mirror of
https://github.com/ONLYOFFICE/sdkjs.git
synced 2026-04-07 14:09:12 +08:00
Добавил методы asc_getSheetViewSettings и asc_setSheetViewSettings
asc_CSheetViewSettings: asc_getShowGridLines asc_getShowRowColHeaders asc_setShowGridLines asc_setShowRowColHeaders Сетка отрисовывается в зависимости от параметра ToDo сделать возможность не отрисовывать заголовки Добавил в меню возможности менять view git-svn-id: svn://192.168.3.15/activex/AVS/Sources/TeamlabOffice/trunk/OfficeWeb@47746 954022d7-b5bf-4e40-9824-e11837661b57
This commit is contained in:
committed by
Alexander.Trofimov
parent
1dccad94d6
commit
b484c77699
@ -1667,6 +1667,8 @@
|
||||
<img class="ToolbarIcon FixedArea" src="menu/img/spacer.gif"/>
|
||||
</div>
|
||||
</li>
|
||||
</ul>
|
||||
<ul class="noListStyle">
|
||||
<li class="ToolbarIconOut selectableIcon" title="Clean fixed area">
|
||||
<div id="td_clean_fixed_area" class="iconToolbar">
|
||||
<img class="ToolbarIcon FixedAreaClean" src="menu/img/spacer.gif"/>
|
||||
@ -1674,6 +1676,21 @@
|
||||
</li>
|
||||
</ul>
|
||||
</td>
|
||||
<td class="cp toolbarSep" style="vertical-align: top; width: 15px;min-width:15px;">
|
||||
<div class="sepMenu ToolbarIconOut" style="position: absolute; background: url('menu/img/sep.png') repeat-y scroll 0pt 0pt transparent; margin-top: -7px; height: 65px; margin-left: 6px;"></div>
|
||||
</td>
|
||||
<td>
|
||||
<ul class="noListStyle">
|
||||
<li class="ToolbarIconOut selectableIcon" title="Show Grid Liines">
|
||||
<input id="showGridLines" type="checkbox" name="showGrid" checked>Show grid
|
||||
</li>
|
||||
</ul>
|
||||
<ul class="noListStyle">
|
||||
<li class="ToolbarIconOut selectableIcon" title="Show Headers">
|
||||
<input id="showHeaders" type="checkbox" name="showHeaders" checked>Show headers
|
||||
</li>
|
||||
</ul>
|
||||
</td>
|
||||
<td class="cp toolbarSep" style="vertical-align: top; width: 15px;min-width:15px;">
|
||||
<div class="sepMenu ToolbarIconOut" style="position: absolute; background: url('menu/img/sep.png') repeat-y scroll 0pt 0pt transparent; margin-top: -7px; height: 65px; margin-left: 6px;"></div>
|
||||
</td>
|
||||
|
||||
10
Excel/api.js
10
Excel/api.js
@ -1915,6 +1915,14 @@ var ASC_DOCS_API_USE_EMBEDDED_FONTS = "@@ASC_DOCS_API_USE_EMBEDDED_FONTS";
|
||||
return this.wb.getWorksheet().getSelectionMergeInfo(options);
|
||||
},
|
||||
|
||||
asc_getSheetViewSettings: function () {
|
||||
return this.wb.getWorksheet().getSheetViewSettings();
|
||||
},
|
||||
|
||||
asc_setSheetViewSettings: function (options) {
|
||||
this.wb.getWorksheet().changeWorksheet("sheetViewSettings", options);
|
||||
},
|
||||
|
||||
// Images & Charts
|
||||
|
||||
asc_drawingObjectsExist: function(chart) {
|
||||
@ -2804,6 +2812,8 @@ var ASC_DOCS_API_USE_EMBEDDED_FONTS = "@@ASC_DOCS_API_USE_EMBEDDED_FONTS";
|
||||
prot["asc_sortCells"] = prot.asc_sortCells;
|
||||
prot["asc_emptyCells"] = prot.asc_emptyCells;
|
||||
prot["asc_mergeCellsDataLost"] = prot.asc_mergeCellsDataLost;
|
||||
prot["asc_getSheetViewSettings"] = prot.asc_getSheetViewSettings;
|
||||
prot["asc_setSheetViewSettings"] = prot.asc_setSheetViewSettings;
|
||||
|
||||
// Auto filters interface
|
||||
prot["asc_addAutoFilter"] = prot.asc_addAutoFilter;
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
$(function () {
|
||||
var IsVisibleMenu = false, elem, contextGrad, gradient, gradSelectPosTop = 1, imgd, pix, colorSelecterClick, newColorSelected={r:255,g:0,b:0},lastColorSelected={r:255,g:0,b:0};
|
||||
var autoFilterObj;
|
||||
var g_sheetViewSettings = null;
|
||||
|
||||
var docTitle = window.location.toString().match(/&title=([^&]+)&/);
|
||||
if (docTitle) {
|
||||
@ -53,6 +54,10 @@
|
||||
onTabClicked( api.asc_getActiveWorksheetIndex() );
|
||||
}
|
||||
|
||||
function onActiveSheetChanged () {
|
||||
updateSheetViewSettings();
|
||||
}
|
||||
|
||||
function showZoomValue() {
|
||||
$("#ws-navigation .ws-zoom-input")
|
||||
.val(Math.round(api.asc_getZoom() * 100) + "%");
|
||||
@ -176,6 +181,12 @@
|
||||
consolelog("onEndAction " + arguments[0] + " " + arguments[1]);
|
||||
}
|
||||
|
||||
function updateSheetViewSettings () {
|
||||
g_sheetViewSettings = api.asc_getSheetViewSettings();
|
||||
$("#showGridLines").attr("checked", g_sheetViewSettings.asc_getShowGridLines());
|
||||
$("#showHeaders").attr("checked", g_sheetViewSettings.asc_getShowRowColHeaders());
|
||||
}
|
||||
|
||||
function onTabNavigationBtnClicked(event) {
|
||||
var btn = $(event.currentTarget),
|
||||
tablist = $("#ws-navigation .tabs"),
|
||||
@ -229,6 +240,7 @@
|
||||
.removeClass("active")
|
||||
.eq(index).addClass("active");
|
||||
api.asc_showWorksheet(index);
|
||||
updateSheetViewSettings();
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -445,6 +457,8 @@
|
||||
|
||||
});
|
||||
api.asc_registerCallback("asc_onSetAFDialog", onSetAFDialog);
|
||||
|
||||
api.asc_registerCallback("asc_onActiveSheetChanged", onActiveSheetChanged);
|
||||
|
||||
api.asc_registerCallback("asc_onConfirmAction", function(){
|
||||
var arg = arguments;
|
||||
@ -1616,6 +1630,14 @@
|
||||
});
|
||||
$("#drawingObjectsLayerMenu").dialog("open");
|
||||
}
|
||||
|
||||
function onChangeView () {
|
||||
var showGridLines = document.getElementById("showGridLines");
|
||||
var showHeaders = document.getElementById("showHeaders");
|
||||
g_sheetViewSettings.asc_setShowGridLines(showGridLines.checked);
|
||||
g_sheetViewSettings.asc_setShowRowColHeaders(showHeaders.checked);
|
||||
api.asc_setSheetViewSettings(g_sheetViewSettings);
|
||||
}
|
||||
|
||||
// Comments
|
||||
|
||||
@ -2579,4 +2601,11 @@
|
||||
api.asc_unGroupGraphicsObjects();
|
||||
}
|
||||
);
|
||||
|
||||
$("#showGridLines").change(function () {
|
||||
onChangeView();
|
||||
});
|
||||
$("#showHeaders").change(function () {
|
||||
onChangeView();
|
||||
});
|
||||
});
|
||||
@ -2146,7 +2146,7 @@ function BinaryWorksheetsTableWriter(memory, wb, oSharedStrings, oDrawings, aDxf
|
||||
if(ws.aCols.length > 0 || null != ws.oAllCol)
|
||||
this.bs.WriteItem(c_oSerWorksheetsTypes.Cols, function(){oThis.WriteWorksheetCols(ws);});
|
||||
|
||||
if (null != ws.sheetViews)
|
||||
if (null !== ws.sheetViews)
|
||||
this.bs.WriteItem(c_oSerWorksheetsTypes.SheetViews, function(){oThis.WriteSheetViews(ws);});
|
||||
|
||||
this.bs.WriteItem(c_oSerWorksheetsTypes.SheetFormatPr, function(){oThis.WriteSheetFormatPr(ws);});
|
||||
@ -2342,15 +2342,15 @@ function BinaryWorksheetsTableWriter(memory, wb, oSharedStrings, oDrawings, aDxf
|
||||
}
|
||||
};
|
||||
this.WriteSheetView = function (oSheetView) {
|
||||
if (undefined !== oSheetView.ShowGridLines) {
|
||||
if (null !== oSheetView.showGridLines) {
|
||||
this.memory.WriteByte(c_oSer_SheetView.ShowGridLines);
|
||||
this.memory.WriteByte(c_oSerPropLenType.Byte);
|
||||
this.memory.WriteBool(oSheetView.ShowGridLines);
|
||||
this.memory.WriteBool(oSheetView.showGridLines);
|
||||
}
|
||||
if (undefined !== oSheetView.ShowRowColHeaders) {
|
||||
if (null !== oSheetView.showRowColHeaders) {
|
||||
this.memory.WriteByte(c_oSer_SheetView.ShowRowColHeaders);
|
||||
this.memory.WriteByte(c_oSerPropLenType.Byte);
|
||||
this.memory.WriteBool(oSheetView.ShowRowColHeaders);
|
||||
this.memory.WriteBool(oSheetView.showRowColHeaders);
|
||||
}
|
||||
};
|
||||
this.WriteSheetFormatPr = function(ws)
|
||||
@ -5706,7 +5706,7 @@ function Binary_WorksheetTableReader(stream, wb, aSharedStrings, aCellXfs, Dxfs,
|
||||
var oSheetView = null;
|
||||
|
||||
if (c_oSerWorksheetsTypes.SheetView === type) {
|
||||
oSheetView = {};
|
||||
oSheetView = new Asc.asc_CSheetViewSettings();
|
||||
res = this.bcr.Read1(length, function (t, l) {
|
||||
return oThis.ReadSheetView(t, l, oSheetView);
|
||||
});
|
||||
@ -5717,9 +5717,9 @@ function Binary_WorksheetTableReader(stream, wb, aSharedStrings, aCellXfs, Dxfs,
|
||||
this.ReadSheetView = function (type, length, oSheetView) {
|
||||
var res = c_oSerConstants.ReadOk;
|
||||
if (c_oSer_SheetView.ShowGridLines === type) {
|
||||
oSheetView.ShowGridLines = this.stream.GetBool();
|
||||
oSheetView.showGridLines = this.stream.GetBool();
|
||||
} else if (c_oSer_SheetView.ShowRowColHeaders === type) {
|
||||
oSheetView.ShowRowColHeaders = this.stream.GetBool();
|
||||
oSheetView.showRowColHeaders = this.stream.GetBool();
|
||||
} else
|
||||
res = c_oSerConstants.ReadUnknown;
|
||||
return res;
|
||||
|
||||
@ -628,6 +628,27 @@
|
||||
this["r2"] = r2;
|
||||
}
|
||||
|
||||
function asc_CSheetViewSettings () {
|
||||
if (!(this instanceof asc_CSheetViewSettings)) {
|
||||
return new asc_CSheetViewSettings();
|
||||
}
|
||||
|
||||
// Показывать ли сетку
|
||||
this.showGridLines = null;
|
||||
// Показывать обозначения строк и столбцов
|
||||
this.showRowColHeaders = null;
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
asc_CSheetViewSettings.prototype = {
|
||||
constructor: asc_CSheetViewSettings,
|
||||
asc_getShowGridLines: function () { return false !== this.showGridLines; },
|
||||
asc_getShowRowColHeaders: function () { return false !== this.showRowColHeaders; },
|
||||
asc_setShowGridLines: function (val) { this.showGridLines = val; },
|
||||
asc_setShowRowColHeaders: function (val) { this.showRowColHeaders = val; }
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Export
|
||||
@ -742,5 +763,12 @@
|
||||
|
||||
window["Asc"].asc_CCollaborativeRange = asc_CCollaborativeRange;
|
||||
|
||||
window["Asc"]["asc_CSheetViewSettings"] = window["Asc"].asc_CSheetViewSettings = asc_CSheetViewSettings;
|
||||
prot = asc_CSheetViewSettings.prototype;
|
||||
prot["asc_getShowGridLines"] = prot.asc_getShowGridLines;
|
||||
prot["asc_getShowRowColHeaders"] = prot.asc_getShowRowColHeaders;
|
||||
prot["asc_setShowGridLines"] = prot.asc_setShowGridLines;
|
||||
prot["asc_setShowRowColHeaders"] = prot.asc_setShowRowColHeaders;
|
||||
|
||||
}
|
||||
)(jQuery, window);
|
||||
|
||||
@ -644,6 +644,13 @@
|
||||
return ct ? $.extend({}, ct.metrics) : undefined;
|
||||
},
|
||||
|
||||
getSheetViewSettings: function () {
|
||||
if (null === this.model.sheetViews || 0 === this.model.sheetViews.length)
|
||||
return new asc.asc_CSheetViewSettings();
|
||||
|
||||
return this.model.sheetViews[0];
|
||||
},
|
||||
|
||||
|
||||
// mouseX - это разница стартовых координат от мыши при нажатии и границы
|
||||
changeColumnWidth: function (col, x2, mouseX) {
|
||||
@ -2176,6 +2183,11 @@
|
||||
|
||||
/** Рисует сетку таблицы */
|
||||
_drawGrid: function (drawingCtx, range, leftFieldInPt, topFieldInPt, width, height) {
|
||||
// Возможно сетку не нужно рисовать (при печати свои проверки)
|
||||
if (undefined === drawingCtx && null !== this.model.sheetViews &&
|
||||
0 < this.model.sheetViews.length && false === this.model.sheetViews[0].asc_getShowGridLines())
|
||||
return;
|
||||
|
||||
if (range === undefined) {
|
||||
range = this.visibleRange;
|
||||
}
|
||||
@ -8270,6 +8282,19 @@
|
||||
}
|
||||
break;
|
||||
|
||||
case "sheetViewSettings":
|
||||
functionModelAction = function () {
|
||||
if (null === t.model.sheetViews)
|
||||
t.model.sheetViews = [];
|
||||
t.model.sheetViews[0] = val;
|
||||
|
||||
isUpdateCols = true;
|
||||
isUpdateRows = true;
|
||||
fullRecalc = false;
|
||||
};
|
||||
|
||||
return this._isLockedAll (onChangeWorksheetCallback);
|
||||
|
||||
case "update":
|
||||
if (val !== undefined) {
|
||||
fullRecalc = !!val.fullRecalc;
|
||||
|
||||
Reference in New Issue
Block a user