Commit ca475ba0 authored by Sergey Luzyanin's avatar Sergey Luzyanin

title, description

parent f53cdaeb
...@@ -215,11 +215,43 @@ function addToDrawings(worksheet, graphic, position, lockByDefault, anchor) ...@@ -215,11 +215,43 @@ function addToDrawings(worksheet, graphic, position, lockByDefault, anchor)
CShape.prototype.addToDrawingObjects = function(pos) CShape.prototype.addToDrawingObjects = function(pos)
{ {
var controller = this.getDrawingObjectsController();
var position = addToDrawings(this.worksheet, this, pos, /*lockByDefault*/undefined, undefined); var position = addToDrawings(this.worksheet, this, pos, /*lockByDefault*/undefined, undefined);
var data = {Type: AscDFH.historyitem_AutoShapes_AddToDrawingObjects, Pos: position}; var data = {Type: AscDFH.historyitem_AutoShapes_AddToDrawingObjects, Pos: position};
History.Add(this, data); History.Add(this, data);
this.worksheet.addContentChanges(new AscCommon.CContentChangesElement(AscCommon.contentchanges_Add, data.Pos, 1, data)); this.worksheet.addContentChanges(new AscCommon.CContentChangesElement(AscCommon.contentchanges_Add, data.Pos, 1, data));
var nv_sp_pr, bNeedSet = false;
switch(this.getObjectType()){
case AscDFH.historyitem_type_Shape:{
if(!this.nvSpPr){
bNeedSet = true;
}
break;
}
case AscDFH.historyitem_type_ChartSpace:{
if(!this.nvGraphicFramePr){
bNeedSet = true;
}
break;
}
case AscDFH.historyitem_type_ImageShape:{
if(!this.nvPicPr){
bNeedSet = true;
}
break;
}
case AscDFH.historyitem_type_GroupShape:{
if(!this.nvGrpSpPr){
bNeedSet = true;
}
break;
}
}
if(bNeedSet){
nv_sp_pr = new AscFormat.UniNvPr();
nv_sp_pr.cNvPr.setId(++AscFormat.Ax_Counter.GLOBAL_AX_ID_COUNTER);
this.setNvSpPr(nv_sp_pr);
}
}; };
......
...@@ -2531,6 +2531,11 @@ DrawingObjectsController.prototype = ...@@ -2531,6 +2531,11 @@ DrawingObjectsController.prototype =
objects_by_type.charts[i].setTitle(props.title); objects_by_type.charts[i].setTitle(props.title);
} }
for(i = 0; i < objects_by_type.images.length; ++i)
{
objects_by_type.images[i].setTitle(props.title);
}
for(i = 0; i < objects_by_type.shapes.length; ++i) for(i = 0; i < objects_by_type.shapes.length; ++i)
{ {
objects_by_type.shapes[i].setDescription(props.description); objects_by_type.shapes[i].setDescription(props.description);
...@@ -2544,6 +2549,11 @@ DrawingObjectsController.prototype = ...@@ -2544,6 +2549,11 @@ DrawingObjectsController.prototype =
objects_by_type.charts[i].setDescription(props.description); objects_by_type.charts[i].setDescription(props.description);
} }
for(i = 0; i < objects_by_type.images.length; ++i)
{
objects_by_type.images[i].setDescription(props.description);
}
if(typeof props.ImageUrl === "string" && props.ImageUrl.length > 0) if(typeof props.ImageUrl === "string" && props.ImageUrl.length > 0)
{ {
for(i = 0; i < objects_by_type.images.length; ++i) for(i = 0; i < objects_by_type.images.length; ++i)
...@@ -7314,6 +7324,10 @@ DrawingObjectsController.prototype = ...@@ -7314,6 +7324,10 @@ DrawingObjectsController.prototype =
shape_props.ShapeProperties.canChangeArrows = props.shapeProps.canChangeArrows; shape_props.ShapeProperties.canChangeArrows = props.shapeProps.canChangeArrows;
shape_props.ShapeProperties.bFromChart = props.shapeProps.bFromChart; shape_props.ShapeProperties.bFromChart = props.shapeProps.bFromChart;
shape_props.ShapeProperties.lockAspect = props.shapeProps.lockAspect; shape_props.ShapeProperties.lockAspect = props.shapeProps.lockAspect;
shape_props.ShapeProperties.description = props.shapeProps.description;
shape_props.ShapeProperties.title = props.shapeProps.title;
shape_props.description = props.shapeProps.description;
shape_props.title = props.shapeProps.title;
shape_props.ShapeProperties.textArtProperties = AscFormat.CreateAscTextArtProps(props.shapeProps.textArtProperties); shape_props.ShapeProperties.textArtProperties = AscFormat.CreateAscTextArtProps(props.shapeProps.textArtProperties);
shape_props.lockAspect = props.shapeProps.lockAspect; shape_props.lockAspect = props.shapeProps.lockAspect;
if(props.shapeProps.textArtProperties) if(props.shapeProps.textArtProperties)
...@@ -7382,6 +7396,9 @@ DrawingObjectsController.prototype = ...@@ -7382,6 +7396,9 @@ DrawingObjectsController.prototype =
image_props.oleWidth = props.imageProps.oleWidth; image_props.oleWidth = props.imageProps.oleWidth;
image_props.oleHeight = props.imageProps.oleHeight; image_props.oleHeight = props.imageProps.oleHeight;
image_props.description = props.imageProps.description;
image_props.title = props.imageProps.title;
if(!bParaLocked) if(!bParaLocked)
{ {
bParaLocked = image_props.Locked; bParaLocked = image_props.Locked;
...@@ -7400,6 +7417,9 @@ DrawingObjectsController.prototype = ...@@ -7400,6 +7417,9 @@ DrawingObjectsController.prototype =
{ {
bParaLocked = chart_props.Locked; bParaLocked = chart_props.Locked;
} }
chart_props.description = props.chartProps.description;
chart_props.title = props.chartProps.title;
ret.push(chart_props); ret.push(chart_props);
} }
for (i = 0; i < ret.length; i++) for (i = 0; i < ret.length; i++)
......
...@@ -428,6 +428,9 @@ ...@@ -428,6 +428,9 @@
}; };
CGraphicObjectBase.prototype.setTitle = function(sTitle){ CGraphicObjectBase.prototype.setTitle = function(sTitle){
if(undefined === sTitle){
return;
}
var oNvPr = this.getNvProps(); var oNvPr = this.getNvProps();
if(oNvPr){ if(oNvPr){
oNvPr.setTitle(sTitle ? sTitle : null); oNvPr.setTitle(sTitle ? sTitle : null);
...@@ -435,6 +438,9 @@ ...@@ -435,6 +438,9 @@
}; };
CGraphicObjectBase.prototype.setDescription = function(sDescription){ CGraphicObjectBase.prototype.setDescription = function(sDescription){
if(undefined === sDescription){
return;
}
var oNvPr = this.getNvProps(); var oNvPr = this.getNvProps();
if(oNvPr){ if(oNvPr){
oNvPr.setDecr(sDescription ? sDescription : null); oNvPr.setDecr(sDescription ? sDescription : null);
......
...@@ -3924,6 +3924,9 @@ background-repeat: no-repeat;\ ...@@ -3924,6 +3924,9 @@ background-repeat: no-repeat;\
ImagePr.Width = null === obj.Width ? null : parseFloat(obj.Width); ImagePr.Width = null === obj.Width ? null : parseFloat(obj.Width);
ImagePr.Height = null === obj.Height ? null : parseFloat(obj.Height); ImagePr.Height = null === obj.Height ? null : parseFloat(obj.Height);
ImagePr.title = obj.title;
ImagePr.description = obj.description;
if (undefined != obj.Position) if (undefined != obj.Position)
{ {
ImagePr.Position = ImagePr.Position =
......
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