Commit eb0a5384 authored by Dmitry.Vikulov's avatar Dmitry.Vikulov Committed by Alexander.Trofimov

- Сдвиг шейпов при вставке/удалении строк/столбцов

- Текстовое превью для шейпов в меню настроек
- Изменение размеров объектов через меню
- Исправлен баг с отображением свойств текста в меню при переходе с граф.объекта в ячейку

git-svn-id: svn://192.168.3.15/activex/AVS/Sources/TeamlabOffice/trunk/OfficeWeb@48838 954022d7-b5bf-4e40-9824-e11837661b57
parent 31ca546a
...@@ -3022,12 +3022,14 @@ function DrawingObjects() { ...@@ -3022,12 +3022,14 @@ function DrawingObjects() {
api.isImageChangeUrl = false; api.isImageChangeUrl = false;
} }
else if ( api.isShapeImageChangeUrl ) { else if ( api.isShapeImageChangeUrl ) {
var imgProps = new asc_CImgProperty();
var shapeProp = new asc_CShapeProperty(); var shapeProp = new asc_CShapeProperty();
imgProps.ShapeProperties = shapeProp;
shapeProp.fill = new asc_CShapeFill(); shapeProp.fill = new asc_CShapeFill();
shapeProp.fill.type = c_oAscFill.FILL_TYPE_BLIP; shapeProp.fill.type = c_oAscFill.FILL_TYPE_BLIP;
shapeProp.fill.fill = new asc_CFillBlip(); shapeProp.fill.fill = new asc_CFillBlip();
shapeProp.fill.fill.asc_putUrl(_image.src); shapeProp.fill.fill.asc_putUrl(_image.src);
_this.setGraphicObjectProps(shapeProp); _this.setGraphicObjectProps(imgProps);
api.isShapeImageChangeUrl = false; api.isShapeImageChangeUrl = false;
} }
...@@ -3136,7 +3138,7 @@ function DrawingObjects() { ...@@ -3136,7 +3138,7 @@ function DrawingObjects() {
var obj = aObjects[i]; var obj = aObjects[i];
var bbox = obj.isChart() ? obj.graphicObject.chart.range.intervalObject.getBBox0() : null; var bbox = obj.isChart() ? obj.graphicObject.chart.range.intervalObject.getBBox0() : null;
if ( obj.isChart() || obj.isImage() ) { if ( obj.isChart() || obj.isImage() || obj.isShape() ) {
metrics = { from: {}, to: {} }; metrics = { from: {}, to: {} };
metrics.from.col = obj.from.col; metrics.to.col = obj.to.col; metrics.from.col = obj.from.col; metrics.to.col = obj.to.col;
...@@ -3720,12 +3722,7 @@ function DrawingObjects() { ...@@ -3720,12 +3722,7 @@ function DrawingObjects() {
} }
_this.getSelectedGraphicObjects = function() { _this.getSelectedGraphicObjects = function() {
var selArray = []; return _this.controller.selectedObjects;
for (var i = 0; i < aObjects.length; i++) {
if ( aObjects[i].isGraphicObject() && aObjects[i].graphicObject.selected )
selArray.push(aObjects[i]);
}
return selArray;
} }
_this.selectedGraphicObjectsExists = function() { _this.selectedGraphicObjectsExists = function() {
...@@ -3832,6 +3829,11 @@ function DrawingObjects() { ...@@ -3832,6 +3829,11 @@ function DrawingObjects() {
api.wb.handlers.trigger("asc_onShowChartDialog", true); api.wb.handlers.trigger("asc_onShowChartDialog", true);
} }
_this.setDrawImagePlaceParagraph = function(element_id, props) {
_this.drawingDocument.InitGuiCanvasTextProps(element_id);
_this.drawingDocument.DrawGuiCanvasTextProps(props);
}
//----------------------------------------------------------------------------------- //-----------------------------------------------------------------------------------
// Graphic object mouse & keyboard events // Graphic object mouse & keyboard events
//----------------------------------------------------------------------------------- //-----------------------------------------------------------------------------------
......
...@@ -87,4 +87,12 @@ var c_oAscCellAnchorType = { ...@@ -87,4 +87,12 @@ var c_oAscCellAnchorType = {
var c_oAscChartDefines = { var c_oAscChartDefines = {
defaultChartWidth: 478, defaultChartWidth: 478,
defaultChartHeight: 286 defaultChartHeight: 286
};
var c_oAscLineDrawingRule = {
Left : 0,
Center : 1,
Right : 2,
Top : 0,
Bottom : 2
}; };
\ No newline at end of file
...@@ -2066,13 +2066,11 @@ var ASC_DOCS_API_USE_EMBEDDED_FONTS = "@@ASC_DOCS_API_USE_EMBEDDED_FONTS"; ...@@ -2066,13 +2066,11 @@ var ASC_DOCS_API_USE_EMBEDDED_FONTS = "@@ASC_DOCS_API_USE_EMBEDDED_FONTS";
}, },
asc_editChartDrawingObject: function(chart) { asc_editChartDrawingObject: function(chart) {
this.wb.controller.isSelectDrawingObject = true;
var ws = this.wb.getWorksheet(); var ws = this.wb.getWorksheet();
return ws.objectRender.editChartDrawingObject(chart); return ws.objectRender.editChartDrawingObject(chart);
}, },
asc_addImageDrawingObject: function(imageUrl) { asc_addImageDrawingObject: function(imageUrl) {
this.wb.controller.isSelectDrawingObject = true;
var ws = this.wb.getWorksheet(); var ws = this.wb.getWorksheet();
return ws.objectRender.addImageDrawingObject(imageUrl, null); return ws.objectRender.addImageDrawingObject(imageUrl, null);
}, },
...@@ -2262,6 +2260,11 @@ var ASC_DOCS_API_USE_EMBEDDED_FONTS = "@@ASC_DOCS_API_USE_EMBEDDED_FONTS"; ...@@ -2262,6 +2260,11 @@ var ASC_DOCS_API_USE_EMBEDDED_FONTS = "@@ASC_DOCS_API_USE_EMBEDDED_FONTS";
ws.objectRender.controller.putLineSpacingBeforeAfter(type, value); ws.objectRender.controller.putLineSpacingBeforeAfter(type, value);
}, },
asc_setDrawImagePlaceParagraph: function(element_id, props) {
var ws = this.wb.getWorksheet();
ws.objectRender.setDrawImagePlaceParagraph(element_id, props);
},
asyncImageStartLoaded: function() { asyncImageStartLoaded: function() {
}, },
...@@ -2773,8 +2776,7 @@ var ASC_DOCS_API_USE_EMBEDDED_FONTS = "@@ASC_DOCS_API_USE_EMBEDDED_FONTS"; ...@@ -2773,8 +2776,7 @@ var ASC_DOCS_API_USE_EMBEDDED_FONTS = "@@ASC_DOCS_API_USE_EMBEDDED_FONTS";
if (!window['scriptBridge']['addFileImage']) { if (!window['scriptBridge']['addFileImage']) {
window['scriptBridge']['addFileImage'] = function(imageUrl, x, y, width, height) { window['scriptBridge']['addFileImage'] = function(imageUrl, x, y, width, height) {
t.wb.controller.isSelectDrawingObject = true;
var ws = t.wb.getWorksheet(); var ws = t.wb.getWorksheet();
ws.model.workbook.handlers.trigger("asc_onStartAction", c_oAscAsyncActionType.BlockInteraction, c_oAscAsyncAction.LoadImage); ws.model.workbook.handlers.trigger("asc_onStartAction", c_oAscAsyncActionType.BlockInteraction, c_oAscAsyncAction.LoadImage);
...@@ -3174,6 +3176,7 @@ var ASC_DOCS_API_USE_EMBEDDED_FONTS = "@@ASC_DOCS_API_USE_EMBEDDED_FONTS"; ...@@ -3174,6 +3176,7 @@ var ASC_DOCS_API_USE_EMBEDDED_FONTS = "@@ASC_DOCS_API_USE_EMBEDDED_FONTS";
prot["asc_changeImageFromFile"] = prot.asc_changeImageFromFile; prot["asc_changeImageFromFile"] = prot.asc_changeImageFromFile;
prot["asc_putPrLineSpacing"] = prot.asc_putPrLineSpacing; prot["asc_putPrLineSpacing"] = prot.asc_putPrLineSpacing;
prot["asc_putLineSpacingBeforeAfter"] = prot.asc_putLineSpacingBeforeAfter; prot["asc_putLineSpacingBeforeAfter"] = prot.asc_putLineSpacingBeforeAfter;
prot["asc_setDrawImagePlaceParagraph"] = prot.asc_setDrawImagePlaceParagraph;
prot["asc_changeShapeImageFromFile"] = prot.asc_changeShapeImageFromFile; prot["asc_changeShapeImageFromFile"] = prot.asc_changeShapeImageFromFile;
// Cell interface // Cell interface
......
var g_dDpiX = 96.0;
var g_dDpiY = 96.0;
var g_dKoef_mm_to_pix = g_dDpiX / 25.4;
var g_dKoef_pix_to_mm = 25.4 / g_dDpiX;
var g_fontManager = new CFontManager(); var g_fontManager = new CFontManager();
g_fontManager.Initialize(true); g_fontManager.Initialize(true);
...@@ -4493,7 +4500,7 @@ function CDrawingDocument(drawingObjects) ...@@ -4493,7 +4500,7 @@ function CDrawingDocument(drawingObjects)
{ {
bIsChange = true; bIsChange = true;
this.GuiLastTextProps = new CParagraphProp(); this.GuiLastTextProps = new asc_CParagraphProperty();
this.GuiLastTextProps.Subscript = props.Subscript; this.GuiLastTextProps.Subscript = props.Subscript;
this.GuiLastTextProps.Superscript = props.Superscript; this.GuiLastTextProps.Superscript = props.Superscript;
...@@ -4558,10 +4565,14 @@ function CDrawingDocument(drawingObjects) ...@@ -4558,10 +4565,14 @@ function CDrawingDocument(drawingObjects)
return; return;
History.TurnOff(); History.TurnOff();
var _oldTurn = editor.isViewMode; //var _oldTurn = editor.isViewMode;
editor.isViewMode = true; //editor.isViewMode = true;
var par = new Paragraph(this, this.m_oWordControl.m_oLogicDocument, 0, 0, 0, 1000, 1000); //var par = new Paragraph(this, this.m_oWordControl.m_oLogicDocument, 0, 0, 0, 1000, 1000);
var shape = new CShape(null, this.drawingObjects);
shape.addTextBody(new CTextBody(shape));
var par = shape.txBody.content.Content[0];
par.Cursor_MoveToStartPos(); par.Cursor_MoveToStartPos();
...@@ -4599,7 +4610,9 @@ function CDrawingDocument(drawingObjects) ...@@ -4599,7 +4610,9 @@ function CDrawingDocument(drawingObjects)
par.Add(new ParaText("l")); par.Add(new ParaText("l"));
par.Add(new ParaText("d")); par.Add(new ParaText("d"));
par.Recalculate_Page(0); shape.txBody.content.Reset(0, 0, 1000, 1000);
shape.txBody.content.Recalculate_Page(0,true);
var baseLineOffset = par.Lines[0].Y; var baseLineOffset = par.Lines[0].Y;
var _bounds = par.Get_PageBounds(0); var _bounds = par.Get_PageBounds(0);
...@@ -4655,13 +4668,13 @@ function CDrawingDocument(drawingObjects) ...@@ -4655,13 +4668,13 @@ function CDrawingDocument(drawingObjects)
graphics.transform(1,0,0,1,0,0); graphics.transform(1,0,0,1,0,0);
var old_marks = this.m_oWordControl.m_oApi.ShowParaMarks; //var old_marks = this.m_oWordControl.m_oApi.ShowParaMarks;
this.m_oWordControl.m_oApi.ShowParaMarks = false; //this.m_oWordControl.m_oApi.ShowParaMarks = false;
par.Draw(0, graphics); par.Draw(0, graphics);
this.m_oWordControl.m_oApi.ShowParaMarks = old_marks; //this.m_oWordControl.m_oApi.ShowParaMarks = old_marks;
History.TurnOn(); History.TurnOn();
editor.isViewMode = _oldTurn; //editor.isViewMode = _oldTurn;
} }
this.CheckTableStyles = function(tableLook) this.CheckTableStyles = function(tableLook)
......
...@@ -209,14 +209,17 @@ DrawingObjectsController.prototype = ...@@ -209,14 +209,17 @@ DrawingObjectsController.prototype =
var selection_array = this.selectedObjects; var selection_array = this.selectedObjects;
for(var i = 0; i < selection_array.length; ++i) for(var i = 0; i < selection_array.length; ++i)
{ {
var cur_pr = selection_array[i].getAllParagraphParaPr(); if ( typeof(selection_array[i].getAllParagraphParaPr) === "function" )
if(cur_pr != null) {
{ var cur_pr = selection_array[i].getAllParagraphParaPr();
if(result == null) if(cur_pr != null)
result = cur_pr; {
else if(result == null)
result = result.Compare(cur_pr); result = cur_pr;
} else
result = result.Compare(cur_pr);
}
}
} }
if(result != null) if(result != null)
return result; return result;
...@@ -232,9 +235,10 @@ DrawingObjectsController.prototype = ...@@ -232,9 +235,10 @@ DrawingObjectsController.prototype =
case STATES_ID_TEXT_ADD: case STATES_ID_TEXT_ADD:
{ {
var pr = this.curState.textObject.getParagraphTextPr(); var pr = this.curState.textObject.getParagraphTextPr();
if(pr != null) /*if(pr != null)
return pr; return pr;
return new CTextPr(); return new CTextPr();*/
return pr;
} }
case STATES_ID_TEXT_ADD_IN_GROUP: case STATES_ID_TEXT_ADD_IN_GROUP:
{ {
...@@ -242,11 +246,13 @@ DrawingObjectsController.prototype = ...@@ -242,11 +246,13 @@ DrawingObjectsController.prototype =
if(typeof this.curState.textObject.getParagraphTextPr === "function") if(typeof this.curState.textObject.getParagraphTextPr === "function")
{ {
pr = this.curState.textObject.getParagraphTextPr(); pr = this.curState.textObject.getParagraphTextPr();
if(pr != null) /*if(pr != null)
return pr; return pr;
return new CTextPr(); return new CTextPr();*/
return pr;
} }
return new CTextPr(); //return new CTextPr();
return null;
} }
default: default:
{ {
...@@ -254,18 +260,23 @@ DrawingObjectsController.prototype = ...@@ -254,18 +260,23 @@ DrawingObjectsController.prototype =
var selection_array = this.selectedObjects; var selection_array = this.selectedObjects;
for(var i = 0; i < selection_array.length; ++i) for(var i = 0; i < selection_array.length; ++i)
{ {
var cur_pr = selection_array[i].getAllParagraphTextPr(); if ( typeof(selection_array[i].getAllParagraphTextPr) === "function" )
if(cur_pr != null) {
{ var cur_pr = selection_array[i].getAllParagraphTextPr();
if(result == null) if(cur_pr != null)
result = cur_pr; {
else if(result == null)
result = result.Compare(cur_pr); result = cur_pr;
} else
result = result.Compare(cur_pr);
}
}
} }
if(result != null) /*if(result != null)
return result; return result;
return new CTextPr(); return new CTextPr();*/
return result;
} }
} }
}, },
...@@ -994,48 +1005,13 @@ DrawingObjectsController.prototype = ...@@ -994,48 +1005,13 @@ DrawingObjectsController.prototype =
// Текстовые свойства объекта // Текстовые свойства объекта
var ParaPr = this.getParagraphParaPr(); var ParaPr = this.getParagraphParaPr();
var TextPr = this.getParagraphTextPr(); var TextPr = this.getParagraphTextPr();
if ( ParaPr && TextPr ) { if ( ParaPr && TextPr ) {
this.prepareTextProperties(TextPr);
this.prepareParagraphProperties(ParaPr, TextPr); this.prepareParagraphProperties(ParaPr, TextPr);
} }
return ascSelectedObjects; return ascSelectedObjects;
}, },
prepareTextProperties: function(TextPr)
{
/*var _this = this;
var trigger = this.drawingObjects.callTrigger;
if ( "undefined" != typeof(TextPr) )
{
var oTextPrMap =
{
Bold : function(_this, v){ trigger("asc_onBold", v); },
Italic : function(_this, v){ trigger("asc_onItalic", v); },
Underline : function(_this, v){ trigger("asc_onUnderline", v); },
Strikeout : function(_this, v){ trigger("asc_onStrikeout", v); },
FontSize : function(_this, v){ trigger("asc_onFontSize", v); },
FontFamily : function(_this, v){ (v != undefined) ? trigger("asc_onFontFamily", new asc_CTextFontFamily(v)) : new asc_CTextFontFamily( { Name : "", Index : -1 } ); },
VertAlign : function(_this, v){ trigger("asc_onVerticalAlign", v); },
Color : function(_this, v){ if (v != undefined) trigger("asc_onTextColor", CreateAscColorCustomEx(v.r, v.g, v.b)); },
HighLight : function(_this, v){ if (v != undefined) trigger("asc_onTextHighLight", new asc_CColor(v.r, v.g, v.b)); },
Spacing : function(_this, v){ trigger("asc_onTextSpacing", v); },
DStrikeout : function(_this, v){ trigger("asc_onTextDStrikeout", v); },
Caps : function(_this, v){ trigger("asc_onTextDStrikeout", v); },
SmallCaps : function(_this, v){ trigger("asc_onTextSmallCaps", v); },
Position : function(_this, v){ trigger("asc_onTextPosition", v); },
Lang : function(_this, v){ trigger("asc_onTextLanguage", v);}
}
for ( var Item in oTextPrMap )
{
oTextPrMap[Item]( this, TextPr[Item] );
}
}*/
},
prepareParagraphProperties: function(ParaPr, TextPr) prepareParagraphProperties: function(ParaPr, TextPr)
{ {
var _this = this; var _this = this;
...@@ -1086,17 +1062,19 @@ DrawingObjectsController.prototype = ...@@ -1086,17 +1062,19 @@ DrawingObjectsController.prototype =
ascSelectedObjects.push(new asc_CSelectedObject( c_oAscTypeSelectElement.Paragraph, new asc_CParagraphProperty( ParaPr ) )); ascSelectedObjects.push(new asc_CSelectedObject( c_oAscTypeSelectElement.Paragraph, new asc_CParagraphProperty( ParaPr ) ));
}, },
putPrLineSpacing: function(type, value) { putPrLineSpacing: function(type, value)
{
}, },
putLineSpacingBeforeAfter: function(type, value) { putLineSpacingBeforeAfter: function(type, value)
{
}, },
setGraphicObjectProps: function(props) setGraphicObjectProps: function(props)
{ {
History.Create_NewPoint(); History.Create_NewPoint();
var properties; var properties;
if ( (props instanceof asc_CImgProperty) && props.ShapeProperties) if ( (props instanceof asc_CImgProperty) && props.ShapeProperties )
properties = props.ShapeProperties; properties = props.ShapeProperties;
else else
properties = props; properties = props;
...@@ -1117,7 +1095,7 @@ DrawingObjectsController.prototype = ...@@ -1117,7 +1095,7 @@ DrawingObjectsController.prototype =
this.curState.textObject.setTextVerticalAlign(props.verticalTextAlign); this.curState.textObject.setTextVerticalAlign(props.verticalTextAlign);
} }
} }
if (!(this.curState.id === STATES_ID_GROUP || this.curState.id === STATES_ID_TEXT_ADD_IN_GROUP) && isRealObject(properties)) if ( !(this.curState.id === STATES_ID_GROUP || this.curState.id === STATES_ID_TEXT_ADD_IN_GROUP) )
{ {
var ArrGlyph = this.selectedObjects; var ArrGlyph = this.selectedObjects;
for (var i = 0; i< ArrGlyph.length; ++i) for (var i = 0; i< ArrGlyph.length; ++i)
...@@ -1143,10 +1121,12 @@ DrawingObjectsController.prototype = ...@@ -1143,10 +1121,12 @@ DrawingObjectsController.prototype =
result_height = ArrGlyph[i].extY; result_height = ArrGlyph[i].extY;
if (ArrGlyph[i].isShape() || ArrGlyph[i].isImage()) if (ArrGlyph[i].isShape() || ArrGlyph[i].isImage())
{ {
ArrGlyph[i].setAbsoluteTransform(null, null, result_width, result_height, null, false, false); ArrGlyph[i].setExtents(result_width, result_height);
ArrGlyph[i].setXfrm(null, null, result_width, result_height, null, null, null); ArrGlyph[i].setXfrm(null, null, result_width, result_height, null, null, null);
ArrGlyph[i].calculateAfterResize(); ArrGlyph[i].recalculateTransform();
ArrGlyph[i].calculateContent();
ArrGlyph[i].calculateTransformTextMatrix();
} }
} }
......
...@@ -228,12 +228,12 @@ CImage.prototype = ...@@ -228,12 +228,12 @@ CImage.prototype =
if(extX != null) if(extX != null)
{ {
this.absExtX = extX; this.extX = extX;
} }
if(extY != null) if(extY != null)
{ {
this.absExtY = extY; this.extY = extY;
} }
if(rot != null) if(rot != null)
...@@ -388,7 +388,7 @@ CImage.prototype = ...@@ -388,7 +388,7 @@ CImage.prototype =
calculateAfterResize: function(transform, bChangeSize, bAfterOpen) calculateAfterResize: function(transform, bChangeSize, bAfterOpen)
{ {
if(this.spPr.geometry !== null) if(this.spPr.geometry !== null)
this.spPr.geometry.Recalculate(this.absExtX, this.absExtY); this.spPr.geometry.Recalculate(this.extX, this.extY);
this.calculateTransformMatrix(transform); this.calculateTransformMatrix(transform);
this.calculateTransformTextMatrix(); this.calculateTransformTextMatrix();
...@@ -396,8 +396,8 @@ CImage.prototype = ...@@ -396,8 +396,8 @@ CImage.prototype =
if(isRealObject(this.chart) && (bChangeSize === true || this.chart.img == "")&& bAfterOpen !== true) if(isRealObject(this.chart) && (bChangeSize === true || this.chart.img == "")&& bAfterOpen !== true)
{ {
this.chart.width = this.drawingDocument.GetDotsPerMM(this.absExtX); this.chart.width = this.drawingDocument.GetDotsPerMM(this.extX);
this.chart.height = this.drawingDocument.GetDotsPerMM(this.absExtY); this.chart.height = this.drawingDocument.GetDotsPerMM(this.extY);
var chartRender = new ChartRender(); var chartRender = new ChartRender();
var chartBase64 = chartRender.insertChart(this.chart, null, this.chart.width, this.chart.height); var chartBase64 = chartRender.insertChart(this.chart, null, this.chart.width, this.chart.height);
......
...@@ -1605,12 +1605,12 @@ CShape.prototype = ...@@ -1605,12 +1605,12 @@ CShape.prototype =
if(extX != null) if(extX != null)
{ {
this.absExtX = extX; this.extX = extX;
} }
if(extY != null) if(extY != null)
{ {
this.absExtY = extY; this.extY = extY;
} }
/*if(extX != null || extY!=null) /*if(extX != null || extY!=null)
{ {
...@@ -2750,6 +2750,10 @@ CShape.prototype = ...@@ -2750,6 +2750,10 @@ CShape.prototype =
} }
}; };
function CheckLinePreset(preset)
{
return preset === "line";
}
function CorrectUniFill(asc_fill, unifill) function CorrectUniFill(asc_fill, unifill)
{ {
......
...@@ -52,8 +52,9 @@ ...@@ -52,8 +52,9 @@
this.targetInfo = undefined; this.targetInfo = undefined;
this.isResizeMode = false; this.isResizeMode = false;
this.isResizeModeMove = false; this.isResizeModeMove = false;
// Для обработки событий автофигур
this.isGraphicObjectMode = false;
// Режим автозаполнения // Режим автозаполнения
this.isSelectDrawingObject = false;
this.isFillHandleMode = false; this.isFillHandleMode = false;
this.isMoveRangeMode = false; this.isMoveRangeMode = false;
this.isMoveResizeRange = false; this.isMoveResizeRange = false;
...@@ -1045,13 +1046,15 @@ ...@@ -1045,13 +1046,15 @@
} }
// Shapes // Shapes
this.isGraphicObjectMode = false;
var graphicsInfo = t.handlers.trigger("getGraphicsInfo", coord.x, coord.y); var graphicsInfo = t.handlers.trigger("getGraphicsInfo", coord.x, coord.y);
if ( graphicsInfo && graphicsInfo.isGraphicObject ) {
asc["editor"].isStartAddShape = true; if ( asc["editor"].isStartAddShape || (graphicsInfo && graphicsInfo.isGraphicObject) ) {
t.isSelectDrawingObject = true; this.isGraphicObjectMode = true;
asc["editor"].isStartAddShape = false;
} }
if ( asc["editor"].isStartAddShape ) { if ( this.isGraphicObjectMode ) {
event.ClickCount = 1; event.ClickCount = 1;
t.handlers.trigger("graphicObjectMouseDown", event, coord.x, coord.y); t.handlers.trigger("graphicObjectMouseDown", event, coord.x, coord.y);
if ( t.isCellEditMode ) if ( t.isCellEditMode )
...@@ -1063,8 +1066,10 @@ ...@@ -1063,8 +1066,10 @@
t.handlers.trigger("changeSelection", /*isStartPoint*/true, coord.x, coord.y, /*isCoord*/true, /*isSelectMode*/true); t.handlers.trigger("changeSelection", /*isStartPoint*/true, coord.x, coord.y, /*isCoord*/true, /*isSelectMode*/true);
return; return;
} }
else if ( t.targetInfo && t.targetInfo.target != "moveResizeRange" ) else if ( t.targetInfo && t.targetInfo.target != "moveResizeRange" ) {
t.handlers.trigger("resetSelectedGraphicObjects"); t.handlers.trigger("resetSelectedGraphicObjects");
this.isGraphicObjectMode = false;
}
if (event.originalEvent && 2 === event.originalEvent.detail) { if (event.originalEvent && 2 === event.originalEvent.detail) {
// Это означает, что это MouseDown для dblClick эвента (его обрабатывать не нужно) // Это означает, что это MouseDown для dblClick эвента (его обрабатывать не нужно)
...@@ -1091,8 +1096,6 @@ ...@@ -1091,8 +1096,6 @@
this.mouseDownLastCord = coord; this.mouseDownLastCord = coord;
t.hasFocus = true; t.hasFocus = true;
t.isSelectDrawingObject = false;
if (!t.isCellEditMode) { if (!t.isCellEditMode) {
if (event.shiftKey) { if (event.shiftKey) {
t._changeSelection(event, /*isSelectMode*/false); t._changeSelection(event, /*isSelectMode*/false);
...@@ -1189,9 +1192,11 @@ ...@@ -1189,9 +1192,11 @@
// Shapes // Shapes
var coord = this._getCoordinates(event); var coord = this._getCoordinates(event);
if ( asc["editor"].isStartAddShape ) { if ( this.isGraphicObjectMode ) {
this.handlers.trigger("graphicObjectMouseUp", event, coord.x, coord.y); this.handlers.trigger("graphicObjectMouseUp", event, coord.x, coord.y);
return; this._changeSelectionDone(event);
this.isGraphicObjectMode = false;
return true;
} }
if (this.isSelectMode) { if (this.isSelectMode) {
...@@ -1233,7 +1238,7 @@ ...@@ -1233,7 +1238,7 @@
t.hasCursor = true; t.hasCursor = true;
// Shapes // Shapes
if ( asc["editor"].isStartAddShape ) { if ( this.isGraphicObjectMode ) {
t.handlers.trigger("graphicObjectMouseMove", event, coord.x, coord.y); t.handlers.trigger("graphicObjectMouseMove", event, coord.x, coord.y);
t.handlers.trigger("updateWorksheet", t.element[0], coord.x, coord.y, event.ctrlKey, function(info){t.targetInfo = info;}); t.handlers.trigger("updateWorksheet", t.element[0], coord.x, coord.y, event.ctrlKey, function(info){t.targetInfo = info;});
return; return;
...@@ -1297,7 +1302,7 @@ ...@@ -1297,7 +1302,7 @@
* @param delta {Number} * @param delta {Number}
*/ */
_onMouseWheel: function (event, delta) { _onMouseWheel: function (event, delta) {
if (this.isFillHandleMode || this.isMoveRangeMode || this.isMoveResizeChartsRange || (this.isSelectDrawingObject && event.shiftKey) || this.isMoveResizeRange) { if (this.isFillHandleMode || this.isMoveRangeMode || this.isMoveResizeChartsRange || this.isMoveResizeRange) {
return true; return true;
} }
var self = this; var self = this;
......
...@@ -298,7 +298,7 @@ ...@@ -298,7 +298,7 @@
} }
self.controller.setStrictClose(true); self.controller.setStrictClose(true);
self.cellEditor.callTopLineMouseup = true; self.cellEditor.callTopLineMouseup = true;
if (!self.controller.isCellEditMode && !self.controller.isFillHandleMode && !self.controller.isSelectDrawingObject) { if (!self.controller.isCellEditMode && !self.controller.isFillHandleMode) {
self._onEditCell(0, 0, /*isCoord*/false, /*isFocus*/true); self._onEditCell(0, 0, /*isCoord*/false, /*isFocus*/true);
} }
}); });
......
...@@ -426,6 +426,7 @@ ...@@ -426,6 +426,7 @@
this.isFormulaEditMode = false; this.isFormulaEditMode = false;
this.isChartAreaEditMode = false; this.isChartAreaEditMode = false;
this.lockDraw = false; this.lockDraw = false;
this.isUpdateSelection = false;
this.isSelectionDialogMode = false; this.isSelectionDialogMode = false;
this.copyOfActiveRange = null; this.copyOfActiveRange = null;
...@@ -5681,13 +5682,42 @@ ...@@ -5681,13 +5682,42 @@
var fa = c.getFontAlign().toLowerCase(); var fa = c.getFontAlign().toLowerCase();
var cellType = c.getType(); var cellType = c.getType();
var isNumberFormat = (!cellType || CellValueType.Number === cellType); var isNumberFormat = (!cellType || CellValueType.Number === cellType);
var isGraphicObject = this.objectRender.selectedGraphicObjectsExists();
var textPr = this.objectRender.controller.getParagraphTextPr();
var paraPr = this.objectRender.controller.getParagraphParaPr();
var cell_info = new asc_CCellInfo(); var cell_info = new asc_CCellInfo();
cell_info.name = this._getColumnTitle(c1) + this._getRowTitle(r1); cell_info.name = this._getColumnTitle(c1) + this._getRowTitle(r1);
cell_info.formula = c.getFormula(); cell_info.formula = c.getFormula();
cell_info.text = c.getValueForEdit(); cell_info.text = c.getValueForEdit();
cell_info.halign = c.getAlignHorizontalByValue().toLowerCase();
cell_info.valign = c.getAlignVertical().toLowerCase(); this.isUpdateSelection = false;
if ( isGraphicObject && textPr && paraPr ) {
this.isUpdateSelection = true;
var horAlign = "center";
switch (paraPr.Jc) {
case align_Left: horAlign = "left"; break;
case align_Right: horAlign = "right"; break;
case align_Center: horAlign = "center"; break;
case align_Justify: horAlign = "justify"; break;
}
var vertAlign = "center";
/*switch (textPr.VertAlign) {
case VERTICAL_ANCHOR_TYPE_TOP: vertAlign = "top"; break;
case VERTICAL_ANCHOR_TYPE_CENTER: vertAlign = "center"; break;
case VERTICAL_ANCHOR_TYPE_BOTTOM: vertAlign = "bottom"; break;
}*/
cell_info.halign = horAlign;
cell_info.valign = vertAlign;
}
else {
cell_info.halign = c.getAlignHorizontalByValue().toLowerCase();
cell_info.valign = c.getAlignVertical().toLowerCase();
}
cell_info.isFormatTable = this.autoFilters.searchRangeInTableParts(activeCell, this); cell_info.isFormatTable = this.autoFilters.searchRangeInTableParts(activeCell, this);
cell_info.styleName = c.getStyleName(); cell_info.styleName = c.getStyleName();
...@@ -5699,19 +5729,18 @@ ...@@ -5699,19 +5729,18 @@
cell_info.flags.lockText = ("" !== cell_info.text && (isNumberFormat || "" !== cell_info.formula)); cell_info.flags.lockText = ("" !== cell_info.text && (isNumberFormat || "" !== cell_info.formula));
cell_info.font = new asc_CFont(); cell_info.font = new asc_CFont();
var isGraphicObject = this.objectRender.selectedGraphicObjectsExists();
var textPr = this.objectRender.controller.getParagraphTextPr(); if ( isGraphicObject && textPr && paraPr ) {
if ( isGraphicObject && textPr && (textPr.Bold != undefined) && (textPr.Italic != undefined) && (textPr.Underline != undefined) && (textPr.FontFamily != undefined) ) {
cell_info.font.name = textPr.FontFamily.Name; cell_info.font.name = textPr.FontFamily.Name;
cell_info.font.size = textPr.FontSize; cell_info.font.size = textPr.FontSize;
cell_info.font.bold = textPr.Bold; cell_info.font.bold = textPr.Bold;
cell_info.font.italic = textPr.Italic; cell_info.font.italic = textPr.Italic;
cell_info.font.underline = textPr.Underline; cell_info.font.underline = textPr.Underline;
cell_info.font.strikeout = textPr.Strikeout; cell_info.font.strikeout = textPr.Strikeout;
//cell_info.font.subscript = fa === "subscript"; cell_info.font.subscript = (textPr.VertAlign == vertalign_SubScript) ? true : false;
//cell_info.font.superscript = fa === "superscript"; cell_info.font.superscript = (textPr.VertAlign == vertalign_SuperScript) ? true : false;
cell_info.font.color = CreateAscColorCustom(textPr.Color.r, textPr.Color.g, textPr.Color.b); if ( textPr.Color )
cell_info.font.color = CreateAscColorCustom(textPr.Color.r, textPr.Color.g, textPr.Color.b);
} }
else { else {
cell_info.font.name = c.getFontname(); cell_info.font.name = c.getFontname();
...@@ -5869,6 +5898,9 @@ ...@@ -5869,6 +5898,9 @@
if ( this.objectRender.controller.curState.id != STATES_ID_BEGIN_TRACK_NEW_SHAPE ) { if ( this.objectRender.controller.curState.id != STATES_ID_BEGIN_TRACK_NEW_SHAPE ) {
this.objectRender.unselectDrawingObjects(); this.objectRender.unselectDrawingObjects();
asc["editor"].isStartAddShape = false; asc["editor"].isStartAddShape = false;
if ( this.isUpdateSelection )
this._trigger("selectionChanged", this.getSelectionInfo());
} }
} }
......
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