Commit 31820ea4 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@49524 954022d7-b5bf-4e40-9824-e11837661b57
parent faed83ee
......@@ -25,7 +25,101 @@ DrawingObjectsController.prototype =
},
setCellFontName: function (fontName) {
this.checkSelectedObjectsAndCallback(this.setCellFontNameCallBack, [fontName]);
},
setCellFontSize: function (fontSize) {
this.checkSelectedObjectsAndCallback(this.setCellFontSizeCallBack, [fontSize]);
},
setCellBold: function (isBold) {
this.checkSelectedObjectsAndCallback(this.setCellBoldCallBack, [isBold]);
},
setCellItalic: function (isItalic) {
this.checkSelectedObjectsAndCallback(this.setCellItalicCallBack, [isItalic]);
},
setCellUnderline: function (isUnderline) {
this.checkSelectedObjectsAndCallback(this.setCellUnderlineCallBack, [isUnderline]);
},
setCellStrikeout: function (isStrikeout) {
this.checkSelectedObjectsAndCallback(this.setCellStrikeoutCallBack, [isStrikeout]);
},
setCellSubscript: function (isSubscript) {
this.checkSelectedObjectsAndCallback(this.setCellSubscriptCallBack, [isSubscript]);
},
setCellSuperscript: function (isSuperscript) {
this.checkSelectedObjectsAndCallback(this.setCellSuperscriptCallBack, [isSuperscript]);
},
setCellAlign: function (align) {
this.checkSelectedObjectsAndCallback(this.setCellAlignCallBack, [align]);
},
setCellVertAlign: function (align) {
this.checkSelectedObjectsAndCallback(this.setCellVertAlignCallBack, [align]);
},
setCellTextWrap: function (isWrapped) {
this.checkSelectedObjectsAndCallback(this.setCellTextWrapCallBack, [isWrapped]);
},
setCellTextShrink: function (isShrinked) {
this.checkSelectedObjectsAndCallback(this.setCellTextShrinkCallBack, [isShrinked]);
},
setCellTextColor: function (color) {
this.checkSelectedObjectsAndCallback(this.setCellTextColorCallBack, [color]);
},
setCellBackgroundColor: function (color) {
this.checkSelectedObjectsAndCallback(this.setCellBackgroundColorCallBack, [color]);
},
setCellAngle: function (angle) {
this.checkSelectedObjectsAndCallback(this.setCellAngleCallBack, [angle]);
},
setCellStyle: function (name) {
this.checkSelectedObjectsAndCallback(this.setCellStyleCallBack, [name]);
},
// Увеличение размера шрифта
increaseFontSize: function () {
this.checkSelectedObjectsAndCallback(this.increaseFontSizeCallBack, []);
},
// Уменьшение размера шрифта
decreaseFontSize: function () {
this.checkSelectedObjectsAndCallback(this.decreaseFontSizeCallBack, []);
},
setCellFontNameCallBack: function (fontName) {
if(typeof this.curState.setCellFontName === "function")
{
History.Create_NewPoint();
......@@ -33,7 +127,7 @@ DrawingObjectsController.prototype =
}
},
setCellFontSize: function (fontSize) {
setCellFontSizeCallBack: function (fontSize) {
if(typeof this.curState.setCellFontSize === "function")
{
History.Create_NewPoint();
......@@ -41,7 +135,7 @@ DrawingObjectsController.prototype =
}
},
setCellBold: function (isBold) {
setCellBoldCallBack: function (isBold) {
if(typeof this.curState.setCellBold === "function")
{
History.Create_NewPoint();
......@@ -49,7 +143,7 @@ DrawingObjectsController.prototype =
}
},
setCellItalic: function (isItalic) {
setCellItalicCallBack: function (isItalic) {
if(typeof this.curState.setCellItalic === "function")
{
History.Create_NewPoint();
......@@ -57,7 +151,7 @@ DrawingObjectsController.prototype =
}
},
setCellUnderline: function (isUnderline) {
setCellUnderlineCallBack: function (isUnderline) {
if(typeof this.curState.setCellUnderline === "function")
{
History.Create_NewPoint();
......@@ -65,7 +159,7 @@ DrawingObjectsController.prototype =
}
},
setCellStrikeout: function (isStrikeout) {
setCellStrikeoutCallBack: function (isStrikeout) {
if(typeof this.curState.setCellStrikeout === "function")
{
History.Create_NewPoint();
......@@ -73,7 +167,7 @@ DrawingObjectsController.prototype =
}
},
setCellSubscript: function (isSubscript) {
setCellSubscriptCallBack: function (isSubscript) {
if(typeof this.curState.setCellSubscript === "function")
{
History.Create_NewPoint();
......@@ -81,7 +175,7 @@ DrawingObjectsController.prototype =
}
},
setCellSuperscript: function (isSuperscript) {
setCellSuperscriptCallBack: function (isSuperscript) {
if(typeof this.curState.setCellSuperscript === "function")
{
History.Create_NewPoint();
......@@ -89,7 +183,7 @@ DrawingObjectsController.prototype =
}
},
setCellAlign: function (align) {
setCellAlignCallBack: function (align) {
if(typeof this.curState.setCellAlign === "function")
{
History.Create_NewPoint();
......@@ -97,7 +191,7 @@ DrawingObjectsController.prototype =
}
},
setCellVertAlign: function (align) {
setCellVertAlignCallBack: function (align) {
if(typeof this.curState.setCellVertAlign === "function")
{
History.Create_NewPoint();
......@@ -105,7 +199,7 @@ DrawingObjectsController.prototype =
}
},
setCellTextWrap: function (isWrapped) {
setCellTextWrapCallBack: function (isWrapped) {
if(typeof this.curState.setCellTextWrap === "function")
{
History.Create_NewPoint();
......@@ -113,7 +207,7 @@ DrawingObjectsController.prototype =
}
},
setCellTextShrink: function (isShrinked) {
setCellTextShrinkCallBack: function (isShrinked) {
if(typeof this.curState.setCellTextShrink === "function")
{
History.Create_NewPoint();
......@@ -121,7 +215,7 @@ DrawingObjectsController.prototype =
}
},
setCellTextColor: function (color) {
setCellTextColorCallBack: function (color) {
if(typeof this.curState.setCellTextColor === "function")
{
History.Create_NewPoint();
......@@ -130,7 +224,7 @@ DrawingObjectsController.prototype =
},
setCellBackgroundColor: function (color) {
setCellBackgroundColorCallBack: function (color) {
if(typeof this.curState.setCellBackgroundColor === "function")
{
History.Create_NewPoint();;
......@@ -139,7 +233,7 @@ DrawingObjectsController.prototype =
},
setCellAngle: function (angle) {
setCellAngleCallBack: function (angle) {
if(typeof this.curState.setCellAngle === "function")
{
History.Create_NewPoint();
......@@ -147,7 +241,7 @@ DrawingObjectsController.prototype =
}
},
setCellStyle: function (name) {
setCellStyleCallBack: function (name) {
if(typeof this.curState.setCellStyle === "function")
{
History.Create_NewPoint();
......@@ -156,7 +250,7 @@ DrawingObjectsController.prototype =
},
// Увеличение размера шрифта
increaseFontSize: function () {
increaseFontSizeCallBack: function () {
if(typeof this.curState.increaseFontSize === "function")
{
History.Create_NewPoint();
......@@ -165,7 +259,7 @@ DrawingObjectsController.prototype =
},
// Уменьшение размера шрифта
decreaseFontSize: function () {
decreaseFontSizeCallBack: function () {
if(typeof this.curState.decreaseFontSize === "function")
{
History.Create_NewPoint();
......@@ -859,7 +953,7 @@ DrawingObjectsController.prototype =
shape_props.ShapeProperties.stroke = c_obj.getStroke();
shape_props.ShapeProperties.canChangeArrows = c_obj.canChangeArrows();
shape_props.ShapeProperties.paddings = c_obj.getPaddings();
shape_props.ShapeProperties.IsLocked = !(c_obj.lockType === c_oAscLockTypes.kLockTypeNone || c_obj.lockType === c_oAscLockTypes.kLockTypeNone);
shape_props.verticalTextAlign = isRealObject(c_obj.txBody) ? c_obj.txBody.getBodyPr().anchor : null;
}
else
......@@ -870,7 +964,7 @@ DrawingObjectsController.prototype =
ShapeProperties.stroke = c_obj.getStroke();
ShapeProperties.canChangeArrows = c_obj.canChangeArrows();
ShapeProperties.paddings = c_obj.getPaddings();
ShapeProperties.IsLocked = !(c_obj.lockType === c_oAscLockTypes.kLockTypeNone || c_obj.lockType === c_oAscLockTypes.kLockTypeNone);
shape_props = c_obj.Get_Props(shape_props);
shape_props.ShapeProperties = CompareShapeProperties(ShapeProperties, shape_props.ShapeProperties);
shape_props.verticalTextAlign = undefined;
......@@ -884,12 +978,15 @@ DrawingObjectsController.prototype =
image_props.Width = c_obj.extX;
image_props.Height = c_obj.extY;
image_props.ImageUrl = c_obj.getImageUrl();
image_props.IsLocked = !(c_obj.lockType === c_oAscLockTypes.kLockTypeNone || c_obj.lockType === c_oAscLockTypes.kLockTypeNone);
}
else
{
var locked = !(c_obj.lockType === c_oAscLockTypes.kLockTypeNone|| c_obj.lockType === c_oAscLockTypes.kLockTypeNone) || image_props.IsLocked;
image_props = c_obj.Get_Props(image_props);
if (image_props.ImageUrl != null && c_obj.getImageUrl() !== image_props.ImageUrl)
image_props.ImageUrl = null;
image_props.IsLocked = locked;
}
}
......@@ -1078,6 +1175,33 @@ DrawingObjectsController.prototype =
setGraphicObjectProps: function(props)
{
this.checkSelectedObjectsAndCallback(this.setGraphicObjectPropsCallBack, [props])
},
checkSelectedObjectsAndCallback: function(callback, args)
{
var selection_state = this.getSelectionState();
this.drawingObjects.objectLocker.reset();
for(var i = 0; i < this.selectedObjects.length; ++i)
{
this.drawingObjects.objectLocker.addObjectId(this.selectedObjects[i].Get_Id());
}
var _this = this;
var callback2 = function(bLock)
{
if(bLock)
{
_this.setSelectionState(selection_state);
callback.apply(_this, args);
}
};
this.drawingObjects.objectLocker.checkObjects(callback2);
},
setGraphicObjectPropsCallBack: function(props)
{
History.Create_NewPoint();
var properties;
if ( (props instanceof asc_CImgProperty) && props.ShapeProperties )
......@@ -1178,7 +1302,6 @@ DrawingObjectsController.prototype =
//if (false === this.document.Document_Is_SelectionLocked(changestype_Drawing_Props, {Type : changestype_2_Element_and_Type , Element : this.curState.group.parent.Parent, CheckType : changestype_Paragraph_Content} ))
{
ArrGlyph = this.curState.group.selectedObjects;
var b_change_diagram = false;
for (i = 0; i< ArrGlyph.length; ++i)
{
if (ArrGlyph[i].isShape() && isRealObject(properties))
......@@ -1210,16 +1333,6 @@ DrawingObjectsController.prototype =
ArrGlyph[i].setCellAllVertAlign(props.verticalTextAlign);
}
}
if (b_change_diagram)
{
/*this.curState.group.updateSizes();
this.curState.group.recalculate();
var bounds = this.curState.group.parent.getBounds();
if (!this.curState.group.parent.Is_Inline())
this.curState.group.parent.OnEnd_ChangeFlow(this.curState.group.absOffsetX, this.curState.group.absOffsetY, this.curState.group.pageIndex, bounds.r - bounds.l, bounds.b - bounds.t, null, true, true);
else
this.curState.group.parent.OnEnd_ResizeInline(bounds.r - bounds.l, bounds.b - bounds.t); */
}
}
}
}
......
......@@ -1125,8 +1125,9 @@ CChartAsGroup.prototype =
if ( !this.chart.range.intervalObject )
this.drawingObjects.intervalToIntervalObject(this.chart);
this.brush.fill.RasterImageId = this.drawingObjects.getChartRender().insertChart(this.chart, null, this.drawingObjects.convertMetric(this.extX, 3, 0),this.drawingObjects.convertMetric(this.extY, 3, 0));
this.drawingObjects.loadImageRedraw(this.brush.fill.RasterImageId);
this.brush.fill.canvas= this.drawingObjects.getChartRender().insertChart(this.chart, null, this.drawingObjects.convertMetric(this.extX, 3, 0),this.drawingObjects.convertMetric(this.extY, 3, 0));
this.brush.fill.RasterImageId = "";
//this.drawingObjects.loadImageRedraw(this.brush.fill.RasterImageId);
},
getInvertTransform: function()
......@@ -1470,8 +1471,9 @@ CChartAsGroup.prototype =
if ( !this.chart.range.intervalObject )
this.drawingObjects.intervalToIntervalObject(this.chart);
this.brush.fill.RasterImageId = this.drawingObjects.getChartRender().insertChart(this.chart, null, this.drawingObjects.convertMetric(this.extX, 3, 0),this.drawingObjects.convertMetric(this.extY, 3, 0));
this.drawingObjects.loadImageRedraw(this.brush.fill.RasterImageId);
this.brush.fill.canvas= this.drawingObjects.getChartRender().insertChart(this.chart, null, this.drawingObjects.convertMetric(this.extX, 3, 0),this.drawingObjects.convertMetric(this.extY, 3, 0));
this.brush.fill.RasterImageId = "";
//this.drawingObjects.loadImageRedraw(this.brush.fill.RasterImageId);
},
Undo: function(type, data)
......@@ -1481,6 +1483,12 @@ CChartAsGroup.prototype =
case historyitem_AutoShapes_RecalculateTransformUndo:
{
this.recalculate();
break;
}
case historyitem_AutoShapes_Add_To_Drawing_Objects:
{
this.drawingObjects.deleteDrawingBase(this.Id);
break;
}
}
},
......@@ -1492,6 +1500,13 @@ CChartAsGroup.prototype =
case historyitem_AutoShapes_RecalculateTransformRedo:
{
this.recalculate();
break;
}
case historyitem_AutoShapes_Add_To_Drawing_Objects:
{
this.drawingObjects.addGraphicObject(this, data.oldValue);
break;
}
}
},
......
......@@ -2753,6 +2753,7 @@ function CompareShapeProperties(shapeProp1, shapeProp2)
_result_shape_prop.canChangeArrows = true;
_result_shape_prop.fill = CompareUniFill(shapeProp1.fill, shapeProp2.fill);
_result_shape_prop.IsLocked = shapeProp1.IsLocked === true || shapeProp2.IsLocked === true;
if(isRealObject(shapeProp1.paddings) && isRealObject(shapeProp2.paddings))
{
_result_shape_prop.paddings = new asc_CPaddings();
......
......@@ -181,6 +181,78 @@ Paragraph.prototype =
},
recalculateFonts: function()
{
var theme = this.Parent.getTheme();
var color_map = this.Parent.getColorMap();
var TextPr = this.CompiledPr.Pr.TextPr;
if(isRealObject(TextPr.unifill) && isRealObject(TextPr.unifill.fill))
{
if(typeof TextPr.themeFont === "string")
{
var font_name = getFontInfo(TextPr.themeFont)(theme.themeElements.fontScheme);
TextPr.FontFamily = {Name: font_name, Index: -1};
}
}
for(var i = 0; i < this.Content.length; ++i)
{
if(this.Content[i].Type === para_TextPr)
{
TextPr = this.Content[i].Value;
if(typeof TextPr.themeFont === "string")
{
var font_name = getFontInfo(TextPr.themeFont)(theme.themeElements.fontScheme);
TextPr.FontFamily = {Name: font_name, Index: -1};
}
}
}
},
recalculateTextPr: function()
{
var theme = this.Parent.getTheme();
var color_map = this.Parent.getColorMap();
var TextPr = this.CompiledPr.Pr.TextPr;
if(isRealObject(TextPr.unifill) && isRealObject(TextPr.unifill.fill))
{
TextPr.unifill.calculate(theme, color_map, {R:0, G: 0, B: 0, A:255});
if(isRealObject(TextPr.unifill.fill.color))
{
var color = TextPr.unifill.fill.color.RGBA;
TextPr.Color = new CDocumentColor(color.R, color.G, color.B);
}
else if(Array.isArray(TextPr.unifill.fill.colors) && isRealObject(TextPr.unifill.fill.colors[0]))
{
var color = TextPr.unifill.fill.colors[0].RGBA;
TextPr.Color = new CDocumentColor(color.R, color.G, color.B);
}
}
for(var i = 0; i < this.Content.length; ++i)
{
if(this.Content[i].Type === para_TextPr)
{
TextPr = this.Content[i].Value;
if(isRealObject(TextPr.unifill) && isRealObject(TextPr.unifill.fill))
{
TextPr.unifill.calculate(theme, color_map, {R:0, G: 0, B: 0, A:255});
if(isRealObject(TextPr.unifill.fill.color))
{
var color = TextPr.unifill.fill.color.RGBA;
TextPr.Color = new CDocumentColor(color.R, color.G, color.B);
}
else if(Array.isArray(TextPr.unifill.fill.colors) && isRealObject(TextPr.unifill.fill.colors[0]))
{
var color = TextPr.unifill.fill.colors[0].RGBA;
TextPr.Color = new CDocumentColor(color.R, color.G, color.B);
}
}
}
}
},
GetType : function()
......@@ -6405,10 +6477,6 @@ Paragraph.prototype =
TextPr.FontFamily = {Name: font_name, Index: -1};
}
if ( undefined != TextPr.FontFamily )
{
var FName = TextPr.FontFamily.Name;
......
......@@ -1397,7 +1397,7 @@ CShape.prototype =
}
else
{
this.clipRect = {x: 0, y: 0, w: this.absExtX, h: this.absExtY};
this.clipRect = {x: 0, y: 0, w: this.extX, h: this.extY};
}
}
else
......@@ -1535,8 +1535,8 @@ CShape.prototype =
this.clipRect = {
x: -l_ins,
y: -_vertical_shift - t_ins,
w: this.contentWidth + (r_ins + l_ins),
h: this.contentHeight + (b_ins + t_ins)
w: this.txBody.contentWidth + (r_ins + l_ins),
h: this.txBody.contentHeight + (b_ins + t_ins)
};
}
this.invertTransformText = global_MatrixTransformer.Invert(this.transformText);
......@@ -1864,16 +1864,20 @@ CShape.prototype =
{
graphics.SetIntegerGrid(false);
graphics.transform3(this.transformText);
var clip_rect = this.clipRect;
//graphics.AddClipRect(clip_rect.x, clip_rect.y, clip_rect.w, clip_rect.h);
this.txBody.draw(graphics);
/* if (graphics.FreeFont !== undefined)
graphics.FreeFont(); */
graphics.reset();
// graphics.RestoreGrState();
graphics.SetIntegerGrid(true);
}
},
drawTextSelection: function()
{
if(isRealObject(this.txBody))
......
......@@ -653,6 +653,10 @@ CTextBody.prototype =
}
this.content.Reset(0, 0, _content_width, 20000);
this.content.Recalculate_Page(0, true );
for(var i = 0; i < this.content.Content.length; ++i)
{
this.content.Content[i].recalculateTextPr();
}
},
OnEndRecalculate_Page: function()
......
......@@ -2671,7 +2671,7 @@ function GroupState(drawingObjectsController, drawingObjects, group)
cur_grouped_object.selectionSetStart(e, x, y);
this.drawingObjectsController.changeCurrentState(new TextAddInGroup(this.drawingObjectsController, this.drawingObjects, this.group, cur_drawing));
if(e.ClickCount < 2)
cur_drawing.updateSelectionState(this.drawingObjects.drawingDocument);
cur_grouped_object.updateSelectionState(this.drawingObjects.drawingDocument);
return;
}
}
......@@ -2887,8 +2887,8 @@ function TextAddInGroup(drawingObjectsController, drawingObjects, group, textObj
};
this.drawSelection = function(drawingDocument)
{
drawingDocument.DrawTrack(TYPE_TRACK_GROUP_PASSIVE, this.group.getTransform(), 0, 0, this.group.extX, this.group.extY, false/*, selected_objects[i].canRotate()TODO*/);
drawingDocument.DrawTrack(TYPE_TRACK_TEXT, this.textObject.getTransform(), 0, 0, this.textObject.extX, this.textObject.extY, false/*, selected_objects[i].canRotate()TODO*/)
drawingDocument.DrawTrack(TYPE_TRACK_GROUP_PASSIVE, this.group.getTransform(), 0, 0, this.group.extX, this.group.extY, false, this.group.canRotate());
drawingDocument.DrawTrack(TYPE_TRACK_TEXT, this.textObject.getTransform(), 0, 0, this.textObject.extX, this.textObject.extY, false, this.textObject.canRotate());
this.textObject.drawAdjustments(drawingDocument);
};
......
......@@ -2587,7 +2587,12 @@ UndoRedoGraphicObjects.prototype =
{
target_object.Undo(Type, Data.drawingData);
if(typeof target_object.Refresh_RecalcData === "function")
{
if(!(target_object instanceof CDocumentContent && (Type ===historyitem_AutoShapes_AddDrawingDocument
|| Type ===historyitem_AutoShapes_AddParent || Type ===historyitem_AutoShapes_AddParagraph)))
target_object.Refresh_RecalcData(Type, Data);
}
}
}
else
......
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