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