Commit 9da52a8c authored by Alexander.Trofimov's avatar Alexander.Trofimov Committed by Alexander.Trofimov

Добавил asc_onEditorSelectionChanged(asc_CFont) - эвент на смену информации о...

Добавил asc_onEditorSelectionChanged(asc_CFont) - эвент на смену информации о выделении в редакторе ячейки

git-svn-id: svn://192.168.3.15/activex/AVS/Sources/TeamlabOffice/trunk/OfficeWeb@57943 954022d7-b5bf-4e40-9824-e11837661b57
parent 0c5c3793
...@@ -1178,6 +1178,7 @@ var ASC_DOCS_API_USE_EMBEDDED_FONTS = "@@ASC_DOCS_API_USE_EMBEDDED_FONTS"; ...@@ -1178,6 +1178,7 @@ var ASC_DOCS_API_USE_EMBEDDED_FONTS = "@@ASC_DOCS_API_USE_EMBEDDED_FONTS";
* asc_onAdvancedOptions (asc_CAdvancedOptions, ascAdvancedOptionsAction) - эвент на получение дополнительных опций (открытие/сохранение CSV) * asc_onAdvancedOptions (asc_CAdvancedOptions, ascAdvancedOptionsAction) - эвент на получение дополнительных опций (открытие/сохранение CSV)
* asc_onError (c_oAscError.ID, c_oAscError.Level) - эвент об ошибке * asc_onError (c_oAscError.ID, c_oAscError.Level) - эвент об ошибке
* asc_onEditCell (c_oAscCellEditorState) - эвент на редактирование ячейки с состоянием (переходами из формулы и обратно) * asc_onEditCell (c_oAscCellEditorState) - эвент на редактирование ячейки с состоянием (переходами из формулы и обратно)
* asc_onEditorSelectionChanged (asc_CFont) - эвент на смену информации о выделении в редакторе ячейки
* asc_onSelectionChanged (asc_CCellInfo) - эвент на смену информации о выделении * asc_onSelectionChanged (asc_CCellInfo) - эвент на смену информации о выделении
* asc_onSelectionNameChanged (sName) - эвент на смену имени выделения (Id-ячейки, число выделенных столбцов/строк, имя диаграммы и др.) * asc_onSelectionNameChanged (sName) - эвент на смену имени выделения (Id-ячейки, число выделенных столбцов/строк, имя диаграммы и др.)
* asc_onSelectionMathChanged (asc_CSelectionMathInfo) - эвент на смену математической информации о выделении * asc_onSelectionMathChanged (asc_CSelectionMathInfo) - эвент на смену математической информации о выделении
......
...@@ -262,6 +262,7 @@ ...@@ -262,6 +262,7 @@
*/ */
this.setFocus(this.isTopLineActive ? true : (undefined !== options.focus) ? options.focus : this._haveTextInEdit() ? true : false); this.setFocus(this.isTopLineActive ? true : (undefined !== options.focus) ? options.focus : this._haveTextInEdit() ? true : false);
this._updateUndoRedoChanged(); this._updateUndoRedoChanged();
this._updateSelectionInfo();
}; };
CellEditor.prototype.close = function (saveValue) { CellEditor.prototype.close = function (saveValue) {
...@@ -305,7 +306,6 @@ ...@@ -305,7 +306,6 @@
var t = this, opt = t.options, begin, end, i, first, last; var t = this, opt = t.options, begin, end, i, first, last;
if (t.selectionBegin !== t.selectionEnd) { if (t.selectionBegin !== t.selectionEnd) {
begin = Math.min(t.selectionBegin, t.selectionEnd); begin = Math.min(t.selectionBegin, t.selectionEnd);
end = Math.max(t.selectionBegin, t.selectionEnd); end = Math.max(t.selectionBegin, t.selectionEnd);
...@@ -342,7 +342,6 @@ ...@@ -342,7 +342,6 @@
} }
} else { } else {
first = t._findFragmentToInsertInto(t.cursorPos); first = t._findFragmentToInsertInto(t.cursorPos);
if (first) { if (first) {
if (!t.newTextFormat) { if (!t.newTextFormat) {
...@@ -352,6 +351,8 @@ ...@@ -352,6 +351,8 @@
} }
} }
this._updateSelectionInfo();
}; };
CellEditor.prototype.empty = function(options) { CellEditor.prototype.empty = function(options) {
...@@ -1642,6 +1643,25 @@ ...@@ -1642,6 +1643,25 @@
return this.objAutoComplete[str] = arrResult; return this.objAutoComplete[str] = arrResult;
}; };
CellEditor.prototype._updateSelectionInfo = function () {
var tmp = Math.min(this.selectionBegin, this.selectionEnd);
tmp = this._findFragment(tmp);
tmp = this.options.fragments[tmp].format;
var result = new asc.asc_CFont();
result.name = tmp.fn;
result.size = tmp.fs;
result.bold = tmp.b;
result.italic = tmp.i;
result.underline = (Asc.EUnderline.underlineNone !== tmp.u); // ToDo убрать, когда будет реализовано двойное подчеркивание
result.strikeout = tmp.s;
result.subscript = tmp.va === "subscript";
result.superscript = tmp.va === "superscript";
result.color = (tmp.c ? asc.colorObjToAscColor(tmp.c) : new CAscColor(this.options.textColor));
this.handlers.trigger("updateEditorSelectionInfo", result);
};
// Event handlers // Event handlers
/** @param event {KeyboardEvent} */ /** @param event {KeyboardEvent} */
......
...@@ -356,44 +356,42 @@ ...@@ -356,44 +356,42 @@
}, false); }, false);
} }
this.cellEditor = new asc.CellEditor(this.element, this.input, this.fmgrGraphics, this.m_oFont, this.cellEditor = new asc.CellEditor(this.element, this.input, this.fmgrGraphics, this.m_oFont,
/*handlers*/{ /*handlers*/{
"closed" : function () {self._onCloseCellEditor.apply(self, arguments);}, "closed" : function () {self._onCloseCellEditor.apply(self, arguments);},
"updated" : function () {self._onUpdateCellEditor.apply(self, arguments);}, "updated" : function () {self._onUpdateCellEditor.apply(self, arguments);},
"gotFocus" : function (hasFocus) {self.controller.setFocus(!hasFocus);}, "gotFocus" : function (hasFocus) {self.controller.setFocus(!hasFocus);},
"copy" : function () {self.copyToClipboard.apply(self, arguments);}, "copy" : function () {self.copyToClipboard.apply(self, arguments);},
"paste" : function () {self.pasteFromClipboard.apply(self, arguments);}, "paste" : function () {self.pasteFromClipboard.apply(self, arguments);},
"cut" : function () {self.cutToClipboard.apply(self, arguments);}, "cut" : function () {self.cutToClipboard.apply(self, arguments);},
"updateFormulaEditMod": function () { "updateFormulaEditMod": function () {
self.controller.setFormulaEditMode.apply(self.controller, arguments); self.controller.setFormulaEditMode.apply(self.controller, arguments);
var ws = self.getWorksheet(); var ws = self.getWorksheet();
if (ws) { if (ws) {
ws.cleanSelection(); ws.cleanSelection();
ws.cleanFormulaRanges(); ws.cleanFormulaRanges();
ws.setFormulaEditMode.apply(ws, arguments); ws.setFormulaEditMode.apply(ws, arguments);
} }
}, },
"updateEditorState" : function () {self.handlers.trigger.apply(self.handlers, "updateEditorState" : function (state) {self.handlers.trigger("asc_onEditCell", state);},
["asc_onEditCell"].concat(Array.prototype.slice.call(arguments)));}, "isGlobalLockEditCell" : function () {return self.collaborativeEditing.getGlobalLockEditCell();},
"isGlobalLockEditCell" : function () {return self.collaborativeEditing.getGlobalLockEditCell();}, "updateFormulaEditModEnd" : function (rangeUpdated) {self.getWorksheet().updateSelection();},
"updateFormulaEditModEnd": function (rangeUpdated) { "newRange" : function (range) { self.getWorksheet().addFormulaRange(range); },
self.getWorksheet().updateSelection(); "existedRange" : function (range) { self.getWorksheet().changeFormulaRange(range); },
}, "updateUndoRedoChanged" : function (bCanUndo, bCanRedo) {
"newRange" : function (range) { self.getWorksheet().addFormulaRange(range); }, self.handlers.trigger("asc_onCanUndoChanged", bCanUndo);
"existedRange" : function (range) { self.getWorksheet().changeFormulaRange(range); }, self.handlers.trigger("asc_onCanRedoChanged", bCanRedo);
"updateUndoRedoChanged" : function (bCanUndo, bCanRedo) { },
self.handlers.trigger("asc_onCanUndoChanged", bCanUndo); "applyCloseEvent" : function () {self.controller._onWindowKeyDown.apply(self.controller, arguments);},
self.handlers.trigger("asc_onCanRedoChanged", bCanRedo); "isViewerMode" : function () {return self.controller.settings.isViewerMode;},
}, "popUpSelectorKeyDown" : function (event) {return self._onPopUpSelectorKeyDown(event);},
"applyCloseEvent" : function () {self.controller._onWindowKeyDown.apply(self.controller, arguments);}, "getFormulaRanges" : function () {return self.getWorksheet().getFormulaRanges();},
"isViewerMode" : function () {return self.controller.settings.isViewerMode;}, "setStrictClose" : function (val) {self.controller.setStrictClose(val);},
"popUpSelectorKeyDown" : function (event) {return self._onPopUpSelectorKeyDown(event);}, "updateEditorSelectionInfo" : function (info) {self.handlers.trigger("asc_onEditorSelectionChanged", info);}
"getFormulaRanges" : function () {return self.getWorksheet().getFormulaRanges();}, },
"setStrictClose" : function (val) {self.controller.setStrictClose(val);} /*settings*/{
}, font: this.defaultFont
/*settings*/{ });
font: this.defaultFont
});
this.popUpSelector = new asc.PopUpSelector(this.element, /*handlers*/{ this.popUpSelector = new asc.PopUpSelector(this.element, /*handlers*/{
"insert" : function () {self._onPopUpSelectorInsert.apply(self, arguments);} "insert" : function () {self._onPopUpSelectorInsert.apply(self, arguments);}
......
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