Commit 5b61e519 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@56150 954022d7-b5bf-4e40-9824-e11837661b57
parent e2d53674
......@@ -265,6 +265,16 @@ DrawingObjectsController.prototype =
handleMoveHit: function(object, e, x, y, group, bInSelect, pageIndex, bWord)
{
var b_is_inline;
if(isRealObject(group))
{
b_is_inline = group.parent && group.parent.Is_Inline();
}
else
{
b_is_inline = object.parent && object.parent.Is_Inline();
}
var b_is_selected_inline = this.selectedObjects.length === 1 && (this.selectedObjects[0].parent && this.selectedObjects[0].parent.Is_Inline());
if(this.handleEventMode === HANDLE_EVENT_MODE_HANDLE)
{
var selector = group ? group : this;
......@@ -272,7 +282,7 @@ DrawingObjectsController.prototype =
{
this.arrPreTrackObjects.length = 0;
var is_selected = object.selected;
if(!(e.CtrlKey || e.ShiftKey) && !is_selected)
if(!(e.CtrlKey || e.ShiftKey) && !is_selected || b_is_inline || b_is_selected_inline)
selector.resetSelection();
selector.selectObject(object, pageIndex);
if(!is_selected)
......@@ -281,7 +291,12 @@ DrawingObjectsController.prototype =
if(!isRealObject(group))
{
this.resetInternalSelection();
this.changeCurrentState(new PreMoveState(this, x, y, e.ShiftKey, e.CtrlKey, object, is_selected, true));
if(!b_is_inline)
this.changeCurrentState(new PreMoveState(this, x, y, e.ShiftKey, e.CtrlKey, object, is_selected, true));
else
{
this.changeCurrentState(new PreMoveInlineObject(this, object, is_selected, true));
}
}
else
{
......@@ -693,6 +708,24 @@ DrawingObjectsController.prototype =
this.selectedObjects[0].drawAdjustments(drawingDocument);
}
}
if(this.document)
{
if(this.selectedObjects.length === 1 && this.selectedObjects[0].parent && !this.selectedObjects[0].parent.Is_Inline())
{
if(this.arrTrackObjects.length === 1)
{
var bounds = this.arrTrackObjects[0].getBounds();
var page_index = isRealNumber(this.arrTrackObjects[0].pageIndex) ? this.arrTrackObjects[0].pageIndex : (isRealNumber(this.arrTrackObjects[0].selectStartPage) ? this.arrTrackObjects[0].selectStartPage : 0);
var nearest_pos = this.document.Get_NearestPos(page_index, bounds.min_x, bounds.min_y, true, this.selectedObjects[0].parent);
drawingDocument.AutoShapesTrack.drawFlowAnchor(nearest_pos.Paragraph.X, nearest_pos.Paragraph.Y);
}
else
{
var paragraph = this.selectedObjects[0].parent.Get_ParentParagraph();
drawingDocument.AutoShapesTrack.drawFlowAnchor(paragraph.X, paragraph.Y);
}
}
}
return;
},
......
......@@ -153,67 +153,29 @@ function handleGroup(drawing, drawingObjectsController, e, x, y, group, pageInde
for(var j = grouped_objects.length - 1; j > -1; --j)
{
var cur_grouped_object = grouped_objects[j];
if(cur_grouped_object instanceof CShape || cur_grouped_object instanceof CImageShape)
switch (cur_grouped_object.getObjectType())
{
var hit_in_inner_area = cur_grouped_object.hitInInnerArea(x, y);
var hit_in_path = cur_grouped_object.hitInPath(x, y);
var hit_in_text_rect = cur_grouped_object.hitInTextRect(x, y);
if(hit_in_inner_area && !hit_in_text_rect || hit_in_path)
{
return drawingObjectsController.handleMoveHit(drawing, e, x, y, null, false, pageIndex, true);
}
else if(hit_in_text_rect)
{
return drawingObjectsController.handleTextHit(cur_grouped_object, e, x, y, drawing, pageIndex, bWord);
}
}
}
return false;
}
function handleTable(drawing, drawingObjects, drawingObjectsController, e, x, y, handleState)
{
var hit_in_inner_area = drawing.hitInInnerArea(x, y);
var hit_in_bounding_rect = drawing.hitInBoundingRect(x, y);
if(hit_in_bounding_rect || hit_in_inner_area)
{
resetGroupChartSelection(drawingObjectsController.State);
if(e.CtrlKey && drawingObjectsController.selectedObjects.length > 0)
{
var b_selected = drawing.selected;
drawing.select(drawingObjectsController);
for(var j = 0; j < drawingObjectsController.selectedObjects.length; ++j)
{
drawingObjectsController.addPreTrackObject(drawingObjectsController.selectedObjects[j].createMoveTrack());
}
drawingObjectsController.changeCurrentState(new PreMoveState(drawingObjectsController, drawingObjects, x, y, e.ShiftKey, e.CtrlKey, drawing, b_selected, true));
drawingObjects.OnUpdateOverlay();
return true;
}
else
{
drawingObjectsController.resetSelection();
drawing.select(drawingObjectsController);
if(!(e.Button === g_mouse_button_right)&&(!drawing.isTableBorder(x, y)
|| editor.WordControl.m_oLogicDocument.Document_Is_SelectionLocked(changestype_Drawing_Props) === false))
{
drawing.selectionSetStart(e, x, y);
drawingObjectsController.changeCurrentState(new TextAddState(drawingObjectsController, drawingObjects, drawing));
}
else if(e.Button === g_mouse_button_right && drawingObjectsController.State.textObject && drawingObjectsController.State.textObject === drawing && !(drawing.pointInSelectedText(x, y)))
case historyitem_type_Shape:
case historyitem_type_ImageShape:
case historyitem_type_ChartSpace:
{
drawing.selectionSetStart(e, x, y);
drawingObjectsController.changeCurrentState(new TextAddState(drawingObjectsController, drawingObjects, drawing));
var hit_in_inner_area = cur_grouped_object.hitInInnerArea && cur_grouped_object.hitInInnerArea(x, y);
var hit_in_path = cur_grouped_object.hitInPath && cur_grouped_object.hitInPath(x, y);
var hit_in_text_rect = cur_grouped_object.hitInTextRect && cur_grouped_object.hitInTextRect(x, y);
if(hit_in_inner_area && !hit_in_text_rect || hit_in_path)
{
return drawingObjectsController.handleMoveHit(drawing, e, x, y, null, false, pageIndex, true);
}
else if(hit_in_text_rect)
{
return drawingObjectsController.handleTextHit(cur_grouped_object, e, x, y, drawing, pageIndex, bWord);
}
}
drawingObjects.presentation.Document_UpdateSelectionState();
drawingObjects.OnUpdateOverlay();
return true;
}
}
return false;
}
function handleChart(drawing, drawingObjectsController, e, x, y, group, pageIndex, bWord)
{
var ret = handleShapeImage(drawing, drawingObjectsController, e, x, y, group, pageIndex, bWord);
......@@ -223,6 +185,23 @@ function handleChart(drawing, drawingObjectsController, e, x, y, group, pageInde
}
function handleInlineShapeImage(drawing, drawingObjectsController, e, x, y, pageIndex)
{
var _hit = drawing.hit && drawing.hit(x, y);
var _hit_to_path = drawing.hitToPath && drawing.hitToPath(x, y);
var b_hit_to_text = drawing.hitInTextRect && drawing.hitInTextRect(x, y);
if((_hit && !b_hit_to_text) || _hit_to_path)
{
return handleInlineHitNoText(drawing, drawingObjectsController, e, x, y, pageIndex);
}
else if(b_hit_to_text)
{
return drawingObjectsController.handleTextHit(drawing, e, x, y, null, pageIndex, true);
}
}
function handleInlineHitNoText(drawing, drawingObjects, e, x, y, pageIndex)
{
var selected_objects = drawingObjects.selectedObjects;
......@@ -252,38 +231,29 @@ function handleInlineHitNoText(drawing, drawingObjects, e, x, y, pageIndex)
function handleInlineObjects(drawingObjectsController, drawingArr, e, x, y, pageIndex, bWord)
{
var i;
var drawing;
var drawing, ret;
for(i = drawingArr.length-1; i > -1; --i)
{
drawing = drawingArr[i];
switch(drawing.getObjectType())
{
case historyitem_type_Shape:
case historyitem_type_ImageShape:
case historyitem_type_ChartSpace:
case historyitem_type_ChartSpace://TODO
{
ret = handleInlineShapeImage(drawing, drawingObjectsController, e, x, y, pageIndex);
if(ret)
return ret;
break;
}
case historyitem_type_GroupShape:
{
var _hit = drawing.hit && drawing.hit(x, y);
var _hit_to_path = drawing.hitToPath && drawing.hitToPath(x, y);
var b_hit_to_text = drawing.hitToTextRect && drawing.hitToTextRect(x, y);
if((_hit && !b_hit_to_text) || _hit_to_path)
{
return handleInlineHitNoText(drawing, drawingObjectsController, e, x, y, pageIndex);
}
else if(b_hit_to_text)
{
return false;
}
ret = handleGroup(drawing, drawingObjectsController, e, x, y, null, pageIndex, bWord);
if(ret)
return ret;
break;
}
// case historyitem_type_ChartSpace:
// {
//
// break;
// }
// case historyitem_type_GroupShape:
// {
// break;
// }
}
}
return false;
......@@ -313,23 +283,4 @@ function handleMouseUpPreMoveState(drawingObjects, e, x, y, pageIndex, bWord)
}
}
}
}
function handleInlineShapeImage(drawingObjectsController, drawing, e, x, y, pageIndex, bWord)
{
var selected_objects = drawingObjectsController.selectedObjects;
var hit = drawing.hit(x, y);
var hit_to_path = drawing.hitToPath(x, y);
var b_hit_to_text = drawing.hitToTextRect(x, y);
if((hit && !b_hit_to_text) || hit_to_path)
{
handleInlineHitNoText(drawing, drawingObjectsController, e, x, y, pageIndex, handleState);
return true;
}
else if(b_hit_to_text)
{
return true;
}
return false;
}
\ No newline at end of file
"use strict";
// COLOR -----------------------
/*
var map_color_scheme = {};
......@@ -27,6 +25,13 @@ var historyitem_ChangeColorScheme = 0;
var historyitem_ChangeFontScheme = 1;
var historyitem_ChangeFmtScheme = 2;
var g_oThemeFontsName = {};
g_oThemeFontsName["+mj-cs"] = true;
g_oThemeFontsName["+mj-ea"] = true;
g_oThemeFontsName["+mj-lt"] = true;
g_oThemeFontsName["+mn-cs"] = true;
g_oThemeFontsName["+mn-ea"] = true;
g_oThemeFontsName["+mn-lt"] = true;
function isRealObject(o)
{
return o !== null && typeof o === "object";
......@@ -1442,7 +1447,7 @@ CRGBColor.prototype =
setColor: function(r, g, b)
{
var rgba = this.RGBA;
// History.Add(this, {Type: historyitem_RGBColor_SetColor, oldColor: {r: rgba.R, g: rgba.G, b: rgba.B}, newColor: {r: r, g: g, b: b}});
// History.Add(this, {Type: historyitem_RGBColor_SetColor, oldColor: {r: rgba.R, g: rgba.G, b: rgba.B}, newColor: {r: r, g: g, b: b}});
this.RGBA.R = r;
this.RGBA.G = g;
this.RGBA.B = b;
......@@ -3589,12 +3594,12 @@ CGradFill.prototype =
{
case historyitem_GradFill_AddColor:
{
// w.WriteBool(isRealObject(data.color));
// if(isRealObject(data.color))
// {
// w.WriteString2(data.color.Get_Id());
// }
// break;
// w.WriteBool(isRealObject(data.color));
// if(isRealObject(data.color))
// {
// w.WriteString2(data.color.Get_Id());
// }
// break;
}
case historyitem_GradFill_SetLin:
{
......@@ -3608,12 +3613,12 @@ CGradFill.prototype =
case historyitem_GradFill_SetPath:
{
// w.WriteBool(isRealObject(data.newPath));
// if(isRealObject(data.newPath))
// {
// w.WriteString2(data.newPath.Get_Id());
// }
// break;
// w.WriteBool(isRealObject(data.newPath));
// if(isRealObject(data.newPath))
// {
// w.WriteString2(data.newPath.Get_Id());
// }
// break;
}
}
},
......@@ -4120,7 +4125,7 @@ function CUniFill()
{
this.fill = null;
this.transparent = null;
// this.Id = g_oIdCounter.Get_NewId();
// this.Id = g_oIdCounter.Get_NewId();
}
CUniFill.prototype =
......@@ -4544,7 +4549,7 @@ function CompareUnifillBool(u1, u2)
for(var i = 0; i < u1.fill.colors.length; ++i)
{
if(u1.fill.colors[i].pos !== u1.fill.colors[i].pos
|| ! CompareUniColor(u1.fill.colors[i].color, u2.fill.colors[i].color))
|| ! CompareUniColor(u1.fill.colors[i].color, u2.fill.colors[i].color))
return false;
}
break;
......@@ -4669,11 +4674,11 @@ function CompareShapeProperties(shapeProp1, shapeProp2)
_result_shape_prop.stroke = shapeProp1.stroke.compare(shapeProp2.stroke)
}
/* if(shapeProp1.verticalTextAlign === shapeProp2.verticalTextAlign)
{
_result_shape_prop.verticalTextAlign = shapeProp1.verticalTextAlign;
}
else */
/* if(shapeProp1.verticalTextAlign === shapeProp2.verticalTextAlign)
{
_result_shape_prop.verticalTextAlign = shapeProp1.verticalTextAlign;
}
else */
{
_result_shape_prop.verticalTextAlign = null;
}
......@@ -8453,36 +8458,36 @@ CSpPr.prototype =
}
case historyitem_SpPr_SetFill:
{
if(r.GetBool())
{
this.Fill = new CUniFill();
this.Fill.Read_FromBinary(r);
if(typeof CollaborativeEditing !== "undefined")
{
if(this.Fill.fill && this.Fill.fill.type === FILL_TYPE_BLIP && typeof this.Fill.fill.RasterImageId === "string" && this.Fill.fill.RasterImageId.length > 0)
{
var full_image_src_func;
if(typeof getFullImageSrc === "function")
{
full_image_src_func = getFullImageSrc;
}
else if(typeof _getFullImageSrc === "function")
{
full_image_src_func = _getFullImageSrc;
}
if(full_image_src_func)
{
CollaborativeEditing.Add_NewImage(full_image_src_func(this.Fill.fill.RasterImageId));
}
}
}
}
if(r.GetBool())
{
this.Fill = new CUniFill();
this.Fill.Read_FromBinary(r);
if(typeof CollaborativeEditing !== "undefined")
{
if(this.Fill.fill && this.Fill.fill.type === FILL_TYPE_BLIP && typeof this.Fill.fill.RasterImageId === "string" && this.Fill.fill.RasterImageId.length > 0)
{
var full_image_src_func;
if(typeof getFullImageSrc === "function")
{
full_image_src_func = getFullImageSrc;
}
else if(typeof _getFullImageSrc === "function")
{
full_image_src_func = _getFullImageSrc;
}
if(full_image_src_func)
{
CollaborativeEditing.Add_NewImage(full_image_src_func(this.Fill.fill.RasterImageId));
}
}
}
}
else
{
this.Fill = null;
}
{
this.Fill = null;
}
this.handleUpdateFill();
break;
}
......@@ -9250,11 +9255,18 @@ FontScheme.prototype =
checkFont: function(font)
{
if(font)
if(g_oThemeFontsName[font])
{
return this.fontMap[font] ? this.fontMap[font] : font;
if(this.fontMap[font])
{
return this.fontMap[font];
}
else
{
return "Arial";
}
}
return "Arial";
return font;
},
getObjectType: function()
......@@ -9898,11 +9910,11 @@ function CTheme()
return historyitem_type_Theme;
};
this.Write_ToBinary2 = function(w)
{
w.WriteLong(historyitem_type_Theme);
w.WriteString2(this.Id);
};
this.Write_ToBinary2 = function(w)
{
w.WriteLong(historyitem_type_Theme);
w.WriteString2(this.Id);
};
this.Read_FromBinary2 = function(r)
{
......@@ -12327,7 +12339,7 @@ CBodyPr.prototype =
}
},
Read_FromBinary: function(r)
Read_FromBinary: function(r)
{
var flag = r.GetBool();
if(flag)
......
......@@ -283,10 +283,12 @@ PreChangeAdjState.prototype =
}
};
function PreMoveInlineObject(drawingObjects, majorObject)
function PreMoveInlineObject(drawingObjects, majorObject, isSelected, bInside)
{
this.drawingObjects = drawingObjects;
this.majorObject = majorObject;
this.isSelected = isSelected;
this.bInside = bInside;
}
PreMoveInlineObject.prototype =
......@@ -310,7 +312,7 @@ PreMoveInlineObject.prototype =
onMouseUp: function(e, x,y,pageIndex)
{
this.drawingObjects.changeCurrentState(new NullState(this.drawingObjects));
return handleMouseUpPreMoveState(this.drawingObjects, e, x, y,pageIndex, true);
}
};
......@@ -1327,7 +1329,6 @@ SplineBezierState.prototype =
onMouseUp: function(e, X, Y, pageIndex)
{
this.drawingObjects.changeCurrentState(new NullState(this.drawingObjects));
this.drawingObjects.curState.updateAnchorPos();
}
};
......
......@@ -799,6 +799,8 @@ CShape.prototype.getRecalcObject = function()
CShape.prototype.setRecalcObject = function(object)
{
if(!object)
return;
var content = this.getDocContent && this.getDocContent();
if(content)
{
......
......@@ -2638,7 +2638,7 @@ ZIndexManager.prototype =
if(arrInd[0] > 0)
{
item = this.removeItem(arrInd[0]);
this.addItem(--arrInd[0]);
this.addItem(--arrInd[0], item);
}
for(i = 1; i < arrInd.length; ++i)
{
......
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