Commit 41ba9dc9 authored by Sergey.Luzyanin's avatar Sergey.Luzyanin Committed by Alexander.Trofimov

Bug #31617 - Не клипируется текст шейпа

git-svn-id: svn://192.168.3.15/activex/AVS/Sources/TeamlabOffice/trunk/OfficeWeb@68227 954022d7-b5bf-4e40-9824-e11837661b57
parent 5a2f63d3
...@@ -5073,7 +5073,7 @@ DrawingObjectsController.prototype = ...@@ -5073,7 +5073,7 @@ DrawingObjectsController.prototype =
if (oTargetTextObject) { if (oTargetTextObject) {
var warpGeometry = oTargetTextObject.recalcInfo && oTargetTextObject.recalcInfo.warpGeometry; var warpGeometry = oTargetTextObject.recalcInfo && oTargetTextObject.recalcInfo.warpGeometry;
if(warpGeometry && warpGeometry.preset !== "textNoShape") if(warpGeometry && warpGeometry.preset !== "textNoShape" || oTargetTextObject.worksheet)
{ {
if (oTargetTextObject.recalcInfo.bRecalculatedTitle) if (oTargetTextObject.recalcInfo.bRecalculatedTitle)
{ {
......
...@@ -5450,6 +5450,10 @@ CChartSpace.prototype = ...@@ -5450,6 +5450,10 @@ CChartSpace.prototype =
} }
}, },
hitInTextRect: function()
{
return false;
},
recalculateLegend: function() recalculateLegend: function()
{ {
......
...@@ -3431,8 +3431,8 @@ CShape.prototype = ...@@ -3431,8 +3431,8 @@ CShape.prototype =
oController && (getTargetTextObject(oController) === this || (oController.curState.startTargetTextObject === this))) oController && (getTargetTextObject(oController) === this || (oController.curState.startTargetTextObject === this)))
{ {
var content = this.getDocContent && this.getDocContent(); var content = this.getDocContent && this.getDocContent();
if ( content && this.invertTransformText) { if ( content && this.invertTransformText)
{
var t_x, t_y; var t_x, t_y;
t_x = this.invertTransformText.TransformPointX(x, y); t_x = this.invertTransformText.TransformPointX(x, y);
t_y = this.invertTransformText.TransformPointY(x, y); t_y = this.invertTransformText.TransformPointY(x, y);
...@@ -3448,7 +3448,8 @@ CShape.prototype = ...@@ -3448,7 +3448,8 @@ CShape.prototype =
}, },
updateCursorType: function (x, y, e) { updateCursorType: function (x, y, e)
{
if(this.invertTransformText) if(this.invertTransformText)
{ {
var tx = this.invertTransformText.TransformPointX(x, y); var tx = this.invertTransformText.TransformPointX(x, y);
...@@ -3459,10 +3460,11 @@ CShape.prototype = ...@@ -3459,10 +3460,11 @@ CShape.prototype =
selectionSetStart: function (e, x, y, slideIndex) { selectionSetStart: function (e, x, y, slideIndex)
{
var content = this.getDocContent(); var content = this.getDocContent();
if (isRealObject(content)) { if (isRealObject(content))
{
var tx, ty; var tx, ty;
tx = this.invertTransformText.TransformPointX(x, y); tx = this.invertTransformText.TransformPointX(x, y);
ty = this.invertTransformText.TransformPointY(x, y); ty = this.invertTransformText.TransformPointY(x, y);
...@@ -3478,7 +3480,6 @@ CShape.prototype = ...@@ -3478,7 +3480,6 @@ CShape.prototype =
content.Selection_SetStart(tx, ty, slideIndex, e); content.Selection_SetStart(tx, ty, slideIndex, e);
else else
content.Selection_SetEnd(tx, ty, slideIndex, e); content.Selection_SetEnd(tx, ty, slideIndex, e);
} }
}, },
...@@ -3653,6 +3654,47 @@ CShape.prototype = ...@@ -3653,6 +3654,47 @@ CShape.prototype =
return false; return false;
}, },
clipTextRect: function(graphics)
{
if(this.clipRect)
{
var clip_rect = this.clipRect;
var oBodyPr = this.getBodyPr();
if(!oBodyPr || oBodyPr.upright)
{
graphics.transform3(this.transform);
graphics.AddClipRect(clip_rect.x, clip_rect.y, clip_rect.w, clip_rect.h);
graphics.SetIntegerGrid(false);
graphics.transform3(this.transformText, true);
}
else
{
var oTransform = new CMatrix();
var cX = this.transform.TransformPointX(this.extX/2, this.extY/2);
var cY = this.transform.TransformPointY(this.extX/2, this.extY/2);
if(checkNormalRotate(this.rot))
{
oTransform.tx = cX - this.extX/2;
oTransform.ty = cY - this.extY/2;
}
else
{
global_MatrixTransformer.TranslateAppend(oTransform, - this.extX/2, -this.extY/2);
global_MatrixTransformer.RotateRadAppend(oTransform, Math.PI/2);
global_MatrixTransformer.TranslateAppend(oTransform, cX, cY);
}
graphics.transform3(oTransform, true);
graphics.AddClipRect(clip_rect.x, clip_rect.y, clip_rect.w, clip_rect.h);
graphics.SetIntegerGrid(false);
graphics.transform3(this.transformText, true);
}
}
},
draw: function (graphics, transform, transformText, pageIndex) { draw: function (graphics, transform, transformText, pageIndex) {
if(graphics.updatedRect && this.bounds) if(graphics.updatedRect && this.bounds)
...@@ -3791,32 +3833,20 @@ CShape.prototype = ...@@ -3791,32 +3833,20 @@ CShape.prototype =
graphics.SaveGrState(); graphics.SaveGrState();
graphics.SetIntegerGrid(false); graphics.SetIntegerGrid(false);
var transform_text; var transform_text;
if ((!this.txBody.content || this.txBody.content.Is_Empty()) && this.txBody.content2 != null && !this.txBody.checkCurrentPlaceholder() && (this.isEmptyPlaceholder ? this.isEmptyPlaceholder() : false) && this.transformText2) { if ((!this.txBody.content || this.txBody.content.Is_Empty()) && this.txBody.content2 != null && !this.txBody.checkCurrentPlaceholder() && (this.isEmptyPlaceholder ? this.isEmptyPlaceholder() : false) && this.transformText2)
{
transform_text = this.transformText2; transform_text = this.transformText2;
} }
else if (this.txBody.content) { else if (this.txBody.content)
transform_text = _transform_text;
}
var clip_rect = this.clipRect;
var bodyPr = this.txBody.bodyPr;
if(/*clip_rect*/ false)
{ {
if(!bodyPr || !bodyPr.upright) transform_text = _transform_text;
{
graphics.transform3(this.transform);
graphics.AddClipRect(clip_rect.x, clip_rect.y, clip_rect.w, clip_rect.h);
graphics.transform3(transform_text, true);
}
else
{
graphics.transform3(transform_text, true);
graphics.AddClipRect(clip_rect.x, clip_rect.y, clip_rect.w, clip_rect.h);
}
} }
else
if(this.worksheet && (this instanceof CShape) && !(oController && (getTargetTextObject(oController) === this)))
{ {
graphics.transform3(transform_text, true); this.clipTextRect(graphics);
} }
graphics.transform3(this.transformText, true);
if (graphics.CheckUseFonts2 !== undefined) if (graphics.CheckUseFonts2 !== undefined)
graphics.CheckUseFonts2(transform_text); graphics.CheckUseFonts2(transform_text);
...@@ -3832,43 +3862,9 @@ CShape.prototype = ...@@ -3832,43 +3862,9 @@ CShape.prototype =
var old_start_page = this.textBoxContent.Get_StartPage_Relative(); var old_start_page = this.textBoxContent.Get_StartPage_Relative();
this.textBoxContent.Set_StartPage(pageIndex); this.textBoxContent.Set_StartPage(pageIndex);
var clip_rect = this.clipRect; graphics.SaveGrState();
if(!this.bodyPr.upright) graphics.SetIntegerGrid(false);
{ this.clipTextRect(graphics);
graphics.SaveGrState();
graphics.SetIntegerGrid(false);
graphics.transform3(this.transform);
graphics.AddClipRect(clip_rect.x, clip_rect.y, clip_rect.w, clip_rect.h);
graphics.SetIntegerGrid(false);
graphics.transform3(this.transformText, true);
}
else
{
graphics.SaveGrState();
graphics.SetIntegerGrid(false);
var oTransform = new CMatrix();
var cX = this.transform.TransformPointX(this.extX/2, this.extY/2);
var cY = this.transform.TransformPointY(this.extX/2, this.extY/2);
if(checkNormalRotate(this.rot))
{
oTransform.tx = cX - this.extX/2;
oTransform.ty = cY - this.extY/2;
}
else
{
global_MatrixTransformer.TranslateAppend(oTransform, - this.extX/2, -this.extY/2);
global_MatrixTransformer.RotateRadAppend(oTransform, Math.PI/2);
global_MatrixTransformer.TranslateAppend(oTransform, cX, cY);
}
graphics.transform3(oTransform, true);
graphics.AddClipRect(clip_rect.x, clip_rect.y, clip_rect.w, clip_rect.h);
graphics.SetIntegerGrid(false);
graphics.transform3(this.transformText, true);
}
var result_page_index = isRealNumber(graphics.shapePageIndex) ? graphics.shapePageIndex : old_start_page; var result_page_index = isRealNumber(graphics.shapePageIndex) ? graphics.shapePageIndex : old_start_page;
if (graphics.CheckUseFonts2 !== undefined) if (graphics.CheckUseFonts2 !== undefined)
......
...@@ -152,10 +152,9 @@ StartAddNewShape.prototype = ...@@ -152,10 +152,9 @@ StartAddNewShape.prototype =
function checkEmptyPlaceholderContent(content) function checkEmptyPlaceholderContent(content)
{ {
if(!content || if(!content || content.Parent && content.Parent.parent &&
content.Parent && content.Parent.parent &&
(content.Is_Empty() && content.Parent.parent.isPlaceholder && content.Parent.parent.isPlaceholder() || (content.Is_Empty() && content.Parent.parent.isPlaceholder && content.Parent.parent.isPlaceholder() ||
content.Parent.parent.txWarpStruct || content.Parent.parent.recalcInfo && content.Parent.parent.recalcInfo.warpGeometry) ) content.Parent.parent.txWarpStruct || content.Parent.parent.recalcInfo && content.Parent.parent.recalcInfo.warpGeometry || content.Parent.parent.worksheet) )
return content; return content;
return null; return null;
} }
......
...@@ -34,7 +34,6 @@ CChartSpace.prototype.getInvertTransform = CShape.prototype.getInvertTransform; ...@@ -34,7 +34,6 @@ CChartSpace.prototype.getInvertTransform = CShape.prototype.getInvertTransform;
CChartSpace.prototype.hit = CShape.prototype.hit; CChartSpace.prototype.hit = CShape.prototype.hit;
CChartSpace.prototype.hitInInnerArea = CShape.prototype.hitInInnerArea; CChartSpace.prototype.hitInInnerArea = CShape.prototype.hitInInnerArea;
CChartSpace.prototype.hitInPath = CShape.prototype.hitInPath; CChartSpace.prototype.hitInPath = CShape.prototype.hitInPath;
CChartSpace.prototype.hitInTextRect = CShape.prototype.hitInTextRect;
CChartSpace.prototype.getNumByCardDirection = CShape.prototype.getNumByCardDirection; CChartSpace.prototype.getNumByCardDirection = CShape.prototype.getNumByCardDirection;
CChartSpace.prototype.getCardDirectionByNum = CShape.prototype.getCardDirectionByNum; CChartSpace.prototype.getCardDirectionByNum = CShape.prototype.getCardDirectionByNum;
CChartSpace.prototype.getResizeCoefficients = CShape.prototype.getResizeCoefficients; CChartSpace.prototype.getResizeCoefficients = CShape.prototype.getResizeCoefficients;
......
...@@ -83,6 +83,27 @@ CShape.prototype.getDrawingObjectsController = function() ...@@ -83,6 +83,27 @@ CShape.prototype.getDrawingObjectsController = function()
return null; return null;
}; };
CShape.prototype.hitInTextRect = function (x, y)
{
var oController = this.getDrawingObjectsController && this.getDrawingObjectsController();
if(oController && (getTargetTextObject(oController) === this || (oController.curState.startTargetTextObject === this)))
{
var content = this.getDocContent && this.getDocContent();
if ( content && this.invertTransformText)
{
var t_x, t_y;
t_x = this.invertTransformText.TransformPointX(x, y);
t_y = this.invertTransformText.TransformPointY(x, y);
return t_x > 0 && t_x < this.contentWidth && t_y > 0 && t_y < this.contentHeight;
}
}
else
{
return this.hitInTextRectWord(x, y);
}
return false;
};
function addToDrawings(worksheet, graphic, position, lockByDefault, anchor) function addToDrawings(worksheet, graphic, position, lockByDefault, anchor)
{ {
......
...@@ -142,7 +142,6 @@ CChartSpace.prototype.getInvertTransform = CShape.prototype.getInvertTransform; ...@@ -142,7 +142,6 @@ CChartSpace.prototype.getInvertTransform = CShape.prototype.getInvertTransform;
CChartSpace.prototype.hit = CShape.prototype.hit; CChartSpace.prototype.hit = CShape.prototype.hit;
CChartSpace.prototype.hitInInnerArea = CShape.prototype.hitInInnerArea; CChartSpace.prototype.hitInInnerArea = CShape.prototype.hitInInnerArea;
CChartSpace.prototype.hitInPath = CShape.prototype.hitInPath; CChartSpace.prototype.hitInPath = CShape.prototype.hitInPath;
CChartSpace.prototype.hitInTextRect = CShape.prototype.hitInTextRect;
CChartSpace.prototype.getNumByCardDirection = CShape.prototype.getNumByCardDirection; CChartSpace.prototype.getNumByCardDirection = CShape.prototype.getNumByCardDirection;
CChartSpace.prototype.getCardDirectionByNum = CShape.prototype.getCardDirectionByNum; CChartSpace.prototype.getCardDirectionByNum = CShape.prototype.getCardDirectionByNum;
CChartSpace.prototype.getResizeCoefficients = CShape.prototype.getResizeCoefficients; CChartSpace.prototype.getResizeCoefficients = CShape.prototype.getResizeCoefficients;
......
...@@ -37,10 +37,6 @@ CChartSpace.prototype.getInvertTransform = CShape.prototype.getInvertTransform; ...@@ -37,10 +37,6 @@ CChartSpace.prototype.getInvertTransform = CShape.prototype.getInvertTransform;
CChartSpace.prototype.hit = CShape.prototype.hit; CChartSpace.prototype.hit = CShape.prototype.hit;
CChartSpace.prototype.hitInInnerArea = CShape.prototype.hitInInnerArea; CChartSpace.prototype.hitInInnerArea = CShape.prototype.hitInInnerArea;
CChartSpace.prototype.hitInPath = CShape.prototype.hitInPath; CChartSpace.prototype.hitInPath = CShape.prototype.hitInPath;
CChartSpace.prototype.hitInTextRect = function()
{
return false;
};
CChartSpace.prototype.getNumByCardDirection = CShape.prototype.getNumByCardDirection; CChartSpace.prototype.getNumByCardDirection = CShape.prototype.getNumByCardDirection;
CChartSpace.prototype.getCardDirectionByNum = CShape.prototype.getCardDirectionByNum; CChartSpace.prototype.getCardDirectionByNum = CShape.prototype.getCardDirectionByNum;
CChartSpace.prototype.getResizeCoefficients = CShape.prototype.getResizeCoefficients; CChartSpace.prototype.getResizeCoefficients = CShape.prototype.getResizeCoefficients;
......
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