Commit 9255e781 authored by Alexander.Trofimov's avatar Alexander.Trofimov Committed by Alexander.Trofimov

Реализовал Increase/Decrease font size

git-svn-id: svn://192.168.3.15/activex/AVS/Sources/TeamlabOffice/trunk/OfficeWeb@47876 954022d7-b5bf-4e40-9824-e11837661b57
parent cca32173
...@@ -1378,7 +1378,7 @@ ...@@ -1378,7 +1378,7 @@
<ul id="textMenu"> <ul id="textMenu">
<li id="fontSelect" class="item main textSelect textSelectBoard ToolbarIconOut" value="Arial"> <li id="fontSelect" class="item main textSelect textSelectBoard ToolbarIconOut" value="Arial">
<span id="fontSelectVal">Arial</span> <span id="fontSelectVal">Arial</span>
<ul style="width: 250px; height: 250px;overflow-y: scroll;"> <ul style="width: 220px; height: 220px;overflow-y: scroll;">
<li id="Arial" class="SubItem" style="font-family:Arial;" value="Arial">Arial</li> <li id="Arial" class="SubItem" style="font-family:Arial;" value="Arial">Arial</li>
<li id="ArialBlack" class="SubItem" value="Arial Black" style="font-family:Arial Black;">Arial Black</li> <li id="ArialBlack" class="SubItem" value="Arial Black" style="font-family:Arial Black;">Arial Black</li>
<li id="ArialCyr" class="SubItem" value="Arial Cyr" style="font-family:Arial Cyr;">Arial Cyr</li> <li id="ArialCyr" class="SubItem" value="Arial Cyr" style="font-family:Arial Cyr;">Arial Cyr</li>
...@@ -1454,7 +1454,7 @@ ...@@ -1454,7 +1454,7 @@
<div class="ToolbarDropDown"></div> <div class="ToolbarDropDown"></div>
</div> </div>
</li> </li>
<li id="td_TextColor" class="ToolbarIconOut selectableIcon iconToolbar" title="TextColor"> <li id="td_TextColor" class="ToolbarIconOut selectableIcon iconToolbar" title="TextColor" style="padding-right: 15px;">
<div class="ToolbarButtonCaption clrSelector2"> <div class="ToolbarButtonCaption clrSelector2">
<div class="ToolbarColorIndicator2"> <div class="ToolbarColorIndicator2">
<div class="toolbarImg txt_color"></div> <div class="toolbarImg txt_color"></div>
...@@ -1464,6 +1464,17 @@ ...@@ -1464,6 +1464,17 @@
<div class="ToolbarDropDown"></div> <div class="ToolbarDropDown"></div>
</div> </div>
</li> </li>
<li class="toolbarSep">
<div class="ToolbarIconOut">
<img src="menu/img/Border.png"/>
</div>
</li>
<li id="tdIncreaseFontSize" class="ToolbarIconOut selectableIcon iconToolbar" title="Increase FontSize">
<img class="toolbarImg incFS" src="menu/img/spacer.gif"/>
</li>
<li id="tdDecreaseFontSize" class="ToolbarIconOut selectableIcon iconToolbar" title="Decrease FontSize">
<img class="toolbarImg decFS" src="menu/img/spacer.gif"/>
</li>
</ul> </ul>
</td> </td>
<td class="cp toolbarSep" style="vertical-align: top; width: 15px;min-width:15px;"> <td class="cp toolbarSep" style="vertical-align: top; width: 15px;min-width:15px;">
......
...@@ -2245,12 +2245,16 @@ var ASC_DOCS_API_USE_EMBEDDED_FONTS = "@@ASC_DOCS_API_USE_EMBEDDED_FONTS"; ...@@ -2245,12 +2245,16 @@ var ASC_DOCS_API_USE_EMBEDDED_FONTS = "@@ASC_DOCS_API_USE_EMBEDDED_FONTS";
this.wb.restoreFocus(); this.wb.restoreFocus();
}, },
// Увеличение размера шрифта
asc_increaseFontSize: function () { asc_increaseFontSize: function () {
// ToDo add code here this.wb.changeFontSize("changeFontSize", true);
this.wb.restoreFocus();
}, },
// Уменьшение размера шрифта
asc_decreaseFontSize: function () { asc_decreaseFontSize: function () {
// ToDo add code here this.wb.changeFontSize("changeFontSize", false);
this.wb.restoreFocus();
}, },
asc_onMouseUp: function (x, y) { asc_onMouseUp: function (x, y) {
......
...@@ -888,6 +888,12 @@ ...@@ -888,6 +888,12 @@
} }
} }
}); });
$("#tdIncreaseFontSize").click(function () {
api.asc_increaseFontSize();
});
$("#tdDecreaseFontSize").click(function () {
api.asc_decreaseFontSize();
});
$(".selectable").bind("mouseover", function() {if ($(this).hasClass("noselectable")) return; $(this).addClass("iconHover"); }); $(".selectable").bind("mouseover", function() {if ($(this).hasClass("noselectable")) return; $(this).addClass("iconHover"); });
$(".selectable").bind("mouseout", function() { $(this).removeClass("iconHover"); }); $(".selectable").bind("mouseout", function() { $(this).removeClass("iconHover"); });
$(".clrPicker1").mousedown(function(){ $(".clrPicker1").mousedown(function(){
......
...@@ -35,8 +35,8 @@ ...@@ -35,8 +35,8 @@
#fontSelect #fontSelect
{ {
min-width: 250px; min-width: 220px;
width: 250px; width: 220px;
height: 26px; height: 26px;
} }
......
...@@ -65,6 +65,8 @@ p{ margin: 2px; padding: 2px; vertical-align:top;} ...@@ -65,6 +65,8 @@ p{ margin: 2px; padding: 2px; vertical-align:top;}
.drop_down{background-position: -66px 0px;width: 5px;height: 3px; margin-left: 1px; margin-right: 1px;margin-top: 10px;} .drop_down{background-position: -66px 0px;width: 5px;height: 3px; margin-left: 1px; margin-right: 1px;margin-top: 10px;}
.bg_fill{background-position: -544px 50%; width: 16px; height: 14px;} .bg_fill{background-position: -544px 50%; width: 16px; height: 14px;}
.txt_color{background-position: -161px 50%; width: 16px; height: 14px;} .txt_color{background-position: -161px 50%; width: 16px; height: 14px;}
.incFS {background-position: -1397px 50%;width: 15px;height: 15px; margin-left: 5px; margin-top: 3px;}
.decFS {background-position: -1382px 50%;width: 15px;height: 15px; margin-left: 5px; margin-top: 3px;}
.MenubarBGColor{background-position: -544px 50%;} .MenubarBGColor{background-position: -544px 50%;}
.MenubarFontColor{background-position: -161px 50%;} .MenubarFontColor{background-position: -161px 50%;}
.cell_border{background-position: 0px -27px; width: 13px; height: 13px; margin-left: 5px; margin-top: 5px;} .cell_border{background-position: 0px -27px; width: 13px; height: 13px; margin-left: 5px; margin-top: 5px;}
......
...@@ -95,6 +95,32 @@ ...@@ -95,6 +95,32 @@
//return Math.ceil(x); //return Math.ceil(x);
} }
function incDecFonSize (bIncrease, oValue) {
// Закон изменения размеров :
// Результатом должно быть ближайшее из отрезка [8,72] по следующим числам 8,9,10,11,12,14,16,18,20,22,24,26,28,36,48,72
// Если значение меньше или равно 8 и мы уменьшаем, то ничего не меняется
// Если значение больше или равно 72 и мы увеличиваем, то ничего не меняется
var aSizes = [8,9,10,11,12,14,16,18,20,22,24,26,28,36,48,72];
var nLength = aSizes.length;
var i;
if (true === bIncrease) {
if (oValue >= aSizes[nLength - 1])
return null;
for (i = 0; i < nLength; ++i)
if (aSizes[i] > oValue)
break;
} else {
if (oValue <= aSizes[0])
return null;
for (i = nLength - 1; i >= 0; --i)
if (aSizes[i] < oValue)
break;
}
return aSizes[i];
}
function inherit(child, parent, childProto) { function inherit(child, parent, childProto) {
parent.prototype.constructor = parent; parent.prototype.constructor = parent;
...@@ -803,6 +829,7 @@ ...@@ -803,6 +829,7 @@
window["Asc"].round = round; window["Asc"].round = round;
window["Asc"].floor = floor; window["Asc"].floor = floor;
window["Asc"].ceil = ceil; window["Asc"].ceil = ceil;
window["Asc"].incDecFonSize = incDecFonSize;
window["Asc"].inherit = inherit; window["Asc"].inherit = inherit;
window["Asc"].outputDebugStr = outputDebugStr; window["Asc"].outputDebugStr = outputDebugStr;
window["Asc"].isEqual = isEqual; window["Asc"].isEqual = isEqual;
......
...@@ -1315,6 +1315,14 @@ ...@@ -1315,6 +1315,14 @@
} }
}, },
changeFontSize: function (prop, val) {
if (!this.controller.isCellEditMode) {
this.getWorksheet().setSelectionInfo(prop, val);
} else {
//ToDo this.cellEditor.setTextStyle(prop, val);
}
},
emptyCells: function(options) { emptyCells: function(options) {
if (!this.controller.isCellEditMode) { if (!this.controller.isCellEditMode) {
this.getWorksheet().setSelectionInfo("empty", options); this.getWorksheet().setSelectionInfo("empty", options);
......
...@@ -26,6 +26,7 @@ ...@@ -26,6 +26,7 @@
var asc_n2Color = asc.numberToAscColor; var asc_n2Color = asc.numberToAscColor;
var asc_obj2Color = asc.colorObjToAscColor; var asc_obj2Color = asc.colorObjToAscColor;
var asc_typeof = asc.typeOf; var asc_typeof = asc.typeOf;
var asc_incDecFonSize = asc.incDecFonSize;
var asc_debug = asc.outputDebugStr; var asc_debug = asc.outputDebugStr;
var asc_Range = asc.Range; var asc_Range = asc.Range;
var asc_FP = asc.FontProperties; var asc_FP = asc.FontProperties;
...@@ -6990,6 +6991,7 @@ ...@@ -6990,6 +6991,7 @@
var isLargeRange = t._isLargeRange(range), callTrigger = false; var isLargeRange = t._isLargeRange(range), callTrigger = false;
var res, flag; var res, flag;
var mc, r, c, cell;
function makeBorder(b) { function makeBorder(b) {
var border = {}; var border = {};
...@@ -7107,6 +7109,20 @@ ...@@ -7107,6 +7109,20 @@
range.shiftNumFormat(val, res); range.shiftNumFormat(val, res);
canChangeColWidth = c_oAscCanChangeColWidth.numbers; canChangeColWidth = c_oAscCanChangeColWidth.numbers;
break; break;
case "changeFontSize":
mc = t._getMergedCellsRange(arn.startCol, arn.startRow);
c = mc ? mc.c1 : arn.startCol;
r = mc ? mc.r1 : arn.startRow;
cell = t._getVisibleCell(c, r);
if (undefined !== cell) {
var oldFontSize = cell.getFontsize();
var newFontSize = asc_incDecFonSize(val, oldFontSize);
if (null !== newFontSize) {
range.setFontsize(newFontSize);
canChangeColWidth = c_oAscCanChangeColWidth.numbers;
}
}
break;
case "paste": case "paste":
var pasteExec = function() var pasteExec = function()
{ {
...@@ -7230,9 +7246,9 @@ ...@@ -7230,9 +7246,9 @@
newHyperlink.Tooltip = val.asc_getTooltip(); newHyperlink.Tooltip = val.asc_getTooltip();
range.setHyperlink(newHyperlink); range.setHyperlink(newHyperlink);
// Вставим текст в активную ячейку (а не так, как MSExcel в первую ячейку диапазона) // Вставим текст в активную ячейку (а не так, как MSExcel в первую ячейку диапазона)
var mc = t._getMergedCellsRange(arn.startCol, arn.startRow); mc = t._getMergedCellsRange(arn.startCol, arn.startRow);
var c = mc ? mc.c1 : arn.startCol; c = mc ? mc.c1 : arn.startCol;
var r = mc ? mc.r1 : arn.startRow; r = mc ? mc.r1 : arn.startRow;
if (null !== val.asc_getText()) { if (null !== val.asc_getText()) {
t.model.getRange3(r, c, r, c) t.model.getRange3(r, c, r, c)
.setValue(val.asc_getText()); .setValue(val.asc_getText());
......
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