Commit 1bf27d18 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@64410 954022d7-b5bf-4e40-9824-e11837661b57
parent 77395366
......@@ -693,13 +693,18 @@ CGroupShape.prototype =
checkExtentsByDocContent: function()
{
var bRet = false;
for(var i = 0; i < this.spTree.length; ++i)
{
if(typeof this.spTree[i].checkExtentsByDocContent === "function")
{
this.spTree[i].checkExtentsByDocContent();
if(this.spTree[i].checkExtentsByDocContent())
{
bRet = true;
}
}
}
return bRet;
},
Paragraph_IncDecFontSizeAll: function(val)
......@@ -916,6 +921,51 @@ CGroupShape.prototype =
}
},
CheckNeedRecalcAutoFit: function(oSectPr)
{
var bRet = false;
for(var i = 0; i< this.spTree.length; ++i)
{
if(this.spTree[i].CheckNeedRecalcAutoFit && this.spTree[i].CheckNeedRecalcAutoFit(oSectPr))
{
bRet = true;
}
}
if(bRet)
{
this.recalcWrapPolygon();
}
return bRet;
},
CheckGroupSizes: function()
{
var bRet = false;
for(var i = 0; i < this.spTree.length; ++i)
{
if(this.spTree[i].checkExtentsByDocContent)
{
if(this.spTree[i].checkExtentsByDocContent(undefined, false))
{
bRet = true;
}
}
}
if(bRet)
{
if(!this.group)
{
this.updateCoordinatesAfterInternalResize();
}
if(this.parent instanceof ParaDrawing)
{
this.parent.CheckWH();
}
}
return bRet;
},
Search : function(Str, Props, SearchEngine, Type)
{
var Len = this.arrGraphicObjects.length;
......@@ -1297,6 +1347,7 @@ CGroupShape.prototype =
sp_tree[i].spPr.xfrm.setOffY(sp_tree[i].spPr.xfrm.offY - y_min_clear);
}
this.checkDrawingBaseCoords();
return {posX: pos_x, posY: pos_y};
},
select: CShape.prototype.select,
......
......@@ -14,6 +14,16 @@ function CheckWordArtTextPr(oTextPr)
return false;
}
function CopyPageSize(oPageSize)
{
var oRet = new CSectionPageSize();
oRet.W = oPageSize.W
oRet.H = oPageSize.H
oRet.Orient = oPageSize.Orient;
return oRet;
}
function hitToHandles(x, y, object)
{
var invert_transform = object.getInvertTransform();
......@@ -790,7 +800,10 @@ CShape.prototype =
if (content_to_add) {
docContentFunction.apply(content_to_add, args);
}
this.checkExtentsByDocContent();
if(!editor || !editor.noCreatePoint || editor.exucuteHistory)
{
this.checkExtentsByDocContent();
}
},
clearContent: function () {
......@@ -2456,13 +2469,8 @@ CShape.prototype =
}
if(this.checkAutofit && this.checkAutofit()) {
if(this.checkAutofit && this.checkAutofit() && (!this.bWordShape || !this.group || this.bCheckAutoFitFlag)) {
var oBodyPr = this.getBodyPr();
if(this.recalcInfo.recalculateGeometry)
{
this.recalculateGeometry();
this.recalcInfo.recalculateGeometry = true;
}
if (this.bWordShape) {
if (this.recalcInfo.recalculateTxBoxContent) {
this.recalcInfo.oContentMetrics = this.recalculateTxBoxContent();
......@@ -2741,6 +2749,53 @@ CShape.prototype =
this.transform = transform;
},
CheckNeedRecalcAutoFit : function(oSectPr)
{
var Width, Height, Width2, Height2;
var bRet = false;
if(this.checkAutofit())
{
if(oSectPr)
{
if(!this.m_oSectPr)
{
this.recalcBounds();
this.recalcText();
this.recalcGeometry();
bRet = true;
}
else
{
Width = oSectPr.Get_PageWidth() - oSectPr.Get_PageMargin_Left() - oSectPr.Get_PageMargin_Right();
Height = oSectPr.Get_PageHeight() - oSectPr.Get_PageMargin_Top() - oSectPr.Get_PageMargin_Bottom();
Width2 = this.m_oSectPr.Get_PageWidth() - this.m_oSectPr.Get_PageMargin_Left() - this.m_oSectPr.Get_PageMargin_Right();
Height2 = this.m_oSectPr.Get_PageHeight() - this.m_oSectPr.Get_PageMargin_Top() - this.m_oSectPr.Get_PageMargin_Bottom();
bRet = (Math.abs(Width - Width2) > 0.001 || Math.abs(Height - Height2) > 0.001);
if(bRet)
{
this.recalcBounds();
this.recalcText();
this.recalcGeometry();
}
return bRet;
}
}
else
{
if(this.m_oSectPr)
{
this.recalcBounds();
this.recalcText();
this.recalcGeometry();
bRet = true;
}
}
}
return bRet;
},
recalculateDocContent: function(oDocContent, oBodyPr)
{
......@@ -2765,6 +2820,7 @@ CShape.prototype =
var dMaxWidth = 100000;
if(this.bWordShape)
{
this.m_oSectPr = null;
var oParaDrawing = getParaDrawing(this);
if(oParaDrawing)
{
......@@ -2782,6 +2838,8 @@ CShape.prototype =
{
dMaxWidth = oSectPr.Get_PageHeight() - oSectPr.Get_PageMargin_Top() - oSectPr.Get_PageMargin_Bottom();
}
this.m_oSectPr = new CSectionPr();
this.m_oSectPr.Copy(oSectPr);
}
}
}
......@@ -2879,12 +2937,12 @@ CShape.prototype =
return oRet;
},
checkExtentsByDocContent: function(bForce)
checkExtentsByDocContent: function(bForce, bNeedRecalc)
{
if((!this.bWordShape || this.group || bForce) && this.checkAutofit(true))
{
var oMainGroup = this.getMainGroup();
if(oMainGroup)
if(oMainGroup && !(bNeedRecalc === false))
{
oMainGroup.normalize();
}
......@@ -2910,21 +2968,24 @@ CShape.prototype =
CheckExcelDrawingXfrm(this.spPr.xfrm);
}
}
if(oMainGroup)
if(!(bNeedRecalc === false))
{
oMainGroup.updateCoordinatesAfterInternalResize();
if(oMainGroup.parent && oMainGroup.parent.CheckWH)
if(oMainGroup)
{
oMainGroup.parent.CheckWH();
if(this.bWordShape)
oMainGroup.updateCoordinatesAfterInternalResize();
if(oMainGroup.parent && oMainGroup.parent.CheckWH)
{
editor.WordControl.m_oLogicDocument.Recalculate();
oMainGroup.parent.CheckWH();
if(this.bWordShape)
{
editor.WordControl.m_oLogicDocument.Recalculate();
}
}
}
}
else
{
this.checkDrawingBaseCoords();
else
{
this.checkDrawingBaseCoords();
}
}
return true;
}
......
......@@ -7686,6 +7686,7 @@ CDocument.prototype =
var B = ( undefined === MarPr.Bottom ? undefined : SectPr.Get_PageHeight() - MarPr.Bottom );
SectPr.Set_PageMargins( L, T, R, B );
this.DrawingObjects.CheckAutoFit();
this.ContentLastChangePos = 0;
this.Recalculate();
......@@ -7704,6 +7705,7 @@ CDocument.prototype =
SectPr.Set_PageSize( W, H );
this.DrawingObjects.CheckAutoFit();
if( true != bNoRecalc )
{
this.ContentLastChangePos = 0;
......@@ -7739,6 +7741,7 @@ CDocument.prototype =
SectPr.Set_Orientation( Orientation, true );
this.DrawingObjects.CheckAutoFit();
if( true != bNoRecalc )
{
this.Recalculate();
......
......@@ -1108,13 +1108,13 @@ MoveInGroupState.prototype =
this.drawingObjects.arrTrackObjects[i].trackEnd(true);
}
}
this.group.updateCoordinatesAfterInternalResize();
var oPosObject = this.group.updateCoordinatesAfterInternalResize();
this.group.recalculate();
var bounds = this.group.bounds;
var check_paragraphs = [];
check_paragraphs.push(this.group.parent.Get_ParentParagraph());
var posX = this.group.spPr.xfrm.offX;
var posY = this.group.spPr.xfrm.offY;
var posX = oPosObject.posX;
var posY = oPosObject.posY;
this.group.spPr.xfrm.setOffX(0);
this.group.spPr.xfrm.setOffY(0);
if(this.group.parent.Is_Inline())
......@@ -1123,7 +1123,7 @@ MoveInGroupState.prototype =
}
else
{
var nearest_pos = this.drawingObjects.document.Get_NearestPos(this.group.parent.pageIndex, this.group.parent.X + (bounds.x - old_x), this.group.parent.Y + (bounds.y - old_y), true, this.group.parent);
// var nearest_pos = this.drawingObjects.document.Get_NearestPos(this.group.parent.pageIndex, this.group.parent.X + (bounds.x - old_x), this.group.parent.Y + (bounds.y - old_y), true, this.group.parent);
// if(nearest_pos.Paragraph !== check_paragraphs[0] && this.group.parent.Locked !== true )
// {
// check_paragraphs.push(nearest_pos.Paragraph);
......@@ -1134,9 +1134,9 @@ MoveInGroupState.prototype =
// }
// else
{
check_paragraphs.length = 0;
this.group.parent.Set_XY(this.group.posX + posX, this.group.posY + posY, check_paragraphs[0], this.group.parent.pageIndex, false);
}
check_paragraphs.length = 0;
}
if(false === editor.isViewMode && false === this.drawingObjects.document.Document_Is_SelectionLocked(changestype_Drawing_Props, {Type : changestype_2_ElementsArray_and_Type , Elements : check_paragraphs, CheckType : changestype_Paragraph_Content}))
{
......
......@@ -118,11 +118,14 @@ CGroupShape.prototype.setRecalculateInfo = function()
CGroupShape.prototype.recalcTransform = function()
{
this.recalcInfo.recalculateScaleCoefficients = true;
this.recalcInfo.recalculateTransform = true;
for(var i = 0; i < this.spTree.length; ++i)
if(!editor || !editor.noCreatePoint || editor.exucuteHistory)
{
this.spTree[i].recalcTransform();
this.recalcInfo.recalculateScaleCoefficients = true;
this.recalcInfo.recalculateTransform = true;
for(var i = 0; i < this.spTree.length; ++i)
{
this.spTree[i].recalcTransform();
}
}
};
......
......@@ -44,6 +44,9 @@ CShape.prototype.recalcContent = function()
this.recalcInfo.AllDrawings = [];
if(this.checkAutofit && this.checkAutofit())
{
this.recalcGeometry();
this.recalcWrapPolygon();
this.recalcBounds();
this.recalcTransform();
}
}
......@@ -121,6 +124,9 @@ CShape.prototype.recalcTxBoxContent = function()
this.recalcInfo.AllDrawings = [];
if(this.checkAutofit && this.checkAutofit() && (!editor || !editor.noCreatePoint || editor.exucuteHistory))
{
this.recalcGeometry();
this.recalcWrapPolygon();
this.recalcBounds();
this.recalcTransform();
}
};
......@@ -833,6 +839,12 @@ CShape.prototype.recalcText = function()
{
this.recalcTxBoxContent();
this.recalcTransformText();
if(this.checkAutofit && this.checkAutofit())
{
this.recalcGeometry();
this.recalcWrapPolygon();
this.recalcBounds();
}
}
};
......
......@@ -399,6 +399,14 @@ CGraphicObjects.prototype =
applyDrawingProps: DrawingObjectsController.prototype.applyDrawingProps,
CheckAutoFit : function()
{
for(var i = this.drawingObjects.length - 1; i > -1; --i)
{
this.drawingObjects[i].CheckGroupSizes();
}
},
checkUseDrawings: function(aDrawings)
{
for(var i = aDrawings.length - 1; i > -1; --i)
......@@ -2066,6 +2074,7 @@ CGraphicObjects.prototype =
}
}));
para_drawing.Add_ToDocument2(first_paragraph);
para_drawing.Parent = first_paragraph;
this.addGraphicObject(para_drawing);
this.resetSelection();
this.selectObject(group, page_index);
......
......@@ -4278,6 +4278,15 @@ ParaDrawing.prototype =
return false;
},
CheckGroupSizes : function()
{
if(this.GraphicObj && this.GraphicObj.CheckGroupSizes)
{
this.GraphicObj.CheckGroupSizes();
}
},
getXfrmExtX: function()
{
if(isRealObject(this.GraphicObj) && isRealObject(this.GraphicObj.spPr) && isRealObject(this.GraphicObj.spPr.xfrm))
......@@ -4472,6 +4481,10 @@ ParaDrawing.prototype =
else
{
this.GraphicObj.recalculate();
if(this.GraphicObj.recalculateText)
{
this.GraphicObj.recalculateText();
}
if(this.PositionH.UseAlign || this.Is_Inline())
{
this.Width = this.GraphicObj.bounds.w;
......@@ -5083,6 +5096,22 @@ ParaDrawing.prototype =
{
return this.Parent.Get_AnchorPos(this);
},
CheckRecalcAutoFit : function(oSectPr)
{
if(this.GraphicObj && this.GraphicObj.CheckNeedRecalcAutoFit)
{
if(this.GraphicObj.CheckNeedRecalcAutoFit(oSectPr))
{
//this.GraphicObj.recalculate();
if(this.GraphicObj)
{
this.GraphicObj.recalcWrapPolygon && this.GraphicObj.recalcWrapPolygon();
}
this.Measure();
}
}
},
//-----------------------------------------------------------------------------------
// Undo/Redo функции
//-----------------------------------------------------------------------------------
......
......@@ -2074,6 +2074,7 @@ ParaRun.prototype.Recalculate_Range = function(PRS, ParaPr, Depth)
var ContentLen = this.Content.length;
var XRange = PRS.XRange;
var oSectionPr = undefined;
if (false === StartWord && true === FirstItemOnLine && XEnd - X < 0.001 && RangesCount > 0)
{
......@@ -2437,6 +2438,11 @@ ParaRun.prototype.Recalculate_Range = function(PRS, ParaPr, Depth)
}
case para_Drawing:
{
if(oSectionPr === undefined)
{
oSectionPr = Para.Get_SectPr();
}
Item.CheckRecalcAutoFit(oSectionPr);
if (true === Item.Is_Inline() || true === Para.Parent.Is_DrawingShape())
{
if (true !== Item.Is_Inline())
......@@ -4028,7 +4034,6 @@ ParaRun.prototype.Draw_Elements = function(PDSE)
var pGraphics = PDSE.Graphics;
var BgColor = PDSE.BgColor;
var Theme = PDSE.Theme;
var FontScheme = Theme.themeElements.fontScheme;
var X = PDSE.X;
var Y = PDSE.Y;
......@@ -8161,6 +8166,13 @@ ParaRun.prototype.Load_Changes = function(Reader, Reader2, Color)
var unifill = new CUniFill();
unifill.Read_FromBinary(Reader);
this.Pr.Unifill = unifill;
if(typeof CollaborativeEditing !== "undefined")
{
if(unifill.fill && unifill.fill.type === FILL_TYPE_BLIP && typeof unifill.fill.RasterImageId === "string" && unifill.fill.RasterImageId.length > 0)
{
CollaborativeEditing.Add_NewImage(getFullImageSrc2(unifill.fill.RasterImageId));
}
}
}
else
this.Pr.Unifill = undefined;
......
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