Commit 2fda0124 authored by Sergey.Luzyanin's avatar Sergey.Luzyanin Committed by Alexander.Trofimov

git-svn-id:...

git-svn-id: svn://192.168.3.15/activex/AVS/Sources/TeamlabOffice/trunk/OfficeWeb@47547 954022d7-b5bf-4e40-9824-e11837661b57
parent 7a57b3ea
...@@ -10,14 +10,14 @@ ...@@ -10,14 +10,14 @@
//----------------------------------------------------------------------------------- //-----------------------------------------------------------------------------------
var DrawingObject = null; var DrawingObject = null;
var DrawingObjectLayer = null; var DrawingObjectLayer = null;
if ( !window["Asc"] ) { // Для вставки диаграмм в Word if ( !window["Asc"] ) { // Для вставки диаграмм в Word
window["Asc"] = {}; window["Asc"] = {};
} }
function isObject(what) { function isObject(what) {
return ( what && (typeof(what) == "object") ); return ( what && (typeof(what) == "object") );
} }
function convertFormula(formula, ws) { function convertFormula(formula, ws) {
...@@ -37,11 +37,11 @@ function convertFormula(formula, ws) { ...@@ -37,11 +37,11 @@ function convertFormula(formula, ws) {
} }
} }
return range; return range;
} }
//----------------------------------------------------------------------------------- //-----------------------------------------------------------------------------------
// Интерфейс < Excel - Word > // Интерфейс < Excel - Word >
//----------------------------------------------------------------------------------- //-----------------------------------------------------------------------------------
function CChartData(bWordContext, chart) { function CChartData(bWordContext, chart) {
...@@ -864,10 +864,10 @@ function CChartData(bWordContext, chart) { ...@@ -864,10 +864,10 @@ function CChartData(bWordContext, chart) {
if ( bWordContext ) if ( bWordContext )
g_oTableId.Add( _this, _this.Id ); g_oTableId.Add( _this, _this.Id );
} }
//----------------------------------------------------------------------------------- //-----------------------------------------------------------------------------------
// Chart style // Chart style
//----------------------------------------------------------------------------------- //-----------------------------------------------------------------------------------
function asc_CChartStyle() { function asc_CChartStyle() {
this.style = null; this.style = null;
...@@ -881,7 +881,7 @@ asc_CChartStyle.prototype = { ...@@ -881,7 +881,7 @@ asc_CChartStyle.prototype = {
asc_getImageUrl: function() { return this.imageUrl; }, asc_getImageUrl: function() { return this.imageUrl; },
asc_setImageUrl: function(imageUrl) { this.imageUrl = imageUrl; } asc_setImageUrl: function(imageUrl) { this.imageUrl = imageUrl; }
} }
//{ asc_CChartStyle export //{ asc_CChartStyle export
window["Asc"].asc_CChartStyle = asc_CChartStyle; window["Asc"].asc_CChartStyle = asc_CChartStyle;
window["Asc"]["asc_CChartStyle"] = asc_CChartStyle; window["Asc"]["asc_CChartStyle"] = asc_CChartStyle;
...@@ -891,17 +891,17 @@ prot["asc_getStyle"] = prot.asc_getStyle; ...@@ -891,17 +891,17 @@ prot["asc_getStyle"] = prot.asc_getStyle;
prot["asc_setStyle"] = prot.asc_setStyle; prot["asc_setStyle"] = prot.asc_setStyle;
prot["asc_getImageUrl"] = prot.asc_getImageUrl; prot["asc_getImageUrl"] = prot.asc_getImageUrl;
prot["asc_setImageUrl"] = prot.asc_setImageUrl; prot["asc_setImageUrl"] = prot.asc_setImageUrl;
//} //}
//-----------------------------------------------------------------------------------
// Chart
//-----------------------------------------------------------------------------------
function asc_CChart(object) { //-----------------------------------------------------------------------------------
// Chart
//-----------------------------------------------------------------------------------
function asc_CChart(object) {
var bCopy = isObject(object); var bCopy = isObject(object);
this.bChartEditor = bCopy ? object.bChartEditor : false; this.bChartEditor = bCopy ? object.bChartEditor : false;
this.type = bCopy ? object.type : null; this.type = bCopy ? object.type : null;
this.subType = bCopy ? object.subType : null; this.subType = bCopy ? object.subType : null;
...@@ -1169,7 +1169,7 @@ asc_CChart.prototype = { ...@@ -1169,7 +1169,7 @@ asc_CChart.prototype = {
} }
} }
} }
//{ asc_CChart export //{ asc_CChart export
window["Asc"].asc_CChart = asc_CChart; window["Asc"].asc_CChart = asc_CChart;
window["Asc"]["asc_CChart"] = asc_CChart; window["Asc"]["asc_CChart"] = asc_CChart;
...@@ -1210,15 +1210,15 @@ prot["asc_setSeria"] = prot.asc_setSeria; ...@@ -1210,15 +1210,15 @@ prot["asc_setSeria"] = prot.asc_setSeria;
prot["asc_removeSeries"] = prot.asc_removeSeries; prot["asc_removeSeries"] = prot.asc_removeSeries;
prot["asc_getChartEditorFlag"] = prot.asc_getChartEditorFlag; prot["asc_getChartEditorFlag"] = prot.asc_getChartEditorFlag;
prot["asc_setChartEditorFlag"] = prot.asc_setChartEditorFlag; prot["asc_setChartEditorFlag"] = prot.asc_setChartEditorFlag;
//} //}
//----------------------------------------------------------------------------------- //-----------------------------------------------------------------------------------
// Chart range // Chart range
//----------------------------------------------------------------------------------- //-----------------------------------------------------------------------------------
function asc_CChartRange(object) { function asc_CChartRange(object) {
var bCopy = isObject(object); var bCopy = isObject(object);
this.interval = bCopy ? object.interval : ""; this.interval = bCopy ? object.interval : "";
...@@ -1275,7 +1275,7 @@ asc_CChartRange.prototype = { ...@@ -1275,7 +1275,7 @@ asc_CChartRange.prototype = {
} }
} }
} }
//{ asc_CChartRange export //{ asc_CChartRange export
window["Asc"].asc_CChartRange = asc_CChartRange; window["Asc"].asc_CChartRange = asc_CChartRange;
window["Asc"]["asc_CChartRange"] = asc_CChartRange; window["Asc"]["asc_CChartRange"] = asc_CChartRange;
...@@ -1288,12 +1288,12 @@ prot["asc_getRowsFlag"] = prot.asc_getRowsFlag; ...@@ -1288,12 +1288,12 @@ prot["asc_getRowsFlag"] = prot.asc_getRowsFlag;
prot["asc_setRowsFlag"] = prot.asc_setRowsFlag; prot["asc_setRowsFlag"] = prot.asc_setRowsFlag;
prot["asc_getColumnsFlag"] = prot.asc_getColumnsFlag; prot["asc_getColumnsFlag"] = prot.asc_getColumnsFlag;
prot["asc_setColumnsFlag"] = prot.asc_setColumnsFlag; prot["asc_setColumnsFlag"] = prot.asc_setColumnsFlag;
//} //}
//----------------------------------------------------------------------------------- //-----------------------------------------------------------------------------------
// Chart title // Chart title
//----------------------------------------------------------------------------------- //-----------------------------------------------------------------------------------
function asc_CChartHeader(object) { function asc_CChartHeader(object) {
...@@ -1357,7 +1357,7 @@ asc_CChartHeader.prototype = { ...@@ -1357,7 +1357,7 @@ asc_CChartHeader.prototype = {
} }
} }
} }
//{ asc_CChartHeader export //{ asc_CChartHeader export
window["Asc"].asc_CChartHeader = asc_CChartHeader; window["Asc"].asc_CChartHeader = asc_CChartHeader;
window["Asc"]["asc_CChartHeader"] = asc_CChartHeader; window["Asc"]["asc_CChartHeader"] = asc_CChartHeader;
...@@ -1373,16 +1373,16 @@ prot["asc_getDefaultTitleFlag"] = prot.asc_getDefaultTitleFlag; ...@@ -1373,16 +1373,16 @@ prot["asc_getDefaultTitleFlag"] = prot.asc_getDefaultTitleFlag;
prot["asc_setDefaultTitleFlag"] = prot.asc_setDefaultTitleFlag; prot["asc_setDefaultTitleFlag"] = prot.asc_setDefaultTitleFlag;
prot["asc_getFont"] = prot.asc_getFont; prot["asc_getFont"] = prot.asc_getFont;
prot["asc_setFont"] = prot.asc_setFont; prot["asc_setFont"] = prot.asc_setFont;
//} //}
//----------------------------------------------------------------------------------- //-----------------------------------------------------------------------------------
// Chart axis X // Chart axis X
//----------------------------------------------------------------------------------- //-----------------------------------------------------------------------------------
function asc_CChartAxisX(object) { function asc_CChartAxisX(object) {
var bCopy = isObject(object); var bCopy = isObject(object);
this.title = bCopy ? object.title : ""; this.title = bCopy ? object.title : "";
this.bDefaultTitle = bCopy ? object.bDefaultTitle : false; this.bDefaultTitle = bCopy ? object.bDefaultTitle : false;
...@@ -1456,7 +1456,7 @@ asc_CChartAxisX.prototype = { ...@@ -1456,7 +1456,7 @@ asc_CChartAxisX.prototype = {
} }
} }
} }
//{ asc_CChartAxisX export //{ asc_CChartAxisX export
window["Asc"].asc_CChartAxisX = asc_CChartAxisX; window["Asc"].asc_CChartAxisX = asc_CChartAxisX;
window["Asc"]["asc_CChartAxisX"] = asc_CChartAxisX; window["Asc"]["asc_CChartAxisX"] = asc_CChartAxisX;
...@@ -1478,11 +1478,11 @@ prot["asc_getTitleFont"] = prot.asc_getTitleFont; ...@@ -1478,11 +1478,11 @@ prot["asc_getTitleFont"] = prot.asc_getTitleFont;
prot["asc_setTitleFont"] = prot.asc_setTitleFont; prot["asc_setTitleFont"] = prot.asc_setTitleFont;
prot["asc_getLabelFont"] = prot.asc_getLabelFont; prot["asc_getLabelFont"] = prot.asc_getLabelFont;
prot["asc_setLabelFont"] = prot.asc_setLabelFont; prot["asc_setLabelFont"] = prot.asc_setLabelFont;
//} //}
//----------------------------------------------------------------------------------- //-----------------------------------------------------------------------------------
// Chart axis Y // Chart axis Y
//----------------------------------------------------------------------------------- //-----------------------------------------------------------------------------------
function asc_CChartAxisY(object) { function asc_CChartAxisY(object) {
...@@ -1561,7 +1561,7 @@ asc_CChartAxisY.prototype = { ...@@ -1561,7 +1561,7 @@ asc_CChartAxisY.prototype = {
} }
} }
} }
//{ asc_CChartAxisY export //{ asc_CChartAxisY export
window["Asc"].asc_CChartAxisY = asc_CChartAxisY; window["Asc"].asc_CChartAxisY = asc_CChartAxisY;
window["Asc"]["asc_CChartAxisY"] = asc_CChartAxisY; window["Asc"]["asc_CChartAxisY"] = asc_CChartAxisY;
...@@ -1583,17 +1583,17 @@ prot["asc_getTitleFont"] = prot.asc_getTitleFont; ...@@ -1583,17 +1583,17 @@ prot["asc_getTitleFont"] = prot.asc_getTitleFont;
prot["asc_setTitleFont"] = prot.asc_setTitleFont; prot["asc_setTitleFont"] = prot.asc_setTitleFont;
prot["asc_getLabelFont"] = prot.asc_getLabelFont; prot["asc_getLabelFont"] = prot.asc_getLabelFont;
prot["asc_setLabelFont"] = prot.asc_setLabelFont; prot["asc_setLabelFont"] = prot.asc_setLabelFont;
//} //}
//----------------------------------------------------------------------------------- //-----------------------------------------------------------------------------------
// Chart legend // Chart legend
//----------------------------------------------------------------------------------- //-----------------------------------------------------------------------------------
function asc_CChartLegend(object) { function asc_CChartLegend(object) {
var bCopy = isObject(object); var bCopy = isObject(object);
this.position = bCopy ? object.position : c_oAscChartLegend.right; this.position = bCopy ? object.position : c_oAscChartLegend.right;
this.bShow = bCopy ? object.bShow : true; this.bShow = bCopy ? object.bShow : true;
this.bOverlay = bCopy ? object.bOverlay : false; this.bOverlay = bCopy ? object.bOverlay : false;
...@@ -1647,7 +1647,7 @@ asc_CChartLegend.prototype = { ...@@ -1647,7 +1647,7 @@ asc_CChartLegend.prototype = {
} }
} }
} }
//{ asc_CChartLegend export //{ asc_CChartLegend export
window["Asc"].asc_CChartLegend = asc_CChartLegend; window["Asc"].asc_CChartLegend = asc_CChartLegend;
window["Asc"]["asc_CChartLegend"] = asc_CChartLegend; window["Asc"]["asc_CChartLegend"] = asc_CChartLegend;
...@@ -1663,12 +1663,12 @@ prot["asc_getOverlayFlag"] = prot.asc_getOverlayFlag; ...@@ -1663,12 +1663,12 @@ prot["asc_getOverlayFlag"] = prot.asc_getOverlayFlag;
prot["asc_setOverlayFlag"] = prot.asc_setOverlayFlag; prot["asc_setOverlayFlag"] = prot.asc_setOverlayFlag;
prot["asc_getFont"] = prot.asc_getFont; prot["asc_getFont"] = prot.asc_getFont;
prot["asc_setFont"] = prot.asc_setFont; prot["asc_setFont"] = prot.asc_setFont;
//} //}
//----------------------------------------------------------------------------------- //-----------------------------------------------------------------------------------
// Chart series // Chart series
//----------------------------------------------------------------------------------- //-----------------------------------------------------------------------------------
function asc_CChartSeria() { function asc_CChartSeria() {
this.Val = { Formula: null, NumCache: [] }; this.Val = { Formula: null, NumCache: [] };
...@@ -1755,7 +1755,7 @@ asc_CChartSeria.prototype = { ...@@ -1755,7 +1755,7 @@ asc_CChartSeria.prototype = {
} }
} }
} }
//{ asc_CChartSeria export //{ asc_CChartSeria export
window["Asc"].asc_CChartSeria = asc_CChartSeria; window["Asc"].asc_CChartSeria = asc_CChartSeria;
window["Asc"]["asc_CChartSeria"] = asc_CChartSeria; window["Asc"]["asc_CChartSeria"] = asc_CChartSeria;
...@@ -1780,16 +1780,16 @@ prot["asc_getOutlineColor"] = prot.asc_getOutlineColor; ...@@ -1780,16 +1780,16 @@ prot["asc_getOutlineColor"] = prot.asc_getOutlineColor;
prot["asc_setOutlineColor"] = prot.asc_setOutlineColor; prot["asc_setOutlineColor"] = prot.asc_setOutlineColor;
prot["asc_getFormatCode"] = prot.asc_getFormatCode; prot["asc_getFormatCode"] = prot.asc_getFormatCode;
prot["asc_setFormatCode"] = prot.asc_setFormatCode; prot["asc_setFormatCode"] = prot.asc_setFormatCode;
//} //}
//----------------------------------------------------------------------------------- //-----------------------------------------------------------------------------------
// Chart font // Chart font
//----------------------------------------------------------------------------------- //-----------------------------------------------------------------------------------
function asc_CChartFont(object) { function asc_CChartFont(object) {
var bCopy = isObject(object); var bCopy = isObject(object);
this.name = bCopy ? object.name : "Calibri"; this.name = bCopy ? object.name : "Calibri";
this.size = bCopy ? object.size : 10; this.size = bCopy ? object.size : 10;
...@@ -1861,7 +1861,7 @@ asc_CChartFont.prototype = { ...@@ -1861,7 +1861,7 @@ asc_CChartFont.prototype = {
} }
} }
} }
//{ asc_CChartFont export //{ asc_CChartFont export
window["Asc"].asc_CChartFont = asc_CChartFont; window["Asc"].asc_CChartFont = asc_CChartFont;
window["Asc"]["asc_CChartFont"] = asc_CChartFont; window["Asc"]["asc_CChartFont"] = asc_CChartFont;
...@@ -1883,12 +1883,12 @@ asc_CChartFont.prototype = { ...@@ -1883,12 +1883,12 @@ asc_CChartFont.prototype = {
prot["asc_setItalic"] = prot.asc_setItalic; prot["asc_setItalic"] = prot.asc_setItalic;
prot["asc_getUnderline"] = prot.asc_getUnderline; prot["asc_getUnderline"] = prot.asc_getUnderline;
prot["asc_setUnderline"] = prot.asc_setUnderline; prot["asc_setUnderline"] = prot.asc_setUnderline;
//} //}
//----------------------------------------------------------------------------------- //-----------------------------------------------------------------------------------
// Undo/Redo // Undo/Redo
//----------------------------------------------------------------------------------- //-----------------------------------------------------------------------------------
DrawingObjects.prototype = { DrawingObjects.prototype = {
...@@ -1987,9 +1987,9 @@ function DrawingObjects() { ...@@ -1987,9 +1987,9 @@ function DrawingObjects() {
var shiftKey = false; var shiftKey = false;
var userId = null; var userId = null;
var documentId = null; var documentId = null;
var lastObjectIndex = null; var lastObjectIndex = null;
// Все изменения, связанные с image.src прогоняем через этот класс // Все изменения, связанные с image.src прогоняем через этот класс
var imageLoader = new ImageLoader(); var imageLoader = new ImageLoader();
//----------------------------------------------------------------------------------- //-----------------------------------------------------------------------------------
...@@ -2016,12 +2016,12 @@ function DrawingObjects() { ...@@ -2016,12 +2016,12 @@ function DrawingObjects() {
currentSheet.model.Drawings[i].worksheet = worksheet; currentSheet.model.Drawings[i].worksheet = worksheet;
aObjects[i] = _this.cloneDrawingObject(currentSheet.model.Drawings[i]); aObjects[i] = _this.cloneDrawingObject(currentSheet.model.Drawings[i]);
if (aObjects[i].isChart()) { if (aObjects[i].isChart()) {
_this.calcChartInterval(aObjects[i].chart); _this.calcChartInterval(aObjects[i].chart);
aObjects[i].chart.worksheet = worksheet; aObjects[i].chart.worksheet = worksheet;
} }
if (aObjects[i].isImage()) if (aObjects[i].isImage())
imageLoader.addImage(aObjects[i].image.src); imageLoader.addImage(aObjects[i].image.src);
} }
lastObjectIndex = aObjects.length; lastObjectIndex = aObjects.length;
...@@ -2196,15 +2196,15 @@ function DrawingObjects() { ...@@ -2196,15 +2196,15 @@ function DrawingObjects() {
// всё чистим // всё чистим
if (clearCanvas) if (clearCanvas)
_this.clearDrawingObjects(); _this.clearDrawingObjects();
if ( !imageLoader.isReady() ) { if ( !imageLoader.isReady() ) {
//console.log("imageLoader - False"); //console.log("imageLoader - False");
imageLoader.setReadyCallback(_this.showDrawingObjects); imageLoader.setReadyCallback(_this.showDrawingObjects);
} }
else { else {
//console.log("imageLoader - Ok"); //console.log("imageLoader - Ok");
imageLoader.removeReadyCallback(); imageLoader.removeReadyCallback();
} }
for (var i = 0; i < _this.countDrawingObjects(); i++) { for (var i = 0; i < _this.countDrawingObjects(); i++) {
...@@ -2224,7 +2224,7 @@ function DrawingObjects() { ...@@ -2224,7 +2224,7 @@ function DrawingObjects() {
if (!obj.flags.anchorUpdated) if (!obj.flags.anchorUpdated)
obj.updateAnchorPosition(); obj.updateAnchorPosition();
// History // History
if (obj.move.inAction && undoRedoObject && (undoRedoObject.id == obj.id)) { if (obj.move.inAction && undoRedoObject && (undoRedoObject.id == obj.id)) {
...@@ -2260,9 +2260,9 @@ function DrawingObjects() { ...@@ -2260,9 +2260,9 @@ function DrawingObjects() {
obj.chart.rebuildSeries(); obj.chart.rebuildSeries();
var chartBase64 = chartRender.insertChart(obj.chart, null, obj.getWidthFromTo(), obj.getHeightFromTo()); var chartBase64 = chartRender.insertChart(obj.chart, null, obj.getWidthFromTo(), obj.getHeightFromTo());
if ( !chartBase64 ) if ( !chartBase64 )
continue; continue;
imageLoader.addImage(chartBase64); imageLoader.addImage(chartBase64);
imageLoader.setReadyCallback(_this.showDrawingObjects); imageLoader.setReadyCallback(_this.showDrawingObjects);
obj.image.onload = function() { obj.image.onload = function() {
...@@ -2270,7 +2270,7 @@ function DrawingObjects() { ...@@ -2270,7 +2270,7 @@ function DrawingObjects() {
} }
obj.image.src = chartBase64; obj.image.src = chartBase64;
obj.flags.redrawChart = false; obj.flags.redrawChart = false;
continue; continue;
} }
...@@ -2412,68 +2412,68 @@ function DrawingObjects() { ...@@ -2412,68 +2412,68 @@ function DrawingObjects() {
//----------------------------------------------------------------------------------- //-----------------------------------------------------------------------------------
// Create drawing // Create drawing
//----------------------------------------------------------------------------------- //-----------------------------------------------------------------------------------
var DrawingBase = function(ws) { var DrawingBase = function(ws) {
var _t = this; var _t = this;
_t.worksheet = ws; _t.worksheet = ws;
_t.Properties = { _t.Properties = {
Id: 1, Id: 1,
Type: 2, Type: 2,
PosX: 3, PosX: 3,
PosY: 4, PosY: 4,
ExtCx: 5, ExtCx: 5,
ExtCy: 6, ExtCy: 6,
ImageSrc: 7, ImageSrc: 7,
FlagCurrentCursor: 8, FlagCurrentCursor: 8,
FlagsTransactionState: 9, FlagsTransactionState: 9,
ImageUrl: 10, ImageUrl: 10,
FromCol: 11, FromCol: 11,
FromColOff: 12, FromColOff: 12,
FromRow: 13, FromRow: 13,
FromRowOff: 14, FromRowOff: 14,
ToCol: 15, ToCol: 15,
ToColOff: 16, ToColOff: 16,
ToRow: 17, ToRow: 17,
ToRowOff: 18, ToRowOff: 18,
MoveX: 19, MoveX: 19,
MoveY: 20, MoveY: 20,
SizeCoeff: 21, SizeCoeff: 21,
ChartData: 22 ChartData: 22
}; };
_t.id = null; _t.id = null;
_t.image = new Image(); _t.image = new Image();
_t.imageUrl = ""; _t.imageUrl = "";
_t.Type = c_oAscCellAnchorType.cellanchorTwoCell; _t.Type = c_oAscCellAnchorType.cellanchorTwoCell;
_t.Pos = { X: 0, Y: 0 }; _t.Pos = { X: 0, Y: 0 };
_t.from = { col: 0, colOff: 0, row: 0, rowOff: 0 }; _t.from = { col: 0, colOff: 0, row: 0, rowOff: 0 };
_t.to = { col: 0, colOff: 0, row: 0, rowOff: 0 }; _t.to = { col: 0, colOff: 0, row: 0, rowOff: 0 };
_t.ext = { cx: 0, cy: 0 }; _t.ext = { cx: 0, cy: 0 };
_t.size = { width: 0, height: 0, coeff: 1 }; _t.size = { width: 0, height: 0, coeff: 1 };
_t.move = { x: 0, y: 0, inAction: false }; _t.move = { x: 0, y: 0, inAction: false };
_t.chart = new asc_CChart(); _t.chart = new asc_CChart();
_t.graphicObject = null; // CShape or GroupShape _t.graphicObject = null; // CShape or GroupShape
_t.flags = { _t.flags = {
selected: false, selected: false,
anchorUpdated: false, anchorUpdated: false,
lockState: c_oAscObjectLockState.No, lockState: c_oAscObjectLockState.No,
currentCursor: null, currentCursor: null,
transactionState: c_oAscTransactionState.No, transactionState: c_oAscTransactionState.No,
redrawChart: false redrawChart: false
}; };
// Свойства // Свойства
_t.isImage = function() { _t.isImage = function() {
return !_t.isChart(); return !_t.isChart();
} }
_t.isChart = function() { _t.isChart = function() {
return _t.chart.type ? true : false; return _t.chart.type ? true : false;
} }
_t.isGraphicObject = function() { _t.isGraphicObject = function() {
...@@ -2482,219 +2482,223 @@ function DrawingObjects() { ...@@ -2482,219 +2482,223 @@ function DrawingObjects() {
_t.getWorkbook = function() { _t.getWorkbook = function() {
return (_t.worksheet ? _t.worksheet.model.workbook : null); return (_t.worksheet ? _t.worksheet.model.workbook : null);
} }
// Проверяет выход за границы _t.getCanvasContext = function() {
_t.canDraw = function() { return shapeCtx.m_oContext;
var result = true; }
if (!_t.image.src || // Проверяет выход за границы
(_t.worksheet.getCellLeft(_t.worksheet.getFirstVisibleCol(), 0) > _t.worksheet.getCellLeft(_t.to.col, 0) + mmToPx(_t.to.colOff)) || _t.canDraw = function() {
(_t.worksheet.getCellTop(_t.worksheet.getFirstVisibleRow(), 0) > _t.worksheet.getCellTop(_t.to.row, 0) + mmToPx(_t.to.rowOff))) var result = true;
{ result = false; }
if (!_t.image.src ||
return result; (_t.worksheet.getCellLeft(_t.worksheet.getFirstVisibleCol(), 0) > _t.worksheet.getCellLeft(_t.to.col, 0) + mmToPx(_t.to.colOff)) ||
} (_t.worksheet.getCellTop(_t.worksheet.getFirstVisibleRow(), 0) > _t.worksheet.getCellTop(_t.to.row, 0) + mmToPx(_t.to.rowOff)))
{ result = false; }
_t.canResize = function(width, height) {
var result = true; return result;
}
if (_t.flags.currentCursor != "move") {
if (_t.isChart()) { _t.canResize = function(width, height) {
if (width == minChartWidth) { var result = true;
switch (_t.flags.currentCursor) {
case "w-resize": case "e-resize": case "ne-resize": if (_t.flags.currentCursor != "move") {
case "nw-resize": case "se-resize": case "sw-resize": if (_t.isChart()) {
result = false; if (width == minChartWidth) {
} switch (_t.flags.currentCursor) {
} case "w-resize": case "e-resize": case "ne-resize":
else if (height == minChartHeight) { case "nw-resize": case "se-resize": case "sw-resize":
switch (_t.flags.currentCursor) { result = false;
case "n-resize": case "s-resize": case "ne-resize": }
case "nw-resize": case "se-resize": case "sw-resize": }
result = false; else if (height == minChartHeight) {
} switch (_t.flags.currentCursor) {
} case "n-resize": case "s-resize": case "ne-resize":
} case "nw-resize": case "se-resize": case "sw-resize":
else { // Image result = false;
if (width == minImageWidth) { }
switch (_t.flags.currentCursor) { }
case "w-resize": case "e-resize": case "ne-resize": }
case "nw-resize": case "se-resize": case "sw-resize": else { // Image
result = false; if (width == minImageWidth) {
} switch (_t.flags.currentCursor) {
} case "w-resize": case "e-resize": case "ne-resize":
else if (height == minImageHeight) { case "nw-resize": case "se-resize": case "sw-resize":
switch (_t.flags.currentCursor) { result = false;
case "n-resize": case "s-resize": case "ne-resize": }
case "nw-resize": case "se-resize": case "sw-resize": }
result = false; else if (height == minImageHeight) {
} switch (_t.flags.currentCursor) {
} case "n-resize": case "s-resize": case "ne-resize":
} case "nw-resize": case "se-resize": case "sw-resize":
} result = false;
}
return result; }
} }
}
_t.updateAnchorPosition = function() {
return result;
switch (_t.Type) { }
case c_oAscCellAnchorType.cellanchorOneCell:
{ _t.updateAnchorPosition = function() {
var _left = _t.getRealLeftOffset();
var _top = _t.getRealTopOffset(); switch (_t.Type) {
case c_oAscCellAnchorType.cellanchorOneCell:
var foundCol = _t.worksheet._findColUnderCursor(pxToPt(_left + mmToPx(_t.ext.cx)), true); {
while (foundCol == null) { var _left = _t.getRealLeftOffset();
_t.worksheet.expandColsOnScroll(true); var _top = _t.getRealTopOffset();
_t.worksheet._trigger("reinitializeScrollX");
foundCol = _t.worksheet._findColUnderCursor(pxToPt(_left + mmToPx(_t.ext.cx)), true); var foundCol = _t.worksheet._findColUnderCursor(pxToPt(_left + mmToPx(_t.ext.cx)), true);
} while (foundCol == null) {
_t.to.col = foundCol.col; _t.worksheet.expandColsOnScroll(true);
_t.to.colOff = pxToMm(_left + mmToPx(_t.ext.cx) - _t.worksheet.getCellLeft(_t.to.col, 0)); _t.worksheet._trigger("reinitializeScrollX");
foundCol = _t.worksheet._findColUnderCursor(pxToPt(_left + mmToPx(_t.ext.cx)), true);
var foundRow = _t.worksheet._findRowUnderCursor(pxToPt(_top + mmToPx(_t.ext.cy)), true); }
while (foundRow == null) { _t.to.col = foundCol.col;
_t.worksheet.expandRowsOnScroll(true); _t.to.colOff = pxToMm(_left + mmToPx(_t.ext.cx) - _t.worksheet.getCellLeft(_t.to.col, 0));
_t.worksheet._trigger("reinitializeScrollY");
foundRow = _t.worksheet._findRowUnderCursor(pxToPt(_top + mmToPx(_t.ext.cy)), true); var foundRow = _t.worksheet._findRowUnderCursor(pxToPt(_top + mmToPx(_t.ext.cy)), true);
} while (foundRow == null) {
_t.to.row = foundRow.row; _t.worksheet.expandRowsOnScroll(true);
_t.to.rowOff = pxToMm(_top + mmToPx(_t.ext.cy) - _t.worksheet.getCellTop(_t.to.row, 0)); _t.worksheet._trigger("reinitializeScrollY");
} foundRow = _t.worksheet._findRowUnderCursor(pxToPt(_top + mmToPx(_t.ext.cy)), true);
break; }
_t.to.row = foundRow.row;
case c_oAscCellAnchorType.cellanchorAbsolute: _t.to.rowOff = pxToMm(_top + mmToPx(_t.ext.cy) - _t.worksheet.getCellTop(_t.to.row, 0));
{ }
if ( _t.Pos.X < 0 ) break;
_t.Pos.X = 0;
if ( _t.Pos.Y < 0 ) case c_oAscCellAnchorType.cellanchorAbsolute:
_t.Pos.Y = 0; {
if ( _t.Pos.X < 0 )
_t.from.col = _t.worksheet._findColUnderCursor(pxToPt(mmToPx(_t.Pos.X) + _t.worksheet.getCellLeft(0, 0)), true).col; _t.Pos.X = 0;
_t.from.colOff = pxToMm(mmToPx(_t.Pos.X) + _t.worksheet.getCellLeft(0, 0) - _t.worksheet.getCellLeft(_t.from.col, 0)); if ( _t.Pos.Y < 0 )
_t.Pos.Y = 0;
_t.from.row = _t.worksheet._findRowUnderCursor(pxToPt(mmToPx(_t.Pos.Y) + _t.worksheet.getCellTop(0, 0)), true).row;
_t.from.rowOff = pxToMm(mmToPx(_t.Pos.Y) + _t.worksheet.getCellTop(0, 0) - _t.worksheet.getCellTop(_t.from.row, 0)); _t.from.col = _t.worksheet._findColUnderCursor(pxToPt(mmToPx(_t.Pos.X) + _t.worksheet.getCellLeft(0, 0)), true).col;
_t.from.colOff = pxToMm(mmToPx(_t.Pos.X) + _t.worksheet.getCellLeft(0, 0) - _t.worksheet.getCellLeft(_t.from.col, 0));
var _left = _t.getRealLeftOffset();
var _top = _t.getRealTopOffset(); _t.from.row = _t.worksheet._findRowUnderCursor(pxToPt(mmToPx(_t.Pos.Y) + _t.worksheet.getCellTop(0, 0)), true).row;
_t.from.rowOff = pxToMm(mmToPx(_t.Pos.Y) + _t.worksheet.getCellTop(0, 0) - _t.worksheet.getCellTop(_t.from.row, 0));
var foundCol = _t.worksheet._findColUnderCursor(pxToPt(_left + mmToPx(_t.ext.cx)), true);
while (foundCol == null) { var _left = _t.getRealLeftOffset();
_t.worksheet.expandColsOnScroll(true); var _top = _t.getRealTopOffset();
_t.worksheet._trigger("reinitializeScrollX");
foundCol = _t.worksheet._findColUnderCursor(pxToPt(_left + mmToPx(_t.ext.cx)), true); var foundCol = _t.worksheet._findColUnderCursor(pxToPt(_left + mmToPx(_t.ext.cx)), true);
} while (foundCol == null) {
_t.to.col = foundCol.col; _t.worksheet.expandColsOnScroll(true);
_t.to.colOff = pxToMm(_left + mmToPx(_t.ext.cx) - _t.worksheet.getCellLeft(_t.to.col, 0)); _t.worksheet._trigger("reinitializeScrollX");
foundCol = _t.worksheet._findColUnderCursor(pxToPt(_left + mmToPx(_t.ext.cx)), true);
var foundRow = _t.worksheet._findRowUnderCursor(pxToPt(_top + mmToPx(_t.ext.cy)), true); }
while (foundRow == null) { _t.to.col = foundCol.col;
_t.worksheet.expandRowsOnScroll(true); _t.to.colOff = pxToMm(_left + mmToPx(_t.ext.cx) - _t.worksheet.getCellLeft(_t.to.col, 0));
_t.worksheet._trigger("reinitializeScrollY");
foundRow = _t.worksheet._findRowUnderCursor(pxToPt(_top + mmToPx(_t.ext.cy)), true); var foundRow = _t.worksheet._findRowUnderCursor(pxToPt(_top + mmToPx(_t.ext.cy)), true);
} while (foundRow == null) {
_t.to.row = foundRow.row; _t.worksheet.expandRowsOnScroll(true);
_t.to.rowOff = pxToMm(_top + mmToPx(_t.ext.cy) - _t.worksheet.getCellTop(_t.to.row, 0)); _t.worksheet._trigger("reinitializeScrollY");
} foundRow = _t.worksheet._findRowUnderCursor(pxToPt(_top + mmToPx(_t.ext.cy)), true);
break; }
} _t.to.row = foundRow.row;
_t.flags.anchorUpdated = true; _t.to.rowOff = pxToMm(_top + mmToPx(_t.ext.cy) - _t.worksheet.getCellTop(_t.to.row, 0));
} }
break;
_t.normalizeMetrics = function() { }
var width = _t.getWidthFromTo(); _t.flags.anchorUpdated = true;
var height = _t.getHeightFromTo(); }
if ( width < 2 )
_t.to.colOff = _t.from.colOff + 4; _t.normalizeMetrics = function() {
if ( height < 2 ) var width = _t.getWidthFromTo();
_t.to.rowOff = _t.from.rowOff + 4; var height = _t.getHeightFromTo();
} if ( width < 2 )
_t.to.colOff = _t.from.colOff + 4;
// Реальное смещение по высоте if ( height < 2 )
_t.getRealTopOffset = function() { _t.to.rowOff = _t.from.rowOff + 4;
var val = _t.worksheet.getCellTop(_t.from.row, 0) + mmToPx(_t.from.rowOff); }
return Asc.round(val);
} // Реальное смещение по высоте
_t.getRealTopOffset = function() {
// Реальное смещение по ширине var val = _t.worksheet.getCellTop(_t.from.row, 0) + mmToPx(_t.from.rowOff);
_t.getRealLeftOffset = function() { return Asc.round(val);
var val = _t.worksheet.getCellLeft(_t.from.col, 0) + mmToPx(_t.from.colOff); }
return Asc.round(val);
} // Реальное смещение по ширине
_t.getRealLeftOffset = function() {
// Ширина по координатам var val = _t.worksheet.getCellLeft(_t.from.col, 0) + mmToPx(_t.from.colOff);
_t.getWidthFromTo = function(withoutRound) { return Asc.round(val);
var val = _t.worksheet.getCellLeft(_t.to.col, 0) + mmToPx(_t.to.colOff) - _t.worksheet.getCellLeft(_t.from.col, 0) - mmToPx(_t.from.colOff); }
return withoutRound ? val : Asc.round(val);
} // Ширина по координатам
_t.getWidthFromTo = function(withoutRound) {
// Высота по координатам var val = _t.worksheet.getCellLeft(_t.to.col, 0) + mmToPx(_t.to.colOff) - _t.worksheet.getCellLeft(_t.from.col, 0) - mmToPx(_t.from.colOff);
_t.getHeightFromTo = function(withoutRound) { return withoutRound ? val : Asc.round(val);
var val = _t.worksheet.getCellTop(_t.to.row, 0) + mmToPx(_t.to.rowOff) - _t.worksheet.getCellTop(_t.from.row, 0) - mmToPx(_t.from.rowOff); }
return withoutRound ? val : Asc.round(val);
} // Высота по координатам
_t.getHeightFromTo = function(withoutRound) {
// Видимая ширина при скролах var val = _t.worksheet.getCellTop(_t.to.row, 0) + mmToPx(_t.to.rowOff) - _t.worksheet.getCellTop(_t.from.row, 0) - mmToPx(_t.from.rowOff);
_t.getVisibleWidth = function() { return withoutRound ? val : Asc.round(val);
var fvc = _t.worksheet.getCellLeft(_t.worksheet.getFirstVisibleCol(), 0); }
var off = _t.getRealLeftOffset() - fvc;
off = (off >= 0) ? 0 : Math.abs(off); // Видимая ширина при скролах
return _t.getWidthFromTo() - off; _t.getVisibleWidth = function() {
} var fvc = _t.worksheet.getCellLeft(_t.worksheet.getFirstVisibleCol(), 0);
var off = _t.getRealLeftOffset() - fvc;
// Видимая высота при скролах off = (off >= 0) ? 0 : Math.abs(off);
_t.getVisibleHeight = function() { return _t.getWidthFromTo() - off;
var fvr = _t.worksheet.getCellTop(_t.worksheet.getFirstVisibleRow(), 0); }
var off = _t.getRealTopOffset() - fvr;
off = (off >= 0) ? 0 : Math.abs(off); // Видимая высота при скролах
return _t.getHeightFromTo() - off; _t.getVisibleHeight = function() {
} var fvr = _t.worksheet.getCellTop(_t.worksheet.getFirstVisibleRow(), 0);
var off = _t.getRealTopOffset() - fvr;
// Видимое смещение объекта от первой видимой строки off = (off >= 0) ? 0 : Math.abs(off);
_t.getVisibleTopOffset = function(withHeader) { return _t.getHeightFromTo() - off;
var headerRowOff = _t.worksheet.getCellTop(0, 0); }
var fvr = _t.worksheet.getCellTop(_t.worksheet.getFirstVisibleRow(), 0);
var off = _t.getRealTopOffset() - fvr; // Видимое смещение объекта от первой видимой строки
var off = (off > 0) ? off : 0; _t.getVisibleTopOffset = function(withHeader) {
return withHeader ? headerRowOff + off : off; var headerRowOff = _t.worksheet.getCellTop(0, 0);
} var fvr = _t.worksheet.getCellTop(_t.worksheet.getFirstVisibleRow(), 0);
var off = _t.getRealTopOffset() - fvr;
// Видимое смещение объекта от первой видимой колонки var off = (off > 0) ? off : 0;
_t.getVisibleLeftOffset = function(withHeader) { return withHeader ? headerRowOff + off : off;
var headerColOff = _t.worksheet.getCellLeft(0, 0); }
var fvc = _t.worksheet.getCellLeft(_t.worksheet.getFirstVisibleCol(), 0);
var off = _t.getRealLeftOffset() - fvc; // Видимое смещение объекта от первой видимой колонки
var off = (off > 0) ? off : 0; _t.getVisibleLeftOffset = function(withHeader) {
return withHeader ? headerColOff + off : off; var headerColOff = _t.worksheet.getCellLeft(0, 0);
} var fvc = _t.worksheet.getCellLeft(_t.worksheet.getFirstVisibleCol(), 0);
var off = _t.getRealLeftOffset() - fvc;
// смещение по высоте внутри объекта var off = (off > 0) ? off : 0;
_t.getInnerOffsetTop = function() { return withHeader ? headerColOff + off : off;
var fvr = _t.worksheet.getCellTop(_t.worksheet.getFirstVisibleRow(), 0); }
var off = _t.getRealTopOffset() - fvr;
return (off > 0) ? 0 : Asc.round(Math.abs(off) * _t.getHeightCoeff()); // смещение по высоте внутри объекта
} _t.getInnerOffsetTop = function() {
var fvr = _t.worksheet.getCellTop(_t.worksheet.getFirstVisibleRow(), 0);
// смещение по ширине внутри объекта var off = _t.getRealTopOffset() - fvr;
_t.getInnerOffsetLeft = function() { return (off > 0) ? 0 : Asc.round(Math.abs(off) * _t.getHeightCoeff());
var fvc = _t.worksheet.getCellLeft(_t.worksheet.getFirstVisibleCol(), 0); }
var off = _t.getRealLeftOffset() - fvc;
return (off > 0) ? 0 : Asc.round(Math.abs(off) * _t.getWidthCoeff()); // смещение по ширине внутри объекта
} _t.getInnerOffsetLeft = function() {
var fvc = _t.worksheet.getCellLeft(_t.worksheet.getFirstVisibleCol(), 0);
// коэффициент по ширине если несоответствие с реальным размером var off = _t.getRealLeftOffset() - fvc;
_t.getWidthCoeff = function() { return (off > 0) ? 0 : Asc.round(Math.abs(off) * _t.getWidthCoeff());
return _t.image.width / _t.getWidthFromTo(); }
}
// коэффициент по ширине если несоответствие с реальным размером
// коэффициент по высоте если несоответствие с реальным размером _t.getWidthCoeff = function() {
_t.getHeightCoeff = function() { return _t.image.width / _t.getWidthFromTo();
return _t.image.height / _t.getHeightFromTo(); }
}
} // коэффициент по высоте если несоответствие с реальным размером
_t.getHeightCoeff = function() {
return _t.image.height / _t.getHeightFromTo();
}
}
DrawingBase.prototype = { DrawingBase.prototype = {
...@@ -2943,8 +2947,8 @@ function DrawingObjects() { ...@@ -2943,8 +2947,8 @@ function DrawingObjects() {
_this.addImageDrawingObject = function(imageUrl, bPackage, options) { _this.addImageDrawingObject = function(imageUrl, bPackage, options) {
if (imageUrl && !isViewerMode()) { if (imageUrl && !isViewerMode()) {
imageLoader.addImage(imageUrl); imageLoader.addImage(imageUrl);
var obj = _this.createDrawingObject(); var obj = _this.createDrawingObject();
...@@ -3128,8 +3132,8 @@ function DrawingObjects() { ...@@ -3128,8 +3132,8 @@ function DrawingObjects() {
chart.worksheet = worksheet; // Для формул серий chart.worksheet = worksheet; // Для формул серий
var chartBase64 = chartRender.insertChart(chart, null, bWordChart ? wordChart.width : c_oAscChartDefines.defaultChartWidth, bWordChart ? wordChart.height : c_oAscChartDefines.defaultChartHeight, isNewChart); var chartBase64 = chartRender.insertChart(chart, null, bWordChart ? wordChart.width : c_oAscChartDefines.defaultChartWidth, bWordChart ? wordChart.height : c_oAscChartDefines.defaultChartHeight, isNewChart);
if ( !chartBase64 ) if ( !chartBase64 )
return false; return false;
imageLoader.addImage(chartBase64); imageLoader.addImage(chartBase64);
// draw // draw
...@@ -3256,7 +3260,7 @@ function DrawingObjects() { ...@@ -3256,7 +3260,7 @@ function DrawingObjects() {
_this.addGraphicObject = function(x, y, extX, extY, flipH, flipV, presetGeom) { _this.addGraphicObject = function(x, y, extX, extY, flipH, flipV, presetGeom) {
var obj = _this.createDrawingObject(); var obj = _this.createDrawingObject();
obj.graphicObject = new CShape(_this); obj.graphicObject = new CShape(obj);
obj.graphicObject.initDefault(x, y, extX, extY, flipH, flipV, presetGeom); obj.graphicObject.initDefault(x, y, extX, extY, flipH, flipV, presetGeom);
aObjects.push(obj); aObjects.push(obj);
_this.showDrawingObjects(false); _this.showDrawingObjects(false);
...@@ -4848,53 +4852,53 @@ function DrawingObjects() { ...@@ -4848,53 +4852,53 @@ function DrawingObjects() {
var tmp = val * ascCvtRatio(0, 3); var tmp = val * ascCvtRatio(0, 3);
return tmp; return tmp;
} }
} }
//----------------------------------------------------------------------------------- //-----------------------------------------------------------------------------------
// Image loader // Image loader
//----------------------------------------------------------------------------------- //-----------------------------------------------------------------------------------
function ImageLoader() { function ImageLoader() {
var _this = this; var _this = this;
var readyCallback = null; var readyCallback = null;
var ImageObject = function() { var ImageObject = function() {
var _t = this; var _t = this;
_t.bReady = false; _t.bReady = false;
_t.image = new Image(); _t.image = new Image();
_t.image.onload = function() { _t.image.onload = function() {
_t.bReady = true; _t.bReady = true;
if ( _this.isReady() && readyCallback ) if ( _this.isReady() && readyCallback )
readyCallback(false, null, false); readyCallback(false, null, false);
} }
}; };
var container = []; // array of ImageObject var container = []; // array of ImageObject
_this.isReady = function() { _this.isReady = function() {
for (var i = 0; i < container.length; i++) { for (var i = 0; i < container.length; i++) {
if ( !container[i].bReady ) if ( !container[i].bReady )
return false; return false;
} }
return true; return true;
} }
_this.addImage = function(imageSrc) { _this.addImage = function(imageSrc) {
if ( imageSrc ) { if ( imageSrc ) {
var imageObject = new ImageObject(); var imageObject = new ImageObject();
imageObject.image.src = imageSrc; imageObject.image.src = imageSrc;
container.push(imageObject); container.push(imageObject);
} }
} }
_this.setReadyCallback = function(callback) { _this.setReadyCallback = function(callback) {
if ( callback && (typeof(callback) == "function") ) if ( callback && (typeof(callback) == "function") )
readyCallback = callback; readyCallback = callback;
} }
_this.removeReadyCallback = function(callback) { _this.removeReadyCallback = function(callback) {
readyCallback = null; readyCallback = null;
container = []; container = [];
} }
} }
\ No newline at end of file
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