|
|
|
@ -4684,118 +4684,118 @@ null};CGraphicObjectBase.prototype.drawCropTrack=function(graphics,srcRect,trans
|
|
|
|
|
oldExtX;this.extY=oldExtY;this.setSrcRect(this.calculateSrcRect2());this.clearCropObject()};CGraphicObjectBase.prototype.setSrcRect=function(srcRect){if(this.getObjectType()===AscDFH.historyitem_type_ImageShape){var blipFill=this.blipFill.createDuplicate();blipFill.srcRect=srcRect;this.setBlipFill(blipFill)}else{var brush=this.brush.createDuplicate();brush.fill.srcRect=srcRect;this.spPr.setFill(brush)}};CGraphicObjectBase.prototype.calculateSrcRect2=function(){var oShapeDrawer=new AscCommon.CShapeDrawer;
|
|
|
|
|
oShapeDrawer.bIsCheckBounds=true;oShapeDrawer.Graphics=new AscFormat.CSlideBoundsChecker;this.check_bounds(oShapeDrawer);return CalculateSrcRect(this.transform,oShapeDrawer,this.cropObject.invertTransform,this.cropObject.extX,this.cropObject.extY)};CGraphicObjectBase.prototype.getMediaFileName=function(){return null};CGraphicObjectBase.prototype.getLogicDocument=function(){var oApi=editor||Asc["editor"];if(oApi&&oApi.WordControl)return oApi.WordControl.m_oLogicDocument;return null};CGraphicObjectBase.prototype.updatePosition=
|
|
|
|
|
function(x,y){this.posX=x;this.posY=y;if(!this.group){this.x=this.localX+x;this.y=this.localY+y}else{this.x=this.localX;this.y=this.localY}if(this.updateTransformMatrix)this.updateTransformMatrix()};CGraphicObjectBase.prototype.copyComments=function(oLogicDocument){if(!oLogicDocument)return;var aDocContents=[];this.getAllDocContents(aDocContents);for(var i=0;i<aDocContents.length;++i)aDocContents[i].CreateDuplicateComments()};CGraphicObjectBase.prototype.createPlaceholderControl=function(){var phType=
|
|
|
|
|
this.getPhType();var aButtons=[];var isLocalDesktop=window["AscDesktopEditor"]&&window["AscDesktopEditor"]["IsSupportMedia"]&&window["AscDesktopEditor"]["IsSupportMedia"]();switch(phType){case null:{aButtons.push(AscCommon.PlaceholderButtonType.Table);aButtons.push(AscCommon.PlaceholderButtonType.Chart);aButtons.push(AscCommon.PlaceholderButtonType.Image);aButtons.push(AscCommon.PlaceholderButtonType.ImageUrl);if(isLocalDesktop){aButtons.push(AscCommon.PlaceholderButtonType.Video);aButtons.push(AscCommon.PlaceholderButtonType.Audio)}break}case AscFormat.phType_body:{break}case AscFormat.phType_chart:{aButtons.push(AscCommon.PlaceholderButtonType.Chart);
|
|
|
|
|
break}case AscFormat.phType_clipArt:{aButtons.push(AscCommon.PlaceholderButtonType.Image);aButtons.push(AscCommon.PlaceholderButtonType.ImageUrl);break}case AscFormat.phType_ctrTitle:{break}case AscFormat.phType_dgm:{break}case AscFormat.phType_dt:{break}case AscFormat.phType_ftr:{break}case AscFormat.phType_hdr:{break}case AscFormat.phType_media:{if(isLocalDesktop){aButtons.push(AscCommon.PlaceholderButtonType.Video);aButtons.push(AscCommon.PlaceholderButtonType.Audio)}break}case AscFormat.phType_obj:{aButtons.push(AscCommon.PlaceholderButtonType.Table);
|
|
|
|
|
aButtons.push(AscCommon.PlaceholderButtonType.Chart);aButtons.push(AscCommon.PlaceholderButtonType.Image);aButtons.push(AscCommon.PlaceholderButtonType.ImageUrl);if(isLocalDesktop){aButtons.push(AscCommon.PlaceholderButtonType.Video);aButtons.push(AscCommon.PlaceholderButtonType.Audio)}break}case AscFormat.phType_pic:{aButtons.push(AscCommon.PlaceholderButtonType.Image);aButtons.push(AscCommon.PlaceholderButtonType.ImageUrl);break}case AscFormat.phType_sldImg:{aButtons.push(AscCommon.PlaceholderButtonType.Image);
|
|
|
|
|
aButtons.push(AscCommon.PlaceholderButtonType.ImageUrl);break}case AscFormat.phType_sldNum:{break}case AscFormat.phType_subTitle:{break}case AscFormat.phType_tbl:{aButtons.push(AscCommon.PlaceholderButtonType.Table);break}case AscFormat.phType_title:{break}}var nSlideNum=0;if(this.parent.getObjectType&&this.parent.getObjectType()===AscDFH.historyitem_type_Slide)nSlideNum=this.parent.num;return AscCommon.CreateDrawingPlaceholder(this.Id,aButtons,nSlideNum,{x:0,y:0,w:this.extX,h:this.extY},this.transform)};
|
|
|
|
|
CGraphicObjectBase.prototype.onSlicerUpdate=function(sName){return false};CGraphicObjectBase.prototype.onSlicerLock=function(sName,bLock){};CGraphicObjectBase.prototype.onSlicerDelete=function(sName){return false};CGraphicObjectBase.prototype.onSlicerChangeName=function(sName,sNewName){return false};CGraphicObjectBase.prototype.onUpdate=function(oRect){if(this.drawingBase)this.drawingBase.onUpdate(oRect);else if(this.group)this.group.onUpdate(oRect)};CGraphicObjectBase.prototype.getSlicerViewByName=
|
|
|
|
|
function(name){return null};CGraphicObjectBase.prototype.setParent2=function(parent){this.setParent(parent);if(Array.isArray(this.spTree))for(var i=0;i<this.spTree.length;++i)this.spTree[i].setParent2(parent)};CGraphicObjectBase.prototype.documentCreateFontMap=function(oMap){};CGraphicObjectBase.prototype.createFontMap=function(oMap){this.documentCreateFontMap(oMap)};function CRelSizeAnchor(){CBaseObject.call(this);this.fromX=null;this.fromY=null;this.toX=null;this.toY=null;this.object=null;this.parent=
|
|
|
|
|
null;this.drawingBase=null}CRelSizeAnchor.prototype=Object.create(CBaseObject.prototype);CRelSizeAnchor.prototype.constructor=CRelSizeAnchor;CRelSizeAnchor.prototype.setDrawingBase=function(drawingBase){this.drawingBase=drawingBase};CRelSizeAnchor.prototype.getObjectType=function(){return AscDFH.historyitem_type_RelSizeAnchor};CRelSizeAnchor.prototype.setFromTo=function(fromX,fromY,toX,toY){History.Add(new AscDFH.CChangesDrawingsDouble(this,AscDFH.historyitem_RelSizeAnchorFromX,this.fromX,fromX));
|
|
|
|
|
History.Add(new AscDFH.CChangesDrawingsDouble(this,AscDFH.historyitem_RelSizeAnchorFromY,this.fromY,fromY));History.Add(new AscDFH.CChangesDrawingsDouble(this,AscDFH.historyitem_RelSizeAnchorToX,this.toX,toX));History.Add(new AscDFH.CChangesDrawingsDouble(this,AscDFH.historyitem_RelSizeAnchorToY,this.toY,toY));this.fromX=fromX;this.fromY=fromY;this.toX=toX;this.toY=toY};CRelSizeAnchor.prototype.setObject=function(object){History.Add(new AscDFH.CChangesDrawingsObject(this,AscDFH.historyitem_RelSizeAnchorObject,
|
|
|
|
|
this.object,object));this.object=object;if(object)object.setParent(this)};CRelSizeAnchor.prototype.setParent=function(object){History.Add(new AscDFH.CChangesDrawingsObject(this,AscDFH.historyitem_RelSizeAnchorParent,this.parent,object));this.parent=object};CRelSizeAnchor.prototype.copy=function(oPr){var copy=new CRelSizeAnchor;copy.setFromTo(this.fromX,this.fromY,this.toX,this.toY);if(this.object)copy.setObject(this.object.copy(oPr));return copy};CRelSizeAnchor.prototype.Refresh_RecalcData=function(drawingDocument){if(this.parent&&
|
|
|
|
|
this.parent.Refresh_RecalcData2)this.parent.Refresh_RecalcData2()};CRelSizeAnchor.prototype.Refresh_RecalcData2=function(drawingDocument){if(this.parent&&this.parent.Refresh_RecalcData2)this.parent.Refresh_RecalcData2()};AscDFH.drawingsChangesMap[AscDFH.historyitem_RelSizeAnchorFromX]=function(oClass,value){oClass.fromX=value};AscDFH.drawingsChangesMap[AscDFH.historyitem_RelSizeAnchorFromY]=function(oClass,value){oClass.fromY=value};AscDFH.drawingsChangesMap[AscDFH.historyitem_RelSizeAnchorToX]=function(oClass,
|
|
|
|
|
value){oClass.toX=value};AscDFH.drawingsChangesMap[AscDFH.historyitem_RelSizeAnchorToY]=function(oClass,value){oClass.toY=value};AscDFH.drawingsChangesMap[AscDFH.historyitem_RelSizeAnchorObject]=function(oClass,value){oClass.object=value};AscDFH.drawingsChangesMap[AscDFH.historyitem_RelSizeAnchorParent]=function(oClass,value){oClass.parent=value};AscDFH.changesFactory[AscDFH.historyitem_RelSizeAnchorFromX]=window["AscDFH"].CChangesDrawingsDouble;AscDFH.changesFactory[AscDFH.historyitem_RelSizeAnchorFromY]=
|
|
|
|
|
window["AscDFH"].CChangesDrawingsDouble;AscDFH.changesFactory[AscDFH.historyitem_RelSizeAnchorToX]=window["AscDFH"].CChangesDrawingsDouble;AscDFH.changesFactory[AscDFH.historyitem_RelSizeAnchorToY]=window["AscDFH"].CChangesDrawingsDouble;AscDFH.changesFactory[AscDFH.historyitem_RelSizeAnchorObject]=window["AscDFH"].CChangesDrawingsObject;AscDFH.changesFactory[AscDFH.historyitem_RelSizeAnchorParent]=window["AscDFH"].CChangesDrawingsObject;function CAbsSizeAnchor(){CBaseObject.call(this);this.fromX=
|
|
|
|
|
null;this.fromY=null;this.toX=null;this.toY=null;this.object=null;this.parent=null;this.drawingBase=null}CAbsSizeAnchor.prototype=Object.create(CBaseObject.prototype);CAbsSizeAnchor.prototype.constructor=CAbsSizeAnchor;CAbsSizeAnchor.prototype.setDrawingBase=function(drawingBase){this.drawingBase=drawingBase};CAbsSizeAnchor.prototype.getObjectType=function(){return AscDFH.historyitem_type_AbsSizeAnchor};CAbsSizeAnchor.prototype.setFromTo=function(fromX,fromY,extX,extY){History.Add(new AscDFH.CChangesDrawingsDouble(this,
|
|
|
|
|
AscDFH.historyitem_AbsSizeAnchorFromX,this.fromX,fromX));History.Add(new AscDFH.CChangesDrawingsDouble(this,AscDFH.historyitem_AbsSizeAnchorFromY,this.fromY,fromY));History.Add(new AscDFH.CChangesDrawingsDouble(this,AscDFH.historyitem_AbsSizeAnchorExtX,this.toX,extX));History.Add(new AscDFH.CChangesDrawingsDouble(this,AscDFH.historyitem_AbsSizeAnchorExtY,this.toY,extY));this.fromX=fromX;this.fromY=fromY;this.toX=extX;this.toY=extY};CAbsSizeAnchor.prototype.setObject=function(object){History.Add(new AscDFH.CChangesDrawingsObject(this,
|
|
|
|
|
AscDFH.historyitem_AbsSizeAnchorObject,this.object,object));this.object=object;if(object)object.setParent(this)};CAbsSizeAnchor.prototype.setParent=function(object){History.Add(new AscDFH.CChangesDrawingsObject(this,AscDFH.historyitem_AbsSizeAnchorParent,this.parent,object));this.parent=object};CAbsSizeAnchor.prototype.copy=function(oPr){var copy=new CRelSizeAnchor;copy.setFromTo(this.fromX,this.fromY,this.toX,this.toY);if(this.object)copy.setObject(this.object.copy(oPr));return copy};CAbsSizeAnchor.prototype.Refresh_RecalcData=
|
|
|
|
|
function(drawingDocument){if(this.parent&&this.parent.Refresh_RecalcData2)this.parent.Refresh_RecalcData2()};CAbsSizeAnchor.prototype.Refresh_RecalcData2=function(drawingDocument){if(this.parent&&this.parent.Refresh_RecalcData2)this.parent.Refresh_RecalcData2()};function CalculateSrcRect(parentCropTransform,bounds,oInvertTransformCrop,cropExtX,cropExtY){var lt_x_abs=parentCropTransform.TransformPointX(bounds.min_x,bounds.min_y);var lt_y_abs=parentCropTransform.TransformPointY(bounds.min_x,bounds.min_y);
|
|
|
|
|
var rb_x_abs=parentCropTransform.TransformPointX(bounds.max_x,bounds.max_y);var rb_y_abs=parentCropTransform.TransformPointY(bounds.max_x,bounds.max_y);var lt_x_rel=oInvertTransformCrop.TransformPointX(lt_x_abs,lt_y_abs);var lt_y_rel=oInvertTransformCrop.TransformPointY(lt_x_abs,lt_y_abs);var rb_x_rel=oInvertTransformCrop.TransformPointX(rb_x_abs,rb_y_abs);var rb_y_rel=oInvertTransformCrop.TransformPointY(rb_x_abs,rb_y_abs);var srcRect=new AscFormat.CSrcRect;var _l=100*lt_x_rel/cropExtX;var _t=100*
|
|
|
|
|
lt_y_rel/cropExtY;var _r=100*rb_x_rel/cropExtX;var _b=100*rb_y_rel/cropExtY;srcRect.l=Math.min(_l,_r);srcRect.t=Math.min(_t,_b);srcRect.r=Math.max(_l,_r);srcRect.b=Math.max(_t,_b);return srcRect}AscDFH.drawingsChangesMap[AscDFH.historyitem_AbsSizeAnchorFromX]=function(oClass,value){oClass.fromX=value};AscDFH.drawingsChangesMap[AscDFH.historyitem_AbsSizeAnchorFromY]=function(oClass,value){oClass.fromY=value};AscDFH.drawingsChangesMap[AscDFH.historyitem_AbsSizeAnchorExtX]=function(oClass,value){oClass.toX=
|
|
|
|
|
value};AscDFH.drawingsChangesMap[AscDFH.historyitem_AbsSizeAnchorExtY]=function(oClass,value){oClass.toY=value};AscDFH.drawingsChangesMap[AscDFH.historyitem_AbsSizeAnchorObject]=function(oClass,value){oClass.object=value};AscDFH.drawingsChangesMap[AscDFH.historyitem_AbsSizeAnchorParent]=function(oClass,value){oClass.parent=value};AscDFH.changesFactory[AscDFH.historyitem_AbsSizeAnchorFromX]=window["AscDFH"].CChangesDrawingsDouble;AscDFH.changesFactory[AscDFH.historyitem_AbsSizeAnchorFromY]=window["AscDFH"].CChangesDrawingsDouble;
|
|
|
|
|
AscDFH.changesFactory[AscDFH.historyitem_AbsSizeAnchorExtX]=window["AscDFH"].CChangesDrawingsDouble;AscDFH.changesFactory[AscDFH.historyitem_AbsSizeAnchorExtY]=window["AscDFH"].CChangesDrawingsDouble;AscDFH.changesFactory[AscDFH.historyitem_AbsSizeAnchorObject]=window["AscDFH"].CChangesDrawingsObject;AscDFH.changesFactory[AscDFH.historyitem_AbsSizeAnchorParent]=window["AscDFH"].CChangesDrawingsObject;window["AscFormat"]=window["AscFormat"]||{};window["AscFormat"].CBaseObject=CBaseObject;window["AscFormat"].CGraphicObjectBase=
|
|
|
|
|
CGraphicObjectBase;window["AscFormat"].CGraphicBounds=CGraphicBounds;window["AscFormat"].checkNormalRotate=checkNormalRotate;window["AscFormat"].normalizeRotate=normalizeRotate;window["AscFormat"].CRelSizeAnchor=CRelSizeAnchor;window["AscFormat"].CAbsSizeAnchor=CAbsSizeAnchor;window["AscFormat"].CalculateSrcRect=CalculateSrcRect;window["AscFormat"].CCopyObjectProperties=CCopyObjectProperties;window["AscFormat"].LOCKS_MASKS=LOCKS_MASKS})(window);"use strict";(function(window,undefined){var g_memory=
|
|
|
|
|
AscFonts.g_memory;var DecodeBase64Char=AscFonts.DecodeBase64Char;var b64_decode=AscFonts.b64_decode;var c_oAscSizeRelFromH=AscCommon.c_oAscSizeRelFromH;var c_oAscSizeRelFromV=AscCommon.c_oAscSizeRelFromV;var CMatrix=AscCommon.CMatrix;var isRealObject=AscCommon.isRealObject;var global_mouseEvent=AscCommon.global_mouseEvent;var History=AscCommon.History;var global_MatrixTransformer=AscCommon.global_MatrixTransformer;var checkNormalRotate=AscFormat.checkNormalRotate;var HitInLine=AscFormat.HitInLine;
|
|
|
|
|
var MOVE_DELTA=AscFormat.MOVE_DELTA;var c_oAscFill=Asc.c_oAscFill;var dTextFitDelta=3;function CheckObjectLine(obj){return obj instanceof CShape&&obj.spPr&&obj.spPr.geometry&&AscFormat.CheckLinePreset(obj.spPr.geometry.preset)}function CheckWordArtTextPr(oRun){if(oRun instanceof AscCommonWord.ParaRun){var oTextPr=oRun.Get_CompiledPr();if(oTextPr.TextFill||oTextPr.TextOutline&&oTextPr.TextOutline.Fill&&oTextPr.TextOutline.Fill.fill&&oTextPr.TextOutline.Fill.fill.type!==Asc.c_oAscFill.FILL_TYPE_NOFILL||
|
|
|
|
|
oTextPr.Unifill&&oTextPr.Unifill.fill&&(oTextPr.Unifill.fill.type!==c_oAscFill.FILL_TYPE_SOLID||oTextPr.Unifill.transparent!=null&&oTextPr.Unifill.transparent<254.5))return true}return false}function hitInRect(x,y,l,t,r,b){return x>=l&&x<=r&&y>=t&&y<=b}function hitToCropHandles(x,y,object){var invert_transform=object.getInvertTransform();if(!invert_transform)return-1;var t_x,t_y;t_x=invert_transform.TransformPointX(x,y);t_y=invert_transform.TransformPointY(x,y);var fCoeff=object.convertPixToMM(1);
|
|
|
|
|
var fCoeff2=1/fCoeff;var widthCorner=object.extX*fCoeff2+1>>1;var isCentralMarkerX=widthCorner>40?true:false;if(widthCorner>17)widthCorner=17;var heightCorner=object.extY*fCoeff2+1>>1;var isCentralMarkerY=heightCorner>40?true:false;if(heightCorner>17)heightCorner=17;widthCorner*=fCoeff;heightCorner*=fCoeff;var markerWidth=5*fCoeff;if(hitInRect(t_x,t_y,0,0,widthCorner,markerWidth))return 0;if(hitInRect(t_x,t_y,0,0,markerWidth,heightCorner))return 0;if(isCentralMarkerX){if(hitInRect(t_x,t_y,object.extX/
|
|
|
|
|
2-widthCorner/2,0,object.extX/2+widthCorner/2,markerWidth))return 1;if(hitInRect(t_x,t_y,object.extX/2-widthCorner/2,object.extY-markerWidth,object.extX/2+widthCorner/2,object.extY))return 5}if(hitInRect(t_x,t_y,object.extX-widthCorner,0,object.extX,markerWidth))return 2;if(hitInRect(t_x,t_y,object.extX-markerWidth,0,object.extX,heightCorner))return 2;if(isCentralMarkerY){if(hitInRect(t_x,t_y,object.extX-markerWidth,object.extY/2-heightCorner/2,object.extX,object.extY/2+heightCorner/2))return 3;if(hitInRect(t_x,
|
|
|
|
|
t_y,0,object.extY/2-heightCorner/2,markerWidth,object.extY/2+heightCorner/2))return 7}if(hitInRect(t_x,t_y,object.extX-markerWidth,object.extY-heightCorner,object.extX,object.extY))return 4;if(hitInRect(t_x,t_y,object.extX-widthCorner,object.extY-markerWidth,object.extX,object.extY))return 4;if(hitInRect(t_x,t_y,0,object.extY-heightCorner,markerWidth,object.extY))return 6;if(hitInRect(t_x,t_y,0,object.extY-markerWidth,widthCorner,object.extY))return 6;return-1}function hitToHandles(x,y,object){if(object.cropObject)return hitToCropHandles(x,
|
|
|
|
|
y,object);var invert_transform=object.getInvertTransform();if(!invert_transform)return-1;var t_x,t_y;t_x=invert_transform.TransformPointX(x,y);t_y=invert_transform.TransformPointY(x,y);var radius=object.convertPixToMM(AscCommon.TRACK_CIRCLE_RADIUS);if(typeof global_mouseEvent!=="undefined"&&isRealObject(global_mouseEvent)&&AscFormat.isRealNumber(global_mouseEvent.KoefPixToMM))radius*=global_mouseEvent.KoefPixToMM;if(global_mouseEvent&&global_mouseEvent.AscHitToHandlesEpsilon)radius=global_mouseEvent.AscHitToHandlesEpsilon;
|
|
|
|
|
radius*=radius;var _min_dist=2*radius;var _ret_value=-1;var check_line=CheckObjectLine(object);var sqr_x=t_x*t_x,sqr_y=t_y*t_y;var _tmp_dist=sqr_x+sqr_y;if(_tmp_dist<_min_dist){_min_dist=_tmp_dist;_ret_value=0}var hc=object.extX*.5;var dist_x=t_x-hc;sqr_x=dist_x*dist_x;_tmp_dist=sqr_x+sqr_y;if(_tmp_dist<_min_dist&&!check_line){_min_dist=_tmp_dist;_ret_value=1}dist_x=t_x-object.extX;sqr_x=dist_x*dist_x;_tmp_dist=sqr_x+sqr_y;if(_tmp_dist<_min_dist&&!check_line){_min_dist=_tmp_dist;_ret_value=2}var vc=
|
|
|
|
|
object.extY*.5;var dist_y=t_y-vc;sqr_y=dist_y*dist_y;_tmp_dist=sqr_x+sqr_y;if(_tmp_dist<_min_dist&&!check_line){_min_dist=_tmp_dist;_ret_value=3}dist_y=t_y-object.extY;sqr_y=dist_y*dist_y;_tmp_dist=sqr_x+sqr_y;if(_tmp_dist<_min_dist){_min_dist=_tmp_dist;_ret_value=4}dist_x=t_x-hc;sqr_x=dist_x*dist_x;_tmp_dist=sqr_x+sqr_y;if(_tmp_dist<_min_dist&&!check_line){_min_dist=_tmp_dist;_ret_value=5}dist_x=t_x;sqr_x=dist_x*dist_x;_tmp_dist=sqr_x+sqr_y;if(_tmp_dist<_min_dist&&!check_line){_min_dist=_tmp_dist;
|
|
|
|
|
_ret_value=6}dist_y=t_y-vc;sqr_y=dist_y*dist_y;_tmp_dist=sqr_x+sqr_y;if(_tmp_dist<_min_dist&&!check_line){_min_dist=_tmp_dist;_ret_value=7}if(object.canRotate&&object.canRotate()&&!check_line){var rotate_distance=object.convertPixToMM(AscCommon.TRACK_DISTANCE_ROTATE);dist_y=t_y+rotate_distance;sqr_y=dist_y*dist_y;dist_x=t_x-hc;sqr_x=dist_x*dist_x;_tmp_dist=sqr_x+sqr_y;if(_tmp_dist<_min_dist){_min_dist=_tmp_dist;_ret_value=8}}dist_x=t_x-hc;dist_y=t_y-vc;_tmp_dist=dist_x*dist_x+dist_y*dist_y;if(_tmp_dist<
|
|
|
|
|
_min_dist&&!check_line){_min_dist=_tmp_dist;_ret_value=-1}if(_min_dist<radius)return _ret_value;return-1}function CreateUniFillByUniColorCopy(uniColor){var ret=new AscFormat.CUniFill;ret.setFill(new AscFormat.CSolidFill);ret.fill.setColor(uniColor.createDuplicate());return ret}function CreateUniFillByUniColor(uniColor){var ret=new AscFormat.CUniFill;ret.setFill(new AscFormat.CSolidFill);ret.fill.setColor(uniColor.createDuplicate());return ret}function CopyRunToPPTX(Run,Paragraph,bHyper){var NewRun=
|
|
|
|
|
new ParaRun(Paragraph,false);var RunPr=Run.Pr.Copy();if(RunPr.RStyle!=undefined)RunPr.RStyle=undefined;RunPr.FontScale=undefined;if(bHyper){if(!RunPr.Unifill)RunPr.Unifill=AscFormat.CreateUniFillSchemeColorWidthTint(11,0);RunPr.Underline=true}if(RunPr.TextFill){RunPr.Unifill=RunPr.TextFill;RunPr.TextFill=undefined}NewRun.Set_Pr(RunPr);var PosToAdd=0;for(var CurPos=0;CurPos<Run.Content.length;CurPos++){var Item=Run.Content[CurPos];if(Item.Type!==para_End&&Item.Type!==para_Drawing&&Item.Type!==para_Comment&&
|
|
|
|
|
Item.Type!==para_PageCount&&Item.Type!==para_FootnoteRef&&Item.Type!==para_FootnoteReference&&Item.Type!==para_PageNum&&Item.Type!==para_FieldChar&&Item.Type!==para_Bookmark&&Item.Type!==para_RevisionMove&&Item.Type!==para_InstrText&&Item.Type!==para_EndnoteReference&&Item.Type!==para_EndnoteRef){NewRun.Add_ToContent(PosToAdd,Item.Copy(),false);++PosToAdd}}return NewRun}function ConvertParagraphContentToPPTX(aOrigContent,oNewParagraph,bIsAddMath,bRemoveHyperlink){var Count=aOrigContent.length;for(var Index=
|
|
|
|
|
0;Index<Count;Index++){var Item=aOrigContent[Index];if(Item.Type===para_Run)oNewParagraph.Internal_Content_Add(oNewParagraph.Content.length,CopyRunToPPTX(Item,oNewParagraph),false);else if(Item.Type===para_Hyperlink)if(bRemoveHyperlink===true)for(var j=0;j<Item.Content.length;++j){if(Item.Content[j].Type===para_Run)oNewParagraph.Internal_Content_Add(oNewParagraph.Content.length,CopyRunToPPTX(Item.Content[j],oNewParagraph),false)}else oNewParagraph.Internal_Content_Add(oNewParagraph.Content.length,
|
|
|
|
|
ConvertHyperlinkToPPTX(Item,oNewParagraph),false);else if(Item.Type===para_InlineLevelSdt)ConvertParagraphContentToPPTX(Item.Content,oNewParagraph,bIsAddMath,bRemoveHyperlink);else if(true===bIsAddMath&&Item.Type===para_Math)oNewParagraph.Internal_Content_Add(oNewParagraph.Content.length,Item.Copy(),false)}}function ConvertParagraphToPPTX(paragraph,drawingDocument,newParent,bIsAddMath,bRemoveHyperlink){var _drawing_document=isRealObject(drawingDocument)?drawingDocument:paragraph.DrawingDocument;var _new_parent=
|
|
|
|
|
isRealObject(newParent)?newParent:null;var new_paragraph=new Paragraph(_drawing_document,_new_parent,true);if(!(paragraph instanceof Paragraph))return new_paragraph;var oCopyPr=paragraph.Pr.Copy();oCopyPr.ContextualSpacing=undefined;oCopyPr.KeepLines=undefined;oCopyPr.KeepNext=undefined;oCopyPr.PageBreakBefore=undefined;oCopyPr.Shd=undefined;oCopyPr.Brd.First=undefined;oCopyPr.Brd.Last=undefined;oCopyPr.Brd.Between=undefined;oCopyPr.Brd.Bottom=undefined;oCopyPr.Brd.Left=undefined;oCopyPr.Brd.Right=
|
|
|
|
|
undefined;oCopyPr.Brd.Top=undefined;oCopyPr.WidowControl=undefined;oCopyPr.Tabs=undefined;oCopyPr.NumPr=undefined;oCopyPr.PStyle=undefined;oCopyPr.FramePr=undefined;new_paragraph.Set_Pr(oCopyPr);var oNewEndPr=paragraph.TextPr.Value.Copy();if(oNewEndPr.TextFill){oNewEndPr.Unifill=oNewEndPr.TextFill;oNewEndPr.TextFill=undefined}new_paragraph.TextPr.Set_Value(oNewEndPr);new_paragraph.Internal_Content_Remove2(0,new_paragraph.Content.length);ConvertParagraphContentToPPTX(paragraph.Content,new_paragraph,
|
|
|
|
|
bIsAddMath,bRemoveHyperlink);var EndRun=new ParaRun(new_paragraph);EndRun.Add_ToContent(0,new ParaEnd);new_paragraph.Internal_Content_Add(new_paragraph.Content.length,EndRun,false);return new_paragraph}function ConvertElementsToPPTX(aResult,aElements,drawingDocument,newParent,bIsAddMath,bRemoveHyperlink){var i,j,oElement;for(i=0;i<aElements.length;++i){oElement=aElements[i];if(oElement instanceof AscCommonWord.Paragraph)aResult.push(ConvertParagraphToPPTX(oElement));else if(oElement instanceof AscCommonWord.CTable){var paragraphs=
|
|
|
|
|
[];oElement.GetAllParagraphs({All:true},paragraphs);for(j=0;j<paragraphs.length;j++)aResult.push(AscFormat.ConvertParagraphToPPTX(paragraphs[j],drawingDocument,newParent,bIsAddMath,bRemoveHyperlink))}else if(oElement instanceof AscCommonWord.CBlockLevelSdt)ConvertElementsToPPTX(aResult,oElement.Content.Content,drawingDocument,newParent,bIsAddMath,bRemoveHyperlink)}}function ConvertHyperlinkToPPTX(hyperlink,paragraph){var hyperlink_ret=new ParaHyperlink,i,item,pos=0;hyperlink_ret.SetValue(hyperlink.Value);
|
|
|
|
|
hyperlink_ret.SetToolTip(hyperlink.ToolTip);for(i=0;i<hyperlink.Content.length;++i){item=hyperlink.Content[i];if(item.Type===para_Run)hyperlink_ret.Add_ToContent(pos++,CopyRunToPPTX(item,paragraph,true));else if(item.Type===para_Hyperlink)hyperlink_ret.Add_ToContent(pos++,ConvertHyperlinkToPPTX(item,paragraph))}return hyperlink_ret}function ConvertParagraphToWord(paragraph,docContent){var _docContent=isRealObject(docContent)?docContent:paragraph.Parent;var oldFlag=paragraph.bFromDocument;paragraph.bFromDocument=
|
|
|
|
|
true;var new_paragraph=paragraph.Copy(_docContent);CheckWordParagraphContent(new_paragraph.Content,new_paragraph.Pr.DefaultRunPr);var NewRPr=CheckWordRunPr(new_paragraph.TextPr.Value);var oCopyDefaultPr;if(NewRPr){if(new_paragraph.Pr.DefaultRunPr){oCopyDefaultPr=new_paragraph.Pr.DefaultRunPr.Copy();oCopyDefaultPr.Merge(NewRPr);NewRPr=CheckWordRunPr(oCopyDefaultPr);if(!NewRPr)NewRPr=oCopyDefaultPr}new_paragraph.TextPr.Apply_TextPr(NewRPr)}else if(new_paragraph.Pr.DefaultRunPr){oCopyDefaultPr=new_paragraph.Pr.DefaultRunPr.Copy();
|
|
|
|
|
oCopyDefaultPr.Merge(new_paragraph.TextPr.Value);NewRPr=CheckWordRunPr(oCopyDefaultPr);if(!NewRPr)NewRPr=oCopyDefaultPr;new_paragraph.TextPr.Apply_TextPr(NewRPr)}paragraph.bFromDocument=oldFlag;return new_paragraph}function CheckWordRunPr(Pr,bMath){var NewRPr=null;if(Pr.Unifill&&Pr.Unifill.fill)switch(Pr.Unifill.fill.type){case c_oAscFill.FILL_TYPE_SOLID:{if(Pr.Unifill.fill.color&&Pr.Unifill.fill.color.color)switch(Pr.Unifill.fill.color.color.type){case Asc.c_oAscColor.COLOR_TYPE_SCHEME:{if(Pr.Unifill.fill.color.Mods&&
|
|
|
|
|
Pr.Unifill.fill.color.Mods.Mods.length!==0)if(!Pr.Unifill.fill.color.canConvertPPTXModsToWord()){NewRPr=Pr.Copy();NewRPr.TextFill=NewRPr.Unifill;NewRPr.Unifill=undefined}else{NewRPr=Pr.Copy();NewRPr.Unifill.convertToWordMods()}break}case Asc.c_oAscColor.COLOR_TYPE_SRGB:{NewRPr=Pr.Copy();var RGBA=Pr.Unifill.fill.color.color.RGBA;NewRPr.Color=new CDocumentColor(RGBA.R,RGBA.G,RGBA.B);NewRPr.Unifill=undefined;break}default:{NewRPr=Pr.Copy();NewRPr.TextFill=NewRPr.Unifill;NewRPr.Unifill=undefined}}break}case c_oAscFill.FILL_TYPE_PATT:case c_oAscFill.FILL_TYPE_BLIP:{NewRPr=
|
|
|
|
|
Pr.Copy();NewRPr.TextFill=AscFormat.CreateUnfilFromRGB(0,0,0);NewRPr.Unifill=undefined;break}default:{NewRPr=Pr.Copy();NewRPr.TextFill=NewRPr.Unifill;NewRPr.Unifill=undefined;break}}if(bMath){NewRPr=Pr.Copy();NewRPr.RFonts.Set_All("Cambria Math",-1)}return NewRPr}function CheckWordParagraphContent(aContent,oTextPr){var NewRPr,MergePr;for(var i=0;i<aContent.length;++i){var oItem=aContent[i];switch(oItem.Type){case para_Run:{NewRPr=CheckWordRunPr(oItem.Pr);if(NewRPr){MergePr=NewRPr;if(oTextPr){MergePr=
|
|
|
|
|
oTextPr.Copy();MergePr.Merge(NewRPr);NewRPr=CheckWordRunPr(MergePr);if(!NewRPr)NewRPr=MergePr}oItem.Set_Pr(NewRPr)}else if(oTextPr){MergePr=oTextPr.Copy();MergePr.Merge(oItem.Pr);NewRPr=CheckWordRunPr(MergePr);if(!NewRPr)NewRPr=MergePr;oItem.Set_Pr(NewRPr)}break}case para_Hyperlink:{CheckWordParagraphContent(oItem.Content);break}case para_Math:{if(oItem.Root&&oItem.Root.Content)CheckWordParagraphContent(oItem.Root.Content);break}case para_Math_Run:{NewRPr=CheckWordRunPr(oItem.Pr,true);if(NewRPr){MergePr=
|
|
|
|
|
NewRPr;if(oTextPr){MergePr=oTextPr.Copy();MergePr.Merge(NewRPr);NewRPr=CheckWordRunPr(MergePr);if(!NewRPr)NewRPr=MergePr}oItem.Set_Pr(NewRPr)}else if(oTextPr){MergePr=oTextPr.Copy();MergePr.Merge(oItem.Pr);NewRPr=CheckWordRunPr(MergePr);if(!NewRPr)NewRPr=MergePr;oItem.Set_Pr(NewRPr)}break}}}}function ConvertGraphicFrameToWordTable(oGraphicFrame,oDocument){oGraphicFrame.setWordFlag(false,oDocument);return oGraphicFrame.graphicObject.Copy(oDocument)}function ConvertTableToGraphicFrame(oTable,oPresentation){var oGraphicFrame=
|
|
|
|
|
new AscFormat.CGraphicFrame;var oTable2=new CTable(oPresentation.DrawingDocument,oGraphicFrame,true,0,[].concat(oTable.TableGrid),oTable.TableGrid.length,true);oTable2.Reset(0,0,50,1E5,0,0,1);oTable2.SetTableLayout(tbllayout_Fixed);oTable2.Set_Pr(oTable.Pr.Copy());oTable2.Set_TableLook(oTable.TableLook.Copy());for(var i=0;i<oTable.Content.length;++i){var oRow=oTable.Content[i];var oNewRow=new CTableRow(oTable2,oRow.Content.length,oTable2.TableGrid);for(var j=0;j<oRow.Content.length;++j){var oContent=
|
|
|
|
|
oRow.Content[j].Content;var oNewContent=oNewRow.Content[j].Content;for(var t=0;t<oContent.Content.length;++t)if(oContent.Content[t].Get_Type()===type_Paragraph)oNewContent.Internal_Content_Add(oNewContent.Content.length,AscFormat.ConvertParagraphToPPTX(oContent.Content[t],oPresentation.DrawingDocument,oNewContent))}var nIndex=oTable2.Content.length;oTable2.Content[nIndex]=oNewRow;History.Add(new CChangesTableAddRow(oTable2,nIndex,[oNewRow]));oTable2.private_UpdateTableGrid()}if(!oGraphicFrame.spPr){oGraphicFrame.setSpPr(new AscFormat.CSpPr);
|
|
|
|
|
oGraphicFrame.spPr.setParent(oGraphicFrame)}oGraphicFrame.spPr.setXfrm(new AscFormat.CXfrm);oGraphicFrame.spPr.xfrm.setExtX(50);oGraphicFrame.spPr.xfrm.setExtY(50);oGraphicFrame.spPr.xfrm.setParent(oGraphicFrame.spPr);var _nvGraphicFramePr=new AscFormat.UniNvPr;oGraphicFrame.setNvSpPr(_nvGraphicFramePr);if(AscCommon.isRealObject(_nvGraphicFramePr)&&AscFormat.isRealNumber(_nvGraphicFramePr.locks))oGraphicFrame.setLocks(_nvGraphicFramePr.locks);oGraphicFrame.setGraphicObject(oTable2);oGraphicFrame.setBDeleted(false);
|
|
|
|
|
return oGraphicFrame}function fHandleContent(aContent,oMax){for(var i=0;i<aContent.length;++i){var oContentElement=aContent[i];if(oContentElement.Get_Type()===type_Paragraph){var paragraph_lines=aContent[i].Lines;for(var j=0;j<paragraph_lines.length;++j)if(paragraph_lines[j].Ranges[0].W>oMax.max_width)oMax.max_width=paragraph_lines[j].Ranges[0].X+paragraph_lines[j].Ranges[0].W}else if(oContentElement.Get_Type()===type_Table){if(oContentElement.Bounds.Right>oMax.max_width)oMax.max_width=oContentElement.Bounds.Right}else if(oContentElement.Get_Type()===
|
|
|
|
|
type_BlockLevelSdt)if(oContentElement&&oContentElement.Content)fHandleContent(oContentElement.Content.Content,oMax)}}function RecalculateDocContentByMaxLine(oDocContent,dMaxWidth,bNeedRecalcAllDrawings){var oMaxWidth={max_width:0},i;oDocContent.Reset(0,0,dMaxWidth,2E4);if(bNeedRecalcAllDrawings){var aAllDrawings=oDocContent.GetAllDrawingObjects();for(i=0;i<aAllDrawings.length;++i)aAllDrawings[i].GraphicObj.recalculate()}oDocContent.Recalculate_Page(0,true);fHandleContent(oDocContent.Content,oMaxWidth);
|
|
|
|
|
if(oMaxWidth.max_width===0){if(oDocContent.Is_Empty())if(oDocContent.Content[0]&&oDocContent.Content[0].Content[0]&&oDocContent.Content[0].Content[0].Content[0])return oDocContent.Content[0].Content[0].Content[0].WidthVisible/TEXTWIDTH_DIVIDER;return.001}return oMaxWidth.max_width}function CheckExcelDrawingXfrm(xfrm){var rot=AscFormat.isRealNumber(xfrm.rot)?xfrm.rot:0;if(checkNormalRotate(rot)){if(xfrm.offX<0)xfrm.setOffX(0);if(xfrm.offY<0)xfrm.setOffY(0)}else{var dPosX=xfrm.offX+xfrm.extX/2-xfrm.extY/
|
|
|
|
|
2;var dPosY=xfrm.offY+xfrm.extY/2-xfrm.extX/2;if(dPosX<0)xfrm.setOffX(xfrm.offX-dPosX);if(dPosY<0)xfrm.setOffY(xfrm.offY-dPosY)}}function SetXfrmFromMetrics(oDrawing,metrics){AscFormat.CheckSpPrXfrm(oDrawing);var rot=AscFormat.isRealNumber(oDrawing.spPr.xfrm.rot)?AscFormat.normalizeRotate(oDrawing.spPr.xfrm.rot):0;var metricExtX,metricExtY;if(!(oDrawing instanceof AscFormat.CGroupShape)){metricExtX=metrics.extX;metricExtY=metrics.extY;if(checkNormalRotate(rot)){oDrawing.spPr.xfrm.setExtX(metrics.extX);
|
|
|
|
|
oDrawing.spPr.xfrm.setExtY(metrics.extY)}else{oDrawing.spPr.xfrm.setExtX(metrics.extY);oDrawing.spPr.xfrm.setExtY(metrics.extX)}}else if(AscFormat.isRealNumber(oDrawing.spPr.xfrm.extX)&&AscFormat.isRealNumber(oDrawing.spPr.xfrm.extY)){metricExtX=oDrawing.spPr.xfrm.extX;metricExtY=oDrawing.spPr.xfrm.extY}else{metricExtX=metrics.extX;metricExtY=metrics.extY}if(checkNormalRotate(rot)){oDrawing.spPr.xfrm.setOffX(metrics.x);oDrawing.spPr.xfrm.setOffY(metrics.y)}else{oDrawing.spPr.xfrm.setOffX(metrics.x+
|
|
|
|
|
metricExtX/2-metricExtY/2);oDrawing.spPr.xfrm.setOffY(metrics.y+metricExtY/2-metricExtX/2)}}AscDFH.changesFactory[AscDFH.historyitem_ShapeSetNvSpPr]=AscDFH.CChangesDrawingsObject;AscDFH.changesFactory[AscDFH.historyitem_ShapeSetSpPr]=AscDFH.CChangesDrawingsObject;AscDFH.changesFactory[AscDFH.historyitem_ShapeSetStyle]=AscDFH.CChangesDrawingsObject;AscDFH.changesFactory[AscDFH.historyitem_ShapeSetTxBody]=AscDFH.CChangesDrawingsObject;AscDFH.changesFactory[AscDFH.historyitem_ShapeSetTextBoxContent]=
|
|
|
|
|
AscDFH.CChangesDrawingsObject;AscDFH.changesFactory[AscDFH.historyitem_ShapeSetBodyPr]=AscDFH.CChangesDrawingsObjectNoId;AscDFH.changesFactory[AscDFH.historyitem_AutoShapes_SetBFromSerialize]=AscDFH.CChangesDrawingsBool;AscDFH.changesFactory[AscDFH.historyitem_ShapeSetParent]=AscDFH.CChangesDrawingsObject;AscDFH.changesFactory[AscDFH.historyitem_ShapeSetGroup]=AscDFH.CChangesDrawingsObject;AscDFH.changesFactory[AscDFH.historyitem_ShapeSetWordShape]=AscDFH.CChangesDrawingsBool;AscDFH.changesFactory[AscDFH.historyitem_ShapeSetSignature]=
|
|
|
|
|
AscDFH.CChangesDrawingsObjectNoId;AscDFH.drawingsChangesMap[AscDFH.historyitem_ShapeSetNvSpPr]=function(oClass,value){oClass.nvSpPr=value};AscDFH.drawingsChangesMap[AscDFH.historyitem_ShapeSetSpPr]=function(oClass,value){oClass.spPr=value};AscDFH.drawingsChangesMap[AscDFH.historyitem_ShapeSetStyle]=function(oClass,value){oClass.style=value};AscDFH.drawingsChangesMap[AscDFH.historyitem_ShapeSetTxBody]=function(oClass,value){oClass.txBody=value};AscDFH.drawingsChangesMap[AscDFH.historyitem_ShapeSetTextBoxContent]=
|
|
|
|
|
function(oClass,value){oClass.textBoxContent=value};AscDFH.drawingsChangesMap[AscDFH.historyitem_ShapeSetBodyPr]=function(oClass,value){oClass.bodyPr=value};AscDFH.drawingsChangesMap[AscDFH.historyitem_AutoShapes_SetBFromSerialize]=function(oClass,value){oClass.fromSerialize=value};AscDFH.drawingsChangesMap[AscDFH.historyitem_ShapeSetParent]=function(oClass,value){oClass.parent=value};AscDFH.drawingsChangesMap[AscDFH.historyitem_ShapeSetGroup]=function(oClass,value){oClass.group=value};AscDFH.drawingsChangesMap[AscDFH.historyitem_ShapeSetWordShape]=
|
|
|
|
|
function(oClass,value){oClass.bWordShape=value};AscDFH.drawingsChangesMap[AscDFH.historyitem_ShapeSetSignature]=function(oClass,value){var oldSignature=oClass.signatureLine;var newSignature=value;oClass.signatureLine=value;if(!AscCommon.isFileBuild()){var oApi=window["Asc"]&&window["Asc"]["editor"]||editor;if(oApi){if(oldSignature&&oldSignature.id)oApi.sendEvent("asc_onRemoveSignature",oldSignature.id);if(newSignature&&newSignature.id)oApi.sendEvent("asc_onAddSignature",newSignature.id)}}};function CSignatureLine(){this.id=
|
|
|
|
|
null;this.signer=null;this.signer2=null;this.email=null;this.showDate=null;this.instructions=null}CSignatureLine.prototype.Write_ToBinary=function(writer){AscFormat.writeString(writer,this.id);AscFormat.writeString(writer,this.signer);AscFormat.writeString(writer,this.signer2);AscFormat.writeString(writer,this.email);AscFormat.writeBool(writer,this.showDate);AscFormat.writeString(writer,this.instructions)};CSignatureLine.prototype.Read_FromBinary=function(reader){this.id=AscFormat.readString(reader);
|
|
|
|
|
this.signer=AscFormat.readString(reader);this.signer2=AscFormat.readString(reader);this.email=AscFormat.readString(reader);this.showDate=AscFormat.readBool(reader);this.instructions=AscFormat.readString(reader)};CSignatureLine.prototype.copy=function(){var ret=new CSignatureLine;ret.id=AscCommon.CreateGUID();ret.signer=this.signer;ret.signer2=this.signer2;ret.email=this.email;ret.showDate=this.showDate;ret.instructions=this.instructions;return ret};CSignatureLine.prototype.copyWithId=function(){var sId=
|
|
|
|
|
this.id;var oCopy=this.copy();oCopy.id=sId;return oCopy};CSignatureLine.prototype.setProperties=function(oPr){this.signer=oPr.asc_getSigner1();this.signer2=oPr.asc_getSigner2();this.email=oPr.asc_getEmail();this.showDate=oPr.asc_getShowDate();this.instructions=oPr.asc_getInstructions()};AscDFH.drawingsConstructorsMap[AscDFH.historyitem_ShapeSetBodyPr]=AscFormat.CBodyPr;AscDFH.drawingsConstructorsMap[AscDFH.historyitem_ShapeSetSignature]=CSignatureLine;function CShape(){AscFormat.CGraphicObjectBase.call(this);
|
|
|
|
|
this.nvSpPr=null;this.style=null;this.txBody=null;this.bodyPr=null;this.textBoxContent=null;this.drawingBase=null;this.bWordShape=null;this.bCheckAutoFitFlag=false;this.signatureLine=null;this.transformText=new CMatrix;this.invertTransformText=null;this.localTransformText=new CMatrix;this.worksheet=null;this.cachedImage=null;this.txWarpStruct=null;this.txWarpStructParamarks=null;this.txWarpStructNoTransform=null;this.txWarpStructParamarksNoTransform=null;this.tmpFontScale=undefined;this.tmpLnSpcReduction=
|
|
|
|
|
undefined}CShape.prototype=Object.create(AscFormat.CGraphicObjectBase.prototype);CShape.prototype.constructor=CShape;CShape.prototype.getObjectType=function(){return AscDFH.historyitem_type_Shape};CShape.prototype.GetAllDrawingObjects=function(DrawingObjects){var oContent=this.getDocContent();if(oContent)oContent.GetAllDrawingObjects(DrawingObjects)};CShape.prototype.setSignature=function(oSignature){History.Add(new AscDFH.CChangesDrawingsObjectNoId(this,AscDFH.historyitem_ShapeSetSignature,this.signatureLine,
|
|
|
|
|
oSignature));this.signatureLine=oSignature};CShape.prototype.setSignaturePr=function(oPr,sUrl){if(!oPr||!this.signatureLine)return;var oCopy=this.signatureLine.copyWithId();oCopy.setProperties(oPr);this.setSignature(oCopy);if(sUrl)if(this.spPr){var oBlipFillUnifill=AscFormat.CreateBlipFillUniFillFromUrl(sUrl);this.spPr.setFill(oBlipFillUnifill)}};CShape.prototype.convertToWord=function(document){this.setBDeleted(true);var c=new CShape;c.setWordShape(true);c.setBDeleted(false);if(this.nvSpPr)c.setNvSpPr(this.nvSpPr.createDuplicate());
|
|
|
|
|
if(this.spPr){c.setSpPr(this.spPr.createDuplicate());if(!c.spPr.geometry)c.spPr.setGeometry(AscFormat.CreateGeometry("rect"));c.spPr.setParent(c)}if(this.style)c.setStyle(this.style.createDuplicate());if(this.txBody){if(this.txBody.bodyPr)c.setBodyPr(this.txBody.bodyPr.createDuplicate());if(this.txBody.content){var new_content=new CDocumentContent(c,document.DrawingDocument,0,0,0,2E4,false,false,false);var paragraphs=this.txBody.content.Content;new_content.Internal_Content_RemoveAll();for(var i=0;i<
|
|
|
|
|
paragraphs.length;++i){var cur_par=paragraphs[i];var new_paragraph=ConvertParagraphToWord(cur_par,new_content);new_content.Internal_Content_Add(i,new_paragraph,false)}c.setTextBoxContent(new_content)}}if(this.signatureLine)c.setSignature(this.signatureLine.copy());return c};CShape.prototype.convertToPPTX=function(drawingDocument,worksheet,bIsAddMath){var c=new CShape;c.setWordShape(false);c.setBDeleted(false);c.setWorksheet(worksheet);if(this.nvSpPr)c.setNvSpPr(this.nvSpPr.createDuplicate());if(this.spPr){c.setSpPr(this.spPr.createDuplicate());
|
|
|
|
|
c.spPr.setParent(c)}if(this.style)c.setStyle(this.style.createDuplicate());if(this.textBoxContent){var tx_body=new AscFormat.CTextBody;tx_body.setParent(c);if(this.bodyPr)tx_body.setBodyPr(this.bodyPr.createDuplicate());var new_content=new AscFormat.CDrawingDocContent(tx_body,drawingDocument,0,0,0,0,false,false,true);new_content.Internal_Content_RemoveAll();var paragraphs=this.textBoxContent.Content;var index=0;for(var i=0;i<paragraphs.length;++i){var cur_par=paragraphs[i];if(cur_par instanceof Paragraph){var new_paragraph=
|
|
|
|
|
ConvertParagraphToPPTX(cur_par,drawingDocument,new_content,bIsAddMath);new_content.Internal_Content_Add(index++,new_paragraph,false)}}tx_body.setContent(new_content);c.setTxBody(tx_body)}if(worksheet)if(this.signatureLine)c.setSignature(this.signatureLine.copy());return c};CShape.prototype.handleAllContents=function(fCallback){var content=this.getDocContent();if(content)fCallback(content)};CShape.prototype.documentGetAllFontNames=function(AllFonts){var content=this.getDocContent();if(content)content.Document_Get_AllFontNames(AllFonts)};
|
|
|
|
|
CShape.prototype.documentCreateFontMap=function(map){var content=this.getDocContent();if(content)content.Document_CreateFontMap(map)};CShape.prototype.setNvSpPr=function(pr){History.Add(new AscDFH.CChangesDrawingsObject(this,AscDFH.historyitem_ShapeSetNvSpPr,this.nvSpPr,pr));this.nvSpPr=pr};CShape.prototype.setSpPr=function(spPr){History.Add(new AscDFH.CChangesDrawingsObject(this,AscDFH.historyitem_ShapeSetSpPr,this.spPr,spPr));this.spPr=spPr};CShape.prototype.setStyle=function(style){History.Add(new AscDFH.CChangesDrawingsObject(this,
|
|
|
|
|
AscDFH.historyitem_ShapeSetStyle,this.style,style));this.style=style;var content=this.getDocContent();this.recalcInfo.recalculateShapeStyleForParagraph=true;if(this.recalcTextStyles)this.recalcTextStyles();if(content)content.Recalc_AllParagraphs_CompiledPr()};CShape.prototype.setTxBody=function(txBody){History.Add(new AscDFH.CChangesDrawingsObject(this,AscDFH.historyitem_ShapeSetTxBody,this.txBody,txBody));this.txBody=txBody};CShape.prototype.setTextBoxContent=function(textBoxContent){History.Add(new AscDFH.CChangesDrawingsObject(this,
|
|
|
|
|
AscDFH.historyitem_ShapeSetTextBoxContent,this.textBoxContent,textBoxContent));this.textBoxContent=textBoxContent};CShape.prototype.setBodyPr=function(pr){History.Add(new AscDFH.CChangesDrawingsObjectNoId(this,AscDFH.historyitem_ShapeSetBodyPr,this.bodyPr,pr));this.bodyPr=pr;this.recalcInfo.recalculateContent=true;this.recalcInfo.recalculateTransformText=true;this.addToRecalculate()};CShape.prototype.createTextBody=function(){var tx_body=new AscFormat.CTextBody;tx_body.setParent(this);tx_body.setContent(new AscFormat.CDrawingDocContent(tx_body,
|
|
|
|
|
this.getDrawingDocument(),0,0,0,2E4,false,false,true));var oBodyPr=new AscFormat.CBodyPr;if(this.worksheet){oBodyPr.vertOverflow=AscFormat.nOTClip;oBodyPr.horzOverflow=AscFormat.nOTClip}tx_body.setBodyPr(oBodyPr);tx_body.content.Content[0].Set_DocumentIndex(0);tx_body.content.MoveCursorToStartPos(false);this.setTxBody(tx_body)};CShape.prototype.createTextBoxContent=function(){var body_pr=new AscFormat.CBodyPr;body_pr.setAnchor(1);this.setBodyPr(body_pr);this.setTextBoxContent(new CDocumentContent(this,
|
|
|
|
|
this.getDrawingDocument(),0,0,0,2E4,false,false));this.textBoxContent.SetParagraphAlign(AscCommon.align_Center);this.textBoxContent.MoveCursorToStartPos(false);this.textBoxContent.Content[0].Set_DocumentIndex(0)};CShape.prototype.paragraphAdd=function(paraItem,bRecalculate){var content_to_add=this.getDocContent();if(!content_to_add)if(!AscFormat.CheckLinePresetForParagraphAdd(this.getPresetGeom())){if(this.bWordShape)this.createTextBoxContent();else this.createTextBody();content_to_add=this.getDocContent()}if(content_to_add)content_to_add.AddToParagraph(paraItem,
|
|
|
|
|
bRecalculate)};CShape.prototype.applyTextFunction=function(docContentFunction,tableFunction,args){var content_to_add=this.getDocContent();if(!content_to_add)if(!AscFormat.CheckLinePresetForParagraphAdd(this.getPresetGeom())){if(this.bWordShape)this.createTextBoxContent();else this.createTextBody();content_to_add=this.getDocContent();content_to_add.MoveCursorToStartPos()}if(content_to_add)docContentFunction.apply(content_to_add,args);if(!editor||!editor.noCreatePoint||editor.exucuteHistory)this.checkExtentsByDocContent()};
|
|
|
|
|
CShape.prototype.clearContent=function(){var content=this.getDocContent();if(content){content.Set_ApplyToAll(true);content.Remove(-1);content.AddToParagraph(new AscCommonWord.ParaTextPr({Lang:{Val:undefined}}),false);content.Set_ApplyToAll(false)}};CShape.prototype.getDocContent=function(){if(this.txBody)return this.txBody.content;else if(this.textBoxContent)return this.textBoxContent;return null};CShape.prototype.getBodyPr=function(){return AscFormat.ExecuteNoHistory(function(){if(this.bWordShape){var ret=
|
|
|
|
|
new AscFormat.CBodyPr;ret.setDefault();if(this.bodyPr)ret.merge(this.bodyPr);return ret}else{if(this.txBody&&this.txBody.bodyPr)return this.txBody.getCompiledBodyPr();var ret=new AscFormat.CBodyPr;ret.setDefault();return ret}},this,[])};CShape.prototype.GetRevisionsChangeElement=function(SearchEngine){var oContent=this.getDocContent();if(oContent)oContent.GetRevisionsChangeElement(SearchEngine)};CShape.prototype.Search=function(Str,Props,SearchEngine,Type){if(this.textBoxContent){var dd=this.getDrawingDocument();
|
|
|
|
|
dd.StartSearchTransform(this.transformText);this.textBoxContent.Search(Str,Props,SearchEngine,Type);dd.EndSearchTransform()}else if(this.txBody&&this.txBody.content)this.txBody.content.Search(Str,Props,SearchEngine,Type)};CShape.prototype.GetSearchElementId=function(bNext,bCurrent){if(this.textBoxContent)return this.textBoxContent.GetSearchElementId(bNext,bCurrent);else if(this.txBody&&this.txBody.content)return this.txBody.content.GetSearchElementId(bNext,bCurrent);return null};CShape.prototype.documentUpdateRulersState=
|
|
|
|
|
function(){var content=this.getDocContent();if(!content)return;var xc,yc;var l,t,r,b;var body_pr=this.getBodyPr();var l_ins,t_ins,r_ins,b_ins;if(typeof body_pr.lIns==="number")l_ins=body_pr.lIns;else l_ins=2.54;if(typeof body_pr.tIns==="number")t_ins=body_pr.tIns;else t_ins=1.27;if(typeof body_pr.rIns==="number")r_ins=body_pr.rIns;else r_ins=2.54;if(typeof body_pr.bIns==="number")b_ins=body_pr.bIns;else b_ins=1.27;if(this.spPr&&isRealObject(this.spPr.geometry)&&isRealObject(this.spPr.geometry.rect)){l=
|
|
|
|
|
this.spPr.geometry.rect.l+l_ins;t=this.spPr.geometry.rect.t+t_ins;r=this.spPr.geometry.rect.r-r_ins;b=this.spPr.geometry.rect.b-b_ins}else{l=l_ins;t=t_ins;r=this.extX-r_ins;b=this.extY-b_ins}var x_lt,y_lt,x_rt,y_rt,x_rb,y_rb,x_lb,y_lb;var tr=this.transform;x_lt=tr.TransformPointX(l,t);y_lt=tr.TransformPointY(l,t);x_rb=tr.TransformPointX(r,b);y_rb=tr.TransformPointY(r,b);xc=(x_lt+x_rb)*.5;yc=(y_lt+y_rb)*.5;var hc=(r-l)*.5;var vc=(b-t)*.5;this.getDrawingDocument().Set_RulerState_Paragraph({L:xc-hc,
|
|
|
|
|
T:yc-vc,R:xc+hc,B:yc+vc});content.Document_UpdateRulersState(AscFormat.isRealNumber(this.selectStartPage)?this.selectStartPage:0)};CShape.prototype.setParent=function(parent){History.Add(new AscDFH.CChangesDrawingsObject(this,AscDFH.historyitem_ShapeSetParent,this.parent,parent));this.parent=parent};CShape.prototype.setGroup=function(group){History.Add(new AscDFH.CChangesDrawingsObject(this,AscDFH.historyitem_ShapeSetGroup,this.group,group));this.group=group};CShape.prototype.getAllImages=function(images){if(this.spPr&&
|
|
|
|
|
this.spPr.Fill&&this.spPr.Fill.fill instanceof AscFormat.CBlipFill&&typeof this.spPr.Fill.fill.RasterImageId==="string")images[AscCommon.getFullImageSrc2(this.spPr.Fill.fill.RasterImageId)]=true};CShape.prototype.getAllFonts=function(fonts){if(this.txBody){this.txBody.content.Document_Get_AllFontNames(fonts);if(this.txBody&&this.txBody.lstStyle)this.txBody.lstStyle.Document_Get_AllFontNames(fonts);delete fonts["+mj-lt"];delete fonts["+mn-lt"];delete fonts["+mj-ea"];delete fonts["+mn-ea"];delete fonts["+mj-cs"];
|
|
|
|
|
delete fonts["+mn-cs"]}};CShape.prototype.canFill=function(){if(this.spPr&&this.spPr.geometry)return this.spPr.geometry.canFill();return true};CShape.prototype.isShape=function(){return true};CShape.prototype.isImage=function(){return false};CShape.prototype.isChart=function(){return false};CShape.prototype.isGroup=function(){return false};CShape.prototype.getHierarchy=function(bIsSingleBody,info){{this.compiledHierarchy=[];if(this.parent){var hierarchy=this.compiledHierarchy;if(this.isPlaceholder()){var ph_type=
|
|
|
|
|
this.getPlaceholderType();var ph_index=this.getPlaceholderIndex();var b_is_single_body;if(AscFormat.isRealBool(bIsSingleBody))b_is_single_body=bIsSingleBody;else b_is_single_body=this.getIsSingleBody&&this.getIsSingleBody();switch(this.parent.kind){case AscFormat.TYPE_KIND.SLIDE:{hierarchy.push(this.parent.Layout.getMatchingShape(ph_type,ph_index,b_is_single_body,info));hierarchy.push(this.parent.Layout.Master.getMatchingShape(ph_type,ph_index,true));break}case AscFormat.TYPE_KIND.LAYOUT:{hierarchy.push(this.parent.Master.getMatchingShape(ph_type,
|
|
|
|
|
ph_index,true));break}case AscFormat.TYPE_KIND.NOTES:{if(this.parent.Master)hierarchy.push(this.parent.Master.getMatchingShape(ph_type,ph_index,true));break}}}this.recalcInfo.recalculateShapeHierarchy=true}}return this.compiledHierarchy};CShape.prototype.getPaddings=function(){var paddings=null;var shape=this;var body_pr;if(shape.txBody)if(shape.txBody.compiledBodyPr)body_pr=shape.txBody.compiledBodyPr;else body_pr=shape.txBody.getCompiledBodyPr();else if(shape.textBoxContent)body_pr=shape.bodyPr;
|
|
|
|
|
if(body_pr){paddings=new Asc.asc_CPaddings;if(typeof body_pr.lIns==="number")paddings.Left=body_pr.lIns;else paddings.Left=2.54;if(typeof body_pr.tIns==="number")paddings.Top=body_pr.tIns;else paddings.Top=1.27;if(typeof body_pr.rIns==="number")paddings.Right=body_pr.rIns;else paddings.Right=2.54;if(typeof body_pr.bIns==="number")paddings.Bottom=body_pr.bIns;else paddings.Bottom=1.27}return paddings};CShape.prototype.getCompiledFill=function(){if(this.recalcInfo.recalculateFill){this.compiledFill=
|
|
|
|
|
null;if(isRealObject(this.spPr)&&isRealObject(this.spPr.Fill)&&isRealObject(this.spPr.Fill.fill)){if(this.spPr.Fill.fill instanceof AscFormat.CGradFill&&this.spPr.Fill.fill.colors.length===0){var parent_objects=this.getParentObjects();var theme=parent_objects.theme;var fmt_scheme=theme.themeElements.fmtScheme;var fill_style_lst=fmt_scheme.fillStyleLst;for(var i=fill_style_lst.length-1;i>-1;--i)if(fill_style_lst[i]&&fill_style_lst[i].fill instanceof AscFormat.CGradFill){this.spPr.Fill=fill_style_lst[i].createDuplicate();
|
|
|
|
|
break}}this.compiledFill=this.spPr.Fill.createDuplicate();if(this.compiledFill&&this.compiledFill.fill&&this.compiledFill.fill.type===c_oAscFill.FILL_TYPE_GRP)if(this.group){var group_compiled_fill=this.group.getCompiledFill();if(isRealObject(group_compiled_fill)&&isRealObject(group_compiled_fill.fill))this.compiledFill=group_compiled_fill.createDuplicate();else this.compiledFill=null}else this.compiledFill=null}else if(isRealObject(this.group)){var group_compiled_fill=this.group.getCompiledFill();
|
|
|
|
|
if(isRealObject(group_compiled_fill)&&isRealObject(group_compiled_fill.fill))this.compiledFill=group_compiled_fill.createDuplicate();else{var hierarchy=this.getHierarchy();for(var i=0;i<hierarchy.length;++i)if(isRealObject(hierarchy[i])&&isRealObject(hierarchy[i].spPr)&&isRealObject(hierarchy[i].spPr.Fill)&&isRealObject(hierarchy[i].spPr.Fill.fill)){this.compiledFill=hierarchy[i].spPr.Fill.createDuplicate();break}}}else{var hierarchy=this.getHierarchy();for(var i=0;i<hierarchy.length;++i)if(isRealObject(hierarchy[i])&&
|
|
|
|
|
isRealObject(hierarchy[i].spPr)&&isRealObject(hierarchy[i].spPr.Fill)&&isRealObject(hierarchy[i].spPr.Fill.fill)){this.compiledFill=hierarchy[i].spPr.Fill.createDuplicate();break}}this.recalcInfo.recalculateFill=false}return this.compiledFill};CShape.prototype.getMargins=function(){if(this.txBody)return this.txBody.getMargins();else return null};CShape.prototype.Document_UpdateRulersState=function(margins){if(this.txBody&&this.txBody.content)this.txBody.content.Document_UpdateRulersState(this.parent.num,
|
|
|
|
|
this.getMargins())};CShape.prototype.getCompiledLine=function(){if(this.recalcInfo.recalculateLine){this.compiledLine=null;if(isRealObject(this.spPr)&&isRealObject(this.spPr.ln)&&isRealObject(this.spPr.ln))this.compiledLine=this.spPr.ln.createDuplicate();else if(isRealObject(this.group)){var group_compiled_line=this.group.getCompiledLine();if(isRealObject(group_compiled_line)&&isRealObject(group_compiled_line.fill))this.compiledLine=group_compiled_line.createDuplicate();else{var hierarchy=this.getHierarchy();
|
|
|
|
|
for(var i=0;i<hierarchy.length;++i)if(isRealObject(hierarchy[i])&&isRealObject(hierarchy[i].spPr)&&isRealObject(hierarchy[i].spPr.ln)){this.compiledLine=hierarchy[i].spPr.ln.createDuplicate();break}}}else{var hierarchy=this.getHierarchy();for(var i=0;i<hierarchy.length;++i)if(isRealObject(hierarchy[i])&&isRealObject(hierarchy[i].spPr)&&isRealObject(hierarchy[i].spPr.ln)){this.compiledLine=hierarchy[i].spPr.ln.createDuplicate();break}}this.recalcInfo.recalculateLine=false}return this.compiledLine};
|
|
|
|
|
CShape.prototype.getCompiledTransparent=function(){if(this.recalcInfo.recalculateTransparent){this.compiledTransparent=null;if(isRealObject(this.spPr)&&isRealObject(this.spPr.Fill))if(AscFormat.isRealNumber(this.spPr.Fill.transparent))this.compiledTransparent=this.spPr.Fill.transparent;else if(this.spPr.Fill&&this.spPr.Fill.fill&&this.spPr.Fill.fill.type===c_oAscFill.FILL_TYPE_GRP)if(this.group&&this.group.spPr&&this.group.spPr.Fill&&AscFormat.isRealNumber(this.group.spPr.Fill.transparent))this.compiledTransparent=
|
|
|
|
|
this.group.spPr.Fill.transparent;if(null!==this.compiledTransparent){this.recalcInfo.recalculateTransparent=false;return this.compiledTransparent}if(isRealObject(this.group)){var group_transparent=this.group.getCompiledTransparent();if(AscFormat.isRealNumber(group_transparent))this.compiledTransparent=group_transparent;else{var hierarchy=this.getHierarchy();for(var i=0;i<hierarchy.length;++i)if(isRealObject(hierarchy[i])&&isRealObject(hierarchy[i].spPr)&&isRealObject(hierarchy[i].spPr.Fill)&&AscFormat.isRealNumber(hierarchy[i].spPr.Fill.transparent)){this.compiledTransparent=
|
|
|
|
|
hierarchy[i].spPr.Fill.transparent;break}}}else{var hierarchy=this.getHierarchy();for(var i=0;i<hierarchy.length;++i)if(isRealObject(hierarchy[i])&&isRealObject(hierarchy[i].spPr)&&isRealObject(hierarchy[i].spPr.Fill)&&AscFormat.isRealNumber(hierarchy[i].spPr.Fill.transparent)){this.compiledTransparent=hierarchy[i].spPr.Fill.transparent;break}}this.recalcInfo.recalculateTransparent=false}return this.compiledTransparent};CShape.prototype.isPlaceholder=function(){return isRealObject(this.nvSpPr)&&isRealObject(this.nvSpPr.nvPr)&&
|
|
|
|
|
isRealObject(this.nvSpPr.nvPr.ph)};CShape.prototype.getPlaceholderType=function(){return this.isPlaceholder()?this.nvSpPr.nvPr.ph.type:null};CShape.prototype.getPlaceholderIndex=function(){return this.isPlaceholder()?this.nvSpPr.nvPr.ph.idx:null};CShape.prototype.getPhType=function(){return this.isPlaceholder()?this.nvSpPr.nvPr.ph.type:null};CShape.prototype.getPhIndex=function(){return this.isPlaceholder()?this.nvSpPr.nvPr.ph.idx:null};CShape.prototype.setVerticalAlign=function(align){var content_to_add=
|
|
|
|
|
this.getDocContent();if(!content_to_add)if(!AscFormat.CheckLinePresetForParagraphAdd(this.getPresetGeom()))if(this.bWordShape)this.createTextBoxContent();else this.createTextBody();var new_body_pr=this.getBodyPr();if(new_body_pr){new_body_pr=new_body_pr.createDuplicate();new_body_pr.anchor=align;if(this.bWordShape)this.setBodyPr(new_body_pr);else if(this.txBody)this.txBody.setBodyPr(new_body_pr)}};CShape.prototype.setVert=function(vert){var content_to_add=this.getDocContent();if(!content_to_add)if(!AscFormat.CheckLinePresetForParagraphAdd(this.getPresetGeom()))if(this.bWordShape)this.createTextBoxContent();
|
|
|
|
|
else this.createTextBody();var new_body_pr=this.getBodyPr();if(new_body_pr){new_body_pr=new_body_pr.createDuplicate();new_body_pr.vert=vert;if(this.bWordShape)this.setBodyPr(new_body_pr);else if(this.txBody)this.txBody.setBodyPr(new_body_pr)}this.checkExtentsByDocContent&&this.checkExtentsByDocContent()};CShape.prototype.setTextFitType=function(type){if(AscFormat.isRealNumber(type)){var new_body_pr=this.getBodyPr();if(new_body_pr){new_body_pr=new_body_pr.createDuplicate();new_body_pr.textFit=new AscFormat.CTextFit;
|
|
|
|
|
new_body_pr.textFit.type=type;if(this.bWordShape)this.setBodyPr(new_body_pr);else if(this.txBody)this.txBody.setBodyPr(new_body_pr)}this.checkExtentsByDocContent(true,true)}};CShape.prototype.setVertOverflowType=function(type){if(AscFormat.isRealNumber(type)){var new_body_pr=this.getBodyPr();if(new_body_pr){new_body_pr=new_body_pr.createDuplicate();new_body_pr.vertOverflow=type;if(this.bWordShape)this.setBodyPr(new_body_pr);else if(this.txBody)this.txBody.setBodyPr(new_body_pr)}this.checkExtentsByDocContent(true,
|
|
|
|
|
true)}};CShape.prototype.setPaddings=function(paddings){if(paddings){var new_body_pr=this.getBodyPr();if(new_body_pr){new_body_pr=new_body_pr.createDuplicate();if(AscFormat.isRealNumber(paddings.Left))new_body_pr.lIns=paddings.Left;if(AscFormat.isRealNumber(paddings.Top))new_body_pr.tIns=paddings.Top;if(AscFormat.isRealNumber(paddings.Right))new_body_pr.rIns=paddings.Right;if(AscFormat.isRealNumber(paddings.Bottom))new_body_pr.bIns=paddings.Bottom;if(this.bWordShape)this.setBodyPr(new_body_pr);else if(this.txBody)this.txBody.setBodyPr(new_body_pr)}}};
|
|
|
|
|
CShape.prototype.recalculateTransformText=function(){var oContent=this.getDocContent();if(!oContent)return;var oBodyPr=this.getBodyPr();this.clipRect=this.checkTransformTextMatrix(this.localTransformText,oContent,oBodyPr,false);this.transformText=this.localTransformText.CreateDublicate();this.invertTransformText=global_MatrixTransformer.Invert(this.transformText);if(this.txBody&&this.txBody.content2){this.transformText2=new CMatrix;this.clipRect2=this.checkTransformTextMatrix(this.transformText2,
|
|
|
|
|
this.txBody.content2,oBodyPr,false);this.invertTransformText2=global_MatrixTransformer.Invert(this.transformText2)}var bNoTextNoShape=oBodyPr.prstTxWarp&&oBodyPr.prstTxWarp.preset!=="textNoShape";{this.localTransformTextWordArt=new CMatrix;this.checkTransformTextMatrix(this.localTransformTextWordArt,oContent,oBodyPr,bNoTextNoShape,!this.bWordShape&&bNoTextNoShape);this.transformTextWordArt=this.localTransformTextWordArt.CreateDublicate();this.invertTransformTextWordArt=global_MatrixTransformer.Invert(this.transformTextWordArt)}if(this.txBody&&
|
|
|
|
|
this.txBody.content2){this.checkTransformTextMatrix(this.transformText2,this.txBody.content2,oBodyPr,bNoTextNoShape,!this.bWordShape&&bNoTextNoShape);this.transformTextWordArt2=new CMatrix;this.checkTransformTextMatrix(this.transformTextWordArt2,this.txBody.content2,oBodyPr,bNoTextNoShape,!this.bWordShape&&bNoTextNoShape)}if(this.checkPosTransformText)this.checkPosTransformText();if(this.checkContentDrawings)this.checkContentDrawings()};CShape.prototype.getFullFlip=function(){var _transform=this.localTransform;
|
|
|
|
|
var _full_rotate=this.getFullRotate();var _full_pos_x_lt=_transform.TransformPointX(0,0);var _full_pos_y_lt=_transform.TransformPointY(0,0);var _full_pos_x_rt=_transform.TransformPointX(this.extX,0);var _full_pos_y_rt=_transform.TransformPointY(this.extX,0);var _full_pos_x_rb=_transform.TransformPointX(this.extX,this.extY);var _full_pos_y_rb=_transform.TransformPointY(this.extX,this.extY);var _rotate_matrix=new CMatrix;global_MatrixTransformer.RotateRadAppend(_rotate_matrix,_full_rotate);var _rotated_pos_x_lt=
|
|
|
|
|
_rotate_matrix.TransformPointX(_full_pos_x_lt,_full_pos_y_lt);var _rotated_pos_x_rt=_rotate_matrix.TransformPointX(_full_pos_x_rt,_full_pos_y_rt);var _rotated_pos_y_rt=_rotate_matrix.TransformPointY(_full_pos_x_rt,_full_pos_y_rt);var _rotated_pos_y_rb=_rotate_matrix.TransformPointY(_full_pos_x_rb,_full_pos_y_rb);return{flipH:_rotated_pos_x_lt>_rotated_pos_x_rt,flipV:_rotated_pos_y_rt>_rotated_pos_y_rb}};CShape.prototype.recalculateTransformText2=function(){if(this.txBody===null)return;if(!this.txBody.content2)return;
|
|
|
|
|
this.transformText2=new CMatrix;var _text_transform=this.transformText2;var _shape_transform=this.transform;var _body_pr=this.txBody.getBodyPr();var _content_height=this.txBody.getSummaryHeight2();var _l,_t,_r,_b;var _t_x_lt,_t_y_lt,_t_x_rt,_t_y_rt,_t_x_lb,_t_y_lb,_t_x_rb,_t_y_rb;if(this.spPr&&isRealObject(this.spPr.geometry)&&isRealObject(this.spPr.geometry.rect)){var _rect=this.spPr.geometry.rect;_l=_rect.l+_body_pr.lIns;_t=_rect.t+_body_pr.tIns;_r=_rect.r-_body_pr.rIns;_b=_rect.b-_body_pr.bIns}else{_l=
|
|
|
|
|
_body_pr.lIns;_t=_body_pr.tIns;_r=this.extX-_body_pr.rIns;_b=this.extY-_body_pr.bIns}if(_l>=_r){var _c=(_l+_r)*.5;_l=_c-.01;_r=_c+.01}if(_t>=_b){_c=(_t+_b)*.5;_t=_c-.01;_b=_c+.01}_t_x_lt=_shape_transform.TransformPointX(_l,_t);_t_y_lt=_shape_transform.TransformPointY(_l,_t);_t_x_rt=_shape_transform.TransformPointX(_r,_t);_t_y_rt=_shape_transform.TransformPointY(_r,_t);_t_x_lb=_shape_transform.TransformPointX(_l,_b);_t_y_lb=_shape_transform.TransformPointY(_l,_b);_t_x_rb=_shape_transform.TransformPointX(_r,
|
|
|
|
|
_b);_t_y_rb=_shape_transform.TransformPointY(_r,_b);var _dx_t,_dy_t;_dx_t=_t_x_rt-_t_x_lt;_dy_t=_t_y_rt-_t_y_lt;var _dx_lt_rb,_dy_lt_rb;_dx_lt_rb=_t_x_rb-_t_x_lt;_dy_lt_rb=_t_y_rb-_t_y_lt;var _vertical_shift;var _text_rect_height=_b-_t;var _text_rect_width=_r-_l;if(!_body_pr.upright){if(!(_body_pr.vert===AscFormat.nVertTTvert||_body_pr.vert===AscFormat.nVertTTvert270||_body_pr.vert===AscFormat.nVertTTeaVert)){if(true)switch(_body_pr.anchor){case 0:{_vertical_shift=_text_rect_height-_content_height;
|
|
|
|
|
break}case 1:{_vertical_shift=(_text_rect_height-_content_height)*.5;break}case 2:{_vertical_shift=(_text_rect_height-_content_height)*.5;break}case 3:{_vertical_shift=(_text_rect_height-_content_height)*.5;break}case 4:{_vertical_shift=0;break}}else _vertical_shift=0;global_MatrixTransformer.TranslateAppend(_text_transform,0,_vertical_shift);if(_dx_lt_rb*_dy_t-_dy_lt_rb*_dx_t<=0){var alpha=Math.atan2(_dy_t,_dx_t);global_MatrixTransformer.RotateRadAppend(_text_transform,-alpha);global_MatrixTransformer.TranslateAppend(_text_transform,
|
|
|
|
|
_t_x_lt,_t_y_lt)}else{alpha=Math.atan2(_dy_t,_dx_t);global_MatrixTransformer.RotateRadAppend(_text_transform,Math.PI-alpha);global_MatrixTransformer.TranslateAppend(_text_transform,_t_x_rt,_t_y_rt)}}else{if(true)switch(_body_pr.anchor){case 0:{_vertical_shift=_text_rect_width-_content_height;break}case 1:{_vertical_shift=(_text_rect_width-_content_height)*.5;break}case 2:{_vertical_shift=(_text_rect_width-_content_height)*.5;break}case 3:{_vertical_shift=(_text_rect_width-_content_height)*.5;break}case 4:{_vertical_shift=
|
|
|
|
|
0;break}}else _vertical_shift=0;global_MatrixTransformer.TranslateAppend(_text_transform,0,_vertical_shift);var _alpha;_alpha=Math.atan2(_dy_t,_dx_t);if(_body_pr.vert===AscFormat.nVertTTvert||_body_pr.vert===AscFormat.nVertTTeaVert)if(_dx_lt_rb*_dy_t-_dy_lt_rb*_dx_t<=0){global_MatrixTransformer.RotateRadAppend(_text_transform,-_alpha-Math.PI*.5);global_MatrixTransformer.TranslateAppend(_text_transform,_t_x_rt,_t_y_rt)}else{global_MatrixTransformer.RotateRadAppend(_text_transform,Math.PI*.5-_alpha);
|
|
|
|
|
this.getPhType();var aButtons=[];var isLocalDesktop=window["AscDesktopEditor"]&&window["AscDesktopEditor"]["IsSupportMedia"]&&window["AscDesktopEditor"]["IsSupportMedia"]();switch(phType){case null:{aButtons.push(AscCommon.PlaceholderButtonType.Table);aButtons.push(AscCommon.PlaceholderButtonType.Chart);aButtons.push(AscCommon.PlaceholderButtonType.Image);if(isLocalDesktop){aButtons.push(AscCommon.PlaceholderButtonType.Video);aButtons.push(AscCommon.PlaceholderButtonType.Audio)}break}case AscFormat.phType_body:{break}case AscFormat.phType_chart:{aButtons.push(AscCommon.PlaceholderButtonType.Chart);
|
|
|
|
|
break}case AscFormat.phType_clipArt:{aButtons.push(AscCommon.PlaceholderButtonType.Image);break}case AscFormat.phType_ctrTitle:{break}case AscFormat.phType_dgm:{break}case AscFormat.phType_dt:{break}case AscFormat.phType_ftr:{break}case AscFormat.phType_hdr:{break}case AscFormat.phType_media:{if(isLocalDesktop){aButtons.push(AscCommon.PlaceholderButtonType.Video);aButtons.push(AscCommon.PlaceholderButtonType.Audio)}break}case AscFormat.phType_obj:{aButtons.push(AscCommon.PlaceholderButtonType.Table);
|
|
|
|
|
aButtons.push(AscCommon.PlaceholderButtonType.Chart);aButtons.push(AscCommon.PlaceholderButtonType.Image);if(isLocalDesktop){aButtons.push(AscCommon.PlaceholderButtonType.Video);aButtons.push(AscCommon.PlaceholderButtonType.Audio)}break}case AscFormat.phType_pic:{aButtons.push(AscCommon.PlaceholderButtonType.Image);break}case AscFormat.phType_sldImg:{aButtons.push(AscCommon.PlaceholderButtonType.Image);break}case AscFormat.phType_sldNum:{break}case AscFormat.phType_subTitle:{break}case AscFormat.phType_tbl:{aButtons.push(AscCommon.PlaceholderButtonType.Table);
|
|
|
|
|
break}case AscFormat.phType_title:{break}}var nSlideNum=0;if(this.parent.getObjectType&&this.parent.getObjectType()===AscDFH.historyitem_type_Slide)nSlideNum=this.parent.num;return AscCommon.CreateDrawingPlaceholder(this.Id,aButtons,nSlideNum,{x:0,y:0,w:this.extX,h:this.extY},this.transform)};CGraphicObjectBase.prototype.onSlicerUpdate=function(sName){return false};CGraphicObjectBase.prototype.onSlicerLock=function(sName,bLock){};CGraphicObjectBase.prototype.onSlicerDelete=function(sName){return false};
|
|
|
|
|
CGraphicObjectBase.prototype.onSlicerChangeName=function(sName,sNewName){return false};CGraphicObjectBase.prototype.onUpdate=function(oRect){if(this.drawingBase)this.drawingBase.onUpdate(oRect);else if(this.group)this.group.onUpdate(oRect)};CGraphicObjectBase.prototype.getSlicerViewByName=function(name){return null};CGraphicObjectBase.prototype.setParent2=function(parent){this.setParent(parent);if(Array.isArray(this.spTree))for(var i=0;i<this.spTree.length;++i)this.spTree[i].setParent2(parent)};CGraphicObjectBase.prototype.documentCreateFontMap=
|
|
|
|
|
function(oMap){};CGraphicObjectBase.prototype.createFontMap=function(oMap){this.documentCreateFontMap(oMap)};function CRelSizeAnchor(){CBaseObject.call(this);this.fromX=null;this.fromY=null;this.toX=null;this.toY=null;this.object=null;this.parent=null;this.drawingBase=null}CRelSizeAnchor.prototype=Object.create(CBaseObject.prototype);CRelSizeAnchor.prototype.constructor=CRelSizeAnchor;CRelSizeAnchor.prototype.setDrawingBase=function(drawingBase){this.drawingBase=drawingBase};CRelSizeAnchor.prototype.getObjectType=
|
|
|
|
|
function(){return AscDFH.historyitem_type_RelSizeAnchor};CRelSizeAnchor.prototype.setFromTo=function(fromX,fromY,toX,toY){History.Add(new AscDFH.CChangesDrawingsDouble(this,AscDFH.historyitem_RelSizeAnchorFromX,this.fromX,fromX));History.Add(new AscDFH.CChangesDrawingsDouble(this,AscDFH.historyitem_RelSizeAnchorFromY,this.fromY,fromY));History.Add(new AscDFH.CChangesDrawingsDouble(this,AscDFH.historyitem_RelSizeAnchorToX,this.toX,toX));History.Add(new AscDFH.CChangesDrawingsDouble(this,AscDFH.historyitem_RelSizeAnchorToY,
|
|
|
|
|
this.toY,toY));this.fromX=fromX;this.fromY=fromY;this.toX=toX;this.toY=toY};CRelSizeAnchor.prototype.setObject=function(object){History.Add(new AscDFH.CChangesDrawingsObject(this,AscDFH.historyitem_RelSizeAnchorObject,this.object,object));this.object=object;if(object)object.setParent(this)};CRelSizeAnchor.prototype.setParent=function(object){History.Add(new AscDFH.CChangesDrawingsObject(this,AscDFH.historyitem_RelSizeAnchorParent,this.parent,object));this.parent=object};CRelSizeAnchor.prototype.copy=
|
|
|
|
|
function(oPr){var copy=new CRelSizeAnchor;copy.setFromTo(this.fromX,this.fromY,this.toX,this.toY);if(this.object)copy.setObject(this.object.copy(oPr));return copy};CRelSizeAnchor.prototype.Refresh_RecalcData=function(drawingDocument){if(this.parent&&this.parent.Refresh_RecalcData2)this.parent.Refresh_RecalcData2()};CRelSizeAnchor.prototype.Refresh_RecalcData2=function(drawingDocument){if(this.parent&&this.parent.Refresh_RecalcData2)this.parent.Refresh_RecalcData2()};AscDFH.drawingsChangesMap[AscDFH.historyitem_RelSizeAnchorFromX]=
|
|
|
|
|
function(oClass,value){oClass.fromX=value};AscDFH.drawingsChangesMap[AscDFH.historyitem_RelSizeAnchorFromY]=function(oClass,value){oClass.fromY=value};AscDFH.drawingsChangesMap[AscDFH.historyitem_RelSizeAnchorToX]=function(oClass,value){oClass.toX=value};AscDFH.drawingsChangesMap[AscDFH.historyitem_RelSizeAnchorToY]=function(oClass,value){oClass.toY=value};AscDFH.drawingsChangesMap[AscDFH.historyitem_RelSizeAnchorObject]=function(oClass,value){oClass.object=value};AscDFH.drawingsChangesMap[AscDFH.historyitem_RelSizeAnchorParent]=
|
|
|
|
|
function(oClass,value){oClass.parent=value};AscDFH.changesFactory[AscDFH.historyitem_RelSizeAnchorFromX]=window["AscDFH"].CChangesDrawingsDouble;AscDFH.changesFactory[AscDFH.historyitem_RelSizeAnchorFromY]=window["AscDFH"].CChangesDrawingsDouble;AscDFH.changesFactory[AscDFH.historyitem_RelSizeAnchorToX]=window["AscDFH"].CChangesDrawingsDouble;AscDFH.changesFactory[AscDFH.historyitem_RelSizeAnchorToY]=window["AscDFH"].CChangesDrawingsDouble;AscDFH.changesFactory[AscDFH.historyitem_RelSizeAnchorObject]=
|
|
|
|
|
window["AscDFH"].CChangesDrawingsObject;AscDFH.changesFactory[AscDFH.historyitem_RelSizeAnchorParent]=window["AscDFH"].CChangesDrawingsObject;function CAbsSizeAnchor(){CBaseObject.call(this);this.fromX=null;this.fromY=null;this.toX=null;this.toY=null;this.object=null;this.parent=null;this.drawingBase=null}CAbsSizeAnchor.prototype=Object.create(CBaseObject.prototype);CAbsSizeAnchor.prototype.constructor=CAbsSizeAnchor;CAbsSizeAnchor.prototype.setDrawingBase=function(drawingBase){this.drawingBase=drawingBase};
|
|
|
|
|
CAbsSizeAnchor.prototype.getObjectType=function(){return AscDFH.historyitem_type_AbsSizeAnchor};CAbsSizeAnchor.prototype.setFromTo=function(fromX,fromY,extX,extY){History.Add(new AscDFH.CChangesDrawingsDouble(this,AscDFH.historyitem_AbsSizeAnchorFromX,this.fromX,fromX));History.Add(new AscDFH.CChangesDrawingsDouble(this,AscDFH.historyitem_AbsSizeAnchorFromY,this.fromY,fromY));History.Add(new AscDFH.CChangesDrawingsDouble(this,AscDFH.historyitem_AbsSizeAnchorExtX,this.toX,extX));History.Add(new AscDFH.CChangesDrawingsDouble(this,
|
|
|
|
|
AscDFH.historyitem_AbsSizeAnchorExtY,this.toY,extY));this.fromX=fromX;this.fromY=fromY;this.toX=extX;this.toY=extY};CAbsSizeAnchor.prototype.setObject=function(object){History.Add(new AscDFH.CChangesDrawingsObject(this,AscDFH.historyitem_AbsSizeAnchorObject,this.object,object));this.object=object;if(object)object.setParent(this)};CAbsSizeAnchor.prototype.setParent=function(object){History.Add(new AscDFH.CChangesDrawingsObject(this,AscDFH.historyitem_AbsSizeAnchorParent,this.parent,object));this.parent=
|
|
|
|
|
object};CAbsSizeAnchor.prototype.copy=function(oPr){var copy=new CRelSizeAnchor;copy.setFromTo(this.fromX,this.fromY,this.toX,this.toY);if(this.object)copy.setObject(this.object.copy(oPr));return copy};CAbsSizeAnchor.prototype.Refresh_RecalcData=function(drawingDocument){if(this.parent&&this.parent.Refresh_RecalcData2)this.parent.Refresh_RecalcData2()};CAbsSizeAnchor.prototype.Refresh_RecalcData2=function(drawingDocument){if(this.parent&&this.parent.Refresh_RecalcData2)this.parent.Refresh_RecalcData2()};
|
|
|
|
|
function CalculateSrcRect(parentCropTransform,bounds,oInvertTransformCrop,cropExtX,cropExtY){var lt_x_abs=parentCropTransform.TransformPointX(bounds.min_x,bounds.min_y);var lt_y_abs=parentCropTransform.TransformPointY(bounds.min_x,bounds.min_y);var rb_x_abs=parentCropTransform.TransformPointX(bounds.max_x,bounds.max_y);var rb_y_abs=parentCropTransform.TransformPointY(bounds.max_x,bounds.max_y);var lt_x_rel=oInvertTransformCrop.TransformPointX(lt_x_abs,lt_y_abs);var lt_y_rel=oInvertTransformCrop.TransformPointY(lt_x_abs,
|
|
|
|
|
lt_y_abs);var rb_x_rel=oInvertTransformCrop.TransformPointX(rb_x_abs,rb_y_abs);var rb_y_rel=oInvertTransformCrop.TransformPointY(rb_x_abs,rb_y_abs);var srcRect=new AscFormat.CSrcRect;var _l=100*lt_x_rel/cropExtX;var _t=100*lt_y_rel/cropExtY;var _r=100*rb_x_rel/cropExtX;var _b=100*rb_y_rel/cropExtY;srcRect.l=Math.min(_l,_r);srcRect.t=Math.min(_t,_b);srcRect.r=Math.max(_l,_r);srcRect.b=Math.max(_t,_b);return srcRect}AscDFH.drawingsChangesMap[AscDFH.historyitem_AbsSizeAnchorFromX]=function(oClass,value){oClass.fromX=
|
|
|
|
|
value};AscDFH.drawingsChangesMap[AscDFH.historyitem_AbsSizeAnchorFromY]=function(oClass,value){oClass.fromY=value};AscDFH.drawingsChangesMap[AscDFH.historyitem_AbsSizeAnchorExtX]=function(oClass,value){oClass.toX=value};AscDFH.drawingsChangesMap[AscDFH.historyitem_AbsSizeAnchorExtY]=function(oClass,value){oClass.toY=value};AscDFH.drawingsChangesMap[AscDFH.historyitem_AbsSizeAnchorObject]=function(oClass,value){oClass.object=value};AscDFH.drawingsChangesMap[AscDFH.historyitem_AbsSizeAnchorParent]=
|
|
|
|
|
function(oClass,value){oClass.parent=value};AscDFH.changesFactory[AscDFH.historyitem_AbsSizeAnchorFromX]=window["AscDFH"].CChangesDrawingsDouble;AscDFH.changesFactory[AscDFH.historyitem_AbsSizeAnchorFromY]=window["AscDFH"].CChangesDrawingsDouble;AscDFH.changesFactory[AscDFH.historyitem_AbsSizeAnchorExtX]=window["AscDFH"].CChangesDrawingsDouble;AscDFH.changesFactory[AscDFH.historyitem_AbsSizeAnchorExtY]=window["AscDFH"].CChangesDrawingsDouble;AscDFH.changesFactory[AscDFH.historyitem_AbsSizeAnchorObject]=
|
|
|
|
|
window["AscDFH"].CChangesDrawingsObject;AscDFH.changesFactory[AscDFH.historyitem_AbsSizeAnchorParent]=window["AscDFH"].CChangesDrawingsObject;window["AscFormat"]=window["AscFormat"]||{};window["AscFormat"].CBaseObject=CBaseObject;window["AscFormat"].CGraphicObjectBase=CGraphicObjectBase;window["AscFormat"].CGraphicBounds=CGraphicBounds;window["AscFormat"].checkNormalRotate=checkNormalRotate;window["AscFormat"].normalizeRotate=normalizeRotate;window["AscFormat"].CRelSizeAnchor=CRelSizeAnchor;window["AscFormat"].CAbsSizeAnchor=
|
|
|
|
|
CAbsSizeAnchor;window["AscFormat"].CalculateSrcRect=CalculateSrcRect;window["AscFormat"].CCopyObjectProperties=CCopyObjectProperties;window["AscFormat"].LOCKS_MASKS=LOCKS_MASKS})(window);"use strict";(function(window,undefined){var g_memory=AscFonts.g_memory;var DecodeBase64Char=AscFonts.DecodeBase64Char;var b64_decode=AscFonts.b64_decode;var c_oAscSizeRelFromH=AscCommon.c_oAscSizeRelFromH;var c_oAscSizeRelFromV=AscCommon.c_oAscSizeRelFromV;var CMatrix=AscCommon.CMatrix;var isRealObject=AscCommon.isRealObject;
|
|
|
|
|
var global_mouseEvent=AscCommon.global_mouseEvent;var History=AscCommon.History;var global_MatrixTransformer=AscCommon.global_MatrixTransformer;var checkNormalRotate=AscFormat.checkNormalRotate;var HitInLine=AscFormat.HitInLine;var MOVE_DELTA=AscFormat.MOVE_DELTA;var c_oAscFill=Asc.c_oAscFill;var dTextFitDelta=3;function CheckObjectLine(obj){return obj instanceof CShape&&obj.spPr&&obj.spPr.geometry&&AscFormat.CheckLinePreset(obj.spPr.geometry.preset)}function CheckWordArtTextPr(oRun){if(oRun instanceof
|
|
|
|
|
AscCommonWord.ParaRun){var oTextPr=oRun.Get_CompiledPr();if(oTextPr.TextFill||oTextPr.TextOutline&&oTextPr.TextOutline.Fill&&oTextPr.TextOutline.Fill.fill&&oTextPr.TextOutline.Fill.fill.type!==Asc.c_oAscFill.FILL_TYPE_NOFILL||oTextPr.Unifill&&oTextPr.Unifill.fill&&(oTextPr.Unifill.fill.type!==c_oAscFill.FILL_TYPE_SOLID||oTextPr.Unifill.transparent!=null&&oTextPr.Unifill.transparent<254.5))return true}return false}function hitInRect(x,y,l,t,r,b){return x>=l&&x<=r&&y>=t&&y<=b}function hitToCropHandles(x,
|
|
|
|
|
y,object){var invert_transform=object.getInvertTransform();if(!invert_transform)return-1;var t_x,t_y;t_x=invert_transform.TransformPointX(x,y);t_y=invert_transform.TransformPointY(x,y);var fCoeff=object.convertPixToMM(1);var fCoeff2=1/fCoeff;var widthCorner=object.extX*fCoeff2+1>>1;var isCentralMarkerX=widthCorner>40?true:false;if(widthCorner>17)widthCorner=17;var heightCorner=object.extY*fCoeff2+1>>1;var isCentralMarkerY=heightCorner>40?true:false;if(heightCorner>17)heightCorner=17;widthCorner*=
|
|
|
|
|
fCoeff;heightCorner*=fCoeff;var markerWidth=5*fCoeff;if(hitInRect(t_x,t_y,0,0,widthCorner,markerWidth))return 0;if(hitInRect(t_x,t_y,0,0,markerWidth,heightCorner))return 0;if(isCentralMarkerX){if(hitInRect(t_x,t_y,object.extX/2-widthCorner/2,0,object.extX/2+widthCorner/2,markerWidth))return 1;if(hitInRect(t_x,t_y,object.extX/2-widthCorner/2,object.extY-markerWidth,object.extX/2+widthCorner/2,object.extY))return 5}if(hitInRect(t_x,t_y,object.extX-widthCorner,0,object.extX,markerWidth))return 2;if(hitInRect(t_x,
|
|
|
|
|
t_y,object.extX-markerWidth,0,object.extX,heightCorner))return 2;if(isCentralMarkerY){if(hitInRect(t_x,t_y,object.extX-markerWidth,object.extY/2-heightCorner/2,object.extX,object.extY/2+heightCorner/2))return 3;if(hitInRect(t_x,t_y,0,object.extY/2-heightCorner/2,markerWidth,object.extY/2+heightCorner/2))return 7}if(hitInRect(t_x,t_y,object.extX-markerWidth,object.extY-heightCorner,object.extX,object.extY))return 4;if(hitInRect(t_x,t_y,object.extX-widthCorner,object.extY-markerWidth,object.extX,object.extY))return 4;
|
|
|
|
|
if(hitInRect(t_x,t_y,0,object.extY-heightCorner,markerWidth,object.extY))return 6;if(hitInRect(t_x,t_y,0,object.extY-markerWidth,widthCorner,object.extY))return 6;return-1}function hitToHandles(x,y,object){if(object.cropObject)return hitToCropHandles(x,y,object);var invert_transform=object.getInvertTransform();if(!invert_transform)return-1;var t_x,t_y;t_x=invert_transform.TransformPointX(x,y);t_y=invert_transform.TransformPointY(x,y);var radius=object.convertPixToMM(AscCommon.TRACK_CIRCLE_RADIUS);
|
|
|
|
|
if(typeof global_mouseEvent!=="undefined"&&isRealObject(global_mouseEvent)&&AscFormat.isRealNumber(global_mouseEvent.KoefPixToMM))radius*=global_mouseEvent.KoefPixToMM;if(global_mouseEvent&&global_mouseEvent.AscHitToHandlesEpsilon)radius=global_mouseEvent.AscHitToHandlesEpsilon;radius*=radius;var _min_dist=2*radius;var _ret_value=-1;var check_line=CheckObjectLine(object);var sqr_x=t_x*t_x,sqr_y=t_y*t_y;var _tmp_dist=sqr_x+sqr_y;if(_tmp_dist<_min_dist){_min_dist=_tmp_dist;_ret_value=0}var hc=object.extX*
|
|
|
|
|
.5;var dist_x=t_x-hc;sqr_x=dist_x*dist_x;_tmp_dist=sqr_x+sqr_y;if(_tmp_dist<_min_dist&&!check_line){_min_dist=_tmp_dist;_ret_value=1}dist_x=t_x-object.extX;sqr_x=dist_x*dist_x;_tmp_dist=sqr_x+sqr_y;if(_tmp_dist<_min_dist&&!check_line){_min_dist=_tmp_dist;_ret_value=2}var vc=object.extY*.5;var dist_y=t_y-vc;sqr_y=dist_y*dist_y;_tmp_dist=sqr_x+sqr_y;if(_tmp_dist<_min_dist&&!check_line){_min_dist=_tmp_dist;_ret_value=3}dist_y=t_y-object.extY;sqr_y=dist_y*dist_y;_tmp_dist=sqr_x+sqr_y;if(_tmp_dist<_min_dist){_min_dist=
|
|
|
|
|
_tmp_dist;_ret_value=4}dist_x=t_x-hc;sqr_x=dist_x*dist_x;_tmp_dist=sqr_x+sqr_y;if(_tmp_dist<_min_dist&&!check_line){_min_dist=_tmp_dist;_ret_value=5}dist_x=t_x;sqr_x=dist_x*dist_x;_tmp_dist=sqr_x+sqr_y;if(_tmp_dist<_min_dist&&!check_line){_min_dist=_tmp_dist;_ret_value=6}dist_y=t_y-vc;sqr_y=dist_y*dist_y;_tmp_dist=sqr_x+sqr_y;if(_tmp_dist<_min_dist&&!check_line){_min_dist=_tmp_dist;_ret_value=7}if(object.canRotate&&object.canRotate()&&!check_line){var rotate_distance=object.convertPixToMM(AscCommon.TRACK_DISTANCE_ROTATE);
|
|
|
|
|
dist_y=t_y+rotate_distance;sqr_y=dist_y*dist_y;dist_x=t_x-hc;sqr_x=dist_x*dist_x;_tmp_dist=sqr_x+sqr_y;if(_tmp_dist<_min_dist){_min_dist=_tmp_dist;_ret_value=8}}dist_x=t_x-hc;dist_y=t_y-vc;_tmp_dist=dist_x*dist_x+dist_y*dist_y;if(_tmp_dist<_min_dist&&!check_line){_min_dist=_tmp_dist;_ret_value=-1}if(_min_dist<radius)return _ret_value;return-1}function CreateUniFillByUniColorCopy(uniColor){var ret=new AscFormat.CUniFill;ret.setFill(new AscFormat.CSolidFill);ret.fill.setColor(uniColor.createDuplicate());
|
|
|
|
|
return ret}function CreateUniFillByUniColor(uniColor){var ret=new AscFormat.CUniFill;ret.setFill(new AscFormat.CSolidFill);ret.fill.setColor(uniColor.createDuplicate());return ret}function CopyRunToPPTX(Run,Paragraph,bHyper){var NewRun=new ParaRun(Paragraph,false);var RunPr=Run.Pr.Copy();if(RunPr.RStyle!=undefined)RunPr.RStyle=undefined;RunPr.FontScale=undefined;if(bHyper){if(!RunPr.Unifill)RunPr.Unifill=AscFormat.CreateUniFillSchemeColorWidthTint(11,0);RunPr.Underline=true}if(RunPr.TextFill){RunPr.Unifill=
|
|
|
|
|
RunPr.TextFill;RunPr.TextFill=undefined}NewRun.Set_Pr(RunPr);var PosToAdd=0;for(var CurPos=0;CurPos<Run.Content.length;CurPos++){var Item=Run.Content[CurPos];if(Item.Type!==para_End&&Item.Type!==para_Drawing&&Item.Type!==para_Comment&&Item.Type!==para_PageCount&&Item.Type!==para_FootnoteRef&&Item.Type!==para_FootnoteReference&&Item.Type!==para_PageNum&&Item.Type!==para_FieldChar&&Item.Type!==para_Bookmark&&Item.Type!==para_RevisionMove&&Item.Type!==para_InstrText&&Item.Type!==para_EndnoteReference&&
|
|
|
|
|
Item.Type!==para_EndnoteRef){NewRun.Add_ToContent(PosToAdd,Item.Copy(),false);++PosToAdd}}return NewRun}function ConvertParagraphContentToPPTX(aOrigContent,oNewParagraph,bIsAddMath,bRemoveHyperlink){var Count=aOrigContent.length;for(var Index=0;Index<Count;Index++){var Item=aOrigContent[Index];if(Item.Type===para_Run)oNewParagraph.Internal_Content_Add(oNewParagraph.Content.length,CopyRunToPPTX(Item,oNewParagraph),false);else if(Item.Type===para_Hyperlink)if(bRemoveHyperlink===true)for(var j=0;j<Item.Content.length;++j){if(Item.Content[j].Type===
|
|
|
|
|
para_Run)oNewParagraph.Internal_Content_Add(oNewParagraph.Content.length,CopyRunToPPTX(Item.Content[j],oNewParagraph),false)}else oNewParagraph.Internal_Content_Add(oNewParagraph.Content.length,ConvertHyperlinkToPPTX(Item,oNewParagraph),false);else if(Item.Type===para_InlineLevelSdt)ConvertParagraphContentToPPTX(Item.Content,oNewParagraph,bIsAddMath,bRemoveHyperlink);else if(true===bIsAddMath&&Item.Type===para_Math)oNewParagraph.Internal_Content_Add(oNewParagraph.Content.length,Item.Copy(),false)}}
|
|
|
|
|
function ConvertParagraphToPPTX(paragraph,drawingDocument,newParent,bIsAddMath,bRemoveHyperlink){var _drawing_document=isRealObject(drawingDocument)?drawingDocument:paragraph.DrawingDocument;var _new_parent=isRealObject(newParent)?newParent:null;var new_paragraph=new Paragraph(_drawing_document,_new_parent,true);if(!(paragraph instanceof Paragraph))return new_paragraph;var oCopyPr=paragraph.Pr.Copy();oCopyPr.ContextualSpacing=undefined;oCopyPr.KeepLines=undefined;oCopyPr.KeepNext=undefined;oCopyPr.PageBreakBefore=
|
|
|
|
|
undefined;oCopyPr.Shd=undefined;oCopyPr.Brd.First=undefined;oCopyPr.Brd.Last=undefined;oCopyPr.Brd.Between=undefined;oCopyPr.Brd.Bottom=undefined;oCopyPr.Brd.Left=undefined;oCopyPr.Brd.Right=undefined;oCopyPr.Brd.Top=undefined;oCopyPr.WidowControl=undefined;oCopyPr.Tabs=undefined;oCopyPr.NumPr=undefined;oCopyPr.PStyle=undefined;oCopyPr.FramePr=undefined;new_paragraph.Set_Pr(oCopyPr);var oNewEndPr=paragraph.TextPr.Value.Copy();if(oNewEndPr.TextFill){oNewEndPr.Unifill=oNewEndPr.TextFill;oNewEndPr.TextFill=
|
|
|
|
|
undefined}new_paragraph.TextPr.Set_Value(oNewEndPr);new_paragraph.Internal_Content_Remove2(0,new_paragraph.Content.length);ConvertParagraphContentToPPTX(paragraph.Content,new_paragraph,bIsAddMath,bRemoveHyperlink);var EndRun=new ParaRun(new_paragraph);EndRun.Add_ToContent(0,new ParaEnd);new_paragraph.Internal_Content_Add(new_paragraph.Content.length,EndRun,false);return new_paragraph}function ConvertElementsToPPTX(aResult,aElements,drawingDocument,newParent,bIsAddMath,bRemoveHyperlink){var i,j,oElement;
|
|
|
|
|
for(i=0;i<aElements.length;++i){oElement=aElements[i];if(oElement instanceof AscCommonWord.Paragraph)aResult.push(ConvertParagraphToPPTX(oElement));else if(oElement instanceof AscCommonWord.CTable){var paragraphs=[];oElement.GetAllParagraphs({All:true},paragraphs);for(j=0;j<paragraphs.length;j++)aResult.push(AscFormat.ConvertParagraphToPPTX(paragraphs[j],drawingDocument,newParent,bIsAddMath,bRemoveHyperlink))}else if(oElement instanceof AscCommonWord.CBlockLevelSdt)ConvertElementsToPPTX(aResult,oElement.Content.Content,
|
|
|
|
|
drawingDocument,newParent,bIsAddMath,bRemoveHyperlink)}}function ConvertHyperlinkToPPTX(hyperlink,paragraph){var hyperlink_ret=new ParaHyperlink,i,item,pos=0;hyperlink_ret.SetValue(hyperlink.Value);hyperlink_ret.SetToolTip(hyperlink.ToolTip);for(i=0;i<hyperlink.Content.length;++i){item=hyperlink.Content[i];if(item.Type===para_Run)hyperlink_ret.Add_ToContent(pos++,CopyRunToPPTX(item,paragraph,true));else if(item.Type===para_Hyperlink)hyperlink_ret.Add_ToContent(pos++,ConvertHyperlinkToPPTX(item,paragraph))}return hyperlink_ret}
|
|
|
|
|
function ConvertParagraphToWord(paragraph,docContent){var _docContent=isRealObject(docContent)?docContent:paragraph.Parent;var oldFlag=paragraph.bFromDocument;paragraph.bFromDocument=true;var new_paragraph=paragraph.Copy(_docContent);CheckWordParagraphContent(new_paragraph.Content,new_paragraph.Pr.DefaultRunPr);var NewRPr=CheckWordRunPr(new_paragraph.TextPr.Value);var oCopyDefaultPr;if(NewRPr){if(new_paragraph.Pr.DefaultRunPr){oCopyDefaultPr=new_paragraph.Pr.DefaultRunPr.Copy();oCopyDefaultPr.Merge(NewRPr);
|
|
|
|
|
NewRPr=CheckWordRunPr(oCopyDefaultPr);if(!NewRPr)NewRPr=oCopyDefaultPr}new_paragraph.TextPr.Apply_TextPr(NewRPr)}else if(new_paragraph.Pr.DefaultRunPr){oCopyDefaultPr=new_paragraph.Pr.DefaultRunPr.Copy();oCopyDefaultPr.Merge(new_paragraph.TextPr.Value);NewRPr=CheckWordRunPr(oCopyDefaultPr);if(!NewRPr)NewRPr=oCopyDefaultPr;new_paragraph.TextPr.Apply_TextPr(NewRPr)}paragraph.bFromDocument=oldFlag;return new_paragraph}function CheckWordRunPr(Pr,bMath){var NewRPr=null;if(Pr.Unifill&&Pr.Unifill.fill)switch(Pr.Unifill.fill.type){case c_oAscFill.FILL_TYPE_SOLID:{if(Pr.Unifill.fill.color&&
|
|
|
|
|
Pr.Unifill.fill.color.color)switch(Pr.Unifill.fill.color.color.type){case Asc.c_oAscColor.COLOR_TYPE_SCHEME:{if(Pr.Unifill.fill.color.Mods&&Pr.Unifill.fill.color.Mods.Mods.length!==0)if(!Pr.Unifill.fill.color.canConvertPPTXModsToWord()){NewRPr=Pr.Copy();NewRPr.TextFill=NewRPr.Unifill;NewRPr.Unifill=undefined}else{NewRPr=Pr.Copy();NewRPr.Unifill.convertToWordMods()}break}case Asc.c_oAscColor.COLOR_TYPE_SRGB:{NewRPr=Pr.Copy();var RGBA=Pr.Unifill.fill.color.color.RGBA;NewRPr.Color=new CDocumentColor(RGBA.R,
|
|
|
|
|
RGBA.G,RGBA.B);NewRPr.Unifill=undefined;break}default:{NewRPr=Pr.Copy();NewRPr.TextFill=NewRPr.Unifill;NewRPr.Unifill=undefined}}break}case c_oAscFill.FILL_TYPE_PATT:case c_oAscFill.FILL_TYPE_BLIP:{NewRPr=Pr.Copy();NewRPr.TextFill=AscFormat.CreateUnfilFromRGB(0,0,0);NewRPr.Unifill=undefined;break}default:{NewRPr=Pr.Copy();NewRPr.TextFill=NewRPr.Unifill;NewRPr.Unifill=undefined;break}}if(bMath){NewRPr=Pr.Copy();NewRPr.RFonts.Set_All("Cambria Math",-1)}return NewRPr}function CheckWordParagraphContent(aContent,
|
|
|
|
|
oTextPr){var NewRPr,MergePr;for(var i=0;i<aContent.length;++i){var oItem=aContent[i];switch(oItem.Type){case para_Run:{NewRPr=CheckWordRunPr(oItem.Pr);if(NewRPr){MergePr=NewRPr;if(oTextPr){MergePr=oTextPr.Copy();MergePr.Merge(NewRPr);NewRPr=CheckWordRunPr(MergePr);if(!NewRPr)NewRPr=MergePr}oItem.Set_Pr(NewRPr)}else if(oTextPr){MergePr=oTextPr.Copy();MergePr.Merge(oItem.Pr);NewRPr=CheckWordRunPr(MergePr);if(!NewRPr)NewRPr=MergePr;oItem.Set_Pr(NewRPr)}break}case para_Hyperlink:{CheckWordParagraphContent(oItem.Content);
|
|
|
|
|
break}case para_Math:{if(oItem.Root&&oItem.Root.Content)CheckWordParagraphContent(oItem.Root.Content);break}case para_Math_Run:{NewRPr=CheckWordRunPr(oItem.Pr,true);if(NewRPr){MergePr=NewRPr;if(oTextPr){MergePr=oTextPr.Copy();MergePr.Merge(NewRPr);NewRPr=CheckWordRunPr(MergePr);if(!NewRPr)NewRPr=MergePr}oItem.Set_Pr(NewRPr)}else if(oTextPr){MergePr=oTextPr.Copy();MergePr.Merge(oItem.Pr);NewRPr=CheckWordRunPr(MergePr);if(!NewRPr)NewRPr=MergePr;oItem.Set_Pr(NewRPr)}break}}}}function ConvertGraphicFrameToWordTable(oGraphicFrame,
|
|
|
|
|
oDocument){oGraphicFrame.setWordFlag(false,oDocument);return oGraphicFrame.graphicObject.Copy(oDocument)}function ConvertTableToGraphicFrame(oTable,oPresentation){var oGraphicFrame=new AscFormat.CGraphicFrame;var oTable2=new CTable(oPresentation.DrawingDocument,oGraphicFrame,true,0,[].concat(oTable.TableGrid),oTable.TableGrid.length,true);oTable2.Reset(0,0,50,1E5,0,0,1);oTable2.SetTableLayout(tbllayout_Fixed);oTable2.Set_Pr(oTable.Pr.Copy());oTable2.Set_TableLook(oTable.TableLook.Copy());for(var i=
|
|
|
|
|
0;i<oTable.Content.length;++i){var oRow=oTable.Content[i];var oNewRow=new CTableRow(oTable2,oRow.Content.length,oTable2.TableGrid);for(var j=0;j<oRow.Content.length;++j){var oContent=oRow.Content[j].Content;var oNewContent=oNewRow.Content[j].Content;for(var t=0;t<oContent.Content.length;++t)if(oContent.Content[t].Get_Type()===type_Paragraph)oNewContent.Internal_Content_Add(oNewContent.Content.length,AscFormat.ConvertParagraphToPPTX(oContent.Content[t],oPresentation.DrawingDocument,oNewContent))}var nIndex=
|
|
|
|
|
oTable2.Content.length;oTable2.Content[nIndex]=oNewRow;History.Add(new CChangesTableAddRow(oTable2,nIndex,[oNewRow]));oTable2.private_UpdateTableGrid()}if(!oGraphicFrame.spPr){oGraphicFrame.setSpPr(new AscFormat.CSpPr);oGraphicFrame.spPr.setParent(oGraphicFrame)}oGraphicFrame.spPr.setXfrm(new AscFormat.CXfrm);oGraphicFrame.spPr.xfrm.setExtX(50);oGraphicFrame.spPr.xfrm.setExtY(50);oGraphicFrame.spPr.xfrm.setParent(oGraphicFrame.spPr);var _nvGraphicFramePr=new AscFormat.UniNvPr;oGraphicFrame.setNvSpPr(_nvGraphicFramePr);
|
|
|
|
|
if(AscCommon.isRealObject(_nvGraphicFramePr)&&AscFormat.isRealNumber(_nvGraphicFramePr.locks))oGraphicFrame.setLocks(_nvGraphicFramePr.locks);oGraphicFrame.setGraphicObject(oTable2);oGraphicFrame.setBDeleted(false);return oGraphicFrame}function fHandleContent(aContent,oMax){for(var i=0;i<aContent.length;++i){var oContentElement=aContent[i];if(oContentElement.Get_Type()===type_Paragraph){var paragraph_lines=aContent[i].Lines;for(var j=0;j<paragraph_lines.length;++j)if(paragraph_lines[j].Ranges[0].W>
|
|
|
|
|
oMax.max_width)oMax.max_width=paragraph_lines[j].Ranges[0].X+paragraph_lines[j].Ranges[0].W}else if(oContentElement.Get_Type()===type_Table){if(oContentElement.Bounds.Right>oMax.max_width)oMax.max_width=oContentElement.Bounds.Right}else if(oContentElement.Get_Type()===type_BlockLevelSdt)if(oContentElement&&oContentElement.Content)fHandleContent(oContentElement.Content.Content,oMax)}}function RecalculateDocContentByMaxLine(oDocContent,dMaxWidth,bNeedRecalcAllDrawings){var oMaxWidth={max_width:0},i;
|
|
|
|
|
oDocContent.Reset(0,0,dMaxWidth,2E4);if(bNeedRecalcAllDrawings){var aAllDrawings=oDocContent.GetAllDrawingObjects();for(i=0;i<aAllDrawings.length;++i)aAllDrawings[i].GraphicObj.recalculate()}oDocContent.Recalculate_Page(0,true);fHandleContent(oDocContent.Content,oMaxWidth);if(oMaxWidth.max_width===0){if(oDocContent.Is_Empty())if(oDocContent.Content[0]&&oDocContent.Content[0].Content[0]&&oDocContent.Content[0].Content[0].Content[0])return oDocContent.Content[0].Content[0].Content[0].WidthVisible/TEXTWIDTH_DIVIDER;
|
|
|
|
|
return.001}return oMaxWidth.max_width}function CheckExcelDrawingXfrm(xfrm){var rot=AscFormat.isRealNumber(xfrm.rot)?xfrm.rot:0;if(checkNormalRotate(rot)){if(xfrm.offX<0)xfrm.setOffX(0);if(xfrm.offY<0)xfrm.setOffY(0)}else{var dPosX=xfrm.offX+xfrm.extX/2-xfrm.extY/2;var dPosY=xfrm.offY+xfrm.extY/2-xfrm.extX/2;if(dPosX<0)xfrm.setOffX(xfrm.offX-dPosX);if(dPosY<0)xfrm.setOffY(xfrm.offY-dPosY)}}function SetXfrmFromMetrics(oDrawing,metrics){AscFormat.CheckSpPrXfrm(oDrawing);var rot=AscFormat.isRealNumber(oDrawing.spPr.xfrm.rot)?
|
|
|
|
|
AscFormat.normalizeRotate(oDrawing.spPr.xfrm.rot):0;var metricExtX,metricExtY;if(!(oDrawing instanceof AscFormat.CGroupShape)){metricExtX=metrics.extX;metricExtY=metrics.extY;if(checkNormalRotate(rot)){oDrawing.spPr.xfrm.setExtX(metrics.extX);oDrawing.spPr.xfrm.setExtY(metrics.extY)}else{oDrawing.spPr.xfrm.setExtX(metrics.extY);oDrawing.spPr.xfrm.setExtY(metrics.extX)}}else if(AscFormat.isRealNumber(oDrawing.spPr.xfrm.extX)&&AscFormat.isRealNumber(oDrawing.spPr.xfrm.extY)){metricExtX=oDrawing.spPr.xfrm.extX;
|
|
|
|
|
metricExtY=oDrawing.spPr.xfrm.extY}else{metricExtX=metrics.extX;metricExtY=metrics.extY}if(checkNormalRotate(rot)){oDrawing.spPr.xfrm.setOffX(metrics.x);oDrawing.spPr.xfrm.setOffY(metrics.y)}else{oDrawing.spPr.xfrm.setOffX(metrics.x+metricExtX/2-metricExtY/2);oDrawing.spPr.xfrm.setOffY(metrics.y+metricExtY/2-metricExtX/2)}}AscDFH.changesFactory[AscDFH.historyitem_ShapeSetNvSpPr]=AscDFH.CChangesDrawingsObject;AscDFH.changesFactory[AscDFH.historyitem_ShapeSetSpPr]=AscDFH.CChangesDrawingsObject;AscDFH.changesFactory[AscDFH.historyitem_ShapeSetStyle]=
|
|
|
|
|
AscDFH.CChangesDrawingsObject;AscDFH.changesFactory[AscDFH.historyitem_ShapeSetTxBody]=AscDFH.CChangesDrawingsObject;AscDFH.changesFactory[AscDFH.historyitem_ShapeSetTextBoxContent]=AscDFH.CChangesDrawingsObject;AscDFH.changesFactory[AscDFH.historyitem_ShapeSetBodyPr]=AscDFH.CChangesDrawingsObjectNoId;AscDFH.changesFactory[AscDFH.historyitem_AutoShapes_SetBFromSerialize]=AscDFH.CChangesDrawingsBool;AscDFH.changesFactory[AscDFH.historyitem_ShapeSetParent]=AscDFH.CChangesDrawingsObject;AscDFH.changesFactory[AscDFH.historyitem_ShapeSetGroup]=
|
|
|
|
|
AscDFH.CChangesDrawingsObject;AscDFH.changesFactory[AscDFH.historyitem_ShapeSetWordShape]=AscDFH.CChangesDrawingsBool;AscDFH.changesFactory[AscDFH.historyitem_ShapeSetSignature]=AscDFH.CChangesDrawingsObjectNoId;AscDFH.drawingsChangesMap[AscDFH.historyitem_ShapeSetNvSpPr]=function(oClass,value){oClass.nvSpPr=value};AscDFH.drawingsChangesMap[AscDFH.historyitem_ShapeSetSpPr]=function(oClass,value){oClass.spPr=value};AscDFH.drawingsChangesMap[AscDFH.historyitem_ShapeSetStyle]=function(oClass,value){oClass.style=
|
|
|
|
|
value};AscDFH.drawingsChangesMap[AscDFH.historyitem_ShapeSetTxBody]=function(oClass,value){oClass.txBody=value};AscDFH.drawingsChangesMap[AscDFH.historyitem_ShapeSetTextBoxContent]=function(oClass,value){oClass.textBoxContent=value};AscDFH.drawingsChangesMap[AscDFH.historyitem_ShapeSetBodyPr]=function(oClass,value){oClass.bodyPr=value};AscDFH.drawingsChangesMap[AscDFH.historyitem_AutoShapes_SetBFromSerialize]=function(oClass,value){oClass.fromSerialize=value};AscDFH.drawingsChangesMap[AscDFH.historyitem_ShapeSetParent]=
|
|
|
|
|
function(oClass,value){oClass.parent=value};AscDFH.drawingsChangesMap[AscDFH.historyitem_ShapeSetGroup]=function(oClass,value){oClass.group=value};AscDFH.drawingsChangesMap[AscDFH.historyitem_ShapeSetWordShape]=function(oClass,value){oClass.bWordShape=value};AscDFH.drawingsChangesMap[AscDFH.historyitem_ShapeSetSignature]=function(oClass,value){var oldSignature=oClass.signatureLine;var newSignature=value;oClass.signatureLine=value;if(!AscCommon.isFileBuild()){var oApi=window["Asc"]&&window["Asc"]["editor"]||
|
|
|
|
|
editor;if(oApi){if(oldSignature&&oldSignature.id)oApi.sendEvent("asc_onRemoveSignature",oldSignature.id);if(newSignature&&newSignature.id)oApi.sendEvent("asc_onAddSignature",newSignature.id)}}};function CSignatureLine(){this.id=null;this.signer=null;this.signer2=null;this.email=null;this.showDate=null;this.instructions=null}CSignatureLine.prototype.Write_ToBinary=function(writer){AscFormat.writeString(writer,this.id);AscFormat.writeString(writer,this.signer);AscFormat.writeString(writer,this.signer2);
|
|
|
|
|
AscFormat.writeString(writer,this.email);AscFormat.writeBool(writer,this.showDate);AscFormat.writeString(writer,this.instructions)};CSignatureLine.prototype.Read_FromBinary=function(reader){this.id=AscFormat.readString(reader);this.signer=AscFormat.readString(reader);this.signer2=AscFormat.readString(reader);this.email=AscFormat.readString(reader);this.showDate=AscFormat.readBool(reader);this.instructions=AscFormat.readString(reader)};CSignatureLine.prototype.copy=function(){var ret=new CSignatureLine;
|
|
|
|
|
ret.id=AscCommon.CreateGUID();ret.signer=this.signer;ret.signer2=this.signer2;ret.email=this.email;ret.showDate=this.showDate;ret.instructions=this.instructions;return ret};CSignatureLine.prototype.copyWithId=function(){var sId=this.id;var oCopy=this.copy();oCopy.id=sId;return oCopy};CSignatureLine.prototype.setProperties=function(oPr){this.signer=oPr.asc_getSigner1();this.signer2=oPr.asc_getSigner2();this.email=oPr.asc_getEmail();this.showDate=oPr.asc_getShowDate();this.instructions=oPr.asc_getInstructions()};
|
|
|
|
|
AscDFH.drawingsConstructorsMap[AscDFH.historyitem_ShapeSetBodyPr]=AscFormat.CBodyPr;AscDFH.drawingsConstructorsMap[AscDFH.historyitem_ShapeSetSignature]=CSignatureLine;function CShape(){AscFormat.CGraphicObjectBase.call(this);this.nvSpPr=null;this.style=null;this.txBody=null;this.bodyPr=null;this.textBoxContent=null;this.drawingBase=null;this.bWordShape=null;this.bCheckAutoFitFlag=false;this.signatureLine=null;this.transformText=new CMatrix;this.invertTransformText=null;this.localTransformText=new CMatrix;
|
|
|
|
|
this.worksheet=null;this.cachedImage=null;this.txWarpStruct=null;this.txWarpStructParamarks=null;this.txWarpStructNoTransform=null;this.txWarpStructParamarksNoTransform=null;this.tmpFontScale=undefined;this.tmpLnSpcReduction=undefined}CShape.prototype=Object.create(AscFormat.CGraphicObjectBase.prototype);CShape.prototype.constructor=CShape;CShape.prototype.getObjectType=function(){return AscDFH.historyitem_type_Shape};CShape.prototype.GetAllDrawingObjects=function(DrawingObjects){var oContent=this.getDocContent();
|
|
|
|
|
if(oContent)oContent.GetAllDrawingObjects(DrawingObjects)};CShape.prototype.setSignature=function(oSignature){History.Add(new AscDFH.CChangesDrawingsObjectNoId(this,AscDFH.historyitem_ShapeSetSignature,this.signatureLine,oSignature));this.signatureLine=oSignature};CShape.prototype.setSignaturePr=function(oPr,sUrl){if(!oPr||!this.signatureLine)return;var oCopy=this.signatureLine.copyWithId();oCopy.setProperties(oPr);this.setSignature(oCopy);if(sUrl)if(this.spPr){var oBlipFillUnifill=AscFormat.CreateBlipFillUniFillFromUrl(sUrl);
|
|
|
|
|
this.spPr.setFill(oBlipFillUnifill)}};CShape.prototype.convertToWord=function(document){this.setBDeleted(true);var c=new CShape;c.setWordShape(true);c.setBDeleted(false);if(this.nvSpPr)c.setNvSpPr(this.nvSpPr.createDuplicate());if(this.spPr){c.setSpPr(this.spPr.createDuplicate());if(!c.spPr.geometry)c.spPr.setGeometry(AscFormat.CreateGeometry("rect"));c.spPr.setParent(c)}if(this.style)c.setStyle(this.style.createDuplicate());if(this.txBody){if(this.txBody.bodyPr)c.setBodyPr(this.txBody.bodyPr.createDuplicate());
|
|
|
|
|
if(this.txBody.content){var new_content=new CDocumentContent(c,document.DrawingDocument,0,0,0,2E4,false,false,false);var paragraphs=this.txBody.content.Content;new_content.Internal_Content_RemoveAll();for(var i=0;i<paragraphs.length;++i){var cur_par=paragraphs[i];var new_paragraph=ConvertParagraphToWord(cur_par,new_content);new_content.Internal_Content_Add(i,new_paragraph,false)}c.setTextBoxContent(new_content)}}if(this.signatureLine)c.setSignature(this.signatureLine.copy());return c};CShape.prototype.convertToPPTX=
|
|
|
|
|
function(drawingDocument,worksheet,bIsAddMath){var c=new CShape;c.setWordShape(false);c.setBDeleted(false);c.setWorksheet(worksheet);if(this.nvSpPr)c.setNvSpPr(this.nvSpPr.createDuplicate());if(this.spPr){c.setSpPr(this.spPr.createDuplicate());c.spPr.setParent(c)}if(this.style)c.setStyle(this.style.createDuplicate());if(this.textBoxContent){var tx_body=new AscFormat.CTextBody;tx_body.setParent(c);if(this.bodyPr)tx_body.setBodyPr(this.bodyPr.createDuplicate());var new_content=new AscFormat.CDrawingDocContent(tx_body,
|
|
|
|
|
drawingDocument,0,0,0,0,false,false,true);new_content.Internal_Content_RemoveAll();var paragraphs=this.textBoxContent.Content;var index=0;for(var i=0;i<paragraphs.length;++i){var cur_par=paragraphs[i];if(cur_par instanceof Paragraph){var new_paragraph=ConvertParagraphToPPTX(cur_par,drawingDocument,new_content,bIsAddMath);new_content.Internal_Content_Add(index++,new_paragraph,false)}}tx_body.setContent(new_content);c.setTxBody(tx_body)}if(worksheet)if(this.signatureLine)c.setSignature(this.signatureLine.copy());
|
|
|
|
|
return c};CShape.prototype.handleAllContents=function(fCallback){var content=this.getDocContent();if(content)fCallback(content)};CShape.prototype.documentGetAllFontNames=function(AllFonts){var content=this.getDocContent();if(content)content.Document_Get_AllFontNames(AllFonts)};CShape.prototype.documentCreateFontMap=function(map){var content=this.getDocContent();if(content)content.Document_CreateFontMap(map)};CShape.prototype.setNvSpPr=function(pr){History.Add(new AscDFH.CChangesDrawingsObject(this,
|
|
|
|
|
AscDFH.historyitem_ShapeSetNvSpPr,this.nvSpPr,pr));this.nvSpPr=pr};CShape.prototype.setSpPr=function(spPr){History.Add(new AscDFH.CChangesDrawingsObject(this,AscDFH.historyitem_ShapeSetSpPr,this.spPr,spPr));this.spPr=spPr};CShape.prototype.setStyle=function(style){History.Add(new AscDFH.CChangesDrawingsObject(this,AscDFH.historyitem_ShapeSetStyle,this.style,style));this.style=style;var content=this.getDocContent();this.recalcInfo.recalculateShapeStyleForParagraph=true;if(this.recalcTextStyles)this.recalcTextStyles();
|
|
|
|
|
if(content)content.Recalc_AllParagraphs_CompiledPr()};CShape.prototype.setTxBody=function(txBody){History.Add(new AscDFH.CChangesDrawingsObject(this,AscDFH.historyitem_ShapeSetTxBody,this.txBody,txBody));this.txBody=txBody};CShape.prototype.setTextBoxContent=function(textBoxContent){History.Add(new AscDFH.CChangesDrawingsObject(this,AscDFH.historyitem_ShapeSetTextBoxContent,this.textBoxContent,textBoxContent));this.textBoxContent=textBoxContent};CShape.prototype.setBodyPr=function(pr){History.Add(new AscDFH.CChangesDrawingsObjectNoId(this,
|
|
|
|
|
AscDFH.historyitem_ShapeSetBodyPr,this.bodyPr,pr));this.bodyPr=pr;this.recalcInfo.recalculateContent=true;this.recalcInfo.recalculateTransformText=true;this.addToRecalculate()};CShape.prototype.createTextBody=function(){var tx_body=new AscFormat.CTextBody;tx_body.setParent(this);tx_body.setContent(new AscFormat.CDrawingDocContent(tx_body,this.getDrawingDocument(),0,0,0,2E4,false,false,true));var oBodyPr=new AscFormat.CBodyPr;if(this.worksheet){oBodyPr.vertOverflow=AscFormat.nOTClip;oBodyPr.horzOverflow=
|
|
|
|
|
AscFormat.nOTClip}tx_body.setBodyPr(oBodyPr);tx_body.content.Content[0].Set_DocumentIndex(0);tx_body.content.MoveCursorToStartPos(false);this.setTxBody(tx_body)};CShape.prototype.createTextBoxContent=function(){var body_pr=new AscFormat.CBodyPr;body_pr.setAnchor(1);this.setBodyPr(body_pr);this.setTextBoxContent(new CDocumentContent(this,this.getDrawingDocument(),0,0,0,2E4,false,false));this.textBoxContent.SetParagraphAlign(AscCommon.align_Center);this.textBoxContent.MoveCursorToStartPos(false);this.textBoxContent.Content[0].Set_DocumentIndex(0)};
|
|
|
|
|
CShape.prototype.paragraphAdd=function(paraItem,bRecalculate){var content_to_add=this.getDocContent();if(!content_to_add)if(!AscFormat.CheckLinePresetForParagraphAdd(this.getPresetGeom())){if(this.bWordShape)this.createTextBoxContent();else this.createTextBody();content_to_add=this.getDocContent()}if(content_to_add)content_to_add.AddToParagraph(paraItem,bRecalculate)};CShape.prototype.applyTextFunction=function(docContentFunction,tableFunction,args){var content_to_add=this.getDocContent();if(!content_to_add)if(!AscFormat.CheckLinePresetForParagraphAdd(this.getPresetGeom())){if(this.bWordShape)this.createTextBoxContent();
|
|
|
|
|
else this.createTextBody();content_to_add=this.getDocContent();content_to_add.MoveCursorToStartPos()}if(content_to_add)docContentFunction.apply(content_to_add,args);if(!editor||!editor.noCreatePoint||editor.exucuteHistory)this.checkExtentsByDocContent()};CShape.prototype.clearContent=function(){var content=this.getDocContent();if(content){content.Set_ApplyToAll(true);content.Remove(-1);content.AddToParagraph(new AscCommonWord.ParaTextPr({Lang:{Val:undefined}}),false);content.Set_ApplyToAll(false)}};
|
|
|
|
|
CShape.prototype.getDocContent=function(){if(this.txBody)return this.txBody.content;else if(this.textBoxContent)return this.textBoxContent;return null};CShape.prototype.getBodyPr=function(){return AscFormat.ExecuteNoHistory(function(){if(this.bWordShape){var ret=new AscFormat.CBodyPr;ret.setDefault();if(this.bodyPr)ret.merge(this.bodyPr);return ret}else{if(this.txBody&&this.txBody.bodyPr)return this.txBody.getCompiledBodyPr();var ret=new AscFormat.CBodyPr;ret.setDefault();return ret}},this,[])};CShape.prototype.GetRevisionsChangeElement=
|
|
|
|
|
function(SearchEngine){var oContent=this.getDocContent();if(oContent)oContent.GetRevisionsChangeElement(SearchEngine)};CShape.prototype.Search=function(Str,Props,SearchEngine,Type){if(this.textBoxContent){var dd=this.getDrawingDocument();dd.StartSearchTransform(this.transformText);this.textBoxContent.Search(Str,Props,SearchEngine,Type);dd.EndSearchTransform()}else if(this.txBody&&this.txBody.content)this.txBody.content.Search(Str,Props,SearchEngine,Type)};CShape.prototype.GetSearchElementId=function(bNext,
|
|
|
|
|
bCurrent){if(this.textBoxContent)return this.textBoxContent.GetSearchElementId(bNext,bCurrent);else if(this.txBody&&this.txBody.content)return this.txBody.content.GetSearchElementId(bNext,bCurrent);return null};CShape.prototype.documentUpdateRulersState=function(){var content=this.getDocContent();if(!content)return;var xc,yc;var l,t,r,b;var body_pr=this.getBodyPr();var l_ins,t_ins,r_ins,b_ins;if(typeof body_pr.lIns==="number")l_ins=body_pr.lIns;else l_ins=2.54;if(typeof body_pr.tIns==="number")t_ins=
|
|
|
|
|
body_pr.tIns;else t_ins=1.27;if(typeof body_pr.rIns==="number")r_ins=body_pr.rIns;else r_ins=2.54;if(typeof body_pr.bIns==="number")b_ins=body_pr.bIns;else b_ins=1.27;if(this.spPr&&isRealObject(this.spPr.geometry)&&isRealObject(this.spPr.geometry.rect)){l=this.spPr.geometry.rect.l+l_ins;t=this.spPr.geometry.rect.t+t_ins;r=this.spPr.geometry.rect.r-r_ins;b=this.spPr.geometry.rect.b-b_ins}else{l=l_ins;t=t_ins;r=this.extX-r_ins;b=this.extY-b_ins}var x_lt,y_lt,x_rt,y_rt,x_rb,y_rb,x_lb,y_lb;var tr=this.transform;
|
|
|
|
|
x_lt=tr.TransformPointX(l,t);y_lt=tr.TransformPointY(l,t);x_rb=tr.TransformPointX(r,b);y_rb=tr.TransformPointY(r,b);xc=(x_lt+x_rb)*.5;yc=(y_lt+y_rb)*.5;var hc=(r-l)*.5;var vc=(b-t)*.5;this.getDrawingDocument().Set_RulerState_Paragraph({L:xc-hc,T:yc-vc,R:xc+hc,B:yc+vc});content.Document_UpdateRulersState(AscFormat.isRealNumber(this.selectStartPage)?this.selectStartPage:0)};CShape.prototype.setParent=function(parent){History.Add(new AscDFH.CChangesDrawingsObject(this,AscDFH.historyitem_ShapeSetParent,
|
|
|
|
|
this.parent,parent));this.parent=parent};CShape.prototype.setGroup=function(group){History.Add(new AscDFH.CChangesDrawingsObject(this,AscDFH.historyitem_ShapeSetGroup,this.group,group));this.group=group};CShape.prototype.getAllImages=function(images){if(this.spPr&&this.spPr.Fill&&this.spPr.Fill.fill instanceof AscFormat.CBlipFill&&typeof this.spPr.Fill.fill.RasterImageId==="string")images[AscCommon.getFullImageSrc2(this.spPr.Fill.fill.RasterImageId)]=true};CShape.prototype.getAllFonts=function(fonts){if(this.txBody){this.txBody.content.Document_Get_AllFontNames(fonts);
|
|
|
|
|
if(this.txBody&&this.txBody.lstStyle)this.txBody.lstStyle.Document_Get_AllFontNames(fonts);delete fonts["+mj-lt"];delete fonts["+mn-lt"];delete fonts["+mj-ea"];delete fonts["+mn-ea"];delete fonts["+mj-cs"];delete fonts["+mn-cs"]}};CShape.prototype.canFill=function(){if(this.spPr&&this.spPr.geometry)return this.spPr.geometry.canFill();return true};CShape.prototype.isShape=function(){return true};CShape.prototype.isImage=function(){return false};CShape.prototype.isChart=function(){return false};CShape.prototype.isGroup=
|
|
|
|
|
function(){return false};CShape.prototype.getHierarchy=function(bIsSingleBody,info){{this.compiledHierarchy=[];if(this.parent){var hierarchy=this.compiledHierarchy;if(this.isPlaceholder()){var ph_type=this.getPlaceholderType();var ph_index=this.getPlaceholderIndex();var b_is_single_body;if(AscFormat.isRealBool(bIsSingleBody))b_is_single_body=bIsSingleBody;else b_is_single_body=this.getIsSingleBody&&this.getIsSingleBody();switch(this.parent.kind){case AscFormat.TYPE_KIND.SLIDE:{hierarchy.push(this.parent.Layout.getMatchingShape(ph_type,
|
|
|
|
|
ph_index,b_is_single_body,info));hierarchy.push(this.parent.Layout.Master.getMatchingShape(ph_type,ph_index,true));break}case AscFormat.TYPE_KIND.LAYOUT:{hierarchy.push(this.parent.Master.getMatchingShape(ph_type,ph_index,true));break}case AscFormat.TYPE_KIND.NOTES:{if(this.parent.Master)hierarchy.push(this.parent.Master.getMatchingShape(ph_type,ph_index,true));break}}}this.recalcInfo.recalculateShapeHierarchy=true}}return this.compiledHierarchy};CShape.prototype.getPaddings=function(){var paddings=
|
|
|
|
|
null;var shape=this;var body_pr;if(shape.txBody)if(shape.txBody.compiledBodyPr)body_pr=shape.txBody.compiledBodyPr;else body_pr=shape.txBody.getCompiledBodyPr();else if(shape.textBoxContent)body_pr=shape.bodyPr;if(body_pr){paddings=new Asc.asc_CPaddings;if(typeof body_pr.lIns==="number")paddings.Left=body_pr.lIns;else paddings.Left=2.54;if(typeof body_pr.tIns==="number")paddings.Top=body_pr.tIns;else paddings.Top=1.27;if(typeof body_pr.rIns==="number")paddings.Right=body_pr.rIns;else paddings.Right=
|
|
|
|
|
2.54;if(typeof body_pr.bIns==="number")paddings.Bottom=body_pr.bIns;else paddings.Bottom=1.27}return paddings};CShape.prototype.getCompiledFill=function(){if(this.recalcInfo.recalculateFill){this.compiledFill=null;if(isRealObject(this.spPr)&&isRealObject(this.spPr.Fill)&&isRealObject(this.spPr.Fill.fill)){if(this.spPr.Fill.fill instanceof AscFormat.CGradFill&&this.spPr.Fill.fill.colors.length===0){var parent_objects=this.getParentObjects();var theme=parent_objects.theme;var fmt_scheme=theme.themeElements.fmtScheme;
|
|
|
|
|
var fill_style_lst=fmt_scheme.fillStyleLst;for(var i=fill_style_lst.length-1;i>-1;--i)if(fill_style_lst[i]&&fill_style_lst[i].fill instanceof AscFormat.CGradFill){this.spPr.Fill=fill_style_lst[i].createDuplicate();break}}this.compiledFill=this.spPr.Fill.createDuplicate();if(this.compiledFill&&this.compiledFill.fill&&this.compiledFill.fill.type===c_oAscFill.FILL_TYPE_GRP)if(this.group){var group_compiled_fill=this.group.getCompiledFill();if(isRealObject(group_compiled_fill)&&isRealObject(group_compiled_fill.fill))this.compiledFill=
|
|
|
|
|
group_compiled_fill.createDuplicate();else this.compiledFill=null}else this.compiledFill=null}else if(isRealObject(this.group)){var group_compiled_fill=this.group.getCompiledFill();if(isRealObject(group_compiled_fill)&&isRealObject(group_compiled_fill.fill))this.compiledFill=group_compiled_fill.createDuplicate();else{var hierarchy=this.getHierarchy();for(var i=0;i<hierarchy.length;++i)if(isRealObject(hierarchy[i])&&isRealObject(hierarchy[i].spPr)&&isRealObject(hierarchy[i].spPr.Fill)&&isRealObject(hierarchy[i].spPr.Fill.fill)){this.compiledFill=
|
|
|
|
|
hierarchy[i].spPr.Fill.createDuplicate();break}}}else{var hierarchy=this.getHierarchy();for(var i=0;i<hierarchy.length;++i)if(isRealObject(hierarchy[i])&&isRealObject(hierarchy[i].spPr)&&isRealObject(hierarchy[i].spPr.Fill)&&isRealObject(hierarchy[i].spPr.Fill.fill)){this.compiledFill=hierarchy[i].spPr.Fill.createDuplicate();break}}this.recalcInfo.recalculateFill=false}return this.compiledFill};CShape.prototype.getMargins=function(){if(this.txBody)return this.txBody.getMargins();else return null};
|
|
|
|
|
CShape.prototype.Document_UpdateRulersState=function(margins){if(this.txBody&&this.txBody.content)this.txBody.content.Document_UpdateRulersState(this.parent.num,this.getMargins())};CShape.prototype.getCompiledLine=function(){if(this.recalcInfo.recalculateLine){this.compiledLine=null;if(isRealObject(this.spPr)&&isRealObject(this.spPr.ln)&&isRealObject(this.spPr.ln))this.compiledLine=this.spPr.ln.createDuplicate();else if(isRealObject(this.group)){var group_compiled_line=this.group.getCompiledLine();
|
|
|
|
|
if(isRealObject(group_compiled_line)&&isRealObject(group_compiled_line.fill))this.compiledLine=group_compiled_line.createDuplicate();else{var hierarchy=this.getHierarchy();for(var i=0;i<hierarchy.length;++i)if(isRealObject(hierarchy[i])&&isRealObject(hierarchy[i].spPr)&&isRealObject(hierarchy[i].spPr.ln)){this.compiledLine=hierarchy[i].spPr.ln.createDuplicate();break}}}else{var hierarchy=this.getHierarchy();for(var i=0;i<hierarchy.length;++i)if(isRealObject(hierarchy[i])&&isRealObject(hierarchy[i].spPr)&&
|
|
|
|
|
isRealObject(hierarchy[i].spPr.ln)){this.compiledLine=hierarchy[i].spPr.ln.createDuplicate();break}}this.recalcInfo.recalculateLine=false}return this.compiledLine};CShape.prototype.getCompiledTransparent=function(){if(this.recalcInfo.recalculateTransparent){this.compiledTransparent=null;if(isRealObject(this.spPr)&&isRealObject(this.spPr.Fill))if(AscFormat.isRealNumber(this.spPr.Fill.transparent))this.compiledTransparent=this.spPr.Fill.transparent;else if(this.spPr.Fill&&this.spPr.Fill.fill&&this.spPr.Fill.fill.type===
|
|
|
|
|
c_oAscFill.FILL_TYPE_GRP)if(this.group&&this.group.spPr&&this.group.spPr.Fill&&AscFormat.isRealNumber(this.group.spPr.Fill.transparent))this.compiledTransparent=this.group.spPr.Fill.transparent;if(null!==this.compiledTransparent){this.recalcInfo.recalculateTransparent=false;return this.compiledTransparent}if(isRealObject(this.group)){var group_transparent=this.group.getCompiledTransparent();if(AscFormat.isRealNumber(group_transparent))this.compiledTransparent=group_transparent;else{var hierarchy=
|
|
|
|
|
this.getHierarchy();for(var i=0;i<hierarchy.length;++i)if(isRealObject(hierarchy[i])&&isRealObject(hierarchy[i].spPr)&&isRealObject(hierarchy[i].spPr.Fill)&&AscFormat.isRealNumber(hierarchy[i].spPr.Fill.transparent)){this.compiledTransparent=hierarchy[i].spPr.Fill.transparent;break}}}else{var hierarchy=this.getHierarchy();for(var i=0;i<hierarchy.length;++i)if(isRealObject(hierarchy[i])&&isRealObject(hierarchy[i].spPr)&&isRealObject(hierarchy[i].spPr.Fill)&&AscFormat.isRealNumber(hierarchy[i].spPr.Fill.transparent)){this.compiledTransparent=
|
|
|
|
|
hierarchy[i].spPr.Fill.transparent;break}}this.recalcInfo.recalculateTransparent=false}return this.compiledTransparent};CShape.prototype.isPlaceholder=function(){return isRealObject(this.nvSpPr)&&isRealObject(this.nvSpPr.nvPr)&&isRealObject(this.nvSpPr.nvPr.ph)};CShape.prototype.getPlaceholderType=function(){return this.isPlaceholder()?this.nvSpPr.nvPr.ph.type:null};CShape.prototype.getPlaceholderIndex=function(){return this.isPlaceholder()?this.nvSpPr.nvPr.ph.idx:null};CShape.prototype.getPhType=
|
|
|
|
|
function(){return this.isPlaceholder()?this.nvSpPr.nvPr.ph.type:null};CShape.prototype.getPhIndex=function(){return this.isPlaceholder()?this.nvSpPr.nvPr.ph.idx:null};CShape.prototype.setVerticalAlign=function(align){var content_to_add=this.getDocContent();if(!content_to_add)if(!AscFormat.CheckLinePresetForParagraphAdd(this.getPresetGeom()))if(this.bWordShape)this.createTextBoxContent();else this.createTextBody();var new_body_pr=this.getBodyPr();if(new_body_pr){new_body_pr=new_body_pr.createDuplicate();
|
|
|
|
|
new_body_pr.anchor=align;if(this.bWordShape)this.setBodyPr(new_body_pr);else if(this.txBody)this.txBody.setBodyPr(new_body_pr)}};CShape.prototype.setVert=function(vert){var content_to_add=this.getDocContent();if(!content_to_add)if(!AscFormat.CheckLinePresetForParagraphAdd(this.getPresetGeom()))if(this.bWordShape)this.createTextBoxContent();else this.createTextBody();var new_body_pr=this.getBodyPr();if(new_body_pr){new_body_pr=new_body_pr.createDuplicate();new_body_pr.vert=vert;if(this.bWordShape)this.setBodyPr(new_body_pr);
|
|
|
|
|
else if(this.txBody)this.txBody.setBodyPr(new_body_pr)}this.checkExtentsByDocContent&&this.checkExtentsByDocContent()};CShape.prototype.setTextFitType=function(type){if(AscFormat.isRealNumber(type)){var new_body_pr=this.getBodyPr();if(new_body_pr){new_body_pr=new_body_pr.createDuplicate();new_body_pr.textFit=new AscFormat.CTextFit;new_body_pr.textFit.type=type;if(this.bWordShape)this.setBodyPr(new_body_pr);else if(this.txBody)this.txBody.setBodyPr(new_body_pr)}this.checkExtentsByDocContent(true,true)}};
|
|
|
|
|
CShape.prototype.setVertOverflowType=function(type){if(AscFormat.isRealNumber(type)){var new_body_pr=this.getBodyPr();if(new_body_pr){new_body_pr=new_body_pr.createDuplicate();new_body_pr.vertOverflow=type;if(this.bWordShape)this.setBodyPr(new_body_pr);else if(this.txBody)this.txBody.setBodyPr(new_body_pr)}this.checkExtentsByDocContent(true,true)}};CShape.prototype.setPaddings=function(paddings){if(paddings){var new_body_pr=this.getBodyPr();if(new_body_pr){new_body_pr=new_body_pr.createDuplicate();
|
|
|
|
|
if(AscFormat.isRealNumber(paddings.Left))new_body_pr.lIns=paddings.Left;if(AscFormat.isRealNumber(paddings.Top))new_body_pr.tIns=paddings.Top;if(AscFormat.isRealNumber(paddings.Right))new_body_pr.rIns=paddings.Right;if(AscFormat.isRealNumber(paddings.Bottom))new_body_pr.bIns=paddings.Bottom;if(this.bWordShape)this.setBodyPr(new_body_pr);else if(this.txBody)this.txBody.setBodyPr(new_body_pr)}}};CShape.prototype.recalculateTransformText=function(){var oContent=this.getDocContent();if(!oContent)return;
|
|
|
|
|
var oBodyPr=this.getBodyPr();this.clipRect=this.checkTransformTextMatrix(this.localTransformText,oContent,oBodyPr,false);this.transformText=this.localTransformText.CreateDublicate();this.invertTransformText=global_MatrixTransformer.Invert(this.transformText);if(this.txBody&&this.txBody.content2){this.transformText2=new CMatrix;this.clipRect2=this.checkTransformTextMatrix(this.transformText2,this.txBody.content2,oBodyPr,false);this.invertTransformText2=global_MatrixTransformer.Invert(this.transformText2)}var bNoTextNoShape=
|
|
|
|
|
oBodyPr.prstTxWarp&&oBodyPr.prstTxWarp.preset!=="textNoShape";{this.localTransformTextWordArt=new CMatrix;this.checkTransformTextMatrix(this.localTransformTextWordArt,oContent,oBodyPr,bNoTextNoShape,!this.bWordShape&&bNoTextNoShape);this.transformTextWordArt=this.localTransformTextWordArt.CreateDublicate();this.invertTransformTextWordArt=global_MatrixTransformer.Invert(this.transformTextWordArt)}if(this.txBody&&this.txBody.content2){this.checkTransformTextMatrix(this.transformText2,this.txBody.content2,
|
|
|
|
|
oBodyPr,bNoTextNoShape,!this.bWordShape&&bNoTextNoShape);this.transformTextWordArt2=new CMatrix;this.checkTransformTextMatrix(this.transformTextWordArt2,this.txBody.content2,oBodyPr,bNoTextNoShape,!this.bWordShape&&bNoTextNoShape)}if(this.checkPosTransformText)this.checkPosTransformText();if(this.checkContentDrawings)this.checkContentDrawings()};CShape.prototype.getFullFlip=function(){var _transform=this.localTransform;var _full_rotate=this.getFullRotate();var _full_pos_x_lt=_transform.TransformPointX(0,
|
|
|
|
|
0);var _full_pos_y_lt=_transform.TransformPointY(0,0);var _full_pos_x_rt=_transform.TransformPointX(this.extX,0);var _full_pos_y_rt=_transform.TransformPointY(this.extX,0);var _full_pos_x_rb=_transform.TransformPointX(this.extX,this.extY);var _full_pos_y_rb=_transform.TransformPointY(this.extX,this.extY);var _rotate_matrix=new CMatrix;global_MatrixTransformer.RotateRadAppend(_rotate_matrix,_full_rotate);var _rotated_pos_x_lt=_rotate_matrix.TransformPointX(_full_pos_x_lt,_full_pos_y_lt);var _rotated_pos_x_rt=
|
|
|
|
|
_rotate_matrix.TransformPointX(_full_pos_x_rt,_full_pos_y_rt);var _rotated_pos_y_rt=_rotate_matrix.TransformPointY(_full_pos_x_rt,_full_pos_y_rt);var _rotated_pos_y_rb=_rotate_matrix.TransformPointY(_full_pos_x_rb,_full_pos_y_rb);return{flipH:_rotated_pos_x_lt>_rotated_pos_x_rt,flipV:_rotated_pos_y_rt>_rotated_pos_y_rb}};CShape.prototype.recalculateTransformText2=function(){if(this.txBody===null)return;if(!this.txBody.content2)return;this.transformText2=new CMatrix;var _text_transform=this.transformText2;
|
|
|
|
|
var _shape_transform=this.transform;var _body_pr=this.txBody.getBodyPr();var _content_height=this.txBody.getSummaryHeight2();var _l,_t,_r,_b;var _t_x_lt,_t_y_lt,_t_x_rt,_t_y_rt,_t_x_lb,_t_y_lb,_t_x_rb,_t_y_rb;if(this.spPr&&isRealObject(this.spPr.geometry)&&isRealObject(this.spPr.geometry.rect)){var _rect=this.spPr.geometry.rect;_l=_rect.l+_body_pr.lIns;_t=_rect.t+_body_pr.tIns;_r=_rect.r-_body_pr.rIns;_b=_rect.b-_body_pr.bIns}else{_l=_body_pr.lIns;_t=_body_pr.tIns;_r=this.extX-_body_pr.rIns;_b=this.extY-
|
|
|
|
|
_body_pr.bIns}if(_l>=_r){var _c=(_l+_r)*.5;_l=_c-.01;_r=_c+.01}if(_t>=_b){_c=(_t+_b)*.5;_t=_c-.01;_b=_c+.01}_t_x_lt=_shape_transform.TransformPointX(_l,_t);_t_y_lt=_shape_transform.TransformPointY(_l,_t);_t_x_rt=_shape_transform.TransformPointX(_r,_t);_t_y_rt=_shape_transform.TransformPointY(_r,_t);_t_x_lb=_shape_transform.TransformPointX(_l,_b);_t_y_lb=_shape_transform.TransformPointY(_l,_b);_t_x_rb=_shape_transform.TransformPointX(_r,_b);_t_y_rb=_shape_transform.TransformPointY(_r,_b);var _dx_t,
|
|
|
|
|
_dy_t;_dx_t=_t_x_rt-_t_x_lt;_dy_t=_t_y_rt-_t_y_lt;var _dx_lt_rb,_dy_lt_rb;_dx_lt_rb=_t_x_rb-_t_x_lt;_dy_lt_rb=_t_y_rb-_t_y_lt;var _vertical_shift;var _text_rect_height=_b-_t;var _text_rect_width=_r-_l;if(!_body_pr.upright){if(!(_body_pr.vert===AscFormat.nVertTTvert||_body_pr.vert===AscFormat.nVertTTvert270||_body_pr.vert===AscFormat.nVertTTeaVert)){if(true)switch(_body_pr.anchor){case 0:{_vertical_shift=_text_rect_height-_content_height;break}case 1:{_vertical_shift=(_text_rect_height-_content_height)*
|
|
|
|
|
.5;break}case 2:{_vertical_shift=(_text_rect_height-_content_height)*.5;break}case 3:{_vertical_shift=(_text_rect_height-_content_height)*.5;break}case 4:{_vertical_shift=0;break}}else _vertical_shift=0;global_MatrixTransformer.TranslateAppend(_text_transform,0,_vertical_shift);if(_dx_lt_rb*_dy_t-_dy_lt_rb*_dx_t<=0){var alpha=Math.atan2(_dy_t,_dx_t);global_MatrixTransformer.RotateRadAppend(_text_transform,-alpha);global_MatrixTransformer.TranslateAppend(_text_transform,_t_x_lt,_t_y_lt)}else{alpha=
|
|
|
|
|
Math.atan2(_dy_t,_dx_t);global_MatrixTransformer.RotateRadAppend(_text_transform,Math.PI-alpha);global_MatrixTransformer.TranslateAppend(_text_transform,_t_x_rt,_t_y_rt)}}else{if(true)switch(_body_pr.anchor){case 0:{_vertical_shift=_text_rect_width-_content_height;break}case 1:{_vertical_shift=(_text_rect_width-_content_height)*.5;break}case 2:{_vertical_shift=(_text_rect_width-_content_height)*.5;break}case 3:{_vertical_shift=(_text_rect_width-_content_height)*.5;break}case 4:{_vertical_shift=0;
|
|
|
|
|
break}}else _vertical_shift=0;global_MatrixTransformer.TranslateAppend(_text_transform,0,_vertical_shift);var _alpha;_alpha=Math.atan2(_dy_t,_dx_t);if(_body_pr.vert===AscFormat.nVertTTvert||_body_pr.vert===AscFormat.nVertTTeaVert)if(_dx_lt_rb*_dy_t-_dy_lt_rb*_dx_t<=0){global_MatrixTransformer.RotateRadAppend(_text_transform,-_alpha-Math.PI*.5);global_MatrixTransformer.TranslateAppend(_text_transform,_t_x_rt,_t_y_rt)}else{global_MatrixTransformer.RotateRadAppend(_text_transform,Math.PI*.5-_alpha);
|
|
|
|
|
global_MatrixTransformer.TranslateAppend(_text_transform,_t_x_lt,_t_y_lt)}else if(_dx_lt_rb*_dy_t-_dy_lt_rb*_dx_t<=0){global_MatrixTransformer.RotateRadAppend(_text_transform,-_alpha-Math.PI*1.5);global_MatrixTransformer.TranslateAppend(_text_transform,_t_x_lb,_t_y_lb)}else{global_MatrixTransformer.RotateRadAppend(_text_transform,-Math.PI*.5-_alpha);global_MatrixTransformer.TranslateAppend(_text_transform,_t_x_rb,_t_y_rb)}}if(this.spPr&&isRealObject(this.spPr.geometry)&&isRealObject(this.spPr.geometry.rect)){var rect=
|
|
|
|
|
this.spPr.geometry.rect;this.clipRect={x:-1,y:rect.t,w:this.extX+2,h:rect.b-rect.t}}else this.clipRect={x:-1,y:0,w:this.extX+2,h:this.extY}}else{var _full_rotate=this.getFullRotate();var _full_flip=this.getFullFlip();var _hc=this.extX*.5;var _vc=this.extY*.5;var _transformed_shape_xc=this.transform.TransformPointX(_hc,_vc);var _transformed_shape_yc=this.transform.TransformPointY(_hc,_vc);var _content_width,content_height2;if(checkNormalRotate(_full_rotate))if(!(_body_pr.vert===AscFormat.nVertTTvert||
|
|
|
|
|
_body_pr.vert===AscFormat.nVertTTvert270||_body_pr.vert===AscFormat.nVertTTeaVert)){_content_width=_r-_l;content_height2=_b-_t}else{_content_width=_b-_t;content_height2=_r-_l}else if(!(_body_pr.vert===AscFormat.nVertTTvert||_body_pr.vert===AscFormat.nVertTTvert270||_body_pr.vert===AscFormat.nVertTTeaVert)){_content_width=_b-_t;content_height2=_r-_l}else{_content_width=_r-_l;content_height2=_b-_t}if(true)switch(_body_pr.anchor){case 0:{_vertical_shift=content_height2-_content_height;break}case 1:{_vertical_shift=
|
|
|
|
|