Commit ef5845e7 authored by Alexey.Musinov's avatar Alexey.Musinov Committed by Alexander.Trofimov

[ios] tables

git-svn-id: svn://192.168.3.15/activex/AVS/Sources/TeamlabOffice/trunk/OfficeWeb@63579 954022d7-b5bf-4e40-9824-e11837661b57
parent c5689501
......@@ -4,6 +4,10 @@ window["Asc"].WorksheetView = WorksheetView;
WorksheetView.prototype._drawColumnHeaders_Local = function (drawingCtx, start, end, style, offsetXForDraw, offsetYForDraw) {
if (undefined === drawingCtx && false === this.model.sheetViews[0].asc_getShowRowColHeaders())
return;
var range = new asc_Range(start, 0, end, 1);
this._prepareCellTextMetricsCache(range);
var vr = this.visibleRange;
var c = this.cols;
var offsetX = (undefined !== offsetXForDraw) ? offsetXForDraw : c[vr.c1].left - this.cellsLeft;
......@@ -29,14 +33,116 @@ WorksheetView.prototype._drawColumnHeaders_Local = function (drawingCtx, start,
// draw column headers
for (var i = start; i <= end; ++i) {
this._drawHeader(drawingCtx, c[i].left - c[start].left - offsetX, offsetY,
this._drawHeader_Local(drawingCtx, c[i].left - c[start].left - offsetX, offsetY,
c[i].width, this.headersHeight, style, true, i);
}
};
WorksheetView.prototype._drawHeader_Local = function (drawingCtx, x, y, w, h, style, isColHeader, index) {
// Для отрисовки невидимого столбца/строки
var isZeroHeader = false;
if (-1 !== index) {
if (isColHeader) {
if (w < this.width_1px) {
// Это невидимый столбец
isZeroHeader = true;
// Отрисуем только границу
w = this.width_1px;
// Возможно мы уже рисовали границу невидимого столбца (для последовательности невидимых)
if (0 < index && 0 === this.cols[index - 1].width) {
// Мы уже нарисовали border для невидимой границы
return;
}
} else if (0 < index && 0 === this.cols[index - 1].width) {
// Мы уже нарисовали border для невидимой границы (поэтому нужно чуть меньше рисовать для соседнего столбца)
w -= this.width_1px;
x += this.width_1px;
}
} else {
if (h < this.height_1px) {
// Это невидимая строка
isZeroHeader = true;
// Отрисуем только границу
h = this.height_1px;
// Возможно мы уже рисовали границу невидимой строки (для последовательности невидимых)
if (0 < index && 0 === this.rows[index - 1].height) {
// Мы уже нарисовали border для невидимой границы
return;
}
} else if (0 < index && 0 === this.rows[index - 1].height) {
// Мы уже нарисовали border для невидимой границы (поэтому нужно чуть меньше рисовать для соседней строки)
h -= this.height_1px;
y += this.height_1px;
}
}
}
var ctx = (drawingCtx) ? drawingCtx : this.drawingCtx;
var st = this.settings.header.style[style];
var x2 = x + w;
var y2 = y + h;
var x2WithoutBorder = x2 - this.width_1px;
var y2WithoutBorder = y2 - this.height_1px;
// background только для видимых
if (!isZeroHeader) {
// draw background
ctx.setFillStyle(st.background)
.fillRect(x, y, w + 20, h + 20);
}
// draw border
ctx.setStrokeStyle(st.border)
.setLineWidth(1)
.beginPath();
if (style !== kHeaderDefault && !isColHeader) {
// Select row (top border)
ctx.lineHorPrevPx(x, y, x2);
}
// Right border
if (isColHeader) ctx.lineVerPrevPx(x2, y, y2);
// Bottom border
if (!isColHeader)ctx.lineHorPrevPx(x, y2, x2);
if (style !== kHeaderDefault && isColHeader) {
// Select col (left border)
//ctx.lineVerPrevPx(x, y, y2);
}
ctx.stroke();
// Для невидимых кроме border-а ничего не рисуем
if (isZeroHeader || -1 === index)
return;
// draw text
var text = isColHeader ? this._getColumnTitle(index) : this._getRowTitle(index);
var sr = this.stringRender;
var tm = this._roundTextMetrics( sr.measureString(text) );
var bl = y2WithoutBorder - (isColHeader ? this.defaultRowDescender : this.rows[index].descender);
var textX = this._calcTextHorizPos(x, x2WithoutBorder, tm, tm.width < w ? khaCenter : khaLeft);
var textY = this._calcTextVertPos(y, y2WithoutBorder, bl, tm, kvaBottom);
if (drawingCtx) {
ctx.AddClipRect(x, y, w, h);
ctx.setFillStyle(st.color)
.fillText(text, textX, textY + tm.baseline, undefined, sr.charWidths);
ctx.RemoveClipRect();
} else {
ctx.save()
.beginPath()
.rect(x, y, w, h)
.clip()
.setFillStyle(st.color)
.fillText(text, textX, textY + tm.baseline, undefined, sr.charWidths)
.restore();
}
};
WorksheetView.prototype._drawRowHeaders_Local = function (drawingCtx, start, end, style, offsetXForDraw, offsetYForDraw) {
if (undefined === drawingCtx && false === this.model.sheetViews[0].asc_getShowRowColHeaders())
return;
var range = new asc_Range(0, start, 1, end);
this._prepareCellTextMetricsCache(range);
var vr = this.visibleRange;
var r = this.rows;
var offsetX = (undefined !== offsetXForDraw) ? offsetXForDraw : this.headersLeft;
......@@ -62,7 +168,7 @@ WorksheetView.prototype._drawRowHeaders_Local = function (drawingCtx, start, end
// draw row headers
for (var i = start; i <= end; ++i) {
this._drawHeader(drawingCtx, offsetX, r[i].top - r[start].top - offsetY,
this._drawHeader_Local(drawingCtx, offsetX, r[i].top - r[start].top - offsetY,
this.headersWidth, r[i].height, style, false, i);
}
};
......@@ -334,6 +440,16 @@ WorksheetView.prototype._getDrawSelection_Local = function (c1, r1, c2, r2, isFr
native_selection.push(_t);
native_selection.push(_r);
native_selection.push(_b);
native_selection.push(range.c1);
native_selection.push(range.c2);
native_selection.push(range.r1);
native_selection.push(range.r2);
native_selection.push(cr.c1);
native_selection.push(cr.c2);
native_selection.push(cr.r1);
native_selection.push(cr.r2);
}
//if (!(isFrozen && (!drawRightSide || !drawBottomSide))) {
......
......@@ -1407,10 +1407,8 @@ var deviceScale = 1;
function OfflineEditor () {
this.contentX = 16384;
this.contextY = 1048576;
this.zoom = 1.0;
// main
this.openFile = function () {
......@@ -1424,7 +1422,6 @@ function OfflineEditor () {
_api.asc_nativeOpenFile(window.native["GetFileString"]());
this.registerEventsHandlers();
this.asc_WriteAllWorksheets(true);
};
this.registerEventsHandlers = function () {
......@@ -1459,6 +1456,16 @@ function OfflineEditor () {
this.getMaxSizeY = function () {
return this.contextY;
};
this.getMaxBounds = function () {
var worksheet = _api.wb.getWorksheet();
var left = worksheet.cols[worksheet.cols.length - 1].left;
var top = worksheet.rows[worksheet.rows.length - 1].top;
left += (gc_nMaxCol - worksheet.cols.length) * worksheet.defaultColWidth;
top += (gc_nMaxRow - worksheet.rows.length) * worksheet.defaultRowHeight;
return [left, top];
};
this.getSelection = function(x, y, width, height) {
_null_object.width = width;
_null_object.height = height;
......@@ -1726,6 +1733,9 @@ function offline_mouse_up(x, y) {
function offline_get_selection(x, y, width, height) {
return _s.getSelection(x, y, width, height);
}
function offline_get_worksheet_bounds() {
return _s.getMaxBounds();
}
function offline_apply_event(type,params) {
var _stream = null;
var _return = undefined;
......
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