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

Добавил методы 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
parent 1dccad94
...@@ -1667,6 +1667,8 @@ ...@@ -1667,6 +1667,8 @@
<img class="ToolbarIcon FixedArea" src="menu/img/spacer.gif"/> <img class="ToolbarIcon FixedArea" src="menu/img/spacer.gif"/>
</div> </div>
</li> </li>
</ul>
<ul class="noListStyle">
<li class="ToolbarIconOut selectableIcon" title="Clean fixed area"> <li class="ToolbarIconOut selectableIcon" title="Clean fixed area">
<div id="td_clean_fixed_area" class="iconToolbar"> <div id="td_clean_fixed_area" class="iconToolbar">
<img class="ToolbarIcon FixedAreaClean" src="menu/img/spacer.gif"/> <img class="ToolbarIcon FixedAreaClean" src="menu/img/spacer.gif"/>
...@@ -1674,6 +1676,21 @@ ...@@ -1674,6 +1676,21 @@
</li> </li>
</ul> </ul>
</td> </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;"> <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> <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>
......
...@@ -1915,6 +1915,14 @@ var ASC_DOCS_API_USE_EMBEDDED_FONTS = "@@ASC_DOCS_API_USE_EMBEDDED_FONTS"; ...@@ -1915,6 +1915,14 @@ var ASC_DOCS_API_USE_EMBEDDED_FONTS = "@@ASC_DOCS_API_USE_EMBEDDED_FONTS";
return this.wb.getWorksheet().getSelectionMergeInfo(options); 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 // Images & Charts
asc_drawingObjectsExist: function(chart) { asc_drawingObjectsExist: function(chart) {
...@@ -2804,6 +2812,8 @@ var ASC_DOCS_API_USE_EMBEDDED_FONTS = "@@ASC_DOCS_API_USE_EMBEDDED_FONTS"; ...@@ -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_sortCells"] = prot.asc_sortCells;
prot["asc_emptyCells"] = prot.asc_emptyCells; prot["asc_emptyCells"] = prot.asc_emptyCells;
prot["asc_mergeCellsDataLost"] = prot.asc_mergeCellsDataLost; prot["asc_mergeCellsDataLost"] = prot.asc_mergeCellsDataLost;
prot["asc_getSheetViewSettings"] = prot.asc_getSheetViewSettings;
prot["asc_setSheetViewSettings"] = prot.asc_setSheetViewSettings;
// Auto filters interface // Auto filters interface
prot["asc_addAutoFilter"] = prot.asc_addAutoFilter; prot["asc_addAutoFilter"] = prot.asc_addAutoFilter;
......
$(function () { $(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 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 autoFilterObj;
var g_sheetViewSettings = null;
var docTitle = window.location.toString().match(/&title=([^&]+)&/); var docTitle = window.location.toString().match(/&title=([^&]+)&/);
if (docTitle) { if (docTitle) {
...@@ -53,6 +54,10 @@ ...@@ -53,6 +54,10 @@
onTabClicked( api.asc_getActiveWorksheetIndex() ); onTabClicked( api.asc_getActiveWorksheetIndex() );
} }
function onActiveSheetChanged () {
updateSheetViewSettings();
}
function showZoomValue() { function showZoomValue() {
$("#ws-navigation .ws-zoom-input") $("#ws-navigation .ws-zoom-input")
.val(Math.round(api.asc_getZoom() * 100) + "%"); .val(Math.round(api.asc_getZoom() * 100) + "%");
...@@ -176,6 +181,12 @@ ...@@ -176,6 +181,12 @@
consolelog("onEndAction " + arguments[0] + " " + arguments[1]); 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) { function onTabNavigationBtnClicked(event) {
var btn = $(event.currentTarget), var btn = $(event.currentTarget),
tablist = $("#ws-navigation .tabs"), tablist = $("#ws-navigation .tabs"),
...@@ -229,6 +240,7 @@ ...@@ -229,6 +240,7 @@
.removeClass("active") .removeClass("active")
.eq(index).addClass("active"); .eq(index).addClass("active");
api.asc_showWorksheet(index); api.asc_showWorksheet(index);
updateSheetViewSettings();
return true; return true;
} }
...@@ -446,6 +458,8 @@ ...@@ -446,6 +458,8 @@
}); });
api.asc_registerCallback("asc_onSetAFDialog", onSetAFDialog); api.asc_registerCallback("asc_onSetAFDialog", onSetAFDialog);
api.asc_registerCallback("asc_onActiveSheetChanged", onActiveSheetChanged);
api.asc_registerCallback("asc_onConfirmAction", function(){ api.asc_registerCallback("asc_onConfirmAction", function(){
var arg = arguments; var arg = arguments;
$("#ConfirmMess") $("#ConfirmMess")
...@@ -1617,6 +1631,14 @@ ...@@ -1617,6 +1631,14 @@
$("#drawingObjectsLayerMenu").dialog("open"); $("#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 // Comments
var g_commentsEditorId = "commentsEditor"; var g_commentsEditorId = "commentsEditor";
...@@ -2579,4 +2601,11 @@ ...@@ -2579,4 +2601,11 @@
api.asc_unGroupGraphicsObjects(); api.asc_unGroupGraphicsObjects();
} }
); );
$("#showGridLines").change(function () {
onChangeView();
});
$("#showHeaders").change(function () {
onChangeView();
});
}); });
\ No newline at end of file
...@@ -2146,7 +2146,7 @@ function BinaryWorksheetsTableWriter(memory, wb, oSharedStrings, oDrawings, aDxf ...@@ -2146,7 +2146,7 @@ function BinaryWorksheetsTableWriter(memory, wb, oSharedStrings, oDrawings, aDxf
if(ws.aCols.length > 0 || null != ws.oAllCol) if(ws.aCols.length > 0 || null != ws.oAllCol)
this.bs.WriteItem(c_oSerWorksheetsTypes.Cols, function(){oThis.WriteWorksheetCols(ws);}); 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.SheetViews, function(){oThis.WriteSheetViews(ws);});
this.bs.WriteItem(c_oSerWorksheetsTypes.SheetFormatPr, function(){oThis.WriteSheetFormatPr(ws);}); this.bs.WriteItem(c_oSerWorksheetsTypes.SheetFormatPr, function(){oThis.WriteSheetFormatPr(ws);});
...@@ -2342,15 +2342,15 @@ function BinaryWorksheetsTableWriter(memory, wb, oSharedStrings, oDrawings, aDxf ...@@ -2342,15 +2342,15 @@ function BinaryWorksheetsTableWriter(memory, wb, oSharedStrings, oDrawings, aDxf
} }
}; };
this.WriteSheetView = function (oSheetView) { this.WriteSheetView = function (oSheetView) {
if (undefined !== oSheetView.ShowGridLines) { if (null !== oSheetView.showGridLines) {
this.memory.WriteByte(c_oSer_SheetView.ShowGridLines); this.memory.WriteByte(c_oSer_SheetView.ShowGridLines);
this.memory.WriteByte(c_oSerPropLenType.Byte); 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_oSer_SheetView.ShowRowColHeaders);
this.memory.WriteByte(c_oSerPropLenType.Byte); this.memory.WriteByte(c_oSerPropLenType.Byte);
this.memory.WriteBool(oSheetView.ShowRowColHeaders); this.memory.WriteBool(oSheetView.showRowColHeaders);
} }
}; };
this.WriteSheetFormatPr = function(ws) this.WriteSheetFormatPr = function(ws)
...@@ -5706,7 +5706,7 @@ function Binary_WorksheetTableReader(stream, wb, aSharedStrings, aCellXfs, Dxfs, ...@@ -5706,7 +5706,7 @@ function Binary_WorksheetTableReader(stream, wb, aSharedStrings, aCellXfs, Dxfs,
var oSheetView = null; var oSheetView = null;
if (c_oSerWorksheetsTypes.SheetView === type) { if (c_oSerWorksheetsTypes.SheetView === type) {
oSheetView = {}; oSheetView = new Asc.asc_CSheetViewSettings();
res = this.bcr.Read1(length, function (t, l) { res = this.bcr.Read1(length, function (t, l) {
return oThis.ReadSheetView(t, l, oSheetView); return oThis.ReadSheetView(t, l, oSheetView);
}); });
...@@ -5717,9 +5717,9 @@ function Binary_WorksheetTableReader(stream, wb, aSharedStrings, aCellXfs, Dxfs, ...@@ -5717,9 +5717,9 @@ function Binary_WorksheetTableReader(stream, wb, aSharedStrings, aCellXfs, Dxfs,
this.ReadSheetView = function (type, length, oSheetView) { this.ReadSheetView = function (type, length, oSheetView) {
var res = c_oSerConstants.ReadOk; var res = c_oSerConstants.ReadOk;
if (c_oSer_SheetView.ShowGridLines === type) { if (c_oSer_SheetView.ShowGridLines === type) {
oSheetView.ShowGridLines = this.stream.GetBool(); oSheetView.showGridLines = this.stream.GetBool();
} else if (c_oSer_SheetView.ShowRowColHeaders === type) { } else if (c_oSer_SheetView.ShowRowColHeaders === type) {
oSheetView.ShowRowColHeaders = this.stream.GetBool(); oSheetView.showRowColHeaders = this.stream.GetBool();
} else } else
res = c_oSerConstants.ReadUnknown; res = c_oSerConstants.ReadUnknown;
return res; return res;
......
...@@ -628,6 +628,27 @@ ...@@ -628,6 +628,27 @@
this["r2"] = r2; 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 * Export
...@@ -742,5 +763,12 @@ ...@@ -742,5 +763,12 @@
window["Asc"].asc_CCollaborativeRange = asc_CCollaborativeRange; 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); )(jQuery, window);
...@@ -644,6 +644,13 @@ ...@@ -644,6 +644,13 @@
return ct ? $.extend({}, ct.metrics) : undefined; 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 - это разница стартовых координат от мыши при нажатии и границы // mouseX - это разница стартовых координат от мыши при нажатии и границы
changeColumnWidth: function (col, x2, mouseX) { changeColumnWidth: function (col, x2, mouseX) {
...@@ -2176,6 +2183,11 @@ ...@@ -2176,6 +2183,11 @@
/** Рисует сетку таблицы */ /** Рисует сетку таблицы */
_drawGrid: function (drawingCtx, range, leftFieldInPt, topFieldInPt, width, height) { _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) { if (range === undefined) {
range = this.visibleRange; range = this.visibleRange;
} }
...@@ -8270,6 +8282,19 @@ ...@@ -8270,6 +8282,19 @@
} }
break; 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": case "update":
if (val !== undefined) { if (val !== undefined) {
fullRecalc = !!val.fullRecalc; fullRecalc = !!val.fullRecalc;
......
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