From 130a197fd7ae4311be1dd93076cc2e8517b18a83 Mon Sep 17 00:00:00 2001
From: "Dmitry.Vikulov" <Dmitry.Vikulov@OnlyOffice.com>
Date: Wed, 14 Aug 2013 14:34:20 +0000
Subject: [PATCH] =?UTF-8?q?-=20=D0=94=D0=BE=D0=B1=D0=B0=D0=B2=D0=BB=D0=B5?=
 =?UTF-8?q?=D0=BD=D1=8B=20asc=5FputPrLineSpacing=20+=20asc=5FputLineSpacin?=
 =?UTF-8?q?gBeforeAfter=20-=20=D0=95=D1=81=D0=BB=D0=B8=20=D0=BA=D0=BB?=
 =?UTF-8?q?=D0=B8=D0=BA=D0=B0=D0=B5=D0=BC=20=D0=BF=D0=BE=20=D0=B3=D1=80?=
 =?UTF-8?q?=D0=B0=D1=84.=D0=BE=D0=B1=D1=8A=D0=B5=D0=BA=D1=82=D1=83,=20?=
 =?UTF-8?q?=D1=82=D0=BE=20cellInfo.asc=5FgetFont()=20=D0=B2=D0=BE=D0=B7?=
 =?UTF-8?q?=D0=B2=D1=80=D0=B0=D1=89=D0=B0=D0=B5=D1=82=20=D0=BD=D0=B0=D1=81?=
 =?UTF-8?q?=D1=82=D1=80=D0=BE=D0=B9=D0=BA=D0=B8=20=D1=82=D0=B5=D0=BA=D1=81?=
 =?UTF-8?q?=D1=82=D0=B0=20=D0=B4=D0=BB=D1=8F=20=D1=88=D0=B5=D0=B9=D0=BF?=
 =?UTF-8?q?=D0=B0=20-=20=D0=9F=D1=80=D0=B8=20=D0=BA=D0=BB=D0=B8=D0=BA?=
 =?UTF-8?q?=D0=B5=20=D0=BF=D0=BE=20=D0=B3=D1=80=D0=B0=D1=84.=D0=BE=D0=B1?=
 =?UTF-8?q?=D1=8A=D0=B5=D0=BA=D1=82=D1=83=20=D0=BD=D0=B5=20=D0=BC=D0=B5?=
 =?UTF-8?q?=D0=BD=D1=8F=D0=B5=D1=82=D1=81=D1=8F=20selectionName=20-=20?=
 =?UTF-8?q?=D0=95=D1=81=D0=BB=D0=B8=20=D0=B3=D1=80=D0=B0=D1=84.=D0=BE?=
 =?UTF-8?q?=D0=B1=D1=8A=D0=B5=D0=BA=D1=82=20=D0=B7=D0=B0=D1=81=D0=B5=D0=BB?=
 =?UTF-8?q?=D0=B5=D0=BA=D1=87=D0=B5=D0=BD,=20=D1=82=D0=BE=20=D0=BF=D0=BE?=
 =?UTF-8?q?=20Esc=20=D1=81=D0=B5=D0=BB=D0=B5=D0=BA=D1=82=20=D1=81=D0=B1?=
 =?UTF-8?q?=D1=80=D0=BE=D1=81=D0=B8=D1=82=D1=81=D1=8F=20=D0=B8=20=D0=B2?=
 =?UTF-8?q?=D1=8B=D0=B4=D0=B5=D0=BB=D0=B8=D1=82=D1=81=D1=8F=20=D0=BF=D0=BE?=
 =?UTF-8?q?=D1=81=D0=BB=D0=B5=D0=B4=D0=BD=D1=8F=D1=8F=20=D0=B7=D0=B0=D1=81?=
 =?UTF-8?q?=D0=B5=D0=BB=D0=B5=D0=BA=D1=87=D0=B5=D0=BD=D0=BD=D0=B0=D1=8F=20?=
 =?UTF-8?q?=D1=8F=D1=87=D0=B5=D0=B9=D0=BA=D0=B0?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

git-svn-id: svn://192.168.3.15/activex/AVS/Sources/TeamlabOffice/trunk/OfficeWeb@48817 954022d7-b5bf-4e40-9824-e11837661b57
---
 Excel/api.js                                  | 12 +++++
 .../DrawingObjectsController.js               | 10 +++-
 Excel/model/DrawingObjects/States.js          |  2 +
 Excel/view/WorksheetView.js                   | 54 ++++++++++++-------
 4 files changed, 56 insertions(+), 22 deletions(-)

diff --git a/Excel/api.js b/Excel/api.js
index cccdca17c..1127cab81 100644
--- a/Excel/api.js
+++ b/Excel/api.js
@@ -2252,6 +2252,16 @@ var ASC_DOCS_API_USE_EMBEDDED_FONTS = "@@ASC_DOCS_API_USE_EMBEDDED_FONTS";
 				this.asc_showImageFileDialog();
 			},
 			
+			asc_putPrLineSpacing: function(type, value) {
+				var ws = this.wb.getWorksheet();
+				ws.objectRender.controller.putPrLineSpacing(type, value);
+			},
+			
+			asc_putLineSpacingBeforeAfter: function(type,value) { // "type == 0" means "Before", "type == 1" means "After"
+				var ws = this.wb.getWorksheet();
+				ws.objectRender.controller.putLineSpacingBeforeAfter(type, value);
+			},
+			
 			asyncImageStartLoaded: function() {
 			},
 			
@@ -3162,6 +3172,8 @@ var ASC_DOCS_API_USE_EMBEDDED_FONTS = "@@ASC_DOCS_API_USE_EMBEDDED_FONTS";
 		prot["asc_changeShapeType"] = prot.asc_changeShapeType;
 		prot["asc_setInterfaceDrawImagePlaceShape"] = prot.asc_setInterfaceDrawImagePlaceShape;
 		prot["asc_changeImageFromFile"] = prot.asc_changeImageFromFile;
+		prot["asc_putPrLineSpacing"] = prot.asc_putPrLineSpacing;
+		prot["asc_putLineSpacingBeforeAfter"] = prot.asc_putLineSpacingBeforeAfter;
 		prot["asc_changeShapeImageFromFile"] = prot.asc_changeShapeImageFromFile;
 		
 		// Cell interface
diff --git a/Excel/model/DrawingObjects/DrawingObjectsController.js b/Excel/model/DrawingObjects/DrawingObjectsController.js
index 2631778a5..6863dac9d 100644
--- a/Excel/model/DrawingObjects/DrawingObjectsController.js
+++ b/Excel/model/DrawingObjects/DrawingObjectsController.js
@@ -1005,7 +1005,7 @@ DrawingObjectsController.prototype =
 	
 	prepareTextProperties: function(TextPr)
 	{
-		var _this = this;
+		/*var _this = this;
 		var trigger = this.drawingObjects.callTrigger;
 		
 		if ( "undefined" != typeof(TextPr) )
@@ -1033,7 +1033,7 @@ DrawingObjectsController.prototype =
 			{
 				oTextPrMap[Item]( this, TextPr[Item] );
 			}
-		}
+		}*/
 	},
 	
 	prepareParagraphProperties: function(ParaPr, TextPr)
@@ -1086,6 +1086,12 @@ DrawingObjectsController.prototype =
 		ascSelectedObjects.push(new asc_CSelectedObject( c_oAscTypeSelectElement.Paragraph, new asc_CParagraphProperty( ParaPr ) ));
 	},
 	
+	putPrLineSpacing: function(type, value) {
+	},
+	
+	putLineSpacingBeforeAfter: function(type, value) {
+	},
+	
 	setGraphicObjectProps: function(props)
 	{
         History.Create_NewPoint();
diff --git a/Excel/model/DrawingObjects/States.js b/Excel/model/DrawingObjects/States.js
index 2749c4a40..32f889a82 100644
--- a/Excel/model/DrawingObjects/States.js
+++ b/Excel/model/DrawingObjects/States.js
@@ -4846,6 +4846,8 @@ function DefaultKeyDownHandle(drawingObjectsController, e)
         {
             case STATES_ID_NULL:
             {
+				drawingObjectsController.drawingObjects.unselectDrawingObjects();
+				drawingObjectsController.drawingObjects.getWorksheet()._drawSelection();
                 bRetValue = true;
                 break;
             }
diff --git a/Excel/view/WorksheetView.js b/Excel/view/WorksheetView.js
index 8959117b1..23c5d4c89 100644
--- a/Excel/view/WorksheetView.js
+++ b/Excel/view/WorksheetView.js
@@ -5359,6 +5359,13 @@
 				var xpos = x;
 				var ypos = y;
 				var ar = (this.isFormulaEditMode) ? this.arrActiveFormulaRanges[this.arrActiveFormulaRanges.length - 1] : this.activeRange;
+				
+				var cursorInfo = this.objectRender.checkCursorDrawingObject(xpos, ypos);
+				if ( cursorInfo ) {
+					var graphicSelectionType = this.objectRender.getGraphicSelectionType(cursorInfo.data);
+					ar.type = graphicSelectionType;
+					return;
+				}
 
 				x *= asc_getcvt( 0/*px*/, 1/*pt*/, this._getPPIX() );
 				y *= asc_getcvt( 0/*px*/, 1/*pt*/, this._getPPIY() );
@@ -5389,17 +5396,8 @@
 					ar.assign(c, r, c, r);
 					ar.startCol = c;
 					ar.startRow = r;
-
-					var cursorInfo = this.objectRender.checkCursorDrawingObject(xpos, ypos);
-					if ( cursorInfo ) {
-						var graphicSelectionType = this.objectRender.getGraphicSelectionType(cursorInfo.data);
-						ar.type = graphicSelectionType;
-					}
-					else
-					{
-						ar.type = c_oAscSelectionType.RangeCells;
-						this._fixSelectionOfMergedCells();
-					}
+					ar.type = c_oAscSelectionType.RangeCells;
+					this._fixSelectionOfMergedCells();
 				}
 			},
 
@@ -5713,15 +5711,31 @@
 				cell_info.flags.lockText = ("" !== cell_info.text && (isNumberFormat || "" !== cell_info.formula));
 
 				cell_info.font = new asc_CFont();
-				cell_info.font.name = c.getFontname();
-				cell_info.font.size = c.getFontsize();
-				cell_info.font.bold = c.getBold();
-				cell_info.font.italic = c.getItalic();
-				cell_info.font.underline = ("none" !== c.getUnderline()); // ToDo убрать, когда будет реализовано двойное подчеркивание
-				cell_info.font.strikeout = c.getStrikeout();
-				cell_info.font.subscript = fa === "subscript";
-				cell_info.font.superscript = fa === "superscript";
-				cell_info.font.color = (fc ? asc_obj2Color(fc) : asc_n2Color(c_opt.defaultState.colorNumber));
+				var isGraphicObject = this.objectRender.selectedGraphicObjectsExists();
+				var textPr = this.objectRender.controller.getParagraphTextPr();
+				
+				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.size = textPr.FontSize;
+					cell_info.font.bold = textPr.Bold;
+					cell_info.font.italic = textPr.Italic;
+					cell_info.font.underline = textPr.Underline;
+					cell_info.font.strikeout = textPr.Strikeout;
+					//cell_info.font.subscript = fa === "subscript";
+					//cell_info.font.superscript = fa === "superscript";
+					cell_info.font.color = CreateAscColorCustom(textPr.Color.r, textPr.Color.g, textPr.Color.b);
+				}
+				else {
+					cell_info.font.name = c.getFontname();
+					cell_info.font.size = c.getFontsize();
+					cell_info.font.bold = c.getBold();
+					cell_info.font.italic = c.getItalic();
+					cell_info.font.underline = ("none" !== c.getUnderline()); // ToDo убрать, когда будет реализовано двойное подчеркивание
+					cell_info.font.strikeout = c.getStrikeout();
+					cell_info.font.subscript = fa === "subscript";
+					cell_info.font.superscript = fa === "superscript";
+					cell_info.font.color = (fc ? asc_obj2Color(fc) : asc_n2Color(c_opt.defaultState.colorNumber));
+				}
 
 				cell_info.fill = new asc_CFill((null !==  bg && undefined !== bg) ? asc_obj2Color(bg) : bg);
 
-- 
2.30.9