Commit ff7e2d0c authored by Alexander.Trofimov's avatar Alexander.Trofimov Committed by Alexander.Trofimov

Добавил функцию копирование по образцу - asc_formatPainter

git-svn-id: svn://192.168.3.15/activex/AVS/Sources/TeamlabOffice/trunk/OfficeWeb@54808 954022d7-b5bf-4e40-9824-e11837661b57
parent ffb15b34
...@@ -2886,9 +2886,9 @@ var ASC_DOCS_API_USE_EMBEDDED_FONTS = "@@ASC_DOCS_API_USE_EMBEDDED_FONTS"; ...@@ -2886,9 +2886,9 @@ var ASC_DOCS_API_USE_EMBEDDED_FONTS = "@@ASC_DOCS_API_USE_EMBEDDED_FONTS";
// Увеличение размера шрифта // Увеличение размера шрифта
asc_increaseFontSize: function () { asc_increaseFontSize: function () {
var ws = this.wb.getWorksheet(); var ws = this.wb.getWorksheet();
if ( ws.objectRender.selectedGraphicObjectsExists() && ws.objectRender.controller.increaseFontSize ) if (ws.objectRender.selectedGraphicObjectsExists() && ws.objectRender.controller.increaseFontSize)
ws.objectRender.controller.increaseFontSize(); ws.objectRender.controller.increaseFontSize();
else{ else {
this.wb.changeFontSize("changeFontSize", true); this.wb.changeFontSize("changeFontSize", true);
this.wb.restoreFocus(); this.wb.restoreFocus();
} }
...@@ -2897,14 +2897,19 @@ var ASC_DOCS_API_USE_EMBEDDED_FONTS = "@@ASC_DOCS_API_USE_EMBEDDED_FONTS"; ...@@ -2897,14 +2897,19 @@ var ASC_DOCS_API_USE_EMBEDDED_FONTS = "@@ASC_DOCS_API_USE_EMBEDDED_FONTS";
// Уменьшение размера шрифта // Уменьшение размера шрифта
asc_decreaseFontSize: function () { asc_decreaseFontSize: function () {
var ws = this.wb.getWorksheet(); var ws = this.wb.getWorksheet();
if ( ws.objectRender.selectedGraphicObjectsExists() && ws.objectRender.controller.decreaseFontSize ) if (ws.objectRender.selectedGraphicObjectsExists() && ws.objectRender.controller.decreaseFontSize)
ws.objectRender.controller.decreaseFontSize(); ws.objectRender.controller.decreaseFontSize();
else{ else {
this.wb.changeFontSize("changeFontSize", false); this.wb.changeFontSize("changeFontSize", false);
this.wb.restoreFocus(); this.wb.restoreFocus();
} }
}, },
// Формат по образцу
asc_formatPainter: function () {
this.wb.getWorksheet().formatPainter();
},
asc_onMouseUp: function (x, y) { asc_onMouseUp: function (x, y) {
this.controller._onWindowMouseUpExternal(x, y); this.controller._onWindowMouseUpExternal(x, y);
}, },
...@@ -3699,6 +3704,7 @@ var ASC_DOCS_API_USE_EMBEDDED_FONTS = "@@ASC_DOCS_API_USE_EMBEDDED_FONTS"; ...@@ -3699,6 +3704,7 @@ var ASC_DOCS_API_USE_EMBEDDED_FONTS = "@@ASC_DOCS_API_USE_EMBEDDED_FONTS";
prot["asc_decreaseCellDigitNumbers"] = prot.asc_decreaseCellDigitNumbers; prot["asc_decreaseCellDigitNumbers"] = prot.asc_decreaseCellDigitNumbers;
prot["asc_increaseFontSize"] = prot.asc_increaseFontSize; prot["asc_increaseFontSize"] = prot.asc_increaseFontSize;
prot["asc_decreaseFontSize"] = prot.asc_decreaseFontSize; prot["asc_decreaseFontSize"] = prot.asc_decreaseFontSize;
prot["asc_formatPainter"] = prot.asc_formatPainter;
prot["asc_onMouseUp"] = prot.asc_onMouseUp; prot["asc_onMouseUp"] = prot.asc_onMouseUp;
prot["asc_mapAscServerErrorToAscError"] = prot.asc_mapAscServerErrorToAscError; prot["asc_mapAscServerErrorToAscError"] = prot.asc_mapAscServerErrorToAscError;
......
...@@ -726,6 +726,7 @@ ...@@ -726,6 +726,7 @@
// http://bugzserver/show_bug.cgi?id=14631 - наш баг на редактор // http://bugzserver/show_bug.cgi?id=14631 - наш баг на редактор
// Перехватим Esc и отключим дефалтовую обработку // Перехватим Esc и отключим дефалтовую обработку
stop(); stop();
t.handlers.trigger("stopFormatPainter");
return t.__retval; return t.__retval;
case 144: //Num Lock case 144: //Num Lock
......
...@@ -239,6 +239,7 @@ ...@@ -239,6 +239,7 @@
"commentCellClick": function () {self._onCommentCellClick.apply(self, arguments);}, "commentCellClick": function () {self._onCommentCellClick.apply(self, arguments);},
"isGlobalLockEditCell": function () {return self.collaborativeEditing.getGlobalLockEditCell();}, "isGlobalLockEditCell": function () {return self.collaborativeEditing.getGlobalLockEditCell();},
"updateSelectionName": function () {self._onUpdateSelectionName.apply(self, arguments);}, "updateSelectionName": function () {self._onUpdateSelectionName.apply(self, arguments);},
"stopFormatPainter": function () {self._onStopFormatPainter.apply(self, arguments);},
// Shapes // Shapes
"graphicObjectMouseDown": function () {self._onGraphicObjectMouseDown.apply(self, arguments);}, "graphicObjectMouseDown": function () {self._onGraphicObjectMouseDown.apply(self, arguments);},
...@@ -779,6 +780,12 @@ ...@@ -779,6 +780,12 @@
} }
}; };
WorkbookView.prototype._onStopFormatPainter = function () {
var ws = this.getWorksheet();
if (ws.isFormatPainter)
ws.formatPainter();
};
// Shapes // Shapes
WorkbookView.prototype._onGraphicObjectMouseDown = function (e, x, y) { WorkbookView.prototype._onGraphicObjectMouseDown = function (e, x, y) {
var ws = this.getWorksheet(); var ws = this.getWorksheet();
......
...@@ -95,18 +95,6 @@ ...@@ -95,18 +95,6 @@
var kCurSEResize = "se-resize"; var kCurSEResize = "se-resize";
var kCurNEResize = "ne-resize"; var kCurNEResize = "ne-resize";
/**
* cell border id
* @const
*/
var kcbidLeft = 1;
var kcbidRight = 2;
var kcbidTop = 3;
var kcbidBottom = 4;
var kcbidDiagonal = 5;
var kcbidDiagonalDown = 6;
var kcbidDiagonalUp = 7;
var kNewLine = "\n"; var kNewLine = "\n";
var kPaneStateFrozen = "frozen"; var kPaneStateFrozen = "frozen";
...@@ -345,6 +333,8 @@ ...@@ -345,6 +333,8 @@
this.lockDraw = false; this.lockDraw = false;
this.isSelectOnShape = false; // Выделен shape this.isSelectOnShape = false; // Выделен shape
this.isFormatPainter = false;
this.isSelectionDialogMode = false; this.isSelectionDialogMode = false;
this.copyOfActiveRange = null; this.copyOfActiveRange = null;
...@@ -3334,6 +3324,8 @@ ...@@ -3334,6 +3324,8 @@
if (!isFrozen && this.isSelectionDialogMode) { if (!isFrozen && this.isSelectionDialogMode) {
this._drawSelectRange(this.activeRange.clone(true)); this._drawSelectRange(this.activeRange.clone(true));
} }
if (!isFrozen && this.isFormatPainter)
this._drawFormatPainterRange();
if (null !== this.activeMoveRange) { if (null !== this.activeMoveRange) {
ctx.setStrokeStyle(new CColor(0, 0, 0)) ctx.setStrokeStyle(new CColor(0, 0, 0))
...@@ -3367,6 +3359,11 @@ ...@@ -3367,6 +3359,11 @@
} }
}; };
WorksheetView.prototype._drawFormatPainterRange = function () {
var lineWidth = 1, isDashLine = true, strokeColor = new CColor(0, 0, 0);
this._drawElements(this, this._drawSelectionElement, this.copyOfActiveRange, isDashLine, lineWidth, strokeColor);
};
WorksheetView.prototype._drawFormulaRanges = function (arrRanges){ WorksheetView.prototype._drawFormulaRanges = function (arrRanges){
var lineWidth = 1, isDashLine = false, var lineWidth = 1, isDashLine = false,
opt = this.settings, lengthColors = opt.formulaRangeBorderColor.length; opt = this.settings, lengthColors = opt.formulaRangeBorderColor.length;
...@@ -6332,6 +6329,8 @@ ...@@ -6332,6 +6329,8 @@
} else { } else {
// Нормализуем range // Нормализуем range
this.activeRange.normalize(); this.activeRange.normalize();
if (this.isFormatPainter)
this.applyFormatPainter();
} }
}; };
...@@ -6365,6 +6364,36 @@ ...@@ -6365,6 +6364,36 @@
// ----- Changing cells ----- // ----- Changing cells -----
WorksheetView.prototype.applyFormatPainter = function () {
var t = this;
var onApplyMoveRangeHandleCallback = function (isSuccess) {
// Очищаем выделение
t.cleanSelection();
if (true === isSuccess)
t._getRange(0, 0, 0, 0).promoteFromTo(t.copyOfActiveRange, t.activeRange);
// Сбрасываем параметры
t._updateCellsRange(t.activeRange, /*canChangeColWidth*/c_oAscCanChangeColWidth.none);
t.formatPainter();
// Перерисовываем
t._drawSelection();
};
this._isLockedCells (this.activeRange, null, onApplyMoveRangeHandleCallback);
};
WorksheetView.prototype.formatPainter = function () {
this.isFormatPainter = !this.isFormatPainter;
if (this.isFormatPainter) {
this.copyOfActiveRange = this.activeRange.clone(true);
this._drawFormatPainterRange();
} else {
this.cleanSelection();
this.copyOfActiveRange = null;
this._drawSelection();
}
};
/* Функция для работы автозаполнения (selection). (x, y) - координаты точки мыши на области */ /* Функция для работы автозаполнения (selection). (x, y) - координаты точки мыши на области */
WorksheetView.prototype.changeSelectionFillHandle = function (x, y) { WorksheetView.prototype.changeSelectionFillHandle = function (x, y) {
// Возвращаемый результат // Возвращаемый результат
...@@ -7092,15 +7121,13 @@ ...@@ -7092,15 +7121,13 @@
t.cleanSelection(); t.cleanSelection();
t._drawSelection(); t._drawSelection();
return false; return false;
} } else if( resmove == -1 ){
else if( resmove == -1 ){
t.model.workbook.handlers.trigger("asc_onConfirmAction", t.model.workbook.handlers.trigger("asc_onConfirmAction",
c_oAscConfirm.ConfirmReplaceRange, c_oAscConfirm.ConfirmReplaceRange,
function(can){t.moveRangeHandle(arnFrom, arnTo, can, ctrlKey)} function(can){t.moveRangeHandle(arnFrom, arnTo, can, ctrlKey)}
); );
} } else {
else{
t.moveRangeHandle(arnFrom, arnTo, true, ctrlKey) t.moveRangeHandle(arnFrom, arnTo, true, ctrlKey)
} }
......
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