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

git-svn-id: svn://192.168.3.15/activex/AVS/Sources/TeamlabOffice/trunk/OfficeWeb@50294 954022d7-b5bf-4e40-9824-e11837661b57
parent 7ce9a373
......@@ -1211,10 +1211,62 @@ DrawingObjectsController.prototype =
putPrLineSpacing: function(type, value)
{
},
putPrLineSpacingCallback: function(type, value)
{
switch (this.curState.id)
{
case STATES_ID_TEXT_ADD:
case STATES_ID_TEXT_ADD_IN_GROUP:
{
var spacing = new CParaSpacing();
var _type;
switch(type)
{
case 0:
{
_type = linerule_AtLeast;
break;
}
case 1:
{
_type = linerule_Auto;
break;
}
case 2:
{
_type = linerule_Exact;
break;
}
}
var spacing = new CParaSpacing();
spacing.LineRule = _type;
spacing.Line = value;
this.curState.textObject.txBody.content.Set_ParagraphSpacing(spacing);
break;
}
case STATES_ID_NULL:
{
if(editor.WordControl.m_oLogicDocument.Document_Is_SelectionLocked(changestype_Text_Props) === false)
{
for(var i = 0; i < this.selectedObjects.length; ++i)
{
if(typeof this.selectedObjects[i].applyAllSpacing === "function")
{
this.selectedObjects[i].applyAllSpacing(val);
}
}
}
break;
}
}
},
putLineSpacingBeforeAfter: function(type, value)
{
},
setGraphicObjectProps: function(props)
{
......
......@@ -1473,7 +1473,7 @@ CBlipFill.prototype =
getObjectType: function()
{
return CLASS_TYPE_SOLID_FILL;
return CLASS_TYPE_BLIP_FILL;
},
setRasterImageId: function(rasterImageId)
......
......@@ -54,6 +54,20 @@ function CGroupShape(drawingBase, drawingObjects)
CGroupShape.prototype =
{
applyAllSpacing: function(val)
{
for(var i = 0; i < this.spTree.length; ++i)
{
}
if(isRealObject(this.txBody))
{
this.txBody.content.Set_ApplyToAll(true);
this.txBody.content.Set_ParagraphSpacing(val);
this.txBody.content.Set_ApplyToAll(false);
}
},
getAllFonts: function(AllFonts)
{
for(var i = 0; i< this.spTree.length; ++i)
......
......@@ -39,8 +39,7 @@ function CImageShape(drawingBase, drawingObjects)
this.drawingBase = drawingBase;
this.drawingObjects = drawingObjects;
this.blipFill = new CUniFill();
this.blipFill.fill = new CBlipFill();
this.spPr = new CSpPr();
this.nvSpPr = null;
this.style = null;
......@@ -74,6 +73,14 @@ function CImageShape(drawingBase, drawingObjects)
this.selected = false;
this.Id = g_oIdCounter.Get_NewId();
g_oTableId.Add(this, this.Id);
if(isRealObject(drawingObjects))
this.setDrawingObjects(drawingObjects);
if(isRealObject(drawingObjects))
{
var blip_fill = new CUniFill();
blip_fill.setFill(new CBlipFill());
this.setBlipFill(blip_fill);
}
}
CImageShape.prototype =
......@@ -82,6 +89,16 @@ CImageShape.prototype =
{
},
setDrawingObjects: function(drawingObjects)
{
var newValue = isRealObject(drawingObjects) ? drawingObjects.getWorksheet().model.getId() : null;
var oldValue = isRealObject(this.drawingObjects) ? this.drawingObjects.getWorksheet().model.getId() : null;
History.Add(g_oUndoRedoGraphicObjects, historyitem_AutoShapes_SetDrawingObjects, null, null,
new UndoRedoDataGraphicObjects(this.Get_Id(), new UndoRedoDataGOSingleProp(oldValue, newValue)));
this.drawingObjects = drawingObjects;
},
getObjectType: function()
{
return CLASS_TYPE_IMAGE;
......@@ -143,13 +160,20 @@ CImageShape.prototype =
this.setImageId(imageId);
this.setPresetGeometry("rect");
this.recalculate();
History.Add(g_oUndoRedoGraphicObjects, historyitem_AutoShapes_RecalculateAfterInit, null, null,
new UndoRedoDataGraphicObjects(this.Get_Id(), new UndoRedoDataGOSingleProp(null, null)));
},
setXfrmObject: function(xfrm)
{
var oldId = isRealObject(this.spPr.xfrm) ? this.spPr.xfrm.Get_Id() : null;
var newId = isRealObject(xfrm) ? xfrm.Get_Id() : null;
History.Add(g_oUndoRedoGraphicObjects, historyitem_AutoShapes_SetXfrm, null, null,
new UndoRedoDataGraphicObjects(this.Get_Id(), new UndoRedoDataGOSingleProp(oldId, newId)));
this.spPr.xfrm = xfrm;
},
setDrawingBase: function(drawingBase)
{
this.drawingBase = drawingBase;
......@@ -157,10 +181,17 @@ CImageShape.prototype =
setPresetGeometry: function(preset)
{
var oldId = isRealObject(this.spPr.geometry) ? this.spPr.geometry.Get_Id() : null;
this.spPr.geometry = CreateGeometry(preset);
var newId = this.spPr.geometry.Get_Id();
History.Add(g_oUndoRedoGraphicObjects, historyitem_AutoShapes_SetPresetGeometry, null, null,
new UndoRedoDataGraphicObjects(this.Get_Id(), new UndoRedoDataGOSingleProp(oldId, newId)));
this.spPr.geometry.Init(5, 5);
},
setPosition: function(x, y)
{
var model_id = this.drawingObjects.getWorksheet().model.getId();
......@@ -198,14 +229,17 @@ CImageShape.prototype =
setRasterImage: function(img, canvas)
{
this.blipFill = new CUniFill();
this.blipFill.fill = new CBlipFill();
this.blipFill.fill.RasterImageId = img;
/*this.blipFill = new CUniFill();
this.blipFill.fill = new CBlipFill();*/
this.blipFill.fill.setRasterImageId(img);
if(isRealObject(canvas))
this.blipFill.fill.canvas = canvas;
// this.spPr.Fill = new CUniFill();
this.spPr.Fill = this.blipFill;
this.brush = this.spPr.Fill;
History.Add(g_oUndoRedoGraphicObjects, historyitem_AutoShapes_RecalculateAfterInit, null, null,
new UndoRedoDataGraphicObjects(this.Get_Id(), new UndoRedoDataGOSingleProp(null, null)));
},
updateDrawingBaseCoordinates: function()
......@@ -216,7 +250,7 @@ CImageShape.prototype =
setImageId: function(imageId)
{
this.blipFill.fill.RasterImageId = imageId;
this.setRasterImage(imageId);
},
setAbsoluteTransform: function(offsetX, offsetY, extX, extY, rot, flipH, flipV, bAfterOpen)
......@@ -352,6 +386,11 @@ CImageShape.prototype =
{
aImagesSync.push(getFullImageSrc(this.brush.fill.RasterImageId));
}
if(this.drawingObjects)
{
this.drawingObjects.loadImageRedraw(this.brush.fill.RasterImageId);
}
},
recalculateTransform: function()
......@@ -1054,6 +1093,22 @@ CImageShape.prototype =
{
switch (type)
{
case historyitem_AutoShapes_SetPresetGeometry:
{
this.spPr.geometry = g_oTableId.Get_ById(data.oldValue);
break;
}
case historyitem_AutoShapes_Set_ImageBlipFill:
{
this.blipFill = g_oTableId.Get_ById(data.oldValue);
break;
}
case historyitem_AutoShapes_SetXfrm:
{
this.spPr.xfrm = g_oTableId.Get_ById(data.oldValue);
break;
}
case historyitem_AutoShapes_RecalculateTransformUndo:
{
this.recalculateTransform();
......@@ -1071,6 +1126,19 @@ CImageShape.prototype =
this.drawingObjects.addGraphicObject(this, data.oldValue);
break;
}
case historyitem_AutoShapes_SetDrawingObjects:
{
if(data.oldValue !== null)
{
var api = window["Asc"]["editor"];
if ( api.wb )
{
var ws = api.wb.getWorksheetById(data.oldValue);
this.drawingObjects = ws.objectRender;
}
}
break;
}
}
},
......@@ -1078,6 +1146,43 @@ CImageShape.prototype =
{
switch (type)
{
case historyitem_AutoShapes_SetPresetGeometry:
{
this.spPr.geometry = g_oTableId.Get_ById(data.newValue);
break;
}
case historyitem_AutoShapes_Set_ImageBlipFill:
{
this.blipFill = g_oTableId.Get_ById(data.newValue);
break;
}
case historyitem_AutoShapes_RecalculateAfterInit:
{
this.recalculateTransform();
this.calculateContent();
this.calculateTransformTextMatrix();
this.recalculateBrush();
break;
}
case historyitem_AutoShapes_SetXfrm:
{
this.spPr.xfrm = g_oTableId.Get_ById(data.newValue);
break;
}
case historyitem_AutoShapes_SetDrawingObjects:
{
if(data.newValue !== null)
{
var api = window["Asc"]["editor"];
if ( api.wb )
{
var ws = api.wb.getWorksheetById(data.newValue);
this.drawingObjects = ws.objectRender;
}
}
break;
}
case historyitem_AutoShapes_RecalculateTransformRedo:
{
this.recalculateTransform();
......@@ -1115,7 +1220,12 @@ CImageShape.prototype =
},
setBlipFill: function(blipFill)
{
var oldValue = this.blipFill ? this.blipFill.Get_Id() : null;
var newValue = blipFill ? blipFill.Get_Id() : null;
this.blipFill = blipFill;
History.Add(g_oUndoRedoGraphicObjects, historyitem_AutoShapes_Set_ImageBlipFill, null, null,
new UndoRedoDataGraphicObjects(this.Get_Id(), new UndoRedoDataGOSingleProp(oldValue, newValue)));
},
writeToBinaryForCopyPaste: function(w)
......
......@@ -8297,6 +8297,14 @@ Paragraph.prototype =
Pr.TextPr.FontFamily = {Name: font_name, Index: -1};
}
if(Pr.TextPr.FontFamily && Pr.TextPr.FontFamily.Name)
{
Pr.TextPr.RFonts.Ascii = {Name:Pr.TextPr.FontFamily.Name, Index: -1};
Pr.TextPr.RFonts.CS = {Name:Pr.TextPr.FontFamily.Name, Index: -1};
Pr.TextPr.RFonts.EastAsia = {Name:Pr.TextPr.FontFamily.Name, Index: -1};
Pr.TextPr.RFonts.HAnsi = {Name:Pr.TextPr.FontFamily.Name, Index: -1};
}
// Если в стиле была задана нумерация сохраним это в специальном поле
if ( undefined != Pr.ParaPr.NumPr )
Pr.ParaPr.StyleNumPr = Pr.ParaPr.NumPr.Copy();
......@@ -8642,37 +8650,49 @@ Paragraph.prototype =
if ( ( undefined != Spacing.Line || true === bDeleteUndefined ) && this.Pr.Spacing.Line !== Spacing.Line )
{
History.Add( this, { Type : historyitem_Paragraph_Spacing_Line, New : Spacing.Line, Old : ( undefined != this.Pr.Spacing.Line ? this.Pr.Spacing.Line : undefined ) } );
// History.Add( this, { Type : historyitem_Paragraph_Spacing_Line, New : Spacing.Line, Old : ( undefined != this.Pr.Spacing.Line ? this.Pr.Spacing.Line : undefined ) } );
History.Add(g_oUndoRedoGraphicObjects, historyitem_Paragraph_Spacing_Line, null, null, new UndoRedoDataGraphicObjects(this.Get_Id(), new UndoRedoDataGOSingleProp(( undefined != this.Pr.Spacing.Line ? this.Pr.Spacing.Line : undefined ), Spacing.Line)));
this.Pr.Spacing.Line = Spacing.Line;
}
if ( ( undefined != Spacing.LineRule || true === bDeleteUndefined ) && this.Pr.Spacing.LineRule !== Spacing.LineRule )
{
History.Add( this, { Type : historyitem_Paragraph_Spacing_LineRule, New : Spacing.LineRule, Old : ( undefined != this.Pr.Spacing.LineRule ? this.Pr.Spacing.LineRule : undefined ) } );
//History.Add( this, { Type : historyitem_Paragraph_Spacing_LineRule, New : Spacing.LineRule, Old : ( undefined != this.Pr.Spacing.LineRule ? this.Pr.Spacing.LineRule : undefined ) } );
History.Add(g_oUndoRedoGraphicObjects, historyitem_Paragraph_Spacing_LineRule, null, null, new UndoRedoDataGraphicObjects(this.Get_Id(), new UndoRedoDataGOSingleProp(( undefined != this.Pr.Spacing.LineRule ? this.Pr.Spacing.LineRule : undefined ), Spacing.LineRule)));
this.Pr.Spacing.LineRule = Spacing.LineRule;
}
if ( ( undefined != Spacing.Before || true === bDeleteUndefined ) && this.Pr.Spacing.Before !== Spacing.Before )
{
History.Add( this, { Type : historyitem_Paragraph_Spacing_Before, New : Spacing.Before, Old : ( undefined != this.Pr.Spacing.Before ? this.Pr.Spacing.Before : undefined ) } );
// History.Add( this, { Type : historyitem_Paragraph_Spacing_Before, New : Spacing.Before, Old : ( undefined != this.Pr.Spacing.Before ? this.Pr.Spacing.Before : undefined ) } );
History.Add(g_oUndoRedoGraphicObjects, historyitem_Paragraph_Spacing_Before, null, null, new UndoRedoDataGraphicObjects(this.Get_Id(), new UndoRedoDataGOSingleProp(( undefined != this.Pr.Spacing.Before ? this.Pr.Spacing.Before : undefined ), Spacing.Before)));
this.Pr.Spacing.Before = Spacing.Before;
}
if ( ( undefined != Spacing.After || true === bDeleteUndefined ) && this.Pr.Spacing.After !== Spacing.After )
{
History.Add( this, { Type : historyitem_Paragraph_Spacing_After, New : Spacing.After, Old : ( undefined != this.Pr.Spacing.After ? this.Pr.Spacing.After : undefined ) } );
// History.Add( this, { Type : historyitem_Paragraph_Spacing_After, New : Spacing.After, Old : ( undefined != this.Pr.Spacing.After ? this.Pr.Spacing.After : undefined ) } );
History.Add(g_oUndoRedoGraphicObjects, historyitem_Paragraph_Spacing_After, null, null, new UndoRedoDataGraphicObjects(this.Get_Id(), new UndoRedoDataGOSingleProp(( undefined != this.Pr.Spacing.After ? this.Pr.Spacing.After : undefined ), Spacing.After)));
this.Pr.Spacing.After = Spacing.After;
}
if ( ( undefined != Spacing.AfterAutoSpacing || true === bDeleteUndefined ) && this.Pr.Spacing.AfterAutoSpacing !== Spacing.AfterAutoSpacing )
{
History.Add( this, { Type : historyitem_Paragraph_Spacing_AfterAutoSpacing, New : Spacing.AfterAutoSpacing, Old : ( undefined != this.Pr.Spacing.AfterAutoSpacing ? this.Pr.Spacing.AfterAutoSpacing : undefined ) } );
//History.Add( this, { Type : historyitem_Paragraph_Spacing_AfterAutoSpacing, New : Spacing.AfterAutoSpacing, Old : ( undefined != this.Pr.Spacing.AfterAutoSpacing ? this.Pr.Spacing.AfterAutoSpacing : undefined ) } );
History.Add(g_oUndoRedoGraphicObjects, historyitem_Paragraph_Spacing_AfterAutoSpacing, null, null, new UndoRedoDataGraphicObjects(this.Get_Id(), new UndoRedoDataGOSingleProp(( undefined != this.Pr.Spacing.AfterAutoSpacing ? this.Pr.Spacing.AfterAutoSpacing : undefined ), Spacing.AfterAutoSpacing)));
this.Pr.Spacing.AfterAutoSpacing = Spacing.AfterAutoSpacing;
}
if ( ( undefined != Spacing.BeforeAutoSpacing || true === bDeleteUndefined ) && this.Pr.Spacing.BeforeAutoSpacing !== Spacing.BeforeAutoSpacing )
{
History.Add( this, { Type : historyitem_Paragraph_Spacing_BeforeAutoSpacing, New : Spacing.BeforeAutoSpacing, Old : ( undefined != this.Pr.Spacing.BeforeAutoSpacing ? this.Pr.Spacing.BeforeAutoSpacing : undefined ) } );
//History.Add( this, { Type : historyitem_Paragraph_Spacing_BeforeAutoSpacing, New : Spacing.BeforeAutoSpacing, Old : ( undefined != this.Pr.Spacing.BeforeAutoSpacing ? this.Pr.Spacing.BeforeAutoSpacing : undefined ) } );
History.Add(g_oUndoRedoGraphicObjects, historyitem_Paragraph_Spacing_BeforeAutoSpacing, null, null, new UndoRedoDataGraphicObjects(this.Get_Id(), new UndoRedoDataGOSingleProp(( undefined != this.Pr.Spacing.BeforeAutoSpacing ? this.Pr.Spacing.BeforeAutoSpacing : undefined ), Spacing.BeforeAutoSpacing)));
this.Pr.Spacing.BeforeAutoSpacing = Spacing.BeforeAutoSpacing;
}
......
......@@ -729,6 +729,16 @@ CShape.prototype =
}
},
applyAllSpacing: function(val)
{
if(isRealObject(this.txBody))
{
this.txBody.content.Set_ApplyToAll(true);
this.txBody.content.Set_ParagraphSpacing(val);
this.txBody.content.Set_ApplyToAll(false);
}
},
initDefault: function(x, y, extX, extY, flipH, flipV, presetGeom)
{
......
......@@ -244,6 +244,11 @@ CTableId.prototype =
Class = new CGs();
break;
}
case CLASS_TYPE_BLIP_FILL:
{
Class = new CBlipFill();
break;
}
}
if(isRealObject(Class))
......
//----------------------------------------------------------------------------------- // Global counters //----------------------------------------------------------------------------------- function CIdCounter() { this.m_sUserId = null; this.m_bLoad = true; this.m_nIdCounterLoad = 0; // Счетчик Id для загрузки this.m_nIdCounterEdit = 0; // Счетчик Id для работы this.Get_NewId = function() { if ( true === this.m_bLoad || null === this.m_sUserId ) { this.m_nIdCounterLoad++; return ("" + this.m_nIdCounterLoad); } else { this.m_nIdCounterEdit++; return ("" + this.m_sUserId + "_" + this.m_nIdCounterEdit); } }; this.Set_UserId = function(sUserId) { this.m_sUserId = sUserId; }; this.Set_Load = function(bValue) { this.m_bLoad = bValue; }; } var g_oIdCounter = null; var CLASS_TYPE_TABLE_ID = 0; var CLASS_TYPE_DOCUMENT_CONTENT = 1; var CLASS_TYPE_SHAPE = 2; var CLASS_TYPE_IMAGE = 3; var CLASS_TYPE_GROUP = 4; var CLASS_TYPE_XFRM = 5; var CLASS_TYPE_GEOMETRY = 6; var CLASS_TYPE_PATH = 7; var CLASS_TYPE_PARAGRAPH = 8; var CLASS_TYPE_TEXT_BODY = 9; var CLASS_TYPE_TEXT_PR = 10; var CLASS_TYPE_UNI_FILL = 11; var CLASS_TYPE_PATTERN_FILL = 12; var CLASS_TYPE_GRAD_FILL = 13; var CLASS_TYPE_SOLID_FILL = 14; var CLASS_TYPE_UNI_COLOR = 15; var CLASS_TYPE_SCHEME_COLOR = 16; var CLASS_TYPE_RGB_COLOR = 17; var CLASS_TYPE_PRST_COLOR = 18; var CLASS_TYPE_SYS_COLOR = 19; var CLASS_TYPE_LINE = 20; var CLASS_TYPE_CHART_AS_GROUP = 21; var CLASS_TYPE_CHART_LEGEND = 22; var CLASS_TYPE_CHART_TITLE = 23; var CLASS_TYPE_COLOR_MOD = 24; var CLASS_TYPE_LEGEND_ENTRY = 25; var CLASS_TYPE_CHART_DATA = 26; var CLASS_TYPE_NO_FILL = 27; var CLASS_TYPE_GS = 28; var CLASS_TYPE_GRAD_LIN = 29; var CLASS_TYPE_GRAD_PAT = 30; var g_oTableId = null;
\ No newline at end of file
//----------------------------------------------------------------------------------- // Global counters //----------------------------------------------------------------------------------- function CIdCounter() { this.m_sUserId = null; this.m_bLoad = true; this.m_nIdCounterLoad = 0; // Счетчик Id для загрузки this.m_nIdCounterEdit = 0; // Счетчик Id для работы this.Get_NewId = function() { if ( true === this.m_bLoad || null === this.m_sUserId ) { this.m_nIdCounterLoad++; return ("" + this.m_nIdCounterLoad); } else { this.m_nIdCounterEdit++; return ("" + this.m_sUserId + "_" + this.m_nIdCounterEdit); } }; this.Set_UserId = function(sUserId) { this.m_sUserId = sUserId; }; this.Set_Load = function(bValue) { this.m_bLoad = bValue; }; } var g_oIdCounter = null; var CLASS_TYPE_TABLE_ID = 0; var CLASS_TYPE_DOCUMENT_CONTENT = 1; var CLASS_TYPE_SHAPE = 2; var CLASS_TYPE_IMAGE = 3; var CLASS_TYPE_GROUP = 4; var CLASS_TYPE_XFRM = 5; var CLASS_TYPE_GEOMETRY = 6; var CLASS_TYPE_PATH = 7; var CLASS_TYPE_PARAGRAPH = 8; var CLASS_TYPE_TEXT_BODY = 9; var CLASS_TYPE_TEXT_PR = 10; var CLASS_TYPE_UNI_FILL = 11; var CLASS_TYPE_PATTERN_FILL = 12; var CLASS_TYPE_GRAD_FILL = 13; var CLASS_TYPE_SOLID_FILL = 14; var CLASS_TYPE_UNI_COLOR = 15; var CLASS_TYPE_SCHEME_COLOR = 16; var CLASS_TYPE_RGB_COLOR = 17; var CLASS_TYPE_PRST_COLOR = 18; var CLASS_TYPE_SYS_COLOR = 19; var CLASS_TYPE_LINE = 20; var CLASS_TYPE_CHART_AS_GROUP = 21; var CLASS_TYPE_CHART_LEGEND = 22; var CLASS_TYPE_CHART_TITLE = 23; var CLASS_TYPE_COLOR_MOD = 24; var CLASS_TYPE_LEGEND_ENTRY = 25; var CLASS_TYPE_CHART_DATA = 26; var CLASS_TYPE_NO_FILL = 27; var CLASS_TYPE_GS = 28; var CLASS_TYPE_GRAD_LIN = 29; var CLASS_TYPE_GRAD_PAT = 30; var CLASS_TYPE_BLIP_FILL = 31; var g_oTableId = null;
\ No newline at end of file
......
......@@ -208,7 +208,6 @@ function NullState(drawingObjectsController, drawingObjects)
{
if(cur_drawing.hitInWorkArea(x, y))
{
if(!e.shiftKey && !e.ctrlKey)
{
......
......@@ -178,6 +178,8 @@ var historyitem_AutoShapes_RightInset = 67;
var historyitem_AutoShapes_LeftInset = 68;
var historyitem_AutoShapes_BottomInset = 68;
var historyitem_AutoShapes_Set_AutoShapeStyle = 69;
var historyitem_AutoShapes_Set_ImageBlipFill = 70;
......
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