/* * Copyright (C) Ascensio System SIA 2012-2021. All rights reserved * * https://www.onlyoffice.com/ * * Version: 0.0.0 (build:0) */ (function(window,undefined){(function(window,undefined){function FileHandler(){this.get=function(file){if(AscCommon.AscBrowser.isAppleDevices){var downloadWindow=window.open(file,"_parent","",false);window.focus()}else var frmWindow=getIFrameWindow(file)};var getIFrameWindow=function(file){var ifr=document.getElementById("fileFrame");if(null!=ifr)document.body.removeChild(ifr);createFrame(file);var wnd=window.frames["fileFrame"];return wnd};var createFrame=function(file){var frame=document.createElement("iframe"); frame.src=file;frame.name="fileFrame";frame.id="fileFrame";frame.style.width="0px";frame.style.height="0px";frame.style.border="0px";frame.style.display="none";document.body.appendChild(frame)}}function getFile(filePath){var fh=new FileHandler;fh.get(filePath)}window["AscCommon"]=window["AscCommon"]||{};window["AscCommon"].getFile=getFile})(window);"use strict";(function(window,undefined){var CellValueType=AscCommon.CellValueType;var c_oAscNumFormatType=Asc.c_oAscNumFormatType;var gc_sFormatDecimalPoint= ".";var gc_sFormatThousandSeparator=",";var LocaleFormatSymbol={};var numFormat_Text=0;var numFormat_TextPlaceholder=1;var numFormat_Bracket=2;var numFormat_Digit=3;var numFormat_DigitNoDisp=4;var numFormat_DigitSpace=5;var numFormat_DecimalPoint=6;var numFormat_DecimalFrac=7;var numFormat_Thousand=8;var numFormat_Scientific=9;var numFormat_Repeat=10;var numFormat_Skip=11;var numFormat_Year=12;var numFormat_Month=13;var numFormat_Minute=14;var numFormat_Hour=15;var numFormat_Day=16;var numFormat_Second= 17;var numFormat_Milliseconds=18;var numFormat_AmPm=19;var numFormat_DateSeparator=20;var numFormat_TimeSeparator=21;var numFormat_DecimalPointText=22;var numFormat_MonthMinute=101;var numFormat_Percent=102;var numFormat_General=103;var numFormat_DigitDrop=104;var numFormat_Plus=105;var numFormat_Minus=106;var numFormat_ThousandText=107;var FormatStates={Decimal:1,Frac:2,Scientific:3,Slash:4,SlashFrac:5};var SignType={Negative:1,Null:2,Positive:3};var gc_nMaxDigCount=15;var gc_nMaxDigCountView=11; var gc_nMaxMantissa=Math.pow(10,gc_nMaxDigCount);var gc_aTimeFormats=["[$-F400]h:mm:ss AM/PM","h:mm;@","h:mm AM/PM;@","h:mm:ss;@","h:mm:ss AM/PM;@","mm:ss.0;@","[h]:mm:ss;@"];var gc_aFractionFormats=["# ?/?","# ??/??","# ???/???","# ?/2","# ?/4","# ?/8","# ??/16","# ?/10","# ??/100"];var NumComporationOperators={equal:1,greater:2,less:3,greaterorequal:4,lessorequal:5,notequal:6};var NumFormatType={Excel:1,WordFieldDate:2,WordFieldNumeric:3};function getNumberParts(x){var sig=SignType.Null;if(!isFinite(x))x= 0;if(x>0)sig=SignType.Positive;else if(x<0){sig=SignType.Negative;x=Math.abs(x)}var exp=-gc_nMaxDigCount;var man=0;if(SignType.Null!=sig){exp=Math.floor(Math.log(x)*Math.LOG10E)-gc_nMaxDigCount+1;man=Math.round(x/Math.pow(10,exp));if(man>=gc_nMaxMantissa){exp++;man/=10}}return{mantissa:man,exponent:exp,sign:sig}}function compareNumbers(val1,val2){var res=0;var parts1=getNumberParts(val1);var parts2=getNumberParts(val2);if(parts1.sign===parts2.sign){if(parts1.exponent===parts2.exponent)res=parts1.mantissa- parts2.mantissa;else res=parts1.exponent-parts2.exponent;if(SignType.Negative===parts1.sign)res=-res}else res=parts1.sign-parts2.sign;return res}function isNumber(n){return!isNaN(parseFloat(n))&&isFinite(n)}function round10(value,exp1,exp2){value=value.toString().split("e");value=Math.round(+(value[0]+"e"+(value[1]?+value[1]+exp1:exp1)));value=value.toString().split("e");return+(value[0]+"e"+(value[1]?+value[1]-exp2:-exp2))}function FormatObj(type,val){this.type=type;this.val=val}function FormatObjScientific(val, format,sign){this.type=numFormat_Scientific;this.val=val;this.format=format;this.sign=sign}function FormatObjDecimalFrac(aLeft,aRight){this.type=numFormat_DecimalFrac;this.aLeft=aLeft;this.aRight=aRight;this.bNumRight=false;this.numerator=0;this.denominator=0}function FormatObjDateVal(type,nCount,bElapsed){this.type=type;this.val=nCount;this.bElapsed=bElapsed}function FormatObjBracket(sData){this.type=numFormat_Bracket;this.val=sData;this.parse=function(data){var length=data.length;if(length>0){var first= data[0];if("$"==first){var aParams=data.substring(1).split("-");if(aParams[0].length>0)this.CurrencyString=aParams[0];if(aParams.length>1&&aParams[1].length>0)this.Lid=aParams[1]}else if("="==first||">"==first||"<"==first){var nIndex=1;var sOperator=first;if(length>1&&(">"==first||"<"==first)){var second=data[1];if("="==second||">"==second&&"<"==first){sOperator+=second;nIndex=2}}switch(sOperator){case "=":this.operator=NumComporationOperators.equal;break;case ">":this.operator=NumComporationOperators.greater; break;case "<":this.operator=NumComporationOperators.less;break;case ">=":this.operator=NumComporationOperators.greaterorequal;break;case "<=":this.operator=NumComporationOperators.lessorequal;break;case "<>":this.operator=NumComporationOperators.notequal;break}this.operatorValue=parseInt(data.substring(nIndex))}else{var sLowerColor=data.toLowerCase();if("black"==sLowerColor)this.color=0;else if("blue"==sLowerColor)this.color=255;else if("cyan"==sLowerColor)this.color=65535;else if("green"==sLowerColor)this.color= 65280;else if("magenta"==sLowerColor)this.color=16711935;else if("red"==sLowerColor)this.color=16711680;else if("white"==sLowerColor)this.color=16777215;else if("yellow"==sLowerColor)this.color=16776960;else if("y"==first||"m"==first||"d"==first||"h"==first||"s"==first||"Y"==first||"M"==first||"D"==first||"H"==first||"S"==first){var bSame=true;var nCount=1;for(var i=1;i=0)this.index=nNewIndex},_addToFormat:function(type,val){var oFormatObj=new FormatObj(type, val);this.aRawFormat.push(oFormatObj)},_addToFormat2:function(oFormatObj){this.aRawFormat.push(oFormatObj)},_ReadText:function(endChar){var sText="";while(true){var next=this._readChar();if(this.EOF==next||endChar==next)break;else sText+=next}this._addToFormat(numFormat_Text,sText)},_GetText:function(len){return this.formatString.substr(this.index,len)},_ReadChar:function(){var next=this._readChar();if(this.EOF!=next)this._addToFormat(numFormat_Text,next)},_ReadBracket:function(){var sBracket=""; while(true){var next=this._readChar();if(this.EOF==next||"]"==next)break;else sBracket+=next}var oFormatObjBracket=new FormatObjBracket(sBracket);if(null!=oFormatObjBracket.operator)this.ComporationOperator=oFormatObjBracket;this._addToFormat2(oFormatObjBracket)},_ReadAmPm:function(next){var sAm=next;var sPm="";var bAm=true;while(true){next=this._readChar();if(this.EOF==next)break;else if("/"==next)bAm=false;else if("A"==next||"a"==next||"P"==next||"p"==next||"M"==next||"m"==next)if(true==bAm)sAm+= next;else sPm+=next;else{this._skip(-1);break}}if(""!=sAm&&""!=sPm){this._addToFormat2(new FormatObj(numFormat_AmPm));this.bTimePeriod=true;this.bDateTime=true}},_parseFormat:function(digitSpaceSymbol,useLocaleFormat){var sGeneral;var DecimalSeparator;var GroupSeparator;var TimeSeparator;var Year;var Month;var Day;var Hour;var year;var month;var day;var hour;var Minute;var minute;var Second;var second;if(useLocaleFormat){sGeneral=LocaleFormatSymbol["general"].toLowerCase();DecimalSeparator=g_oDefaultCultureInfo.NumberDecimalSeparator; TimeSeparator=g_oDefaultCultureInfo.TimeSeparator;GroupSeparator=g_oDefaultCultureInfo.NumberGroupSeparator;Year=LocaleFormatSymbol["Y"];year=LocaleFormatSymbol["y"];Month=LocaleFormatSymbol["M"];month=LocaleFormatSymbol["m"];Day=LocaleFormatSymbol["D"];day=LocaleFormatSymbol["d"];Hour=LocaleFormatSymbol["H"];hour=LocaleFormatSymbol["h"];Minute=LocaleFormatSymbol["Minute"];minute=LocaleFormatSymbol["minute"];Second=LocaleFormatSymbol["S"];second=LocaleFormatSymbol["s"]}else{sGeneral=AscCommon.g_cGeneralFormat.toLowerCase(); DecimalSeparator=gc_sFormatDecimalPoint;TimeSeparator=":";GroupSeparator=gc_sFormatThousandSeparator;Year="Y";year="y";Month="M";month="m";Day="D";day="d";Hour="H";hour="h";Minute="M";minute="m";Second="S";second="s"}var sGeneralFirst=sGeneral[0];this.bGeneralChart=true;while(true){var next=this._readChar();var bNoFormat=false;if(this.EOF==next)break;else if("["==next)this._ReadBracket();else if('"'==next)this._ReadText('"');else if("\\"==next)this._ReadChar();else if("%"==next)this._addToFormat(numFormat_Percent); else if(TimeSeparator==next)this._addToFormat(numFormat_TimeSeparator);else if("0"<=next&&next<="9")this._addToFormat(numFormat_Digit,next-0);else if("#"==next)this._addToFormat(numFormat_DigitNoDisp);else if(digitSpaceSymbol==next)this._addToFormat(numFormat_DigitSpace);else if(DecimalSeparator==next)this._addToFormat(numFormat_DecimalPoint);else if("/"==next)this._addToFormat2(new FormatObjDecimalFrac([],[]));else if(GroupSeparator==next)this._addToFormat(numFormat_Thousand,1);else if("$"==next|| "+"==next||"-"==next||"("==next||")"==next||" "==next)this._addToFormat(numFormat_Text,next);else if(sGeneralFirst===next.toLowerCase()&&sGeneral===(next+this._GetText(sGeneral.length-1)).toLowerCase()){this._addToFormat(numFormat_General);this._skip(sGeneral.length-1)}else if("E"==next||"e"==next){var nextnext=this._readChar();if(this.EOF!=nextnext&&"+"==nextnext||"-"==nextnext){var sign="+"==nextnext?SignType.Positive:SignType.Negative;this._addToFormat2(new FormatObjScientific(next,"",sign))}}else if("*"== next){var nextnext=this._readChar();if(this.EOF!=nextnext)this._addToFormat(numFormat_Repeat,nextnext)}else if("_"==next){var nextnext=this._readChar();if(this.EOF!=nextnext)this._addToFormat(numFormat_Skip,nextnext)}else if("@"==next)this._addToFormat(numFormat_TextPlaceholder);else if(Year==next||year==next)this._addToFormat2(new FormatObjDateVal(numFormat_Year,1,false));else if(Month==next||month==next)if(Month===Minute)this._addToFormat2(new FormatObjDateVal(numFormat_MonthMinute,1,false));else this._addToFormat2(new FormatObjDateVal(numFormat_Month, 1,false));else if(Day==next||day==next)this._addToFormat2(new FormatObjDateVal(numFormat_Day,1,false));else if(Hour==next||hour==next)this._addToFormat2(new FormatObjDateVal(numFormat_Hour,1,false));else if(Minute==next||minute==next)this._addToFormat2(new FormatObjDateVal(numFormat_Minute,1,false));else if(Second==next||second==next)this._addToFormat2(new FormatObjDateVal(numFormat_Second,1,false));else if("A"==next||"a"==next)this._ReadAmPm(next);else{bNoFormat=true;this._addToFormat(numFormat_Text, next)}if(!bNoFormat)this.bGeneralChart=false}return true},_parseFormatWordDateTime:function(){while(true){var next=this._readChar();if(this.EOF==next)break;else if("'"==next)this._ReadText("'");else if("Y"==next||"y"==next)this._addToFormat2(new FormatObjDateVal(numFormat_Year,1,false));else if("M"==next||"m"==next)this._addToFormat2(new FormatObjDateVal(numFormat_MonthMinute,1,false));else if("D"==next||"d"==next)this._addToFormat2(new FormatObjDateVal(numFormat_Day,1,false));else if("H"==next|| "h"==next)this._addToFormat2(new FormatObjDateVal(numFormat_Hour,1,false));else if("S"==next||"s"==next)this._addToFormat2(new FormatObjDateVal(numFormat_Second,1,false));else if("A"==next||"a"==next)this._ReadAmPm(next);else this._addToFormat(numFormat_Text,next)}return true},_parseFormatWordNumeric:function(digitSpaceSymbol){while(true){var next=this._readChar();if(this.EOF==next)break;else if("'"===next)this._ReadText("'");else if("0"===next)this._addToFormat(numFormat_Digit,0);else if(digitSpaceSymbol=== next)this._addToFormat(numFormat_DigitSpace);else if("x"===next||"X"===next)this._addToFormat(numFormat_DigitDrop);else if(gc_sFormatDecimalPoint===next)this._addToFormat(numFormat_DecimalPoint);else if(gc_sFormatThousandSeparator===next)this._addToFormat(numFormat_Thousand,1);else if("+"===next)this._addToFormat(numFormat_Plus);else if("-"===next)this._addToFormat(numFormat_Minus);else this._addToFormat(numFormat_Text,next)}return true},_isDigitType:function(type){return numFormat_Digit===type|| numFormat_DigitNoDisp===type||numFormat_DigitSpace===type||numFormat_DigitDrop===type},_prepareFormat:function(){for(var i=0,length=this.aRawFormat.length;i 0){item.format=aDigitArray;this.bScientific=true}else bAsText=true}if(false!=bAsText){item.type=numFormat_Text;item.val=item.val+"+"}}else if(numFormat_DecimalFrac==item.type){var bValid=false;var nLeft=i;for(var j=i-1;j>=0;--j){var subitem=this.aRawFormat[j];if(this._isDigitType(subitem.type))nLeft=j;else break}var nRight=i;if(nLefti){bValid=true;item.aRight=this.aRawFormat.splice(i+ 1,nRight-i);item.aLeft=this.aRawFormat.splice(nLeft,i-nLeft);nFormatLength-=nRight-nLeft;i-=i-nLeft;this.bSlash=true;var flag=item.aRight.length>0&&item.aRight[0].type==numFormat_Digit&&item.aRight[0].val>0;if(flag){var rPart=0;for(var j=0;j=0;--j){var subItem=this.aRawFormat[j];if(numFormat_Hour==subItem.type){bLeftCond=true;break}else if(numFormat_Second==subItem.type)bFindSec=true;else if(numFormat_Minute==subItem.type||numFormat_Month==subItem.type||numFormat_MonthMinute== subItem.type){if(true==bFindSec&&numFormat_Minute==subItem.type)bFindSec=false;break}else if(numFormat_Year==subItem.type||numFormat_Day==subItem.type||numFormat_Hour==subItem.type||numFormat_Second==subItem.type||numFormat_Milliseconds==subItem.type)if(true==bFindSec)break}if(true==bFindSec)bLeftCond=true}if((true==bLeftCond||true==bRightCond)&&item.val<=2){item.type=numFormat_Minute;this.bTime=true}else{item.type=numFormat_Month;this.bDate=true}}else if(numFormat_Percent==item.type){this.nPercent++; item.type=numFormat_Text;item.val="%"}else if(numFormat_Thousand==item.type){var isPrevDigit=i>0&&this._isDigitType(this.aRawFormat[i-1].type);var isPrevDecimalPoint=i>0&&numFormat_DecimalPoint===this.aRawFormat[i-1].type;var isNextDigit=i+1nKoef)nKoef=nDecLen;if(nRealExp>0&&nKoef>0){var nTemp=nRealExp%nKoef;if(0== nTemp)nTemp=nKoef;nKoef=nTemp}return nKoef},_parseNumber:function(number,aDecFormat,nFracLen,nValType){var res={bDigit:false,dec:0,frac:0,fraction:0,exponent:0,exponentFrac:0,scientific:0,sign:SignType.Positive,date:{}};if(CellValueType.String!=nValType)res.bDigit=number==number-0;if(res.bDigit){var numberAbs=Math.abs(number);res.fraction=numberAbs-Math.floor(numberAbs);var parts=getNumberParts(number);res.sign=parts.sign;var nRealExp=gc_nMaxDigCount+parts.exponent;if(SignType.Null!=parts.sign){if(true== this.bScientific){var nKoef=this._calsScientific(aDecFormat.length,nRealExp);res.scientific=nRealExp-nKoef;nRealExp=nKoef}else{for(var i=0;i0&&nRealExp 0){res.dec=0;res.frac=0;if(nFracLen+nRealExp>0){var sTemp=parts.mantissa.toString();res.frac=sTemp.substring(0,nFracLen+nRealExp)-0}}else{res.dec=0;res.frac=0}else if(nRealExp>=gc_nMaxDigCount){res.dec=parts.mantissa;res.frac=0}else{var sTemp=parts.mantissa.toString();if(this.bSlash==true){res.dec=sTemp.substring(0,nRealExp)-0;if(nRealExp0){res.dec=sTemp.substring(0,nRealExp)-0;res.frac=0;var nStart=nRealExp;var nEnd= nRealExp+nFracLen;if(nStart0&&ttimes[i].val===ttimes[i].coeff;i--){ttimes[i].val=0;ttimes[i-1].val++}var stDate,day,month,year,dayWeek;if(AscCommon.bDate1904){stDate=new Date(Date.UTC(1904,0,1,0,0,0));if(d.val)stDate.setUTCDate(stDate.getUTCDate()+d.val);day=stDate.getUTCDate();dayWeek=stDate.getUTCDay();month=stDate.getUTCMonth();year=stDate.getUTCFullYear()}else if(numberAbs===60){day=29;month=1;year=1900;dayWeek=3}else if(numberAbs=== 0){stDate=new Asc.cDate(Date.UTC(1899,11,31,0,0,0));day=stDate.getUTCDate();dayWeek=stDate.getUTCDay()>0?stDate.getUTCDay()-1:6;month=stDate.getUTCMonth();year=stDate.getUTCFullYear()}else if(numberAbs<60){stDate=new Date(Date.UTC(1899,11,31,0,0,0));if(d.val)stDate.setUTCDate(stDate.getUTCDate()+d.val);day=stDate.getUTCDate();dayWeek=stDate.getUTCDay()>0?stDate.getUTCDay()-1:6;month=stDate.getUTCMonth();year=stDate.getUTCFullYear()}else{stDate=new Date(Date.UTC(1899,11,30,0,0,0));if(d.val)stDate.setUTCDate(stDate.getUTCDate()+ d.val);day=stDate.getUTCDate();dayWeek=stDate.getUTCDay();month=stDate.getUTCMonth();year=stDate.getUTCFullYear()}return{d:day,month:month,year:year,dayWeek:dayWeek,hour:h.val,min:min.val,sec:s.val,ms:ms.val,countDay:d.val}},_FormatNumber:function(number,exponent,format,nReadState,cultureInfo,opt_forceNull){var aRes=[];var nFormatLen=format.length;if(nFormatLen>0)if(FormatStates.Frac!=nReadState&&FormatStates.SlashFrac!=nReadState){var sNumber=number+"";var nNumberLen=sNumber.length;if(exponent>nNumberLen){for(var i= 0;inFormatLen){if(false===bIsNUll){var item=format.shift();if(numFormat_DigitDrop!==item.type){var nSplitIndex=nNumberLen-nFormatLen+1;aRes.push(new FormatObj(numFormat_Text,sNumber.slice(0,nSplitIndex)));sNumber=sNumber.substring(nSplitIndex)}else sNumber=sNumber.substring(nNumberLen-nFormatLen)}}else if(nNumberLen=0;--i){var item=aRes[i];if(numFormat_Text==item.type){var aNewText=[];var nTextLength=item.val.length;for(var j=nTextLength-1;j>=0;--j){if(nCurGroupSize==nIndex){aNewText.push(sThousandSep);nTextLength++}aNewText.push(item.val[j]);if(0!=j){nIndex++; if(nCurGroupSize+1==nIndex){nIndex=1;if(nCurGroupIndex1)aNewText.reverse();item.val=aNewText.join("")}else if(numFormat_DigitNoDisp!=item.type)if(nCurGroupSize==nIndex){item.val=sThousandSep;aRes[i]=item}nIndex++;if(nCurGroupSize+1==nIndex){nIndex=1;if(nCurGroupIndex=0;--i){if("0"!=sNumber[i])break;nLastNoNull=i}if(nLastNoNull0){this._CommitText(res,null,oCurText.text,null);oCurText.text=""}if(null!=textVal&&textVal.length>0){var length=res.length;var prev=null;if(length>0)prev=res[length-1];if(-1!=this.Color){if(null==format)format=new AscCommonExcel.Font;format.c=new AscCommonExcel.RgbColor(this.Color)}if(null!= prev&&(null==prev.format&&null==format||null!=prev.format&&null!=format&&format.isEqual(prev.format)))prev.text+=textVal;else{if(null==format)prev={text:textVal};else prev={text:textVal,format:format};res.push(prev)}}},setFormat:function(format,cultureInfo,formatType,useLocaleFormat){if(null==cultureInfo)cultureInfo=g_oDefaultCultureInfo;this.formatString=format;this.length=this.formatString.length;if(NumFormatType.WordFieldDate===formatType)this.valid=this._parseFormatWordDateTime();else if(NumFormatType.WordFieldNumeric=== formatType)this.valid=this._parseFormatWordNumeric("#");else this.valid=this._parseFormat("?",useLocaleFormat);if(true==this.valid){this.valid=this._prepareFormat();if(this.valid){var aCurrencySymbols=["$","\u20ac","\u00a3","\u00a5","\u0440.",cultureInfo.CurrencySymbol];var sText="";for(var i=0,length=this.aRawFormat.length;i2958465.9999884)}, _applyGeneralFormat:function(number,nValType,dDigitsCount,bChart,cultureInfo){var res=null;var sGeneral=DecodeGeneralFormat(number,nValType,dDigitsCount);if(null!=sGeneral){var numFormat=oNumFormatCache.get(sGeneral);if(null!=numFormat)res=numFormat.format(number,nValType,dDigitsCount,bChart,cultureInfo,true)}if(!res)res=[{text:number.toString()}];if(-1!=this.Color)for(var i=0;i0){var denominatorLen=Math.min(7,item.aRight.length);var denominatorBound=Math.pow(10,denominatorLen);var an=Math.floor(frac);var xn1=frac-an;var pn1=an;var qn1= 1;var pn2=1;var qn2=0;do{an=Math.floor(1/xn1);xn1=1/xn1-an;var pn=an*pn1+pn2;var qn=an*qn1+qn2;pn2=pn1;pn1=pn;qn2=qn1;qn1=qn}while(qn0&&item.denominator>0||curForceNull)oCurText.text+="/";else{var oNewFont=new AscCommonExcel.Font;oNewFont.skip=true;this._CommitText(res,oCurText,"/",oNewFont)}if(item.bNumRight===true){var rightVal=item.aRight[0].val;if(rightVal)if(item.denominator>0)oCurText.text+=rightVal;else for(var rightIdx=0;rightIdx0)if(item.val<=2)oCurText.text+=(oParsedNumber.date.year+"").substring(2);else oCurText.text+=oParsedNumber.date.year}else if(numFormat_Month==item.type){var m=oParsedNumber.date.month;if(item.val==1)oCurText.text+=m+1; else if(item.val==2)oCurText.text+=this._ZeroPad(m+1);else if(item.val==3)if(this.bDay&&cultureInfoLCID.AbbreviatedMonthGenitiveNames.length>0)oCurText.text+=cultureInfoLCID.AbbreviatedMonthGenitiveNames[m];else oCurText.text+=cultureInfoLCID.AbbreviatedMonthNames[m];else if(item.val==5){var sMonthName=cultureInfoLCID.MonthNames[m];if(sMonthName.length>0)oCurText.text+=sMonthName[0]}else if(item.val>0)if(this.bDay&&cultureInfoLCID.MonthGenitiveNames.length>0)oCurText.text+=cultureInfoLCID.MonthGenitiveNames[m]; else oCurText.text+=cultureInfoLCID.MonthNames[m]}else if(numFormat_Day==item.type)if(item.val==1)oCurText.text+=oParsedNumber.date.d;else if(item.val==2)oCurText.text+=this._ZeroPad(oParsedNumber.date.d);else if(item.val==3)oCurText.text+=cultureInfoLCID.AbbreviatedDayNames[oParsedNumber.date.dayWeek];else{if(item.val>0)oCurText.text+=cultureInfoLCID.DayNames[oParsedNumber.date.dayWeek]}else if(numFormat_Hour==item.type){var h=oParsedNumber.date.hour;if(item.bElapsed===true)h=oParsedNumber.date.countDay* 24+oParsedNumber.date.hour;if(this.bTimePeriod===true)h=h%12||12;if(item.val==1)oCurText.text+=h;else if(item.val>0)oCurText.text+=this._ZeroPad(h)}else if(numFormat_Minute==item.type){var min=oParsedNumber.date.min;if(item.bElapsed===true)min=oParsedNumber.date.countDay*24*60+oParsedNumber.date.hour*60+oParsedNumber.date.min;if(item.val==1)oCurText.text+=min;else if(item.val>0)oCurText.text+=this._ZeroPad(min)}else if(numFormat_Second==item.type){var s=oParsedNumber.date.sec;if(this.bMillisec=== false)s=oParsedNumber.date.sec+Math.round(oParsedNumber.date.ms/1E3);if(item.bElapsed===true)s=oParsedNumber.date.countDay*24*60*60+oParsedNumber.date.hour*60*60+oParsedNumber.date.min*60+s;if(item.val==1)oCurText.text+=s;else if(item.val>0)oCurText.text+=this._ZeroPad(s)}else if(numFormat_AmPm==item.type)if(cultureInfoLCID.AMDesignator.length>0&&cultureInfoLCID.PMDesignator.length>0)oCurText.text+=oParsedNumber.date.hour<12?cultureInfoLCID.AMDesignator:cultureInfoLCID.PMDesignator;else oCurText.text+= oParsedNumber.date.hour<12?"AM":"PM";else if(numFormat_Milliseconds==item.type){var nMsFormatLength=item.format.length;var dMs=oParsedNumber.date.ms;if(nMsFormatLength<3){var dTemp=dMs/Math.pow(10,3-nMsFormatLength);dTemp=Math.round(dTemp);dMs=dTemp*Math.pow(10,3-nMsFormatLength)}var nExponent=0;if(0==dMs)nExponent=-1;else if(dMs<10)nExponent=-2;else if(dMs<100)nExponent=-1;var aMilSec=this._FormatNumber(dMs,nExponent,item.format.concat(),FormatStates.Frac,cultureInfo);for(var k=0;k0)oCurText.text+="+";else if(number<0)oCurText.text+="-";else oCurText.text+=" "}else if(numFormat_Minus==item.type){hasSign=true;if(number<0)oCurText.text+="-";else oCurText.text+=" "}}if(true==this.bAddMinusIfNes&&SignType.Negative==oParsedNumber.sign&& !hasSign)res.unshift({text:"-"});this._CommitText(res,oCurText,null,null);if(0==res.length)res=[{text:""}]}else if(0==res.length)res=[{text:number.toString()}];var nLen=0;for(var i=0;iAsc.c_oAscMaxColumnWidth){var oNewFont=new AscCommonExcel.Font;oNewFont.repeat=true;res=[{text:"#",format:oNewFont}]}return res},shiftFormat:function(output,nShift,useLocaleFormat){if(this.bDateTime||this.bSlash||this.bTextFormat||nShift<0&& 0==this.aFracFormat.length)return false;output.format=this.toString(nShift,useLocaleFormat);return true},toString:function(nShift,useLocaleFormat){var sGeneral;var DecimalSeparator;var GroupSeparator;var TimeSeparator;var year;var month;var day;var hour;var minute;var second;if(useLocaleFormat){sGeneral=LocaleFormatSymbol["general"];DecimalSeparator=g_oDefaultCultureInfo.NumberDecimalSeparator;TimeSeparator=g_oDefaultCultureInfo.TimeSeparator;GroupSeparator=g_oDefaultCultureInfo.NumberGroupSeparator; if(LocaleFormatSymbol["M"]===LocaleFormatSymbol["m"]){year=LocaleFormatSymbol["Y"];month=LocaleFormatSymbol["M"];day=LocaleFormatSymbol["D"]}else{year=LocaleFormatSymbol["y"];month=LocaleFormatSymbol["m"];day=LocaleFormatSymbol["d"]}hour=LocaleFormatSymbol["h"];minute=LocaleFormatSymbol["minute"];second=LocaleFormatSymbol["s"]}else{sGeneral=AscCommon.g_cGeneralFormat;DecimalSeparator=gc_sFormatDecimalPoint;TimeSeparator=":";GroupSeparator=gc_sFormatThousandSeparator;year="y";month="m";day="d";hour= "h";minute="m";second="s"}var nDecLength=this.aDecFormat.length;var nDecIndex=0;var nFracLength=this.aFracFormat.length;var nFracIndex=0;var nNewFracLength=nFracLength+nShift;if(nNewFracLength<0)nNewFracLength=0;var nReadState=FormatStates.Decimal;var res="";var fFormatToString=function(aFormat){var res="";for(var i=0,length=aFormat.length;inNewFracLength);else{var sCurSimbol;if(numFormat_Digit==item.type)sCurSimbol="0";else if(numFormat_DigitNoDisp==item.type)sCurSimbol="#";else if(numFormat_DigitSpace==item.type)sCurSimbol="?";else if(numFormat_DigitDrop==item.type)sCurSimbol="x";res+=sCurSimbol; if(nReadState==FormatStates.Frac&&nFracIndex==nFracLength)for(var j=0;j0&&FormatStates.Decimal==nReadState&&nDecIndex==nDecLength){res+=gc_sFormatDecimalPoint;for(var j=0;j0&&1===formatTail[0].length%2&&i+10){var oFirstFormat=aParsedFormats[0];if(null!=oFirstFormat.ComporationOperator){bComporationOperator= true;if(3==nFormatsLength){var oPositive=null;var oNegative=null;var oNull=null;for(var i=0;ioComporationOperator.operatorValue&&(oComporationOperator.operator==NumComporationOperators.greater||oComporationOperator.operator==NumComporationOperators.greaterorequal))oCurFormat.bAddMinusIfNes=true}}this.aComporationFormats=aParsedFormats}else{this.oPositiveFormat= oPositive;this.oNegativeFormat=oNegative;this.oNullFormat=oNull}}}if(false==bComporationOperator)if(4<=nFormatsLength){this.oPositiveFormat=aParsedFormats[0];this.oNegativeFormat=aParsedFormats[1];this.oNullFormat=aParsedFormats[2];this.oTextFormat=aParsedFormats[3];this.oTextFormat.bTextFormat=true}else if(3==nFormatsLength){this.oPositiveFormat=aParsedFormats[0];this.oNegativeFormat=aParsedFormats[1];this.oNullFormat=aParsedFormats[2];this.oTextFormat=this.oPositiveFormat;if(this.oNullFormat.bTextFormat){this.oTextFormat= this.oNullFormat;this.oNullFormat=this.oPositiveFormat}}else if(2==nFormatsLength){this.oPositiveFormat=aParsedFormats[0];this.oNegativeFormat=aParsedFormats[1];this.oNullFormat=this.oPositiveFormat;this.oTextFormat=this.oPositiveFormat;if(this.oNegativeFormat.bTextFormat){this.oTextFormat=this.oNegativeFormat;this.oNegativeFormat=this.oPositiveFormat;this.oPositiveFormat.bAddMinusIfNes=true}}else{this.oPositiveFormat=aParsedFormats[0];this.oPositiveFormat.bAddMinusIfNes=true;this.oNegativeFormat= this.oPositiveFormat;this.oNullFormat=this.oPositiveFormat;this.oTextFormat=this.oPositiveFormat}this.formatCache={}}CellFormat.prototype={isTextFormat:function(){if(null!=this.oPositiveFormat)return this.oPositiveFormat.bTextFormat;else if(null!=this.aComporationFormats&&this.aComporationFormats.length>0)return this.aComporationFormats[0].bTextFormat;return false},isGeneralFormat:function(){if(null!=this.oPositiveFormat)return this.oPositiveFormat.isGeneral();else if(null!=this.aComporationFormats&& this.aComporationFormats.length>0)return this.aComporationFormats[0].isGeneral();return false},isDateTimeFormat:function(){if(null!=this.oPositiveFormat)return this.oPositiveFormat.bDateTime;else if(null!=this.aComporationFormats&&this.aComporationFormats.length>0)return this.aComporationFormats[0].bDateTime;return false},getTextFormat:function(){var oRes=null;if(null==this.aComporationFormats){if(null!=this.oTextFormat&&this.oTextFormat.bTextFormat)oRes=this.oTextFormat}else for(var i=0,length=this.aComporationFormats.length;i< length;++i){var oCurFormat=this.aComporationFormats[i];if(null==oCurFormat.ComporationOperator&&oCurFormat.bTextFormat){oRes=oCurFormat;break}}return oRes},getFormatByValue:function(dNumber){var oRes=null;if(null==this.aComporationFormats)if(dNumber>0&&null!=this.oPositiveFormat)oRes=this.oPositiveFormat;else if(dNumber<0&&null!=this.oNegativeFormat)oRes=this.oNegativeFormat;else{if(null!=this.oNullFormat)oRes=this.oNullFormat}else{var nLength=this.aComporationFormats.length;var oDefaultComporationFormat= null;for(var i=0,length=nLength;ioOperationValue;break;case NumComporationOperators.less:bOperationResult=dNumber=oOperationValue;break;case NumComporationOperators.lessorequal:bOperationResult=dNumber<=oOperationValue;break;case NumComporationOperators.notequal:bOperationResult=dNumber!=oOperationValue;break}if(true==bOperationResult)oRes=oCurFormat}else if(null==oDefaultComporationFormat)oDefaultComporationFormat=oCurFormat}if(null==oRes&&null!=oDefaultComporationFormat)oRes=oDefaultComporationFormat}return oRes},format:function(number, nValType,dDigitsCount,bChart,cultureInfo,opt_withoutCache,opt_forceNull){var res=null;if(null==bChart)bChart=false;var lcid=cultureInfo?cultureInfo.LCID:0;var cacheKey,cacheVal;if(!opt_withoutCache){cacheKey=number+"-"+nValType+"-"+dDigitsCount+"-"+lcid;cacheVal=this.formatCache[cacheKey];if(null!=cacheVal){if(bChart)res=cacheVal.chart;else res=cacheVal.nochart;if(null!=res)return res}}res=[{text:number.toString()}];var dNumber=number-0;var oFormat=null;if(CellValueType.String!=nValType&&number== dNumber){oFormat=this.getFormatByValue(dNumber);if(null!=oFormat)res=oFormat.format(number,nValType,dDigitsCount,cultureInfo,bChart,opt_forceNull);else if(null!=this.aComporationFormats){var oNewFont=new AscCommonExcel.Font;oNewFont.repeat=true;res=[{text:"#",format:oNewFont}]}}else if(null!=this.oTextFormat){oFormat=this.oTextFormat;res=oFormat.format(number,nValType,dDigitsCount,cultureInfo,bChart,opt_forceNull)}if(!opt_withoutCache){if(null==cacheVal){cacheVal={chart:null,nochart:null};this.formatCache[cacheKey]= cacheVal}if(null!=oFormat&&oFormat.bGeneralChart)if(bChart)cacheVal.chart=res;else cacheVal.nochart=res;else{cacheVal.chart=res;cacheVal.nochart=res}}return res},shiftFormat:function(output,nShift,useLocaleFormat){var bRes=false;var bCurRes=true;if(null==this.aComporationFormats){bCurRes=this.oPositiveFormat.shiftFormat(output,nShift,useLocaleFormat);if(false==bCurRes)output.format=this.oPositiveFormat.formatString;bRes|=bCurRes;if(null!=this.oNegativeFormat&&this.oPositiveFormat!=this.oNegativeFormat){var oTempOutput= {};bCurRes=this.oNegativeFormat.shiftFormat(oTempOutput,nShift,useLocaleFormat);if(false==bCurRes)output.format+=";"+this.oNegativeFormat.formatString;else output.format+=";"+oTempOutput.format;bRes|=bCurRes}if(null!=this.oNullFormat&&this.oPositiveFormat!=this.oNullFormat){var oTempOutput={};bCurRes=this.oNullFormat.shiftFormat(oTempOutput,nShift,useLocaleFormat);if(false==bCurRes)output.format+=";"+this.oNullFormat.formatString;else output.format+=";"+oTempOutput.format;bRes|=bCurRes}if(null!=this.oTextFormat&& this.oPositiveFormat!=this.oTextFormat){var oTempOutput={};bCurRes=this.oTextFormat.shiftFormat(oTempOutput,nShift,useLocaleFormat);if(false==bCurRes)output.format+=";"+this.oTextFormat.formatString;else output.format+=";"+oTempOutput.format;bRes|=bCurRes}}else{var length=this.aComporationFormats.length;output.format="";for(var i=0;i0){info=this.aComporationFormats[0].getFormatCellsInfo();info.asc_setType(this._getType(this.aComporationFormats[0]))}else{info= new Asc.asc_CFormatCellsInfo;info.asc_setType(c_oAscNumFormatType.General);info.asc_setDecimalPlaces(0);info.asc_setSeparator(false);info.asc_setSymbol(null)}return info},_getType:function(format){var nType=c_oAscNumFormatType.Custom;if(format.isGeneral())nType=c_oAscNumFormatType.General;else if(format.bDateTime)if(format.bDate)nType=c_oAscNumFormatType.Date;else nType=c_oAscNumFormatType.Time;else if(format.bCurrency)if(format.bRepeat)nType=c_oAscNumFormatType.Accounting;else nType=c_oAscNumFormatType.Currency; else{var info=format.getFormatCellsInfo();var types=[c_oAscNumFormatType.Text,c_oAscNumFormatType.Percent,c_oAscNumFormatType.Scientific,c_oAscNumFormatType.Number,c_oAscNumFormatType.Fraction,c_oAscNumFormatType.Currency,c_oAscNumFormatType.Accounting];for(var i=0;igc_nMaxDigCountView)nDigitsCount=gc_nMaxDigCountView;else nDigitsCount=parseInt(dDigitsCount); if(number<0)number=-number;if(nDigitsCount<1)return"0";var bContinue=true;var parts=getNumberParts(number);while(bContinue){bContinue=false;var nRealExp=gc_nMaxDigCount+parts.exponent;var nRealExpAbs=Math.abs(nRealExp);var nExpMinDigitsCount;if(nRealExpAbs<100)nExpMinDigitsCount=4;else nExpMinDigitsCount=2+nRealExpAbs.toString().length;var suffix="";if(nRealExp>0){if(nRealExp>nDigitsCount)if(nDigitsCount>=nExpMinDigitsCount+1){suffix="E+";for(var i=2;i2)nVarian2--;else if(nVarian2>0)nVarian2=1;if(nVarian1<=0&&nVarian2<=0)return"0";if(nVarian10&&0==parts.mantissa%Math.pow(10,gc_nMaxDigCount-nVarian1))bUseVarian1=true;if(false==bUseVarian1)if(nDigitsCount>=nExpMinDigitsCount+1){suffix="E+";for(var i=2;i0)nRoundDigCount=nTemp}else if(dec_num_digits0){var nTemp=Math.pow(10,gc_nMaxDigCount-nRoundDigCount);number=Math.round(parts.mantissa/nTemp)*nTemp*Math.pow(10,parts.exponent);var oNewParts=getNumberParts(number); if(oNewParts.exponent!=parts.exponent)bContinue=true;else bContinue=false;parts=oNewParts}}var frac_num_digits;if(dec_num_digits>0)frac_num_digits=nDigitsCount-1-dec_num_digits;else frac_num_digits=nDigitsCount-2+dec_num_digits;if(frac_num_digits>0){var sTempNumber=parts.mantissa.toString();var sTempNumber;if(dec_num_digits>0)sTempNumber=sTempNumber.substring(dec_num_digits,dec_num_digits+frac_num_digits);else sTempNumber=sTempNumber.substring(0,frac_num_digits);var nTempNumberLength=sTempNumber.length; var nreal_frac_num_digits=frac_num_digits;for(var i=frac_num_digits-1;i>=0;--i)if("0"==sTempNumber[i])nreal_frac_num_digits--;else break;frac_num_digits=nreal_frac_num_digits;if(dec_num_digits<0)frac_num_digits+=-dec_num_digits}if(frac_num_digits<=0)return"0"+suffix;var number_format_string="0"+gc_sFormatDecimalPoint;for(var i=0;i=0)if(nRealExp<=21){sRes=parts.mantissa.toString();for(var i=0;i1){var temp= sRes.substring(0,1);temp+=cultureInfo.NumberDecimalSeparator;temp+=sRes.substring(1);sRes=temp}sRes+="E+"+(nRealExp-1)}else if(nRealExp>0){sRes=parts.mantissa.toString();if(sRes.length>nRealExp){var temp=sRes.substring(0,nRealExp);temp+=cultureInfo.NumberDecimalSeparator;temp+=sRes.substring(nRealExp);sRes=temp}sRes=this._removeTileZeros(sRes,cultureInfo)}else if(nRealExp>=-18){sRes="0";sRes+=cultureInfo.NumberDecimalSeparator;for(var i=0;i<-nRealExp;++i)sRes+="0";var sTemp=parts.mantissa.toString(); sTemp=sTemp.substring(0,19+nRealExp);sRes+=this._removeTileZeros(sTemp,cultureInfo)}else{sRes=parts.mantissa.toString();if(sRes.length>1){var temp=sRes.substring(0,1);temp+=cultureInfo.NumberDecimalSeparator;temp+=sRes.substring(1);temp=this._removeTileZeros(temp,cultureInfo);sRes=temp}sRes+="E-"+(1-nRealExp)}if(SignType.Negative==parts.sign)value="-"+sRes;else value=sRes}this.oCache[number]=value}return value},_removeTileZeros:function(val,cultureInfo){var res=val;var nLength=val.length;var nLastNoZero= nLength-1;for(var i=val.length-1;i>=0;--i){nLastNoZero=i;if("0"!=val[i])break}if(nLastNoZero!=nLength-1)if(cultureInfo.NumberDecimalSeparator==res[nLastNoZero])res=res.substring(0,nLastNoZero);else res=res.substring(0,nLastNoZero+1);return res}};var oGeneralEditFormatCache=new GeneralEditFormatCache;function FormatParser(){this.days=[31,28,31,30,31,30,31,31,30,31,30,31];this.daysLeap=[31,29,31,30,31,30,31,31,30,31,30,31]}FormatParser.prototype={isLocaleNumber:function(val,cultureInfo){if(null==cultureInfo)cultureInfo= g_oDefaultCultureInfo;if("."!=cultureInfo.NumberDecimalSeparator){val=val.replace(".","q");val=val.replace(cultureInfo.NumberDecimalSeparator,".")}return AscCommonExcel.parseNum(val)&&Asc.isNumberInfinity(val)},parseLocaleNumber:function(val,cultureInfo){if(null==cultureInfo)cultureInfo=g_oDefaultCultureInfo;if("."!=cultureInfo.NumberDecimalSeparator){val=val.replace(".","q");val=val.replace(cultureInfo.NumberDecimalSeparator,".")}return val-0},parse:function(value,cultureInfo){if(null==cultureInfo)cultureInfo= g_oDefaultCultureInfo;var res=null;var bError=false;if(" "==cultureInfo.NumberGroupSeparator)value=value.replace(new RegExp(String.fromCharCode(160),"g"));var rx_thouthand=new RegExp("^(([ \\+\\-%\\$\u20ac\u00a3\u00a5\\(]|"+escapeRegExp(cultureInfo.CurrencySymbol)+")*)((\\d+"+escapeRegExp(cultureInfo.NumberGroupSeparator)+"\\d+)*\\d*"+escapeRegExp(cultureInfo.NumberDecimalSeparator)+"?\\d*)(([ %\\)]|\u0440.|"+escapeRegExp(cultureInfo.CurrencySymbol)+")*)$");var match=value.match(rx_thouthand);if(null!= match){var sBefore=match[1];var sVal=match[3];var sAfter=match[5];var oChartCount={};if(null!=sBefore)this._parseStringLetters(sBefore,cultureInfo.CurrencySymbol,true,oChartCount);if(null!=sAfter)this._parseStringLetters(sAfter,cultureInfo.CurrencySymbol,false,oChartCount);var bMinus=false;var bPercent=false;var sCurrency=null;var oCurrencyElem=null;var nBracket=0;for(var sChar in oChartCount){var elem=oChartCount[sChar];if(" "==sChar)continue;else if("+"==sChar){if(elem.all>1)bError=true}else if("-"== sChar)if(elem.all>1)bError=true;else bMinus=true;else if("-"==sChar)if(elem.all>1)bError=true;else bMinus=true;else if("("==sChar)if(1==elem.all&&1==elem.before)nBracket++;else bError=true;else if(")"==sChar)if(1==elem.all&&1==elem.after)nBracket++;else bError=true;else if("%"==sChar)if(1==elem.all)bPercent=true;else bError=true;else if(null==sCurrency&&1==elem.all){sCurrency=sChar;oCurrencyElem=elem}else bError=true}if(nBracket>0)if(2==nBracket)bMinus=true;else bError=true;var CurrencyNegativePattern= cultureInfo.CurrencyNegativePattern;if(null!=sCurrency)if(sCurrency==cultureInfo.CurrencySymbol){var nPattern=cultureInfo.CurrencyNegativePattern;if(0==nPattern||1==nPattern||2==nPattern||3==nPattern||9==nPattern||11==nPattern||12==nPattern||14==nPattern){if(1!=oCurrencyElem.before)bError=true}else if(1!=oCurrencyElem.after)bError=true}else if(-1!="$\u20ac\u00a3\u00a5".indexOf(sCurrency))if(1==oCurrencyElem.before)CurrencyNegativePattern=0;else bError=true;else if(-1!="\u0440.".indexOf(sCurrency))if(1== oCurrencyElem.after)CurrencyNegativePattern=5;else bError=true;else bError=true;if(!bError){var oVal=this._parseThouthand(sVal,cultureInfo);if(oVal){res={format:null,value:null,bDateTime:false,bDate:false,bTime:false,bPercent:false,bCurrency:false};var dVal=oVal.number;if(bMinus)dVal=-dVal;var sFracFormat="";if(parseInt(dVal)!=dVal)sFracFormat=gc_sFormatDecimalPoint+"00";var sFormat=null;if(bPercent){res.bPercent=true;dVal/=100;sFormat="0"+sFracFormat+"%"}else if(sCurrency){res.bCurrency=true;var sNumberFormat= "#"+gc_sFormatThousandSeparator+"##0"+sFracFormat;var sCurrencyFormat;if(sCurrency.length>1)sCurrencyFormat='"'+sCurrency+'"';else sCurrencyFormat="\\"+sCurrency;var sPositivePattern;var sNegativePattern;switch(CurrencyNegativePattern){case 0:sPositivePattern=sCurrencyFormat+sNumberFormat+"_)";sNegativePattern="[Red]("+sCurrencyFormat+sNumberFormat+")";break;case 1:sPositivePattern=sCurrencyFormat+sNumberFormat;sNegativePattern="[Red]-"+sCurrencyFormat+sNumberFormat;break;case 2:sPositivePattern= sCurrencyFormat+sNumberFormat;sNegativePattern="[Red]"+sCurrencyFormat+"-"+sNumberFormat;break;case 3:sPositivePattern=sCurrencyFormat+sNumberFormat+"_-";sNegativePattern="[Red]"+sCurrencyFormat+sNumberFormat+"-";break;case 4:sPositivePattern=sNumberFormat+sCurrencyFormat+"_)";sNegativePattern="[Red]("+sNumberFormat+sCurrencyFormat+")";break;case 5:sPositivePattern=sNumberFormat+sCurrencyFormat;sNegativePattern="[Red]-"+sNumberFormat+sCurrencyFormat;break;case 6:sPositivePattern=sNumberFormat+"-"+ sCurrencyFormat;sNegativePattern="[Red]"+sNumberFormat+"-"+sCurrencyFormat;break;case 7:sPositivePattern=sNumberFormat+sCurrencyFormat+"_-";sNegativePattern="[Red]"+sNumberFormat+sCurrencyFormat+"-";break;case 8:sPositivePattern=sNumberFormat+" "+sCurrencyFormat;sNegativePattern="[Red]-"+sNumberFormat+" "+sCurrencyFormat;break;case 9:sPositivePattern=sCurrencyFormat+" "+sNumberFormat;sNegativePattern="[Red]-"+sCurrencyFormat+" "+sNumberFormat;break;case 10:sPositivePattern=sNumberFormat+" "+sCurrencyFormat+ "_-";sNegativePattern="[Red]"+sNumberFormat+" "+sCurrencyFormat+"-";break;case 11:sPositivePattern=sCurrencyFormat+" "+sNumberFormat+"_-";sNegativePattern="[Red]"+sCurrencyFormat+" "+sNumberFormat+"-";break;case 12:sPositivePattern=sCurrencyFormat+" "+sNumberFormat;sNegativePattern="[Red]"+sCurrencyFormat+" -"+sNumberFormat;break;case 13:sPositivePattern=sNumberFormat+" "+sCurrencyFormat;sNegativePattern="[Red]"+sNumberFormat+"- "+sCurrencyFormat;break;case 14:sPositivePattern=sCurrencyFormat+" "+ sNumberFormat+"_)";sNegativePattern="[Red]("+sCurrencyFormat+" "+sNumberFormat+")";break;case 15:sPositivePattern=sNumberFormat+" "+sCurrencyFormat+"_)";sNegativePattern="[Red]("+sNumberFormat+" "+sCurrencyFormat+")";break}sFormat=sPositivePattern+";"+sNegativePattern}else if(oVal.thouthand)sFormat="#"+gc_sFormatThousandSeparator+"##0"+sFracFormat;else sFormat=AscCommon.g_cGeneralFormat;res.format=sFormat;res.value=dVal}}}if(null==res&&!bError)res=this.parseDate(value,cultureInfo);return res},_parseStringLetters:function(sVal, currencySymbol,bBefore,oRes){var aTemp=["\u0440.",currencySymbol];for(var i=0,length=aTemp.length;i0){sVal=sVal.replace(new RegExp(escapeRegExp(sChar),"g"),"");var elem=oRes[sChar];if(!elem){elem={before:0,after:0,all:0};oRes[sChar]=elem}if(bBefore)elem.before+=nCount;else elem.after+=nCount;elem.all+=nCount}}for(var i=0,length=sVal.length;i=0;--i)sReverseVal+=val[i];var nGroupSizeIndex=0;var nGroupSize=cultureInfo.NumberGroupSizes[nGroupSizeIndex];var nPrevIndex=0;var nIndex=-1;var bError=false;while(-1!=(nIndex=sReverseVal.indexOf(cultureInfo.NumberGroupSeparator,nIndex+1))){var nCurLength= nIndex-nPrevIndex;if(nCurLength0){val=val.replace(new RegExp(escapeRegExp(cultureInfo.NumberGroupSeparator),"g"),"");bThouthand=true}if(g_oFormatParser.isLocaleNumber(val,cultureInfo)){var dNumber=g_oFormatParser.parseLocaleNumber(val, cultureInfo);oRes={number:dNumber,thouthand:bThouthand}}}return oRes},_parseDateFromArray:function(match,oDataTypes,cultureInfo){var res=null;var bError=false;for(var i=0,length=match.length;i=0&&i+1=0&&i+1==length){var prev=match[i-1];if(prev.type!=oDataTypes.delimiter)if(cultureInfo.TimeSeparator==elem.val||":"==elem.val&&cultureInfo.DateSeparator!=elem.val)if(false==prev.date){bError=false;prev.time=true}}if(bError)break}}if(!bError)for(var i=0,length=match.length;i=0){var prev=match[i-1];if(oDataTypes.digit==prev.type&&false==prev.date)prev.time=true}if(i+1!=length)bError=true}else if(null!=elem.month){if(i-1>=0){var prev=match[i-1];if(oDataTypes.digit==prev.type&&false==prev.time)prev.date=true}if(i+10&&!(2<=nDateLength&&nDateLength<=3&&(null==nMonthIndex||3==nDateLength&&1==nMonthIndex||2==nDateLength)))bError=true;var nTimeLength=aTime.length;if(nTimeLength>3)bError=true;if(!bError){res={d:null,m:null,y:null,h:null,min:null,s:null,am:am,pm:pm,sDateFormat:null};if(nDateLength>0){var nIndexD=Math.max(cultureInfo.ShortDatePattern.indexOf("0"),cultureInfo.ShortDatePattern.indexOf("1"));var nIndexM=Math.max(cultureInfo.ShortDatePattern.indexOf("2"), cultureInfo.ShortDatePattern.indexOf("3"));var nIndexY=Math.max(cultureInfo.ShortDatePattern.indexOf("4"),cultureInfo.ShortDatePattern.indexOf("5"));if(null!=nMonthIndex)if(2==nDateLength){res.d=aDate[nDateLength-1-nMonthIndex];res.m=aDate[nMonthIndex];if(this.isValidDate((new Date).getFullYear(),res.m-1,res.d))res.sDateFormat="d-mmm";else if(!isDMY(cultureInfo)&&this.isValidDate((new Date).getFullYear(),res.d-1,res.m)){res.sDateFormat="d-mmm";var temp=res.d;res.d=res.m;res.m=temp}else if(0==nMonthIndex){res.sDateFormat= "mmm-yy";res.d=null;res.m=aDate[0];res.y=aDate[1]}else bError=true}else{res.sDateFormat="d-mmm-yy";res.d=aDate[0];res.m=aDate[1];res.y=aDate[2]}else if(2==nDateLength){if(nIndexD1E3){res.y=aDate[0];res.m=aDate[1];res.d=aDate[2];res.sDateFormat=getShortDateFormat(cultureInfo)}else{for(var i=0,length=cultureInfo.ShortDatePattern.length;i0){res.h=aTime[0];if(nTimeLength>1)res.min=aTime[1];if(nTimeLength>2)res.s=aTime[2]}if(bError)res=null}}return res},strcmp:function(s1,s2,index1,length,index2){if(null==index2)index2=0;var bRes=true;for(var i=0;i=oCurDataType.min){if(oDataTypes.space!=oCurDataType){var oNewElem={val:sCurValue,type:oCurDataType,month:null,am:false,pm:false,date:false,time:false};if(oDataTypes.digit==oCurDataType)oNewElem.val= oNewElem.val-0;match.push(oNewElem)}sCurValue=sChar;oPrevType=oCurDataType}else bError=true;oCurDataType=oDataType}else bError=true;if(oDataTypes.letter==oDataType){var oNewElem={val:sCurValue,type:oCurDataType,month:null,am:false,pm:false,date:false,time:false};var bAm=false;var bPm=false;if(!bAmPm&&((bAm=this.strcmp(valueLower,"am",i,2))||(bPm=this.strcmp(valueLower,"pm",i,2)))){bAmPm=true;oNewElem.am=bAm;oNewElem.pm=bPm;oNewElem.time=true;match.push(oNewElem);i+=2-1;if(oPrevType!=oDataTypes.space)bError= true}else if(!bMonth){bMonth=true;var aArraysToCheck=[{arr:cultureInfo.AbbreviatedMonthNames,format:"mmm"},{arr:cultureInfo.MonthNames,format:"mmmm"}];var bFound=false;for(var index in aArraysToCheck){var aArrayTemp=aArraysToCheck[index];for(var j=0,length2=aArrayTemp.arr.length;j0){var oParsedDate=this._parseDateFromArray(match,oDataTypes,cultureInfo);if(null!=oParsedDate){var d=oParsedDate.d;var m=oParsedDate.m;var y=oParsedDate.y;var h=oParsedDate.h;var min=oParsedDate.min;var s=oParsedDate.s;var am=oParsedDate.am;var pm=oParsedDate.pm;var sDateFormat=oParsedDate.sDateFormat;var bDate=false;var bTime=false;var nDay;var nMounth;var nYear;if(AscCommon.bDate1904){nDay=1;nMounth=0;nYear= 1904}else{nDay=31;nMounth=11;nYear=1899}var nHour=0;var nMinute=0;var nSecond=0;var dValue=0;var bValidDate=true;if(null!=m&&(null!=d||null!=y)){bDate=true;var oNowDate;if(null!=d)nDay=d-0;else nDay=1;nMounth=m-1;if(null!=y)nYear=y-0;else{oNowDate=new Date;nYear=oNowDate.getFullYear()}bValidDate=this.isValidDate(nYear,nMounth,nDay)}if(null!=h){bTime=true;nHour=h-0;if(am||pm)if(nHour<=23){nHour=nHour%12;if(pm)nHour+=12}else bValidDate=false;if(null!=min){nMinute=min-0;if(nMinute>59)bValidDate=false}if(null!= s){nSecond=s-0;if(nSecond>59)bValidDate=false}}if(true==bValidDate&&(true==bDate||true==bTime)){if(AscCommon.bDate1904)dValue=(Date.UTC(nYear,nMounth,nDay,nHour,nMinute,nSecond)-Date.UTC(1904,0,1,0,0,0))/(86400*1E3);else if(1900=0){var sFormat;if(true==bDate&&true==bTime){sFormat=sDateFormat+" h:mm:ss";if(am||pm)sFormat+=" AM/PM"}else if(true==bDate)sFormat=sDateFormat;else if(dValue>1)sFormat="[h]:mm:ss";else if(am||pm)sFormat="h:mm:ss AM/PM";else sFormat="h:mm:ss";res={format:sFormat,value:dValue,bDateTime:true,bDate:bDate,bTime:bTime,bPercent:false,bCurrency:false}}}}}return res},isValidDate:function(nYear,nMounth,nDay){if(nYear<1900&&!(1899===nYear&&11==nMounth&&31==nDay))return false;else if(nMounth< 0||nMounth>11)return false;else if(this.isValidDay(nYear,nMounth,nDay))return true;else if(1900==nYear&&1==nMounth&&29==nDay)return true;return false},isValidDay:function(nYear,nMounth,nDay){if(this.isLeapYear(nYear)){if(nDay<=0||nDay>this.daysLeap[nMounth])return false}else if(nDay<=0||nDay>this.days[nMounth])return false;return true},isLeapYear:function(year){return 0==year%4&&(0!=year%100||0==year%400)}};var g_oFormatParser=new FormatParser;function escapeRegExp(string){return string.replace(/([.*+?^=!:${}()|\[\]\/\\])/g, "\\$1")}function setCurrentCultureInfo(LCID,decimalSeparator,groupSeparator){var res=false;var cultureInfoNew=g_aCultureInfos[LCID];if(cultureInfoNew){if(LCID!==g_oLCID){g_oLCID=LCID;AscCommon.g_oDefaultCultureInfo=g_oDefaultCultureInfo=JSON.parse(JSON.stringify(cultureInfoNew));res=true}ParseLocalFormatSymbol(g_oDefaultCultureInfo.Name);decimalSeparator=null!=decimalSeparator?decimalSeparator:cultureInfoNew.NumberDecimalSeparator;if(decimalSeparator!==g_oDefaultCultureInfo.NumberDecimalSeparator){g_oDefaultCultureInfo.NumberDecimalSeparator= decimalSeparator;res=true}groupSeparator=null!=groupSeparator?groupSeparator:cultureInfoNew.NumberGroupSeparator;if(groupSeparator!==g_oDefaultCultureInfo.NumberGroupSeparator){g_oDefaultCultureInfo.NumberGroupSeparator=groupSeparator;res=true}}return res}function checkCultureInfoFontPicker(LCID){var ci=g_aCultureInfos[LCID]||g_oDefaultCultureInfo;AscFonts.FontPickerByCharacter.getFontsByString(ci.CurrencySymbol);AscFonts.FontPickerByCharacter.getFontsByString(ci.NumberDecimalSeparator);AscFonts.FontPickerByCharacter.getFontsByString(ci.NumberGroupSeparator); AscFonts.FontPickerByCharacter.getFontsByString(ci.AMDesignator);AscFonts.FontPickerByCharacter.getFontsByString(ci.PMDesignator);AscFonts.FontPickerByCharacter.getFontsByString(ci.DateSeparator);AscFonts.FontPickerByCharacter.getFontsByString(ci.TimeSeparator);var arrays=[ci.DayNames,ci.AbbreviatedDayNames,ci.MonthNames,ci.AbbreviatedMonthNames,ci.MonthGenitiveNames,ci.AbbreviatedMonthGenitiveNames];arrays.forEach(function(arr){arr.forEach(function(text){AscFonts.FontPickerByCharacter.getFontsByString(text)})})} function isDMY(cultureInfo){var res=true;for(var i=0;icultureInfo.ShortDatePattern.charCodeAt(i+1))return false;return true}function isYMD(cultureInfo){var res=true;for(var i=0;i0)dateElems.push("d".repeat(day)); break;case "2":case "3":if(month>0)dateElems.push("m".repeat(month));break;case "4":case "5":if(year>0)dateElems.push("y".repeat(year));break}return dateElems.join("/")}function getShortTimeFormat(opt_cultureInfo){var cultureInfo=opt_cultureInfo?opt_cultureInfo:g_oDefaultCultureInfo;if(cultureInfo.AMDesignator.length>0&&cultureInfo.PMDesignator.length>0)return"h:mm AM/PM;@";else return"h:mm;@"}function getLongTimeFormat(opt_cultureInfo){var cultureInfo=opt_cultureInfo?opt_cultureInfo:g_oDefaultCultureInfo; if(cultureInfo.AMDesignator.length>0&&cultureInfo.PMDesignator.length>0)return"h:mm:ss AM/PM;@";else return"h:mm:ss;@"}function getNumberFormatSimple(opt_separate,opt_fraction){var numberFormat=opt_separate?"#,##0":"0";if(opt_fraction>0)numberFormat+="."+"0".repeat(opt_fraction);return numberFormat}function getNumberFormat(opt_cultureInfo,opt_separate,opt_fraction,opt_red){var cultureInfo=opt_cultureInfo?opt_cultureInfo:g_oDefaultCultureInfo;var numberFormat=getNumberFormatSimple(opt_separate,opt_fraction); var red=opt_red?"[Red]":"";var positiveFormat;var negativeFormat;switch(cultureInfo.CurrencyNegativePattern){case 0:case 4:case 14:case 15:positiveFormat=numberFormat+"_)";negativeFormat="\\("+numberFormat+"\\)";break;default:positiveFormat=numberFormat+"_ ";negativeFormat="\\-"+numberFormat+"\\ ";break}return positiveFormat+";"+red+negativeFormat}function getLocaleFormat(opt_cultureInfo,opt_currency){var cultureInfo=opt_cultureInfo?opt_cultureInfo:g_oDefaultCultureInfo;var symbol=opt_currency?cultureInfo.CurrencySymbol: "";return"[$"+symbol+"-"+cultureInfo.LCID.toString(16).toUpperCase()+"]"}function getCurrencyFormatSimple(opt_cultureInfo,opt_fraction,opt_currency,opt_currencyLocale,opt_red){var cultureInfo=opt_cultureInfo?opt_cultureInfo:g_oDefaultCultureInfo;var numberFormat=getNumberFormatSimple(true,opt_fraction);var signCurrencyFormat;var signCurrencyFormatEnd;var signCurrencyFormatSpace;if(opt_currency){if(opt_currencyLocale)signCurrencyFormat=getLocaleFormat(cultureInfo,true);else signCurrencyFormat='"'+ cultureInfo.CurrencySymbol+'"';signCurrencyFormatEnd=signCurrencyFormat;signCurrencyFormatSpace=signCurrencyFormat+"\\ "}else{signCurrencyFormatEnd=signCurrencyFormat=signCurrencyFormatSpace="";for(var i=0;i0)format+="."+"0".repeat(info.decimalPlaces);format+="%";res.push(format)}else if(Asc.c_oAscNumFormatType.Fraction===info.type)res=gc_aFractionFormats;else if(Asc.c_oAscNumFormatType.Scientific===info.type){format="0."+"0".repeat(info.decimalPlaces)+ "E+00";res.push(format)}else if(Asc.c_oAscNumFormatType.Text===info.type)res.push("@");else if(Asc.c_oAscNumFormatType.Custom===info.type){for(i=0;i<=4;++i)res.push(AscCommonExcel.aStandartNumFormats[i]);res.push(getCurrencyFormatSimple(null,0,false,false,false));res.push(getCurrencyFormatSimple(null,0,false,false,true));res.push(getCurrencyFormatSimple(null,2,false,false,false));res.push(getCurrencyFormatSimple(null,2,false,false,true));res.push(getCurrencyFormatSimple(null,0,true,false,false)); res.push(getCurrencyFormatSimple(null,0,true,false,true));res.push(getCurrencyFormatSimple(null,2,true,false,false));res.push(getCurrencyFormatSimple(null,2,true,false,true));for(i=9;i<=13;++i)res.push(AscCommonExcel.aStandartNumFormats[i]);res.push(getShortDateFormat(null));res.push(getShortDateMonthFormat(true,true,null));res.push(getShortDateMonthFormat(true,false,null));res.push(getShortDateMonthFormat(false,true,null));for(i=18;i<=21;++i)res.push(AscCommonExcel.aStandartNumFormats[i]);res.push(getShortDateFormat(null)+ " h:mm");for(i=45;i<=49;++i)res.push(AscCommonExcel.aStandartNumFormats[i]);res.push(AscCommon.getCurrencyFormat(null,0,true,false));res.push(AscCommon.getCurrencyFormat(null,0,false,false));res.push(AscCommon.getCurrencyFormat(null,2,true,false));res.push(AscCommon.getCurrencyFormat(null,2,false,false))}else{res.push(AscCommon.g_cGeneralFormat);res.push("0.00");res.push("0.00E+00");res.push(getCurrencyFormat(cultureInfo,2,currency,true));res.push(getCurrencyFormatSimple2(cultureInfo,2,currency,false)); res.push(getShortDateFormat(cultureInfo));res.push("[$-F400]h:mm:ss AM/PM");res.push("0.00%");res.push("# ?/?");res.push("@")}}return res}function getFormatByStandardId(id){var res=null;if(15<=id&&id<=17)switch(id){case 15:res=AscCommon.getShortDateMonthFormat(true,true,null);break;case 16:res=AscCommon.getShortDateMonthFormat(true,false,null);break;case 17:res=AscCommon.getShortDateMonthFormat(false,true,null);break}else{var currencyLocale=true;switch(id){case 5:res=AscCommon.getCurrencyFormatSimple(null, 0,true,currencyLocale,false);break;case 6:res=AscCommon.getCurrencyFormatSimple(null,0,true,currencyLocale,true);break;case 7:res=AscCommon.getCurrencyFormatSimple(null,2,true,currencyLocale,false);break;case 8:res=AscCommon.getCurrencyFormatSimple(null,2,true,currencyLocale,true);break;case 14:res=AscCommon.getShortDateFormat(null);break;case 22:res=AscCommon.getShortDateFormat(null)+" h:mm";break;case 27:case 28:case 29:case 30:case 31:case 36:res=AscCommon.getShortDateFormat(null);break;case 37:res= AscCommon.getCurrencyFormatSimple(null,0,false,currencyLocale,false);break;case 38:res=AscCommon.getCurrencyFormatSimple(null,0,false,currencyLocale,true);break;case 39:res=AscCommon.getCurrencyFormatSimple(null,2,false,currencyLocale,false);break;case 40:res=AscCommon.getCurrencyFormatSimple(null,2,false,currencyLocale,true);break;case 41:res=AscCommon.getCurrencyFormat(null,0,false,currencyLocale);break;case 42:res=AscCommon.getCurrencyFormat(null,0,true,currencyLocale);break;case 43:res=AscCommon.getCurrencyFormat(null, 2,false,currencyLocale);break;case 44:res=AscCommon.getCurrencyFormat(null,2,true,currencyLocale);break;default:res=AscCommonExcel.aStandartNumFormats[id];break}}return res}var g_aCultureInfos={4:{LCID:4,Name:"zh-Hans",CurrencyPositivePattern:0,CurrencyNegativePattern:2,CurrencySymbol:"\u00a5",NumberDecimalSeparator:".",NumberGroupSeparator:",",NumberGroupSizes:[3],DayNames:["\u661f\u671f\u65e5","\u661f\u671f\u4e00","\u661f\u671f\u4e8c","\u661f\u671f\u4e09","\u661f\u671f\u56db","\u661f\u671f\u4e94", "\u661f\u671f\u516d"],AbbreviatedDayNames:["\u5468\u65e5","\u5468\u4e00","\u5468\u4e8c","\u5468\u4e09","\u5468\u56db","\u5468\u4e94","\u5468\u516d"],MonthNames:["\u4e00\u6708","\u4e8c\u6708","\u4e09\u6708","\u56db\u6708","\u4e94\u6708","\u516d\u6708","\u4e03\u6708","\u516b\u6708","\u4e5d\u6708","\u5341\u6708","\u5341\u4e00\u6708","\u5341\u4e8c\u6708",""],AbbreviatedMonthNames:["1\u6708","2\u6708","3\u6708","4\u6708","5\u6708","6\u6708","7\u6708","8\u6708","9\u6708","10\u6708","11\u6708","12\u6708", ""],MonthGenitiveNames:[],AbbreviatedMonthGenitiveNames:[],AMDesignator:"\u4e0a\u5348",PMDesignator:"\u4e0b\u5348",DateSeparator:"/",TimeSeparator:":",ShortDatePattern:"520"},5:{LCID:5,Name:"cs",CurrencyPositivePattern:3,CurrencyNegativePattern:8,CurrencySymbol:"K\u010d",NumberDecimalSeparator:",",NumberGroupSeparator:" ",NumberGroupSizes:[3],DayNames:["ned\u011ble","pond\u011bl\u00ed","\u00fater\u00fd","st\u0159eda","\u010dtvrtek","p\u00e1tek","sobota"],AbbreviatedDayNames:["ne","po","\u00fat","st", "\u010dt","p\u00e1","so"],MonthNames:["leden","\u00fanor","b\u0159ezen","duben","kv\u011bten","\u010derven","\u010dervenec","srpen","z\u00e1\u0159\u00ed","\u0159\u00edjen","listopad","prosinec",""],AbbreviatedMonthNames:["led","\u00fano","b\u0159e","dub","kv\u011b","\u010dvn","\u010dvc","srp","z\u00e1\u0159","\u0159\u00edj","lis","pro",""],MonthGenitiveNames:["ledna","\u00fanora","b\u0159ezna","dubna","kv\u011btna","\u010dervna","\u010dervence","srpna","z\u00e1\u0159\u00ed","\u0159\u00edjna","listopadu", "prosince",""],AbbreviatedMonthGenitiveNames:[],AMDesignator:"dop.",PMDesignator:"odp.",DateSeparator:".",TimeSeparator:":",ShortDatePattern:"135"},7:{LCID:7,Name:"de",CurrencyPositivePattern:3,CurrencyNegativePattern:8,CurrencySymbol:"\u20ac",NumberDecimalSeparator:",",NumberGroupSeparator:".",NumberGroupSizes:[3],DayNames:["Sonntag","Montag","Dienstag","Mittwoch","Donnerstag","Freitag","Samstag"],AbbreviatedDayNames:["So","Mo","Di","Mi","Do","Fr","Sa"],MonthNames:["Januar","Februar","M\u00e4rz", "April","Mai","Juni","Juli","August","September","Oktober","November","Dezember",""],AbbreviatedMonthNames:["Jan","Feb","Mrz","Apr","Mai","Jun","Jul","Aug","Sep","Okt","Nov","Dez",""],MonthGenitiveNames:[],AbbreviatedMonthGenitiveNames:[],AMDesignator:"",PMDesignator:"",DateSeparator:".",TimeSeparator:":",ShortDatePattern:"135"},8:{LCID:8,Name:"el",CurrencyPositivePattern:3,CurrencyNegativePattern:8,CurrencySymbol:"\u20ac",NumberDecimalSeparator:",",NumberGroupSeparator:".",NumberGroupSizes:[3],DayNames:["\u039a\u03c5\u03c1\u03b9\u03b1\u03ba\u03ae", "\u0394\u03b5\u03c5\u03c4\u03ad\u03c1\u03b1","\u03a4\u03c1\u03af\u03c4\u03b7","\u03a4\u03b5\u03c4\u03ac\u03c1\u03c4\u03b7","\u03a0\u03ad\u03bc\u03c0\u03c4\u03b7","\u03a0\u03b1\u03c1\u03b1\u03c3\u03ba\u03b5\u03c5\u03ae","\u03a3\u03ac\u03b2\u03b2\u03b1\u03c4\u03bf"],AbbreviatedDayNames:["\u039a\u03c5\u03c1","\u0394\u03b5\u03c5","\u03a4\u03c1\u03b9","\u03a4\u03b5\u03c4","\u03a0\u03b5\u03bc","\u03a0\u03b1\u03c1","\u03a3\u03b1\u03b2"],MonthNames:["\u0399\u03b1\u03bd\u03bf\u03c5\u03ac\u03c1\u03b9\u03bf\u03c2", "\u03a6\u03b5\u03b2\u03c1\u03bf\u03c5\u03ac\u03c1\u03b9\u03bf\u03c2","\u039c\u03ac\u03c1\u03c4\u03b9\u03bf\u03c2","\u0391\u03c0\u03c1\u03af\u03bb\u03b9\u03bf\u03c2","\u039c\u03ac\u03b9\u03bf\u03c2","\u0399\u03bf\u03cd\u03bd\u03b9\u03bf\u03c2","\u0399\u03bf\u03cd\u03bb\u03b9\u03bf\u03c2","\u0391\u03cd\u03b3\u03bf\u03c5\u03c3\u03c4\u03bf\u03c2","\u03a3\u03b5\u03c0\u03c4\u03ad\u03bc\u03b2\u03c1\u03b9\u03bf\u03c2","\u039f\u03ba\u03c4\u03ce\u03b2\u03c1\u03b9\u03bf\u03c2","\u039d\u03bf\u03ad\u03bc\u03b2\u03c1\u03b9\u03bf\u03c2", "\u0394\u03b5\u03ba\u03ad\u03bc\u03b2\u03c1\u03b9\u03bf\u03c2",""],AbbreviatedMonthNames:["\u0399\u03b1\u03bd","\u03a6\u03b5\u03b2","\u039c\u03b1\u03c1","\u0391\u03c0\u03c1","\u039c\u03b1\u03ca","\u0399\u03bf\u03c5\u03bd","\u0399\u03bf\u03c5\u03bb","\u0391\u03c5\u03b3","\u03a3\u03b5\u03c0","\u039f\u03ba\u03c4","\u039d\u03bf\u03b5","\u0394\u03b5\u03ba",""],MonthGenitiveNames:["\u0399\u03b1\u03bd\u03bf\u03c5\u03b1\u03c1\u03af\u03bf\u03c5","\u03a6\u03b5\u03b2\u03c1\u03bf\u03c5\u03b1\u03c1\u03af\u03bf\u03c5", "\u039c\u03b1\u03c1\u03c4\u03af\u03bf\u03c5","\u0391\u03c0\u03c1\u03b9\u03bb\u03af\u03bf\u03c5","\u039c\u03b1\u0390\u03bf\u03c5","\u0399\u03bf\u03c5\u03bd\u03af\u03bf\u03c5","\u0399\u03bf\u03c5\u03bb\u03af\u03bf\u03c5","\u0391\u03c5\u03b3\u03bf\u03cd\u03c3\u03c4\u03bf\u03c5","\u03a3\u03b5\u03c0\u03c4\u03b5\u03bc\u03b2\u03c1\u03af\u03bf\u03c5","\u039f\u03ba\u03c4\u03c9\u03b2\u03c1\u03af\u03bf\u03c5","\u039d\u03bf\u03b5\u03bc\u03b2\u03c1\u03af\u03bf\u03c5","\u0394\u03b5\u03ba\u03b5\u03bc\u03b2\u03c1\u03af\u03bf\u03c5", ""],AbbreviatedMonthGenitiveNames:[],AMDesignator:"\u03c0\u03bc",PMDesignator:"\u03bc\u03bc",DateSeparator:"/",TimeSeparator:":",ShortDatePattern:"025"},9:{LCID:9,Name:"en",CurrencyPositivePattern:0,CurrencyNegativePattern:0,CurrencySymbol:"$",NumberDecimalSeparator:".",NumberGroupSeparator:",",NumberGroupSizes:[3],DayNames:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],AbbreviatedDayNames:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],MonthNames:["January","February","March", "April","May","June","July","August","September","October","November","December",""],AbbreviatedMonthNames:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec",""],MonthGenitiveNames:[],AbbreviatedMonthGenitiveNames:[],AMDesignator:"AM",PMDesignator:"PM",DateSeparator:"/",TimeSeparator:":",ShortDatePattern:"205"},10:{LCID:10,Name:"es",CurrencyPositivePattern:3,CurrencyNegativePattern:8,CurrencySymbol:"\u20ac",NumberDecimalSeparator:",",NumberGroupSeparator:".",NumberGroupSizes:[3], DayNames:["domingo","lunes","martes","mi\u00e9rcoles","jueves","viernes","s\u00e1bado"],AbbreviatedDayNames:["do.","lu.","ma.","mi.","ju.","vi.","s\u00e1."],MonthNames:["enero","febrero","marzo","abril","mayo","junio","julio","agosto","septiembre","octubre","noviembre","diciembre",""],AbbreviatedMonthNames:["ene.","feb.","mar.","abr.","may.","jun.","jul.","ago.","sep.","oct.","nov.","dic.",""],MonthGenitiveNames:[],AbbreviatedMonthGenitiveNames:[],AMDesignator:"",PMDesignator:"",DateSeparator:"/", TimeSeparator:":",ShortDatePattern:"135"},11:{LCID:11,Name:"fi",CurrencyPositivePattern:3,CurrencyNegativePattern:8,CurrencySymbol:"\u20ac",NumberDecimalSeparator:",",NumberGroupSeparator:" ",NumberGroupSizes:[3],DayNames:["sunnuntai","maanantai","tiistai","keskiviikko","torstai","perjantai","lauantai"],AbbreviatedDayNames:["su","ma","ti","ke","to","pe","la"],MonthNames:["tammikuu","helmikuu","maaliskuu","huhtikuu","toukokuu","kes\u00e4kuu","hein\u00e4kuu","elokuu","syyskuu","lokakuu","marraskuu", "joulukuu",""],AbbreviatedMonthNames:["tammi","helmi","maalis","huhti","touko","kes\u00e4","hein\u00e4","elo","syys","loka","marras","joulu",""],MonthGenitiveNames:["tammikuuta","helmikuuta","maaliskuuta","huhtikuuta","toukokuuta","kes\u00e4kuuta","hein\u00e4kuuta","elokuuta","syyskuuta","lokakuuta","marraskuuta","joulukuuta",""],AbbreviatedMonthGenitiveNames:["tammik.","helmik.","maalisk.","huhtik.","toukok.","kes\u00e4k.","hein\u00e4k.","elok.","syysk.","lokak.","marrask.","jouluk.",""],AMDesignator:"ap.", PMDesignator:"ip.",DateSeparator:".",TimeSeparator:".",ShortDatePattern:"025"},12:{LCID:12,Name:"fr",CurrencyPositivePattern:3,CurrencyNegativePattern:8,CurrencySymbol:"\u20ac",NumberDecimalSeparator:",",NumberGroupSeparator:" ",NumberGroupSizes:[3],DayNames:["dimanche","lundi","mardi","mercredi","jeudi","vendredi","samedi"],AbbreviatedDayNames:["dim.","lun.","mar.","mer.","jeu.","ven.","sam."],MonthNames:["janvier","f\u00e9vrier","mars","avril","mai","juin","juillet","ao\u00fbt","septembre","octobre", "novembre","d\u00e9cembre",""],AbbreviatedMonthNames:["janv.","f\u00e9vr.","mars","avr.","mai","juin","juil.","ao\u00fbt","sept.","oct.","nov.","d\u00e9c.",""],MonthGenitiveNames:[],AbbreviatedMonthGenitiveNames:[],AMDesignator:"",PMDesignator:"",DateSeparator:"/",TimeSeparator:":",ShortDatePattern:"135"},14:{LCID:14,Name:"hu",CurrencyPositivePattern:3,CurrencyNegativePattern:8,CurrencySymbol:"Ft",NumberDecimalSeparator:",",NumberGroupSeparator:" ",NumberGroupSizes:[3],DayNames:["vas\u00e1rnap","h\u00e9tf\u0151", "kedd","szerda","cs\u00fct\u00f6rt\u00f6k","p\u00e9ntek","szombat"],AbbreviatedDayNames:["V","H","K","Sze","Cs","P","Szo"],MonthNames:["janu\u00e1r","febru\u00e1r","m\u00e1rcius","\u00e1prilis","m\u00e1jus","j\u00fanius","j\u00falius","augusztus","szeptember","okt\u00f3ber","november","december",""],AbbreviatedMonthNames:["jan.","febr.","m\u00e1rc.","\u00e1pr.","m\u00e1j.","j\u00fan.","j\u00fal.","aug.","szept.","okt.","nov.","dec.",""],MonthGenitiveNames:[],AbbreviatedMonthGenitiveNames:[],AMDesignator:"de.", PMDesignator:"du.",DateSeparator:". ",TimeSeparator:":",ShortDatePattern:"531"},16:{LCID:16,Name:"it",CurrencyPositivePattern:3,CurrencyNegativePattern:8,CurrencySymbol:"\u20ac",NumberDecimalSeparator:",",NumberGroupSeparator:".",NumberGroupSizes:[3],DayNames:["domenica","luned\u00ec","marted\u00ec","mercoled\u00ec","gioved\u00ec","venerd\u00ec","sabato"],AbbreviatedDayNames:["dom","lun","mar","mer","gio","ven","sab"],MonthNames:["gennaio","febbraio","marzo","aprile","maggio","giugno","luglio","agosto", "settembre","ottobre","novembre","dicembre",""],AbbreviatedMonthNames:["gen","feb","mar","apr","mag","giu","lug","ago","set","ott","nov","dic",""],MonthGenitiveNames:[],AbbreviatedMonthGenitiveNames:[],AMDesignator:"",PMDesignator:"",DateSeparator:"/",TimeSeparator:":",ShortDatePattern:"135"},17:{LCID:17,Name:"ja",CurrencyPositivePattern:0,CurrencyNegativePattern:1,CurrencySymbol:"\u00a5",NumberDecimalSeparator:".",NumberGroupSeparator:",",NumberGroupSizes:[3],DayNames:["\u65e5\u66dc\u65e5","\u6708\u66dc\u65e5", "\u706b\u66dc\u65e5","\u6c34\u66dc\u65e5","\u6728\u66dc\u65e5","\u91d1\u66dc\u65e5","\u571f\u66dc\u65e5"],AbbreviatedDayNames:["\u65e5","\u6708","\u706b","\u6c34","\u6728","\u91d1","\u571f"],MonthNames:["1\u6708","2\u6708","3\u6708","4\u6708","5\u6708","6\u6708","7\u6708","8\u6708","9\u6708","10\u6708","11\u6708","12\u6708",""],AbbreviatedMonthNames:["1","2","3","4","5","6","7","8","9","10","11","12",""],MonthGenitiveNames:[],AbbreviatedMonthGenitiveNames:[],AMDesignator:"\u5348\u524d",PMDesignator:"\u5348\u5f8c", DateSeparator:"/",TimeSeparator:":",ShortDatePattern:"531"},18:{LCID:18,Name:"ko",CurrencyPositivePattern:0,CurrencyNegativePattern:1,CurrencySymbol:"\u20a9",NumberDecimalSeparator:".",NumberGroupSeparator:",",NumberGroupSizes:[3],DayNames:["\uc77c\uc694\uc77c","\uc6d4\uc694\uc77c","\ud654\uc694\uc77c","\uc218\uc694\uc77c","\ubaa9\uc694\uc77c","\uae08\uc694\uc77c","\ud1a0\uc694\uc77c"],AbbreviatedDayNames:["\uc77c","\uc6d4","\ud654","\uc218","\ubaa9","\uae08","\ud1a0"],MonthNames:["1\uc6d4","2\uc6d4", "3\uc6d4","4\uc6d4","5\uc6d4","6\uc6d4","7\uc6d4","8\uc6d4","9\uc6d4","10\uc6d4","11\uc6d4","12\uc6d4",""],AbbreviatedMonthNames:["1","2","3","4","5","6","7","8","9","10","11","12",""],MonthGenitiveNames:[],AbbreviatedMonthGenitiveNames:[],AMDesignator:"\uc624\uc804",PMDesignator:"\uc624\ud6c4",DateSeparator:"-",TimeSeparator:":",ShortDatePattern:"531"},21:{LCID:21,Name:"pl",CurrencyPositivePattern:3,CurrencyNegativePattern:8,CurrencySymbol:"z\u0142",NumberDecimalSeparator:",",NumberGroupSeparator:" ", NumberGroupSizes:[3],DayNames:["niedziela","poniedzia\u0142ek","wtorek","\u015broda","czwartek","pi\u0105tek","sobota"],AbbreviatedDayNames:["niedz.","pon.","wt.","\u015br.","czw.","pt.","sob."],MonthNames:["stycze\u0144","luty","marzec","kwiecie\u0144","maj","czerwiec","lipiec","sierpie\u0144","wrzesie\u0144","pa\u017adziernik","listopad","grudzie\u0144",""],AbbreviatedMonthNames:["sty","lut","mar","kwi","maj","cze","lip","sie","wrz","pa\u017a","lis","gru",""],MonthGenitiveNames:["stycznia","lutego", "marca","kwietnia","maja","czerwca","lipca","sierpnia","wrze\u015bnia","pa\u017adziernika","listopada","grudnia",""],AbbreviatedMonthGenitiveNames:[],AMDesignator:"AM",PMDesignator:"PM",DateSeparator:".",TimeSeparator:":",ShortDatePattern:"135"},22:{LCID:22,Name:"pt",CurrencyPositivePattern:2,CurrencyNegativePattern:9,CurrencySymbol:"R$",NumberDecimalSeparator:",",NumberGroupSeparator:".",NumberGroupSizes:[3],DayNames:["domingo","segunda-feira","ter\u00e7a-feira","quarta-feira","quinta-feira","sexta-feira", "s\u00e1bado"],AbbreviatedDayNames:["dom","seg","ter","qua","qui","sex","s\u00e1b"],MonthNames:["janeiro","fevereiro","mar\u00e7o","abril","maio","junho","julho","agosto","setembro","outubro","novembro","dezembro",""],AbbreviatedMonthNames:["jan","fev","mar","abr","mai","jun","jul","ago","set","out","nov","dez",""],MonthGenitiveNames:[],AbbreviatedMonthGenitiveNames:[],AMDesignator:"",PMDesignator:"",DateSeparator:"/",TimeSeparator:":",ShortDatePattern:"135"},25:{LCID:25,Name:"ru",CurrencyPositivePattern:3, CurrencyNegativePattern:8,CurrencySymbol:"\u20bd",NumberDecimalSeparator:",",NumberGroupSeparator:" ",NumberGroupSizes:[3],DayNames:["\u0432\u043e\u0441\u043a\u0440\u0435\u0441\u0435\u043d\u044c\u0435","\u043f\u043e\u043d\u0435\u0434\u0435\u043b\u044c\u043d\u0438\u043a","\u0432\u0442\u043e\u0440\u043d\u0438\u043a","\u0441\u0440\u0435\u0434\u0430","\u0447\u0435\u0442\u0432\u0435\u0440\u0433","\u043f\u044f\u0442\u043d\u0438\u0446\u0430","\u0441\u0443\u0431\u0431\u043e\u0442\u0430"],AbbreviatedDayNames:["\u0412\u0441", "\u041f\u043d","\u0412\u0442","\u0421\u0440","\u0427\u0442","\u041f\u0442","\u0421\u0431"],MonthNames:["\u042f\u043d\u0432\u0430\u0440\u044c","\u0424\u0435\u0432\u0440\u0430\u043b\u044c","\u041c\u0430\u0440\u0442","\u0410\u043f\u0440\u0435\u043b\u044c","\u041c\u0430\u0439","\u0418\u044e\u043d\u044c","\u0418\u044e\u043b\u044c","\u0410\u0432\u0433\u0443\u0441\u0442","\u0421\u0435\u043d\u0442\u044f\u0431\u0440\u044c","\u041e\u043a\u0442\u044f\u0431\u0440\u044c","\u041d\u043e\u044f\u0431\u0440\u044c", "\u0414\u0435\u043a\u0430\u0431\u0440\u044c",""],AbbreviatedMonthNames:["\u044f\u043d\u0432","\u0444\u0435\u0432","\u043c\u0430\u0440","\u0430\u043f\u0440","\u043c\u0430\u0439","\u0438\u044e\u043d","\u0438\u044e\u043b","\u0430\u0432\u0433","\u0441\u0435\u043d","\u043e\u043a\u0442","\u043d\u043e\u044f","\u0434\u0435\u043a",""],MonthGenitiveNames:["\u044f\u043d\u0432\u0430\u0440\u044f","\u0444\u0435\u0432\u0440\u0430\u043b\u044f","\u043c\u0430\u0440\u0442\u0430","\u0430\u043f\u0440\u0435\u043b\u044f", "\u043c\u0430\u044f","\u0438\u044e\u043d\u044f","\u0438\u044e\u043b\u044f","\u0430\u0432\u0433\u0443\u0441\u0442\u0430","\u0441\u0435\u043d\u0442\u044f\u0431\u0440\u044f","\u043e\u043a\u0442\u044f\u0431\u0440\u044f","\u043d\u043e\u044f\u0431\u0440\u044f","\u0434\u0435\u043a\u0430\u0431\u0440\u044f",""],AbbreviatedMonthGenitiveNames:["\u044f\u043d\u0432","\u0444\u0435\u0432","\u043c\u0430\u0440","\u0430\u043f\u0440","\u043c\u0430\u044f","\u0438\u044e\u043d","\u0438\u044e\u043b","\u0430\u0432\u0433", "\u0441\u0435\u043d","\u043e\u043a\u0442","\u043d\u043e\u044f","\u0434\u0435\u043a",""],AMDesignator:"",PMDesignator:"",DateSeparator:".",TimeSeparator:":",ShortDatePattern:"135"},29:{LCID:29,Name:"sv",CurrencyPositivePattern:3,CurrencyNegativePattern:8,CurrencySymbol:"kr",NumberDecimalSeparator:",",NumberGroupSeparator:" ",NumberGroupSizes:[3],DayNames:["s\u00f6ndag","m\u00e5ndag","tisdag","onsdag","torsdag","fredag","l\u00f6rdag"],AbbreviatedDayNames:["s\u00f6n","m\u00e5n","tis","ons","tor","fre", "l\u00f6r"],MonthNames:["januari","februari","mars","april","maj","juni","juli","augusti","september","oktober","november","december",""],AbbreviatedMonthNames:["jan","feb","mar","apr","maj","jun","jul","aug","sep","okt","nov","dec",""],MonthGenitiveNames:[],AbbreviatedMonthGenitiveNames:[],AMDesignator:"",PMDesignator:"",DateSeparator:"-",TimeSeparator:":",ShortDatePattern:"531"},31:{LCID:31,Name:"tr",CurrencyPositivePattern:0,CurrencyNegativePattern:1,CurrencySymbol:"\u20ba",NumberDecimalSeparator:",", NumberGroupSeparator:".",NumberGroupSizes:[3],DayNames:["Pazar","Pazartesi","Sal\u0131","\u00c7ar\u015famba","Per\u015fembe","Cuma","Cumartesi"],AbbreviatedDayNames:["Paz","Pzt","Sal","\u00c7ar","Per","Cum","Cmt"],MonthNames:["Ocak","\u015eubat","Mart","Nisan","May\u0131s","Haziran","Temmuz","A\u011fustos","Eyl\u00fcl","Ekim","Kas\u0131m","Aral\u0131k",""],AbbreviatedMonthNames:["Oca","\u015eub","Mar","Nis","May","Haz","Tem","A\u011fu","Eyl","Eki","Kas","Ara",""],MonthGenitiveNames:[],AbbreviatedMonthGenitiveNames:[], AMDesignator:"\u00d6\u00d6",PMDesignator:"\u00d6S",DateSeparator:".",TimeSeparator:":",ShortDatePattern:"035"},34:{LCID:34,Name:"uk",CurrencyPositivePattern:3,CurrencyNegativePattern:8,CurrencySymbol:"\u20b4",NumberDecimalSeparator:",",NumberGroupSeparator:" ",NumberGroupSizes:[3],DayNames:["\u043d\u0435\u0434\u0456\u043b\u044f","\u043f\u043e\u043d\u0435\u0434\u0456\u043b\u043e\u043a","\u0432\u0456\u0432\u0442\u043e\u0440\u043e\u043a","\u0441\u0435\u0440\u0435\u0434\u0430","\u0447\u0435\u0442\u0432\u0435\u0440", "\u043f'\u044f\u0442\u043d\u0438\u0446\u044f","\u0441\u0443\u0431\u043e\u0442\u0430"],AbbreviatedDayNames:["\u041d\u0434","\u041f\u043d","\u0412\u0442","\u0421\u0440","\u0427\u0442","\u041f\u0442","\u0421\u0431"],MonthNames:["\u0441\u0456\u0447\u0435\u043d\u044c","\u043b\u044e\u0442\u0438\u0439","\u0431\u0435\u0440\u0435\u0437\u0435\u043d\u044c","\u043a\u0432\u0456\u0442\u0435\u043d\u044c","\u0442\u0440\u0430\u0432\u0435\u043d\u044c","\u0447\u0435\u0440\u0432\u0435\u043d\u044c","\u043b\u0438\u043f\u0435\u043d\u044c", "\u0441\u0435\u0440\u043f\u0435\u043d\u044c","\u0432\u0435\u0440\u0435\u0441\u0435\u043d\u044c","\u0436\u043e\u0432\u0442\u0435\u043d\u044c","\u043b\u0438\u0441\u0442\u043e\u043f\u0430\u0434","\u0433\u0440\u0443\u0434\u0435\u043d\u044c",""],AbbreviatedMonthNames:["\u0421\u0456\u0447","\u041b\u044e\u0442","\u0411\u0435\u0440","\u041a\u0432\u0456","\u0422\u0440\u0430","\u0427\u0435\u0440","\u041b\u0438\u043f","\u0421\u0435\u0440","\u0412\u0435\u0440","\u0416\u043e\u0432","\u041b\u0438\u0441","\u0413\u0440\u0443", ""],MonthGenitiveNames:["\u0441\u0456\u0447\u043d\u044f","\u043b\u044e\u0442\u043e\u0433\u043e","\u0431\u0435\u0440\u0435\u0437\u043d\u044f","\u043a\u0432\u0456\u0442\u043d\u044f","\u0442\u0440\u0430\u0432\u043d\u044f","\u0447\u0435\u0440\u0432\u043d\u044f","\u043b\u0438\u043f\u043d\u044f","\u0441\u0435\u0440\u043f\u043d\u044f","\u0432\u0435\u0440\u0435\u0441\u043d\u044f","\u0436\u043e\u0432\u0442\u043d\u044f","\u043b\u0438\u0441\u0442\u043e\u043f\u0430\u0434\u0430","\u0433\u0440\u0443\u0434\u043d\u044f", ""],AbbreviatedMonthGenitiveNames:["\u0441\u0456\u0447","\u043b\u044e\u0442","\u0431\u0435\u0440","\u043a\u0432\u0456","\u0442\u0440\u0430","\u0447\u0435\u0440","\u043b\u0438\u043f","\u0441\u0435\u0440","\u0432\u0435\u0440","\u0436\u043e\u0432","\u043b\u0438\u0441","\u0433\u0440\u0443",""],AMDesignator:"",PMDesignator:"",DateSeparator:".",TimeSeparator:":",ShortDatePattern:"135"},36:{LCID:36,Name:"sl",CurrencyPositivePattern:3,CurrencyNegativePattern:8,CurrencySymbol:"\u20ac",NumberDecimalSeparator:",", NumberGroupSeparator:".",NumberGroupSizes:[3],DayNames:["nedelja","ponedeljek","torek","sreda","\u010detrtek","petek","sobota"],AbbreviatedDayNames:["ned.","pon.","tor.","sre.","\u010det.","pet.","sob."],MonthNames:["januar","februar","marec","april","maj","junij","julij","avgust","september","oktober","november","december",""],AbbreviatedMonthNames:["jan.","feb.","mar.","apr.","maj","jun.","jul.","avg.","sep.","okt.","nov.","dec.",""],MonthGenitiveNames:[],AbbreviatedMonthGenitiveNames:[],AMDesignator:"dop.", PMDesignator:"pop.",DateSeparator:". ",TimeSeparator:":",ShortDatePattern:"035"},38:{LCID:38,Name:"lv",CurrencyPositivePattern:3,CurrencyNegativePattern:8,CurrencySymbol:"\u20ac",NumberDecimalSeparator:",",NumberGroupSeparator:" ",NumberGroupSizes:[3],DayNames:["sv\u0113tdiena","pirmdiena","otrdiena","tre\u0161diena","ceturtdiena","piektdiena","sestdiena"],AbbreviatedDayNames:["sv\u0113td.","pirmd.","otrd.","tre\u0161d.","ceturtd.","piektd.","sestd."],MonthNames:["janv\u0101ris","febru\u0101ris", "marts","apr\u012blis","maijs","j\u016bnijs","j\u016blijs","augusts","septembris","oktobris","novembris","decembris",""],AbbreviatedMonthNames:["janv.","febr.","marts","apr.","maijs","j\u016bn.","j\u016bl.","aug.","sept.","okt.","nov.","dec.",""],MonthGenitiveNames:[],AbbreviatedMonthGenitiveNames:[],AMDesignator:"priek\u0161p.",PMDesignator:"p\u0113cp.",DateSeparator:".",TimeSeparator:":",ShortDatePattern:"135"},39:{LCID:39,Name:"lt",CurrencyPositivePattern:3,CurrencyNegativePattern:8,CurrencySymbol:"\u20ac", NumberDecimalSeparator:",",NumberGroupSeparator:" ",NumberGroupSizes:[3],DayNames:["sekmadienis","pirmadienis","antradienis","tre\u010diadienis","ketvirtadienis","penktadienis","\u0161e\u0161tadienis"],AbbreviatedDayNames:["sk","pr","an","tr","kt","pn","\u0161t"],MonthNames:["sausis","vasaris","kovas","balandis","gegu\u017e\u0117","bir\u017eelis","liepa","rugpj\u016btis","rugs\u0117jis","spalis","lapkritis","gruodis",""],AbbreviatedMonthNames:["saus.","vas.","kov.","bal.","geg.","bir\u017e.","liep.", "rugp.","rugs.","spal.","lapkr.","gruod.",""],MonthGenitiveNames:["sausio","vasario","kovo","baland\u017eio","gegu\u017e\u0117s","bir\u017eelio","liepos","rugpj\u016b\u010dio","rugs\u0117jo","spalio","lapkri\u010dio","gruod\u017eio",""],AbbreviatedMonthGenitiveNames:[],AMDesignator:"prie\u0161piet",PMDesignator:"popiet",DateSeparator:"-",TimeSeparator:":",ShortDatePattern:"531"},42:{LCID:42,Name:"vi",CurrencyPositivePattern:3,CurrencyNegativePattern:8,CurrencySymbol:"\u20ab",NumberDecimalSeparator:",", NumberGroupSeparator:".",NumberGroupSizes:[3],DayNames:["Chu\u0309 Nh\u00e2\u0323t","Th\u01b0\u0301 Hai","Th\u01b0\u0301 Ba","Th\u01b0\u0301 T\u01b0","Th\u01b0\u0301 N\u0103m","Th\u01b0\u0301 Sa\u0301u","Th\u01b0\u0301 Ba\u0309y"],AbbreviatedDayNames:["CN","T2","T3","T4","T5","T6","T7"],MonthNames:["Tha\u0301ng Gi\u00eang","Tha\u0301ng Hai","Tha\u0301ng Ba","Tha\u0301ng T\u01b0","Tha\u0301ng N\u0103m","Tha\u0301ng Sa\u0301u","Tha\u0301ng Ba\u0309y","Tha\u0301ng Ta\u0301m","Tha\u0301ng Chi\u0301n", "Tha\u0301ng M\u01b0\u01a1\u0300i","Tha\u0301ng M\u01b0\u01a1\u0300i M\u00f4\u0323t","Tha\u0301ng M\u01b0\u01a1\u0300i Hai",""],AbbreviatedMonthNames:["Thg1","Thg2","Thg3","Thg4","Thg5","Thg6","Thg7","Thg8","Thg9","Thg10","Thg11","Thg12",""],MonthGenitiveNames:[],AbbreviatedMonthGenitiveNames:[],AMDesignator:"SA",PMDesignator:"CH",DateSeparator:"/",TimeSeparator:":",ShortDatePattern:"135"},44:{LCID:44,Name:"az",CurrencyPositivePattern:3,CurrencyNegativePattern:8,CurrencySymbol:"\u20bc",NumberDecimalSeparator:",", NumberGroupSeparator:".",NumberGroupSizes:[3],DayNames:["bazar","bazar ert\u0259si","\u00e7\u0259r\u015f\u0259nb\u0259 ax\u015fam\u0131","\u00e7\u0259r\u015f\u0259nb\u0259","c\u00fcm\u0259 ax\u015fam\u0131","c\u00fcm\u0259","\u015f\u0259nb\u0259"],AbbreviatedDayNames:["B.","B.E.","\u00c7.A.","\u00c7.","C.A.","C.","\u015e."],MonthNames:["Yanvar","Fevral","Mart","Aprel","May","\u0130yun","\u0130yul","Avqust","Sentyabr","Oktyabr","Noyabr","Dekabr",""],AbbreviatedMonthNames:["yan","fev","mar","apr","may", "iyn","iyl","avq","sen","okt","noy","dek",""],MonthGenitiveNames:["yanvar","fevral","mart","aprel","may","iyun","iyul","avqust","sentyabr","oktyabr","noyabr","dekabr",""],AbbreviatedMonthGenitiveNames:[],AMDesignator:"AM",PMDesignator:"PM",DateSeparator:".",TimeSeparator:":",ShortDatePattern:"135"},63:{LCID:63,Name:"kk",CurrencyPositivePattern:3,CurrencyNegativePattern:8,CurrencySymbol:"\u20b8",NumberDecimalSeparator:",",NumberGroupSeparator:" ",NumberGroupSizes:[3],DayNames:["\u0436\u0435\u043a\u0441\u0435\u043d\u0431\u0456", "\u0434\u04af\u0439\u0441\u0435\u043d\u0431\u0456","\u0441\u0435\u0439\u0441\u0435\u043d\u0431\u0456","\u0441\u04d9\u0440\u0441\u0435\u043d\u0431\u0456","\u0431\u0435\u0439\u0441\u0435\u043d\u0431\u0456","\u0436\u04b1\u043c\u0430","\u0441\u0435\u043d\u0431\u0456"],AbbreviatedDayNames:["\u0436\u0441","\u0434\u0441","\u0441\u0441","\u0441\u0440","\u0431\u0441","\u0436\u043c","\u0441\u0431"],MonthNames:["\u049a\u0430\u04a3\u0442\u0430\u0440","\u0410\u049b\u043f\u0430\u043d","\u041d\u0430\u0443\u0440\u044b\u0437", "\u0421\u04d9\u0443\u0456\u0440","\u041c\u0430\u043c\u044b\u0440","\u041c\u0430\u0443\u0441\u044b\u043c","\u0428\u0456\u043b\u0434\u0435","\u0422\u0430\u043c\u044b\u0437","\u049a\u044b\u0440\u043a\u04af\u0439\u0435\u043a","\u049a\u0430\u0437\u0430\u043d","\u049a\u0430\u0440\u0430\u0448\u0430","\u0416\u0435\u043b\u0442\u043e\u049b\u0441\u0430\u043d",""],AbbreviatedMonthNames:["\u049b\u0430\u04a3.","\u0430\u049b\u043f.","\u043d\u0430\u0443.","\u0441\u04d9\u0443.","\u043c\u0430\u043c.","\u043c\u0430\u0443.", "\u0448\u0456\u043b.","\u0442\u0430\u043c.","\u049b\u044b\u0440.","\u049b\u0430\u0437.","\u049b\u0430\u0440.","\u0436\u0435\u043b.",""],MonthGenitiveNames:["\u049b\u0430\u04a3\u0442\u0430\u0440","\u0430\u049b\u043f\u0430\u043d","\u043d\u0430\u0443\u0440\u044b\u0437","\u0441\u04d9\u0443\u0456\u0440","\u043c\u0430\u043c\u044b\u0440","\u043c\u0430\u0443\u0441\u044b\u043c","\u0448\u0456\u043b\u0434\u0435","\u0442\u0430\u043c\u044b\u0437","\u049b\u044b\u0440\u043a\u04af\u0439\u0435\u043a","\u049b\u0430\u0437\u0430\u043d", "\u049b\u0430\u0440\u0430\u0448\u0430","\u0436\u0435\u043b\u0442\u043e\u049b\u0441\u0430\u043d",""],AbbreviatedMonthGenitiveNames:[],AMDesignator:"AM",PMDesignator:"PM",DateSeparator:".",TimeSeparator:":",ShortDatePattern:"135"},80:{LCID:80,Name:"mn",CurrencyPositivePattern:2,CurrencyNegativePattern:9,CurrencySymbol:"\u20ae",NumberDecimalSeparator:".",NumberGroupSeparator:",",NumberGroupSizes:[3],DayNames:["\u043d\u044f\u043c","\u0434\u0430\u0432\u0430\u0430","\u043c\u044f\u0433\u043c\u0430\u0440", "\u043b\u0445\u0430\u0433\u0432\u0430","\u043f\u04af\u0440\u044d\u0432","\u0431\u0430\u0430\u0441\u0430\u043d","\u0431\u044f\u043c\u0431\u0430"],AbbreviatedDayNames:["\u041d\u044f","\u0414\u0430","\u041c\u044f","\u041b\u0445","\u041f\u04af","\u0411\u0430","\u0411\u044f"],MonthNames:["\u041d\u044d\u0433\u0434\u04af\u0433\u044d\u044d\u0440 \u0441\u0430\u0440","\u0425\u043e\u0451\u0440\u0434\u0443\u0433\u0430\u0430\u0440 \u0441\u0430\u0440","\u0413\u0443\u0440\u0430\u0432\u0434\u0443\u0433\u0430\u0430\u0440 \u0441\u0430\u0440", "\u0414\u04e9\u0440\u04e9\u0432\u0434\u04af\u0433\u044d\u044d\u0440 \u0441\u0430\u0440","\u0422\u0430\u0432\u0434\u0443\u0433\u0430\u0430\u0440 \u0441\u0430\u0440","\u0417\u0443\u0440\u0433\u0430\u0430\u0434\u0443\u0433\u0430\u0430\u0440 \u0441\u0430\u0440","\u0414\u043e\u043b\u043e\u043e\u0434\u0443\u0433\u0430\u0430\u0440 \u0441\u0430\u0440","\u041d\u0430\u0439\u043c\u0434\u0443\u0433\u0430\u0430\u0440 \u0441\u0430\u0440","\u0415\u0441\u0434\u04af\u0433\u044d\u044d\u0440 \u0441\u0430\u0440","\u0410\u0440\u0430\u0432\u0434\u0443\u0433\u0430\u0430\u0440 \u0441\u0430\u0440", "\u0410\u0440\u0432\u0430\u043d \u043d\u044d\u0433\u0434\u04af\u0433\u044d\u044d\u0440 \u0441\u0430\u0440","\u0410\u0440\u0432\u0430\u043d \u0445\u043e\u0451\u0440\u0434\u0443\u0433\u0430\u0430\u0440 \u0441\u0430\u0440",""],AbbreviatedMonthNames:["1-\u0440 \u0441\u0430\u0440","2-\u0440 \u0441\u0430\u0440","3-\u0440 \u0441\u0430\u0440","4-\u0440 \u0441\u0430\u0440","5-\u0440 \u0441\u0430\u0440","6-\u0440 \u0441\u0430\u0440","7-\u0440 \u0441\u0430\u0440","8-\u0440 \u0441\u0430\u0440","9-\u0440 \u0441\u0430\u0440", "10-\u0440 \u0441\u0430\u0440","11-\u0440 \u0441\u0430\u0440","12-\u0440 \u0441\u0430\u0440",""],MonthGenitiveNames:["\u043d\u044d\u0433\u0434\u04af\u0433\u044d\u044d\u0440 \u0441\u0430\u0440","\u0445\u043e\u0451\u0440\u0434\u0443\u0433\u0430\u0430\u0440 \u0441\u0430\u0440","\u0433\u0443\u0440\u0430\u0432\u0434\u0443\u0433\u0430\u0430\u0440 \u0441\u0430\u0440","\u0434\u04e9\u0440\u04e9\u0432\u0434\u04af\u0433\u044d\u044d\u0440 \u0441\u0430\u0440","\u0442\u0430\u0432\u0434\u0443\u0433\u0430\u0430\u0440 \u0441\u0430\u0440", "\u0437\u0443\u0440\u0433\u0430\u0430\u0434\u0443\u0433\u0430\u0430\u0440 \u0441\u0430\u0440","\u0434\u043e\u043b\u043e\u043e\u0434\u0443\u0433\u0430\u0430\u0440 \u0441\u0430\u0440","\u043d\u0430\u0439\u043c\u0434\u0443\u0433\u0430\u0430\u0440 \u0441\u0430\u0440","\u0435\u0441\u0434\u04af\u0433\u044d\u044d\u0440 \u0441\u0430\u0440","\u0430\u0440\u0430\u0432\u0434\u0443\u0433\u0430\u0430\u0440 \u0441\u0430\u0440","\u0430\u0440\u0432\u0430\u043d \u043d\u044d\u0433\u0434\u04af\u0433\u044d\u044d\u0440 \u0441\u0430\u0440", "\u0430\u0440\u0432\u0430\u043d \u0445\u043e\u0451\u0440\u0434\u0443\u0433\u0430\u0430\u0440 \u0441\u0430\u0440",""],AbbreviatedMonthGenitiveNames:[],AMDesignator:"\u04af.\u04e9.",PMDesignator:"\u04af.\u0445.",DateSeparator:".",TimeSeparator:":",ShortDatePattern:"531"},1026:{LCID:1026,Name:"bg-BG",CurrencyPositivePattern:3,CurrencyNegativePattern:8,CurrencySymbol:"\u043b\u0432.",NumberDecimalSeparator:",",NumberGroupSeparator:" ",NumberGroupSizes:[3],DayNames:["\u043d\u0435\u0434\u0435\u043b\u044f", "\u043f\u043e\u043d\u0435\u0434\u0435\u043b\u043d\u0438\u043a","\u0432\u0442\u043e\u0440\u043d\u0438\u043a","\u0441\u0440\u044f\u0434\u0430","\u0447\u0435\u0442\u0432\u044a\u0440\u0442\u044a\u043a","\u043f\u0435\u0442\u044a\u043a","\u0441\u044a\u0431\u043e\u0442\u0430"],AbbreviatedDayNames:["\u043d\u0435\u0434","\u043f\u043e\u043d","\u0432\u0442","\u0441\u0440","\u0447\u0435\u0442\u0432","\u043f\u0435\u0442","\u0441\u044a\u0431"],MonthNames:["\u044f\u043d\u0443\u0430\u0440\u0438","\u0444\u0435\u0432\u0440\u0443\u0430\u0440\u0438", "\u043c\u0430\u0440\u0442","\u0430\u043f\u0440\u0438\u043b","\u043c\u0430\u0439","\u044e\u043d\u0438","\u044e\u043b\u0438","\u0430\u0432\u0433\u0443\u0441\u0442","\u0441\u0435\u043f\u0442\u0435\u043c\u0432\u0440\u0438","\u043e\u043a\u0442\u043e\u043c\u0432\u0440\u0438","\u043d\u043e\u0435\u043c\u0432\u0440\u0438","\u0434\u0435\u043a\u0435\u043c\u0432\u0440\u0438",""],AbbreviatedMonthNames:["\u044f\u043d\u0443","\u0444\u0435\u0432","\u043c\u0430\u0440","\u0430\u043f\u0440","\u043c\u0430\u0439","\u044e\u043d\u0438", "\u044e\u043b\u0438","\u0430\u0432\u0433","\u0441\u0435\u043f","\u043e\u043a\u0442","\u043d\u043e\u0435","\u0434\u0435\u043a",""],MonthGenitiveNames:[],AbbreviatedMonthGenitiveNames:[],AMDesignator:"",PMDesignator:"",DateSeparator:".",TimeSeparator:":",ShortDatePattern:"025"},1028:{LCID:1028,Name:"zh-TW",CurrencyPositivePattern:0,CurrencyNegativePattern:1,CurrencySymbol:"NT$",NumberDecimalSeparator:".",NumberGroupSeparator:",",NumberGroupSizes:[3],DayNames:["\u661f\u671f\u65e5","\u661f\u671f\u4e00", "\u661f\u671f\u4e8c","\u661f\u671f\u4e09","\u661f\u671f\u56db","\u661f\u671f\u4e94","\u661f\u671f\u516d"],AbbreviatedDayNames:["\u9031\u65e5","\u9031\u4e00","\u9031\u4e8c","\u9031\u4e09","\u9031\u56db","\u9031\u4e94","\u9031\u516d"],MonthNames:["\u4e00\u6708","\u4e8c\u6708","\u4e09\u6708","\u56db\u6708","\u4e94\u6708","\u516d\u6708","\u4e03\u6708","\u516b\u6708","\u4e5d\u6708","\u5341\u6708","\u5341\u4e00\u6708","\u5341\u4e8c\u6708",""],AbbreviatedMonthNames:["\u4e00\u6708","\u4e8c\u6708","\u4e09\u6708", "\u56db\u6708","\u4e94\u6708","\u516d\u6708","\u4e03\u6708","\u516b\u6708","\u4e5d\u6708","\u5341\u6708","\u5341\u4e00\u6708","\u5341\u4e8c\u6708",""],MonthGenitiveNames:[],AbbreviatedMonthGenitiveNames:[],AMDesignator:"\u4e0a\u5348",PMDesignator:"\u4e0b\u5348",DateSeparator:"/",TimeSeparator:":",ShortDatePattern:"520"},1029:{LCID:1029,Name:"cs-CZ",CurrencyPositivePattern:3,CurrencyNegativePattern:8,CurrencySymbol:"K\u010d",NumberDecimalSeparator:",",NumberGroupSeparator:" ",NumberGroupSizes:[3], DayNames:["ned\u011ble","pond\u011bl\u00ed","\u00fater\u00fd","st\u0159eda","\u010dtvrtek","p\u00e1tek","sobota"],AbbreviatedDayNames:["ne","po","\u00fat","st","\u010dt","p\u00e1","so"],MonthNames:["leden","\u00fanor","b\u0159ezen","duben","kv\u011bten","\u010derven","\u010dervenec","srpen","z\u00e1\u0159\u00ed","\u0159\u00edjen","listopad","prosinec",""],AbbreviatedMonthNames:["led","\u00fano","b\u0159e","dub","kv\u011b","\u010dvn","\u010dvc","srp","z\u00e1\u0159","\u0159\u00edj","lis","pro",""], MonthGenitiveNames:["ledna","\u00fanora","b\u0159ezna","dubna","kv\u011btna","\u010dervna","\u010dervence","srpna","z\u00e1\u0159\u00ed","\u0159\u00edjna","listopadu","prosince",""],AbbreviatedMonthGenitiveNames:[],AMDesignator:"dop.",PMDesignator:"odp.",DateSeparator:".",TimeSeparator:":",ShortDatePattern:"135"},1031:{LCID:1031,Name:"de-DE",CurrencyPositivePattern:3,CurrencyNegativePattern:8,CurrencySymbol:"\u20ac",NumberDecimalSeparator:",",NumberGroupSeparator:".",NumberGroupSizes:[3],DayNames:["Sonntag", "Montag","Dienstag","Mittwoch","Donnerstag","Freitag","Samstag"],AbbreviatedDayNames:["So","Mo","Di","Mi","Do","Fr","Sa"],MonthNames:["Januar","Februar","M\u00e4rz","April","Mai","Juni","Juli","August","September","Oktober","November","Dezember",""],AbbreviatedMonthNames:["Jan","Feb","Mrz","Apr","Mai","Jun","Jul","Aug","Sep","Okt","Nov","Dez",""],MonthGenitiveNames:[],AbbreviatedMonthGenitiveNames:[],AMDesignator:"",PMDesignator:"",DateSeparator:".",TimeSeparator:":",ShortDatePattern:"135"},1032:{LCID:1032, Name:"el-GR",CurrencyPositivePattern:3,CurrencyNegativePattern:8,CurrencySymbol:"\u20ac",NumberDecimalSeparator:",",NumberGroupSeparator:".",NumberGroupSizes:[3],DayNames:["\u039a\u03c5\u03c1\u03b9\u03b1\u03ba\u03ae","\u0394\u03b5\u03c5\u03c4\u03ad\u03c1\u03b1","\u03a4\u03c1\u03af\u03c4\u03b7","\u03a4\u03b5\u03c4\u03ac\u03c1\u03c4\u03b7","\u03a0\u03ad\u03bc\u03c0\u03c4\u03b7","\u03a0\u03b1\u03c1\u03b1\u03c3\u03ba\u03b5\u03c5\u03ae","\u03a3\u03ac\u03b2\u03b2\u03b1\u03c4\u03bf"],AbbreviatedDayNames:["\u039a\u03c5\u03c1", "\u0394\u03b5\u03c5","\u03a4\u03c1\u03b9","\u03a4\u03b5\u03c4","\u03a0\u03b5\u03bc","\u03a0\u03b1\u03c1","\u03a3\u03b1\u03b2"],MonthNames:["\u0399\u03b1\u03bd\u03bf\u03c5\u03ac\u03c1\u03b9\u03bf\u03c2","\u03a6\u03b5\u03b2\u03c1\u03bf\u03c5\u03ac\u03c1\u03b9\u03bf\u03c2","\u039c\u03ac\u03c1\u03c4\u03b9\u03bf\u03c2","\u0391\u03c0\u03c1\u03af\u03bb\u03b9\u03bf\u03c2","\u039c\u03ac\u03b9\u03bf\u03c2","\u0399\u03bf\u03cd\u03bd\u03b9\u03bf\u03c2","\u0399\u03bf\u03cd\u03bb\u03b9\u03bf\u03c2","\u0391\u03cd\u03b3\u03bf\u03c5\u03c3\u03c4\u03bf\u03c2", "\u03a3\u03b5\u03c0\u03c4\u03ad\u03bc\u03b2\u03c1\u03b9\u03bf\u03c2","\u039f\u03ba\u03c4\u03ce\u03b2\u03c1\u03b9\u03bf\u03c2","\u039d\u03bf\u03ad\u03bc\u03b2\u03c1\u03b9\u03bf\u03c2","\u0394\u03b5\u03ba\u03ad\u03bc\u03b2\u03c1\u03b9\u03bf\u03c2",""],AbbreviatedMonthNames:["\u0399\u03b1\u03bd","\u03a6\u03b5\u03b2","\u039c\u03b1\u03c1","\u0391\u03c0\u03c1","\u039c\u03b1\u03ca","\u0399\u03bf\u03c5\u03bd","\u0399\u03bf\u03c5\u03bb","\u0391\u03c5\u03b3","\u03a3\u03b5\u03c0","\u039f\u03ba\u03c4","\u039d\u03bf\u03b5", "\u0394\u03b5\u03ba",""],MonthGenitiveNames:["\u0399\u03b1\u03bd\u03bf\u03c5\u03b1\u03c1\u03af\u03bf\u03c5","\u03a6\u03b5\u03b2\u03c1\u03bf\u03c5\u03b1\u03c1\u03af\u03bf\u03c5","\u039c\u03b1\u03c1\u03c4\u03af\u03bf\u03c5","\u0391\u03c0\u03c1\u03b9\u03bb\u03af\u03bf\u03c5","\u039c\u03b1\u0390\u03bf\u03c5","\u0399\u03bf\u03c5\u03bd\u03af\u03bf\u03c5","\u0399\u03bf\u03c5\u03bb\u03af\u03bf\u03c5","\u0391\u03c5\u03b3\u03bf\u03cd\u03c3\u03c4\u03bf\u03c5","\u03a3\u03b5\u03c0\u03c4\u03b5\u03bc\u03b2\u03c1\u03af\u03bf\u03c5", "\u039f\u03ba\u03c4\u03c9\u03b2\u03c1\u03af\u03bf\u03c5","\u039d\u03bf\u03b5\u03bc\u03b2\u03c1\u03af\u03bf\u03c5","\u0394\u03b5\u03ba\u03b5\u03bc\u03b2\u03c1\u03af\u03bf\u03c5",""],AbbreviatedMonthGenitiveNames:[],AMDesignator:"\u03c0\u03bc",PMDesignator:"\u03bc\u03bc",DateSeparator:"/",TimeSeparator:":",ShortDatePattern:"025"},1033:{LCID:1033,Name:"en-US",CurrencyPositivePattern:0,CurrencyNegativePattern:0,CurrencySymbol:"$",NumberDecimalSeparator:".",NumberGroupSeparator:",",NumberGroupSizes:[3], DayNames:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],AbbreviatedDayNames:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],MonthNames:["January","February","March","April","May","June","July","August","September","October","November","December",""],AbbreviatedMonthNames:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec",""],MonthGenitiveNames:[],AbbreviatedMonthGenitiveNames:[],AMDesignator:"AM",PMDesignator:"PM",DateSeparator:"/",TimeSeparator:":",ShortDatePattern:"205"}, 1035:{LCID:1035,Name:"fi-FI",CurrencyPositivePattern:3,CurrencyNegativePattern:8,CurrencySymbol:"\u20ac",NumberDecimalSeparator:",",NumberGroupSeparator:" ",NumberGroupSizes:[3],DayNames:["sunnuntai","maanantai","tiistai","keskiviikko","torstai","perjantai","lauantai"],AbbreviatedDayNames:["su","ma","ti","ke","to","pe","la"],MonthNames:["tammikuu","helmikuu","maaliskuu","huhtikuu","toukokuu","kes\u00e4kuu","hein\u00e4kuu","elokuu","syyskuu","lokakuu","marraskuu","joulukuu",""],AbbreviatedMonthNames:["tammi", "helmi","maalis","huhti","touko","kes\u00e4","hein\u00e4","elo","syys","loka","marras","joulu",""],MonthGenitiveNames:["tammikuuta","helmikuuta","maaliskuuta","huhtikuuta","toukokuuta","kes\u00e4kuuta","hein\u00e4kuuta","elokuuta","syyskuuta","lokakuuta","marraskuuta","joulukuuta",""],AbbreviatedMonthGenitiveNames:["tammik.","helmik.","maalisk.","huhtik.","toukok.","kes\u00e4k.","hein\u00e4k.","elok.","syysk.","lokak.","marrask.","jouluk.",""],AMDesignator:"ap.",PMDesignator:"ip.",DateSeparator:".", TimeSeparator:".",ShortDatePattern:"025"},1036:{LCID:1036,Name:"fr-FR",CurrencyPositivePattern:3,CurrencyNegativePattern:8,CurrencySymbol:"\u20ac",NumberDecimalSeparator:",",NumberGroupSeparator:" ",NumberGroupSizes:[3],DayNames:["dimanche","lundi","mardi","mercredi","jeudi","vendredi","samedi"],AbbreviatedDayNames:["dim.","lun.","mar.","mer.","jeu.","ven.","sam."],MonthNames:["janvier","f\u00e9vrier","mars","avril","mai","juin","juillet","ao\u00fbt","septembre","octobre","novembre","d\u00e9cembre", ""],AbbreviatedMonthNames:["janv.","f\u00e9vr.","mars","avr.","mai","juin","juil.","ao\u00fbt","sept.","oct.","nov.","d\u00e9c.",""],MonthGenitiveNames:[],AbbreviatedMonthGenitiveNames:[],AMDesignator:"",PMDesignator:"",DateSeparator:"/",TimeSeparator:":",ShortDatePattern:"135"},1038:{LCID:1038,Name:"hu-HU",CurrencyPositivePattern:3,CurrencyNegativePattern:8,CurrencySymbol:"Ft",NumberDecimalSeparator:",",NumberGroupSeparator:" ",NumberGroupSizes:[3],DayNames:["vas\u00e1rnap","h\u00e9tf\u0151","kedd", "szerda","cs\u00fct\u00f6rt\u00f6k","p\u00e9ntek","szombat"],AbbreviatedDayNames:["V","H","K","Sze","Cs","P","Szo"],MonthNames:["janu\u00e1r","febru\u00e1r","m\u00e1rcius","\u00e1prilis","m\u00e1jus","j\u00fanius","j\u00falius","augusztus","szeptember","okt\u00f3ber","november","december",""],AbbreviatedMonthNames:["jan.","febr.","m\u00e1rc.","\u00e1pr.","m\u00e1j.","j\u00fan.","j\u00fal.","aug.","szept.","okt.","nov.","dec.",""],MonthGenitiveNames:[],AbbreviatedMonthGenitiveNames:[],AMDesignator:"de.", PMDesignator:"du.",DateSeparator:". ",TimeSeparator:":",ShortDatePattern:"531"},1040:{LCID:1040,Name:"it-IT",CurrencyPositivePattern:3,CurrencyNegativePattern:8,CurrencySymbol:"\u20ac",NumberDecimalSeparator:",",NumberGroupSeparator:".",NumberGroupSizes:[3],DayNames:["domenica","luned\u00ec","marted\u00ec","mercoled\u00ec","gioved\u00ec","venerd\u00ec","sabato"],AbbreviatedDayNames:["dom","lun","mar","mer","gio","ven","sab"],MonthNames:["gennaio","febbraio","marzo","aprile","maggio","giugno","luglio", "agosto","settembre","ottobre","novembre","dicembre",""],AbbreviatedMonthNames:["gen","feb","mar","apr","mag","giu","lug","ago","set","ott","nov","dic",""],MonthGenitiveNames:[],AbbreviatedMonthGenitiveNames:[],AMDesignator:"",PMDesignator:"",DateSeparator:"/",TimeSeparator:":",ShortDatePattern:"135"},1041:{LCID:1041,Name:"ja-JP",CurrencyPositivePattern:0,CurrencyNegativePattern:1,CurrencySymbol:"\u00a5",NumberDecimalSeparator:".",NumberGroupSeparator:",",NumberGroupSizes:[3],DayNames:["\u65e5\u66dc\u65e5", "\u6708\u66dc\u65e5","\u706b\u66dc\u65e5","\u6c34\u66dc\u65e5","\u6728\u66dc\u65e5","\u91d1\u66dc\u65e5","\u571f\u66dc\u65e5"],AbbreviatedDayNames:["\u65e5","\u6708","\u706b","\u6c34","\u6728","\u91d1","\u571f"],MonthNames:["1\u6708","2\u6708","3\u6708","4\u6708","5\u6708","6\u6708","7\u6708","8\u6708","9\u6708","10\u6708","11\u6708","12\u6708",""],AbbreviatedMonthNames:["1","2","3","4","5","6","7","8","9","10","11","12",""],MonthGenitiveNames:[],AbbreviatedMonthGenitiveNames:[],AMDesignator:"\u5348\u524d", PMDesignator:"\u5348\u5f8c",DateSeparator:"/",TimeSeparator:":",ShortDatePattern:"531"},1042:{LCID:1042,Name:"ko-KR",CurrencyPositivePattern:0,CurrencyNegativePattern:1,CurrencySymbol:"\u20a9",NumberDecimalSeparator:".",NumberGroupSeparator:",",NumberGroupSizes:[3],DayNames:["\uc77c\uc694\uc77c","\uc6d4\uc694\uc77c","\ud654\uc694\uc77c","\uc218\uc694\uc77c","\ubaa9\uc694\uc77c","\uae08\uc694\uc77c","\ud1a0\uc694\uc77c"],AbbreviatedDayNames:["\uc77c","\uc6d4","\ud654","\uc218","\ubaa9","\uae08","\ud1a0"], MonthNames:["1\uc6d4","2\uc6d4","3\uc6d4","4\uc6d4","5\uc6d4","6\uc6d4","7\uc6d4","8\uc6d4","9\uc6d4","10\uc6d4","11\uc6d4","12\uc6d4",""],AbbreviatedMonthNames:["1","2","3","4","5","6","7","8","9","10","11","12",""],MonthGenitiveNames:[],AbbreviatedMonthGenitiveNames:[],AMDesignator:"\uc624\uc804",PMDesignator:"\uc624\ud6c4",DateSeparator:"-",TimeSeparator:":",ShortDatePattern:"531"},1043:{LCID:1043,Name:"nl-NL",CurrencyPositivePattern:2,CurrencyNegativePattern:12,CurrencySymbol:"\u20ac",NumberDecimalSeparator:",", NumberGroupSeparator:".",NumberGroupSizes:[3],DayNames:["zondag","maandag","dinsdag","woensdag","donderdag","vrijdag","zaterdag"],AbbreviatedDayNames:["zo","ma","di","wo","do","vr","za"],MonthNames:["januari","februari","maart","april","mei","juni","juli","augustus","september","oktober","november","december",""],AbbreviatedMonthNames:["jan","feb","mrt","apr","mei","jun","jul","aug","sep","okt","nov","dec",""],MonthGenitiveNames:[],AbbreviatedMonthGenitiveNames:[],AMDesignator:"",PMDesignator:"", DateSeparator:"-",TimeSeparator:":",ShortDatePattern:"025"},1045:{LCID:1045,Name:"pl-PL",CurrencyPositivePattern:3,CurrencyNegativePattern:8,CurrencySymbol:"z\u0142",NumberDecimalSeparator:",",NumberGroupSeparator:" ",NumberGroupSizes:[3],DayNames:["niedziela","poniedzia\u0142ek","wtorek","\u015broda","czwartek","pi\u0105tek","sobota"],AbbreviatedDayNames:["niedz.","pon.","wt.","\u015br.","czw.","pt.","sob."],MonthNames:["stycze\u0144","luty","marzec","kwiecie\u0144","maj","czerwiec","lipiec","sierpie\u0144", "wrzesie\u0144","pa\u017adziernik","listopad","grudzie\u0144",""],AbbreviatedMonthNames:["sty","lut","mar","kwi","maj","cze","lip","sie","wrz","pa\u017a","lis","gru",""],MonthGenitiveNames:["stycznia","lutego","marca","kwietnia","maja","czerwca","lipca","sierpnia","wrze\u015bnia","pa\u017adziernika","listopada","grudnia",""],AbbreviatedMonthGenitiveNames:[],AMDesignator:"AM",PMDesignator:"PM",DateSeparator:".",TimeSeparator:":",ShortDatePattern:"135"},1046:{LCID:1046,Name:"pt-BR",CurrencyPositivePattern:2, CurrencyNegativePattern:9,CurrencySymbol:"R$",NumberDecimalSeparator:",",NumberGroupSeparator:".",NumberGroupSizes:[3],DayNames:["domingo","segunda-feira","ter\u00e7a-feira","quarta-feira","quinta-feira","sexta-feira","s\u00e1bado"],AbbreviatedDayNames:["dom","seg","ter","qua","qui","sex","s\u00e1b"],MonthNames:["janeiro","fevereiro","mar\u00e7o","abril","maio","junho","julho","agosto","setembro","outubro","novembro","dezembro",""],AbbreviatedMonthNames:["jan","fev","mar","abr","mai","jun","jul", "ago","set","out","nov","dez",""],MonthGenitiveNames:[],AbbreviatedMonthGenitiveNames:[],AMDesignator:"",PMDesignator:"",DateSeparator:"/",TimeSeparator:":",ShortDatePattern:"135"},1049:{LCID:1049,Name:"ru-RU",CurrencyPositivePattern:3,CurrencyNegativePattern:8,CurrencySymbol:"\u20bd",NumberDecimalSeparator:",",NumberGroupSeparator:" ",NumberGroupSizes:[3],DayNames:["\u0432\u043e\u0441\u043a\u0440\u0435\u0441\u0435\u043d\u044c\u0435","\u043f\u043e\u043d\u0435\u0434\u0435\u043b\u044c\u043d\u0438\u043a", "\u0432\u0442\u043e\u0440\u043d\u0438\u043a","\u0441\u0440\u0435\u0434\u0430","\u0447\u0435\u0442\u0432\u0435\u0440\u0433","\u043f\u044f\u0442\u043d\u0438\u0446\u0430","\u0441\u0443\u0431\u0431\u043e\u0442\u0430"],AbbreviatedDayNames:["\u0412\u0441","\u041f\u043d","\u0412\u0442","\u0421\u0440","\u0427\u0442","\u041f\u0442","\u0421\u0431"],MonthNames:["\u042f\u043d\u0432\u0430\u0440\u044c","\u0424\u0435\u0432\u0440\u0430\u043b\u044c","\u041c\u0430\u0440\u0442","\u0410\u043f\u0440\u0435\u043b\u044c", "\u041c\u0430\u0439","\u0418\u044e\u043d\u044c","\u0418\u044e\u043b\u044c","\u0410\u0432\u0433\u0443\u0441\u0442","\u0421\u0435\u043d\u0442\u044f\u0431\u0440\u044c","\u041e\u043a\u0442\u044f\u0431\u0440\u044c","\u041d\u043e\u044f\u0431\u0440\u044c","\u0414\u0435\u043a\u0430\u0431\u0440\u044c",""],AbbreviatedMonthNames:["\u044f\u043d\u0432","\u0444\u0435\u0432","\u043c\u0430\u0440","\u0430\u043f\u0440","\u043c\u0430\u0439","\u0438\u044e\u043d","\u0438\u044e\u043b","\u0430\u0432\u0433","\u0441\u0435\u043d", "\u043e\u043a\u0442","\u043d\u043e\u044f","\u0434\u0435\u043a",""],MonthGenitiveNames:["\u044f\u043d\u0432\u0430\u0440\u044f","\u0444\u0435\u0432\u0440\u0430\u043b\u044f","\u043c\u0430\u0440\u0442\u0430","\u0430\u043f\u0440\u0435\u043b\u044f","\u043c\u0430\u044f","\u0438\u044e\u043d\u044f","\u0438\u044e\u043b\u044f","\u0430\u0432\u0433\u0443\u0441\u0442\u0430","\u0441\u0435\u043d\u0442\u044f\u0431\u0440\u044f","\u043e\u043a\u0442\u044f\u0431\u0440\u044f","\u043d\u043e\u044f\u0431\u0440\u044f","\u0434\u0435\u043a\u0430\u0431\u0440\u044f", ""],AbbreviatedMonthGenitiveNames:["\u044f\u043d\u0432","\u0444\u0435\u0432","\u043c\u0430\u0440","\u0430\u043f\u0440","\u043c\u0430\u044f","\u0438\u044e\u043d","\u0438\u044e\u043b","\u0430\u0432\u0433","\u0441\u0435\u043d","\u043e\u043a\u0442","\u043d\u043e\u044f","\u0434\u0435\u043a",""],AMDesignator:"",PMDesignator:"",DateSeparator:".",TimeSeparator:":",ShortDatePattern:"135"},1050:{LCID:1050,Name:"hr-HR",CurrencyPositivePattern:3,CurrencyNegativePattern:8,CurrencySymbol:"kn",NumberDecimalSeparator:",", NumberGroupSeparator:".",NumberGroupSizes:[3],DayNames:["nedjelja","ponedjeljak","utorak","srijeda","\u010detvrtak","petak","subota"],AbbreviatedDayNames:["ned","pon","uto","sri","\u010det","pet","sub"],MonthNames:["sije\u010danj","velja\u010da","o\u017eujak","travanj","svibanj","lipanj","srpanj","kolovoz","rujan","listopad","studeni","prosinac",""],AbbreviatedMonthNames:["sij","vlj","o\u017eu","tra","svi","lip","srp","kol","ruj","lis","stu","pro",""],MonthGenitiveNames:["sije\u010dnja","velja\u010de", "o\u017eujka","travnja","svibnja","lipnja","srpnja","kolovoza","rujna","listopada","studenog","prosinca",""],AbbreviatedMonthGenitiveNames:[],AMDesignator:"",PMDesignator:"",DateSeparator:".",TimeSeparator:":",ShortDatePattern:"025"},1051:{LCID:1051,Name:"sk-SK",CurrencyPositivePattern:3,CurrencyNegativePattern:8,CurrencySymbol:"\u20ac",NumberDecimalSeparator:",",NumberGroupSeparator:" ",NumberGroupSizes:[3],DayNames:["nede\u013ea","pondelok","utorok","streda","\u0161tvrtok","piatok","sobota"],AbbreviatedDayNames:["ne", "po","ut","st","\u0161t","pi","so"],MonthNames:["janu\u00e1r","febru\u00e1r","marec","apr\u00edl","m\u00e1j","j\u00fan","j\u00fal","august","september","okt\u00f3ber","november","december",""],AbbreviatedMonthNames:["jan","feb","mar","apr","m\u00e1j","j\u00fan","j\u00fal","aug","sep","okt","nov","dec",""],MonthGenitiveNames:["janu\u00e1ra","febru\u00e1ra","marca","apr\u00edla","m\u00e1ja","j\u00fana","j\u00fala","augusta","septembra","okt\u00f3bra","novembra","decembra",""],AbbreviatedMonthGenitiveNames:[], AMDesignator:"AM",PMDesignator:"PM",DateSeparator:". ",TimeSeparator:":",ShortDatePattern:"025"},1053:{LCID:1053,Name:"sv-SE",CurrencyPositivePattern:3,CurrencyNegativePattern:8,CurrencySymbol:"kr",NumberDecimalSeparator:",",NumberGroupSeparator:" ",NumberGroupSizes:[3],DayNames:["s\u00f6ndag","m\u00e5ndag","tisdag","onsdag","torsdag","fredag","l\u00f6rdag"],AbbreviatedDayNames:["s\u00f6n","m\u00e5n","tis","ons","tor","fre","l\u00f6r"],MonthNames:["januari","februari","mars","april","maj","juni", "juli","augusti","september","oktober","november","december",""],AbbreviatedMonthNames:["jan","feb","mar","apr","maj","jun","jul","aug","sep","okt","nov","dec",""],MonthGenitiveNames:[],AbbreviatedMonthGenitiveNames:[],AMDesignator:"",PMDesignator:"",DateSeparator:"-",TimeSeparator:":",ShortDatePattern:"531"},1055:{LCID:1055,Name:"tr-TR",CurrencyPositivePattern:0,CurrencyNegativePattern:1,CurrencySymbol:"\u20ba",NumberDecimalSeparator:",",NumberGroupSeparator:".",NumberGroupSizes:[3],DayNames:["Pazar", "Pazartesi","Sal\u0131","\u00c7ar\u015famba","Per\u015fembe","Cuma","Cumartesi"],AbbreviatedDayNames:["Paz","Pzt","Sal","\u00c7ar","Per","Cum","Cmt"],MonthNames:["Ocak","\u015eubat","Mart","Nisan","May\u0131s","Haziran","Temmuz","A\u011fustos","Eyl\u00fcl","Ekim","Kas\u0131m","Aral\u0131k",""],AbbreviatedMonthNames:["Oca","\u015eub","Mar","Nis","May","Haz","Tem","A\u011fu","Eyl","Eki","Kas","Ara",""],MonthGenitiveNames:[],AbbreviatedMonthGenitiveNames:[],AMDesignator:"\u00d6\u00d6",PMDesignator:"\u00d6S", DateSeparator:".",TimeSeparator:":",ShortDatePattern:"035"},1058:{LCID:1058,Name:"uk-UA",CurrencyPositivePattern:3,CurrencyNegativePattern:8,CurrencySymbol:"\u20b4",NumberDecimalSeparator:",",NumberGroupSeparator:" ",NumberGroupSizes:[3],DayNames:["\u043d\u0435\u0434\u0456\u043b\u044f","\u043f\u043e\u043d\u0435\u0434\u0456\u043b\u043e\u043a","\u0432\u0456\u0432\u0442\u043e\u0440\u043e\u043a","\u0441\u0435\u0440\u0435\u0434\u0430","\u0447\u0435\u0442\u0432\u0435\u0440","\u043f'\u044f\u0442\u043d\u0438\u0446\u044f", "\u0441\u0443\u0431\u043e\u0442\u0430"],AbbreviatedDayNames:["\u041d\u0434","\u041f\u043d","\u0412\u0442","\u0421\u0440","\u0427\u0442","\u041f\u0442","\u0421\u0431"],MonthNames:["\u0441\u0456\u0447\u0435\u043d\u044c","\u043b\u044e\u0442\u0438\u0439","\u0431\u0435\u0440\u0435\u0437\u0435\u043d\u044c","\u043a\u0432\u0456\u0442\u0435\u043d\u044c","\u0442\u0440\u0430\u0432\u0435\u043d\u044c","\u0447\u0435\u0440\u0432\u0435\u043d\u044c","\u043b\u0438\u043f\u0435\u043d\u044c","\u0441\u0435\u0440\u043f\u0435\u043d\u044c", "\u0432\u0435\u0440\u0435\u0441\u0435\u043d\u044c","\u0436\u043e\u0432\u0442\u0435\u043d\u044c","\u043b\u0438\u0441\u0442\u043e\u043f\u0430\u0434","\u0433\u0440\u0443\u0434\u0435\u043d\u044c",""],AbbreviatedMonthNames:["\u0421\u0456\u0447","\u041b\u044e\u0442","\u0411\u0435\u0440","\u041a\u0432\u0456","\u0422\u0440\u0430","\u0427\u0435\u0440","\u041b\u0438\u043f","\u0421\u0435\u0440","\u0412\u0435\u0440","\u0416\u043e\u0432","\u041b\u0438\u0441","\u0413\u0440\u0443",""],MonthGenitiveNames:["\u0441\u0456\u0447\u043d\u044f", "\u043b\u044e\u0442\u043e\u0433\u043e","\u0431\u0435\u0440\u0435\u0437\u043d\u044f","\u043a\u0432\u0456\u0442\u043d\u044f","\u0442\u0440\u0430\u0432\u043d\u044f","\u0447\u0435\u0440\u0432\u043d\u044f","\u043b\u0438\u043f\u043d\u044f","\u0441\u0435\u0440\u043f\u043d\u044f","\u0432\u0435\u0440\u0435\u0441\u043d\u044f","\u0436\u043e\u0432\u0442\u043d\u044f","\u043b\u0438\u0441\u0442\u043e\u043f\u0430\u0434\u0430","\u0433\u0440\u0443\u0434\u043d\u044f",""],AbbreviatedMonthGenitiveNames:["\u0441\u0456\u0447", "\u043b\u044e\u0442","\u0431\u0435\u0440","\u043a\u0432\u0456","\u0442\u0440\u0430","\u0447\u0435\u0440","\u043b\u0438\u043f","\u0441\u0435\u0440","\u0432\u0435\u0440","\u0436\u043e\u0432","\u043b\u0438\u0441","\u0433\u0440\u0443",""],AMDesignator:"",PMDesignator:"",DateSeparator:".",TimeSeparator:":",ShortDatePattern:"135"},1060:{LCID:1060,Name:"sl-SI",CurrencyPositivePattern:3,CurrencyNegativePattern:8,CurrencySymbol:"\u20ac",NumberDecimalSeparator:",",NumberGroupSeparator:".",NumberGroupSizes:[3], DayNames:["nedelja","ponedeljek","torek","sreda","\u010detrtek","petek","sobota"],AbbreviatedDayNames:["ned.","pon.","tor.","sre.","\u010det.","pet.","sob."],MonthNames:["januar","februar","marec","april","maj","junij","julij","avgust","september","oktober","november","december",""],AbbreviatedMonthNames:["jan.","feb.","mar.","apr.","maj","jun.","jul.","avg.","sep.","okt.","nov.","dec.",""],MonthGenitiveNames:[],AbbreviatedMonthGenitiveNames:[],AMDesignator:"dop.",PMDesignator:"pop.",DateSeparator:". ", TimeSeparator:":",ShortDatePattern:"035"},1062:{LCID:1062,Name:"lv-LV",CurrencyPositivePattern:3,CurrencyNegativePattern:8,CurrencySymbol:"\u20ac",NumberDecimalSeparator:",",NumberGroupSeparator:" ",NumberGroupSizes:[3],DayNames:["sv\u0113tdiena","pirmdiena","otrdiena","tre\u0161diena","ceturtdiena","piektdiena","sestdiena"],AbbreviatedDayNames:["sv\u0113td.","pirmd.","otrd.","tre\u0161d.","ceturtd.","piektd.","sestd."],MonthNames:["janv\u0101ris","febru\u0101ris","marts","apr\u012blis","maijs","j\u016bnijs", "j\u016blijs","augusts","septembris","oktobris","novembris","decembris",""],AbbreviatedMonthNames:["janv.","febr.","marts","apr.","maijs","j\u016bn.","j\u016bl.","aug.","sept.","okt.","nov.","dec.",""],MonthGenitiveNames:[],AbbreviatedMonthGenitiveNames:[],AMDesignator:"priek\u0161p.",PMDesignator:"p\u0113cp.",DateSeparator:".",TimeSeparator:":",ShortDatePattern:"135"},1063:{LCID:1063,Name:"lt-LT",CurrencyPositivePattern:3,CurrencyNegativePattern:8,CurrencySymbol:"\u20ac",NumberDecimalSeparator:",", NumberGroupSeparator:" ",NumberGroupSizes:[3],DayNames:["sekmadienis","pirmadienis","antradienis","tre\u010diadienis","ketvirtadienis","penktadienis","\u0161e\u0161tadienis"],AbbreviatedDayNames:["sk","pr","an","tr","kt","pn","\u0161t"],MonthNames:["sausis","vasaris","kovas","balandis","gegu\u017e\u0117","bir\u017eelis","liepa","rugpj\u016btis","rugs\u0117jis","spalis","lapkritis","gruodis",""],AbbreviatedMonthNames:["saus.","vas.","kov.","bal.","geg.","bir\u017e.","liep.","rugp.","rugs.","spal.", "lapkr.","gruod.",""],MonthGenitiveNames:["sausio","vasario","kovo","baland\u017eio","gegu\u017e\u0117s","bir\u017eelio","liepos","rugpj\u016b\u010dio","rugs\u0117jo","spalio","lapkri\u010dio","gruod\u017eio",""],AbbreviatedMonthGenitiveNames:[],AMDesignator:"prie\u0161piet",PMDesignator:"popiet",DateSeparator:"-",TimeSeparator:":",ShortDatePattern:"531"},1066:{LCID:1066,Name:"vi-VN",CurrencyPositivePattern:3,CurrencyNegativePattern:8,CurrencySymbol:"\u20ab",NumberDecimalSeparator:",",NumberGroupSeparator:".", NumberGroupSizes:[3],DayNames:["Chu\u0309 Nh\u00e2\u0323t","Th\u01b0\u0301 Hai","Th\u01b0\u0301 Ba","Th\u01b0\u0301 T\u01b0","Th\u01b0\u0301 N\u0103m","Th\u01b0\u0301 Sa\u0301u","Th\u01b0\u0301 Ba\u0309y"],AbbreviatedDayNames:["CN","T2","T3","T4","T5","T6","T7"],MonthNames:["Tha\u0301ng Gi\u00eang","Tha\u0301ng Hai","Tha\u0301ng Ba","Tha\u0301ng T\u01b0","Tha\u0301ng N\u0103m","Tha\u0301ng Sa\u0301u","Tha\u0301ng Ba\u0309y","Tha\u0301ng Ta\u0301m","Tha\u0301ng Chi\u0301n","Tha\u0301ng M\u01b0\u01a1\u0300i", "Tha\u0301ng M\u01b0\u01a1\u0300i M\u00f4\u0323t","Tha\u0301ng M\u01b0\u01a1\u0300i Hai",""],AbbreviatedMonthNames:["Thg1","Thg2","Thg3","Thg4","Thg5","Thg6","Thg7","Thg8","Thg9","Thg10","Thg11","Thg12",""],MonthGenitiveNames:[],AbbreviatedMonthGenitiveNames:[],AMDesignator:"SA",PMDesignator:"CH",DateSeparator:"/",TimeSeparator:":",ShortDatePattern:"135"},1068:{LCID:1068,Name:"az-Latn-AZ",CurrencyPositivePattern:3,CurrencyNegativePattern:8,CurrencySymbol:"\u20bc",NumberDecimalSeparator:",",NumberGroupSeparator:".", NumberGroupSizes:[3],DayNames:["bazar","bazar ert\u0259si","\u00e7\u0259r\u015f\u0259nb\u0259 ax\u015fam\u0131","\u00e7\u0259r\u015f\u0259nb\u0259","c\u00fcm\u0259 ax\u015fam\u0131","c\u00fcm\u0259","\u015f\u0259nb\u0259"],AbbreviatedDayNames:["B.","B.E.","\u00c7.A.","\u00c7.","C.A.","C.","\u015e."],MonthNames:["Yanvar","Fevral","Mart","Aprel","May","\u0130yun","\u0130yul","Avqust","Sentyabr","Oktyabr","Noyabr","Dekabr",""],AbbreviatedMonthNames:["yan","fev","mar","apr","may","iyn","iyl","avq","sen", "okt","noy","dek",""],MonthGenitiveNames:["yanvar","fevral","mart","aprel","may","iyun","iyul","avqust","sentyabr","oktyabr","noyabr","dekabr",""],AbbreviatedMonthGenitiveNames:[],AMDesignator:"AM",PMDesignator:"PM",DateSeparator:".",TimeSeparator:":",ShortDatePattern:"135"},1087:{LCID:1087,Name:"kk-KZ",CurrencyPositivePattern:3,CurrencyNegativePattern:8,CurrencySymbol:"\u20b8",NumberDecimalSeparator:",",NumberGroupSeparator:" ",NumberGroupSizes:[3],DayNames:["\u0436\u0435\u043a\u0441\u0435\u043d\u0431\u0456", "\u0434\u04af\u0439\u0441\u0435\u043d\u0431\u0456","\u0441\u0435\u0439\u0441\u0435\u043d\u0431\u0456","\u0441\u04d9\u0440\u0441\u0435\u043d\u0431\u0456","\u0431\u0435\u0439\u0441\u0435\u043d\u0431\u0456","\u0436\u04b1\u043c\u0430","\u0441\u0435\u043d\u0431\u0456"],AbbreviatedDayNames:["\u0436\u0441","\u0434\u0441","\u0441\u0441","\u0441\u0440","\u0431\u0441","\u0436\u043c","\u0441\u0431"],MonthNames:["\u049a\u0430\u04a3\u0442\u0430\u0440","\u0410\u049b\u043f\u0430\u043d","\u041d\u0430\u0443\u0440\u044b\u0437", "\u0421\u04d9\u0443\u0456\u0440","\u041c\u0430\u043c\u044b\u0440","\u041c\u0430\u0443\u0441\u044b\u043c","\u0428\u0456\u043b\u0434\u0435","\u0422\u0430\u043c\u044b\u0437","\u049a\u044b\u0440\u043a\u04af\u0439\u0435\u043a","\u049a\u0430\u0437\u0430\u043d","\u049a\u0430\u0440\u0430\u0448\u0430","\u0416\u0435\u043b\u0442\u043e\u049b\u0441\u0430\u043d",""],AbbreviatedMonthNames:["\u049b\u0430\u04a3.","\u0430\u049b\u043f.","\u043d\u0430\u0443.","\u0441\u04d9\u0443.","\u043c\u0430\u043c.","\u043c\u0430\u0443.", "\u0448\u0456\u043b.","\u0442\u0430\u043c.","\u049b\u044b\u0440.","\u049b\u0430\u0437.","\u049b\u0430\u0440.","\u0436\u0435\u043b.",""],MonthGenitiveNames:["\u049b\u0430\u04a3\u0442\u0430\u0440","\u0430\u049b\u043f\u0430\u043d","\u043d\u0430\u0443\u0440\u044b\u0437","\u0441\u04d9\u0443\u0456\u0440","\u043c\u0430\u043c\u044b\u0440","\u043c\u0430\u0443\u0441\u044b\u043c","\u0448\u0456\u043b\u0434\u0435","\u0442\u0430\u043c\u044b\u0437","\u049b\u044b\u0440\u043a\u04af\u0439\u0435\u043a","\u049b\u0430\u0437\u0430\u043d", "\u049b\u0430\u0440\u0430\u0448\u0430","\u0436\u0435\u043b\u0442\u043e\u049b\u0441\u0430\u043d",""],AbbreviatedMonthGenitiveNames:[],AMDesignator:"AM",PMDesignator:"PM",DateSeparator:".",TimeSeparator:":",ShortDatePattern:"135"},1104:{LCID:1104,Name:"mn-MN",CurrencyPositivePattern:2,CurrencyNegativePattern:9,CurrencySymbol:"\u20ae",NumberDecimalSeparator:".",NumberGroupSeparator:",",NumberGroupSizes:[3],DayNames:["\u043d\u044f\u043c","\u0434\u0430\u0432\u0430\u0430","\u043c\u044f\u0433\u043c\u0430\u0440", "\u043b\u0445\u0430\u0433\u0432\u0430","\u043f\u04af\u0440\u044d\u0432","\u0431\u0430\u0430\u0441\u0430\u043d","\u0431\u044f\u043c\u0431\u0430"],AbbreviatedDayNames:["\u041d\u044f","\u0414\u0430","\u041c\u044f","\u041b\u0445","\u041f\u04af","\u0411\u0430","\u0411\u044f"],MonthNames:["\u041d\u044d\u0433\u0434\u04af\u0433\u044d\u044d\u0440 \u0441\u0430\u0440","\u0425\u043e\u0451\u0440\u0434\u0443\u0433\u0430\u0430\u0440 \u0441\u0430\u0440","\u0413\u0443\u0440\u0430\u0432\u0434\u0443\u0433\u0430\u0430\u0440 \u0441\u0430\u0440", "\u0414\u04e9\u0440\u04e9\u0432\u0434\u04af\u0433\u044d\u044d\u0440 \u0441\u0430\u0440","\u0422\u0430\u0432\u0434\u0443\u0433\u0430\u0430\u0440 \u0441\u0430\u0440","\u0417\u0443\u0440\u0433\u0430\u0430\u0434\u0443\u0433\u0430\u0430\u0440 \u0441\u0430\u0440","\u0414\u043e\u043b\u043e\u043e\u0434\u0443\u0433\u0430\u0430\u0440 \u0441\u0430\u0440","\u041d\u0430\u0439\u043c\u0434\u0443\u0433\u0430\u0430\u0440 \u0441\u0430\u0440","\u0415\u0441\u0434\u04af\u0433\u044d\u044d\u0440 \u0441\u0430\u0440","\u0410\u0440\u0430\u0432\u0434\u0443\u0433\u0430\u0430\u0440 \u0441\u0430\u0440", "\u0410\u0440\u0432\u0430\u043d \u043d\u044d\u0433\u0434\u04af\u0433\u044d\u044d\u0440 \u0441\u0430\u0440","\u0410\u0440\u0432\u0430\u043d \u0445\u043e\u0451\u0440\u0434\u0443\u0433\u0430\u0430\u0440 \u0441\u0430\u0440",""],AbbreviatedMonthNames:["1-\u0440 \u0441\u0430\u0440","2-\u0440 \u0441\u0430\u0440","3-\u0440 \u0441\u0430\u0440","4-\u0440 \u0441\u0430\u0440","5-\u0440 \u0441\u0430\u0440","6-\u0440 \u0441\u0430\u0440","7-\u0440 \u0441\u0430\u0440","8-\u0440 \u0441\u0430\u0440","9-\u0440 \u0441\u0430\u0440", "10-\u0440 \u0441\u0430\u0440","11-\u0440 \u0441\u0430\u0440","12-\u0440 \u0441\u0430\u0440",""],MonthGenitiveNames:["\u043d\u044d\u0433\u0434\u04af\u0433\u044d\u044d\u0440 \u0441\u0430\u0440","\u0445\u043e\u0451\u0440\u0434\u0443\u0433\u0430\u0430\u0440 \u0441\u0430\u0440","\u0433\u0443\u0440\u0430\u0432\u0434\u0443\u0433\u0430\u0430\u0440 \u0441\u0430\u0440","\u0434\u04e9\u0440\u04e9\u0432\u0434\u04af\u0433\u044d\u044d\u0440 \u0441\u0430\u0440","\u0442\u0430\u0432\u0434\u0443\u0433\u0430\u0430\u0440 \u0441\u0430\u0440", "\u0437\u0443\u0440\u0433\u0430\u0430\u0434\u0443\u0433\u0430\u0430\u0440 \u0441\u0430\u0440","\u0434\u043e\u043b\u043e\u043e\u0434\u0443\u0433\u0430\u0430\u0440 \u0441\u0430\u0440","\u043d\u0430\u0439\u043c\u0434\u0443\u0433\u0430\u0430\u0440 \u0441\u0430\u0440","\u0435\u0441\u0434\u04af\u0433\u044d\u044d\u0440 \u0441\u0430\u0440","\u0430\u0440\u0430\u0432\u0434\u0443\u0433\u0430\u0430\u0440 \u0441\u0430\u0440","\u0430\u0440\u0432\u0430\u043d \u043d\u044d\u0433\u0434\u04af\u0433\u044d\u044d\u0440 \u0441\u0430\u0440", "\u0430\u0440\u0432\u0430\u043d \u0445\u043e\u0451\u0440\u0434\u0443\u0433\u0430\u0430\u0440 \u0441\u0430\u0440",""],AbbreviatedMonthGenitiveNames:[],AMDesignator:"\u04af.\u04e9.",PMDesignator:"\u04af.\u0445.",DateSeparator:".",TimeSeparator:":",ShortDatePattern:"531"},2052:{LCID:2052,Name:"zh-CN",CurrencyPositivePattern:0,CurrencyNegativePattern:2,CurrencySymbol:"\u00a5",NumberDecimalSeparator:".",NumberGroupSeparator:",",NumberGroupSizes:[3],DayNames:["\u661f\u671f\u65e5","\u661f\u671f\u4e00","\u661f\u671f\u4e8c", "\u661f\u671f\u4e09","\u661f\u671f\u56db","\u661f\u671f\u4e94","\u661f\u671f\u516d"],AbbreviatedDayNames:["\u5468\u65e5","\u5468\u4e00","\u5468\u4e8c","\u5468\u4e09","\u5468\u56db","\u5468\u4e94","\u5468\u516d"],MonthNames:["\u4e00\u6708","\u4e8c\u6708","\u4e09\u6708","\u56db\u6708","\u4e94\u6708","\u516d\u6708","\u4e03\u6708","\u516b\u6708","\u4e5d\u6708","\u5341\u6708","\u5341\u4e00\u6708","\u5341\u4e8c\u6708",""],AbbreviatedMonthNames:["1\u6708","2\u6708","3\u6708","4\u6708","5\u6708","6\u6708", "7\u6708","8\u6708","9\u6708","10\u6708","11\u6708","12\u6708",""],MonthGenitiveNames:[],AbbreviatedMonthGenitiveNames:[],AMDesignator:"\u4e0a\u5348",PMDesignator:"\u4e0b\u5348",DateSeparator:"/",TimeSeparator:":",ShortDatePattern:"520"},2055:{LCID:2055,Name:"de-CH",CurrencyPositivePattern:2,CurrencyNegativePattern:2,CurrencySymbol:"CHF",NumberDecimalSeparator:".",NumberGroupSeparator:"\u2019",NumberGroupSizes:[3],DayNames:["Sonntag","Montag","Dienstag","Mittwoch","Donnerstag","Freitag","Samstag"], AbbreviatedDayNames:["So.","Mo.","Di.","Mi.","Do.","Fr.","Sa."],MonthNames:["Januar","Februar","M\u00e4rz","April","Mai","Juni","Juli","August","September","Oktober","November","Dezember",""],AbbreviatedMonthNames:["Jan","Feb","M\u00e4r","Apr","Mai","Jun","Jul","Aug","Sep","Okt","Nov","Dez",""],MonthGenitiveNames:[],AbbreviatedMonthGenitiveNames:["Jan.","Feb.","M\u00e4rz","Apr.","Mai","Juni","Juli","Aug.","Sept.","Okt.","Nov.","Dez.",""],AMDesignator:"AM",PMDesignator:"PM",DateSeparator:".",TimeSeparator:":", ShortDatePattern:"135"},2057:{LCID:2057,Name:"en-GB",CurrencyPositivePattern:0,CurrencyNegativePattern:1,CurrencySymbol:"\u00a3",NumberDecimalSeparator:".",NumberGroupSeparator:",",NumberGroupSizes:[3],DayNames:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],AbbreviatedDayNames:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],MonthNames:["January","February","March","April","May","June","July","August","September","October","November","December",""],AbbreviatedMonthNames:["Jan", "Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec",""],MonthGenitiveNames:[],AbbreviatedMonthGenitiveNames:[],AMDesignator:"AM",PMDesignator:"PM",DateSeparator:"/",TimeSeparator:":",ShortDatePattern:"135"},2058:{LCID:2058,Name:"es-MX",CurrencyPositivePattern:0,CurrencyNegativePattern:1,CurrencySymbol:"$",NumberDecimalSeparator:".",NumberGroupSeparator:",",NumberGroupSizes:[3],DayNames:["domingo","lunes","martes","mi\u00e9rcoles","jueves","viernes","s\u00e1bado"],AbbreviatedDayNames:["dom.", "lun.","mar.","mi\u00e9.","jue.","vie.","s\u00e1b."],MonthNames:["enero","febrero","marzo","abril","mayo","junio","julio","agosto","septiembre","octubre","noviembre","diciembre",""],AbbreviatedMonthNames:["ene.","feb.","mar.","abr.","may.","jun.","jul.","ago.","sep.","oct.","nov.","dic.",""],MonthGenitiveNames:[],AbbreviatedMonthGenitiveNames:[],AMDesignator:"a. m.",PMDesignator:"p. m.",DateSeparator:"/",TimeSeparator:":",ShortDatePattern:"135"},2060:{LCID:2060,Name:"fr-BE",CurrencyPositivePattern:3, CurrencyNegativePattern:8,CurrencySymbol:"\u20ac",NumberDecimalSeparator:",",NumberGroupSeparator:".",NumberGroupSizes:[3],DayNames:["dimanche","lundi","mardi","mercredi","jeudi","vendredi","samedi"],AbbreviatedDayNames:["dim.","lun.","mar.","mer.","jeu.","ven.","sam."],MonthNames:["janvier","f\u00e9vrier","mars","avril","mai","juin","juillet","ao\u00fbt","septembre","octobre","novembre","d\u00e9cembre",""],AbbreviatedMonthNames:["janv.","f\u00e9vr.","mars","avr.","mai","juin","juil.","ao\u00fbt", "sept.","oct.","nov.","d\u00e9c.",""],MonthGenitiveNames:[],AbbreviatedMonthGenitiveNames:[],AMDesignator:"",PMDesignator:"",DateSeparator:"-",TimeSeparator:":",ShortDatePattern:"134"},2064:{LCID:2064,Name:"it-CH",CurrencyPositivePattern:2,CurrencyNegativePattern:2,CurrencySymbol:"CHF",NumberDecimalSeparator:".",NumberGroupSeparator:"\u2019",NumberGroupSizes:[3],DayNames:["domenica","luned\u00ec","marted\u00ec","mercoled\u00ec","gioved\u00ec","venerd\u00ec","sabato"],AbbreviatedDayNames:["dom","lun", "mar","mer","gio","ven","sab"],MonthNames:["gennaio","febbraio","marzo","aprile","maggio","giugno","luglio","agosto","settembre","ottobre","novembre","dicembre",""],AbbreviatedMonthNames:["gen","feb","mar","apr","mag","giu","lug","ago","set","ott","nov","dic",""],MonthGenitiveNames:[],AbbreviatedMonthGenitiveNames:[],AMDesignator:"AM",PMDesignator:"PM",DateSeparator:".",TimeSeparator:":",ShortDatePattern:"135"},2070:{LCID:2070,Name:"pt-PT",CurrencyPositivePattern:3,CurrencyNegativePattern:8,CurrencySymbol:"\u20ac", NumberDecimalSeparator:",",NumberGroupSeparator:" ",NumberGroupSizes:[3],DayNames:["domingo","segunda-feira","ter\u00e7a-feira","quarta-feira","quinta-feira","sexta-feira","s\u00e1bado"],AbbreviatedDayNames:["dom","seg","ter","qua","qui","sex","s\u00e1b"],MonthNames:["janeiro","fevereiro","mar\u00e7o","abril","maio","junho","julho","agosto","setembro","outubro","novembro","dezembro",""],AbbreviatedMonthNames:["jan","fev","mar","abr","mai","jun","jul","ago","set","out","nov","dez",""],MonthGenitiveNames:[], AbbreviatedMonthGenitiveNames:[],AMDesignator:"",PMDesignator:"",DateSeparator:"/",TimeSeparator:":",ShortDatePattern:"135"},2073:{LCID:2073,Name:"ru-MD",CurrencyPositivePattern:3,CurrencyNegativePattern:8,CurrencySymbol:"L",NumberDecimalSeparator:",",NumberGroupSeparator:" ",NumberGroupSizes:[3],DayNames:["\u0432\u043e\u0441\u043a\u0440\u0435\u0441\u0435\u043d\u044c\u0435","\u043f\u043e\u043d\u0435\u0434\u0435\u043b\u044c\u043d\u0438\u043a","\u0432\u0442\u043e\u0440\u043d\u0438\u043a","\u0441\u0440\u0435\u0434\u0430", "\u0447\u0435\u0442\u0432\u0435\u0440\u0433","\u043f\u044f\u0442\u043d\u0438\u0446\u0430","\u0441\u0443\u0431\u0431\u043e\u0442\u0430"],AbbreviatedDayNames:["\u0432\u0441","\u043f\u043d","\u0432\u0442","\u0441\u0440","\u0447\u0442","\u043f\u0442","\u0441\u0431"],MonthNames:["\u044f\u043d\u0432\u0430\u0440\u044c","\u0444\u0435\u0432\u0440\u0430\u043b\u044c","\u043c\u0430\u0440\u0442","\u0430\u043f\u0440\u0435\u043b\u044c","\u043c\u0430\u0439","\u0438\u044e\u043d\u044c","\u0438\u044e\u043b\u044c","\u0430\u0432\u0433\u0443\u0441\u0442", "\u0441\u0435\u043d\u0442\u044f\u0431\u0440\u044c","\u043e\u043a\u0442\u044f\u0431\u0440\u044c","\u043d\u043e\u044f\u0431\u0440\u044c","\u0434\u0435\u043a\u0430\u0431\u0440\u044c",""],AbbreviatedMonthNames:["\u044f\u043d\u0432.","\u0444\u0435\u0432\u0440.","\u043c\u0430\u0440\u0442","\u0430\u043f\u0440.","\u043c\u0430\u0439","\u0438\u044e\u043d\u044c","\u0438\u044e\u043b\u044c","\u0430\u0432\u0433.","\u0441\u0435\u043d\u0442.","\u043e\u043a\u0442.","\u043d\u043e\u044f\u0431.","\u0434\u0435\u043a.", ""],MonthGenitiveNames:["\u044f\u043d\u0432\u0430\u0440\u044f","\u0444\u0435\u0432\u0440\u0430\u043b\u044f","\u043c\u0430\u0440\u0442\u0430","\u0430\u043f\u0440\u0435\u043b\u044f","\u043c\u0430\u044f","\u0438\u044e\u043d\u044f","\u0438\u044e\u043b\u044f","\u0430\u0432\u0433\u0443\u0441\u0442\u0430","\u0441\u0435\u043d\u0442\u044f\u0431\u0440\u044f","\u043e\u043a\u0442\u044f\u0431\u0440\u044f","\u043d\u043e\u044f\u0431\u0440\u044f","\u0434\u0435\u043a\u0430\u0431\u0440\u044f",""],AbbreviatedMonthGenitiveNames:["\u044f\u043d\u0432.", "\u0444\u0435\u0432\u0440.","\u043c\u0430\u0440.","\u0430\u043f\u0440.","\u043c\u0430\u044f","\u0438\u044e\u043d.","\u0438\u044e\u043b.","\u0430\u0432\u0433.","\u0441\u0435\u043d\u0442.","\u043e\u043a\u0442.","\u043d\u043e\u044f\u0431.","\u0434\u0435\u043a.",""],AMDesignator:"AM",PMDesignator:"PM",DateSeparator:".",TimeSeparator:":",ShortDatePattern:"135"},2077:{LCID:2077,Name:"sv-FI",CurrencyPositivePattern:3,CurrencyNegativePattern:8,CurrencySymbol:"\u20ac",NumberDecimalSeparator:",",NumberGroupSeparator:" ", NumberGroupSizes:[3],DayNames:["s\u00f6ndag","m\u00e5ndag","tisdag","onsdag","torsdag","fredag","l\u00f6rdag"],AbbreviatedDayNames:["s\u00f6n","m\u00e5n","tis","ons","tors","fre","l\u00f6r"],MonthNames:["januari","februari","mars","april","maj","juni","juli","augusti","september","oktober","november","december",""],AbbreviatedMonthNames:["jan.","feb.","mars","apr.","maj","juni","juli","aug.","sep.","okt.","nov.","dec.",""],MonthGenitiveNames:[],AbbreviatedMonthGenitiveNames:[],AMDesignator:"fm",PMDesignator:"em", DateSeparator:"-",TimeSeparator:":",ShortDatePattern:"135"},2092:{LCID:2092,Name:"az-Cyrl-AZ",CurrencyPositivePattern:3,CurrencyNegativePattern:8,CurrencySymbol:"\u20bc",NumberDecimalSeparator:",",NumberGroupSeparator:" ",NumberGroupSizes:[3],DayNames:["\u0431\u0430\u0437\u0430\u0440","\u0431\u0430\u0437\u0430\u0440\u00a0\u0435\u0440\u0442\u04d9\u0441\u0438","\u0447\u04d9\u0440\u0448\u04d9\u043d\u0431\u04d9\u00a0\u0430\u0445\u0448\u0430\u043c\u044b","\u0447\u04d9\u0440\u0448\u04d9\u043d\u0431\u04d9", "\u04b9\u04af\u043c\u04d9\u00a0\u0430\u0445\u0448\u0430\u043c\u044b","\u04b9\u04af\u043c\u04d9","\u0448\u04d9\u043d\u0431\u04d9"],AbbreviatedDayNames:["\u0411","\u0411\u0435","\u0427\u0430","\u0427","\u04b8\u0430","\u04b8","\u0428"],MonthNames:["j\u0430\u043d\u0432\u0430\u0440","\u0444\u0435\u0432\u0440\u0430\u043b","\u043c\u0430\u0440\u0442","\u0430\u043f\u0440\u0435\u043b","\u043c\u0430\u0458","\u0438\u0458\u0443\u043d","\u0438\u0458\u0443\u043b","\u0430\u0432\u0433\u0443\u0441\u0442","\u0441\u0435\u043d\u0442\u0458\u0430\u0431\u0440", "\u043e\u043a\u0442\u0458\u0430\u0431\u0440","\u043d\u043e\u0458\u0430\u0431\u0440","\u0434\u0435\u043a\u0430\u0431\u0440",""],AbbreviatedMonthNames:["\u0408\u0430\u043d","\u0424\u0435\u0432","\u041c\u0430\u0440","\u0410\u043f\u0440","\u041c\u0430\u0458","\u0418\u0458\u0443\u043d","\u0418\u0458\u0443\u043b","\u0410\u0432\u0433","\u0421\u0435\u043d","\u041e\u043a\u0442","\u041d\u043e\u044f","\u0414\u0435\u043a",""],MonthGenitiveNames:["\u0458\u0430\u043d\u0432\u0430\u0440","\u0444\u0435\u0432\u0440\u0430\u043b", "\u043c\u0430\u0440\u0442","\u0430\u043f\u0440\u0435\u043b","\u043c\u0430\u0458","\u0438\u0458\u0443\u043d","\u0438\u0458\u0443\u043b","\u0430\u0432\u0433\u0443\u0441\u0442","\u0441\u0435\u043d\u0442\u0458\u0430\u0431\u0440","\u043e\u043a\u0442\u0458\u0430\u0431\u0440","\u043d\u043e\u0458\u0430\u0431\u0440","\u0434\u0435\u043a\u0430\u0431\u0440",""],AbbreviatedMonthGenitiveNames:["\u0408\u0430\u043d","\u0424\u0435\u0432","\u041c\u0430\u0440","\u0410\u043f\u0440","\u043c\u0430\u044f","\u0438\u0458\u0443\u043d", "\u0438\u0458\u0443\u043b","\u0410\u0432\u0433","\u0421\u0435\u043d","\u041e\u043a\u0442","\u041d\u043e\u044f","\u0414\u0435\u043a",""],AMDesignator:"",PMDesignator:"",DateSeparator:".",TimeSeparator:":",ShortDatePattern:"135"},2128:{LCID:2128,Name:"mn-Mong-CN",CurrencyPositivePattern:0,CurrencyNegativePattern:2,CurrencySymbol:"\u00a5",NumberDecimalSeparator:".",NumberGroupSeparator:",",NumberGroupSizes:[3,0],DayNames:["\u182d\u1820\u1837\u1820\u182d\u202f\u1824\u1828 \u1821\u1833\u1826\u1837","\u182d\u1820\u1837\u1820\u182d\u202f\u1824\u1828 \u1828\u1822\u182d\u1821\u1828", "\u182d\u1820\u1837\u1820\u182d\u202f\u1824\u1828 \u182c\u1823\u1836\u1820\u1837","\u182d\u1820\u1837\u1820\u182d\u202f\u1824\u1828 \u182d\u1824\u1837\u182a\u1820\u1828","\u182d\u1820\u1837\u1820\u182d\u202f\u1824\u1828 \u1833\u1825\u1837\u182a\u1821\u1828","\u182d\u1820\u1837\u1820\u182d\u202f\u1824\u1828 \u1832\u1820\u182a\u1824\u1828","\u182d\u1820\u1837\u1820\u182d\u202f\u1824\u1828 \u1835\u1822\u1837\u182d\u1824\u182d\u1820\u1828"],AbbreviatedDayNames:["\u182d\u1820\u1837\u1820\u182d\u202f\u1824\u1828 \u1821\u1833\u1826\u1837", "\u182d\u1820\u1837\u1820\u182d\u202f\u1824\u1828 \u1828\u1822\u182d\u1821\u1828","\u182d\u1820\u1837\u1820\u182d\u202f\u1824\u1828 \u182c\u1823\u1836\u1820\u1837","\u182d\u1820\u1837\u1820\u182d\u202f\u1824\u1828 \u182d\u1824\u1837\u182a\u1820\u1828","\u182d\u1820\u1837\u1820\u182d\u202f\u1824\u1828 \u1833\u1825\u1837\u182a\u1821\u1828","\u182d\u1820\u1837\u1820\u182d\u202f\u1824\u1828 \u1832\u1820\u182a\u1824\u1828","\u182d\u1820\u1837\u1820\u182d\u202f\u1824\u1828 \u1835\u1822\u1837\u182d\u1824\u182d\u1820\u1828"], MonthNames:["\u1828\u1822\u182d\u1821\u1833\u1826\u182d\u1821\u1837 \u1830\u1820\u1837\u180e\u1820","\u182c\u1824\u1836\u180b\u1820\u1833\u1824\u182d\u1820\u1837 \u1830\u1820\u1837\u180e\u1820","\u182d\u1824\u1837\u182a\u1820\u1833\u1824\u182d\u1820\u1837 \u1830\u1820\u1837\u180e\u1820","\u1832\u1826\u1837\u182a\u1821\u1833\u1826\u182d\u1821\u1837 \u1830\u1820\u1837\u180e\u1820","\u1832\u1820\u182a\u1824\u1833\u1824\u182d\u1820\u1837 \u1830\u1820\u1837\u180e\u1820","\u1835\u1822\u1837\u182d\u1824\u1833\u1824\u182d\u1820\u1837 \u1830\u1820\u1837\u180e\u1820", "\u1832\u1824\u182f\u1824\u1833\u1824\u182d\u1820\u1837 \u1830\u1820\u1837\u180e\u1820","\u1828\u1820\u1822\u182e\u1820\u1833\u1824\u182d\u1820\u1837 \u1830\u1820\u1837\u180e\u1820","\u1836\u1822\u1830\u1826\u1833\u1826\u182d\u1821\u1837 \u1830\u1820\u1837\u180e\u1820","\u1820\u1837\u182a\u1820\u1833\u1824\u182d\u1820\u1837 \u1830\u1820\u1837\u180e\u1820","\u1820\u1837\u182a\u1820\u1828 \u1828\u1822\u182d\u1821\u1833\u1826\u182d\u1821\u1837 \u1830\u1820\u1837\u180e\u1820","\u1820\u1837\u182a\u1820\u1828 \u182c\u1824\u1836\u180b\u1820\u1833\u1824\u182d\u1820\u1837 \u1830\u1820\u1837\u180e\u1820", ""],AbbreviatedMonthNames:["\u1828\u1822\u182d\u1821\u1833\u1826\u182d\u1821\u1837 \u1830\u1820\u1837\u180e\u1820","\u182c\u1824\u1836\u180b\u1820\u1833\u1824\u182d\u1820\u1837 \u1830\u1820\u1837\u180e\u1820","\u182d\u1824\u1837\u182a\u1820\u1833\u1824\u182d\u1820\u1837 \u1830\u1820\u1837\u180e\u1820","\u1832\u1826\u1837\u182a\u1821\u1833\u1826\u182d\u1821\u1837 \u1830\u1820\u1837\u180e\u1820","\u1832\u1820\u182a\u1824\u1833\u1824\u182d\u1820\u1837 \u1830\u1820\u1837\u180e\u1820","\u1835\u1822\u1837\u182d\u1824\u1833\u1824\u182d\u1820\u1837 \u1830\u1820\u1837\u180e\u1820", "\u1832\u1824\u182f\u1824\u1833\u1824\u182d\u1820\u1837 \u1830\u1820\u1837\u180e\u1820","\u1828\u1820\u1822\u182e\u1820\u1833\u1824\u182d\u1820\u1837 \u1830\u1820\u1837\u180e\u1820","\u1836\u1822\u1830\u1826\u1833\u1826\u182d\u1821\u1837 \u1830\u1820\u1837\u180e\u1820","\u1820\u1837\u182a\u1820\u1833\u1824\u182d\u1820\u1837 \u1830\u1820\u1837\u180e\u1820","\u1820\u1837\u182a\u1820\u1828 \u1828\u1822\u182d\u1821\u1833\u1826\u182d\u1821\u1837 \u1830\u1820\u1837\u180e\u1820","\u1820\u1837\u182a\u1820\u1828 \u182c\u1824\u1836\u180b\u1820\u1833\u1824\u182d\u1820\u1837 \u1830\u1820\u1837\u180e\u1820", ""],MonthGenitiveNames:[],AbbreviatedMonthGenitiveNames:[],AMDesignator:"",PMDesignator:"",DateSeparator:"/",TimeSeparator:":",ShortDatePattern:"520"},3076:{LCID:3076,Name:"zh-HK",CurrencyPositivePattern:0,CurrencyNegativePattern:0,CurrencySymbol:"HK$",NumberDecimalSeparator:".",NumberGroupSeparator:",",NumberGroupSizes:[3],DayNames:["\u661f\u671f\u65e5","\u661f\u671f\u4e00","\u661f\u671f\u4e8c","\u661f\u671f\u4e09","\u661f\u671f\u56db","\u661f\u671f\u4e94","\u661f\u671f\u516d"],AbbreviatedDayNames:["\u9031\u65e5", "\u9031\u4e00","\u9031\u4e8c","\u9031\u4e09","\u9031\u56db","\u9031\u4e94","\u9031\u516d"],MonthNames:["\u4e00\u6708","\u4e8c\u6708","\u4e09\u6708","\u56db\u6708","\u4e94\u6708","\u516d\u6708","\u4e03\u6708","\u516b\u6708","\u4e5d\u6708","\u5341\u6708","\u5341\u4e00\u6708","\u5341\u4e8c\u6708",""],AbbreviatedMonthNames:["\u4e00\u6708","\u4e8c\u6708","\u4e09\u6708","\u56db\u6708","\u4e94\u6708","\u516d\u6708","\u4e03\u6708","\u516b\u6708","\u4e5d\u6708","\u5341\u6708","\u5341\u4e00\u6708","\u5341\u4e8c\u6708", ""],MonthGenitiveNames:[],AbbreviatedMonthGenitiveNames:[],AMDesignator:"\u4e0a\u5348",PMDesignator:"\u4e0b\u5348",DateSeparator:"/",TimeSeparator:":",ShortDatePattern:"025"},3079:{LCID:3079,Name:"de-AT",CurrencyPositivePattern:2,CurrencyNegativePattern:9,CurrencySymbol:"\u20ac",NumberDecimalSeparator:",",NumberGroupSeparator:" ",NumberGroupSizes:[3],DayNames:["Sonntag","Montag","Dienstag","Mittwoch","Donnerstag","Freitag","Samstag"],AbbreviatedDayNames:["So.","Mo.","Di.","Mi.","Do.","Fr.","Sa."], MonthNames:["J\u00e4nner","Februar","M\u00e4rz","April","Mai","Juni","Juli","August","September","Oktober","November","Dezember",""],AbbreviatedMonthNames:["J\u00e4n","Feb","M\u00e4r","Apr","Mai","Jun","Jul","Aug","Sep","Okt","Nov","Dez",""],MonthGenitiveNames:[],AbbreviatedMonthGenitiveNames:["J\u00e4n.","Feb.","M\u00e4rz","Apr.","Mai","Juni","Juli","Aug.","Sep.","Okt.","Nov.","Dez.",""],AMDesignator:"AM",PMDesignator:"PM",DateSeparator:".",TimeSeparator:":",ShortDatePattern:"135"},3081:{LCID:3081, Name:"en-AU",CurrencyPositivePattern:0,CurrencyNegativePattern:1,CurrencySymbol:"$",NumberDecimalSeparator:".",NumberGroupSeparator:",",NumberGroupSizes:[3],DayNames:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],AbbreviatedDayNames:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],MonthNames:["January","February","March","April","May","June","July","August","September","October","November","December",""],AbbreviatedMonthNames:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep", "Oct","Nov","Dec",""],MonthGenitiveNames:[],AbbreviatedMonthGenitiveNames:[],AMDesignator:"AM",PMDesignator:"PM",DateSeparator:"/",TimeSeparator:":",ShortDatePattern:"035"},3082:{LCID:3082,Name:"es-ES",CurrencyPositivePattern:3,CurrencyNegativePattern:8,CurrencySymbol:"\u20ac",NumberDecimalSeparator:",",NumberGroupSeparator:".",NumberGroupSizes:[3],DayNames:["domingo","lunes","martes","mi\u00e9rcoles","jueves","viernes","s\u00e1bado"],AbbreviatedDayNames:["do.","lu.","ma.","mi.","ju.","vi.","s\u00e1."], MonthNames:["enero","febrero","marzo","abril","mayo","junio","julio","agosto","septiembre","octubre","noviembre","diciembre",""],AbbreviatedMonthNames:["ene.","feb.","mar.","abr.","may.","jun.","jul.","ago.","sep.","oct.","nov.","dic.",""],MonthGenitiveNames:[],AbbreviatedMonthGenitiveNames:[],AMDesignator:"",PMDesignator:"",DateSeparator:"/",TimeSeparator:":",ShortDatePattern:"135"},3084:{LCID:3084,Name:"fr-CA",CurrencyPositivePattern:3,CurrencyNegativePattern:15,CurrencySymbol:"$",NumberDecimalSeparator:",", NumberGroupSeparator:" ",NumberGroupSizes:[3],DayNames:["dimanche","lundi","mardi","mercredi","jeudi","vendredi","samedi"],AbbreviatedDayNames:["dim.","lun.","mar.","mer.","jeu.","ven.","sam."],MonthNames:["janvier","f\u00e9vrier","mars","avril","mai","juin","juillet","ao\u00fbt","septembre","octobre","novembre","d\u00e9cembre",""],AbbreviatedMonthNames:["janv.","f\u00e9vr.","mars","avr.","mai","juin","juil.","ao\u00fbt","sept.","oct.","nov.","d\u00e9c.",""],MonthGenitiveNames:[],AbbreviatedMonthGenitiveNames:[], AMDesignator:"",PMDesignator:"",DateSeparator:"-",TimeSeparator:":",ShortDatePattern:"531"},3152:{LCID:3152,Name:"mn-Mong-MN",CurrencyPositivePattern:0,CurrencyNegativePattern:2,CurrencySymbol:"\u20ae",NumberDecimalSeparator:".",NumberGroupSeparator:",",NumberGroupSizes:[3,0],DayNames:["\u1828\u1822\u182e\u180e\u1820","\u1833\u1820\u1838\u1820","\u182e\u1822\u182d\u182e\u1820\u1837","\u1840\u1820\u182d\u182a\u1820","\u182b\u1826\u1837\u182a\u1826","\u182a\u1820\u1830\u1820\u1829","\u182a\u1822\u182e\u182a\u1820"], AbbreviatedDayNames:["\u1828\u1822\u182e\u180e\u1820","\u1833\u1820\u1838\u1820","\u182e\u1822\u182d\u182e\u1820\u1837","\u1840\u1820\u182d\u182a\u1820","\u182b\u1826\u1837\u182a\u1826","\u182a\u1820\u1830\u1820\u1829","\u182a\u1822\u182e\u182a\u1820"],MonthNames:["\u1828\u1822\u182d\u1821\u1833\u1826\u182d\u1821\u1837 \u1830\u1820\u1837\u180e\u1820","\u182c\u1824\u1836\u180b\u1820\u1833\u1824\u182d\u1820\u1837 \u1830\u1820\u1837\u180e\u1820","\u182d\u1824\u1837\u182a\u1820\u1833\u1824\u182d\u1820\u1837 \u1830\u1820\u1837\u180e\u1820", "\u1832\u1826\u1837\u182a\u1821\u1833\u1826\u182d\u1821\u1837 \u1830\u1820\u1837\u180e\u1820","\u1832\u1820\u182a\u1824\u1833\u1824\u182d\u1820\u1837 \u1830\u1820\u1837\u180e\u1820","\u1835\u1822\u1837\u182d\u1824\u1833\u1824\u182d\u1820\u1837 \u1830\u1820\u1837\u180e\u1820","\u1832\u1824\u182f\u1824\u1833\u1824\u182d\u1820\u1837 \u1830\u1820\u1837\u180e\u1820","\u1828\u1820\u1822\u182e\u1820\u1833\u1824\u182d\u1820\u1837 \u1830\u1820\u1837\u180e\u1820","\u1836\u1822\u1830\u1826\u1833\u1826\u182d\u1821\u1837 \u1830\u1820\u1837\u180e\u1820", "\u1820\u1837\u182a\u1820\u1833\u1824\u182d\u1820\u1837 \u1830\u1820\u1837\u180e\u1820","\u1820\u1837\u182a\u1820\u1828 \u1828\u1822\u182d\u1821\u1833\u1826\u182d\u1821\u1837 \u1830\u1820\u1837\u180e\u1820","\u1820\u1837\u182a\u1820\u1828 \u182c\u1824\u1836\u180b\u1820\u1833\u1824\u182d\u1820\u1837 \u1830\u1820\u1837\u180e\u1820",""],AbbreviatedMonthNames:["\u1828\u1822\u182d\u1821\u1833\u1826\u182d\u1821\u1837 \u1830\u1820\u1837\u180e\u1820","\u182c\u1824\u1836\u180b\u1820\u1833\u1824\u182d\u1820\u1837 \u1830\u1820\u1837\u180e\u1820", "\u182d\u1824\u1837\u182a\u1820\u1833\u1824\u182d\u1820\u1837 \u1830\u1820\u1837\u180e\u1820","\u1832\u1826\u1837\u182a\u1821\u1833\u1826\u182d\u1821\u1837 \u1830\u1820\u1837\u180e\u1820","\u1832\u1820\u182a\u1824\u1833\u1824\u182d\u1820\u1837 \u1830\u1820\u1837\u180e\u1820","\u1835\u1822\u1837\u182d\u1824\u1833\u1824\u182d\u1820\u1837 \u1830\u1820\u1837\u180e\u1820","\u1832\u1824\u182f\u1824\u1833\u1824\u182d\u1820\u1837 \u1830\u1820\u1837\u180e\u1820","\u1828\u1820\u1822\u182e\u1820\u1833\u1824\u182d\u1820\u1837 \u1830\u1820\u1837\u180e\u1820", "\u1836\u1822\u1830\u1826\u1833\u1826\u182d\u1821\u1837 \u1830\u1820\u1837\u180e\u1820","\u1820\u1837\u182a\u1820\u1833\u1824\u182d\u1820\u1837 \u1830\u1820\u1837\u180e\u1820","\u1820\u1837\u182a\u1820\u1828 \u1828\u1822\u182d\u1821\u1833\u1826\u182d\u1821\u1837 \u1830\u1820\u1837\u180e\u1820","\u1820\u1837\u182a\u1820\u1828 \u182c\u1824\u1836\u180b\u1820\u1833\u1824\u182d\u1820\u1837 \u1830\u1820\u1837\u180e\u1820",""],MonthGenitiveNames:[],AbbreviatedMonthGenitiveNames:[],AMDesignator:"",PMDesignator:"", DateSeparator:"/",TimeSeparator:":",ShortDatePattern:"520"},4100:{LCID:4100,Name:"zh-SG",CurrencyPositivePattern:0,CurrencyNegativePattern:1,CurrencySymbol:"$",NumberDecimalSeparator:".",NumberGroupSeparator:",",NumberGroupSizes:[3],DayNames:["\u661f\u671f\u65e5","\u661f\u671f\u4e00","\u661f\u671f\u4e8c","\u661f\u671f\u4e09","\u661f\u671f\u56db","\u661f\u671f\u4e94","\u661f\u671f\u516d"],AbbreviatedDayNames:["\u5468\u65e5","\u5468\u4e00","\u5468\u4e8c","\u5468\u4e09","\u5468\u56db","\u5468\u4e94", "\u5468\u516d"],MonthNames:["\u4e00\u6708","\u4e8c\u6708","\u4e09\u6708","\u56db\u6708","\u4e94\u6708","\u516d\u6708","\u4e03\u6708","\u516b\u6708","\u4e5d\u6708","\u5341\u6708","\u5341\u4e00\u6708","\u5341\u4e8c\u6708",""],AbbreviatedMonthNames:["\u4e00\u6708","\u4e8c\u6708","\u4e09\u6708","\u56db\u6708","\u4e94\u6708","\u516d\u6708","\u4e03\u6708","\u516b\u6708","\u4e5d\u6708","\u5341\u6708","\u5341\u4e00\u6708","\u5341\u4e8c\u6708",""],MonthGenitiveNames:[],AbbreviatedMonthGenitiveNames:[],AMDesignator:"\u4e0a\u5348", PMDesignator:"\u4e0b\u5348",DateSeparator:"/",TimeSeparator:":",ShortDatePattern:"025"},4103:{LCID:4103,Name:"de-LU",CurrencyPositivePattern:3,CurrencyNegativePattern:8,CurrencySymbol:"\u20ac",NumberDecimalSeparator:",",NumberGroupSeparator:".",NumberGroupSizes:[3],DayNames:["Sonntag","Montag","Dienstag","Mittwoch","Donnerstag","Freitag","Samstag"],AbbreviatedDayNames:["So.","Mo.","Di.","Mi.","Do.","Fr.","Sa."],MonthNames:["Januar","Februar","M\u00e4rz","April","Mai","Juni","Juli","August","September", "Oktober","November","Dezember",""],AbbreviatedMonthNames:["Jan","Feb","M\u00e4r","Apr","Mai","Jun","Jul","Aug","Sep","Okt","Nov","Dez",""],MonthGenitiveNames:[],AbbreviatedMonthGenitiveNames:["Jan.","Feb.","M\u00e4rz","Apr.","Mai","Juni","Juli","Aug.","Sept.","Okt.","Nov.","Dez.",""],AMDesignator:"AM",PMDesignator:"PM",DateSeparator:".",TimeSeparator:":",ShortDatePattern:"135"},4105:{LCID:4105,Name:"en-CA",CurrencyPositivePattern:0,CurrencyNegativePattern:1,CurrencySymbol:"$",NumberDecimalSeparator:".", NumberGroupSeparator:",",NumberGroupSizes:[3],DayNames:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],AbbreviatedDayNames:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],MonthNames:["January","February","March","April","May","June","July","August","September","October","November","December",""],AbbreviatedMonthNames:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec",""],MonthGenitiveNames:[],AbbreviatedMonthGenitiveNames:[],AMDesignator:"AM",PMDesignator:"PM", DateSeparator:"-",TimeSeparator:":",ShortDatePattern:"531"},4106:{LCID:4106,Name:"es-GT",CurrencyPositivePattern:0,CurrencyNegativePattern:1,CurrencySymbol:"Q",NumberDecimalSeparator:".",NumberGroupSeparator:",",NumberGroupSizes:[3],DayNames:["domingo","lunes","martes","mi\u00e9rcoles","jueves","viernes","s\u00e1bado"],AbbreviatedDayNames:["dom.","lun.","mar.","mi\u00e9.","jue.","vie.","s\u00e1b."],MonthNames:["enero","febrero","marzo","abril","mayo","junio","julio","agosto","septiembre","octubre", "noviembre","diciembre",""],AbbreviatedMonthNames:["ene.","feb.","mar.","abr.","may.","jun.","jul.","ago.","sep.","oct.","nov.","dic.",""],MonthGenitiveNames:[],AbbreviatedMonthGenitiveNames:[],AMDesignator:"a.\u00a0m.",PMDesignator:"p.\u00a0m.",DateSeparator:"/",TimeSeparator:":",ShortDatePattern:"035"},4108:{LCID:4108,Name:"fr-CH",CurrencyPositivePattern:3,CurrencyNegativePattern:8,CurrencySymbol:"CHF",NumberDecimalSeparator:",",NumberGroupSeparator:" ",NumberGroupSizes:[3],DayNames:["dimanche", "lundi","mardi","mercredi","jeudi","vendredi","samedi"],AbbreviatedDayNames:["dim.","lun.","mar.","mer.","jeu.","ven.","sam."],MonthNames:["janvier","f\u00e9vrier","mars","avril","mai","juin","juillet","ao\u00fbt","septembre","octobre","novembre","d\u00e9cembre",""],AbbreviatedMonthNames:["janv.","f\u00e9vr.","mars","avr.","mai","juin","juil.","ao\u00fbt","sept.","oct.","nov.","d\u00e9c.",""],MonthGenitiveNames:[],AbbreviatedMonthGenitiveNames:[],AMDesignator:"AM",PMDesignator:"PM",DateSeparator:".", TimeSeparator:":",ShortDatePattern:"135"},4122:{LCID:4122,Name:"hr-BA",CurrencyPositivePattern:3,CurrencyNegativePattern:8,CurrencySymbol:"KM",NumberDecimalSeparator:",",NumberGroupSeparator:".",NumberGroupSizes:[3],DayNames:["nedjelja","ponedjeljak","utorak","srijeda","\u010detvrtak","petak","subota"],AbbreviatedDayNames:["ned","pon","uto","sri","\u010det","pet","sub"],MonthNames:["sije\u010danj","velja\u010da","o\u017eujak","travanj","svibanj","lipanj","srpanj","kolovoz","rujan","listopad","studeni", "prosinac",""],AbbreviatedMonthNames:["sij","velj","o\u017eu","tra","svi","lip","srp","kol","ruj","lis","stu","pro",""],MonthGenitiveNames:["sije\u010dnja","velja\u010de","o\u017eujka","travnja","svibnja","lipnja","srpnja","kolovoza","rujna","listopada","studenoga","prosinca",""],AbbreviatedMonthGenitiveNames:[],AMDesignator:"AM",PMDesignator:"PM",DateSeparator:". ",TimeSeparator:":",ShortDatePattern:"025"},5124:{LCID:5124,Name:"zh-MO",CurrencyPositivePattern:0,CurrencyNegativePattern:1,CurrencySymbol:"MOP", NumberDecimalSeparator:".",NumberGroupSeparator:",",NumberGroupSizes:[3],DayNames:["\u661f\u671f\u65e5","\u661f\u671f\u4e00","\u661f\u671f\u4e8c","\u661f\u671f\u4e09","\u661f\u671f\u56db","\u661f\u671f\u4e94","\u661f\u671f\u516d"],AbbreviatedDayNames:["\u9031\u65e5","\u9031\u4e00","\u9031\u4e8c","\u9031\u4e09","\u9031\u56db","\u9031\u4e94","\u9031\u516d"],MonthNames:["\u4e00\u6708","\u4e8c\u6708","\u4e09\u6708","\u56db\u6708","\u4e94\u6708","\u516d\u6708","\u4e03\u6708","\u516b\u6708","\u4e5d\u6708", "\u5341\u6708","\u5341\u4e00\u6708","\u5341\u4e8c\u6708",""],AbbreviatedMonthNames:["\u4e00\u6708","\u4e8c\u6708","\u4e09\u6708","\u56db\u6708","\u4e94\u6708","\u516d\u6708","\u4e03\u6708","\u516b\u6708","\u4e5d\u6708","\u5341\u6708","\u5341\u4e00\u6708","\u5341\u4e8c\u6708",""],MonthGenitiveNames:[],AbbreviatedMonthGenitiveNames:[],AMDesignator:"\u4e0a\u5348",PMDesignator:"\u4e0b\u5348",DateSeparator:"/",TimeSeparator:":",ShortDatePattern:"025"},5127:{LCID:5127,Name:"de-LI",CurrencyPositivePattern:2, CurrencyNegativePattern:9,CurrencySymbol:"CHF",NumberDecimalSeparator:".",NumberGroupSeparator:"\u2019",NumberGroupSizes:[3],DayNames:["Sonntag","Montag","Dienstag","Mittwoch","Donnerstag","Freitag","Samstag"],AbbreviatedDayNames:["So.","Mo.","Di.","Mi.","Do.","Fr.","Sa."],MonthNames:["Januar","Februar","M\u00e4rz","April","Mai","Juni","Juli","August","September","Oktober","November","Dezember",""],AbbreviatedMonthNames:["Jan","Feb","M\u00e4r","Apr","Mai","Jun","Jul","Aug","Sep","Okt","Nov","Dez", ""],MonthGenitiveNames:[],AbbreviatedMonthGenitiveNames:["Jan.","Feb.","M\u00e4rz","Apr.","Mai","Juni","Juli","Aug.","Sept.","Okt.","Nov.","Dez.",""],AMDesignator:"AM",PMDesignator:"PM",DateSeparator:".",TimeSeparator:":",ShortDatePattern:"135"},5129:{LCID:5129,Name:"en-NZ",CurrencyPositivePattern:0,CurrencyNegativePattern:1,CurrencySymbol:"$",NumberDecimalSeparator:".",NumberGroupSeparator:",",NumberGroupSizes:[3],DayNames:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"], AbbreviatedDayNames:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],MonthNames:["January","February","March","April","May","June","July","August","September","October","November","December",""],AbbreviatedMonthNames:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec",""],MonthGenitiveNames:[],AbbreviatedMonthGenitiveNames:[],AMDesignator:"am",PMDesignator:"pm",DateSeparator:"/",TimeSeparator:":",ShortDatePattern:"035"},5130:{LCID:5130,Name:"es-CR",CurrencyPositivePattern:0,CurrencyNegativePattern:1, CurrencySymbol:"\u20a1",NumberDecimalSeparator:",",NumberGroupSeparator:" ",NumberGroupSizes:[3],DayNames:["domingo","lunes","martes","mi\u00e9rcoles","jueves","viernes","s\u00e1bado"],AbbreviatedDayNames:["dom.","lun.","mar.","mi\u00e9.","jue.","vie.","s\u00e1b."],MonthNames:["enero","febrero","marzo","abril","mayo","junio","julio","agosto","septiembre","octubre","noviembre","diciembre",""],AbbreviatedMonthNames:["ene.","feb.","mar.","abr.","may.","jun.","jul.","ago.","sep.","oct.","nov.","dic.", ""],MonthGenitiveNames:[],AbbreviatedMonthGenitiveNames:[],AMDesignator:"a.\u00a0m.",PMDesignator:"p.\u00a0m.",DateSeparator:"/",TimeSeparator:":",ShortDatePattern:"025"},5132:{LCID:5132,Name:"fr-LU",CurrencyPositivePattern:3,CurrencyNegativePattern:8,CurrencySymbol:"\u20ac",NumberDecimalSeparator:",",NumberGroupSeparator:".",NumberGroupSizes:[3],DayNames:["dimanche","lundi","mardi","mercredi","jeudi","vendredi","samedi"],AbbreviatedDayNames:["dim.","lun.","mar.","mer.","jeu.","ven.","sam."],MonthNames:["janvier", "f\u00e9vrier","mars","avril","mai","juin","juillet","ao\u00fbt","septembre","octobre","novembre","d\u00e9cembre",""],AbbreviatedMonthNames:["janv.","f\u00e9vr.","mars","avr.","mai","juin","juil.","ao\u00fbt","sept.","oct.","nov.","d\u00e9c.",""],MonthGenitiveNames:[],AbbreviatedMonthGenitiveNames:[],AMDesignator:"AM",PMDesignator:"PM",DateSeparator:"/",TimeSeparator:":",ShortDatePattern:"135"},6153:{LCID:6153,Name:"en-IE",CurrencyPositivePattern:0,CurrencyNegativePattern:1,CurrencySymbol:"\u20ac", NumberDecimalSeparator:".",NumberGroupSeparator:",",NumberGroupSizes:[3],DayNames:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],AbbreviatedDayNames:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],MonthNames:["January","February","March","April","May","June","July","August","September","October","November","December",""],AbbreviatedMonthNames:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec",""],MonthGenitiveNames:[],AbbreviatedMonthGenitiveNames:[],AMDesignator:"am", PMDesignator:"pm",DateSeparator:"/",TimeSeparator:":",ShortDatePattern:"135"},6154:{LCID:6154,Name:"es-PA",CurrencyPositivePattern:0,CurrencyNegativePattern:1,CurrencySymbol:"B/.",NumberDecimalSeparator:".",NumberGroupSeparator:",",NumberGroupSizes:[3],DayNames:["domingo","lunes","martes","mi\u00e9rcoles","jueves","viernes","s\u00e1bado"],AbbreviatedDayNames:["dom.","lun.","mar.","mi\u00e9.","jue.","vie.","s\u00e1b."],MonthNames:["enero","febrero","marzo","abril","mayo","junio","julio","agosto","septiembre", "octubre","noviembre","diciembre",""],AbbreviatedMonthNames:["ene.","feb.","mar.","abr.","may.","jun.","jul.","ago.","sep.","oct.","nov.","dic.",""],MonthGenitiveNames:[],AbbreviatedMonthGenitiveNames:[],AMDesignator:"a.\u00a0m.",PMDesignator:"p.\u00a0m.",DateSeparator:"/",TimeSeparator:":",ShortDatePattern:"315"},6156:{LCID:6156,Name:"fr-MC",CurrencyPositivePattern:3,CurrencyNegativePattern:8,CurrencySymbol:"\u20ac",NumberDecimalSeparator:",",NumberGroupSeparator:" ",NumberGroupSizes:[3],DayNames:["dimanche", "lundi","mardi","mercredi","jeudi","vendredi","samedi"],AbbreviatedDayNames:["dim.","lun.","mar.","mer.","jeu.","ven.","sam."],MonthNames:["janvier","f\u00e9vrier","mars","avril","mai","juin","juillet","ao\u00fbt","septembre","octobre","novembre","d\u00e9cembre",""],AbbreviatedMonthNames:["janv.","f\u00e9vr.","mars","avr.","mai","juin","juil.","ao\u00fbt","sept.","oct.","nov.","d\u00e9c.",""],MonthGenitiveNames:[],AbbreviatedMonthGenitiveNames:[],AMDesignator:"AM",PMDesignator:"PM",DateSeparator:"/", TimeSeparator:":",ShortDatePattern:"135"},7177:{LCID:7177,Name:"en-ZA",CurrencyPositivePattern:0,CurrencyNegativePattern:1,CurrencySymbol:"R",NumberDecimalSeparator:",",NumberGroupSeparator:" ",NumberGroupSizes:[3],DayNames:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],AbbreviatedDayNames:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],MonthNames:["January","February","March","April","May","June","July","August","September","October","November","December",""],AbbreviatedMonthNames:["Jan", "Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec",""],MonthGenitiveNames:[],AbbreviatedMonthGenitiveNames:[],AMDesignator:"am",PMDesignator:"pm",DateSeparator:"/",TimeSeparator:":",ShortDatePattern:"531"},7178:{LCID:7178,Name:"es-DO",CurrencyPositivePattern:0,CurrencyNegativePattern:0,CurrencySymbol:"$",NumberDecimalSeparator:".",NumberGroupSeparator:",",NumberGroupSizes:[3],DayNames:["domingo","lunes","martes","mi\u00e9rcoles","jueves","viernes","s\u00e1bado"],AbbreviatedDayNames:["dom.", "lun.","mar.","mi\u00e9.","jue.","vie.","s\u00e1b."],MonthNames:["enero","febrero","marzo","abril","mayo","junio","julio","agosto","septiembre","octubre","noviembre","diciembre",""],AbbreviatedMonthNames:["ene.","feb.","mar.","abr.","may.","jun.","jul.","ago.","sep.","oct.","nov.","dic.",""],MonthGenitiveNames:[],AbbreviatedMonthGenitiveNames:[],AMDesignator:"a.\u00a0m.",PMDesignator:"p.\u00a0m.",DateSeparator:"/",TimeSeparator:":",ShortDatePattern:"025"},7180:{LCID:7180,Name:"fr-029",CurrencyPositivePattern:3, CurrencyNegativePattern:8,CurrencySymbol:"EC$",NumberDecimalSeparator:",",NumberGroupSeparator:" ",NumberGroupSizes:[3],DayNames:["dimanche","lundi","mardi","mercredi","jeudi","vendredi","samedi"],AbbreviatedDayNames:["dim.","lun.","mar.","mer.","jeu.","ven.","sam."],MonthNames:["Janvier","F\u00e9vrier","Mars","Avril","Mai","Juin","Juillet","Ao\u00fbt","Septembre","Octobre","Novembre","D\u00e9cembre",""],AbbreviatedMonthNames:["Janv.","F\u00e9vr.","Mars","Avr.","Mai","Juin","Juil.","Ao\u00fbt","Sept.", "Oct.","Nov.","D\u00e9c.",""],MonthGenitiveNames:["janvier","f\u00e9vrier","mars","avril","mai","juin","juillet","ao\u00fbt","septembre","octobre","novembre","d\u00e9cembre",""],AbbreviatedMonthGenitiveNames:["janv.","f\u00e9vr.","mars","avr.","mai","juin","juil.","ao\u00fbt","sept.","oct.","nov.","d\u00e9c.",""],AMDesignator:"AM",PMDesignator:"PM",DateSeparator:"/",TimeSeparator:":",ShortDatePattern:"135"},8201:{LCID:8201,Name:"en-JM",CurrencyPositivePattern:0,CurrencyNegativePattern:1,CurrencySymbol:"$", NumberDecimalSeparator:".",NumberGroupSeparator:",",NumberGroupSizes:[3],DayNames:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],AbbreviatedDayNames:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],MonthNames:["January","February","March","April","May","June","July","August","September","October","November","December",""],AbbreviatedMonthNames:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec",""],MonthGenitiveNames:[],AbbreviatedMonthGenitiveNames:[],AMDesignator:"am", PMDesignator:"pm",DateSeparator:"/",TimeSeparator:":",ShortDatePattern:"025"},8202:{LCID:8202,Name:"es-VE",CurrencyPositivePattern:0,CurrencyNegativePattern:2,CurrencySymbol:"Bs.S",NumberDecimalSeparator:",",NumberGroupSeparator:".",NumberGroupSizes:[3],DayNames:["domingo","lunes","martes","mi\u00e9rcoles","jueves","viernes","s\u00e1bado"],AbbreviatedDayNames:["dom.","lun.","mar.","mi\u00e9.","jue.","vie.","s\u00e1b."],MonthNames:["enero","febrero","marzo","abril","mayo","junio","julio","agosto", "septiembre","octubre","noviembre","diciembre",""],AbbreviatedMonthNames:["ene.","feb.","mar.","abr.","may.","jun.","jul.","ago.","sept.","oct.","nov.","dic.",""],MonthGenitiveNames:[],AbbreviatedMonthGenitiveNames:[],AMDesignator:"a.\u00a0m.",PMDesignator:"p.\u00a0m.",DateSeparator:"/",TimeSeparator:":",ShortDatePattern:"025"},8204:{LCID:8204,Name:"fr-RE",CurrencyPositivePattern:3,CurrencyNegativePattern:8,CurrencySymbol:"\u20ac",NumberDecimalSeparator:",",NumberGroupSeparator:" ",NumberGroupSizes:[3], DayNames:["dimanche","lundi","mardi","mercredi","jeudi","vendredi","samedi"],AbbreviatedDayNames:["dim.","lun.","mar.","mer.","jeu.","ven.","sam."],MonthNames:["janvier","f\u00e9vrier","mars","avril","mai","juin","juillet","ao\u00fbt","septembre","octobre","novembre","d\u00e9cembre",""],AbbreviatedMonthNames:["janv.","f\u00e9vr.","mars","avr.","mai","juin","juil.","ao\u00fbt","sept.","oct.","nov.","d\u00e9c.",""],MonthGenitiveNames:[],AbbreviatedMonthGenitiveNames:[],AMDesignator:"AM",PMDesignator:"PM", DateSeparator:"/",TimeSeparator:":",ShortDatePattern:"135"},9225:{LCID:9225,Name:"en-029",CurrencyPositivePattern:0,CurrencyNegativePattern:1,CurrencySymbol:"EC$",NumberDecimalSeparator:".",NumberGroupSeparator:",",NumberGroupSizes:[3],DayNames:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],AbbreviatedDayNames:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],MonthNames:["January","February","March","April","May","June","July","August","September","October","November","December", ""],AbbreviatedMonthNames:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec",""],MonthGenitiveNames:[],AbbreviatedMonthGenitiveNames:[],AMDesignator:"AM",PMDesignator:"PM",DateSeparator:"/",TimeSeparator:":",ShortDatePattern:"135"},9226:{LCID:9226,Name:"es-CO",CurrencyPositivePattern:2,CurrencyNegativePattern:9,CurrencySymbol:"$",NumberDecimalSeparator:",",NumberGroupSeparator:".",NumberGroupSizes:[3],DayNames:["domingo","lunes","martes","mi\u00e9rcoles","jueves","viernes","s\u00e1bado"], AbbreviatedDayNames:["dom.","lun.","mar.","mi\u00e9.","jue.","vie.","s\u00e1b."],MonthNames:["enero","febrero","marzo","abril","mayo","junio","julio","agosto","septiembre","octubre","noviembre","diciembre",""],AbbreviatedMonthNames:["ene.","feb.","mar.","abr.","may.","jun.","jul.","ago.","sept.","oct.","nov.","dic.",""],MonthGenitiveNames:[],AbbreviatedMonthGenitiveNames:["ene.","feb.","mar.","abr.","may.","jun.","jul.","ago.","sep.","oct.","nov.","dic.",""],AMDesignator:"a.\u00a0m.",PMDesignator:"p.\u00a0m.", DateSeparator:"/",TimeSeparator:":",ShortDatePattern:"035"},9228:{LCID:9228,Name:"fr-CD",CurrencyPositivePattern:3,CurrencyNegativePattern:8,CurrencySymbol:"FC",NumberDecimalSeparator:",",NumberGroupSeparator:" ",NumberGroupSizes:[3],DayNames:["dimanche","lundi","mardi","mercredi","jeudi","vendredi","samedi"],AbbreviatedDayNames:["dim.","lun.","mar.","mer.","jeu.","ven.","sam."],MonthNames:["janvier","f\u00e9vrier","mars","avril","mai","juin","juillet","ao\u00fbt","septembre","octobre","novembre", "d\u00e9cembre",""],AbbreviatedMonthNames:["janv.","f\u00e9vr.","mars","avr.","mai","juin","juil.","ao\u00fbt","sept.","oct.","nov.","d\u00e9c.",""],MonthGenitiveNames:[],AbbreviatedMonthGenitiveNames:[],AMDesignator:"AM",PMDesignator:"PM",DateSeparator:"/",TimeSeparator:":",ShortDatePattern:"135"},10249:{LCID:10249,Name:"en-BZ",CurrencyPositivePattern:0,CurrencyNegativePattern:1,CurrencySymbol:"$",NumberDecimalSeparator:".",NumberGroupSeparator:",",NumberGroupSizes:[3],DayNames:["Sunday","Monday", "Tuesday","Wednesday","Thursday","Friday","Saturday"],AbbreviatedDayNames:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],MonthNames:["January","February","March","April","May","June","July","August","September","October","November","December",""],AbbreviatedMonthNames:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec",""],MonthGenitiveNames:[],AbbreviatedMonthGenitiveNames:[],AMDesignator:"am",PMDesignator:"pm",DateSeparator:"/",TimeSeparator:":",ShortDatePattern:"135"},10250:{LCID:10250, Name:"es-PE",CurrencyPositivePattern:2,CurrencyNegativePattern:9,CurrencySymbol:"S/",NumberDecimalSeparator:".",NumberGroupSeparator:",",NumberGroupSizes:[3],DayNames:["domingo","lunes","martes","mi\u00e9rcoles","jueves","viernes","s\u00e1bado"],AbbreviatedDayNames:["dom.","lun.","mar.","mi\u00e9.","jue.","vie.","s\u00e1b."],MonthNames:["Enero","Febrero","Marzo","Abril","Mayo","Junio","Julio","Agosto","Setiembre","Octubre","Noviembre","Diciembre",""],AbbreviatedMonthNames:["Ene.","Feb.","Mar.","Abr.", "May.","Jun.","Jul.","Ago.","Set.","Oct.","Nov.","Dic.",""],MonthGenitiveNames:["enero","febrero","marzo","abril","mayo","junio","julio","agosto","setiembre","octubre","noviembre","diciembre",""],AbbreviatedMonthGenitiveNames:["ene.","feb.","mar.","abr.","may.","jun.","jul.","ago.","set.","oct.","nov.","dic.",""],AMDesignator:"a.\u00a0m.",PMDesignator:"p.\u00a0m.",DateSeparator:"/",TimeSeparator:":",ShortDatePattern:"035"},10252:{LCID:10252,Name:"fr-SN",CurrencyPositivePattern:3,CurrencyNegativePattern:8, CurrencySymbol:"CFA",NumberDecimalSeparator:",",NumberGroupSeparator:" ",NumberGroupSizes:[3],DayNames:["dimanche","lundi","mardi","mercredi","jeudi","vendredi","samedi"],AbbreviatedDayNames:["dim.","lun.","mar.","mer.","jeu.","ven.","sam."],MonthNames:["janvier","f\u00e9vrier","mars","avril","mai","juin","juillet","ao\u00fbt","septembre","octobre","novembre","d\u00e9cembre",""],AbbreviatedMonthNames:["janv.","f\u00e9vr.","mars","avr.","mai","juin","juil.","ao\u00fbt","sept.","oct.","nov.","d\u00e9c.", ""],MonthGenitiveNames:[],AbbreviatedMonthGenitiveNames:[],AMDesignator:"AM",PMDesignator:"PM",DateSeparator:"/",TimeSeparator:":",ShortDatePattern:"135"},11273:{LCID:11273,Name:"en-TT",CurrencyPositivePattern:0,CurrencyNegativePattern:1,CurrencySymbol:"$",NumberDecimalSeparator:".",NumberGroupSeparator:",",NumberGroupSizes:[3],DayNames:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],AbbreviatedDayNames:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],MonthNames:["January","February", "March","April","May","June","July","August","September","October","November","December",""],AbbreviatedMonthNames:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec",""],MonthGenitiveNames:[],AbbreviatedMonthGenitiveNames:[],AMDesignator:"am",PMDesignator:"pm",DateSeparator:"/",TimeSeparator:":",ShortDatePattern:"135"},11274:{LCID:11274,Name:"es-AR",CurrencyPositivePattern:2,CurrencyNegativePattern:9,CurrencySymbol:"$",NumberDecimalSeparator:",",NumberGroupSeparator:".",NumberGroupSizes:[3], DayNames:["domingo","lunes","martes","mi\u00e9rcoles","jueves","viernes","s\u00e1bado"],AbbreviatedDayNames:["dom.","lun.","mar.","mi\u00e9.","jue.","vie.","s\u00e1b."],MonthNames:["enero","febrero","marzo","abril","mayo","junio","julio","agosto","septiembre","octubre","noviembre","diciembre",""],AbbreviatedMonthNames:["ene.","feb.","mar.","abr.","may.","jun.","jul.","ago.","sep.","oct.","nov.","dic.",""],MonthGenitiveNames:[],AbbreviatedMonthGenitiveNames:[],AMDesignator:"a.\u00a0m.",PMDesignator:"p.\u00a0m.", DateSeparator:"/",TimeSeparator:":",ShortDatePattern:"025"},11276:{LCID:11276,Name:"fr-CM",CurrencyPositivePattern:3,CurrencyNegativePattern:8,CurrencySymbol:"FCFA",NumberDecimalSeparator:",",NumberGroupSeparator:" ",NumberGroupSizes:[3],DayNames:["dimanche","lundi","mardi","mercredi","jeudi","vendredi","samedi"],AbbreviatedDayNames:["dim.","lun.","mar.","mer.","jeu.","ven.","sam."],MonthNames:["janvier","f\u00e9vrier","mars","avril","mai","juin","juillet","ao\u00fbt","septembre","octobre","novembre", "d\u00e9cembre",""],AbbreviatedMonthNames:["janv.","f\u00e9vr.","mars","avr.","mai","juin","juil.","ao\u00fbt","sept.","oct.","nov.","d\u00e9c.",""],MonthGenitiveNames:[],AbbreviatedMonthGenitiveNames:[],AMDesignator:"mat.",PMDesignator:"soir",DateSeparator:"/",TimeSeparator:":",ShortDatePattern:"135"},12297:{LCID:12297,Name:"en-ZW",CurrencyPositivePattern:0,CurrencyNegativePattern:1,CurrencySymbol:"US$",NumberDecimalSeparator:".",NumberGroupSeparator:",",NumberGroupSizes:[3],DayNames:["Sunday","Monday", "Tuesday","Wednesday","Thursday","Friday","Saturday"],AbbreviatedDayNames:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],MonthNames:["January","February","March","April","May","June","July","August","September","October","November","December",""],AbbreviatedMonthNames:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec",""],MonthGenitiveNames:[],AbbreviatedMonthGenitiveNames:[],AMDesignator:"am",PMDesignator:"pm",DateSeparator:"/",TimeSeparator:":",ShortDatePattern:"025"},12298:{LCID:12298, Name:"es-EC",CurrencyPositivePattern:0,CurrencyNegativePattern:2,CurrencySymbol:"$",NumberDecimalSeparator:",",NumberGroupSeparator:".",NumberGroupSizes:[3],DayNames:["domingo","lunes","martes","mi\u00e9rcoles","jueves","viernes","s\u00e1bado"],AbbreviatedDayNames:["dom.","lun.","mar.","mi\u00e9.","jue.","vie.","s\u00e1b."],MonthNames:["enero","febrero","marzo","abril","mayo","junio","julio","agosto","septiembre","octubre","noviembre","diciembre",""],AbbreviatedMonthNames:["ene.","feb.","mar.","abr.", "may.","jun.","jul.","ago.","sep.","oct.","nov.","dic.",""],MonthGenitiveNames:[],AbbreviatedMonthGenitiveNames:[],AMDesignator:"a.\u00a0m.",PMDesignator:"p.\u00a0m.",DateSeparator:"/",TimeSeparator:":",ShortDatePattern:"025"},12300:{LCID:12300,Name:"fr-CI",CurrencyPositivePattern:3,CurrencyNegativePattern:8,CurrencySymbol:"CFA",NumberDecimalSeparator:",",NumberGroupSeparator:" ",NumberGroupSizes:[3],DayNames:["dimanche","lundi","mardi","mercredi","jeudi","vendredi","samedi"],AbbreviatedDayNames:["dim.", "lun.","mar.","mer.","jeu.","ven.","sam."],MonthNames:["janvier","f\u00e9vrier","mars","avril","mai","juin","juillet","ao\u00fbt","septembre","octobre","novembre","d\u00e9cembre",""],AbbreviatedMonthNames:["janv.","f\u00e9vr.","mars","avr.","mai","juin","juil.","ao\u00fbt","sept.","oct.","nov.","d\u00e9c.",""],MonthGenitiveNames:[],AbbreviatedMonthGenitiveNames:[],AMDesignator:"AM",PMDesignator:"PM",DateSeparator:"/",TimeSeparator:":",ShortDatePattern:"135"},13321:{LCID:13321,Name:"en-PH",CurrencyPositivePattern:0, CurrencyNegativePattern:1,CurrencySymbol:"\u20b1",NumberDecimalSeparator:".",NumberGroupSeparator:",",NumberGroupSizes:[3],DayNames:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],AbbreviatedDayNames:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],MonthNames:["January","February","March","April","May","June","July","August","September","October","November","December",""],AbbreviatedMonthNames:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec",""],MonthGenitiveNames:[], AbbreviatedMonthGenitiveNames:[],AMDesignator:"am",PMDesignator:"pm",DateSeparator:"/",TimeSeparator:":",ShortDatePattern:"135"},13322:{LCID:13322,Name:"es-CL",CurrencyPositivePattern:0,CurrencyNegativePattern:2,CurrencySymbol:"$",NumberDecimalSeparator:",",NumberGroupSeparator:".",NumberGroupSizes:[3],DayNames:["domingo","lunes","martes","mi\u00e9rcoles","jueves","viernes","s\u00e1bado"],AbbreviatedDayNames:["dom.","lun.","mar.","mi\u00e9.","jue.","vie.","s\u00e1b."],MonthNames:["enero","febrero", "marzo","abril","mayo","junio","julio","agosto","septiembre","octubre","noviembre","diciembre",""],AbbreviatedMonthNames:["ene.","feb.","mar.","abr.","may.","jun.","jul.","ago.","sept.","oct.","nov.","dic.",""],MonthGenitiveNames:[],AbbreviatedMonthGenitiveNames:["ene.","feb.","mar.","abr.","may.","jun.","jul.","ago.","sep.","oct.","nov.","dic.",""],AMDesignator:"a.\u00a0m.",PMDesignator:"p.\u00a0m.",DateSeparator:"-",TimeSeparator:":",ShortDatePattern:"135"},13324:{LCID:13324,Name:"fr-ML",CurrencyPositivePattern:3, CurrencyNegativePattern:8,CurrencySymbol:"CFA",NumberDecimalSeparator:",",NumberGroupSeparator:" ",NumberGroupSizes:[3],DayNames:["dimanche","lundi","mardi","mercredi","jeudi","vendredi","samedi"],AbbreviatedDayNames:["dim.","lun.","mar.","mer.","jeu.","ven.","sam."],MonthNames:["janvier","f\u00e9vrier","mars","avril","mai","juin","juillet","ao\u00fbt","septembre","octobre","novembre","d\u00e9cembre",""],AbbreviatedMonthNames:["janv.","f\u00e9vr.","mars","avr.","mai","juin","juil.","ao\u00fbt","sept.", "oct.","nov.","d\u00e9c.",""],MonthGenitiveNames:[],AbbreviatedMonthGenitiveNames:[],AMDesignator:"AM",PMDesignator:"PM",DateSeparator:"/",TimeSeparator:":",ShortDatePattern:"135"},14345:{LCID:14345,Name:"en-ID",CurrencyPositivePattern:0,CurrencyNegativePattern:1,CurrencySymbol:"Rp",NumberDecimalSeparator:",",NumberGroupSeparator:".",NumberGroupSizes:[3],DayNames:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],AbbreviatedDayNames:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"], MonthNames:["January","February","March","April","May","June","July","August","September","October","November","December",""],AbbreviatedMonthNames:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec",""],MonthGenitiveNames:[],AbbreviatedMonthGenitiveNames:[],AMDesignator:"AM",PMDesignator:"PM",DateSeparator:"/",TimeSeparator:":",ShortDatePattern:"135"},14346:{LCID:14346,Name:"es-UY",CurrencyPositivePattern:2,CurrencyNegativePattern:9,CurrencySymbol:"$",NumberDecimalSeparator:",", NumberGroupSeparator:".",NumberGroupSizes:[3],DayNames:["domingo","lunes","martes","mi\u00e9rcoles","jueves","viernes","s\u00e1bado"],AbbreviatedDayNames:["dom.","lun.","mar.","mi\u00e9.","jue.","vie.","s\u00e1b."],MonthNames:["Enero","Febrero","Marzo","Abril","Mayo","Junio","Julio","Agosto","Setiembre","Octubre","Noviembre","Diciembre",""],AbbreviatedMonthNames:["Ene.","Feb.","Mar.","Abr.","May.","Jun.","Jul.","Ago.","Set.","Oct.","Nov.","Dic.",""],MonthGenitiveNames:["enero","febrero","marzo","abril", "mayo","junio","julio","agosto","setiembre","octubre","noviembre","diciembre",""],AbbreviatedMonthGenitiveNames:["ene.","feb.","mar.","abr.","may.","jun.","jul.","ago.","set.","oct.","nov.","dic.",""],AMDesignator:"a.\u00a0m.",PMDesignator:"p.\u00a0m.",DateSeparator:"/",TimeSeparator:":",ShortDatePattern:"025"},14348:{LCID:14348,Name:"fr-MA",CurrencyPositivePattern:3,CurrencyNegativePattern:8,CurrencySymbol:"DH",NumberDecimalSeparator:",",NumberGroupSeparator:".",NumberGroupSizes:[3],DayNames:["dimanche", "lundi","mardi","mercredi","jeudi","vendredi","samedi"],AbbreviatedDayNames:["dim.","lun.","mar.","mer.","jeu.","ven.","sam."],MonthNames:["janvier","f\u00e9vrier","mars","avril","mai","juin","juillet","ao\u00fbt","septembre","octobre","novembre","d\u00e9cembre",""],AbbreviatedMonthNames:["jan.","f\u00e9v.","mar.","avr.","mai","jui.","juil.","ao\u00fbt","sept.","oct.","nov.","d\u00e9c.",""],MonthGenitiveNames:[],AbbreviatedMonthGenitiveNames:[],AMDesignator:"AM",PMDesignator:"PM",DateSeparator:"/", TimeSeparator:":",ShortDatePattern:"135"},15369:{LCID:15369,Name:"en-HK",CurrencyPositivePattern:0,CurrencyNegativePattern:1,CurrencySymbol:"$",NumberDecimalSeparator:".",NumberGroupSeparator:",",NumberGroupSizes:[3],DayNames:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],AbbreviatedDayNames:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],MonthNames:["January","February","March","April","May","June","July","August","September","October","November","December",""],AbbreviatedMonthNames:["Jan", "Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec",""],MonthGenitiveNames:[],AbbreviatedMonthGenitiveNames:[],AMDesignator:"am",PMDesignator:"pm",DateSeparator:"/",TimeSeparator:":",ShortDatePattern:"025"},15370:{LCID:15370,Name:"es-PY",CurrencyPositivePattern:2,CurrencyNegativePattern:12,CurrencySymbol:"\u20b2",NumberDecimalSeparator:",",NumberGroupSeparator:".",NumberGroupSizes:[3],DayNames:["domingo","lunes","martes","mi\u00e9rcoles","jueves","viernes","s\u00e1bado"],AbbreviatedDayNames:["dom.", "lun.","mar.","mi\u00e9.","jue.","vie.","s\u00e1b."],MonthNames:["enero","febrero","marzo","abril","mayo","junio","julio","agosto","septiembre","octubre","noviembre","diciembre",""],AbbreviatedMonthNames:["ene.","feb.","mar.","abr.","may.","jun.","jul.","ago.","sept.","oct.","nov.","dic.",""],MonthGenitiveNames:[],AbbreviatedMonthGenitiveNames:[],AMDesignator:"a.\u00a0m.",PMDesignator:"p.\u00a0m.",DateSeparator:"/",TimeSeparator:":",ShortDatePattern:"025"},15372:{LCID:15372,Name:"fr-HT",CurrencyPositivePattern:3, CurrencyNegativePattern:8,CurrencySymbol:"G",NumberDecimalSeparator:",",NumberGroupSeparator:" ",NumberGroupSizes:[3],DayNames:["dimanche","lundi","mardi","mercredi","jeudi","vendredi","samedi"],AbbreviatedDayNames:["dim.","lun.","mar.","mer.","jeu.","ven.","sam."],MonthNames:["janvier","f\u00e9vrier","mars","avril","mai","juin","juillet","ao\u00fbt","septembre","octobre","novembre","d\u00e9cembre",""],AbbreviatedMonthNames:["janv.","f\u00e9vr.","mars","avr.","mai","juin","juil.","ao\u00fbt","sept.", "oct.","nov.","d\u00e9c.",""],MonthGenitiveNames:[],AbbreviatedMonthGenitiveNames:[],AMDesignator:"AM",PMDesignator:"PM",DateSeparator:"/",TimeSeparator:":",ShortDatePattern:"135"},16393:{LCID:16393,Name:"en-IN",CurrencyPositivePattern:2,CurrencyNegativePattern:12,CurrencySymbol:"\u20b9",NumberDecimalSeparator:".",NumberGroupSeparator:",",NumberGroupSizes:[3,2],DayNames:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],AbbreviatedDayNames:["Sun","Mon","Tue","Wed","Thu","Fri", "Sat"],MonthNames:["January","February","March","April","May","June","July","August","September","October","November","December",""],AbbreviatedMonthNames:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec",""],MonthGenitiveNames:[],AbbreviatedMonthGenitiveNames:[],AMDesignator:"AM",PMDesignator:"PM",DateSeparator:"-",TimeSeparator:":",ShortDatePattern:"135"},16394:{LCID:16394,Name:"es-BO",CurrencyPositivePattern:0,CurrencyNegativePattern:1,CurrencySymbol:"Bs",NumberDecimalSeparator:",", NumberGroupSeparator:".",NumberGroupSizes:[3],DayNames:["domingo","lunes","martes","mi\u00e9rcoles","jueves","viernes","s\u00e1bado"],AbbreviatedDayNames:["dom.","lun.","mar.","mi\u00e9.","jue.","vie.","s\u00e1b."],MonthNames:["enero","febrero","marzo","abril","mayo","junio","julio","agosto","septiembre","octubre","noviembre","diciembre",""],AbbreviatedMonthNames:["ene.","feb.","mar.","abr.","may.","jun.","jul.","ago.","sep.","oct.","nov.","dic.",""],MonthGenitiveNames:[],AbbreviatedMonthGenitiveNames:[], AMDesignator:"a.\u00a0m.",PMDesignator:"p.\u00a0m.",DateSeparator:"/",TimeSeparator:":",ShortDatePattern:"025"},17417:{LCID:17417,Name:"en-MY",CurrencyPositivePattern:0,CurrencyNegativePattern:1,CurrencySymbol:"RM",NumberDecimalSeparator:".",NumberGroupSeparator:",",NumberGroupSizes:[3],DayNames:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],AbbreviatedDayNames:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],MonthNames:["January","February","March","April","May","June","July", "August","September","October","November","December",""],AbbreviatedMonthNames:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec",""],MonthGenitiveNames:[],AbbreviatedMonthGenitiveNames:[],AMDesignator:"AM",PMDesignator:"PM",DateSeparator:"/",TimeSeparator:":",ShortDatePattern:"025"},17418:{LCID:17418,Name:"es-SV",CurrencyPositivePattern:0,CurrencyNegativePattern:1,CurrencySymbol:"$",NumberDecimalSeparator:".",NumberGroupSeparator:",",NumberGroupSizes:[3],DayNames:["domingo", "lunes","martes","mi\u00e9rcoles","jueves","viernes","s\u00e1bado"],AbbreviatedDayNames:["dom.","lun.","mar.","mi\u00e9.","jue.","vie.","s\u00e1b."],MonthNames:["enero","febrero","marzo","abril","mayo","junio","julio","agosto","septiembre","octubre","noviembre","diciembre",""],AbbreviatedMonthNames:["ene.","feb.","mar.","abr.","may.","jun.","jul.","ago.","sep.","oct.","nov.","dic.",""],MonthGenitiveNames:[],AbbreviatedMonthGenitiveNames:[],AMDesignator:"a.\u00a0m.",PMDesignator:"p.\u00a0m.",DateSeparator:"/", TimeSeparator:":",ShortDatePattern:"025"},18441:{LCID:18441,Name:"en-SG",CurrencyPositivePattern:0,CurrencyNegativePattern:1,CurrencySymbol:"$",NumberDecimalSeparator:".",NumberGroupSeparator:",",NumberGroupSizes:[3],DayNames:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],AbbreviatedDayNames:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],MonthNames:["January","February","March","April","May","June","July","August","September","October","November","December",""],AbbreviatedMonthNames:["Jan", "Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec",""],MonthGenitiveNames:[],AbbreviatedMonthGenitiveNames:[],AMDesignator:"am",PMDesignator:"pm",DateSeparator:"/",TimeSeparator:":",ShortDatePattern:"025"},18442:{LCID:18442,Name:"es-HN",CurrencyPositivePattern:0,CurrencyNegativePattern:1,CurrencySymbol:"L",NumberDecimalSeparator:".",NumberGroupSeparator:",",NumberGroupSizes:[3],DayNames:["domingo","lunes","martes","mi\u00e9rcoles","jueves","viernes","s\u00e1bado"],AbbreviatedDayNames:["dom.", "lun.","mar.","mi\u00e9.","jue.","vie.","s\u00e1b."],MonthNames:["enero","febrero","marzo","abril","mayo","junio","julio","agosto","septiembre","octubre","noviembre","diciembre",""],AbbreviatedMonthNames:["ene.","feb.","mar.","abr.","may.","jun.","jul.","ago.","sep.","oct.","nov.","dic.",""],MonthGenitiveNames:[],AbbreviatedMonthGenitiveNames:[],AMDesignator:"a.\u00a0m.",PMDesignator:"p.\u00a0m.",DateSeparator:"/",TimeSeparator:":",ShortDatePattern:"025"},19466:{LCID:19466,Name:"es-NI",CurrencyPositivePattern:0, CurrencyNegativePattern:1,CurrencySymbol:"C$",NumberDecimalSeparator:".",NumberGroupSeparator:",",NumberGroupSizes:[3],DayNames:["domingo","lunes","martes","mi\u00e9rcoles","jueves","viernes","s\u00e1bado"],AbbreviatedDayNames:["dom.","lun.","mar.","mi\u00e9.","jue.","vie.","s\u00e1b."],MonthNames:["enero","febrero","marzo","abril","mayo","junio","julio","agosto","septiembre","octubre","noviembre","diciembre",""],AbbreviatedMonthNames:["ene.","feb.","mar.","abr.","may.","jun.","jul.","ago.","sep.", "oct.","nov.","dic.",""],MonthGenitiveNames:[],AbbreviatedMonthGenitiveNames:[],AMDesignator:"a.\u00a0m.",PMDesignator:"p.\u00a0m.",DateSeparator:"/",TimeSeparator:":",ShortDatePattern:"025"},20490:{LCID:20490,Name:"es-PR",CurrencyPositivePattern:0,CurrencyNegativePattern:1,CurrencySymbol:"$",NumberDecimalSeparator:".",NumberGroupSeparator:",",NumberGroupSizes:[3],DayNames:["domingo","lunes","martes","mi\u00e9rcoles","jueves","viernes","s\u00e1bado"],AbbreviatedDayNames:["dom.","lun.","mar.","mi\u00e9.", "jue.","vie.","s\u00e1b."],MonthNames:["enero","febrero","marzo","abril","mayo","junio","julio","agosto","septiembre","octubre","noviembre","diciembre",""],AbbreviatedMonthNames:["ene.","feb.","mar.","abr.","may.","jun.","jul.","ago.","sep.","oct.","nov.","dic.",""],MonthGenitiveNames:[],AbbreviatedMonthGenitiveNames:[],AMDesignator:"a.\u00a0m.",PMDesignator:"p.\u00a0m.",DateSeparator:"/",TimeSeparator:":",ShortDatePattern:"315"},21514:{LCID:21514,Name:"es-US",CurrencyPositivePattern:0,CurrencyNegativePattern:0, CurrencySymbol:"$",NumberDecimalSeparator:".",NumberGroupSeparator:",",NumberGroupSizes:[3],DayNames:["domingo","lunes","martes","mi\u00e9rcoles","jueves","viernes","s\u00e1bado"],AbbreviatedDayNames:["dom","lun","mar","mi\u00e9","jue","vie","s\u00e1b"],MonthNames:["enero","febrero","marzo","abril","mayo","junio","julio","agosto","septiembre","octubre","noviembre","diciembre",""],AbbreviatedMonthNames:["ene","feb","mar","abr","may","jun","jul","ago","sep","oct","nov","dic",""],MonthGenitiveNames:[], AbbreviatedMonthGenitiveNames:[],AMDesignator:"AM",PMDesignator:"PM",DateSeparator:"/",TimeSeparator:":",ShortDatePattern:"205"},22538:{LCID:22538,Name:"es-419",CurrencyPositivePattern:0,CurrencyNegativePattern:1,CurrencySymbol:"XDR",NumberDecimalSeparator:".",NumberGroupSeparator:",",NumberGroupSizes:[3],DayNames:["domingo","lunes","martes","mi\u00e9rcoles","jueves","viernes","s\u00e1bado"],AbbreviatedDayNames:["dom.","lun.","mar.","mi\u00e9.","jue.","vie.","s\u00e1b."],MonthNames:["enero","febrero", "marzo","abril","mayo","junio","julio","agosto","septiembre","octubre","noviembre","diciembre",""],AbbreviatedMonthNames:["ene.","feb.","mar.","abr.","may.","jun.","jul.","ago.","sep.","oct.","nov.","dic.",""],MonthGenitiveNames:[],AbbreviatedMonthGenitiveNames:[],AMDesignator:"a.m.",PMDesignator:"p.m.",DateSeparator:"/",TimeSeparator:":",ShortDatePattern:"025"},23562:{LCID:23562,Name:"es-CU",CurrencyPositivePattern:0,CurrencyNegativePattern:1,CurrencySymbol:"$",NumberDecimalSeparator:".",NumberGroupSeparator:",", NumberGroupSizes:[3],DayNames:["domingo","lunes","martes","mi\u00e9rcoles","jueves","viernes","s\u00e1bado"],AbbreviatedDayNames:["dom.","lun.","mar.","mi\u00e9.","jue.","vie.","s\u00e1b."],MonthNames:["enero","febrero","marzo","abril","mayo","junio","julio","agosto","septiembre","octubre","noviembre","diciembre",""],AbbreviatedMonthNames:["ene.","feb.","mar.","abr.","may.","jun.","jul.","ago.","sep.","oct.","nov.","dic.",""],MonthGenitiveNames:[],AbbreviatedMonthGenitiveNames:[],AMDesignator:"a.m.", PMDesignator:"p.m.",DateSeparator:"/",TimeSeparator:":",ShortDatePattern:"025"},29740:{LCID:29740,Name:"az-Cyrl",CurrencyPositivePattern:3,CurrencyNegativePattern:8,CurrencySymbol:"\u20bc",NumberDecimalSeparator:",",NumberGroupSeparator:" ",NumberGroupSizes:[3],DayNames:["\u0431\u0430\u0437\u0430\u0440","\u0431\u0430\u0437\u0430\u0440\u00a0\u0435\u0440\u0442\u04d9\u0441\u0438","\u0447\u04d9\u0440\u0448\u04d9\u043d\u0431\u04d9\u00a0\u0430\u0445\u0448\u0430\u043c\u044b","\u0447\u04d9\u0440\u0448\u04d9\u043d\u0431\u04d9", "\u04b9\u04af\u043c\u04d9\u00a0\u0430\u0445\u0448\u0430\u043c\u044b","\u04b9\u04af\u043c\u04d9","\u0448\u04d9\u043d\u0431\u04d9"],AbbreviatedDayNames:["\u0411","\u0411\u0435","\u0427\u0430","\u0427","\u04b8\u0430","\u04b8","\u0428"],MonthNames:["j\u0430\u043d\u0432\u0430\u0440","\u0444\u0435\u0432\u0440\u0430\u043b","\u043c\u0430\u0440\u0442","\u0430\u043f\u0440\u0435\u043b","\u043c\u0430\u0458","\u0438\u0458\u0443\u043d","\u0438\u0458\u0443\u043b","\u0430\u0432\u0433\u0443\u0441\u0442","\u0441\u0435\u043d\u0442\u0458\u0430\u0431\u0440", "\u043e\u043a\u0442\u0458\u0430\u0431\u0440","\u043d\u043e\u0458\u0430\u0431\u0440","\u0434\u0435\u043a\u0430\u0431\u0440",""],AbbreviatedMonthNames:["\u0408\u0430\u043d","\u0424\u0435\u0432","\u041c\u0430\u0440","\u0410\u043f\u0440","\u041c\u0430\u0458","\u0418\u0458\u0443\u043d","\u0418\u0458\u0443\u043b","\u0410\u0432\u0433","\u0421\u0435\u043d","\u041e\u043a\u0442","\u041d\u043e\u044f","\u0414\u0435\u043a",""],MonthGenitiveNames:["\u0458\u0430\u043d\u0432\u0430\u0440","\u0444\u0435\u0432\u0440\u0430\u043b", "\u043c\u0430\u0440\u0442","\u0430\u043f\u0440\u0435\u043b","\u043c\u0430\u0458","\u0438\u0458\u0443\u043d","\u0438\u0458\u0443\u043b","\u0430\u0432\u0433\u0443\u0441\u0442","\u0441\u0435\u043d\u0442\u0458\u0430\u0431\u0440","\u043e\u043a\u0442\u0458\u0430\u0431\u0440","\u043d\u043e\u0458\u0430\u0431\u0440","\u0434\u0435\u043a\u0430\u0431\u0440",""],AbbreviatedMonthGenitiveNames:["\u0408\u0430\u043d","\u0424\u0435\u0432","\u041c\u0430\u0440","\u0410\u043f\u0440","\u043c\u0430\u044f","\u0438\u0458\u0443\u043d", "\u0438\u0458\u0443\u043b","\u0410\u0432\u0433","\u0421\u0435\u043d","\u041e\u043a\u0442","\u041d\u043e\u044f","\u0414\u0435\u043a",""],AMDesignator:"",PMDesignator:"",DateSeparator:".",TimeSeparator:":",ShortDatePattern:"135"},30724:{LCID:30724,Name:"zh",CurrencyPositivePattern:0,CurrencyNegativePattern:2,CurrencySymbol:"\u00a5",NumberDecimalSeparator:".",NumberGroupSeparator:",",NumberGroupSizes:[3],DayNames:["\u661f\u671f\u65e5","\u661f\u671f\u4e00","\u661f\u671f\u4e8c","\u661f\u671f\u4e09","\u661f\u671f\u56db", "\u661f\u671f\u4e94","\u661f\u671f\u516d"],AbbreviatedDayNames:["\u5468\u65e5","\u5468\u4e00","\u5468\u4e8c","\u5468\u4e09","\u5468\u56db","\u5468\u4e94","\u5468\u516d"],MonthNames:["\u4e00\u6708","\u4e8c\u6708","\u4e09\u6708","\u56db\u6708","\u4e94\u6708","\u516d\u6708","\u4e03\u6708","\u516b\u6708","\u4e5d\u6708","\u5341\u6708","\u5341\u4e00\u6708","\u5341\u4e8c\u6708",""],AbbreviatedMonthNames:["1\u6708","2\u6708","3\u6708","4\u6708","5\u6708","6\u6708","7\u6708","8\u6708","9\u6708","10\u6708", "11\u6708","12\u6708",""],MonthGenitiveNames:[],AbbreviatedMonthGenitiveNames:[],AMDesignator:"\u4e0a\u5348",PMDesignator:"\u4e0b\u5348",DateSeparator:"/",TimeSeparator:":",ShortDatePattern:"520"},30764:{LCID:30764,Name:"az-Latn",CurrencyPositivePattern:3,CurrencyNegativePattern:8,CurrencySymbol:"\u20bc",NumberDecimalSeparator:",",NumberGroupSeparator:".",NumberGroupSizes:[3],DayNames:["bazar","bazar ert\u0259si","\u00e7\u0259r\u015f\u0259nb\u0259 ax\u015fam\u0131","\u00e7\u0259r\u015f\u0259nb\u0259", "c\u00fcm\u0259 ax\u015fam\u0131","c\u00fcm\u0259","\u015f\u0259nb\u0259"],AbbreviatedDayNames:["B.","B.E.","\u00c7.A.","\u00c7.","C.A.","C.","\u015e."],MonthNames:["Yanvar","Fevral","Mart","Aprel","May","\u0130yun","\u0130yul","Avqust","Sentyabr","Oktyabr","Noyabr","Dekabr",""],AbbreviatedMonthNames:["yan","fev","mar","apr","may","iyn","iyl","avq","sen","okt","noy","dek",""],MonthGenitiveNames:["yanvar","fevral","mart","aprel","may","iyun","iyul","avqust","sentyabr","oktyabr","noyabr","dekabr",""], AbbreviatedMonthGenitiveNames:[],AMDesignator:"AM",PMDesignator:"PM",DateSeparator:".",TimeSeparator:":",ShortDatePattern:"135"},30800:{LCID:30800,Name:"mn-Cyrl",CurrencyPositivePattern:2,CurrencyNegativePattern:9,CurrencySymbol:"\u20ae",NumberDecimalSeparator:".",NumberGroupSeparator:",",NumberGroupSizes:[3],DayNames:["\u043d\u044f\u043c","\u0434\u0430\u0432\u0430\u0430","\u043c\u044f\u0433\u043c\u0430\u0440","\u043b\u0445\u0430\u0433\u0432\u0430","\u043f\u04af\u0440\u044d\u0432","\u0431\u0430\u0430\u0441\u0430\u043d", "\u0431\u044f\u043c\u0431\u0430"],AbbreviatedDayNames:["\u041d\u044f","\u0414\u0430","\u041c\u044f","\u041b\u0445","\u041f\u04af","\u0411\u0430","\u0411\u044f"],MonthNames:["\u041d\u044d\u0433\u0434\u04af\u0433\u044d\u044d\u0440 \u0441\u0430\u0440","\u0425\u043e\u0451\u0440\u0434\u0443\u0433\u0430\u0430\u0440 \u0441\u0430\u0440","\u0413\u0443\u0440\u0430\u0432\u0434\u0443\u0433\u0430\u0430\u0440 \u0441\u0430\u0440","\u0414\u04e9\u0440\u04e9\u0432\u0434\u04af\u0433\u044d\u044d\u0440 \u0441\u0430\u0440", "\u0422\u0430\u0432\u0434\u0443\u0433\u0430\u0430\u0440 \u0441\u0430\u0440","\u0417\u0443\u0440\u0433\u0430\u0430\u0434\u0443\u0433\u0430\u0430\u0440 \u0441\u0430\u0440","\u0414\u043e\u043b\u043e\u043e\u0434\u0443\u0433\u0430\u0430\u0440 \u0441\u0430\u0440","\u041d\u0430\u0439\u043c\u0434\u0443\u0433\u0430\u0430\u0440 \u0441\u0430\u0440","\u0415\u0441\u0434\u04af\u0433\u044d\u044d\u0440 \u0441\u0430\u0440","\u0410\u0440\u0430\u0432\u0434\u0443\u0433\u0430\u0430\u0440 \u0441\u0430\u0440","\u0410\u0440\u0432\u0430\u043d \u043d\u044d\u0433\u0434\u04af\u0433\u044d\u044d\u0440 \u0441\u0430\u0440", "\u0410\u0440\u0432\u0430\u043d \u0445\u043e\u0451\u0440\u0434\u0443\u0433\u0430\u0430\u0440 \u0441\u0430\u0440",""],AbbreviatedMonthNames:["1-\u0440 \u0441\u0430\u0440","2-\u0440 \u0441\u0430\u0440","3-\u0440 \u0441\u0430\u0440","4-\u0440 \u0441\u0430\u0440","5-\u0440 \u0441\u0430\u0440","6-\u0440 \u0441\u0430\u0440","7-\u0440 \u0441\u0430\u0440","8-\u0440 \u0441\u0430\u0440","9-\u0440 \u0441\u0430\u0440","10-\u0440 \u0441\u0430\u0440","11-\u0440 \u0441\u0430\u0440","12-\u0440 \u0441\u0430\u0440", ""],MonthGenitiveNames:["\u043d\u044d\u0433\u0434\u04af\u0433\u044d\u044d\u0440 \u0441\u0430\u0440","\u0445\u043e\u0451\u0440\u0434\u0443\u0433\u0430\u0430\u0440 \u0441\u0430\u0440","\u0433\u0443\u0440\u0430\u0432\u0434\u0443\u0433\u0430\u0430\u0440 \u0441\u0430\u0440","\u0434\u04e9\u0440\u04e9\u0432\u0434\u04af\u0433\u044d\u044d\u0440 \u0441\u0430\u0440","\u0442\u0430\u0432\u0434\u0443\u0433\u0430\u0430\u0440 \u0441\u0430\u0440","\u0437\u0443\u0440\u0433\u0430\u0430\u0434\u0443\u0433\u0430\u0430\u0440 \u0441\u0430\u0440", "\u0434\u043e\u043b\u043e\u043e\u0434\u0443\u0433\u0430\u0430\u0440 \u0441\u0430\u0440","\u043d\u0430\u0439\u043c\u0434\u0443\u0433\u0430\u0430\u0440 \u0441\u0430\u0440","\u0435\u0441\u0434\u04af\u0433\u044d\u044d\u0440 \u0441\u0430\u0440","\u0430\u0440\u0430\u0432\u0434\u0443\u0433\u0430\u0430\u0440 \u0441\u0430\u0440","\u0430\u0440\u0432\u0430\u043d \u043d\u044d\u0433\u0434\u04af\u0433\u044d\u044d\u0440 \u0441\u0430\u0440","\u0430\u0440\u0432\u0430\u043d \u0445\u043e\u0451\u0440\u0434\u0443\u0433\u0430\u0430\u0440 \u0441\u0430\u0440", ""],AbbreviatedMonthGenitiveNames:[],AMDesignator:"\u04af.\u04e9.",PMDesignator:"\u04af.\u0445.",DateSeparator:".",TimeSeparator:":",ShortDatePattern:"531"},31748:{LCID:31748,Name:"zh-Hant",CurrencyPositivePattern:0,CurrencyNegativePattern:0,CurrencySymbol:"HK$",NumberDecimalSeparator:".",NumberGroupSeparator:",",NumberGroupSizes:[3],DayNames:["\u661f\u671f\u65e5","\u661f\u671f\u4e00","\u661f\u671f\u4e8c","\u661f\u671f\u4e09","\u661f\u671f\u56db","\u661f\u671f\u4e94","\u661f\u671f\u516d"],AbbreviatedDayNames:["\u9031\u65e5", "\u9031\u4e00","\u9031\u4e8c","\u9031\u4e09","\u9031\u56db","\u9031\u4e94","\u9031\u516d"],MonthNames:["\u4e00\u6708","\u4e8c\u6708","\u4e09\u6708","\u56db\u6708","\u4e94\u6708","\u516d\u6708","\u4e03\u6708","\u516b\u6708","\u4e5d\u6708","\u5341\u6708","\u5341\u4e00\u6708","\u5341\u4e8c\u6708",""],AbbreviatedMonthNames:["\u4e00\u6708","\u4e8c\u6708","\u4e09\u6708","\u56db\u6708","\u4e94\u6708","\u516d\u6708","\u4e03\u6708","\u516b\u6708","\u4e5d\u6708","\u5341\u6708","\u5341\u4e00\u6708","\u5341\u4e8c\u6708", ""],MonthGenitiveNames:[],AbbreviatedMonthGenitiveNames:[],AMDesignator:"\u4e0a\u5348",PMDesignator:"\u4e0b\u5348",DateSeparator:"/",TimeSeparator:":",ShortDatePattern:"025"},31824:{LCID:31824,Name:"mn-Mong",CurrencyPositivePattern:0,CurrencyNegativePattern:2,CurrencySymbol:"\u00a5",NumberDecimalSeparator:".",NumberGroupSeparator:",",NumberGroupSizes:[3,0],DayNames:["\u182d\u1820\u1837\u1820\u182d\u202f\u1824\u1828 \u1821\u1833\u1826\u1837","\u182d\u1820\u1837\u1820\u182d\u202f\u1824\u1828 \u1828\u1822\u182d\u1821\u1828", "\u182d\u1820\u1837\u1820\u182d\u202f\u1824\u1828 \u182c\u1823\u1836\u1820\u1837","\u182d\u1820\u1837\u1820\u182d\u202f\u1824\u1828 \u182d\u1824\u1837\u182a\u1820\u1828","\u182d\u1820\u1837\u1820\u182d\u202f\u1824\u1828 \u1833\u1825\u1837\u182a\u1821\u1828","\u182d\u1820\u1837\u1820\u182d\u202f\u1824\u1828 \u1832\u1820\u182a\u1824\u1828","\u182d\u1820\u1837\u1820\u182d\u202f\u1824\u1828 \u1835\u1822\u1837\u182d\u1824\u182d\u1820\u1828"],AbbreviatedDayNames:["\u182d\u1820\u1837\u1820\u182d\u202f\u1824\u1828 \u1821\u1833\u1826\u1837", "\u182d\u1820\u1837\u1820\u182d\u202f\u1824\u1828 \u1828\u1822\u182d\u1821\u1828","\u182d\u1820\u1837\u1820\u182d\u202f\u1824\u1828 \u182c\u1823\u1836\u1820\u1837","\u182d\u1820\u1837\u1820\u182d\u202f\u1824\u1828 \u182d\u1824\u1837\u182a\u1820\u1828","\u182d\u1820\u1837\u1820\u182d\u202f\u1824\u1828 \u1833\u1825\u1837\u182a\u1821\u1828","\u182d\u1820\u1837\u1820\u182d\u202f\u1824\u1828 \u1832\u1820\u182a\u1824\u1828","\u182d\u1820\u1837\u1820\u182d\u202f\u1824\u1828 \u1835\u1822\u1837\u182d\u1824\u182d\u1820\u1828"], MonthNames:["\u1828\u1822\u182d\u1821\u1833\u1826\u182d\u1821\u1837 \u1830\u1820\u1837\u180e\u1820","\u182c\u1824\u1836\u180b\u1820\u1833\u1824\u182d\u1820\u1837 \u1830\u1820\u1837\u180e\u1820","\u182d\u1824\u1837\u182a\u1820\u1833\u1824\u182d\u1820\u1837 \u1830\u1820\u1837\u180e\u1820","\u1832\u1826\u1837\u182a\u1821\u1833\u1826\u182d\u1821\u1837 \u1830\u1820\u1837\u180e\u1820","\u1832\u1820\u182a\u1824\u1833\u1824\u182d\u1820\u1837 \u1830\u1820\u1837\u180e\u1820","\u1835\u1822\u1837\u182d\u1824\u1833\u1824\u182d\u1820\u1837 \u1830\u1820\u1837\u180e\u1820", "\u1832\u1824\u182f\u1824\u1833\u1824\u182d\u1820\u1837 \u1830\u1820\u1837\u180e\u1820","\u1828\u1820\u1822\u182e\u1820\u1833\u1824\u182d\u1820\u1837 \u1830\u1820\u1837\u180e\u1820","\u1836\u1822\u1830\u1826\u1833\u1826\u182d\u1821\u1837 \u1830\u1820\u1837\u180e\u1820","\u1820\u1837\u182a\u1820\u1833\u1824\u182d\u1820\u1837 \u1830\u1820\u1837\u180e\u1820","\u1820\u1837\u182a\u1820\u1828 \u1828\u1822\u182d\u1821\u1833\u1826\u182d\u1821\u1837 \u1830\u1820\u1837\u180e\u1820","\u1820\u1837\u182a\u1820\u1828 \u182c\u1824\u1836\u180b\u1820\u1833\u1824\u182d\u1820\u1837 \u1830\u1820\u1837\u180e\u1820", ""],AbbreviatedMonthNames:["\u1828\u1822\u182d\u1821\u1833\u1826\u182d\u1821\u1837 \u1830\u1820\u1837\u180e\u1820","\u182c\u1824\u1836\u180b\u1820\u1833\u1824\u182d\u1820\u1837 \u1830\u1820\u1837\u180e\u1820","\u182d\u1824\u1837\u182a\u1820\u1833\u1824\u182d\u1820\u1837 \u1830\u1820\u1837\u180e\u1820","\u1832\u1826\u1837\u182a\u1821\u1833\u1826\u182d\u1821\u1837 \u1830\u1820\u1837\u180e\u1820","\u1832\u1820\u182a\u1824\u1833\u1824\u182d\u1820\u1837 \u1830\u1820\u1837\u180e\u1820","\u1835\u1822\u1837\u182d\u1824\u1833\u1824\u182d\u1820\u1837 \u1830\u1820\u1837\u180e\u1820", "\u1832\u1824\u182f\u1824\u1833\u1824\u182d\u1820\u1837 \u1830\u1820\u1837\u180e\u1820","\u1828\u1820\u1822\u182e\u1820\u1833\u1824\u182d\u1820\u1837 \u1830\u1820\u1837\u180e\u1820","\u1836\u1822\u1830\u1826\u1833\u1826\u182d\u1821\u1837 \u1830\u1820\u1837\u180e\u1820","\u1820\u1837\u182a\u1820\u1833\u1824\u182d\u1820\u1837 \u1830\u1820\u1837\u180e\u1820","\u1820\u1837\u182a\u1820\u1828 \u1828\u1822\u182d\u1821\u1833\u1826\u182d\u1821\u1837 \u1830\u1820\u1837\u180e\u1820","\u1820\u1837\u182a\u1820\u1828 \u182c\u1824\u1836\u180b\u1820\u1833\u1824\u182d\u1820\u1837 \u1830\u1820\u1837\u180e\u1820", ""],MonthGenitiveNames:[],AbbreviatedMonthGenitiveNames:[],AMDesignator:"",PMDesignator:"",DateSeparator:"/",TimeSeparator:":",ShortDatePattern:"520"}};var g_oDefaultCultureInfo,g_oLCID;setCurrentCultureInfo(1033);window["AscCommon"]=window["AscCommon"]||{};window["AscCommon"].isNumber=isNumber;window["AscCommon"].NumFormat=NumFormat;window["AscCommon"].CellFormat=CellFormat;window["AscCommon"].DecodeGeneralFormat=DecodeGeneralFormat;window["AscCommon"].setCurrentCultureInfo=setCurrentCultureInfo; window["AscCommon"].checkCultureInfoFontPicker=checkCultureInfoFontPicker;window["AscCommon"].getShortDateFormat=getShortDateFormat;window["AscCommon"].getShortDateFormat2=getShortDateFormat2;window["AscCommon"].getShortTimeFormat=getShortTimeFormat;window["AscCommon"].getLongTimeFormat=getLongTimeFormat;window["AscCommon"].getShortDateMonthFormat=getShortDateMonthFormat;window["AscCommon"].getNumberFormatSimple=getNumberFormatSimple;window["AscCommon"].getNumberFormat=getNumberFormat;window["AscCommon"].getLocaleFormat= getLocaleFormat;window["AscCommon"].getCurrencyFormatSimple=getCurrencyFormatSimple;window["AscCommon"].getCurrencyFormatSimple2=getCurrencyFormatSimple2;window["AscCommon"].getCurrencyFormat=getCurrencyFormat;window["AscCommon"].getFormatCells=getFormatCells;window["AscCommon"].getFormatByStandardId=getFormatByStandardId;window["AscCommon"].compareNumbers=compareNumbers;window["AscCommon"].gc_nMaxDigCount=gc_nMaxDigCount;window["AscCommon"].gc_nMaxDigCountView=gc_nMaxDigCountView;window["AscCommon"].oNumFormatCache= oNumFormatCache;window["AscCommon"].oGeneralEditFormatCache=oGeneralEditFormatCache;window["AscCommon"].g_oFormatParser=g_oFormatParser;window["AscCommon"].g_aCultureInfos=g_aCultureInfos;window["AscCommon"].g_oDefaultCultureInfo=g_oDefaultCultureInfo;window["AscCommon"].NumFormatType=NumFormatType})(window);"use strict";(function(window,undefined){var c_oSerConstants=AscCommon.c_oSerConstants;var c_oAscTickMark=Asc.c_oAscTickMark;var c_oAscTickLabelsPos=Asc.c_oAscTickLabelsPos;var c_oAscChartDataLabelsPos= Asc.c_oAscChartDataLabelsPos;var c_oAscValAxUnits=Asc.c_oAscValAxUnits;var c_oAscChartLegendShowSettings=Asc.c_oAscChartLegendShowSettings;var st_pagesetuporientationDEFAULT=0;var st_pagesetuporientationPORTRAIT=1;var st_pagesetuporientationLANDSCAPE=2;var st_dispblanksasSPAN=0;var st_dispblanksasGAP=1;var st_dispblanksasZERO=2;var st_legendposB=0;var st_legendposTR=1;var st_legendposL=2;var st_legendposR=3;var st_legendposT=4;var st_layouttargetINNER=0;var st_layouttargetOUTER=1;var st_layoutmodeEDGE= 0;var st_layoutmodeFACTOR=1;var st_orientationMAXMIN=0;var st_orientationMINMAX=1;var st_axposB=0;var st_axposL=1;var st_axposR=2;var st_axposT=3;var st_tickmarkCROSS=0;var st_tickmarkIN=1;var st_tickmarkNONE=2;var st_tickmarkOUT=3;var st_ticklblposHIGH=0;var st_ticklblposLOW=1;var st_ticklblposNEXTTO=2;var st_ticklblposNONE=3;var st_crossesAUTOZERO=0;var st_crossesMAX=1;var st_crossesMIN=2;var st_timeunitDAYS=0;var st_timeunitMONTHS=1;var st_timeunitYEARS=2;var st_lblalgnCTR=0;var st_lblalgnL=1; var st_lblalgnR=2;var st_builtinunitHUNDREDS=0;var st_builtinunitTHOUSANDS=1;var st_builtinunitTENTHOUSANDS=2;var st_builtinunitHUNDREDTHOUSANDS=3;var st_builtinunitMILLIONS=4;var st_builtinunitTENMILLIONS=5;var st_builtinunitHUNDREDMILLIONS=6;var st_builtinunitBILLIONS=7;var st_builtinunitTRILLIONS=8;var st_crossbetweenBETWEEN=0;var st_crossbetweenMIDCAT=1;var st_sizerepresentsAREA=0;var st_sizerepresentsW=1;var st_markerstyleCIRCLE=0;var st_markerstyleDASH=1;var st_markerstyleDIAMOND=2;var st_markerstyleDOT= 3;var st_markerstyleNONE=4;var st_markerstylePICTURE=5;var st_markerstylePLUS=6;var st_markerstyleSQUARE=7;var st_markerstyleSTAR=8;var st_markerstyleTRIANGLE=9;var st_markerstyleX=10;var st_markerstyleAUTO=11;var st_pictureformatSTRETCH=0;var st_pictureformatSTACK=1;var st_pictureformatSTACKSCALE=2;var st_dlblposBESTFIT=0;var st_dlblposB=1;var st_dlblposCTR=2;var st_dlblposINBASE=3;var st_dlblposINEND=4;var st_dlblposL=5;var st_dlblposOUTEND=6;var st_dlblposR=7;var st_dlblposT=8;var st_trendlinetypeEXP= 0;var st_trendlinetypeLINEAR=1;var st_trendlinetypeLOG=2;var st_trendlinetypeMOVINGAVG=3;var st_trendlinetypePOLY=4;var st_trendlinetypePOWER=5;var st_errdirX=0;var st_errdirY=1;var st_errbartypeBOTH=0;var st_errbartypeMINUS=1;var st_errbartypePLUS=2;var st_errvaltypeCUST=0;var st_errvaltypeFIXEDVAL=1;var st_errvaltypePERCENTAGE=2;var st_errvaltypeSTDDEV=3;var st_errvaltypeSTDERR=4;var st_splittypeAUTO=0;var st_splittypeCUST=1;var st_splittypePERCENT=2;var st_splittypePOS=3;var st_splittypeVAL=4; var st_ofpietypePIE=0;var st_ofpietypeBAR=1;var st_bardirBAR=0;var st_bardirCOL=1;var st_bargroupingPERCENTSTACKED=0;var st_bargroupingCLUSTERED=1;var st_bargroupingSTANDARD=2;var st_bargroupingSTACKED=3;var st_shapeCONE=0;var st_shapeCONETOMAX=1;var st_shapeBOX=2;var st_shapeCYLINDER=3;var st_shapePYRAMID=4;var st_shapePYRAMIDTOMAX=5;var st_scatterstyleNONE=0;var st_scatterstyleLINE=1;var st_scatterstyleLINEMARKER=2;var st_scatterstyleMARKER=3;var st_scatterstyleSMOOTH=4;var st_scatterstyleSMOOTHMARKER= 5;var st_radarstyleSTANDARD=0;var st_radarstyleMARKER=1;var st_radarstyleFILLED=2;var st_groupingPERCENTSTACKED=0;var st_groupingSTANDARD=1;var st_groupingSTACKED=2;var c_oserct_extlstEXT=0;var c_oserct_chartspaceDATE1904=0;var c_oserct_chartspaceLANG=1;var c_oserct_chartspaceROUNDEDCORNERS=2;var c_oserct_chartspaceALTERNATECONTENT=3;var c_oserct_chartspaceSTYLE=4;var c_oserct_chartspaceCLRMAPOVR=5;var c_oserct_chartspacePIVOTSOURCE=6;var c_oserct_chartspacePROTECTION=7;var c_oserct_chartspaceCHART= 8;var c_oserct_chartspaceSPPR=9;var c_oserct_chartspaceTXPR=10;var c_oserct_chartspaceEXTERNALDATA=11;var c_oserct_chartspacePRINTSETTINGS=12;var c_oserct_chartspaceUSERSHAPES=13;var c_oserct_chartspaceEXTLST=14;var c_oserct_chartspaceTHEMEOVERRIDE=15;var c_oserct_chartspaceXLSX=16;var c_oserct_chartspaceSTYLES=17;var c_oserct_chartspaceCOLORS=18;var c_oserct_usershapes_COUNT=0;var c_oserct_usershapes_SHAPE_REL=1;var c_oserct_usershapes_SHAPE_ABS=2;var c_oserct_booleanVAL=0;var c_oserct_relidID=0; var c_oserct_pagesetupPAPERSIZE=0;var c_oserct_pagesetupPAPERHEIGHT=1;var c_oserct_pagesetupPAPERWIDTH=2;var c_oserct_pagesetupFIRSTPAGENUMBER=3;var c_oserct_pagesetupORIENTATION=4;var c_oserct_pagesetupBLACKANDWHITE=5;var c_oserct_pagesetupDRAFT=6;var c_oserct_pagesetupUSEFIRSTPAGENUMBER=7;var c_oserct_pagesetupHORIZONTALDPI=8;var c_oserct_pagesetupVERTICALDPI=9;var c_oserct_pagesetupCOPIES=10;var c_oserct_pagemarginsL=0;var c_oserct_pagemarginsR=1;var c_oserct_pagemarginsT=2;var c_oserct_pagemarginsB= 3;var c_oserct_pagemarginsHEADER=4;var c_oserct_pagemarginsFOOTER=5;var c_oserct_headerfooterODDHEADER=0;var c_oserct_headerfooterODDFOOTER=1;var c_oserct_headerfooterEVENHEADER=2;var c_oserct_headerfooterEVENFOOTER=3;var c_oserct_headerfooterFIRSTHEADER=4;var c_oserct_headerfooterFIRSTFOOTER=5;var c_oserct_headerfooterALIGNWITHMARGINS=6;var c_oserct_headerfooterDIFFERENTODDEVEN=7;var c_oserct_headerfooterDIFFERENTFIRST=8;var c_oserct_printsettingsHEADERFOOTER=0;var c_oserct_printsettingsPAGEMARGINS= 1;var c_oserct_printsettingsPAGESETUP=2;var c_oserct_externaldataAUTOUPDATE=0;var c_oserct_externaldataID=1;var c_oserct_dispblanksasVAL=0;var c_oserct_legendentryIDX=0;var c_oserct_legendentryDELETE=1;var c_oserct_legendentryTXPR=2;var c_oserct_legendentryEXTLST=3;var c_oserct_unsignedintVAL=0;var c_oserct_extensionANY=0;var c_oserct_extensionURI=1;var c_oserct_legendposVAL=0;var c_oserct_legendLEGENDPOS=0;var c_oserct_legendLEGENDENTRY=1;var c_oserct_legendLAYOUT=2;var c_oserct_legendOVERLAY=3; var c_oserct_legendSPPR=4;var c_oserct_legendTXPR=5;var c_oserct_legendEXTLST=6;var c_oserct_layoutMANUALLAYOUT=0;var c_oserct_layoutEXTLST=1;var c_oserct_manuallayoutLAYOUTTARGET=0;var c_oserct_manuallayoutXMODE=1;var c_oserct_manuallayoutYMODE=2;var c_oserct_manuallayoutWMODE=3;var c_oserct_manuallayoutHMODE=4;var c_oserct_manuallayoutX=5;var c_oserct_manuallayoutY=6;var c_oserct_manuallayoutW=7;var c_oserct_manuallayoutH=8;var c_oserct_manuallayoutEXTLST=9;var c_oserct_layouttargetVAL=0;var c_oserct_layoutmodeVAL= 0;var c_oserct_doubleVAL=0;var c_oserct_dtableSHOWHORZBORDER=0;var c_oserct_dtableSHOWVERTBORDER=1;var c_oserct_dtableSHOWOUTLINE=2;var c_oserct_dtableSHOWKEYS=3;var c_oserct_dtableSPPR=4;var c_oserct_dtableTXPR=5;var c_oserct_dtableEXTLST=6;var c_oserct_seraxAXID=0;var c_oserct_seraxSCALING=1;var c_oserct_seraxDELETE=2;var c_oserct_seraxAXPOS=3;var c_oserct_seraxMAJORGRIDLINES=4;var c_oserct_seraxMINORGRIDLINES=5;var c_oserct_seraxTITLE=6;var c_oserct_seraxNUMFMT=7;var c_oserct_seraxMAJORTICKMARK= 8;var c_oserct_seraxMINORTICKMARK=9;var c_oserct_seraxTICKLBLPOS=10;var c_oserct_seraxSPPR=11;var c_oserct_seraxTXPR=12;var c_oserct_seraxCROSSAX=13;var c_oserct_seraxCROSSES=14;var c_oserct_seraxCROSSESAT=15;var c_oserct_seraxTICKLBLSKIP=16;var c_oserct_seraxTICKMARKSKIP=17;var c_oserct_seraxEXTLST=18;var c_oserct_scalingLOGBASE=0;var c_oserct_scalingORIENTATION=1;var c_oserct_scalingMAX=2;var c_oserct_scalingMIN=3;var c_oserct_scalingEXTLST=4;var c_oserct_logbaseVAL=0;var c_oserct_orientationVAL= 0;var c_oserct_axposVAL=0;var c_oserct_chartlinesSPPR=0;var c_oserct_titleTX=0;var c_oserct_titleLAYOUT=1;var c_oserct_titleOVERLAY=2;var c_oserct_titleSPPR=3;var c_oserct_titleTXPR=4;var c_oserct_titleEXTLST=5;var c_oserct_txRICH=0;var c_oserct_txSTRREF=1;var c_oserct_strrefF=0;var c_oserct_strrefSTRCACHE=1;var c_oserct_strrefEXTLST=2;var c_oserct_strdataPTCOUNT=0;var c_oserct_strdataPT=1;var c_oserct_strdataEXTLST=2;var c_oserct_strvalV=0;var c_oserct_strvalIDX=1;var c_oserct_numfmtFORMATCODE=0; var c_oserct_numfmtSOURCELINKED=1;var c_oserct_tickmarkVAL=0;var c_oserct_ticklblposVAL=0;var c_oserct_crossesVAL=0;var c_oserct_skipVAL=0;var c_oserct_timeunitVAL=0;var c_oserct_dateaxAXID=0;var c_oserct_dateaxSCALING=1;var c_oserct_dateaxDELETE=2;var c_oserct_dateaxAXPOS=3;var c_oserct_dateaxMAJORGRIDLINES=4;var c_oserct_dateaxMINORGRIDLINES=5;var c_oserct_dateaxTITLE=6;var c_oserct_dateaxNUMFMT=7;var c_oserct_dateaxMAJORTICKMARK=8;var c_oserct_dateaxMINORTICKMARK=9;var c_oserct_dateaxTICKLBLPOS= 10;var c_oserct_dateaxSPPR=11;var c_oserct_dateaxTXPR=12;var c_oserct_dateaxCROSSAX=13;var c_oserct_dateaxCROSSES=14;var c_oserct_dateaxCROSSESAT=15;var c_oserct_dateaxAUTO=16;var c_oserct_dateaxLBLOFFSET=17;var c_oserct_dateaxBASETIMEUNIT=18;var c_oserct_dateaxMAJORUNIT=19;var c_oserct_dateaxMAJORTIMEUNIT=20;var c_oserct_dateaxMINORUNIT=21;var c_oserct_dateaxMINORTIMEUNIT=22;var c_oserct_dateaxEXTLST=23;var c_oserct_lbloffsetVAL=0;var c_oserct_axisunitVAL=0;var c_oserct_lblalgnVAL=0;var c_oserct_cataxAXID= 0;var c_oserct_cataxSCALING=1;var c_oserct_cataxDELETE=2;var c_oserct_cataxAXPOS=3;var c_oserct_cataxMAJORGRIDLINES=4;var c_oserct_cataxMINORGRIDLINES=5;var c_oserct_cataxTITLE=6;var c_oserct_cataxNUMFMT=7;var c_oserct_cataxMAJORTICKMARK=8;var c_oserct_cataxMINORTICKMARK=9;var c_oserct_cataxTICKLBLPOS=10;var c_oserct_cataxSPPR=11;var c_oserct_cataxTXPR=12;var c_oserct_cataxCROSSAX=13;var c_oserct_cataxCROSSES=14;var c_oserct_cataxCROSSESAT=15;var c_oserct_cataxAUTO=16;var c_oserct_cataxLBLALGN=17; var c_oserct_cataxLBLOFFSET=18;var c_oserct_cataxTICKLBLSKIP=19;var c_oserct_cataxTICKMARKSKIP=20;var c_oserct_cataxNOMULTILVLLBL=21;var c_oserct_cataxEXTLST=22;var c_oserct_dispunitslblLAYOUT=0;var c_oserct_dispunitslblTX=1;var c_oserct_dispunitslblSPPR=2;var c_oserct_dispunitslblTXPR=3;var c_oserct_builtinunitVAL=0;var c_oserct_dispunitsBUILTINUNIT=0;var c_oserct_dispunitsCUSTUNIT=1;var c_oserct_dispunitsDISPUNITSLBL=2;var c_oserct_dispunitsEXTLST=3;var c_oserct_crossbetweenVAL=0;var c_oserct_valaxAXID= 0;var c_oserct_valaxSCALING=1;var c_oserct_valaxDELETE=2;var c_oserct_valaxAXPOS=3;var c_oserct_valaxMAJORGRIDLINES=4;var c_oserct_valaxMINORGRIDLINES=5;var c_oserct_valaxTITLE=6;var c_oserct_valaxNUMFMT=7;var c_oserct_valaxMAJORTICKMARK=8;var c_oserct_valaxMINORTICKMARK=9;var c_oserct_valaxTICKLBLPOS=10;var c_oserct_valaxSPPR=11;var c_oserct_valaxTXPR=12;var c_oserct_valaxCROSSAX=13;var c_oserct_valaxCROSSES=14;var c_oserct_valaxCROSSESAT=15;var c_oserct_valaxCROSSBETWEEN=16;var c_oserct_valaxMAJORUNIT= 17;var c_oserct_valaxMINORUNIT=18;var c_oserct_valaxDISPUNITS=19;var c_oserct_valaxEXTLST=20;var c_oserct_sizerepresentsVAL=0;var c_oserct_bubblescaleVAL=0;var c_oserct_bubbleserIDX=0;var c_oserct_bubbleserORDER=1;var c_oserct_bubbleserTX=2;var c_oserct_bubbleserSPPR=3;var c_oserct_bubbleserINVERTIFNEGATIVE=4;var c_oserct_bubbleserDPT=5;var c_oserct_bubbleserDLBLS=6;var c_oserct_bubbleserTRENDLINE=7;var c_oserct_bubbleserERRBARS=8;var c_oserct_bubbleserXVAL=9;var c_oserct_bubbleserYVAL=10;var c_oserct_bubbleserBUBBLESIZE= 11;var c_oserct_bubbleserBUBBLE3D=12;var c_oserct_bubbleserEXTLST=13;var c_oserct_sertxSTRREF=0;var c_oserct_sertxV=1;var c_oserct_dptIDX=0;var c_oserct_dptINVERTIFNEGATIVE=1;var c_oserct_dptMARKER=2;var c_oserct_dptBUBBLE3D=3;var c_oserct_dptEXPLOSION=4;var c_oserct_dptSPPR=5;var c_oserct_dptPICTUREOPTIONS=6;var c_oserct_dptEXTLST=7;var c_oserct_markerSYMBOL=0;var c_oserct_markerSIZE=1;var c_oserct_markerSPPR=2;var c_oserct_markerEXTLST=3;var c_oserct_markerstyleVAL=0;var c_oserct_markersizeVAL= 0;var c_oserct_pictureoptionsAPPLYTOFRONT=0;var c_oserct_pictureoptionsAPPLYTOSIDES=1;var c_oserct_pictureoptionsAPPLYTOEND=2;var c_oserct_pictureoptionsPICTUREFORMAT=3;var c_oserct_pictureoptionsPICTURESTACKUNIT=4;var c_oserct_pictureformatVAL=0;var c_oserct_picturestackunitVAL=0;var c_oserct_dlblsDLBL=0;var c_oserct_dlblsITEMS=1;var c_oserct_dlblsDLBLPOS=2;var c_oserct_dlblsDELETE=3;var c_oserct_dlblsLEADERLINES=4;var c_oserct_dlblsNUMFMT=5;var c_oserct_dlblsSEPARATOR=6;var c_oserct_dlblsSHOWBUBBLESIZE= 7;var c_oserct_dlblsSHOWCATNAME=8;var c_oserct_dlblsSHOWLEADERLINES=9;var c_oserct_dlblsSHOWLEGENDKEY=10;var c_oserct_dlblsSHOWPERCENT=11;var c_oserct_dlblsSHOWSERNAME=12;var c_oserct_dlblsSHOWVAL=13;var c_oserct_dlblsSPPR=14;var c_oserct_dlblsTXPR=15;var c_oserct_dlblsEXTLST=16;var c_oserct_dlblIDX=0;var c_oserct_dlblITEMS=1;var c_oserct_dlblDLBLPOS=2;var c_oserct_dlblDELETE=3;var c_oserct_dlblLAYOUT=4;var c_oserct_dlblNUMFMT=5;var c_oserct_dlblSEPARATOR=6;var c_oserct_dlblSHOWBUBBLESIZE=7;var c_oserct_dlblSHOWCATNAME= 8;var c_oserct_dlblSHOWLEGENDKEY=9;var c_oserct_dlblSHOWPERCENT=10;var c_oserct_dlblSHOWSERNAME=11;var c_oserct_dlblSHOWVAL=12;var c_oserct_dlblSPPR=13;var c_oserct_dlblTX=14;var c_oserct_dlblTXPR=15;var c_oserct_dlblEXTLST=16;var c_oserct_dlblposVAL=0;var c_oserct_trendlineNAME=0;var c_oserct_trendlineSPPR=1;var c_oserct_trendlineTRENDLINETYPE=2;var c_oserct_trendlineORDER=3;var c_oserct_trendlinePERIOD=4;var c_oserct_trendlineFORWARD=5;var c_oserct_trendlineBACKWARD=6;var c_oserct_trendlineINTERCEPT= 7;var c_oserct_trendlineDISPRSQR=8;var c_oserct_trendlineDISPEQ=9;var c_oserct_trendlineTRENDLINELBL=10;var c_oserct_trendlineEXTLST=11;var c_oserct_trendlinetypeVAL=0;var c_oserct_orderVAL=0;var c_oserct_periodVAL=0;var c_oserct_trendlinelblLAYOUT=0;var c_oserct_trendlinelblTX=1;var c_oserct_trendlinelblNUMFMT=2;var c_oserct_trendlinelblSPPR=3;var c_oserct_trendlinelblTXPR=4;var c_oserct_trendlinelblEXTLST=5;var c_oserct_errbarsERRDIR=0;var c_oserct_errbarsERRBARTYPE=1;var c_oserct_errbarsERRVALTYPE= 2;var c_oserct_errbarsNOENDCAP=3;var c_oserct_errbarsPLUS=4;var c_oserct_errbarsMINUS=5;var c_oserct_errbarsVAL=6;var c_oserct_errbarsSPPR=7;var c_oserct_errbarsEXTLST=8;var c_oserct_errdirVAL=0;var c_oserct_errbartypeVAL=0;var c_oserct_errvaltypeVAL=0;var c_oserct_numdatasourceNUMLIT=0;var c_oserct_numdatasourceNUMREF=1;var c_oserct_numdataFORMATCODE=0;var c_oserct_numdataPTCOUNT=1;var c_oserct_numdataPT=2;var c_oserct_numdataEXTLST=3;var c_oserct_numvalV=0;var c_oserct_numvalIDX=1;var c_oserct_numvalFORMATCODE= 2;var c_oserct_numrefF=0;var c_oserct_numrefNUMCACHE=1;var c_oserct_numrefEXTLST=2;var c_oserct_axdatasourceMULTILVLSTRREF=0;var c_oserct_axdatasourceNUMLIT=1;var c_oserct_axdatasourceNUMREF=2;var c_oserct_axdatasourceSTRLIT=3;var c_oserct_axdatasourceSTRREF=4;var c_oserct_multilvlstrrefF=0;var c_oserct_multilvlstrrefMULTILVLSTRCACHE=1;var c_oserct_multilvlstrrefEXTLST=2;var c_oserct_lvlPT=0;var c_oserct_multilvlstrdataPTCOUNT=0;var c_oserct_multilvlstrdataLVL=1;var c_oserct_multilvlstrdataEXTLST= 2;var c_oserct_bubblechartVARYCOLORS=0;var c_oserct_bubblechartSER=1;var c_oserct_bubblechartDLBLS=2;var c_oserct_bubblechartBUBBLE3D=3;var c_oserct_bubblechartBUBBLESCALE=4;var c_oserct_bubblechartSHOWNEGBUBBLES=5;var c_oserct_bubblechartSIZEREPRESENTS=6;var c_oserct_bubblechartAXID=7;var c_oserct_bubblechartEXTLST=8;var c_oserct_bandfmtsBANDFMT=0;var c_oserct_surface3dchartWIREFRAME=0;var c_oserct_surface3dchartSER=1;var c_oserct_surface3dchartBANDFMTS=2;var c_oserct_surface3dchartAXID=3;var c_oserct_surface3dchartEXTLST= 4;var c_oserct_surfaceserIDX=0;var c_oserct_surfaceserORDER=1;var c_oserct_surfaceserTX=2;var c_oserct_surfaceserSPPR=3;var c_oserct_surfaceserCAT=4;var c_oserct_surfaceserVAL=5;var c_oserct_surfaceserEXTLST=6;var c_oserct_bandfmtIDX=0;var c_oserct_bandfmtSPPR=1;var c_oserct_surfacechartWIREFRAME=0;var c_oserct_surfacechartSER=1;var c_oserct_surfacechartBANDFMTS=2;var c_oserct_surfacechartAXID=3;var c_oserct_surfacechartEXTLST=4;var c_oserct_secondpiesizeVAL=0;var c_oserct_splittypeVAL=0;var c_oserct_ofpietypeVAL= 0;var c_oserct_custsplitSECONDPIEPT=0;var c_oserct_ofpiechartOFPIETYPE=0;var c_oserct_ofpiechartVARYCOLORS=1;var c_oserct_ofpiechartSER=2;var c_oserct_ofpiechartDLBLS=3;var c_oserct_ofpiechartGAPWIDTH=4;var c_oserct_ofpiechartSPLITTYPE=5;var c_oserct_ofpiechartSPLITPOS=6;var c_oserct_ofpiechartCUSTSPLIT=7;var c_oserct_ofpiechartSECONDPIESIZE=8;var c_oserct_ofpiechartSERLINES=9;var c_oserct_ofpiechartEXTLST=10;var c_oserct_pieserIDX=0;var c_oserct_pieserORDER=1;var c_oserct_pieserTX=2;var c_oserct_pieserSPPR= 3;var c_oserct_pieserEXPLOSION=4;var c_oserct_pieserDPT=5;var c_oserct_pieserDLBLS=6;var c_oserct_pieserCAT=7;var c_oserct_pieserVAL=8;var c_oserct_pieserEXTLST=9;var c_oserct_gapamountVAL=0;var c_oserct_bar3dchartBARDIR=0;var c_oserct_bar3dchartGROUPING=1;var c_oserct_bar3dchartVARYCOLORS=2;var c_oserct_bar3dchartSER=3;var c_oserct_bar3dchartDLBLS=4;var c_oserct_bar3dchartGAPWIDTH=5;var c_oserct_bar3dchartGAPDEPTH=6;var c_oserct_bar3dchartSHAPE=7;var c_oserct_bar3dchartAXID=8;var c_oserct_bar3dchartEXTLST= 9;var c_oserct_bardirVAL=0;var c_oserct_bargroupingVAL=0;var c_oserct_barserIDX=0;var c_oserct_barserORDER=1;var c_oserct_barserTX=2;var c_oserct_barserSPPR=3;var c_oserct_barserINVERTIFNEGATIVE=4;var c_oserct_barserPICTUREOPTIONS=5;var c_oserct_barserDPT=6;var c_oserct_barserDLBLS=7;var c_oserct_barserTRENDLINE=8;var c_oserct_barserERRBARS=9;var c_oserct_barserCAT=10;var c_oserct_barserVAL=11;var c_oserct_barserSHAPE=12;var c_oserct_barserEXTLST=13;var c_oserct_shapeVAL=0;var c_oserct_overlapVAL= 0;var c_oserct_barchartBARDIR=0;var c_oserct_barchartGROUPING=1;var c_oserct_barchartVARYCOLORS=2;var c_oserct_barchartSER=3;var c_oserct_barchartDLBLS=4;var c_oserct_barchartGAPWIDTH=5;var c_oserct_barchartOVERLAP=6;var c_oserct_barchartSERLINES=7;var c_oserct_barchartAXID=8;var c_oserct_barchartEXTLST=9;var c_oserct_holesizeVAL=0;var c_oserct_doughnutchartVARYCOLORS=0;var c_oserct_doughnutchartSER=1;var c_oserct_doughnutchartDLBLS=2;var c_oserct_doughnutchartFIRSTSLICEANG=3;var c_oserct_doughnutchartHOLESIZE= 4;var c_oserct_doughnutchartEXTLST=5;var c_oserct_firstsliceangVAL=0;var c_oserct_pie3dchartVARYCOLORS=0;var c_oserct_pie3dchartSER=1;var c_oserct_pie3dchartDLBLS=2;var c_oserct_pie3dchartEXTLST=3;var c_oserct_piechartVARYCOLORS=0;var c_oserct_piechartSER=1;var c_oserct_piechartDLBLS=2;var c_oserct_piechartFIRSTSLICEANG=3;var c_oserct_piechartEXTLST=4;var c_oserct_scatterserIDX=0;var c_oserct_scatterserORDER=1;var c_oserct_scatterserTX=2;var c_oserct_scatterserSPPR=3;var c_oserct_scatterserMARKER= 4;var c_oserct_scatterserDPT=5;var c_oserct_scatterserDLBLS=6;var c_oserct_scatterserTRENDLINE=7;var c_oserct_scatterserERRBARS=8;var c_oserct_scatterserXVAL=9;var c_oserct_scatterserYVAL=10;var c_oserct_scatterserSMOOTH=11;var c_oserct_scatterserEXTLST=12;var c_oserct_scatterstyleVAL=0;var c_oserct_scatterchartSCATTERSTYLE=0;var c_oserct_scatterchartVARYCOLORS=1;var c_oserct_scatterchartSER=2;var c_oserct_scatterchartDLBLS=3;var c_oserct_scatterchartAXID=4;var c_oserct_scatterchartEXTLST=5;var c_oserct_radarserIDX= 0;var c_oserct_radarserORDER=1;var c_oserct_radarserTX=2;var c_oserct_radarserSPPR=3;var c_oserct_radarserMARKER=4;var c_oserct_radarserDPT=5;var c_oserct_radarserDLBLS=6;var c_oserct_radarserCAT=7;var c_oserct_radarserVAL=8;var c_oserct_radarserEXTLST=9;var c_oserct_radarstyleVAL=0;var c_oserct_radarchartRADARSTYLE=0;var c_oserct_radarchartVARYCOLORS=1;var c_oserct_radarchartSER=2;var c_oserct_radarchartDLBLS=3;var c_oserct_radarchartAXID=4;var c_oserct_radarchartEXTLST=5;var c_oserct_stockchartSER= 0;var c_oserct_stockchartDLBLS=1;var c_oserct_stockchartDROPLINES=2;var c_oserct_stockchartHILOWLINES=3;var c_oserct_stockchartUPDOWNBARS=4;var c_oserct_stockchartAXID=5;var c_oserct_stockchartEXTLST=6;var c_oserct_lineserIDX=0;var c_oserct_lineserORDER=1;var c_oserct_lineserTX=2;var c_oserct_lineserSPPR=3;var c_oserct_lineserMARKER=4;var c_oserct_lineserDPT=5;var c_oserct_lineserDLBLS=6;var c_oserct_lineserTRENDLINE=7;var c_oserct_lineserERRBARS=8;var c_oserct_lineserCAT=9;var c_oserct_lineserVAL= 10;var c_oserct_lineserSMOOTH=11;var c_oserct_lineserEXTLST=12;var c_oserct_updownbarsGAPWIDTH=0;var c_oserct_updownbarsUPBARS=1;var c_oserct_updownbarsDOWNBARS=2;var c_oserct_updownbarsEXTLST=3;var c_oserct_updownbarSPPR=0;var c_oserct_line3dchartGROUPING=0;var c_oserct_line3dchartVARYCOLORS=1;var c_oserct_line3dchartSER=2;var c_oserct_line3dchartDLBLS=3;var c_oserct_line3dchartDROPLINES=4;var c_oserct_line3dchartGAPDEPTH=5;var c_oserct_line3dchartAXID=6;var c_oserct_line3dchartEXTLST=7;var c_oserct_groupingVAL= 0;var c_oserct_linechartGROUPING=0;var c_oserct_linechartVARYCOLORS=1;var c_oserct_linechartSER=2;var c_oserct_linechartDLBLS=3;var c_oserct_linechartDROPLINES=4;var c_oserct_linechartHILOWLINES=5;var c_oserct_linechartUPDOWNBARS=6;var c_oserct_linechartMARKER=7;var c_oserct_linechartSMOOTH=8;var c_oserct_linechartAXID=9;var c_oserct_linechartEXTLST=10;var c_oserct_area3dchartGROUPING=0;var c_oserct_area3dchartVARYCOLORS=1;var c_oserct_area3dchartSER=2;var c_oserct_area3dchartDLBLS=3;var c_oserct_area3dchartDROPLINES= 4;var c_oserct_area3dchartGAPDEPTH=5;var c_oserct_area3dchartAXID=6;var c_oserct_area3dchartEXTLST=7;var c_oserct_areaserIDX=0;var c_oserct_areaserORDER=1;var c_oserct_areaserTX=2;var c_oserct_areaserSPPR=3;var c_oserct_areaserPICTUREOPTIONS=4;var c_oserct_areaserDPT=5;var c_oserct_areaserDLBLS=6;var c_oserct_areaserTRENDLINE=7;var c_oserct_areaserERRBARS=8;var c_oserct_areaserCAT=9;var c_oserct_areaserVAL=10;var c_oserct_areaserEXTLST=11;var c_oserct_areachartGROUPING=0;var c_oserct_areachartVARYCOLORS= 1;var c_oserct_areachartSER=2;var c_oserct_areachartDLBLS=3;var c_oserct_areachartDROPLINES=4;var c_oserct_areachartAXID=5;var c_oserct_areachartEXTLST=6;var c_oserct_plotareaLAYOUT=0;var c_oserct_plotareaITEMS=1;var c_oserct_plotareaAREA3DCHART=2;var c_oserct_plotareaAREACHART=3;var c_oserct_plotareaBAR3DCHART=4;var c_oserct_plotareaBARCHART=5;var c_oserct_plotareaBUBBLECHART=6;var c_oserct_plotareaDOUGHNUTCHART=7;var c_oserct_plotareaLINE3DCHART=8;var c_oserct_plotareaLINECHART=9;var c_oserct_plotareaOFPIECHART= 10;var c_oserct_plotareaPIE3DCHART=11;var c_oserct_plotareaPIECHART=12;var c_oserct_plotareaRADARCHART=13;var c_oserct_plotareaSCATTERCHART=14;var c_oserct_plotareaSTOCKCHART=15;var c_oserct_plotareaSURFACE3DCHART=16;var c_oserct_plotareaSURFACECHART=17;var c_oserct_plotareaITEMS1=18;var c_oserct_plotareaCATAX=19;var c_oserct_plotareaDATEAX=20;var c_oserct_plotareaSERAX=21;var c_oserct_plotareaVALAX=22;var c_oserct_plotareaDTABLE=23;var c_oserct_plotareaSPPR=24;var c_oserct_plotareaEXTLST=25;var c_oserct_thicknessVAL= 0;var c_oserct_surfaceTHICKNESS=0;var c_oserct_surfaceSPPR=1;var c_oserct_surfacePICTUREOPTIONS=2;var c_oserct_surfaceEXTLST=3;var c_oserct_perspectiveVAL=0;var c_oserct_depthpercentVAL=0;var c_oserct_rotyVAL=0;var c_oserct_hpercentVAL=0;var c_oserct_rotxVAL=0;var c_oserct_view3dROTX=0;var c_oserct_view3dHPERCENT=1;var c_oserct_view3dROTY=2;var c_oserct_view3dDEPTHPERCENT=3;var c_oserct_view3dRANGAX=4;var c_oserct_view3dPERSPECTIVE=5;var c_oserct_view3dEXTLST=6;var c_oserct_pivotfmtIDX=0;var c_oserct_pivotfmtSPPR= 1;var c_oserct_pivotfmtTXPR=2;var c_oserct_pivotfmtMARKER=3;var c_oserct_pivotfmtDLBL=4;var c_oserct_pivotfmtEXTLST=5;var c_oserct_pivotfmtsPIVOTFMT=0;var c_oserct_chartTITLE=0;var c_oserct_chartAUTOTITLEDELETED=1;var c_oserct_chartPIVOTFMTS=2;var c_oserct_chartVIEW3D=3;var c_oserct_chartFLOOR=4;var c_oserct_chartSIDEWALL=5;var c_oserct_chartBACKWALL=6;var c_oserct_chartPLOTAREA=7;var c_oserct_chartLEGEND=8;var c_oserct_chartPLOTVISONLY=9;var c_oserct_chartDISPBLANKSAS=10;var c_oserct_chartSHOWDLBLSOVERMAX= 11;var c_oserct_chartEXTLST=12;var c_oserct_protectionCHARTOBJECT=0;var c_oserct_protectionDATA=1;var c_oserct_protectionFORMATTING=2;var c_oserct_protectionSELECTION=3;var c_oserct_protectionUSERINTERFACE=4;var c_oserct_pivotsourceNAME=0;var c_oserct_pivotsourceFMTID=1;var c_oserct_pivotsourceEXTLST=2;var c_oserct_style1VAL=0;var c_oserct_styleVAL=0;var c_oserct_textlanguageidVAL=0;var c_oseralternatecontentCHOICE=0;var c_oseralternatecontentFALLBACK=1;var c_oseralternatecontentchoiceSTYLE=0;var c_oseralternatecontentchoiceREQUIRES= 1;var c_oseralternatecontentfallbackSTYLE=0;var c_oserct_chartstyleID=0;var c_oserct_chartstyleENTRY=1;var c_oserct_chartstyleMARKERLAYOUT=2;var c_oserct_chartstyleENTRYTYPE=0;var c_oserct_chartstyleLNREF=1;var c_oserct_chartstyleFILLREF=2;var c_oserct_chartstyleEFFECTREF=3;var c_oserct_chartstyleFONTREF=4;var c_oserct_chartstyleDEFPR=5;var c_oserct_chartstyleBODYPR=6;var c_oserct_chartstyleSPPR=7;var c_oserct_chartstyleLINEWIDTH=8;var c_oserct_chartstyleMARKERSYMBOL=0;var c_oserct_chartstyleMARKERSIZE= 1;var c_oserct_chartcolorsID=0;var c_oserct_chartcolorsMETH=1;var c_oserct_chartcolorsVARIATION=2;var c_oserct_chartcolorsCOLOR=3;var c_oserct_chartcolorsEFFECT=4;var SIZE_REPRESENTS_AREA=0;var SIZE_REPRESENTS_W=1;var ERR_BAR_TYPE_BOTH=0;var ERR_BAR_TYPE_MINUS=1;var ERR_BAR_TYPE_PLUS=2;var ERR_DIR_X=0;var ERR_DIR_Y=1;var ERR_VAL_TYPE_CUST=0;var ERR_VAL_TYPE_FIXED_VAL=1;var ERR_VAL_TYPE_PERCENTAGE=2;var ERR_VAL_TYPE_STD_DEV=3;var ERR_VAL_TYPE_STD_ERR=4;var LAYOUT_TARGET_INNER=0;var LAYOUT_TARGET_OUTER= 1;var LAYOUT_MODE_EDGE=0;var LAYOUT_MODE_FACTOR=1;var OF_PIE_TYPE_BAR=0;var OF_PIE_TYPE_PIE=1;var SPLIT_TYPE_AUTO=0;var SPLIT_TYPE_CUST=1;var SPLIT_TYPE_PERCENT=2;var SPLIT_TYPE_POS=3;var SPLIT_TYPE_VAL=4;var PICTURE_FORMAT_STACK=0;var PICTURE_FORMAT_STACK_SCALE=1;var PICTURE_FORMAT_STACK_STRETCH=2;var RADAR_STYLE_STANDARD=0;var RADAR_STYLE_MARKER=1;var RADAR_STYLE_FILLED=2;var TRENDLINE_TYPE_EXP=0;var TRENDLINE_TYPE_LINEAR=1;var TRENDLINE_TYPE_LOG=2;var TRENDLINE_TYPE_MOVING_AVG=3;var TRENDLINE_TYPE_POLY= 4;var TRENDLINE_TYPE_POWER=5;function BinaryChartWriter(memory){this.memory=memory;this.bs=new AscCommon.BinaryCommonWriter(this.memory)}BinaryChartWriter.prototype.WriteCT_extLst=function(oVal){var oThis=this;if(null!=oVal.m_ext)for(var i=0,length=oVal.m_ext.length;i0)this.bs.WriteItem(c_oserct_chartspaceUSERSHAPES,function(){oThis.WriteCT_UserShapes(oVal.userShapes)});if(null!=oVal.themeOverride)this.bs.WriteItem(c_oserct_chartspaceTHEMEOVERRIDE,function(){AscCommon.pptx_content_writer.WriteTheme(oThis.memory,oVal.themeOverride)});if(null!=oVal.chartStyle)this.bs.WriteItem(c_oserct_chartspaceSTYLES,function(){oThis.WriteCT_ChartStyle(oVal.chartStyle)}); if(null!=oVal.chartColors)this.bs.WriteItem(c_oserct_chartspaceCOLORS,function(){oThis.WriteCT_ChartColors(oVal.chartColors)})};BinaryChartWriter.prototype.WriteCT_FromTo=function(oVal){this.memory.WriteByte(Asc.c_oSer_DrawingPosType.X);this.memory.WriteByte(AscCommon.c_oSerPropLenType.Double);this.memory.WriteDouble2(oVal.x);this.memory.WriteByte(Asc.c_oSer_DrawingPosType.Y);this.memory.WriteByte(AscCommon.c_oSerPropLenType.Double);this.memory.WriteDouble2(oVal.y)};BinaryChartWriter.prototype.WriteCT_UserShape= function(oVal){var oThis=this;var res=c_oSerConstants.ReadOk;if(AscFormat.isRealNumber(oVal.fromX)&&AscFormat.isRealNumber(oVal.fromY)){var oNewVal={x:oVal.fromX,y:oVal.fromY};this.bs.WriteItem(Asc.c_oSer_DrawingType.From,function(){oThis.WriteCT_FromTo(oNewVal)})}if(AscFormat.isRealNumber(oVal.toX)&&AscFormat.isRealNumber(oVal.toY)){var oNewVal={x:oVal.toX,y:oVal.toY};var type=oVal.getObjectType()===AscDFH.historyitem_type_AbsSizeAnchor?Asc.c_oSer_DrawingType.Ext:Asc.c_oSer_DrawingType.To;this.bs.WriteItem(type, function(){oThis.WriteCT_FromTo(oNewVal)})}this.bs.WriteItem(Asc.c_oSer_DrawingType.pptxDrawing,function(){pptx_content_writer.WriteDrawing(oThis.memory,oVal.object,null,null,null)})};BinaryChartWriter.prototype.WriteCT_UserShapes=function(oVal){var oThis=this;this.bs.WriteItem(c_oserct_usershapes_COUNT,function(){oThis.memory.WriteLong(oVal.length)});for(var i=0;i0)this.bs.WriteItem(c_oserct_surface3dchartBANDFMTS,function(){oThis.WriteCT_bandFmts(oVal.bandFmts)});if(null!=oVal.axId)for(var i=0,length=oVal.axId.length;i0)this.bs.WriteItem(c_oserct_surfacechartBANDFMTS,function(){oThis.WriteCT_bandFmts(oVal.bandFmts)});if(null!=oVal.axId)for(var i= 0,length=oVal.axId.length;i0)this.bs.WriteItem(c_oserct_ofpiechartCUSTSPLIT, function(){oThis.WriteCT_custSplit(oVal.custSplit)});if(null!=oVal.secondPieSize)this.bs.WriteItem(c_oserct_ofpiechartSECONDPIESIZE,function(){oThis.WriteCT_SecondPieSize(oVal.secondPieSize)});if(null!=oVal.serLines)this.bs.WriteItem(c_oserct_ofpiechartSERLINES,function(){oThis.WriteCT_ChartLines(oVal.serLines)})};BinaryChartWriter.prototype.WriteCT_PieSer=function(oVal){var oThis=this;if(null!=oVal.idx)this.bs.WriteItem(c_oserct_pieserIDX,function(){oThis.WriteCT_UnsignedInt(oVal.idx)});if(null!= oVal.order)this.bs.WriteItem(c_oserct_pieserORDER,function(){oThis.WriteCT_UnsignedInt(oVal.order)});if(null!=oVal.tx&&oVal.tx.isValid&&oVal.tx.isValid())this.bs.WriteItem(c_oserct_pieserTX,function(){oThis.WriteCT_SerTx(oVal.tx)});if(null!=oVal.spPr)this.bs.WriteItem(c_oserct_pieserSPPR,function(){oThis.WriteSpPr(oVal.spPr)});if(null!=oVal.explosion)this.bs.WriteItem(c_oserct_pieserEXPLOSION,function(){oThis.WriteCT_UnsignedInt(oVal.explosion)});if(null!=oVal.dPt)for(var i=0,length=oVal.dPt.length;i< length;++i){var oCurVal=oVal.dPt[i];if(null!=oCurVal)this.bs.WriteItem(c_oserct_pieserDPT,function(){oThis.WriteCT_DPt(oCurVal)})}if(null!=oVal.dLbls)this.bs.WriteItem(c_oserct_pieserDLBLS,function(){oThis.WriteCT_DLbls(oVal.dLbls)});if(null!=oVal.cat&&oVal.cat.isValid&&oVal.cat.isValid())this.bs.WriteItem(c_oserct_pieserCAT,function(){oThis.WriteCT_AxDataSource(oVal.cat)});if(null!=oVal.val&&oVal.val.isValid&&oVal.val.isValid())this.bs.WriteItem(c_oserct_pieserVAL,function(){oThis.WriteCT_NumDataSource(oVal.val)})}; BinaryChartWriter.prototype.WriteCT_GapAmount=function(oVal){var oThis=this;if(null!=oVal)this.bs.WriteItem(c_oserct_gapamountVAL,function(){oThis.memory.WriteString3(oThis.percentToString(oVal,true,false))})};BinaryChartWriter.prototype.WriteCT_Bar3DChart=function(oVal){var oThis=this;if(null!=oVal.barDir)this.bs.WriteItem(c_oserct_bar3dchartBARDIR,function(){oThis.WriteCT_BarDir(oVal.barDir)});if(null!=oVal.grouping)this.bs.WriteItem(c_oserct_bar3dchartGROUPING,function(){oThis.WriteCT_BarGrouping(oVal.grouping)}); if(null!=oVal.varyColors)this.bs.WriteItem(c_oserct_bar3dchartVARYCOLORS,function(){oThis.WriteCT_Boolean(oVal.varyColors)});if(null!=oVal.series)for(var i=0,length=oVal.series.length;i0)this.bs.WriteItem(c_oserct_chartPIVOTFMTS,function(){oThis.WriteCT_pivotFmts(oVal.pivotFmts)});if(null!=oVal.view3D)this.bs.WriteItem(c_oserct_chartVIEW3D, function(){oThis.WriteCT_View3D(oVal.view3D)});if(null!=oVal.floor)this.bs.WriteItem(c_oserct_chartFLOOR,function(){oThis.WriteCT_Surface(oVal.floor)});if(null!=oVal.sideWall)this.bs.WriteItem(c_oserct_chartSIDEWALL,function(){oThis.WriteCT_Surface(oVal.sideWall)});if(null!=oVal.backWall)this.bs.WriteItem(c_oserct_chartBACKWALL,function(){oThis.WriteCT_Surface(oVal.backWall)});if(null!=oVal.plotArea)this.bs.WriteItem(c_oserct_chartPLOTAREA,function(){oThis.WriteCT_PlotArea(oVal.plotArea,oVal)});if(null!= oVal.legend)this.bs.WriteItem(c_oserct_chartLEGEND,function(){oThis.WriteCT_Legend(oVal.legend)});if(null!=oVal.plotVisOnly)this.bs.WriteItem(c_oserct_chartPLOTVISONLY,function(){oThis.WriteCT_Boolean(oVal.plotVisOnly)});if(null!=oVal.dispBlanksAs)this.bs.WriteItem(c_oserct_chartDISPBLANKSAS,function(){oThis.WriteCT_DispBlanksAs(oVal.dispBlanksAs)});if(null!=oVal.showDLblsOverMax)this.bs.WriteItem(c_oserct_chartSHOWDLBLSOVERMAX,function(){oThis.WriteCT_Boolean(oVal.showDLblsOverMax)})};BinaryChartWriter.prototype.WriteCT_Protection= function(oVal){var oThis=this;if(null!=oVal.chartObject)this.bs.WriteItem(c_oserct_protectionCHARTOBJECT,function(){oThis.WriteCT_Boolean(oVal.chartObject)});if(null!=oVal.data)this.bs.WriteItem(c_oserct_protectionDATA,function(){oThis.WriteCT_Boolean(oVal.data)});if(null!=oVal.formatting)this.bs.WriteItem(c_oserct_protectionFORMATTING,function(){oThis.WriteCT_Boolean(oVal.formatting)});if(null!=oVal.selection)this.bs.WriteItem(c_oserct_protectionSELECTION,function(){oThis.WriteCT_Boolean(oVal.selection)}); if(null!=oVal.userInterface)this.bs.WriteItem(c_oserct_protectionUSERINTERFACE,function(){oThis.WriteCT_Boolean(oVal.userInterface)})};BinaryChartWriter.prototype.WriteCT_PivotSource=function(oVal){var oThis=this;if(null!=oVal.name)this.bs.WriteItem(c_oserct_pivotsourceNAME,function(){oThis.memory.WriteString3(oVal.name)});if(null!=oVal.fmtId)this.bs.WriteItem(c_oserct_pivotsourceFMTID,function(){oThis.WriteCT_UnsignedInt(oVal.fmtId)})};BinaryChartWriter.prototype.WriteCT_Style1=function(oVal){var oThis= this;if(null!=oVal)this.bs.WriteItem(c_oserct_style1VAL,function(){oThis.memory.WriteByte(oVal)})};BinaryChartWriter.prototype.WriteCT_Style=function(oVal){var oThis=this;if(null!=oVal)this.bs.WriteItem(c_oserct_styleVAL,function(){oThis.memory.WriteByte(oVal)})};BinaryChartWriter.prototype.WriteCT_TextLanguageID=function(oVal){var oThis=this;if(null!=oVal)this.bs.WriteItem(c_oserct_textlanguageidVAL,function(){oThis.memory.WriteString3(oVal)})};BinaryChartWriter.prototype.WriteAlternateContent=function(oVal){var oThis= this;if(null!=oVal.m_Choice)for(var i=0,length=oVal.m_Choice.length;i0){var choice=oNewVal.m_Choice[0];if(null!=choice.m_style&&null!=choice.m_style.m_val)nNewStyle=choice.m_style.m_val-100}if(null==nNewStyle&&null!=oNewVal.m_Fallback&&null!=oNewVal.m_Fallback.m_style&&null!=oNewVal.m_Fallback.m_style.m_val)nNewStyle=oNewVal.m_Fallback.m_style.m_val;if(null!=nNewStyle)val.setStyle(nNewStyle)}else if(c_oserct_chartspaceSTYLE===type){oNewVal={m_val:null};res=this.bcr.Read1(length,function(t,l){return oThis.ReadCT_Style1(t,l, oNewVal)});if(null!=oNewVal.m_val)val.setStyle(oNewVal.m_val)}else if(c_oserct_chartspaceCLRMAPOVR===type)val.setClrMapOvr(this.ReadClrOverride(length));else if(c_oserct_chartspacePIVOTSOURCE===type){oNewVal=new AscFormat.CPivotSource;res=this.bcr.Read1(length,function(t,l){return oThis.ReadCT_PivotSource(t,l,oNewVal)});val.setPivotSource(oNewVal)}else if(c_oserct_chartspacePROTECTION===type){oNewVal=new AscFormat.CProtection;res=this.bcr.Read1(length,function(t,l){return oThis.ReadCT_Protection(t, l,oNewVal)});val.setProtection(oNewVal)}else if(c_oserct_chartspaceCHART===type){oNewVal=new AscFormat.CChart;res=this.bcr.Read1(length,function(t,l){return oThis.ReadCT_Chart(t,l,oNewVal)});val.setChart(oNewVal);if(null===oNewVal.showDLblsOverMax)oNewVal.setShowDLblsOverMax(false)}else if(c_oserct_chartspaceSPPR===type){val.setSpPr(this.ReadSpPr(length));val.spPr.setParent(val)}else if(c_oserct_chartspaceTXPR===type){val.setTxPr(this.ReadTxPr(length));val.txPr.setParent(val)}else if(c_oserct_chartspacePRINTSETTINGS=== type){oNewVal=new AscFormat.CPrintSettings;res=this.bcr.Read1(length,function(t,l){return oThis.ReadCT_PrintSettings(t,l,oNewVal)});val.setPrintSettings(oNewVal)}else if(c_oserct_chartspaceUSERSHAPES===type)res=this.bcr.Read1(length,function(t,l){return oThis.ReadCT_UserShapes(t,l,val)});else if(c_oserct_chartspaceEXTLST===type){oNewVal={};res=this.bcr.Read1(length,function(t,l){return oThis.ReadCT_extLst(t,l,oNewVal)})}else if(c_oserct_chartspaceTHEMEOVERRIDE===type){var theme=AscCommon.pptx_content_loader.ReadTheme(this, this.stream);if(null!=theme)val.setThemeOverride(theme)}else if(c_oserct_chartspaceXLSX===type)res=c_oSerConstants.ReadUnknown;else if(c_oserct_chartspaceSTYLES===type){this.curChart.oChartStyleData=AscCommon.fSaveStream(this.bcr.stream,length);oNewVal=new AscFormat.CChartStyle;res=this.bcr.Read1(length,function(t,l){return oThis.ReadCT_ChartStyle(t,l,oNewVal)});if(oNewVal)val.setChartStyle(oNewVal)}else if(c_oserct_chartspaceCOLORS===type){this.curChart.oChartColorsData=AscCommon.fSaveStream(this.bcr.stream, length);oNewVal=new AscFormat.CChartColors;res=this.bcr.Read1(length,function(t,l){return oThis.ReadCT_ChartColors(t,l,oNewVal)});if(oNewVal)val.setChartColors(oNewVal)}else res=c_oSerConstants.ReadUnknown;return res};BinaryChartReader.prototype.ReadSpPr=function(length){return AscCommon.pptx_content_loader.ReadShapeProperty(this.stream)};BinaryChartReader.prototype.ReadClrOverride=function(lenght){var loader=new AscCommon.BinaryPPTYLoader;loader.stream=new AscCommon.FileStream;loader.stream.obj= this.stream.obj;loader.stream.data=this.stream.data;loader.stream.size=this.stream.size;loader.stream.pos=this.stream.pos;loader.stream.cur=this.stream.cur;var s=loader.stream;var _main_type=s.GetUChar();var clr_map=new AscFormat.ClrMap;loader.ReadClrMap(clr_map);this.stream.pos=s.pos;this.stream.cur=s.cur;return clr_map};BinaryChartReader.prototype.ReadTxPr=function(length){var cur=this.stream.cur;var ret=AscCommon.pptx_content_loader.ReadTextBody(null,this.stream,null,this.curWorksheet,this.drawingDocument); this.stream.cur=cur+length;return ret};BinaryChartReader.prototype.ParsePersent=function(val){var nVal=parseFloat(val);if(!isNaN(nVal))return nVal;else return null};BinaryChartReader.prototype.ParseMetric=function(val){var nVal=parseFloat(val);var nRes=null;if(!isNaN(nVal))if(-1!=val.indexOf("mm"))nRes=nVal;else if(-1!=val.indexOf("cm"))nRes=nVal*10;else if(-1!=val.indexOf("in"))nRes=nVal*2.54*10;else if(-1!=val.indexOf("pt"))nRes=nVal*2.54*10/72;else if(-1!=val.indexOf("pc")||-1!=val.indexOf("pi"))nRes= nVal*12*2.54*10/72;return nRes};BinaryChartReader.prototype.ConvertSurfaceToLine=function(oSurface,aChartWithAxis){var oLine=new AscFormat.CLineChart;oLine.setGrouping(AscFormat.GROUPING_STANDARD);oLine.setVaryColors(false);for(var i=0,length=oSurface.series.length;i-1;--_i){var oChart=oNewVal.charts[_i];if(oChart){if(oChart.getObjectType()!==AscDFH.historyitem_type_ScatterChart&&oChart.getObjectType()!==AscDFH.historyitem_type_PieChart&&oChart.getObjectType()!==AscDFH.historyitem_type_DoughnutChart){var axis_by_types=oChart.getAxisByTypes();if(axis_by_types.valAx.length=== 0||axis_by_types.catAx.length===0){oNewVal.removeCharts(_i,_i);if(oChart.axId){oChart.axId.length=0;oChart=oChart.createDuplicate();if(oChart.setParent)oChart.setParent(oNewVal)}var sDefaultValAxFormatCode=null;if(oChart&&oChart.series[0]){var aPoints=oChart.series[0].getNumPts();if(aPoints[0]&&typeof aPoints[0].formatCode==="string"&&aPoints[0].formatCode.length>0)sDefaultValAxFormatCode=aPoints[0].formatCode}var need_num_fmt=sDefaultValAxFormatCode;var axis_obj=AscFormat.CreateDefaultAxes(need_num_fmt? need_num_fmt:"General");var cat_ax=axis_obj.catAx;var val_ax=axis_obj.valAx;if(oChart.getObjectType()===AscDFH.historyitem_type_BarChart&&oChart.barDir===AscFormat.BAR_DIR_BAR){if(cat_ax.axPos!==AscFormat.AX_POS_L)cat_ax.setAxPos(AscFormat.AX_POS_L);if(val_ax.axPos!==AscFormat.AX_POS_B)val_ax.setAxPos(AscFormat.AX_POS_B)}else{if(cat_ax.axPos!==AscFormat.AX_POS_B)cat_ax.setAxPos(AscFormat.AX_POS_B);if(val_ax.axPos!==AscFormat.AX_POS_L)val_ax.setAxPos(AscFormat.AX_POS_L)}oNewVal.addChart(oChart);oChart.addAxId(cat_ax); oChart.addAxId(val_ax);oNewVal.addAxis(cat_ax);oNewVal.addAxis(val_ax)}else if(oChart.getObjectType()===AscDFH.historyitem_type_BarChart&&oChart.barDir===AscFormat.BAR_DIR_BAR){for(var _c=0;_c=charA&&ch<=charZ)return ch-charA+0;if(ch>=chara&&ch<=charz)return ch-chara+26;if(ch>=char0&&ch<=char9)return ch-char0+52;if(ch==charp)return 62; if(ch==chars)return 63;return-1}var b64_decode=[];(function(){var i;for(i=charA;i<=charZ;i++)b64_decode[i]=i-charA+0;for(i=chara;i<=charz;i++)b64_decode[i]=i-chara+26;for(i=char0;i<=char9;i++)b64_decode[i]=i-char0+52})();b64_decode[charp]=62;b64_decode[chars]=63;function CreateFontData2(szSrc,dstLen){var srcLen=szSrc.length;var nWritten=0;if(dstLen===undefined)dstLen=srcLen;var stream=new AscFonts.FontStream(AscFonts.allocate(dstLen),dstLen);var dstPx=stream.data;var index=0;if(window.chrome)while(index< srcLen){var dwCurr=0;var i;var nBits=0;for(i=0;i<4;i++){if(index>=srcLen)break;var nCh=DecodeBase64Char(szSrc.charCodeAt(index++));if(nCh==-1){i--;continue}dwCurr<<=6;dwCurr|=nCh;nBits+=6}dwCurr<<=24-nBits;for(i=0;i>>16;dwCurr<<=8}}else{var p=b64_decode;while(index=srcLen)break;var nCh=p[szSrc.charCodeAt(index++)];if(nCh==undefined){i--;continue}dwCurr<<=6;dwCurr|=nCh;nBits+=6}dwCurr<<= 24-nBits;for(i=0;i>>16;dwCurr<<=8}}}return stream}function CreateFontData3(szSrc){var srcLen=szSrc.length;var stream=new AscFonts.FontStream(AscFonts.allocate(srcLen),srcLen);var dstPx=stream.data;var index=0;while(index=srcLen)break;var nCh=DecodeBase64Char(szSrc.charCodeAt(index++));if(nCh==-1){i--;continue}dwCurr<<=6;dwCurr|=nCh;nBits+=6}dwCurr<<=24-nBits;for(i=0;i>>16;dwCurr<<= 8}}else{var p=b64_decode;while(index=srcLen)break;var nCh=p[szSrc.charCodeAt(index++)];if(nCh==undefined){i--;continue}dwCurr<<=6;dwCurr|=nCh;nBits+=6}dwCurr<<=24-nBits;for(i=0;i>>16;dwCurr<<=8}}}return stream}var FD_UNKNOWN_CHARSET=3;function FD_FontInfo(){this.Name="";this.IndexR=-1;this.IndexI=-1;this.IndexB=-1;this.IndexBI=-1}function FD_FontDictionary(){this.FONTS_DICT_ASCII_NAMES_COUNT= 0;this.FD_Ascii_Names=[];this.FD_Ascii_Names_Offsets=null;if(typeof Int32Array!="undefined"&&!window.opera)this.FD_Ascii_Names_Offsets=new Int32Array(256);else this.FD_Ascii_Names_Offsets=new Array(256);for(var i=0;i<256;i++)this.FD_Ascii_Names_Offsets[i]=-1;this.FONTS_DICT_UNICODE_NAMES_COUNT=0;this.FD_Unicode_Names=[];this.FONTS_DICT_ASCII_FONTS_COUNT=0;this.FD_Ascii_Files=[];this.FD_Ascii_Font_Like_Names=[["Cambria Math","Asana Math","XITS Math","Latin Modern"],["OpenSymbol"],["Arial","Liberation Sans", "Helvetica","Nimbus Sans L"],["Times New Roman","Liberation Serif"],["Courier New","Liberation Mono"],["Segoe","Segoe UI"],["Cambria","Caladea"]];this.FD_Ascii_Font_Like_Main={"Cambria Math":0,"Asana Math":0,"XITS Math":0,"Latin Modern":0,"Symbol":1,"Wingdings":1,"Arial":2,"Liberation Sans":2,"Helvetica":2,"Nimbus Sans L":2,"Times New Roman":3,"Liberation Serif":3,"Courier New":4,"Liberation Mono":4,"Segoe":5,"Segoe UI":5,"Cambria":6,"Caladea":6};this.ChangeGlyphsMap={"Symbol":{Name:"OpenSymbol", IsSymbolSrc:true,MapSrc:[183,168],MapDst:[57644,58434]},"Wingdings":{Name:"OpenSymbol",IsSymbolSrc:true,MapSrc:[118,119,216,167,252,113],MapDst:[58433,58434,57951,58479,58160,10065]}};this.MainUnicodeRanges={48:3E3,49:3E3,50:3E3,55:3E3,59:3E3,28:3E3,13:3E3,63:3E3,67:3E3}}FD_FontDictionary.prototype={Init:function(){var _base64_data="qwEAAA0AAABBR0EgQXJhYmVzcXVlGAAAAP///////////////xUAAABBR0EgQXJhYmVzcXVlIERlc2t0b3AbAAAA////////////////CQAAAEFnZW5jeSBGQgEAAAD/////AAAAAP////8HAAAAQWhhcm9uaf//////////AwAAAP////8JAAAAQWtoYmFyIE1U/////wQAAAD/////BQAAAAcAAABBbGRoYWJpBgAAAP///////////////wgAAABBbGdlcmlhbgcAAAD///////////////8FAAAAQW1pIFJZAQAA////////////////BwAAAEFuZGFsdXMIAAAA////////////////CwAAAEFuZ3NhbmEgTmV3CQAAAAsAAAAKAAAAEAAAAAoAAABBbmdzYW5hVVBDDAAAAA4AAAANAAAADwAAAAkAAABBcGFyYWppdGEUAAAAFwAAABUAAAAWAAAAEgAAAEFyYWJpYyBUcmFuc3BhcmVudCgAAAD/////JwAAAP////8SAAAAQXJhYmljIFR5cGVzZXR0aW5nGQAAAP///////////////wUAAABBcmlhbBwAAAAfAAAAHQAAAB4AAAALAAAAQXJpYWwgQmxhY2slAAAA////////////////DAAAAEFyaWFsIE5hcnJvdyAAAAAjAAAAIQAAACIAAAAVAAAAQXJpYWwgUm91bmRlZCBNVCBCb2xkJgAAAP///////////////xAAAABBcmlhbCBVbmljb2RlIE1TJAAAAP///////////////wQAAABBcnZvLAAAACsAAAApAAAAKgAAAAgAAABBc3Rvbi1GMS0AAAD///////////////8UAAAAQmFza2VydmlsbGUgT2xkIEZhY2UuAAAA////////////////BgAAAEJhdGFuZy8AAAD///////////////8JAAAAQmF0YW5nQ2hlMAAAAP///////////////woAAABCYXVoYXVzIDkzMwAAAP///////////////wcAAABCZWxsIE1UNAAAADYAAAA1AAAA/////w4AAABCZXJsaW4gU2FucyBGQk4AAAD/////TAAAAP////8TAAAAQmVybGluIFNhbnMgRkIgRGVtaf//////////TQAAAP////8UAAAAQmVybmFyZCBNVCBDb25kZW5zZWQ3AAAA////////////////EgAAAEJpY2toYW0gU2NyaXB0IFByb///////////OAAAAP////8aAAAAQmlja2hhbSBTY3JpcHQgUHJvIFJlZ3VsYXL//////////zgAAAD/////DgAAAEJsYWNrYWRkZXIgSVRDYwEAAP///////////////wkAAABCb2RvbmkgTVRFAAAAQwAAADsAAAA8AAAADwAAAEJvZG9uaSBNVCBCbGFjaz4AAAA9AAAA//////////8TAAAAQm9kb25pIE1UIENvbmRlbnNlZEIAAABBAAAAPwAAAEAAAAAbAAAAQm9kb25pIE1UIFBvc3RlciBDb21wcmVzc2VkRAAAAP///////////////w8AAABCb2xkIEl0YWxpYyBBcnQ6AAAA////////////////DAAAAEJvb2sgQW50aXF1YTkAAAATAAAAEQAAABIAAAARAAAAQm9va21hbiBPbGQgU3R5bGVGAAAASQAAAEcAAABIAAAAEgAAAEJvb2tzaGVsZiBTeW1ib2wgN1kAAAD///////////////8QAAAAQnJhZGxleSBIYW5kIElUQ0oAAAD///////////////8OAAAAQnJpdGFubmljIEJvbGRLAAAA////////////////CAAAAEJyb2Fkd2F5TwAAAP///////////////w0AAABCcm93YWxsaWEgTmV3UAAAAFIAAABRAAAAVwAAAAwAAABCcm93YWxsaWFVUENTAAAAVQAAAFQAAABWAAAADwAAAEJydXNoIFNjcmlwdCBNVP////9YAAAA//////////8HAAAAQ2FsaWJyaVoAAABcAAAAWwAAAF8AAAANAAAAQ2FsaWJyaSBMaWdodF0AAABeAAAA//////////8UAAAAQ2FsaWJyaSBMaWdodCBJdGFsaWP/////XgAAAP//////////DgAAAENhbGlmb3JuaWFuIEZCYgAAAGEAAABgAAAA/////woAAABDYWxpc3RvIE1UYwAAAGYAAABkAAAAZQAAAAcAAABDYW1icmlhZwAAAGoAAABpAAAAawAAAAwAAABDYW1icmlhIE1hdGhoAAAA////////////////BwAAAENhbmRhcmFsAAAAbgAAAG0AAABvAAAACQAAAENhc3RlbGxhcnAAAAD///////////////8HAAAAQ2VudGF1cnIAAAD///////////////8HAAAAQ2VudHVyeXMAAAD///////////////8OAAAAQ2VudHVyeSBHb3RoaWMYAQAAGwEAABkBAAAaAQAAEgAAAENlbnR1cnkgU2Nob29sYm9va3EAAAAmAgAAJAIAACUCAAAHAAAAQ2hpbGxlcnQAAAD///////////////8KAAAAQ29sb25uYSBNVHUAAAD///////////////8NAAAAQ29taWMgU2FucyBNU3YAAAB4AAAAdwAAAHkAAAAIAAAAQ29uc29sYXN6AAAAfAAAAHsAAAB9AAAACgAAAENvbnN0YW50aWF+AAAAgAAAAH8AAACBAAAADAAAAENvb3BlciBCbGFja4IAAAD///////////////8XAAAAQ29wcGVycGxhdGUgR290aGljIEJvbGSDAAAA////////////////GAAAAENvcHBlcnBsYXRlIEdvdGhpYyBMaWdodIQAAAD///////////////8GAAAAQ29yYmVshQAAAIcAAACGAAAAiAAAAAoAAABDb3JkaWEgTmV3iQAAAIsAAACKAAAAkAAAAAkAAABDb3JkaWFVUEOMAAAAjgAAAI0AAACPAAAACwAAAENvdXJpZXIgTmV3kQAAAJQAAACSAAAAkwAAAAYAAABDdXBydW2YAAAAlwAAAJUAAACWAAAACAAAAEN1cmx6IE1UmQAAAP///////////////wgAAABERkthaS1TQmkBAAD///////////////8OAAAARGFuY2luZyBTY3JpcHSbAAAA/////5oAAAD/////CAAAAERhdW5QZW5onAAAAP///////////////wUAAABEYXZpZJ0AAAD/////ngAAAP////8RAAAARGF2aWQgVHJhbnNwYXJlbnSfAAAA////////////////DgAAAERlY29UeXBlIE5hc2towwAAAP///////////////xkAAABEZWNvVHlwZSBOYXNraCBFeHRlbnNpb25zxgAAAP///////////////xYAAABEZWNvVHlwZSBOYXNraCBTcGVjaWFsxAAAAP///////////////xYAAABEZWNvVHlwZSBOYXNraCBTd2FzaGVzxwAAAP///////////////xcAAABEZWNvVHlwZSBOYXNraCBWYXJpYW50c8UAAAD///////////////8QAAAARGVjb1R5cGUgVGh1bHV0aMIAAAD///////////////8LAAAARGVqYVZ1IFNhbnOgAAAArAAAAKEAAACiAAAAFQAAAERlamFWdSBTYW5zIENvbmRlbnNlZKYAAAClAAAAowAAAKQAAAARAAAARGVqYVZ1IFNhbnMgTGlnaHSnAAAA////////////////EAAAAERlamFWdSBTYW5zIE1vbm+rAAAAqgAAAKgAAACpAAAADAAAAERlamFWdSBTZXJpZq0AAAC0AAAArgAAAK8AAAAWAAAARGVqYVZ1IFNlcmlmIENvbmRlbnNlZLMAAACyAAAAsAAAALEAAAALAAAARGlsbGVuaWFVUEN/AgAAfgIAAHwCAAB9AgAACAAAAERpbmdiYXRztQAAAP///////////////wsAAABEaXdhbmkgQmVudLYAAAD///////////////8NAAAARGl3YW5pIExldHRlcrcAAAD///////////////8VAAAARGl3YW5pIE91dGxpbmUgU2hhZGVkyAAAAP///////////////xUAAABEaXdhbmkgU2ltcGxlIE91dGxpbmXKAAAA////////////////FwAAAERpd2FuaSBTaW1wbGUgT3V0bGluZSAyyQAAAP///////////////xUAAABEaXdhbmkgU2ltcGxlIFN0cmlwZWTLAAAA////////////////CQAAAERva0NoYW1wYbgAAAD///////////////8FAAAARG90dW0iAQAA////////////////CAAAAERvdHVtQ2hlIwEAAP///////////////woAAABEcm9pZCBTYW5zvAAAAP////+7AAAA/////w8AAABEcm9pZCBTYW5zIE1vbm+9AAAA////////////////CwAAAERyb2lkIFNlcmlmwQAAAMAAAAC+AAAAvwAAAAYAAABFYnJpbWHMAAAA/////80AAAD/////FAAAAEVkd2FyZGlhbiBTY3JpcHQgSVRDZAEAAP///////////////wgAAABFbGVwaGFudM4AAADPAAAA//////////8MAAAARW5ncmF2ZXJzIE1U0AAAAP///////////////w0AAABFcmFzIEJvbGQgSVRD0QAAAP///////////////w0AAABFcmFzIERlbWkgSVRD0gAAAP///////////////w4AAABFcmFzIExpZ2h0IElUQ9MAAAD///////////////8PAAAARXJhcyBNZWRpdW0gSVRD1AAAAP///////////////xEAAABFc3RyYW5nZWxvIEVkZXNzYdUAAAD///////////////8LAAAARXVjcm9zaWFVUEODAgAAggIAAIACAACBAgAACAAAAEV1cGhlbWlh1gAAAP///////////////wYAAABFeHBvIE1WAQAA////////////////BwAAAEZaU2h1VGnsAAAA////////////////BwAAAEZaWWFvVGntAAAA////////////////CAAAAEZhbmdTb25nPAIAAP///////////////xEAAABGYXJzaSBTaW1wbGUgQm9sZOkAAAD///////////////8UAAAARmFyc2kgU2ltcGxlIE91dGxpbmXqAAAA////////////////DQAAAEZlbGl4IFRpdGxpbmfXAAAA////////////////GAAAAEZpeGVkIE1pcmlhbSBUcmFuc3BhcmVudMIBAAD///////////////8QAAAARmxlbWlzaFNjcmlwdCBCVNgAAAD///////////////8SAAAARm9vdGxpZ2h0IE1UIExpZ2h06wAAAP///////////////wUAAABGb3J0ZdkAAAD///////////////8KAAAARnJhbmtSdWVobOQAAAD///////////////8UAAAARnJhbmtsaW4gR290aGljIEJvb2vaAAAA2wAAAP//////////FAAAAEZyYW5rbGluIEdvdGhpYyBEZW1p3AAAAN4AAAD//////////xkAAABGcmFua2xpbiBHb3RoaWMgRGVtaSBDb25k3QAAAP///////////////xUAAABGcmFua2xpbiBHb3RoaWMgSGVhdnnfAAAA4AAAAP//////////FgAAAEZyYW5rbGluIEdvdGhpYyBNZWRpdW3hAAAA4wAAAP//////////GwAAAEZyYW5rbGluIEdvdGhpYyBNZWRpdW0gQ29uZOIAAAD///////////////8KAAAARnJlZXNpYVVQQ4cCAACGAgAAhAIAAIUCAAAQAAAARnJlZXN0eWxlIFNjcmlwdOYAAAD///////////////8QAAAARnJlbmNoIFNjcmlwdCBNVOgAAAD///////////////8LAAAAR09TVCB0eXBlIEEWAQAA////////////////CwAAAEdPU1QgdHlwZSBCFwEAAP///////////////wgAAABHYWJyaW9sYe4AAAD///////////////8GAAAAR2FkdWdp7wAAAP/////wAAAA/////wgAAABHYXJhbW9uZPIAAAD0AAAA8wAAAP////8HAAAAR2F1dGFtafUAAAD/////9gAAAP////8NAAAAR2VudGl1bSBCYXNpY/oAAAD5AAAA9wAAAPgAAAASAAAAR2VudGl1bSBCb29rIEJhc2lj/gAAAP0AAAD7AAAA/AAAAAcAAABHZW9yZ2lh/wAAAAEBAAAAAQAAAgEAAAQAAABHaWdpBgEAAP///////////////wwAAABHaWxsIFNhbnMgTVQNAQAACgEAAAgBAAAHAQAAFgAAAEdpbGwgU2FucyBNVCBDb25kZW5zZWQJAQAA////////////////HwAAAEdpbGwgU2FucyBNVCBFeHQgQ29uZGVuc2VkIEJvbGQUAQAA////////////////FAAAAEdpbGwgU2FucyBVbHRyYSBCb2xkDAEAAP///////////////x4AAABHaWxsIFNhbnMgVWx0cmEgQm9sZCBDb25kZW5zZWQLAQAA////////////////BQAAAEdpc2hhDgEAAP////8PAQAA/////x0AAABHbG91Y2VzdGVyIE1UIEV4dHJhIENvbmRlbnNlZBMBAAD///////////////8PAAAAR291ZHkgT2xkIFN0eWxlHAEAAB4BAAAdAQAA/////wsAAABHb3VkeSBTdG91dB8BAAD///////////////8FAAAAR3VsaW0gAQAA////////////////CAAAAEd1bGltQ2hlIQEAAP///////////////wcAAABHdW5nc3VoMQAAAP///////////////woAAABHdW5nc3VoQ2hlMgAAAP///////////////w8AAABHdXR0bWFuIEFoYXJvbmnxAAAA////////////////EAAAAEd1dHRtYW4gRHJvZ29saW66AAAA/////7kAAAD/////DQAAAEd1dHRtYW4gRnJhbmsDAQAA/////+UAAAD/////DQAAAEd1dHRtYW4gRnJuZXfnAAAA////////////////DAAAAEd1dHRtYW4gSGFpbQQBAAD///////////////8WAAAAR3V0dG1hbiBIYWltLUNvbmRlbnNlZAUBAAD///////////////8OAAAAR3V0dG1hbiBIYXR6dml2AgAA/////3UCAAD/////CwAAAEd1dHRtYW4gS2F2EgEAAP////8QAQAA/////xEAAABHdXR0bWFuIEthdi1MaWdodBEBAAD///////////////8NAAAAR3V0dG1hbiBMb2dvMY8BAAD///////////////8PAAAAR3V0dG1hbiBNYW50b3ZhpgEAAP////+kAQAA/////xUAAABHdXR0bWFuIE1hbnRvdmEtRGVjb3KlAQAA////////////////DgAAAEd1dHRtYW4gTWlyeWFtugEAAP////+4AQAA/////w8AAABHdXR0bWFuIE15YW1maXgVAQAA////////////////DQAAAEd1dHRtYW4gUmFzaGkWAgAA/////xcCAAD/////DAAAAEd1dHRtYW4gU3RhbU0CAAD///////////////8NAAAAR3V0dG1hbiBTdGFtMU4CAAD///////////////8NAAAAR3V0dG1hbiBWaWxuYaUCAAD/////pgIAAP////8LAAAAR3V0dG1hbiBZYWQlAQAA////////////////EQAAAEd1dHRtYW4gWWFkLUJydXNoJAEAAP///////////////xEAAABHdXR0bWFuIFlhZC1MaWdodCYBAAD///////////////8PAAAAR3V0dG1hbi1BaGFyb25p//////////8CAAAA/////wwAAABHdXR0bWFuLUFyYW0aAAAA////////////////DwAAAEd1dHRtYW4tQ291ck1pcrkBAAD///////////////8JAAAASEdHb3RoaWNFNwEAAP///////////////wkAAABIR0dvdGhpY006AQAA////////////////CwAAAEhHR3lvc2hvdGFpPQEAAP///////////////w0AAABIR0t5b2thc2hvdGFpQAEAAP///////////////xAAAABIR01hcnVHb3RoaWNNUFJPUwEAAP///////////////wkAAABIR01pbmNob0JDAQAA////////////////CQAAAEhHTWluY2hvRUYBAAD///////////////8KAAAASEdQR290aGljRTgBAAD///////////////8KAAAASEdQR290aGljTTsBAAD///////////////8MAAAASEdQR3lvc2hvdGFpPgEAAP///////////////w4AAABIR1BLeW9rYXNob3RhaUEBAAD///////////////8KAAAASEdQTWluY2hvQkQBAAD///////////////8KAAAASEdQTWluY2hvRUcBAAD///////////////8TAAAASEdQU29laUtha3Vnb3RoaWNVQlABAAD///////////////8RAAAASEdQU29laUtha3Vwb3B0YWlKAQAA////////////////EQAAAEhHUFNvZWlQcmVzZW5jZUVCTQEAAP///////////////woAAABIR1NHb3RoaWNFOQEAAP///////////////woAAABIR1NHb3RoaWNNPAEAAP///////////////wwAAABIR1NHeW9zaG90YWk/AQAA////////////////DgAAAEhHU0t5b2thc2hvdGFpQgEAAP///////////////woAAABIR1NNaW5jaG9CRQEAAP///////////////woAAABIR1NNaW5jaG9FSAEAAP///////////////xMAAABIR1NTb2VpS2FrdWdvdGhpY1VCUQEAAP///////////////xEAAABIR1NTb2VpS2FrdXBvcHRhaUsBAAD///////////////8RAAAASEdTU29laVByZXNlbmNlRUJOAQAA////////////////EQAAAEhHU2Vpa2Fpc2hvdGFpUFJPUgEAAP///////////////xIAAABIR1NvZWlLYWt1Z290aGljVUJPAQAA////////////////EAAAAEhHU29laUtha3Vwb3B0YWlJAQAA////////////////EAAAAEhHU29laVByZXNlbmNlRUJMAQAA////////////////DgAAAEhZR290aGljLUV4dHJhKQEAAP///////////////w8AAABIWUdvdGhpYy1NZWRpdW0qAQAA////////////////EAAAAEhZR3JhcGhpYy1NZWRpdW0nAQAA////////////////DQAAAEhZR3VuZ1NvLUJvbGQoAQAA////////////////EQAAAEhZSGVhZExpbmUtTWVkaXVtKwEAAP///////////////xAAAABIWU15ZW9uZ0pvLUV4dHJhLAEAAP///////////////w4AAABIWVBNb2tHYWstQm9sZC4BAAD///////////////8MAAAASFlQb3N0LUxpZ2h0LwEAAP///////////////w0AAABIWVBvc3QtTWVkaXVtMAEAAP///////////////xMAAABIWVNob3J0U2FtdWwtTWVkaXVtMQEAAP///////////////xQAAABIWVNpbk15ZW9uZ0pvLU1lZGl1bS0BAAD///////////////8QAAAASGFldHRlbnNjaHdlaWxlcjQBAAD///////////////8RAAAASGFuV2FuZ01pbmdNZWRpdW2wAgAA////////////////EwAAAEhhcmxvdyBTb2xpZCBJdGFsaWP/////MgEAAP//////////CgAAAEhhcnJpbmd0b24zAQAA////////////////CgAAAEhlYWRsaW5lIFJbAQAA////////////////DwAAAEhpZ2ggVG93ZXIgVGV4dFwBAABdAQAA//////////8GAAAASW1wYWN0XgEAAP///////////////xEAAABJbXByaW50IE1UIFNoYWRvd18BAAD///////////////8OAAAASW5mb3JtYWwgUm9tYW5gAQAA////////////////BwAAAElyaXNVUEOLAgAAigIAAIgCAACJAgAADAAAAElza29vbGEgUG90YWEBAAD/////YgEAAP////8SAAAASXRhbGljIE91dGxpbmUgQXJ0ZgEAAP///////////////woAAABKYXNtaW5lVVBDjwIAAI4CAACMAgAAjQIAAAgAAABKb2tlcm1hbmcBAAD///////////////8JAAAASnVpY2UgSVRDaAEAAP///////////////wUAAABLYWlUaT4CAAD///////////////8HAAAAS2FsaW5nYWoBAAD/////awEAAP////8HAAAAS2FydGlrYWwBAAD/////bQEAAP////8IAAAAS2htZXIgVUlwAQAA/////3EBAAD/////DAAAAEtvZGNoaWFuZ1VQQ5MCAACSAgAAkAIAAJECAAAGAAAAS29raWxhcgEAAHUBAABzAQAAdAEAAAsAAABLcmlzdGVuIElUQ2UBAAD///////////////8VAAAAS3VmaSBFeHRlbmRlZCBPdXRsaW5lbgEAAP///////////////xMAAABLdWZpIE91dGxpbmUgU2hhZGVkbwEAAP///////////////w8AAABLdW5zdGxlciBTY3JpcHR3AQAA////////////////BgAAAExhbyBVSXgBAAD/////eQEAAP////8FAAAATGF0aGF6AQAA/////3sBAAD/////DwAAAExlZCBJdGFsaWMgRm9udIIBAAD///////////////8KAAAATGVlbGF3YWRlZYMBAAD/////hAEAAP////8KAAAATGV2ZW5pbSBNVJkBAAD/////mgEAAP////8EAAAATGlTdT8CAAD///////////////8HAAAATGlseVVQQ5cCAACWAgAAlAIAAJUCAAAHAAAATG9ic3RlcooBAAD///////////////8LAAAATG9ic3RlciAxLjSKAQAA////////////////CwAAAExvYnN0ZXIgVHdvjgEAAI0BAACLAQAAjAEAAA0AAABMdWNpZGEgQnJpZ2h0fQEAAIABAAB+AQAAfwEAABIAAABMdWNpZGEgQ2FsbGlncmFwaHmBAQAA////////////////DgAAAEx1Y2lkYSBDb25zb2xlmAEAAP///////////////woAAABMdWNpZGEgRmF4hQEAAIgBAACGAQAAhwEAABIAAABMdWNpZGEgSGFuZHdyaXRpbmeJAQAA////////////////CwAAAEx1Y2lkYSBTYW5zkAEAAJMBAACRAQAAkgEAABYAAABMdWNpZGEgU2FucyBUeXBld3JpdGVylAEAAJcBAACVAQAAlgEAABMAAABMdWNpZGEgU2FucyBVbmljb2RlmwEAAP///////////////wkAAABNUyBHb3RoaWPEAQAA////////////////CQAAAE1TIE1pbmNob8sBAAD///////////////8KAAAATVMgT3V0bG9va/MBAAD///////////////8KAAAATVMgUEdvdGhpY8YBAAD///////////////8KAAAATVMgUE1pbmNob8wBAAD///////////////8XAAAATVMgUmVmZXJlbmNlIFNhbnMgU2VyaWYZAgAA////////////////FgAAAE1TIFJlZmVyZW5jZSBTcGVjaWFsdHkaAgAA////////////////DAAAAE1TIFVJIEdvdGhpY8UBAAD///////////////8HAAAATVYgQm9sadcBAAD///////////////8HAAAATWFnaWMgUloBAAD///////////////8HAAAATWFnbmV0b///////////nAEAAP////8LAAAATWFpYW5kcmEgR0SdAQAA////////////////DQAAAE1hbGd1biBHb3RoaWOgAQAA/////6EBAAD/////BgAAAE1hbmdhbKIBAAD/////owEAAP////8HAAAATWFybGV0dKcBAAD///////////////8ZAAAATWF0dXJhIE1UIFNjcmlwdCBDYXBpdGFsc6gBAAD///////////////8GAAAATWVpcnlvqQEAAKoBAACtAQAArgEAAAkAAABNZWlyeW8gVUmrAQAArAEAAK8BAACwAQAAEgAAAE1pY3Jvc29mdCBIaW1hbGF5YVQBAAD///////////////8SAAAATWljcm9zb2Z0IEpoZW5nSGVpxwEAAP/////JAQAA/////xUAAABNaWNyb3NvZnQgSmhlbmdIZWkgVUnIAQAA/////8oBAAD/////FQAAAE1pY3Jvc29mdCBOZXcgVGFpIEx1Zd4BAAD/////3wEAAP////8RAAAATWljcm9zb2Z0IFBoYWdzUGECAgAA/////wMCAAD/////FAAAAE1pY3Jvc29mdCBTYW5zIFNlcmlmsQEAAP///////////////xAAAABNaWNyb3NvZnQgVGFpIExlXgIAAP////9fAgAA/////xAAAABNaWNyb3NvZnQgVWlnaHVyzgEAAP/////NAQAA/////w8AAABNaWNyb3NvZnQgWWFIZWnPAQAA/////9EBAAD/////EgAAAE1pY3Jvc29mdCBZYUhlaSBVSdABAAD/////0gEAAP////8SAAAATWljcm9zb2Z0IFlpIEJhaXRp0wEAAP///////////////wcAAABNaW5nTGlVsgEAAP///////////////wwAAABNaW5nTGlVLUV4dEK1AQAA////////////////DQAAAE1pbmdMaVVfSEtTQ1O0AQAA////////////////EgAAAE1pbmdMaVVfSEtTQ1MtRXh0QrcBAAD///////////////8GAAAATWlyaWFtwAEAAP///////////////wwAAABNaXJpYW0gRml4ZWTBAQAA////////////////EgAAAE1pcmlhbSBUcmFuc3BhcmVudMMBAAD///////////////8HAAAATWlzdHJhbLsBAAD///////////////8NAAAATW9kZXJuIE5vLiAyML0BAAD///////////////8IAAAATW9ldW1UIFJVAQAA////////////////DwAAAE1vbmdvbGlhbiBCYWl0ab4BAAD///////////////8QAAAATW9ub3R5cGUgQ29yc2l2Yf/////UAQAA//////////8RAAAATW9ub3R5cGUgSGFkYXNzYWg1AQAA/////zYBAAD/////DgAAAE1vbm90eXBlIEtvdWZp/////3YBAAD//////////w4AAABNb25vdHlwZSBTb3J0c9UBAAD///////////////8JAAAATW9vbEJvcmFuvwEAAP///////////////wgAAABNdWRpciBNVP/////WAQAA//////////8MAAAATXlhbm1hciBUZXh0vAEAAP///////////////wcAAABOU2ltU3VuRAIAAP///////////////wgAAABOYXJraXNpbd0BAAD///////////////8JAAAATmV3IEd1bGlt2AEAAP///////////////xAAAABOaWFnYXJhIEVuZ3JhdmVk2QEAAP///////////////w0AAABOaWFnYXJhIFNvbGlk2gEAAP///////////////woAAABOaXJtYWxhIFVJ2wEAAP/////cAQAA/////wUAAABOeWFsYeABAAD///////////////8OAAAAT0NSIEEgRXh0ZW5kZWThAQAA////////////////BAAAAE9DUkLiAQAA////////////////DgAAAE9sZCBBbnRpYyBCb2xk4wEAAP///////////////xQAAABPbGQgQW50aWMgRGVjb3JhdGl2ZeQBAAD///////////////8RAAAAT2xkIEFudGljIE91dGxpbmXlAQAA////////////////GAAAAE9sZCBBbnRpYyBPdXRsaW5lIFNoYWRlZOcBAAD///////////////8TAAAAT2xkIEVuZ2xpc2ggVGV4dCBNVOYBAAD///////////////8EAAAAT255eOgBAAD///////////////8JAAAAT3BlbiBTYW5z7wEAAO4BAADpAQAA6gEAABMAAABPcGVuIFNhbnMgQ29uZGVuc2Vk///////////rAQAA/////xkAAABPcGVuIFNhbnMgQ29uZGVuc2VkIExpZ2h07AEAAO0BAAD//////////woAAABPcGVuU3ltYm9s8AEAAP///////////////wYAAABPc3dhbGTyAQAA//////EBAAD/////CAAAAFBNaW5nTGlVswEAAP///////////////w0AAABQTWluZ0xpVS1FeHRCtgEAAP///////////////wwAAABQVCBCb2xkIEFyY2gIAgAA////////////////DgAAAFBUIEJvbGQgQnJva2VuCQIAAP///////////////w0AAABQVCBCb2xkIER1c2t5CgIAAP///////////////w8AAABQVCBCb2xkIEhlYWRpbmcLAgAA////////////////DgAAAFBUIEJvbGQgTWlycm9yDAIAAP///////////////w0AAABQVCBCb2xkIFN0YXJzDQIAAP///////////////wcAAABQVCBTYW5zEgIAABECAAAPAgAAEAIAABMAAABQVCBTZXBhcmF0ZWQgQmFsb29uDgIAAP///////////////xQAAABQVCBTaW1wbGUgQm9sZCBSdWxlZEkCAAD///////////////8IAAAAUGFjaWZpY2/0AQAA////////////////EAAAAFBhbGFjZSBTY3JpcHQgTVT/////+QEAAP//////////EQAAAFBhbGF0aW5vIExpbm90eXBl9QEAAPgBAAD2AQAA9wEAAAcAAABQYXB5cnVz+gEAAP///////////////wkAAABQYXJjaG1lbnT7AQAA////////////////CAAAAFBlcnBldHVhAQIAAP4BAAD9AQAA/AEAABMAAABQZXJwZXR1YSBUaXRsaW5nIE1UAAIAAP//////AQAA/////xQAAABQbGFudGFnZW5ldCBDaGVyb2tlZQQCAAD///////////////8IAAAAUGxheWJpbGwFAgAA////////////////DAAAAFBvb3IgUmljaGFyZAYCAAD///////////////8IAAAAUHJpc3RpbmEHAgAA////////////////CAAAAFB5dW5qaSBSWAEAAP///////////////wUAAABSYWF2aRMCAAD/////FAIAAP////8LAAAAUmFnZSBJdGFsaWMVAgAA////////////////BQAAAFJhdmllGAIAAP///////////////wgAAABSb2Nrd2VsbB0CAAAhAgAAHgIAAB8CAAASAAAAUm9ja3dlbGwgQ29uZGVuc2VkHAIAAP////8bAgAA/////xMAAABSb2Nrd2VsbCBFeHRyYSBCb2xkIAIAAP///////////////wMAAABSb2QiAgAA////////////////DwAAAFJvZCBUcmFuc3BhcmVudCMCAAD///////////////8IAAAAU1RDYWl5dW5PAgAA////////////////CgAAAFNURmFuZ3NvbmdRAgAA////////////////BgAAAFNUSHVwb1ICAAD///////////////8HAAAAU1RLYWl0aVMCAAD///////////////8GAAAAU1RMaXRpVAIAAP///////////////wYAAABTVFNvbmdVAgAA////////////////BwAAAFNUWGloZWlWAgAA////////////////CQAAAFNUWGluZ2thaVcCAAD///////////////8IAAAAU1RYaW53ZWlYAgAA////////////////CwAAAFNUWmhvbmdzb25nWQIAAP///////////////w4AAABTYWtrYWwgTWFqYWxsYZ4BAAD/////nwEAAP////8OAAAAU2NyaXB0IE1UIEJvbGQnAgAA////////////////CwAAAFNlZ29lIFByaW50KAIAAP////8pAgAA/////wwAAABTZWdvZSBTY3JpcHQqAgAA/////ysCAAD/////CAAAAFNlZ29lIFVJLAIAAC4CAAAtAgAAMQIAAA4AAABTZWdvZSBVSSBMaWdodC8CAAAyAgAA//////////8RAAAAU2Vnb2UgVUkgU2VtaWJvbGQzAgAANAIAAP//////////EgAAAFNlZ29lIFVJIFNlbWlsaWdodDACAAA1AgAA//////////8PAAAAU2Vnb2UgVUkgU3ltYm9sNgIAAP///////////////w0AAABTaG9uYXIgQmFuZ2xhNwIAAP////84AgAA/////w8AAABTaG93Y2FyZCBHb3RoaWM5AgAA////////////////BgAAAFNocnV0aToCAAD/////OwIAAP////8GAAAAU2ltSGVpPQIAAP///////////////wYAAABTaW1TdW5DAgAA////////////////CwAAAFNpbVN1bi1FeHRCRQIAAP///////////////xMAAABTaW1wbGUgQm9sZCBKdXQgT3V0SAIAAP///////////////xUAAABTaW1wbGUgSW5kdXN0IE91dGxpbmVKAgAA////////////////FAAAAFNpbXBsZSBJbmR1c3QgU2hhZGVkSwIAAP///////////////xIAAABTaW1wbGUgT3V0bGluZSBQYXRMAgAA////////////////EQAAAFNpbXBsaWZpZWQgQXJhYmljQgIAAP////9AAgAA/////xcAAABTaW1wbGlmaWVkIEFyYWJpYyBGaXhlZEECAAD///////////////8IAAAAU25hcCBJVENHAgAA////////////////BwAAAFN0ZW5jaWxQAgAA////////////////BwAAAFN5bGZhZW5aAgAA////////////////BgAAAFN5bWJvbFsCAAD///////////////8GAAAAVGFob21hXAIAAP////9dAgAA/////wkAAABUYWxsIFBhdWxgAgAA////////////////DwAAAFRlbXB1cyBTYW5zIElUQ2gCAAD///////////////8PAAAAVGltZXMgTmV3IFJvbWFuaQIAAGwCAABqAgAAawIAABIAAABUcmFkaXRpb25hbCBBcmFiaWNuAgAA/////20CAAD/////DAAAAFRyZWJ1Y2hldCBNU28CAAByAgAAcAIAAHECAAAFAAAAVHVuZ2FzAgAA/////3QCAAD/////CQAAAFR3IENlbiBNVGcCAABmAgAAYgIAAGECAAATAAAAVHcgQ2VuIE1UIENvbmRlbnNlZGUCAAD/////YwIAAP////8eAAAAVHcgQ2VuIE1UIENvbmRlbnNlZCBFeHRyYSBCb2xkZAIAAP///////////////wYAAABVYnVudHV6AgAAeQIAAHcCAAB4AgAAEAAAAFVidW50dSBDb25kZW5zZWR7AgAA////////////////EAAAAFVyZHUgVHlwZXNldHRpbmeYAgAA////////////////BgAAAFV0c2FhaJkCAACcAgAAmgIAAJsCAAAEAAAAVmFuaZ0CAAD/////ngIAAP////8HAAAAVmVyZGFuYZ8CAAChAgAAoAIAAKICAAAGAAAAVmlqYXlhowIAAP////+kAgAA/////w4AAABWaW5lciBIYW5kIElUQ6cCAAD///////////////8HAAAAVml2YWxkaf////+oAgAA//////////8PAAAAVmxhZGltaXIgU2NyaXB0qQIAAP///////////////wYAAABWcmluZGGqAgAA/////6sCAAD/////CAAAAFdlYmRpbmdzrAIAAP///////////////woAAABXaWRlIExhdGlufAEAAP///////////////wkAAABXaW5nZGluZ3OtAgAA////////////////CwAAAFdpbmdkaW5ncyAyrgIAAP///////////////wsAAABXaW5nZGluZ3MgM68CAAD///////////////8FAAAAWWV0IFJXAQAA////////////////BwAAAFlvdVl1YW5GAgAA//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////8AAAAAFQAAAC4AAABJAAAAaAAAAHQAAACIAAAAtwAAAOUAAADrAAAA7gAAAPgAAAAKAQAAOQEAAEABAABNAQAA/////2QBAABsAQAAjwEAAJkBAACdAQAApAEAAP////+pAQAA/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////1sAAAAdAAAASEdQ5Ym16Iux6KeS7726776e7728772v7724VUJQAQAA////////////////HgAAAEhHUOWJteiLseinku++ju++n++9r+++jO++n+S9k0oBAAD///////////////8gAAAASEdQ5Ym16Iux776M776f776a772+776e776d7729RUJNAQAA////////////////DwAAAEhHUOaVmeenkeabuOS9k0EBAAD///////////////8KAAAASEdQ5piO5pydQkQBAAD///////////////8KAAAASEdQ5piO5pydRUcBAAD///////////////8MAAAASEdQ6KGM5pu45L2TPgEAAP///////////////xMAAABIR1Dvvbrvvp7vvbzvva/vvbhFOAEAAP///////////////xMAAABIR1Dvvbrvvp7vvbzvva/vvbhNOwEAAP///////////////x0AAABIR1PlibXoi7Hop5Lvvbrvvp7vvbzvva/vvbhVQlEBAAD///////////////8eAAAASEdT5Ym16Iux6KeS776O776f772v776M776f5L2TSwEAAP///////////////yAAAABIR1PlibXoi7Hvvozvvp/vvprvvb7vvp7vvp3vvb1FQk4BAAD///////////////8PAAAASEdT5pWZ56eR5pu45L2TQgEAAP///////////////woAAABIR1PmmI7mnJ1CRQEAAP///////////////woAAABIR1PmmI7mnJ1FSAEAAP///////////////wwAAABIR1PooYzmm7jkvZM/AQAA////////////////EwAAAEhHU++9uu++nu+9vO+9r++9uEU5AQAA////////////////EwAAAEhHU++9uu++nu+9vO+9r++9uE08AQAA////////////////GQAAAEhH5Li47726776e7728772v7724TS1QUk9TAQAA////////////////HAAAAEhH5Ym16Iux6KeS7726776e7728772v7724VUJPAQAA////////////////HQAAAEhH5Ym16Iux6KeS776O776f772v776M776f5L2TSQEAAP///////////////x8AAABIR+WJteiLse++jO++n+++mu+9vu++nu++ne+9vUVCTAEAAP///////////////w4AAABIR+aVmeenkeabuOS9k0ABAAD///////////////8JAAAASEfmmI7mnJ1CQwEAAP///////////////wkAAABIR+aYjuacnUVGAQAA////////////////EgAAAEhH5q2j5qW35pu45L2TLVBST1IBAAD///////////////8LAAAASEfooYzmm7jkvZM9AQAA////////////////EgAAAEhH7726776e7728772v7724RTcBAAD///////////////8SAAAASEfvvbrvvp7vvbzvva/vvbhNOgEAAP///////////////wsAAABIWeqyrOqzoOuUlSkBAAD///////////////8LAAAASFnqsqzrqoXsobAsAQAA////////////////CQAAAEhZ6raB7IScQigBAAD///////////////8MAAAASFnqt7jrnpjtlL1NJwEAAP///////////////w8AAABIWeuqqeqwge2MjOyehEIuAQAA////////////////CwAAAEhZ7Iug66qF7KGwLQEAAP///////////////w8AAABIWeyWleydgOyDmOusvE0xAQAA////////////////CQAAAEhZ7Je97IScTC8BAAD///////////////8JAAAASFnsl73shJxNMAEAAP///////////////wsAAABIWeykkeqzoOuUlSoBAAD///////////////8PAAAASFntl6Trk5zrnbzsnbhNKwEAAP///////////////wwAAADjg6HjgqTjg6rjgqqpAQAAqgEAAK0BAACuAQAABgAAAOS7v+WuizwCAAD///////////////8MAAAA5Y2O5paH5Lit5a6LWQIAAP///////////////wwAAADljY7mlofku7/lrotRAgAA////////////////DAAAAOWNjuaWh+Wui+S9k1UCAAD///////////////8MAAAA5Y2O5paH5b2p5LqRTwIAAP///////////////wwAAADljY7mlofmlrDprY9YAgAA////////////////DAAAAOWNjuaWh+alt+S9k1MCAAD///////////////8MAAAA5Y2O5paH55Cl54+AUgIAAP///////////////wwAAADljY7mlofnu4bpu5FWAgAA////////////////DAAAAOWNjuaWh+ihjOalt1cCAAD///////////////8MAAAA5Y2O5paH6Zq25LmmVAIAAP///////////////wYAAADlrovkvZNDAgAA////////////////BgAAAOW5vOWchkYCAAD///////////////8PAAAA5b6u6Luf5q2j6buR6auUxwEAAP/////JAQAA/////wwAAADlvq7ova/pm4Xpu5HPAQAA/////9EBAAD/////CQAAAOaWsOWui+S9k0QCAAD///////////////8MAAAA5paw57Sw5piO6auUswEAAP///////////////xEAAADmlrDntLDmmI7pq5QtRXh0QrYBAAD///////////////8MAAAA5pa55q2j5aea5L2T7QAAAP///////////////wwAAADmlrnmraPoiJLkvZPsAAAA////////////////BgAAAOalt+S9kz4CAAD///////////////8JAAAA5qiZ5qW36auUaQEAAP///////////////xUAAADnjovmvKLlrpfkuK3mmI7pq5TnuYGwAgAA////////////////CQAAAOe0sOaYjumrlLIBAAD///////////////8OAAAA57Sw5piO6auULUV4dEK1AQAA////////////////DwAAAOe0sOaYjumrlF9IS1NDU7QBAAD///////////////8UAAAA57Sw5piO6auUX0hLU0NTLUV4dEK3AQAA////////////////BgAAAOmatuS5pj8CAAD///////////////8GAAAA6buR5L2TPQIAAP///////////////wYAAADqtbTrprwgAQAA////////////////CQAAAOq1tOumvOyytCEBAAD///////////////8GAAAA6raB7IScMQAAAP///////////////wkAAADqtoHshJzssrQyAAAA////////////////BgAAAOuPi+ybgCIBAAD///////////////8JAAAA64+L7JuA7LK0IwEAAP///////////////w0AAADrp5HsnYAg6rOg65SVoAEAAP////+hAQAA/////wYAAADrsJTtg5UvAAAA////////////////CQAAAOuwlO2DleyytDAAAAD///////////////8JAAAA7IOI6rW066a82AEAAP///////////////xgAAADtnLTrqLzrkaXqt7ztl6Trk5zrnbzsnbhbAQAA////////////////DwAAAO2ctOuovOunpOyngeyytFoBAAD///////////////8NAAAA7Zy066i866qo7J2MVFUBAAD///////////////8PAAAA7Zy066i87JWE66+47LK0WQEAAP///////////////w8AAADtnLTrqLzsl5HsiqTtj6xWAQAA////////////////DAAAAO2ctOuovOyYm+yytFcBAAD///////////////8PAAAA7Zy066i87Y647KeA7LK0WAEAAP///////////////xMAAADvvK3vvLMg44K044K344OD44KvxAEAAP///////////////w0AAADvvK3vvLMg5piO5pydywEAAP///////////////xYAAADvvK3vvLMg77yw44K044K344OD44KvxgEAAP///////////////xAAAADvvK3vvLMg77yw5piO5pydzAEAAP///////////////7ECAAAJAAAAQWdlbmN5IEZCAAAAAAEAAAAAAAAAAAAAAAILCAQCAgICAgQDAAAAAAAAAAAAAAAAAAAAAQAAIAAAAAC8AgMAAAgBAFUB/AJM/1AAAAAAAAkAAABBZ2VuY3kgRkIAAAAAAAAAAAAAAAAAAAAAAgsFAwICAgICBAMAAAAAAAAAAAAAAAAAAAABAAAgAAAAAJABAwAACAEAPAH8Akz/UAAAAAAADwAAAEd1dHRtYW4tQWhhcm9uaQAAAAABAAAAAAAAAAAAAAACAQcBAQEBAQEBABgAAAAAAEAAAAAAAAAAACAAAAAAAAAAvAIFAAAAAQCMAeoCsP4AAAAAAAAHAAAAQWhhcm9uaQAAAAABAAAAAAAAAAAAAAACAQgDAgEEAwIDAQgAAAAAAAAAAAAAAAAAACAAAAAAACAAvAIFAAAAAQDdAd4C9/4AAAAAAAAJAAAAQWtoYmFyIE1UAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAgAAAAACQAQUAAAABAJgBEQJi/n0AAAAAAAkAAABBa2hiYXIgTVQAAAAAAQAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACAAAAAALwCBQAAAAEAqQErApH+kwAAAAAABwAAAEFsZGhhYmkAAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAG8gAKBLgACQAAAAAAAAAABBAAAAAAAAAJABBQAAAAEA/wGDApz+7gIGAYIBCAAAAEFsZ2VyaWFuAAAAAAAAAAAAAAAAAAAAAAQCBwUECgIGBwIDAAAAAAAAAAAAAAAAAAAAAQAAIAAAAACQAQIAAAABAB0CeAMh/9AAAAAAAAcAAABBbmRhbHVzAAAAAAAAAAAAAAAAAAAAAAICBgMFBAUCAwQDIAAAAAAAgAgAAAAAAAAAQQAAAAAACCCQAQUAAAABANkBUARb/gAA/gHHAgsAAABBbmdzYW5hIE5ldwAAAAAAAAAAAAAAAAAAAAACAgYDBQQFAgMEAwAAgQAAAAAAAAAAAAAAAAEAAQAAAAAAkAEFAAUBAQAIAZoDEf8AABsBtQELAAAAQW5nc2FuYSBOZXcAAAAAAQAAAAAAAAAAAAAAAgIIAwcFBQIDBAMAAIEAAAAAAAAAAAAAAAABAAEAAAAAALwCBQAFAQEAGQF4AxH/AAAbAbUBCwAAAEFuZ3NhbmEgTmV3AAAAAAAAAAABAAAAAAAAAAICBQMFBAUJAwQDAACBAAAAAAAAAAAAAAAAAQABAAAAAACQAQUABQEBAAkBmwMR/wAAGwG1AQoAAABBbmdzYW5hVVBDAAAAAAAAAAAAAAAAAAAAAAICBgMFBAUCAwQDAACBAAAAAAAAAAAAAAAAAQABAAAAAACQAQUABQEBAAgBmgMR/wAAGwG1AQoAAABBbmdzYW5hVVBDAAAAAAEAAAAAAAAAAAAAAAICCAMHBQUCAwQDAACBAAAAAAAAAAAAAAAAAQABAAAAAAC8AgUABQEBABkBeAMR/wAAGwG1AQoAAABBbmdzYW5hVVBDAAAAAAAAAAABAAAAAAAAAAICBQMFBAUJAwQDAACBAAAAAAAAAAAAAAAAAQABAAAAAACQAQUABQEBAAkBmwMR/wAAGwG1AQoAAABBbmdzYW5hVVBDAAAAAAEAAAABAAAAAAAAAAICBwMGBQUJAwQDAACBAAAAAAAAAAAAAAAAAQABAAAAAAC8AgUABQEBAA8BnwMy/wAAGwG1AQsAAABBbmdzYW5hIE5ldwAAAAABAAAAAQAAAAAAAAACAgcDBgUFCQMEAwAAgQAAAAAAAAAAAAAAAAEAAQAAAAAAvAIFAAUBAQAPAZ8DMv8AABsBtQEMAAAAQm9vayBBbnRpcXVhAAAAAAEAAAAAAAAAAAAAAAIEBwIFAwUDAwSHAgAAAAAAAAAAAAAAAAAAnwAAIAAA19+8AgUABAEBAMoB1gL3/k4AAAAAAAwAAABCb29rIEFudGlxdWEAAAAAAQAAAAEAAAAAAAAAAgQHAgYDBQoCBIcCAAAAAAAAAAAAAAAAAACfAAAgAADX37wCBQAEAQEAvgHZAu7+QAAAAAAADAAAAEJvb2sgQW50aXF1YQAAAAAAAAAAAQAAAAAAAAACBAUCBQMFCgMEhwIAAAAAAAAAAAAAAAAAAJ8AACAAANffkAEFAAQBAQCQAdUC6f5AAAAAAAAJAAAAQXBhcmFqaXRhAAAAAAAAAAAAAAAAAAAAAAILBgQCAgICAgQDgAAAAAAAAAAAAAAAAAAAAQAAAAAAAACQAQUAAAABAO8B3AIO/18AZwEVAgkAAABBcGFyYWppdGEAAAAAAQAAAAAAAAAAAAAAAgsIBAICAgICBAOAAAAAAAAAAAAAAAAAAAABAAAAAAAAALwCBQAAAAEACgLcAg7/XwBvARUCCQAAAEFwYXJhaml0YQAAAAABAAAAAQAAAAAAAAACCwgEAgICAgIEA4AAAAAAAAAAAAAAAAAAAAEAAAAAAAAAvAIFAAAAAQAGAtwCDv9fAGwBFQIJAAAAQXBhcmFqaXRhAAAAAAAAAAABAAAAAAAAAAILBgQCAgICAgQDgAAAAAAAAAAAAAAAAAAAAQAAAAAAAACQAQUAAAABAO0B3AIO/18AYwEVAg0AAABBR0EgQXJhYmVzcXVlAAAAAAAAAAAAAAAAAAAAAAUBAQEBAQEBAQEAAAAAAAAAAAAAAAAAAAAAAAAAgAAAAACQAQUAAAwBACcCAgPNABcAAAAAABIAAABBcmFiaWMgVHlwZXNldHRpbmcAAAAAAAAAAAAAAAAAAAAAAwIEAgQEBgMCA28gAKAAAADACAAAAAAAAADTAAAgAAAAAJABBQAAAAEAGwEPAqv+AAD0AbwCDAAAAEd1dHRtYW4tQXJhbQAAAAAAAAAAAAAAAAAAAAACAQQBAQEBAQEBABgAAAAAAEAAAAAAAAAAACAAAAAAAAAAkAEFAAAAAQB2AeoCsP4AAAAAAAAVAAAAQUdBIEFyYWJlc3F1ZSBEZXNrdG9wAAAAAAAAAAAAAAAAAAAAAAUBAQEBAQEBAQEAAAAAAAAAAAAAAAAAAAAAAAAAgAAAAACQAQUAAAABAK4D9AH0AQAAAAAAAAUAAABBcmlhbAAAAAAAAAAAAAAAAAAAAAACCwYEAgICAgIE/yoA4EN4AMAJAAAAAAAAAP8BAEAAAP//kAEFAAUIAQC5AdgCLv+VAAYCzAIFAAAAQXJpYWwAAAAAAQAAAAAAAAAAAAAAAgsHBAICAgICBP8qAOBDeADACQAAAAAAAAD/AQBAAAD//7wCBQAFCAEA3gHYAi7/lQAGAssCBQAAAEFyaWFsAAAAAAEAAAABAAAAAAAAAAILBwQCAgIJAgT/CgDgQ3gAAAEAAAAAAAAAvwEAQAAA99+8AgUABQgBAN4B2AIu/5UABgLLAgUAAABBcmlhbAAAAAAAAAAAAQAAAAAAAAACCwYEAgICCQIE/woA4EN4AAABAAAAAAAAAL8BAEAAAPffkAEFAAUIAQC5AdgCMf+VAAYCywIMAAAAQXJpYWwgTmFycm93AAAAAAAAAAAAAAAAAAAAAAILBgYCAgIDAgSHAgAAAAgAAAAAAAAAAAAAnwAAIAAA19+QAQMABQgBAGkB2AIu/4MAAAAAAAwAAABBcmlhbCBOYXJyb3cAAAAAAQAAAAAAAAAAAAAAAgsHBgICAgMCBIcCAAAACAAAAAAAAAAAAACfAAAgAADX37wCAwAFCAEAiAHYAi7/gwAAAAAADAAAAEFyaWFsIE5hcnJvdwAAAAABAAAAAQAAAAAAAAACCwcGAgICCgIEhwIAAAAIAAAAAAAAAAAAAJ8AACAAANffvAIDAAUIAQCIAdgCLv+DAAAAAAAMAAAAQXJpYWwgTmFycm93AAAAAAAAAAABAAAAAAAAAAILBgYCAgIKAgSHAgAAAAgAAAAAAAAAAAAAnwAAIAAA19+QAQMABQgBAGkB2AIx/4YAAAAAABAAAABBcmlhbCBVbmljb2RlIE1TAAAAAAAAAAAAAAAAAAAAAAILBgQCAgICAgT/////////6T8AAAAAAAAA/wE/YAAA//+QAQUABQgBALkB2AIv/4MAAAAAAAsAAABBcmlhbCBCbGFjawAAAAAAAAAAAAAAAAAAAAACCwoEAgECAgIErwIAoPt4AEAAAAAAAAAAAJ8AAGAAANffhAMFAAUIAQAoAssC0wCOAAYCywIVAAAAQXJpYWwgUm91bmRlZCBNVCBCb2xkAAAAAAAAAAAAAAAAAAAAAAIPBwQDBQQDAgQDAAAAAAAAAAAAAAAAAAAAAQAAIAAAAACQAQUABQgBAOMB2AIv/4MAAAAAABIAAABBcmFiaWMgVHJhbnNwYXJlbnQAAAAAAQAAAAAAAAAAAAAAAgEAAAAAAAAAAAAgAAAAAAAAAAAAAAAAAABAAAAAAAAAALwCBQAAAAEAuQFRA7r+AAAAAAAAEgAAAEFyYWJpYyBUcmFuc3BhcmVudAAAAAAAAAAAAAAAAAAAAAACAQAAAAAAAAAAACAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAkAEFAAAAAQCYAVEDuv4AAAAAAAAEAAAAQXJ2bwAAAAABAAAAAAAAAAAAAAACAAAAAAAAAAAAJwAAgEAAAAgAAAAUAAAAAAEAAAAAAAAAvAIFAAAAAQAFAvcCG/81APkB5AIEAAAAQXJ2bwAAAAABAAAAAQAAAAAAAAACAAAAAAAAAAAAJwAAgEEAAAAAAAAAAAAAABEBACAAAABAvAIFAAAAAQAGAvcCG/81APkB5AIEAAAAQXJ2bwAAAAAAAAAAAQAAAAAAAAACAAAAAAAAAAAApwAAgEEAAAAAAAAAAAAAABEBACAAAABAkAEFAAAAAQD0AfcCG/81APkB5AIEAAAAQXJ2bwAAAAAAAAAAAAAAAAAAAAACAAAAAAAAAAAApwAAgEEAAAAAAAAAAAAAABEBACAAAABAkAEFAAAAAQDYAfcCG/81APkB5AIIAAAAQXN0b24tRjEAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAJABBQAAAAEAWgDVAQAAAAAAAAAAFAAAAEJhc2tlcnZpbGxlIE9sZCBGYWNlAAAAAAAAAAAAAAAAAAAAAAICBgIIBQUCAwMDAAAAAAAAAAAAAAAAAAAAAQAAIAAAAACQAQUAAAABAIgBrwJO/8sAAAAAAAYAAABCYXRhbmcAAAAAAAAAAAAAAAAAAAAAAgMGAAABAQEBAa8CALD7fNdpMAAAAAAAAACfAAhAAADX35ABBQAFAQEA9AFaA3P/lAAAAAAACQAAAEJhdGFuZ0NoZQEAAAAAAAAAAAAAAAQAAAACAwYJAAEBAQEBrwIAsPt812kwAAAAAAAAAJ8ACEAAANffkAEFAAUBAQD0AVoDc/+UAAAAAAAHAAAAR3VuZ3N1aAIAAAAAAAAAAAAAAAAAAAACAwYAAAEBAQEBrwIAsPt812kwAAAAAAAAAJ8ACEAAANffkAEFAAUBAQD0AVoDc/+UAAAAAAAKAAAAR3VuZ3N1aENoZQMAAAAAAAAAAAAAAAQAAAACAwYJAAEBAQEBrwIAsPt812kwAAAAAAAAAJ8ACEAAANffkAEFAAUBAQD0AVoDc/+UAAAAAAAKAAAAQmF1aGF1cyA5MwAAAAAAAAAAAAAAAAAAAAAEAwkFAgsCAgwCAwAAAAAAAAAAAAAAAAAAAAEAACAAAAAAkAEFAAAAAQC7AYIDGP9IAQAAAAAHAAAAQmVsbCBNVAAAAAAAAAAAAAAAAAAAAAACAgUDBgMFAgMDAwAAAAAAAAAAAAAAAAAAAAEAACAAAAAAkAEFAAECAQCXAZwC9v6GAAAAAAAHAAAAQmVsbCBNVAAAAAABAAAAAAAAAAAAAAACAwcDBgUKAgMDAwAAAAAAAAAAAAAAAAAAAAEAACAAAAAAvAIFAAECAQC2AZsC+P6JAAAAAAAHAAAAQmVsbCBNVAAAAAAAAAAAAQAAAAAAAAACAwYDBgUKCQIDAwAAAAAAAAAAAAAAAAAAAAEAACAAAAAAkAEFAAECAQBuAZ0C9v6GAAAAAAAUAAAAQmVybmFyZCBNVCBDb25kZW5zZWQAAAAAAAAAAAAAAAAAAAAAAgUIBgYJBQIEBAMAAAAAAAAAAAAAAAAAAAABAAAgAAAAAJABAwAFBAEAgwElA4j/jwAAAAAAGgAAAEJpY2toYW0gU2NyaXB0IFBybyBSZWd1bGFyAAAAAAEAAAAAAAAAAAAAAAMDCAIEBwcNDQavAACASyAAUAAAAAAAAAAAkwAAAAAAAAC8AgUAAAACABUCqALA/sgAfgLuAgwAAABCb29rIEFudGlxdWEAAAAAAAAAAAAAAAAAAAAAAgQGAgUDBQMDBIcCAAAAAAAAAAAAAAAAAACfAAAgAADX35ABBQAEAQEAvQHXAub+PAAAAAAADwAAAEJvbGQgSXRhbGljIEFydAAAAAAAAAAAAAAAAAAAAAACAQQAAAAAAAAAAGAAAAAAAIAIAAAAAAAAAEAAAAAAAAAAkAEFAAAAAQCNAu0FOAIAAAAAAAAJAAAAQm9kb25pIE1UAAAAAAEAAAAAAAAAAAAAAAIHCAMIBgYCAgMDAAAAAAAAAAAAAAAAAAAAAQAAIAAAAAC8AgUAAQMBAJgBmAIA/5QAAAAAAAkAAABCb2RvbmkgTVQAAAAAAQAAAAEAAAAAAAAAAgcIAwgGBgkCAwMAAAAAAAAAAAAAAAAAAAABAAAgAAAAALwCBQABAwEAywGaAgH/kgAAAAAADwAAAEJvZG9uaSBNVCBCbGFjawAAAAAAAAAAAQAAAAAAAAACBwoDCAYGCQIDAwAAAAAAAAAAAAAAAAAAAAEAACAAAAAAhAMFAAEDAQAfApQCL//HAAAAAAAPAAAAQm9kb25pIE1UIEJsYWNrAAAAAAAAAAAAAAAAAAAAAAIHCgMIBgYCAgMDAAAAAAAAAAAAAAAAAAAAAQAAIAAAAACEAwUAAQMBAP0BnQIc/6sAAAAAABMAAABCb2RvbmkgTVQgQ29uZGVuc2VkAAAAAAEAAAAAAAAAAAAAAAIHCAYIBgYCAgMDAAAAAAAAAAAAAAAAAAAAAQAAIAAAAAC8AgMAAQMBAFABgwIt/9YAAAAAABMAAABCb2RvbmkgTVQgQ29uZGVuc2VkAAAAAAEAAAABAAAAAAAAAAIHCAYIBgYJAgMDAAAAAAAAAAAAAAAAAAAAAQAAIAAAAAC8AgMAAQMBAFIBgwIt/9YAAAAAABMAAABCb2RvbmkgTVQgQ29uZGVuc2VkAAAAAAAAAAABAAAAAAAAAAIHBgYIBgYJAgMDAAAAAAAAAAAAAAAAAAAAAQAAIAAAAACQAQMAAQMBAB8BgwIt/9YAAAAAABMAAABCb2RvbmkgTVQgQ29uZGVuc2VkAAAAAAAAAAAAAAAAAAAAAAIHBgYIBgYCAgMDAAAAAAAAAAAAAAAAAAAAAQAAIAAAAACQAQMAAQMBABwBgwIt/9YAAAAAAAkAAABCb2RvbmkgTVQAAAAAAAAAAAEAAAAAAAAAAgcGAwgGBgkCAwMAAAAAAAAAAAAAAAAAAAABAAAgAAAAAJABBQABAwEAhQGaAgb/lwAAAAAAGwAAAEJvZG9uaSBNVCBQb3N0ZXIgQ29tcHJlc3NlZAAAAAAAAAAAAAAAAAAAAAACBwcGCAYBBQIEAwAAAAAAAAAAAAAAAAAAABEAACAAAAAALAECAAEDAQDvAOQCS/+TAAAAAAAJAAAAQm9kb25pIE1UAAAAAAAAAAAAAAAAAAAAAAIHBgMIBgYCAgMDAAAAAAAAAAAAAAAAAAAAAQAAIAAAAACQAQUAAQMBAKEBlgL+/pQAAAAAABEAAABCb29rbWFuIE9sZCBTdHlsZQAAAAAAAAAAAAAAAAAAAAACBQYEBQUFAgIEhwIAAAAAAAAAAAAAAAAAAJ8AACAAANffLAEFAAUBAQDsAcwCH/+AAAAAAAARAAAAQm9va21hbiBPbGQgU3R5bGUAAAAAAQAAAAAAAAAAAAAAAgUIBAQFBQICBIcCAAAAAAAAAAAAAAAAAACfAAAgAADX31gCBQAFAQEADgLMAiH/gQAAAAAAEQAAAEJvb2ttYW4gT2xkIFN0eWxlAAAAAAEAAAABAAAAAAAAAAIFCAQEBQUJAgSHAgAAAAAAAAAAAAAAAAAAnwAAIAAA199YAgUABQEBABoCzAIh/4IAAAAAABEAAABCb29rbWFuIE9sZCBTdHlsZQAAAAAAAAAAAQAAAAAAAAACBQYEBQUFCQIEhwIAAAAAAAAAAAAAAAAAAJ8AACAAANffLAEFAAUBAQDiAcwCGv97AAAAAAAQAAAAQnJhZGxleSBIYW5kIElUQwAAAAAAAAAAAAAAAAAAAAADBwQCBQMCAwIDAwAAAAAAAAAAAAAAAAAAAAEAACAAAAAAkAEFAAYKAQCiAboC8/5mAAAAAAAOAAAAQnJpdGFubmljIEJvbGQAAAAAAAAAAAAAAAAAAAAAAgsJAwYHAwICBAMAAAAAAAAAAAAAAAAAAAABAAAgAAAAAJABBQAAAAEAvgGkAlr/AAEAAAAADgAAAEJlcmxpbiBTYW5zIEZCAAAAAAEAAAAAAAAAAAAAAAIOCQICBQICAwYDAAAAAAAAAAAAAAAAAAAAAQAAIAAAAAC8AgUAAggBANwBigO1/mgAAAAAABMAAABCZXJsaW4gU2FucyBGQiBEZW1pAAAAAAEAAAAAAAAAAAAAAAIOCAICBQICAwYDAAAAAAAAAAAAAAAAAAAAAQAAIAAAAAC8AgUAAggBALwBnAM0/2AAAAAAAA4AAABCZXJsaW4gU2FucyBGQgAAAAAAAAAAAAAAAAAAAAACDgYCAgUCAgMGAwAAAAAAAAAAAAAAAAAAAAEAACAAAAAAkAEFAAIIAQCdAX8DNf9cAAAAAAAIAAAAQnJvYWR3YXkAAAAAAAAAAAAAAAAAAAAABAQJBQgLAgIFAgMAAAAAAAAAAAAAAAAAAAABAAAgAAAAAJABBQAACQEAHwLBAun/AAAAAAAADQAAAEJyb3dhbGxpYSBOZXcAAAAAAAAAAAAAAAAAAAAAAgsGBAICAgICBAMAAIEAAAAAAAAAAAAAAAABAAEAAAAAAJABBQAFCAEAJgFIA9/+AABSAdMBDQAAAEJyb3dhbGxpYSBOZXcAAAAAAQAAAAAAAAAAAAAAAgsHBAICAgICBAMAAIEAAAAAAAAAAAAAAAABAAEAAAAAALwCBQAFCAEAOAFoAwD/AABSAdMBDQAAAEJyb3dhbGxpYSBOZXcAAAAAAAAAAAEAAAAAAAAAAgsDBAICAgkCBAMAAIEAAAAAAAAAAAAAAAABAAEAAAAAAJABBQAFCAEAIAFHA9r+AABSAdMBDAAAAEJyb3dhbGxpYVVQQwAAAAAAAAAAAAAAAAAAAAACCwYEAgICAgIEAwAAgQAAAAAAAAAAAAAAAAEAAQAAAAAAkAEFAAUIAQAmAUgD3/4AAFIB0wEMAAAAQnJvd2FsbGlhVVBDAAAAAAEAAAAAAAAAAAAAAAILBwQCAgICAgQDAACBAAAAAAAAAAAAAAAAAQABAAAAAAC8AgUABQgBADgBaAMA/wAAUgHTAQwAAABCcm93YWxsaWFVUEMAAAAAAAAAAAEAAAAAAAAAAgsDBAICAgkCBAMAAIEAAAAAAAAAAAAAAAABAAEAAAAAAJABBQAFCAEAIAFHA9r+AABSAdMBDAAAAEJyb3dhbGxpYVVQQwAAAAABAAAAAQAAAAAAAAACCwcEAgICCQIEAwAAgQAAAAAAAAAAAAAAAAEAAQAAAAAAvAIFAAUIAQA/AWgDAP8AAFIB0wENAAAAQnJvd2FsbGlhIE5ldwAAAAABAAAAAQAAAAAAAAACCwcEAgICCQIEAwAAgQAAAAAAAAAAAAAAAAEAAQAAAAAAvAIFAAUIAQA/AWgDAP8AAFIB0wEPAAAAQnJ1c2ggU2NyaXB0IE1UAAAAAAAAAAABAAAAAAAAAAMGCAIEBAYHAwQDAAAAAAAAAAAAAAAAAAAAAQAAIAAAAACQAQUAAgoBAD8BWAIJ/94AAAAAABIAAABCb29rc2hlbGYgU3ltYm9sIDcAAAAAAAAAAAAAAAAAAAAABQEBAQEBAQEBAQAAAAAAAAAAAAAAAAAAAAAAAACAAAAAAJABBQAFCAEAkAJbA3T/AAAAAAAABwAAAENhbGlicmkAAAAAAAAAAAAAAAAAAAAAAg8FAgICBAMCBP8CAOD/rABAAQAAAAAAAACfAQAgAAAAAJABBQAACAEACALuAgb/3ADQAXcCBwAAAENhbGlicmkAAAAAAQAAAAAAAAAAAAAAAg8HAgMEBAMCBP8CAOD/rABAAQAAAAAAAACfAQAgAAAAALwCBQAACAEAGALuAgb/3ADUAXcCBwAAAENhbGlicmkAAAAAAAAAAAEAAAAAAAAAAg8FAgICBAoCBP8CAOD/rABAAQAAAAAAAACfAQAgAAAAAJABBQAACAEACALuAgb/3ADTAXkCDQAAAENhbGlicmkgTGlnaHQAAAAAAAAAAAAAAAAAAAAAAg8DAgICBAMCBO8CAKB7IABAAAAAAAAAAACfAQAgAAAAACwBBQAACAEACALuAgb/3ADNAXcCDQAAAENhbGlicmkgTGlnaHQAAAAAAAAAAAEAAAAAAAAAAg8DAgICBAMCBO8CAKB7IABAAAAAAAAAAACfAQAgAAAAACwBBQAACAEACALuAgb/3ADQAXcCBwAAAENhbGlicmkAAAAAAQAAAAEAAAAAAAAAAg8HAgMEBAoCBP8CAOD/rABAAQAAAAAAAACfAQAgAAAAALwCBQAACAEAGALuAgb/3ADUAXcCDgAAAENhbGlmb3JuaWFuIEZCAAAAAAEAAAAAAAAAAAAAAAIHBgMGCAsDAgQDAAAAAAAAAAAAAAAAAAAAAQAAIAAAAAC8AgUAAwEBAKsB6QIC/1QAAAAAAA4AAABDYWxpZm9ybmlhbiBGQgAAAAAAAAAAAQAAAAAAAAACBwQDBggLCgIEAwAAAAAAAAAAAAAAAAAAAAEAACAAAAAAkAEFAAABAQBRAekCAv9UAAAAAAAOAAAAQ2FsaWZvcm5pYW4gRkIAAAAAAAAAAAAAAAAAAAAAAgcEAwYICwMCBAMAAAAAAAAAAAAAAAAAAAABAAAgAAAAAJABBQADAQEAlAHpAgL/VAAAAAAACgAAAENhbGlzdG8gTVQAAAAAAAAAAAAAAAAAAAAAAgQGAwUFBQMDBAMAAAAAAAAAAAAAAAAAAAABAAAgAAAAAJABBQACAQEApQHIAi//kwAAAAAACgAAAENhbGlzdG8gTVQAAAAAAQAAAAAAAAAAAAAAAgQHAwYFBQIDBAMAAAAAAAAAAAAAAAAAAAABAAAgAAAAALwCBQACAQEAtAHIAi//kwAAAAAACgAAAENhbGlzdG8gTVQAAAAAAQAAAAEAAAAAAAAAAgQHAwUFBQkDBAMAAAAAAAAAAAAAAAAAAAABAAAgAAAAALwCBQACAQEAiQHIAi//kwAAAAAACgAAAENhbGlzdG8gTVQAAAAAAAAAAAEAAAAAAAAAAgQGAwUFBQkDBAMAAAAAAAAAAAAAAAAAAAABAAAgAAAAAJABBQAFBAEAdQHHAi//kwAAAAAABwAAAENhbWJyaWEAAAAAAAAAAAAAAAAAAAAAAgQFAwUEBgMCBP8CAOD/BABAAAAAAAAAAACfAQAgAAAAAJABBQAPAgEAZwIJAyL/rADSAZoCDAAAAENhbWJyaWEgTWF0aAEAAAAAAAAAAAAAAAAAAAACBAUDBQQGAwIE/wIA4P8kAEIAAAAAAAAAAJ8BACAAAAAAkAEFAA8CAQBnAgkDIv+sANIBmgIHAAAAQ2FtYnJpYQAAAAABAAAAAAAAAAAAAAACBAgDBQQGAwIE/wIA4F8EAEAAAAAAAAAAAJ8BACAAAAAAvAIFAA8CAQBXAgkDIv+sAOQBmgIHAAAAQ2FtYnJpYQAAAAAAAAAAAQAAAAAAAAACBAUDBQQGCgIE/wIA4F8EAEAAAAAAAAAAAJ8BACAAAAAAkAEFAA8CAQAeAgkDIv+sANIBmgIHAAAAQ2FtYnJpYQAAAAABAAAAAQAAAAAAAAACBAgDBQQGCgIE/wIA4F8EAEAAAAAAAAAAAJ8BACAAAAAAvAIFAA8CAQBIAgkDIv+sAOQBmgIHAAAAQ2FuZGFyYQAAAAAAAAAAAAAAAAAAAAACDgUCAwMDAgIE7wIAoEukAEAAAAAAAAAAAJ8BACAAAAAAkAEFAAIIAQAJAtQC7f7cAM8BfgIHAAAAQ2FuZGFyYQAAAAABAAAAAAAAAAAAAAACDgcCAwMDAgIE7wIAoEukAEAAAAAAAAAAAJ8BACAAAAAAvAIFAAIIAQAQAtQC7f7cAM8BfgIHAAAAQ2FuZGFyYQAAAAAAAAAAAQAAAAAAAAACDgUCAwMDCQIE7wIAoEukAEAAAAAAAAAAAJ8BACAAAAAAkAEFAAIIAQD3AdQC7f7cANUBfgIHAAAAQ2FuZGFyYQAAAAABAAAAAQAAAAAAAAACDgcCAwMDCQIE7wIAoEukAEAAAAAAAAAAAJ8BACAAAAAAvAIFAAIIAQAFAtQC7f7cANUBfgIJAAAAQ2FzdGVsbGFyAAAAAAAAAAAAAAAAAAAAAAIKBAIGBAYBAwEDAAAAAAAAAAAAAAAAAAAAAQAAIAAAAACQAQUABAkBAJoCygL9/18BAAAAABIAAABDZW50dXJ5IFNjaG9vbGJvb2sAAAAAAAAAAAAAAAAAAAAAAgQGBAUFBQIDBIcCAAAAAAAAAAAAAAAAAACfAAAgAADX35ABBQACBAEA0AHkAj7/hgAAAAAABwAAAENlbnRhdXIAAAAAAAAAAAAAAAAAAAAAAgMFBAUCBQIDBAMAAAAAAAAAAAAAAAAAAAABAAAgAAAAAJABBQACBAEAagGgAuv+dwAAAAAABwAAAENlbnR1cnkAAAAAAAAAAAAAAAAAAAAAAgQGBAUFBQIDBIcCAAAAAAAAAAAAAAAAAACfAAAgAADX35ABBQACBAEA0AHkAj7/hgAAAAAABwAAAENoaWxsZXIAAAAAAAAAAAAAAAAAAAAABAIEBAMQBwIGAgMAAAAAAAAAAAAAAAAAAAABAAAgAAAAAJABBgAPCgEAJQFQA8/+AAAAAAAACgAAAENvbG9ubmEgTVQAAAAAAAAAAAAAAAAAAAAABAIIBQYCAgMCAwMAAAAAAAAAAAAAAAAAAAABAAAgAAAAAJABBQABCQEAowFTArP+jQAAAAAADQAAAENvbWljIFNhbnMgTVMAAAAAAAAAAAAAAAAAAAAAAw8HAgMDAgICBIcCAAATAABAAAAAAAAAAACfAAAgAAAAAJABBQAICgEA1AEfA93+AAAbAvYCDQAAAENvbWljIFNhbnMgTVMAAAAAAQAAAAAAAAAAAAAAAw8JAgMDAgICBIcCAAATAABAAAAAAAAAAACfAAAgAAAAALwCBQAICgEA7wEfA+3+AAAbAvYCDQAAAENvbWljIFNhbnMgTVMAAAAAAAAAAAEAAAAAAAAAAw8HAgMDAgYCBIcCAAATAAAAAAAAAAAAAACfAAAgAAAAAJABBQAICgEAhgIfA+3+AAAbAvYCDQAAAENvbWljIFNhbnMgTVMAAAAAAQAAAAEAAAAAAAAAAw8JAgMDAgYCBIcCAAATAAAAAAAAAAAAAACfAAAgAAAAALwCBQAICgEAjwIfA+3+AAAbAvYCCAAAAENvbnNvbGFzAAAAAAAAAAAAAAAABAAAAAILBgkCAgQDAgT/AgDh//wAQAkAAAAAAAAAnwEAYAAA19+QAQUACQgBACUC5gL//qoA6gF+AggAAABDb25zb2xhcwAAAAABAAAAAAAAAAQAAAACCwcJAgIEAwIE/wIA4f/8AEAJAAAAAAAAAJ8BAGAAANffvAIFAAkIAQAlAuYC//6qAPABfgIIAAAAQ29uc29sYXMAAAAAAAAAAAEAAAAEAAAAAgsGCQICBAoCBP8CAOH//ABACQAAAAAAAACfAQBgAADX35ABBQAJCAEAJQLmAv/+qgDqAX4CCAAAAENvbnNvbGFzAAAAAAEAAAABAAAABAAAAAILBwkCAgQKAgT/AgDh//wAQAkAAAAAAAAAnwEAYAAA19+8AgUACQgBACUC5gL//qoA8AF+AgoAAABDb25zdGFudGlhAAAAAAAAAAAAAAAAAAAAAAIDBgIFAwYDAwPvAgCgSyAAQAAAAAAAAAAAnwEAIAAAAACQAQUAAAABAB0C7gIH/9wAxQGuAgoAAABDb25zdGFudGlhAAAAAAEAAAAAAAAAAAAAAAIDBwIGAwYDAwPvAgCgSyAAQAAAAAAAAAAAnwEAIAAAAAC8AgUAAAABAD4C7gIH/9wAyAGuAgoAAABDb25zdGFudGlhAAAAAAAAAAABAAAAAAAAAAIDBgIFAwYKAwPvAgCgSyAAQAAAAAAAAAAAnwEAIAAAAACQAQUAAAABABUC7gIH/9wAygGuAgoAAABDb25zdGFudGlhAAAAAAEAAAABAAAAAAAAAAIDBwIGAwYKAwPvAgCgSyAAQAAAAAAAAAAAnwEAIAAAAAC8AgUAAAABADkC7gIH/9wA0AGuAgwAAABDb29wZXIgQmxhY2sAAAAAAAAAAAAAAAAAAAAAAggJBAQDCwIEBAMAAAAAAAAAAAAAAAAAAAABAAAgAAAAAJABBQAACQEA/wGfAkD/AAAAAAAAFwAAAENvcHBlcnBsYXRlIEdvdGhpYyBCb2xkAAAAAAAAAAAAAAAAAAAAAAIOBwUCAgYCBAQDAAAAAAAAAAAAAAAAAAAAAQAAIAAAAACQAQUAAQkBAEMCQgL1/wAAAAAAABgAAABDb3BwZXJwbGF0ZSBHb3RoaWMgTGlnaHQAAAAAAAAAAAAAAAAAAAAAAg4FBwICBgIEBAMAAAAAAAAAAAAAAAAAAAABAAAgAAAAAJABBQABCQEAKQJCAvX/AAAAAAAABgAAAENvcmJlbAAAAAAAAAAAAAAAAAAAAAACCwUDAgIEAgIE7wIAoEukAEAAAAAAAAAAAJ8BACAAAAAAkAEFAAAAAQARAucCAP/PAM8BjQIGAAAAQ29yYmVsAAAAAAEAAAAAAAAAAAAAAAILBwMCAgQCAgTvAgCgS6QAQAAAAAAAAAAAnwEAIAAAAAC8AgUAAAABACgC5wIA/88A2QGNAgYAAABDb3JiZWwAAAAAAAAAAAEAAAAAAAAAAgsFAwICBAkCBO8CAKBLpABAAAAAAAAAAACfAQAgAAAAAJABBQAAAAEAAwLnAgD/zwDPAY0CBgAAAENvcmJlbAAAAAABAAAAAQAAAAAAAAACCwcDAgIECQIE7wIAoEukAEAAAAAAAAAAAJ8BACAAAAAAvAIFAAAAAQAeAucCAP/PANkBjQIKAAAAQ29yZGlhIE5ldwAAAAAAAAAAAAAAAAAAAAACCwMEAgICAgIEAwAAgQAAAAAAAAAAAAAAAAEAAQAAAAAAkAEFAAUIAQAlAX0DA/8AAFMB1AEKAAAAQ29yZGlhIE5ldwAAAAABAAAAAAAAAAAAAAACCwYEAgICAgIEAwAAgQAAAAAAAAAAAAAAAAEAAQAAAAAAvAIFAAUIAQAoAUED+/4AAFMB1AEKAAAAQ29yZGlhIE5ldwAAAAAAAAAAAQAAAAAAAAACCwMEAgICCQIEAwAAgQAAAAAAAAAAAAAAAAEAAQAAAAAAkAEFAAUIAQArAX0DA/8AAFMB1AEJAAAAQ29yZGlhVVBDAAAAAAAAAAAAAAAAAAAAAAILAwQCAgICAgQDAACBAAAAAAAAAAAAAAAAAQABAAAAAACQAQUABQgBACUBfQMD/wAAUwHUAQkAAABDb3JkaWFVUEMAAAAAAQAAAAAAAAAAAAAAAgsGBAICAgICBAMAAIEAAAAAAAAAAAAAAAABAAEAAAAAALwCBQAFCAEAKAFBA/v+AABTAdQBCQAAAENvcmRpYVVQQwAAAAAAAAAAAQAAAAAAAAACCwMEAgICCQIEAwAAgQAAAAAAAAAAAAAAAAEAAQAAAAAAkAEFAAUIAQArAX0DA/8AAFMB1AEJAAAAQ29yZGlhVVBDAAAAAAEAAAABAAAAAAAAAAILBgQCAgIJAgQDAACBAAAAAAAAAAAAAAAAAQABAAAAAAC8AgUABQgBACEBQQP7/gAAUwHUAQoAAABDb3JkaWEgTmV3AAAAAAEAAAABAAAAAAAAAAILBgQCAgIJAgQDAACBAAAAAAAAAAAAAAAAAQABAAAAAAC8AgUABQgBACEBQQP7/gAAUwHUAQsAAABDb3VyaWVyIE5ldwAAAAAAAAAAAAAAAAQAAAACBwMJAgIFAgQE/yoA4EN4AMAJAAAAAAAAAP8BAEAAAP//kAEFAAUFAQBYAmQCRP8AAKYBOwILAAAAQ291cmllciBOZXcAAAAAAQAAAAAAAAAEAAAAAgcGCQICBQIEBP8qAOBDeADACQAAAAAAAAD/AQBAAAD//7wCBQAFBQEAWAJ5AjD/AAC7AU8CCwAAAENvdXJpZXIgTmV3AAAAAAEAAAABAAAABAAAAAIHBgkCAgUJBAT/CgDgQ3gAQAEAAAAAAAAAvwEAQAAA99+8AgUABQUBAFgCeQIw/wAAuwFPAgsAAABDb3VyaWVyIE5ldwAAAAAAAAAAAQAAAAQAAAACBwQJAgIFCQQE/woA4EN4AEABAAAAAAAAAL8BAEAAAPffkAEFAAUFAQBYAmQCRP8AAKYBOwIGAAAAQ3VwcnVtAAAAAAEAAAAAAAAAAAAAAAIACAYAAAACAAQvAgCACgAAAAAAAAAAAAAAlQAAAAAAAAC8AgUAAAABAM8BfwP8/gAA9AHGAgYAAABDdXBydW0AAAAAAQAAAAEAAAAAAAAAAgAIBgAAAAkABC8CAIAKAAAAAAAAAAAAAACVAAAAAAAAALwCBQAAAAEA0AF/A/z+AAD0AcYCBgAAAEN1cHJ1bQAAAAAAAAAAAQAAAAAAAAACAAUGAAAACQAELwIAgAoAAAAAAAAAAAAAAJUAAAAAAAAAkAEFAAAAAQC3AX8D/P4AAPQBxgIGAAAAQ3VwcnVtAAAAAAAAAAAAAAAAAAAAAAIABQYAAAACAAQvAgCACgAAAAAAAAAAAAAAlQAAAAAAAACQAQUAAAABALUBfwP8/gAA9AHGAggAAABDdXJseiBNVAAAAAAAAAAAAAAAAAAAAAAEBAQEBQcCAgICAwAAAAAAAAAAAAAAAAAAAAEAACAAAAAAkAEFAA8HAQB8AcoCQv+kAAAAAAAOAAAARGFuY2luZyBTY3JpcHQAAAAAAQAAAAAAAAAAAAAAAwgIAAQFBwANAC8AAIALAABAAAAAAAAAAAABAAAAAAAAALwCBQACCgEA7gGYA+j+AABMAdACDgAAAERhbmNpbmcgU2NyaXB0AAAAAAAAAAAAAAAAAAAAAAMIBgAEBQcADQAvAACACwAAQAAAAAAAAAAAAQAAAAAAAACQAQUAAgoBANMBmAPo/gAATAHQAggAAABEYXVuUGVuaAAAAAAAAAAAAAAAAAAAAAABAQEBAQEBAQEBAwAAAAAAAAAAAAEAAAAAAAEAAAAAAAAAkAEFAAAAAQCEAaoCbf0eABYB1AEFAAAARGF2aWQAAAAAAAAAAAAAAAAAAAAAAg4FAgYEAQEBAQEIAAAAAAAAAAAAAAAAAAAgAAAAAAAgAJABBQAAAAEAjAHeAvf+AAAAAAAABQAAAERhdmlkAAAAAAEAAAAAAAAAAAAAAAIOCAIGBAEBAQEBCAAAAAAAAAAAAAAAAAAAIAAAAAAAIAC8AgUAAAABAKUB3gL3/gAAAAAAABEAAABEYXZpZCBUcmFuc3BhcmVudAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAgAAAAAAAAAAAAAAAAAACAAAAAAAAAAkAEFAAAAAQCXAZsD9v4AAAAAAAALAAAARGVqYVZ1IFNhbnMAAAAAAAAAAAAAAAAAAAAAAgsGAwMIBAICBP8uAOf//QDSKSAECgAAAAD/AQDgAAD/v5ABBQAAAAEA+gH3AhD/yAAAAAAACwAAAERlamFWdSBTYW5zAAAAAAEAAAAAAAAAAAAAAAILCAMDBgQCAgT/LgDn//UA0ikgBAoAAAAA/wEAYAAA/7+8AgUAAAABADwC9wIQ/8gAAAAAAAsAAABEZWphVnUgU2FucwAAAAABAAAAAQAAAAAAAAACCwgDAwMECwIE/w4A5//1AFIhIAQKAAAAAL8BAGAAAPefvAIFAAAAAQA8AvcCEP/IAAAAAAAVAAAARGVqYVZ1IFNhbnMgQ29uZGVuc2VkAAAAAAEAAAAAAAAAAAAAAAILCAYDBgQCAgT/LgDn//UA0ilgBAoAAAAA/wEAYAAACAC8AgQAAAABAAMC9wIQ/8gAAAAAABUAAABEZWphVnUgU2FucyBDb25kZW5zZWQAAAAAAQAAAAEAAAAAAAAAAgsIBgMDBAsCBP8OAOf/9QBSISAECgAAAAC/AQBgAAAAALwCBAAAAAEAAwL3AhD/yAAAAAAAFQAAAERlamFWdSBTYW5zIENvbmRlbnNlZAAAAAAAAAAAAQAAAAAAAAACCwYGAwMECwIE/w4A5//9AFIhIAQKAAAAAL8BAGAAAPffkAEEAAAAAQDIAfcCEP/IAAAAAAAVAAAARGVqYVZ1IFNhbnMgQ29uZGVuc2VkAAAAAAAAAAAAAAAAAAAAAAILBgYDCAQCAgT/LgDn//0A0ilgBAoAAAAA/wEAYAAA/9+QAQQAAAABAMgB9wIQ/8gAAAAAABEAAABEZWphVnUgU2FucyBMaWdodAAAAAAAAAAAAAAAAAAAAAACCwIDAwgEAgIE/yYA4HsAAFAgAAAIAAAAAJ8BAGAAANefyAAFAAAAAQD6AfcCEP8AAAAAAAAQAAAARGVqYVZ1IFNhbnMgTW9ubwAAAAABAAAAAAAAAAQAAAACCwcJAwYEAgIE/yIA5vvxANAoAAAAAAAAAN8BAGAAAAgAvAIFAAAAAQBaAvcCEP/IAAAAAAAQAAAARGVqYVZ1IFNhbnMgTW9ubwAAAAABAAAAAQAAAAQAAAACCwcJAwMECwIE/wIA5vtxAFAgAAAAAAAAAJ8BAGAAAAAAvAIFAAAAAQBaAvcCEP/IAAAAAAAQAAAARGVqYVZ1IFNhbnMgTW9ubwAAAAAAAAAAAQAAAAQAAAACCwYJAwMECwIE/wIA5vt5AFAgAAAAAAAAAJ8BAGAAANffkAEFAAAAAQBaAvcCEP/IAAAAAAAQAAAARGVqYVZ1IFNhbnMgTW9ubwAAAAAAAAAAAAAAAAQAAAACCwYJAwgEAgIE/yIA5vv5ANIoAAACAAAAAN8BAGAAAN/fkAEFAAAAAQBaAvcCEP/IAAAAAAALAAAARGVqYVZ1IFNhbnMAAAAAAAAAAAEAAAAAAAAAAgsGAwMDBAsCBP8OAOf//QBSISAECgAAAAC/AQBgAAD3n5ABBQAAAAEA+gH3AhD/yAAAAAAADAAAAERlamFWdSBTZXJpZgAAAAAAAAAAAAAAAAAAAAACBgYDBQYFAgIE/wIA5Pt5AFAgAAQIAAAAAJ8AAGAAANefkAEFAAAAAQAAAvcCEP/IAAAAAAAMAAAARGVqYVZ1IFNlcmlmAAAAAAEAAAAAAAAAAAAAAAIGCAMFBgUCAgT/AgDk+3EAUCAABAgAAAAAnwAAYAAA15+8AgUAAAABADUC9wIQ/8gAAAAAAAwAAABEZWphVnUgU2VyaWYAAAAAAQAAAAEAAAAAAAAAAgYIAwUDBQsCBP8CAOT7cQBQIAAECAAAAACfAABgAADXn7wCBQAAAAEANQL3AhD/yAAAAAAAFgAAAERlamFWdSBTZXJpZiBDb25kZW5zZWQAAAAAAQAAAAAAAAAAAAAAAgYIBgUGBQICBP8CAOT78QBSIAAECgAAAACfAABgAAAAALwCBAAAAAEA/QH3AhD/yAAAAAAAFgAAAERlamFWdSBTZXJpZiBDb25kZW5zZWQAAAAAAQAAAAEAAAAAAAAAAgYIBgUDBQsCBP8CAOT78QBSIAAECgAAAACfAABgAAAAALwCBAAAAAEA/QH3AhD/yAAAAAAAFgAAAERlamFWdSBTZXJpZiBDb25kZW5zZWQAAAAAAAAAAAEAAAAAAAAAAgYGBgUDBQsCBP8CAOT7+QBSIAAECgAAAACfAABgAADX35ABBAAAAAEAzAH3AhD/yAAAAAAAFgAAAERlamFWdSBTZXJpZiBDb25kZW5zZWQAAAAAAAAAAAAAAAAAAAAAAgYGBgUGBQICBP8CAOT7+QBSIAAECgAAAACfAABgAADX35ABBAAAAAEAzAH3AhD/yAAAAAAADAAAAERlamFWdSBTZXJpZgAAAAAAAAAAAQAAAAAAAAACBgYDBQMFCwIE/wIA5Pt5AFAgAAQIAAAAAJ8AAGAAANefkAEFAAAAAQAAAvcCEP/IAAAAAAAIAAAARGluZ2JhdHMAAAAAAAAAAAAAAAAAAAAAAgAFAwAAAAAAAAMAAIAAAAAAAAAAAAAAAAABAAAAAAAAAJABBQAAAAEAsAIzA3H/WgAAAAAACwAAAERpd2FuaSBCZW50AAAAAAAAAAAAAAAAAAAAAAIBBAAAAAAAAAAAYAAAAAAAgAgAAAAAAAAAQAAAAAAAAACQAQUAAAABAHEBCgbl/QAAAAAAAA0AAABEaXdhbmkgTGV0dGVyAAAAAAAAAAAAAAAAAAAAAAIBBAAAAAAAAAAAYAAAAAAAgAgAAAAAAAAAQAAAAAAAAACQAQUAAAABAGgB9AXl/QAAAAAAAAkAAABEb2tDaGFtcGEAAAAAAAAAAAAAAAAAAAAAAgsGBAICAgICBAMAAAMAAAAAAAAAAAAAAAABAAFAAAAAAJABBQAFCAEATQLQA/L+YQAuAtgCEAAAAEd1dHRtYW4gRHJvZ29saW4AAAAAAQAAAAAAAAAAAAAAAgEHAQEBAQEBAQAYAAAAAABAAAAAAAAAAAAgAAAAAAAAALwCBQAAAAEAhwHqArD+AAAAAAAAEAAAAEd1dHRtYW4gRHJvZ29saW4AAAAAAAAAAAAAAAAAAAAAAgEEAQEBAQEBAQAYAAAAAABAAAAAAAAAAAAgAAAAAAAAAJABBQAAAAEAfwHqArD+AAAAAAAACgAAAERyb2lkIFNhbnMAAAAAAQAAAAAAAAAAAAAAAgsIBgMIBAICBO8CAOBbIABAKAAAAAAAAACfAQAgAAAAALwCBQAAAAEAJAL9AhD/QAAhAskCCgAAAERyb2lkIFNhbnMAAAAAAAAAAAAAAAAAAAAAAgsGBgMIBAICBO8CAOBbIABAKAAAAAAAAACfAQAgAAAAAJABBQAAAAEABgL9AhD/QAAYAskCDwAAAERyb2lkIFNhbnMgTW9ubwAAAAAAAAAAAAAAAAQAAAACCwYJAwgEAgIE7wIA4FsgAEAoAAAAAAAAAJ8BACAAAAAAkAEFAAAAAQBYAv0CEP9AABgCyQILAAAARHJvaWQgU2VyaWYAAAAAAQAAAAAAAAAAAAAAAgIIAAYFAAICAO8CAOBbIABAKAAAAAAAAACfAQAgAAAAALwCBQAAAgEAQwIBAxD/PAAYAskCCwAAAERyb2lkIFNlcmlmAAAAAAEAAAABAAAAAAAAAAICCAAGBQAJAgDvAgDgWyAAQCgAAAAAAAAAnwEAIAAAAAC8AgUAAAIBAEQCAgMQ/zsAGALJAgsAAABEcm9pZCBTZXJpZgAAAAAAAAAAAQAAAAAAAAACAgYABgUACQIA7wIA4FsgAEAoAAAAAAAAAJ8BACAAAAAAkAEFAAACAQAjAgIDEP87ABgCyQILAAAARHJvaWQgU2VyaWYAAAAAAAAAAAAAAAAAAAAAAgIGAAYFAAICAO8CAOBbIABAKAAAAAAAAACfAQAgAAAAAJABBQAAAgEAKAICAxD/OwAYAskCEAAAAERlY29UeXBlIFRodWx1dGgAAAAAAAAAAAAAAAAAAAAAAgEAAAAAAAAAAABgAAAAAACACAAAAAAAAABAAAAAAAAAAJABBQAAAAEArAHiAwz+AAAAAAAADgAAAERlY29UeXBlIE5hc2toAAAAAAAAAAAAAAAAAAAAAAIBBAAAAAAAAAAAYAAAAAAAgAgAAAAAAAAAQAAAAAAAAACQAQUAAAABAJEB4gMM/gAAAAAAABYAAABEZWNvVHlwZSBOYXNraCBTcGVjaWFsAAAAAAAAAAAAAAAAAAAAAAIBAAAAAAAAAAAAYAAAAAAAgAgAAAAAAAAAQAAAAAAAAACQAQUAAAABAJQB4gMM/gAAAAAAABcAAABEZWNvVHlwZSBOYXNraCBWYXJpYW50cwAAAAAAAAAAAAAAAAAAAAACAQQAAAAAAAAAAGAAAAAAAIAIAAAAAAAAAEAAAAAAAAAAkAEFAAAAAQChAeIDDP4AAAAAAAAZAAAARGVjb1R5cGUgTmFza2ggRXh0ZW5zaW9ucwAAAAAAAAAAAAAAAAAAAAACAQQAAAAAAAAAAGAAAAAAAIAIAAAAAAAAAEAAAAAAAAAAkAEFAAAAAQDRAeIDDP4AAAAAAAAWAAAARGVjb1R5cGUgTmFza2ggU3dhc2hlcwAAAAAAAAAAAAAAAAAAAAACAQQAAAAAAAAAAGAAAAAAAIAIAAAAAAAAAEAAAAAAAAAAkAEFAAAAAQCQAeIDDP4AAAAAAAAVAAAARGl3YW5pIE91dGxpbmUgU2hhZGVkAAAAAAAAAAAAAAAAAAAAAAIBBAAAAAAAAAAAYAAAAAAAgAgAAAAAAAAAQAAAAAAAAACQAQUAAAABAJgBNgaJ/QAAAAAAABcAAABEaXdhbmkgU2ltcGxlIE91dGxpbmUgMgAAAAAAAAAAAAAAAAAAAAACAQQAAAAAAAAAAGAAAAAAAIAIAAAAAAAAAEAAAAAAAAAAkAEFAAAAAQB4ATYG1/0AAAAAAAAVAAAARGl3YW5pIFNpbXBsZSBPdXRsaW5lAAAAAAAAAAAAAAAAAAAAAAIBBAAAAAAAAAAAYAAAAAAAgAgAAAAAAAAAQAAAAAAAAACQAQUAAAABAHgBHAbU/QAAAAAAABUAAABEaXdhbmkgU2ltcGxlIFN0cmlwZWQAAAAAAAAAAAAAAAAAAAAAAgEEAAAAAAAAAABgAAAAAACACAAAAAAAAABAAAAAAAAAAJABBQAAAAEAcQEtBuX9AAAAAAAABgAAAEVicmltYQAAAAAAAAAAAAAAAAAAAAACAAAAAAAAAAAAX1AAoEEAAAIACAAABAQAAJMAAAAAAAAAkAEFAAUIAQBcAtgCLv+DAPQBvAIGAAAARWJyaW1hAAAAAAEAAAAAAAAAAAAAAAIAAAAAAAAAAABfUACgQQAAAgAIAAAEBAAAkwAAAAAAAAC8AgUABQgBAI4C5AIb/zkA9AG8AggAAABFbGVwaGFudAAAAAAAAAAAAAAAAAAAAAACAgkECQUFAgMDAwAAAAAAAAAAAAAAAAAAAAEAACAAAAAAkAEFAAAAAQDoAcID9/4AAAAAAAAIAAAARWxlcGhhbnQAAAAAAAAAAAEAAAAAAAAAAgIJBwkJBQkJBAMAAAAAAAAAAAAAAAAAAAABAAAgAAAAAJABBQAAAAEA7wHHA/j+AAAAAAAADAAAAEVuZ3JhdmVycyBNVAAAAAAAAAAAAAAAAAAAAAACCQcHCAUFAgMEAwAAAAAAAAAAAAAAAAAAAAEAACAAAAAA9AEHAAEDAQAXA7cC8/9oAQAAAAANAAAARXJhcyBCb2xkIElUQwAAAAAAAAAAAAAAAAAAAAACCwkHAwUEAgIEAwAAAAAAAAAAAAAAAAAAAAEAACAAAAAAkAEFAAQIAQD7AbgCE/8AAAAAAAANAAAARXJhcyBEZW1pIElUQwAAAAAAAAAAAAAAAAAAAAACCwgFAwUEAggEAwAAAAAAAAAAAAAAAAAAAAEAACAAAAAAkAEFAAQIAQDaAa0CFP8AAAAAAAAOAAAARXJhcyBMaWdodCBJVEMAAAAAAAAAAAAAAAAAAAAAAgsEAgMFBAIIBAMAAAAAAAAAAAAAAAAAAAABAAAgAAAAAJABBQAECAEAnwGpAhT/AAAAAAAADwAAAEVyYXMgTWVkaXVtIElUQwAAAAAAAAAAAAAAAAAAAAACCwYCAwUEAggEAwAAAAAAAAAAAAAAAAAAAAEAACAAAAAAkAEFAAUIAQC7Aa0CFP8AAAAAAAARAAAARXN0cmFuZ2VsbyBFZGVzc2EAAAAAAAAAAAAAAAAAAAAAAwgGAAAAAAAAAEMgAIAAAAAAgAAAAAAAAAABAAAAAAAAAJABBQAAAAEA9QG8AtX+AACQAXcCCAAAAEV1cGhlbWlhAAAAAAAAAAAAAAAAAAAAAAILBQMEAQICAQRvAACASgAAAAAgAAAAAAAAAQAAAAAAAACQAQUABggBALoC/QIj/1EADwL9Ag0AAABGZWxpeCBUaXRsaW5nAAAAAAAAAAAAAAAAAAAAAAQGBQUGAgICCgQDAAAAAAAAAAAAAAAAAAAAAQAAIAAAAACQAQUAAgEBAEwCzwIAAF4BAAAAABAAAABGbGVtaXNoU2NyaXB0IEJUAAAAAAAAAAAAAAAAAAAAAAMDBgIFBQcPCgUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACQAQUAAwoBAA4B9wIQ/8gAAAAAAAUAAABGb3J0ZQAAAAAAAAAAAAAAAAAAAAADBgkCBAUCBwIDAwAAAAAAAAAAAAAAAAAAAAEAACAAAAAAkAEFAAYKAQCqAaACK/+3AAAAAAAUAAAARnJhbmtsaW4gR290aGljIEJvb2sAAAAAAAAAAAAAAAAAAAAAAgsFAwIBAgICBIcCAAAAAAAAAAAAAAAAAACfAAAgAADX35ABBQAGCAEApQG8AkP/swAAAAAAFAAAAEZyYW5rbGluIEdvdGhpYyBCb29rAAAAAAAAAAABAAAAAAAAAAILBQMCAQIJAgSHAgAAAAAAAAAAAAAAAAAAnwAAIAAA19+QAQUABggBAKcBvAJD/7MAAAAAABQAAABGcmFua2xpbiBHb3RoaWMgRGVtaQAAAAAAAAAAAAAAAAAAAAACCwcDAgECAgIEhwIAAAAAAAAAAAAAAAAAAJ8AACAAANffkAEFAAYIAQC2AbwCQ/+zAAAAAAAZAAAARnJhbmtsaW4gR290aGljIERlbWkgQ29uZAAAAAAAAAAAAAAAAAAAAAACCwcGAwQCAgIEhwIAAAAAAAAAAAAAAAAAAJ8AACAAANffkAEDAAYIAQB3AbwCQ/+zAAAAAAAUAAAARnJhbmtsaW4gR290aGljIERlbWkAAAAAAAAAAAEAAAAAAAAAAgsHAwIBAgkCBIcCAAAAAAAAAAAAAAAAAACfAAAgAADX35ABBQAGCAEAtQG8AkP/swAAAAAAFQAAAEZyYW5rbGluIEdvdGhpYyBIZWF2eQAAAAAAAAAAAAAAAAAAAAACCwkDAgECAgIEhwIAAAAAAAAAAAAAAAAAAJ8AACAAANffkAEFAAYIAQDZAbwCQ/+zAAAAAAAVAAAARnJhbmtsaW4gR290aGljIEhlYXZ5AAAAAAAAAAABAAAAAAAAAAILCQMCAQIJAgSHAgAAAAAAAAAAAAAAAAAAnwAAIAAA19+QAQUABggBANUBvAJD/7MAAAAAABYAAABGcmFua2xpbiBHb3RoaWMgTWVkaXVtAAAAAAAAAAAAAAAAAAAAAAILBgMCAQICAgSHAgAAAAAAAAAAAAAAAAAAnwAAIAAA19+QAQUABggBAKwBvAJD/7MAAAAAABsAAABGcmFua2xpbiBHb3RoaWMgTWVkaXVtIENvbmQAAAAAAAAAAAAAAAAAAAAAAgsGBgMEAgICBIcCAAAAAAAAAAAAAAAAAACfAAAgAADX35ABAwAGCAEAaAG8AkP/swAAAAAAFgAAAEZyYW5rbGluIEdvdGhpYyBNZWRpdW0AAAAAAAAAAAEAAAAAAAAAAgsGAwIBAgkCBIcCAAAAAAAAAAAAAAAAAACfAAAgAADX35ABBQAGCAEAqwG8AkP/swAAAAAACgAAAEZyYW5rUnVlaGwAAAAAAAAAAAAAAAAAAAAAAg4FAwYBAQEBAQEIAAAAAAAAAAAAAAAAAAAgAAAAAAAgAJABBQAAAAEAigHeAvf+AAAAAAAADQAAAEd1dHRtYW4gRnJhbmsAAAAAAQAAAAAAAAAAAAAAAgEHAQEBAQEBAQAYAAAAAABAAAAAAAAAAAAgAAAAAAAAALwCBQAAAAEAegHqArD+AAAAAAAAEAAAAEZyZWVzdHlsZSBTY3JpcHQAAAAAAAAAAAAAAAAAAAAAAwgEAgMCBQsEBAMAAAAAAAAAAAAAAAAAAAABAAAgAAAAAJABBQAECgEAAgGqAsP+AAAAAAAADQAAAEd1dHRtYW4gRnJuZXcAAAAAAAAAAAAAAAAAAAAAAgEEAQEBAQEBAQAYAAAAAABAAAAAAAAAAAAgAAAAAAAAAJABBQAAAAEAbQHqArD+AAAAAAAAEAAAAEZyZW5jaCBTY3JpcHQgTVQAAAAAAAAAAAAAAAAAAAAAAwIEAgQGBwQGBQMAAAAAAAAAAAAAAAAAAAABAAAgAAAAAJABBQADCgEAFwE+AtX+wwAAAAAAEQAAAEZhcnNpIFNpbXBsZSBCb2xkAAAAAAAAAAAAAAAAAAAAAAIBBAAAAAAAAAAAYAAAAAAAgAgAAAAAAAAAQAAAAAAAAACQAQUAAAABAMABOAWF/AAAAAAAABQAAABGYXJzaSBTaW1wbGUgT3V0bGluZQAAAAAAAAAAAAAAAAAAAAACAQQAAAAAAAAAAGAAAAAAAIAIAAAAAAAAAEAAAAAAAAAAkAEFAAAAAQDYAUAFfvwAAAAAAAASAAAARm9vdGxpZ2h0IE1UIExpZ2h0AAAAAAAAAAAAAAAAAAAAAAIEBgIGAwoCAwQDAAAAAAAAAAAAAAAAAAAAAQAAIAAAAAAsAQUAAwEBAJsBswIh/2b/AAAAAAcAAABGWlNodVRpAAAAAAAAAAAAAAAAAAAAAAIBBgEDAQEBAQEDAAAAAAAOCAAAAAAAAAAAAAAEAAAAAACQAQQAAAABAPQBjgNw/5AAAAAAAAcAAABGWllhb1RpAAAAAAAAAAAAAAAAAAAAAAIBBgEDAQEBAQEDAAAAAAAOCAAAAAAAAAAAAAAEAAAAAACQAQQAAAABAPQB3ANs/5QAAAAAAAgAAABHYWJyaW9sYQAAAAAAAAAAAAAAAAAAAAAEBAYFBRACAg0C7wIA4EsgAFAAAAAAAAAAAJ8AACAAAAAAkAEFAAAAAQDsAasCxP67AlcBLgIGAAAAR2FkdWdpAAAAAAAAAAAAAAAAAAAAAAILBQIEAgQCAgMDAAAAAAAAAAAwAAAAAAAAAQAAAAAAAACQAQUABQgBADQC2AIu/4MA9AG8AgYAAABHYWR1Z2kAAAAAAQAAAAAAAAAAAAAAAgsIAgQCBAICAwMAAAAAAAAAADAAAAAAAAABAAAAAAAAALwCBQAFCAEArgLYAi7/gwD0AbwCDwAAAEd1dHRtYW4gQWhhcm9uaQAAAAAAAAAAAAAAAAAAAAACAQQBAQEBAQEBABgAAAAAAEAAAAAAAAAAACAAAAAAAAAAkAEFAAAAAQCPAeoCUAEAAAAAAAAIAAAAR2FyYW1vbmQAAAAAAAAAAAAAAAAAAAAAAgIEBAMDAQEIA4cCAAAAAAAAAAAAAAAAAACfAAAAAADX35ABBQACAQEAgwGNAvn+mAAAAAAACAAAAEdhcmFtb25kAAAAAAEAAAAAAAAAAAAAAAICCAQDAwcBCAOHAgAAAAAAAAAAAAAAAAAAnwAAAAAA19+8AgUAAgEBAKYBjQL5/pgAAAAAAAgAAABHYXJhbW9uZAAAAAAAAAAAAQAAAAAAAAACAgQEAwMBAQgDhwIAAAAAAAAAAAAAAAAAAJ8AACAAANffkAEFAAIBAQBEAY0C+f6YAAAAAAAHAAAAR2F1dGFtaQAAAAAAAAAAAAAAAAAAAAACCwUCBAIEAgIDAwAgAAAAAAAAAAAAAAAAAAEAAAAAAAAAkAEFAAAAAQA5ApsD1PypAN4BlAIHAAAAR2F1dGFtaQAAAAABAAAAAAAAAAAAAAACCwgCBAIEAgIDAwAgAAAAAAAAAAAAAAAAAAEAAAAAAAAAvAIFAAAAAQA9ApsD1PypAN4BlAINAAAAR2VudGl1bSBCYXNpYwAAAAABAAAAAAAAAAAAAAACAAUDBgAAAgAEfwAAoEogAEAAAAAAAAAAABMAACAAAAAAvAIFAAAAAQARAmoD5f4AAMYBZwINAAAAR2VudGl1bSBCYXNpYwAAAAABAAAAAQAAAAAAAAACAAYGCAAAAgAEfwAAoEogAEAAAAAAAAAAABMAACAAAAAAvAIFAAAAAQDlAWoD5f4AAMYBZwINAAAAR2VudGl1bSBCYXNpYwAAAAAAAAAAAQAAAAAAAAACAAYGCAAAAgAEfwAAoEogAEAAAAAAAAAAABMAACAAAAAAkAEFAAAAAQDIAWoD5f4AAMYBZwINAAAAR2VudGl1bSBCYXNpYwAAAAAAAAAAAAAAAAAAAAACAAUDBgAAAgAEfwAAoEogAEAAAAAAAAAAABMAACAAAAAAkAEFAAAAAQD0AWoD5f4AAMYBZwISAAAAR2VudGl1bSBCb29rIEJhc2ljAAAAAAEAAAAAAAAAAAAAAAIABQMGAAACAAR/AACgSiAAQAAAAAAAAAAAEwAAIAAAAAC8AgUAAAABABoCagPl/gAAxgFnAhIAAABHZW50aXVtIEJvb2sgQmFzaWMAAAAAAQAAAAEAAAAAAAAAAgAGBggAAAIABH8AAKBKIABAAAAAAAAAAAATAAAgAAAAALwCBQAAAAEA7wFqA+X+AADGAWcCEgAAAEdlbnRpdW0gQm9vayBCYXNpYwAAAAAAAAAAAQAAAAAAAAACAAYGCAAAAgAEfwAAoEogAEAAAAAAAAAAABMAACAAAAAAkAEFAAAAAQDSAWoD5f4AAMYBZwISAAAAR2VudGl1bSBCb29rIEJhc2ljAAAAAAAAAAAAAAAAAAAAAAIABQMGAAACAAR/AACgSiAAQAAAAAAAAAAAEwAAIAAAAACQAQUAAAABAP4BagPl/gAAxgFnAgcAAABHZW9yZ2lhAAAAAAAAAAAAAAAAAAAAAAIEBQIFBAUCAwOHAgAAAAAAAAAAAAAAAAAAnwAAIAAAAACQAQUAAwQBALcB9AIo/2AA4QG0AgcAAABHZW9yZ2lhAAAAAAEAAAAAAAAAAAAAAAIECAIFBAUCAgOHAgAAAAAAAAAAAAAAAAAAnwAAIAAAAAC8AgUAAwQBAAEC9AIo/2AA5AG0AgcAAABHZW9yZ2lhAAAAAAAAAAABAAAAAAAAAAIEBQIFBAUJAwOHAgAAAAAAAAAAAAAAAAAAnwAAIAAAAACQAQUAAwQBAMEB9AIo/2AA6AG0AgcAAABHZW9yZ2lhAAAAAAEAAAABAAAAAAAAAAIECAIFBAUJAgOHAgAAAAAAAAAAAAAAAAAAnwAAIAAAAAC8AgUAAwQBAAsC9AIo/2AA7wG0Ag0AAABHdXR0bWFuIEZyYW5rAAAAAAAAAAAAAAAAAAAAAAIBBAEBAQEBAQEAGAAAAAAAQAAAAAAAAAAAIAAAAAAAAACQAQUAAAABAHsB6gKw/gAAAAAAAAwAAABHdXR0bWFuIEhhaW0AAAAAAAAAAAAAAAAAAAAAAgEEAQEBAQEBAQAYAAAAAABAAAAAAAAAAAAgAAAAAAAAAJABBQAAAAEAlgHqArD+AAAAAAAAFgAAAEd1dHRtYW4gSGFpbS1Db25kZW5zZWQAAAAAAAAAAAAAAAAAAAAAAgEEAQEBAQEBAQAYAAAAAABAAAAAAAAAAAAgAAAAAAAAAJABBQAAAAEATwHqArD+AAAAAAAABAAAAEdpZ2kAAAAAAAAAAAAAAAAAAAAABAQFBAYQBwINAgMAAAAAAAAAAAAAAAAAAAABAAAgAAAAAJABBQAPCgEAigEbA3z+AAAAAAAADAAAAEdpbGwgU2FucyBNVAAAAAABAAAAAQAAAAAAAAACCwgCAgEECQIDAwAAAAAAAAAAAAAAAAAAAAMAACAAAAAAvAIFAAIIAQC3AbICG/+UAAAAAAAMAAAAR2lsbCBTYW5zIE1UAAAAAAEAAAAAAAAAAAAAAAILCAICAQQCAgMDAAAAAAAAAAAAAAAAAAAAAwAAIAAAAAC8AgUAAggBANIBsgIb/5QAAAAAABYAAABHaWxsIFNhbnMgTVQgQ29uZGVuc2VkAAAAAAAAAAAAAAAAAAAAAAILBQYCAQQCAgMDAAAAAAAAAAAAAAAAAAAAAwAAIAAAAACQAQMAAggBADABswIL/4QAAAAAAAwAAABHaWxsIFNhbnMgTVQAAAAAAAAAAAEAAAAAAAAAAgsFAgIBBAkCAwMAAAAAAAAAAAAAAAAAAAADAAAgAAAAAJABBQACCAEAdwGyAhv/lAAAAAAAHgAAAEdpbGwgU2FucyBVbHRyYSBCb2xkIENvbmRlbnNlZAAAAAAAAAAAAAAAAAAAAAACCwoGAgEEAgIDAwAAAAAAAAAAAAAAAAAAAAMAAAAAAAAAkAEDAAIIAQC9AfECXP+XAAAAAAAUAAAAR2lsbCBTYW5zIFVsdHJhIEJvbGQAAAAAAAAAAAAAAAAAAAAAAgsKAgIBBAICAwMAAAAAAAAAAAAAAAAAAAADAAAgAAAAAJABBQACCAEAdQL0Alv/kwAAAAAADAAAAEdpbGwgU2FucyBNVAAAAAAAAAAAAAAAAAAAAAACCwUCAgEEAgIDAwAAAAAAAAAAAAAAAAAAAAMAACAAAAAAkAEFAAIIAQCXAbICG/+UAAAAAAAFAAAAR2lzaGEAAAAAAAAAAAAAAAAAAAAAAgsFAgQCBAICAwcIAIBCAABAAAAAAAAAAAAhAAAAAAAAAJABBQAFCAEA/gHuAhX/UwD0AbwCBQAAAEdpc2hhAAAAAAEAAAAAAAAAAAAAAAILCAIEAgQCAgMHCACAQgAAQAAAAAAAAAAAIQAAAAAAAAC8AgUABQgBACYC7wIW/1MA9AG8AgsAAABHdXR0bWFuIEthdgAAAAABAAAAAAAAAAAAAAACAQcBAQEBAQEBABgAAAAAAEAAAAAAAAAAACAAAAAAAAAAvAIFAAAAAQCNAeoCsP4AAAAAAAARAAAAR3V0dG1hbiBLYXYtTGlnaHQAAAAAAAAAAAAAAAAAAAAAAgEEAQEBAQEBAQAYAAAAAABAAAAAAAAAAAAgAAAAAAAAAJABBQAAAAEAdAHqArD+AAAAAAAACwAAAEd1dHRtYW4gS2F2AAAAAAAAAAAAAAAAAAAAAAIBBAEBAQEBAQEAGAAAAAAAQAAAAAAAAAAAIAAAAAAAAACQAQUAAAABAI8B6gKw/gAAAAAAAB0AAABHbG91Y2VzdGVyIE1UIEV4dHJhIENvbmRlbnNlZAAAAAAAAAAAAAAAAAAAAAACAwgIAgYBAQEBAwAAAAAAAAAAAAAAAAAAAAEAACAAAAAAkAECAAUEAQAUAQEDYP+MAAAAAAAfAAAAR2lsbCBTYW5zIE1UIEV4dCBDb25kZW5zZWQgQm9sZAAAAAAAAAAAAAAAAAAAAAACCwkCAgEEAgIDAwAAAAAAAAAAAAAAAAAAAAMAACAAAAAAkAECAAIIAQDlACIDjP+WAAAAAAAPAAAAR3V0dG1hbiBNeWFtZml4AAAAAAAAAAAAAAAABAAAAAIBBAkBAQEBAQEAGAAAAAAAQAAAAAAAAAAAIAAAAAAAAACQAQUAAAABAK0B5AOG/gAAAAAAAAsAAABHT1NUIHR5cGUgQQAAAAAAAAAAAAAAAAAAAAACCwUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAkAEFAAAAAQBcAa8CJv8AAAAAAAALAAAAR09TVCB0eXBlIEIAAAAAAAAAAAAAAAAAAAAAAgsFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAJABBQAAAAEAsgGyAjP/AAAAAAAADgAAAENlbnR1cnkgR290aGljAAAAAAAAAAAAAAAAAAAAAAILBQICAgICAgSHAgAAAAAAAAAAAAAAAAAAnwAAIAAA19+QAQUABAIBAOUB7gIw/28AAAAAAA4AAABDZW50dXJ5IEdvdGhpYwAAAAABAAAAAAAAAAAAAAACCwcCAgICAgIEhwIAAAAAAAAAAAAAAAAAAJ8AACAAANffvAIFAAQCAQDlAe4CMP9vAAAAAAAOAAAAQ2VudHVyeSBHb3RoaWMAAAAAAQAAAAEAAAAAAAAAAgsGAgICAgkCBIcCAAAAAAAAAAAAAAAAAACfAAAgAADX37wCBQAEAgEA5QHuAjD/bwAAAAAADgAAAENlbnR1cnkgR290aGljAAAAAAAAAAABAAAAAAAAAAILBQICAgIJAgSHAgAAAAAAAAAAAAAAAAAAnwAAIAAA19+QAQUABAIBAOUB7gIw/28AAAAAAA8AAABHb3VkeSBPbGQgU3R5bGUAAAAAAAAAAAAAAAAAAAAAAgIFAgUDBQIDAwMAAAAAAAAAAAAAAAAAAAABAAAgAAAAAJABBgADAQEAiQF+AxP/RAAAAAAADwAAAEdvdWR5IE9sZCBTdHlsZQAAAAABAAAAAAAAAAAAAAACAgYCBgMFAgMDAwAAAAAAAAAAAAAAAAAAAAEAACAAAAAAvAIGAAMBAQCUAX4DE/9EAAAAAAAPAAAAR291ZHkgT2xkIFN0eWxlAAAAAAAAAAABAAAAAAAAAAICBQIFAwUJAwMDAAAAAAAAAAAAAAAAAAAAAQAAIAAAAACQAQUAAwEBAF4BfgMT/0QAAAAAAAsAAABHb3VkeSBTdG91dAAAAAAAAAAAAAAAAAAAAAACAgkEBwMLAgQBAwAAAAAAAAAAAAAAAAAAAAEAACAAAAAAkAEFAAAAAQBVBOkC7v8AAAAAAAAFAAAAR3VsaW0AAAAAAAAAAAAAAAAAAAAAAgsGAAABAQEBAa8CALD7fNdpMAAAAAAAAACfAAhAAADX35ABBQAFCAEA9AFaA3P/lAAAAAAACAAAAEd1bGltQ2hlAQAAAAAAAAAAAAAABAAAAAILBgkAAQEBAQGvAgCw+3zXaTAAAAAAAAAAnwAIQAAA19+QAQUABQgBAPQBWgNz/5QAAAAAAAUAAABEb3R1bQIAAAAAAAAAAAAAAAAAAAACCwYAAAEBAQEBrwIAsPt812kwAAAAAAAAAJ8ACEAAANffkAEFAAUIAQD0AVoDc/+UAAAAAAAIAAAARG90dW1DaGUDAAAAAAAAAAAAAAAEAAAAAgsGCQABAQEBAa8CALD7fNdpMAAAAAAAAACfAAhAAADX35ABBQAFCAEA9AFaA3P/lAAAAAAAEQAAAEd1dHRtYW4gWWFkLUJydXNoAAAAAAAAAAAAAAAAAAAAAAIBBAEBAQEBAQEAGAAAAAAAQAAAAAAAAAAAIAAAAAAAAACQAQUAAAABALYB6gKx/gAAAAAAAAsAAABHdXR0bWFuIFlhZAAAAAAAAAAAAAAAAAAAAAACAQQBAQEBAQEBABgAAAAAAEAAAAAAAAAAACAAAAAAAAAAkAEFAAAAAQCTAeoCsf4AAAAAAAARAAAAR3V0dG1hbiBZYWQtTGlnaHQAAAAAAAAAAAAAAAAAAAAAAgEEAQEBAQEBAQAYAAAAAABAAAAAAAAAAAAgAAAAAAAAAJABBQAAAAEAlQHqArD+AAAAAAAAEAAAAEhZR3JhcGhpYy1NZWRpdW0AAAAAAAAAAAAAAAAAAAAAAgMGAAABAQEBAacCAJD5fNcBEAAAAAAAAAAAAAgAAAAAAJABBQAFAQEA9AFaA3P/lAAAAAAADQAAAEhZR3VuZ1NvLUJvbGQAAAAAAAAAAAAAAAAAAAAAAgMGAAABAQEBAacCAJD5fNcBEAAAAAAAAAAAAAgAAAAAAJABBQAFAQEA9AFaA3P/lAAAAAAADgAAAEhZR290aGljLUV4dHJhAAAAAAAAAAAAAAAAAAAAAAIDBgAAAQEBAQGnAgCQ+XzXKRAAAAAAAAAAAAAIAAAAAACQAQUABQEBAPQBWgNz/5QAAAAAAA8AAABIWUdvdGhpYy1NZWRpdW0AAAAAAAAAAAAAAAAAAAAAAgMGAAABAQEBAacCAJD5fNcpEAAAAAAAAAAAAAgAAAAAAJABBQAFAQEA9AFaA3P/lAAAAAAAEQAAAEhZSGVhZExpbmUtTWVkaXVtAAAAAAAAAAAAAAAAAAAAAAIDBgAAAQEBAQGnAgCQ+XzXARAAAAAAAAAAAAAIAAAAAACQAQUABQEBAPQBWgNz/5QAAAAAABAAAABIWU15ZW9uZ0pvLUV4dHJhAAAAAAAAAAAAAAAAAAAAAAIDBgAAAQEBAQGnAgCQ+XzXKRAAAAAAAAAAAAAIAAAAAACQAQUABQEBAPQBWgNz/5QAAAAAABQAAABIWVNpbk15ZW9uZ0pvLU1lZGl1bQAAAAAAAAAAAAAAAAAAAAACAwYAAAEBAQEBpwIAkPl81ykQAAAAAAAAAAAACAAAAAAAkAEFAAUBAQD0AVoDc/+UAAAAAAAOAAAASFlQTW9rR2FrLUJvbGQAAAAAAAAAAAAAAAAAAAAAAgMGAAABAQEBAacCAJD5fNcBEAAAAAAAAAAAAAgAAAAAAJABBQAFAQEA9AFaA3P/lAAAAAAADAAAAEhZUG9zdC1MaWdodAAAAAAAAAAAAAAAAAAAAAACAwYAAAEBAQEBpwIAkPl81wEQAAAAAAAAAAAACAAAAAAAkAEFAAUBAQD0AVoDc/+UAAAAAAANAAAASFlQb3N0LU1lZGl1bQAAAAAAAAAAAAAAAAAAAAACAwYAAAEBAQEBpwIAkPl81wEQAAAAAAAAAAAACAAAAAAAkAEFAAUBAQD0AVoDc/+UAAAAAAATAAAASFlTaG9ydFNhbXVsLU1lZGl1bQAAAAAAAAAAAAAAAAAAAAACAwYAAAEBAQEBpwIAkPl81wEQAAAAAAAAAAAACAAAAAAAkAEFAAUBAQD0AVoDc/+UAAAAAAATAAAASGFybG93IFNvbGlkIEl0YWxpYwAAAAAAAAAAAQAAAAAAAAAEAwYEAg8CAg0CAwAAAAAAAAAAAAAAAAAAAAEAACAAAAAAkAEGAAAAAQB9AWoDfP4AAAAAAAAKAAAASGFycmluZ3RvbgAAAAAAAAAAAAAAAAAAAAAEBAUFBQoCAgcCAwAAAAAAAAAAAAAAAAAAAAEAACAAAAAAkAEFAA8HAQCyAbEDGv8AAAAAAAAQAAAASGFldHRlbnNjaHdlaWxlcgAAAAAAAAAAAAAAAAAAAAACCwcGBAkCBgIEhwIAAAAAAAAAAAAAAAAAAJ8AACAAANffkAEFAAUIAQA3AbwCeABCAAAAAAARAAAATW9ub3R5cGUgSGFkYXNzYWgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACAAAAAAJABBQAAAAEA9gFYAyz/AAAAAAAAEQAAAE1vbm90eXBlIEhhZGFzc2FoAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAgAAAAAC8AgUAAAABAAQCWAMs/wAAAAAAAAkAAABIR0dvdGhpY0UAAAAAAAAAAAAAAAAEAAAAAgsJCQAAAAAAAP8CAOD7/cdqEgAAAAAAAACfAAJAAADX35ABBQABCAEA9AFbA3T/AAAyAg0DCgAAAEhHUEdvdGhpY0UBAAAAAAAAAAAAAAAAAAAAAgsJAAAAAAAAAP8CAOD7/cdqEgAAAAAAAACfAAJAAADX35ABBQABCAEA9AFbA3T/AAAyAg0DCgAAAEhHU0dvdGhpY0UCAAAAAAAAAAAAAAAAAAAAAgsJAAAAAAAAAP8CAOD7/cdqEgAAAAAAAACfAAJAAADX35ABBQABCAEA9AFbA3T/AAAyAg0DCQAAAEhHR290aGljTQAAAAAAAAAAAAAAAAAAAAACCwYJAAAAAAAAgQIAgPhsxygQAAAAAAAAAAAAAgAAAAAAkAEFAAEIAQD0AVsDdP8AAAAAAAAKAAAASEdQR290aGljTQEAAAAAAAAAAAAAAAAAAAACCwYAAAAAAAAAgQIAgPhsxygQAAAAAAAAAAAAAgAAAAAAkAEFAAEIAQD0AVsDdP8AAAAAAAAKAAAASEdTR290aGljTQIAAAAAAAAAAAAAAAAAAAACCwYAAAAAAAAAgQIAgPhsxygQAAAAAAAAAAAAAgAAAAAAkAEFAAEIAQD0AVsDdP8AAAAAAAALAAAASEdHeW9zaG90YWkAAAAAAAAAAAAAAAAAAAAAAwAGCQAAAAAAAIECAID4bMcoEAAAAAAAAAAAAAIAAAAAAJABBQAGCgEA9AFbA3T/AAAAAAAADAAAAEhHUEd5b3Nob3RhaQEAAAAAAAAAAAAAAAAAAAADAAYAAAAAAAAAgQIAgPhsxygQAAAAAAAAAAAAAgAAAAAAkAEFAAYKAQD0AVsDdP8AAAAAAAAMAAAASEdTR3lvc2hvdGFpAgAAAAAAAAAAAAAAAAAAAAMABgAAAAAAAACBAgCA+GzHKBAAAAAAAAAAAAACAAAAAACQAQUABgoBAPQBWwN0/wAAAAAAAA0AAABIR0t5b2thc2hvdGFpAAAAAAAAAAAAAAAAAAAAAAICBgkAAAAAAACBAgCA+GzHKBAAAAAAAAAAAAACAAAAAACQAQUACAEBAPQBWwN0/wAAAAAAAA4AAABIR1BLeW9rYXNob3RhaQEAAAAAAAAAAAAAAAAAAAACAgYAAAAAAAAAgQIAgPhsxygQAAAAAAAAAAAAAgAAAAAAkAEFAAgBAQD0AVsDdP8AAAAAAAAOAAAASEdTS3lva2FzaG90YWkCAAAAAAAAAAAAAAAAAAAAAgIGAAAAAAAAAIECAID4bMcoEAAAAAAAAAAAAAIAAAAAAJABBQAIAQEA9AFbA3T/AAAAAAAACQAAAEhHTWluY2hvQgAAAAAAAAAAAAAAAAAAAAACAggJAAAAAAAAgQIAgPhsxygQAAAAAAAAAAAAAgAAAAAAkAEFAAUBAQD0AVsDdP8AAAAAAAAKAAAASEdQTWluY2hvQgEAAAAAAAAAAAAAAAAAAAACAggAAAAAAAAAgQIAgPhsxygQAAAAAAAAAAAAAgAAAAAAkAEFAAUBAQD0AVsDdP8AAAAAAAAKAAAASEdTTWluY2hvQgIAAAAAAAAAAAAAAAAAAAACAggAAAAAAAAAgQIAgPhsxygQAAAAAAAAAAAAAgAAAAAAkAEFAAUBAQD0AVsDdP8AAAAAAAAJAAAASEdNaW5jaG9FAAAAAAAAAAAAAAAABAAAAAICCQkAAAAAAAD/AgDg+/3HahIAAAAAAAAAnwACQAAA19+QAQUABQEBAPQBWwN0/wAA8AHeAgoAAABIR1BNaW5jaG9FAQAAAAAAAAAAAAAAAAAAAAICCQAAAAAAAAD/AgDg+/3HahIAAAAAAAAAnwACQAAA19+QAQUABQEBAPQBWwN0/wAA7AHWAgoAAABIR1NNaW5jaG9FAgAAAAAAAAAAAAAAAAAAAAICCQAAAAAAAAD/AgDg+/3HahIAAAAAAAAAnwACQAAA19+QAQUABQEBAPQBWwN0/wAA7AHWAhAAAABIR1NvZWlLYWt1cG9wdGFpAAAAAAAAAAAAAAAABAAAAAQLCgkAAAAAAAD/AgDg+/3HahIAAAAAAAAAnwACQAAA19+QAQUAAwkBAPQBWwN0/wAAJgIgAxEAAABIR1BTb2VpS2FrdXBvcHRhaQEAAAAAAAAAAAAAAAAAAAAECwoAAAAAAAAA/wIA4Pv9x2oSAAAAAAAAAJ8AAkAAANffkAEFAAMJAQD0AVsDdP8AAE0CKAMRAAAASEdTU29laUtha3Vwb3B0YWkCAAAAAAAAAAAAAAAAAAAABAsKAAAAAAAAAP8CAOD7/cdqEgAAAAAAAACfAAJAAADX35ABBQADCQEA9AFbA3T/AABNAigDEAAAAEhHU29laVByZXNlbmNlRUIAAAAAAAAAAAAAAAAAAAAAAgIICQAAAAAAAIECAID4bMcoEAAAAAAAAAAAAAIAAAAAAJABBQAFAQEA9AFbA3T/AAAAAAAAEQAAAEhHUFNvZWlQcmVzZW5jZUVCAQAAAAAAAAAAAAAAAAAAAAICCAAAAAAAAACBAgCA+GzHKBAAAAAAAAAAAAACAAAAAACQAQUABQEBAPQBWwN0/wAAAAAAABEAAABIR1NTb2VpUHJlc2VuY2VFQgIAAAAAAAAAAAAAAAAAAAACAggAAAAAAAAAgQIAgPhsxygQAAAAAAAAAAAAAgAAAAAAkAEFAAUBAQD0AVsDdP8AAAAAAAASAAAASEdTb2VpS2FrdWdvdGhpY1VCAAAAAAAAAAAAAAAABAAAAAILCQkAAAAAAAD/AgDg+/3HahIAAAAAAAAAnwACQAAA19+QAQUAAQgBAPQBWwN0/wAAOgIBAxMAAABIR1BTb2VpS2FrdWdvdGhpY1VCAQAAAAAAAAAAAAAAAAAAAAILCQAAAAAAAAD/AgDg+/3HahIAAAAAAAAAnwACQAAA19+QAQUAAQgBAPQBWwN0/wAAOgIFAxMAAABIR1NTb2VpS2FrdWdvdGhpY1VCAgAAAAAAAAAAAAAAAAAAAAILCQAAAAAAAAD/AgDg+/3HahIAAAAAAAAAnwACQAAA19+QAQUAAQgBAPQBWwN0/wAAOgIFAxEAAABIR1NlaWthaXNob3RhaVBSTwAAAAAAAAAAAAAAAAAAAAADAAYAAAAAAAAAgQIAgPhsxygQAAAAAAAAAAAAAgAAAAAAkAEFAAcKAQD0AVsDdP8AAAAAAAAQAAAASEdNYXJ1R290aGljTVBSTwAAAAAAAAAAAAAAAAAAAAACDwYAAAAAAAAA/wIA4Pv9x2oSAAAAAAAAAJ8AAkAAANffkAEFAAkIAQD0AVsDdP8AAA8C9QISAAAATWljcm9zb2Z0IEhpbWFsYXlhAAAAAAAAAAAAAAAAAAAAAAEBAQABAQEBAQEDAACAAAABAEAAAAAAAAAAAQAAAAAAAACQAQUAAAoBAJoBTwJo/lQAKwG7AQgAAABNb2V1bVQgUgAAAAAAAAAAAAAAAAAAAAACAwUEAAEBAQEBpwIAgPt81ykQAAAAAAAAAAAACAAAAAAAkAEFAAAAAQD0AVsDdP+UAAAAAAAGAAAARXhwbyBNAQAAAAAAAAAAAAAAAAAAAAIDBQQAAQEBAQGnAgCA+3zXKRAAAAAAAAAAAAAIAAAAAACQAQUAAAABAPQBWwN0/5QAAAAAAAUAAABZZXQgUgAAAAAAAAAAAAAAAAAAAAACAwUEAAEBAQEBpwIAgPt81ykQAAAAAAAAAAAACAAAAAAAkAEFAAAAAQD0AVsDdP+UAAAAAAAIAAAAUHl1bmppIFIAAAAAAAAAAAAAAAAAAAAAAgMFBAABAQEBAacCAID7fNcpEAAAAAAAAAAAAAgAAAAAAJABBQAAAAEA9AFbA3T/lAAAAAAABQAAAEFtaSBSAAAAAAAAAAAAAAAAAAAAAAIDBQQAAQEBAQGnAgCA+3zXARAAAAAAAAAAAAAIAAAAAACQAQUAAAABAPQBWwN0/5QAAAAAAAcAAABNYWdpYyBSAAAAAAAAAAAAAAAAAAAAAAIDBQQAAQEBAQGnAgCA+3zXARAAAAAAAAAAAAAIAAAAAACQAQUAAAABAPQBWwN0/5QAAAAAAAoAAABIZWFkbGluZSBSAAAAAAAAAAAAAAAAAAAAAAIDBQQAAQEBAQGnAgCA+3zXARAAAAAAAAAAAAAIAAAAAACQAQUAAAABAPQBWwN0/5QAAAAAAA8AAABIaWdoIFRvd2VyIFRleHQAAAAAAAAAAAAAAAAAAAAAAgQFAgUFBgMDAwMAAAAAAAAAAAAAAAAAAAABAAAgAAAAAJABBQADAQEAogHkAv3+VAAAAAAADwAAAEhpZ2ggVG93ZXIgVGV4dAAAAAAAAAAAAQAAAAAAAAACBAUCBQUGCgMDAwAAAAAAAAAAAAAAAAAAAAEAACAAAAAAkAEFAAMBAQB3AR8DOP9UAAAAAAAGAAAASW1wYWN0AAAAAAAAAAAAAAAAAAAAAAILCAYDCQIFAgSHAgAAAAAAAAAAAAAAAAAAnwAAIAAA19+QAQMABQgBAFQCFgOR/6cAhwIWAxEAAABJbXByaW50IE1UIFNoYWRvdwAAAAAAAAAAAAAAAAAAAAAEAgYFBgMDAwICAwAAAAAAAAAAAAAAAAAAAAEAACAAAAAAkAEFAAMEAQCkAb0CEP+AAAAAAAAOAAAASW5mb3JtYWwgUm9tYW4AAAAAAAAAAAAAAAAAAAAAAwYEAgMEBgsCBAMAAAAAAAAAAAAAAAAAAAABAAAgAAAAAJABBQAPBwEAaQHuAgb/AAAAAAAADAAAAElza29vbGEgUG90YQAAAAAAAAAAAAAAAAAAAAACCwUCBAIEAgIDAwAAAAAAAAAAAgAAAAAAAAEAACAAAAAAkAEFAAUBAQCvArUCDP/FAL8BlgIMAAAASXNrb29sYSBQb3RhAAAAAAEAAAAAAAAAAAAAAAILCAIEAgQCAgMDAAAAAAAAAAACAAAAAAAAAQAAIAAAAAC8AgUABQEBAL0CtQIM/8UAwAGWAg4AAABCbGFja2FkZGVyIElUQwAAAAAAAAAAAAAAAAAAAAAEAgUFBRAHAg0CAwAAAAAAAAAAAAAAAAAAAAEAACAAAAAAkAEFAAYKAQA4AYADfv4AAAAAAAAUAAAARWR3YXJkaWFuIFNjcmlwdCBJVEMAAAAAAAAAAAAAAAAAAAAAAwMDAgQHBw0IBAMAAAAAAAAAAAAAAAAAAAABAAAgAAAAAJABBgADCgEA/gBQA7j+AAAAAAAACwAAAEtyaXN0ZW4gSVRDAAAAAAAAAAAAAAAAAAAAAAMFBQIEAgIDAgIDAAAAAAAAAAAAAAAAAAAAAQAAIAAAAACQAQYABgoBAOoBAwS0/gAAAAAAABIAAABJdGFsaWMgT3V0bGluZSBBcnQAAAAAAAAAAAAAAAAAAAAAAgEEAAAAAAAAAABgAAAAAACACAAAAAAAAABAAAAAAAAAAJABBQAAAAEAkgLtBbT9AAAAAAAACAAAAEpva2VybWFuAAAAAAAAAAAAAAAAAAAAAAQJBgUGDQYCBwIDAAAAAAAAAAAAAAAAAAAAAQAAIAAAAACQAQUAAwkBAOgBYwPC/gAAAAAAAAkAAABKdWljZSBJVEMAAAAAAAAAAAAAAAAAAAAABAQEAwQKAgICAgMAAAAAAAAAAAAAAAAAAAABAAAgAAAAAJABBQAICgEAIwH3AhD/yAAAAAAACAAAAERGS2FpLVNCAAAAAAAAAAAAAAAABAAAAAMABQkAAAAAAAADAAAAAAAuCBYAAAAAAAAAAQAQAAAAAACQAQUABwoBAPQBIAM5/8cAAAAAAAcAAABLYWxpbmdhAAAAAAAAAAAAAAAAAAAAAAILBQIEAgQCAgMDAAgAAAAAAAAAAAAAAAAAAQAAAAAAAACQAQUAAAABAEgC5AMY/nICAgLFAgcAAABLYWxpbmdhAAAAAAEAAAAAAAAAAAAAAAILCAIEAgQCAgMDAAgAAAAAAAAAAAAAAAAAAQAAAAAAAAC8AgUAAAABAE4C5AMY/nICAALFAgcAAABLYXJ0aWthAAAAAAAAAAAAAAAAAAAAAAICBQMDBAQGAgMDAIAAAAAAAAAAAAAAAAAAAQAAAAAAAACQAQUAAAABAEED1gNF/gAAGQLkAgcAAABLYXJ0aWthAAAAAAEAAAAAAAAAAAAAAAICCAMDBAQGAgMDAIAAAAAAAAAAAAAAAAAAAQAAAAAAAAC8AgUAAAABAEgD1gNF/gAAGQLkAhUAAABLdWZpIEV4dGVuZGVkIE91dGxpbmUAAAAAAAAAAAAAAAAAAAAABAEEAQEBAQEBAQBgAAAAAACACAAAAAAAAABAAAAAAAAAAJABBQAAAAEAVQJWBdb9AAAAAAAAEwAAAEt1ZmkgT3V0bGluZSBTaGFkZWQAAAAAAAAAAAAAAAAAAAAABAEEAQEBAQEBAQBgAAAAAACACAAAAAAAAABAAAAAAAAAAJABBQAAAAEAAQL4BOX9AAAAAAAACAAAAEtobWVyIFVJAAAAAAAAAAAAAAAAAAAAAAILBQIEAgQCAgMvAACASiAAAAAAAQAAAAAAAQAAAAAAAACQAQUABQgBAJUC2AIu/4MA9AG8AggAAABLaG1lciBVSQAAAAABAAAAAAAAAAAAAAACCwcCBAIEAgIDLwAAgEogAAAAAAEAAAAAAAEAAAAAAAAAvAIFAAUIAQDAAtgCLv+DAPQBvAIGAAAAS29raWxhAAAAAAAAAAAAAAAAAAAAAAILBgQCAgICAgQDgAAAAAAAAAAAAAAAAAAAAQAAAAAAAACQAQUAAAABAKABGAJa/24BWgEAAgYAAABLb2tpbGEAAAAAAQAAAAAAAAAAAAAAAgsIBAICAgICBAOAAAAAAAAAAAAAAAAAAAABAAAAAAAAALwCBQAAAAEAwAEMAlr/egFhAQACBgAAAEtva2lsYQAAAAABAAAAAQAAAAAAAAACCwgEAgICAgIEA4AAAAAAAAAAAAAAAAAAAAEAAAAAAAAAvAIFAAAAAQC8AQwCWv96AV4BAAIGAAAAS29raWxhAAAAAAAAAAABAAAAAAAAAAILBgQCAgICAgQDgAAAAAAAAAAAAAAAAAAAAQAAAAAAAACQAQUAAAABAJ8BGQJa/20BVQEAAg4AAABNb25vdHlwZSBLb3VmaQAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAACUAgYA9AMAAGICBwCIBgAAAIAAAAAAvAIFAAAAAQCoAQAAAADoAwAAAAAPAAAAS3Vuc3RsZXIgU2NyaXB0AAAAAAAAAAAAAAAAAAAAAAMDBAICBgcNDQYDAAAAAAAAAAAAAAAAAAAAAQAAIAAAAACQAQUAAwoBAPUAFgIQ/xEBAAAAAAYAAABMYW8gVUkAAAAAAAAAAAAAAAAAAAAAAgsFAgQCBAICAwMAAAIAAAAAAAAAAAAAAAABAAAAAAAAAJABBQAFCAEAKgLYAi7/gwD0AbwCBgAAAExhbyBVSQAAAAABAAAAAAAAAAAAAAACCwgCBAIEAgIDAwAAAgAAAAAAAAAAAAAAAAEAAAAAAAAAvAIFAAUIAQBLAtgCLv+DAPQBvAIFAAAATGF0aGEAAAAAAAAAAAAAAAAAAAAAAgsGBAICAgICBAMAEAAAAAAAAAAAAAAAAAABAAAAAAAAAJABBQAAAAEA0wLoA2z9AADSAYQCBQAAAExhdGhhAAAAAAEAAAAAAAAAAAAAAAILBwQCAgICAgQDABAAAAAAAAAAAAAAAAAAAQAAAAAAAAC8AgUAAAABAPAC6ANs/QAA0gGEAgoAAABXaWRlIExhdGluAAAAAAAAAAAAAAAAAAAAAAIKCgcFBQUCBAQDAAAAAAAAAAAAAAAAAAAAAQAAIAAAAACQAQkAAAABADoDvAIi/5MAAAAAAA0AAABMdWNpZGEgQnJpZ2h0AAAAAAAAAAAAAAAAAAAAAAIEBgIFBQUCAwQDAAAAAAAAAAAAAAAAAAAAAQAAIAAAAACQAQUAAAIBAOsBAgMz/xcAAAAAAA0AAABMdWNpZGEgQnJpZ2h0AAAAAAEAAAAAAAAAAAAAAAIEBwIGBQUCAwQDAAAAAAAAAAAAAAAAAAAAAQAAIAAAAABYAgUAAAIBAP8BAgMz/xcAAAAAAA0AAABMdWNpZGEgQnJpZ2h0AAAAAAEAAAABAAAAAAAAAAIEBwIFBQUJAwQDAAAAAAAAAAAAAAAAAAAAAQAAIAAAAABYAgUAAAIBAPsBAgMz/xcAAAAAAA0AAABMdWNpZGEgQnJpZ2h0AAAAAAAAAAABAAAAAAAAAAIEBgIFBQUJAwQDAAAAAAAAAAAAAAAAAAAAAQAAIAAAAACQAQUAAAIBAOIBAgMz/xcAAAAAABIAAABMdWNpZGEgQ2FsbGlncmFwaHkAAAAAAAAAAAAAAAAAAAAAAwEBAQEBAQEBAQMAAAAAAAAAAAAAAAAAAAABAAAgAAAAAJABBQAFCgEAGQJXA7v+TP8AAAAADwAAAExlZCBJdGFsaWMgRm9udAAAAAAAAAAAAAAAAAAAAAACAQQAAAAAAAAAAGAAAAAAAIAIAAAAAAAAAEAAAAAAAAAAkAEFAAAAAQDHAu0F7QEAAAAAAAAKAAAATGVlbGF3YWRlZQAAAAAAAAAAAAAAAAAAAAACCwUCBAIEAgIDAQAAAQAAAAAAAAAAAAAAAAEAASAAAAAAkAEFAAUIAQAWAr0DEv9TAPQBvAIKAAAATGVlbGF3YWRlZQAAAAABAAAAAAAAAAAAAAACCwgCBAIEAgIDAQAAAQAAAAAAAAAAAAAAAAEAASAAAAAAvAIFAAUIAQBFAr0DEv9TAPQBvAIKAAAATHVjaWRhIEZheAAAAAAAAAAAAAAAAAAAAAACBgYCBQUFAgIEAwAAAAAAAAAAAAAAAAAAAAEAACAAAAAAkAEFAAIFAQACAgIDzQAXAAAAAAAKAAAATHVjaWRhIEZheAAAAAABAAAAAAAAAAAAAAACBgcCBQUFAwIEAwAAAAAAAAAAAAAAAAAAAAEAACAAAAAAWAIFAAIFAQAbAgIDzQAXAAAAAAAKAAAATHVjaWRhIEZheAAAAAABAAAAAQAAAAAAAAACBgcCBAMFCQIEAwAAAAAAAAAAAAAAAAAAAAEAACAAAAAAWAIFAAIFAQASAgIDzQAXAAAAAAAKAAAATHVjaWRhIEZheAAAAAAAAAAAAQAAAAAAAAACBgYCBQMFCgMEAwAAAAAAAAAAAAAAAAAAAAEAACAAAAAAkAEFAAIFAQD5AQIDzQAXAAAAAAASAAAATHVjaWRhIEhhbmR3cml0aW5nAAAAAAAAAAAAAAAAAAAAAAMBAQEBAQEBAQEDAAAAAAAAAAAAAAAAAAAAAQAAIAAAAACQAQUABAoBADoCVwNFAUz/AAAAAAcAAABMb2JzdGVyAAAAAAAAAAAAAAAAAAAAAAIABQYAAAACAAMvAACASgAAQAAAAAAAAAAABQAAAAAAAACQAQUAAgoBAIEB6AMG/wAA9AHtAgsAAABMb2JzdGVyIFR3bwAAAAABAAAAAAAAAAAAAAACAAUGAAAAAgADLwAAgEoAAEAAAAAAAAAAAAEAAAAAAAAAvAIFAAIKAQAiAugDBv8AAPQB8AILAAAATG9ic3RlciBUd28AAAAAAQAAAAEAAAAAAAAAAgAFBgAAAAIAAy8AAIBKAABAAAAAAAAAAAABAAAAAAAAALwCBQACCgEAIQLoAwb/AAD0AfACCwAAAExvYnN0ZXIgVHdvAAAAAAAAAAABAAAAAAAAAAIABQYAAAACAAMvAACASgAAQAAAAAAAAAAAAQAAAAAAAACQAQUAAgoBAAgC6AMG/wAA9AHyAgsAAABMb2JzdGVyIFR3bwAAAAAAAAAAAAAAAAAAAAACAAUGAAAAAgADLwAAgEoAAEAAAAAAAAAAAAEAAAAAAAAAkAEFAAIKAQAIAugDBv8AAPQB8gINAAAAR3V0dG1hbiBMb2dvMQAAAAAAAAAAAAAAAAAAAAAFAQEBAQEBAQEBAAAAAAAAAAAAAAAAAAAAAAAAAIAAAAAAkAEFAAAAAQDcAiADyAAAAAAAAAALAAAATHVjaWRhIFNhbnMAAAAAAAAAAAAAAAAAAAAAAgsGAgMFBAICBAMAAAAAAAAAAAAAAAAAAAABAAAgAAAAAJABBQACCAEA6QECA80AFwAAAAAACwAAAEx1Y2lkYSBTYW5zAAAAAAEAAAAAAAAAAAAAAAILBwMEBQQCAgQDAAAAAAAAAAAAAAAAAAAAAQAAIAAAAABYAgUAAggBAAkCAgPNABcAAAAAAAsAAABMdWNpZGEgU2FucwAAAAABAAAAAQAAAAAAAAACCwcDBAUECgIEAwAAAAAAAAAAAAAAAAAAAAEAACAAAAAAWAIFAAIIAQAHAgIDzQAXAAAAAAALAAAATHVjaWRhIFNhbnMAAAAAAAAAAAEAAAAAAAAAAgsGAgMFBAkCBAMAAAAAAAAAAAAAAAAAAAABAAAgAAAAAJABBQACCAEA6QECA80AFwAAAAAAFgAAAEx1Y2lkYSBTYW5zIFR5cGV3cml0ZXIAAAAAAAAAAAAAAAAEAAAAAgsFCQMFBAMCBAMAAAAAAAAAAAAAAAAAAAABAAAgAAAAAJABBAAJCAEAWgICA80AFwAAAAAAFgAAAEx1Y2lkYSBTYW5zIFR5cGV3cml0ZXIAAAAAAQAAAAAAAAAEAAAAAgsHCQQFBAMCBAMAAAAAAAAAAAAAAAAAAAABAAAgAAAAAFgCBAAJCAEAWgICA80AFwAAAAAAFgAAAEx1Y2lkYSBTYW5zIFR5cGV3cml0ZXIAAAAAAQAAAAEAAAAEAAAAAgsHCQQFBAoCBAMAAAAAAAAAAAAAAAAAAAABAAAgAAAAAFgCBAAJCAEAWgICA80AFwAAAAAAFgAAAEx1Y2lkYSBTYW5zIFR5cGV3cml0ZXIAAAAAAAAAAAEAAAAEAAAAAgsFCQMFBAMCBAMAAAAAAAAAAAAAAAAAAAABAAAgAAAAAJABBAAJCAEAWgICA80AFwAAAAAADgAAAEx1Y2lkYSBDb25zb2xlAAAAAAAAAAAAAAAABAAAAAILBgkEBQQCAgSPAgCAABgAAAAAAAAAAAAAHwAAAAAA19eQAQQACQgBAFoCDwMz/1EAAAAAAAoAAABMZXZlbmltIE1UAAAAAAAAAAAAAAAAAAAAAAIBBQIGAQEBAQEBCAAAAAAAAAAAAAAAAAAAIAAAAAAAIACQAQUAAAABAO8BsAM5/gAAAAAAAAoAAABMZXZlbmltIE1UAAAAAAEAAAAAAAAAAAAAAAIBCAIGAQEBAQEBCAAAAAAAAAAAAAAAAAAAIAAAAAAAIAC8AgUAAAABAO4BsAM5/gAAAAAAABMAAABMdWNpZGEgU2FucyBVbmljb2RlAAAAAAAAAAAAAAAAAAAAAAILBgIDBQQCAgT/GgCAazkAAAAAAAAAAAAAvwAAIAAA99eQAQUAAAABAOkBDwM0/1IAAAAAAAcAAABNYWduZXRvAAAAAAEAAAAAAAAAAAAAAAQDCAUFCAICDQIDAAAAAAAAAAAAAAAAAAAAAQAAIAAAAAC8AgYABAoBACQCHQM2/1QAAAAAAAsAAABNYWlhbmRyYSBHRAAAAAAAAAAAAAAAAAAAAAACDgUCAwMIAgIEAwAAAAAAAAAAAAAAAAAAAAEAACAAAAAAkAEFAAgKAQC1AfcC8ADIAAAAAAAOAAAAU2Fra2FsIE1hamFsbGEAAAAAAAAAAAAAAAAAAAAAAgAAAAAAAAAAAH8gAKBLIADACAAAAAAAAADTAAAgAAAAAJABBQAAAAEA+wGpAsL+WwFWAfYBDgAAAFNha2thbCBNYWphbGxhAAAAAAEAAAAAAAAAAAAAAAIAAAAAAAAAAAB/IACgSyAAwAgAAAAAAAAA0wAAIAAAAAC8AgUAAAABAAsCqQLC/lsBVQH2AQ0AAABNYWxndW4gR290aGljAAAAAAAAAAAAAAAAAAAAAAILBQMCAAACAASvAgCQ+3zXKRIAAAAAAAAAjQAIAAAAAACQAQUABQgBAM8BHwM4/wAAAALOAg0AAABNYWxndW4gR290aGljAAAAAAEAAAAAAAAAAAAAAAILCAMCAAACAASvAgCQ+3zXKRIAAAAAAAAAjQAIAAAAAAC8AgUABQgBAOgBHwM4/wAAAALNAgYAAABNYW5nYWwAAAAAAAAAAAAAAAAAAAAAAgQFAwUCAwMCAgOAAAAAAAAAAAAAAAAAAAABAAAAAAAAAJABBQAAAAEARQLZBEr+AAAYAuUCBgAAAE1hbmdhbAAAAAABAAAAAAAAAAAAAAACBAUDBQIDAwICA4AAAAAAAAAAAAAAAAAAAAEAAAAAAAAAvAIFAAAAAQBHAtkESv4AABgC5QIPAAAAR3V0dG1hbiBNYW50b3ZhAAAAAAEAAAAAAAAAAAAAAAIBBwEBAQEBAQEAGAAAAAAAQAAAAAAAAAAAIAAAAAAAAAC8AgUAAAABAIAB6gKw/gAAAAAAABUAAABHdXR0bWFuIE1hbnRvdmEtRGVjb3IAAAAAAAAAAAAAAAAAAAAAAgEEAQEBAQEBAQAYAAAAAABAAAAAAAAAAAAgAAAAAAAAAJABBQAAAAEAkwHqArD+AAAAAAAADwAAAEd1dHRtYW4gTWFudG92YQAAAAAAAAAAAAAAAAAAAAACAQQBAQEBAQEBABgAAAAAAEAAAAAAAAAAACAAAAAAAAAAkAEFAAAAAQB/AeoCsf4AAAAAAAAHAAAATWFybGV0dAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAIAAAAAA9AEFAAAAAQC+A+gDAAAAAAAAAAAZAAAATWF0dXJhIE1UIFNjcmlwdCBDYXBpdGFscwAAAAAAAAAAAAAAAAAAAAADAggCBgYCBwICAwAAAAAAAAAAAAAAAAAAAAEAACAAAAAAkAEFAAcKAQCsAXIC6/6lAAAAAAAGAAAATWVpcnlvAAAAAAAAAAAAAAAAAAAAAAILBgQDBQQEAgT/AgDg///HahIAAAgAAAAAnwACYAAA19+QAQUAAAgBALwDbQOG//QBJwLfAgYAAABNZWlyeW8BAAAAAAAAAAEAAAAAAAAAAgsGBAMFBAsCBP8CAOD//8dqEgAACAAAAACfAAJgAADX35ABBQAACAEAvANtA4b/9AEnAt8CCQAAAE1laXJ5byBVSQIAAAAAAAAAAAAAAAAAAAACCwYEAwUEBAIE/wIA4P//x2oSAAAIAAAAAJ8AAmAAANffkAEFAAAIAQAYAm0Dhv/0AScC3wIJAAAATWVpcnlvIFVJAwAAAAAAAAABAAAAAAAAAAILBgQDBQQLAgT/AgDg///HahIAAAgAAAAAnwACYAAA19+QAQUAAAgBABgCbQOG//QBJwLfAgYAAABNZWlyeW8AAAAAAQAAAAAAAAAAAAAAAgsIBAMFBAQCBP8CAOD//8dqEgAACAAAAACfAAJgAADX37wCBQAACAEAwANtA4b/9AE1At8CBgAAAE1laXJ5bwEAAAABAAAAAQAAAAAAAAACCwgEAwUECwIE/wIA4P//x2oSAAAIAAAAAJ8AAmAAANffvAIFAAAIAQDAA20Dhv/0ATUC3wIJAAAATWVpcnlvIFVJAgAAAAEAAAAAAAAAAAAAAAILCAQDBQQEAgT/AgDg///HahIAAAgAAAAAnwACYAAA19+8AgUAAAgBABgCbQOG//QBNQLfAgkAAABNZWlyeW8gVUkDAAAAAQAAAAEAAAAAAAAAAgsIBAMFBAsCBP8CAOD//8dqEgAACAAAAACfAAJgAADX37wCBQAACAEAGAJtA4b/9AE1At8CFAAAAE1pY3Jvc29mdCBTYW5zIFNlcmlmAAAAAAAAAAAAAAAAAAAAAAILBgQCAgICAgT/KgDhAgAAwAgAAAAAAAAA/wEBIAAAKCCQAQUABQgBALcB2AIu/4MABgLLAgcAAABNaW5nTGlVAAAAAAAAAAAAAAAABAAAAAICBQkAAAAAAAD/AgCg+vzPKBYAAAAAAAAAAQAQAAAAAACQAQUABQEBAPQBIAM5/8cArQGTAggAAABQTWluZ0xpVQEAAAAAAAAAAAAAAAAAAAACAgUAAAAAAAAA/wIAoPr8zygWAAAAAAAAAAEAEAAAAAAAkAEFAAUBAQD0ASADOf/HAK0BkwINAAAATWluZ0xpVV9IS1NDUwIAAAAAAAAAAAAAAAAAAAACAgUAAAAAAAAA/wIAoPr8zzgWAAAAAAAAAAEAEAAAAAAAkAEFAAUBAQD0ASADOf/HAK0BkwIMAAAATWluZ0xpVS1FeHRCAAAAAAAAAAAAAAAAAAAAAAICBQAAAAAAAAAvAACACAAAAgAAAAAAAAAAAQAQAAAAAACQAQUABQEBAPQBIAM5/8cArQGTAg0AAABQTWluZ0xpVS1FeHRCAQAAAAAAAAAAAAAAAAAAAAICBQAAAAAAAAAvAACACAAAAgAAAAAAAAAAAQAQAAAAAACQAQUABQEBAPQBIAM5/8cArQGTAhIAAABNaW5nTGlVX0hLU0NTLUV4dEICAAAAAAAAAAAAAAAAAAAAAgIFAAAAAAAAAC8AAIAIAAACAAAAAAAAAAABABAAAAAAAJABBQAFAQEA9AEgAzn/xwCtAZMCDgAAAEd1dHRtYW4gTWlyeWFtAAAAAAEAAAAAAAAAAAAAAAIBBwEBAQEBAQEAGAAAAAAAQAAAAAAAAAAAIAAAAAAAAAC8AgUAAAABAHIB6gKw/gAAAAAAAA8AAABHdXR0bWFuLUNvdXJNaXIAAAAAAAAAAAAAAAAEAAAAAgEECQEBAQEBAQAYAAAAAABAAAAAAAAAAAAgAAAAAAAAAJABBQAAAAEABAIgA4b+AAAAAAAADgAAAEd1dHRtYW4gTWlyeWFtAAAAAAAAAAAAAAAAAAAAAAIBAwEBAQEBAQEAGAAAAAAAQAAAAAAAAAAAIAAAAAAAAAAsAQUAAAABAHEB6gKw/gAAAAAAAAcAAABNaXN0cmFsAAAAAAAAAAAAAAAAAAAAAAMJBwIDBAcCBAOHAgAAAAAAAAAAAAAAAAAAnwAAIAAA19+QAQUAAAABAEIBkAIK/2EAAAAAAAwAAABNeWFubWFyIFRleHQAAAAAAAAAAAAAAAAAAAAAAgsFAgQCBAICAwMAAAAAAAAAAAQAAAAAAAABAAAAAAAAAJABBQAFCAEAJQKeArf+XAP0AbwCDQAAAE1vZGVybiBOby4gMjAAAAAAAAAAAAAAAAAAAAAAAgcHBAcFBQIDAwMAAAAAAAAAAAAAAAAAAAABAAAgAAAAAJABBQABAgEAkAGNAi//RgAAAAAADwAAAE1vbmdvbGlhbiBCYWl0aQAAAAAAAAAAAAAAAAAAAAADAAUAAAAAAAAAIwAAgAAAAAAAAAIAAAAAAAEAAAAAAAAAkAEFAAcKAQCuAUwDJf9ZAKsB0gIJAAAATW9vbEJvcmFuAAAAAAAAAAAAAAAAAAAAAAILAQABAQEBAQEPAACASiAAAAAAAQAAAAAAAQAAAAAAAACQAQUABQgBAJABqgJt/R4AFgHYAQYAAABNaXJpYW0AAAAAAAAAAAAAAAAAAAAAAgsFAgUBAQEBAQEIAAAAAAAAAAAAAAAAAAAgAAAAAAAgAJABBQAAAAEAkQHyAvf+AAAAAAAADAAAAE1pcmlhbSBGaXhlZAAAAAAAAAAAAAAAAAQAAAACCwUJBQEBAQEBAQgAAAAAAAAAAAAAAAAAACAAAAAAACAAkAEFAAAAAQBYAuEC9/4AAAAAAAAYAAAARml4ZWQgTWlyaWFtIFRyYW5zcGFyZW50AAAAAAAAAAAAAAAABAAAAAAAAAkAAAAAAAAACAAAAAAAAAAAAAAAAAAAIAAAAAAAAACQAQUAAAABAFgCQAPU/gAAAAAAABIAAABNaXJpYW0gVHJhbnNwYXJlbnQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAIAAAAAAAAAAAAAAAAAAAgAAAAAAAAAJABBQAAAAEAnQGJAy3/AAAAAAAACQAAAE1TIEdvdGhpYwAAAAAAAAAAAAAAAAQAAAACCwYJBwIFCAIE/wIA4Pv9x2oSAAAIAAAAAJ8AAkAAANffkAEFAAEIAQD0AVsDdP8AAMEBpwIMAAAATVMgVUkgR290aGljAQAAAAAAAAAAAAAAAAAAAAILBgAHAgUIAgT/AgDg+/3HahIAAAgAAAAAnwACQAAA19+QAQUAAQgBAKEBWwN0/wAAwQGnAgoAAABNUyBQR290aGljAgAAAAAAAAAAAAAAAAAAAAILBgAHAgUIAgT/AgDg+/3HahIAAAgAAAAAnwACQAAA19+QAQUAAQgBAKEBWwN0/wAAwQGnAhIAAABNaWNyb3NvZnQgSmhlbmdIZWkAAAAAAAAAAAAAAAAAAAAAAgsGBAMFBAQCBIcAAAAAQK8oFgAAAAAAAAAJABAAAAAAAJABBQACCAEA1AF6A5P/AAAcAvQCFQAAAE1pY3Jvc29mdCBKaGVuZ0hlaSBVSQEAAAAAAAAAAAAAAAAAAAACCwYEAwUEBAIEhwAAAABArygWAAAAAAAAAAkAEAAAAAAAkAEFAAIIAQDUAXoDk/8AABwC9AISAAAATWljcm9zb2Z0IEpoZW5nSGVpAAAAAAEAAAAAAAAAAAAAAAILCAMCBQQEAgSHAAAAAECvKBYAAAAAAAAACQAQAAAAAAC8AgUAAggBAOEBegOT/wAAHAL0AhUAAABNaWNyb3NvZnQgSmhlbmdIZWkgVUkBAAAAAQAAAAAAAAAAAAAAAgsIAwIFBAQCBIcAAAAAQK8oFgAAAAAAAAAJABAAAAAAALwCBQACCAEA4QF6A5P/AAAcAvQCCQAAAE1TIE1pbmNobwAAAAAAAAAAAAAAAAQAAAACAgYJBAIFCAME/wIA4Pv9x2oSAAAIAAAAAJ8AAkAAANffkAEFAAUBAQD0AVsDdP8AAMEBpwIKAAAATVMgUE1pbmNobwEAAAAAAAAAAAAAAAAAAAACAgYABAIFCAME/wIA4Pv9x2oSAAAIAAAAAJ8AAkAAANffkAEFAAUBAQCaAVsDdP8AAMEBpwIQAAAATWljcm9zb2Z0IFVpZ2h1cgAAAAABAAAAAAAAAAAAAAACAAAAAAAAAAAAIyAAgAIAAIAIAAAAAAAAAEEAAAAAAAAAvAIFAAACAQCYAasCxP5RABYB2AEQAAAATWljcm9zb2Z0IFVpZ2h1cgAAAAAAAAAAAAAAAAAAAAACAAAAAAAAAAAAIyAAgAIAAIAIAAAAAAAAAEEAAAAAAAAAkAEFAAAAAQCLAasCxP5RABcB1wEPAAAATWljcm9zb2Z0IFlhSGVpAAAAAAAAAAAAAAAAAAAAAAILBQMCAgQCAgSHAgCAUjzPKBYAAAAAAAAAHwAEAAAAAACQAQUABQgBAOEBLAMD/wQAHAL0AhIAAABNaWNyb3NvZnQgWWFIZWkgVUkBAAAAAAAAAAAAAAAAAAAAAgsFAwICBAICBIcCAIBSPM8oFgAAAAAAAAAfAAQAAAAAAJABBQAFCAEA4QEsAwP/BAAcAvQCDwAAAE1pY3Jvc29mdCBZYUhlaQAAAAABAAAAAAAAAAAAAAACCwcDAgIEAgIBhwIAgFI8zygWAAAAAAAAAB8ABAAAAAAAvAIFAAUIAQD7ASwDA/8EABwC9AISAAAATWljcm9zb2Z0IFlhSGVpIFVJAQAAAAEAAAAAAAAAAAAAAAILBwMCAgQCAgGHAgCAUjzPKBYAAAAAAAAAHwAEAAAAAAC8AgUABQgBAPsBLAMD/wQAHAL0AhIAAABNaWNyb3NvZnQgWWkgQmFpdGkAAAAAAAAAAAAAAAAAAAAAAwAFAAAAAAAAAAMAAIACBAEAAgAIAAAAAAABAAAAAAAAAJABBQAHCgEAhgJbA3P/MgB8ARsCEAAAAE1vbm90eXBlIENvcnNpdmEAAAAAAAAAAAEAAAAAAAAAAwEBAQECAQEBAYcCAAAAAAAAAAAAAAAAAACfAAAgAADX35ABBQAGCgEAXgGwAv7+egAAAAAADgAAAE1vbm90eXBlIFNvcnRzAAAAAAAAAAAAAAAAAAAAAAUBBgEBAQEBAQEAAAAAAAAAAAAAAAAAAAAAAAAAgAAAAACQAQUAAwwBAOsCAAAAAC0EAAAAAAgAAABNdWRpciBNVAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAIAAAAAAWAIFAAAAAQBAApkD5QEAAAAAAAAHAAAATVYgQm9saQAAAAAAAAAAAAAAAAAAAAACAAUAAwIACQAAAwAAAAAAAAAAAQAAAAAAAAEAAAAAAAAAkAEFAAYKAQAyAsoCHv+AAJIBygIJAAAATmV3IEd1bGltAAAAAAAAAAAAAAAAAAAAAAIDBgAAAQEBAQGvAgCw+3zXfzAAAAAAAAAAnwAIQAAA19+QAQUABQEBAPQBWgNz/5QAAAAAABAAAABOaWFnYXJhIEVuZ3JhdmVkAAAAAAAAAAAAAAAAAAAAAAQCBQIHBwMDAgIDAAAAAAAAAAAAAAAAAAAAAQAAIAAAAACQAQMAAAIBAO0AHwM4/1QAAAAAAA0AAABOaWFnYXJhIFNvbGlkAAAAAAAAAAAAAAAAAAAAAAQCBQIHBwICAgIDAAAAAAAAAAAAAAAAAAAAAQAAIAAAAACQAQMAAAIBAO0AHwM4/1QAAAAAAAoAAABOaXJtYWxhIFVJAAAAAAAAAAAAAAAAAAAAAAILBQIEAgQCAgMjgP+ASgAAAAACAAAAAAQAAQAAAAAAAACQAQUABQgBAMwD2AIu/4MA9AG8AgoAAABOaXJtYWxhIFVJAAAAAAEAAAAAAAAAAAAAAAILCAIEAgQCAgMjgP+ASgAAAAACAAAAAAQAAQAAAAAAAAC8AgUABQgBACcE2AIu/4MA9AG8AggAAABOYXJraXNpbQAAAAAAAAAAAAAAAAAAAAACDgUCBQEBAQEBAQgAAAAAAAAAAAAAAAAAACAAAAAAACAAkAEFAAAAAQCAAd4C9/4AAAAAAAAVAAAATWljcm9zb2Z0IE5ldyBUYWkgTHVlAAAAAAAAAAAAAAAAAAAAAAILBQIEAgQCAgMDAAAAAAAAAAAAAIAAAAAAAQAAAAAAAACQAQUABQgBAEgC7gIV/1MA9AG8AhUAAABNaWNyb3NvZnQgTmV3IFRhaSBMdWUAAAAAAQAAAAAAAAAAAAAAAgsIAgQCBAICAwMAAAAAAAAAAAAAgAAAAAABAAAAAAAAALwCBQAFCAEAbALvAhb/UwD0AbwCBQAAAE55YWxhAAAAAAAAAAAAAAAAAAAAAAIABQQHAwACAANvAACgAAAAAAAIAAAAAAAAkwAAAAAAAACQAQUAAAABAC4C7gJX/30AbQFAAg4AAABPQ1IgQSBFeHRlbmRlZAAAAAAAAAAAAAAAAAAAAAACAQUJAgECAQMDAwAAAAAAAAAAAAAAAAAAAAEAACAAAAAAkAEFAA8IAQBcAogCUf/1AAAAAAAEAAAAT0NSQgAAAAAAAAAAAAAAAAQAAAACCwYJAgICAgIEAwAAAAAAAAAAAAAAAAAAAAEAACAAAAAAkAEIAAAIAQBaAsICXP8rAgAAAAAOAAAAT2xkIEFudGljIEJvbGQAAAAAAAAAAAAAAAAAAAAAAgEEAAAAAAAAAABgAAAAAACACAAAAAAAAABAAAAAAAAAAJABBQAAAAEArAGoBeX9AAAAAAAAFAAAAE9sZCBBbnRpYyBEZWNvcmF0aXZlAAAAAAAAAAAAAAAAAAAAAAIBBAAAAAAAAAAAYAAAAAAAgAgAAAAAAAAAQAAAAAAAAACQAQUAAAABAKYB7QXl/QAAAAAAABEAAABPbGQgQW50aWMgT3V0bGluZQAAAAAAAAAAAAAAAAAAAAACAQQAAAAAAAAAAGAAAAAAAIAIAAAAAAAAAEAAAAAAAAAAkAEFAAAAAQDQAQoG5f0AAAAAAAATAAAAT2xkIEVuZ2xpc2ggVGV4dCBNVAAAAAAAAAAAAAAAAAAAAAADBAkCBAUIAwgGAwAAAAAAAAAAAAAAAAAAAAEAACAAAAAAkAEFAAIJAQCFAbsCdv/nAAAAAAAYAAAAT2xkIEFudGljIE91dGxpbmUgU2hhZGVkAAAAAAAAAAAAAAAAAAAAAAIBBAAAAAAAAAAAYAAAAAAAgAgAAAAAAAAAQAAAAAAAAACQAQUAAAABACsCCgbl/QAAAAAAAAQAAABPbnl4AAAAAAAAAAAAAAAAAAAAAAQFBgIIBwICAgMDAAAAAAAAAAAAAAAAAAAAAQAAIAAAAACQAQUAAAABAO8A5AJL/5MAAAAAAAkAAABPcGVuIFNhbnMAAAAAAQAAAAAAAAAAAAAAAgsIBgMFBAICBO8CAOBbIABAKAAAAAAAAACfAQAgAAAAALwCBQACCAEAeAL9AhD/QAAhAskCCQAAAE9wZW4gU2FucwAAAAABAAAAAQAAAAAAAAACCwgGAwUEAgIE7wIA4FsgAEAoAAAAAAAAAJ8BACAAAAAAvAIFAAAAAQBTAv0CEP9AACECyQITAAAAT3BlbiBTYW5zIENvbmRlbnNlZAAAAAABAAAAAAAAAAAAAAACCwgGAwUEAgIE7wIA4FsgAEAoAAAAAAAAAJ8BACAAAAAAvAIDAAIIAQD0Af0CEP9AAB8CyQIZAAAAT3BlbiBTYW5zIENvbmRlbnNlZCBMaWdodAAAAAAAAAAAAAAAAAAAAAACCwMGAwUEAgIE7wIA4FsgAEAoAAAAAAAAAJ8BACAAAAAALAEDAAABAQCfAf0CEP9AABECyQIZAAAAT3BlbiBTYW5zIENvbmRlbnNlZCBMaWdodAAAAAAAAAAAAQAAAAAAAAACCwMGAwUEAgIE7wIA4FsgAEAoAAAAAAAAAJ8BACAAAAAALAEDAAABAQB6Af0CEP9AABECyQIJAAAAT3BlbiBTYW5zAAAAAAAAAAABAAAAAAAAAAILBgYDBQQCAgTvAgDgWyAAQCgAAAAAAAAAnwEAIAAAAACQAQUAAAABACgC/QIQ/0AAFwLJAgkAAABPcGVuIFNhbnMAAAAAAAAAAAAAAAAAAAAAAgsGBgMFBAICBO8CAOBbIABAKAAAAAAAAACfAQAgAAAAAJABBQACCAEATAL9AhD/QAAXAskCCgAAAE9wZW5TeW1ib2wAAAAAAAAAAAAAAAAAAAAABQEAAAAAAAAAAK8AAIDq7AEQAAAAAAAAAAABAAAAAAAAAJABBQAAAAEA3gIfA8gAAAAAAAAABgAAAE9zd2FsZAAAAAABAAAAAAAAAAAAAAACAAgDAAAAAAAA7wAAoEsAAEAAAAAAAAAAAJMAAAAAAAAAvAIFAAAAAQCHAakE4P4AAAAAAAAGAAAAT3N3YWxkAAAAAAAAAAAAAAAAAAAAAAIABQMAAAAAAABvAACgSwAAQAAAAAAAAAAAkwAAAAAAAACQAQUAAAABAIUBqQTg/gAAAAAAAAoAAABNUyBPdXRsb29rAAAAAAAAAAAAAAAAAAAAAAUBAQABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAgAAAAACQAQUAAAwBALoDHwM4/wAAAAAAAAgAAABQYWNpZmljbwAAAAAAAAAAAAAAAAAAAAACAAAAAAAAAAAALwAAgEsAAEAAAAAAAAAAAAEAAAAAAAAAkAEFAAAAAQA5AhYFO/4AALQAMgIRAAAAUGFsYXRpbm8gTGlub3R5cGUAAAAAAAAAAAAAAAAAAAAAAgQFAgUFBQMDBIcCAOATAABAAAAAAAAAAACfAQAgAAAAAJABBQAEAQEAvQHbAuT+TQEGAssCEQAAAFBhbGF0aW5vIExpbm90eXBlAAAAAAEAAAAAAAAAAAAAAAIEBwIGAwUKAgSHAgDgEwAAQAAAAAAAAAAAnwEAIAAAAAC8AgUABAEBAMoB2wLk/k0BBgLLAhEAAABQYWxhdGlubyBMaW5vdHlwZQAAAAABAAAAAQAAAAAAAAACBAcCBgMFCgIEhwIA4BMAAEAAAAAAAAAAAJ8BACAAAAAAvAIFAAQBAQC+AdsC5P5NAQYCywIRAAAAUGFsYXRpbm8gTGlub3R5cGUAAAAAAAAAAAEAAAAAAAAAAgQFAgUDBQoDBIcCAOATAABAAAAAAAAAAACfAQAgAAAAAJABBQAEAQEAkAHbAuT+TQEGAssCEAAAAFBhbGFjZSBTY3JpcHQgTVQAAAAAAAAAAAEAAAAAAAAAAwMDAgIGBwwLBQMAAAAAAAAAAAAAAAAAAAABAAAgAAAAAJABBQADCgEA4ADuAQz/SwEAAAAABwAAAFBhcHlydXMAAAAAAAAAAAAAAAAAAAAAAwcFAgYFAgMCBQMAAAAAAAAAAAAAAAAAAAABAAAgAAAAAJABBQAFCgEAnAEvA2L+AAAAAAAACQAAAFBhcmNobWVudAAAAAAAAAAAAAAAAAAAAAADBAYCBAcIBAgEAwAAAAAAAAAAAAAAAAAAAAEAACAAAAAAkAEFAAIJAQCtAJYBdP9PAAAAAAAIAAAAUGVycGV0dWEAAAAAAQAAAAEAAAAAAAAAAgIIAgYEAQkDAwMAAAAAAAAAAAAAAAAAAAABAAAAAAAAALwCBQAGAQEAhAFzAtH+igAAAAAACAAAAFBlcnBldHVhAAAAAAEAAAAAAAAAAAAAAAICCAIGBAECAwMDAAAAAAAAAAAAAAAAAAAAAQAAIAAAAAC8AgUABgEBAKoBcwLR/ooAAAAAAAgAAABQZXJwZXR1YQAAAAAAAAAAAQAAAAAAAAACAgUCBgQBCQMDAwAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAkAEFAAYBAQA+AXMC0f6KAAAAAAATAAAAUGVycGV0dWEgVGl0bGluZyBNVAAAAAABAAAAAAAAAAAAAAACAggCBgUFAggEAwAAAAAAAAAAAAAAAAAAAAEAACAAAAAAvAIFAAECAQCJAs8Cbv/LAAAAAAATAAAAUGVycGV0dWEgVGl0bGluZyBNVAAAAAAAAAAAAAAAAAAAAAACAgUCBgUFAggEAwAAAAAAAAAAAAAAAAAAAAEAACAAAAAALAEFAAECAQBTAs8Cd//VAAAAAAAIAAAAUGVycGV0dWEAAAAAAAAAAAAAAAAAAAAAAgIFAgYEAQIDAwMAAAAAAAAAAAAAAAAAAAABAAAgAAAAAJABBQAGAQEAZwFzAtH+igAAAAAAEQAAAE1pY3Jvc29mdCBQaGFnc1BhAAAAAAAAAAAAAAAAAAAAAAILBQIEAgQCAgMDAAAAAAAgAAAAAAgAAAAAAQAAAAAAAACQAQUABQgBAPgC2AIu/4MA9AG8AhEAAABNaWNyb3NvZnQgUGhhZ3NQYQAAAAABAAAAAAAAAAAAAAACCwgCBAIEAgIDAwAAAAAAIAAAAAAIAAAAAAEAAAAAAAAAvAIFAAAIAQAPA9gCLv+DAPQBvAIUAAAAUGxhbnRhZ2VuZXQgQ2hlcm9rZWUAAAAAAAAAAAAAAAAAAAAAAgIGAgcBAAAAAAMAAAAAAAAAABAAAAAAAAABAAAAAAAAAJABBQAAAgEAuQG4Aub+MADDAaMCCAAAAFBsYXliaWxsAAAAAAAAAAAAAAAAAAAAAAQFBgMKBgICAgIDAAAAAAAAAAAAAAAAAAAAAQAAIAAAAACQAQEAAAABAPUAmgJV/2oBAAAAAAwAAABQb29yIFJpY2hhcmQAAAAAAAAAAAAAAAAAAAAAAggFAgUFBQIHAgMAAAAAAAAAAAAAAAAAAAABAAAgAAAAAJABBQAEAQEAbwG4Ajj/TwAAAAAACAAAAFByaXN0aW5hAAAAAAAAAAAAAAAAAAAAAAMGBAIEBAYIAgQDAAAAAAAAAAAAAAAAAAAAAQAAIAAAAACQAQUABgoBADEBLQNI/gAAAAAAAAwAAABQVCBCb2xkIEFyY2gAAAAAAAAAAAAAAAAAAAAAAgEEAAAAAAAAAABgAAAAAACACAAAAAAAAABAAAAAAAAAAJABBQAAAAEAKQIWBeX9AAAAAAAADgAAAFBUIEJvbGQgQnJva2VuAAAAAAAAAAAAAAAAAAAAAAIBBAAAAAAAAAAAYAAAAAAAgAgAAAAAAAAAQAAAAAAAAACQAQUAAAABABoCFgXl/QAAAAAAAA0AAABQVCBCb2xkIER1c2t5AAAAAAAAAAAAAAAAAAAAAAIBBAAAAAAAAAAAYAAAAAAAgAgAAAAAAAAAQAAAAAAAAACQAQUAAAABACACFgXl/QAAAAAAAA8AAABQVCBCb2xkIEhlYWRpbmcAAAAAAAAAAAAAAAAAAAAAAgEEAAAAAAAAAABgAAAAAACACAAAAAAAAABAAAAAAAAAAJABBQAAAAEAGwIWBeX9AAAAAAAADgAAAFBUIEJvbGQgTWlycm9yAAAAAAAAAAAAAAAAAAAAAAIBBAAAAAAAAAAAYAAAAAAAgAgAAAAAAAAAQAAAAAAAAACQAQUAAAABABoCQgUJ/gAAAAAAAA0AAABQVCBCb2xkIFN0YXJzAAAAAAAAAAAAAAAAAAAAAAIBBAAAAAAAAAAAYAAAAAAAgAgAAAAAAAAAQAAAAAAAAACQAQUAAAABACYCFgXl/QAAAAAAABMAAABQVCBTZXBhcmF0ZWQgQmFsb29uAAAAAAAAAAAAAAAAAAAAAAIBBAAAAAAAAAAAYAAAAAAAgAgAAAAAAAAAQAAAAAAAAACQAQUAAAABAFMCFgXl/QAAAAAAAAcAAABQVCBTYW5zAAAAAAEAAAAAAAAAAAAAAAILBwMCAgMCAgTvAgCgSyAAUAAAAAAAAAAAlwAAIAAAAAC8AgUAAggBABkC+gPs/gAA9AG8AgcAAABQVCBTYW5zAAAAAAEAAAABAAAAAAAAAAILBwMCAgMJAgTvAgCgSyAAUAAAAAAAAAAAlwAAIAAAAAC8AgUAAggBAAMC+gPs/gAA9AG8AgcAAABQVCBTYW5zAAAAAAAAAAABAAAAAAAAAAILBQMCAgMJAgTvAgCgSyAAUAAAAAAAAAAAlwAAIAAAAACQAQUAAggBAPcB+gPs/gAA9AG8AgcAAABQVCBTYW5zAAAAAAAAAAAAAAAAAAAAAAILBQMCAgMCAgTvAgCgSyAAUAAAAAAAAAAAlwAAIAAAAACQAQUAAggBAA8C+gPs/gAA9AG8AgUAAABSYWF2aQAAAAAAAAAAAAAAAAAAAAACCwUCBAIEAgIDAwACAAAAAAAAAAAAAAAAAAEAAAAAAAAAkAEFAAAAAQCYAdUDbP19ANIBhAIFAAAAUmFhdmkAAAAAAQAAAAAAAAAAAAAAAgsIAgQCBAICAwMAAgAAAAAAAAAAAAAAAAABAAAAAAAAALwCBQAAAAEARwLVA2z9fQDSAYQCCwAAAFJhZ2UgSXRhbGljAAAAAAAAAAAAAAAAAAAAAAMHBQIEBQcHAwQDAAAAAAAAAAAAAAAAAAAAAQAAIAAAAACQAQUAAgoBAGABgwL3/gAAAAAAAA0AAABHdXR0bWFuIFJhc2hpAAAAAAAAAAAAAAAAAAAAAAIBBAEBAQEBAQEAGAAAAAAAQAAAAAAAAAAAIAAAAAAAAACQAQUAAAABAGUB6gKw/gAAAAAAAA0AAABHdXR0bWFuIFJhc2hpAAAAAAEAAAAAAAAAAAAAAAIBBwEBAQEBAQEAGAAAAAAAQAAAAAAAAAAAIAAAAAAAAAC8AgUAAAABAHMB6gKw/gAAAAAAAAUAAABSYXZpZQAAAAAAAAAAAAAAAAAAAAAEBAgFBQgJAgYCAwAAAAAAAAAAAAAAAAAAAAEAACAAAAAAkAEGAAAKAQCxAh8DOP9UAAAAAAAXAAAATVMgUmVmZXJlbmNlIFNhbnMgU2VyaWYAAAAAAAAAAAAAAAAAAAAAAgsGBAMFBAQCBIcCAAAAAAAAAAAAAAAAAACfAQAgAAAAAJABBQAACAEA/AH8AjL/YgAAAAAAFgAAAE1TIFJlZmVyZW5jZSBTcGVjaWFsdHkAAAAAAAAAAAAAAAAAAAAABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACAAAAAAJABBQAFCAEAywIAAAAALQQAAAAAEgAAAFJvY2t3ZWxsIENvbmRlbnNlZAAAAAABAAAAAAAAAAAAAAACBgkCAgEFAgQDAwAAAAAAAAAAAAAAAAAAAAEAACAAAAAAvAIDAAMFAQCeAewCIP9hAAAAAAASAAAAUm9ja3dlbGwgQ29uZGVuc2VkAAAAAAAAAAAAAAAAAAAAAAIGBgMFBAUCAQQDAAAAAAAAAAAAAAAAAAAAAQAAIAAAAACQAQMAAwUBAE4B7AIg/2EAAAAAAAgAAABSb2Nrd2VsbAAAAAAAAAAAAAAAAAAAAAACBgYDAgIFAgQDAwAAAAAAAAAAAAAAAAAAAAEAACAAAAAAkAEFAAMFAQDMAbQCIv+aAAAAAAAIAAAAUm9ja3dlbGwAAAAAAQAAAAAAAAAAAAAAAgYIAwMFBQIEAwMAAAAAAAAAAAAAAAAAAAABAAAgAAAAALwCBQADBQEA6wGyAiX/nwAAAAAACAAAAFJvY2t3ZWxsAAAAAAEAAAABAAAAAAAAAAIGCAMDBQUJBAMDAAAAAAAAAAAAAAAAAAAAAwAAIAAAAAC8AgUAAwUBANoBtAIi/5oAAAAAABMAAABSb2Nrd2VsbCBFeHRyYSBCb2xkAAAAAAAAAAAAAAAAAAAAAAIGCQMEBQUCBAMDAAAAAAAAAAAAAAAAAAAAAQAAIAAAAAAgAwUAAwUBAFoCtAIq/6IAAAAAAAgAAABSb2Nrd2VsbAAAAAAAAAAAAQAAAAAAAAACBgYDAwUFCQQDAwAAAAAAAAAAAAAAAAAAAAEAACAAAAAAkAEFAAMFAQC9AbICIv+cAAAAAAADAAAAUm9kAAAAAAAAAAAAAAAABAAAAAIDBQkFAQEBAQEBCAAAAAAAAAAAAAAAAAAAIAAAAAAAIACQAQUAAAABAFgC3gL3/gAAAAAAAA8AAABSb2QgVHJhbnNwYXJlbnQAAAAAAAAAAAAAAAAEAAAAAAAACQAAAAAAAAAIAAAAAAAAAAAAAAAAAAAgAAAAAAAAAJABBQAAAAEAWAJAA9T+AAAAAAAAEgAAAENlbnR1cnkgU2Nob29sYm9vawAAAAABAAAAAAAAAAAAAAACBAgEBgUFAgMEhwIAAAAAAAAAAAAAAAAAAJ8AACAAANffvAIFAAIEAQALAuQCPf+FAAAAAAASAAAAQ2VudHVyeSBTY2hvb2xib29rAAAAAAEAAAABAAAAAAAAAAIECAQGBQUJAwSHAgAAAAAAAAAAAAAAAAAAnwAAIAAA19+8AgUAAgQBAAIC4wJA/4oAAAAAABIAAABDZW50dXJ5IFNjaG9vbGJvb2sAAAAAAAAAAAEAAAAAAAAAAgQGBAUFBQkDBIcCAAAAAAAAAAAAAAAAAACfAAAgAADX35ABBQACBAEAygHjAj3/hgAAAAAADgAAAFNjcmlwdCBNVCBCb2xkAAAAAAAAAAAAAAAAAAAAAAMEBgIEBgcICQQDAAAAAAAAAAAAAAAAAAAAAQAAIAAAAAC8AgUAAgoBAIkBtwIG/3sAAAAAAAsAAABTZWdvZSBQcmludAAAAAAAAAAAAAAAAAAAAAACAAYAAAAAAAAAjwIAAAAAAAAAAAAAAAAAAJ8AACAAAAFHkAEFAAAKAQCBAlcDyP6e//IBpwILAAAAU2Vnb2UgUHJpbnQAAAAAAQAAAAAAAAAAAAAAAgAIAAAAAAAAAI8CAAAAAAAAAAAAAAAAAACfAAAgAAABR7wCBQAACgEAgAJRA8n+pf/6AagCDAAAAFNlZ29lIFNjcmlwdAAAAAAAAAAAAAAAAAAAAAACCwUEAgAAAAADjwIAAAAAAAAAAAAAAAAAAJ8AAAAAAAAAkAEFAAAKAQCoAukCD/9TAAACoQIMAAAAU2Vnb2UgU2NyaXB0AAAAAAEAAAAAAAAAAAAAAAILCAQCAAAAAAOPAgAAAAAAAAAAAAAAAAAAnwAAAAAAAAC8AgUAAAoBAKYC6gIP/1IACAKoAggAAABTZWdvZSBVSQAAAAAAAAAAAAAAAAAAAAACCwUCBAIEAgID/y4A5H/kAMAJAAAAAAAAAP8BACAAAAAAkAEFAAUIAQAaAtgCLv+DAPQBvAIIAAAAU2Vnb2UgVUkAAAAAAQAAAAAAAAAAAAAAAgsIAgQCBAICA/8uAOR/5ADACQAAAAAAAAD/AQAgAAAAALwCBQAFCAEATQLYAi7/gwD0AbwCCAAAAFNlZ29lIFVJAAAAAAAAAAABAAAAAAAAAAILBQIEAgQJAgP/BgDke+QAQAEAAAAAAAAAnwEAIAAAAACQAQUAAggBAB8C2AIu/4MA9AG8Ag4AAABTZWdvZSBVSSBMaWdodAAAAAAAAAAAAAAAAAAAAAACCwUCBAIEAgID/y4A5H/kAMAJAAAAAAAAAP8BACAAAAAALAEFAAUIAQAPAtgCLv+DAPQBvAISAAAAU2Vnb2UgVUkgU2VtaWxpZ2h0AAAAAAAAAAAAAAAAAAAAAAILBAIEAgQCAgP/LgDkf+QAwAkAAAAAAAAA/wEAIAAAAABeAQUABQgBABYC2AIu/4MA9AG8AggAAABTZWdvZSBVSQAAAAABAAAAAQAAAAAAAAACCwgCBAIECQID/wYA5HvkAEABAAAAAAAAAJ8BACAAAAAAvAIFAAUIAQBMAtgCLv+DAPQBvAIOAAAAU2Vnb2UgVUkgTGlnaHQAAAAAAAAAAAEAAAAAAAAAAgsDAgQFBAkCA/8GAOR75ABAAQAAAAAAAACfAQAgAAAAACwBBQAFCAEADgLYAi7/gwD0AbwCEQAAAFNlZ29lIFVJIFNlbWlib2xkAAAAAAAAAAAAAAAAAAAAAAILBwIEAgQCAgP/LgDkf+QAwAkAAAAAAAAA/wEAIAAAAABYAgUABQgBADQC2AIu/4MA9AG8AhEAAABTZWdvZSBVSSBTZW1pYm9sZAAAAAAAAAAAAQAAAAAAAAACCwcCBAIECQID/wYA5HvkAEABAAAAAAAAAJ8BACAAAAAAWAIFAAUIAQA/AtgCLv+DAPQBvAISAAAAU2Vnb2UgVUkgU2VtaWxpZ2h0AAAAAAAAAAABAAAAAAAAAAILBAIEAgQJAgP/BgDke+QAQAEAAAAAAAAAnwEAIAAAAABeAQUABQgBABkC2AIu/4MA9AG8Ag8AAABTZWdvZSBVSSBTeW1ib2wAAAAAAAAAAAAAAAAAAAAAAgsFAgQCBAICA2MAAIDv/wASAMAkAAAAAAQBAAAAAAAAQJABBQAFCAEAwQLYAi7/gwD0AbwCDQAAAFNob25hciBCYW5nbGEAAAAAAAAAAAAAAAAAAAAAAgsFAgQCBAICAwMAAQAAAAAAAAAAAAAAAAABAAAAAAAAAJABBQAAAAEA+AEoA1X/EQBaARoCDQAAAFNob25hciBCYW5nbGEAAAAAAQAAAAAAAAAAAAAAAgsIAgQCBAICAwMAAQAAAAAAAAAAAAAAAAABAAAAAAAAALwCBQAAAAEAJwIwAk7/SgF5ASMCDwAAAFNob3djYXJkIEdvdGhpYwAAAAAAAAAAAAAAAAAAAAAEAgkEAgECAgYEAwAAAAAAAAAAAAAAAAAAAAEAACAAAAAAkAEFAAAAAQApAh0DNv9UAAAAAAAGAAAAU2hydXRpAAAAAAAAAAAAAAAAAAAAAAILBQIEAgQCAgMDAAQAAAAAAAAAAAAAAAAAAQAAAAAAAACQAQUAAAABAK4B/ANs/ZwA3gGXAgYAAABTaHJ1dGkAAAAAAQAAAAAAAAAAAAAAAgsIAgQCBAICAwMABAAAAAAAAAAAAAAAAAABAAAAAAAAALwCBQAAAAEAbAL8A2z9nADeAZcCCAAAAEZhbmdTb25nAAAAAAAAAAAAAAAAAAAAAAIBBgkGAQEBAQG/AgCA+nzPOBYAAAAAAAAAAQAEAAAAAACQAQUAAAABAPQBWwN0/4wAuQGbAgYAAABTaW1IZWkAAAAAAAAAAAAAAAAAAAAAAgEGCQYBAQEBAb8CAID6fM84FgAAAAAAAAABAAQAAAAAAJABBQAAAAEA9AFbA3T/jADJAa8CBQAAAEthaVRpAAAAAAAAAAAAAAAAAAAAAAIBBgkGAQEBAQG/AgCA+nzPOBYAAAAAAAAAAQAEAAAAAACQAQUAAAABAPQBWwN0/4wAzAGvAgQAAABMaVN1AAAAAAAAAAAAAAAABAAAAAIBBQkGAQEBAQEBAAAAAAAOCAAAAAAAAAAAAAAEAAAAAACQAQUAAAABAPQBWwN0/4wAAAAAABEAAABTaW1wbGlmaWVkIEFyYWJpYwAAAAABAAAAAAAAAAAAAAACAggDBQQFAgMEAyAAAAAAAAAAAAAAAAAAAEEAAAAAAAggvAIFAAAAAQDgAZsEHv4AABECwwIXAAAAU2ltcGxpZmllZCBBcmFiaWMgRml4ZWQAAAAAAAAAAAAAAAAEAAAAAgcDCQICBQIEBAMgAAAAAAAAAAAAAAAAAABBAAAAAAAIIJABBQAAAAEAVwIfA93+AAAAAAAAEQAAAFNpbXBsaWZpZWQgQXJhYmljAAAAAAAAAAAAAAAAAAAAAAICBgMFBAUCAwQDIAAAAAAAAAAAAAAAAAAAQQAAAAAACCCQAQUAAAABAJgBmwQi/gAAEQLDAgYAAABTaW1TdW4AAAAAAAAAAAAAAAAAAAAAAgEGAAMBAQEBAQMAAAAAAI8oBgAAAAAAAAABAAQAAAAAAJABBQAAAAEA9AFbA3T/jADFAasCBwAAAE5TaW1TdW4BAAAAAAAAAAAAAAAEAAAAAgEGCQMBAQEBAQMAAAAAAI8oBgAAAAAAAAABAAQAAAAAAJABBQAAAAEA9AFbA3T/jADFAasCCwAAAFNpbVN1bi1FeHRCAAAAAAAAAAAAAAAABAAAAAIBBgkGAQEBAQEBAAAAAAAAAgAAAAAAAAAAAQAEAAAAAACQAQUAAAABAPQBWwN0/4wAAAAAAAcAAABZb3VZdWFuAAAAAAAAAAAAAAAABAAAAAIBBQkGAQEBAQEBAAAAAAAOCAAAAAAAAAAAAAAEAAAAAACQAQUAAAABAPQBWwN0/4wAAAAAAAgAAABTbmFwIElUQwAAAAAAAAAAAAAAAAAAAAAEBAoHBgoCAgICAwAAAAAAAAAAAAAAAAAAAAEAACAAAAAAkAEFAAgKAQBGAvcCEP/IAAAAAAATAAAAU2ltcGxlIEJvbGQgSnV0IE91dAAAAAAAAAAAAAAAAAAAAAACAQQBAQEBAQEBAGAAAAAAAIAIAAAAAAAAAEAAAAAAAAAAkAEFAAAAAQBOAuIDDP4AAAAAAAAUAAAAUFQgU2ltcGxlIEJvbGQgUnVsZWQAAAAAAAAAAAAAAAAAAAAAAgEEAAAAAAAAAABgAAAAAACACAAAAAAAAABAAAAAAAAAAJABBQAAAAEAGwJHBeX9AAAAAAAAFQAAAFNpbXBsZSBJbmR1c3QgT3V0bGluZQAAAAAAAAAAAAAAAAAAAAACAQQAAAAAAAAAAGAAAAAAAIAIAAAAAAAAAEAAAAAAAAAAkAEFAAAAAQAyAikF5f0AAAAAAAAUAAAAU2ltcGxlIEluZHVzdCBTaGFkZWQAAAAAAAAAAAAAAAAAAAAAAgEEAAAAAAAAAABgAAAAAACACAAAAAAAAABAAAAAAAAAAJABBQAAAAEAngIpBeX9AAAAAAAAEgAAAFNpbXBsZSBPdXRsaW5lIFBhdAAAAAAAAAAAAAAAAAAAAAACAQQAAAAAAAAAAGAAAAAAAIAIAAAAAAAAAEAAAAAAAAAAkAEFAAAAAQASArQE5f0AAAAAAAAMAAAAR3V0dG1hbiBTdGFtAAAAAAAAAAAAAAAAAAAAAAIBBAEBAQEBAQEAGAAAAAAAQAAAAAAAAAAAIAAAAAAAAACQAQUAAAABAKcB6gKw/gAAAAAAAA0AAABHdXR0bWFuIFN0YW0xAAAAAAAAAAAAAAAAAAAAAAIBBAEBAQEBAQEAGAAAAAAAQAAAAAAAAAAAIAAAAAAAAACQAQUAAAABAKcB6gKw/gAAAAAAAAgAAABTVENhaXl1bgAAAAAAAAAAAAAAAAAAAAACAQgABAEBAQEBAQAAAAAADwgAAAAAAAAAAAAABAAAAAAAkAEFAAAAAQC7ASADOP+QAAAAAAAHAAAAU3RlbmNpbAAAAAAAAAAAAAAAAAAAAAAEBAkFDQgCAgQEAwAAAAAAAAAAAAAAAAAAAAEAACAAAAAAkAEFAAAAAQAqApoCAABNAQAAAAAKAAAAU1RGYW5nc29uZwAAAAAAAAAAAAAAAAAAAAACAQYABAEBAQEBhwIAAAAADwgAAAAAAAAAAJ8ABAAAANffkAEFAAAAAQCDASADOP+QAAAAAAAGAAAAU1RIdXBvAAAAAAAAAAAAAAAAAAAAAAIBCAAEAQEBAQEBAAAAAAAPCAAAAAAAAAAAAAAEAAAAAACQAQUAAAABALsBIAM4/5AAAAAAAAcAAABTVEthaXRpAAAAAAAAAAAAAAAAAAAAAAIBBgAEAQEBAQGHAgAAAAAPCAAAAAAAAAAAnwAEAAAA19+QAQUAAAABAIMBIAM4/5AAAAAAAAYAAABTVExpdGkAAAAAAAAAAAAAAAAAAAAAAgEIAAQBAQEBAQEAAAAAAA8IAAAAAAAAAAAAAAQAAAAAAJABBQAAAAEAYgGxAv3+kAAAAAAABgAAAFNUU29uZwAAAAAAAAAAAAAAAAAAAAACAQYABAEBAQEBhwIAAAAADwgAAAAAAAAAAJ8ABAAAANffkAEFAAAAAQCDASADOP+QAAAAAAAHAAAAU1RYaWhlaQAAAAAAAAAAAAAAAAAAAAACAQYABAEBAQEBhwIAAAAADwgAAAAAAAAAAJ8ABAAAANffkAEFAAAAAQDhASADOP+QAAAAAAAJAAAAU1RYaW5na2FpAAAAAAAAAAAAAAAAAAAAAAIBCAAEAQEBAQEBAAAAAAAPCAAAAAAAAAAAAAAEAAAAAACQAQUAAAABADkBIAM4/5AAAAAAAAgAAABTVFhpbndlaQAAAAAAAAAAAAAAAAAAAAACAQgABAEBAQEBAQAAAAAADwgAAAAAAAAAAAAABAAAAAAAkAEFAAAAAQCtASADOP+QAAAAAAALAAAAU1RaaG9uZ3NvbmcAAAAAAAAAAAAAAAAAAAAAAgEGAAQBAQEBAYcCAAAAAA8IAAAAAAAAAACfAAQAAADX35ABBQAAAAEA7AEgAzj/kAAAAAAABwAAAFN5bGZhZW4AAAAAAAAAAAAAAAAAAAAAAQoFAgUDBgMDA4cGAAQAAAAAAAAAAAAAAACfAAAgAAAAAJABBQACBQEAowHhAuf+KgGyAaACBgAAAFN5bWJvbAAAAAAAAAAAAAAAAAAAAAAFBQECAQcGAgUHAAAAAAAAAAAAAAAAAAAAAAAAAIAAAAAAkAEFAAMMAQBYArUCKf+VAAAAAAAGAAAAVGFob21hAAAAAAAAAAAAAAAAAAAAAAILBgQDBQQEAgT/LgDhW2AAwCkAAAAAAAAA/wEBIAAAKCCQAQUAAAgBALwB/AIy/xwAIQLXAgYAAABUYWhvbWEAAAAAAQAAAAAAAAAAAAAAAgsIBAMFBAQCBP8uAOFbYADAKQAAAAAAAAD/AQEgAAAoILwCBQAACAEA+QH8AjL/HAAkAtcCEAAAAE1pY3Jvc29mdCBUYWkgTGUAAAAAAAAAAAAAAAAAAAAAAgsFAgQCBAICAwMAAAAAAAAAAAAAQAAAAAABAAAAAAAAAJABBQAFCAEASgLuAhX/UwD0AbwCEAAAAE1pY3Jvc29mdCBUYWkgTGUAAAAAAQAAAAAAAAAAAAAAAgsIAgQCBAICAwMAAAAAAAAAAAAAQAAAAAABAAAAAAAAALwCBQAFCAEAawLvAhb/UwD0AbwCCQAAAFRhbGwgUGF1bAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAwAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAkAEFAAAAAQAbAWsCnP4AAAAAAAAJAAAAVHcgQ2VuIE1UAAAAAAEAAAABAAAAAAAAAAILCAICAQQJBgMDAAAAAAAAAAAAAAAAAAAAAwAAIAAAAAC8AgUABAgBAH0BsQJE/74AAAAAAAkAAABUdyBDZW4gTVQAAAAAAQAAAAAAAAAAAAAAAgsIAgIBBAIGAwMAAAAAAAAAAAAAAAAAAAADAAAgAAAAALwCBQAECAEAowGxAkT/vgAAAAAAEwAAAFR3IENlbiBNVCBDb25kZW5zZWQAAAAAAQAAAAAAAAAAAAAAAgsIBgIBBAICAwMAAAAAAAAAAAAAAAAAAAADAAAgAAAAALwCBQAECAEAYQGMAkf/5wAAAAAAHgAAAFR3IENlbiBNVCBDb25kZW5zZWQgRXh0cmEgQm9sZAAAAAAAAAAAAAAAAAAAAAACCwgDAgICAgIEAwAAAAAAAAAAAAAAAAAAAAMAACAAAAAAkAEFAAQIAQB8Aa8CR//EAAAAAAATAAAAVHcgQ2VuIE1UIENvbmRlbnNlZAAAAAAAAAAAAAAAAAAAAAACCwYGAgEEAgIDAwAAAAAAAAAAAAAAAAAAAAMAACAAAAAAkAEFAAQIAQAsAYwCR//nAAAAAAAJAAAAVHcgQ2VuIE1UAAAAAAAAAAABAAAAAAAAAAILBgICAQQJBgMDAAAAAAAAAAAAAAAAAAAAAwAAIAAAAACQAQUABAgBAH8BsQJE/74AAAAAAAkAAABUdyBDZW4gTVQAAAAAAAAAAAAAAAAAAAAAAgsGAgIBBAIGAwMAAAAAAAAAAAAAAAAAAAADAAAgAAAAAJABBQAECAEAjgGxAkT/vgAAAAAADwAAAFRlbXB1cyBTYW5zIElUQwAAAAAAAAAAAAAAAAAAAAAEAgQEAw0HAgICAwAAAAAAAAAAAAAAAAAAAAEAACAAAAAAkAEFAAUKAQCgAXQD2P6R/wAAAAAPAAAAVGltZXMgTmV3IFJvbWFuAAAAAAAAAAAAAAAAAAAAAAICBgMFBAUCAwT/KgDgQ3gAwAkAAAAAAAAA/wEAQAAA//+QAQUABQEBAJABtQIp/5UAvwGWAg8AAABUaW1lcyBOZXcgUm9tYW4AAAAAAQAAAAAAAAAAAAAAAgIIAwcFBQIDBP8qAOBDeADACQAAAAAAAAD/AQBAAAD//7wCBQAFAQEAqgGlAin/lQDIAZYCDwAAAFRpbWVzIE5ldyBSb21hbgAAAAABAAAAAQAAAAAAAAACAgcDBgUFCQME/woA4EN4AEABAAAAAAAAAL8BAEAAAPffvAIFAAUBAQCcAaUCKf+VALYBlgIPAAAAVGltZXMgTmV3IFJvbWFuAAAAAAAAAAABAAAAAAAAAAICBQMFBAUJAwT/CgDgQ3gAQAEAAAAAAAAAvwEAQAAA99+QAQUABQEBAJEBtgIp/5UArgGWAhIAAABUcmFkaXRpb25hbCBBcmFiaWMAAAAAAQAAAAAAAAAAAAAAAgIIAwcFBQIDBAMgAAAAAACACAAAAAAAAABBAAAAAAAIILwCBQAAAAEA4QH+AwP+AADXAbwCEgAAAFRyYWRpdGlvbmFsIEFyYWJpYwAAAAAAAAAAAAAAAAAAAAACAgYDBQQFAgMEAyAAAAAAAIAIAAAAAAAAAEEAAAAAAAggkAEFAAAAAQDLAeIDDP4AAMoBtQIMAAAAVHJlYnVjaGV0IE1TAAAAAAAAAAAAAAAAAAAAAAILBgMCAgICAgSHAgAAAwAAAAAAAAAAAAAAnwAAIAAAAACQAQUAAggBAMUB4QIz/wAACgLLAgwAAABUcmVidWNoZXQgTVMAAAAAAQAAAAAAAAAAAAAAAgsHAwICAgICBIcCAAADAAAAAAAAAAAAAACfAAAgAAAAALwCBQACCAEA2QHhAjP/AAAKAssCDAAAAFRyZWJ1Y2hldCBNUwAAAAABAAAAAQAAAAAAAAACCwcDAgICCQIEhwIAAAMAAAAAAAAAAAAAAJ8AACAAAAAAvAIFAAIIAQDhAeECM/8AAAoCywIMAAAAVHJlYnVjaGV0IE1TAAAAAAAAAAABAAAAAAAAAAILBgMCAgIJAgSHAgAAAwAAAAAAAAAAAAAAnwAAIAAAAACQAQUAAggBAMoB4QIz/wAACgLLAgUAAABUdW5nYQAAAAAAAAAAAAAAAAAAAAACCwUCBAIEAgIDAwBAAAAAAAAAAAAAAAAAAAEAAAAAAAAAkAEFAAAAAQAkAiUDav1tAJIBLgIFAAAAVHVuZ2EAAAAAAQAAAAAAAAAAAAAAAgsIAgQCBAICAwMAQAAAAAAAAAAAAAAAAAABAAAAAAAAALwCBQAFCAEAKwIlA2r9bQCSAS4CDgAAAEd1dHRtYW4gSGF0enZpAAAAAAEAAAAAAAAAAAAAAAIBBwEBAQEBAQEAGAAAAAAAQAAAAAAAAAAAIAAAAAAAAAC8AgUAAAABAJ0B6gKw/gAAAAAAAA4AAABHdXR0bWFuIEhhdHp2aQAAAAAAAAAAAAAAAAAAAAACAQQBAQEBAQEBABgAAAAAAEAAAAAAAAAAACAAAAAAAAAAkAEFAAAAAQCsAeoCsP4AAAAAAAAGAAAAVWJ1bnR1AAAAAAEAAAAAAAAAAAAAAAILCAQDBgIDAgT/AgDgWyAAUAAAAAAAAAAAnwAAIAAAAVa8AgUAAAABAIMCCANH/zgADgK1AgYAAABVYnVudHUAAAAAAQAAAAEAAAAAAAAAAgsIBAMGAgoCBP8CAOBbIABQAAAAAAAAAACfAAAgAAABVrwCBQAAAAEAegIIA0f/OAAOArUCBgAAAFVidW50dQAAAAAAAAAAAQAAAAAAAAACCwUEAwYCCgIE/wIA4FsgAFAAAAAAAAAAAJ8AACAAAAFWkAEFAAAAAQBIAggDR/84AAgCtQIGAAAAVWJ1bnR1AAAAAAAAAAAAAAAAAAAAAAILBQQDBgIDAgT/AgDgWyAAUAAAAAAAAAAAnwAAIAAAAVaQAQUAAAABAFoCCANH/zgACAK1AhAAAABVYnVudHUgQ29uZGVuc2VkAAAAAAAAAAAAAAAAAAAAAAILBQYDBgIDAgT/AgDgWyAAUAAAAAAAAAAAnwAAIAAAAVaQAQUAAAABAOQBCANH/zgACAK1AgsAAABEaWxsZW5pYVVQQwAAAAABAAAAAAAAAAAAAAACAggDBwUFAgMEJwAAgQIAAAAAAAAAAAAAAAEAAQAAAAAAvAIFAAAAAQAiAXgDBP8AAD8B0AELAAAARGlsbGVuaWFVUEMAAAAAAQAAAAEAAAAAAAAAAgIHAwYFBQkDBCcAAIECAAAAAAAAAAAAAAABAAEAAAAAALwCBQAAAAEAIgF2AwT/AAA/AdABCwAAAERpbGxlbmlhVVBDAAAAAAAAAAABAAAAAAAAAAICBQMFBAUJAwQnAACBAgAAAAAAAAAAAAAAAQABAAAAAACQAQUAAAABABwBbAME/wAAPwHQAQsAAABEaWxsZW5pYVVQQwAAAAAAAAAAAAAAAAAAAAACAgYDBQQFAgMEJwAAgQIAAAAAAAAAAAAAAAEAAQAAAAAAkAEFAAAAAQAcAWwDBP8AAD8B0AELAAAARXVjcm9zaWFVUEMAAAAAAQAAAAAAAAAAAAAAAgIIAwcFBQIDBCcAAIECAAAAAAAAAAAAAAABAAEAAAAAALwCBQAAAAEAHwE/AwD/AAAxAcIBCwAAAEV1Y3Jvc2lhVVBDAAAAAAEAAAABAAAAAAAAAAICBwMGBQUJAwQnAACBAgAAAAAAAAAAAAAAAQABAAAAAAC8AgUAAAABAB8BPwMA/wAAMQHCAQsAAABFdWNyb3NpYVVQQwAAAAAAAAAAAQAAAAAAAAACAgUDBQQFCQMEJwAAgQIAAAAAAAAAAAAAAAEAAQAAAAAAkAEFAAAAAQAZAUcDG/8AADEBwgELAAAARXVjcm9zaWFVUEMAAAAAAAAAAAAAAAAAAAAAAgIGAwUEBQIDBCcAAIECAAAAAAAAAAAAAAABAAEAAAAAAJABBQAAAAEAGQFHAxj/AAAxAcIBCgAAAEZyZWVzaWFVUEMAAAAAAQAAAAAAAAAAAAAAAgsHBAICAgICBAcAAAECAAAAAAAAAAAAAAABAAEAAAAAALwCBQAAAAEAIQFHAwD/AAAAAAAACgAAAEZyZWVzaWFVUEMAAAAAAQAAAAEAAAAAAAAAAgsHBAICAgkCBAcAAAECAAAAAAAAAAAAAAABAAEAAAAAALwCBQAAAAEAIQFHAwD/AAAAAAAACgAAAEZyZWVzaWFVUEMAAAAAAAAAAAEAAAAAAAAAAgsGBAICAgkCBAcAAAECAAAAAAAAAAAAAAABAAEAAAAAAJABBQAAAAEAIwEwAy7/AAAAAAAACgAAAEZyZWVzaWFVUEMAAAAAAAAAAAAAAAAAAAAAAgsGBAICAgICBAcAAAECAAAAAAAAAAAAAAABAAEAAAAAAJABBQAAAAEAIwEwAy7/AAAAAAAABwAAAElyaXNVUEMAAAAAAQAAAAAAAAAAAAAAAgsHBAICAgICBAcAAAECAAAAAAAAAAAAAAABAAEAAAAAALwCBQAAAAEAIwFIAzT/AAAAAAAABwAAAElyaXNVUEMAAAAAAQAAAAEAAAAAAAAAAgsHBAICAgkCBAcAAAECAAAAAAAAAAAAAAABAAEAAAAAALwCBQAAAAEAIwFIAzT/AAAAAAAABwAAAElyaXNVUEMAAAAAAAAAAAEAAAAAAAAAAgsGBAICAgkCBAcAAAECAAAAAAAAAAAAAAABAAEAAAAAAJABBQAAAAEAGwEvAxv/AAAAAAAABwAAAElyaXNVUEMAAAAAAAAAAAAAAAAAAAAAAgsGBAICAgICBAcAAAECAAAAAAAAAAAAAAABAAEAAAAAAJABBQAAAAEAGwEvAxv/AAAAAAAACgAAAEphc21pbmVVUEMAAAAAAQAAAAAAAAAAAAAAAgIIAwcFBQIDBAcAAAECAAAAAAAAAAAAAAABAAEAAAAAALwCBQAAAAEAMgEHA07/AAAAAAAACgAAAEphc21pbmVVUEMAAAAAAQAAAAEAAAAAAAAAAgIHAwYFBQkDBAcAAAECAAAAAAAAAAAAAAABAAEAAAAAALwCBQAAAAEAMgEHA07/AAAAAAAACgAAAEphc21pbmVVUEMAAAAAAAAAAAEAAAAAAAAAAgIFAwUEBQkDBAcAAAECAAAAAAAAAAAAAAABAAEAAAAAAJABBQAAAAEAEAHOAlf/AAAAAAAACgAAAEphc21pbmVVUEMAAAAAAAAAAAAAAAAAAAAAAgIGAwUEBQIDBAcAAAECAAAAAAAAAAAAAAABAAEAAAAAAJABBQAAAAEAEAHOAlf/AAAAAAAADAAAAEtvZGNoaWFuZ1VQQwAAAAABAAAAAAAAAAAAAAACAggDBwUFAgMEBwAAAQIAAAAAAAAAAAAAAAEAAQAAAAAAvAIFAAAAAQAaAa8CN/8AAAAAAAAMAAAAS29kY2hpYW5nVVBDAAAAAAEAAAABAAAAAAAAAAICBwMGBQUJAwQHAAABAgAAAAAAAAAAAAAAAQABAAAAAAC8AgUAAAABABoBrwI3/wAAAAAAAAwAAABLb2RjaGlhbmdVUEMAAAAAAAAAAAEAAAAAAAAAAgIFAwUEBQkDBAcAAAECAAAAAAAAAAAAAAABAAEAAAAAAJABBQAAAAEAEQGyAj7/AAAAAAAADAAAAEtvZGNoaWFuZ1VQQwAAAAAAAAAAAAAAAAAAAAACAgYDBQQFAgMEBwAAAQIAAAAAAAAAAAAAAAEAAQAAAAAAkAEFAAAAAQARAbICPv8AAAAAAAAHAAAATGlseVVQQwAAAAABAAAAAAAAAAAAAAACCwcEAgICAgIEBwAAAQIAAAAAAAAAAAAAAAEAAQAAAAAAvAIFAAAAAQBCAeICTv8AAAAAAAAHAAAATGlseVVQQwAAAAABAAAAAQAAAAAAAAACCwcEAgICCQIEBwAAAQIAAAAAAAAAAAAAAAEAAQAAAAAAvAIFAAAAAQBCAeICTv8AAAAAAAAHAAAATGlseVVQQwAAAAAAAAAAAQAAAAAAAAACCwYEAgICCQIEBwAAAQIAAAAAAAAAAAAAAAEAAQAAAAAAkAEFAAAAAQAdAaYCb/8AAAAAAAAHAAAATGlseVVQQwAAAAAAAAAAAAAAAAAAAAACCwYEAgICAgIEBwAAAQIAAAAAAAAAAAAAAAEAAQAAAAAAkAEFAAAAAQAdAaYCb/8AAAAAAAAQAAAAVXJkdSBUeXBlc2V0dGluZwAAAAAAAAAAAAAAAAAAAAADAgQCBAQGAwIDAyAAAAAAAIAIAAAAAAAAANMAACAAAAAAkAEFAAAAAQCSAckC4/5GAIwBaAIGAAAAVXRzYWFoAAAAAAAAAAAAAAAAAAAAAAILBgQCAgICAgQDgAAAAAAAAAAAAAAAAAAAAQAAAAAAAACQAQUAAAABAKUBCQJq/40BcwEAAgYAAABVdHNhYWgAAAAAAQAAAAAAAAAAAAAAAgsIBAICAgICBAOAAAAAAAAAAAAAAAAAAAABAAAAAAAAALwCBQAAAAEAuQEJAmr/jQFzAQACBgAAAFV0c2FhaAAAAAABAAAAAQAAAAAAAAACCwgEAgICAgIEA4AAAAAAAAAAAAAAAAAAAAEAAAAAAAAAvAIFAAAAAQC5AQkCav+NAXMBAAIGAAAAVXRzYWFoAAAAAAAAAAABAAAAAAAAAAILBgQCAgICAgQDgAAAAAAAAAAAAAAAAAAAAQAAAAAAAACQAQUAAAABAKUBCQJs/48BcwEAAgQAAABWYW5pAAAAAAAAAAAAAAAAAAAAAAILBQIEAgQCAgMDACAAAAAAAAAAAAAAAAAAAQAAAAAAAACQAQUAAwQBANAC9AIo/2AA4QG0AgQAAABWYW5pAAAAAAEAAAAAAAAAAAAAAAILCAIEAgQCAgMDACAAAAAAAAAAAAAAAAAAAQAAAAAAAAC8AgUAAwQBABID9AIo/2AA5AG0AgcAAABWZXJkYW5hAAAAAAAAAAAAAAAAAAAAAAILBgQDBQQEAgT/BgChWyAAQBAAAAAAAAAAnwEAIAAAAACQAQUAAAgBAPwB/AIy/2IAIQLXAgcAAABWZXJkYW5hAAAAAAEAAAAAAAAAAAAAAAILCAQDBQQEAgT/BgChWyAAQBAAAAAAAAAAnwEAIAAAAAC8AgUAAAgBADcC/AIy/2IAJALXAgcAAABWZXJkYW5hAAAAAAAAAAABAAAAAAAAAAILBgQDBQQLAgT/BgChWyAAQBAAAAAAAAAAnwEAIAAAAACQAQUAAAgBAPwB/AIy/2IAIQLXAgcAAABWZXJkYW5hAAAAAAEAAAABAAAAAAAAAAILCAQDBQQLAgT/BgChWyAAQBAAAAAAAAAAnwEAIAAAAAC8AgUAAAgBADcC/AIy/2IAJALXAgYAAABWaWpheWEAAAAAAAAAAAAAAAAAAAAAAgsGBAICAgICBAMAEAAAAAAAAAAAAAAAAAABAAAAAAAAAJABBQAAAAEAXwIvAlP/UAFjARUCBgAAAFZpamF5YQAAAAABAAAAAAAAAAAAAAACCwgEAgICAgIEAwAQAAAAAAAAAAAAAAAAAAEAAAAAAAAAvAIFAAAAAQBjAiECU/9eAWwBFQINAAAAR3V0dG1hbiBWaWxuYQAAAAAAAAAAAAAAAAAAAAACAQQBAQEBAQEBABgAAAAAAEAAAAAAAAAAACAAAAAAAAAAkAEFAAAAAQCFAeoCsP4AAAAAAAANAAAAR3V0dG1hbiBWaWxuYQAAAAABAAAAAAAAAAAAAAACAQcAAAAAAAAAABgAAAAAAEAAAAAAAAAAACAAAAAAAAAAvAIFAAAAAQCOAeoCsP4AAAAAAAAOAAAAVmluZXIgSGFuZCBJVEMAAAAAAAAAAAAAAAAAAAAAAwcFAgMFAgICAwMAAAAAAAAAAAAAAAAAAAABAAAgAAAAAJABBQAFCgEAyAEJA5n9vf4AAAAABwAAAFZpdmFsZGkAAAAAAAAAAAEAAAAAAAAAAwIGAgUFBgkIBAMAAAAAAAAAAAAAAAAAAAABAAAgAAAAAJABAwAAAAEAJgGHA+P+HgAAAAAADwAAAFZsYWRpbWlyIFNjcmlwdAAAAAAAAAAAAAAAAAAAAAADBQQCBAQHBwMFAwAAAAAAAAAAAAAAAAAAAAEAACAAAAAAkAEFAAMKAQBFAVoC1v5jAAAAAAAGAAAAVnJpbmRhAAAAAAAAAAAAAAAAAAAAAAILBQIEAgQCAgMDAAEAAAAAAAAAAAAAAAAAAQAAAAAAAACQAQUAAAABAHoC2AOF/ikA0AGCAgYAAABWcmluZGEAAAAAAQAAAAAAAAAAAAAAAgsIAgQCBAICAwMAAQAAAAAAAAAAAAAAAAABAAAAAAAAALwCBQAAAAEArgLYA4X+KQDQAYQCCAAAAFdlYmRpbmdzAAAAAAAAAAAAAAAAAAAAAAUDAQIBBQkGBwMAAAAAAAAAAAAAAAAAAAAAAAAAgAAAAACQAQUAAAwBAMsDHwM4/wAAAAAAAAkAAABXaW5nZGluZ3MAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACAAAAAAJABBQAADAEAeQMCA80AFwAAAAAACwAAAFdpbmdkaW5ncyAyAAAAAAAAAAAAAAAAAAAAAAUCAQIBBQcHBwcAAAAAAAAAAAAAAAAAAAAAAAAAgAAAAACQAQUAAAwBAD4DAgPNABcAAAAAAAsAAABXaW5nZGluZ3MgMwAAAAAAAAAAAAAAAAAAAAAFBAECAQgHBwcHAAAAAAAAAAAAAAAAAAAAAAAAAIAAAAAAkAEFAAAMAQAFAwIDzQAXAAAAAAARAAAASGFuV2FuZ01pbmdNZWRpdW0AAAAAAAAAAAAAAAAAAAAAAgIDAAAAAAAAAOMAAIB6eMk4FgAAAAAAAAAAABAAAAAAAJABBQAAAAEA5AMgAzn/xwAAAAAA"; var _ft_stream=CreateFontData2(_base64_data);var _file_stream=new AscCommon.FileStream(_ft_stream.data,_ft_stream.size);var i=0;this.FONTS_DICT_ASCII_NAMES_COUNT=_file_stream.GetLong();for(i=0;i>10& 1023)+String.fromCharCode(56320|code&1023)}},GetUTF16_fromUTF8:function(pBuffer,start,count){var _res="";var lIndex=start;var end=start+count;var val=0;while(lIndex255||_char_code<0){bIsAscii=false;break}}var pFont=null;if(bIsAscii){var nStartIndex=this.FD_Ascii_Names_Offsets[oFormat.wsName.charCodeAt(0)];if(-1!= nStartIndex){var nIndex=-1;for(i=nStartIndex;i>1);break}default:{this.m_wsFontName=this._readStringUtf8(fs,_len);var _count=fs.GetLong(); if(0<_count)this.m_names=[];for(var nameI=0;nameI<_count;nameI++)this.m_names.push(this._readStringUtf8(fs));break}}if(bIsDictionary!==false){switch(_version){case 0:{_len=fs.GetLong();this.m_wsFontPath=fs.GetString(_len>>1);break}default:{this.m_wsFontPath=this._readStringUtf8(fs);break}}if(undefined===window["AscDesktopEditor"]){var _found1=this.m_wsFontPath.lastIndexOf("/");var _found2=this.m_wsFontPath.lastIndexOf("\\");var _found=Math.max(_found1,_found2);if(0<=_found)this.m_wsFontPath=this.m_wsFontPath.substring(_found+ 1)}else{this.m_wsFontPath=this.m_wsFontPath.replace(/\\\\/g,"\\");this.m_wsFontPath=this.m_wsFontPath.replace(/\\/g,"/")}}this.m_lIndex=fs.GetLong();this.m_bItalic=1==fs.GetLong();this.m_bBold=1==fs.GetLong();this.m_bIsFixed=1==fs.GetLong();var _panose_len=10;if(bIsDictionary!==false)_panose_len=fs.GetLong();for(var i=0;i<_panose_len;i++)this.m_aPanose[i]=fs.GetUChar();this.m_ulUnicodeRange1=fs.GetULong();this.m_ulUnicodeRange2=fs.GetULong();this.m_ulUnicodeRange3=fs.GetULong();this.m_ulUnicodeRange4= fs.GetULong();this.m_ulCodePageRange1=fs.GetULong();this.m_ulCodePageRange2=fs.GetULong();this.m_usWeigth=fs.GetUShort();this.m_usWidth=fs.GetUShort();this.m_sFamilyClass=FT_Common.UShort_To_Short(fs.GetUShort());this.m_eFontFormat=FT_Common.UShort_To_Short(fs.GetUShort());this.m_shAvgCharWidth=FT_Common.UShort_To_Short(fs.GetUShort());this.m_shAscent=FT_Common.UShort_To_Short(fs.GetUShort());this.m_shDescent=FT_Common.UShort_To_Short(fs.GetUShort());this.m_shLineGap=FT_Common.UShort_To_Short(fs.GetUShort()); this.m_shXHeight=FT_Common.UShort_To_Short(fs.GetUShort());this.m_shCapHeight=FT_Common.UShort_To_Short(fs.GetUShort())},GetStyle:function(){if(this.m_bBold&&this.m_bItalic)return 3;else if(this.Bold)return 1;else if(this.m_bItalic)return 2;else return 0},GetPenalty:function(oSelect,isName0,_main_ranges){var nCurPenalty=0;if(undefined!==oSelect.pPanose)nCurPenalty+=this.GetPanosePenalty(oSelect.pPanose);if(true)if(undefined!==oSelect.ulRange1&&undefined!==oSelect.ulRange2&&undefined!==oSelect.ulRange3&& undefined!==oSelect.ulRange4&&undefined!==oSelect.ulCodeRange1&&undefined!==oSelect.ulCodeRange2)nCurPenalty+=this.GetSigPenalty(oSelect,nCurPenalty>=1E3?50:10,10,_main_ranges);var unCharset=FD_UNKNOWN_CHARSET;if(undefined!==oSelect.unCharset)unCharset=oSelect.unCharset;if(undefined!==oSelect.bFixedWidth)nCurPenalty+=this.GetFixedPitchPenalty(oSelect.bFixedWidth);var nNamePenalty=0;if(oSelect.wsName!==undefined&&oSelect.wsAltName!==undefined)nNamePenalty+=Math.min(this.GetFaceNamePenalty(oSelect.wsName), this.GetFaceNamePenalty(oSelect.wsAltName));else if(oSelect.wsName!==undefined)nNamePenalty+=this.GetFaceNamePenalty(oSelect.wsName);else if(oSelect.wsAltName!==undefined)nNamePenalty+=this.GetFaceNamePenalty(oSelect.wsAltName);if(true===isName0&&0==nNamePenalty)return 0;nCurPenalty+=nNamePenalty;if(undefined!=oSelect.usWidth)nCurPenalty+=this.GetWidthPenalty(oSelect.usWidth);if(undefined!==oSelect.usWeight)nCurPenalty+=this.GetWeightPenalty(oSelect.usWeight);if(undefined!==oSelect.bBold)nCurPenalty+= this.GetBoldPenalty(oSelect.bBold);if(undefined!==oSelect.bItalic)nCurPenalty+=this.GetItalicPenalty(oSelect.bItalic);if(undefined!==oSelect.wsFamilyClass)nCurPenalty+=this.GetFamilyUnlikelyPenalty(oSelect.wsFamilyClass);else if(undefined!==oSelect.sFamilyClass)nCurPenalty+=this.GetFamilyUnlikelyPenalty1(oSelect.sFamilyClass);nCurPenalty+=this.GetCharsetPenalty(unCharset);if(undefined!==oSelect.shAvgCharWidth)nCurPenalty+=this.GetAvgWidthPenalty(oSelect.shAvgCharWidth);if(undefined!==oSelect.shAscent)nCurPenalty+= this.GetAscentPenalty(oSelect.shAscent);if(undefined!==oSelect.shDescent)nCurPenalty+=this.GetDescentPenalty(oSelect.shDescent);if(undefined!==oSelect.shLineGap)nCurPenalty+=this.GetLineGapPenalty(oSelect.shLineGap);if(undefined!==oSelect.shXHeight)nCurPenalty+=this.GetXHeightPenalty(oSelect.shXHeight);if(undefined!==oSelect.shCapHeight)nCurPenalty+=this.GetCapHeightPenalty(oSelect.shCapHeight);return nCurPenalty},GetPanosePenalty:function(pReqPanose){var nPenalty=0;for(var nIndex=0;nIndex<10;nIndex++)if(this.m_aPanose[nIndex]!= pReqPanose[nIndex]&&0!=pReqPanose[nIndex]){var nKoef=Math.abs(this.m_aPanose[nIndex]-pReqPanose[nIndex]);switch(nIndex){case 0:nPenalty+=1E3*nKoef;break;case 1:nPenalty+=100*nKoef;break;case 2:nPenalty+=100*nKoef;break;case 3:nPenalty+=100*nKoef;break;case 4:nPenalty+=100*nKoef;break;case 5:nPenalty+=100*nKoef;break;case 6:nPenalty+=100*nKoef;break;case 7:nPenalty+=100*nKoef;break;case 8:nPenalty+=100*nKoef;break;case 9:nPenalty+=100*nKoef;break}}return nPenalty},GetSigPenalty:function(format,dRangeWeight, dRangeWeightSuferflouous,_main_ranges){var dPenalty=0;var arrCandidate=typeof Int8Array!="undefined"&&!window.opera?new Uint8Array(192):new Array(192);var arrRequest=typeof Int8Array!="undefined"&&!window.opera?new Uint8Array(192):new Array(192);for(var i=0;i<192;i++){arrCandidate[i]=0;arrRequest[i]=0}var nRangesCount=0;var nAddCount=0;var ulCandRanges=[this.m_ulUnicodeRange1,this.m_ulUnicodeRange2,this.m_ulUnicodeRange3,this.m_ulUnicodeRange4,this.m_ulCodePageRange1,this.m_ulCodePageRange2];var ulReqRanges= [format.ulRange1,format.ulRange2,format.ulRange3,format.ulRange4,format.ulCodeRange1,format.ulCodeRange2];var nIndex=0;for(var nIndex=0;nIndex<6;nIndex++)for(var nBitCount=0,nBit=1;nBitCount<32;nBitCount++,nBit*=2){var bReqAdd=false;if((ulReqRanges[nIndex]&nBit)!=0){arrRequest[nIndex*32+nBitCount]=1;nRangesCount++;bReqAdd=true}if((ulCandRanges[nIndex]&nBit)!=0){arrCandidate[nIndex*32+nBitCount]=1;if(!bReqAdd)nAddCount++}}if(0==nRangesCount)return 0;for(nIndex=0;nIndex<192;nIndex++)if(1==arrRequest[nIndex]&& 0==arrCandidate[nIndex])if(undefined!==_main_ranges&&undefined!==_main_ranges[""+nIndex])dPenalty+=Math.max(_main_ranges[""+nIndex],dRangeWeight);else dPenalty+=dRangeWeight;else if(dRangeWeightSuferflouous!=0&&0==arrRequest[nIndex]&&1==arrCandidate[nIndex])dPenalty+=dRangeWeightSuferflouous;return dPenalty},GetFixedPitchPenalty:function(bReqFixed){var nPenalty=0;if(bReqFixed&&!this.m_bIsFixed)nPenalty=15E3;if(!bReqFixed&&this.m_bIsFixed)nPenalty=350;return nPenalty},GetFaceNamePenalty_private:function(sReqName, sMyName){if(0==sReqName.length)return 0;if(0==sMyName.length)return 1E4;if(sReqName==sMyName)return 0;if(sReqName.replace(/[\s-,]/g,"").toLowerCase()==sMyName.replace(/[\s-,]/g,"").toLowerCase())return 100;if(-1!=sReqName.indexOf(sMyName)||-1!=sMyName.indexOf(sReqName)){if(g_fontApplication.g_fontDictionary.CheckLikeFonts(sMyName,sReqName))return 700;return 1E3}if(g_fontApplication.g_fontDictionary.CheckLikeFonts(sMyName,sReqName))return 1E3;return this.CheckEqualFonts2(sReqName,sMyName)},GetFaceNamePenalty:function(sReqName){var min= this.GetFaceNamePenalty_private(sReqName,this.m_wsFontName);if(this.m_names){var tmpMin=0;for(var i=0,len=this.m_names.length;i>8;var nCandClassID=this.m_sFamilyClass>>8;if(0==nReqClassID)return 0;if(0==nCandClassID)return 50;if(nReqClassID<=8&&nCandClassID>8||nReqClassID>8&&nCandClassID<=8)return 50;return 0},GetFamilyUnlikelyPenalty:function(sReqFamilyClass){var nCandClassID=this.m_sFamilyClass>>8;if("any"==sReqFamilyClass||"unknown"==sReqFamilyClass)return 0; else if(0==nCandClassID)return 50;else if(("swiss"==sReqFamilyClass||"roman"==sReqFamilyClass||"modern"==sReqFamilyClass)&&nCandClassID>8||("decorative"==sReqFamilyClass||"script"==sReqFamilyClass)&&nCandClassID<=8)return 50;return 0},GetCharsetPenalty:function(unReqCharset){if(FD_UNKNOWN_CHARSET==unReqCharset)return 0;var _ret=this.GetCodePageByCharset(unReqCharset);var nMult=1<<_ret.ulBit;if(nMult<0)nMult+=4294967296;var ulCandRanges=[this.m_ulUnicodeRange1,this.m_ulUnicodeRange2,this.m_ulUnicodeRange3, this.m_ulUnicodeRange4,this.m_ulCodePageRange1,this.m_ulCodePageRange2];if((ulCandRanges[_ret.unLongIndex]&nMult)==0)return 65E3;return 0},GetAvgWidthPenalty:function(shReqWidth){if(0==this.m_shAvgCharWidth&&0!=shReqWidth)return 4E3;return Math.abs(this.m_shAvgCharWidth-shReqWidth)*4},GetAscentPenalty:function(shReqAscent){if(0==this.m_shAscent&&0!=shReqAscent)return 100;return Math.abs(this.m_shAscent-shReqAscent)/10>>0},GetDescentPenalty:function(shReqDescent){if(0==this.m_shDescent&&0!=shReqDescent)return 100; return Math.abs(this.m_shDescent-shReqDescent)/10>>0},GetLineGapPenalty:function(shReqLineGap){if(0==this.m_shLineGap&&0!=shReqLineGap)return 100;return Math.abs(this.m_shLineGap-shReqLineGap)/10>>0},GetXHeightPenalty:function(shReqXHeight){if(0==this.shXHeight&&0!=shReqXHeight)return 50;return Math.abs(this.m_shXHeight-shReqXHeight)/20>>0},GetCapHeightPenalty:function(shReqCapHeight){if(0==this.m_shCapHeight&&0!=shReqCapHeight)return 50;return Math.abs(this.m_shCapHeight-shReqCapHeight)/20>>0},GetCodePageByCharset:function(unCharset){var ret= {ulBit:0,unLongIndex:4};if(unCharset==1)unCharset=this.GetDefaultCharset();if(true)switch(unCharset){case 0:ret.ulBit=0;break;case 238:ret.ulBit=1;break;case 204:ret.ulBit=2;break;case 161:ret.ulBit=3;break;case 162:ret.ulBit=4;break;case 177:ret.ulBit=5;break;case 178:ret.ulBit=6;break;case 186:ret.ulBit=7;break;case 163:ret.ulBit=8;break;case 222:ret.ulBit=16;break;case 128:ret.ulBit=17;break;case 134:ret.ulBit=18;break;case 129:ret.ulBit=19;break;case 136:ret.ulBit=20;break;case 130:ret.ulBit= 21;break;case 77:ret.ulBit=29;break;case 2:ret.ulBit=31;break;case 255:ret.ulBit=30;break;default:ret.ulBit=0;break}},GetDefaultCharset:function(bUseDefCharset){if(!bUseDefCharset)return FD_UNKNOWN_CHARSET;return 0},CheckEqualFonts2:function(name1,name2){var _res1=name1.toLowerCase();var _res2=name2.toLowerCase();if(_res1==_res2)return 1500;if(_res1.replace(/[\s-]/g,"")==_res2.replace(/[\s-]/g,""))return 3E3;return 1E4},Serialize:function(){var _obj={};_obj["m_wsFontName"]=this.m_wsFontName;_obj["m_wsFontPath"]= this.m_wsFontPath;_obj["m_lIndex"]=this.m_lIndex;_obj["m_bBold"]=this.m_bBold;_obj["m_bItalic"]=this.m_bItalic;_obj["m_bIsFixed"]=this.m_bIsFixed;_obj["m_aPanose"]=new Array(10);for(var i=0;i<10;i++)_obj["m_aPanose"][i]=this.m_aPanose[i];_obj["m_ulUnicodeRange1"]=this.m_ulUnicodeRange1;_obj["m_ulUnicodeRange2"]=this.m_ulUnicodeRange2;_obj["m_ulUnicodeRange3"]=this.m_ulUnicodeRange3;_obj["m_ulUnicodeRange4"]=this.m_ulUnicodeRange4;_obj["m_ulCodePageRange1"]=this.m_ulCodePageRange1;_obj["m_ulCodePageRange2"]= this.m_ulCodePageRange2;_obj["m_usWeigth"]=this.m_usWeigth;_obj["m_usWidth"]=this.m_usWidth;_obj["m_sFamilyClass"]=this.m_sFamilyClass;_obj["m_eFontFormat"]=this.m_eFontFormat;_obj["m_shAvgCharWidth"]=this.m_shAvgCharWidth;_obj["m_shAscent"]=this.m_shAscent;_obj["m_shDescent"]=this.m_shDescent;_obj["m_shLineGap"]=this.m_shLineGap;_obj["m_shXHeight"]=this.m_shXHeight;_obj["m_shCapHeight"]=this.m_shCapHeight;return _obj}};function CLanguageFontSelect(){this.Type=0;this.Ranges=[];this.CodePage1Mask= 0;this.CodePage2Mask=0;this.DefaultFont="Arial";this.FullSupportPages=false}CLanguageFontSelect.prototype={checkChar:function(_code){var _len=this.Ranges.length;for(var i=0;i<_len;i+=2)if(_code>=this.Ranges[i]&&_code<=this.Ranges[i+1])return true;return false}};var LanguagesFontSelectTypes={Unknown:-1,Arabic:1,Korean:2,Japan:3,Chinese:4,EastAsiaStart:2,EastAsiaEnd:4};function CFontSelectList(){this.List=[];this.ListMap={};this.Languages=[];this.m_pRanges=null;this.m_pRangesNums=null;this.IsInit=false; this.CurrentLoadedObj=null}function memset(p,start,val,count){var _data=p.data;for(var i=0;i=8192&&_code<=8303)return true; if(_code>=8352&&_code<=8399)return true;break}}return false},checkText:function(text){var _text_len=text.length;if(_text_len==0)return LanguagesFontSelectTypes.Unknown;var _array_detect_languages=[];var _detect_languages_length=this.Languages.length;for(var _lang=0;_lang<_detect_languages_length;_lang++){var _language=this.Languages[_lang];var _is_support=true;var _no_multi_symbols=0;var _percent_by_english=0;for(var i=0;i<_text_len;i++){var _code=text.charCodeAt(i);if(!this.isMultiLanguageSymbol(_code)){_no_multi_symbols++; if(!_language.checkChar(_code))if(this.isEnglishChar(_code))_percent_by_english--;else{_is_support=false;break}else _percent_by_english++}}if(0==_no_multi_symbols)return LanguagesFontSelectTypes.Unknown;if(_is_support&&_percent_by_english>0)_array_detect_languages.push(_language.Type)}var _len=_array_detect_languages.length;if(0==_len)return LanguagesFontSelectTypes.Unknown;return _array_detect_languages[_len-1]},checkPasteText:function(textPr,langId){var _ret_obj={is_async:false,name:"",fontSlot:fontslot_ASCII}; if(!textPr.RFonts)return _ret_obj;var _lang=null;for(var i=0;i=LanguagesFontSelectTypes.EastAsiaStart&&langId<=LanguagesFontSelectTypes.EastAsiaEnd)_ret_obj.fontSlot=fontslot_EastAsia;if(langId==LanguagesFontSelectTypes.Arabic)if(textPr.CS||textPr.RTL)_ret_obj.fontSlot=fontslot_CS;var _fontFamily=undefined;var bold=undefined;var italic=undefined; switch(_ret_obj.fontSlot){case fontslot_ASCII:{_fontFamily=textPr.RFonts.Ascii;bold=textPr.Bold;italic=textPr.Italic;break}case fontslot_HAnsi:{_fontFamily=textPr.RFonts.HAnsi;bold=textPr.Bold;italic=textPr.Italic;break}case fontslot_CS:{_fontFamily=textPr.RFonts.CS;bold=textPr.BoldCS;italic=textPr.ItalicCS;break}case fontslot_EastAsia:{_fontFamily=textPr.RFonts.EastAsia;bold=textPr.Bold;italic=textPr.Italic;break}default:break}if(undefined==_fontFamily)return _ret_obj;var oFontStyle=FontStyle.FontStyleRegular; if(!italic&&bold)oFontStyle=FontStyle.FontStyleBold;else if(italic&&!bold)oFontStyle=FontStyle.FontStyleItalic;else if(italic&&bold)oFontStyle=FontStyle.FontStyleBoldItalic;var _info=g_fontApplication.GetFontInfo(_fontFamily.Name,oFontStyle);var _id=_info.GetFontID(AscCommon.g_font_loader,oFontStyle);var _select=this.List[this.ListMap[_id.id]];if(0!=_lang.CodePage1Mask)if(!_lang.FullSupportPages){if(0==(_lang.CodePage1Mask&_select.m_ulCodePageRange1))_ret_obj.is_async=true}else if(_lang.CodePage1Mask!= (_lang.CodePage1Mask&_select.m_ulCodePageRange1))_ret_obj.is_async=true;if(0!=_lang.CodePage2Mask)if(!_lang.FullSupportPages){if(0==(_lang.CodePage2Mask&_select.m_ulCodePageRange2))_ret_obj.is_async=true}else if(_lang.CodePage2Mask!=(_lang.CodePage2Mask&_select.m_ulCodePageRange2))_ret_obj.is_async=true;if(!_ret_obj.is_async)return _ret_obj;_ret_obj.name=this.selectNeedFont(_lang,oFontStyle);if(_ret_obj.name=="")_ret_obj.is_async=false;return _ret_obj},getSetupRFonts:function(obj){var _rfonts=new CRFonts; switch(obj.fontSlot){case fontslot_EastAsia:{_rfonts.EastAsia={Name:obj.name,Index:-1};break}case fontslot_CS:{_rfonts.CS={Name:obj.name,Index:-1};break}case fontslot_HAnsi:{_rfonts.HAnsi={Name:obj.name,Index:-1};break}case fontslot_ASCII:default:{_rfonts.Ascii={Name:obj.name,Index:-1};break}}return _rfonts},selectNeedFont:function(_lang,_style){var _error=16777216;var _name="";var _len=AscFonts.g_font_infos.length;for(var i=0;i<_len;i++){var _info=AscFonts.g_font_infos[i];var _id=_info.GetFontID(AscCommon.g_font_loader, _style);var _select=this.List[this.ListMap[_id.id]];if(!_select)continue;var _bIsNeed=false;if(0!=_lang.CodePage1Mask)if(!_lang.FullSupportPages){if(0==(_lang.CodePage1Mask&_select.m_ulCodePageRange1))_bIsNeed=true}else if(_lang.CodePage1Mask!=(_lang.CodePage1Mask&_select.m_ulCodePageRange1))_bIsNeed=true;if(0!=_lang.CodePage2Mask)if(!_lang.FullSupportPages){if(0==(_lang.CodePage2Mask&_select.m_ulCodePageRange2))_bIsNeed=true}else if(_lang.CodePage2Mask!=(_lang.CodePage2Mask&_select.m_ulCodePageRange2))_bIsNeed= true;if(!_bIsNeed){var _tmp_error=0;if(_id.file.Status!=0)_tmp_error+=65536;if(_info.Name!=_lang.DefaultFont)_tmp_error+=256;if(_tmp_error<_error){_error=_tmp_error;_name=_info.Name}}}if(_name=="")_name=g_fontApplication.GetFontInfoName(_lang.DefaultFont);return _name},checkText2:function(text){var r1=0;var r2=0;var r3=0;var r4=0;var codePage1=0;var codePage2=0;var len=text.length;for(var i=0;i>0;var _size=this.Count;var arr=null;if(typeof Int8Array!="undefined"&&!window.opera)arr=new Int8Array(_size);else arr=new Array(_size);for(var i=0;i<_size;i++)arr[i]=0;this.Images=arr}, Alloc:function(){if(this.Count==this.CountBusy)return-1;var arr=this.Images;if(arr[this.CountBusy]==0){arr[this.CountBusy]=1;this.CountBusy+=1;return this.CountBusy-1}var _len=this.Count;for(var i=0;i<_len;i++)if(arr[i]==0){arr[i]=1;this.CountBusy+=1;return i}return-1},Free:function(index){if(this.Images[index]==1){this.Images[index]=0;this.CountBusy-=1}return this.CountBusy}};function CRasterHeapChuck(){this.CanvasImage=null;this.CanvasCtx=null;this.Width=0;this.Height=0;this.LinesFree=[];this.LinesBusy= [];this.CurLine=null;this.FindOnlyEqualHeight=false}CRasterHeapChuck.prototype={Create:function(width,height){this.Width=width;this.Height=height;this.CanvasImage=document.createElement("canvas");this.CanvasImage.width=width;this.CanvasImage.height=height;this.CanvasCtx=this.CanvasImage.getContext("2d");this.CanvasCtx.globalCompositeOperation="source-atop";var _freeLine=new CRasterHeapLineFree;_freeLine.Y=0;_freeLine.Height=this.Height;this.LinesFree[0]=_freeLine},Clear:function(){this.LinesBusy.splice(0, this.LinesBusy.length);this.LinesFree.splice(0,this.LinesFree.length);var _freeLine=new CRasterHeapLineFree;_freeLine.Y=0;_freeLine.Height=this.Height;this.LinesFree[0]=_freeLine},Alloc:function(width,height){var _need_height=Math.max(width,height);var _busy_len=this.LinesBusy.length;for(var i=0;i<_busy_len;i++){var _line=this.LinesBusy[i];if(_line.Height>=_need_height){var _index=_line.Alloc();if(-1!=_index){var _ret=new CRasterDataInfo;_ret.Chunk=this;_ret.Line=_line;_ret.Index=_index;return _ret}}}var _need_height1= 3*_need_height>>1;if(this.FindOnlyEqualHeight)_need_height1=_need_height;var _free_len=this.LinesFree.length;var _index_found_koef1=-1;for(var i=0;i<_free_len;i++){var _line=this.LinesFree[i];if(_line.Height>=_need_height1){var _new_line=new CRasterHeapLine;_new_line.CreatePlaces(_need_height1,_need_height1,this.Width);_new_line.Y=_line.Y;_new_line.Index=this.LinesBusy.length;this.LinesBusy.push(_new_line);_line.Y+=_need_height1;_line.Height-=_need_height1;if(_line.Height==0)this.LinesFree.splice(i, 1);var _ret=new CRasterDataInfo;_ret.Chunk=this;_ret.Line=_new_line;_ret.Index=_new_line.Alloc();return _ret}else if(_line.Height>=_need_height&&-1==_index_found_koef1)_index_found_koef1=i}if(-1!=_index_found_koef1){var _line=this.LinesFree[_index_found_koef1];var _new_line=new CRasterHeapLine;_new_line.CreatePlaces(_need_height,_need_height,this.Width);_new_line.Y=_line.Y;_new_line.Index=this.LinesBusy.length;this.LinesBusy.push(_new_line);_line.Y+=_need_height;_line.Height-=_need_height;if(_line.Height== 0)this.LinesFree.splice(i,1);var _ret=new CRasterDataInfo;_ret.Chunk=this;_ret.Line=_new_line;_ret.Index=_new_line.Alloc();return _ret}return null},Free:function(obj){var _refs=obj.Line.Free(obj.Index);if(_refs==0){var _line=obj.Line;this.LinesBusy.splice(_line.Index,1);var _lines_busy=this.LinesBusy;var _busy_len=_lines_busy.length;for(var i=_line.Index;i<_busy_len;i++)_lines_busy[i].Index=i;var y1=_line.Y;var y2=_line.Y+_line.Height;var _lines_free=this.LinesFree;var _free_len=_lines_free.length; var _ind_prev=-1;var _ind_next=-1;for(var i=0;i<_free_len;i++){var _line_f=_lines_free[i];if(-1==_ind_prev){if(y1==_line_f.Y+_line_f.Height)_ind_prev=i}else if(-1==_ind_next){if(y2==_line_f.Y)_ind_next=i}else break}if(-1!=_ind_prev&&-1!=_ind_next){_lines_free[_ind_prev].Height+=_line.Height+_lines_free[_ind_next].Height;_lines_free.splice(_ind_next,1)}else if(-1!=_ind_prev)_lines_free[_ind_prev].Height+=_line.Height;else if(-1!=_ind_next){_lines_free[_ind_next].Y-=_line.Height;_lines_free[_ind_next].Height+= _line.Height}else{var _new_line=new CRasterHeapLineFree;_new_line.Y=_line.Y;_new_line.Height=_line.Height;_lines_free.push(_new_line)}_line=null}}};function CRasterHeapTotal(_size){this.ChunkHeapSize=undefined===_size?3E3:_size;this.Chunks=[]}CRasterHeapTotal.prototype={Clear:function(){var _len=this.Chunks.length;for(var i=0;i<_len;i++)this.Chunks[i].Clear();if(_len>1)this.Chunks.splice(1,_len-1)},Alloc:function(width,height){var _len=this.Chunks.length;for(var i=0;i<_len;i++){var _ret=this.Chunks[i].Alloc(width, height);if(null!=_ret)return _ret}this.HeapAlloc(this.ChunkHeapSize,this.ChunkHeapSize);return this.Chunks[_len].Alloc(width,height)},HeapAlloc:function(width,height){var _chunk=new CRasterHeapChuck;_chunk.Create(width,height);this.Chunks[this.Chunks.length]=_chunk},CreateFirstChuck:function(_w,_h){if(0==this.Chunks.length){this.Chunks[0]=new CRasterHeapChuck;this.Chunks[0].Create(undefined==_w?this.ChunkHeapSize:_w,undefined==_h?this.ChunkHeapSize:_h)}}};window["AscFonts"]=window["AscFonts"]||{}; window["AscFonts"].CRasterHeapTotal=CRasterHeapTotal})(window,undefined);"use strict";(function(window,undefined){function CGlyphRect(){this.fX=0;this.fY=0;this.fWidth=0;this.fHeight=0}function CGlyphBounds(){this.fLeft=0;this.fTop=0;this.fRight=0;this.fBottom=0}CGlyphBounds.prototype={checkPoint:function(x,y){if(xthis.fRight)this.fRight=x;if(ythis.fBottom)this.fBottom=y}};function CGlyph(){this.lUnicode=0;this.fX=0;this.fY=0;this.fLeft=0; this.fTop=0;this.fRight=0;this.fBottom=0;this.oMetrics=null;this.eState=AscFonts.EGlyphState.glyphstateNormal;this.bBitmap=false;this.oBitmap=null;this.Clear=function(){this.bBitmap=false;this.eState=AscFonts.EGlyphState.glyphstateNormal}}function CGlyphString(){this.m_fX=0;this.m_fY=0;this.m_fEndX=0;this.m_fEndY=0;this.m_nGlyphIndex=-1;this.m_nGlyphsCount=0;this.m_pGlyphsBuffer=new Array(100);this.m_arrCTM=[];this.m_dIDet=1;this.m_fTransX=0;this.m_fTransY=0;this.GetFirstGlyph=function(){if(!this.m_pGlyphsBuffer[0])this.m_pGlyphsBuffer[0]= new CGlyph;return this.m_pGlyphsBuffer[0]};this.SetString=function(wsString,fX,fY){this.m_fX=fX+this.m_fTransX;this.m_fY=fY+this.m_fTransY;this.m_nGlyphsCount=wsString.length;this.m_nGlyphIndex=0;for(var nIndex=0;nIndex=this.m_nGlyphsCount)nCurIndex=this.m_nGlyphsCount-1;return this.m_pGlyphsBuffer[nCurIndex]};this.SetStartPoint=function(nIndex, fX,fY){if(this.m_nGlyphsCount<=0)return;var nCurIndex=nIndex<0?0:nIndex;if(nCurIndex>=this.m_nGlyphsCount)nCurIndex=this.m_nGlyphsCount-1;this.m_pGlyphsBuffer[nCurIndex].fX=fX;this.m_pGlyphsBuffer[nCurIndex].fY=fY};this.SetState=function(nIndex,eState){if(this.m_nGlyphsCount<=0)return;var nCurIndex=nIndex<0?0:nIndex;if(nCurIndex>=this.m_nGlyphsCount)nCurIndex=this.m_nGlyphsCount-1;this.m_pGlyphsBuffer[nCurIndex].eState=eState};this.SetBBox=function(nIndex,fLeft,fTop,fRight,fBottom){if(this.m_nGlyphsCount<= 0)return;var nCurIndex=nIndex<0?0:nIndex;if(nCurIndex>=this.m_nGlyphsCount)nCurIndex=this.m_nGlyphsCount-1;var _g=this.m_pGlyphsBuffer[nCurIndex];_g.fLeft=fLeft;_g.fTop=fTop;_g.fRight=fRight;_g.fBottom=fBottom};this.SetMetrics=function(nIndex,fWidth,fHeight,fHoriAdvance,fHoriBearingX,fHoriBearingY,fVertAdvance,fVertBearingX,fVertBearingY){if(this.m_nGlyphsCount<=0)return;var nCurIndex=nIndex<0?0:nIndex;if(nCurIndex>=this.m_nGlyphsCount)nCurIndex=this.m_nGlyphsCount-1;var _g=this.m_pGlyphsBuffer[nCurIndex]; _g.oMetrics.fHeight=fHeight;_g.oMetrics.fHoriAdvance=fHoriAdvance;_g.oMetrics.fHoriBearingX=fHoriBearingX;_g.oMetrics.fHoriBearingY=fHoriBearingY;_g.oMetrics.fVertAdvance=fVertAdvance;_g.oMetrics.fVertBearingX=fVertBearingX;_g.oMetrics.fVertBearingY=fVertBearingY;_g.oMetrics.fWidth=fWidth};this.ResetCTM=function(){var m=this.m_arrCTM;m[0]=1;m[1]=0;m[2]=0;m[3]=1;m[4]=0;m[5]=0;this.m_dIDet=1};this.GetBBox=function(nIndex,nType){var oPoint=new CGlyphBounds;if(typeof nIndex=="undefined")nIndex=-1;if(typeof nType== "undefined")nType=0;var nCurIndex=0;if(nIndex<0){if(this.m_nGlyphsCount<=0||this.m_nGlyphIndex<1||this.m_nGlyphIndex>this.m_nGlyphsCount)return oPoint;nCurIndex=this.m_nGlyphIndex-1}else{if(this.m_nGlyphsCount<=0)return oPoint;nCurIndex=nIndex<0?0:nIndex;if(nCurIndex>=this.m_nGlyphsCount)nCurIndex=this.m_nGlyphsCount-1}var _g=this.m_pGlyphsBuffer[nCurIndex];var m=this.m_arrCTM;var fBottom=-_g.fBottom;var fRight=_g.fRight;var fLeft=_g.fLeft;var fTop=-_g.fTop;if(0==nType&&!(1==m[0]&&0==m[1]&&0==m[2]&& 1==m[3]&&0==m[4]&&0==m[5])){var arrfX=[fLeft,fLeft,fRight,fRight];var arrfY=[fTop,fBottom,fBottom,fTop];var fMinX=arrfX[0]*m[0]+arrfY[0]*m[2];var fMinY=arrfX[0]*m[1]+arrfY[0]*m[3];var fMaxX=fMinX;var fMaxY=fMinY;for(var nIndex=1;nIndex<4;++nIndex){var fX=arrfX[nIndex]*m[0]+arrfY[nIndex]*m[2];var fY=arrfX[nIndex]*m[1]+arrfY[nIndex]*m[3];fMaxX=Math.max(fMaxX,fX);fMinX=Math.min(fMinX,fX);fMaxY=Math.max(fMaxY,fY);fMinY=Math.min(fMinY,fY)}fLeft=fMinX;fRight=fMaxX;fTop=fMinY;fBottom=fMaxY}oPoint.fLeft= fLeft+_g.fX+this.m_fX;oPoint.fRight=fRight+_g.fX+this.m_fX;oPoint.fTop=fTop+_g.fY+this.m_fY;oPoint.fBottom=fBottom+_g.fY+this.m_fY;return oPoint};this.GetBBox2=function(){var oPoint=new CGlyphBounds;if(this.m_nGlyphsCount<=0)return oPoint;var fBottom=0;var fRight=0;var fLeft=0;var fTop=0;for(var nIndex=0;nIndex=this.m_nGlyphsCount||this.m_nGlyphIndex<0)return undefined;return this.m_pGlyphsBuffer[this.m_nGlyphIndex++]};this.SetTrans= function(fX,fY){var m=this.m_arrCTM;this.m_fTransX=this.m_dIDet*(fX*m[3]-m[2]*fY);this.m_fTransY=this.m_dIDet*(fY*m[0]-m[1]*fX)};this.SetCTM=function(fA,fB,fC,fD,fE,fF){var m=this.m_arrCTM;m[0]=fA;m[1]=fB;m[2]=fC;m[3]=fD;m[4]=fE;m[5]=fF;var dDet=fA*fD-fB*fC;if(dDet<.001&&dDet>=0)dDet=.001;else if(dDet>-.001&&dDet<0)dDet=-.001;this.m_dIDet=1/dDet}}window["AscFonts"]=window["AscFonts"]||{};window["AscFonts"].CGlyphRect=CGlyphRect;window["AscFonts"].CGlyphBounds=CGlyphBounds;window["AscFonts"].CGlyphString= CGlyphString})(window,undefined);"use strict";(function(window,undefined){function CSymbolRange(_start,_end,_name){this.Start=_start;this.End=_end;this.Name=_name}function CFontByCharacter(){this.Ranges=[];this.UsedRanges=[];this.LastRange=null;this.FontsByRange={};this.FontsByRangeCount=0;this.ExtendFontsByRangeCount=0;this.IsUseNoSquaresMode=true;this.CallbackObj={_this:null,_callback:null}}CFontByCharacter.prototype={init:function(infos){var fonts=window["__fonts_ranges"];if(!fonts)return;var index= 0;var count=fonts.length/3;for(var i=0;i_end)return null;while(_start<_end){_center=_start+_end>>1;_range=_array[_center];if(_range.Start>_char)_end=_center- 1;else if(_range.End<_char)_start=_center+1;else return _array[_center]}if(_start>_end)return null;_range=_array[_start];if(_range.Start>_char||_range.End<_char)return null;return _array[_start]},getFontBySymbol:function(_char){if(!this.IsUseNoSquaresMode)return"";if(undefined===_char||0==_char)return"";if(this.LastRange)if(this.LastRange.Start<=_char&&_char<=this.LastRange.End)return this.LastRange.Name;var _range=this.getRangeBySymbol(_char,this.UsedRanges);if(_range!=null){this.LastRange=_range; return _range.Name}_range=this.getRangeBySymbol(_char,this.Ranges);if(!_range)return"";this.UsedRanges.push(_range);this.LastRange=_range;if(!this.FontsByRange[_range.Name]){this.FontsByRange[_range.Name]=_range.Name;this.FontsByRangeCount++}return _range.Name},getFontsByString:function(_text){if(!this.IsUseNoSquaresMode)return false;if(!_text)return false;var oldCount=this.FontsByRangeCount;for(var i=_text.getUnicodeIterator();i.check();i.next())AscFonts.FontPickerByCharacter.getFontBySymbol(i.value()); return this.FontsByRangeCount!=oldCount},getFontsByString2:function(_array){if(!this.IsUseNoSquaresMode)return false;if(!_array)return false;var oldCount=this.FontsByRangeCount;for(var i=0;i<_array.length;++i)AscFonts.FontPickerByCharacter.getFontBySymbol(_array[i]);return this.FontsByRangeCount!=oldCount},isExtendFonts:function(){return this.ExtendFontsByRangeCount!=this.FontsByRangeCount},extendFonts:function(fonts,isNoRealExtend){if(this.ExtendFontsByRangeCount==this.FontsByRangeCount)return;var isFound; for(var i in this.FontsByRange){isFound=false;for(var j in fonts)if(fonts[j].name==this.FontsByRange[i]){isFound=true;break}if(!isFound)fonts[fonts.length]=new AscFonts.CFont(this.FontsByRange[i],0,"",0,null)}if(true!==isNoRealExtend)this.ExtendFontsByRangeCount=this.FontsByRangeCount},checkTextLight:function(text,isCodes){if(isCodes!==true){if(!this.getFontsByString(text))return false}else if(!this.getFontsByString2(text))return false;var fonts=[];this.extendFonts(fonts,true);if(false===AscCommon.g_font_loader.CheckFontsNeedLoading(fonts))return false; return true},loadFonts:function(_this,_callback){var fonts=[];this.extendFonts(fonts);this.CallbackObj._this=_this;this.CallbackObj._callback=_callback;var _editor=window["Asc"]["editor"]?window["Asc"]["editor"]:window.editor;_editor.asyncMethodCallback=function(){var _t=AscFonts.FontPickerByCharacter.CallbackObj;_t._callback.call(_t._this);_t._this=null;_t._callback=null};AscCommon.g_font_loader.LoadDocumentFonts2(fonts);return true},checkText:function(text,_this,_callback,isCodes,isOnlyAsync,isCheckSymbols){if(window["NATIVE_EDITOR_ENJINE"]){_callback.call(_this); return false}if(isCheckSymbols!==false)if(isCodes!==true){if(!this.getFontsByString(text)){if(!isOnlyAsync)_callback.call(_this);return false}}else if(!this.getFontsByString2(text)){if(!isOnlyAsync)_callback.call(_this);return false}var fonts=[];this.extendFonts(fonts);if(false===AscCommon.g_font_loader.CheckFontsNeedLoading(fonts)){if(!isOnlyAsync)_callback.call(_this);return false}this.CallbackObj._this=_this;this.CallbackObj._callback=_callback;var _editor=window["Asc"]["editor"]?window["Asc"]["editor"]: window.editor;_editor.asyncMethodCallback=function(){var _t=AscFonts.FontPickerByCharacter.CallbackObj;_t._callback.call(_t._this);_t._this=null;_t._callback=null};AscCommon.g_font_loader.LoadDocumentFonts2(fonts);return true}};window["AscFonts"]=window["AscFonts"]||{};window["AscFonts"].IsCheckSymbols=false;window["AscFonts"].FontPickerByCharacter=new CFontByCharacter})(window);"use strict";(function(window,undefined){function CFontFilesCache(){this.m_lMaxSize=1E3;this.m_lCurrentSize=0;this.Fonts= {};this.LoadFontFile=function(stream_index,name,faceindex,fontManager){if(!fontManager._engine)AscFonts.engine_Create(fontManager);if(AscFonts.CreateNativeStreamByIndex)AscFonts.CreateNativeStreamByIndex(stream_index);if(!AscFonts.g_fonts_streams[stream_index])return null;return fontManager._engine.openFont(AscFonts.g_fonts_streams[stream_index],faceindex)};this.LockFont=function(stream_index,fontName,faceIndex,fontSize,_ext,fontManager){var key=fontName+faceIndex+fontSize;if(undefined!==_ext)key+= _ext;var pFontFile=this.Fonts[key];if(pFontFile)return pFontFile;pFontFile=this.Fonts[key]=this.LoadFontFile(stream_index,fontName,faceIndex,fontManager);return pFontFile}}function CFontManager(params){this._engine=null;this.m_pFont=null;this.m_oGlyphString=new AscFonts.CGlyphString;this.error=0;this.fontName=undefined;this.m_fCharSpacing=0;this.m_bStringGID=false;this.m_oFontsCache=null;this.m_lUnits_Per_Em=0;this.m_lAscender=0;this.m_lDescender=0;this.m_lLineHeight=0;this.RasterMemory=null;this.IsCellMode= params&¶ms.mode=="cell"?true:false;this.IsAdvanceNeedBoldFonts=this.IsCellMode;this.IsUseWinOS2Params=true;this.bIsHinting=false;this.bIsSubpixHinting=false;this.LOAD_MODE=40970}CFontManager.prototype={AfterLoad:function(){if(null==this.m_pFont){this.m_lUnits_Per_Em=0;this.m_lAscender=0;this.m_lDescender=0;this.m_lLineHeight=0}else{var f=this.m_pFont;this.m_lUnits_Per_Em=f.m_lUnits_Per_Em;this.m_lAscender=f.m_lAscender;this.m_lDescender=f.m_lDescender;this.m_lLineHeight=f.m_lLineHeight;f.CheckHintsSupport()}}, Initialize:function(is_init_raster_memory){this.m_oFontsCache=new CFontFilesCache;if(is_init_raster_memory===true){AscFonts.registeredFontManagers.push(this);this.InitializeRasterMemory()}},InitializeRasterMemory:function(){if(AscFonts.use_map_blitting){if(!this.RasterMemory){this.RasterMemory=new AscFonts.CRasterHeapTotal;this.RasterMemory.CreateFirstChuck()}}else if(this.RasterMemory)this.RasterMemory=null},ClearFontsRasterCache:function(){for(var i in this.m_oFontsCache.Fonts)if(this.m_oFontsCache.Fonts[i])this.m_oFontsCache.Fonts[i].ClearCache(); this.ClearRasterMemory()},ClearRasterMemory:function(){if(null==this.RasterMemory||null==this.m_oFontsCache)return;var _fonts=this.m_oFontsCache.Fonts;for(var i in _fonts)if(_fonts[i]!==undefined&&_fonts[i]!=null)_fonts[i].ClearCacheNoAttack();this.RasterMemory.Clear()},UpdateSize:function(dOldSize,dDpi,dNewDpi){if(0==dNewDpi)dNewDpi=72;if(0==dDpi)dDpi=72;return dOldSize*dDpi/dNewDpi},LoadString:function(wsBuffer,fX,fY){if(!this.m_pFont)return false;this.m_oGlyphString.SetString(wsBuffer,fX,fY);this.m_pFont.GetString(this.m_oGlyphString); return true},LoadString2:function(wsBuffer,fX,fY){if(!this.m_pFont)return false;this.m_oGlyphString.SetString(wsBuffer,fX,fY);this.m_pFont.GetString2(this.m_oGlyphString);return true},LoadString3:function(gid,fX,fY){if(!this.m_pFont)return false;this.SetStringGID(true);this.m_oGlyphString.SetStringGID(gid,fX,fY);this.m_pFont.GetString2(this.m_oGlyphString);this.SetStringGID(false);return true},LoadString3C:function(gid,fX,fY){if(!this.m_pFont)return false;this.SetStringGID(true);var string=this.m_oGlyphString; string.m_fX=fX+string.m_fTransX;string.m_fY=fY+string.m_fTransY;string.m_nGlyphsCount=1;string.m_nGlyphIndex=0;var _g=string.GetFirstGlyph();_g.bBitmap=false;_g.oBitmap=null;_g.eState=AscFonts.EGlyphState.glyphstateNormal;_g.lUnicode=gid;this.m_pFont.GetString2C(string);this.SetStringGID(false);return true},LoadString2C:function(wsBuffer,fX,fY){if(!this.m_pFont)return false;var string=this.m_oGlyphString;string.m_fX=fX+string.m_fTransX;string.m_fY=fY+string.m_fTransY;string.m_nGlyphsCount=1;string.m_nGlyphIndex= 0;var _g=string.GetFirstGlyph();_g.bBitmap=false;_g.oBitmap=null;_g.eState=AscFonts.EGlyphState.glyphstateNormal;_g.lUnicode=wsBuffer.charCodeAt(0);this.m_pFont.GetString2C(string);return string.m_fEndX},LoadString4C:function(lUnicode,fX,fY){if(!this.m_pFont)return false;var string=this.m_oGlyphString;string.m_fX=fX+string.m_fTransX;string.m_fY=fY+string.m_fTransY;string.m_nGlyphsCount=1;string.m_nGlyphIndex=0;var _g=string.GetFirstGlyph();_g.bBitmap=false;_g.oBitmap=null;_g.eState=AscFonts.EGlyphState.glyphstateNormal; _g.lUnicode=lUnicode;this.m_pFont.GetString2C(string);return string.m_fEndX},LoadStringPathCode:function(code,isGid,fX,fY,worker){if(!this.m_pFont)return false;this.SetStringGID(isGid);var string=this.m_oGlyphString;string.m_fX=fX+string.m_fTransX;string.m_fY=fY+string.m_fTransY;string.m_nGlyphsCount=1;string.m_nGlyphIndex=0;var _g=string.GetFirstGlyph();_g.bBitmap=false;_g.oBitmap=null;_g.eState=AscFonts.EGlyphState.glyphstateNormal;_g.lUnicode=code;this.m_pFont.GetStringPath(string,worker);this.SetStringGID(false); return true},LoadChar:function(lUnicode){if(!this.m_pFont)return false;return this.m_pFont.GetChar2(lUnicode)},MeasureChar:function(lUnicode,is_raster_distances){if(!this.m_pFont)return;return this.m_pFont.GetChar(lUnicode,is_raster_distances)},GetKerning:function(unPrevGID,unGID){if(!this.m_pFont)return;return this.m_pFont.GetKerning(unPrevGID,unGID)},MeasureString:function(){var oPoint=new AscFonts.CGlyphRect;var len=this.m_oGlyphString.GetLength();if(len<=0)return oPoint;var fTop=65535,fBottom= -65535,fLeft=65535,fRight=-65535;for(var nIndex=0;nIndexoSizeTmp.fTop)fTop=oSizeTmp.fTop;if(fLeft>oSizeTmp.fLeft)fLeft=oSizeTmp.fLeft;if(fRight65535)if(nUnicode>=131072&&nUnicode<=173791||nUnicode>=194560&&nUnicode<=195103)_glyph_slot=fontslot_EastAsia;else if(nUnicode>=119808&&nUnicode<=120831)_glyph_slot=fontslot_ASCII;else _glyph_slot=fontslot_HAnsi;else if(nHint!=fonthint_EastAsia)_glyph_slot=this.DetectData[nUnicode];else{if(nEastAsia_lcid==lcid_zh)_glyph_slot=this.DetectData[this.TableChunkHintZH+nUnicode];else _glyph_slot=this.DetectData[this.TableChunkHintEA+nUnicode];if(_glyph_slot==fontslot_EastAsia)return _glyph_slot}if(bCS|| bRTL)return fontslot_CS;return _glyph_slot}}window.CDetectFontUse=CDetectFontUse;window.CDetectFontUse})();var g_font_detector=new window.CDetectFontUse;g_font_detector.Init();"use strict";(function(window,undefined){var g_fontApplication=AscFonts.g_fontApplication;function CGrRFonts(){this.Ascii={Name:"Empty",Index:-1};this.EastAsia={Name:"Empty",Index:-1};this.HAnsi={Name:"Empty",Index:-1};this.CS={Name:"Empty",Index:-1}}CGrRFonts.prototype={checkFromTheme:function(fontScheme,rFonts){this.Ascii.Name= fontScheme.checkFont(rFonts.Ascii.Name);this.EastAsia.Name=fontScheme.checkFont(rFonts.EastAsia.Name);this.HAnsi.Name=fontScheme.checkFont(rFonts.HAnsi.Name);this.CS.Name=fontScheme.checkFont(rFonts.CS.Name);this.Ascii.Index=-1;this.EastAsia.Index=-1;this.HAnsi.Index=-1;this.CS.Index=-1},fromRFonts:function(rFonts){this.Ascii.Name=rFonts.Ascii.Name;this.EastAsia.Name=rFonts.EastAsia.Name;this.HAnsi.Name=rFonts.HAnsi.Name;this.CS.Name=rFonts.CS.Name;this.Ascii.Index=-1;this.EastAsia.Index=-1;this.HAnsi.Index= -1;this.CS.Index=-1}};var gr_state_pen=0;var gr_state_brush=1;var gr_state_pen_brush=2;var gr_state_state=3;var gr_state_all=4;function CFontSetup(){this.Name="";this.Index=-1;this.Size=12;this.Bold=false;this.Italic=false;this.SetUpName="";this.SetUpIndex=-1;this.SetUpSize=12;this.SetUpStyle=-1;this.SetUpMatrix=new CMatrix}CFontSetup.prototype={Clear:function(){this.Name="";this.Index=-1;this.Size=12;this.Bold=false;this.Italic=false;this.SetUpName="";this.SetUpIndex=-1;this.SetUpSize=12;this.SetUpStyle= -1;this.SetUpMatrix=new CMatrix}};function CGrState_Pen(){this.Type=gr_state_pen;this.Pen=null}CGrState_Pen.prototype={Init:function(_pen){if(_pen!==undefined)this.Pen=_pen.CreateDublicate()}};function CGrState_Brush(){this.Type=gr_state_brush;this.Brush=null}CGrState_Brush.prototype={Init:function(_brush){if(undefined!==_brush)this.Brush=_brush.CreateDublicate()}};function CGrState_PenBrush(){this.Type=gr_state_pen_brush;this.Pen=null;this.Brush=null}CGrState_PenBrush.prototype={Init:function(_pen, _brush){if(undefined!==_pen&&undefined!==_brush){this.Pen=_pen.CreateDublicate();this.Brush=_brush.CreateDublicate()}}};function CHist_Clip(){this.Path=null;this.Rect=null;this.IsIntegerGrid=false;this.Transform=new CMatrix}CHist_Clip.prototype={Init:function(path,rect,isIntegerGrid,transform){this.Path=path;if(rect!==undefined){this.Rect=new _rect;this.Rect.x=rect.x;this.Rect.y=rect.y;this.Rect.w=rect.w;this.Rect.h=rect.h}if(undefined!==isIntegerGrid)this.IsIntegerGrid=isIntegerGrid;if(undefined!== transform)this.Transform=transform.CreateDublicate()},ToRenderer:function(renderer){if(this.Rect!=null){var r=this.Rect;renderer.StartClipPath();renderer.rect(r.x,r.y,r.w,r.h);renderer.EndClipPath()}else;}};function CGrState_State(){this.Type=gr_state_state;this.Transform=null;this.IsIntegerGrid=false;this.Clips=null}CGrState_State.prototype={Init:function(_transform,_isIntegerGrid,_clips){if(undefined!==_transform)this.Transform=_transform.CreateDublicate();if(undefined!==_isIntegerGrid)this.IsIntegerGrid= _isIntegerGrid;if(undefined!==_clips)this.Clips=_clips},ApplyClips:function(renderer){var _len=this.Clips.length;for(var i=0;i<_len;i++)this.Clips[i].ToRenderer(renderer)}};function CGrState(){this.Parent=null;this.States=[];this.Clips=[]}CGrState.prototype={SavePen:function(){if(null==this.Parent)return;var _state=new CGrState_Pen;_state.Init(this.Parent.m_oPen);this.States.push(_state)},SaveBrush:function(){if(null==this.Parent)return;var _state=new CGrState_Brush;_state.Init(this.Parent.m_oBrush); this.States.push(_state)},SavePenBrush:function(){if(null==this.Parent)return;var _state=new CGrState_PenBrush;_state.Init(this.Parent.m_oPen,this.Parent.m_oBrush);this.States.push(_state)},RestorePen:function(){var _ind=this.States.length-1;if(null==this.Parent||-1==_ind)return;var _state=this.States[_ind];if(_state.Type==gr_state_pen){this.States.splice(_ind,1);var _c=_state.Pen.Color;this.Parent.p_color(_c.R,_c.G,_c.B,_c.A)}},RestoreBrush:function(){var _ind=this.States.length-1;if(null==this.Parent|| -1==_ind)return;var _state=this.States[_ind];if(_state.Type==gr_state_brush){this.States.splice(_ind,1);var _c=_state.Brush.Color1;this.Parent.b_color1(_c.R,_c.G,_c.B,_c.A)}},RestorePenBrush:function(){var _ind=this.States.length-1;if(null==this.Parent||-1==_ind)return;var _state=this.States[_ind];if(_state.Type==gr_state_pen_brush){this.States.splice(_ind,1);var _cb=_state.Brush.Color1;var _cp=_state.Pen.Color;this.Parent.b_color1(_cb.R,_cb.G,_cb.B,_cb.A);this.Parent.p_color(_cp.R,_cp.G,_cp.B,_cp.A)}}, SaveGrState:function(){if(null==this.Parent)return;var _state=new CGrState_State;_state.Init(this.Parent.m_oTransform,!!this.Parent.m_bIntegerGrid,this.Clips);this.States.push(_state);this.Clips=[]},RestoreGrState:function(){var _ind=this.States.length-1;if(null==this.Parent||-1==_ind)return;var _state=this.States[_ind];if(_state.Type==gr_state_state){if(this.Clips.length>0){this.Parent.RemoveClip();for(var i=0;i<=_ind;i++){var _s=this.States[i];if(_s.Type==gr_state_state){var _c=_s.Clips;var _l= _c.length;for(var j=0;j<_l;j++){this.Parent.transform3(_c[j].Transform);this.Parent.SetIntegerGrid(_c[j].IsIntegerGrid);var _r=_c[j].Rect;this.Parent.StartClipPath();this.Parent._s();this.Parent._m(_r.x,_r.y);this.Parent._l(_r.x+_r.w,_r.y);this.Parent._l(_r.x+_r.w,_r.y+_r.h);this.Parent._l(_r.x,_r.y+_r.h);this.Parent._l(_r.x,_r.y);this.Parent.EndClipPath()}}}}this.Clips=_state.Clips;this.States.splice(_ind,1);this.Parent.transform3(_state.Transform);this.Parent.SetIntegerGrid(_state.IsIntegerGrid)}}, Save:function(){this.SavePen();this.SaveBrush();this.SaveGrState()},Restore:function(){this.RestoreGrState();this.RestoreBrush();this.RestorePen()},StartClipPath:function(){},EndClipPath:function(){},AddClipRect:function(_r){var _histClip=new CHist_Clip;_histClip.Transform=this.Parent.m_oTransform.CreateDublicate();_histClip.IsIntegerGrid=!!this.Parent.m_bIntegerGrid;_histClip.Rect=new _rect;_histClip.Rect.x=_r.x;_histClip.Rect.y=_r.y;_histClip.Rect.w=_r.w;_histClip.Rect.h=_r.h;this.Clips.push(_histClip); this.Parent.StartClipPath();this.Parent._s();this.Parent._m(_r.x,_r.y);this.Parent._l(_r.x+_r.w,_r.y);this.Parent._l(_r.x+_r.w,_r.y+_r.h);this.Parent._l(_r.x,_r.y+_r.h);this.Parent._l(_r.x,_r.y);this.Parent.EndClipPath()}};var g_stringBase64="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";var g_arrayBase64=[];for(var index64=0;index64>0)*4;var nLen2=nLen1/76>>0;var nLen3=19;var srcInd=0;var dstStr=[];var _s="";for(var i=0;i<=nLen2;i++){if(i==nLen2)nLen3=nLen1%76/4>>0;for(var j=0;j>>26&255;_s+=g_arrayBase64[b];dwCurr<<=6;dwCurr&=4294967295}dstStr.push(_s)}}nLen2=nSrcLen%3!=0?nSrcLen%3+1:0;if(nLen2){var dwCurr=0;for(var n=0;n<3;n++){if(n< nSrcLen%3)dwCurr|=srcData[srcInd++ +nOffset];dwCurr<<=8}_s="";for(var k=0;k>>26&255;_s+=g_arrayBase64[b];dwCurr<<=6}nLen3=nLen2!=0?4-nLen2:0;for(var j=0;j=this.len){var _canvas=document.createElement("canvas");var _ctx=_canvas.getContext("2d");var oldImData=this.ImData;var oldData=this.data;var oldPos=this.pos;this.len=Math.max(this.len*2,this.pos+(3*count/2>>0));this.ImData=_ctx.createImageData(this.len/4,1); this.data=this.ImData.data;var newData=this.data;for(var i=0;i>>8&255};this.WriteUShort=function(val){this.WriteShort(AscFonts.FT_Common.UShort_To_Short(val))};this.WriteLong=function(val){this.CheckSize(4);this.data[this.pos++]=val&255;this.data[this.pos++]=val>>>8&255;this.data[this.pos++]=val>>>16&255;this.data[this.pos++]=val>>>24&255};this.WriteULong=function(val){this.WriteLong(AscFonts.FT_Common.UintToInt(val))};this.WriteDouble=function(val){this.CheckSize(4);var lval=val*1E5>>0&4294967295;this.data[this.pos++]=lval& 255;this.data[this.pos++]=lval>>>8&255;this.data[this.pos++]=lval>>>16&255;this.data[this.pos++]=lval>>>24&255};var tempHelp=new ArrayBuffer(8);var tempHelpUnit=new Uint8Array(tempHelp);var tempHelpFloat=new Float64Array(tempHelp);this.WriteDouble2=function(val){this.CheckSize(8);tempHelpFloat[0]=val;this.data[this.pos++]=tempHelpUnit[0];this.data[this.pos++]=tempHelpUnit[1];this.data[this.pos++]=tempHelpUnit[2];this.data[this.pos++]=tempHelpUnit[3];this.data[this.pos++]=tempHelpUnit[4];this.data[this.pos++]= tempHelpUnit[5];this.data[this.pos++]=tempHelpUnit[6];this.data[this.pos++]=tempHelpUnit[7]};this._doubleEncodeLE754=function(v){var s,e,m,i,d,c,mLen,eLen,eBias,eMax;var el={len:8,mLen:52,rt:0};mLen=el.mLen,eLen=el.len*8-el.mLen-1,eMax=(1<>1;s=v<0?1:0;v=Math.abs(v);if(isNaN(v)||v==Infinity){m=isNaN(v)?1:0;e=eMax}else{e=Math.floor(Math.log(v)/Math.LN2);if(v*(c=Math.pow(2,-e))<1){e--;c*=2}if(e+eBias>=1)v+=el.rt/c;else v+=el.rt*Math.pow(2,1-eBias);if(v*c>=2){e++;c/=2}if(e+eBias>= eMax){m=0;e=eMax}else if(e+eBias>=1){m=(v*c-1)*Math.pow(2,mLen);e=e+eBias}else{m=v*Math.pow(2,eBias-1)*Math.pow(2,mLen);e=0}}var a=new Array(8);for(i=0,d=1;mLen>=8;a[i]=m&255,i+=d,m/=256,mLen-=8);for(e=e<0;a[i]=e&255,i+=d,e/=256,eLen-=8);a[i-d]|=s*128;return a};this.WriteStringBySymbol=function(code){if(code<65535){this.CheckSize(4);this.data[this.pos++]=1;this.data[this.pos++]=0;this.data[this.pos++]=code&255;this.data[this.pos++]=code>>>8&255}else{this.CheckSize(6);this.data[this.pos++]= 2;this.data[this.pos++]=0;var codePt=code-65536;var c1=55296|codePt>>10;var c2=56320|codePt&1023;this.data[this.pos++]=c1&255;this.data[this.pos++]=c1>>>8&255;this.data[this.pos++]=c2&255;this.data[this.pos++]=c2>>>8&255}};this.WriteString=function(text){if("string"!=typeof text)text=text+"";var count=text.length&65535;this.CheckSize(2*count+2);this.data[this.pos++]=count&255;this.data[this.pos++]=count>>>8&255;for(var i=0;i>>8&255}};this.WriteString2=function(text){if("string"!=typeof text)text=text+"";var count=text.length&2147483647;var countWrite=2*count;this.WriteLong(countWrite);this.CheckSize(countWrite);for(var i=0;i>>8&255}};this.WriteString3=function(text){if("string"!=typeof text)text=text+"";var count=text.length&2147483647;var countWrite=2*count;this.CheckSize(countWrite);for(var i=0;i>>8&255}};this.WriteString4=function(text){if("string"!=typeof text)text=text+"";var count=text.length&2147483647;this.WriteLong(count);this.CheckSize(2*count);for(var i=0;i>>8&255}};this.ClearNoAttack=function(){this.pos=0};this.WriteLongAt=function(_pos,val){this.data[_pos++]=val&255;this.data[_pos++]=val>>>8&255;this.data[_pos++]=val>>>16&255; this.data[_pos++]=val>>>24&255};this.WriteBuffer=function(data,_pos,count){this.CheckSize(count);for(var i=0;i>6;this.data[this.pos++]=128|code&63}else if(code<65536){this.data[this.pos++]=224|code>>12;this.data[this.pos++]=128|code>>6&63;this.data[this.pos++]=128|code&63}else if(code<2097151){this.data[this.pos++]= 240|code>>18;this.data[this.pos++]=128|code>>12&63;this.data[this.pos++]=128|code>>6&63;this.data[this.pos++]=128|code&63}else if(code<67108863){this.data[this.pos++]=248|code>>24;this.data[this.pos++]=128|code>>18&63;this.data[this.pos++]=128|code>>12&63;this.data[this.pos++]=128|code>>6&63;this.data[this.pos++]=128|code&63}else if(code<2147483647){this.data[this.pos++]=252|code>>30;this.data[this.pos++]=128|code>>24&63;this.data[this.pos++]=128|code>>18&63;this.data[this.pos++]=128|code>>12&63; this.data[this.pos++]=128|code>>6&63;this.data[this.pos++]=128|code&63}};this.WriteXmlString=function(val){var pCur=0;var pEnd=val.length;while(pCur=55296&&code<=57343&&pCur=55296&&code<=57343&&pCur>7)}for(var i=0;i<4;++i){var part= len&127;len=len>>7;if(len===0){this.WriteByte(part);break}else this.WriteByte(part|128)}};this.XlsbEndRecord=function(){}}function CCommandsType(){this.ctPenXML=0;this.ctPenColor=1;this.ctPenAlpha=2;this.ctPenSize=3;this.ctPenDashStyle=4;this.ctPenLineStartCap=5;this.ctPenLineEndCap=6;this.ctPenLineJoin=7;this.ctPenDashPatern=8;this.ctPenDashPatternCount=9;this.ctPenDashOffset=10;this.ctPenAlign=11;this.ctPenMiterLimit=12;this.ctBrushXML=20;this.ctBrushType=21;this.ctBrushColor1=22;this.ctBrushColor2= 23;this.ctBrushAlpha1=24;this.ctBrushAlpha2=25;this.ctBrushTexturePath=26;this.ctBrushTextureAlpha=27;this.ctBrushTextureMode=28;this.ctBrushRectable=29;this.ctBrushRectableEnabled=30;this.ctBrushGradient=31;this.ctFontXML=40;this.ctFontName=41;this.ctFontSize=42;this.ctFontStyle=43;this.ctFontPath=44;this.ctFontGID=45;this.ctFontCharSpace=46;this.ctShadowXML=50;this.ctShadowVisible=51;this.ctShadowDistanceX=52;this.ctShadowDistanceY=53;this.ctShadowBlurSize=54;this.ctShadowColor=55;this.ctShadowAlpha= 56;this.ctEdgeXML=70;this.ctEdgeVisible=71;this.ctEdgeDistance=72;this.ctEdgeColor=73;this.ctEdgeAlpha=74;this.ctDrawText=80;this.ctDrawTextEx=81;this.ctDrawTextCode=82;this.ctDrawTextCodeGid=83;this.ctPathCommandMoveTo=91;this.ctPathCommandLineTo=92;this.ctPathCommandLinesTo=93;this.ctPathCommandCurveTo=94;this.ctPathCommandCurvesTo=95;this.ctPathCommandArcTo=96;this.ctPathCommandClose=97;this.ctPathCommandEnd=98;this.ctDrawPath=99;this.ctPathCommandStart=100;this.ctPathCommandGetCurrentPoint=101; this.ctPathCommandText=102;this.ctPathCommandTextEx=103;this.ctDrawImage=110;this.ctDrawImageFromFile=111;this.ctSetParams=120;this.ctBeginCommand=121;this.ctEndCommand=122;this.ctSetTransform=130;this.ctResetTransform=131;this.ctClipMode=140;this.ctCommandLong1=150;this.ctCommandDouble1=151;this.ctCommandString1=152;this.ctCommandLong2=153;this.ctCommandDouble2=154;this.ctCommandString2=155;this.ctHyperlink=160;this.ctLink=161;this.ctFormField=162;this.ctPageWidth=200;this.ctPageHeight=201;this.ctPageStart= 202;this.ctPageEnd=203;this.ctError=255}var CommandType=new CCommandsType;var MetaBrushType={Solid:0,Gradient:1,Texture:2};var DashPatternPresets=[[4,3],[4,3,1,3],[1,3],[8,3],[8,3,1,3],[8,3,1,3,1,3],undefined,[3,1],[3,1,1,1],[3,1,1,1,1,1],[1,1]];function CMetafileFontPicker(manager){this.Manager=manager;if(!this.Manager){this.Manager=new AscFonts.CFontManager;this.Manager.Initialize(false)}this.FontsInCache={};this.LastPickFont=null;this.LastPickFontNameOrigin="";this.LastPickFontName="";this.Metafile= null;this.SetFont=function(setFont){var name=setFont.FontFamily.Name;var size=setFont.FontSize;var style=0;if(setFont.Italic==true)style+=2;if(setFont.Bold==true)style+=1;var name_check=name+"_"+style;if(this.FontsInCache[name_check])this.LastPickFont=this.FontsInCache[name_check];else{var font=g_fontApplication.GetFontFileWeb(name,style);var font_name_index=AscFonts.g_map_font_index[font.m_wsFontName];var fontId=AscFonts.g_font_infos[font_name_index].GetFontID(AscCommon.g_font_loader,style);var test_id= fontId.id+fontId.faceIndex+size;var cache=this.Manager.m_oFontsCache;this.LastPickFont=cache.Fonts[test_id];if(!this.LastPickFont)this.LastPickFont=cache.Fonts[test_id+"nbold"];if(!this.LastPickFont)this.LastPickFont=cache.Fonts[test_id+"nitalic"];if(!this.LastPickFont)this.LastPickFont=cache.Fonts[test_id+"nboldnitalic"];if(!this.LastPickFont){if(window["NATIVE_EDITOR_ENJINE"]&&fontId.file.Status!=0)fontId.file.LoadFontNative();this.LastPickFont=cache.LockFont(fontId.file.stream_index,fontId.id, fontId.faceIndex,size,"",this.Manager)}this.FontsInCache[name_check]=this.LastPickFont}this.LastPickFontNameOrigin=name;this.LastPickFontName=name;this.Metafile.SetFont(setFont,true)};this.FillTextCode=function(glyph){if(this.LastPickFont&&this.LastPickFont.GetGIDByUnicode(glyph)){if(this.LastPickFontName!=this.LastPickFontNameOrigin){this.LastPickFontName=this.LastPickFontNameOrigin;this.Metafile.SetFontName(this.LastPickFontName)}}else{var name=AscFonts.FontPickerByCharacter.getFontBySymbol(glyph); if(name!=this.LastPickFontName){this.LastPickFontName=name;this.Metafile.SetFontName(this.LastPickFontName)}}}}function CMetafile(width,height){this.Width=width;this.Height=height;this.m_oPen=new CPen;this.m_oBrush=new CBrush;this.m_oFont={Name:"",FontSize:-1,Style:-1};this.m_oPen.Color.R=-1;this.m_oBrush.Color1.R=-1;this.m_oBrush.Color2.R=-1;this.m_oTransform=new CMatrix;this.m_arrayCommands=[];this.Memory=null;this.VectorMemoryForPrint=null;this.BrushType=MetaBrushType.Solid;this.m_oTextPr=null; this.m_oGrFonts=new CGrRFonts;this.m_oFontSlotFont=new CFontSetup;this.LastFontOriginInfo={Name:"",Replace:null};this.m_oFontTmp={FontFamily:{Name:"arial"},Bold:false,Italic:false};this.StartOffset=0;this.m_bIsPenDash=false;this.FontPicker=null}CMetafile.prototype={p_color:function(r,g,b,a){if(this.m_oPen.Color.R!=r||this.m_oPen.Color.G!=g||this.m_oPen.Color.B!=b){this.m_oPen.Color.R=r;this.m_oPen.Color.G=g;this.m_oPen.Color.B=b;var value=b<<16|g<<8|r;this.Memory.WriteByte(CommandType.ctPenColor); this.Memory.WriteLong(value)}if(this.m_oPen.Color.A!=a){this.m_oPen.Color.A=a;this.Memory.WriteByte(CommandType.ctPenAlpha);this.Memory.WriteByte(a)}},p_width:function(w){var val=w/1E3;if(this.m_oPen.Size!=val){this.m_oPen.Size=val;this.Memory.WriteByte(CommandType.ctPenSize);this.Memory.WriteDouble(val)}},p_dash:function(params){var bIsDash=params&¶ms.length>0?true:false;if(false==this.m_bIsPenDash&&bIsDash==this.m_bIsPenDash)return;this.m_bIsPenDash=bIsDash;if(!this.m_bIsPenDash){this.Memory.WriteByte(CommandType.ctPenDashStyle); this.Memory.WriteByte(0)}else{this.Memory.WriteByte(CommandType.ctPenDashStyle);this.Memory.WriteByte(5);this.Memory.WriteLong(params.length);for(var i=0;i0){nFlag|=1<<21;this.Memory.WriteLong(oTextFormPr.MaxCharacters)}var sValue=oForm.GetSelectedText(true);if(sValue){nFlag|=1<<22;this.Memory.WriteString(sValue)}}else if(oForm.IsComboBox()|| oForm.IsDropDownList()){this.Memory.WriteLong(2);var isComboBox=oForm.IsComboBox();var oFormPr=isComboBox?oForm.GetComboBoxPr():oForm.GetDropDownListPr();if(!isComboBox)nFlag|=1<<20;var sValue=oForm.GetSelectedText(true);var nSelectedIndex=-1;var nItemsCount=oFormPr.GetItemsCount();if(nItemsCount>0&&AscCommon.translateManager.getValue("Choose an item")===oFormPr.GetItemDisplayText(0)){this.Memory.WriteLong(nItemsCount-1);for(var nIndex=1;nIndex0||srcRect.t>0||srcRect.r<100||srcRect.b<100)bIsClip=true;if(bIsClip){this.SaveGrState(); this.AddClipRect(x,y,w,h)}var __w=w;var __h=h;var _delW=Math.max(0,-srcRect.l)+Math.max(0,srcRect.r-100)+100;var _delH=Math.max(0,-srcRect.t)+Math.max(0,srcRect.b-100)+100;if(srcRect.l<0){var _off=-srcRect.l/_delW*__w;x+=_off;w-=_off}if(srcRect.t<0){var _off=-srcRect.t/_delH*__h;y+=_off;h-=_off}if(srcRect.r>100){var _off=(srcRect.r-100)/_delW*__w;w-=_off}if(srcRect.b>100){var _off=(srcRect.b-100)/_delH*__h;h-=_off}var _wk=100;if(srcRect.l>0)_wk-=srcRect.l;if(srcRect.r<100)_wk-=100-srcRect.r;_wk=100/ _wk;var _hk=100;if(srcRect.t>0)_hk-=srcRect.t;if(srcRect.b<100)_hk-=100-srcRect.b;_hk=100/_hk;var _r=x+w;var _b=y+h;if(srcRect.l>0)x-=srcRect.l*_wk*w/100;if(srcRect.t>0)y-=srcRect.t*_hk*h/100;if(srcRect.r<100)_r+=(100-srcRect.r)*_wk*w/100;if(srcRect.b<100)_b+=(100-srcRect.b)*_hk*h/100;this.m_arrayPages[this.m_lPagesCount-1].drawImage(img,x,y,_r-x,_b-y);if(bIsClip)this.RestoreGrState()}},SetFont:function(font){if(0!=this.m_lPagesCount)this.m_arrayPages[this.m_lPagesCount-1].SetFont(font)},FillText:function(x, y,text,cropX,cropW){if(0!=this.m_lPagesCount)this.m_arrayPages[this.m_lPagesCount-1].FillText(x,y,text)},FillTextCode:function(x,y,text,cropX,cropW){if(0!=this.m_lPagesCount)this.m_arrayPages[this.m_lPagesCount-1].FillTextCode(x,y,text)},tg:function(gid,x,y){if(0!=this.m_lPagesCount)this.m_arrayPages[this.m_lPagesCount-1].tg(gid,x,y)},FillText2:function(x,y,text){if(0!=this.m_lPagesCount)this.m_arrayPages[this.m_lPagesCount-1].FillText(x,y,text)},charspace:function(space){},SetIntegerGrid:function(param){}, GetIntegerGrid:function(){},GetFont:function(){if(0!=this.m_lPagesCount)return this.m_arrayPages[this.m_lPagesCount-1].m_oFont;return null},put_GlobalAlpha:function(enable,alpha){},Start_GlobalAlpha:function(){},End_GlobalAlpha:function(){},DrawHeaderEdit:function(yPos){},DrawFooterEdit:function(yPos){},drawCollaborativeChanges:function(x,y,w,h){},drawSearchResult:function(x,y,w,h){},DrawEmptyTableLine:function(x1,y1,x2,y2){},DrawLockParagraph:function(lock_type,x,y1,y2){},DrawLockObjectRect:function(lock_type, x,y,w,h){},DrawSpellingLine:function(y0,x0,x1,w){},drawHorLine:function(align,y,x,r,penW){this.p_width(1E3*penW);this._s();var _y=y;switch(align){case 0:{_y=y+penW/2;break}case 1:{break}case 2:{_y=y-penW/2}}this._m(x,y);this._l(r,y);this.ds();this._e()},drawHorLine2:function(align,y,x,r,penW){this.p_width(1E3*penW);var _y=y;switch(align){case 0:{_y=y+penW/2;break}case 1:{break}case 2:{_y=y-penW/2;break}}this._s();this._m(x,_y-penW);this._l(r,_y-penW);this.ds();this._s();this._m(x,_y+penW);this._l(r, _y+penW);this.ds();this._e()},drawVerLine:function(align,x,y,b,penW){this.p_width(1E3*penW);this._s();var _x=x;switch(align){case 0:{_x=x+penW/2;break}case 1:{break}case 2:{_x=x-penW/2}}this._m(_x,y);this._l(_x,b);this.ds()},drawHorLineExt:function(align,y,x,r,penW,leftMW,rightMW){this.drawHorLine(align,y,x+leftMW,r+rightMW,penW)},rect:function(x,y,w,h){var _x=x;var _y=y;var _r=x+w;var _b=y+h;this._s();this._m(_x,_y);this._l(_r,_y);this._l(_r,_b);this._l(_x,_b);this._l(_x,_y)},TableRect:function(x, y,w,h){this.rect(x,y,w,h);this.df()},put_PenLineJoin:function(_join){if(0!=this.m_lPagesCount)this.m_arrayPages[this.m_lPagesCount-1].put_PenLineJoin(_join)},put_TextureBounds:function(x,y,w,h){if(0!=this.m_lPagesCount)this.m_arrayPages[this.m_lPagesCount-1].put_TextureBounds(x,y,w,h)},put_TextureBoundsEnabled:function(val){if(0!=this.m_lPagesCount)this.m_arrayPages[this.m_lPagesCount-1].put_TextureBoundsEnabled(val)},put_brushTexture:function(src,mode){if(src==null||src==undefined)src="";if(0!=this.m_lPagesCount)this.m_arrayPages[this.m_lPagesCount- 1].put_brushTexture(src,mode)},put_BrushTextureAlpha:function(alpha){if(0!=this.m_lPagesCount)this.m_arrayPages[this.m_lPagesCount-1].put_BrushTextureAlpha(alpha)},put_BrushGradient:function(gradFill,points,transparent){if(0!=this.m_lPagesCount)this.m_arrayPages[this.m_lPagesCount-1].put_BrushGradient(gradFill,points,transparent)},AddClipRect:function(x,y,w,h){var __rect=new _rect;__rect.x=x;__rect.y=y;__rect.w=w;__rect.h=h;this.GrState.AddClipRect(__rect)},RemoveClipRect:function(){},SetClip:function(r){if(0!= this.m_lPagesCount)this.m_arrayPages[this.m_lPagesCount-1].beginCommand(32);this.rect(r.x,r.y,r.w,r.h);if(0!=this.m_lPagesCount)this.m_arrayPages[this.m_lPagesCount-1].endCommand(32)},RemoveClip:function(){if(0!=this.m_lPagesCount){this.m_arrayPages[this.m_lPagesCount-1].beginCommand(64);this.m_arrayPages[this.m_lPagesCount-1].endCommand(64)}},GetTransform:function(){if(0!=this.m_lPagesCount)return this.m_arrayPages[this.m_lPagesCount-1].m_oTransform;return null},GetLineWidth:function(){if(0!=this.m_lPagesCount)return this.m_arrayPages[this.m_lPagesCount- 1].m_oPen.Size;return 0},GetPen:function(){if(0!=this.m_lPagesCount)return this.m_arrayPages[this.m_lPagesCount-1].m_oPen;return 0},GetBrush:function(){if(0!=this.m_lPagesCount)return this.m_arrayPages[this.m_lPagesCount-1].m_oBrush;return 0},drawFlowAnchor:function(x,y){},SavePen:function(){this.GrState.SavePen()},RestorePen:function(){this.GrState.RestorePen()},SaveBrush:function(){this.GrState.SaveBrush()},RestoreBrush:function(){this.GrState.RestoreBrush()},SavePenBrush:function(){this.GrState.SavePenBrush()}, RestorePenBrush:function(){this.GrState.RestorePenBrush()},SaveGrState:function(){this.GrState.SaveGrState()},RestoreGrState:function(){var _t=this.m_oBaseTransform;this.m_oBaseTransform=null;this.GrState.RestoreGrState();this.m_oBaseTransform=_t},StartClipPath:function(){this.private_removeVectors();if(0!=this.m_lPagesCount)this.m_arrayPages[this.m_lPagesCount-1].beginCommand(32)},EndClipPath:function(){if(0!=this.m_lPagesCount)this.m_arrayPages[this.m_lPagesCount-1].endCommand(32);this.private_restoreVectors()}, SetTextPr:function(textPr,theme){if(0!=this.m_lPagesCount){var _page=this.m_arrayPages[this.m_lPagesCount-1];if(theme&&textPr&&textPr.ReplaceThemeFonts)textPr.ReplaceThemeFonts(theme.themeElements.fontScheme);_page.m_oTextPr=textPr;if(theme)_page.m_oGrFonts.checkFromTheme(theme.themeElements.fontScheme,_page.m_oTextPr.RFonts);else _page.m_oGrFonts=_page.m_oTextPr.RFonts}},SetFontSlot:function(slot,fontSizeKoef){if(0!=this.m_lPagesCount)this.m_arrayPages[this.m_lPagesCount-1].SetFontSlot(slot,fontSizeKoef)}, GetTextPr:function(){if(0!=this.m_lPagesCount)return this.m_arrayPages[this.m_lPagesCount-1].m_oTextPr;return null},DrawPresentationComment:function(type,x,y,w,h){},private_removeVectors:function(){this._restoreDumpedVectors=this.VectorMemoryForPrint;if(this._restoreDumpedVectors!=null){this.VectorMemoryForPrint=null;if(0!=this.m_lPagesCount)this.m_arrayPages[this.m_lPagesCount-1].VectorMemoryForPrint=null}},private_restoreVectors:function(){if(null!=this._restoreDumpedVectors){this.VectorMemoryForPrint= this._restoreDumpedVectors;if(0!=this.m_lPagesCount)this.m_arrayPages[this.m_lPagesCount-1].VectorMemoryForPrint=this._restoreDumpedVectors}this._restoreDumpedVectors=null},AddHyperlink:function(x,y,w,h,url,tooltip){if(0!==this.m_lPagesCount)this.m_arrayPages[this.m_lPagesCount-1].AddHyperlink(x,y,w,h,url,tooltip)},AddLink:function(x,y,w,h,dx,dy,dPage){if(0!==this.m_lPagesCount)this.m_arrayPages[this.m_lPagesCount-1].AddLink(x,y,w,h,dx,dy,dPage)},AddFormField:function(nX,nY,nW,nH,nBaseLineOffset, oForm){if(0!==this.m_lPagesCount)this.m_arrayPages[this.m_lPagesCount-1].AddFormField(nX,nY,nW,nH,nBaseLineOffset,oForm)}};var MATRIX_ORDER_PREPEND=0;var MATRIX_ORDER_APPEND=1;function deg2rad(deg){return deg*Math.PI/180}function rad2deg(rad){return rad*180/Math.PI}function CMatrix(){this.sx=1;this.shx=0;this.shy=0;this.sy=1;this.tx=0;this.ty=0}CMatrix.prototype={Reset:function(){this.sx=1;this.shx=0;this.shy=0;this.sy=1;this.tx=0;this.ty=0},Multiply:function(matrix,order){if(MATRIX_ORDER_PREPEND== order){var m=new CMatrix;m.sx=matrix.sx;m.shx=matrix.shx;m.shy=matrix.shy;m.sy=matrix.sy;m.tx=matrix.tx;m.ty=matrix.ty;m.Multiply(this,MATRIX_ORDER_APPEND);this.sx=m.sx;this.shx=m.shx;this.shy=m.shy;this.sy=m.sy;this.tx=m.tx;this.ty=m.ty}else{var t0=this.sx*matrix.sx+this.shy*matrix.shx;var t2=this.shx*matrix.sx+this.sy*matrix.shx;var t4=this.tx*matrix.sx+this.ty*matrix.shx+matrix.tx;this.shy=this.sx*matrix.shy+this.shy*matrix.sy;this.sy=this.shx*matrix.shy+this.sy*matrix.sy;this.ty=this.tx*matrix.shy+ this.ty*matrix.sy+matrix.ty;this.sx=t0;this.shx=t2;this.tx=t4}return this},Translate:function(x,y,order){var m=new CMatrix;m.tx=x;m.ty=y;this.Multiply(m,order)},Scale:function(x,y,order){var m=new CMatrix;m.sx=x;m.sy=y;this.Multiply(m,order)},Rotate:function(a,order){var m=new CMatrix;var rad=deg2rad(a);m.sx=Math.cos(rad);m.shx=Math.sin(rad);m.shy=-Math.sin(rad);m.sy=Math.cos(rad);this.Multiply(m,order)},RotateAt:function(a,x,y,order){this.Translate(-x,-y,order);this.Rotate(a,order);this.Translate(x, y,order)},Determinant:function(){return this.sx*this.sy-this.shy*this.shx},Invert:function(){var det=this.Determinant();if(1E-4>Math.abs(det))return;var d=1/det;var t0=this.sy*d;this.sy=this.sx*d;this.shy=-this.shy*d;this.shx=-this.shx*d;var t4=-this.tx*t0-this.ty*this.shx;this.ty=-this.tx*this.shy-this.ty*this.sy;this.sx=t0;this.tx=t4;return this},TransformPointX:function(x,y){return x*this.sx+y*this.shx+this.tx},TransformPointY:function(x,y){return x*this.shy+y*this.sy+this.ty},GetRotation:function(){var x1= 0;var y1=0;var x2=1;var y2=0;var _x1=this.TransformPointX(x1,y1);var _y1=this.TransformPointY(x1,y1);var _x2=this.TransformPointX(x2,y2);var _y2=this.TransformPointY(x2,y2);var _y=_y2-_y1;var _x=_x2-_x1;if(Math.abs(_y)<.001)if(_x>0)return 0;else return 180;if(Math.abs(_x)<.001)if(_y>0)return 90;else return 270;var a=Math.atan2(_y,_x);a=rad2deg(a);if(a<0)a+=360;return a},CreateDublicate:function(){var m=new CMatrix;m.sx=this.sx;m.shx=this.shx;m.shy=this.shy;m.sy=this.sy;m.tx=this.tx;m.ty=this.ty;return m}, IsIdentity:function(){if(this.sx==1&&this.shx==0&&this.shy==0&&this.sy==1&&this.tx==0&&this.ty==0)return true;return false},IsIdentity2:function(){if(this.sx==1&&this.shx==0&&this.shy==0&&this.sy==1)return true;return false},GetScaleValue:function(){var x1=this.TransformPointX(0,0);var y1=this.TransformPointY(0,0);var x2=this.TransformPointX(1,1);var y2=this.TransformPointY(1,1);return Math.sqrt(((x2-x1)*(x2-x1)+(y2-y1)*(y2-y1))/2)}};function GradientGetAngleNoRotate(_angle,_transform){var x1=0;var y1= 0;var x2=1;var y2=0;var _matrixRotate=new CMatrix;_matrixRotate.Rotate(-_angle/6E4);var _x11=_matrixRotate.TransformPointX(x1,y1);var _y11=_matrixRotate.TransformPointY(x1,y1);var _x22=_matrixRotate.TransformPointX(x2,y2);var _y22=_matrixRotate.TransformPointY(x2,y2);_matrixRotate=global_MatrixTransformer.Invert(_transform);var _x1=_matrixRotate.TransformPointX(_x11,_y11);var _y1=_matrixRotate.TransformPointY(_x11,_y11);var _x2=_matrixRotate.TransformPointX(_x22,_y22);var _y2=_matrixRotate.TransformPointY(_x22, _y22);var _y=_y2-_y1;var _x=_x2-_x1;var a=0;if(Math.abs(_y)<.001)if(_x>0)a=0;else a=180;else if(Math.abs(_x)<.001)if(_y>0)a=90;else a=270;else{a=Math.atan2(_y,_x);a=rad2deg(a)}if(a<0)a+=360;return a*6E4}var CMatrixL=CMatrix;function CGlobalMatrixTransformer(){this.TranslateAppend=function(m,_tx,_ty){m.tx+=_tx;m.ty+=_ty};this.ScaleAppend=function(m,_sx,_sy){m.sx*=_sx;m.shx*=_sx;m.shy*=_sy;m.sy*=_sy;m.tx*=_sx;m.ty*=_sy};this.RotateRadAppend=function(m,_rad){var _sx=Math.cos(_rad);var _shx=Math.sin(_rad); var _shy=-Math.sin(_rad);var _sy=Math.cos(_rad);var t0=m.sx*_sx+m.shy*_shx;var t2=m.shx*_sx+m.sy*_shx;var t4=m.tx*_sx+m.ty*_shx;m.shy=m.sx*_shy+m.shy*_sy;m.sy=m.shx*_shy+m.sy*_sy;m.ty=m.tx*_shy+m.ty*_sy;m.sx=t0;m.shx=t2;m.tx=t4};this.MultiplyAppend=function(m1,m2){var t0=m1.sx*m2.sx+m1.shy*m2.shx;var t2=m1.shx*m2.sx+m1.sy*m2.shx;var t4=m1.tx*m2.sx+m1.ty*m2.shx+m2.tx;m1.shy=m1.sx*m2.shy+m1.shy*m2.sy;m1.sy=m1.shx*m2.shy+m1.sy*m2.sy;m1.ty=m1.tx*m2.shy+m1.ty*m2.sy+m2.ty;m1.sx=t0;m1.shx=t2;m1.tx=t4};this.Invert= function(m){var newM=m.CreateDublicate();var det=newM.sx*newM.sy-newM.shy*newM.shx;if(1E-4>Math.abs(det))return newM;var d=1/det;var t0=newM.sy*d;newM.sy=newM.sx*d;newM.shy=-newM.shy*d;newM.shx=-newM.shx*d;var t4=-newM.tx*t0-newM.ty*newM.shx;newM.ty=-newM.tx*newM.shy-newM.ty*newM.sy;newM.sx=t0;newM.tx=t4;return newM};this.MultiplyAppendInvert=function(m1,m2){var m=this.Invert(m2);this.MultiplyAppend(m1,m)};this.MultiplyPrepend=function(m1,m2){var m=new CMatrixL;m.sx=m2.sx;m.shx=m2.shx;m.shy=m2.shy; m.sy=m2.sy;m.tx=m2.tx;m.ty=m2.ty;this.MultiplyAppend(m,m1);m1.sx=m.sx;m1.shx=m.shx;m1.shy=m.shy;m1.sy=m.sy;m1.tx=m.tx;m1.ty=m.ty};this.CreateDublicateM=function(matrix){var m=new CMatrixL;m.sx=matrix.sx;m.shx=matrix.shx;m.shy=matrix.shy;m.sy=matrix.sy;m.tx=matrix.tx;m.ty=matrix.ty;return m};this.IsIdentity=function(m){if(m.sx==1&&m.shx==0&&m.shy==0&&m.sy==1&&m.tx==0&&m.ty==0)return true;return false};this.IsIdentity2=function(m){var eps=1E-5;if(Math.abs(m.sx-1)res.w)res.w=0;if(0>res.h)res.h=0;return res}}function CPen(){this.Color={R:255,G:255,B:255,A:255};this.Style=0;this.LineCap=0;this.LineJoin=0;this.LineWidth=1}function CBrush(){this.Color1={R:255,G:255,B:255,A:255};this.Color2={R:255,G:255,B:255,A:255};this.Type=0}function CTableMarkup(Table){this.Internal= {RowIndex:0,CellIndex:0,PageNum:0};this.Table=Table;this.X=0;this.Cols=[];this.Margins=[];this.Rows=[];this.CurCol=0;this.CurRow=0;this.TransformX=0;this.TransformY=0}CTableMarkup.prototype={CreateDublicate:function(){var obj=new CTableMarkup(this.Table);obj.Internal={RowIndex:this.Internal.RowIndex,CellIndex:this.Internal.CellIndex,PageNum:this.Internal.PageNum};obj.X=this.X;var len=this.Cols.length;for(var i=0;i0)_Y=this.Rows[0].Y;return _Y}};function CTableOutline(Table,PageNum,X,Y,W,H){this.Table=Table;this.PageNum=PageNum;this.X=X;this.Y=Y;this.W=W;this.H=H}var g_fontManager=new AscFonts.CFontManager;g_fontManager.Initialize(true);g_fontManager.SetHintsProps(true,true);var g_dDpiX=96;var g_dDpiY=96;var g_dKoef_mm_to_pix=g_dDpiX/25.4;var g_dKoef_pix_to_mm=25.4/g_dDpiX;function _rect(){this.x=0;this.y=0;this.w=0;this.h=0}window["AscCommon"]=window["AscCommon"]||{};window["AscCommon"].CGrRFonts= CGrRFonts;window["AscCommon"].CFontSetup=CFontSetup;window["AscCommon"].CGrState=CGrState;window["AscCommon"].Base64Encode=Base64Encode;window["AscCommon"].CMemory=CMemory;window["AscCommon"].CDocumentRenderer=CDocumentRenderer;window["AscCommon"].MATRIX_ORDER_PREPEND=MATRIX_ORDER_PREPEND;window["AscCommon"].MATRIX_ORDER_APPEND=MATRIX_ORDER_APPEND;window["AscCommon"].deg2rad=deg2rad;window["AscCommon"].rad2deg=rad2deg;window["AscCommon"].CMatrix=CMatrix;window["AscCommon"].CMatrixL=CMatrixL;window["AscCommon"].CGlobalMatrixTransformer= CGlobalMatrixTransformer;window["AscCommon"].CClipManager=CClipManager;window["AscCommon"].CPen=CPen;window["AscCommon"].CBrush=CBrush;window["AscCommon"].CTableMarkup=CTableMarkup;window["AscCommon"].CTableOutline=CTableOutline;window["AscCommon"]._rect=_rect;window["AscCommon"].global_MatrixTransformer=new CGlobalMatrixTransformer;window["AscCommon"].g_fontManager=g_fontManager;window["AscCommon"].g_dDpiX=g_dDpiX;window["AscCommon"].g_dKoef_mm_to_pix=g_dKoef_mm_to_pix;window["AscCommon"].g_dKoef_pix_to_mm= g_dKoef_pix_to_mm;window["AscCommon"].GradientGetAngleNoRotate=GradientGetAngleNoRotate;window["AscCommon"].DashPatternPresets=DashPatternPresets;window["AscCommon"].CommandType=CommandType})(window);"use strict";(function(window,undefined){function CTextMeasurer(){this.m_oManager=new AscFonts.CFontManager;this.m_oFont=null;this.m_oTextPr=null;this.m_oGrFonts=new AscCommon.CGrRFonts;this.m_oLastFont=new AscCommon.CFontSetup;this.LastFontOriginInfo={Name:"",Replace:null}}CTextMeasurer.prototype={Init:function(){this.m_oManager.Initialize()}, SetStringGid:function(bGID){this.m_oManager.SetStringGID(bGID)},SetFont:function(font){if(!font)return;this.m_oFont=font;var bItalic=true===font.Italic;var bBold=true===font.Bold;var oFontStyle=FontStyle.FontStyleRegular;if(!bItalic&&bBold)oFontStyle=FontStyle.FontStyleBold;else if(bItalic&&!bBold)oFontStyle=FontStyle.FontStyleItalic;else if(bItalic&&bBold)oFontStyle=FontStyle.FontStyleBoldItalic;var _lastSetUp=this.m_oLastFont;if(_lastSetUp.SetUpName!=font.FontFamily.Name||_lastSetUp.SetUpSize!= font.FontSize||_lastSetUp.SetUpStyle!=oFontStyle){_lastSetUp.SetUpName=font.FontFamily.Name;_lastSetUp.SetUpSize=font.FontSize;_lastSetUp.SetUpStyle=oFontStyle;g_fontApplication.LoadFont(_lastSetUp.SetUpName,AscCommon.g_font_loader,this.m_oManager,_lastSetUp.SetUpSize,_lastSetUp.SetUpStyle,72,72,undefined,this.LastFontOriginInfo)}},SetFontInternal:function(_name,_size,_style){var _lastSetUp=this.m_oLastFont;if(_lastSetUp.SetUpName!=_name||_lastSetUp.SetUpSize!=_size||_lastSetUp.SetUpStyle!=_style){_lastSetUp.SetUpName= _name;_lastSetUp.SetUpSize=_size;_lastSetUp.SetUpStyle=_style;g_fontApplication.LoadFont(_lastSetUp.SetUpName,AscCommon.g_font_loader,this.m_oManager,_lastSetUp.SetUpSize,_lastSetUp.SetUpStyle,72,72,undefined,this.LastFontOriginInfo)}},SetTextPr:function(textPr,theme){if(theme&&textPr&&textPr.ReplaceThemeFonts)textPr.ReplaceThemeFonts(theme.themeElements.fontScheme);this.m_oTextPr=textPr;if(theme)this.m_oGrFonts.checkFromTheme(theme.themeElements.fontScheme,this.m_oTextPr.RFonts);else this.m_oGrFonts.fromRFonts(this.m_oTextPr.RFonts)}, SetFontSlot:function(slot,fontSizeKoef){var _rfonts=this.m_oGrFonts;var _lastFont=this.m_oLastFont;switch(slot){case fontslot_ASCII:{_lastFont.Name=_rfonts.Ascii.Name;_lastFont.Index=_rfonts.Ascii.Index;_lastFont.Size=this.m_oTextPr.FontSize;_lastFont.Bold=this.m_oTextPr.Bold;_lastFont.Italic=this.m_oTextPr.Italic;break}case fontslot_CS:{_lastFont.Name=_rfonts.CS.Name;_lastFont.Index=_rfonts.CS.Index;_lastFont.Size=this.m_oTextPr.FontSizeCS;_lastFont.Bold=this.m_oTextPr.BoldCS;_lastFont.Italic=this.m_oTextPr.ItalicCS; break}case fontslot_EastAsia:{_lastFont.Name=_rfonts.EastAsia.Name;_lastFont.Index=_rfonts.EastAsia.Index;_lastFont.Size=this.m_oTextPr.FontSize;_lastFont.Bold=this.m_oTextPr.Bold;_lastFont.Italic=this.m_oTextPr.Italic;break}case fontslot_HAnsi:default:{_lastFont.Name=_rfonts.HAnsi.Name;_lastFont.Index=_rfonts.HAnsi.Index;_lastFont.Size=this.m_oTextPr.FontSize;_lastFont.Bold=this.m_oTextPr.Bold;_lastFont.Italic=this.m_oTextPr.Italic;break}}if(undefined!==fontSizeKoef)_lastFont.Size*=fontSizeKoef; var _style=0;if(_lastFont.Italic)_style+=2;if(_lastFont.Bold)_style+=1;if(_lastFont.Name!=_lastFont.SetUpName||_lastFont.Size!=_lastFont.SetUpSize||_style!=_lastFont.SetUpStyle){_lastFont.SetUpName=_lastFont.Name;_lastFont.SetUpSize=_lastFont.Size;_lastFont.SetUpStyle=_style;g_fontApplication.LoadFont(_lastFont.SetUpName,AscCommon.g_font_loader,this.m_oManager,_lastFont.SetUpSize,_lastFont.SetUpStyle,72,72,undefined,this.LastFontOriginInfo)}},GetTextPr:function(){return this.m_oTextPr},GetFont:function(){return this.m_oFont}, Measure:function(text){var Width=0;var Height=0;var _code=text.charCodeAt(0);if(null!=this.LastFontOriginInfo.Replace)_code=g_fontApplication.GetReplaceGlyph(_code,this.LastFontOriginInfo.Replace);var Temp=this.m_oManager.MeasureChar(_code);Width=Temp.fAdvanceX*25.4/72;Height=0;return{Width:Width,Height:Height}},Measure2:function(text){var Width=0;var _code=text.charCodeAt(0);if(null!=this.LastFontOriginInfo.Replace)_code=g_fontApplication.GetReplaceGlyph(_code,this.LastFontOriginInfo.Replace);var Temp= this.m_oManager.MeasureChar(_code,true);Width=Temp.fAdvanceX*25.4/72;if(Temp.oBBox.rasterDistances==null)return{Width:Width,Ascent:Temp.oBBox.fMaxY*25.4/72,Height:(Temp.oBBox.fMaxY-Temp.oBBox.fMinY)*25.4/72,WidthG:(Temp.oBBox.fMaxX-Temp.oBBox.fMinX)*25.4/72,rasterOffsetX:0,rasterOffsetY:0};return{Width:Width,Ascent:Temp.oBBox.fMaxY*25.4/72,Height:(Temp.oBBox.fMaxY-Temp.oBBox.fMinY)*25.4/72,WidthG:(Temp.oBBox.fMaxX-Temp.oBBox.fMinX)*25.4/72,rasterOffsetX:Temp.oBBox.rasterDistances.dist_l*25.4/72,rasterOffsetY:Temp.oBBox.rasterDistances.dist_t* 25.4/72}},MeasureCode:function(lUnicode){var Width=0;var Height=0;if(null!=this.LastFontOriginInfo.Replace)lUnicode=g_fontApplication.GetReplaceGlyph(lUnicode,this.LastFontOriginInfo.Replace);var Temp=this.m_oManager.MeasureChar(lUnicode);Width=Temp.fAdvanceX*25.4/72;Height=(Temp.oBBox.fMaxY-Temp.oBBox.fMinY)*25.4/72;return{Width:Width,Height:Height,Ascent:Temp.oBBox.fMaxY*25.4/72}},Measure2Code:function(lUnicode){var Width=0;if(null!=this.LastFontOriginInfo.Replace)lUnicode=g_fontApplication.GetReplaceGlyph(lUnicode, this.LastFontOriginInfo.Replace);var Temp=this.m_oManager.MeasureChar(lUnicode,true);Width=Temp.fAdvanceX*25.4/72;if(Temp.oBBox.rasterDistances==null)return{Width:Width,Ascent:Temp.oBBox.fMaxY*25.4/72,Height:(Temp.oBBox.fMaxY-Temp.oBBox.fMinY)*25.4/72,WidthG:(Temp.oBBox.fMaxX-Temp.oBBox.fMinX)*25.4/72,rasterOffsetX:0,rasterOffsetY:0};return{Width:Width,Ascent:Temp.oBBox.fMaxY*25.4/72,Height:(Temp.oBBox.fMaxY-Temp.oBBox.fMinY)*25.4/72,WidthG:(Temp.oBBox.fMaxX-Temp.oBBox.fMinX)*25.4/72,rasterOffsetX:(Temp.oBBox.rasterDistances.dist_l+ Temp.oBBox.fMinX)*25.4/72,rasterOffsetY:Temp.oBBox.rasterDistances.dist_t*25.4/72}},GetAscender:function(){var UnitsPerEm=this.m_oManager.m_lUnits_Per_Em;var Ascender=this.m_oManager.m_lAscender;return Ascender*this.m_oLastFont.SetUpSize/UnitsPerEm*g_dKoef_pt_to_mm},GetDescender:function(){var UnitsPerEm=this.m_oManager.m_lUnits_Per_Em;var Descender=this.m_oManager.m_lDescender;return Descender*this.m_oLastFont.SetUpSize/UnitsPerEm*g_dKoef_pt_to_mm},GetHeight:function(){var UnitsPerEm=this.m_oManager.m_lUnits_Per_Em; var Height=this.m_oManager.m_lLineHeight;return Height*this.m_oLastFont.SetUpSize/UnitsPerEm*g_dKoef_pt_to_mm}};var g_oTextMeasurer=new CTextMeasurer;g_oTextMeasurer.Init();window["AscCommon"]=window["AscCommon"]||{};window["AscCommon"].CTextMeasurer=CTextMeasurer;window["AscCommon"].g_oTextMeasurer=g_oTextMeasurer})(window);"use strict";(function(window,undefined){AscCommon.isTouch=false;AscCommon.isTouchMove=false;AscCommon.TouchStartTime=-1;var AscBrowser=AscCommon.AscBrowser;var g_mouse_event_type_down= 0;var g_mouse_event_type_move=1;var g_mouse_event_type_up=2;var g_mouse_event_type_wheel=3;var g_mouse_button_left=0;var g_mouse_button_center=1;var g_mouse_button_right=2;var MouseUpLock={MouseUpLockedSend:false};AscCommon.stopEvent=function(e){if(!e)return;if(e.preventDefault)e.preventDefault();if(e.stopPropagation)e.stopPropagation()};var isUsePointerEvents=AscBrowser.isChrome&&AscBrowser.chromeVersion>70?true:false;AscCommon.addMouseEvent=function(elem,type,handler){var _type=(isUsePointerEvents? "onpointer":"onmouse")+type;elem[_type]=handler};AscCommon.removeMouseEvent=function(elem,type){var _type=(isUsePointerEvents?"onpointer":"onmouse")+type;if(elem[_type])delete elem[_type]};AscCommon.getMouseEvent=function(elem,type){var _type=(isUsePointerEvents?"onpointer":"onmouse")+type;return elem[_type]};function CMouseEventHandler(){this.X=0;this.Y=0;this.Button=g_mouse_button_left;this.Type=g_mouse_event_type_move;this.AltKey=false;this.CtrlKey=false;this.ShiftKey=false;this.Sender=null;this.LastClickTime= -1;this.ClickCount=0;this.WheelDelta=0;this.IsPressed=false;this.LastX=0;this.LastY=0;this.KoefPixToMM=1;this.IsLocked=false;this.IsLockedEvent=false;this.buttonObject=null;this.AscHitToHandlesEpsilon=0;this.LockMouse=function(){if(!this.IsLocked){this.IsLocked=true;if(window.captureEvents)window.captureEvents(Event.MOUSEDOWN|Event.MOUSEUP);if(window.g_asc_plugins)window.g_asc_plugins.disablePointerEvents();return true}return false};this.UnLockMouse=function(){if(this.IsLocked){this.IsLocked=false; if(window.releaseEvents)window.releaseEvents(Event.MOUSEMOVE);if(window.g_asc_plugins)window.g_asc_plugins.enablePointerEvents();return true}return false}}function CKeyboardEvent(){this.AltKey=false;this.CtrlKey=false;this.ShiftKey=false;this.MacCmdKey=false;this.AltGr=false;this.Sender=null;this.CharCode=0;this.KeyCode=0}CKeyboardEvent.prototype.Up=function(){this.AltKey=false;this.CtrlKey=false;this.ShiftKey=false;this.AltGr=false;this.MacCmdKey=false};CKeyboardEvent.prototype.IsCtrl=function(){return this.CtrlKey|| this.AltKey&&this.AltGr};CKeyboardEvent.prototype.IsShift=function(){return this.ShiftKey};CKeyboardEvent.prototype.IsAlt=function(){return this.AltKey};CKeyboardEvent.prototype.GetKeyCode=function(){return this.KeyCode};var global_mouseEvent=new CMouseEventHandler;var global_keyboardEvent=new CKeyboardEvent;function check_KeyboardEvent(e){global_keyboardEvent.AltKey=e.altKey;global_keyboardEvent.AltGr=AscCommon.getAltGr(e);global_keyboardEvent.CtrlKey=!global_keyboardEvent.AltGr&&(e.metaKey||e.ctrlKey); global_keyboardEvent.MacCmdKey=AscCommon.AscBrowser.isMacOs&&e.metaKey;global_keyboardEvent.ShiftKey=e.shiftKey;global_keyboardEvent.Sender=e.srcElement?e.srcElement:e.target;global_keyboardEvent.CharCode=e.charCode;global_keyboardEvent.KeyCode=e.keyCode;global_keyboardEvent.Which=e.which}function check_KeyboardEvent2(e){global_keyboardEvent.AltKey=e.altKey;if(e.metaKey!==undefined)global_keyboardEvent.CtrlKey=e.ctrlKey||e.metaKey;else global_keyboardEvent.CtrlKey=e.ctrlKey;global_keyboardEvent.MacCmdKey= AscCommon.AscBrowser.isMacOs&&e.metaKey;global_keyboardEvent.ShiftKey=e.shiftKey;global_keyboardEvent.AltGr=global_keyboardEvent.CtrlKey&&global_keyboardEvent.AltKey?true:false;if(global_keyboardEvent.CtrlKey&&global_keyboardEvent.AltKey)global_keyboardEvent.CtrlKey=false}function check_MouseMoveEvent(e){if(e.IsLocked&&!e.IsLockedEvent)return;if(e.pageX||e.pageY){global_mouseEvent.X=e.pageX;global_mouseEvent.Y=e.pageY}else if(e.clientX||e.clientY){global_mouseEvent.X=e.clientX;global_mouseEvent.Y= e.clientY}global_mouseEvent.X=global_mouseEvent.X*AscBrowser.zoom>>0;global_mouseEvent.Y=global_mouseEvent.Y*AscBrowser.zoom>>0;global_mouseEvent.AltKey=e.altKey;global_mouseEvent.ShiftKey=e.shiftKey;global_mouseEvent.CtrlKey=e.ctrlKey||e.metaKey;global_mouseEvent.Type=g_mouse_event_type_move;if(!global_mouseEvent.IsLocked)global_mouseEvent.Sender=e.srcElement?e.srcElement:e.target;var _eps=3*global_mouseEvent.KoefPixToMM;if(Math.abs(global_mouseEvent.X-global_mouseEvent.LastX)>_eps||Math.abs(global_mouseEvent.Y- global_mouseEvent.LastY)>_eps){global_mouseEvent.LastClickTime=-1;global_mouseEvent.ClickCount=0}}function CreateMouseUpEventObject(x,y){var e={};e.PageX=x;e.PageY=y;e.altKey=global_mouseEvent.AltKey;e.shiftKey=global_mouseEvent.ShiftKey;e.ctrlKey=global_mouseEvent.CtrlKey;e.srcElement=global_mouseEvent.Sender;e.button=0;return e}function getMouseButton(e){var res=e.button;return res&&-1!==res?res:0}function check_MouseUpEvent(e){if(e.pageX||e.pageY){global_mouseEvent.X=e.pageX;global_mouseEvent.Y= e.pageY}else if(e.clientX||e.clientY){global_mouseEvent.X=e.clientX;global_mouseEvent.Y=e.clientY}global_mouseEvent.X=global_mouseEvent.X*AscBrowser.zoom>>0;global_mouseEvent.Y=global_mouseEvent.Y*AscBrowser.zoom>>0;global_mouseEvent.AltKey=e.altKey;global_mouseEvent.ShiftKey=e.shiftKey;global_mouseEvent.CtrlKey=e.ctrlKey||e.metaKey;global_keyboardEvent.AltKey=global_mouseEvent.AltKey;global_keyboardEvent.ShiftKey=global_mouseEvent.ShiftKey;global_keyboardEvent.CtrlKey=global_mouseEvent.CtrlKey;global_mouseEvent.Type= g_mouse_event_type_up;global_mouseEvent.Button=getMouseButton(e);var lockedElement=null;var newSender=e.srcElement?e.srcElement:e.target;if(!newSender)newSender={id:"emulation_oo_id"};if(global_mouseEvent.Sender&&global_mouseEvent.Sender.id==newSender.id)lockedElement=global_mouseEvent.Sender;if(global_mouseEvent.IsLocked==true&&global_mouseEvent.Sender!=newSender&&false===MouseUpLock.MouseUpLockedSend)Window_OnMouseUp(e);MouseUpLock.MouseUpLockedSend=true;global_mouseEvent.Sender=newSender;global_mouseEvent.UnLockMouse(); global_mouseEvent.IsPressed=false;return lockedElement}function check_MouseClickOnUp(){if(0==global_mouseEvent.ClickCount)return false;var _eps=3*global_mouseEvent.KoefPixToMM;if(Math.abs(global_mouseEvent.X-global_mouseEvent.LastX)>_eps||Math.abs(global_mouseEvent.Y-global_mouseEvent.LastY)>_eps)return false;var CurTime=(new Date).getTime();if(500>0;global_mouseEvent.Y=global_mouseEvent.Y*AscBrowser.zoom>>0;var _eps=3*global_mouseEvent.KoefPixToMM;if(Math.abs(global_mouseEvent.X-global_mouseEvent.LastX)>_eps||Math.abs(global_mouseEvent.Y-global_mouseEvent.LastY)>_eps){global_mouseEvent.LastClickTime=-1;global_mouseEvent.ClickCount=0}global_mouseEvent.LastX=global_mouseEvent.X; global_mouseEvent.LastY=global_mouseEvent.Y;global_mouseEvent.AltKey=e.altKey;global_mouseEvent.ShiftKey=e.shiftKey;global_mouseEvent.CtrlKey=e.ctrlKey||e.metaKey;global_keyboardEvent.AltKey=global_mouseEvent.AltKey;global_keyboardEvent.ShiftKey=global_mouseEvent.ShiftKey;global_keyboardEvent.CtrlKey=global_mouseEvent.CtrlKey;global_mouseEvent.Type=g_mouse_event_type_down;global_mouseEvent.Button=getMouseButton(e);if(!global_mouseEvent.IsLocked||!global_mouseEvent.Sender)global_mouseEvent.Sender= e.srcElement?e.srcElement:e.target;if(isClicks){var CurTime=(new Date).getTime();if(0==global_mouseEvent.ClickCount){global_mouseEvent.ClickCount=1;global_mouseEvent.LastClickTime=CurTime}else if(500>CurTime-global_mouseEvent.LastClickTime){global_mouseEvent.LastClickTime=CurTime;global_mouseEvent.ClickCount++}else{global_mouseEvent.ClickCount=1;global_mouseEvent.LastClickTime=CurTime}}else{global_mouseEvent.LastClickTime=-1;global_mouseEvent.ClickCount=1}MouseUpLock.MouseUpLockedSend=false}function check_MouseDownEvent2(x, y){global_mouseEvent.X=x;global_mouseEvent.Y=y;global_mouseEvent.LastX=global_mouseEvent.X;global_mouseEvent.LastY=global_mouseEvent.Y;global_mouseEvent.Type=g_mouse_event_type_down;global_mouseEvent.Sender=editor.WordControl.m_oEditor.HtmlElement;global_mouseEvent.LastClickTime=-1;global_mouseEvent.ClickCount=1;MouseUpLock.MouseUpLockedSend=false}function global_OnMouseWheel(e){global_mouseEvent.AltKey=e.altKey;global_mouseEvent.ShiftKey=e.shiftKey;global_mouseEvent.CtrlKey=e.ctrlKey||e.metaKey; if(undefined!=e.wheelDelta)global_mouseEvent.WheelDelta=e.wheelDelta>0?-45:45;else global_mouseEvent.WheelDelta=e.detail>0?45:-45;global_mouseEvent.type=g_mouse_event_type_wheel;global_mouseEvent.Sender=e.srcElement?e.srcElement:e.target;global_mouseEvent.LastClickTime=-1;global_mouseEvent.ClickCount=0}function InitCaptureEvents(){AscCommon.addMouseEvent(window,"move",Window_OnMouseMove);AscCommon.addMouseEvent(window,"up",Window_OnMouseUp)}function Window_OnMouseMove(e){if(!global_mouseEvent.IsLocked|| !global_mouseEvent.Sender)return;var types=isUsePointerEvents?["onpointermove","onmousemove"]:["onmousemove","onpointermove"];for(var i=0;i<2;i++)if(global_mouseEvent.Sender[types[i]]){global_mouseEvent.IsLockedEvent=true;global_mouseEvent.Sender[types[i]](e);global_mouseEvent.IsLockedEvent=false;break}}function Window_OnMouseUp(e){if(false===MouseUpLock.MouseUpLockedSend){MouseUpLock.MouseUpLockedSend=true;if(global_mouseEvent.IsLocked&&global_mouseEvent.Sender){var types=isUsePointerEvents?["onpointerup", "onmouseup"]:["onmouseup","onpointerup"];for(var i=0;i<2;i++)if(global_mouseEvent.Sender[types[i]]){global_mouseEvent.Sender[types[i]](e,true);if(global_mouseEvent.IsLocked)global_mouseEvent.UnLockMouse();break}}}if(window.g_asc_plugins)window.g_asc_plugins.onExternalMouseUp()}InitCaptureEvents();function button_eventHandlers(disable_pos,norm_pos,over_pos,down_pos,control,click_func_delegate){this.state_normal=norm_pos;this.state_over=over_pos;this.state_down=down_pos;this.Click_func=click_func_delegate; this.Control=control;this.IsPressed=false;var oThis=this;this.Control.HtmlElement.onmouseover=function(e){check_MouseMoveEvent(e);if(global_mouseEvent.IsLocked){if(global_mouseEvent.Sender.id!=oThis.Control.HtmlElement.id)return;oThis.Control.HtmlElement.style.backgroundPosition=oThis.state_down;return}oThis.Control.HtmlElement.style.backgroundPosition=oThis.state_over};this.Control.HtmlElement.onmouseout=function(e){check_MouseMoveEvent(e);if(global_mouseEvent.IsLocked){if(global_mouseEvent.Sender.id!= oThis.Control.HtmlElement.id)return;oThis.Control.HtmlElement.style.backgroundPosition=oThis.state_over;return}oThis.Control.HtmlElement.style.backgroundPosition=oThis.state_normal};this.Control.HtmlElement.onmousedown=function(e){check_MouseDownEvent(e);global_mouseEvent.LockMouse();global_mouseEvent.buttonObject=oThis;AscCommon.stopEvent(e);if(global_mouseEvent.IsLocked){if(global_mouseEvent.Sender.id!=oThis.Control.HtmlElement.id)return;oThis.Control.HtmlElement.style.backgroundPosition=oThis.state_down; return}oThis.Control.HtmlElement.style.backgroundPosition=oThis.state_down};this.Control.HtmlElement.onmouseup=function(e){var lockedElement=check_MouseUpEvent(e);if(e.preventDefault)e.preventDefault();else e.returnValue=false;if(null!=lockedElement&&global_mouseEvent.buttonObject!=null)oThis.Click_func();if(null!=lockedElement)oThis.Control.HtmlElement.style.backgroundPosition=oThis.state_over;else{if(null!=global_mouseEvent.buttonObject)global_mouseEvent.buttonObject.Control.HtmlElement.style.backgroundPosition= global_mouseEvent.buttonObject.state_normal;if(global_mouseEvent.buttonObject==null||oThis.Control.HtmlElement.id!=global_mouseEvent.buttonObject.Control.HtmlElement.id)oThis.Control.HtmlElement.style.backgroundPosition=oThis.state_over}global_mouseEvent.buttonObject=null};this.Control.HtmlElement.ontouchstart=function(e){oThis.Control.HtmlElement.onmousedown(e.touches[0]);return false};this.Control.HtmlElement.ontouchend=function(e){var lockedElement=check_MouseUpEvent(e.changedTouches[0]);if(null!= lockedElement){oThis.Click_func();oThis.Control.HtmlElement.style.backgroundPosition=oThis.state_normal}else{if(null!=global_mouseEvent.buttonObject)global_mouseEvent.buttonObject.Control.HtmlElement.style.backgroundPosition=global_mouseEvent.buttonObject.state_normal;if(oThis.Control.HtmlElement.id!=global_mouseEvent.buttonObject.Control.HtmlElement.id)oThis.Control.HtmlElement.style.backgroundPosition=oThis.state_normal}global_mouseEvent.buttonObject=null;return false}}function emulateKeyDown(_code, _element){var oEvent=document.createEvent("KeyboardEvent");Object.defineProperty(oEvent,"keyCode",{get:function(){return this.keyCodeVal}});Object.defineProperty(oEvent,"which",{get:function(){return this.keyCodeVal}});Object.defineProperty(oEvent,"shiftKey",{get:function(){return false}});Object.defineProperty(oEvent,"altKey",{get:function(){return false}});Object.defineProperty(oEvent,"metaKey",{get:function(){return false}});Object.defineProperty(oEvent,"ctrlKey",{get:function(){return false}}); if(AscCommon.AscBrowser.isIE)oEvent.preventDefault=function(){Object.defineProperty(this,"defaultPrevented",{get:function(){return true}})};if(oEvent.initKeyboardEvent)oEvent.initKeyboardEvent("keydown",true,true,window,false,false,false,false,_code,_code);else oEvent.initKeyEvent("keydown",true,true,window,false,false,false,false,_code,0);oEvent.keyCodeVal=_code;_element.dispatchEvent(oEvent);return oEvent.defaultPrevented}window["AscCommon"]=window["AscCommon"]||{};window["AscCommon"].g_mouse_event_type_down= g_mouse_event_type_down;window["AscCommon"].g_mouse_event_type_move=g_mouse_event_type_move;window["AscCommon"].g_mouse_event_type_up=g_mouse_event_type_up;window["AscCommon"].g_mouse_button_left=g_mouse_button_left;window["AscCommon"].g_mouse_button_center=g_mouse_button_center;window["AscCommon"].g_mouse_button_right=g_mouse_button_right;window["AscCommon"].MouseUpLock=MouseUpLock;window["AscCommon"].CMouseEventHandler=CMouseEventHandler;window["AscCommon"].CKeyboardEvent=CKeyboardEvent;window["AscCommon"].global_mouseEvent= global_mouseEvent;window["AscCommon"].global_keyboardEvent=global_keyboardEvent;window["AscCommon"].check_KeyboardEvent=check_KeyboardEvent;window["AscCommon"].check_KeyboardEvent2=check_KeyboardEvent2;window["AscCommon"].check_MouseMoveEvent=check_MouseMoveEvent;window["AscCommon"].CreateMouseUpEventObject=CreateMouseUpEventObject;window["AscCommon"].getMouseButton=getMouseButton;window["AscCommon"].check_MouseUpEvent=check_MouseUpEvent;window["AscCommon"].check_MouseDownEvent=check_MouseDownEvent; window["AscCommon"].Window_OnMouseUp=Window_OnMouseUp;window["AscCommon"].button_eventHandlers=button_eventHandlers;window["AscCommon"].emulateKeyDown=emulateKeyDown;window["AscCommon"].check_MouseClickOnUp=check_MouseClickOnUp})(window);"use strict";(function(window,undefined){function CHistory(Document){this.Index=-1;this.SavedIndex=null;this.ForceSave=false;this.RecIndex=-1;this.Points=[];this.Document=Document;this.Api=null;this.CollaborativeEditing=null;this.CanNotAddChanges=false;this.CollectChanges= false;this.RecalculateData={Inline:{Pos:-1,PageNum:0},Flow:[],HdrFtr:[],Drawings:{All:false,Map:{},ThemeInfo:null},Tables:[],NumPr:[],NotesEnd:false,NotesEndPage:0,LineNumbers:false,Update:true};this.TurnOffHistory=0;this.MinorChanges=false;this.BinaryWriter=new AscCommon.CMemory;this.FileCheckSum=0;this.FileSize=0;this.UserSaveMode=false;this.UserSavedIndex=null;this.StoredData=[]}CHistory.prototype={Set_LogicDocument:function(LogicDocument){if(!LogicDocument)return;this.Document=LogicDocument;this.Api= LogicDocument.Get_Api();this.CollaborativeEditing=LogicDocument.Get_CollaborativeEditing()},Is_UserSaveMode:function(){return this.UserSaveMode},Update_FileDescription:function(oStream){var pData=oStream.data;var nSize=oStream.size;this.FileCheckSum=AscCommon.g_oCRC32.Calculate_ByByteArray(pData,nSize);this.FileSize=nSize},Update_PointInfoItem:function(PointIndex,StartPoint,LastPoint,SumIndex,DeletedIndex){var Point=this.Points[PointIndex];if(Point){var Class=AscCommon.g_oTableId;if(Point.Items.length> 0){var FirstItem=Point.Items[0];if(FirstItem.Class===Class&&AscDFH.historyitem_TableId_Description===FirstItem.Data.Type)Point.Items.splice(0,1)}var Data=new AscCommon.CChangesTableIdDescription(Class,this.FileCheckSum,this.FileSize,Point.Description,Point.Items.length,PointIndex,StartPoint,LastPoint,SumIndex,DeletedIndex);var Binary_Pos=this.BinaryWriter.GetCurPosition();this.BinaryWriter.WriteString2(Class.Get_Id());this.BinaryWriter.WriteLong(Data.Type);Data.WriteToBinary(this.BinaryWriter);var Binary_Len= this.BinaryWriter.GetCurPosition()-Binary_Pos;var Item={Class:Class,Data:Data,Binary:{Pos:Binary_Pos,Len:Binary_Len},NeedRecalc:false};Point.Items.splice(0,0,Item)}},Is_Clear:function(){if(this.Points.length<=0)return true;return false},Clear:function(){this.Index=-1;this.SavedIndex=null;this.ForceSave=false;this.UserSavedIndex=null;this.Points.length=0;this.TurnOffHistory=0;this.private_ClearRecalcData()},Can_Undo:function(){if(this.Index>=0)return true;return false},Can_Redo:function(){if(this.Points.length> 0&&this.Index_bottomIndex;i--){var oItem=aItems[i];oItem.Data.Undo()}oPoint.Items.length=_bottomIndex+1;this.Document.SetSelectionState(oPoint.State)}},Undo:function(Options){var arrChanges=[];this.CheckUnionLastPoints(); if(true!==this.Can_Undo())return null;if(this.Index===this.Points.length-1)this.LastState=this.Document.GetSelectionState();this.Document.RemoveSelection(true);var Point=null;if(undefined!==Options&&null!==Options&&true===Options.All)while(this.Index>=0){Point=this.Points[this.Index--];for(var Index=Point.Items.length-1;Index>=0;Index--){var Item=Point.Items[Index];if(Item.Data){Item.Data.Undo();arrChanges.push(Item.Data)}this.private_UpdateContentChangesOnUndo(Item)}}else{Point=this.Points[this.Index--]; for(var Index=Point.Items.length-1;Index>=0;Index--){var Item=Point.Items[Index];if(Item.Data){Item.Data.Undo();arrChanges.push(Item.Data)}this.private_UpdateContentChangesOnUndo(Item)}}if(null!=Point)this.Document.SetSelectionState(Point.State);if(!window["AscCommon"].g_specialPasteHelper.specialPasteStart)window["AscCommon"].g_specialPasteHelper.SpecialPasteButton_Hide(true);return arrChanges},Redo:function(){var arrChanges=[];if(true!==this.Can_Redo())return null;this.Document.RemoveSelection(true); var Point=this.Points[++this.Index];for(var Index=0;Index-1){this.CollectChanges=false; this.Index--;this.Points.length=this.Index+1}},Is_LastPointEmpty:function(){if(!this.Points[this.Index]||this.Points[this.Index].Items.length<=0)return true;return false},Is_LastPointNeedRecalc:function(){if(!this.Points[this.Index])return false;var RecalcData=this.Get_RecalcData();if(RecalcData.Flow.length>0||RecalcData.HdrFtr.length>0||-1!==RecalcData.Inline.Pos||true===RecalcData.Drawings.All)return true;for(var Key in RecalcData.Drawings.Map)if(null!=AscCommon.g_oTableId.Get_ById(Key))return true; return false},Clear_Redo:function(){this.Points.length=this.Index+1},Add:function(_Class,Data){if(!this.CanAddChanges())return;this._CheckCanNotAddChanges();if(this.RecIndex>=this.Index)this.RecIndex=this.Index-1;var Binary_Pos=this.BinaryWriter.GetCurPosition();var Class;if(_Class){Class=_Class.GetClass();Data=_Class;this.BinaryWriter.WriteString2(Class.Get_Id());this.BinaryWriter.WriteLong(_Class.Type);_Class.WriteToBinary(this.BinaryWriter)}if(Class&&Class.SetIsRecalculated&&(!_Class||_Class.IsNeedRecalculate()))Class.SetIsRecalculated(false); var Binary_Len=this.BinaryWriter.GetCurPosition()-Binary_Pos;var Item={Class:Class,Data:Data,Binary:{Pos:Binary_Pos,Len:Binary_Len},NeedRecalc:!this.MinorChanges&&(!_Class||_Class.IsNeedRecalculate()||_Class.IsNeedRecalculateLineNumbers())};this.Points[this.Index].Items.push(Item);if(!this.CollaborativeEditing)return;if(_Class){if(_Class.IsContentChange()){var bAdd=_Class.IsAdd();var Count=_Class.GetItemsCount();var ContentChanges=new AscCommon.CContentChangesElement(bAdd==true?AscCommon.contentchanges_Add: AscCommon.contentchanges_Remove,Data.Pos,Count,Item);Class.Add_ContentChanges(ContentChanges);this.CollaborativeEditing.Add_NewDC(Class);if(true===bAdd)this.CollaborativeEditing.Update_DocumentPositionsOnAdd(Class,Data.Pos);else this.CollaborativeEditing.Update_DocumentPositionsOnRemove(Class,Data.Pos,Count)}if(_Class.IsPosExtChange())this.CollaborativeEditing.AddPosExtChanges(Item,_Class)}},RecalcData_Add:function(Data){if(true!==this.RecalculateData.Update)return;if("undefined"===typeof Data||null=== Data)return;switch(Data.Type){case AscDFH.historyitem_recalctype_Flow:{var bNew=true;for(var Index=0;Index=this.Points.length-2||true===this.Is_UserSaveMode()&&null!==this.UserSavedIndex&&this.UserSavedIndex>=this.Points.length-2)return false;var Point1=this.Points[this.Points.length-2];var Point2=this.Points[this.Points.length-1];if(Point1.Items.length>63&&AscDFH.historydescription_Document_AddLetterUnion===Point1.Description)return false;var StartIndex1=0;var StartIndex2=0;if(Point1.Items.length> 0&&Point1.Items[0].Data&&AscDFH.historyitem_TableId_Description===Point1.Items[0].Data.Type)StartIndex1=1;if(Point2.Items.length>0&&Point2.Items[0].Data&&AscDFH.historyitem_TableId_Description===Point2.Items[0].Data.Type)StartIndex2=1;var NewDescription;if((AscDFH.historydescription_Document_CompositeInput===Point1.Description||AscDFH.historydescription_Document_CompositeInputReplace===Point1.Description)&&AscDFH.historydescription_Document_CompositeInputReplace===Point2.Description)NewDescription= AscDFH.historydescription_Document_CompositeInput;else{var PrevItem=null;var Class=null;for(var Index=StartIndex1;Index=this.Points.length-2)this.Set_SavedIndex(this.Points.length-3);this.Points.splice(this.Points.length- 2,2,NewPoint);if(this.Index>=this.Points.length){var DiffIndex=-this.Index+(this.Points.length-1);this.Index+=DiffIndex;this.RecIndex=Math.max(-1,this.RecIndex+DiffIndex)}return true},CanRemoveLastPoint:function(){if(this.Points.length<=0||true!==this.Is_UserSaveMode()&&null!==this.SavedIndex&&this.SavedIndex>=this.Points.length-1||true===this.Is_UserSaveMode()&&null!==this.UserSavedIndex&&this.UserSavedIndex>=this.Points.length-1)return false;return true},TurnOff:function(){this.TurnOffHistory++}, TurnOn:function(){this.TurnOffHistory--;if(this.TurnOffHistory<0)this.TurnOffHistory=0},Is_On:function(){return 0===this.TurnOffHistory},IsOn:function(){return 0===this.TurnOffHistory},Reset_SavedIndex:function(IsUserSave){this.SavedIndex=null===this.SavedIndex&&-1===this.Index?null:this.Index;if(true===this.Is_UserSaveMode()){if(true===IsUserSave){this.UserSavedIndex=this.Index;this.ForceSave=false}}else this.ForceSave=false},Set_SavedIndex:function(Index){this.SavedIndex=Index;if(true===this.Is_UserSaveMode()){if(null!== this.UserSavedIndex&&this.UserSavedIndex>this.SavedIndex){this.UserSavedIndex=Index;this.ForceSave=true}}else this.ForceSave=true},Have_Changes:function(IsNotUserSave){if(!this.Document||this.Document.IsViewModeInReview())return false;var checkIndex=this.Is_UserSaveMode()&&!IsNotUserSave?this.UserSavedIndex:this.SavedIndex;if(-1===this.Index&&null===checkIndex&&false===this.ForceSave)return false;if(this.Index!=checkIndex||true===this.ForceSave)return true;return false},Get_RecalcData:function(oRecalcData, arrChanges,nChangeStart,nChangeEnd){if(oRecalcData)this.RecalculateData=oRecalcData;else if(arrChanges){this.private_ClearRecalcData();var nStart=undefined!==nChangeStart?nChangeStart:0;var nEnd=undefined!==nChangeEnd?nChangeEnd:arrChanges.length-1;for(var nIndex=nStart;nIndex<=nEnd;++nIndex){var oChange=arrChanges[nIndex];oChange.RefreshRecalcData()}this.private_PostProcessingRecalcData()}else if(this.Index>=0){this.private_ClearRecalcData();for(var Pos=this.RecIndex+1;Pos<=this.Index;Pos++){var Point= this.Points[Pos];for(var Index=0;Index=0)this.Points[this.Index].Additional.ExtendDocumentToPos=true},Is_ExtendDocumentToPos:function(){if(undefined===this.Points[this.Index]|| undefined===this.Points[this.Index].Additional||undefined===this.Points[this.Index].Additional.ExtendDocumentToPos)return false;return true},Get_EditingTime:function(dTime){var Count=this.Points.length;var TimeLine=[];for(var Index=0;Index=0};CHistory.prototype.ClearAdditional=function(){if(this.Index>=0)this.Points[this.Index].Additional={};if(this.Api&&true=== this.Api.isMarkerFormat)this.Api.sync_MarkerFormatCallback(false);if(this.Api&&true===this.Api.isDrawTablePen)this.Api.sync_TableDrawModeCallback(false);if(this.Api&&true===this.Api.isDrawTableErase)this.Api.sync_TableEraseModeCallback(false)};CHistory.prototype.private_UpdateContentChangesOnUndo=function(Item){if(this.private_IsContentChange(Item.Class,Item.Data))Item.Class.m_oContentChanges.RemoveByHistoryItem(Item)};CHistory.prototype.private_UpdateContentChangesOnRedo=function(Item){if(this.private_IsContentChange(Item.Class, Item.Data)){var bAdd=this.private_IsAddContentChange(Item.Class,Item.Data);var Count=this.private_GetItemsCountInContentChange(Item.Class,Item.Data);var ContentChanges=new AscCommon.CContentChangesElement(bAdd==true?AscCommon.contentchanges_Add:AscCommon.contentchanges_Remove,Item.Data.Pos,Count,Item);Item.Class.Add_ContentChanges(ContentChanges);this.CollaborativeEditing.Add_NewDC(Item.Class)}};CHistory.prototype.private_IsContentChange=function(Class,Data){var bPresentation=!(typeof CPresentation=== "undefined");var bSlide=!(typeof Slide==="undefined");if(Class instanceof CDocument&&(AscDFH.historyitem_Document_AddItem===Data.Type||AscDFH.historyitem_Document_RemoveItem===Data.Type)||(Class instanceof CDocumentContent||Class instanceof AscFormat.CDrawingDocContent)&&(AscDFH.historyitem_DocumentContent_AddItem===Data.Type||AscDFH.historyitem_DocumentContent_RemoveItem===Data.Type)||Class instanceof CTable&&(AscDFH.historyitem_Table_AddRow===Data.Type||AscDFH.historyitem_Table_RemoveRow===Data.Type)|| Class instanceof CTableRow&&(AscDFH.historyitem_TableRow_AddCell===Data.Type||AscDFH.historyitem_TableRow_RemoveCell===Data.Type)||Class instanceof Paragraph&&(AscDFH.historyitem_Paragraph_AddItem===Data.Type||AscDFH.historyitem_Paragraph_RemoveItem===Data.Type)||Class instanceof ParaHyperlink&&(AscDFH.historyitem_Hyperlink_AddItem===Data.Type||AscDFH.historyitem_Hyperlink_RemoveItem===Data.Type)||Class instanceof ParaRun&&(AscDFH.historyitem_ParaRun_AddItem===Data.Type||AscDFH.historyitem_ParaRun_RemoveItem=== Data.Type)||bPresentation&&Class instanceof CPresentation&&(AscDFH.historyitem_Presentation_AddSlide===Data.Type||AscDFH.historyitem_Presentation_RemoveSlide===Data.Type)||bSlide&&Class instanceof Slide&&(AscDFH.historyitem_SlideAddToSpTree===Data.Type||AscDFH.historyitem_SlideRemoveFromSpTree===Data.Type))return true;return false};CHistory.prototype.private_IsAddContentChange=function(Class,Data){var bPresentation=!(typeof CPresentation==="undefined");var bSlide=!(typeof Slide==="undefined");return Class instanceof CDocument&&AscDFH.historyitem_Document_AddItem===Data.Type||(Class instanceof CDocumentContent||Class instanceof AscFormat.CDrawingDocContent)&&AscDFH.historyitem_DocumentContent_AddItem===Data.Type||Class instanceof CTable&&AscDFH.historyitem_Table_AddRow===Data.Type||Class instanceof CTableRow&&AscDFH.historyitem_TableRow_AddCell===Data.Type||Class instanceof Paragraph&&AscDFH.historyitem_Paragraph_AddItem===Data.Type||Class instanceof ParaHyperlink&&AscDFH.historyitem_Hyperlink_AddItem===Data.Type|| Class instanceof ParaRun&&AscDFH.historyitem_ParaRun_AddItem===Data.Type||bPresentation&&Class instanceof CPresentation&&AscDFH.historyitem_Presentation_AddSlide===Data.Type||bSlide&&Class instanceof Slide&&AscDFH.historyitem_SlideAddToSpTree===Data.Type?true:false};CHistory.prototype.private_GetItemsCountInContentChange=function(Class,Data){if(Class instanceof Paragraph||Class instanceof ParaHyperlink||Class instanceof ParaRun||Class instanceof CDocument&&AscDFH.historyitem_Document_RemoveItem=== Data.Type||(Class instanceof CDocumentContent||Class instanceof AscFormat.CDrawingDocContent)&&AscDFH.historyitem_DocumentContent_RemoveItem===Data.Type)return Data.Items.length;return 1};CHistory.prototype.GetAllParagraphsForRecalcData=function(Props){if(!this.RecalculateData.AllParagraphs)if(this.Document)this.RecalculateData.AllParagraphs=this.Document.GetAllParagraphs({All:true});else this.RecalculateData.AllParagraphs=[];var arrParagraphs=[];if(!Props||true===Props.All)return this.RecalculateData.AllParagraphs; else if(true===Props.Style){var arrStylesId=Props.StylesId;for(var nParaIndex=0,nParasCount=this.RecalculateData.AllParagraphs.length;nParaIndex0&&this.Points.length>0){nDeleteIndex-=this.Points[0].Items.length; this.Points.splice(0,1);if(this.Index>=0)this.Index--;if(this.RecIndex>=0)this.RecIndex--}this.SavedIndex=null};CHistory.prototype.GetNonRecalculatedChanges=function(){var arrChanges=[];if(this.Index-this.RecIndex!==1&&this.RecIndex>=-1)for(var nPointIndex=this.RecIndex+1;nPointIndex<=this.Index;++nPointIndex)this.GetChangesFromPoint(nPointIndex,arrChanges);else if(this.Index>=0)this.GetChangesFromPoint(this.Index,arrChanges);return arrChanges};CHistory.prototype.GetChangesFromPoint=function(nPointIndex, arrChanges){if(!arrChanges)arrChanges=[];var oHPoint=this.Points[nPointIndex];if(oHPoint)for(var nIndex=0,nItemsCount=oHPoint.Items.length;nIndex0){var oChange=oPoint.Items[nItemsCount-1].Data;if(!oChange||!oChange.IsContentChange())return false;var nChangeItemsCount=oChange.GetItemsCount();return nChangeItemsCount>0&&AscDFH.historyitem_ParaRun_AddItem===oChange.GetType()&&oChange.GetItem(nChangeItemsCount-1)===oLastElement}return false};window["AscCommon"]=window["AscCommon"]||{};window["AscCommon"].CHistory=CHistory;window["AscCommon"].History=new CHistory})(window);"use strict";(function(window,undefined){var CAscColorScheme= AscCommon.CAscColorScheme;var CColor=AscCommon.CColor;var g_oAutoShapesGroups=["Basic shapes","Figured arrows","Math","Charts","Stars & Ribbons","Callouts","Buttons","Rectangles","Lines"];var autoShapes=[["textRect","rect","ellipse","triangle","rtTriangle","parallelogram","trapezoid","diamond","pentagon","hexagon","heptagon","octagon","decagon","dodecagon","pie","chord","teardrop","frame","halfFrame","corner","diagStripe","plus","plaque","can","cube","bevel","donut","noSmoking","blockArc","foldedCorner", "smileyFace","heart","lightningBolt","sun","moon","cloud","arc","bracePair","leftBracket","rightBracket","leftBrace","rightBrace"],["rightArrow","leftArrow","upArrow","downArrow","leftRightArrow","upDownArrow","quadArrow","leftRightUpArrow","bentArrow","uturnArrow","leftUpArrow","bentUpArrow","curvedRightArrow","curvedLeftArrow","curvedUpArrow","curvedDownArrow","stripedRightArrow","notchedRightArrow","homePlate","chevron","rightArrowCallout","downArrowCallout","leftArrowCallout","upArrowCallout", "leftRightArrowCallout","quadArrowCallout","circularArrow"],["mathPlus","mathMinus","mathMultiply","mathDivide","mathEqual","mathNotEqual"],["flowChartProcess","flowChartAlternateProcess","flowChartDecision","flowChartInputOutput","flowChartPredefinedProcess","flowChartInternalStorage","flowChartDocument","flowChartMultidocument","flowChartTerminator","flowChartPreparation","flowChartManualInput","flowChartManualOperation","flowChartConnector","flowChartOffpageConnector","flowChartPunchedCard","flowChartPunchedTape", "flowChartSummingJunction","flowChartOr","flowChartCollate","flowChartSort","flowChartExtract","flowChartMerge","flowChartOnlineStorage","flowChartDelay","flowChartMagneticTape","flowChartMagneticDisk","flowChartMagneticDrum","flowChartDisplay"],["irregularSeal1","irregularSeal2","star4","star5","star6","star7","star8","star10","star12","star16","star24","star32","ribbon2","ribbon","ellipseRibbon2","ellipseRibbon","verticalScroll","horizontalScroll","wave","doubleWave"],["wedgeRectCallout","wedgeRoundRectCallout", "wedgeEllipseCallout","cloudCallout","borderCallout1","borderCallout2","borderCallout3","accentCallout1","accentCallout2","accentCallout3","callout1","callout2","callout3","accentBorderCallout1","accentBorderCallout2","accentBorderCallout3"],["actionButtonBackPrevious","actionButtonForwardNext","actionButtonBeginning","actionButtonEnd","actionButtonHome","actionButtonInformation","actionButtonReturn","actionButtonMovie","actionButtonDocument","actionButtonSound","actionButtonHelp","actionButtonBlank"], ["rect","roundRect","snip1Rect","snip2SameRect","snip2DiagRect","snipRoundRect","round1Rect","round2SameRect","round2DiagRect"],["line","lineWithArrow","lineWithTwoArrows","bentConnector5","bentConnector5WithArrow","bentConnector5WithTwoArrows","curvedConnector3","curvedConnector3WithArrow","curvedConnector3WithTwoArrows","spline","polyline1","polyline2"]];var g_oAutoShapesTypes=[];for(var i=0,length=autoShapes.length;i=.8)return 1;if(L>=.2)return 2;if(L>0)return 3;return 4}function GetDefaultMods(r,g,b,pos,editor_id){if(pos<1||pos>5)return[];var index=GetDefaultColorModsIndex(r,g,b);var _obj,_mods=[],_mod;if(editor_id==0){_obj=g_oThemeColorsDefaultModsPowerPoint[index][pos-1];if(_obj.lumMod!== -1){_mod=new AscFormat.CColorMod;_mod["name"]="lumMod";_mod["val"]=_obj.lumMod;_mods.push(_mod)}if(_obj.lumOff!==-1){_mod=new AscFormat.CColorMod;_mod.name="lumOff";_mod.val=_obj.lumOff;_mods.push(_mod)}return _mods}if(editor_id==1){_obj=g_oThemeColorsDefaultModsWord[index][pos-1];_mod=new AscFormat.CColorMod;_mod.name=_obj.name;_mod.val=_obj.val;_mods.push(_mod);return _mods}return[]}var g_oUserColorScheme=[];var elem;elem=new CAscColorScheme;elem.name="New Office";elem.putColor(new CColor(0,0,0)); elem.putColor(new CColor(255,255,255));elem.putColor(new CColor(68,84,106));elem.putColor(new CColor(231,230,230));elem.putColor(new CColor(91,155,213));elem.putColor(new CColor(237,125,49));elem.putColor(new CColor(165,165,165));elem.putColor(new CColor(255,192,0));elem.putColor(new CColor(68,114,196));elem.putColor(new CColor(112,173,71));elem.putColor(new CColor(5,99,193));elem.putColor(new CColor(149,79,114));g_oUserColorScheme.push(elem);elem=new CAscColorScheme;elem.name="Office";elem.putColor(new CColor(0, 0,0));elem.putColor(new CColor(255,255,255));elem.putColor(new CColor(31,73,125));elem.putColor(new CColor(238,236,225));elem.putColor(new CColor(79,129,189));elem.putColor(new CColor(192,80,77));elem.putColor(new CColor(155,187,89));elem.putColor(new CColor(128,100,162));elem.putColor(new CColor(75,172,198));elem.putColor(new CColor(247,150,70));elem.putColor(new CColor(0,0,255));elem.putColor(new CColor(128,0,128));g_oUserColorScheme.push(elem);elem=new CAscColorScheme;elem.name="Grayscale";elem.putColor(new CColor(0, 0,0));elem.putColor(new CColor(255,255,255));elem.putColor(new CColor(0,0,0));elem.putColor(new CColor(248,248,248));elem.putColor(new CColor(221,221,221));elem.putColor(new CColor(178,178,178));elem.putColor(new CColor(150,150,150));elem.putColor(new CColor(128,128,128));elem.putColor(new CColor(95,95,95));elem.putColor(new CColor(77,77,77));elem.putColor(new CColor(95,95,95));elem.putColor(new CColor(145,145,145));g_oUserColorScheme.push(elem);elem=new CAscColorScheme;elem.name="Apex";elem.putColor(new CColor(0, 0,0));elem.putColor(new CColor(255,255,255));elem.putColor(new CColor(105,103,109));elem.putColor(new CColor(201,194,209));elem.putColor(new CColor(206,185,102));elem.putColor(new CColor(156,176,132));elem.putColor(new CColor(107,177,201));elem.putColor(new CColor(101,133,207));elem.putColor(new CColor(126,107,201));elem.putColor(new CColor(163,121,187));elem.putColor(new CColor(65,0,130));elem.putColor(new CColor(147,41,104));g_oUserColorScheme.push(elem);elem=new CAscColorScheme;elem.name="Aspect"; elem.putColor(new CColor(0,0,0));elem.putColor(new CColor(255,255,255));elem.putColor(new CColor(50,50,50));elem.putColor(new CColor(227,222,209));elem.putColor(new CColor(240,127,9));elem.putColor(new CColor(159,41,54));elem.putColor(new CColor(27,88,124));elem.putColor(new CColor(78,133,66));elem.putColor(new CColor(96,72,120));elem.putColor(new CColor(193,152,89));elem.putColor(new CColor(107,159,37));elem.putColor(new CColor(178,107,2));g_oUserColorScheme.push(elem);elem=new CAscColorScheme;elem.name= "Civic";elem.putColor(new CColor(0,0,0));elem.putColor(new CColor(255,255,255));elem.putColor(new CColor(100,107,134));elem.putColor(new CColor(197,209,215));elem.putColor(new CColor(209,99,73));elem.putColor(new CColor(204,180,0));elem.putColor(new CColor(140,173,174));elem.putColor(new CColor(140,123,112));elem.putColor(new CColor(143,176,140));elem.putColor(new CColor(209,144,73));elem.putColor(new CColor(0,163,214));elem.putColor(new CColor(105,79,7));g_oUserColorScheme.push(elem);elem=new CAscColorScheme; elem.name="Concourse";elem.putColor(new CColor(0,0,0));elem.putColor(new CColor(255,255,255));elem.putColor(new CColor(70,70,70));elem.putColor(new CColor(222,245,250));elem.putColor(new CColor(45,162,191));elem.putColor(new CColor(218,31,40));elem.putColor(new CColor(235,100,27));elem.putColor(new CColor(57,99,157));elem.putColor(new CColor(71,75,120));elem.putColor(new CColor(125,60,74));elem.putColor(new CColor(255,129,25));elem.putColor(new CColor(68,185,232));g_oUserColorScheme.push(elem);elem= new CAscColorScheme;elem.name="Equity";elem.putColor(new CColor(0,0,0));elem.putColor(new CColor(255,255,255));elem.putColor(new CColor(105,100,100));elem.putColor(new CColor(233,229,220));elem.putColor(new CColor(211,72,23));elem.putColor(new CColor(155,45,31));elem.putColor(new CColor(162,142,106));elem.putColor(new CColor(149,98,81));elem.putColor(new CColor(145,132,133));elem.putColor(new CColor(133,93,93));elem.putColor(new CColor(204,153,0));elem.putColor(new CColor(150,169,169));g_oUserColorScheme.push(elem); elem=new CAscColorScheme;elem.name="Flow";elem.putColor(new CColor(0,0,0));elem.putColor(new CColor(255,255,255));elem.putColor(new CColor(4,97,123));elem.putColor(new CColor(219,245,249));elem.putColor(new CColor(15,111,198));elem.putColor(new CColor(0,157,217));elem.putColor(new CColor(11,208,217));elem.putColor(new CColor(16,207,155));elem.putColor(new CColor(124,202,98));elem.putColor(new CColor(165,194,73));elem.putColor(new CColor(244,145,0));elem.putColor(new CColor(133,223,208));g_oUserColorScheme.push(elem); elem=new CAscColorScheme;elem.name="Foundry";elem.putColor(new CColor(0,0,0));elem.putColor(new CColor(255,255,255));elem.putColor(new CColor(103,106,85));elem.putColor(new CColor(234,235,222));elem.putColor(new CColor(114,163,118));elem.putColor(new CColor(176,204,176));elem.putColor(new CColor(168,205,215));elem.putColor(new CColor(192,190,175));elem.putColor(new CColor(206,197,151));elem.putColor(new CColor(232,183,183));elem.putColor(new CColor(219,83,83));elem.putColor(new CColor(144,54,56)); g_oUserColorScheme.push(elem);elem=new CAscColorScheme;elem.name="Median";elem.putColor(new CColor(0,0,0));elem.putColor(new CColor(255,255,255));elem.putColor(new CColor(119,95,85));elem.putColor(new CColor(235,221,195));elem.putColor(new CColor(148,182,210));elem.putColor(new CColor(221,128,71));elem.putColor(new CColor(165,171,129));elem.putColor(new CColor(216,178,92));elem.putColor(new CColor(123,167,157));elem.putColor(new CColor(150,140,140));elem.putColor(new CColor(247,182,21));elem.putColor(new CColor(112, 68,4));g_oUserColorScheme.push(elem);elem=new CAscColorScheme;elem.name="Metro";elem.putColor(new CColor(0,0,0));elem.putColor(new CColor(255,255,255));elem.putColor(new CColor(78,91,111));elem.putColor(new CColor(214,236,255));elem.putColor(new CColor(127,209,59));elem.putColor(new CColor(234,21,122));elem.putColor(new CColor(254,184,10));elem.putColor(new CColor(0,173,220));elem.putColor(new CColor(115,138,200));elem.putColor(new CColor(26,179,159));elem.putColor(new CColor(235,136,3));elem.putColor(new CColor(95, 119,145));g_oUserColorScheme.push(elem);elem=new CAscColorScheme;elem.name="Module";elem.putColor(new CColor(0,0,0));elem.putColor(new CColor(255,255,255));elem.putColor(new CColor(90,99,120));elem.putColor(new CColor(212,212,214));elem.putColor(new CColor(240,173,0));elem.putColor(new CColor(96,181,204));elem.putColor(new CColor(230,108,125));elem.putColor(new CColor(107,183,109));elem.putColor(new CColor(232,134,81));elem.putColor(new CColor(198,72,71));elem.putColor(new CColor(22,139,186));elem.putColor(new CColor(104, 0,0));g_oUserColorScheme.push(elem);elem=new CAscColorScheme;elem.name="Opulent";elem.putColor(new CColor(0,0,0));elem.putColor(new CColor(255,255,255));elem.putColor(new CColor(177,63,154));elem.putColor(new CColor(244,231,237));elem.putColor(new CColor(184,61,104));elem.putColor(new CColor(172,102,187));elem.putColor(new CColor(222,108,54));elem.putColor(new CColor(249,182,57));elem.putColor(new CColor(207,109,164));elem.putColor(new CColor(250,141,61));elem.putColor(new CColor(255,222,102));elem.putColor(new CColor(212, 144,197));g_oUserColorScheme.push(elem);elem=new CAscColorScheme;elem.name="Oriel";elem.putColor(new CColor(0,0,0));elem.putColor(new CColor(255,255,255));elem.putColor(new CColor(87,95,109));elem.putColor(new CColor(255,243,157));elem.putColor(new CColor(254,134,55));elem.putColor(new CColor(117,152,217));elem.putColor(new CColor(179,44,22));elem.putColor(new CColor(245,205,45));elem.putColor(new CColor(174,186,213));elem.putColor(new CColor(119,124,132));elem.putColor(new CColor(210,97,28));elem.putColor(new CColor(59, 67,91));g_oUserColorScheme.push(elem);elem=new CAscColorScheme;elem.name="Origin";elem.putColor(new CColor(0,0,0));elem.putColor(new CColor(255,255,255));elem.putColor(new CColor(70,70,83));elem.putColor(new CColor(221,233,236));elem.putColor(new CColor(114,124,163));elem.putColor(new CColor(159,184,205));elem.putColor(new CColor(210,218,122));elem.putColor(new CColor(250,218,122));elem.putColor(new CColor(184,132,114));elem.putColor(new CColor(142,115,106));elem.putColor(new CColor(178,146,202)); elem.putColor(new CColor(107,86,128));g_oUserColorScheme.push(elem);elem=new CAscColorScheme;elem.name="Paper";elem.putColor(new CColor(0,0,0));elem.putColor(new CColor(255,255,255));elem.putColor(new CColor(68,77,38));elem.putColor(new CColor(254,250,201));elem.putColor(new CColor(165,181,146));elem.putColor(new CColor(243,164,71));elem.putColor(new CColor(231,188,41));elem.putColor(new CColor(208,146,167));elem.putColor(new CColor(156,133,192));elem.putColor(new CColor(128,158,194));elem.putColor(new CColor(142, 88,182));elem.putColor(new CColor(127,111,111));g_oUserColorScheme.push(elem);elem=new CAscColorScheme;elem.name="Solstice";elem.putColor(new CColor(0,0,0));elem.putColor(new CColor(255,255,255));elem.putColor(new CColor(79,39,28));elem.putColor(new CColor(231,222,201));elem.putColor(new CColor(56,145,167));elem.putColor(new CColor(254,184,10));elem.putColor(new CColor(195,45,46));elem.putColor(new CColor(132,170,51));elem.putColor(new CColor(150,67,5));elem.putColor(new CColor(71,90,141));elem.putColor(new CColor(141, 199,101));elem.putColor(new CColor(170,138,20));g_oUserColorScheme.push(elem);elem=new CAscColorScheme;elem.name="Technic";elem.putColor(new CColor(0,0,0));elem.putColor(new CColor(255,255,255));elem.putColor(new CColor(59,59,59));elem.putColor(new CColor(212,210,208));elem.putColor(new CColor(110,160,176));elem.putColor(new CColor(204,175,10));elem.putColor(new CColor(141,137,164));elem.putColor(new CColor(116,133,96));elem.putColor(new CColor(158,146,115));elem.putColor(new CColor(126,132,141)); elem.putColor(new CColor(0,200,195));elem.putColor(new CColor(161,22,224));g_oUserColorScheme.push(elem);elem=new CAscColorScheme;elem.name="Trek";elem.putColor(new CColor(0,0,0));elem.putColor(new CColor(255,255,255));elem.putColor(new CColor(78,59,48));elem.putColor(new CColor(251,238,201));elem.putColor(new CColor(240,162,46));elem.putColor(new CColor(165,100,78));elem.putColor(new CColor(181,139,128));elem.putColor(new CColor(195,152,109));elem.putColor(new CColor(161,149,116));elem.putColor(new CColor(193, 117,41));elem.putColor(new CColor(173,31,31));elem.putColor(new CColor(255,196,47));g_oUserColorScheme.push(elem);elem=new CAscColorScheme;elem.name="Urban";elem.putColor(new CColor(0,0,0));elem.putColor(new CColor(255,255,255));elem.putColor(new CColor(66,68,86));elem.putColor(new CColor(222,222,222));elem.putColor(new CColor(83,84,138));elem.putColor(new CColor(67,128,134));elem.putColor(new CColor(160,77,163));elem.putColor(new CColor(196,101,45));elem.putColor(new CColor(139,93,61));elem.putColor(new CColor(92, 146,181));elem.putColor(new CColor(103,175,189));elem.putColor(new CColor(194,168,116));g_oUserColorScheme.push(elem);elem=new CAscColorScheme;elem.name="Verve";elem.putColor(new CColor(0,0,0));elem.putColor(new CColor(255,255,255));elem.putColor(new CColor(102,102,102));elem.putColor(new CColor(210,210,210));elem.putColor(new CColor(255,56,140));elem.putColor(new CColor(228,0,89));elem.putColor(new CColor(156,0,127));elem.putColor(new CColor(104,0,127));elem.putColor(new CColor(0,91,211));elem.putColor(new CColor(0, 52,158));elem.putColor(new CColor(23,187,253));elem.putColor(new CColor(255,121,194));g_oUserColorScheme.push(elem);var g_oUserTexturePresets=["data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADIAAAAyCAIAAACRXR/mAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAEENJREFUeNp0Wcl25DByxA5wK0nd47F98f9/hi8++OifmIM93VKVaiGxOgIoadoH82lBgSCYQEZGRqLk/uvfvQ4iikep/sdJarX//j0pLbY13W41F+eMdO7+8TtYp5QSfmr7fuQkhfavL/HzJqR06yp0e/x6d8ZqH+r9nlr16yK0bOdzdtacXjDV8X7xrejFFlFSVGFd4/UmRBWtOW9FqTklaRb9tpnjOKzV+/X4TPnn6ypEu91u2lh32h6Px/HYt20JWu/7no8Is1ZlMCAWvCv4BMu7Wd6XlDE+ymOO7KxKYoXC6vv5rLd1WtZWK95VcnTSZtXiIa21GFlKMlpbu+UYL5eLm+S6TUYITCu//46L7dZGu6HxZ/ur8Wc/Lt0vo/pfY4pkD36/B7c/Bo9XjOvPj2MeiZ9y+Q9lJpFkyQW7J6Qq53fMLKYg9r3lIrUU3ufLB3aQdkwL+ktOoin9+tKud04JJ4ocf384jPFB3O+lVb3MQglxvQpnxbqJ2vLHp2lFzEa0XLNR2yY+r8OJIjiRi0ipNqdeV5NzRocoqpSichZKokcLKXIuGQ8X3SS2AHeNwrsqbuMWLm5Hb8Asi78t8UGMNcBIzjALf5SQBdNIzNx6t4EReFvLOTVgANcwy2LxGf5MuUmHYfCuCeq4xktMb4tvUsDBr0Cgo+PjfoTgFiHQPuQDjnhR5vPzE5AHtlzwGAyzfhjTdAN0sIy5APF3mKmMbkbd39/lMnvnsVsAX8rRFhM75HGdz+eBrVd1SvuB2ab1pxPCeO8VfpP0UjnnGj0Gmzz+hRCwWnySgZeRqtbK294LrZx9jqETQ5A1AlIG6OI/QLbhb9V8dAzDblXMhfseO1O00jaEaZqwxTBLh4CdjpGTAFvswbxqmhbr+FYl+VZAJCVYCQg/N5mXa/SycjACfoaHFFeEx/ljDEYErGeag4CbKmgF/KCXpRjNmRsNhVnCw88R6xLWwiwhPLHVZzidTkVgswQ8cvEn/bjs5yP988u/AVTn8/vJ2PCv//Lx8ft+vZ1e1tWod/iiFRhxsubX77+nkq3xP7fp77//By/7yxrEo94+r3d1nqOHE2tppwosTH/777+BHd7CLJo8f37UcpxiULVcc/vp1OX8C6iVtf3461/36/V2vdrp9XSaSRC8gQ1TCuAAINBgrEY6H69kYJcyQhc9ADD+IvS5AYiAHtUVg+vgBjVC3dANGiHSHYowzY1hKVS/Wsl8sNavV0sagZhTnARvNPM8068KU2d4TVmzbZvHex2oewXKtCHc0EawwE2I/60hvhFgIIsJ/ZwX/Y2oM1YYy1g2GnQPmIuXFwSJFfC7UMuyKFn85MWxawkO4gW7FRgNrVKctVUZrgo2wmqRe1DjqhVB6zWpsjBgk5Da9GUB/liutZ6sUEst4nuJHRyqE+aTJJ/kKeVgDduxhcGdHsASNdVk8bHyvTDLfLcdt9Qgqyw27PfjHvPc3vAkkAFnTNuKeAa2ppmRiWFR0COb9YzzQgY4xYg2Ote+sB7/YhIOAQVsMaNYf71eXZjCHGuTGAB669SV7rnNy4KRXBjYdJrQvt9uQQYPJ6ruz4EnxJLo2OAGGDM6GaodKZLhIsdg1QAHPTIO0YMHcxl55mu3auvxNeCCkarJjrbCj62CbMa0GEYn9jYGdyauT4Ig1RR6sOPEgn6wz1wsWE0RqkRAx2v3I62nE/uD7MQ7tB7YskBoRpwKR3pjp+6ZUfQVSm17GFWLVXX4Yzgi8R9ta7EUkg0eNuBUQXAAPpyIdMWGJFqq6A8wP/RY4uub3R9xvPWZ12vVdJsa6AIhYinQKggpZC/B9XASDURz2hpguHleNGs0EBk2CDggPvZFh/1zvx1p/vmK7PF5vmjn3TRd3j8AqXkOTpnH9Ra5U2IzDskH2KITU0K6IEVDWsl8vV3CbrdlOs4PKKoTMKCZXozzL+AtpUFAwJai8tr3ZF7tst9irXfs09s04S6AaHx7RaomvXa0PKVFRwMb2B6LWCnDy52fGKmy3+UYocZgOpEPdj8YwohoG4+AD5DjucdMR4jrVmPz9KOudCLdKhtnUAPkDBPmA761T8c97C+A9wcannBF29LXIDCieDAezXjOO4wQfQpOapyGkqmaJjKVTVrxTWB5vgIZ3NiWquyRhA+yr0CAxpGYLJE6SNiM9WnLV4rO7PjFRGMnKDI1n8EjNGsYquQwywxTSF2YC6qaJmI0ZJtEuwORDa5TARnYPkCMQGxPyItu19h4M0Ie/44UJ3j6SAd+Hg9q+RR9qS6nmLsekhWPgswOLcF4r4YcxtBoasFzxwFb0YXAxFSATQBYHveKMLBwqCJv+cUjJYjSeasYWZCLHjFNO1T53qm3hd3f98cRj1qdg99p3TCzYLeIM+6W5m4RQyNF6uEsCpsnyWEL23Nr6ZruB2yS6ksHQiQW03cLbUZKBZviPQxmDCw1sv8LW4PtvhNiz4nbKgLyXVlt8hDEGLtt1DPzNLXqYgKokLBORK0mP83LCrk5zJpmFC8gNwxWVWy1deZUoK4KsyC7LaCB8EdWDbB2XQ/izRtzhwVOIEfGQ3cniHWd4XEIpwLq8qx8QCAtoixJOu7AEDZ2k1p4kCJ1M1IZIIP9h30Iq6nnK5rY1JTi04lQAFU+4gEphdCIkOSQgfoQWSYMRtrucgOTYDs36bF9VHzACXUK7lRzOMxFBY9dhF7db/dFuf2KrEjeQk3xuFxRKfhtJZ7ujyk4MMT+eYvkVpQC0JM5HQTTtC4U08fx5h3Syn49A+dzmB7QW6LNEvnT3X//3Zw2pzco9cf1YluOak2q7DczT/tx/2xM3nW2Kt32dOTDtLcfJ9PZRfV8VIZ4+qYi9QUd3bWp6Swv+2C8dVRPI3bQhVSNBspXJiyonp77upwOoos2tCm3KY5sAqjNk+WZR1QnD8OyCBIWGtiMRAudY5Hz0VYcAHAMEQxcuN7u1vUU3k0EtqCKkZ4o0XqnoOjtZDEGVOY1sBEG1M44AKPr+Q+GGZllfY5kPkfyYRMSi6VwJwgkhBjTuGJslKUxIWGPTvheNngPDh1mnQIVCKQ6zUoDHGo+DqQ5tFGVzbXde50oQXXCwcvAEyq2kkZFVBbdUktxl/POC06EWUg9aMOJqmkSxLe/vpKPeAqbryTzJNXvPPP/XfL/XEo+J/x+/Lt/6KLvhEMx3eo/kl6/zCiYDAqyyg8ENTQ0HEeMeAq04GWYEMs9MSjqihgBHe6Wc0P5SOpjFiCTdQqsAdlUiyWqQAprxQwGRVTDJAEwmhDkSBHTEM0D8mgHJCRpmqEcMuRx/B4HnIZcCmzRR1DKmcGPfjBUULpnWS43+EDnQslXufCpSK5iqd0dCneAIDAXJAaCpBIkkIwGLswN/cBRsDIVlLEayyOEQPqlos3nY6qFNXrX8vl5sd2Y8ynAu7ImulBZ9DflkSXWrXZp/63lRw1Tu/CX5ZmpyFsBEk4CWzAPD2I28FZuWTEeCESiGH+7WS2OK4GBZY9ShwjUnnFZRIRbQdJasWixLiCukaK1ZRmNnDKjOqV0UaJIFDBQBRQLHSWYzkzeIv5Qf6OCRqb3KGMkXJp4LEFt56fZIici6bUsna5Q4A7p9wBLgvBYM1meSaHIkfn2n9oFEREpSb8gx5j2eWF2fllEBLsdUB5iWcXlAzqOAobl1NG4SZrnMA8eTMgZWavkDyo+VAuIW0ANGYml4Z5qK2peKXPPVwWiQHG63xrodlnE7aPWgykYA/bEHz+LCanmdl/h0JhuKWGdIBpw9IxleoUEj6BF+l2Uxv7rXpC5VtBJ3ykz93MzmLUy37JkCim72tLtBuihhkdUyCukRz+wqO32+TnJ5krIFTmprFqjjC55h9PmItKRIMTNnpzaRkHmgT3YEN5O8D3e5Oxke5GN5GOQcQtyxZ02WevW5egXxBMAATENn67bhsKR2KosY4gt6AT4F8Lm/UOdkIZRedZ0oFCLiLaiBUgKbBf3AwoaAWC16wEGr4nJvPXTwL4Nres+fqrkT9Ep5bsKHdXHqLEwgD/o7gN0b2IwK7Z+S/bCXvaeXoRRLst+XADiR4iUnIxyI7W1+pS4LcPcothTzQZYODeFCXeJDMli30gs1PA4pTaPRTt/2jbmQCp2jWKGhznGUfCsG+2l4CbhgbekD+At0Bp5S4qX7RRdz2ZAkw/IOEjmusZDsdifj+lQtdc8k5Oo3oWbFmkdneiViTuk4eH3Hes5HsBTMT0zwFnYHLvvLLUFC70ABfLgSTPTqGeF3fPxDj5B+kAROzcBQKDohgfBWBmJqDrwnujHcVAtK2SULFAeYZ7Qs+83LlG7uKfHDQyi5sX3ZOJc148VoSvHeSSIA/TdE8pI1YPM6OWeCUAmI3uUfpiD6AMzUEoQA6ynZa/8IJAGDKg88ZHFphmPu6+kPq7RHpIATn3mfLcsE2UvCwE3B75bVT85y+MA9Df3ukE9SvK/gKD165wh9ZZlPR20D5oHZXSw3jp4fFINuyU9izD/cwGJyX40aldfsxKnOdxuGv70PF6YTRfD4EXb5s2CzChGmHyg9K9X7OaSIsKeUZaFe2EpURCe0kNNoFIAU3lwZC8yR04Mx45SFpv0hmgV/WjkiNtEZyHkVqRlZ1G+gi19L7vZvz9obSngjTf4ft9j2iFNVqQB3IMGDpp70foD3xfD7OsMvZ8XlZHSR5YRXW7QoSUj0YmeUkaoAks8fn6eNsgyzpiE7dKFp2q4G3sS5OEeM1sZI3kWIp/agY/0N/ac2I8YTD/fGnZQnSEq/vgmYdQ3Wj5rw+/ylWVtL4BrLH8e74xDQEzOozZtxrkIz4UV9WpmbJEwRrUDJ35Vyvp5VMMzWe81MJgzaxjBglN1mHfVoYe6pQTBaB41Ks4+TgPBLNP0VE59DLHVYRu0CtOEzQeb1M6CrFq8t5rSCJsR9NcpcAvEFvDeClWWZn31PAYq/fiLvujnNq2zH25By7A2LE+p0FKxEDVdP8DDorfp8a6IZB88tG7TI44FGUTpQDVCBVFQLTvVFQi/kUh9BrJjlyv9bLGRE+D7SRMByH+RUxg87ExzkaRS7wfiC8ajjSIBahtvpfbth5Qvx8HvrVBZTCgDmRPpjsCzF0Yig4sBhHAf8E1PYedg0O0RoRB5Avi44SlsG6CH2ZbTQsywPgkBQRw7UFp34oQ03msH2QGh5tnfb0GpCTDfNiw95kTIox8egS+QA+IdDTjRrOum1O1gAmaB4RzNYimieYCrunTh4Rm/KVqh8SoSkXbr6iJpgZwHGOfzf2mdBRBbql5/ChXq+V2JJE5r2yPIhjEGxNyvKGh5cD2fBL9/4wm2Op3q5cI9n2c4se0HkykGY7dKNutCkb5fqYimTfSYRehKp8Sxi2YFv4r6FKM8MPQpgbUL8XPjFzivq72d368x/dP8hor2169fPyajXzZQTt6P13XBatCmU4zelLtcLth8rP+kNdqw7yUEqIDP8xn0fVroGlTYG/ba2c+PD5DmyS/AzcfHB0D8lx+nmuL1fnu1FhSIxAYvvfx4Sf37xMVu9nX6XwEGAL7UsCPVcUyLAAAAAElFTkSuQmCC", "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADIAAAAyCAIAAACRXR/mAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAClNJREFUeNpkmdmO3DYQRbVQUm9jGEbgR7/5//8myS84BuzJTHerN0m5xcO+Fhw9CGyKLNZya2PXp39/LMvSNM3tdtN7nufz+bzZbF5eXk6nU9/3mhy222qev3371nXddrdJKV3z07atvtZ1rWXj6fz29rbf7w+Hw/F4FB0NqqoathsRvFwuWqmNWqyBNm764efPn4/HQ5M6Syu1XXQ00DvWaZuoaOl2u9UicanBIz8aa4GW8oaPOT/6pLfmNRjHUVINwyC+oatJDaZpen19Fc3dbmc6DCRVnx+t0UGa0VtjPiWN0BYU9Q3pJbEGoqiz7/e7xlogLVbVop+aRE9aACGxlb9WUoze+soxWqk1IqgBZ+ktCvdrrMdKWimB+SQd6x1speeDAkRUu6rnY/n0jsVdC4tajJSoUOYTBY052+OuWuCVee3VEdooRqVdrKRJbOWNCaERRWP0Lyr6LDk0YA/S6Oeh28OHSHMAcBFgoKBHUjEOW9cV+kCFKFh6Sk1wo5VgDmBgd2aSFa79OhKFawVmZV5rREszgFcUYYuxPgnysIhSUbw2pr5DJQimRwPp6XIecS8dpxnAyqNDE7CFelj8etXZ6B89wXT4jkQchuvtAk8ADhNItnDSbAU8FJ8CwkiOc+gnawwPe6h4xXtEOSwFjwIHDgiK9Y1POm/IT5h1HOXMIqHYgWrxEgzU73b3MR74QDFztZi/Lj8aS+X77Q7sogvwClJDI49LHCBl6oPY0gd8Z7zEjDaIuliRqowYEQWC+on+NRi6Xgve39/F5YcPHySGfmrc9RE1AAn2wg5NeFHADp+D12A9BVSKETVCpfAemg9LBgjwZ/abdRTMRhBGHNFewItrR4BYKvwAvBoY06M4O1+JSgWyS51YDUQwP4Dd7beY3OAFJbg6NrIXh8MHujqFTauQaF4vvw5GsHV8Xr8BjwSJMci1TxGQkMkclwMyPIsJsvR6g63wuCZ8AtRP+SkL6gakgzAmw7ip5SDEthtyXCJE8ZtQBvTMK2ETDemrPANeCTmcp41aQxCRQNPTXeK8qvj8OvlohlTBdiKLgSGMpHVAB2cEpOvtV9LgjPDGzWbJJiORsZiQ3dahA7mh9Q3a2tTZFMQCUD+eT+t4ZvuUJEGUIg6xCKxcruUA/cTnwzqrnIo1WSwlDf0AESRkYySffsB2NhbyMzY3K7fQfJVAA0KDVmTaNluWkqdwk8jtmT/SlGakyDUQ7QSgAplhAkngiZiHw6ItC8PPpEiD28uJqKI4r2Crbje77dCHGsbzRawPmx4wQUuGxShTNT3mKUMhG6sNH9dMfQtJ0tDbOe63q87vNhHTpYnb5Q5BYXu/OUz3OCu0RfZwacUAPVlKw9POaIfHVwAKC4A2KXl+TCYLZeKOs9b0fOR8Yno75HDqkoZoy/GEEBvFtLKTLmaRHCCFEYfX9Qxchmz1DE94iWFOnq3/9+DRic/IR60I9bWHogCWKVUDEYxC/UiV4byGjoFUvRT4e9KmQNmuclHQ+XgKvZCbHVSwkam4+nP0b9rGD+JCF73CE9U2T1OVMsG6L3vrEsnsB+wik5ZUb+k5A17xOBfvJdl1vTsF8M5hpB1kWKtkmWZnw3WLcb9ebDgfQdAObZGMkcyVIfByODGKy0nPGG2wr5OxKaCDNu91lDL8jQQmiQtBKhUoJ5BIUBa8qCZQJhsgUaqr6Y4+IlQ+keRC2VEbggLcYbe3L685U9WKEzgPPsWeoyGjbKUDwXyKZMHBstCEaEFE1xx1KV00ryx0GUd1dppRFAi+o2qvlII0UOyJtkx+3rTd0N9Opz///ktW/vr16y+oPCaFAZlYcSx2ycGXiK4iVFK16y0CRmkNsnBIGbko1zNxfF2pNEVV4g9Nh8R1gwwomBIvep63CNGCitgCc5HO6/r93ze0q5pRJ2oNwCiBsHs+KN85UdqKiJzDhCNIWK2J7oqC/VkhxaMeygGWIEkKr5dZmv7y5YvYWjJNsogYjXIo20EDSniaADESkIe0o9k9P0OuHajl6RcYL/UC8AET7Lp04UgDLhyiWmBCk9+/f5dI+Mrjdicaiya1PD09hVb4EVWyPhO0YBEPdZP4C9FdS2Xh8poe3wGaCG5f0VuWRXJZv30+l8foLsjdbHYdEWkLZ8SIdXQhmdjPnbnmakbbBAXwG4xOJR6WwJPtK9PsDntr+vPnz1SwoqBy0nUUkBJxsVi20wA6Yfkm4ng8ur9b5wAleKpC9qMqQqFI3fLDeYjET6TFxDKT2Ora5DIEkFDnRD0rtiQQJSicshMusQiyuuolnNK/iyGuHmQd5T7o4NpgK9qy6QGwqGocHW0BUYOtctUz5wpvnh5N3Y/Xy+16+fjxY98Fo+qWPv3xiVbsei+9Zd9FeOurTn26+pwh/xRy9TO8NYsekfAZ9/HoaODmxdWvLKPGNa4zbtfb445XPS4T0aBum9N4jDiFW2lz9PIp4agAUFC1ZVGn3rtNqc/c/GALTtUu6Y8aiUoEwIE2IEuK+y3uu5EpBRKAIAhF5T+OkNNApqGBxppuQKyVKCOfPFF2g3SKJcDnNgv/xY6ESZcVvqFYcmoJOs59bqz18/X1Vfr0LY/rSa05vR85lX7fly109OQD4qRDhjHq+jHQ3XeGLPy5YoiOBoVbRFmBtLh/OWzy456M2IaS3aO6QiRqG7ncCTjy4ZIuy367NnJfVKAmbSknQFGs4KL4F1ksivHsO1zLWOdA2FHevR4A4IYHlyQDYhCIr4Mi3v3bZUSi9Hb96fAY6TO1AJZLEcj5ZoELIF8j4hOuUqSt6JRyK0vQR69OJNR8hDfXcL6nCNkUNqmWuNgQLUkpE+y3B8xM78p1Lc6IE1hJTGoLnHGSvFjz0rrTMKWsFpRioSrZdt0nskD1UrmkRFxCAy7GpTxqN0rocwjleJkkCT9QqbPMipzRT9TV+TIqJg3bTfSJS0E6MBBNbaEfodJXcfasKBe18lWTjUi94QLSdbf7xHX+CQFS5x6aPlsDLuUQd90AalLVqZscl8vwgec2qycskJIgVBov5wEz4TsSly7rex8yDzFPY0KoK3q7Vb42GSBLeHOiBLiIug5ypUUAub749wMVPAtoO8/jBECbIMkFJKEVYRwXuHr0bcz6On19n+vL6a6NXjWw7DbfISQGVdENOnCd2DatLYWjiKHw/+cB7gRLhJyK8wIS3+q654GO7/e4dE3rSzpbMHxzevge0D6MFvESQgD1E38cuRdyKwtW3Ak6IhDDHWbJp8QgeU+katyV7OHL0lzuLb/dpj4dqpztSx9RAJrGg0NlWD/fha7bfy0jBvni05FC88fz6eXlJVnhvhsu0OmSge+MS5fsv9f40yYKoWkS6tf9PkaJlH8622msNlKntoNIJz1qvmD3/cc//v8NIPs6nijqf7DIiRpIz/rK/1t2OmnXRem6Ymmb5P+2pCF6r8iPuTx010osDKma7AdrhbsqWqd6JsG1b37t5+CJDgc1ODuVWDgtLodQTKlZqpLvwRYbo0nOlP8TYAD8wdiTL7IMZAAAAABJRU5ErkJggg==", "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADIAAAAyCAIAAACRXR/mAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAABs9JREFUeNp8mVlW3EoQRB90gYdfL8X735bBYOCFdMUlSLVdHzoldQ05Rg598/Pnz8vl8vr6+vb2xuTl5SWTtdbrPvL95ubm9vb2v31kkgU888oWnhn5ko1PT0/39/d5fvv27fn5OV9yCOvzzLK7uztOyzxHZTHb8z0r2bIGWSEik6y+2QdkZXBQ1kONr7kpz8fHR1bmYyaw9+fPH3jgC3QwcrdkuT4jJ2xk3e6Ds8Yk4+Z98F0S/egcRpnkjhAamnLO3T48EyLWPqCGNUhRFS3p7QFn0pFny0C+VUqeYdHFSCJkIVTOR4mo5cw5a2R1eX0PfvvvfUiZi5n0l9gHKoBjJBTb+vXrl1t6hGi4Ql1qEOPZlBieMkNsUMNHxaZ5ypaq9/X3799KMcbOxeiRNZ7Depkf0mIspaKBM886VemvfdB4RUg4Ab4J9yGRE3hFidpAuxrzGECYWW9/Ga81WqFD185zq8ahteHRSlTXOUsLQaiEy48fP7JfS8wkxEYjaAF3zdIwDa8Ql1fgTSeIkI4TL5f8CvKxWDRhAQAEdnz58iUTPZHJ5qoxVfeoDrhsZcMHktMUMEoGJqzS4VDfPI94QxaErBz19etXDswrW5b6HrD59vfRBtdG2Qy03ntovg8PD1gIxpcnikJ1q/28z2qP+6T1XULNhijKgog/R6uOTARJTRuFoMTszRMCspfFq4Ndh478jBEwB5oNZwMSNURIBCAwRGMiAIRmMDtIBLF0L8R2eHVf0KtFPN27Iy50QJA2Grrv9yFZQKBQiVEiyxHiPiLviDMdTbn49fOQrI5ReQbN1SkcIxgl5GJ+CjM8X94HP+G2R8jUWqUdW4FRFHdofS11jYT0R9bHrVCTqhGlIFGfaKxqbNs8EQjhxahkWgJDG+yuFTCDvhYbuIxQsybzfAfVWn2IClkiGJ64oTCZ85/3sRSgsGSgULBGD0GByxA4LCXfGpHgaoLgAKKgGw/ImnwEh49QPfAzi6ILMpM8IZpXsdtD2ZUTdVUoZhAkWCa4mHh2HqU5boRidPo/2s2XcD/I4oLv378jcBEcG4giOCGvUQ0KRZwNwgarM0SDpZjBOsdgs2GdwOAqUmjC6qgzLSNYRshtk+9E2WONFpxz6LEv0DtMw5UWtgW5Ar0yICZinczxmM65BziNGNqELjyO1fAB1pFeOiQX4jrp6O3ah7DnynZhEYFdMNlVxjJ9U4wDQlrC2GwnysgGoapE4U3lQhaWrslezShZGTR60Hh3PvJzLOD1nNF3FBd4tUXwJYSKVa1lZNwhznRIPk3LNiVyiiIFMhCMybsJxdXUu5cN1s9ZvKls5yM6FrF1I2s4YGdwPBv6rbGuejhbNLKRnHngubhqwzjyFy1ppDcAbFsVV3boYCW2ZYSReqHknDziKKa4Bm9jzDJF6W1xn73s+0gWtIOudUe1eH526txMdp03LPjIIIb6e6kyaJNSilpkdwmMOeYFktUe3dS42JM3OE3sQx6HZ+4mT4wTc7mPnZYSVx27cxVvNfk2jxi72kUIWYswpF6AokSMy+XOgsxyVDRqBXUi2R+tZoXA4VVNaENxvifyRG4Rw+17CcS9W6FmFEcvto1GgaQALBVTbJkk2nuyq2OvyrhnopEFlBtL5oSi4TVnIq4OQucoDKGpd6ksePZk230HJ+eyfXjlUMFYP9Q3orjkjjaHKlYKhstD9efaY9iBlP1bWjrUSA0IlJ3YdBHKRqsBc8zVjtPjXAkOjBnh0qNH6qYhd4Vs/NFFqBg+zHTQNGxoqLUNrtO30ZeTDlKg0UkYPstPndJsZA2/lb+rKat0nFsP7ZINmCPGe767IuY4INJi/mFbV235LLBzh8PviLyVbg09SmqLP7PZlh9916OyU99gj70Ay1zjLp5li6BFS3e5mxGBriAziJjaxBBOpn+Op3rJMsES5e2bdZraVmVCayuBydWg1B0e/J82JHK1RLVcpf75FKrNWOTY5OLcQelG5oDf7kGeG9iSayZtDgfQb/kW9Yk0QUekBRAb/4fW/tHpO5tjF1R2pjpr4i7iz/EvhtGRT3REPKVrtc6tz8mjDfCRbLUNWN4MTBlSh+7lBQ3oAxFGm2mEnZEANtZgD5h55xo2CuwLWahtUbyRzVYYJn/GPdM9X+VSoTYmncnVtugYEp6hm3Mi9Y0HWjn6y/hnQS1Y3tgL7VZ7d3tGSCVR6XaGerS2s2fG+UcDXBwC+OmzWSPYeDGp72qCi8Ob5Pp/GJOjZFgLKAexMOLHx8eu/xT5tv5voRSd4ozW+Ajf/kArzq4L3gCufvoHYAdbQedpH7SW3WvX+X8BBgAdQTe+hA31AQAAAABJRU5ErkJggg==", "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADIAAAAyCAIAAACRXR/mAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAABlZJREFUeNp0mclS3EAQRDGIzeH//0pOEIHN7tK88SMjW9aBEN2t6lqzlvnx9PT0/v7++fl5eXn59fX18fFxcXFxdXU1KxfxfJ0etnif89u2zcp8MhTm5ce/x094yfUhy+fz71CYb9/e3mb95uYGBob+/Ltx/RzydHFTdIeVj9MzHw43Q2vWZ1E6PJCav4ficT1b19fXrM+/8wl62e9QDuj6nrS43vuQDFpuybqyzYukVB4PqkLO2cJivJ+1NYxzH6dhS2NJlMtG55enRxGh7oqk0oIaJE28qoB7d7ZKiCQnrfQtVO27RMul/JdrPJPGReWjJ2yKaiG4sYddVm2n6HCGmxMckEjlHQq2sosP6QkwAFv39/ffbBlic5pDmKY4g4kMpdVMK2fyVLtnxZzk5OTw8PLycmYLVlJbumrFvLvzIAZqHwpQzwOGSLEFNe6dvwMNuKzocHb52ZZNNrgV5uCYMAYaWMEtttMzRMELYxbXmS1IcQBJ5thQ48DQnHsz2uZ9GN24WOsgSsIVJsOmHmZXaFAeAgJqBlphIdcPo0k/7f7nz58tb5KWnOlJsuWthWfFKBKqpxTGCK3rtPtuhP9huk5tukiwSbcziFJofMCL0wh4pLCuwnju7u7GxJsfJCClQdPl15WEtBQdaoJTsa5jZQjz1e/fv3cYQh+H+SHDJ6mX3KZYtoQYrh//TZflwzlDDFVgzvvg1th9O8z8Klm5S4VcKbYBE0LMSi2tCShSOOiRGnECc0+O6l9cTYYEiML99Rk/xYs5j/Iyz1SW9DoPc9fQ2QFC9oUZ/s1KgfTC9abqq9PDrSK1KQ8snPWJdvRNVAK8oAnohdZ5ma2hvEeizqixtIiFoWWTCoAQfCPr0Kpaj5U18WW8Y1yLHLPLlk6A07GhYuWj6qqUwSs9AxHLPd1LwMuqs+L6uLBJ3yyFzb+vr69aENNwhvX6PONDD6vClXXRkQjdqt4oCDAA/ezXr18U78OHDovF18SldaDASSENJ1avCHkuWVcwLIBN/5j14cYt1YbvV7WelDWZ7Ylqzkj/Zsu7E2ZQAxoy1JVeN+f8xNfwmohQFrBcEXSyIs84sOPYDtsSuEmtiG34WWZW0AHgQAeHVXLW2cRp3ihAArPbmp5M48aU3dG8DNZRshmh8zIiopIEZG6aLdGEk6o8oZiSbiQcxX/D6ersXJNeJWdrAs3FTBsV3Yl/GVKuIOQOuVmPZ41btVtyUKjIIpFYReLab1XJoMty6ajt9vZ2h/vM7Wu5Ut2YCKmGoGizXwW7lUxmUnF1hUxS9RnlK5hTydlzmllTWybNHCvo3U4DCgsz0tdSb3eytUQsgM7Kovqf5LWA5rDlTBgCgXNSwnNGadM72VtChlJlrgL9rHwSX9BcVWCJdln7p59MGO7MZNzlgEWAyICCAyFRZ69aTTWnnEq1aqigdY+qx8dHpiVs47zkExCLBn/sbf9TvVqW5+UMcAZuZSNOM0jih/KUZfSxpPxNmWz37Jh5l5Usfg4dKGsEeS3H8jDV7JoJSBWbKq3hnbVirmc/vvpclVMco01d12nBK+QFto2KoO6mqaeGLlQzyx4mq6ojDi2u2FWX5uxjs7RNxMKrKnPpsJVk0kA18lSLBY05eMoGTvfYsu+u3Fxjywz4FclKi1q/hjbK4I0EGeNJW86txPV94sK+Q3FztFfl3ue/p/RBoNVMRqgbgrCV1jxrS1SsqV8Oxo1w284qlX7+/JljpnW2mDOczNmV387MPTw8iBECVc0814QqWmbX4AAsZ4s0+zUtqpmgerKj2Q4HMt9cL2PttfNOv0mvz1KskmONhvUzXs7J5zBDr+NrX7KEqjit6iPnLtXtJYbXoGt3oeQjxz3+uFB/c4i//jDhoMCbUlt5F6Gny2oBktLG9tqTrQxVwKuekqpG+fZqJUl95crz8/PetiRg5ukc9CQJY6LK3+yS8z1bj3zAhRrf2zttq6OUk/2vqC+5axJmaAs9ZZAsG6so331LWlUqTalfhUAaZf3hIxNI9tlZgJStzUv5Iw293VlpjoTv7u78ldB2mWzPxfOZDE07MAeYR8w6/eNsvZweB/fclAUqs7UEatz8+vQMtfOYa06PeuBmVrNjzp85+DGxMFpEHaDH+Sghh0vucHZiVUi5V3UYwnP+rwADAN6ZnhHCe04NAAAAAElFTkSuQmCC", "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADIAAAAyCAIAAACRXR/mAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAE0pJREFUeNo8mVlsVdd6x/c+e5959Dk+Ho5njG08AZchIYloGkhEm6SB5uHm5aa6La1Stbq6adVIVdW39qVSW6m60Ic+ZJCiDKhNQiCRAomIIAGMTRwwBo6xsY1nH595Hnd/a6+qW9bWPmuv9Q3/7/9961vb6oXz3+7Zs8disaRSKV3Xw+Gw1+tNp9OGaikUCrVarbW1NR6P1+t1h8OxsbER6euxWjR+aoby2X//z8527PgLL7B8M72TzWbtdjtrx8bGurq6EokEotwO59LSktu8UGEYRigUampqyhfLW1tbvb29Dx8+TCaTkUhEVVWPx9NQjEAgoP3Jm39ms9kY4gfS5+fnma1pWr1hoGNlZeXDDz+sVqvDw8ONRmNgoK9WN5BSq1Qr5fJcNGqz2jo6O3l2et0YMT4+jhuVSmV7exsLdu3aNXVrMp/Pt7W1IRM/XS4XzvNgszusVivuNTc3O53Ob775ZnZ2FmcUVeWn9td/9VvMZyXGIVGorNVwolAssvj7778/e/bs4ODgkSNHNjc3a7WGoSqaamGOzWodGx8/cOCAVdeDoZDT6wIPdPt8PvThEpA8ePAgl81mMplisdjX17e4uDg9Pb17927ebm5t83ZiYoLnzs5O4OAn6IwMD1crVe25Z38fIxBEgBRFCQaDLS0taNWtVhT4/X6UPf/88zyUSiUMVRoNi6ryBx47OzulcglPOrs6V9ZWHj9+zFqgIuhggDQAK+TzSIMbcAAn0UKIeTVzb/bMmTMIxDEg7O/vB2kscbkdhtLQjr1wgknSRcJEvHjAP4LIM34AFXd4EzSvQi7vcjobhsEI2OBfPBEPt4Qzucz6+jo+wA+WYxzwY1xPVzd3nmEINIIhCESOP9CEQa+88grkWV5eJrJMYGY+n8NK9aepB8wGZH4MDAxgCqjidN1QIBZeMhspFfPi2a5Z5+bmmkJBX8APWs0tLQxm8zmjUSuXyyCHx4CEh5g4MzOTTiQRAtL79+/Hpu+++27v3r1wLhRuZVoul0P1nTt3eMB0kk9TDUZ0FmMK6bO6uor3HR0dmMWDCLCmAQm0A2rGWYn0hQdRh8vFHIjIYCaXS2XSGKEYdbIJ1FmCQIhF3jGNQQxlHHbD6DfeeIO3KI3FYuBE3LFmZGQEjDEaqqQS2/F4THvx+B+A1ssvv3z8+HHMx2MyAABqZkUAW8QxDrwgQbIkd+Lk3eTUVLFU6untVTQLTKoZDa/bxaq1tbUd84JDiAIVzWLBaPzhjqEYTaIhkyBiB3Yzh5nhcEhRVN5aVINYWfAGVBGULxZweebh/Vy5qFg1RWlUKiWbTbfbSSvr4uJCsZgfHh7KVQrfXbuSzqfbIhSCUq1U9LtdmVismMvqquKw6ppi8DwffZhNJRkhT548WSoUchaLEo0+uHNnemnpcb1eTSfjtUrJqFeT8VilVNhYWwsGfC3NQWADBe2ZI793+fLlffv2DY8Mut3e5pYwrlAJW1taiDFI4BCYkxYskBWO2EEUwgQdKZUwj5xYXV2xmskLGNQCqoDMROKCECKOHAoEKAAP8svlyuTkJKKYD1m95gV+Pp9X1K13/u4fAB81VpsdnDVd585io944d+4cDCWf0UqSE1PU7N07GggEQRfAuUejUUIDS8Lhlmh0bmrqtt8vnhcXl3K5fHd3Tzqd4c9udzidLl41N4dTqfT2dqy9vZ1gQTtQgLtYj93Ir1TKGK3j39GjR9EK5UEimUnDLVi5tb5BfUM3Tou9yDAkVMvLq0+IytISQkmxoaEhvOIVLo6OjiJa7mM184K1vf27RsbHSJfVDVE+tnZi0A43sAYJPAM56FJTWAU1oYrYCUAY8NkcWpoCWOPyejAUOx49egQTGUclCoAQa7ADV7788ktWMq27uxs7WI4QygfPlCImkBz4gwSmDY0Mky68xW0GWUXeMa4pKiHDFLhBJWICRIIYwWAA57X/PPtfGEHU8oU8djhcTuKCc6qisBgRsESmN64DCT+x/sSJE1Dh3r17YAkGCCoUSoah2GzYRrSdgUBTS0trJNLhcnt0zVqr1nnFIG9xvFKu2qw66YkQfAY2SiZFdWpq6tq1q8SXzef5hYUFXlO4xW6taz/88ANgnjp5ku0ZOlMS79+/zwSshAG3bt3CS17hKA5ADoDESzAiRdCE9+BH0HEGc1VdQ7JCkjod7Jq5fK5aq6kWS6mQBw52MEoXrgB83rxIHWKiy9xBpdVuI8DUIeiPdCxDK2uoVehgKlnD9sLI119/jbn4RCp89tlnDJ4+fbqvr5/wgRwLAZvJPONnsVrBXMPcrDASRQwyAV34j7cHDx7EMUgGKfEZjt24cUPv6dtFILAM9dyZ1xJqoYpWG1VMtDkd+w78QuRuwJ/KZixW/cTLJ/Yd2Afyw2PDKKsrdVVXucdT8faOdgBIpBOUA7fPje7p69Pt4e7W1rDb5dS98KJRb5QL2Z0qBXlyEpCefvrpwcGB9fWNrNlosF2ynAioly/fwAORI1tbEFxskyrrlVwxh9+wlUHAAy2WEf6bN6+zJYAT+EM4LHA6HZubW+xSrGJELod/mH779m1LQ3vttdd0q4bF7OwUVSiBrqGhYTiIXqDCJgktirbj22KbAWEUo4bWgrggV7YGsgrwVjYXRF3sGH5/UxNbEzuS4XC4uM/PP67VDPor1iKHyfAMs+ArMYWCTpdeLGV2djZ3drYdgl1+v6/ZYfcyGYJfvHiR8JGGuEHKsxD5mmbVZbEmB4lgIOCs1XxV82L8iy++YB6icZSfcJkyjX3gJPscgMF6YiE3csoE1gASbkAD8gvdkbZQqZy3WPBUQ/1c9FF7e0dXV59urVPn7t69i2okACGhoHSzEKU6KQCMkoyxWAahZtOTxwiSljtOY6VUSR+HQRiKlcAO5YCZKgWQWIAQ3uIDEtAEDMyhxrOQutDV2QcXGaQIhkLhnfgaRQ6MKfE0NtevX5duwGbRxm1t5SkBWNbT04NuOASY9LIwmjWyhUIHjl67do0J42P7SFXsUMzCxgg+EFybnU3djleEHhaKzslkQqSVjWjxp59+6u8fiEQ6EagqooGrNyqXLl1i/NSpUxRS2TUJlntFG6ydOvVLGUGGxGZkdolEwe11W81LNS9oCAZU10h7BwbhIqVZgJHJ8BYJsZ3tjz76iIdnnnkGdPGTJcDjcnhHRgYdTi8bJYkbCHgNpV6pQFk/En788UeYzuaNe3CDXoaGh4qozswsghNqYDetmeyD2aSSmaTcsMAW89GEBYiolAUeHDfIMiDhaEAyAnCkow2kmUB+4R4LcRWZuVR5z57BjY21VDpJexMM+WhdCevI8D4YiRzZUrME+fSJLo+PWGm//vWfu92uhYX5iYmbXq+n0cAhv81mpX1LJZPrq2sOm/1RdK4pEFhdWUnE46FwqFwueX2e/fv35fLZ7p6uvXvHz5//wu2wh0Mht8vd3trW0R5ZX9vQVK3J37S5ter3s896kkkRirbWSFNTc1dXr9/r4/ShGApLlpeWdU0fHBjY3Ni0Oqxuj0u9e1ccDGH3hQsXYM/Jkyefe+45+CSPLrJ/B1XBCVUFOSgJBoTPrEMaJIVbUCS+TSkags5UO7OAGbwyDzw2kEMO80GdYCGQYCkN4+bNm/yU7QO5RfIhuaO3m6CpDx8+Yfeg3sADVlJhyTKkkFMQGQrLIyStFbYyc2DPEIRlDoYSWTTBP9G4KQb6EokU7RCraAKYwAiNCvrIHlSQE0ggXuIYUm/wDH4sZ0PDB2IqGq/mIAt1dPNONEa9vfQRZATuYgprKLDAAzBMgH8o4620BqPlfsxybCKXd7Y2mRkOtx46dCgcbo7FEsiBdh6P6PHhEO0GkxmRBz4m9/SJ8yn74MTkrcOHD3f39oRbW2j4RNvzq1/9KbNhN5CCFmBiEDmC0/KgJ/LCPIDLcxydCzY1zAsIeQXHcYMEpsHKZLIAyfGW+okooryxsS6XMw19yGRQFnBiLb3COMguuphGA/TE1xDSGDUE+P93NPKLGLMY/PAJ+4ANnMAGbbpdyGUCocQs8hEgRUdkNJ566ineoxIri8WyPKMjUJ4ZuaABpZxxtmQOS0wzEvHWSPuzfp/cA0ARUKgaFsW8sJcIIh3MAF+eV4kd1MFWwCMKMAMFOA1m8AMFOAohGCThwRuCI4oEEkfteJyoIQGxOIMc7mADh7hLJsizDHfkMAFXeQYCqr92+vRfym4YEZiCT9TM6elpjEMimDMCJKwBZ+6pdJo743gC8xgEc56HBgfMD0kORH/11VdXr15DNzRHHSoRAtjYKgOHhxnzYAx+QIBAWM9CQoeJVFc2nyyEZQE7AH5THs08rxUrRYJtGGpnZwfn6nyuKPeAgM8jPwARVn6imOoMnzaWlwvlEgElHHfvzfDKbp5+fb4AiMpmX+6wMsqbsW2aLYu5h4M0OYjMd999t6e94/XXX9eOHTsBboQGZbRmH3/8MbJo2D0+D4aTvwsLjwlHR0cnunHL6bADFWGVbEMB+sAglUoCntj1NQvqW81mCQsaDVF3RAURXxIYbC6VKB8qSSdN4Z42I8AZhIo10L8be7SxsV9AVZCUK9FNd0EaT9+ZRijO/Pzzz1CHw4IMHLhRTWAhlkEjBjl8woHB3YNer29tfYOWsFar50SACG9abupEhwcyAa5iumhSigUCB8Oc5kVkGTxy5Mjg8B6rw65euTJBicdveW6mFaCbEqmez0AOOjIUg+XQoPgaCDDFfJZMMWf6sYZsJQSwSlctbKuS3cHmEMEl11jo94hPnnADOfILKBAQU8OiynyHdkKs2e/LPg/8LEBNOHghThlWay5XxybgoS4TIHRANfwgbyGcJCymsB6yU74ZJDNA7vK337IFER1fwC++EqSS2IQR4nuk2XZyRzEcxyZgli0Gl6xn+Al5WEiNoO6ITOQda2TtxhTMx9ZIRwQrzXO6XVis2zAIrblsRrYiMAllmEUXTNrbbY4Q4PX10cBsbscmJ6fcHq/H43WYYIsTqMPBctiDh+LoVinjvNygiK/8zoOfWkN8BNV+85u/ldVIfjCSkRIfIy2KmThJ2R9z/pSfSTh2ggEo4jdqcEbWYT8dt9m0KRYL90xOlHvEriwvkzHvvfee/HyKqywX6hoNgBEnXacTIdQj2eRotQYbBo3NX3z66ac4Ib/MEGzza1PY6Xaa4BXc4lTgf7ywSJ4y0t7WynrYKg+9IAd1sJicNTNXfzQ/D9g9vT0AD6UWF+bBFcvGx8chHMeKXvNSzK4OCajDViKG8yxXK/WvLl7U3vn7fyQpOGu0trc1BYMPog9xuVqvVUsVm9VmUdV8Nsduz8DG+loqmfD6mwJNwYahjI6NF4qlR/MLXh8dJU2wQQmiVuEqlFiYX5i9N5uIJ0b37o10dr7yR68Nj44uLi8bqtrd21cokUwWbKKjBDDqOQ4QAUpDdWfxyqUvxce+o0eP4jRIEkRYIitybHOL2sg8igXA4MqLL74IHob6f18uQVduDDy0tTUnk+LjJ7WDFKG9fP/999966y2ApIvMZbKqoZAZ46NjovXQdDOIVWiABJCGVTKv4UOmaDnw9DHt1B//0mKygSGUybOUoEu1hq3y+xH1R6YMgjTdiim8wlf50QaKzMzM8otx+bkGD3GGdlJsUMEQ++7EjZvcbUhuNDwu99rKKtzlLXLK5kWRAgXAm7h1N57Oa//0z/8Cn+S3KxgAb+SZoqujkzs/SQLWy4/y4sNVvcGmyRLZ/WEKr+Rxr1qtyLZMpwUW23yRdqZRLZ8587t//7d/9Xk9wabA3FyU/eDwoYOlasUssHlZS+UuREW8fWfGypnst3/zDpsaLmIZOuTRj0nwiWf8BmGSiHDIBOzu6QVadAMMoKpmb8XJkbS9evXqJ598gmVAS/9N3LHVpmvEFESh+fnz5z/44AP8AZuV9TXxHyHOEeanBoQgAYHZYrZYLqj3o09IK9azVYM8kBA4DE3EdrAJeIiU/AiAXJjx440JdifAxyBYhSAkUujtDit9B2cyTHzzzTcZh0z0aomtGBmHfNz4/PPPcezVV19FYLqQY4IoJZkMwhHCHOx7OHePaKjReXEi0M2LSkOt47X4ZBhPwPRoNPrSSy9hB+MsRtx//O4sM99++23AB0hqfcm8rDbRjjKHPgwH5DdwWJxKJVCDn9QXGkzsuHLlCmlx8OBh5HOyZZXsFllIi1Az+0ft0OFnwZzokkTQSG7YbCZQ/tixYzKmDGKr+JdEOt3WHjl37hyQjI4OU9WIO6+oTJwL2VLkPyNwXYYemf0D/bAmnognU8nOrq5EMjF1+3ZHZ6diiOjLeim2LPMbHSaG/C1379xT5+fXIRboyXJKECXHUYYTLAMbZst/BZApbW0R8kB+4eEVhoIo1RlHiTgUloVbfvCYnZ3Vbfb21pZykQMwx/xGvVq2ahrUvHDpMrv1iRN/CPXjySSFqVAiwYNBv020CFR5CIijtDvAppkXlsEw1KCPBxJNNq7m/8nKnG3kbo90eV4AfyZATfCX/61gITKhIEcGv8+38oRj35pmUculYjaTEZ88+gWKu3b1NzeHyVv8SSRTu3cP2HSRRv8rwACeH6Q1grmypQAAAABJRU5ErkJggg==", "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADIAAAAyCAIAAACRXR/mAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAB8JJREFUeNpkmdlWIzEMREkwO/n/T+QRDvvOlPuGm5rGDxzj9iJLpZLkbG5ubrbb7c/Svr+/8/f4+Pjo6Cj9r6+vy8vL9/f3DH5+fqb/8fGRwUx4eXkZY5ydneXfo6Wlc3Fxka1eX18zLV/Tz+DJyUn6WZ45n0vLqs1mk8kPDw85JV+zfyZnMF9PT0/ZfCAELRvlW+ZlWcbTyV/kzmH8i+g5L50IkR3Oz885NTvkb+Zn8HhpP79ts7R8YofcNv1MyGAOzebbpWWHjIy3tzd6HI/sm9/GLbM4n9LP1wyiVJZwmXQcz3U5DN1wbSYgJapFQ3zCPmnodUqXS3MtjmF3DlBDXItl7KU0LM9eWYis6AlI9B04BcVrekTPuJfZaweVqj0AoRzYHnG9KF+RjIspFihkz4zHuPf394jFfUAIsjKNDelrpfH09BSVZH2mcqHIEdlbiEzwchkBTJkfAGQwk8EHquJiLNS+LEdu9ME+ET1znp+fMSUyzQknS0OHLNaCaBFUYQWUh9eIVs5Gc2NpYjHnteHwCaRHu0iGNOkowIjHZSWuJPYBLDdDZ6okM6EJUIVYyE1HFKsknQOxshBFsj8KQz6gPG+YXpaFKjggdkHq7BuCyUg+7XY7TJm/d3d3WXl9fY16MicTkFgIZpMQBxIgjQbKrRAL9np8fAx7ob9MgxamwtEzqmYlCgccURJkxr+gKoNMRhnbahhUUmhXsLEh83GXvYa2WyA7YYfsHMOQ7Id6MCjLQIPEQ+NKhgphh1c2R3gZ6VSQETxwhak8proj89KiT5lX8sTiiKVnIERzrHsaxOQ8HSti4R/omAYYYt/xlzMap5q1R7CUsGUCd5DtpHXpTYFwSbXuiTLo1M7qeP0FyKPVle1pUjlz9GI9GqsxrSMVYsVpgKz2laWn0MYBL6RW6YAPbqavAQVNL8LU64EYf4MVVKwiubxGQE8Beow7IX91deUCRDGmkiDka5TERlmDKxBQVRKglMRFtyyK3JiMCyS6GAr1fZlvQCqYA7wjL04XO6LCDvhwqexM+BMlHSRyAbhav8NpyIsyng6XZB/YbjoCHoHCTIDSeV+a5oDZWyyVD/fqpHoP481YOimO2dgyjrHzIKp8VzPdI5pGYVADCuP4hjDqwbP+YqsZTvti02yF6+iVuuQAHNKg9gr7t5NGemimAyWHYb5YhL7BTrz3NcS7/qED0tljyy0aGQpHgNMihjnBHkFVWAtk9tYxQBVwJW2KWxi1pu5b4VgQJyCXdxcTKSabmgIRooJe2abUcAbWFtoYhQVluIGPYGxzbSCVkzqHZIJEqjq5tImQ4bVDQourNHbQutF9oo1Q3RmfiIm76vxmEEY31M4neUt7KQqgMbY06rv0IJvKnqRYBx4HRpmRepA0y8QmBoWE0HaYkLSMtWROCEdqoLcieraSLMCJqOAmJlvp5/Q50pGyqQjx+6JwRKIC0nAk9JsdE+NQ2CplcAQgmnSo6VanScDo6N0E4+x9SF+grTch08xAloua7EpmDXYxzmRBaeLKNZxz4CEdoam8MyG9IbqBYBkUKIReaazh3H0zRIToAgRFZP8JeYvMroylHGaTS+l98DJmZWFDhxqGpwDZyJ073UUvqAMtqqahyVQ4hqM2lPfEDVIyLa5KUaRzmCxwpUaSF+hXCU0sliioDnSqObhHjuwUhYKWNwyQBIfBIOZ6RA+zia476Pj6YGzgCLBrmBkrLjYj0BBCGD1RpekEPpyEBbQjDdezVuMr6kwAVUrSYLG7Lx1ub29TrJHrwZzEUYnYAsY4Su4hGjg4HBHuIAXSTKCHrxGCbAUMmE8jMbxlBToMkJ19q0zLB+iAkBBnQVDfUQjY/ZLTmaBUblIunozxhvn9C5nZn+zAMkgSW1BrkDTjDWSI+IFwAXkGbJM79IGtj/5vLRDXw/TDQAEXeFICTowbxKz4BlW73krGi7brGDy6rBISqkMtcue5P6xozFmVoJpSZ45YPss0Xzunhfj50yRnJfYJUuI8PPpYHBtwyP54cTCt8MUHkMquKMBxBWqArrRCBWseseL9rTdbhWqxT61BZPDVoFnngNNfo/jiunpO8rFDy7T0ijGrHuORMrW2TYagmaiQwlrH9ulWdYJxlnAGxNt5uWzX/G7RkDJiz8Lm+f0MhI1IgKjgOB5tEXMynoVhrKyKiwSwIR4e6JHYVDZLqEAViDfO/AvjANy0Wc5Yl5r/exvTVGTVGc3xey0/HZAG+jTfkadNgTqNUQCDZ1hOGYjf6RiCN1CMvorVtmAJW1uBEal0OqvWLgZ9mSLl1FaTIMx6jabm0KvcyIClHZHDdNQnRfG64p3OHQAoeiUP4GWAXH5Ybq/SVEFgiGhOgtNXL9Odolgh8pORwd4kUZY2blqSzMDTrwZeurlEJPme069wjANb9eePHc04HW18fPN1yBdUasGtaZOvD7CiFRKnIlA/o/UzhPm45ORvC50B/H28lI0tWEDk6NoG5FrUUzvwGtavmPb7VRcn8oGq43cnJp7FtU+XRinG0WGcrRABervdjuKE7DSLM5IJ8Fs/Q3AzEimfuPglEdPgYpkQSstfQgUVWIgNDSEHM/lpTe3uH5J8tmtAYHiSdAsyXzJUQKtNsDeWu5po4He9JFGjzn8CDADdTKgo2oIe5AAAAABJRU5ErkJggg==", "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADIAAAAyCAIAAACRXR/mAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAADYFJREFUeNo82VernNcVxnGdGXXJ6r33XgzG+jKxY4eQkIvUixACIeTDBXIhJIzKUT3qVpesZhWr5ffOH85cDO/sd5VnPWvttctMzVyaXrFixd27d5cuXfrp06enT58uWbJk48aNFy5cOHTo0OvXr1+8eGHk5cuXHz9+3LRp0/3793/55Zc9e/Zcv36d/BdffPHgwYPly5evX79+ZmZm586dT548GY1GP//8s+/xeLxo0aJ58+axs2rVqnfv3t27d4+wt58/f2bkypUr69atmz9/vnEA3rx5A8C2bdumzv1w6u3bt3RIG4XAi0ePHq1evZrXhQsXkmaOlTlz5sDkYfv27aBMTU0xB66fIMI6d+5c8q9evdq6dSsjnlnjD3RvgWNnw4YNdLds2fL48WNYhcr11atXQXz//j0LYGBk5AdlIOhAIz7PK1euZMiIn9zz5Cd8xhnCh8E1a9YsXrxYJCzs2LFj2bJl5EVIHf0fPnwwTgaL3PspKph8J+aZup8//fSTwNauXcvm8+fPgUH5SEyU/RYf99euXUOAZJEGnJrgjD979oyMyHBe0DwZQR4VCDCPXZigRyoogrx58yZJwUglL8gwQljuGNy8eTO+cSkqpqgbPH36tMEptcUNx8LFhDjib9a32uJbCjBn0CvWwWXCWwVkxLMYBMYTU0rHIDvEUAKTUCH+8ccfybPGFDGphEYd37lzhzBJg2zyNdSWROCQAgSE+CDHSpluHiyffBDTDOCPCn12xcorAshzKYPoER5FgZkHCgCOBQsWwMe3apM1AphjxyuS/IJhcN++fTdu3BhhSPoZglfivPAsjqZSxHjFMWXjkl5+sUvAKynzU96rG+OyoKJv377NmuRyHEPy+GzyURi80KIusL1790ql2iLWnB0pBfGhx29uzpw5c+vWLUz4SdO34PhTKCYITWmihktiJiAVzcUrNcexoAl7lYNLly4BKmzBU0EDhoQnEo6Ywt+RI0eYlQekYvTixYtSOXXv9g1DwALx8OFDJFenIkYMfeZ4IiCVeCIACn187N69Gx8YrWhE6LnwqIu2LgBH1EoThkDkS0iEK/kAEfs8+QzWODbEATUupemrr76iD4HXoteEwBLBwYMH620IUGHHjh1jl5jUaLyevZIRMpoQ62QUSs1CSbCgCuUBHwwePny4Bk4MW4B6hg8LxEZhCgRlBcHKrl27SItDvlD4ZvJRvBQA5dKDoGn55sZbzQYyrHBgXLRqCPEsFJiAZRlJEqe2qDCFbJhgFaryFZWmyMKoaam2ZrtDFVMV167EYdIpFOYIYJ5paOADXRigs8sULfKqralHXhI5RoySMM43lAJQjvxCgB5hNCuJyfvly5enbly9hKehsU6KVzoUozJXpzXxAwcOCL1Sm56eJgYucDU2ugS491DDFJsHikCjgU2gTQj4GFTmlhpTDxTTyAjLgqdCni4Kz58/PzIEssgYIiF3dKA0LhopaDWUX6alGw3M4c/Mb1Vha9Pk44Ewu1JZRvAEOiMZRwwBzygxrnuR4Ygpr1IhoIiH2pL1J5OPikMgNJDhk4M2F/x5JWu1tLofTKw0pcmgQaIBKnecodMcxx9h+CpKyZJ3/KlUcHmhIlQ9hcGsKaepKxfOgU+t3QsdGaRgBMOagm9yigbu5jD3BrlUJXEJVg1WomUzgdojm7wa57J9hCChgTsKpY8KAYRhMRgjkQl62eTDkExx9nzykSyARNmCiPMFkw9btMxw6PkwK1UkSeFyxvr+/fuJUVEMHtrAcOaZfc9qTuKkRZy+5UTixCA2PQWy8XfffsMosE1AtcJZXZ5QRabk1RyjIHowIpVIEiWelF31BCKyRe9BUto/Ae1BhEyRQT8XJj4XVYJJDRYVRPiJUWU6/s+//+WFlCsF2L3GJASU+fCT75pvFe2D1DalIIpE9GpF2QEqUHaNs4ZUbmgZZ82rQsK9kbaHPOZLhbRlJUBy2NiQRjj4+CSq6jnDGU+ibB6phoJu2wMKJtqxaCW2D/iuhnxjpf1J65IREAFtTlDRrs+dG2qafD2Fl1Q4HXYQYHIjtfVS+pYO3+1IlQJKKVQQZrX4qmJTr3kg9C+//FJJvZh82gJ5kJRy6kFOwWrXwAIWrV1BrGw4apMHmZ/jP/z+dxyjoSpBo0kEgVQyIZr2kwx5y7cRAagtbMOkVgTNFs48qBLWjaseUQEkkiYTlXZBzdzaWFOEIzllquwPy9Q///F3OqSF4gGlXnso6wXtVacX4xUKtpj2s3OE2jLiFRU0N/MrTdY8NzGJMTJv8gHIeC2jCNsr+LYATJ3833+9M1/w1DnCKCH4RpOPtQUCPpiWC548zB6WdEUbpsYluqUQQ63BrFlqGMQig75poV/NoMe2oFoUhu4jKgA6CI2///U3UoZJvskJXdFAY6Ihv57uufMW2lDVesUQf8aZo9IqVGdCg7Il1hJiXGpg0hHUBv5aT/GktqjrHQIwbypH1sZ/+8ufjALY5H86+eh13NAUh37WccqcQg8OmCNw9uzZduKo6hDQRpQAPiLepOZGqFRYa9dg/jafvGK/hZ+RtpBGuJu6fuViJyHREMVTi493Mj27HUVAm0E4+CNZU63ezRjpAIhLsSGphLYqC6aZRKXeYXrWqEDxrOZKRZXAy3AqZ1RGhtPZZEHV9JFJuWVBjwGI733798t1/ZYDKwxnxKjYWbT4cOABMdx4ZSWhwsXLyYcK3+FuL14vFJIVDzsCsEvwavzb33wPU8T4kDNaTISUnbAUivE3r1+3KIFrQWRdLdbi8ScXHmY3tM3N1py2AqitSGCSZSoqofrrdKmClQHhYaNgG0hCQJ0HPXOMABBr4uip/5avjhJYZNo3QxATMJdl30i+a0umUYd9sASp1KQMjm4o6pe1CY46ZopzOL7evXW9W5p2iQApfxL1MEGIqfMxAfvGEi3L7ILCccdi6FtJOvK3OknCqVOn5k4+3hqUGSjNVhOI8XY7KGhPxpEH69LQCLCCt1eTD9QKojnCQcs+r8Iipt+UAvLaFXAtzMZ5qgl7hTOhatHQHD16VI460lmjpEXwnanarBohUK49g/7111+P//rnP+JZKXQwamVVByBSE66pS5Rdamq5iW0eaKR815RrVx68AoW1tr8mh4yTEW03Ds4pMi71HWgVrhg8dFKiC9kw+W7OXMZ/5/faP25Yl2AWYZJfHHQn1haqJZZXz90W6W3UyQgMrzxJWXcK3ShhulONeoLMzAVR/F6RBKV2GCzuhh0EYsTanRaLphvmWPSNHjkFlw7a25oKC6w1k08NSRa6rOsarb0A4c4ELcBQ8iLgdgB0jXesaD9icHYzMhQjQ7yaRyQgSIKOV5jnrwM7N2oc28pRErvhAQu7ug4KlSr31LvarGvXn5pVHHUZiQu04cyBoCnZnRstQQ5Lxf07N+mTJtq1iRf0y7oQNad6YCsMT575VoUdWWvNNQgcsNCxB278UUESWIyw+XHyaU8LFhXxMOihmgNmgHH14vnhADS5COUYcBJSPnsKhV2+u8oiIPRuIiqgEg06KCBCMFTGaES96uwkjfXmDRDqtdvX9gvGGel2iEGYhuNrazhPcsQ0Iaa7P2nft37DBoAANYeRlFjNCY7is6GFnnVzkEA3cmRUevcLXLJApv7nlTLwMHsi6uaRJGSWkKGW4eDYCuNZL/VarSycfGhOnz9PmoCqaoNPwCbMRNG1OaPCK7tIEiuGWnwMIobLEydOIIYi3G0elRSDFl+WqSBPqEzJskk9NWxCZi53Pun2mxUZAYuCsui6poKbvYnodAocZ12SUwFU7Yuw69bx5MOyXNMyCBYLkqhNGEQbqppJ3VMqnu5phnP2d9/+ymtlhO22Ax5EOdt1FGZHD2XHH2GI5VdGkNfNpbf1G1ShQfRkFEaHxNZyoHllhIAMCsmEmDP5dJongxf1MJzzuBcHu0B0UgXfOogDSYFSKP2FQUZ5tSsyrqTo40PxwiEwCIxgupLnPuOi96wuJbojnVlctxMMC7CC5RmRFIftMdpJGKLJEwTe1cm6DrUCluVuIrlhHaPk0W4cGRq3QJkGvV1h3di4B69anq0lhDujstbWnkFe0FHw1jRMD7XVRqz7BRC9RoCRfCusmntktEDNjgNhSp48eZL14Xw3HsMKd9cv/YQDYV0C4hUC2fDtbbuMTkE8ctHhbLg7bccnx50RBN01fzUhX/0noJj8FJDZ1CUnrf4OchZt5y1Ckl2YkVF2VLr9BrTLFZmFRj0IzGDLuSrszwfFwPKofWNnLEJcemcdZJRcK1prQAceueCGUcEZRMD09LQYqLQt6zZFVejsrUstR3SJsS8AAcsJUlHItWzW88Ss3Qx3EHancIAsIBnpD5LOM+ZL86gzY/f9/HW6gqk1tCsQqzL0IuQAZ+LpzhyULqG96najs11cMiKhXXp3T+EzbJrP/XCKIVC86w8FK27/yHUPdvz48dygh12htPH3s1bELs7qRpjAcYwyIhJd2qBXVVt/TejjbLZPRBgoAqbYFRdGhn/I+hOr23bWNd8Ox1VD/+A1TYAmT0ZqvOKvhaVrEuptHoXbVTaXcioJoFBEz+z/MZqCYu1g18HEuGdFJc7/CzAAb2tiTmxUvU0AAAAASUVORK5CYII=", "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADIAAAAyCAIAAACRXR/mAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAC4lJREFUeNpM2UlyHMcVgGE00JgnUgBJUKTEE3jpM3jtpbe+gve6jvcO38J7e6eQEKYoieKIGSAA/9UflOEKsqMq8+Wbx8Ts3//4bmtr6+rq6mTx3N3d9bm0tLS5ubm3t7eysnJ6evrx48fz8/O1tbX9/f22NjY2gr+9vb25ubm4uFhfX2/r/v6+levr6+Xl5T6/fPkSqrb6ffToUZ+z2ezy8rKDoe0z/BY7GExHOhiV9+/f9zkPdbiitLu7++nTp7dv30IX+bY6s7q6Gt75fN6ZDx8+PH36dOX3J1ytBxnY48ePoxGqiLXVYnh6iZUEC2BgS5I4iFYA94unz061ReYA5u0lJaCWXr16FUTMtRei+Gsx/XUygGgkDR30myTb29vh7UjAcRlnYWtlcNzZ2AoY+bBlk1QVGIT99knZHT86OuplHsbU0BvNh6KTT548+eGHH8KL0vricfjNmzc0EcaU0XpnaSjOerldPEyJS7IlAEttLh4WTx0d2dnZaQtbGaTf+fR/Pg9pOoxqoHT7/Pnz1nvHK08KOGMFnC4TuvV85W7xHBwc0FOE6a/f4HsJTzqOs2gH32e/cZZ4SISZs/YZ9332Mo+hCMR49HhiPk431EDQIJmSJvoNL4egqp7erfewbEbsYGI4GKMYGsruN55SR1thI+c8e3EUkdKTSlNVlg00lXACvoyqJ3QdYXpqJn2o2wogVj5//gxzqmLr1lMBRodU14tHfLDbcrbsw0bfeXEifv/99yEKo2PkjrkRa/HRep+Q8k7+MFs8ke9IWi96ko33CN7IdZyC6ca6lRBOhmZvGh7hnQOFq5XM12esy1sxHQEyZB1aaTEy6eD4+LjFQikkiZS3wSkztUJPIe9XYgqyI1EhWMgf2BKi7CIDSTDyaqyELujURg1nZ2cW44m3ClXxy5oBS6fBlOe4cCsMHdWYYIq1xYN0nLT+9ddfx+WcjZhAKMkFkedABBWnAjPsyS3pt9VnhHcXT+uhlkEYPTtSXvDyX4vcTqzEJTftCU8qn0IyXPB2OH65USvkG9jDKxILdaYJGI2whyTssR5M3LfFyTpLbEhg4FIDgPxiRaXKZ+acvzolOBPiavGkyZEY5YWRhVOJAsIVOhKvKbhTilgK67P3SAbTJ5wxFC1op3BbXh7hmS6VE5E0D6mc1pLM0W+H+WMHuJGkPAroN998w6YR7rjaIoO0q/T2BCyhx5MAXF08wWBL7uUVAij4fONBdQnE0/sFLRTomQXVuGjEikzYWYGpMIyt3vUj+Bi1n6ikFRk98THIidCJnFQhiYlEdaYwVi6zV2fIJ2ZZFnYew2n6Tfft5gBOZdDsu7V4WuQk4exsW5FTbcWTborXzg8PDys7tKVtIvrIKAktWFrvhQv3K/2kHkYXyOGVFRUZ3p1IIklV1m+dnZ4WLOdnZ5cXF1E5PDhQY/jxFDitdrJjfDPmWlENaELRHaHEUQIYzhuXqUed1jhwmnbJQxLYtH6KrK1UKNjLwCl58lcxHJawx41MKKeP7O+8F7kgREOv1BBSfoNdaJmbtOl+pFnW1zVIxa0n2FQ8trcnO+gPiQIiLDyXvWQmIip/ujmomalFngcbHfDRrJYMvWRT8PrNPjkuErBJQ1NWkzmlAOyHtzP8jAIiKQUEwJkyIu/pUSiD4aDScsDkbMvBUdOY8tPHj+2WPDE6ug/Vdp6/y5M8iebpVmDCxbc0gIGxjmTIHGRT3Qg53Ei91yOlp9ajzYk9o73RM05ZvvoapQ6Iu9G6KG2cPbZwoyUcZVSxUhaxKCakKyr/9ddfhVQwaZq/hjO6HYlKwNxOuGTXSVschdcnUKgVkFgmdw+7qLUc0S+f0y1FbwQseGmlX6b86quvkFAx+40V1UZf3osMMMn/1z//Md0vzdq78S8XT691DxHIxLUAyl+0tR9hyScqEanQsDWa6eHvI+ICGwLXtCSwnuLs/LwAmf3e6d4vmg79agLM/vPP71ImO2p9HtDtPeL+RkoDp4LK1rDElg5sNPKaZrm3x+xqGqB+Rnz9+jXVgucAZdrw//TTT3Npsw/uyfZabxMzcY3LXErTLGCTnmuPdCr4NYwcWRSnZl7YE69pTlqXdXvhEqjP0TYtGSWG90gEvWRBKacns6ahfCLamkHVekzhXqBiFOMGMeKgNEb31CFj0bcKNuWPNhR8gsock/m3b9OTWwb2Ciwla9slwCGGFKNnHKOH3jqwsGkFYmiIEdo4Uz/adQ8Suw/jqwKeA3V4gEYpFCKUaeiZWK0HHEC44lvLwAFoq5URrVpwuc0wGP4OjjZdH6qSOjVlQf2NXpQaCXR6cqYE6TqoOlEaIQEzBNaD72zadQkADzK6BlVlDI/GssEHKhL4s2fPGgfnpjl5crQixuuYoMv8SaGIQOkx7FnTHY5+UJNkMaq5hIBloz47G73g05OUZjxher+U3UuSz/7197/xAFVMkpTQI9bwCYWJQ5WIS8E8EtXFIjWHXXD89ttvSmdb3377rUZIbyM/j3sKB10BjT55IifDRqYkph7JltJMEkuGEoxo75gC2qLyzJTMF5kAWjGcyQJxxqviRteQ8tR1ehodkdFo7qJCalZoSYnXFy9eBP3jjz+qIQ/F/9MnswDpxXbHgymNjUKkMHBWBykbl26sEiBItXKYaMoR7h3c9LklM5mF1MgQ0pcvXzKu9FOblnHDXko0HaRdF3cMpCcLTHk2u+rG1EEuyC/5QzxQyrt376aMb6/vzo87GTla/JNDMEbJnVYjvASm/Y2GGlKZMo+Ec9xaSW/syCta4Zqy9Bj7ol5nMRnRDaXLAu8mFsIZquKmA72bWl3pBpAJ4j5WmDKSBXUYtH7i1z2ZmmPe0juJMMqW6uQUDdl8SDzmKpIZU6P0/1Nk52PFRKA8KK5pvvdemhHa5XzKl86x46oQJiQwrmnEbTeYdhN+SgXm6eA4QWRisTOuvuUtdpQDA5MUdEj0UaYxa4SqrZ9//jl9F9rRUKfpsi0i9W5O7MmnlTgNC17no+XQp7veaFE3osjEawCS4biyUpE6NWZ2iS2FhbfU9ebNm5GT5Qv+7hJgZ/8RFb54sRP356dnmvXN7Y3Jqf7ypz+kAwOduFB6k0Zsh1pJGY2yIZaPj4sX2Ui/NcbJpJJmXfbxM/Ani4uayc8up2yyt7sn49zeLToIl58YV8IUqTTXYgoLL8fXX1R8xoWlexSxJgVgOpGOjo46e3x8rFsf7ZqrB4wGPKWJpWlwnd1PHUdheHL2eWoXyklRdWEnUXXYNDIGt/EHCyle1AwY1zhSqGZGT9v7q1evGuZpd4L5cnN7f7c2X1nQerh9XVtdU14jTeuTy5shiTuu2iQwDX+7agtnTyCLbErfPbkOparc7phzSvlZxzH6toW5pwE9PGefp9BbXdwr8NQpwjiaTkhJN7pIUS6JeIbKpT4ynL6K0NFwaZund/Dw8DBufvnll829qXiv5G9rD8Pg5fWUY/d3H7kE0H9f314/3Iku3HfOeY1scpVKrAUQZUJv/G1nSK9P4viJYbaW8yQn3jb+oCI50d+7t+9d7B69fBm2D+/eu4MoEh8m743FU9SY4GIrAu4wxx0wh4uzqmG7AnbcjkBSNESv1iACBXkrVY67lRnfGtky3whDMeHSm4StULb0Pj+/uly+mbS3tbuzsjbF9uXN9cX7d/e39bLTbeLS3Wx5aeW/r4831lZ2d7efPn/WaFPPsru1O/0Z5sPbWodnRwenJx/v7pfmG3vLGzVQm7PVteuL04vzk+svt4KgbFufub+9PQ0p1ah3b/P6hM89i4Tp9m2+ka0vzy+miyT3BZKWTK07vZw6z9X1ta3N9WnIub55ur6aLdav7h/+rOKatEA+PW0WOtlY32kYZc1pQrq6vMp1LpYOnjwVQ+Py3Dy96Hmmv6aUfmdLN4XI/v7UcaTsFPY/AQYAVM4VTMddBr0AAAAASUVORK5CYII=", "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADIAAAAyCAIAAACRXR/mAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAABfRJREFUeNp8mWt66zgMQ28a9bH/jc1GZgNt0mbgwDnFgM7VD3+OIlF8ghR9uvz7z5/7uN1uPDXWWl9fXz8/P3o5n8+3+zidTnrq58vLi16+v7/11Ltmrtfrz2No2ctj6F0zWimap/swKU/qRfRNjY3b6SLHBgjBn98ZntQWuNcQdQkgzvTOdi/WSbfHgJqf7+/v8GqaqGN7mjtYsUpSbaVIrUclYsXK8PGWytx4Rv+mnlJCZDMDXiyCXr+YZYMoIrfPSHL+eXoML9NT5PJsxOOZijQdS5KWgcJmxLnTDCE6mrCUXqlJSwxnqBnWPVns+kVGNOvWKIb23mWfYA/bOKyczB5q25ktvdiaJlrqZCBhGnEesRtRA69MD/XxtceBiUbP9zGlKg3xFwtE1mGuNY50aO4ub+6mN2gPhgMaNHm5XHDnjO30kgojnAlF6vn29uboM9yYJn68jB92WK+AJ0uTyk8SDM1Y5RwMcFjrGMvEzevr66v+Sm7wM52yR2K6rbkpWfkJTiY4iRYMAYmId2hKgIoIS7P8ilIoChwntBjZUWSeBKwk0wU9yQeAkrFP+K884BmhdF5HECSceQq3kE3zBpTEOUxcAIs6tsCaxgK7E/QZoDxZLHcdCjaJaMi3KjwLhtYEwETzYvqQXPpQuXAhiP/Si+C0BOCsLcbTUQA0NHGYtnOeqiEBPf1yqhAffZZ5N7am3Noghzg0is4Wbk1L+Rhvga3yoXqWz2X0bIgjtIWQJdCsNKwzqJMyTh0pib0eOkakHAGuyTQpGWT0Iu4wRLswhNY33JrWJV5IBWl1xChZfTzIB01xlhWAXa3skJHr5LYmEIC2CISVD7Pe9LyJT5mOJoSmy17vYyX0pWIqEjlbWilx/ZczmJWRrG8WWSuzng1qOyR/CUC/dXqlCA4mIWapU/VqVr0z7BmZTKv+ycjbmM5aL4kiN8ZKv6myDKgDitNvprFApVn82PFX2cjPpFvVTrozeb1KyGSo3lFPomMSdGWxCvspl70N4TKAy7Hm9SbdvG5TFNlluEzYe701Xbsymrlx6HLVMd8Ug+bG4KQSD54APztG3Vky9hFpixLhSgFjaijRH5/jPbewPi9kCb+QlZlcNB9GtN+XAxUPwKsMBPPumsb9O6BURBf8zovxfue5l6yLiKu6AM2XnrMKLdyqVI2vVJnptkDW/lPO5dRb11EnjamSKWXpP22aoTorDpyh/MFjFZD+3msfKFyKZL5g00FdRR++RU1L4qNsL+Ddw8g+lAdj48O+SP3MEOGikSUhWcReQfEDi5DCPTa+S/mwkrW5JZ7JtbKHsQBn4DDaHvAH/sGWJxF10VWqJOgKgmujmSM+Ku6yp5WoRnPApi9koUOWufXsWzUAUZdSAAINgZaVRuqkagEJWlPa8r8Cd+6Pa9bUpgtAZGGIKYutGYnpDLNeyKI5L6GcvuoyVLDLZZD5KpqfdbN4Cs1Zn42diickvLpjU1cJ8gYNgkrJz+4/zxpSVAOst3fjPKn4Tf7UVsEgzNXFtW6UdAxnFZlFItAKLtTtKKX9/PzcfauylQ9zCp/ziS6W7M8oIaupOat+qSr7uRlYDrWVykwNgXsZRMDPvuVuDuc435LLTdENgVzOWp7gzbu2bB3306oDmP1PIgsn4xJRSDvvpbmSjneGVNY/W73FOjdecJfy6xxW2PT9SjseeYWZKX8WQnugpO3A8SwgK9VkTKUm6oBqdM80lTIk0gp+N+fLuiq/fGTaSZ5IZ1noWR6KlgzVrM8yANPtZtW0CK7UQSXpeV2eg3ti+fJh0ZZXhFpjn1uGzfxskT27ui0dHkPZSFMYXXLPnpXtDJF0ylUVD73y/LqRhIqb7OQcwikrsxNWrfUqGzcjVluWegY4rW4v3YRyYeEWGJZtVbros0atCMXxt8t++alTmPLrx8eHqJC/+IB4uV594P/y9x32Zmuv+p1iPTsROkWUKY/p/+59+Wwo1JdOmm/XOzcmbfVYMZz98lBt3tSNW/mZk6KUIP28D60UNPDh7j8BBgBq3suL4cOj2gAAAABJRU5ErkJggg==", "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADIAAAAyCAIAAACRXR/mAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAADkJJREFUeNp8WcuS28gR7DcADmckjbRehx1+3Oz9YX+UI3zxwTdH+GDvbtiWVpoHCaBfzqwCMZS0YQSHA4KNRnV1VlZW0T797U/GmHme7+5e55x7760Z7329uZliakteT8/OWOdNN6ZZ/BVr8c/EGEsprbVhGHCjaf37v//jV7/7TT0kfNsfTsvT6fjNvQkRH2utzjkMxr0pJTxuWM1pHO/evTv9+IOvj/FmqO5Q1qHn/2JkgAW4De/4gHfYZG2nWQYn2wGL1BQ55Xm/HOZyhMCpOE+MeHyRYbiIheq9Ov7q3IgLeMBqPLhz1rrNhhXjH5ZdeXAcb2m24BvnW+FhOw1TbwVnzdWxG8cpa6U/MKy1dV3V92r55wbpVd4hlhWj1lk+WmfHEqN4q+Kkd24QbILnohxYSY8RFvmwmdVrvjZod5isimY5sS/LId++uFaN25ch9zXZBLWYt3u56vQSTi7Ld+b/HpfxZp9an+fkUDDgwDA9ud7o61sIDmfkFowEeOW6qTpbwMpgE8zkYktXyOPgYq1rsmg4ijsv3krBfbF3u7c2hyhc1BWC8Z9dm7X6VXu56Po+GKBM+i+GwXQClJ7EpgaPiw1oC+F6E68nuvaEmkKrxD5Gj7rqc7O2GDJGPUp8tdxbdtg9x2jbzFKMw0+KDIJpe5h/AYTig07GxJ8ZtLsNdigci4Q2aMAWrAi70V4i+uqAWboYulki0crFvpkl2xyHUFqGvQAr5sKeOGyoAoPutI1/PWBb4QX4u2RbbUKoYn0uEhkAZZgKl+0MpjSDjW7toeUZEzrMVRh5xmMea6pZXRW+6QFhh4WX6pKtuLEnsMTGW4wg8aruYN8itWuIXDaALFHKCrNazc7ojnYsAO+gmHWdEe0+JGxArhkfPWyyfJTsznaiL910MicID+sFVJzbYzMoVIlriR2JALEycquNxZqUGrFEbIe3tjqCs+ouYHrHZbQYHfjcuooBcHbrqw89JdfzarFe2t+ZIZyMcdV1r9sqhLW9GIOBXghCTk2dhGM3rhH+ErEm00v4gw3wr67bbV68nHTPBeP5HWmqce8BLBeTX3JjHPOl02wfwYwav/BIXVfrMQNSWWgybViWRUlZYQtOV7NgrwZ7/xzetdGyWooXixCpoCq8Pz+fcDDZHRImwQlHPzwkicevj9bbdSDvMaFZh95SckMGVXiRHSQPvbDlJQ8KGrxsor9sIryLTbTHm7t6N0/TTUxTwASHI0nncCzzGc6Vl7mc8IXl6XMFW9ERBKAFb824YWvjG2WKy0dEp3Op1YIcqOgmVA1yOznZBrddRIwhEuUOZ1PJppwzMQHsQYA03B2dDQxjjCEusarkbEFKa4IZxRYg5rbsPmpO9OpAuE0NEoIwBeg2agIC+mIWmKFSY4DnjORsYNAEpgw8L8YhpdHEgbloqDGmTF9iBQHrJewbnB0kbnwcU6V7BD/zGR4zAygEAKBfyB54AZdrbYXsAypyOPfGr+c1WCwKQRnpFHhKYQ1XAPhwJAIQD0UigAcswiwvbY4gpTzj5NPp4+hh95LLudQZJ3iIniCM5vMy57UisEBhBnKtwqHgRDBjNyUoY+km7lmsXR3EGdzDN7J9xSrgok2GKPNzB5d5QUwBsPquQIYndDcU1HuCkqRE0gKgb25uvF/NOALmZd1yQbBXx3VW+SJdbPAnNdi+fSvvjgnWSKCM46hIUEho9EDj6bK/SD4YAKrEAkAFAdbH6PXRFntWg0oRVSb6+F2iqCN3raLPkxygp3KLx/YSfWkcd+GgvgdGRb1twfRFdteHqlnAVwAPiBYFqnFH2CXUtUD7wk/XBMMNAupr06Qq0pdmQXDo4+EzmK50qKGtRPiFz7C/fRzgs8PhkGIxw2AFKpILRTTvwNJZFAS4vgvOdoEF5szI6Bez+CTsqQPc+ml+BJ2qjsBd5/MZ3sIkEAEbJ3+uTmFWjWErI+omCPmGUEWG2CF/7eS9iPgabYonI1JANpKuQnTe3d3BTxiM1eucgDMGLHneAXC9ITHELL7HAvJyQlwMiQkQPEezNAkqpHYwCTm6iw1uH4CEM8SB1EgGeTGL2PKgCoe9gxvalnSDbIq/hsR+DqNBqTozcwr8ulEBX6InCBCKFU+soM6h7HAqIVTeitqQPeht3urEKjTPokjKtF4T00HPG4YM198KCFVQL6mW/IzRLUKLzyYmLAXipddgpkM9+hJnVwaDzCWQvzhjIy31EDgQaat1sBvoDmqxGFH0VvWB2RS0AFEjy4OP17IEMlrLtax5wbuNoo9EcgPDIjloagBDY1gB2507mC6MHvaFWOnsEvZ6V2VGqWWDAtbVKzgfK+KiqKxotN8j1O6Y038IjhX0baEyKV2gi7KkQlmqEzbuVfQNJRcG46Zh8Ld3hzjUARNbJLYlBbo+KBWJdpC6qm/lVDELnoQ9lZdsrmyq6Reg2M/gAjo0EE2Q30PU3ACxha/WBuZmSjE6iUhLfAwRXy2n0/L0/DGBTMJhmIYQBkvqagFRrRwBHzF1lIVlNGZK5DrAViGsxAGLy3qpfLaQsKqsPy2PBRuwnpukrvMJO2gArekQfrbehKQ2o0XY9vt7mOWqR8Ja1nOCCMdz8cVFcjEiYvWIEdJmz4Jk4pRQVczB+z3bl9SzBSO9NU69Y7kuxYHbfQiH6XZZmGAYGE11t1PVhY/wKkXQefnw/uOQ6006Qp15aCSqjL7lRMGNUX8ouwDCEDgQJ4wLCXUd6dOW9fpepItZzkNFYtehPzyJB2tNB8SNln4Eu9GKC/NTNtZiMBVuGrB5rg/xgFp0qX0ME+qVsKewnVH0YyXGjRRATl69SRy6rqlTNKaAXks6UQQcLP2VLrHBIPUqmhtXLLqNY3AHymYwFPTG6XSuax+OUwTIReiStypVqE/jALadhqGtjmq2mjTF9+9/mobXYIflnCV794IypvWv6VEqighL81xHiC/UJ2ZtIzgu33gSiTYBSJtkCMClLetDNymkYaRFcxwKF9hQ2Z8NalXpTNDOwOoe6/B0e3BAbgjblm4nlIwumPR1j4SDGIqs8VOKSAJMAzEybbdlEyZa4xurJVZCrgwYaeCO+fRxHc7Tm8lME6CFQgHZlB0QoAExGKQVwhJZemAW6O65iTbjEpGkwdbN/axZIGdRAIW9IK1OW937RFeabvtPEQCmkBSGGk5zPICGByIrwEXCW8S6ArlKpDRduvZ3JAgFtaZ90Rh6ET8tx0Ciqi1vxbGovGA1Pci0RJ2RJgKU/rRaRWGX3oUX1bRi2+CvwN5BV1AzRoQOrDA36ae3rfA1hVODhq+7gdcOq0yjgKwRLVSkZVqRf4Z4EQ7ybi8sjDEW2i/54/E4VDO4BE0CVNN/jv0tI10vWI5awYmMZtpCom7l7MAvkTUtexgYU439qjF0EcFeO4gIDHZfsPoQRKAWzYmiZlkuwXS82A7GkxCPnfIf8RQ5SbBtBnJC9IfoI3fRtq3io1qocGZGikM+TFOrZxoaESZOi/GvgxHQMMIsIyDfEfJ0zwCsrPnSzBQauhTZw5hOpQHvDw8PcX0qMY0RKvI29hl2BjKbMAIKFjAswkKDORfz/v2Hw/RqHA/Pz88wa5zCsswvufpz41jNlfXx4cOb2yOme1qWV7Wf1jzZqgDvZuueqeid57kYB1vevXt3519764u7ORE2DKwwpTdujGYcaphQ9KUJWYdNdnezmB++f/3ta7b2DkeV0TEc7sZfmb5Xa9LVlIane/XtcHf76sN/5tNjK/Xbbw7x1f38/Q/MyGTnAhqA9dM0nJ7rTz+tv//NvYGzPj389c9/KQ+Ph3H67R//cPvLX6wFWrKFjw//SsuQ1vHp6RPLKZbrqAURBShGl9PT0670NeI+Pfzz4idVLJvPoEvre/P4038HD4lWPz6YV+6+m6duxg54+RYSdrMizqyv46E+PT35g3/79u133303gOSsG+/fFGa2OTQUZG5hl46QPDOt2swy2/Xbw9v7u1s4kL2eVncxY8e8CXz70sGmCHavvMO7jSwRPDJQ8m5gvQesFHzlQpUmLVnwaMPBH4on2DE5smmQunLN+ThQIIVpGBEeSJoL6NkjHr0kvZKXM+bCPwFrvVSIfWuQd3P5CaJp139I9wlpyibPwrCyHQL2yXah/qToAEGKQCqqOotjLspKQ459G+uZ5FEQYXgAxUCRQhhAFUMldJYj8rtOOMcEblyEQ6toSppVZhUdXRIJOzJkYIt7EXK51DOmZ3+iQL/PENzRTXjolicwD/sspCPaOrJ7NUFZtQ41wYKMzcbBWZBwk9qwsWKgImEzkx3FADn76jaNiRxYRPlAtxTI7bRXZXsU0lw3pWmcVnZncYFq5fZNWN0UQP7aASXTSuNJ2nou9gQnZITk+fmEdYCczGFK6Sjd97i6fuavKSGz4DLVg9p7fl6JpHNhlYfEC9e4yKzOOCXEkLisGsRdgH/dEfHePaqaJn155JCQK1Y0V/lRTdvrXoRNBiXCMfCJEc7YamMkR1+WMxsFrT0ieNfSULQA8TWvEZlmzW56q20IgLcIESAOWI9QtXLNVjvQFDryE1J6OLfTKb9Pganucf5wTM9L/zT1gzCIFtbVsxICJ59zJosj4TD8U9KmGiqliLodKmn1kz+M2OKcn5mzQxPK7qOpP/7w729++WsoNmlBtVgdYrK5iWZRyumvKVWrjZBHFFk+3tnTwkx1Mzn/eqQmJZFC6ra8aosMm8bfB6BrwvQ8P6/LeXTz+TTf3Uwmj9atLH29PTbmwknStTduSxQ1n2tOvSJOo2FLE14H50Qj4FA5urdi6H82liMrPelcW6Q3niO1jh5Ez9iVFAe5alAgZbhAcmbQfoQzlyYPs3H5nwADAP/upUmMy6b8AAAAAElFTkSuQmCC", "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADIAAAAyCAIAAACRXR/mAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAADjlJREFUeNo8mctvVNcZwOfO3JmxYxuDbUwMBAwmVCBICotIVaJWXWdXqd112W7yn+TfyLJqlSqbVkStKqJU0FaVGqHwMDZ+4bc9g+2x593fd3723MX43nO+872fx9mP84u9Xq/RaOR5PjQ0xHuz2Tw6OhobGxseHuaFlfHxcV7K5TJbrVa7kp4sy0ql0rt376rVarvdZrfVagHGO3hGRkb6/T5oi8Uip4rpAR7gQqEATKHQb6UHKsCDB4rAl8sVALIfnr+CMDRqtRq/Fy9eBPX+/j5woOYAiOAYGufPn19ZWSmV8vfee48joIbd4+NjtkrpkSQrEHPFTwAUgyMwhwCs93pdGGLx4OAAQp1Op9vtQg6xYSDf2dnhD99LS0swe+fOnZH0wOXh4SHnQcpJ8MIWkEjC7ujoKACQFB2MAix5GVI3/IKznR44AJJf2EKqjY11kIBzb2+Ps7C4u7sLtuPjE/DkH3zwAdgvXbp0//59lITEKv/cuXMoH0Qq5uTkBDDUtrS0XK/Xp6amoColwOQP7gFGEpiDNluoDY4Bk3tdAswATE5OsqumkRDMFy5cgEV43dzczL79x3fr6+tQhTMNceXKFQ6rWI4BB1tra2scg4ONjc2trS3UwKfWVNnQbqaHI9qd46DVe4AEoe4BAGDj4+dYhEXXeUdUPGd1dQ34HEfj/PLyMjoEC/pcXV1lBUq69vvvvz89Pa3ngmVm5jLaQiw0BLy+wgNe6HEQPhBDkTgOi+iJIyoGYaDIyubmBmffvn0LW8gAZxwEGIDt7e3s6X//BzHFghKGYA8yCwsLKh99oHDMinXQHJGCWBpC5QPAKdyfUwaHZgUh5GGFFRjlLNhULVv1eg224AC0wGhx0PZ6AZz94etvsBpIwTXY5hNG2YYeJjbEzgK2rpNhdGgAibh4A2oGDLx4MSvAa1PkwTSYAtPAB8jZBUOWAVIg8BMrPZhmMbHejQTx29//jg1MAHPYS4cFddYLF+EdEQ0rI65eO4Qn3MusA99JheVCdur72IhT+OLExATv1coodoFpTnHc3AGq8fGxN2/eAI/uUWckhTyX6dD6L37+SwjjiYcHjaWTFfTBdre7OFypcgCM+gqcsY4A/X6kosuXL0MbKSGAPlI+rEsPMOQZHhoxERDK4GdReL2CI63WiQnsID1QAQDB8Da4zF69WYUqXsIB4EzcyKEDwg2fIOKdX7BPTFxgBXWyhaFBYcwTABxHKqNYBaf8tKHtUBXcu56CZpddWCGeXDFuTEbZn775K0jhCQm0MZ8Ire14GXCMnjlA6jaZgcJTZ1opwJMBy4opA2H29nY8yzpgeNjMzAxUoIDPCAZCg5oHL0R5+fbmVikrRgo9POJ78fUCKuFwPyugEmKQk6ga1zZC5+df6M6IiOsAg3zJuTvqAw5gFzWgIUjOzd1ETsONRZwMxTQaR5ZLczVgkdnz3BQdZpm7NWtZvf2TOc6TkAirEK7V6nTa6+ur5jMjDs5uzs0CDENmBxYBQPr1t5v4OPJAGB5NB1Zx+KPEoRKcVUNzsFwp1d/tA2kpC+aK/VIepalYGsn++OevbRnwbs2sMtvdSIy8mDaRAHrJji2QXr9+PfTT6QBPVKKnRuMQAoABLDG2othXR5HhrPtouQva6lAZUZEQdtm1mOoS4M/uf3zXpKyfAhS5P88b7VMzgQUf1wqRPLuRke1qANblwxFLHYMAGBBChhd8oFQc1ueMQbNrxFqWwSXIsbsFdAATZfTC9AQMYW8RAWc49HuZWGBIl9ed+4UuvEJeRvUM3dY6nafHvi0qxyEKyNutTilH5l6hH1mU9ygh7cicxVI4VqTQ8Kp+VsopYfmDBw8sXmG4dhtKoAs1FkqmdfWhP0bNL3RN+koMx4X0aDWNCIus8IJeq3nZLGOK4V1yvOvmZ+1XfEYjdNIK//vb47/rQxwjElGVNJonbUVXsZ7RMXkiVBNbVkDcjpA0z5n9gcQp8ZVLUxcB0P+MZTMFmCVqhygVXja3I0FkjVazUq7U6rXz4+ePGtHyepisnlihXWnpEGGLdqde34cq8aFlAYY2OVMBoAR5y5HG3d3eRnlUERycdeTRI3mBb4uHKj81fbsbpeLRo0cENsfoB/UkMKKtdrtroLGC53KgVmviguQm8WosUzP0QMqKQtsgoZXQ2dGRVYXUQ2HRXy2ONptICImh9LDS6YVBKSZTEFtYePPDD88QnZIOpdnZ2UplCGWG70dbEhLwSUqjDeMddKQrixJM2xdhx0SjmL7CjsF3Xq2Uq3mp1e10jw6Pbe1hC+W1mp167YBfyxfaKfSLqWKeZOvbO6DAJYG2IyP1IdCdO3d3dnb300NhtpaBdGdnyzHJTh+GKCZs0Tkpuq7dimwcnSDJETWYyVixJIBNC+id5kUbz5N2JzKUMYhL8uKgwnkUvr29o2R2XRwjL0A+ZEphCF6EhmlWUDC4YNf+RD5QLbt5Vkx9R9/hAPlZVJFYxubMwNRldbVsdWMbZrEI0Midupquw5NZkQNowsaLdbCD2iQXwqUsQHmAdV4gA5dwrGJYqZRykNtwUxsQ+Msvv3z8+PEnP/vk008/ff369e3bt+Fmfn4e6vTr08PRQsYZzkPJyiAf9p8WaWtAZLIswwvRgW0Wi9YrtBj5KY0V+gDY7HKBb580bVbNFzD9+eefE17lofLDhw8R4KuvvoLQ3NzcZ5999uTJk788ecrB3NTnAPPq1SvYunr1KhYh5s3sllJO8gsfhgxHbBBUGLxCwDGBR5+zbTwqxHQalJI7IuSNGzcIqU6/Q7GHiv3Zs2fPkBDm/v3ddw8ePsge//OpCQ0mkBKZaIP4xHC2AIRMJz2AqVewwxnrdiaDsuMIxFkbc30ZDJG9dnf1jcGwZAVj5cWLF8+fP2cXdmF9ZnLyo48+yr5/+h/cAhT08nbAIDIwbWDUJd4NOvQBAEodRICRhbg0LbgwR5AHSGQAAH897c3zPNw/mtsJXVk1T6WHcRCi9o9UvaKp3JqKSs2HuoJXEhYZC4UByMCj28m3GdzOUZtCBu4dhDQc3oYFnCCQChiENP3i417DpMF4AxLwfcoWfDj8OHiwgRXwVhsP883i4qJtmQUHAFDwwi4+ASUUjCRj6YE/uOmlx4GaJmskleX9Wi3yBZHU6uSl8lA1azXb++1QwZXLVyPyUgKP5slqADorFHYxjeEfMGfNt+G0KYUhU7wtqAMgOoNjhyjksQljVFldWyMRgJNcYLU1jRWzqJ4sol0C0yhBI0tvV6ImLi0vf/jhh+sbG8srK9YQIvE0adFTEDudaNInp6Y4E6yMjaEh3BFzwFBkE+YO+tVrs1gWqWKi6kWNYxcFXE2l1l4PYTiF4qOiDw9HPeh3d/d2Wu2mBS18ptNlI7e1oLzYTg1cfnB1hsKcjwHQgfbSAyTBCK9gxGenp6bN9ZrYGx69zcTLcZItMJbaUupqDGQsTjxC7t69e6gN6rlkbIg1oj1uNT1OSDqvXZHXLyQw2OW89TEajayP0J1uDLqVapkX4KcuTh6lYd/rNX4RA2AUU0pXX/ZesEtS8HaomSbKiNgAsk9PXQeErcq4HaLgZ+QOO30TmHGHOr1tA7UXWt7J2KxahgFeWlpCbMJCvQKvpkdTN4u+HR1AZb/ESygYF7Z0m/fYU+0mIcdXq7g1Ue7xazMq3HsfcfDuHXwjt/nM+HcO8xpncOmFSoD/9tEjGLp7966RzgqCsVVNZb70q1//BqqwbxNsDkPt6ByMDnr6sgkM4MEsDxYlSVMyQzpVj4yFsUiJ2dBQleluY3PLCzpv4cz7yHx5Zgb9WU6g5UyWJQfKLVvg3U0P56EXs3aewxmgXo0MenZ+sYL3jqoEiSlw0ZEeR0FcX1/HarxAmLNguHXrlt2pUx0YMKKjm2bx8lL3YGsk3Tac6sAqZiXxjtlcSg22y/ayD254wawmM++9dcRzYyOk8jTHNiw+mqaUV0ytTgn6flyMpf4WQggGQtIKLgHYyupqjPz3fvqxZcE5SVUrDQfgSefwauBs1ih7xAsmddDtnQ6MTnz+Ri3vGgOniz4WrsGnaXIQLtFWYVojSMKi9orHgm1YeQPgBKH+Bhfa9l7nxkftObW4U3KEZ++UxcEjKvHw4qIzJvDwFMHxxRdfOElbVtV/uhZrDYZpBw1bVlk3AvRfgh/97+5tm1PSZVNEPlEZwV+qGB+OwY6cYCBgvdQwq8koTZsUs7dbgc5soVtAEvMP7s0cy1SPjiheHuBhgjhNtxqH3nKbnNCEOI+Pmxq6mx7HYK+cvSgAiRkA/ggUjkTgK58p0eSu99heOomrbROHfJuibJ68brCfibqRTqljPsfHLww8RCurNv91YFIwejQFgYz6yUOMo/2k/2PlUDJC3VYObRmbRqujZrqH7qZRopviN9o1YLxzPwt+SLb29+s6uxZUQh5qRKq0bfWHdyHA5ORFvDcE9z8tNr66nldctHt8egWFAuyuWH/58iXKoH3jk9abHAO7qfjE/7dsdK3Zlud6veYUZBBYsmwLbKwd/y1iyEP/EtVz/s2Kdd5AG3iP92wmKnnVoKCYnDy/uLhM6ht4IZzt7+9CydYZ/rxkR3nwM0gNxqyjFOOX1452Jf4nCxL4RkTu4+//FWFcCMOncpZR7+Ku9qiJwsTl3AJA1K9uExWm0SsuiUHXaZ9eSdD1LizE1St5H/t6kzg8bC8fXt/utNbW1nAPVHxj9pa8ohH/K8M7XPaTCNmPLxfjdnpk+Ox6rcRezPvFivkGPaESZGI3bv3LmTcth4eNa9euxdVN+/RS1B4LqXBbAG7evJlajEai2kq5oUs2hzNy+/VrNwcjkCFidW914gLr/wIMAIJk/ijZRA/fAAAAAElFTkSuQmCC"]; var g_sWordPlaceholderImage="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAMgAAADICAIAAAAiOjnJAAAAAXNSR0IArs4c6QAAAAlwSFlzAAAOxAAADsQBlSsOGwAAA5dJREFUeF7t0rEVgkAAREG4BgjpvzvJsAA9DSiBHzFbwAb/zTrnPN7fxRS4r8C+jfV1fu479KTAVWAooUBRAKyiqs8FLAiSAmAlWZ2CxUBSAKwkq1OwGEgKgJVkdQoWA0kBsJKsTsFiICkAVpLVKVgMJAXASrI6BYuBpABYSVanYDGQFAAryeoULAaSAmAlWZ2CxUBSAKwkq1OwGEgKgJVkdQoWA0kBsJKsTsFiICkAVpLVKVgMJAXASrI6BYuBpABYSVanYDGQFAAryeoULAaSAmAlWZ2CxUBSAKwkq1OwGEgKgJVkdQoWA0kBsJKsTsFiICkAVpLVKVgMJAXASrI6BYuBpABYSVanYDGQFAAryeoULAaSAmAlWZ2CxUBSAKwkq1OwGEgKgJVkdQoWA0kBsJKsTsFiICkAVpLVKVgMJAXASrI6BYuBpABYSVanYDGQFAAryeoULAaSAmAlWZ2CxUBSAKwkq1OwGEgKgJVkdQoWA0kBsJKsTsFiICkAVpLVKVgMJAXASrI6BYuBpABYSVanYDGQFAAryeoULAaSAmAlWZ2CxUBSAKwkq1OwGEgKgJVkdQoWA0kBsJKsTsFiICkAVpLVKVgMJAXASrI6BYuBpABYSVanYDGQFAAryeoULAaSAmAlWZ2CxUBSAKwkq1OwGEgKgJVkdQoWA0kBsJKsTsFiICkAVpLVKVgMJAXASrI6BYuBpABYSVanYDGQFAAryeoULAaSAmAlWZ2CxUBSAKwkq1OwGEgKgJVkdQoWA0kBsJKsTsFiICkAVpLVKVgMJAXASrI6BYuBpABYSVanYDGQFAAryeoULAaSAmAlWZ2CxUBSAKwkq1OwGEgKgJVkdQoWA0kBsJKsTsFiICkAVpLVKVgMJAXASrI6BYuBpABYSVanYDGQFAAryeoULAaSAmAlWZ2CxUBSAKwkq1OwGEgKgJVkdQoWA0kBsJKsTsFiICkAVpLVKVgMJAXASrI6BYuBpABYSVanYDGQFAAryeoULAaSAmAlWZ2CxUBSAKwkq1OwGEgKgJVkdQoWA0kBsJKsTsFiICkAVpLVKVgMJAXASrI6BYuBpABYSVanYDGQFAAryeoULAaSAmAlWZ2CxUBSAKwkq1OwGEgKgJVkdQoWA0kBsJKsTsFiICkAVpLVKVgMJAXASrI6BYuBpABYSVanYDGQFAAryeoULAaSAmAlWZ2CxUBSYOwbW0nZJ5/+Uf0Ahm8Ksdfm760AAAAASUVORK5CYII="; var g_aTextArtPresets=["textNoShape","textPlain","textStop","textTriangle","textTriangleInverted","textChevron","textChevronInverted","textRingInside","textRingOutside","textArchUpPour","textArchDownPour","textCirclePour","textButtonPour","textCurveUp","textCurveDown","textCanUp","textCanDown","textWave1","textWave2","textDoubleWave1","textWave4","textInflate","textDeflate","textInflateBottom","textDeflateBottom","textInflateTop","textDeflateTop","textDeflateInflate","textDeflateInflateDeflate","textFadeRight", "textFadeLeft","textFadeUp","textFadeDown","textSlantUp","textCascadeUp","textCascadeDown","textArchUp","textArchDown","textCircle","textButton"];function fSaveStream(oStream,nLength){return undefined}window["AscCommon"]=window["AscCommon"]||{};window["AscCommon"].g_oAutoShapesGroups=g_oAutoShapesGroups;window["AscCommon"].g_oAutoShapesTypes=g_oAutoShapesTypes;window["AscCommon"].g_oStandartColors=g_oStandartColors;window["AscCommon"].GetDefaultColorModsIndex=GetDefaultColorModsIndex;window["AscCommon"].GetDefaultMods= GetDefaultMods;window["AscCommon"].g_oUserColorScheme=g_oUserColorScheme;window["AscCommon"].g_oUserTexturePresets=g_oUserTexturePresets;window["AscCommon"].g_sWordPlaceholderImage=g_sWordPlaceholderImage;window["AscCommon"].g_aTextArtPresets=g_aTextArtPresets;window["AscCommon"].sChartStyles="";window["AscCommon"].g_oChartStyles=window["AscCommon"]["g_oChartStyles"]||{};window["AscCommon"]["g_oChartStyles"]=window["AscCommon"].g_oChartStyles;window["AscCommon"].g_oStylesBinaries=window["AscCommon"]["g_oStylesBinaries"]|| {};window["AscCommon"]["g_oStylesBinaries"]=window["AscCommon"].g_oStylesBinaries;window["AscCommon"].g_oColorsBinaries=window["AscCommon"]["g_oColorsBinaries"]||{};window["AscCommon"]["g_oColorsBinaries"]=window["AscCommon"].g_oColorsBinaries;window["AscCommon"].g_oDataLabelsBinaries=window["AscCommon"]["g_oDataLabelsBinaries"]||{};window["AscCommon"]["g_oDataLabelsBinaries"]=window["AscCommon"].g_oDataLabelsBinaries;window["AscCommon"].g_oLegendBinaries=window["AscCommon"]["g_oLegendBinaries"]|| {};window["AscCommon"]["g_oLegendBinaries"]=window["AscCommon"].g_oLegendBinaries;window["AscCommon"].g_oCatBinaries=window["AscCommon"]["g_oCatBinaries"]||{};window["AscCommon"]["g_oCatBinaries"]=window["AscCommon"].g_oCatBinaries;window["AscCommon"].g_oValBinaries=window["AscCommon"]["g_oValBinaries"]||{};window["AscCommon"]["g_oValBinaries"]=window["AscCommon"].g_oValBinaries;window["AscCommon"].g_oBarParams=window["AscCommon"]["g_oBarParams"]||{};window["AscCommon"]["g_oBarParams"]=window["AscCommon"].g_oBarParams; window["AscCommon"].g_oView3dBinaries=window["AscCommon"]["g_oView3dBinaries"]||{};window["AscCommon"]["g_oView3dBinaries"]=window["AscCommon"].g_oView3dBinaries;window["AscCommon"].g_oChartStylesIdMap=window["AscCommon"]["g_oChartStylesIdMap"]||{};window["AscCommon"]["g_oChartStylesIdMap"]=window["AscCommon"].g_oChartStylesIdMap;function fGetAttributeString(attribute){if(Array.isArray(attribute)){var sResult="[";for(var nIdx=0;nIdx0)version=_version_num_str-0;read_main_prop="";while(true){var _c=isBase64?base64_ppty.charCodeAt(index):base64_ppty[index];if(_c==";".charCodeAt(0))break;read_main_prop+=String.fromCharCode(_c);index++}index++;if(Asc.c_nVersionNoBase64!==version){var dstLen_str=read_main_prop;var dstLen=parseInt(dstLen_str);var pointer=g_memory.Alloc(dstLen);this.stream=new AscCommon.FileStream(pointer.data,dstLen);this.stream.obj=pointer.obj;var dstPx= this.stream.data;if(window.chrome)while(index=srcLen)break;var nCh=DecodeBase64Char(isBase64?base64_ppty.charCodeAt(index++):base64_ppty[index++]);if(nCh==-1){i--;continue}dwCurr<<=6;dwCurr|=nCh;nBits+=6}dwCurr<<=24-nBits;for(i=0;i>>16;dwCurr<<=8}}else{var p=b64_decode;while(index=srcLen)break;var nCh=p[isBase64?base64_ppty.charCodeAt(index++): base64_ppty[index++]];if(nCh==undefined){i--;continue}dwCurr<<=6;dwCurr|=nCh;nBits+=6}dwCurr<<=24-nBits;for(i=0;i>>16;dwCurr<<=8}}}}else{this.stream=new AscCommon.FileStream;this.stream.obj=null;this.stream.data=base64_ppty;this.stream.size=base64_ppty.length;this.stream.EnterFrame(index);this.stream.Seek2(index)}this.presentation.ImageMap={};this.presentation.Fonts=[];this.fields.length=0;this.LoadDocument();if(AscFonts.IsCheckSymbols){var bLoad= AscCommon.g_oIdCounter.m_bLoad;AscCommon.g_oIdCounter.Set_Load(false);for(var nField=0;nField0)AscFonts.FontPickerByCharacter.getFontsByString(sValue)}AscCommon.g_oIdCounter.Set_Load(bLoad)}this.fields.length=0;AscFormat.checkPlaceholdersText();this.ImageMapChecker=null};this.LoadDocument=function(){var _main_tables={};var s=this.stream;var err=0;err=s.EnterFrame(5* 30);if(err!=0)return err;for(var i=0;i<30;i++){var _type=s.GetUChar();if(0==_type)break;_main_tables[""+_type]=s.GetULong()}if(undefined!=_main_tables["255"]){s.Seek2(_main_tables["255"]);var _sign=s.GetString1(4);var _ver=s.GetULong()}if(!this.IsThemeLoader){if(undefined!=_main_tables["1"]){s.Seek2(_main_tables["1"]);this.presentation.App=new CApp;this.presentation.App.fromStream(s)}if(undefined!=_main_tables["2"]){s.Seek2(_main_tables["2"]);this.presentation.Core=new CCore;this.presentation.Core.fromStream(s)}if(undefined!= _main_tables["48"]){s.Seek2(_main_tables["48"]);this.presentation.CustomProperties=new CCustomProperties;this.presentation.CustomProperties.fromStream(s)}}if(undefined!=_main_tables["3"]){s.Seek2(_main_tables["3"]);this.presentation.pres=new CPres;var pres=this.presentation.pres;pres.fromStream(s,this);if(!this.IsThemeLoader){if(pres.attrShowSpecialPlsOnTitleSld!==null)this.presentation.setShowSpecialPlsOnTitleSld(pres.attrShowSpecialPlsOnTitleSld);if(pres.attrFirstSlideNum!==null)this.presentation.setFirstSlideNum(pres.attrFirstSlideNum)}this.presentation.defaultTextStyle= pres.defaultTextStyle}if(!this.IsThemeLoader){if(undefined!=_main_tables["4"]){s.Seek2(_main_tables["4"]);this.presentation.ViewProps=this.ReadViewProps()}if(undefined!=_main_tables["5"]){s.Seek2(_main_tables["5"]);this.presentation.VmlDrawing=this.ReadVmlDrawing()}if(undefined!=_main_tables["6"]){s.Seek2(_main_tables["6"]);this.presentation.TableStyles=this.ReadTableStyles()}if(undefined!=_main_tables["7"]){s.Seek2(_main_tables["7"]);this.ReadPresProps(this.presentation)}}this.aThemes.length=0;if(undefined!= _main_tables["20"]){s.Seek2(_main_tables["20"]);var _themes_count=s.GetULong();for(var i=0;i<_themes_count;i++)this.aThemes[i]=this.ReadTheme()}if(undefined!=_main_tables["22"]){s.Seek2(_main_tables["22"]);var _sm_count=s.GetULong();for(var i=0;i<_sm_count;i++){this.presentation.slideMasters[i]=this.ReadSlideMaster();this.presentation.slideMasters[i].setSlideSize(this.presentation.GetWidthMM(),this.presentation.GetHeightMM())}}this.aSlideLayouts.length=0;if(undefined!=_main_tables["23"]){s.Seek2(_main_tables["23"]); var _sl_count=s.GetULong();for(var i=0;i<_sl_count;i++){this.aSlideLayouts[i]=this.ReadSlideLayout();this.aSlideLayouts[i].setSlideSize(this.presentation.GetWidthMM(),this.presentation.GetHeightMM())}}if(!this.IsThemeLoader){if(undefined!=_main_tables["24"]){s.Seek2(_main_tables["24"]);var _s_count=s.GetULong();var bOldVal;if(this.Api){bOldVal=this.Api.bNoSendComments;this.Api.bNoSendComments=true}for(var i=0;i<_s_count;i++)this.presentation.insertSlide(i,this.ReadSlide(i));if(this.Api)this.Api.bNoSendComments= bOldVal}if(undefined!=_main_tables["25"]){s.Seek2(_main_tables["25"]);var _nm_count=s.GetULong();for(var i=0;i<_nm_count;i++){this.presentation.notesMasters[i]=this.ReadNoteMaster();this.presentation.notesMasters[i].setTheme(this.aThemes[0])}}if(undefined!=_main_tables["26"]){s.Seek2(_main_tables["26"]);var _n_count=s.GetULong();for(var i=0;i<_n_count;i++)this.presentation.notes[i]=this.ReadNote()}}if(null==this.ImageMapChecker){if(undefined!=_main_tables["42"]){s.Seek2(_main_tables["42"]);var _type= s.GetUChar();var _len=s.GetULong();s.Skip2(1);var _cur_ind=0;while(true){var _at=s.GetUChar();if(_at==g_nodeAttributeEnd)break;var image_id=s.GetString2();if(this.IsThemeLoader)image_id="theme"+(this.Api.ThemeLoader.CurrentLoadThemeIndex+1)+"/media/"+image_id;this.presentation.ImageMap[_cur_ind++]=image_id}}}else{var _cur_ind=0;for(var k in this.ImageMapChecker){if(this.IsThemeLoader)image_id="theme"+(this.Api.ThemeLoader.CurrentLoadThemeIndex+1)+"/media/"+k;this.presentation.ImageMap[_cur_ind++]= k}}if(undefined!=_main_tables["43"]){s.Seek2(_main_tables["43"]);var _type=s.GetUChar();var _len=s.GetULong();s.Skip2(1);var _cur_ind=0;while(true){var _at=s.GetUChar();if(_at==g_nodeAttributeEnd)break;var f_name=s.GetString2();this.presentation.Fonts[this.presentation.Fonts.length]=new AscFonts.CFont(f_name,0,"",0,15)}}if(undefined!=_main_tables["41"]){s.Seek2(_main_tables["41"]);s.Skip2(5);var _count=s.GetULong();for(var i=0;i<_count;i++){var _master_type=s.GetUChar();this.ReadMasterInfo(i)}}if(!this.IsThemeLoader){if(undefined!= _main_tables["40"]){s.Seek2(_main_tables["40"]);s.Skip2(6);var _slideNum=0;while(true){var _at=s.GetUChar();if(_at==g_nodeAttributeEnd)break;var indexL=s.GetULong();this.presentation.Slides[_slideNum].setLayout(this.aSlideLayouts[indexL]);this.presentation.Slides[_slideNum].Master=this.aSlideLayouts[indexL].Master;_slideNum++}}if(undefined!=_main_tables["45"]){s.Seek2(_main_tables["45"]);s.Skip2(6);var _slideNum=0;while(true){var _at=s.GetUChar();if(_at==g_nodeAttributeEnd)break;var indexL=s.GetLong(); this.presentation.Slides[_slideNum].setNotes(this.presentation.notes[indexL]);++_slideNum}}if(undefined!=_main_tables["46"]){s.Seek2(_main_tables["46"]);s.Skip2(6);var _noteNum=0;while(true){var _at=s.GetUChar();if(_at==g_nodeAttributeEnd)break;var indexL=s.GetLong();this.presentation.notes[_noteNum].setNotesMaster(this.presentation.notesMasters[indexL]);_noteNum++}}if(undefined!=_main_tables["47"]){s.Seek2(_main_tables["47"]);s.Skip2(6);var _noteMasterNum=0;while(true){var _at=s.GetUChar();if(_at== g_nodeAttributeEnd)break;var indexL=s.GetLong();var notesMaster=this.presentation.notesMasters[_noteMasterNum];var notesMasterTheme=this.aThemes[indexL];if(notesMaster&¬esMasterTheme)notesMaster.setTheme(notesMasterTheme);_noteMasterNum++}}}if(this.Api!=null&&!this.IsThemeLoader){if(this.aThemes.length==0)this.aThemes[0]=AscFormat.GenerateDefaultTheme(this.presentation);if(this.presentation.slideMasters.length==0){this.presentation.slideMasters[0]=AscFormat.GenerateDefaultMasterSlide(this.aThemes[0]); this.aSlideLayouts[0]=this.presentation.slideMasters[0].sldLayoutLst[0]}if(this.presentation.slideMasters[0].sldLayoutLst.length===0){this.presentation.slideMasters[0].sldLayoutLst[0]=AscFormat.GenerateDefaultSlideLayout(this.presentation.slideMasters[0]);this.aSlideLayouts[0]=this.presentation.slideMasters[0].sldLayoutLst[0]}if(this.presentation.notesMasters.length===0){this.presentation.notesMasters[0]=AscCommonSlide.CreateNotesMaster();var oNotesTheme=this.aThemes[0].createDuplicate();oNotesTheme.presentation= this.presentation;this.aThemes.push(oNotesTheme);this.presentation.notesMasters[0].setTheme(oNotesTheme)}if(this.presentation.Slides.length==0);var _slides=this.presentation.Slides;var _slide;for(var i=0;i<_slides.length;++i){_slide=_slides[i];if(!_slide.notes){_slide.setNotes(AscCommonSlide.CreateNotes());_slide.notes.setSlide(_slide);_slide.notes.setNotesMaster(this.presentation.notesMasters[0])}else if(!_slide.notes.Master)_slide.notes.setNotesMaster(this.presentation.notesMasters[0])}}else if(this.Api!= null&&this.IsThemeLoader){var theme_loader=this.Api.ThemeLoader;var _info=theme_loader.themes_info_editor[theme_loader.CurrentLoadThemeIndex];_info.ImageMap=this.presentation.ImageMap;_info.FontMap=this.presentation.Fonts}};this.ReadMasterInfo=function(indexMaster){var s=this.stream;var _rec_start=s.cur;var _end_rec=_rec_start+s.GetLong()+4;var master=this.presentation.slideMasters[indexMaster];s.Skip2(1);while(true){var _at=s.GetUChar();if(_at==g_nodeAttributeEnd)break;switch(_at){case 0:{var indexTh= s.GetULong();master.setTheme(this.aThemes[indexTh]);master.ThemeIndex=-indexTh-1;break}case 1:{s.GetString2A();break}default:break}}var _lay_count=s.GetULong();for(var i=0;i<_lay_count;i++){s.Skip2(6);while(true){var _at=s.GetUChar();if(_at==g_nodeAttributeEnd)break;switch(_at){case 0:{var indexL=s.GetULong();master.addToSldLayoutLstToPos(master.sldLayoutLst.length,this.aSlideLayouts[indexL]);break}case 1:{s.GetString2A();break}default:break}}}s.Seek2(_end_rec);if(this.Api!=null&&this.IsThemeLoader){var theme_loader= this.Api.ThemeLoader;var theme_load_info=new CThemeLoadInfo;theme_load_info.Master=master;theme_load_info.Theme=master.Theme;var _lay_cnt=master.sldLayoutLst.length;for(var i=0;i<_lay_cnt;i++)theme_load_info.Layouts[i]=master.sldLayoutLst[i];theme_loader.themes_info_editor[theme_loader.CurrentLoadThemeIndex]=theme_load_info}};this.ReadViewProps=function(){return null};this.ReadVmlDrawing=function(){return null};this.ReadPresProps=function(presentation){var s=this.stream;var _type=s.GetUChar();var _rec_start= s.cur;var _end_rec=_rec_start+s.GetLong()+4;while(s.cur<_end_rec){var _at=s.GetUChar();switch(_at){case 0:{s.SkipRecord();break}case 1:{presentation.showPr=this.ReadShowPr();break}default:{s.SkipRecord();break}}}s.Seek2(_end_rec)};this.ReadShowPr=function(){var showPr=new CShowPr;var s=this.stream;var _rec_start=s.cur;var _end_rec=_rec_start+s.GetLong()+4;s.Skip2(1);while(true){var _at=s.GetUChar();if(_at==g_nodeAttributeEnd)break;switch(_at){case 0:{showPr.loop=s.GetBool();break}case 1:{showPr.showAnimation= s.GetBool();break}case 2:{showPr.showNarration=s.GetBool();break}case 3:{showPr.useTimings=s.GetBool();break}default:break}}while(s.cur<_end_rec){var _at=s.GetUChar();switch(_at){case 0:{showPr.browse=true;s.SkipRecord();break}case 1:{this.ReadShowPrCustShow(showPr);break}case 2:{this.ReadShowPrKiosk(showPr);break}case 3:{showPr.penClr=this.ReadUniColor();break}case 4:{showPr.present=true;s.SkipRecord();break}case 5:{if(!showPr.show)showPr.show={showAll:null,range:null,custShow:null};showPr.show.showAll= true;s.SkipRecord();break}case 6:{this.ReadShowPrSldRg(showPr);break}default:{s.SkipRecord();break}}}s.Seek2(_end_rec);return showPr};this.ReadShowPrCustShow=function(showPr){var s=this.stream;var _rec_start=s.cur;var _end_rec=_rec_start+s.GetLong()+4;s.Skip2(1);while(true){var _at=s.GetUChar();if(_at==g_nodeAttributeEnd)break;switch(_at){case 0:{if(!showPr.show)showPr.show={showAll:null,range:null,custShow:null};showPr.show.custShow=s.GetLong();break}default:break}}s.Seek2(_end_rec)};this.ReadShowPrKiosk= function(showPr){showPr.kiosk={restart:null};var s=this.stream;var _rec_start=s.cur;var _end_rec=_rec_start+s.GetLong()+4;s.Skip2(1);while(true){var _at=s.GetUChar();if(_at==g_nodeAttributeEnd)break;switch(_at){case 0:{showPr.kiosk.restart=s.GetLong();break}default:break}}s.Seek2(_end_rec)};this.ReadShowPrSldRg=function(showPr){if(!showPr.show)showPr.show={showAll:null,range:null,custShow:null};showPr.show.range={start:null,end:null};var s=this.stream;var _rec_start=s.cur;var _end_rec=_rec_start+ s.GetLong()+4;s.Skip2(1);while(true){var _at=s.GetUChar();if(_at==g_nodeAttributeEnd)break;switch(_at){case 0:{showPr.show.range.start=s.GetLong();break}case 1:{showPr.show.range.end=s.GetLong();break}default:break}}s.Seek2(_end_rec)};this.ReadTableStyles=function(){var s=this.stream;var _type=s.GetUChar();var _rec_start=s.cur;var _end_rec=_rec_start+s.GetLong()+4;s.Skip2(1);var _old_default=this.presentation.DefaultTableStyleId;while(true){var _at=s.GetUChar();if(_at==g_nodeAttributeEnd)break;switch(_at){case 0:{var _def= s.GetString2();this.presentation.DefaultTableStyleId=_def;break}default:break}}var _type=s.GetUChar();s.Skip2(4);while(s.cur<_end_rec){s.Skip2(1);this.ReadTableStyle()}if(!this.presentation.globalTableStyles.Style[this.presentation.DefaultTableStyleId])this.presentation.DefaultTableStyleId=_old_default;s.Seek2(_end_rec)};this.ReadTableStyle=function(bNotAddStyle){var s=this.stream;var _style=new CStyle("",null,null,styletype_Table);var _rec_start=s.cur;var _end_rec=_rec_start+s.GetLong()+4;s.Skip2(1); while(true){var _at=s.GetUChar();if(_at==g_nodeAttributeEnd)break;switch(_at){case 0:{var _id=s.GetString2();if(AscCommon.isRealObject(this.presentation.TableStylesIdMap)&&!bNotAddStyle)this.presentation.TableStylesIdMap[_style.Id]=true;this.map_table_styles[_id]=_style;break}case 1:{_style.Name=s.GetString2();break}default:break}}while(s.cur<_end_rec){var _at=s.GetUChar();switch(_at){case 0:{var _end_rec2=s.cur+s.GetLong()+4;while(s.cur<_end_rec2){var _at2=s.GetUChar();switch(_at2){case 0:{var _end_rec3= s.cur+s.GetLong()+4;while(s.cur<_end_rec3){var _at3=s.GetUChar();switch(_at3){case 0:{var _unifill=this.ReadUniFill();if(_unifill&&_unifill.fill!==undefined&&_unifill.fill!=null){if(undefined===_style.TablePr.Shd||null==_style.TablePr.Shd){_style.TablePr.Shd=new CDocumentShd;_style.TablePr.Shd.Value=c_oAscShdClear}_style.TablePr.Shd.Unifill=_unifill}}default:{s.SkipRecord();break}}}break}case 1:{if(undefined===_style.TablePr.Shd||null==_style.TablePr.Shd){_style.TablePr.Shd=new CDocumentShd;_style.TablePr.Shd.Value= c_oAscShdClear}_style.TablePr.Shd.FillRef=this.ReadStyleRef();break}default:{s.SkipRecord();break}}}s.Seek2(_end_rec2);break}case 1:{_style.TableWholeTable=this.ReadTableStylePart();break}case 2:{_style.TableBand1Horz=this.ReadTableStylePart();break}case 3:{_style.TableBand2Horz=this.ReadTableStylePart();break}case 4:{_style.TableBand1Vert=this.ReadTableStylePart();break}case 5:{_style.TableBand2Vert=this.ReadTableStylePart();break}case 6:{_style.TableLastCol=this.ReadTableStylePart();break}case 7:{_style.TableFirstCol= this.ReadTableStylePart();break}case 8:{_style.TableFirstRow=this.ReadTableStylePart();break}case 9:{_style.TableLastRow=this.ReadTableStylePart();break}case 10:{_style.TableBRCell=this.ReadTableStylePart();break}case 11:{_style.TableBLCell=this.ReadTableStylePart();break}case 12:{_style.TableTRCell=this.ReadTableStylePart();break}case 13:{_style.TableTLCell=this.ReadTableStylePart();break}default:{s.SkipRecord();break}}}s.Seek2(_end_rec);if(_style.TableWholeTable.TablePr.TableBorders.InsideH){_style.TablePr.TableBorders.InsideH= _style.TableWholeTable.TablePr.TableBorders.InsideH;delete _style.TableWholeTable.TablePr.TableBorders.InsideH}if(_style.TableWholeTable.TablePr.TableBorders.InsideV){_style.TablePr.TableBorders.InsideV=_style.TableWholeTable.TablePr.TableBorders.InsideV;delete _style.TableWholeTable.TablePr.TableBorders.InsideV}if(_style.TableWholeTable.TableCellPr.TableCellBorders.Top){_style.TablePr.TableBorders.Top=_style.TableWholeTable.TableCellPr.TableCellBorders.Top;delete _style.TableWholeTable.TableCellPr.TableCellBorders.Top}if(_style.TableWholeTable.TableCellPr.TableCellBorders.Bottom){_style.TablePr.TableBorders.Bottom= _style.TableWholeTable.TableCellPr.TableCellBorders.Bottom;delete _style.TableWholeTable.TableCellPr.TableCellBorders.Bottom}if(_style.TableWholeTable.TableCellPr.TableCellBorders.Left){_style.TablePr.TableBorders.Left=_style.TableWholeTable.TableCellPr.TableCellBorders.Left;delete _style.TableWholeTable.TableCellPr.TableCellBorders.Left}if(_style.TableWholeTable.TableCellPr.TableCellBorders.Right){_style.TablePr.TableBorders.Right=_style.TableWholeTable.TableCellPr.TableCellBorders.Right;delete _style.TableWholeTable.TableCellPr.TableCellBorders.Right}if(bNotAddStyle)return _style; else if(this.presentation.globalTableStyles)this.presentation.globalTableStyles.Add(_style)};this.ReadTableStylePart=function(){var s=this.stream;var _part=new CTableStylePr;var _rec_start=s.cur;var _end_rec=_rec_start+s.GetLong()+4;while(s.cur<_end_rec){var _at=s.GetUChar();switch(_at){case 0:{var _end_rec2=s.cur+s.GetLong()+4;s.Skip2(1);var _i,_b;while(true){var _at2=s.GetUChar();if(_at2==g_nodeAttributeEnd)break;switch(_at2){case 0:{_i=s.GetUChar();break}case 1:{_b=s.GetUChar();break}default:break}}if(_i=== 0)_part.TextPr.Italic=true;else if(_i===1)_part.TextPr.Italic=false;if(_b===0)_part.TextPr.Bold=true;else if(_b===1)_part.TextPr.Bold=false;while(s.cur<_end_rec2){var _at3=s.GetUChar();switch(_at3){case 0:{_part.TextPr.FontRef=this.ReadFontRef();break}case 1:{var _Unicolor=this.ReadUniColor();if(_Unicolor&&_Unicolor.color){_part.TextPr.Unifill=new AscFormat.CUniFill;_part.TextPr.Unifill.fill=new AscFormat.CSolidFill;_part.TextPr.Unifill.fill.color=_Unicolor}break}default:{s.SkipRecord();break}}}s.Seek2(_end_rec2); break}case 1:{var _end_rec2=s.cur+s.GetLong()+4;while(s.cur<_end_rec2){var _at2=s.GetUChar();switch(_at2){case 0:{this.ReadTcBdr(_part);break}case 1:{if(undefined===_part.TableCellPr.Shd||null==_part.TableCellPr.Shd){_part.TableCellPr.Shd=new CDocumentShd;_part.TableCellPr.Shd.Value=c_oAscShdClear}_part.TableCellPr.Shd.FillRef=this.ReadStyleRef();break}case 2:{var _end_rec3=s.cur+s.GetLong()+4;while(s.cur<_end_rec3){var _at3=s.GetUChar();switch(_at3){case 0:{var _unifill=this.ReadUniFill();if(_unifill&& _unifill.fill!==undefined&&_unifill.fill!=null){if(undefined===_part.TableCellPr.Shd||null==_part.TableCellPr.Shd){_part.TableCellPr.Shd=new CDocumentShd;_part.TableCellPr.Shd.Value=c_oAscShdClear}_part.TableCellPr.Shd.Unifill=_unifill}break}default:{s.SkipRecord();break}}}break}case 3:{s.SkipRecord();break}default:{s.SkipRecord();break}}}s.Seek2(_end_rec2);break}default:{s.SkipRecord();break}}}s.Seek2(_end_rec);return _part};this.ReadTcBdr=function(_part){var s=this.stream;var _rec_start=s.cur;var _end_rec= _rec_start+s.GetLong()+4;while(s.cur<_end_rec){var _at=s.GetUChar();switch(_at){case 0:{_part.TableCellPr.TableCellBorders.Left=new CDocumentBorder;this.ReadTableBorderLineStyle(_part.TableCellPr.TableCellBorders.Left);break}case 1:{_part.TableCellPr.TableCellBorders.Right=new CDocumentBorder;this.ReadTableBorderLineStyle(_part.TableCellPr.TableCellBorders.Right);break}case 2:{_part.TableCellPr.TableCellBorders.Top=new CDocumentBorder;this.ReadTableBorderLineStyle(_part.TableCellPr.TableCellBorders.Top); break}case 3:{_part.TableCellPr.TableCellBorders.Bottom=new CDocumentBorder;this.ReadTableBorderLineStyle(_part.TableCellPr.TableCellBorders.Bottom);break}case 4:{_part.TablePr.TableBorders.InsideH=new CDocumentBorder;this.ReadTableBorderLineStyle(_part.TablePr.TableBorders.InsideH);break}case 5:{_part.TablePr.TableBorders.InsideV=new CDocumentBorder;this.ReadTableBorderLineStyle(_part.TablePr.TableBorders.InsideV);break}case 6:case 7:{s.SkipRecord()}default:{s.SkipRecord();break}}}s.Seek2(_end_rec); return _part};this.ReadTableBorderLineStyle=function(_border){var s=this.stream;var _rec_start=s.cur;var _end_rec=_rec_start+s.GetLong()+4;while(s.cur<_end_rec){var _at=s.GetUChar();switch(_at){case 0:{var ln=this.ReadLn();_border.Unifill=ln.Fill;_border.Size=ln.w==null?12700:ln.w>>0;_border.Size/=36E3;_border.Value=border_Single;break}case 1:{_border.LineRef=this.ReadStyleRef();_border.Value=border_Single;break}default:{s.SkipRecord();break}}}s.Seek2(_end_rec)};this.ReadUniColor=function(){var s= this.stream;var _len=s.GetULong();var read_start=s.cur;var read_end=read_start+_len;var uni_color=new AscFormat.CUniColor;if(s.cur=0&&_find<_mod.name.length-1)_mod.setName(_mod.name.substring(_find+1))}else if(1==_type)_mod.setVal(s.GetLong());else if(g_nodeAttributeEnd==_type)break;else break}}s.Seek2(_e1);return _mod};this.ReadColorModifiers=function(){var s=this.stream;var _start=s.cur;var _end=_start+s.GetULong()+4;var _ret=null;var _count=s.GetULong();for(var i=0;i<_count;i++){if(s.cur> _end)break;s.Skip2(1);var _mod=this.ReadColorMod();if(_mod){if(null==_ret)_ret=[];_ret[_ret.length]=_mod}}s.Seek2(_end);return _ret};this.ReadRect=function(bIsMain){var _ret={};var s=this.stream;var _rec_start=s.cur;var _end_rec=_rec_start+s.GetLong()+4;s.Skip2(1);while(true){var _at=s.GetUChar();if(_at==g_nodeAttributeEnd)break;switch(_at){case 0:{_ret.l=s.GetPercentage();break}case 1:{_ret.t=s.GetPercentage();break}case 2:{_ret.r=s.GetPercentage();break}case 3:{_ret.b=s.GetPercentage();break}default:break}}s.Seek2(_end_rec); if(null==_ret.l&&null==_ret.t&&null==_ret.r&&null==_ret.b)return null;if(_ret.l==null)_ret.l=0;if(_ret.t==null)_ret.t=0;if(_ret.r==null)_ret.r=0;if(_ret.b==null)_ret.b=0;if(!bIsMain){var _absW=Math.abs(_ret.l)+Math.abs(_ret.r)+100;var _absH=Math.abs(_ret.t)+Math.abs(_ret.b)+100;_ret.l=-100*_ret.l/_absW;_ret.t=-100*_ret.t/_absH;_ret.r=-100*_ret.r/_absW;_ret.b=-100*_ret.b/_absH}_ret.r=100-_ret.r;_ret.b=100-_ret.b;if(_ret.l>_ret.r){var tmp=_ret.l;_ret.l=_ret.r;_ret.r=tmp}if(_ret.t>_ret.b){var tmp=_ret.t; _ret.t=_ret.b;_ret.b=tmp}var ret=new AscFormat.CSrcRect;ret.setLTRB(_ret.l,_ret.t,_ret.r,_ret.b);return ret};this.ReadGradLin=function(){var _lin=new AscFormat.GradLin;var s=this.stream;var _rec_start=s.cur;var _end_rec=_rec_start+s.GetLong()+4;s.Skip2(1);while(true){var _at=s.GetUChar();if(_at==g_nodeAttributeEnd)break;switch(_at){case 0:{_lin.setAngle(s.GetLong());break}case 1:{_lin.setScale(s.GetBool())}default:break}}s.Seek2(_end_rec);return _lin};this.ReadGradPath=function(){var _path=new AscFormat.GradPath; var s=this.stream;var _rec_start=s.cur;var _end_rec=_rec_start+s.GetLong()+4;s.Skip2(1);while(true){var _at=s.GetUChar();if(_at==g_nodeAttributeEnd)break;switch(_at){case 0:{_path.setPath(s.GetUChar());break}default:break}}s.Seek2(_end_rec);return _path};this.ReadBlur=function(){var nRecStart,nRecLen,nRecEnd;var s=this.stream;s.GetULong();s.GetUChar();nRecStart=s.cur;nRecLen=s.GetLong();nRecEnd=nRecStart+nRecLen+4;var oEffect=new AscFormat.CBlur;s.Skip2(1);while(true){var _at=s.GetUChar();if(_at== g_nodeAttributeEnd)break;switch(_at){case 0:oEffect.rad=s.GetULong();break;case 1:oEffect.grow=s.GetBool();break}}s.Seek2(nRecEnd);return oEffect};this.ReadFillOverlay=function(){var s=this.stream;s.GetULong();s.GetUChar();var nRecStart,nRecLen,nRecEnd;nRecStart=s.cur;nRecLen=s.GetLong();nRecEnd=nRecStart+nRecLen+4;var oEffect=new AscFormat.CFillOverlay;s.Skip2(1);while(true){var _at=s.GetUChar();if(_at==g_nodeAttributeEnd)break;if(_at==0)oEffect.blend=s.GetUChar();else break}while(s.cur0)sReadPath=sMedia}uni_fill.fill.setRasterImageId(sReadPath);var _s=sReadPath;var indS=_s.lastIndexOf("emf");if(indS==-1)indS=_s.lastIndexOf("wmf");if(indS!=-1&&indS==_s.length-3){_s=_s.substring(0,indS);_s+="svg"; sReadPath=_s;uni_fill.fill.setRasterImageId(_s)}if(this.IsThemeLoader){sReadPath="theme"+(this.Api.ThemeLoader.CurrentLoadThemeIndex+1)+"/media/"+sReadPath;uni_fill.fill.setRasterImageId(sReadPath)}if(this.ImageMapChecker!=null)this.ImageMapChecker[sReadPath]=true;if(this.IsUseFullUrl)this.RebuildImages.push(new CBuilderImages(uni_fill.fill,sReadPath,oImageShape,oSpPr,oLn));s.Skip2(1);break}default:{s.SkipRecord();break}}}s.Seek2(_e2);break}case 1:{uni_fill.fill.setSrcRect(this.ReadRect(true));break}case 2:{var oBlipTile= new AscFormat.CBlipFillTile;var s=this.stream;var _rec_start=s.cur;var _end_rec=_rec_start+s.GetLong()+4;s.Skip2(1);while(true){var _at=s.GetUChar();if(_at==g_nodeAttributeEnd)break;switch(_at){case 0:{oBlipTile.sx=s.GetLong();break}case 1:{oBlipTile.sy=s.GetLong();break}case 2:{oBlipTile.tx=s.GetLong();break}case 3:{oBlipTile.ty=s.GetLong();break}case 4:{oBlipTile.algn=s.GetUChar();break}case 5:{oBlipTile.flip=s.GetUChar();break}default:{break}}}s.Seek2(_end_rec);uni_fill.fill.setTile(oBlipTile); break}case 3:{var _e2=s.cur+s.GetLong()+4;while(s.cur<_e2){var _t=s.GetUChar();switch(_t){case 0:{var _srcRect=this.ReadRect(false);if(_srcRect!=null)uni_fill.fill.setSrcRect(_srcRect);break}default:{s.SkipRecord();break}}}s.Seek2(_e2);break}case 101:{var oBuilderImages=this.RebuildImages[this.RebuildImages.length-1];if(this.IsUseFullUrl&&oBuilderImages){s.Skip2(4);var urlsCount=s.GetUChar();for(var i=0;i=_e1)break;s.Skip2(1);s.Skip2(4);var _gs= new AscFormat.CGs;s.Skip2(1);s.Skip2(1);_gs.pos=s.GetLong();s.Skip2(1);s.Skip2(1);_gs.color=this.ReadUniColor();colors_[colors_.length]=_gs}s.Seek2(_e1);colors_.sort(function(a,b){return a.pos-b.pos});for(var z=0;z0)spPr.setGeometry(oGeometry);break}case 2:{spPr.setFill(this.ReadUniFill(spPr,null,null));break}case 3:{spPr.setLn(this.ReadLn(spPr));break}case 4:{spPr.setEffectPr(this.ReadEffectProperties());break}case 5:{var _len=s.GetULong();s.Skip2(_len);break}case 6:{var _len=s.GetULong();s.Skip2(_len);break}default:{s.SkipRecord();break}}}s.Seek2(_end_rec)};this.ReadGrSpPr=function(spPr){var s= this.stream;var _rec_start=s.cur;var _end_rec=_rec_start+s.GetULong()+4;s.Skip2(1);while(true){var _at=s.GetUChar();if(_at==g_nodeAttributeEnd)break;if(0==_at)spPr.setBwMode(s.GetUChar());else break}while(s.cur<_end_rec){var _at=s.GetUChar();switch(_at){case 0:{spPr.setXfrm(this.ReadXfrm());spPr.xfrm.setParent(spPr);break}case 1:{spPr.setFill(this.ReadUniFill(spPr,null,null));break}case 2:{var _len=s.GetULong();s.Skip2(_len);break}case 3:{var _len=s.GetULong();s.Skip2(_len);break}default:{s.SkipRecord(); break}}}s.Seek2(_end_rec)};this.ReadXfrm=function(){var ret=new AscFormat.CXfrm;var s=this.stream;var _rec_start=s.cur;var _end_rec=_rec_start+s.GetULong()+4;s.Skip2(1);while(true){var _at=s.GetUChar();if(_at==g_nodeAttributeEnd)break;switch(_at){case 0:{ret.setOffX(s.GetLong()/c_dScalePPTXSizes);break}case 1:{ret.setOffY(s.GetLong()/c_dScalePPTXSizes);break}case 2:{ret.setExtX(s.GetLong()/c_dScalePPTXSizes);break}case 3:{ret.setExtY(s.GetLong()/c_dScalePPTXSizes);break}case 4:{ret.setChOffX(s.GetLong()/ c_dScalePPTXSizes);break}case 5:{ret.setChOffY(s.GetLong()/c_dScalePPTXSizes);break}case 6:{ret.setChExtX(s.GetLong()/c_dScalePPTXSizes);break}case 7:{ret.setChExtY(s.GetLong()/c_dScalePPTXSizes);break}case 8:{ret.setFlipH(s.GetBool());break}case 9:{ret.setFlipV(s.GetBool());break}case 10:{ret.setRot(s.GetLong()/6E4*Math.PI/180);break}default:break}}s.Seek2(_end_rec);return ret};this.ReadSignatureLine=function(){var ret=new AscFormat.CSignatureLine;var s=this.stream;var _rec_start=s.cur;var _end_rec= _rec_start+s.GetULong()+4;s.Skip2(1);while(true){var _at=s.GetUChar();if(_at==g_nodeAttributeEnd)break;switch(_at){case 0:{s.GetString2();break}case 1:{s.GetBool();break}case 2:{s.GetUChar();break}case 3:{ret.id=s.GetString2();break}case 4:{s.GetBool();break}case 5:{s.GetString2();break}case 6:{ret.showDate=s.GetBool();break}case 7:{ret.instructions=s.GetString2();break}case 8:{s.GetBool();break}case 9:{s.GetString2();break}case 10:{ret.signer=s.GetString2();break}case 11:{ret.signer2=s.GetString2(); break}case 12:{ret.email=s.GetString2();break}default:break}}s.Seek2(_end_rec);return ret};this.ReadShapeStyle=function(){var def=new AscFormat.CShapeStyle;var s=this.stream;var _rec_start=s.cur;var _end_rec=_rec_start+s.GetULong()+4;while(s.cur<_end_rec){var _at=s.GetUChar();switch(_at){case 0:{def.setLnRef(this.ReadStyleRef());break}case 1:{def.setFillRef(this.ReadStyleRef());break}case 2:{def.setEffectRef(this.ReadStyleRef());break}case 3:{def.setFontRef(this.ReadFontRef());break}default:{s.SkipRecord(); break}}}s.Seek2(_end_rec);return def};this.ReadOleInfo=function(ole){var s=this.stream;var _rec_start=s.cur;var _end_rec=_rec_start+s.GetLong()+4;s.Skip2(1);var dxaOrig=0;var dyaOrig=0;while(true){var _at=s.GetUChar();if(_at==g_nodeAttributeEnd)break;switch(_at){case 0:{ole.setApplicationId(s.GetString2());break}case 1:{ole.setData(s.GetString2());break}case 2:{dxaOrig=s.GetULong();break}case 3:{dyaOrig=s.GetULong();break}case 4:{s.GetUChar();break}case 5:{s.GetUChar();break}case 6:{s.GetUChar(); break}case 7:{ole.setObjectFile(s.GetString2());break}default:{break}}}var oleType=null;while(s.cur<_end_rec){var _at=s.GetUChar();switch(_at){case 1:{s.GetLong();oleType=s.GetUChar();ole.setOleType(oleType);break}case 2:{var binary_length;switch(oleType){case 0:{binary_length=s.GetULong();ole.setBinaryData(s.data.slice(s.cur,s.cur+binary_length));s.Seek2(s.cur+binary_length);break}case 1:{ole.setObjectFile("maskFile.docx");binary_length=s.GetULong();ole.setBinaryData(s.data.slice(s.cur,s.cur+binary_length)); s.Seek2(s.cur+binary_length);break}case 2:{ole.setObjectFile("maskFile.xlsx");binary_length=s.GetULong();ole.setBinaryData(s.data.slice(s.cur,s.cur+binary_length));s.Seek2(s.cur+binary_length);break}case 4:{s.GetLong();var type2=s.GetUChar();s.SkipRecord();break}default:{s.SkipRecord();break}}break}default:{s.SkipRecord();break}}}if(dxaOrig>0&&dyaOrig>0){var ratio=4/3/20;ole.setPixSizes(ratio*dxaOrig,ratio*dyaOrig)}s.Seek2(_end_rec)};this.ReadGeometry=function(_xfrm){var geom=null;var s=this.stream; var _rec_start=s.cur;var _end_rec=_rec_start+s.GetULong()+4;if(s.cur<_end_rec){var _t=s.GetUChar();if(1==_t){var _len=s.GetULong();var _s=s.cur;var _e=_s+_len;s.Skip2(1);while(true){var _at=s.GetUChar();if(_at==g_nodeAttributeEnd)break;if(0==_at){var tmpStr=s.GetString2();geom=AscFormat.CreateGeometry(tmpStr);geom.isLine=tmpStr=="line";geom.setPreset(tmpStr)}else break}while(s.cur<_e){var _at=s.GetUChar();switch(_at){case 0:{this.ReadGeomAdj(geom);break}default:{s.SkipRecord();break}}}}else if(2== _t){var _len=s.GetULong();var _s=s.cur;var _e=_s+_len;geom=AscFormat.CreateGeometry("");geom.preset=null;while(s.cur<_e){var _at=s.GetUChar();switch(_at){case 0:{this.ReadGeomAdj(geom);break}case 1:{this.ReadGeomGd(geom);break}case 2:{this.ReadGeomAh(geom);break}case 3:{this.ReadGeomCxn(geom);break}case 4:{this.ReadGeomPathLst(geom,_xfrm);break}case 5:{this.ReadGeomRect(geom);break}default:{s.SkipRecord();break}}}}}s.Seek2(_end_rec);return geom};this.ReadGeomAdj=function(geom){var s=this.stream;var _rec_start= s.cur;var _end_rec=_rec_start+s.GetULong()+4;var _c=s.GetULong();for(var i=0;i<_c;i++){s.Skip2(6);var arr=[];var cp=0;while(true){var _at=s.GetUChar();if(_at==g_nodeAttributeEnd)break;if(cp==1)arr[cp]=s.GetLong();else arr[cp]=s.GetString2();cp++}if(arr.length>=3)geom.AddAdj(arr[0],arr[1],arr[2])}s.Seek2(_end_rec)};this.ReadGeomGd=function(geom){var s=this.stream;var _rec_start=s.cur;var _end_rec=_rec_start+s.GetULong()+4;var _c=s.GetULong();for(var i=0;i<_c;i++){s.Skip2(6);var arr=[];var cp=0;while(true){var _at= s.GetUChar();if(_at==g_nodeAttributeEnd)break;if(cp==1)arr[cp]=s.GetLong();else arr[cp]=s.GetString2();cp++}geom.AddGuide(arr[0],arr[1],arr[2],arr[3],arr[4])}s.Seek2(_end_rec)};this.ReadGeomAh=function(geom){var s=this.stream;var _rec_start=s.cur;var _end_rec=_rec_start+s.GetULong()+4;var _c=s.GetULong();for(var i=0;i<_c;i++){var _type1=s.GetUChar();s.Skip2(4);var _type=s.GetUChar();s.Skip2(5);var arr=[];while(true){var _at=s.GetUChar();if(_at==g_nodeAttributeEnd)break;arr[_at]=s.GetString2()}if(1== _type)geom.AddHandlePolar(arr[2],arr[6],arr[4],arr[3],arr[7],arr[5],arr[0],arr[1]);else geom.AddHandleXY(arr[2],arr[6],arr[4],arr[3],arr[7],arr[5],arr[0],arr[1])}s.Seek2(_end_rec)};this.ReadGeomCxn=function(geom){var s=this.stream;var _rec_start=s.cur;var _end_rec=_rec_start+s.GetULong()+4;var _c=s.GetULong();for(var i=0;i<_c;i++){var _type=s.GetUChar();s.Skip2(5);var arr=[];while(true){var _at=s.GetUChar();if(_at==g_nodeAttributeEnd)break;arr[_at]=s.GetString2()}geom.AddCnx(arr[2],arr[0],arr[1])}s.Seek2(_end_rec)}; this.ReadGeomRect=function(geom){var s=this.stream;var _rec_start=s.cur;var _end_rec=_rec_start+s.GetULong()+4;s.Skip2(1);var arr=[];arr[0]="l";arr[1]="t";arr[2]="r";arr[3]="b";while(true){var _at=s.GetUChar();if(_at==g_nodeAttributeEnd)break;arr[_at]=s.GetString2()}geom.AddRect(arr[0],arr[1],arr[2],arr[3]);s.Seek2(_end_rec)};this.ReadGeomPathLst=function(geom,_xfrm){var s=this.stream;var _rec_start=s.cur;var _end_rec=_rec_start+s.GetULong()+4;var _c=s.GetULong();for(var i=0;i<_c;i++){var _type=s.GetUChar(); var _len=s.GetULong();var _s=s.cur;var _e=_s+_len;s.Skip2(1);var extrusionOk=false;var fill=5;var stroke=true;var w=undefined;var h=undefined;while(true){var _at=s.GetUChar();if(_at==g_nodeAttributeEnd)break;switch(_at){case 0:{extrusionOk=s.GetBool();break}case 1:{fill=s.GetUChar();break}case 2:{h=s.GetLong();break}case 3:{stroke=s.GetBool();break}case 4:{w=s.GetLong();break}default:break}}geom.AddPathCommand(0,extrusionOk,fill==4?"none":"norm",stroke,w,h);var isKoords=false;while(s.cur<_e){var _at= s.GetUChar();switch(_at){case 0:{s.Skip2(4);var _cc=s.GetULong();for(var j=0;j<_cc;j++){s.Skip2(5);isKoords|=this.ReadUniPath2D(geom)}break}default:{s.SkipRecord();break}}}s.Seek2(_e)}var _path=geom.pathLst[geom.pathLst.length-1];if(isKoords&&undefined===_path.pathW&&undefined===_path.pathH){_path.pathW=_xfrm.extX*c_dScalePPTXSizes;_path.pathH=_xfrm.extY*c_dScalePPTXSizes;if(_path.pathW!=undefined){_path.divPW=100/_path.pathW;_path.divPH=100/_path.pathH}}s.Seek2(_end_rec)};this.ReadUniPath2D=function(geom){var s= this.stream;var _type=s.GetUChar();var _len=s.GetULong();var _s=s.cur;var _e=_s+_len;if(3==_type){geom.AddPathCommand(6);s.Seek2(_e);return}s.Skip2(1);var isKoord=false;var arr=[];while(true){var _at=s.GetUChar();if(_at==g_nodeAttributeEnd)break;arr[_at]=s.GetString2();if(!isKoord&&!isNaN(parseInt(arr[_at])))isKoord=true}switch(_type){case 1:{geom.AddPathCommand(1,arr[0],arr[1]);break}case 2:{geom.AddPathCommand(2,arr[0],arr[1]);break}case 3:{geom.AddPathCommand(6);break}case 4:{geom.AddPathCommand(5, arr[0],arr[1],arr[2],arr[3],arr[4],arr[5]);break}case 5:{geom.AddPathCommand(3,arr[0],arr[1],arr[2],arr[3]);break}case 6:{geom.AddPathCommand(4,arr[0],arr[1],arr[2],arr[3]);break}default:{s.SkipRecord();break}}s.Seek2(_e);return isKoord};this.ReadGraphicObject=function(){var s=this.stream;var _type=s.GetUChar();var _object=null;switch(_type){case 1:{_object=this.ReadShape();break}case 2:case 6:case 7:case 8:{_object=this.ReadPic(_type);break}case 3:{_object=this.ReadCxn();break}case 4:{_object=this.ReadGroupShape(); break}case 5:{_object=this.ReadGrFrame();break}default:{s.SkipRecord();break}}return _object};this.ReadShape=function(){var s=this.stream;var shape=new AscFormat.CShape(this.TempMainObject);if(null!=this.TempGroupObject)shape.Container=this.TempGroupObject;var _rec_start=s.cur;var _end_rec=_rec_start+s.GetULong()+4;shape.setBDeleted(false);s.Skip2(1);while(true){var _at=s.GetUChar();if(_at==g_nodeAttributeEnd)break;switch(_at){case 0:{shape.attrUseBgFill=s.GetBool();break}default:break}}var txXfrm= null;while(s.cur<_end_rec){var _at=s.GetUChar();switch(_at){case 0:{var pr=this.ReadNvUniProp(shape);shape.setNvSpPr(pr);if(AscFormat.isRealNumber(pr.locks))shape.setLocks(pr.locks);break}case 1:{var sp_pr=new AscFormat.CSpPr;this.ReadSpPr(sp_pr);shape.setSpPr(sp_pr);sp_pr.setParent(shape);break}case 2:{shape.setStyle(this.ReadShapeStyle());break}case 3:{shape.setTxBody(this.ReadTextBody(shape));shape.txBody.setParent(shape);break}case 6:{txXfrm=this.ReadXfrm();break}case 7:{shape.setSignature(this.ReadSignatureLine()); break}case 161:{shape.readMacro(s);break}default:{s.SkipRecord();break}}}if(txXfrm&&AscFormat.isRealNumber(txXfrm.rot)&&shape.txBody){var oCopyBodyPr;var rot2=txXfrm.rot;while(rot2<0)rot2+=2*Math.PI;var nSquare=2*rot2/Math.PI+.5>>0;while(nSquare<0)nSquare+=4;switch(nSquare){case 0:{oCopyBodyPr=shape.txBody.bodyPr?shape.txBody.bodyPr.createDuplicate():new AscFormat.CBodyPr;oCopyBodyPr.rot=rot2/AscFormat.cToRad+.5>>0;shape.txBody.setBodyPr(oCopyBodyPr);break}case 1:{oCopyBodyPr=shape.txBody.bodyPr? shape.txBody.bodyPr.createDuplicate():new AscFormat.CBodyPr;oCopyBodyPr.vert=AscFormat.nVertTTvert;shape.txBody.setBodyPr(oCopyBodyPr);break}case 2:{oCopyBodyPr=shape.txBody.bodyPr?shape.txBody.bodyPr.createDuplicate():new AscFormat.CBodyPr;oCopyBodyPr.rot=rot2/AscFormat.cToRad+.5>>0;shape.txBody.setBodyPr(oCopyBodyPr);break}case 3:{oCopyBodyPr=shape.txBody.bodyPr?shape.txBody.bodyPr.createDuplicate():new AscFormat.CBodyPr;oCopyBodyPr.vert=AscFormat.nVertTTvert270;shape.txBody.setBodyPr(oCopyBodyPr); break}}}s.Seek2(_end_rec);return shape};this.CheckGroupXfrm=function(oGroup){if(!oGroup||!oGroup.spPr)return;if(!oGroup.spPr.xfrm&&oGroup.spTree.length>0){var oXfrm=new AscFormat.CXfrm;oXfrm.setOffX(0);oXfrm.setOffY(0);oXfrm.setChOffX(0);oXfrm.setChOffY(0);oXfrm.setExtX(50);oXfrm.setExtY(50);oXfrm.setChExtX(50);oXfrm.setChExtY(50);oGroup.spPr.setXfrm(oXfrm);oGroup.updateCoordinatesAfterInternalResize();oGroup.spPr.xfrm.setParent(oGroup.spPr)}};this.ReadGroupShape=function(type){var s=this.stream; var shape;if(type===9)shape=new AscFormat.CLockedCanvas;else shape=new AscFormat.CGroupShape;shape.setBDeleted(false);this.TempGroupObject=shape;var _rec_start=s.cur;var _end_rec=_rec_start+s.GetULong()+4;while(s.cur<_end_rec){var _at=s.GetUChar();switch(_at){case 0:{var pr=this.ReadNvUniProp(shape);shape.setNvSpPr(pr);if(AscFormat.isRealNumber(pr.locks))shape.setLocks(pr.locks);break}case 1:{var spPr=new AscFormat.CSpPr;this.ReadGrSpPr(spPr);shape.setSpPr(spPr);spPr.setParent(shape);break}case 2:{s.Skip2(4); var _c=s.GetULong();for(var i=0;i<_c;i++){s.Skip2(1);var __len=s.GetULong();if(__len==0)continue;var _type=s.GetUChar();var _object=null;switch(_type){case 1:{_object=this.ReadShape();if(!IsHiddenObj(_object)&&_object.spPr&&_object.spPr.xfrm){shape.addToSpTree(shape.spTree.length,_object);shape.spTree[shape.spTree.length-1].setGroup(shape)}break}case 6:case 2:case 7:case 8:{_object=this.ReadPic(_type);if(!IsHiddenObj(_object)&&_object.spPr&&_object.spPr.xfrm){shape.addToSpTree(shape.spTree.length, _object);shape.spTree[shape.spTree.length-1].setGroup(shape)}break}case 3:{_object=this.ReadCxn();if(!IsHiddenObj(_object)&&_object.spPr&&_object.spPr.xfrm){shape.addToSpTree(shape.spTree.length,_object);shape.spTree[shape.spTree.length-1].setGroup(shape)}break}case 4:{_object=this.ReadGroupShape();if(!IsHiddenObj(_object)&&_object.spPr&&_object.spPr.xfrm&&_object.spTree.length>0){shape.addToSpTree(shape.spTree.length,_object);shape.spTree[shape.spTree.length-1].setGroup(shape);this.TempGroupObject= shape}break}case 5:{var _ret=null;if("undefined"!=typeof AscFormat.CGraphicFrame)_ret=this.ReadGrFrame();else _ret=this.ReadChartDataInGroup(shape);if(null!=_ret){shape.addToSpTree(shape.spTree.length,_ret);shape.spTree[shape.spTree.length-1].setGroup(shape)}break}default:{s.SkipRecord();break}}}break}default:{s.SkipRecord();break}}}this.CheckGroupXfrm(shape);s.Seek2(_end_rec);this.TempGroupObject=null;return shape};this.ReadGroupShapeMain=function(){var s=this.stream;var shapes=[];var _rec_start= s.cur;var _end_rec=_rec_start+s.GetULong()+4;s.Skip2(5);while(s.cur<_end_rec){var _at=s.GetUChar();switch(_at){case 0:{var _len=s.GetULong();s.Skip2(_len);break}case 1:{var _len=s.GetULong();s.Skip2(_len);break}case 2:{s.Skip2(4);var _c=s.GetULong();for(var i=0;i<_c;i++){s.Skip2(1);var __len=s.GetULong();if(__len==0)continue;var _type=s.GetUChar();switch(_type){case 1:{var _object=this.ReadShape();if(!IsHiddenObj(_object)){shapes[shapes.length]=_object;_object.setParent2(this.TempMainObject)}break}case 6:case 2:case 7:case 8:{var _object= this.ReadPic(_type);if(!IsHiddenObj(_object))if(_type!==6||_object.checkCorrect()){shapes[shapes.length]=_object;_object.setParent2(this.TempMainObject)}break}case 3:{var _object=this.ReadCxn();if(!IsHiddenObj(_object)){shapes[shapes.length]=_object;_object.setParent2(this.TempMainObject)}break}case 4:{var _object=this.ReadGroupShape();if(!IsHiddenObj(_object)){shapes[shapes.length]=_object;_object.setParent2(this.TempMainObject)}break}case 5:{var _ret=this.ReadGrFrame();if(null!=_ret){shapes[shapes.length]= _ret;_ret.setParent2(this.TempMainObject)}break}default:{s.SkipRecord();break}}}break}default:{s.SkipRecord();break}}}s.Seek2(_end_rec);return shapes};this.ReadPic=function(type){var s=this.stream;var isOle=type===6;var pic=isOle?new AscFormat.COleObject(this.TempMainObject):new AscFormat.CImageShape(this.TempMainObject);pic.setBDeleted(false);var _rec_start=s.cur;var _end_rec=_rec_start+s.GetULong()+4;var sMaskFileName;while(s.cur<_end_rec){var _at=s.GetUChar();switch(_at){case 0:{var pr=this.ReadNvUniProp(pic); pic.setNvSpPr(pr);if(AscFormat.isRealNumber(pr.locks))pic.setLocks(pr.locks);break}case 1:{pic.setBlipFill(this.ReadUniFill(null,pic,null).fill);break}case 2:{var spPr=new AscFormat.CSpPr;spPr.setParent(pic);this.ReadSpPr(spPr);pic.setSpPr(spPr);break}case 3:{pic.setStyle(this.ReadShapeStyle());break}case 4:{if(isOle)this.ReadOleInfo(pic);else s.SkipRecord();break}case 5:{if(type===7||type===8){s.GetLong();s.GetUChar();while(true){var _at2=s.GetUChar();if(_at2==g_nodeAttributeEnd)break;switch(_at2){case 0:{sMaskFileName= s.GetString2();break}case 1:{s.GetBool();break}default:{break}}}}else s.SkipRecord();break}case 161:{pic.readMacro(s);break}default:{this.stream.SkipRecord();break}}}if(type===7||type===8)if(typeof sMaskFileName==="string"&&sMaskFileName.length>0&&pic.nvPicPr&&pic.nvPicPr.nvPr){var oUniMedia=new AscFormat.UniMedia;oUniMedia.type=type;oUniMedia.media=sMaskFileName;pic.nvPicPr.nvPr.setUniMedia(oUniMedia)}s.Seek2(_end_rec);return pic};this.ReadCxn=function(){var s=this.stream;var shape=new AscFormat.CConnectionShape; shape.setBDeleted(false);var _rec_start=s.cur;var _end_rec=_rec_start+s.GetULong()+4;while(s.cur<_end_rec){var _at=s.GetUChar();switch(_at){case 0:{var pr=this.ReadNvUniProp(shape);shape.setNvSpPr(pr);if(AscFormat.isRealNumber(pr.locks))shape.setLocks(pr.locks);break}case 1:{var spPr=new AscFormat.CSpPr;spPr.setParent(shape);this.ReadSpPr(spPr);shape.setSpPr(spPr);break}case 2:{shape.setStyle(this.ReadShapeStyle());break}case 161:{shape.readMacro(s);break}default:{s.SkipRecord();break}}}this.AddConnectedObject(shape); s.Seek2(_end_rec);return shape};this.ReadChartDataInGroup=function(group){var s=this.stream;var _rec_start=s.cur;var _end_rec=_rec_start+s.GetULong()+4;this.TempGroupObject=group;s.Skip2(1);while(true){var _at=s.GetUChar();if(_at==g_nodeAttributeEnd)break;switch(_at){case 0:{var spid=s.GetString2();break}default:break}}var _nvGraphicFramePr=null;var _xfrm=null;var _chart=null;while(s.cur<_end_rec){var _at=s.GetUChar();switch(_at){case 0:{_nvGraphicFramePr=this.ReadNvUniProp(AscFormat.ExecuteNoHistory(function(){return new AscFormat.CGraphicFrame}, this,[]));break}case 1:{_xfrm=this.ReadXfrm();break}case 2:{s.SkipRecord();break}case 3:{var _length=s.GetLong();var _pos=s.cur;var _stream=new AscCommon.FT_Stream2;_stream.data=s.data;_stream.pos=s.pos;_stream.cur=s.cur;_stream.size=s.size;_chart=new AscFormat.CChartSpace;_chart.setBDeleted(false);var oBinaryChartReader=new AscCommon.BinaryChartReader(_stream);oBinaryChartReader.ExternalReadCT_ChartSpace(_length,_chart,this.presentation);_chart.setBDeleted(false);if(AscCommon.isRealObject(_nvGraphicFramePr)&& AscFormat.isRealNumber(_nvGraphicFramePr.locks))_chart.setLocks(_nvGraphicFramePr.locks);if(_xfrm){if(!_chart.spPr){_chart.setSpPr(new AscFormat.CSpPr);_chart.spPr.setParent(_chart)}_chart.spPr.setXfrm(_xfrm);_xfrm.setParent(_chart.spPr)}s.Seek2(_pos+_length);break}default:{s.SkipRecord();break}}}s.Seek2(_end_rec);this.TempGroupObject=null;if(_chart==null)return null;return _chart};this.ReadGrFrame=function(){var s=this.stream;var _rec_start=s.cur;var _end_rec=_rec_start+s.GetULong()+4;var _graphic_frame= new AscFormat.CGraphicFrame;_graphic_frame.setParent2(this.TempMainObject);this.TempGroupObject=_graphic_frame;s.Skip2(1);while(true){var _at=s.GetUChar();if(_at==g_nodeAttributeEnd)break;switch(_at){case 0:{var spid=s.GetString2();break}default:break}}var _nvGraphicFramePr=null;var _xfrm=null;var _table=null;var _chart=null;var _slicer=null;while(s.cur<_end_rec){var _at=s.GetUChar();switch(_at){case 0:{_nvGraphicFramePr=this.ReadNvUniProp(_graphic_frame);break}case 1:{_xfrm=this.ReadXfrm();break}case 2:{_table= this.ReadTable(_xfrm,_graphic_frame);break}case 3:{var _length=s.GetLong();var _pos=s.cur;if(typeof AscFormat.CChartSpace!=="undefined"&&_length){var _stream=new AscCommon.FT_Stream2;_stream.data=s.data;_stream.pos=s.pos;_stream.cur=s.cur;_stream.size=s.size;_chart=new AscFormat.CChartSpace;_chart.setBDeleted(false);AscCommon.pptx_content_loader.ImageMapChecker=this.ImageMapChecker;AscCommon.pptx_content_loader.Reader.ImageMapChecker=this.ImageMapChecker;var oBinaryChartReader=new AscCommon.BinaryChartReader(_stream); oBinaryChartReader.ExternalReadCT_ChartSpace(_length,_chart,this.presentation)}s.Seek2(_pos+_length);break}case 5:case 6:{if(typeof AscFormat.CSlicer!=="undefined"){_slicer=new AscFormat.CSlicer;_slicer.fromStream(s)}else s.SkipRecord();break}case 161:{_graphic_frame.readMacro(s);break}default:{s.SkipRecord();break}}}s.Seek2(_end_rec);this.TempGroupObject=null;if(_table==null&&_chart==null&&_slicer==null)return null;if(_table!=null){if(!_graphic_frame.spPr){_graphic_frame.setSpPr(new AscFormat.CSpPr); _graphic_frame.spPr.setParent(_graphic_frame)}if(!_xfrm){_xfrm=new AscFormat.CXfrm;_xfrm.setOffX(0);_xfrm.setOffY(0);_xfrm.setExtX(0);_xfrm.setExtY(0)}_graphic_frame.spPr.setXfrm(_xfrm);_xfrm.setParent(_graphic_frame.spPr);_graphic_frame.setSpPr(_graphic_frame.spPr);_graphic_frame.setNvSpPr(_nvGraphicFramePr);if(AscCommon.isRealObject(_nvGraphicFramePr)&&AscFormat.isRealNumber(_nvGraphicFramePr.locks))_graphic_frame.setLocks(_nvGraphicFramePr.locks);_graphic_frame.setGraphicObject(_table);_graphic_frame.setBDeleted(false)}else if(_chart!= null){if(!_chart.spPr){_chart.setSpPr(new AscFormat.CSpPr);_chart.spPr.setParent(_chart)}if(!_xfrm){_xfrm=new AscFormat.CXfrm;_xfrm.setOffX(0);_xfrm.setOffY(0);_xfrm.setExtX(0);_xfrm.setExtY(0)}if(AscCommon.isRealObject(_nvGraphicFramePr)){_chart.setNvSpPr(_nvGraphicFramePr);if(AscFormat.isRealNumber(_nvGraphicFramePr.locks))_chart.setLocks(_nvGraphicFramePr.locks)}this.map_shapes_by_id[_nvGraphicFramePr.cNvPr.id]=_chart;_chart.spPr.setXfrm(_xfrm);_xfrm.setParent(_chart.spPr);return _chart}else if(_slicer!= null){_slicer.setBDeleted(false);if(!_slicer.spPr){_slicer.setSpPr(new AscFormat.CSpPr);_slicer.spPr.setParent(_slicer)}if(!_xfrm){_xfrm=new AscFormat.CXfrm;_xfrm.setOffX(0);_xfrm.setOffY(0);_xfrm.setExtX(0);_xfrm.setExtY(0)}_slicer.spPr.setXfrm(_xfrm);_xfrm.setParent(_slicer.spPr);if(AscCommon.isRealObject(_nvGraphicFramePr)){_slicer.setNvSpPr(_nvGraphicFramePr);if(AscFormat.isRealNumber(_nvGraphicFramePr.locks))_slicer.setLocks(_nvGraphicFramePr.locks)}return _slicer}return _graphic_frame};this.ReadNvUniProp= function(drawing){var prop=new AscFormat.UniNvPr;var s=this.stream;var _rec_start=s.cur;var _end_rec=_rec_start+s.GetULong()+4;while(s.cur<_end_rec){var _at=s.GetUChar();switch(_at){case 0:{this.ReadCNvPr(prop.cNvPr);if(AscCommon.isRealObject(drawing))this.map_shapes_by_id[prop.cNvPr.id]=drawing;break}case 1:{var end=s.cur+s.GetULong()+4;var locks=0;if(AscCommon.isRealObject(drawing)){var drawingType=drawing.getObjectType();switch(drawingType){case AscDFH.historyitem_type_Shape:{s.Skip2(1);while(true){var _at2= s.GetUChar();if(_at2==g_nodeAttributeEnd)break;var value;switch(_at2){case 0:{value=s.GetBool();locks|=AscFormat.LOCKS_MASKS.txBox|(value?AscFormat.LOCKS_MASKS.txBox<<1:0);break}case 1:{value=s.GetBool();locks|=AscFormat.LOCKS_MASKS.noAdjustHandles|(value?AscFormat.LOCKS_MASKS.noAdjustHandles<<1:0);break}case 2:{value=s.GetBool();locks|=AscFormat.LOCKS_MASKS.noChangeArrowheads|(value?AscFormat.LOCKS_MASKS.noChangeArrowheads<<1:0);break}case 3:{value=s.GetBool();locks|=AscFormat.LOCKS_MASKS.noChangeAspect| (value?AscFormat.LOCKS_MASKS.noChangeAspect<<1:0);break}case 4:{value=s.GetBool();locks|=AscFormat.LOCKS_MASKS.noChangeShapeType|(value?AscFormat.LOCKS_MASKS.noChangeShapeType<<1:0);break}case 5:{value=s.GetBool();locks|=AscFormat.LOCKS_MASKS.noEditPoints|(value?AscFormat.LOCKS_MASKS.noEditPoints<<1:0);break}case 6:{value=s.GetBool();locks|=AscFormat.LOCKS_MASKS.noGrp|(value?AscFormat.LOCKS_MASKS.noGrp<<1:0);break}case 7:{value=s.GetBool();locks|=AscFormat.LOCKS_MASKS.noMove|(value?AscFormat.LOCKS_MASKS.noMove<< 1:0);break}case 8:{value=s.GetBool();locks|=AscFormat.LOCKS_MASKS.noResize|(value?AscFormat.LOCKS_MASKS.noResize<<1:0);break}case 9:{value=s.GetBool();locks|=AscFormat.LOCKS_MASKS.noRot|(value?AscFormat.LOCKS_MASKS.noRot<<1:0);break}case 10:{value=s.GetBool();locks|=AscFormat.LOCKS_MASKS.noSelect|(value?AscFormat.LOCKS_MASKS.noSelect<<1:0);break}case 11:{value=s.GetBool();locks|=AscFormat.LOCKS_MASKS.noTextEdit|(value?AscFormat.LOCKS_MASKS.noTextEdit<<1:0);break}}}prop.locks=locks;break}case AscDFH.historyitem_type_GroupShape:{s.Skip2(1); while(true){var _at2=s.GetUChar();if(_at2==g_nodeAttributeEnd)break;var value;switch(_at2){case 0:{value=s.GetBool();locks|=AscFormat.LOCKS_MASKS.noChangeAspect|(value?AscFormat.LOCKS_MASKS.noChangeAspect<<1:0);break}case 1:{value=s.GetBool();locks|=AscFormat.LOCKS_MASKS.noGrp|(value?AscFormat.LOCKS_MASKS.noGrp<<1:0);break}case 2:{value=s.GetBool();locks|=AscFormat.LOCKS_MASKS.noMove|(value?AscFormat.LOCKS_MASKS.noMove<<1:0);break}case 3:{value=s.GetBool();locks|=AscFormat.LOCKS_MASKS.noResize|(value? AscFormat.LOCKS_MASKS.noResize<<1:0);break}case 4:{value=s.GetBool();locks|=AscFormat.LOCKS_MASKS.noRot|(value?AscFormat.LOCKS_MASKS.noRot<<1:0);break}case 5:{value=s.GetBool();locks|=AscFormat.LOCKS_MASKS.noSelect|(value?AscFormat.LOCKS_MASKS.noSelect<<1:0);break}case 6:{value=s.GetBool();locks|=AscFormat.LOCKS_MASKS.noUngrp|(value?AscFormat.LOCKS_MASKS.noUngrp<<1:0);break}}}prop.locks=locks;break}case AscDFH.historyitem_type_ImageShape:{s.Skip2(1);while(true){var _at2=s.GetUChar();if(_at2==g_nodeAttributeEnd)break; var value;switch(_at2){case 0:{value=s.GetBool();break}case 1:{value=s.GetBool();locks|=AscFormat.LOCKS_MASKS.noAdjustHandles|(value?AscFormat.LOCKS_MASKS.noAdjustHandles<<1:0);break}case 2:{value=s.GetBool();locks|=AscFormat.LOCKS_MASKS.noChangeArrowheads|(value?AscFormat.LOCKS_MASKS.noChangeArrowheads<<1:0);break}case 3:{value=s.GetBool();locks|=AscFormat.LOCKS_MASKS.noChangeAspect|(value?AscFormat.LOCKS_MASKS.noChangeAspect<<1:0);break}case 4:{value=s.GetBool();locks|=AscFormat.LOCKS_MASKS.noChangeShapeType| (value?AscFormat.LOCKS_MASKS.noChangeShapeType<<1:0);break}case 5:{value=s.GetBool();locks|=AscFormat.LOCKS_MASKS.noCrop|(value?AscFormat.LOCKS_MASKS.noCrop<<1:0);break}case 6:{value=s.GetBool();locks|=AscFormat.LOCKS_MASKS.noEditPoints|(value?AscFormat.LOCKS_MASKS.noEditPoints<<1:0);break}case 7:{value=s.GetBool();locks|=AscFormat.LOCKS_MASKS.noGrp|(value?AscFormat.LOCKS_MASKS.noGrp<<1:0);break}case 8:{value=s.GetBool();locks|=AscFormat.LOCKS_MASKS.noMove|(value?AscFormat.LOCKS_MASKS.noMove<<1:0); break}case 9:{value=s.GetBool();locks|=AscFormat.LOCKS_MASKS.noResize|(value?AscFormat.LOCKS_MASKS.noResize<<1:0);break}case 10:{value=s.GetBool();locks|=AscFormat.LOCKS_MASKS.noRot|(value?AscFormat.LOCKS_MASKS.noRot<<1:0);break}case 11:{value=s.GetBool();locks|=AscFormat.LOCKS_MASKS.noSelect|(value?AscFormat.LOCKS_MASKS.noSelect<<1:0);break}}}prop.locks=locks;break}case AscDFH.historyitem_type_GraphicFrame:case AscDFH.historyitem_type_ChartSpace:{s.Skip2(1);while(true){var _at2=s.GetUChar();if(_at2== g_nodeAttributeEnd)break;var value;switch(_at2){case 0:{value=s.GetBool();locks|=AscFormat.LOCKS_MASKS.noChangeAspect|(value?AscFormat.LOCKS_MASKS.noChangeAspect<<1:0);break}case 1:{value=s.GetBool();locks|=AscFormat.LOCKS_MASKS.noDrilldown|(value?AscFormat.LOCKS_MASKS.noDrilldown<<1:0);break}case 2:{value=s.GetBool();locks|=AscFormat.LOCKS_MASKS.noGrp|(value?AscFormat.LOCKS_MASKS.noGrp<<1:0);break}case 3:{value=s.GetBool();locks|=AscFormat.LOCKS_MASKS.noMove|(value?AscFormat.LOCKS_MASKS.noMove<< 1:0);break}case 4:{value=s.GetBool();locks|=AscFormat.LOCKS_MASKS.noResize|(value?AscFormat.LOCKS_MASKS.noResize<<1:0);break}case 5:{value=s.GetBool();locks|=AscFormat.LOCKS_MASKS.noSelect|(value?AscFormat.LOCKS_MASKS.noSelect<<1:0);break}}}prop.locks=locks;break}case AscDFH.historyitem_type_Cnx:{s.Skip2(1);while(true){var _at2=s.GetUChar();if(_at2==g_nodeAttributeEnd)break;var value;switch(_at2){case 0:{value=s.GetBool();locks|=AscFormat.LOCKS_MASKS.noAdjustHandles|(value?AscFormat.LOCKS_MASKS.noAdjustHandles<< 1:0);break}case 1:{value=s.GetBool();locks|=AscFormat.LOCKS_MASKS.noChangeArrowheads|(value?AscFormat.LOCKS_MASKS.noChangeArrowheads<<1:0);break}case 2:{value=s.GetBool();locks|=AscFormat.LOCKS_MASKS.noChangeAspect|(value?AscFormat.LOCKS_MASKS.noChangeAspect<<1:0);break}case 3:{value=s.GetBool();locks|=AscFormat.LOCKS_MASKS.noChangeShapeType|(value?AscFormat.LOCKS_MASKS.noChangeShapeType<<1:0);break}case 4:{value=s.GetBool();locks|=AscFormat.LOCKS_MASKS.noEditPoints|(value?AscFormat.LOCKS_MASKS.noEditPoints<< 1:0);break}case 5:{value=s.GetBool();locks|=AscFormat.LOCKS_MASKS.noGrp|(value?AscFormat.LOCKS_MASKS.noGrp<<1:0);break}case 6:{value=s.GetBool();locks|=AscFormat.LOCKS_MASKS.noMove|(value?AscFormat.LOCKS_MASKS.noMove<<1:0);break}case 7:{value=s.GetBool();locks|=AscFormat.LOCKS_MASKS.noResize|(value?AscFormat.LOCKS_MASKS.noResize<<1:0);break}case 8:{value=s.GetBool();locks|=AscFormat.LOCKS_MASKS.noRot|(value?AscFormat.LOCKS_MASKS.noRot<<1:0);break}case 9:{value=s.GetBool();locks|=AscFormat.LOCKS_MASKS.noSelect| (value?AscFormat.LOCKS_MASKS.noSelect<<1:0);break}case 10:{prop.nvUniSpPr.stCnxId=s.GetULong();break}case 11:{prop.nvUniSpPr.stCnxIdx=s.GetULong();break}case 12:{prop.nvUniSpPr.endCnxId=s.GetULong();break}case 13:{prop.nvUniSpPr.endCnxIdx=s.GetULong();break}}}prop.locks=locks;prop.setUniSpPr(prop.nvUniSpPr.copy());break}}}s.Seek2(end);break}case 2:{this.ReadNvPr(prop.nvPr);break}default:{s.SkipRecord();break}}}s.Seek2(_end_rec);return prop};this.ReadCNvPr=function(cNvPr){var s=this.stream;var _rec_start= s.cur;var _end_rec=_rec_start+s.GetULong()+4;s.Skip2(1);while(true){var _at=s.GetUChar();if(_at==g_nodeAttributeEnd)break;switch(_at){case 0:{cNvPr.setId(s.GetLong());break}case 1:{cNvPr.setName(s.GetString2());break}case 2:{cNvPr.setIsHidden(1==s.GetUChar()?true:false);break}case 3:{cNvPr.setTitle(s.GetString2());break}case 4:{cNvPr.setDescr(s.GetString2());break}case 5:{cNvPr.form=s.GetBool();break}default:{break}}}while(s.cur<_end_rec){var _at=s.GetUChar();switch(_at){case 0:{cNvPr.setHlinkClick(this.ReadHyperlink()); break}case 1:{cNvPr.setHlinkHover(this.ReadHyperlink());break}default:{this.stream.SkipRecord();break}}}s.Seek2(_end_rec)};this.ReadTable=function(_xfrm,_graphic_frame){if(_xfrm==null){this.stream.SkipRecord();return null}var s=this.stream;var _rec_start=s.cur;var _end_rec=_rec_start+s.GetULong()+4;var cols=null;var rows=null;var _return_to_rows=0;var props=null;while(s.cur<_end_rec){var _at=s.GetUChar();switch(_at){case 0:{props=this.ReadTablePr();break}case 1:{s.Skip2(4);var _len=s.GetULong();cols= new Array(_len);for(var i=0;i<_len;i++){s.Skip2(7);cols[i]=s.GetULong()/36E3;s.Skip2(1)}break}case 2:{var _end_rec2=s.cur+s.GetULong()+4;rows=s.GetULong();_return_to_rows=s.cur;s.Seek2(_end_rec2);break}default:{s.SkipRecord();break}}}if(cols.length===0)cols.push(_xfrm.extX);var _table=new CTable(this.presentation.DrawingDocument,_graphic_frame,true,rows,cols.length,cols,true);_table.Reset(0,0,_xfrm.extX,1E5,0,0,1);if(null!=props){var style;if(this.map_table_styles[props.style])_table.Set_TableStyle(this.map_table_styles[props.style].Id); _table.Set_Pr(props.props);_table.Set_TableLook(props.look)}_table.SetTableLayout(tbllayout_Fixed);s.Seek2(_return_to_rows);for(var i=0;i_count-i){_gridCol=_count-i;row.Content[i].Pr.GridSpan=_gridCol;if(1==row.Content[i].Pr.GridSpan)row.Content[i].Pr.GridSpan= undefined}_gridCol--;while(_gridCol>0){i++;if(i>=_count)break;s.Skip2(1);this.ReadCell(row.Content[i]);row.Remove_Cell(i);i--;_count--;--_gridCol}}if(this.presentation&&Array.isArray(this.presentation.Slides)){var bLoadVal=AscCommon.g_oIdCounter.m_bLoad;var bRead=AscCommon.g_oIdCounter.m_bRead;AscCommon.g_oIdCounter.m_bLoad=false;AscCommon.g_oIdCounter.m_bRead=false;for(i=0;ifMaxBottomMargin)fMaxBottomMargin= oMargins.Bottom.W;if(oMargins.Top.W>fMaxTopMargin)fMaxTopMargin=oMargins.Top.W;var oBorders=oCell.Get_Borders();if(oBorders.Top.Size>fMaxTopBorder)fMaxTopBorder=oBorders.Top.Size;if(oBorders.Bottom.Size>fMaxBottomBorder)fMaxBottomBorder=oBorders.Bottom.Size}AscCommon.g_oIdCounter.m_bLoad=bLoadVal;AscCommon.g_oIdCounter.m_bRead=bRead;row.Set_Height(Math.max(1,fRowHeight-fMaxTopMargin-fMaxBottomMargin-fMaxTopBorder/2-fMaxBottomBorder/2),Asc.linerule_AtLeast)}s.Seek2(_end_rec)};this.ReadCell=function(cell){var s= this.stream;var _rec_start=s.cur;var _end_rec=_rec_start+s.GetULong()+4;s.Skip2(1);while(true){var _at=s.GetUChar();if(_at==g_nodeAttributeEnd)break;switch(_at){case 0:{var _id=s.GetString2();break}case 1:{var rowSpan=s.GetULong();if(1>0;border.Size/=36E3;border.Value=border_Single;return border};this.ReadTablePr=function(){var s=this.stream;var _rec_start=s.cur; var _end_rec=_rec_start+s.GetULong()+4;s.Skip2(1);var obj={};obj.props=new CTablePr;obj.look=new CTableLook(false,false,false,false,false,false);obj.style=-1;while(true){var _at=s.GetUChar();if(_at==g_nodeAttributeEnd)break;switch(_at){case 0:{obj.style=s.GetString2();break}case 1:{s.Skip2(1);break}case 2:{obj.look.m_bFirst_Row=s.GetBool();break}case 3:{obj.look.m_bFirst_Col=s.GetBool();break}case 4:{obj.look.m_bLast_Row=s.GetBool();break}case 5:{obj.look.m_bLast_Col=s.GetBool();break}case 6:{obj.look.m_bBand_Hor= s.GetBool();break}case 7:{obj.look.m_bBand_Ver=s.GetBool();break}default:break}}while(s.cur<_end_rec){var _at=s.GetUChar();switch(_at){case 0:{var _unifill=this.ReadUniFill();if(_unifill&&_unifill.fill!==undefined&&_unifill.fill!=null){obj.props.Shd=new CDocumentShd;obj.props.Shd.Value=c_oAscShdClear;obj.props.Shd.Unifill=_unifill}break}default:{s.SkipRecord();break}}}s.Seek2(_end_rec);return obj};this.ReadNvPr=function(nvPr){var s=this.stream;var _rec_start=s.cur;var _end_rec=_rec_start+s.GetULong()+ 4;s.Skip2(1);while(true){var _at=s.GetUChar();if(_at==g_nodeAttributeEnd)break;switch(_at){case 0:{nvPr.setIsPhoto(s.GetBool());break}case 1:{nvPr.setUserDrawn(s.GetBool());break}default:break}}while(s.cur<_end_rec){var _at=s.GetUChar();switch(_at){case 0:{nvPr.setPh(this.ReadPH());break}case 1:{nvPr.setUniMedia(new AscFormat.UniMedia);var _len=s.GetULong();s.Skip2(_len);break}default:{var _len=s.GetULong();s.Skip2(_len);break}}}s.Seek2(_end_rec)};this.ReadPH=function(){var ph=new AscFormat.Ph;var s= this.stream;var _rec_start=s.cur;var _end_rec=_rec_start+s.GetULong()+4;s.Skip2(1);while(true){var _at=s.GetUChar();if(_at==g_nodeAttributeEnd)break;switch(_at){case 0:{ph.setHasCustomPrompt(s.GetBool());break}case 1:{ph.setIdx(s.GetString2());break}case 2:{ph.setOrient(s.GetUChar());break}case 3:{ph.setSz(s.GetUChar());break}case 4:{ph.setType(s.GetUChar());break}default:break}}s.Seek2(_end_rec);return ph};this.ReadRunProperties=function(){var rPr=new CTextPr;var s=this.stream;var _end_rec=s.cur+ s.GetULong()+4;s.Skip2(1);while(true){var _at=s.GetUChar();if(_at==g_nodeAttributeEnd)break;switch(_at){case 0:{var altLang=s.GetString2();break}case 1:{rPr.Bold=s.GetBool();break}case 2:{var baseline=s.GetLong();if(baseline<0)rPr.VertAlign=AscCommon.vertalign_SubScript;else if(baseline>0)rPr.VertAlign=AscCommon.vertalign_SuperScript;break}case 3:{var bmk=s.GetString2();break}case 4:{var _cap=s.GetUChar();if(_cap==0){rPr.Caps=true;rPr.SmallCaps=false}else if(_cap==1){rPr.Caps=false;rPr.SmallCaps= true}else if(_cap==2){rPr.SmallCaps=false;rPr.Caps=false}break}case 5:{s.Skip2(1);break}case 6:{s.Skip2(1);break}case 7:{rPr.Italic=s.GetBool();break}case 8:{s.Skip2(4);break}case 9:{s.Skip2(1);break}case 10:{var lang=s.GetString2();var nLcid=Asc.g_oLcidNameToIdMap[lang];if(nLcid)rPr.Lang.Val=nLcid;break}case 11:{s.Skip2(1);break}case 12:{s.Skip2(1);break}case 13:{s.Skip2(1);break}case 14:{s.Skip2(4);break}case 15:{rPr.Spacing=s.GetLong()*25.4/7200;break}case 16:{var _strike=s.GetUChar();if(0==_strike){rPr.Strikeout= false;rPr.DStrikeout=true}else if(2==_strike){rPr.Strikeout=true;rPr.DStrikeout=false}else{rPr.Strikeout=false;rPr.DStrikeout=false}break}case 17:{var _size=s.GetLong()/100;_size=_size*2+.5>>0;_size/=2;rPr.FontSize=_size;break}case 18:{rPr.Underline=s.GetUChar()!=12;break}default:break}}while(s.cur<_end_rec){var _at=s.GetUChar();switch(_at){case 0:{rPr.TextOutline=this.ReadLn();break}case 1:{var oUniFill=this.ReadUniFill();if(oUniFill&&oUniFill.fill)rPr.Unifill=oUniFill;break}case 2:{s.SkipRecord(); break}case 3:{rPr.RFonts.Ascii={Name:this.ReadTextFontTypeface(),Index:-1};rPr.RFonts.HAnsi={Name:rPr.RFonts.Ascii.Name,Index:-1};break}case 4:{rPr.RFonts.EastAsia={Name:this.ReadTextFontTypeface(),Index:-1};break}case 5:{rPr.RFonts.CS={Name:this.ReadTextFontTypeface(),Index:-1};break}case 6:{s.SkipRecord();break}case 7:{rPr.hlink=this.ReadHyperlink();if(null==rPr.hlink)delete rPr.hlink;break}case 8:{s.SkipRecord();break}case 12:{var end_rec__=s.cur+s.GetULong()+4;s.Skip2(1);var at__;while(true){at__= s.GetUChar();if(at__===g_nodeAttributeEnd)break}while(s.curOldBlipCount)for(var _t=OldBlipCount;_t< this.RebuildImages.length;++_t){var oTextPr=new CTextPr;oTextPr.Set_FromObject(r_pr);this.RebuildImages[_t].TextPr=oTextPr;this.RebuildImages[_t].Paragraph=par}}break}default:{s.SkipRecord()}}}if(b_bullet)para_pr.Bullet=bullet;s.Seek2(_end_rec);return para_pr};this.ReadTextListStyle=function(){var styles=new AscFormat.TextListStyle;var s=this.stream;var _rec_start=s.cur;var _end_rec=_rec_start+s.GetULong()+4;while(s.cur<_end_rec){var _at=s.GetUChar();styles.levels[_at]=this.ReadTextParagraphPr()}s.Seek2(_end_rec); return styles};this.ReadTextBody=function(shape){var txbody;if(shape)if(shape.txBody)txbody=shape.txBody;else{txbody=new AscFormat.CTextBody;txbody.setParent(shape)}else txbody=new AscFormat.CTextBody;var s=this.stream;var _rec_start=s.cur;var _end_rec=_rec_start+s.GetULong()+4;while(s.cur<_end_rec){var _at=s.GetUChar();switch(_at){case 0:{txbody.setBodyPr(this.ReadBodyPr());break}case 1:{txbody.setLstStyle(this.ReadTextListStyle());break}case 2:{s.Skip2(4);var _c=s.GetULong();txbody.setContent(new AscFormat.CDrawingDocContent(txbody, this.DrawingDocument,0,0,0,0,0,0,true));if(_c>0)txbody.content.Internal_Content_RemoveAll();for(var i=0;i<_c;i++){s.Skip2(1);var _paragraph=this.ReadParagraph(txbody.content);_paragraph.Correct_Content();txbody.content.Internal_Content_Add(txbody.content.Content.length,_paragraph)}break}default:{s.SkipRecord();break}}}s.Seek2(_end_rec);return txbody};this.ReadTextBodyTxPr=function(shape){var txbody;if(shape.txPr)txbody=shape.txPr;else{shape.txPr=new AscFormat.CTextBody;txbody=shape.txPr}var s=this.stream; var _rec_start=s.cur;var _end_rec=_rec_start+s.GetULong()+4;while(s.cur<_end_rec){var _at=s.GetUChar();switch(_at){case 0:{shape.setBodyPr(this.ReadBodyPr());break}case 1:{txbody.setLstStyle(this.ReadTextListStyle());break}case 2:{s.Skip2(4);var _c=s.GetULong();if(!txbody.content)txbody.content=new AscFormat.CDrawingDocContent(shape,this.DrawingDocument,0,0,0,0,0,0,true);if(_c>0)txbody.content.Internal_Content_RemoveAll();for(var i=0;i<_c;i++){s.Skip2(1);var _paragraph=this.ReadParagraph(txbody.content); _paragraph.Set_Parent(txbody.content);txbody.content.Internal_Content_Add(txbody.content.Content.length,_paragraph)}break}default:{s.SkipRecord();break}}}s.Seek2(_end_rec);return txbody};this.ReadTextBody2=function(content){var s=this.stream;var _rec_start=s.cur;var _end_rec=_rec_start+s.GetULong()+4;var oBodyPr;while(s.cur<_end_rec){var _at=s.GetUChar();switch(_at){case 0:{s.SkipRecord();break}case 1:{s.SkipRecord();break}case 2:{s.Skip2(4);var _c=s.GetULong();if(_c>0)content.Internal_Content_RemoveAll(); for(var i=0;i<_c;i++){s.Skip2(1);var _paragraph=this.ReadParagraph(content);content.Internal_Content_Add(content.Content.length,_paragraph)}break}default:{s.SkipRecord();break}}}s.Seek2(_end_rec)};this.ReadParagraph=function(DocumentContent){var par=new Paragraph(DocumentContent.DrawingDocument,DocumentContent,true);var EndPos=0;var s=this.stream;var _rec_start=s.cur;var _end_rec=_rec_start+s.GetULong()+4;while(s.cur<_end_rec){var _at=s.GetUChar();switch(_at){case 0:{par.Set_Pr(this.ReadTextParagraphPr(par)); break}case 1:{var OldImgCount=0;if(this.IsUseFullUrl)OldImgCount=this.RebuildImages.length;var endRunPr=this.ReadRunProperties();var _value_text_pr=new CTextPr;if(endRunPr.Unifill&&!endRunPr.Unifill.fill)endRunPr.Unifill=undefined;_value_text_pr.Set_FromObject(endRunPr);par.TextPr.Apply_TextPr(_value_text_pr);var oTextPrEnd=new CTextPr;oTextPrEnd.Set_FromObject(endRunPr);par.Content[0].Set_Pr(oTextPrEnd);if(this.IsUseFullUrl)if(this.RebuildImages.length>OldImgCount)for(var _t=OldImgCount;_tOldImgCount)for(var _t=OldImgCount;_t=_end_pos)break;_type=s.GetUChar();switch(_type){case 0:{var _end_rec2= s.cur+s.GetLong()+4;s.Skip2(1);while(true){_at=s.GetUChar();if(_at==g_nodeAttributeEnd)break;switch(_at){case 16:{this.Characters=s.GetLong();break}case 17:{this.CharactersWithSpaces=s.GetLong();break}case 18:{this.DocSecurity=s.GetLong();break}case 19:{this.HyperlinkBase=s.GetString2();break}case 20:{this.Lines=s.GetLong();break}case 21:{this.Manager=s.GetString2();break}case 22:{this.Pages=s.GetLong();break}default:return}}s.Seek2(_end_rec2);break}default:{s.SkipRecord();break}}}s.Seek2(_end_pos)}; CApp.prototype.toStream=function(s){s.StartRecord(AscCommon.c_oMainTables.App);s.WriteUChar(AscCommon.g_nodeAttributeStart);s._WriteString2(0,this.Template);s._WriteString2(2,this.PresentationFormat);s._WriteString2(3,this.Company);s._WriteBool2(12,this.ScaleCrop);s._WriteBool2(13,this.LinksUpToDate);s._WriteBool2(14,this.SharedDoc);s._WriteBool2(15,this.HyperlinksChanged);s.WriteUChar(g_nodeAttributeEnd);s.StartRecord(0);s.WriteUChar(AscCommon.g_nodeAttributeStart);s._WriteInt2(18,this.DocSecurity); s._WriteString2(19,this.HyperlinkBase);s._WriteString2(21,this.Manager);s.WriteUChar(g_nodeAttributeEnd);s.EndRecord();s.EndRecord()};CApp.prototype.asc_getTemplate=function(){return this.Template};CApp.prototype.asc_getTotalTime=function(){return this.TotalTime};CApp.prototype.asc_getWords=function(){return this.Words};CApp.prototype.asc_getApplication=function(){return this.Application};CApp.prototype.asc_getPresentationFormat=function(){return this.PresentationFormat};CApp.prototype.asc_getParagraphs= function(){return this.Paragraphs};CApp.prototype.asc_getSlides=function(){return this.Slides};CApp.prototype.asc_getNotes=function(){return this.Notes};CApp.prototype.asc_getHiddenSlides=function(){return this.HiddenSlides};CApp.prototype.asc_getMMClips=function(){return this.MMClips};CApp.prototype.asc_getScaleCrop=function(){return this.ScaleCrop};CApp.prototype.asc_getCompany=function(){return this.Company};CApp.prototype.asc_getLinksUpToDate=function(){return this.LinksUpToDate};CApp.prototype.asc_getSharedDoc= function(){return this.SharedDoc};CApp.prototype.asc_getHyperlinksChanged=function(){return this.HyperlinksChanged};CApp.prototype.asc_getAppVersion=function(){return this.AppVersion};CApp.prototype.asc_getCharacters=function(){return this.Characters};CApp.prototype.asc_getCharactersWithSpaces=function(){return this.CharactersWithSpaces};CApp.prototype.asc_getDocSecurity=function(){return this.DocSecurity};CApp.prototype.asc_getHyperlinkBase=function(){return this.HyperlinkBase};CApp.prototype.asc_getLines= function(){return this.Lines};CApp.prototype.asc_getManager=function(){return this.Manager};CApp.prototype.asc_getPages=function(){return this.Pages};function CChangesCorePr(Class,Old,New,Color){AscDFH.CChangesBase.call(this,Class,Old,New,Color);if(Old&&New){this.OldTitle=Old.title;this.OldCreator=Old.creator;this.OldDescription=Old.description;this.OldSubject=Old.subject;this.NewTitle=New.title===Old.title?undefined:New.title;this.NewCreator=New.creator===Old.creator?undefined:New.creator;this.NewDescription= New.description===Old.description?undefined:New.description;this.NewSubject=New.subject===Old.subject?undefined:New.subject}else{this.OldTitle=undefined;this.OldCreator=undefined;this.OldDescription=undefined;this.OldSubject=undefined;this.NewTitle=undefined;this.NewCreator=undefined;this.NewDescription=undefined;this.NewSubject=undefined}}CChangesCorePr.prototype=Object.create(AscDFH.CChangesBase.prototype);CChangesCorePr.prototype.constructor=CChangesCorePr;CChangesCorePr.prototype.Type=AscDFH.historyitem_CoreProperties; CChangesCorePr.prototype.Undo=function(){if(!this.Class)return;this.Class.title=this.OldTitle;this.Class.creator=this.OldCreator;this.Class.description=this.OldDescription;this.Class.subject=this.OldSubject};CChangesCorePr.prototype.Redo=function(){if(!this.Class)return;if(this.NewTitle!==undefined)this.Class.title=this.NewTitle;if(this.NewCreator!==undefined)this.Class.creator=this.NewCreator;if(this.NewDescription!==undefined)this.Class.description=this.NewDescription;if(this.NewSubject!==undefined)this.Class.subject= this.NewSubject};CChangesCorePr.prototype.WriteToBinary=function(Writer){var nFlags=0;if(undefined!==this.NewTitle)nFlags|=1;if(undefined!==this.NewCreator)nFlags|=2;if(undefined!==this.NewDescription)nFlags|=4;if(undefined!==this.NewSubject)nFlags|=8;Writer.WriteLong(nFlags);var bIsField;if(nFlags&1){bIsField=typeof this.NewTitle==="string";Writer.WriteBool(bIsField);if(bIsField)Writer.WriteString2(this.NewTitle)}if(nFlags&2){bIsField=typeof this.NewCreator==="string";Writer.WriteBool(bIsField); if(bIsField)Writer.WriteString2(this.NewCreator)}if(nFlags&4){bIsField=typeof this.NewDescription==="string";Writer.WriteBool(bIsField);if(bIsField)Writer.WriteString2(this.NewDescription)}if(nFlags&8){bIsField=typeof this.NewSubject==="string";Writer.WriteBool(bIsField);if(bIsField)Writer.WriteString2(this.NewSubject)}};CChangesCorePr.prototype.ReadFromBinary=function(Reader){var nFlags=Reader.GetLong();var bIsField;if(nFlags&1){bIsField=Reader.GetBool();if(bIsField)this.NewTitle=Reader.GetString2(); else this.NewTitle=null}if(nFlags&2){bIsField=Reader.GetBool();if(bIsField)this.NewCreator=Reader.GetString2();else this.NewCreator=null}if(nFlags&4){bIsField=Reader.GetBool();if(bIsField)this.NewDescription=Reader.GetString2();else this.NewDescription=null}if(nFlags&8){bIsField=Reader.GetBool();if(bIsField)this.NewSubject=Reader.GetString2();else this.NewSubject=null}};CChangesCorePr.prototype.CreateReverseChange=function(){var ret=new CChangesCorePr(this.Class);ret.OldTitle=this.NewTitle;ret.OldCreator= this.NewCreator;ret.OldDescription=this.NewCreator;ret.OldSubject=this.NewSubject;ret.NewTitle=this.OldTitle;ret.NewCreator=this.OldCreator;ret.NewDescription=this.OldCreator;ret.NewSubject=this.OldSubject;return ret};AscDFH.changesFactory[AscDFH.historyitem_CoreProperties]=CChangesCorePr;function CCore(){this.category=null;this.contentStatus=null;this.created=null;this.creator=null;this.description=null;this.identifier=null;this.keywords=null;this.language=null;this.lastModifiedBy=null;this.lastPrinted= null;this.modified=null;this.revision=null;this.subject=null;this.title=null;this.version=null;this.Id=AscCommon.g_oIdCounter.Get_NewId();this.Lock=new AscCommon.CLock;this.lockType=AscCommon.c_oAscLockTypes.kLockTypeNone;AscCommon.g_oTableId.Add(this,this.Id)}CCore.prototype.fromStream=function(s){var _type=s.GetUChar();var _len=s.GetULong();var _start_pos=s.cur;var _end_pos=_len+_start_pos;var _at;var _sa=s.GetUChar();while(true){_at=s.GetUChar();if(_at==g_nodeAttributeEnd)break;switch(_at){case 0:{this.title= s.GetString2();break}case 1:{this.creator=s.GetString2();break}case 2:{this.lastModifiedBy=s.GetString2();break}case 3:{this.revision=s.GetString2();break}case 4:{this.created=this.readDate(s.GetString2());break}case 5:{this.modified=this.readDate(s.GetString2());break}default:return}}while(true){if(s.cur>=_end_pos)break;_type=s.GetUChar();switch(_type){case 0:{var _end_rec2=s.cur+s.GetLong()+4;s.Skip2(1);while(true){_at=s.GetUChar();if(_at==g_nodeAttributeEnd)break;switch(_at){case 6:{this.category= s.GetString2();break}case 7:{this.contentStatus=s.GetString2();break}case 8:{this.description=s.GetString2();break}case 9:{this.identifier=s.GetString2();break}case 10:{this.keywords=s.GetString2();break}case 11:{this.language=s.GetString2();break}case 12:{this.lastPrinted=this.readDate(s.GetString2());break}case 13:{this.subject=s.GetString2();break}case 14:{this.version=s.GetString2();break}default:return}}s.Seek2(_end_rec2);break}default:{s.SkipRecord();break}}}s.Seek2(_end_pos)};CCore.prototype.readDate= function(val){val=new Date(val);return val instanceof Date&&!isNaN(val)?val:null};CCore.prototype.toStream=function(s,api){s.StartRecord(AscCommon.c_oMainTables.Core);s.WriteUChar(AscCommon.g_nodeAttributeStart);s._WriteString2(0,this.title);s._WriteString2(1,this.creator);if(api&&api.DocInfo)s._WriteString2(2,api.DocInfo.get_UserName());var revision=0;if(this.revision){var rev=parseInt(this.revision);if(!isNaN(rev))revision=rev}s._WriteString2(3,(revision+1).toString());if(this.created)s._WriteString2(4, this.created.toISOString().slice(0,19)+"Z");s._WriteString2(5,(new Date).toISOString().slice(0,19)+"Z");s.WriteUChar(g_nodeAttributeEnd);s.StartRecord(0);s.WriteUChar(AscCommon.g_nodeAttributeStart);s._WriteString2(6,this.category);s._WriteString2(7,this.contentStatus);s._WriteString2(8,this.description);s._WriteString2(9,this.identifier);s._WriteString2(10,this.keywords);s._WriteString2(11,this.language);s._WriteString2(13,this.subject);s._WriteString2(14,this.version);s.WriteUChar(g_nodeAttributeEnd); s.EndRecord();s.EndRecord()};CCore.prototype.asc_getTitle=function(){return this.title};CCore.prototype.asc_getCreator=function(){return this.creator};CCore.prototype.asc_getLastModifiedBy=function(){return this.lastModifiedBy};CCore.prototype.asc_getRevision=function(){return this.revision};CCore.prototype.asc_getCreated=function(){return this.created};CCore.prototype.asc_getModified=function(){return this.modified};CCore.prototype.asc_getCategory=function(){return this.category};CCore.prototype.asc_getContentStatus= function(){return this.contentStatus};CCore.prototype.asc_getDescription=function(){return this.description};CCore.prototype.asc_getIdentifier=function(){return this.identifier};CCore.prototype.asc_getKeywords=function(){return this.keywords};CCore.prototype.asc_getLanguage=function(){return this.language};CCore.prototype.asc_getLastPrinted=function(){return this.lastPrinted};CCore.prototype.asc_getSubject=function(){return this.subject};CCore.prototype.asc_getVersion=function(){return this.version}; CCore.prototype.asc_putTitle=function(v){this.title=v};CCore.prototype.asc_putCreator=function(v){this.creator=v};CCore.prototype.asc_putLastModifiedBy=function(v){this.lastModifiedBy=v};CCore.prototype.asc_putRevision=function(v){this.revision=v};CCore.prototype.asc_putCreated=function(v){this.created=v};CCore.prototype.asc_putModified=function(v){this.modified=v};CCore.prototype.asc_putCategory=function(v){this.category=v};CCore.prototype.asc_putContentStatus=function(v){this.contentStatus=v};CCore.prototype.asc_putDescription= function(v){this.description=v};CCore.prototype.asc_putIdentifier=function(v){this.identifier=v};CCore.prototype.asc_putKeywords=function(v){this.keywords=v};CCore.prototype.asc_putLanguage=function(v){this.language=v};CCore.prototype.asc_putLastPrinted=function(v){this.lastPrinted=v};CCore.prototype.asc_putSubject=function(v){this.subject=v};CCore.prototype.asc_putVersion=function(v){this.version=v};CCore.prototype.setProps=function(oProps){History.Add(new CChangesCorePr(this,this,oProps,null)); this.title=oProps.title;this.creator=oProps.creator;this.description=oProps.description;this.subject=oProps.subject};CCore.prototype.Get_Id=function(){return this.Id};CCore.prototype.Refresh_RecalcData=function(){};CCore.prototype.Refresh_RecalcData2=function(){};CCore.prototype.getObjectType=function(){return AscDFH.historyitem_type_Core};CCore.prototype.Write_ToBinary2=function(oWriter){oWriter.WriteLong(this.getObjectType());oWriter.WriteString2(this.Get_Id())};CCore.prototype.Read_FromBinary2= function(oReader){this.Id=oReader.GetString2()};CCore.prototype.copy=function(){return AscFormat.ExecuteNoHistory(function(){var oCopy=new CCore;oCopy.category=this.category;oCopy.contentStatus=this.contentStatus;oCopy.created=this.created;oCopy.creator=this.creator;oCopy.description=this.description;oCopy.identifier=this.identifier;oCopy.keywords=this.keywords;oCopy.language=this.language;oCopy.lastModifiedBy=this.lastModifiedBy;oCopy.lastPrinted=this.lastPrinted;oCopy.modified=this.modified;oCopy.revision= this.revision;oCopy.subject=this.subject;oCopy.title=this.title;oCopy.version=this.version;return oCopy},this,[])};function CVariantVector(){this.baseType=null;this.size=null;this.variants=[]}CVariantVector.prototype.fromStream=function(s){var _type;var _len=s.GetULong();var _start_pos=s.cur;var _end_pos=_len+_start_pos;var _at;var _sa=s.GetUChar();while(true){_at=s.GetUChar();if(_at==g_nodeAttributeEnd)break;switch(_at){case 0:{this.baseType=s.GetUChar();break}case 1:{this.size=s.GetLong();break}default:return}}while(true){if(s.cur>= _end_pos)break;_type=s.GetUChar();switch(_type){case 0:{s.Skip2(4);var _c=s.GetULong();for(var i=0;i<_c;++i){s.Skip2(1);var tmp=new CVariant;tmp.fromStream(s);this.variants.push(tmp)}break}default:{s.SkipRecord();break}}}s.Seek2(_end_pos)};CVariantVector.prototype.toStream=function(s){s.WriteUChar(AscCommon.g_nodeAttributeStart);s._WriteUChar2(0,this.baseType);s._WriteInt2(1,this.size);s.WriteUChar(g_nodeAttributeEnd);s.WriteRecordArray4(0,0,this.variants)};function CVariantArray(){this.baseType= null;this.lBounds=null;this.uBounds=null;this.variants=[]}CVariantArray.prototype.fromStream=function(s){var _type;var _len=s.GetULong();var _start_pos=s.cur;var _end_pos=_len+_start_pos;var _at;var _sa=s.GetUChar();while(true){_at=s.GetUChar();if(_at==g_nodeAttributeEnd)break;switch(_at){case 0:{this.baseType=s.GetUChar();break}case 1:{this.lBounds=s.GetString2();break}case 2:{this.uBounds=s.GetString2();break}default:return}}while(true){if(s.cur>=_end_pos)break;_type=s.GetUChar();switch(_type){case 0:{s.Skip2(4); var _c=s.GetULong();for(var i=0;i<_c;++i){s.Skip2(1);var tmp=new CVariant;tmp.fromStream(s);this.variants.push(tmp)}break}default:{s.SkipRecord();break}}}s.Seek2(_end_pos)};CVariantArray.prototype.toStream=function(s){s.WriteUChar(AscCommon.g_nodeAttributeStart);s._WriteUChar2(0,this.baseType);s._WriteString2(1,this.lBounds);s._WriteString2(2,this.uBounds);s.WriteUChar(g_nodeAttributeEnd);s.WriteRecordArray4(0,0,this.variants)};function CVariantVStream(){this.version=null;this.strContent=null}CVariantVStream.prototype.fromStream= function(s){var _type;var _len=s.GetULong();var _start_pos=s.cur;var _end_pos=_len+_start_pos;var _at;var _sa=s.GetUChar();while(true){_at=s.GetUChar();if(_at==g_nodeAttributeEnd)break;switch(_at){case 0:{this.version=s.GetString2();break}default:return}}while(true){if(s.cur>=_end_pos)break;_type=s.GetUChar();switch(_type){case 0:{this.strContent=s.GetString2();break}default:{s.SkipRecord();break}}}s.Seek2(_end_pos)};CVariantVStream.prototype.toStream=function(s){s.WriteUChar(AscCommon.g_nodeAttributeStart); s._WriteString2(0,this.version);s.WriteUChar(g_nodeAttributeEnd);s._WriteString2(0,this.strContent)};function CVariant(){this.type=null;this.strContent=null;this.iContent=null;this.uContent=null;this.dContent=null;this.bContent=null;this.variant=null;this.vector=null;this.array=null;this.vStream=null}CVariant.prototype.fromStream=function(s){var _type;var _len=s.GetULong();var _start_pos=s.cur;var _end_pos=_len+_start_pos;var _at;var _sa=s.GetUChar();while(true){_at=s.GetUChar();if(_at==g_nodeAttributeEnd)break; switch(_at){case 0:{this.type=s.GetUChar();break}default:return}}while(true){if(s.cur>=_end_pos)break;_type=s.GetUChar();switch(_type){case 0:{this.strContent=s.GetString2();break}case 1:{this.iContent=s.GetLong();break}case 2:{this.iContent=s.GetULong();break}case 3:{this.dContent=s.GetDouble();break}case 4:{this.bContent=s.GetBool();break}case 5:{this.variant=new CVariant;this.variant.fromStream(s);break}case 6:{this.vector=new CVariantVector;this.vector.fromStream(s);break}case 7:{this.array=new CVariantArray; this.array.fromStream(s);break}case 8:{this.vStream=new CVariantVStream;this.vStream.fromStream(s);break}default:{s.SkipRecord();break}}}s.Seek2(_end_pos)};CVariant.prototype.toStream=function(s){s.WriteUChar(AscCommon.g_nodeAttributeStart);s._WriteUChar2(0,this.type);s.WriteUChar(g_nodeAttributeEnd);s._WriteString2(0,this.strContent);s._WriteInt2(1,this.iContent);s._WriteUInt2(2,this.uContent);s._WriteDoubleReal2(3,this.dContent);s._WriteBool2(4,this.bContent);s.WriteRecord4(5,this.variant);s.WriteRecord4(6, this.vector);s.WriteRecord4(7,this.array);s.WriteRecord4(8,this.vStream)};CVariant.prototype.setText=function(val){this.type=c_oVariantTypes.vtLpwstr;this.strContent=val};CVariant.prototype.setNumber=function(val){this.type=c_oVariantTypes.vtI4;this.iContent=val};CVariant.prototype.setDate=function(val){this.type=c_oVariantTypes.vtFiletime;this.strContent=val.toISOString().slice(0,19)+"Z"};CVariant.prototype.setBool=function(val){this.type=c_oVariantTypes.vtBool;this.bContent=val};function CCustomProperty(){this.fmtid= null;this.pid=null;this.name=null;this.linkTarget=null;this.content=null}CCustomProperty.prototype.fromStream=function(s){var _type;var _len=s.GetULong();var _start_pos=s.cur;var _end_pos=_len+_start_pos;var _at;var _sa=s.GetUChar();while(true){_at=s.GetUChar();if(_at==g_nodeAttributeEnd)break;switch(_at){case 0:{this.fmtid=s.GetString2();break}case 1:{this.pid=s.GetLong();break}case 2:{this.name=s.GetString2();break}case 3:{this.linkTarget=s.GetString2();break}default:return}}while(true){if(s.cur>= _end_pos)break;_type=s.GetUChar();switch(_type){case 0:{this.content=new CVariant;this.content.fromStream(s);break}default:{s.SkipRecord();break}}}s.Seek2(_end_pos)};CCustomProperty.prototype.toStream=function(s){s.WriteUChar(AscCommon.g_nodeAttributeStart);s._WriteString2(0,this.fmtid);s._WriteInt2(1,this.pid);s._WriteString2(2,this.name);s._WriteString2(3,this.linkTarget);s.WriteUChar(g_nodeAttributeEnd);s.WriteRecord4(0,this.content)};function CCustomProperties(){this.properties=[]}CCustomProperties.prototype.fromStream= function(s){var _type=s.GetUChar();var _len=s.GetULong();var _start_pos=s.cur;var _end_pos=_len+_start_pos;var _at;var _sa=s.GetUChar();while(true){_at=s.GetUChar();if(_at==g_nodeAttributeEnd)break}while(true){if(s.cur>=_end_pos)break;_type=s.GetUChar();switch(_type){case 0:{s.Skip2(4);var _c=s.GetULong();for(var i=0;i<_c;++i){s.Skip2(1);var tmp=new CCustomProperty;tmp.fromStream(s);this.properties.push(tmp)}break}default:{s.SkipRecord();break}}}s.Seek2(_end_pos)};CCustomProperties.prototype.toStream= function(s){s.StartRecord(AscCommon.c_oMainTables.CustomProperties);s.WriteUChar(AscCommon.g_nodeAttributeStart);s.WriteUChar(g_nodeAttributeEnd);this.fillNewPid();s.WriteRecordArray4(0,0,this.properties);s.EndRecord()};CCustomProperties.prototype.fillNewPid=function(s){var index=2;this.properties.forEach(function(property){property.pid=index++})};CCustomProperties.prototype.add=function(name,variant,opt_linkTarget){var newProperty=new CCustomProperty;newProperty.fmtid="{D5CDD505-2E9C-101B-9397-08002B2CF9AE}"; newProperty.pid=null;newProperty.name=name;newProperty.linkTarget=opt_linkTarget||null;newProperty.content=variant;this.properties.push(newProperty)};function CPres(){this.defaultTextStyle=null;this.NotesSz=null;this.attrAutoCompressPictures=null;this.attrBookmarkIdSeed=null;this.attrCompatMode=null;this.attrConformance=null;this.attrEmbedTrueTypeFonts=null;this.attrFirstSlideNum=null;this.attrRemovePersonalInfoOnSave=null;this.attrRtl=null;this.attrSaveSubsetFonts=null;this.attrServerZoom=null;this.attrShowSpecialPlsOnTitleSld= null;this.attrStrictFirstAndLastChars=null;this.fromStream=function(s,reader){var _type=s.GetUChar();var _len=s.GetULong();var _start_pos=s.cur;var _end_pos=_len+_start_pos;var _sa=s.GetUChar();var oPresentattion=reader.presentation;while(true){var _at=s.GetUChar();if(_at==g_nodeAttributeEnd)break;switch(_at){case 0:{this.attrAutoCompressPictures=s.GetBool();break}case 1:{this.attrBookmarkIdSeed=s.GetLong();break}case 2:{this.attrCompatMode=s.GetBool();break}case 3:{this.attrConformance=s.GetUChar(); break}case 4:{this.attrEmbedTrueTypeFonts=s.GetBool();break}case 5:{this.attrFirstSlideNum=s.GetLong();break}case 6:{this.attrRemovePersonalInfoOnSave=s.GetBool();break}case 7:{this.attrRtl=s.GetBool();break}case 8:{this.attrSaveSubsetFonts=s.GetBool();break}case 9:{this.attrServerZoom=s.GetString2();break}case 10:{this.attrShowSpecialPlsOnTitleSld=s.GetBool();break}case 11:{this.attrStrictFirstAndLastChars=s.GetBool();break}default:return}}while(true){if(s.cur>=_end_pos)break;_type=s.GetUChar(); switch(_type){case 0:{this.defaultTextStyle=reader.ReadTextListStyle();break}case 1:{s.SkipRecord();break}case 2:{s.SkipRecord();break}case 3:{s.SkipRecord();break}case 4:{s.SkipRecord();break}case 5:{var oSldSize=new AscCommonSlide.CSlideSize;s.Skip2(5);while(true){var _at=s.GetUChar();if(_at==g_nodeAttributeEnd)break;switch(_at){case 0:{oSldSize.setCX(s.GetLong());break}case 1:{oSldSize.setCY(s.GetLong());break}case 2:{oSldSize.setType(s.GetUChar());break}default:return}}if(oPresentattion.setSldSz)oPresentattion.setSldSz(oSldSize); break}case 6:{var _end_rec2=s.cur+s.GetULong()+4;while(s.cur<_end_rec2){var _rec=s.GetUChar();switch(_rec){case 0:{s.Skip2(4);var lCount=s.GetULong();for(var i=0;i0&&pic.nvPicPr&&pic.nvPicPr.nvPr){var oUniMedia=new AscFormat.UniMedia;oUniMedia.type=type;oUniMedia.media=sMaskFileName;pic.nvPicPr.nvPr.setUniMedia(oUniMedia)}s.Seek2(_end_rec); return pic};this.ReadOleInfo=function(ole){var s=this.stream;var _rec_start=s.cur;var _end_rec=_rec_start+s.GetLong()+4;s.Skip2(1);var dxaOrig=0;var dyaOrig=0;while(true){var _at=s.GetUChar();if(_at==g_nodeAttributeEnd)break;switch(_at){case 0:{ole.setApplicationId(s.GetString2());break}case 1:{ole.setData(s.GetString2());break}case 2:{dxaOrig=s.GetULong();break}case 3:{dyaOrig=s.GetULong();break}case 4:{s.GetUChar();break}case 5:{s.GetUChar();break}case 6:{s.GetUChar();break}case 7:{ole.setObjectFile(s.GetString2()); break}default:break}}var oleType=null;while(s.cur<_end_rec){var _at=s.GetUChar();switch(_at){case 1:{s.GetLong();oleType=s.GetUChar();ole.setOleType(oleType);break}case 2:{var binary_length;switch(oleType){case 0:{binary_length=s.GetULong();ole.setBinaryData(s.data.slice(s.cur,s.cur+binary_length));s.Seek2(s.cur+binary_length);break}case 1:{ole.setObjectFile("maskFile.docx");binary_length=s.GetULong();ole.setBinaryData(s.data.slice(s.cur,s.cur+binary_length));s.Seek2(s.cur+binary_length);break}case 2:{ole.setObjectFile("maskFile.xlsx"); binary_length=s.GetULong();ole.setBinaryData(s.data.slice(s.cur,s.cur+binary_length));s.Seek2(s.cur+binary_length);break}case 4:{s.GetLong();var type2=s.GetUChar();if(c_oSer_OMathContentType.OMath===type2&&ole.parent&&ole.parent.Parent){var length2=s.GetLong();var _stream=new AscCommon.FT_Stream2;_stream.data=s.data;_stream.pos=s.pos;_stream.cur=s.cur;_stream.size=s.size;var oReadResult=this.BaseReader?this.BaseReader.oReadResult:new AscCommonWord.DocReadResult(null);var boMathr=new Binary_oMathReader(_stream, oReadResult,null);var oMathPara=new ParaMath;ole.parent.ParaMath=oMathPara;var par=ole.parent.Parent;var oParStruct=new OpenParStruct(par,par);oParStruct.cur.pos=par.Content.length-1;boMathr.bcr.Read1(length2,function(t,l){return boMathr.ReadMathArg(t,l,oMathPara.Root,oParStruct)});oMathPara.Root.Correct_Content(true)}else s.SkipRecord();break}default:{s.SkipRecord();break}}break}default:{s.SkipRecord();break}}}if(dxaOrig>0&&dyaOrig>0){var ratio=4/3/20;ole.setPixSizes(ratio*dxaOrig,ratio*dyaOrig)}s.Seek2(_end_rec)}; this.ReadGroupShape=function(){var s=this.stream;var shape=new AscFormat.CGroupShape;shape.setBDeleted(false);shape.setParent(this.TempMainObject==null?this.ParaDrawing:null);this.TempGroupObject=shape;var oldParaDrawing=this.ParaDrawing;this.ParaDrawing=null;var _rec_start=s.cur;var _end_rec=_rec_start+s.GetULong()+4;while(s.cur<_end_rec){var _at=s.GetUChar();switch(_at){case 0:{s.SkipRecord();break}case 1:{var spPr=new AscFormat.CSpPr;this.Reader.ReadGrSpPr(spPr);shape.setSpPr(spPr);shape.spPr.setParent(shape); break}case 2:{s.Skip2(4);var _c=s.GetULong();for(var i=0;i<_c;i++){s.Skip2(1);var __len=s.GetULong();if(__len==0)continue;var _type=s.GetUChar();var sp;switch(_type){case 1:{sp=this.ReadShape();if(sp.spPr&&sp.spPr.xfrm){sp.setGroup(shape);shape.addToSpTree(shape.spTree.length,sp)}break}case 6:case 2:case 7:case 8:{sp=this.ReadPic(_type);if(sp.spPr&&sp.spPr.xfrm){sp.setGroup(shape);shape.addToSpTree(shape.spTree.length,sp)}break}case 3:{sp=this.ReadCxn();if(sp.spPr&&sp.spPr.xfrm){sp.setGroup(shape); shape.addToSpTree(shape.spTree.length,sp)}break}case 4:{sp=this.ReadGroupShape();if(sp&&sp.spPr&&sp.spPr.xfrm&&sp.spTree.length>0){sp.setGroup(shape);shape.addToSpTree(shape.spTree.length,sp)}break}case 5:{var _chart=this.Reader.ReadChartDataInGroup(shape);if(null!=_chart){_chart.setGroup(shape);shape.addToSpTree(shape.spTree.length,_chart)}break}default:{s.SkipRecord();break}}}break}default:{s.SkipRecord();break}}}if(oldParaDrawing&&shape.spPr&&!shape.spPr.xfrm)shape.bEmptyTransform=true;if(!oldParaDrawing)this.Reader.CheckGroupXfrm(shape); this.ParaDrawing=oldParaDrawing;s.Seek2(_end_rec);this.TempGroupObject=null;return shape};this.ReadSpPr=function(spPr){var s=this.stream;var _rec_start=s.cur;var _end_rec=_rec_start+s.GetULong()+4;s.Skip2(1);while(true){var _at=s.GetUChar();if(_at==AscCommon.g_nodeAttributeEnd)break;if(0==_at)spPr.bwMode=s.GetUChar();else break}while(s.cur<_end_rec){var _at=s.GetUChar();switch(_at){case 0:{spPr.setXfrm(this.Reader.ReadXfrm());spPr.xfrm.setParent(spPr);break}case 1:{var oGeometry=this.Reader.ReadGeometry(spPr.xfrm); if(oGeometry&&oGeometry.pathLst.length>0)spPr.setGeometry(oGeometry);break}case 2:{spPr.setFill(this.Reader.ReadUniFill(spPr,null,null));break}case 3:{spPr.setLn(this.Reader.ReadLn());break}case 4:{spPr.setEffectPr(this.Reader.ReadEffectProperties());break}case 5:{var _len=s.GetULong();s.Skip2(_len);break}case 6:{var _len=s.GetULong();s.Skip2(_len);break}default:{s.SkipRecord();break}}}s.Seek2(_end_rec)};this.CorrectXfrm=function(_xfrm){if(!_xfrm)return;if(null==_xfrm.rot)return;var nInvertRotate= 0;if(true===_xfrm.flipH)nInvertRotate+=1;if(true===_xfrm.flipV)nInvertRotate+=1;var _rot=_xfrm.rot;var _del=2*Math.PI;if(nInvertRotate)_rot=-_rot;if(_rot>=_del){var _intD=_rot/_del>>0;_rot=_rot-_intD*_del}else if(_rot<0){var _intD=-_rot/_del>>0;_intD=1+_intD;_rot=_rot+_intD*_del}_xfrm.rot=_rot};this.CheckImagesNeeds=function(logicDoc){var index=0;logicDoc.ImageMap={};for(var i in this.ImageMapChecker)logicDoc.ImageMap[index++]=i};this.Clear=function(bClearStreamOnly){this.Reader.stream=null;this.stream= null;this.BaseReader=null;if(!bClearStreamOnly)this.ImageMapChecker={}}}window["AscCommon"]=window["AscCommon"]||{};window["AscCommon"].c_dScalePPTXSizes=c_dScalePPTXSizes;window["AscCommon"].CBuilderImages=CBuilderImages;window["AscCommon"].BinaryPPTYLoader=BinaryPPTYLoader;window["AscCommon"].IsHiddenObj=IsHiddenObj;window["AscCommon"].pptx_content_loader=new CPPTXContentLoader;window["AscCommon"].CApp=CApp;prot=CApp.prototype;prot["asc_getTemplate"]=prot.asc_getTemplate;prot["asc_getTotalTime"]= prot.asc_getTotalTime;prot["asc_getWords"]=prot.asc_getWords;prot["asc_getApplication"]=prot.asc_getApplication;prot["asc_getPresentationFormat"]=prot.asc_getPresentationFormat;prot["asc_getParagraphs"]=prot.asc_getParagraphs;prot["asc_getSlides"]=prot.asc_getSlides;prot["asc_getNotes"]=prot.asc_getNotes;prot["asc_getHiddenSlides"]=prot.asc_getHiddenSlides;prot["asc_getMMClips"]=prot.asc_getMMClips;prot["asc_getScaleCrop"]=prot.asc_getScaleCrop;prot["asc_getCompany"]=prot.asc_getCompany;prot["asc_getLinksUpToDate"]= prot.asc_getLinksUpToDate;prot["asc_getSharedDoc"]=prot.asc_getSharedDoc;prot["asc_getHyperlinksChanged"]=prot.asc_getHyperlinksChanged;prot["asc_getAppVersion"]=prot.asc_getAppVersion;prot["asc_getCharacters"]=prot.asc_getCharacters;prot["asc_getCharactersWithSpaces"]=prot.asc_getCharactersWithSpaces;prot["asc_getDocSecurity"]=prot.asc_getDocSecurity;prot["asc_getHyperlinkBase"]=prot.asc_getHyperlinkBase;prot["asc_getLines"]=prot.asc_getLines;prot["asc_getManager"]=prot.asc_getManager;prot["asc_getPages"]= prot.asc_getPages;window["AscCommon"].CCore=CCore;prot=CCore.prototype;prot["asc_getTitle"]=prot.asc_getTitle;prot["asc_getCreator"]=prot.asc_getCreator;prot["asc_getLastModifiedBy"]=prot.asc_getLastModifiedBy;prot["asc_getRevision"]=prot.asc_getRevision;prot["asc_getCreated"]=prot.asc_getCreated;prot["asc_getModified"]=prot.asc_getModified;prot["asc_getCategory"]=prot.asc_getCategory;prot["asc_getContentStatus"]=prot.asc_getContentStatus;prot["asc_getDescription"]=prot.asc_getDescription;prot["asc_getIdentifier"]= prot.asc_getIdentifier;prot["asc_getKeywords"]=prot.asc_getKeywords;prot["asc_getLanguage"]=prot.asc_getLanguage;prot["asc_getLastPrinted"]=prot.asc_getLastPrinted;prot["asc_getSubject"]=prot.asc_getSubject;prot["asc_getVersion"]=prot.asc_getVersion;prot["asc_putTitle"]=prot.asc_putTitle;prot["asc_putCreator"]=prot.asc_putCreator;prot["asc_putLastModifiedBy"]=prot.asc_putLastModifiedBy;prot["asc_putRevision"]=prot.asc_putRevision;prot["asc_putCreated"]=prot.asc_putCreated;prot["asc_putModified"]= prot.asc_putModified;prot["asc_putCategory"]=prot.asc_putCategory;prot["asc_putContentStatus"]=prot.asc_putContentStatus;prot["asc_putDescription"]=prot.asc_putDescription;prot["asc_putIdentifier"]=prot.asc_putIdentifier;prot["asc_putKeywords"]=prot.asc_putKeywords;prot["asc_putLanguage"]=prot.asc_putLanguage;prot["asc_putLastPrinted"]=prot.asc_putLastPrinted;prot["asc_putSubject"]=prot.asc_putSubject;prot["asc_putVersion"]=prot.asc_putVersion;window["AscCommon"].CCustomProperties=CCustomProperties; prot=CCustomProperties.prototype;prot["add"]=prot.add;window["AscCommon"].c_oVariantTypes=c_oVariantTypes;window["AscCommon"].CVariant=CVariant;prot=CVariant.prototype;prot["setText"]=prot.setText;prot["setNumber"]=prot.setNumber;prot["setDate"]=prot.setDate;prot["setBool"]=prot.setBool})(window);"use strict";(function(window,undefined){var c_dScalePPTXSizes=AscCommon.c_dScalePPTXSizes;var g_nodeAttributeStart=AscCommon.g_nodeAttributeStart;var g_nodeAttributeEnd=AscCommon.g_nodeAttributeEnd;var c_oAscColor= Asc.c_oAscColor;var c_oAscFill=Asc.c_oAscFill;var c_oMainTables={Main:255,App:1,Core:2,Presentation:3,ViewProps:4,VmlDrawing:5,TableStyles:6,PresProps:7,JsaProject:8,Themes:20,ThemeOverride:21,SlideMasters:22,SlideLayouts:23,Slides:24,NotesMasters:25,NotesSlides:26,HandoutMasters:30,SlideRels:40,ThemeRels:41,ImageMap:42,FontMap:43,SlideNotesRels:45,NotesRels:46,NotesMastersRels:47,CustomProperties:48};function CSeekTableEntry(){this.Type=0;this.SeekPos=0}function GUID(){var S4=function(){var ret= ((1+Math.random())*65536|0).toString(16).substring(1);ret=ret.toUpperCase();return ret};return S4()+S4()+"-"+S4()+"-"+S4()+"-"+S4()+"-"+S4()+S4()+S4()}function CBinaryFileWriter(){this.tableStylesGuides={};this.Init=function(){var _canvas=document.createElement("canvas");var _ctx=_canvas.getContext("2d");this.len=1024*1024*5;this.ImData=_ctx.createImageData(this.len/4,1);this.data=this.ImData.data;this.pos=0};this.IsWordWriter=false;this.ImData=null;this.data=null;this.len=0;this.pos=0;this.Init(); this.UseContinueWriter=0;this.IsUseFullUrl=false;this.PresentationThemesOrigin="";this.max_shape_id=3;this.arr_map_shapes_id={};this.DocSaveParams=null;var oThis=this;this.GetSpIdxId=function(sEditorId){if(typeof sEditorId==="string"&&sEditorId.length>0){var oDrawing=AscCommon.g_oTableId.Get_ById(sEditorId);if(oDrawing&&oDrawing.getFormatId)return oDrawing.getFormatId()}return null};this.ImportFromMemory=function(memory){this.ImData=memory.ImData;this.data=memory.data;this.len=memory.len;this.pos= memory.pos};this.ExportToMemory=function(memory){memory.ImData=this.ImData;memory.data=this.data;memory.len=this.len;memory.pos=this.pos};this.Start_UseFullUrl=function(){this.IsUseFullUrl=true};this.Start_UseDocumentOrigin=function(origin){this.PresentationThemesOrigin=origin};this.End_UseFullUrl=function(){this.IsUseFullUrl=false};this.Copy=function(oMemory,nPos,nLen){for(var Index=0;Index=this.len){var _canvas=document.createElement("canvas");var _ctx=_canvas.getContext("2d");var oldImData=this.ImData;var oldData=this.data;var oldPos=this.pos;this.len=Math.max(this.len*2,this.pos+(3*count/2>>0));this.ImData=_ctx.createImageData(this.len/4,1);this.data=this.ImData.data;var newData=this.data;for(var i=0;i>>8&255};this.WriteULong=function(val){this.CheckSize(4);this.data[this.pos++]=val&255;this.data[this.pos++]=val>>>8&255;this.data[this.pos++]=val>>>16&255;this.data[this.pos++]=val>>>24&255};this.WriteDouble=function(val){this.WriteULong(val*1E5>>0)};var tempHelp=new ArrayBuffer(8);var tempHelpUnit=new Uint8Array(tempHelp); var tempHelpFloat=new Float64Array(tempHelp);this.WriteDoubleReal=function(val){this.CheckSize(8);tempHelpFloat[0]=val;this.data[this.pos++]=tempHelpUnit[0];this.data[this.pos++]=tempHelpUnit[1];this.data[this.pos++]=tempHelpUnit[2];this.data[this.pos++]=tempHelpUnit[3];this.data[this.pos++]=tempHelpUnit[4];this.data[this.pos++]=tempHelpUnit[5];this.data[this.pos++]=tempHelpUnit[6];this.data[this.pos++]=tempHelpUnit[7]};this.WriteString=function(text){var count=text.length&65535;this.WriteULong(count); this.CheckSize(count);for(var i=0;i>>8&255}};this.WriteBuffer=function(data,_pos,count){this.CheckSize(count);for(var i=0;i>0)};this._WriteDouble1=function(type,val){var _val=val*1E5;this._WriteInt1(type,_val)};this._WriteDouble2=function(type,val){if(val!=null)this._WriteDouble1(type,val)};this._WriteDoubleReal1=function(type,val){this.WriteUChar(type);this.WriteDoubleReal(val)};this._WriteDoubleReal2=function(type,val){if(val!=null)this._WriteDoubleReal1(type,val)};this._WriteLimit1=this._WriteUChar1;this._WriteLimit2=this._WriteUChar2;this.WriteRecord1=function(type, val,func_write){this.StartRecord(type);func_write(val);this.EndRecord()};this.WriteRecord2=function(type,val,func_write){if(null!=val){this.StartRecord(type);func_write(val);this.EndRecord()}};this.WriteRecord3=function(type,val,func_write){if(null!=val){var _start_pos=this.pos;this.StartRecord(type);func_write(val);this.EndRecord();if(_start_pos+5==this.pos){this.pos-=5;return false}return true}return false};this.WriteRecord4=function(type,val){if(null!=val){this.StartRecord(type);val.toStream(this); this.EndRecord()}};this.WriteRecordArray=function(type,subtype,val_array,func_element_write){this.StartRecord(type);var len=val_array.length;this.WriteULong(len);for(var i=0;i0){var _m=presentation.slideMasters[0];_dst_masters[0]=_m;var _m_rels={ThemeIndex:0,Layouts:[]};var _lay_c=_m.sldLayoutLst.length;var _ind_l=_dst_layouts.length;for(var k=0;k<_lay_c;k++){_dst_layouts[_ind_l]= _m.sldLayoutLst[k];_m_rels.Layouts[k]=_ind_l;_ind_l++}_master_rels[0]=_m_rels;_dst_masters_len=1}for(var i=0;i<_dst_masters_len;i++){var _t=_dst_masters[i].Theme;var is_found=false;var _len_dst=_dst_themes.length;for(var j=0;j<_len_dst;j++)if(_dst_themes[j]==_t){is_found=true;break}if(!is_found){_dst_themes[_len_dst]=_t;_master_rels[i].ThemeIndex=_len_dst}}var i,j;for(i=0;i<_dst_notesMasters.length;++i){for(j=0;j<_dst_themes.length;++j)if(_dst_themes[j]===_dst_notesMasters[i].Theme)break;if(j===_dst_themes.length)_dst_themes.push(_dst_notesMasters[i].Theme)}var oTableStyleIdMap; if(presentation.GetTableStyleIdMap){oTableStyleIdMap={};presentation.GetTableStyleIdMap(oTableStyleIdMap)}else oTableStyleIdMap=presentation.TableStylesIdMap;for(var key in oTableStyleIdMap)if(oTableStyleIdMap.hasOwnProperty(key))this.tableStylesGuides[key]="{"+GUID()+"}";this.StartMainRecord(c_oMainTables.TableStyles);this.StartRecord(c_oMainTables.SlideRels);this.WriteUChar(g_nodeAttributeStart);if(this.tableStylesGuides[presentation.DefaultTableStyleId])this._WriteString1(0,this.tableStylesGuides[presentation.DefaultTableStyleId]); else for(key in this.tableStylesGuides)if(this.tableStylesGuides.hasOwnProperty(key)){this._WriteString1(0,this.tableStylesGuides[key]);break}this.WriteUChar(g_nodeAttributeEnd);this.StartRecord(0);for(key in this.tableStylesGuides)if(this.tableStylesGuides.hasOwnProperty(key))this.WriteTableStyle(key,AscCommon.g_oTableId.m_aPairs[key]);this.EndRecord();this.EndRecord();this.StartMainRecord(c_oMainTables.SlideRels);this.StartRecord(c_oMainTables.SlideRels);this.WriteUChar(g_nodeAttributeStart);for(var i= 0;i<_slide_count;i++)this._WriteInt1(0,_slides_rels[i]);this.WriteUChar(g_nodeAttributeEnd);this.EndRecord();this.StartMainRecord(c_oMainTables.SlideNotesRels);this.StartRecord(c_oMainTables.SlideNotesRels);this.WriteUChar(g_nodeAttributeStart);var _rels,slideNotes,i,j;var _notes=_dst_notes;var _notes_count=_notes.length;for(var i=0;i<_slide_count;++i){slideNotes=presentation.Slides[i].notes;_rels=-1;if(slideNotes)for(j=0;j<_notes_count;++j)if(_notes[j]===slideNotes){_rels=j;break}this._WriteInt1(0, _rels)}this.WriteUChar(g_nodeAttributeEnd);this.EndRecord();this.StartMainRecord(c_oMainTables.NotesMastersRels);this.StartRecord(c_oMainTables.NotesMastersRels);this.WriteUChar(g_nodeAttributeStart);var _notes_masters=_dst_notesMasters;var _notes_masters_count=_notes_masters.length;var _themes=_dst_themes;var _thems_count=_themes.length;var _theme;for(i=0;i<_notes_masters_count;++i){_theme=_notes_masters[i].Theme;_rels=-1;for(j=0;j<_thems_count;++j)if(_theme===_themes[j]){_rels=j;break}this._WriteInt1(0, _rels)}this.WriteUChar(g_nodeAttributeEnd);this.EndRecord();this.StartMainRecord(c_oMainTables.NotesRels);this.StartRecord(c_oMainTables.NotesRels);this.WriteUChar(g_nodeAttributeStart);var _notes_count=_notes.length;for(i=0;i<_notes_count;++i){slideNotes=_notes[i];_rels=-1;for(j=0;j<_notes_masters_count;++j)if(slideNotes.Master===_notes_masters[j]){_rels=j;break}this._WriteInt1(0,_rels)}this.WriteUChar(g_nodeAttributeEnd);this.EndRecord();this.StartMainRecord(c_oMainTables.ThemeRels);this.StartRecord(c_oMainTables.ThemeRels); var _master_count=_dst_masters.length;this.WriteULong(_master_count);for(var i=0;i<_master_count;i++){this.StartRecord(0);this.WriteUChar(g_nodeAttributeStart);this._WriteInt1(0,_master_rels[i].ThemeIndex);this.WriteUChar(1);this.WriteString(_dst_masters[i].ImageBase64);this.WriteUChar(g_nodeAttributeEnd);var _lay_c=_master_rels[i].Layouts.length;this.WriteULong(_lay_c);for(var j=0;j<_lay_c;j++){this.StartRecord(0);this.WriteUChar(g_nodeAttributeStart);var _indL=_master_rels[i].Layouts[j];this._WriteInt1(0, _indL);this.WriteUChar(1);this.WriteString(_dst_layouts[_indL].ImageBase64);this.WriteUChar(g_nodeAttributeEnd);this.EndRecord()}this.EndRecord()}this.EndRecord();var _count_arr=0;_count_arr=_dst_themes.length;this.StartMainRecord(c_oMainTables.Themes);this.WriteULong(_count_arr);for(var i=0;i<_count_arr;i++)this.WriteTheme(_dst_themes[i]);_count_arr=_dst_masters.length;this.StartMainRecord(c_oMainTables.SlideMasters);this.WriteULong(_count_arr);for(var i=0;i<_count_arr;i++)this.WriteSlideMaster(_dst_masters[i]); _count_arr=_dst_layouts.length;this.StartMainRecord(c_oMainTables.SlideLayouts);this.WriteULong(_count_arr);for(var i=0;i<_count_arr;i++)this.WriteSlideLayout(_dst_layouts[i]);_count_arr=_dst_slides.length;this.StartMainRecord(c_oMainTables.Slides);this.WriteULong(_count_arr);for(var i=0;i<_count_arr;i++)this.WriteSlide(_dst_slides[i]);_count_arr=_dst_notes.length;this.StartMainRecord(c_oMainTables.NotesSlides);this.WriteULong(_count_arr);for(var i=0;i<_count_arr;i++)this.WriteSlideNote(_dst_notes[i]); _count_arr=_dst_notesMasters.length;this.StartMainRecord(c_oMainTables.NotesMasters);this.WriteULong(_count_arr);for(var i=0;i<_count_arr;i++)this.WriteNoteMaster(_dst_notesMasters[i]);this.StartMainRecord(c_oMainTables.FontMap);this.StartRecord(c_oMainTables.FontMap);this.WriteUChar(g_nodeAttributeStart);var _index_attr=0;for(var i in this.font_map){this.WriteUChar(_index_attr++);this.WriteString2(i)}this.WriteUChar(g_nodeAttributeEnd);this.EndRecord();this.StartMainRecord(c_oMainTables.ImageMap); this.StartRecord(c_oMainTables.ImageMap);this.WriteUChar(g_nodeAttributeStart);_index_attr=0;for(var i in this.image_map){this.WriteUChar(_index_attr++);this.WriteString2(i)}this.WriteUChar(g_nodeAttributeEnd);this.EndRecord();this.WriteMainPart(startPos)};this.WriteDocument=function(presentation){this.WriteDocument2(presentation);var ret="PPTY;v1;"+this.pos+";";return ret+this.GetBase64Memory()};this.WriteDocument3=function(presentation,base64){var _memory=new AscCommon.CMemory(true);_memory.ImData= this.ImData;_memory.data=this.data;_memory.len=this.len;_memory.pos=this.pos;_memory.WriteXmlString("PPTY;v"+Asc.c_nVersionNoBase64+";0;");this.ImData=_memory.ImData;this.data=_memory.data;this.len=_memory.len;this.pos=_memory.pos;this.WriteDocument2(presentation);_memory.ImData=this.ImData;_memory.data=this.data;_memory.len=this.len;_memory.pos=this.pos;if(!base64)return _memory.GetData();return _memory.GetBase64Memory()};this.WriteByMemory=function(callback){var _memory=new AscCommon.CMemory(true); _memory.ImData=this.ImData;_memory.data=this.data;_memory.len=this.len;_memory.pos=this.pos;callback(_memory);this.ImData=_memory.ImData;this.data=_memory.data;this.len=_memory.len;this.pos=_memory.pos};this.WriteApp=function(app){this.StartMainRecord(c_oMainTables.App);app.toStream(this)};this.WriteCore=function(core,api){this.StartMainRecord(c_oMainTables.Core);core.toStream(this,api)};this.WriteCustomProperties=function(customProperties,api){this.StartMainRecord(c_oMainTables.CustomProperties); customProperties.toStream(this,api)};this.WriteViewProps=function(viewprops){this.StartMainRecord(c_oMainTables.ViewProps);this.StartRecord(c_oMainTables.ViewProps);this.EndRecord()};this.WritePresProps=function(presentation){this.StartMainRecord(c_oMainTables.PresProps);this.StartRecord(c_oMainTables.PresProps);var showPr=presentation.showPr;if(showPr){this.StartRecord(1);this.WriteUChar(g_nodeAttributeStart);this._WriteBool2(0,showPr.loop);this._WriteBool2(1,showPr.showAnimation);this._WriteBool2(2, showPr.showNarration);this._WriteBool2(3,showPr.useTimings);this.WriteUChar(g_nodeAttributeEnd);if(showPr.browse){this.StartRecord(0);this.EndRecord()}if(showPr.show&&null!=showPr.show.custShow){this.StartRecord(1);this.WriteUChar(g_nodeAttributeStart);this._WriteInt2(0,showPr.show.custShow);this.WriteUChar(g_nodeAttributeEnd);this.EndRecord()}if(showPr.kiosk){this.StartRecord(2);this.WriteUChar(g_nodeAttributeStart);this._WriteInt2(0,showPr.kiosk.restart);this.WriteUChar(g_nodeAttributeEnd);this.EndRecord()}this.WriteRecord1(3, showPr.penClr,this.WriteUniColor);if(showPr.present){this.StartRecord(4);this.EndRecord()}if(showPr.show&&null!=showPr.show.showAll){this.StartRecord(5);this.EndRecord()}if(showPr.show&&showPr.show.range&&null!=showPr.show.range.start&&null!=showPr.show.range.end){this.StartRecord(6);this.WriteUChar(g_nodeAttributeStart);this._WriteInt2(0,showPr.show.range.start);this._WriteInt2(1,showPr.show.range.end);this.WriteUChar(g_nodeAttributeEnd);this.EndRecord()}this.EndRecord()}this.EndRecord()};this.WritePresentation= function(presentation){var pres=presentation.pres;this.StartMainRecord(c_oMainTables.Presentation);this.StartRecord(c_oMainTables.Presentation);this.WriteUChar(g_nodeAttributeStart);this._WriteBool2(0,pres.attrAutoCompressPictures);this._WriteInt2(1,pres.attrBookmarkIdSeed);this._WriteBool2(2,pres.attrCompatMode);this._WriteLimit2(3,pres.attrConformance);this._WriteBool2(4,pres.attrEmbedTrueTypeFonts);pres.attrFirstSlideNum=presentation.firstSlideNum;this._WriteInt2(5,pres.attrFirstSlideNum);this._WriteBool2(6, pres.attrRemovePersonalInfoOnSave);this._WriteBool2(7,pres.attrRtl);this._WriteBool2(8,pres.attrSaveSubsetFonts);this._WriteString2(9,pres.attrServerZoom);pres.attrShowSpecialPlsOnTitleSld=presentation.showSpecialPlsOnTitleSld;this._WriteBool2(10,pres.attrShowSpecialPlsOnTitleSld);this._WriteBool2(11,pres.attrStrictFirstAndLastChars);this.WriteUChar(g_nodeAttributeEnd);this.WriteRecord2(0,presentation.defaultTextStyle,this.WriteTextListStyle);var oSldSz=presentation.sldSz;if(oSldSz){this.StartRecord(5); this.WriteUChar(g_nodeAttributeStart);this._WriteInt1(0,oSldSz.cx);this._WriteInt1(1,oSldSz.cy);this._WriteLimit2(2,oSldSz.type);this.WriteUChar(g_nodeAttributeEnd);this.EndRecord()}this.StartRecord(3);this.WriteUChar(g_nodeAttributeStart);this._WriteInt1(0,presentation.GetWidthEMU());this._WriteInt1(1,presentation.GetHeightEMU());this.WriteUChar(g_nodeAttributeEnd);this.EndRecord();if(!this.IsUseFullUrl){var _countAuthors=0;for(var i in presentation.CommentAuthors)++_countAuthors;if(_countAuthors> 0){this.StartRecord(6);this.StartRecord(0);this.WriteULong(_countAuthors);for(var i in presentation.CommentAuthors){var _author=presentation.CommentAuthors[i];this.StartRecord(0);this.WriteUChar(g_nodeAttributeStart);this._WriteInt1(0,_author.Id);this._WriteInt1(1,_author.LastId);this._WriteInt1(2,_author.Id-1);this._WriteString1(3,_author.Name);this._WriteString1(4,_author.Initials);this.WriteUChar(g_nodeAttributeEnd);this.EndRecord()}this.EndRecord();this.EndRecord()}}var macros=presentation.Api.macros.GetData(); if(macros){this.StartRecord(9);this.WriteByMemory(function(_memory){_memory.WriteXmlString(macros)});this.EndRecord()}if(presentation.writecomments)this.WriteComments(10,presentation.writecomments);this.EndRecord()};this.WriteTheme=function(_theme){this.StartRecord(c_oMainTables.Themes);this.WriteUChar(g_nodeAttributeStart);this._WriteString2(0,_theme.name);if(_theme.isThemeOverride)this._WriteBool1(1,true);this.WriteUChar(g_nodeAttributeEnd);this.WriteRecord1(0,_theme.themeElements,this.WriteThemeElements); this.WriteRecord2(1,_theme.spDef,this.WriteDefaultShapeDefinition);this.WriteRecord2(2,_theme.lnDef,this.WriteDefaultShapeDefinition);this.WriteRecord2(3,_theme.txDef,this.WriteDefaultShapeDefinition);this.WriteRecordArray(4,0,_theme.extraClrSchemeLst,this.WriteExtraClrScheme);this.EndRecord()};this.WriteSlideMaster=function(_master){this.StartRecord(c_oMainTables.SlideMasters);this.WriteUChar(g_nodeAttributeStart);this._WriteBool2(0,_master.preserve);this.WriteUChar(g_nodeAttributeEnd);this.WriteRecord1(0, _master.cSld,this.WriteCSld);this.WriteRecord1(1,_master.clrMap,this.WriteClrMap);this.WriteRecord2(2,_master.transition,this.WriteSlideTransition);var oThis=this;this.WriteRecord2(3,_master.timing,function(){_master.timing.toPPTY(oThis)});this.WriteRecord2(5,_master.hf,this.WriteHF);this.WriteRecord2(6,_master.txStyles,this.WriteTxStyles);this.EndRecord()};this.WriteSlideLayout=function(_layout){this.StartRecord(c_oMainTables.SlideLayouts);this.WriteUChar(g_nodeAttributeStart);this._WriteString2(0, _layout.matchingName);this._WriteBool2(1,_layout.preserve);this._WriteBool2(2,_layout.showMasterPhAnim);this._WriteBool2(3,_layout.showMasterSp);this._WriteBool2(4,_layout.userDrawn);this._WriteLimit2(5,_layout.type);this.WriteUChar(g_nodeAttributeEnd);this.WriteRecord1(0,_layout.cSld,this.WriteCSld);this.WriteRecord2(1,_layout.clrMap,this.WriteClrMapOvr);this.WriteRecord2(2,_layout.transition,this.WriteSlideTransition);var oThis=this;this.WriteRecord2(3,_layout.timing,function(){_layout.timing.toPPTY(oThis)}); this.WriteRecord2(4,_layout.hf,this.WriteHF);this.EndRecord()};this.WriteSlide=function(_slide){this.StartRecord(c_oMainTables.Slides);this.WriteUChar(g_nodeAttributeStart);this._WriteBool2(0,_slide.show);this._WriteBool2(1,_slide.showMasterPhAnim);this._WriteBool2(2,_slide.showMasterSp);this.WriteUChar(g_nodeAttributeEnd);this.WriteRecord1(0,_slide.cSld,this.WriteCSld);this.WriteRecord2(1,_slide.clrMap,this.WriteClrMapOvr);this.WriteRecord2(2,_slide.transition,this.WriteSlideTransition);var oThis= this;this.WriteRecord2(3,_slide.timing,function(){_slide.timing.toPPTY(oThis)});this.WriteComments(4,_slide.writecomments);this.EndRecord()};this.WriteComments=function(type,comments){var _countComments=0;{for(var i in comments)++_countComments}if(_countComments>0){oThis.StartRecord(type);oThis.StartRecord(0);oThis.WriteULong(_countComments);for(var i in comments){var _comment=comments[i];oThis.StartRecord(0);oThis.WriteUChar(g_nodeAttributeStart);oThis._WriteInt1(0,_comment.WriteAuthorId);oThis._WriteString1(1, _comment.WriteTime);oThis._WriteInt1(2,_comment.WriteCommentId);oThis._WriteInt1(3,22.66*_comment.x>>0);oThis._WriteInt1(4,22.66*_comment.y>>0);oThis._WriteString1(5,_comment.Data.m_sText);if(0!=_comment.WriteParentAuthorId){oThis._WriteInt1(6,_comment.WriteParentAuthorId);oThis._WriteInt1(7,_comment.WriteParentCommentId)}oThis._WriteString1(8,_comment.AdditionalData);oThis.WriteUChar(g_nodeAttributeEnd);if(null!=_comment.timeZoneBias){oThis.StartRecord(0);oThis.WriteUChar(g_nodeAttributeStart);oThis._WriteInt1(9, _comment.timeZoneBias);oThis.WriteUChar(g_nodeAttributeEnd);oThis.EndRecord()}oThis.EndRecord()}oThis.EndRecord();oThis.EndRecord()}};this.WriteSlideTransition=function(_transition){oThis.WriteUChar(g_nodeAttributeStart);oThis._WriteBool1(0,_transition.SlideAdvanceOnMouseClick);if(_transition.SlideAdvanceAfter){oThis._WriteInt1(1,_transition.SlideAdvanceDuration);if(_transition.TransitionType==c_oAscSlideTransitionTypes.None)oThis._WriteInt1(2,0)}else if(_transition.TransitionType==c_oAscSlideTransitionTypes.None)oThis._WriteInt1(2, 2E3);if(_transition.TransitionType!=c_oAscSlideTransitionTypes.None){oThis._WriteInt1(2,_transition.TransitionDuration);if(_transition.TransitionDuration<250)oThis._WriteUChar1(3,0);else if(_transition.TransitionDuration>1E3)oThis._WriteUChar1(3,2);else oThis._WriteUChar1(3,1);oThis.WriteUChar(g_nodeAttributeEnd);oThis.StartRecord(0);oThis.WriteUChar(g_nodeAttributeStart);switch(_transition.TransitionType){case c_oAscSlideTransitionTypes.Fade:{oThis._WriteString2(0,"p:fade");switch(_transition.TransitionOption){case c_oAscSlideTransitionParams.Fade_Smoothly:{oThis._WriteString2(1, "thruBlk");oThis._WriteString2(2,"0");break}case c_oAscSlideTransitionParams.Fade_Through_Black:{oThis._WriteString2(1,"thruBlk");oThis._WriteString2(2,"1");break}default:break}break}case c_oAscSlideTransitionTypes.Push:{oThis._WriteString2(0,"p:push");switch(_transition.TransitionOption){case c_oAscSlideTransitionParams.Param_Left:{oThis._WriteString2(1,"dir");oThis._WriteString2(2,"r");break}case c_oAscSlideTransitionParams.Param_Right:{oThis._WriteString2(1,"dir");oThis._WriteString2(2,"l");break}case c_oAscSlideTransitionParams.Param_Top:{oThis._WriteString2(1, "dir");oThis._WriteString2(2,"d");break}case c_oAscSlideTransitionParams.Param_Bottom:{oThis._WriteString2(1,"dir");oThis._WriteString2(2,"u");break}default:break}break}case c_oAscSlideTransitionTypes.Wipe:{switch(_transition.TransitionOption){case c_oAscSlideTransitionParams.Param_Left:{oThis._WriteString2(0,"p:wipe");oThis._WriteString2(1,"dir");oThis._WriteString2(2,"r");break}case c_oAscSlideTransitionParams.Param_Right:{oThis._WriteString2(0,"p:wipe");oThis._WriteString2(1,"dir");oThis._WriteString2(2, "l");break}case c_oAscSlideTransitionParams.Param_Top:{oThis._WriteString2(0,"p:wipe");oThis._WriteString2(1,"dir");oThis._WriteString2(2,"d");break}case c_oAscSlideTransitionParams.Param_Bottom:{oThis._WriteString2(0,"p:wipe");oThis._WriteString2(1,"dir");oThis._WriteString2(2,"u");break}case c_oAscSlideTransitionParams.Param_TopLeft:{oThis._WriteString2(0,"p:strips");oThis._WriteString2(1,"dir");oThis._WriteString2(2,"rd");break}case c_oAscSlideTransitionParams.Param_TopRight:{oThis._WriteString2(0, "p:strips");oThis._WriteString2(1,"dir");oThis._WriteString2(2,"ld");break}case c_oAscSlideTransitionParams.Param_BottomLeft:{oThis._WriteString2(0,"p:strips");oThis._WriteString2(1,"dir");oThis._WriteString2(2,"ru");break}case c_oAscSlideTransitionParams.Param_BottomRight:{oThis._WriteString2(0,"p:strips");oThis._WriteString2(1,"dir");oThis._WriteString2(2,"lu");break}default:break}break}case c_oAscSlideTransitionTypes.Split:{oThis._WriteString2(0,"p:split");switch(_transition.TransitionOption){case c_oAscSlideTransitionParams.Split_HorizontalIn:{oThis._WriteString2(1, "orient");oThis._WriteString2(1,"dir");oThis._WriteString2(2,"horz");oThis._WriteString2(2,"in");break}case c_oAscSlideTransitionParams.Split_HorizontalOut:{oThis._WriteString2(1,"orient");oThis._WriteString2(1,"dir");oThis._WriteString2(2,"horz");oThis._WriteString2(2,"out");break}case c_oAscSlideTransitionParams.Split_VerticalIn:{oThis._WriteString2(1,"orient");oThis._WriteString2(1,"dir");oThis._WriteString2(2,"vert");oThis._WriteString2(2,"in");break}case c_oAscSlideTransitionParams.Split_VerticalOut:{oThis._WriteString2(1, "orient");oThis._WriteString2(1,"dir");oThis._WriteString2(2,"vert");oThis._WriteString2(2,"out");break}default:break}break}case c_oAscSlideTransitionTypes.UnCover:case c_oAscSlideTransitionTypes.Cover:{if(_transition.TransitionType==c_oAscSlideTransitionTypes.Cover)oThis._WriteString2(0,"p:cover");else oThis._WriteString2(0,"p:pull");switch(_transition.TransitionOption){case c_oAscSlideTransitionParams.Param_Left:{oThis._WriteString2(1,"dir");oThis._WriteString2(2,"r");break}case c_oAscSlideTransitionParams.Param_Right:{oThis._WriteString2(1, "dir");oThis._WriteString2(2,"l");break}case c_oAscSlideTransitionParams.Param_Top:{oThis._WriteString2(1,"dir");oThis._WriteString2(2,"d");break}case c_oAscSlideTransitionParams.Param_Bottom:{oThis._WriteString2(1,"dir");oThis._WriteString2(2,"u");break}case c_oAscSlideTransitionParams.Param_TopLeft:{oThis._WriteString2(1,"dir");oThis._WriteString2(2,"rd");break}case c_oAscSlideTransitionParams.Param_TopRight:{oThis._WriteString2(1,"dir");oThis._WriteString2(2,"ld");break}case c_oAscSlideTransitionParams.Param_BottomLeft:{oThis._WriteString2(1, "dir");oThis._WriteString2(2,"ru");break}case c_oAscSlideTransitionParams.Param_BottomRight:{oThis._WriteString2(1,"dir");oThis._WriteString2(2,"lu");break}default:break}break}case c_oAscSlideTransitionTypes.Clock:{switch(_transition.TransitionOption){case c_oAscSlideTransitionParams.Clock_Clockwise:{oThis._WriteString2(0,"p:wheel");oThis._WriteString2(1,"spokes");oThis._WriteString2(2,"1");break}case c_oAscSlideTransitionParams.Clock_Counterclockwise:{oThis._WriteString2(0,"p14:wheelReverse");oThis._WriteString2(1, "spokes");oThis._WriteString2(2,"1");break}case c_oAscSlideTransitionParams.Clock_Wedge:{oThis._WriteString2(0,"p:wedge");break}default:break}break}case c_oAscSlideTransitionTypes.Zoom:{switch(_transition.TransitionOption){case c_oAscSlideTransitionParams.Zoom_In:{oThis._WriteString2(0,"p14:warp");oThis._WriteString2(1,"dir");oThis._WriteString2(2,"in");break}case c_oAscSlideTransitionParams.Zoom_Out:{oThis._WriteString2(0,"p14:warp");oThis._WriteString2(1,"dir");oThis._WriteString2(2,"out");break}case c_oAscSlideTransitionParams.Zoom_AndRotate:{oThis._WriteString2(0, "p:newsflash");break}default:break}break}default:break}oThis.WriteUChar(g_nodeAttributeEnd);oThis.EndRecord()}else oThis.WriteUChar(g_nodeAttributeEnd)};this.WriteSlideNote=function(_note){this.StartRecord(c_oMainTables.NotesSlides);this.WriteUChar(g_nodeAttributeStart);this._WriteBool2(0,_note.showMasterPhAnim);this._WriteBool2(1,_note.showMasterSp);this.WriteUChar(g_nodeAttributeEnd);this.WriteRecord1(0,_note.cSld,this.WriteCSld);this.WriteRecord2(1,_note.clrMap,this.WriteClrMapOvr);this.EndRecord()}; this.WriteNoteMaster=function(_master){this.StartRecord(c_oMainTables.NotesMasters);this.WriteRecord1(0,_master.cSld,this.WriteCSld);this.WriteRecord1(1,_master.clrMap,this.WriteClrMap);this.WriteRecord2(2,_master.hf,this.WriteHF);this.WriteRecord2(3,_master.txStyles,this.WriteTextListStyle);this.EndRecord()};this.WriteThemeElements=function(themeElements){oThis.WriteRecord1(0,themeElements.clrScheme,oThis.WriteClrScheme);oThis.WriteRecord1(1,themeElements.fontScheme,oThis.WriteFontScheme);oThis.WriteRecord1(2, themeElements.fmtScheme,oThis.WriteFmtScheme)};this.WriteFontScheme=function(fontScheme){oThis.WriteUChar(g_nodeAttributeStart);oThis._WriteString1(0,fontScheme.name);oThis.WriteUChar(g_nodeAttributeEnd);oThis.WriteRecord1(0,fontScheme.majorFont,oThis.WriteFontCollection);oThis.WriteRecord1(1,fontScheme.minorFont,oThis.WriteFontCollection)};this.WriteFontCollection=function(coll){oThis.WriteRecord1(0,{Name:coll.latin,Index:-1},oThis.WriteTextFontTypeface);oThis.WriteRecord1(1,{Name:coll.ea,Index:-1}, oThis.WriteTextFontTypeface);oThis.WriteRecord1(2,{Name:coll.cs,Index:-1},oThis.WriteTextFontTypeface)};this.WriteFmtScheme=function(fmt){oThis.WriteUChar(g_nodeAttributeStart);oThis._WriteString1(0,fmt.name);oThis.WriteUChar(g_nodeAttributeEnd);oThis.WriteRecordArray(0,0,fmt.fillStyleLst,oThis.WriteUniFill);oThis.WriteRecordArray(1,0,fmt.lnStyleLst,oThis.WriteLn);oThis.WriteRecordArray(3,0,fmt.bgFillStyleLst,oThis.WriteUniFill)};this.WriteDefaultShapeDefinition=function(shapeDef){oThis.WriteRecord1(0, shapeDef.spPr,oThis.WriteSpPr);oThis.WriteRecord1(1,shapeDef.bodyPr,oThis.WriteBodyPr);oThis.WriteRecord1(2,shapeDef.lstStyle,oThis.WriteTextListStyle);oThis.WriteRecord2(3,shapeDef.style,oThis.WriteShapeStyle)};this.WriteExtraClrScheme=function(extraScheme){oThis.WriteRecord1(0,extraScheme.clrScheme,oThis.WriteClrScheme);oThis.WriteRecord2(1,extraScheme.clrMap,oThis.WriteClrMap)};this.WriteCSld=function(cSld){oThis.WriteUChar(g_nodeAttributeStart);oThis._WriteString2(0,cSld.name);oThis.WriteUChar(g_nodeAttributeEnd); oThis.WriteRecord2(0,cSld.Bg,oThis.WriteBg);var spTree=cSld.spTree;var _len=spTree.length;oThis.StartRecord(1);oThis.StartRecord(4);var uniPr=AscFormat.ExecuteNoHistory(function(){return new AscFormat.UniNvPr},this,[]);uniPr.cNvPr.id=1;uniPr.cNvPr.name="";var spPr=AscFormat.ExecuteNoHistory(function(){return new AscFormat.CSpPr},this,[]);spPr.xfrm=AscFormat.ExecuteNoHistory(function(){return new AscFormat.CXfrm},this,[]);spPr.xfrm.offX=0;spPr.xfrm.offY=0;spPr.xfrm.extX=0;spPr.xfrm.extY=0;spPr.xfrm.chOffX= 0;spPr.xfrm.chOffY=0;spPr.xfrm.chExtX=0;spPr.xfrm.chExtY=0;spPr.WriteXfrm=spPr.xfrm;oThis.WriteRecord1(0,uniPr,oThis.WriteUniNvPr);oThis.WriteRecord1(1,spPr,oThis.WriteSpPr);if(0!=_len)oThis.WriteSpTree(spTree);oThis.EndRecord();oThis.EndRecord()};this.WriteSpTree=function(spTree){var _len=spTree.length;oThis.StartRecord(2);oThis.WriteULong(_len);for(var i=0;i<_len;i++){oThis.StartRecord(0);oThis.WriteSpTreeElem(spTree[i]);oThis.EndRecord()}oThis.EndRecord()};this.WriteSpTreeElem=function(oSp){switch(oSp.getObjectType()){case AscDFH.historyitem_type_Shape:case AscDFH.historyitem_type_Cnx:{oThis.WriteShape(oSp); break}case AscDFH.historyitem_type_OleObject:case AscDFH.historyitem_type_ImageShape:{oThis.WriteImage(oSp);break}case AscDFH.historyitem_type_GroupShape:{oThis.WriteGroupShape(oSp);break}case AscDFH.historyitem_type_GraphicFrame:case AscDFH.historyitem_type_ChartSpace:case AscDFH.historyitem_type_SlicerView:{oThis.WriteGrFrame(oSp);break}}};this.WriteClrMap=function(clrmap){oThis.WriteUChar(g_nodeAttributeStart);var _len=clrmap.color_map.length;for(var i=0;i<_len;++i)if(null!=clrmap.color_map[i]){oThis.WriteUChar(i); oThis.WriteUChar(clrmap.color_map[i])}oThis.WriteUChar(g_nodeAttributeEnd)};this.WriteClrScheme=function(scheme){oThis.WriteUChar(g_nodeAttributeStart);oThis._WriteString1(0,scheme.name);oThis.WriteUChar(g_nodeAttributeEnd);var _len=scheme.colors.length;for(var i=0;i<_len;i++)if(null!=scheme.colors[i])oThis.WriteRecord1(i,scheme.colors[i],oThis.WriteUniColor)};this.WriteClrMapOvr=function(clrmapovr){oThis.WriteRecord2(0,clrmapovr,oThis.WriteClrMap)};this.WriteHF=function(hf){oThis.WriteUChar(g_nodeAttributeStart); oThis._WriteBool2(0,hf.dt===null?true:hf.dt);oThis._WriteBool2(1,hf.ftr===null?true:hf.ftr);oThis._WriteBool2(2,hf.hdr===null?true:hf.hdr);oThis._WriteBool2(3,hf.sldNum===null?true:hf.sldNum);oThis.WriteUChar(g_nodeAttributeEnd)};this.WriteTxStyles=function(txStyles){oThis.WriteRecord2(0,txStyles.titleStyle,oThis.WriteTextListStyle);oThis.WriteRecord2(1,txStyles.bodyStyle,oThis.WriteTextListStyle);oThis.WriteRecord2(2,txStyles.otherStyle,oThis.WriteTextListStyle)};this.WriteTextListStyle=function(styles){var _levels= styles.levels;var _count=_levels.length;var _props_to_write;for(var i=0;i<_count;++i){if(_levels[i]){_props_to_write=new AscFormat.CTextParagraphPr;_props_to_write.bullet=_levels[i].Bullet;_props_to_write.lvl=_levels[i].Lvl;_props_to_write.pPr=_levels[i];_props_to_write.rPr=_levels[i].DefaultRunPr}else _props_to_write=null;oThis.WriteRecord2(i,_props_to_write,oThis.WriteTextParagraphPr)}};this.WriteTextParagraphPr=function(tPr){oThis.WriteUChar(g_nodeAttributeStart);var pPr=tPr.pPr;if(undefined!== pPr&&null!=pPr){switch(pPr.Jc){case AscCommon.align_Left:oThis._WriteUChar1(0,4);break;case AscCommon.align_Center:oThis._WriteUChar1(0,0);break;case AscCommon.align_Right:oThis._WriteUChar1(0,5);break;case AscCommon.align_Justify:oThis._WriteUChar1(0,2);break;default:break}var defTab=pPr.DefaultTab;if(defTab!==undefined&&defTab!=null)oThis._WriteInt1(1,defTab*36E3);var ind=pPr.Ind;if(ind!==undefined&&ind!=null){if(ind.FirstLine!=null)oThis._WriteInt2(5,ind.FirstLine*36E3);if(ind.Left!=null)oThis._WriteInt1(8, ind.Left*36E3);if(ind.Right!=null)oThis._WriteInt1(9,ind.Right*36E3)}}oThis._WriteInt2(7,tPr.lvl);oThis.WriteUChar(g_nodeAttributeEnd);if(undefined!==pPr&&null!=pPr){var spacing=pPr.Spacing;if(spacing!==undefined&&spacing!=null){var _value;switch(spacing.LineRule){case Asc.linerule_Auto:oThis.StartRecord(0);oThis.WriteUChar(g_nodeAttributeStart);oThis._WriteInt1(0,spacing.Line*1E5>>0);oThis.WriteUChar(g_nodeAttributeEnd);oThis.EndRecord();break;case Asc.linerule_Exact:oThis.StartRecord(0);oThis.WriteUChar(g_nodeAttributeStart); _value=spacing.Line/.00352777778>>0;if(_value<0)_value=0;if(_value>158400)_value=158400;oThis._WriteInt1(1,_value);oThis.WriteUChar(g_nodeAttributeEnd);oThis.EndRecord();break;default:break}if(spacing.After!==undefined&&spacing.After!==null){oThis.StartRecord(1);oThis.WriteUChar(g_nodeAttributeStart);_value=spacing.After/.00352777778>>0;if(_value<0)_value=0;if(_value>158400)_value=158400;oThis._WriteInt1(1,_value);oThis.WriteUChar(g_nodeAttributeEnd);oThis.EndRecord()}if(spacing.Before!==undefined&& spacing.Before!==null){oThis.StartRecord(2);oThis.WriteUChar(g_nodeAttributeStart);_value=spacing.Before/.00352777778>>0;if(_value<0)_value=0;if(_value>158400)_value=158400;oThis._WriteInt1(1,_value);oThis.WriteUChar(g_nodeAttributeEnd);oThis.EndRecord()}}}var bullet=tPr.bullet;if(undefined!==bullet&&null!=bullet){if(bullet.bulletColor!=null&&bullet.bulletColor.type!=AscFormat.BULLET_TYPE_COLOR_NONE){oThis.StartRecord(3);if(bullet.bulletColor.type==AscFormat.BULLET_TYPE_COLOR_CLR){oThis.StartRecord(AscFormat.BULLET_TYPE_COLOR_CLR); oThis.WriteRecord2(0,bullet.bulletColor.UniColor,oThis.WriteUniColor);oThis.EndRecord()}else{oThis.StartRecord(AscFormat.BULLET_TYPE_COLOR_CLRTX);oThis.EndRecord()}oThis.EndRecord()}if(bullet.bulletSize!=null&&bullet.bulletSize.type!=AscFormat.BULLET_TYPE_SIZE_NONE){oThis.StartRecord(4);if(bullet.bulletSize.type==AscFormat.BULLET_TYPE_SIZE_PTS){oThis.StartRecord(AscFormat.BULLET_TYPE_SIZE_PTS);oThis.WriteUChar(g_nodeAttributeStart);oThis._WriteInt1(0,bullet.bulletSize.val);oThis.WriteUChar(g_nodeAttributeEnd); oThis.EndRecord()}else if(bullet.bulletSize.type==AscFormat.BULLET_TYPE_SIZE_PCT){oThis.StartRecord(AscFormat.BULLET_TYPE_SIZE_PCT);oThis.WriteUChar(g_nodeAttributeStart);oThis._WriteInt1(0,bullet.bulletSize.val);oThis.WriteUChar(g_nodeAttributeEnd);oThis.EndRecord()}else{oThis.StartRecord(AscFormat.BULLET_TYPE_SIZE_TX);oThis.EndRecord()}oThis.EndRecord()}if(bullet.bulletTypeface!=null&&bullet.bulletTypeface.type!=null&&bullet.bulletTypeface.type!=AscFormat.BULLET_TYPE_TYPEFACE_NONE){oThis.StartRecord(5); if(bullet.bulletTypeface.type==AscFormat.BULLET_TYPE_TYPEFACE_BUFONT)oThis.WriteRecord2(AscFormat.BULLET_TYPE_TYPEFACE_BUFONT,{Name:bullet.bulletTypeface.typeface,Index:-1},oThis.WriteTextFontTypeface);else{oThis.StartRecord(AscFormat.BULLET_TYPE_TYPEFACE_TX);oThis.EndRecord()}oThis.EndRecord()}if(bullet.bulletType!=null&&bullet.bulletType.type!=null){oThis.StartRecord(6);switch(bullet.bulletType.type){case AscFormat.BULLET_TYPE_BULLET_CHAR:{oThis.StartRecord(AscFormat.BULLET_TYPE_BULLET_CHAR);oThis.WriteUChar(g_nodeAttributeStart); oThis._WriteString1(0,bullet.bulletType.Char);oThis.WriteUChar(g_nodeAttributeEnd);oThis.EndRecord();break}case AscFormat.BULLET_TYPE_BULLET_BLIP:{oThis.StartRecord(AscFormat.BULLET_TYPE_BULLET_CHAR);oThis.WriteUChar(g_nodeAttributeStart);oThis._WriteString1(0,"*");oThis.WriteUChar(g_nodeAttributeEnd);oThis.EndRecord();break}case AscFormat.BULLET_TYPE_BULLET_AUTONUM:{oThis.StartRecord(AscFormat.BULLET_TYPE_BULLET_AUTONUM);oThis.WriteUChar(g_nodeAttributeStart);oThis._WriteLimit1(0,bullet.bulletType.AutoNumType); oThis._WriteInt2(1,bullet.bulletType.startAt);oThis.WriteUChar(g_nodeAttributeEnd);oThis.EndRecord();break}case AscFormat.BULLET_TYPE_BULLET_NONE:{oThis.StartRecord(AscFormat.BULLET_TYPE_BULLET_NONE);oThis.EndRecord();break}}oThis.EndRecord()}}if(pPr!==undefined&&pPr!=null&&pPr.Tabs!==undefined&&pPr.Tabs!=null)if(pPr.Tabs.Tabs!=undefined&&pPr.Tabs.Tabs!=null)oThis.WriteRecordArray(7,0,pPr.Tabs.Tabs,oThis.WriteTab);if(tPr!==undefined&&tPr!=null)oThis.WriteRecord2(8,tPr.rPr,oThis.WriteRunProperties)}; this.WriteRunProperties=function(rPr,hlinkObj){if(rPr==null||rPr===undefined)return;oThis.WriteUChar(g_nodeAttributeStart);oThis._WriteBool2(1,rPr.Bold);oThis._WriteBool2(7,rPr.Italic);var _cap=null;if(rPr.Caps===true)_cap=0;else if(rPr.SmallCaps===true)_cap=1;else if(rPr.Caps===false&&rPr.SmallCaps===false)_cap=2;if(null!=_cap)oThis._WriteUChar1(4,_cap);oThis._WriteString2(10,Asc.g_oLcidIdToNameMap[rPr.Lang.Val]);var _strike=null;if(rPr.DStrikeout===true)_strike=0;else if(rPr.Strikeout===true)_strike= 2;else if(rPr.DStrikeout===false&&rPr.Strikeout===false)_strike=1;if(undefined!==rPr.Spacing&&null!=rPr.Spacing)oThis._WriteInt1(15,rPr.Spacing*7200/25.4>>0);if(null!=_strike)oThis._WriteUChar1(16,_strike);if(undefined!==rPr.Underline&&null!=rPr.Underline)oThis._WriteUChar1(18,rPr.Underline===true?13:12);if(undefined!==rPr.FontSize&&null!=rPr.FontSize){var nFontSize=rPr.FontSize*100;nFontSize=Math.max(100,nFontSize);oThis._WriteInt1(17,nFontSize)}if(AscCommon.vertalign_SubScript==rPr.VertAlign)oThis._WriteInt1(2, -25E3);else if(AscCommon.vertalign_SuperScript==rPr.VertAlign)oThis._WriteInt1(2,3E4);oThis.WriteUChar(g_nodeAttributeEnd);if(rPr.TextOutline)oThis.WriteRecord1(0,rPr.TextOutline,oThis.WriteLn);if(rPr.Unifill)oThis.WriteRecord1(1,rPr.Unifill,oThis.WriteUniFill);if(rPr.RFonts){if(rPr.RFonts.Ascii)oThis.WriteRecord2(3,rPr.RFonts.Ascii,oThis.WriteTextFontTypeface);if(rPr.RFonts.EastAsia)oThis.WriteRecord2(4,rPr.RFonts.EastAsia,oThis.WriteTextFontTypeface);if(rPr.RFonts.CS)oThis.WriteRecord2(5,rPr.RFonts.CS, oThis.WriteTextFontTypeface)}if(hlinkObj!=null&&hlinkObj!==undefined)oThis.WriteRecord1(7,hlinkObj,oThis.WriteHyperlink);if(rPr.HighlightColor)oThis.WriteRecord1(12,rPr.HighlightColor,oThis.WriteHighlightColor)};this.WriteHighlightColor=function(HighlightColor){oThis.WriteUChar(g_nodeAttributeStart);oThis.WriteUChar(g_nodeAttributeEnd);oThis.WriteRecord1(0,HighlightColor,oThis.WriteUniColor)};this.WriteHyperlink=function(hlink){oThis.WriteUChar(g_nodeAttributeStart);var url=hlink.Value;var action= null;if(url=="ppaction://hlinkshowjump?jump=firstslide"){action=url;url=""}else if(url=="ppaction://hlinkshowjump?jump=lastslide"){action=url;url=""}else if(url=="ppaction://hlinkshowjump?jump=nextslide"){action=url;url=""}else if(url=="ppaction://hlinkshowjump?jump=previousslide"){action=url;url=""}else{var mask="ppaction://hlinksldjumpslide";var indSlide=url.indexOf(mask);if(0==indSlide){var slideNum=parseInt(url.substring(mask.length));url="slide"+(slideNum+1)+".xml";action="ppaction://hlinksldjump"}}oThis._WriteString1(0, url);oThis._WriteString2(2,action);oThis._WriteString2(4,hlink.tooltip);oThis.WriteUChar(g_nodeAttributeEnd)};this.WriteTextFontTypeface=function(typeface){oThis.WriteUChar(g_nodeAttributeStart);if(!typeface||typeface.Name==null){oThis.font_map["Arial"]=true;oThis._WriteString1(3,"Arial");oThis.WriteUChar(g_nodeAttributeEnd);return}if(0!=typeface.Name.indexOf("+mj")&&0!=typeface.Name.indexOf("+mn"))oThis.font_map[typeface.Name]=true;oThis._WriteString1(3,typeface.Name);oThis.WriteUChar(g_nodeAttributeEnd)}; this.WriteTab=function(tab){oThis.WriteUChar(g_nodeAttributeStart);var _algn=2;if(tab.Value==tab_Center)_algn=0;else if(tab.Value==tab_Right)_algn=3;oThis._WriteLimit2(0,_algn);if(tab.Pos!=undefined&&tab.Pos!=null)oThis._WriteInt1(1,tab.Pos*36E3);oThis.WriteUChar(g_nodeAttributeEnd)};this.WriteBodyPr=function(bodyPr){if(undefined===bodyPr||null==bodyPr){oThis.WriteUChar(g_nodeAttributeStart);oThis.WriteUChar(g_nodeAttributeEnd);return}oThis.WriteUChar(g_nodeAttributeStart);oThis._WriteInt2(0,bodyPr.flatTx); oThis._WriteLimit2(1,bodyPr.anchor);oThis._WriteBool2(2,bodyPr.anchorCtr);oThis._WriteInt4(3,bodyPr.bIns,36E3);oThis._WriteBool2(4,bodyPr.compatLnSpc);oThis._WriteBool2(5,bodyPr.forceAA);oThis._WriteBool2(6,bodyPr.fromWordArt);oThis._WriteLimit2(7,bodyPr.horzOverflow);oThis._WriteInt4(8,bodyPr.lIns,36E3);oThis._WriteInt2(9,bodyPr.numCol);oThis._WriteInt4(10,bodyPr.rIns,36E3);oThis._WriteInt2(11,bodyPr.rot);oThis._WriteBool2(12,bodyPr.rtlCol);oThis._WriteInt4(13,bodyPr.spcCol,36E3);oThis._WriteBool2(14, bodyPr.spcFirstLastPara);oThis._WriteInt4(15,bodyPr.tIns,36E3);oThis._WriteBool2(16,bodyPr.upright);oThis._WriteLimit2(17,bodyPr.vert);oThis._WriteLimit2(18,bodyPr.vertOverflow);oThis._WriteLimit2(19,bodyPr.wrap);oThis.WriteUChar(g_nodeAttributeEnd);oThis.WriteRecord2(0,bodyPr.prstTxWarp,oThis.WritePrstTxWarp);if(bodyPr.textFit)oThis.WriteRecord1(1,bodyPr.textFit,oThis.WriteTextFit)};this.WriteTextFit=function(oTextFit){oThis.WriteUChar(g_nodeAttributeStart);oThis._WriteInt1(0,oTextFit.type+1);oThis._WriteInt2(1, oTextFit.fontScale);oThis._WriteInt2(2,oTextFit.lnSpcReduction);oThis.WriteUChar(g_nodeAttributeEnd)};this.WriteUniColor=function(unicolor){if(undefined===unicolor||null==unicolor||unicolor.color==null)return;var color=unicolor.color;switch(color.type){case c_oAscColor.COLOR_TYPE_PRST:{oThis.StartRecord(c_oAscColor.COLOR_TYPE_PRST);oThis.WriteUChar(g_nodeAttributeStart);oThis._WriteString1(0,color.id);oThis.WriteUChar(g_nodeAttributeEnd);oThis.WriteMods(unicolor.Mods);oThis.EndRecord();break}case c_oAscColor.COLOR_TYPE_SCHEME:{oThis.StartRecord(c_oAscColor.COLOR_TYPE_SCHEME); oThis.WriteUChar(g_nodeAttributeStart);oThis._WriteUChar1(0,color.id);oThis.WriteUChar(g_nodeAttributeEnd);oThis.WriteMods(unicolor.Mods);oThis.EndRecord();break}case c_oAscColor.COLOR_TYPE_SRGB:{oThis.StartRecord(c_oAscColor.COLOR_TYPE_SRGB);oThis.WriteUChar(g_nodeAttributeStart);oThis._WriteUChar1(0,color.RGBA.R);oThis._WriteUChar1(1,color.RGBA.G);oThis._WriteUChar1(2,color.RGBA.B);oThis.WriteUChar(g_nodeAttributeEnd);oThis.WriteMods(unicolor.Mods);oThis.EndRecord();break}case c_oAscColor.COLOR_TYPE_SYS:{oThis.StartRecord(c_oAscColor.COLOR_TYPE_SYS); oThis.WriteUChar(g_nodeAttributeStart);oThis._WriteString1(0,color.id);oThis._WriteUChar1(1,color.RGBA.R);oThis._WriteUChar1(2,color.RGBA.G);oThis._WriteUChar1(3,color.RGBA.B);oThis.WriteUChar(g_nodeAttributeEnd);oThis.WriteMods(unicolor.Mods);oThis.EndRecord();break}case c_oAscColor.COLOR_TYPE_STYLE:{oThis.StartRecord(c_oAscColor.COLOR_TYPE_STYLE);oThis.WriteUChar(g_nodeAttributeStart);if(AscFormat.isRealNumber(color.val))oThis._WriteUInt1(0,color.val);else oThis._WriteBool2(1,color.bAuto);oThis.WriteUChar(g_nodeAttributeEnd); oThis.WriteMods(unicolor.Mods);oThis.EndRecord();break}}};this.WriteMod=function(mod,bAddNamespace){oThis.WriteUChar(g_nodeAttributeStart);var sName=mod.name;if(bAddNamespace){var _find=sName.indexOf(":");if(_find>=0&&_find>0}};this.WriteEffectDag=function(oEffect){oThis.StartRecord(oEffect.Type);oThis.WriteUChar(g_nodeAttributeStart);oThis.WriteString2(0,oEffect.name);oThis._WriteLimit2(1,oEffect.type);oThis.WriteUChar(g_nodeAttributeEnd);oThis.StartRecord(type);var len__=oEffect.effectList.length;oThis._WriteInt2(0,len__);for(var i=0;i0){oThis.StartRecord(2);oThis.WriteULong(effects_count);for(var effect_index=0;effect_index>0;oThis._WriteString1(0,""+_num)}if(fill.srcRect.t!=null){var _num=fill.srcRect.t*1E3>>0;oThis._WriteString1(1,""+_num)}if(fill.srcRect.l!=null){var _num=(100-fill.srcRect.r)*1E3>>0;oThis._WriteString1(2,""+_num)}if(fill.srcRect.l!=null){var _num=(100-fill.srcRect.b)*1E3>>0;oThis._WriteString1(3,""+_num)}oThis.WriteUChar(g_nodeAttributeEnd);oThis.EndRecord()}if(null!=fill.tile){oThis.StartRecord(2); oThis.WriteUChar(g_nodeAttributeStart);oThis._WriteInt2(0,fill.tile.sx);oThis._WriteInt2(1,fill.tile.sy);oThis._WriteInt2(2,fill.tile.tx);oThis._WriteInt2(3,fill.tile.ty);oThis._WriteLimit2(4,fill.tile.algn);oThis._WriteLimit2(5,fill.tile.flip);oThis.WriteUChar(g_nodeAttributeEnd);oThis.EndRecord()}else{oThis.StartRecord(3);oThis.EndRecord()}if(oThis.IsUseFullUrl){var additionalUrl=AscCommon.g_oDocumentUrls.getImageUrlsWithOtherExtention(imageLocal);if(additionalUrl.length>0){oThis.StartRecord(101); oThis.WriteUChar(additionalUrl.length);for(var i=0;i0){_type=image.nvPicPr.nvPr.unimedia.type;_fileMask=image.nvPicPr.nvPr.unimedia.media;bMedia=true}else _type=2;oThis.StartRecord(_type);if(bMedia)oThis.WriteRecord1(5,null,function(){oThis.WriteUChar(g_nodeAttributeStart); oThis._WriteString1(0,_fileMask);oThis.WriteUChar(g_nodeAttributeEnd)})}var nvPicPr;if(image.nvPicPr)nvPicPr=image.nvPicPr;else nvPicPr={};nvPicPr.locks=image.locks;nvPicPr.objectType=image.getObjectType();oThis.WriteRecord1(0,nvPicPr,this.WriteUniNvPr);image.spPr.WriteXfrm=image.spPr.xfrm;var bSetGeometry=false;if(image.spPr.geometry===undefined||image.spPr.geometry==null){bSetGeometry=true;image.spPr.geometry=AscFormat.ExecuteNoHistory(function(){return AscFormat.CreateGeometry("rect")},this,[])}var unifill= new AscFormat.CUniFill;unifill.fill=image.blipFill;oThis.WriteRecord1(1,unifill,oThis.WriteUniFill);oThis.WriteRecord1(2,image.spPr,oThis.WriteSpPr);if(bSetGeometry)image.spPr.geometry=null;oThis.WriteRecord2(3,image.style,oThis.WriteShapeStyle);image.writeMacro(oThis);image.spPr.WriteXfrm=null;oThis.EndRecord()};this.WriteOleInfo=function(ole){var ratio=20*3/4;oThis.WriteUChar(g_nodeAttributeStart);oThis._WriteString2(0,ole.m_sApplicationId);oThis._WriteString2(1,ole.m_sData);oThis._WriteInt2(2, ratio*ole.m_nPixWidth);oThis._WriteInt2(3,ratio*ole.m_nPixHeight);oThis._WriteUChar2(4,0);oThis._WriteUChar2(5,0);oThis._WriteString2(7,ole.m_sObjectFile);oThis.WriteUChar(g_nodeAttributeEnd);if((ole.m_nOleType===0||ole.m_nOleType===1||ole.m_nOleType===2)&&ole.m_aBinaryData!==null){oThis.WriteRecord1(1,ole.m_nOleType,function(val){oThis.WriteUChar(val)});oThis.WriteRecord1(2,0,function(val){oThis.WriteBuffer(ole.m_aBinaryData,0,ole.m_aBinaryData.length)})}};this.WriteGrFrame=function(grObj){oThis.StartRecord(5); oThis.WriteUChar(g_nodeAttributeStart);oThis.WriteUChar(g_nodeAttributeEnd);var nvGraphicFramePr;if(grObj.nvGraphicFramePr)nvGraphicFramePr=grObj.nvGraphicFramePr;else nvGraphicFramePr={};nvGraphicFramePr.locks=grObj.locks;var nObjectType=grObj.getObjectType();nvGraphicFramePr.objectType=nObjectType;oThis.WriteRecord1(0,nvGraphicFramePr,oThis.WriteUniNvPr);if(grObj.spPr&&grObj.spPr.xfrm&&grObj.spPr.xfrm.isNotNull())oThis.WriteRecord2(1,grObj.spPr.xfrm,oThis.WriteXfrm);switch(nObjectType){case AscDFH.historyitem_type_GraphicFrame:{oThis.WriteRecord2(2, grObj.graphicObject,oThis.WriteTable2);break}case AscDFH.historyitem_type_ChartSpace:{oThis.WriteRecord2(3,grObj,oThis.WriteChart2);break}case AscDFH.historyitem_type_SlicerView:{var slicer=grObj.getSlicer();var slicerType=slicer&&slicer.isExt()?6:5;oThis.WriteRecord2(slicerType,grObj,function(){grObj.toStream(oThis)});break}}grObj.writeMacro(oThis);oThis.EndRecord()};this.WriteChart2=function(grObj){var _memory=new AscCommon.CMemory(true);_memory.ImData=oThis.ImData;_memory.data=oThis.data;_memory.len= oThis.len;_memory.pos=oThis.pos;oThis.UseContinueWriter++;var oBinaryChartWriter=new AscCommon.BinaryChartWriter(_memory);oBinaryChartWriter.WriteCT_ChartSpace(grObj);oThis.ImData=_memory.ImData;oThis.data=_memory.data;oThis.len=_memory.len;oThis.pos=_memory.pos;oThis.UseContinueWriter--;_memory.ImData=null;_memory.data=null};this.WriteTable2=function(table){var obj={};obj.props=table.Pr;obj.look=table.TableLook;obj.style=table.TableStyle;oThis.WriteRecord1(0,obj,oThis.WriteTableProps);var grid=table.TableGrid; var _len=grid.length;oThis.StartRecord(1);oThis.WriteULong(_len);for(var i=0;i<_len;i++){oThis.StartRecord(0);oThis.WriteUChar(g_nodeAttributeStart);oThis._WriteInt1(0,grid[i]*36E3>>0);oThis.WriteUChar(g_nodeAttributeEnd);oThis.EndRecord()}oThis.EndRecord();oThis.StartRecord(2);var rows_c=table.Content.length;oThis.WriteULong(rows_c);var _grid=oThis.GenerateTableWriteGrid(table);for(var i=0;i1)for(var t=_cell_info.grid_span-1;t>0;t--){var _cell_info_empty={};_cell_info_empty.isEmpty=true;_cell_info_empty.vMerge=_cell_info.vMerge;TableGrid.Rows[i].Cells.push(_cell_info_empty)}}}for(var i=0;i<_cols_count;i++){var _index=0;while(_index<_rows_count){var _count= 1;for(var j=_index+1;j<_rows_count;j++){if(i>=TableGrid.Rows[j].Cells.length)continue;if(TableGrid.Rows[j].Cells[i].vMerge!==true)break;++_count}if(ifMaxBottomMargin)fMaxBottomMargin=oMargins.Bottom.W;if(oMargins.Top.W>fMaxTopMargin)fMaxTopMargin=oMargins.Top.W;var oBorders=oCell.Get_Borders();if(oBorders.Top.Size>fMaxTopBorder)fMaxTopBorder=oBorders.Top.Size;if(oBorders.Bottom.Size>fMaxBottomBorder)fMaxBottomBorder=oBorders.Bottom.Size}oThis._WriteInt1(0,(row.Pr.Height.Value+fMaxBottomMargin+fMaxTopMargin+fMaxTopBorder/ 2+fMaxBottomBorder/2)*36E3>>0)}oThis.WriteUChar(g_nodeAttributeEnd);oThis.StartRecord(0);var _len=row_info.Cells.length;oThis.WriteULong(_len);for(var i=0;i<_len;i++){oThis.StartRecord(1);var _info=row_info.Cells[i];if(_info.isEmpty)oThis.WriteEmptyTableCell(_info);else{oThis.WriteUChar(g_nodeAttributeStart);if(_info.vMerge===false&&_info.row_span>1)oThis._WriteInt1(1,_info.row_span);if(_info.hMerge===false&&_info.grid_span>1)oThis._WriteInt1(2,_info.grid_span);if(_info.hMerge===true)oThis._WriteBool1(3, true);if(_info.vMerge===true)oThis._WriteBool1(4,true);oThis.WriteUChar(g_nodeAttributeEnd);oThis.WriteTableCell(_info.Cell)}oThis.EndRecord()}oThis.EndRecord()};this.WriteTableCell=function(cell){oThis.StartRecord(0);oThis.WriteUChar(g_nodeAttributeStart);var _marg=cell.Pr.TableCellMar;var tableMar=cell.Row.Table.Pr.TableCellMar;if(_marg&&_marg.Left&&AscFormat.isRealNumber(_marg.Left.W))oThis._WriteInt1(0,_marg.Left.W*36E3>>0);else if(tableMar&&tableMar.Left&&AscFormat.isRealNumber(tableMar.Left.W))oThis._WriteInt1(0, tableMar.Left.W*36E3>>0);if(_marg&&_marg.Top&&AscFormat.isRealNumber(_marg.Top.W))oThis._WriteInt1(1,_marg.Top.W*36E3>>0);else if(tableMar&&tableMar.Top&&AscFormat.isRealNumber(tableMar.Top.W))oThis._WriteInt1(1,tableMar.Top.W*36E3>>0);if(_marg&&_marg.Right&&AscFormat.isRealNumber(_marg.Right.W))oThis._WriteInt1(2,_marg.Right.W*36E3>>0);else if(tableMar&&tableMar.Right&&AscFormat.isRealNumber(tableMar.Right.W))oThis._WriteInt1(2,tableMar.Right.W*36E3>>0);if(_marg&&_marg.Bottom&&AscFormat.isRealNumber(_marg.Bottom.W))oThis._WriteInt1(3, _marg.Bottom.W*36E3>>0);else if(tableMar&&tableMar.Bottom&&AscFormat.isRealNumber(tableMar.Bottom.W))oThis._WriteInt1(3,tableMar.Bottom.W*36E3>>0);if(AscFormat.isRealNumber(cell.Pr.TextDirection))switch(cell.Pr.TextDirection){case Asc.c_oAscCellTextDirection.LRTB:{oThis._WriteUChar1(5,1);break}case Asc.c_oAscCellTextDirection.TBRL:{oThis._WriteUChar1(5,0);break}case Asc.c_oAscCellTextDirection.BTLR:{oThis._WriteUChar1(5,4);break}default:{oThis._WriteUChar1(5,1);break}}if(AscFormat.isRealNumber(cell.Pr.VAlign))switch(cell.Pr.VAlign){case vertalignjc_Bottom:{oThis._WriteUChar1(6, 0);break}case vertalignjc_Center:{oThis._WriteUChar1(6,1);break}case vertalignjc_Top:{oThis._WriteUChar1(6,4);break}}oThis.WriteUChar(g_nodeAttributeEnd);oThis.WriteRecord3(0,cell.Pr.TableCellBorders.Left,oThis.WriteTableCellBorder);oThis.WriteRecord3(1,cell.Pr.TableCellBorders.Top,oThis.WriteTableCellBorder);oThis.WriteRecord3(2,cell.Pr.TableCellBorders.Right,oThis.WriteTableCellBorder);oThis.WriteRecord3(3,cell.Pr.TableCellBorders.Bottom,oThis.WriteTableCellBorder);var shd=cell.Pr.Shd;if(shd!== undefined&&shd!=null)oThis.WriteRecord2(6,shd.Unifill,oThis.WriteUniFill);oThis.EndRecord();oThis.StartRecord(1);oThis.WriteRecordArray(2,0,cell.Content.Content,oThis.WriteParagraph);oThis.EndRecord()};this.WriteTableProps=function(obj){oThis.WriteUChar(g_nodeAttributeStart);if(oThis.tableStylesGuides.hasOwnProperty(obj.style))oThis._WriteString1(0,oThis.tableStylesGuides[obj.style]);oThis._WriteBool1(2,obj.look.m_bFirst_Row);oThis._WriteBool1(3,obj.look.m_bFirst_Col);oThis._WriteBool1(4,obj.look.m_bLast_Row); oThis._WriteBool1(5,obj.look.m_bLast_Col);oThis._WriteBool1(6,obj.look.m_bBand_Hor);oThis._WriteBool1(7,obj.look.m_bBand_Ver);oThis.WriteUChar(g_nodeAttributeEnd);var shd=obj.props.Shd;if(shd!==undefined&&shd!=null)if(shd.Unifill!==undefined&&shd.Unifill!=null)if(shd.Unifill.fill!==undefined&&shd.Unifill.fill!=null)oThis.WriteRecord1(0,shd.Unifill,oThis.WriteUniFill)};this.WriteGroupShape=function(group,type){if(AscFormat.isRealNumber(type))oThis.StartRecord(type);else oThis.StartRecord(4);group.spPr.WriteXfrm= group.spPr.xfrm;if(group.nvGrpSpPr){var _old_ph=group.nvGrpSpPr.nvPr.ph;group.nvGrpSpPr.nvPr.ph=null;group.nvGrpSpPr.locks=group.locks;group.nvGrpSpPr.objectType=group.getObjectType();oThis.WriteRecord1(0,group.nvGrpSpPr,oThis.WriteUniNvPr);group.nvGrpSpPr.nvPr.ph=_old_ph}oThis.WriteRecord1(1,group.spPr,oThis.WriteGrpSpPr);group.spPr.WriteXfrm=null;var spTree=group.spTree;var _len=spTree.length;if(0!=_len)oThis.WriteSpTree(spTree);oThis.EndRecord()};this.WriteGrpSpPr=function(grpSpPr){oThis.WriteUChar(g_nodeAttributeStart); oThis._WriteLimit2(0,grpSpPr.bwMode);oThis.WriteUChar(g_nodeAttributeEnd);if(grpSpPr.WriteXfrm&&grpSpPr.WriteXfrm.isNotNull())oThis.WriteRecord2(0,grpSpPr.WriteXfrm,oThis.WriteXfrm);oThis.WriteRecord1(1,grpSpPr.Fill,oThis.WriteUniFill)};this.WriteSpPr=function(spPr){oThis.WriteUChar(g_nodeAttributeStart);oThis._WriteLimit2(0,spPr.bwMode);oThis.WriteUChar(g_nodeAttributeEnd);var _fill=spPr.Fill;var bIsExistFill=false;if(_fill!==undefined&&_fill!=null&&_fill.fill!==undefined&&_fill.fill!=null)bIsExistFill= true;var bIsExistLn=false;if(spPr.ln!==undefined&&spPr.ln!=null){_fill=spPr.ln.Fill;if(_fill!==undefined&&_fill!=null&&_fill.fill!==undefined&&_fill.fill!=null)bIsExistLn=true}if(spPr.xfrm&&spPr.xfrm.isNotNull())oThis.WriteRecord2(0,spPr.xfrm,oThis.WriteXfrm);oThis.WriteRecord2(1,spPr.geometry,oThis.WriteGeometry);if(spPr.geometry===undefined||spPr.geometry==null)if(bIsExistFill||bIsExistLn){oThis.StartRecord(1);oThis.StartRecord(1);oThis.WriteUChar(g_nodeAttributeStart);oThis._WriteString1(0,"rect"); oThis.WriteUChar(g_nodeAttributeEnd);oThis.EndRecord();oThis.EndRecord()}oThis.WriteRecord1(2,spPr.Fill,oThis.WriteUniFill);oThis.WriteRecord2(3,spPr.ln,oThis.WriteLn);var oEffectPr=spPr.effectProps;if(oEffectPr)if(oEffectPr.EffectLst)oThis.WriteRecord1(4,oEffectPr.EffectLst,oThis.WriteEffectLst);else if(oEffectPr.EffectDag)oThis.WriteRecord1(4,oEffectPr.EffectDag,oThis.WriteEffectDag)};this.WriteEffectLst=function(oEffectLst){oThis.StartRecord(1);oThis.WriteRecord2(0,oEffectLst.blur,oThis.WriteEffect); oThis.WriteRecord2(1,oEffectLst.fillOverlay,oThis.WriteEffect);oThis.WriteRecord2(2,oEffectLst.glow,oThis.WriteEffect);oThis.WriteRecord2(3,oEffectLst.innerShdw,oThis.WriteEffect);oThis.WriteRecord2(4,oEffectLst.outerShdw,oThis.WriteEffect);oThis.WriteRecord2(5,oEffectLst.prstShdw,oThis.WriteEffect);oThis.WriteRecord2(6,oEffectLst.reflection,oThis.WriteEffect);oThis.WriteRecord2(7,oEffectLst.softEdge,oThis.WriteEffect);oThis.EndRecord()};this.WriteXfrm=function(xfrm){if(oThis.IsWordWriter===true)return oThis.WriteXfrmRot(xfrm); oThis.WriteUChar(g_nodeAttributeStart);oThis._WriteInt4(0,xfrm.offX,c_dScalePPTXSizes);oThis._WriteInt4(1,xfrm.offY,c_dScalePPTXSizes);oThis._WriteInt4(2,xfrm.extX,c_dScalePPTXSizes);oThis._WriteInt4(3,xfrm.extY,c_dScalePPTXSizes);oThis._WriteInt4(4,xfrm.chOffX,c_dScalePPTXSizes);oThis._WriteInt4(5,xfrm.chOffY,c_dScalePPTXSizes);oThis._WriteInt4(6,xfrm.chExtX,c_dScalePPTXSizes);oThis._WriteInt4(7,xfrm.chExtY,c_dScalePPTXSizes);oThis._WriteBool2(8,xfrm.flipH);oThis._WriteBool2(9,xfrm.flipV);oThis._WriteInt4(10, xfrm.rot,180*6E4/Math.PI);oThis.WriteUChar(g_nodeAttributeEnd)};this.WriteSignatureLine=function(oSignatureLine){oThis.WriteUChar(g_nodeAttributeStart);oThis._WriteUChar2(2,1);oThis._WriteString2(3,oSignatureLine.id);oThis._WriteBool2(4,true);oThis._WriteString2(5,"{00000000-0000-0000-0000-000000000000}");oThis._WriteBool2(6,oSignatureLine.showDate);oThis._WriteString2(7,oSignatureLine.instructions);oThis._WriteString2(10,oSignatureLine.signer);oThis._WriteString2(11,oSignatureLine.signer2);oThis._WriteString2(12, oSignatureLine.email);oThis.WriteUChar(g_nodeAttributeEnd)};this.WriteXfrmRot=function(xfrm){oThis.WriteUChar(g_nodeAttributeStart);oThis._WriteInt4(0,xfrm.offX,c_dScalePPTXSizes);oThis._WriteInt4(1,xfrm.offY,c_dScalePPTXSizes);oThis._WriteInt4(2,xfrm.extX,c_dScalePPTXSizes);oThis._WriteInt4(3,xfrm.extY,c_dScalePPTXSizes);oThis._WriteInt4(4,xfrm.chOffX,c_dScalePPTXSizes);oThis._WriteInt4(5,xfrm.chOffY,c_dScalePPTXSizes);oThis._WriteInt4(6,xfrm.chExtX,c_dScalePPTXSizes);oThis._WriteInt4(7,xfrm.chExtY, c_dScalePPTXSizes);oThis._WriteBool2(8,xfrm.flipH);oThis._WriteBool2(9,xfrm.flipV);if(xfrm.rot!=null){var nCheckInvert=0;if(true==xfrm.flipH)nCheckInvert+=1;if(true==xfrm.flipV)nCheckInvert+=1;var _rot=xfrm.rot*180*6E4/Math.PI>>0;var _n360=360*6E4;if(_rot>_n360){var _nDel=_rot/_n360>>0;_rot=_rot-_nDel*_n360}else if(_rot<0){var _nDel=-_rot/_n360>>0;_nDel+=1;_rot=_rot+_nDel*_n360}if(nCheckInvert==1)_rot=_n360-_rot;oThis._WriteInt1(10,_rot)}oThis.WriteUChar(g_nodeAttributeEnd)};this.WriteSpCNvPr=function(locks){oThis.WriteUChar(g_nodeAttributeStart); if(locks&AscFormat.LOCKS_MASKS.txBox)oThis._WriteBool2(0,!!(locks&AscFormat.LOCKS_MASKS.txBox<<1));if(locks&AscFormat.LOCKS_MASKS.noAdjustHandles)oThis._WriteBool2(1,!!(locks&AscFormat.LOCKS_MASKS.noAdjustHandles<<1));if(locks&AscFormat.LOCKS_MASKS.noChangeArrowheads)oThis._WriteBool2(2,!!(locks&AscFormat.LOCKS_MASKS.noChangeArrowheads<<1));if(locks&AscFormat.LOCKS_MASKS.noChangeAspect)oThis._WriteBool2(3,!!(locks&AscFormat.LOCKS_MASKS.noChangeAspect<<1));if(locks&AscFormat.LOCKS_MASKS.noChangeShapeType)oThis._WriteBool2(4, !!(locks&AscFormat.LOCKS_MASKS.noChangeShapeType<<1));if(locks&AscFormat.LOCKS_MASKS.noEditPoints)oThis._WriteBool2(5,!!(locks&AscFormat.LOCKS_MASKS.noEditPoints<<1));if(locks&AscFormat.LOCKS_MASKS.noGrp)oThis._WriteBool2(6,!!(locks&AscFormat.LOCKS_MASKS.noGrp<<1));if(locks&AscFormat.LOCKS_MASKS.noMove)oThis._WriteBool2(7,!!(locks&AscFormat.LOCKS_MASKS.noMove<<1));if(locks&AscFormat.LOCKS_MASKS.noResize)oThis._WriteBool2(8,!!(locks&AscFormat.LOCKS_MASKS.noResize<<1));if(locks&AscFormat.LOCKS_MASKS.noRot)oThis._WriteBool2(9, !!(locks&AscFormat.LOCKS_MASKS.noRot<<1));if(locks&AscFormat.LOCKS_MASKS.noSelect)oThis._WriteBool2(10,!!(locks&AscFormat.LOCKS_MASKS.noSelect<<1));if(locks&AscFormat.LOCKS_MASKS.noTextEdit)oThis._WriteBool2(11,!!(locks&AscFormat.LOCKS_MASKS.noTextEdit<<1));oThis.WriteUChar(g_nodeAttributeEnd)};this.WritePicCNvPr=function(locks){oThis.WriteUChar(g_nodeAttributeStart);if(locks&AscFormat.LOCKS_MASKS.noAdjustHandles)oThis._WriteBool2(1,!!(locks&AscFormat.LOCKS_MASKS.noAdjustHandles<<1));if(locks&AscFormat.LOCKS_MASKS.noChangeArrowheads)oThis._WriteBool2(2, !!(locks&AscFormat.LOCKS_MASKS.noChangeArrowheads<<1));if(locks&AscFormat.LOCKS_MASKS.noChangeAspect)oThis._WriteBool2(3,!!(locks&AscFormat.LOCKS_MASKS.noChangeAspect<<1));if(locks&AscFormat.LOCKS_MASKS.noChangeShapeType)oThis._WriteBool2(4,!!(locks&AscFormat.LOCKS_MASKS.noChangeShapeType<<1));if(locks&AscFormat.LOCKS_MASKS.noCrop)oThis._WriteBool2(5,!!(locks&AscFormat.LOCKS_MASKS.noCrop<<1));if(locks&AscFormat.LOCKS_MASKS.noEditPoints)oThis._WriteBool2(6,!!(locks&AscFormat.LOCKS_MASKS.noEditPoints<< 1));if(locks&AscFormat.LOCKS_MASKS.noGrp)oThis._WriteBool2(7,!!(locks&AscFormat.LOCKS_MASKS.noGrp<<1));if(locks&AscFormat.LOCKS_MASKS.noMove)oThis._WriteBool2(8,!!(locks&AscFormat.LOCKS_MASKS.noMove<<1));if(locks&AscFormat.LOCKS_MASKS.noResize)oThis._WriteBool2(9,!!(locks&AscFormat.LOCKS_MASKS.noResize<<1));if(locks&AscFormat.LOCKS_MASKS.noRot)oThis._WriteBool2(10,!!(locks&AscFormat.LOCKS_MASKS.noRot<<1));if(locks&AscFormat.LOCKS_MASKS.noSelect)oThis._WriteBool2(11,!!(locks&AscFormat.LOCKS_MASKS.noSelect<< 1));oThis.WriteUChar(g_nodeAttributeEnd)};this.WriteGrpCNvPr=function(locks){oThis.WriteUChar(g_nodeAttributeStart);if(locks&AscFormat.LOCKS_MASKS.noChangeAspect)oThis._WriteBool2(0,!!(locks&AscFormat.LOCKS_MASKS.noChangeAspect<<1));if(locks&AscFormat.LOCKS_MASKS.noGrp)oThis._WriteBool2(1,!!(locks&AscFormat.LOCKS_MASKS.noGrp<<1));if(locks&AscFormat.LOCKS_MASKS.noMove)oThis._WriteBool2(2,!!(locks&AscFormat.LOCKS_MASKS.noMove<<1));if(locks&AscFormat.LOCKS_MASKS.noResize)oThis._WriteBool2(3,!!(locks& AscFormat.LOCKS_MASKS.noResize<<1));if(locks&AscFormat.LOCKS_MASKS.noRot)oThis._WriteBool2(4,!!(locks&AscFormat.LOCKS_MASKS.noRot<<1));if(locks&AscFormat.LOCKS_MASKS.noSelect)oThis._WriteBool2(5,!!(locks&AscFormat.LOCKS_MASKS.noSelect<<1));if(locks&AscFormat.LOCKS_MASKS.noUngrp)oThis._WriteBool2(6,!!(locks&AscFormat.LOCKS_MASKS.noUngrp<<1));oThis.WriteUChar(g_nodeAttributeEnd)};this.WriteGrFrameCNvPr=function(locks){oThis.WriteUChar(g_nodeAttributeStart);if(locks&AscFormat.LOCKS_MASKS.noChangeAspect)oThis._WriteBool2(0, !!(locks&AscFormat.LOCKS_MASKS.noChangeAspect<<1));if(locks&AscFormat.LOCKS_MASKS.noDrilldown)oThis._WriteBool2(1,!!(locks&AscFormat.LOCKS_MASKS.noDrilldown<<1));if(locks&AscFormat.LOCKS_MASKS.noGrp)oThis._WriteBool2(2,!!(locks&AscFormat.LOCKS_MASKS.noGrp<<1));if(locks&AscFormat.LOCKS_MASKS.noMove)oThis._WriteBool2(3,!!(locks&AscFormat.LOCKS_MASKS.noMove<<1));if(locks&AscFormat.LOCKS_MASKS.noResize)oThis._WriteBool2(4,!!(locks&AscFormat.LOCKS_MASKS.noResize<<1));if(locks&AscFormat.LOCKS_MASKS.noSelect)oThis._WriteBool2(5, !!(locks&AscFormat.LOCKS_MASKS.noSelect<<1));oThis.WriteUChar(g_nodeAttributeEnd)};this.WriteCnxCNvPr=function(pr){var locks=pr.locks;oThis.WriteUChar(g_nodeAttributeStart);if(locks&AscFormat.LOCKS_MASKS.noAdjustHandles)oThis._WriteBool2(0,!!(locks&AscFormat.LOCKS_MASKS.noAdjustHandles<<1));if(locks&AscFormat.LOCKS_MASKS.noChangeArrowheads)oThis._WriteBool2(1,!!(locks&AscFormat.LOCKS_MASKS.noChangeArrowheads<<1));if(locks&AscFormat.LOCKS_MASKS.noChangeAspect)oThis._WriteBool2(2,!!(locks&AscFormat.LOCKS_MASKS.noChangeAspect<< 1));if(locks&AscFormat.LOCKS_MASKS.noChangeShapeType)oThis._WriteBool2(3,!!(locks&AscFormat.LOCKS_MASKS.noChangeShapeType<<1));if(locks&AscFormat.LOCKS_MASKS.noEditPoints)oThis._WriteBool2(4,!!(locks&AscFormat.LOCKS_MASKS.noEditPoints<<1));if(locks&AscFormat.LOCKS_MASKS.noGrp)oThis._WriteBool2(5,!!(locks&AscFormat.LOCKS_MASKS.noGrp<<1));if(locks&AscFormat.LOCKS_MASKS.noMove)oThis._WriteBool2(6,!!(locks&AscFormat.LOCKS_MASKS.noMove<<1));if(locks&AscFormat.LOCKS_MASKS.noResize)oThis._WriteBool2(7,!!(locks& AscFormat.LOCKS_MASKS.noResize<<1));if(locks&AscFormat.LOCKS_MASKS.noRot)oThis._WriteBool2(8,!!(locks&AscFormat.LOCKS_MASKS.noRot<<1));if(locks&AscFormat.LOCKS_MASKS.noSelect)oThis._WriteBool2(9,!!(locks&AscFormat.LOCKS_MASKS.noSelect<<1));if(pr.stCnxId&&AscFormat.isRealNumber(pr.stCnxIdx)){var nStIdx=oThis.GetSpIdxId(pr.stCnxId);if(nStIdx!==null){oThis._WriteInt2(10,oThis.GetSpIdxId(pr.stCnxId));oThis._WriteInt2(11,pr.stCnxIdx)}}if(pr.endCnxId&&AscFormat.isRealNumber(pr.endCnxIdx)){var nEndIdx=oThis.GetSpIdxId(pr.endCnxId); if(nEndIdx!==null){oThis._WriteInt2(12,oThis.GetSpIdxId(pr.endCnxId));oThis._WriteInt2(13,pr.endCnxIdx)}}oThis.WriteUChar(g_nodeAttributeEnd)};this.WriteUniNvPr=function(nv){oThis.WriteRecord2(0,nv.cNvPr,oThis.Write_cNvPr);if(AscFormat.isRealNumber(nv.locks)&&(nv.locks!==0||nv.nvUniSpPr)&&AscFormat.isRealNumber(nv.objectType))switch(nv.objectType){case AscDFH.historyitem_type_Shape:{oThis.WriteRecord1(1,nv.locks,oThis.WriteSpCNvPr);break}case AscDFH.historyitem_type_ImageShape:{oThis.WriteRecord1(1, nv.locks,oThis.WritePicCNvPr);break}case AscDFH.historyitem_type_GroupShape:{oThis.WriteRecord1(1,nv.locks,oThis.WriteGrpCNvPr);break}case AscDFH.historyitem_type_GraphicFrame:case AscDFH.historyitem_type_ChartSpace:case AscDFH.historyitem_type_SlicerView:{oThis.WriteRecord1(1,nv.locks,oThis.WriteGrFrameCNvPr);break}case AscDFH.historyitem_type_Cnx:{nv.nvUniSpPr.locks=nv.locks;oThis.WriteRecord1(1,nv.nvUniSpPr,oThis.WriteCnxCNvPr);break}}nv.locks=null;nv.objectType=null;oThis.WriteRecord2(2,nv.nvPr, oThis.Write_nvPr)};this.Write_cNvPr=function(cNvPr){oThis.WriteUChar(g_nodeAttributeStart);oThis._WriteInt1(0,cNvPr.id);oThis._WriteString1(1,cNvPr.name);oThis._WriteBool1(2,cNvPr.isHidden);oThis._WriteString2(3,cNvPr.title);oThis._WriteString2(4,cNvPr.descr);oThis._WriteBool2(5,cNvPr.form);oThis.WriteUChar(g_nodeAttributeEnd);oThis.WriteRecord2(0,cNvPr.hlinkClick,oThis.Write_Hyperlink2);oThis.WriteRecord2(1,cNvPr.hlinkHover,oThis.Write_Hyperlink2)};this.Write_Hyperlink2=function(hyper){oThis.WriteUChar(g_nodeAttributeStart); var id=hyper.id;var action=hyper.action;if(id==="ppaction://hlinkshowjump?jump=firstslide"){action=id;id=""}else if(id==="ppaction://hlinkshowjump?jump=lastslide"){action=id;id=""}else if(id==="ppaction://hlinkshowjump?jump=nextslide"){action=id;id=""}else if(id==="ppaction://hlinkshowjump?jump=previousslide"){action=id;id=""}else if(typeof id==="string"){var mask="ppaction://hlinksldjumpslide";var indSlide=id.indexOf(mask);if(0===indSlide){var slideNum=parseInt(id.substring(mask.length));id="slide"+ (slideNum+1)+".xml";action="ppaction://hlinksldjump"}}oThis._WriteString2(0,id);oThis._WriteString2(1,hyper.invalidUrl);oThis._WriteString2(2,action);oThis._WriteString2(3,hyper.tgtFrame);oThis._WriteString2(4,hyper.tooltip);oThis._WriteBool2(5,hyper.history);oThis._WriteBool2(6,hyper.highlightClick);oThis._WriteBool2(7,hyper.endSnd);oThis.WriteUChar(g_nodeAttributeEnd)};this.Write_nvPr=function(nvPr){oThis.WriteUChar(g_nodeAttributeStart);oThis._WriteBool2(0,nvPr.isPhoto);oThis._WriteBool2(1,nvPr.userDrawn); oThis.WriteUChar(g_nodeAttributeEnd);oThis.WriteRecord2(0,nvPr.ph,oThis.Write_ph)};this.Write_ph=function(ph){oThis.WriteUChar(g_nodeAttributeStart);oThis._WriteBool2(0,ph.hasCustomPrompt);oThis._WriteString2(1,ph.idx);oThis._WriteLimit2(2,ph.orient);oThis._WriteLimit2(3,ph.sz);oThis._WriteLimit2(4,ph.type);oThis.WriteUChar(g_nodeAttributeEnd)};this.WriteGeometry=function(geom){if(undefined===geom||null==geom)return;if(typeof geom.preset==="string"&&geom.preset.length>0){oThis.StartRecord(1);oThis.WriteUChar(g_nodeAttributeStart); oThis._WriteString1(0,geom.preset);oThis.WriteUChar(g_nodeAttributeEnd);oThis.WriteAdj(geom.gdLst,geom.avLst,0);oThis.EndRecord()}else{oThis.StartRecord(2);oThis.WriteAdj(geom.gdLst,geom.avLst,0);oThis.WriteGuides(geom.gdLstInfo,1);oThis.WriteAh(geom.ahXYLstInfo,geom.ahPolarLstInfo,2);oThis.WriteCnx(geom.cnxLstInfo,3);oThis.WritePathLst(geom.pathLst,4);oThis.WriteRecord2(5,geom.rectS,oThis.WriteTextRect);oThis.EndRecord()}};this.WritePrstTxWarp=function(prstTxWarp){oThis.WriteUChar(g_nodeAttributeStart); oThis._WriteLimit1(0,AscFormat.getNumByTxPrst(prstTxWarp.preset));oThis.WriteUChar(g_nodeAttributeEnd);oThis.WriteAdj(prstTxWarp.gdLst,prstTxWarp.avLst,0)};this.WriteAdj=function(gdLst,avLst,rec_num){var _len=0;for(var i in avLst)++_len;if(0==_len)return;oThis.StartRecord(rec_num);oThis.WriteULong(_len);for(var i in avLst){oThis.StartRecord(1);oThis.WriteUChar(g_nodeAttributeStart);oThis._WriteString1(0,i);oThis._WriteInt1(1,15);oThis._WriteString1(2,""+(gdLst[i]>>0));oThis.WriteUChar(g_nodeAttributeEnd); oThis.EndRecord()}oThis.EndRecord()};this.WriteGuides=function(gdLst,rec_num){var _len=gdLst.length;if(0==rec_num)return;this.StartRecord(rec_num);this.WriteULong(_len);for(var i=0;i<_len;i++){this.StartRecord(1);var _gd=gdLst[i];this.WriteUChar(g_nodeAttributeStart);this._WriteString1(0,_gd.name);this._WriteInt1(1,_gd.formula);this._WriteString2(2,_gd.x);this._WriteString2(3,_gd.y);this._WriteString2(4,_gd.z);this.WriteUChar(g_nodeAttributeEnd);this.EndRecord()}this.EndRecord()};this.WriteAh=function(ahLstXY, ahLstPolar,rec_num){var _len=0;for(var i in ahLstXY)++_len;for(var i in ahLstPolar)++_len;if(0==rec_num)return;this.StartRecord(rec_num);this.WriteULong(_len);for(var i in ahLstXY){this.StartRecord(1);var _ah=ahLstXY[i];this.StartRecord(2);this.WriteUChar(g_nodeAttributeStart);this._WriteString2(0,_ah.posX);this._WriteString2(1,_ah.posY);this._WriteString2(2,_ah.gdRefX);this._WriteString2(3,_ah.gdRefY);this._WriteString2(4,_ah.maxX);this._WriteString2(5,_ah.maxY);this._WriteString2(6,_ah.minX);this._WriteString2(7, _ah.minY);this.WriteUChar(g_nodeAttributeEnd);this.EndRecord();this.EndRecord()}for(var i in ahLstPolar){this.StartRecord(1);var _ah=ahLstPolar[i];this.StartRecord(2);this.WriteUChar(g_nodeAttributeStart);this._WriteString2(0,_ah.posX);this._WriteString2(1,_ah.posY);this._WriteString2(2,_ah.gdRefAng);this._WriteString2(3,_ah.gdRefR);this._WriteString2(4,_ah.maxAng);this._WriteString2(5,_ah.maxR);this._WriteString2(6,_ah.minAng);this._WriteString2(7,_ah.minR);this.WriteUChar(g_nodeAttributeEnd);this.EndRecord(); this.EndRecord()}this.EndRecord()};this.WriteCnx=function(cnxLst,rec_num){var _len=0;for(var i in cnxLst)++_len;if(0==rec_num)return;this.StartRecord(rec_num);this.WriteULong(_len);for(var i in cnxLst){this.StartRecord(1);var _gd=cnxLst[i];this.WriteUChar(g_nodeAttributeStart);this._WriteString1(0,_gd.x);this._WriteString1(1,_gd.y);this._WriteString1(2,_gd.ang);this.WriteUChar(g_nodeAttributeEnd);this.EndRecord()}this.EndRecord()};this.WriteTextRect=function(rect){oThis.WriteUChar(g_nodeAttributeStart); oThis._WriteString2(0,rect.l);oThis._WriteString2(1,rect.t);oThis._WriteString2(2,rect.r);oThis._WriteString2(3,rect.b);oThis.WriteUChar(g_nodeAttributeEnd)};this.WritePathLst=function(pathLst,rec_num){var _len=pathLst.length;if(0==_len)return;this.StartRecord(rec_num);this.WriteULong(_len);for(var i=0;i<_len;i++){this.StartRecord(1);var _path=pathLst[i];this.WriteUChar(g_nodeAttributeStart);this._WriteBool2(0,_path.extrusionOk);if(_path.fill!=null&&_path.fill!==undefined)this._WriteLimit1(1,_path.fill== "none"?4:5);this._WriteInt2(2,_path.pathH);this._WriteBool2(3,_path.stroke);this._WriteInt2(4,_path.pathW);this.WriteUChar(g_nodeAttributeEnd);var _comms=_path.ArrPathCommandInfo;var _count=_comms.length;if(0!=_count){this.StartRecord(0);this.WriteULong(_count);for(var j=0;j<_count;j++){this.StartRecord(0);var cmd=_comms[j];switch(cmd.id){case AscFormat.moveTo:{this.StartRecord(1);this.WriteUChar(g_nodeAttributeStart);this._WriteString1(0,""+cmd.X);this._WriteString1(1,""+cmd.Y);this.WriteUChar(g_nodeAttributeEnd); this.EndRecord();break}case AscFormat.lineTo:{this.StartRecord(2);this.WriteUChar(g_nodeAttributeStart);this._WriteString1(0,""+cmd.X);this._WriteString1(1,""+cmd.Y);this.WriteUChar(g_nodeAttributeEnd);this.EndRecord();break}case AscFormat.bezier3:{this.StartRecord(6);this.WriteUChar(g_nodeAttributeStart);this._WriteString1(0,""+cmd.X0);this._WriteString1(1,""+cmd.Y0);this._WriteString1(2,""+cmd.X1);this._WriteString1(3,""+cmd.Y1);this.WriteUChar(g_nodeAttributeEnd);this.EndRecord();break}case AscFormat.bezier4:{this.StartRecord(4); this.WriteUChar(g_nodeAttributeStart);this._WriteString1(0,""+cmd.X0);this._WriteString1(1,""+cmd.Y0);this._WriteString1(2,""+cmd.X1);this._WriteString1(3,""+cmd.Y1);this._WriteString1(4,""+cmd.X2);this._WriteString1(5,""+cmd.Y2);this.WriteUChar(g_nodeAttributeEnd);this.EndRecord();break}case AscFormat.arcTo:{this.StartRecord(5);this.WriteUChar(g_nodeAttributeStart);this._WriteString1(0,""+cmd.wR);this._WriteString1(1,""+cmd.hR);this._WriteString1(2,""+cmd.stAng);this._WriteString1(3,""+cmd.swAng); this.WriteUChar(g_nodeAttributeEnd);this.EndRecord();break}case AscFormat.close:{this.StartRecord(3);this.EndRecord();break}}this.EndRecord()}this.EndRecord()}this.EndRecord()}this.EndRecord()};this.WriteTableStyle=function(num,tableStyle){oThis.StartRecord(1);oThis.WriteUChar(g_nodeAttributeStart);oThis._WriteString1(0,oThis.tableStylesGuides[num]);var __name=tableStyle.Name;__name=__name.replace(/&/g,"_");__name=__name.replace(/>/g,"_");__name=__name.replace(/>0);oThis.WriteUChar(g_nodeAttributeEnd);oThis.WriteRecord2(0,_border.Unifill,oThis.WriteUniFill);oThis.EndRecord()}};this.WriteTableCellBorderLineStyle2=function(rec_type,_border){if(!_border){oThis.StartRecord(rec_type);oThis.StartRecord(0); oThis.WriteUChar(g_nodeAttributeStart);oThis.WriteUChar(g_nodeAttributeEnd);var _unifill=new AscFormat.CUniFill;_unifill.fill=new AscFormat.CNoFill;oThis.WriteRecord2(0,_unifill,oThis.WriteUniFill);oThis.EndRecord();oThis.EndRecord();return}else oThis.WriteRecord3(rec_type,_border,oThis.WriteTableCellBorderLineStyle)};this.WriteTableCellBorderLineStyle=function(_border){if(_border.Value==border_None){oThis.StartRecord(0);oThis.WriteUChar(g_nodeAttributeStart);oThis.WriteUChar(g_nodeAttributeEnd); var _unifill=new AscFormat.CUniFill;_unifill.fill=new AscFormat.CNoFill;oThis.WriteRecord2(0,_unifill,oThis.WriteUniFill);oThis.EndRecord();return}var bIsFill=false;var bIsSize=false;var bIsLnRef=false;if(_border.Unifill!==undefined&&_border.Unifill!=null)bIsFill=true;if(_border.Size!==undefined&&_border.Size!=null)bIsSize=true;if(bIsFill&&bIsSize){oThis.StartRecord(0);oThis.WriteUChar(g_nodeAttributeStart);if(bIsSize)oThis._WriteInt2(3,_border.Size*36E3>>0);oThis.WriteUChar(g_nodeAttributeEnd);oThis.WriteRecord2(0, _border.Unifill,oThis.WriteUniFill);oThis.EndRecord()}oThis.WriteRecord2(1,_border.LineRef,oThis.WriteStyleRef)}}function CPPTXContentWriter(){this.BinaryFileWriter=new AscCommon.CBinaryFileWriter;this.BinaryFileWriter.Init();this.TreeDrawingIndex=0;this.ShapeTextBoxContent=null;this.arrayStackStartsTextBoxContent=[];this.arrayStackStarts=[];this.Start_UseFullUrl=function(){this.BinaryFileWriter.Start_UseFullUrl()};this.Start_UseDocumentOrigin=function(origin){this.BinaryFileWriter.Start_UseDocumentOrigin(origin)}; this.End_UseFullUrl=function(){return this.BinaryFileWriter.End_UseFullUrl()};this._Start=function(){this.ShapeTextBoxContent=new AscCommon.CMemory;this.arrayStackStartsTextBoxContent=[];this.arrayStackStarts=[]};this._End=function(){this.ShapeTextBoxContent=null};this.WritePPTXObject=function(memory,fCallback){if(this.BinaryFileWriter.UseContinueWriter>0){this.BinaryFileWriter.ImData=memory.ImData;this.BinaryFileWriter.data=memory.data;this.BinaryFileWriter.len=memory.len;this.BinaryFileWriter.pos= memory.pos}else{this.TreeDrawingIndex++;this.arrayStackStarts.push(this.BinaryFileWriter.pos)}fCallback();if(this.BinaryFileWriter.UseContinueWriter>0){memory.ImData=this.BinaryFileWriter.ImData;memory.data=this.BinaryFileWriter.data;memory.len=this.BinaryFileWriter.len;memory.pos=this.BinaryFileWriter.pos}else{this.TreeDrawingIndex--;var oldPos=this.arrayStackStarts[this.arrayStackStarts.length-1];memory.WriteBuffer(this.BinaryFileWriter.data,oldPos,this.BinaryFileWriter.pos-oldPos);this.BinaryFileWriter.pos= oldPos;this.arrayStackStarts.splice(this.arrayStackStarts.length-1,1)}};this.WriteTextBody=function(memory,textBody){var _writer=this.BinaryFileWriter;this.WritePPTXObject(memory,function(){_writer.StartRecord(0);_writer.WriteTxBody(textBody);_writer.EndRecord()})};this.WriteClrMapOverride=function(memory,clrMapOverride){var _writer=this.BinaryFileWriter;this.WritePPTXObject(memory,function(){_writer.StartRecord(0);_writer.StartRecord(0);_writer.WriteClrMapOvr(clrMapOverride);_writer.EndRecord(); _writer.EndRecord()})};this.WriteSpPr=function(memory,spPr,type){var _writer=this.BinaryFileWriter;this.WritePPTXObject(memory,function(){_writer.StartRecord(0);if(0==type)_writer.WriteLn(spPr);else if(1==type)_writer.WriteUniFill(spPr);else _writer.WriteSpPr(spPr);_writer.EndRecord()})};this.WriteStyleRef=function(memory,oStyleRef){var _writer=this.BinaryFileWriter;this.WritePPTXObject(memory,function(){_writer.StartRecord(0);_writer.WriteStyleRef(oStyleRef);_writer.EndRecord()})};this.WriteFontRef= function(memory,oFontRef){var _writer=this.BinaryFileWriter;this.WritePPTXObject(memory,function(){_writer.StartRecord(0);_writer.WriteFontRef(oFontRef);_writer.EndRecord()})};this.WriteBodyPr=function(memory,oBodyPr){var _writer=this.BinaryFileWriter;this.WritePPTXObject(memory,function(){_writer.StartRecord(0);_writer.WriteBodyPr(oBodyPr);_writer.EndRecord()})};this.WriteMod=function(memory,oMod){var _writer=this.BinaryFileWriter;this.WritePPTXObject(memory,function(){_writer.StartRecord(0);_writer.WriteMod(oMod, true);_writer.EndRecord()})};this.WriteUniColor=function(memory,oUniColor){var _writer=this.BinaryFileWriter;this.WritePPTXObject(memory,function(){_writer.StartRecord(0);_writer.WriteUniColor(oUniColor);_writer.EndRecord()})};this.WriteRunProperties=function(memory,rPr){var _writer=this.BinaryFileWriter;this.WritePPTXObject(memory,function(){_writer.StartRecord(0);_writer.WriteRunProperties(rPr);_writer.EndRecord()})};this.WriteDrawing=function(memory,grObject,Document,oMapCommentId,oNumIdMap,copyParams, saveParams){var oThis=this;this.WritePPTXObject(memory,function(){oThis.BinaryFileWriter.StartRecord(0);oThis.BinaryFileWriter.StartRecord(1);oThis.WriteGrObj(grObject,Document,oMapCommentId,oNumIdMap,copyParams,saveParams);oThis.BinaryFileWriter.EndRecord();oThis.BinaryFileWriter.EndRecord()})};this.WriteGrObj=function(grObject,Document,oMapCommentId,oNumIdMap,copyParams,saveParams){switch(grObject.getObjectType()){case AscDFH.historyitem_type_Shape:case AscDFH.historyitem_type_Cnx:{if(grObject.bWordShape)this.WriteShape(grObject, Document,oMapCommentId,oNumIdMap,copyParams,saveParams);else this.WriteShape2(grObject,Document,oMapCommentId,oNumIdMap,copyParams,saveParams);break}case AscDFH.historyitem_type_OleObject:case AscDFH.historyitem_type_ImageShape:{if(grObject.bWordShape)this.WriteImage(grObject);else this.WriteImage2(grObject);break}case AscDFH.historyitem_type_GroupShape:{this.WriteGroup(grObject,Document,oMapCommentId,oNumIdMap,copyParams,saveParams);break}case AscDFH.historyitem_type_LockedCanvas:{if(!grObject.group)this.BinaryFileWriter.WriteGroupShape(grObject, 9);break}case AscDFH.historyitem_type_ChartSpace:case AscDFH.historyitem_type_SlicerView:{this.BinaryFileWriter.WriteGrFrame(grObject);break}}};this.WriteShape2=function(shape,Document,oMapCommentId,oNumIdMap,copyParams,saveParams){var _writer=this.BinaryFileWriter;_writer.WriteShape(shape)};this.WriteShape=function(shape,Document,oMapCommentId,oNumIdMap,copyParams,saveParams){var _writer=this.BinaryFileWriter;if(shape.getObjectType()===AscDFH.historyitem_type_Cnx)_writer.StartRecord(3);else{_writer.StartRecord(1); _writer.WriteUChar(g_nodeAttributeStart);_writer._WriteBool2(0,shape.attrUseBgFill);_writer.WriteUChar(g_nodeAttributeEnd)}shape.spPr.WriteXfrm=shape.spPr.xfrm;var tmpFill=shape.spPr.Fill;var isUseTmpFill=false;if(tmpFill!==undefined&&tmpFill!=null){var trans=tmpFill.transparent!=null&&tmpFill.transparent!=255?tmpFill.transparent:null;if(trans!=null)if(tmpFill.fill===undefined||tmpFill.fill==null){isUseTmpFill=true;shape.spPr.Fill=shape.brush}}_writer.WriteRecord1(0,{locks:shape.locks,objectType:shape.getObjectType()}, _writer.WriteUniNvPr);_writer.WriteRecord1(1,shape.spPr,_writer.WriteSpPr);_writer.WriteRecord2(2,shape.style,_writer.WriteShapeStyle);if(shape.textBoxContent){_writer.StartRecord(4);var memory=this.ShapeTextBoxContent;this.arrayStackStartsTextBoxContent.push(memory.pos);var bdtw=new BinaryDocumentTableWriter(memory,Document,oMapCommentId,oNumIdMap,copyParams,saveParams);var bcw=new AscCommon.BinaryCommonWriter(memory);bcw.WriteItemWithLength(function(){bdtw.WriteDocumentContent(shape.textBoxContent)}); var oldPos=this.arrayStackStartsTextBoxContent[this.arrayStackStartsTextBoxContent.length-1];_writer.WriteBuffer(memory.data,oldPos,memory.pos-oldPos);memory.pos=oldPos;this.arrayStackStartsTextBoxContent.splice(this.arrayStackStartsTextBoxContent.length-1,1);_writer.EndRecord();_writer.StartRecord(5);_writer.WriteBodyPr(shape.bodyPr);_writer.EndRecord()}_writer.WriteRecord2(7,shape.signatureLine,_writer.WriteSignatureLine);shape.writeMacro(_writer);if(isUseTmpFill)shape.spPr.Fill=tmpFill;delete shape.spPr.WriteXfrm; _writer.EndRecord()};this.WriteImage2=function(image){var _writer=this.BinaryFileWriter;_writer.WriteImage(image)};this.WriteImage=function(image){var _writer=this.BinaryFileWriter;var isOle=AscDFH.historyitem_type_OleObject==image.getObjectType();var _type,_fileMask;if(isOle){_writer.StartRecord(6);_writer.WriteRecord1(4,image,_writer.WriteOleInfo)}else{var _type;var bMedia=false;if(image.nvPicPr&&image.nvPicPr.nvPr&&image.nvPicPr.nvPr.unimedia&&image.nvPicPr.nvPr.unimedia.type!==null&&typeof image.nvPicPr.nvPr.unimedia.media=== "string"&&image.nvPicPr.nvPr.unimedia.media.length>0){_type=image.nvPicPr.nvPr.unimedia.type;_fileMask=image.nvPicPr.nvPr.unimedia.media;bMedia=true}else _type=2;_writer.StartRecord(_type);if(bMedia)_writer.WriteRecord1(5,null,function(){_writer.WriteUChar(g_nodeAttributeStart);_writer._WriteString2(0,_fileMask);_writer.WriteUChar(g_nodeAttributeEnd)})}_writer.WriteRecord1(0,{locks:image.locks,objectType:image.getObjectType()},_writer.WriteUniNvPr);image.spPr.WriteXfrm=image.spPr.xfrm;var _unifill= null;if(image.blipFill instanceof AscFormat.CUniFill)_unifill=image.blipFill;else{_unifill=new AscFormat.CUniFill;_unifill.fill=image.blipFill}_writer.WriteRecord1(1,_unifill,_writer.WriteUniFill);_writer.WriteRecord1(2,image.spPr,_writer.WriteSpPr);_writer.WriteRecord2(3,image.style,_writer.WriteShapeStyle);image.writeMacro(_writer);delete image.spPr.WriteXfrm;_writer.EndRecord()};this.WriteOleInfo=function(ole){var ratio=20*3/4;var _writer=this.BinaryFileWriter;_writer.WriteUChar(g_nodeAttributeStart); _writer._WriteString2(0,ole.m_sApplicationId);_writer._WriteString2(1,ole.m_sData);_writer._WriteInt2(2,ratio*ole.m_nPixWidth);_writer._WriteInt2(3,ratio*ole.m_nPixHeight);_writer._WriteUChar2(4,0);_writer._WriteUChar2(5,0);_writer._WriteString2(7,ole.m_sObjectFile);_writer.WriteUChar(g_nodeAttributeEnd)};this.WriteGroup=function(group,Document,oMapCommentId,oNumIdMap,copyParams,saveParams){var _writer=this.BinaryFileWriter;_writer.StartRecord(4);group.spPr.WriteXfrm=group.spPr.xfrm;_writer.WriteRecord1(1, group.spPr,_writer.WriteGrpSpPr);delete group.spPr.WriteXfrm;var spTree=group.spTree;var _len=spTree.length;if(0!=_len){_writer.StartRecord(2);_writer.WriteULong(_len);for(var i=0;i<_len;i++){_writer.StartRecord(0);var elem=spTree[i];this.WriteGrObj(elem,Document,oMapCommentId,oNumIdMap,copyParams,saveParams);_writer.EndRecord(0)}_writer.EndRecord()}_writer.EndRecord()};this.WriteTheme=function(memory,theme){var _writer=this.BinaryFileWriter;this.WritePPTXObject(memory,function(){_writer.WriteTheme(theme)})}} window["AscCommon"]=window["AscCommon"]||{};window["AscCommon"].GUID=GUID;window["AscCommon"].c_oMainTables=c_oMainTables;window["AscCommon"].CBinaryFileWriter=CBinaryFileWriter;window["AscCommon"].pptx_content_writer=new CPPTXContentWriter})(window);"use strict";(function(window,undefined){var global_mouseEvent=AscCommon.global_mouseEvent;function HitInLine(context,px,py,x0,y0,x1,y1){var tx,ty,dx,dy,d;tx=x1-x0;ty=y1-y0;d=1.5/Math.sqrt(tx*tx+ty*ty);if(typeof global_mouseEvent!=="undefined"&&AscCommon.isRealObject(global_mouseEvent)&& AscFormat.isRealNumber(global_mouseEvent.KoefPixToMM))d*=global_mouseEvent.KoefPixToMM;if(global_mouseEvent&&global_mouseEvent.AscHitToHandlesEpsilon)d=global_mouseEvent.AscHitToHandlesEpsilon/Math.sqrt(tx*tx+ty*ty);dx=-ty*d;dy=tx*d;context.beginPath();context.moveTo(x0,y0);context.lineTo(x0+dx,y0+dy);context.lineTo(x1+dx,y1+dy);context.lineTo(x1-dx,y1-dy);context.lineTo(x0-dx,y0-dy);context.closePath();return context.isPointInPath(px,py)}function HitInBezier4(context,px,py,x0,y0,x1,y1,x2,y2,x3,y3){var l= Math.min(x0,x1,x2,x3);var t=Math.min(y0,y1,y2,y3);var r=Math.max(x0,x1,x2,x3);var b=Math.max(y0,y1,y2,y3);if(pxr||pyb)return false;var tx,ty,dx,dy,d;tx=x3-x0;ty=y3-y0;d=1.5/Math.sqrt(tx*tx+ty*ty);if(typeof global_mouseEvent!=="undefined"&&AscCommon.isRealObject(global_mouseEvent)&&AscFormat.isRealNumber(global_mouseEvent.KoefPixToMM))d*=global_mouseEvent.KoefPixToMM;if(global_mouseEvent&&global_mouseEvent.AscHitToHandlesEpsilon)d=global_mouseEvent.AscHitToHandlesEpsilon/Math.sqrt(tx* tx+ty*ty);dx=-ty*d;dy=tx*d;context.beginPath();context.moveTo(x0,y0);context.lineTo(x0+dx,y0+dy);context.bezierCurveTo(x1+dx,y1+dy,x2+dx,y2+dy,x3+dx,y3+dy);context.lineTo(x3-dx,y3-dy);context.bezierCurveTo(x2-dx,y2-dy,x1-dx,y1-dy,x0-dx,y0-dy);context.closePath();return context.isPointInPath(px,py)}function HitInBezier3(context,px,py,x0,y0,x1,y1,x2,y2){var l=Math.min(x0,x1,x2);var t=Math.min(y0,y1,y2);var r=Math.max(x0,x1,x2);var b=Math.max(y0,y1,y2);if(pxr||pyb)return false;var tx,ty, dx,dy,d;tx=x2-x0;ty=y2-y0;d=1.5/Math.sqrt(tx*tx+ty*ty);if(typeof global_mouseEvent!=="undefined"&&AscCommon.isRealObject(global_mouseEvent)&&AscFormat.isRealNumber(global_mouseEvent.KoefPixToMM))d*=global_mouseEvent.KoefPixToMM;if(global_mouseEvent&&global_mouseEvent.AscHitToHandlesEpsilon)d=global_mouseEvent.AscHitToHandlesEpsilon/Math.sqrt(tx*tx+ty*ty);dx=-ty*d;dy=tx*d;context.beginPath();context.moveTo(x0,y0);context.lineTo(x0+dx,y0+dy);context.quadraticCurveTo(x1+dx,y1+dy,x2+dx,y2+dy);context.lineTo(x2- dx,y2-dy);context.quadraticCurveTo(x1-dx,y1-dy,x0-dx,y0-dy);context.closePath();return context.isPointInPath(px,py)}window["AscFormat"]=window["AscFormat"]||{};window["AscFormat"].HitInLine=HitInLine;window["AscFormat"].HitInBezier4=HitInBezier4;window["AscFormat"].HitInBezier3=HitInBezier3})(window);"use strict";(function(window,undefined){var HitInBezier4=AscFormat.HitInBezier4;function Arc3(ctx,fX,fY,fWidth,fHeight,fStartAngle,fSweepAngle){var sin1=Math.sin(fStartAngle);var cos1=Math.cos(fStartAngle); var __x=cos1/fWidth;var __y=sin1/fHeight;var l=1/Math.sqrt(__x*__x+__y*__y);var cx=fX-l*cos1;var cy=fY-l*sin1;Arc2(ctx,cx-fWidth,cy-fHeight,2*fWidth,2*fHeight,fStartAngle,fSweepAngle)}function Arc2(ctx,fX,fY,fWidth,fHeight,fStartAngle,fSweepAngle){if(0>=fWidth||0>=fHeight)return;fStartAngle=-fStartAngle;fSweepAngle=-fSweepAngle;if(false){var fStartX=fX+fWidth/2+fWidth/2*Math.cos(AngToEllPrm(fStartAngle,fWidth/2,fHeight/2));var fStartY=fY+fHeight/2-fHeight/2*Math.sin(AngToEllPrm(fStartAngle,fWidth/ 2,fHeight/2));if(fSweepAngle<2*Math.PI)ctx._m(fStartX,fStartY)}var bClockDirection=false;var fEndAngle=2*Math.PI-(fSweepAngle+fStartAngle);var fSrtAngle=2*Math.PI-fStartAngle;if(fSweepAngle>0)bClockDirection=true;if(Math.abs(fSweepAngle)>=2*Math.PI)Ellipse(ctx,fX+fWidth/2,fY+fHeight/2,fWidth/2,fHeight/2);else EllipseArc(ctx,fX+fWidth/2,fY+fHeight/2,fWidth/2,fHeight/2,fSrtAngle,fEndAngle,bClockDirection)}function AngToEllPrm(fAngle,fXRad,fYRad){return Math.atan2(Math.sin(fAngle)/fYRad,Math.cos(fAngle)/ fXRad)}function Ellipse(ctx,fX,fY,fXRad,fYRad){ctx._m(fX-fXRad,fY);var c_fKappa=.552;ctx._c(fX-fXRad,fY+fYRad*c_fKappa,fX-fXRad*c_fKappa,fY+fYRad,fX,fY+fYRad);ctx._c(fX+fXRad*c_fKappa,fY+fYRad,fX+fXRad,fY+fYRad*c_fKappa,fX+fXRad,fY);ctx._c(fX+fXRad,fY-fYRad*c_fKappa,fX+fXRad*c_fKappa,fY-fYRad,fX,fY-fYRad);ctx._c(fX-fXRad*c_fKappa,fY-fYRad,fX-fXRad,fY-fYRad*c_fKappa,fX-fXRad,fY)}function EllipseArc(ctx,fX,fY,fXRad,fYRad,fAngle1,fAngle2,bClockDirection){while(fAngle1<0)fAngle1+=2*Math.PI;while(fAngle1> 2*Math.PI)fAngle1-=2*Math.PI;while(fAngle2<0)fAngle2+=2*Math.PI;while(fAngle2>=2*Math.PI)fAngle2-=2*Math.PI;if(!bClockDirection)if(fAngle1<=fAngle2)EllipseArc2(ctx,fX,fY,fXRad,fYRad,fAngle1,fAngle2,false);else{EllipseArc2(ctx,fX,fY,fXRad,fYRad,fAngle1,2*Math.PI,false);EllipseArc2(ctx,fX,fY,fXRad,fYRad,0,fAngle2,false)}else if(fAngle1>=fAngle2)EllipseArc2(ctx,fX,fY,fXRad,fYRad,fAngle1,fAngle2,true);else{EllipseArc2(ctx,fX,fY,fXRad,fYRad,fAngle1,0,true);EllipseArc2(ctx,fX,fY,fXRad,fYRad,2*Math.PI,fAngle2, true)}}function EllipseArc2(ctx,fX,fY,fXRad,fYRad,dAngle1,dAngle2,bClockDirection){var nFirstPointQuard=(2*dAngle1/Math.PI>>0)+1;var nSecondPointQuard=(2*dAngle2/Math.PI>>0)+1;nSecondPointQuard=Math.min(4,Math.max(1,nSecondPointQuard));nFirstPointQuard=Math.min(4,Math.max(1,nFirstPointQuard));var fStartX=fX+fXRad*Math.cos(AngToEllPrm(dAngle1,fXRad,fYRad));var fStartY=fY+fYRad*Math.sin(AngToEllPrm(dAngle1,fXRad,fYRad));var EndPoint={X:0,Y:0};var fCurX=fStartX,fCurY=fStartY;var dStartAngle=dAngle1; var dEndAngle=0;if(!bClockDirection)for(var nIndex=nFirstPointQuard;nIndex<=nSecondPointQuard;nIndex++){if(nIndex==nSecondPointQuard)dEndAngle=dAngle2;else dEndAngle=nIndex*Math.PI/2;if(!(nIndex==nFirstPointQuard))dStartAngle=(nIndex-1)*Math.PI/2;EndPoint=EllipseArc3(ctx,fX,fY,fXRad,fYRad,AngToEllPrm(dStartAngle,fXRad,fYRad),AngToEllPrm(dEndAngle,fXRad,fYRad),false)}else for(var nIndex=nFirstPointQuard;nIndex>=nSecondPointQuard;nIndex--){if(nIndex==nFirstPointQuard)dStartAngle=dAngle1;else dStartAngle= nIndex*Math.PI/2;if(!(nIndex==nSecondPointQuard))dEndAngle=(nIndex-1)*Math.PI/2;else dEndAngle=dAngle2;EndPoint=EllipseArc3(ctx,fX,fY,fXRad,fYRad,AngToEllPrm(dStartAngle,fXRad,fYRad),AngToEllPrm(dEndAngle,fXRad,fYRad),false)}}function EllipseArc3(ctx,fX,fY,fXRad,fYRad,dAngle1,dAngle2,bClockDirection){var fAlpha=Math.sin(dAngle2-dAngle1)*(Math.sqrt(4+3*Math.tan((dAngle2-dAngle1)/2)*Math.tan((dAngle2-dAngle1)/2))-1)/3;var sin1=Math.sin(dAngle1);var cos1=Math.cos(dAngle1);var sin2=Math.sin(dAngle2); var cos2=Math.cos(dAngle2);var fX1=fX+fXRad*cos1;var fY1=fY+fYRad*sin1;var fX2=fX+fXRad*cos2;var fY2=fY+fYRad*sin2;var fCX1=fX1-fAlpha*fXRad*sin1;var fCY1=fY1+fAlpha*fYRad*cos1;var fCX2=fX2+fAlpha*fXRad*sin2;var fCY2=fY2-fAlpha*fYRad*cos2;if(!bClockDirection){ctx._c(fCX1,fCY1,fCX2,fCY2,fX2,fY2);return{X:fX2,Y:fY2}}else{ctx._c(fCX2,fCY2,fCX1,fCY1,fX1,fY1);return{X:fX1,Y:fY1}}}function _ArcToOnCanvas(context,start_x,start_y,width_r,height_r,start_ang,sweep_ang){var _sin=Math.sin(start_ang);var _cos= Math.cos(start_ang);var _x=_cos/width_r;var _y=_sin/height_r;var _l=1/Math.sqrt(_x*_x+_y*_y);var _cx=start_x-_l*_cos;var _cy=start_y-_l*_sin;ArcTo2OnCanvas(context,_cx-width_r,_cy-height_r,2*width_r,2*height_r,start_ang,sweep_ang)}function ArcTo2OnCanvas(context,_l_c_x,_l_c_y,width,height,start_ang,sweep_ang){if(0>=width||0>=height)return;start_ang=-start_ang;sweep_ang=-sweep_ang;var bClockDirection=false;var fEndAngle=2*Math.PI-(sweep_ang+start_ang);var fSrtAngle=2*Math.PI-start_ang;if(sweep_ang> 0)bClockDirection=true;if(Math.abs(sweep_ang)>=2*Math.PI)EllipseOnCanvas(context,_l_c_x+width/2,_l_c_y+height/2,width/2,height/2);else EllipseArcOnCanvas(context,_l_c_x+width/2,_l_c_y+height/2,width/2,height/2,fSrtAngle,fEndAngle,bClockDirection)}function EllipseOnCanvas(ctx,fX,fY,fXRad,fYRad){ctx.moveTo(fX-fXRad,fY);var c_fKappa=.552;ctx.bezierCurveTo(fX-fXRad,fY+fYRad*c_fKappa,fX-fXRad*c_fKappa,fY+fYRad,fX,fY+fYRad);ctx.bezierCurveTo(fX+fXRad*c_fKappa,fY+fYRad,fX+fXRad,fY+fYRad*c_fKappa,fX+fXRad, fY);ctx.bezierCurveTo(fX+fXRad,fY-fYRad*c_fKappa,fX+fXRad*c_fKappa,fY-fYRad,fX,fY-fYRad);ctx.bezierCurveTo(fX-fXRad*c_fKappa,fY-fYRad,fX-fXRad,fY-fYRad*c_fKappa,fX-fXRad,fY)}function EllipseArcOnCanvas(ctx,fX,fY,fXRad,fYRad,fAngle1,fAngle2,bClockDirection){while(fAngle1<0)fAngle1+=2*Math.PI;while(fAngle1>2*Math.PI)fAngle1-=2*Math.PI;while(fAngle2<0)fAngle2+=2*Math.PI;while(fAngle2>=2*Math.PI)fAngle2-=2*Math.PI;if(!bClockDirection)if(fAngle1<=fAngle2)EllipseArc2OnCanvas(ctx,fX,fY,fXRad,fYRad,fAngle1, fAngle2,false);else{EllipseArc2OnCanvas(ctx,fX,fY,fXRad,fYRad,fAngle1,2*Math.PI,false);EllipseArc2OnCanvas(ctx,fX,fY,fXRad,fYRad,0,fAngle2,false)}else if(fAngle1>=fAngle2)EllipseArc2OnCanvas(ctx,fX,fY,fXRad,fYRad,fAngle1,fAngle2,true);else{EllipseArc2OnCanvas(ctx,fX,fY,fXRad,fYRad,fAngle1,0,true);EllipseArc2OnCanvas(ctx,fX,fY,fXRad,fYRad,2*Math.PI,fAngle2,true)}}function EllipseArc2OnCanvas(ctx,fX,fY,fXRad,fYRad,dAngle1,dAngle2,bClockDirection){var nFirstPointQuard=(2*dAngle1/Math.PI>>0)+1;var nSecondPointQuard= (2*dAngle2/Math.PI>>0)+1;nSecondPointQuard=Math.min(4,Math.max(1,nSecondPointQuard));nFirstPointQuard=Math.min(4,Math.max(1,nFirstPointQuard));var fStartX=fX+fXRad*Math.cos(AngToEllPrm(dAngle1,fXRad,fYRad));var fStartY=fY+fYRad*Math.sin(AngToEllPrm(dAngle1,fXRad,fYRad));var EndPoint={X:0,Y:0};ctx.lineTo(fStartX,fStartY);var fCurX=fStartX,fCurY=fStartY;var dStartAngle=dAngle1;var dEndAngle=0;if(!bClockDirection)for(var nIndex=nFirstPointQuard;nIndex<=nSecondPointQuard;nIndex++){if(nIndex==nSecondPointQuard)dEndAngle= dAngle2;else dEndAngle=nIndex*Math.PI/2;if(!(nIndex==nFirstPointQuard))dStartAngle=(nIndex-1)*Math.PI/2;EndPoint=EllipseArc3OnCanvas(ctx,fX,fY,fXRad,fYRad,AngToEllPrm(dStartAngle,fXRad,fYRad),AngToEllPrm(dEndAngle,fXRad,fYRad),false)}else for(var nIndex=nFirstPointQuard;nIndex>=nSecondPointQuard;nIndex--){if(nIndex==nFirstPointQuard)dStartAngle=dAngle1;else dStartAngle=nIndex*Math.PI/2;if(!(nIndex==nSecondPointQuard))dEndAngle=(nIndex-1)*Math.PI/2;else dEndAngle=dAngle2;EndPoint=EllipseArc3OnCanvas(ctx, fX,fY,fXRad,fYRad,AngToEllPrm(dStartAngle,fXRad,fYRad),AngToEllPrm(dEndAngle,fXRad,fYRad),false)}}function EllipseArc3OnCanvas(ctx,fX,fY,fXRad,fYRad,dAngle1,dAngle2,bClockDirection){var fAlpha=Math.sin(dAngle2-dAngle1)*(Math.sqrt(4+3*Math.tan((dAngle2-dAngle1)/2)*Math.tan((dAngle2-dAngle1)/2))-1)/3;var sin1=Math.sin(dAngle1);var cos1=Math.cos(dAngle1);var sin2=Math.sin(dAngle2);var cos2=Math.cos(dAngle2);var fX1=fX+fXRad*cos1;var fY1=fY+fYRad*sin1;var fX2=fX+fXRad*cos2;var fY2=fY+fYRad*sin2;var fCX1= fX1-fAlpha*fXRad*sin1;var fCY1=fY1+fAlpha*fYRad*cos1;var fCX2=fX2+fAlpha*fXRad*sin2;var fCY2=fY2-fAlpha*fYRad*cos2;if(!bClockDirection){ctx.bezierCurveTo(fCX1,fCY1,fCX2,fCY2,fX2,fY2);return{X:fX2,Y:fY2}}else{ctx.bezierCurveTo(fCX2,fCY2,fCX1,fCY1,fX1,fY1);return{X:fX1,Y:fY1}}}function _HitToArc(context,px,py,start_x,start_y,width_r,height_r,start_ang,sweep_ang){var _sin=Math.sin(start_ang);var _cos=Math.cos(start_ang);var _x=_cos/width_r;var _y=_sin/height_r;var _l=1/Math.sqrt(_x*_x+_y*_y);var _cx= start_x-_l*_cos;var _cy=start_y-_l*_sin;return HitToArc2(px,py,context,_cx-width_r,_cy-height_r,2*width_r,2*height_r,start_ang,sweep_ang)}function HitToArc2(px,py,context,_l_c_x,_l_c_y,width,height,start_ang,sweep_ang){if(0>=width||0>=height)return;start_ang=-start_ang;sweep_ang=-sweep_ang;var bClockDirection=false;var fEndAngle=2*Math.PI-(sweep_ang+start_ang);var fSrtAngle=2*Math.PI-start_ang;if(sweep_ang>0)bClockDirection=true;if(Math.abs(sweep_ang)>=2*Math.PI)return HitToEllipseOnCanvas(px,py, context,_l_c_x+width/2,_l_c_y+height/2,width/2,height/2);else return HitToEllipseArcOnCanvas(px,py,context,_l_c_x+width/2,_l_c_y+height/2,width/2,height/2,fSrtAngle,fEndAngle,bClockDirection)}function HitToEllipseOnCanvas(px,py,ctx,fX,fY,fXRad,fYRad){var c_fKappa=.552;return HitInBezier4(ctx,px,py,fX-fXRad,fY,fX-fXRad,fY+fYRad*c_fKappa,fX-fXRad*c_fKappa,fY+fYRad,fX,fY+fYRad)||HitInBezier4(ctx,px,py,fX,fY+fYRad,fX+fXRad*c_fKappa,fY+fYRad,fX+fXRad,fY+fYRad*c_fKappa,fX+fXRad,fY)||HitInBezier4(ctx,px, py,fX+fXRad,fY,fX+fXRad,fY-fYRad*c_fKappa,fX+fXRad*c_fKappa,fY-fYRad,fX,fY-fYRad)||HitInBezier4(ctx,px,py,fX,fY-fYRad,fX-fXRad*c_fKappa,fY-fYRad,fX-fXRad,fY-fYRad*c_fKappa,fX-fXRad,fY)}function HitToEllipseArcOnCanvas(px,py,ctx,fX,fY,fXRad,fYRad,fAngle1,fAngle2,bClockDirection){while(fAngle1<0)fAngle1+=2*Math.PI;while(fAngle1>2*Math.PI)fAngle1-=2*Math.PI;while(fAngle2<0)fAngle2+=2*Math.PI;while(fAngle2>=2*Math.PI)fAngle2-=2*Math.PI;if(!bClockDirection)if(fAngle1<=fAngle2)return HitToEllipseArc2OnCanvas(px, py,ctx,fX,fY,fXRad,fYRad,fAngle1,fAngle2,false);else return HitToEllipseArc2OnCanvas(px,py,ctx,fX,fY,fXRad,fYRad,fAngle1,2*Math.PI,false)||HitToEllipseArc2OnCanvas(px,py,ctx,fX,fY,fXRad,fYRad,0,fAngle2,false);else if(fAngle1>=fAngle2)return HitToEllipseArc2OnCanvas(px,py,ctx,fX,fY,fXRad,fYRad,fAngle1,fAngle2,true);else return HitToEllipseArc2OnCanvas(px,py,ctx,fX,fY,fXRad,fYRad,fAngle1,0,true)||HitToEllipseArc2OnCanvas(px,py,ctx,fX,fY,fXRad,fYRad,2*Math.PI,fAngle2,true)}function HitToEllipseArc2OnCanvas(px, py,ctx,fX,fY,fXRad,fYRad,dAngle1,dAngle2,bClockDirection){var nFirstPointQuard=(2*dAngle1/Math.PI>>0)+1;var nSecondPointQuard=(2*dAngle2/Math.PI>>0)+1;nSecondPointQuard=Math.min(4,Math.max(1,nSecondPointQuard));nFirstPointQuard=Math.min(4,Math.max(1,nFirstPointQuard));var fStartX=fX+fXRad*Math.cos(AngToEllPrm(dAngle1,fXRad,fYRad));var fStartY=fY+fYRad*Math.sin(AngToEllPrm(dAngle1,fXRad,fYRad));var EndPoint={X:fStartX,Y:fStartY,hit:false};var dStartAngle=dAngle1;var dEndAngle=0;if(!bClockDirection)for(var nIndex= nFirstPointQuard;nIndex<=nSecondPointQuard;nIndex++){if(nIndex==nSecondPointQuard)dEndAngle=dAngle2;else dEndAngle=nIndex*Math.PI/2;if(!(nIndex==nFirstPointQuard))dStartAngle=(nIndex-1)*Math.PI/2;EndPoint=HitToEllipseArc3OnCanvas(px,py,EndPoint,ctx,fX,fY,fXRad,fYRad,AngToEllPrm(dStartAngle,fXRad,fYRad),AngToEllPrm(dEndAngle,fXRad,fYRad),false);if(EndPoint.hit)return true}else for(var nIndex=nFirstPointQuard;nIndex>=nSecondPointQuard;nIndex--){if(nIndex==nFirstPointQuard)dStartAngle=dAngle1;else dStartAngle= nIndex*Math.PI/2;if(!(nIndex==nSecondPointQuard))dEndAngle=(nIndex-1)*Math.PI/2;else dEndAngle=dAngle2;EndPoint=HitToEllipseArc3OnCanvas(px,py,EndPoint,ctx,fX,fY,fXRad,fYRad,AngToEllPrm(dStartAngle,fXRad,fYRad),AngToEllPrm(dEndAngle,fXRad,fYRad),false);if(EndPoint.hit)return true}return false}function HitToEllipseArc3OnCanvas(px,py,EndPoint,ctx,fX,fY,fXRad,fYRad,dAngle1,dAngle2,bClockDirection){var fAlpha=Math.sin(dAngle2-dAngle1)*(Math.sqrt(4+3*Math.tan((dAngle2-dAngle1)/2)*Math.tan((dAngle2-dAngle1)/ 2))-1)/3;var sin1=Math.sin(dAngle1);var cos1=Math.cos(dAngle1);var sin2=Math.sin(dAngle2);var cos2=Math.cos(dAngle2);var fX1=fX+fXRad*cos1;var fY1=fY+fYRad*sin1;var fX2=fX+fXRad*cos2;var fY2=fY+fYRad*sin2;var fCX1=fX1-fAlpha*fXRad*sin1;var fCY1=fY1+fAlpha*fYRad*cos1;var fCX2=fX2+fAlpha*fXRad*sin2;var fCY2=fY2-fAlpha*fYRad*cos2;if(!bClockDirection)return{X:fX2,Y:fY2,hit:HitInBezier4(ctx,px,py,EndPoint.X,EndPoint.Y,fCX1,fCY1,fCX2,fCY2,fX2,fY2)};else return{X:fX1,Y:fY1,hit:HitInBezier4(ctx,px,py,EndPoint.X, EndPoint.Y,fCX2,fCY2,fCX1,fCY1,fX1,fY1)}}window["AscFormat"]=window["AscFormat"]||{};window["AscFormat"].ArcToCurvers=Arc3;window["AscFormat"].HitToArc=_HitToArc;window["AscFormat"].ArcToOnCanvas=_ArcToOnCanvas})(window);"use strict";(function(window,undefined){function CShapeColor(r,g,b){this.r=r;this.g=g;this.b=b}function dBoundColor(c){var t=c+.5>>0;return t<0?0:t>255?255:t}function dBoundColor2(c,min,max){var t=c+.5>>0;return tmax?max:t}CShapeColor.prototype.getColorData=function(dBrightness){if(AscFormat.fApproxEqual(dBrightness, 0))return this;var r,g,b;if(dBrightness>=0)return new CShapeColor(dBoundColor(this.r*(1-dBrightness)+dBrightness*255),dBoundColor(this.g*(1-dBrightness)+dBrightness*255),dBoundColor(this.b*(1-dBrightness)+dBrightness*255));else return new CShapeColor(dBoundColor(this.r*(1+dBrightness)),dBoundColor(this.g*(1+dBrightness)),dBoundColor(this.b*(1+dBrightness)))};CShapeColor.prototype.darken=function(){return this.getColorData(-.4)};CShapeColor.prototype.darkenLess=function(){return this.getColorData(-.2)}; CShapeColor.prototype.lighten=function(){return this.getColorData(.4)};CShapeColor.prototype.lightenLess=function(){return this.getColorData(.2)};CShapeColor.prototype.norm=function(a){return this};window["AscFormat"]=window["AscFormat"]||{};window["AscFormat"].CShapeColor=CShapeColor;window["AscFormat"].ClampColor=dBoundColor;window["AscFormat"].ClampColor2=dBoundColor2})(window);"use strict";(function(window,undefined){var c_oAscSizeRelFromH=AscCommon.c_oAscSizeRelFromH;var c_oAscSizeRelFromV=AscCommon.c_oAscSizeRelFromV; var c_oAscLockTypes=AscCommon.c_oAscLockTypes;var parserHelp=AscCommon.parserHelp;var isRealObject=AscCommon.isRealObject;var History=AscCommon.History;var c_oAscError=Asc.c_oAscError;var c_oAscChartTitleShowSettings=Asc.c_oAscChartTitleShowSettings;var c_oAscChartHorAxisLabelShowSettings=Asc.c_oAscChartHorAxisLabelShowSettings;var c_oAscChartVertAxisLabelShowSettings=Asc.c_oAscChartVertAxisLabelShowSettings;var c_oAscChartLegendShowSettings=Asc.c_oAscChartLegendShowSettings;var c_oAscChartDataLabelsPos= Asc.c_oAscChartDataLabelsPos;var c_oAscGridLinesSettings=Asc.c_oAscGridLinesSettings;var c_oAscChartTypeSettings=Asc.c_oAscChartTypeSettings;var c_oAscRelativeFromH=Asc.c_oAscRelativeFromH;var c_oAscRelativeFromV=Asc.c_oAscRelativeFromV;var c_oAscFill=Asc.c_oAscFill;var HANDLE_EVENT_MODE_HANDLE=0;var HANDLE_EVENT_MODE_CURSOR=1;var DISTANCE_TO_TEXT_LEFTRIGHT=3.2;var BAR_DIR_BAR=0;var BAR_DIR_COL=1;var BAR_GROUPING_CLUSTERED=0;var BAR_GROUPING_PERCENT_STACKED=1;var BAR_GROUPING_STACKED=2;var BAR_GROUPING_STANDARD= 3;var GROUPING_PERCENT_STACKED=0;var GROUPING_STACKED=1;var GROUPING_STANDARD=2;var SCATTER_STYLE_LINE=0;var SCATTER_STYLE_LINE_MARKER=1;var SCATTER_STYLE_MARKER=2;var SCATTER_STYLE_NONE=3;var SCATTER_STYLE_SMOOTH=4;var SCATTER_STYLE_SMOOTH_MARKER=5;var CARD_DIRECTION_N=0;var CARD_DIRECTION_NE=1;var CARD_DIRECTION_E=2;var CARD_DIRECTION_SE=3;var CARD_DIRECTION_S=4;var CARD_DIRECTION_SW=5;var CARD_DIRECTION_W=6;var CARD_DIRECTION_NW=7;var CURSOR_TYPES_BY_CARD_DIRECTION=[];CURSOR_TYPES_BY_CARD_DIRECTION[CARD_DIRECTION_N]= "n-resize";CURSOR_TYPES_BY_CARD_DIRECTION[CARD_DIRECTION_NE]="ne-resize";CURSOR_TYPES_BY_CARD_DIRECTION[CARD_DIRECTION_E]="e-resize";CURSOR_TYPES_BY_CARD_DIRECTION[CARD_DIRECTION_SE]="se-resize";CURSOR_TYPES_BY_CARD_DIRECTION[CARD_DIRECTION_S]="s-resize";CURSOR_TYPES_BY_CARD_DIRECTION[CARD_DIRECTION_SW]="sw-resize";CURSOR_TYPES_BY_CARD_DIRECTION[CARD_DIRECTION_W]="w-resize";CURSOR_TYPES_BY_CARD_DIRECTION[CARD_DIRECTION_NW]="nw-resize";function fillImage(image,rasterImageId,x,y,extX,extY,sVideoUrl, sAudioUrl){image.setSpPr(new AscFormat.CSpPr);image.spPr.setParent(image);image.spPr.setGeometry(AscFormat.CreateGeometry("rect"));image.spPr.setXfrm(new AscFormat.CXfrm);image.spPr.xfrm.setParent(image.spPr);image.spPr.xfrm.setOffX(x);image.spPr.xfrm.setOffY(y);image.spPr.xfrm.setExtX(extX);image.spPr.xfrm.setExtY(extY);var blip_fill=new AscFormat.CBlipFill;blip_fill.setRasterImageId(rasterImageId);blip_fill.setStretch(true);image.setBlipFill(blip_fill);image.setNvPicPr(new AscFormat.UniNvPr);var sMediaName= sVideoUrl||sAudioUrl;if(sMediaName){var sExt=AscCommon.GetFileExtension(sMediaName);var oUniMedia=new AscFormat.UniMedia;oUniMedia.type=sVideoUrl?7:8;oUniMedia.media="maskFile."+sExt;image.nvPicPr.nvPr.setUniMedia(oUniMedia)}image.setNoChangeAspect(true);image.setBDeleted(false)}function fApproxEqual(a,b,fDelta){if(a===b)return true;if(AscFormat.isRealNumber(fDelta))return Math.abs(a-b)Math.max(x21,x22))return false;if(Math.max(y11,y12)Math.max(y21,y22))return false;var oCoeffs=fResolve2LinearSystem(x12-x11,-(x22-x21),y12-y11,-(y22-y21),x21-x11,y21-y11);if(oCoeffs.bError)return false;return oCoeffs.x1>=0&&oCoeffs.x1<=1&&oCoeffs.x2>=0&&oCoeffs.x2<=1}function fResolve2LinearSystem(a11,a12,a21,a22,t1,t2){var oResult={bError:true}; var D=a11*a22-a12*a21;if(fApproxEqual(D,0))return oResult;oResult.bError=false;oResult.x1=(t1*a22-a12*t2)/D;oResult.x2=(a11*t2-t1*a21)/D;return oResult}function checkParagraphDefFonts(map,par){par&&par.Pr&&par.Pr.DefaultRunPr&&checkRFonts(map,par.Pr.DefaultRunPr.RFonts)}function checkTxBodyDefFonts(map,txBody){txBody&&txBody.content&&txBody.content.Content[0]&&checkParagraphDefFonts(map,txBody.content.Content[0])}function checkRFonts(map,rFonts){if(rFonts){if(rFonts.Ascii&&typeof rFonts.Ascii.Name&& rFonts.Ascii.Name.length>0)map[rFonts.Ascii.Name]=true;if(rFonts.EastAsia&&typeof rFonts.EastAsia.Name&&rFonts.EastAsia.Name.length>0)map[rFonts.EastAsia.Name]=true;if(rFonts.CS&&typeof rFonts.CS.Name&&rFonts.CS.Name.length>0)map[rFonts.CS.Name]=true;if(rFonts.HAnsi&&typeof rFonts.HAnsi.Name&&rFonts.HAnsi.Name.length>0)map[rFonts.HAnsi.Name]=true}}function CheckShapeBodyAutoFitReset(oShape,bNoResetRelSize){var oParaDrawing=AscFormat.getParaDrawing(oShape);if(oParaDrawing&&!(bNoResetRelSize===true)){if(oParaDrawing.SizeRelH)oParaDrawing.SetSizeRelH(undefined); if(oParaDrawing.SizeRelV)oParaDrawing.SetSizeRelV(undefined)}if(oShape instanceof AscFormat.CShape){var oPropsToSet=null;if(oShape.bWordShape){if(!oShape.textBoxContent)return;if(oShape.bodyPr)oPropsToSet=oShape.bodyPr.createDuplicate();else oPropsToSet=new AscFormat.CBodyPr}else{if(!oShape.txBody)return;if(oShape.txBody.bodyPr)oPropsToSet=oShape.txBody.bodyPr.createDuplicate();else oPropsToSet=new AscFormat.CBodyPr}var oBodyPr=oShape.getBodyPr();if(oBodyPr.textFit&&oBodyPr.textFit.type===AscFormat.text_fit_Auto){if(!oPropsToSet.textFit)oPropsToSet.textFit= new AscFormat.CTextFit;oPropsToSet.textFit.type=AscFormat.text_fit_No}if(oBodyPr.wrap===AscFormat.nTWTNone)oPropsToSet.wrap=AscFormat.nTWTSquare;if(oShape.bWordShape)oShape.setBodyPr(oPropsToSet);else{oShape.txBody.setBodyPr(oPropsToSet);if(oShape.checkExtentsByDocContent)oShape.checkExtentsByDocContent(true,true)}}}function CDistance(L,T,R,B){this.L=L;this.T=T;this.R=R;this.B=B}function ConvertRelPositionHToRelSize(nRelPosition){switch(nRelPosition){case c_oAscRelativeFromH.InsideMargin:{return c_oAscSizeRelFromH.sizerelfromhInsideMargin}case c_oAscRelativeFromH.LeftMargin:{return c_oAscSizeRelFromH.sizerelfromhLeftMargin}case c_oAscRelativeFromH.Margin:{return c_oAscSizeRelFromH.sizerelfromhMargin}case c_oAscRelativeFromH.OutsideMargin:{return c_oAscSizeRelFromH.sizerelfromhOutsideMargin}case c_oAscRelativeFromH.Page:{return c_oAscSizeRelFromH.sizerelfromhPage}case c_oAscRelativeFromH.RightMargin:{return c_oAscSizeRelFromH.sizerelfromhRightMargin}default:{return c_oAscSizeRelFromH.sizerelfromhPage}}} function ConvertRelPositionVToRelSize(nRelPosition){switch(nRelPosition){case c_oAscRelativeFromV.BottomMargin:{return c_oAscSizeRelFromV.sizerelfromvBottomMargin}case c_oAscRelativeFromV.InsideMargin:{return c_oAscSizeRelFromV.sizerelfromvInsideMargin}case c_oAscRelativeFromV.Margin:{return c_oAscSizeRelFromV.sizerelfromvMargin}case c_oAscRelativeFromV.OutsideMargin:{return c_oAscSizeRelFromV.sizerelfromvOutsideMargin}case c_oAscRelativeFromV.Page:{return c_oAscSizeRelFromV.sizerelfromvPage}case c_oAscRelativeFromV.TopMargin:{return c_oAscSizeRelFromV.sizerelfromvTopMargin}default:{return c_oAscSizeRelFromV.sizerelfromvMargin}}} function ConvertRelSizeHToRelPosition(nRelSize){switch(nRelSize){case c_oAscSizeRelFromH.sizerelfromhMargin:{return c_oAscRelativeFromH.Margin}case c_oAscSizeRelFromH.sizerelfromhPage:{return c_oAscRelativeFromH.Page}case c_oAscSizeRelFromH.sizerelfromhLeftMargin:{return c_oAscRelativeFromH.LeftMargin}case c_oAscSizeRelFromH.sizerelfromhRightMargin:{return c_oAscRelativeFromH.RightMargin}case c_oAscSizeRelFromH.sizerelfromhInsideMargin:{return c_oAscRelativeFromH.InsideMargin}case c_oAscSizeRelFromH.sizerelfromhOutsideMargin:{return c_oAscRelativeFromH.OutsideMargin}default:{return c_oAscRelativeFromH.Margin}}} function ConvertRelSizeVToRelPosition(nRelSize){switch(nRelSize){case c_oAscSizeRelFromV.sizerelfromvMargin:{return c_oAscRelativeFromV.Margin}case c_oAscSizeRelFromV.sizerelfromvPage:{return c_oAscRelativeFromV.Page}case c_oAscSizeRelFromV.sizerelfromvTopMargin:{return c_oAscRelativeFromV.TopMargin}case c_oAscSizeRelFromV.sizerelfromvBottomMargin:{return c_oAscRelativeFromV.BottomMargin}case c_oAscSizeRelFromV.sizerelfromvInsideMargin:{return c_oAscRelativeFromV.InsideMargin}case c_oAscSizeRelFromV.sizerelfromvOutsideMargin:{return c_oAscRelativeFromV.OutsideMargin}default:{return c_oAscRelativeFromV.Margin}}} function checkObjectInArray(aObjects,oObject){var i;for(i=0;i558.7)return 0;return val}return defaultVal}function checkInternalSelection(selection){return!!(selection.groupSelection||selection.chartSelection||selection.textSelection)}function CheckStockChart(oDrawingObjects,oApi){var selectedObjectsByType=oDrawingObjects.getSelectedObjectsByTypes(); if(selectedObjectsByType.charts[0]){var chartSpace=selectedObjectsByType.charts[0];if(!chartSpace.canChangeToStockChart()){oApi.sendEvent("asc_onError",c_oAscError.ID.StockChartError,c_oAscError.Level.NoCritical);oApi.WordControl.m_oLogicDocument.Document_UpdateInterfaceState();return false}}return true}function CheckLinePreset(preset){return CheckLinePresetForParagraphAdd(preset)}function CheckLinePresetForParagraphAdd(preset){return preset==="line"||preset==="bentConnector2"||preset==="bentConnector3"|| preset==="bentConnector4"||preset==="bentConnector5"||preset==="curvedConnector2"||preset==="curvedConnector3"||preset==="curvedConnector4"||preset==="curvedConnector5"||preset==="straightConnector1"}function CompareGroups(a,b){if(a.group==null&&b.group==null)return 0;if(a.group==null)return 1;if(b.group==null)return-1;var count1=0;var cur_group=a.group;while(cur_group!=null){++count1;cur_group=cur_group.group}var count2=0;cur_group=b.group;while(cur_group!=null){++count2;cur_group=cur_group.group}return count1- count2}function CheckSpPrXfrm(object,bNoResetAutofit){if(!object.spPr){object.setSpPr(new AscFormat.CSpPr);object.spPr.setParent(object)}if(!object.spPr.xfrm){object.spPr.setXfrm(new AscFormat.CXfrm);object.spPr.xfrm.setParent(object.spPr);if(object.parent&&object.parent.GraphicObj===object){object.spPr.xfrm.setOffX(0);object.spPr.xfrm.setOffY(0)}else{object.spPr.xfrm.setOffX(object.x);object.spPr.xfrm.setOffY(object.y)}object.spPr.xfrm.setExtX(object.extX);object.spPr.xfrm.setExtY(object.extY);if(bNoResetAutofit!== true)CheckShapeBodyAutoFitReset(object)}}function CheckSpPrXfrm2(object){if(!object)return;if(!object.spPr){object.spPr=new AscFormat.CSpPr;object.spPr.parent=object}if(!object.spPr.xfrm){object.spPr.xfrm=new AscFormat.CXfrm;object.spPr.xfrm.parent=object.spPr;object.spPr.xfrm.offX=0;object.spPr.xfrm.offY=0;object.spPr.xfrm.extX=object.extX;object.spPr.xfrm.extY=object.extY}}function CheckSpPrXfrm3(object){if(object.recalcInfo&&object.recalcInfo.recalculateTransform){if(!object.spPr){object.setSpPr(new AscFormat.CSpPr); object.spPr.setParent(object)}if(!object.spPr.xfrm){object.spPr.setXfrm(new AscFormat.CXfrm);object.spPr.xfrm.setParent(object.spPr);if(object.parent&&object.parent.GraphicObj===object){object.spPr.xfrm.setOffX(0);object.spPr.xfrm.setOffY(0)}else{object.spPr.xfrm.setOffX(AscFormat.isRealNumber(object.x)?object.x:0);object.spPr.xfrm.setOffY(AscFormat.isRealNumber(object.y)?object.y:0)}object.spPr.xfrm.setExtX(AscFormat.isRealNumber(object.extX)?object.extX:0);object.spPr.xfrm.setExtY(AscFormat.isRealNumber(object.extY)? object.extY:0)}return}if(!object.spPr){object.setSpPr(new AscFormat.CSpPr);object.spPr.setParent(object)}if(!object.spPr.xfrm){object.spPr.setXfrm(new AscFormat.CXfrm);object.spPr.xfrm.setParent(object.spPr)}var oXfrm=object.spPr.xfrm;var _x=object.x;var _y=object.y;if(object.parent&&object.parent.GraphicObj===object){_x=0;_y=0}if(oXfrm.offX===null||!AscFormat.fApproxEqual(_x,oXfrm.offX,.01))object.spPr.xfrm.setOffX(_x);if(oXfrm.offY===null||!AscFormat.fApproxEqual(_y,oXfrm.offY,.01))object.spPr.xfrm.setOffY(_y); if(oXfrm.extX===null||!AscFormat.fApproxEqual(object.extX,oXfrm.extX,.01))object.spPr.xfrm.setExtX(object.extX);if(oXfrm.extY===null||!AscFormat.fApproxEqual(object.extY,oXfrm.extY,.01))object.spPr.xfrm.setExtY(object.extY)}function getObjectsByTypesFromArr(arr,bGrouped){var ret={shapes:[],images:[],groups:[],charts:[],tables:[],oleObjects:[],slicers:[]};var selected_objects=arr;for(var i=0;i0){if(sPreset==="flowChartOffpageConnector"||sPreset==="flowChartConnector"||sPreset==="flowChartOfflineStorage"||sPreset==="flowChartOnlineStorage")return false;return sPreset.toLowerCase().indexOf("line")>-1||sPreset.toLowerCase().indexOf("connector")>-1}return false}function DrawingObjectsController(drawingObjects){this.drawingObjects=drawingObjects;this.curState=new AscFormat.NullState(this);this.selectedObjects= [];this.drawingDocument=drawingObjects.drawingDocument;this.selection={selectedObjects:[],groupSelection:null,chartSelection:null,textSelection:null};this.arrPreTrackObjects=[];this.arrTrackObjects=[];this.objectsForRecalculate={};this.eventListeners=[];this.chartForProps=null;this.handleEventMode=HANDLE_EVENT_MODE_HANDLE}function CanStartEditText(oController){var oSelector=oController.selection.groupSelection?oController.selection.groupSelection:oController;if(oSelector.selectedObjects.length=== 1&&oSelector.selectedObjects[0].getObjectType()===AscDFH.historyitem_type_Shape&&!AscFormat.CheckLinePresetForParagraphAdd(oSelector.selectedObjects[0].getPresetGeom()))return true;return false}DrawingObjectsController.prototype={checkDrawingHyperlinkAndMacro:function(drawing,e,hit_in_text_rect,x,y,pageIndex){var oApi=this.getEditorApi();if(!oApi)return;var oNvPr;if(this.document||this.drawingObjects&&this.drawingObjects.cSld){if(true){oNvPr=drawing.getCNvProps();if(oNvPr&&oNvPr.hlinkClick&&oNvPr.hlinkClick.id!== null)if(this.handleEventMode===HANDLE_EVENT_MODE_HANDLE){if(e.CtrlKey||this.isSlideShow()){editor.sync_HyperlinkClickCallback(oNvPr.hlinkClick.id);return true}}else{var ret={objectId:drawing.Get_Id(),cursorType:"move",bMarker:false};if(!(this.noNeedUpdateCursorType===true)){var oDD=editor&&editor.WordControl&&editor.WordControl.m_oDrawingDocument;if(oDD){var MMData=new AscCommon.CMouseMoveData;var Coords=oDD.ConvertCoordsToCursorWR(x,y,pageIndex,null);MMData.X_abs=Coords.X;MMData.Y_abs=Coords.Y;MMData.Type= Asc.c_oAscMouseMoveDataTypes.Hyperlink;MMData.Hyperlink=new Asc.CHyperlinkProperty({Text:null,Value:oNvPr.hlinkClick.id,ToolTip:oNvPr.hlinkClick.tooltip,Class:null});if(this.isSlideShow()){ret.cursorType="pointer";MMData.Hyperlink=null;oDD.SetCursorType("pointer",MMData)}else{editor.sync_MouseMoveCallback(MMData);if(hit_in_text_rect){var sCursorType=e.CtrlKey?"pointer":"text";ret.cursorType=sCursorType;oDD.SetCursorType(sCursorType,MMData)}}ret.updated=true}}return ret}}}else if(this.drawingObjects&& this.drawingObjects.getWorksheetModel){oNvPr=drawing.getCNvProps();var bHasLink=oNvPr&&oNvPr.hlinkClick&&oNvPr.hlinkClick.id!==null;if(!drawing.selected&&!e.CtrlKey&&(bHasLink||drawing.hasJSAMacro()))if(this.handleEventMode===HANDLE_EVENT_MODE_HANDLE){if(e.Button===AscCommon.g_mouse_button_right)return false;return true}else if(bHasLink){var _link=oNvPr.hlinkClick.id;var sLink2;if(_link.search("#")===0)sLink2=_link.replace("#","");else sLink2=_link;var oHyperlink=AscFormat.ExecuteNoHistory(function(){return new ParaHyperlink}, this,[]);oHyperlink.Value=sLink2;oHyperlink.Tooltip=oNvPr.hlinkClick.tooltip;if(hit_in_text_rect)return{objectId:drawing.Get_Id(),cursorType:"text",bMarker:false,hyperlink:oHyperlink,macro:null};else return{objectId:drawing.Get_Id(),cursorType:"move",bMarker:false,hyperlink:oHyperlink,macro:null}}else if(drawing.hasJSAMacro())return{objectId:drawing.Get_Id(),cursorType:"pointer",bMarker:false,hyperlink:null,macro:drawing.getJSAMacroId()}}if(this.handleEventMode===HANDLE_EVENT_MODE_HANDLE)return false; else return null},showVideoControl:function(sMediaFile,extX,extY,transform){this.bShowVideoControl=true;var oApi=this.getEditorApi();oApi.showVideoControl(sMediaFile,extX,extY,transform)},getAllSignatures:function(){var _ret=[];this.getAllSignatures2(_ret,this.getDrawingArray());return _ret},getAllSignatures2:function(aRet,spTree){var aSp=[];for(var i=0;i0&&this.arrPreTrackObjects[0].originalObject&&this.arrPreTrackObjects[0].overlayObject){var aAllConnectors=this.getAllConnectors(this.getDrawingArray());var oPreTrack;var stId=null,endId= null,oBeginTrack=null,oEndTrack=null,oBeginShape=null,oEndShape=null;var aConnectionPreTracks=[];for(var i=0;i=bounds_h){srcRect.l=0;srcRect.r=100;srcRect.t=-100*(bounds_h-dTestHeight)/2/dTestHeight;srcRect.b=100-srcRect.t}else{srcRect.t=0;srcRect.b=100;dScale=bounds_h/oSize.Height;var dTestWidth=oSize.Width*dScale;srcRect.l=-100*(bounds_w-dTestWidth)/2/dTestWidth;srcRect.r=100-srcRect.l}cropObject.setSrcRect(srcRect);var oParent=cropObject.parent;if(oParent&& oParent.Check_WrapPolygon)oParent.Check_WrapPolygon();this.selection.cropSelection=cropObject;this.sendCropState();if(this.drawingObjects&&this.drawingObjects.showDrawingObjects)this.drawingObjects.showDrawingObjects();this.updateOverlay()}},[],false)},setCropAspect:function(dAspect){var cropObject=this.getObjectForCrop();if(!cropObject)return;this.checkSelectedObjectsAndCallback(function(){cropObject.checkSrcRect();if(cropObject.createCropObject()){this.selection.cropSelection=cropObject;this.sendCropState(); var newW,newH;if(dAspect*cropObject.extX<=cropObject.extY){newW=cropObject.extX;newH=cropObject.extY*dAspect}else{newW=cropObject.extX/dAspect;newH=cropObject.extY}if(this.drawingObjects&&this.drawingObjects.showDrawingObjects)this.drawingObjects.showDrawingObjects();this.updateOverlay()}},[],false)},canReceiveKeyPress:function(){return this.curState instanceof AscFormat.NullState},handleAdjustmentHit:function(hit,selectedObject,group,pageIndex,bWord){if(this.handleEventMode===HANDLE_EVENT_MODE_HANDLE){this.arrPreTrackObjects.length= 0;if(hit.adjPolarFlag===false)this.arrPreTrackObjects.push(new AscFormat.XYAdjustmentTrack(selectedObject,hit.adjNum,hit.warp));else this.arrPreTrackObjects.push(new AscFormat.PolarAdjustmentTrack(selectedObject,hit.adjNum,hit.warp));if(!isRealObject(group)){this.resetInternalSelection();this.changeCurrentState(new AscFormat.PreChangeAdjState(this,selectedObject))}else{group.resetInternalSelection();this.changeCurrentState(new AscFormat.PreChangeAdjInGroupState(this,group))}return true}else if(!isRealObject(group))return{objectId:selectedObject.Get_Id(), cursorType:"crosshair",bMarker:true};else return{objectId:selectedObject.Get_Id(),cursorType:"crosshair",bMarker:true}},handleSlideComments:function(e,x,y,pageIndex){if(this.handleEventMode===HANDLE_EVENT_MODE_HANDLE)return{result:null,selectedIndex:-1};else return{result:false,selectedIndex:-1}},handleSignatureDblClick:function(sGuid,width,height){var oApi=editor||Asc["editor"];if(oApi)oApi.sendEvent("asc_onSignatureDblClick",sGuid,width,height)},checkChartForProps:function(bStart){if(bStart){if(this.selectedObjects.length=== 0){this.chartForProps=null;return}this.chartForProps=this.getSelectionState();this.resetSelection();this.drawingObjects.getWorksheet().endEditChart();var oldIsStartAdd=window["Asc"]["editor"].isStartAddShape;window["Asc"]["editor"].isStartAddShape=true;this.updateOverlay();window["Asc"]["editor"].isStartAddShape=oldIsStartAdd}else{if(this.chartForProps===null)return;this.setSelectionState(this.chartForProps,this.chartForProps.length-1);this.updateOverlay();this.drawingObjects.getWorksheet().setSelectionShape(true); this.chartForProps=null}},resetInternalSelection:function(noResetContentSelect,bDoNotRedraw){var oApi=this.getEditorApi&&this.getEditorApi();if(oApi&&oApi.hideVideoControl)oApi.hideVideoControl();if(this.selection.groupSelection){this.selection.groupSelection.resetSelection(this);this.selection.groupSelection=null}if(this.selection.textSelection){if(!(noResetContentSelect===true))if(this.selection.textSelection.getObjectType()===AscDFH.historyitem_type_GraphicFrame){if(this.selection.textSelection.graphicObject)this.selection.textSelection.graphicObject.RemoveSelection()}else{var content= this.selection.textSelection.getDocContent();content&&content.RemoveSelection()}this.selection.textSelection=null}if(this.selection.chartSelection){this.selection.chartSelection.resetSelection(noResetContentSelect);this.selection.chartSelection=null}if(this.selection.wrapPolygonSelection)this.selection.wrapPolygonSelection=null;if(this.selection.cropSelection)this.endImageCrop&&this.endImageCrop(bDoNotRedraw)},resetChartElementsSelection:function(){var oTargetDocContent=this.getTargetDocContent(false, false);if(!oTargetDocContent){var oSelector=this.selection.groupSelection?this.selection.groupSelection:this;if(oSelector.selection.chartSelection){oSelector.selection.chartSelection.resetSelection(false);oSelector.selection.chartSelection=null}}},handleHandleHit:function(hit,selectedObject,group,pageIndex,bWord){if(this.handleEventMode===HANDLE_EVENT_MODE_HANDLE){var selected_objects=group?group.selectedObjects:this.selectedObjects;this.arrPreTrackObjects.length=0;if(hit===8){if(selectedObject.canRotate()){for(var i= 0;i1&&!e.ShiftKey&&!e.CtrlKey&&(this.selection.groupSelection&& this.selection.groupSelection.selectedObjects.length===1||this.selectedObjects.length===1)){var drawing=this.selectedObjects[0].parent;if(object.getObjectType()===AscDFH.historyitem_type_ChartSpace&&this.handleChartDoubleClick){this.handleChartDoubleClick(drawing,object,e,x,y,pageIndex);return true}if(object.getObjectType()===AscDFH.historyitem_type_Shape)if(null!==object.signatureLine){if(this.handleSignatureDblClick){this.handleSignatureDblClick(object.signatureLine.id,object.extX,object.extY); return true}}else if(this.handleDblClickEmptyShape)if(!object.getDocContent()){this.handleDblClickEmptyShape(object);if(object.getDocContent())return true}if(object.getObjectType()===AscDFH.historyitem_type_OleObject&&this.handleOleObjectDoubleClick){this.handleOleObjectDoubleClick(drawing,object,e,x,y,pageIndex);return true}else if(2==e.ClickCount&&drawing instanceof AscCommonWord.ParaDrawing&&drawing.IsMathEquation()){this.handleMathDrawingDoubleClick(drawing,e,x,y,pageIndex);return true}}if(object.canMove()){this.checkSelectedObjectsForMove(group, pageIndex);if(!isRealObject(group)){if(!object.isCrop&&!object.cropObject)this.resetInternalSelection();this.updateOverlay();if(!b_is_inline)this.changeCurrentState(new AscFormat.PreMoveState(this,x,y,e.ShiftKey,e.CtrlKey,object,is_selected,!bInSelect));else this.changeCurrentState(new AscFormat.PreMoveInlineObject(this,object,is_selected,!bInSelect,pageIndex,x,y))}else{group.resetInternalSelection();this.updateOverlay();this.changeCurrentState(new AscFormat.PreMoveInGroupState(this,group,x,y,e.ShiftKey, e.CtrlKey,object,is_selected))}}return true}else{var sId=object.Get_Id();if(object.isCrop&&object.parentCrop)sId=object.parentCrop.Get_Id();var sCursorType="move";if(this.isSlideShow()){var sMediaName=object.getMediaFileName();if(sMediaName)sCursorType="pointer"}return{objectId:sId,cursorType:sCursorType,bMarker:bInSelect}}},handleChartTitleMoveHit:function(title,e,x,y,drawing,group,pageIndex){var selector=group?group:this;if(this.handleEventMode===HANDLE_EVENT_MODE_HANDLE){this.checkChartTextSelection(); selector.resetSelection();selector.selectObject(drawing,pageIndex);selector.selection.chartSelection=drawing;if(title.select)drawing.selectTitle(title,pageIndex);this.arrPreTrackObjects.length=0;this.arrPreTrackObjects.push(new AscFormat.MoveChartObjectTrack(title,drawing));this.changeCurrentState(new AscFormat.PreMoveState(this,x,y,false,false,drawing,true,true));this.updateSelectionState();this.updateOverlay();if(Asc["editor"]&&Asc["editor"].wb){var ws=Asc["editor"].wb.getWorksheet();if(ws){var ct= ws.getCursorTypeFromXY(ws.objectRender.lastX,ws.objectRender.lastY);if(ct)Asc["editor"].wb._onUpdateCursor(ct.cursor)}}return true}else return{objectId:drawing.Get_Id(),cursorType:"move",bMarker:false}},recalculateCurPos:function(bUpdateX,bUpdateY){var oTargetDocContent=this.getTargetDocContent(undefined,true);if(oTargetDocContent)return oTargetDocContent.RecalculateCurPos(bUpdateX,bUpdateY);return{X:0,Y:0,Height:0,PageNum:0,Internal:{Line:0,Page:0,Range:0},Transform:null}},startEditCurrentOleObject:function(){var oSelector= this.selection.groupSelection?this.selection.groupSelection:this;var oThis=this;if(oSelector.selectedObjects.length===1&&oSelector.selectedObjects[0].getObjectType()===AscDFH.historyitem_type_OleObject){var oleObject=oSelector.selectedObjects[0];this.checkSelectedObjectsAndFireCallback(function(){var pluginData=new Asc.CPluginData;pluginData.setAttribute("data",oleObject.m_sData);pluginData.setAttribute("guid",oleObject.m_sApplicationId);pluginData.setAttribute("width",oleObject.extX);pluginData.setAttribute("height", oleObject.extY);pluginData.setAttribute("widthPix",oleObject.m_nPixWidth);pluginData.setAttribute("heightPix",oleObject.m_nPixHeight);pluginData.setAttribute("objectId",oleObject.Id);if(window["Asc"]["editor"])window["Asc"]["editor"].asc_pluginRun(oleObject.m_sApplicationId,0,pluginData);else if(editor)editor.asc_pluginRun(oleObject.m_sApplicationId,0,pluginData)},[])}},checkSelectedObjectsForMove:function(group,pageIndex){var selected_object=group?group.selectedObjects:this.selectedObjects;var b_check_page= AscFormat.isRealNumber(pageIndex);for(var i=0;i-1;--i)if(aDrawings[i].selected&&pageIndex===aDrawings[i].selectStartPage){dX=aDrawings[i].transform.TransformPointX(aDrawings[i].extX/2,aDrawings[i].extY/2)-aDrawings[i].extX/2;dY=aDrawings[i].transform.TransformPointY(aDrawings[i].extX/2,aDrawings[i].extY/2)-aDrawings[i].extY/2;return{X:dX,Y:dY,bSelected:true,PageIndex:pageIndex}}return{X:0,Y:0,bSelected:false,PageIndex:pageIndex}},getLeftTopSelectedObject:function(pageIndex){return this.getLeftTopSelectedFromArray(this.getDrawingObjects(), pageIndex)},createWatermarkImage:function(sImageUrl){return AscFormat.ExecuteNoHistory(function(){return this.createImage(sImageUrl,0,0,110,61.875)},this,[])},IsSelectionUse:function(){var content=this.getTargetDocContent();if(content)return content.IsTextSelectionUse();else return this.selectedObjects.length>0},getFromTargetTextObjectContextMenuPosition:function(oTargetTextObject,pageIndex){var oTransformText=oTargetTextObject.transformText;var oTargetObjectOrTable=this.getTargetDocContent(false, true);if(oTargetTextObject&&oTargetObjectOrTable&&oTargetObjectOrTable.GetCursorPosXY&&oTransformText){var oPos=oTargetObjectOrTable.GetCursorPosXY();return{X:oTransformText.TransformPointX(oPos.X,oPos.Y),Y:oTransformText.TransformPointY(oPos.X,oPos.Y),PageIndex:pageIndex}}return{X:0,Y:0,PageIndex:pageIndex}},isPointInDrawingObjects3:function(x,y,nPageIndex,bSelected,bText){var oOldState=this.curState;this.changeCurrentState(new AscFormat.NullState(this));var oResult,bRet=false;this.handleEventMode= HANDLE_EVENT_MODE_CURSOR;oResult=this.curState.onMouseDown(AscCommon.global_mouseEvent,x,y,0);this.handleEventMode=HANDLE_EVENT_MODE_HANDLE;if(AscCommon.isRealObject(oResult))if(oResult.cursorType!=="text"){var object=g_oTableId.Get_ById(oResult.objectId);if(AscCommon.isRealObject(object)&&(bSelected&&object.selected||!bSelected))bRet=true;else return false}else if(bText)return true;this.changeCurrentState(oOldState);return bRet},isPointInDrawingObjects4:function(x,y,pageIndex){var oOldState=this.curState; this.changeCurrentState(new AscFormat.NullState(this));var oResult,nRet=0;this.handleEventMode=HANDLE_EVENT_MODE_CURSOR;oResult=this.curState.onMouseDown(AscCommon.global_mouseEvent,x,y,0);this.handleEventMode=HANDLE_EVENT_MODE_HANDLE;var object;if(AscCommon.isRealObject(oResult))if(oResult.cursorType==="text")nRet=0;else if(oResult.cursorType==="move"){object=g_oTableId.Get_ById(oResult.objectId);if(object&&object.hitInBoundingRect&&object.hitInBoundingRect(x,y))nRet=3;else nRet=2}else nRet=3;this.changeCurrentState(oOldState); return nRet},GetSelectionBounds:function(){var oTargetDocContent=this.getTargetDocContent(false,true);if(isRealObject(oTargetDocContent))return oTargetDocContent.GetSelectionBounds();return null},CreateDocContent:function(){var oController=this;if(this.selection.groupSelection)oController=this.selection.groupSelection;if(oController.selection.textSelection)return;if(oController.selection.chartSelection)if(oController.selection.chartSelection.selection.textSelection){oController.selection.chartSelection.selection.textSelection.checkDocContent&& oController.selection.chartSelection.selection.textSelection.checkDocContent();return}if(oController.selectedObjects.length===1)if(oController.selectedObjects[0].getObjectType()===AscDFH.historyitem_type_Shape){var oShape=oController.selectedObjects[0];if(!AscFormat.CheckLinePresetForParagraphAdd(oShape.getPresetGeom())){if(oShape.bWordShape){if(!oShape.textBoxContent)oShape.createTextBoxContent()}else if(!oShape.txBody)oShape.createTextBody();oController.selection.textSelection=oShape}}else if(oController.selection.chartSelection&& oController.selection.chartSelection.selection.title){oController.selection.chartSelection.selection.textSelection=oController.selection.chartSelection.selection.title;oController.selection.chartSelection.selection.textSelection.checkDocContent&&oController.selection.chartSelection.selection.textSelection.checkDocContent()}},getContextMenuPosition:function(pageIndex){var i,aDrawings,dX,dY,oTargetTextObject;if(this.selectedObjects.length>0){oTargetTextObject=getTargetTextObject(this);if(oTargetTextObject)return this.getFromTargetTextObjectContextMenuPosition(oTargetTextObject, pageIndex);else if(this.selection.groupSelection){aDrawings=this.selection.groupSelection.arrGraphicObjects;for(i=aDrawings.length-1;i>-1;--i)if(aDrawings[i].selected){dX=aDrawings[i].transform.TransformPointX(aDrawings[i].extX/2,aDrawings[i].extY/2)-aDrawings[i].extX/2;dY=aDrawings[i].transform.TransformPointY(aDrawings[i].extX/2,aDrawings[i].extY/2)-aDrawings[i].extY/2;return{X:dX,Y:dY,PageIndex:this.selection.groupSelection.selectStartPage}}}else return this.getLeftTopSelectedObject(pageIndex)}return{X:0, Y:0,PageIndex:pageIndex}},drawSelect:function(pageIndex,drawingDocument){if(undefined!==drawingDocument.BeginDrawTracking)drawingDocument.BeginDrawTracking();var oApi=Asc.editor||editor;var isDrawHandles=oApi?oApi.isShowShapeAdjustments():true;if(this.selectedObjects.length===1&&this.selectedObjects[0].isForm()&&this.selectedObjects[0].getInnerForm()&&this.selectedObjects[0].getInnerForm().IsFormLocked())isDrawHandles=false;var i;if(this.selection.textSelection){if(this.selection.textSelection.selectStartPage=== pageIndex)if(!this.selection.textSelection.isForm()){drawingDocument.DrawTrack(AscFormat.TYPE_TRACK.TEXT,this.selection.textSelection.getTransformMatrix(),0,0,this.selection.textSelection.extX,this.selection.textSelection.extY,AscFormat.CheckObjectLine(this.selection.textSelection),this.selection.textSelection.canRotate(),undefined,isDrawHandles);if(this.selection.textSelection.drawAdjustments)this.selection.textSelection.drawAdjustments(drawingDocument)}}else if(this.selection.cropSelection){if(this.arrTrackObjects.length=== 0)if(this.selection.cropSelection.selectStartPage===pageIndex){var oCropSelection=this.selection.cropSelection;var cropObject=oCropSelection.getCropObject();if(cropObject){var oldGlobalAlpha;if(drawingDocument.AutoShapesTrack.Graphics){oldGlobalAlpha=drawingDocument.AutoShapesTrack.Graphics.globalAlpha;drawingDocument.AutoShapesTrack.Graphics.put_GlobalAlpha(false,1)}drawingDocument.AutoShapesTrack.SetCurrentPage(cropObject.selectStartPage,true);cropObject.draw(drawingDocument.AutoShapesTrack);drawingDocument.AutoShapesTrack.CorrectOverlayBounds(); drawingDocument.AutoShapesTrack.SetCurrentPage(cropObject.selectStartPage,true);oCropSelection.draw(drawingDocument.AutoShapesTrack);drawingDocument.AutoShapesTrack.CorrectOverlayBounds();if(drawingDocument.AutoShapesTrack.Graphics)drawingDocument.AutoShapesTrack.Graphics.put_GlobalAlpha(true,oldGlobalAlpha);drawingDocument.DrawTrack(AscFormat.TYPE_TRACK.SHAPE,cropObject.getTransformMatrix(),0,0,cropObject.extX,cropObject.extY,false,false,undefined,isDrawHandles);drawingDocument.DrawTrack(AscFormat.TYPE_TRACK.CROP, oCropSelection.getTransformMatrix(),0,0,oCropSelection.extX,oCropSelection.extY,false,false,undefined,isDrawHandles)}}}else if(this.selection.groupSelection){if(this.selection.groupSelection.selectStartPage===pageIndex){drawingDocument.DrawTrack(AscFormat.TYPE_TRACK.GROUP_PASSIVE,this.selection.groupSelection.getTransformMatrix(),0,0,this.selection.groupSelection.extX,this.selection.groupSelection.extY,false,this.selection.groupSelection.canRotate(),undefined,isDrawHandles);if(this.selection.groupSelection.selection.textSelection)for(i= 0;i>0;var h_px=h_mm*dKoef+.5>>0;_bounds_cheker.init(w_px,h_px,w_mm,h_mm);_bounds_cheker.transform(1,0,0,1,0,0); _bounds_cheker.AutoCheckLineWidth=true;for(var i=0;i0&&_need_pix_height>0){var _canvas=document.createElement("canvas");_canvas.width=_need_pix_width;_canvas.height=_need_pix_height;var _ctx=_canvas.getContext("2d");var sImageUrl;if(!window["NATIVE_EDITOR_ENJINE"]){var g= new AscCommon.CGraphics;g.init(_ctx,w_px,h_px,w_mm,h_mm);g.m_oFontManager=AscCommon.g_fontManager;g.m_oCoordTransform.tx=-_bounds_cheker.Bounds.min_x;g.m_oCoordTransform.ty=-_bounds_cheker.Bounds.min_y;g.transform(1,0,0,1,0,0);AscCommon.IsShapeToImageConverter=true;for(i=0;i0&&this.selectedObjects[0].parent&&this.selectedObjects[0].parent.GoTo_Text){this.selectedObjects[0].parent.GoTo_Text();this.resetSelection();if(this.document&&(docpostype_DrawingObjects!==this.document.GetDocPosType()||isRealObject(getTargetTextObject(this)))&&CDocumentContent.prototype.AddNewParagraph===docContentFunction)this.document.AddNewParagraph(args[0])}},paragraphAdd:function(paraItem,bRecalculate){this.applyTextFunction(CDocumentContent.prototype.AddToParagraph, CTable.prototype.AddToParagraph,[paraItem,bRecalculate])},startTrackText:function(X,Y,oObject){if(this.drawingObjects.cSld){this.changeCurrentState(new AscFormat.TrackTextState(this,oObject,X,Y));return true}return false},setMathProps:function(oMathProps){var oContent=this.getTargetDocContent(false);if(oContent)this.checkSelectedObjectsAndCallback(function(){var oContent2=this.getTargetDocContent(true);if(oContent2){var SelectedInfo=new CSelectedElementsInfo;oContent2.GetSelectedElementsInfo(SelectedInfo); if(null!==SelectedInfo.GetMath()){var ParaMath=SelectedInfo.GetMath();ParaMath.Set_MenuProps(oMathProps)}}},[],false,AscDFH.historydescription_Spreadsheet_SetCellFontName)},paragraphIncDecFontSize:function(bIncrease){this.applyDocContentFunction(CDocumentContent.prototype.IncreaseDecreaseFontSize,[bIncrease],CTable.prototype.IncreaseDecreaseFontSize)},paragraphIncDecIndent:function(bIncrease){this.applyDocContentFunction(CDocumentContent.prototype.IncreaseDecreaseIndent,[bIncrease],CTable.prototype.IncreaseDecreaseIndent)}, setDefaultTabSize:function(TabSize){this.applyDocContentFunction(CDocumentContent.prototype.SetParagraphDefaultTabSize,[TabSize],CTable.prototype.SetParagraphDefaultTabSize)},setParagraphAlign:function(align){if(!this.document){var oContent=this.getTargetDocContent(true,false);if(oContent){var oInfo=new CSelectedElementsInfo;oContent.GetSelectedElementsInfo(oInfo);var Math=oInfo.GetMath();if(null!==Math&&true!==Math.Is_Inline()){Math.Set_Align(align);return}}}this.applyDocContentFunction(CDocumentContent.prototype.SetParagraphAlign, [align],CTable.prototype.SetParagraphAlign)},setParagraphIndent:function(indent){var content=this.getTargetDocContent(true);if(content)content.SetParagraphIndent(indent);else if(this.document)if(this.selectedObjects.length>0){var parent_paragraph=this.selectedObjects[0].parent.Get_ParentParagraph();if(parent_paragraph){parent_paragraph.Set_Ind(indent,true);this.document.Recalculate()}}},setCellFontName:function(fontName){var oThis=this;var callBack=function(){oThis.paragraphAdd(new ParaTextPr({FontFamily:{Name:fontName, Index:-1}}))};this.checkSelectedObjectsAndCallback(callBack,[],false,AscDFH.historydescription_Spreadsheet_SetCellFontName)},setCellFontSize:function(fontSize){var oThis=this;var callBack=function(){oThis.paragraphAdd(new ParaTextPr({FontSize:fontSize}))};this.checkSelectedObjectsAndCallback(callBack,[],false,AscDFH.historydescription_Spreadsheet_SetCellFontSize)},setCellBold:function(isBold){var oThis=this;var callBack=function(){oThis.paragraphAdd(new ParaTextPr({Bold:isBold}))};this.checkSelectedObjectsAndCallback(callBack, [],false,AscDFH.historydescription_Spreadsheet_SetCellBold)},setCellItalic:function(isItalic){var oThis=this;var callBack=function(){oThis.paragraphAdd(new ParaTextPr({Italic:isItalic}))};this.checkSelectedObjectsAndCallback(callBack,[],false,AscDFH.historydescription_Spreadsheet_SetCellItalic)},setCellUnderline:function(isUnderline){var oThis=this;var callBack=function(){oThis.paragraphAdd(new ParaTextPr({Underline:isUnderline}))};this.checkSelectedObjectsAndCallback(callBack,[],false,AscDFH.historydescription_Spreadsheet_SetCellUnderline)}, setCellStrikeout:function(isStrikeout){var oThis=this;var callBack=function(){oThis.paragraphAdd(new ParaTextPr({Strikeout:isStrikeout}))};this.checkSelectedObjectsAndCallback(callBack,[],false,AscDFH.historydescription_Spreadsheet_SetCellStrikeout)},setCellSubscript:function(isSubscript){var oThis=this;var callBack=function(){oThis.paragraphAdd(new ParaTextPr({VertAlign:isSubscript?AscCommon.vertalign_SubScript:AscCommon.vertalign_Baseline}))};this.checkSelectedObjectsAndCallback(callBack,[],false, AscDFH.historydescription_Spreadsheet_SetCellSubscript)},setCellSuperscript:function(isSuperscript){var oThis=this;var callBack=function(){oThis.paragraphAdd(new ParaTextPr({VertAlign:isSuperscript?AscCommon.vertalign_SuperScript:AscCommon.vertalign_Baseline}))};this.checkSelectedObjectsAndCallback(callBack,[],false,AscDFH.historydescription_Spreadsheet_SetCellSuperscript)},setCellAlign:function(align){this.checkSelectedObjectsAndCallback(this.setParagraphAlign,[align],false,AscDFH.historydescription_Spreadsheet_SetCellAlign)}, setCellVertAlign:function(align){var vert_align;switch(align){case Asc.c_oAscVAlign.Bottom:{vert_align=0;break}case Asc.c_oAscVAlign.Center:{vert_align=1;break}case Asc.c_oAscVAlign.Dist:{vert_align=1;break}case Asc.c_oAscVAlign.Just:{vert_align=1;break}case Asc.c_oAscVAlign.Top:{vert_align=4}}this.checkSelectedObjectsAndCallback(this.applyDrawingProps,[{verticalTextAlign:vert_align}],false,AscDFH.historydescription_Spreadsheet_SetCellVertAlign)},setCellTextWrap:function(isWrapped){},setCellTextShrink:function(isShrinked){}, setCellTextColor:function(color){var oThis=this;var callBack=function(){var unifill=new AscFormat.CUniFill;unifill.setFill(new AscFormat.CSolidFill);unifill.fill.setColor(AscFormat.CorrectUniColor(color,null));oThis.paragraphAdd(new ParaTextPr({Unifill:unifill}))};this.checkSelectedObjectsAndCallback(callBack,[],false,AscDFH.historydescription_Spreadsheet_SetCellTextColor)},setCellBackgroundColor:function(color){var fill=new Asc.asc_CShapeFill;if(color){fill.type=c_oAscFill.FILL_TYPE_SOLID;fill.fill= new Asc.asc_CFillSolid;fill.fill.color=color}else fill.type=c_oAscFill.FILL_TYPE_NOFILL;this.checkSelectedObjectsAndCallback(this.applyDrawingProps,[{fill:fill}],false,AscDFH.historydescription_Spreadsheet_SetCellBackgroundColor)},setCellAngle:function(angle){if(0===angle)angle=AscFormat.nVertTThorz;else if(-90===angle)angle=AscFormat.nVertTTvert;else if(90===angle)angle=AscFormat.nVertTTvert270;else return;this.checkSelectedObjectsAndCallback(this.applyDrawingProps,[{vert:angle}],false,AscDFH.historydescription_Spreadsheet_SetCellVertAlign)}, setCellStyle:function(name){},increaseFontSize:function(){this.checkSelectedObjectsAndCallback(this.paragraphIncDecFontSize,[true],false,AscDFH.historydescription_Spreadsheet_SetCellIncreaseFontSize)},decreaseFontSize:function(){this.checkSelectedObjectsAndCallback(this.paragraphIncDecFontSize,[false],false,AscDFH.historydescription_Spreadsheet_SetCellDecreaseFontSize)},deleteSelectedObjects:function(){if(Asc["editor"]&&Asc["editor"].isChartEditor&&!this.selection.chartSelection)return;var oThis= this;this.checkSelectedObjectsAndCallback(function(){var oSelection=oThis.selection.groupSelection?oThis.selection.groupSelection.selection:oThis.selection;if(oSelection.chartSelection){oSelection.chartSelection.resetSelection(true);oSelection.chartSelection=null}if(oSelection.textSelection)oSelection.textSelection=null;oThis.removeCallback(-1,undefined,undefined,undefined,undefined,undefined);oThis.updateSelectionState()},[],false,AscDFH.historydescription_Spreadsheet_Remove)},hyperlinkCheck:function(bCheckEnd){var content= this.getTargetDocContent();if(content)return content.IsCursorInHyperlink(bCheckEnd);return null},hyperlinkCanAdd:function(bCheckInHyperlink){var content=this.getTargetDocContent();if(content){if(this.document&&content.Parent&&content.Parent instanceof AscFormat.CTextBody)return false;return content.CanAddHyperlink(bCheckInHyperlink)}return false},hyperlinkRemove:function(){var content=this.getTargetDocContent(true);if(content){var Ret=content.RemoveHyperlink();var target_text_object=getTargetTextObject(this); if(target_text_object)target_text_object.checkExtentsByDocContent&&target_text_object.checkExtentsByDocContent();return Ret}return undefined},hyperlinkModify:function(HyperProps){var content=this.getTargetDocContent(true);if(content){var Ret=content.ModifyHyperlink(HyperProps);var target_text_object=getTargetTextObject(this);if(target_text_object)target_text_object.checkExtentsByDocContent&&target_text_object.checkExtentsByDocContent();return Ret}return undefined},hyperlinkAdd:function(HyperProps){var content= this.getTargetDocContent(true),bCheckExtents=false;if(content){if(!this.document)if(null!=HyperProps.Text&&""!=HyperProps.Text&&true===content.IsSelectionUse()){this.removeCallback(-1,undefined,undefined,undefined,undefined,true);bCheckExtents=true}var Ret=content.AddHyperlink(HyperProps);if(bCheckExtents){var target_text_object=getTargetTextObject(this);if(target_text_object)target_text_object.checkExtentsByDocContent&&target_text_object.checkExtentsByDocContent()}return Ret}return null},insertHyperlink:function(options){if(!this.getHyperlinkInfo())this.checkSelectedObjectsAndCallback(this.hyperlinkAdd, [{Text:options.text,Value:options.hyperlinkModel.Hyperlink,ToolTip:options.hyperlinkModel.Tooltip}],false,AscDFH.historydescription_Spreadsheet_SetCellHyperlinkAdd);else this.checkSelectedObjectsAndCallback(this.hyperlinkModify,[{Text:options.text,Value:options.hyperlinkModel.Hyperlink,ToolTip:options.hyperlinkModel.Tooltip}],false,AscDFH.historydescription_Spreadsheet_SetCellHyperlinkModify)},removeHyperlink:function(){this.checkSelectedObjectsAndCallback(this.hyperlinkRemove,[],false,AscDFH.historydescription_Spreadsheet_SetCellHyperlinkRemove)}, canAddHyperlink:function(){return this.hyperlinkCanAdd()},getParagraphParaPr:function(){var target_text_object=getTargetTextObject(this);if(target_text_object)if(target_text_object.getObjectType()===AscDFH.historyitem_type_GraphicFrame)return target_text_object.graphicObject.GetCalculatedParaPr();else{var content=this.getTargetDocContent();if(content)return content.GetCalculatedParaPr()}else{var result,cur_pr,selected_objects,i;var getPropsFromArr=function(arr){var cur_pr,result_pr,content;for(var i= 0;i0){var oImg;for(i=0;i0){ret.putRange(range_obj.range);ret.putInColumns(!range_obj.bVert)}ret.putStyle(chart_space.getChartStyleIdx());ret.putTitle(isRealObject(chart.title)?chart.title.overlay?c_oAscChartTitleShowSettings.overlay: c_oAscChartTitleShowSettings.noOverlay:c_oAscChartTitleShowSettings.none);var oOrderedAxes=chart_space.getOrderedAxes();var aAx=oOrderedAxes.getHorizontalAxes();var nAx;for(nAx=0;nAx0){var asc_chart_binary=new Asc.asc_CChartBinary;asc_chart_binary.asc_setBinary(chart["binary"]);ret=asc_chart_binary.getChartSpace(editor.WordControl.m_oLogicDocument);if(ret.spPr&&ret.spPr.xfrm){ret.spPr.xfrm.setOffX(0);ret.spPr.xfrm.setOffY(0)}ret.setBDeleted(false)}else if(Array.isArray(chart)){ret=DrawingObjectsController.prototype._getChartSpace.call(this,chart,options,true);ret.setBDeleted(false);ret.setStyle(2);ret.setSpPr(new AscFormat.CSpPr);ret.spPr.setParent(ret); ret.spPr.setXfrm(new AscFormat.CXfrm);ret.spPr.xfrm.setParent(ret.spPr);ret.spPr.xfrm.setOffX(0);ret.spPr.xfrm.setOffY(0);ret.spPr.xfrm.setExtX(152);ret.spPr.xfrm.setExtY(89)}return ret},getSeriesDefault:function(type){var series=[],seria,Cat;var createItem=function(value){return{numFormatStr:"General",isDateTimeFormat:false,val:value,isHidden:false}};var createItem2=function(value,formatCode){return{numFormatStr:formatCode,isDateTimeFormat:false,val:value,isHidden:false}};if(type!==c_oAscChartTypeSettings.stock){var bIsScatter= c_oAscChartTypeSettings.scatter<=type&&type<=c_oAscChartTypeSettings.scatterSmoothMarker;Cat={Formula:"Sheet1!$A$2:$A$7",NumCache:[createItem("USA"),createItem("CHN"),createItem("RUS"),createItem("GBR"),createItem("GER"),createItem("JPN")]};seria=new AscFormat.asc_CChartSeria;seria.Val.Formula="Sheet1!$B$2:$B$7";seria.Val.NumCache=[createItem(46),createItem(38),createItem(24),createItem(29),createItem(11),createItem(7)];seria.TxCache.Formula="Sheet1!$B$1";seria.TxCache.NumCache=[createItem("Gold")]; seria.Cat=Cat;seria.xVal=Cat;series.push(seria);seria=new AscFormat.asc_CChartSeria;seria.Val.Formula="Sheet1!$C$2:$C$7";seria.Val.NumCache=[createItem(29),createItem(27),createItem(26),createItem(17),createItem(19),createItem(14)];seria.TxCache.Formula="Sheet1!$C$1";seria.TxCache.NumCache=[createItem("Silver")];seria.Cat=Cat;seria.xVal=Cat;series.push(seria);seria=new AscFormat.asc_CChartSeria;seria.Val.Formula="Sheet1!$D$2:$D$7";seria.Val.NumCache=[createItem(29),createItem(23),createItem(32),createItem(19), createItem(14),createItem(17)];seria.TxCache.Formula="Sheet1!$D$1";seria.TxCache.NumCache=[createItem("Bronze")];seria.Cat=Cat;seria.xVal=Cat;series.push(seria);return series}else{Cat={Formula:"Sheet1!$A$2:$A$6",NumCache:[createItem2(38719,"d-mmm-yy"),createItem2(38720,"d-mmm-yy"),createItem2(38721,"d-mmm-yy"),createItem2(38722,"d-mmm-yy"),createItem2(38723,"d-mmm-yy")],formatCode:"d-mmm-yy"};seria=new AscFormat.asc_CChartSeria;seria.Val.Formula="Sheet1!$B$2:$B$6";seria.Val.NumCache=[createItem(40), createItem(21),createItem(37),createItem(49),createItem(32)];seria.TxCache.Formula="Sheet1!$B$1";seria.TxCache.NumCache=[createItem("Open")];seria.Cat=Cat;seria.xVal=Cat;series.push(seria);seria=new AscFormat.asc_CChartSeria;seria.Val.Formula="Sheet1!$C$2:$C$6";seria.Val.NumCache=[createItem(57),createItem(54),createItem(52),createItem(59),createItem(34)];seria.TxCache.Formula="Sheet1!$C$1";seria.TxCache.NumCache=[createItem("High")];seria.Cat=Cat;seria.xVal=Cat;series.push(seria);seria=new AscFormat.asc_CChartSeria; seria.Val.Formula="Sheet1!$D$2:$D$6";seria.Val.NumCache=[createItem(10),createItem(14),createItem(14),createItem(12),createItem(6)];seria.TxCache.Formula="Sheet1!$D$1";seria.TxCache.NumCache=[createItem("Low")];seria.Cat=Cat;seria.xVal=Cat;series.push(seria);seria=new AscFormat.asc_CChartSeria;seria.Val.Formula="Sheet1!$E$2:$E$6";seria.Val.NumCache=[createItem(24),createItem(35),createItem(48),createItem(35),createItem(15)];seria.TxCache.Formula="Sheet1!$E$1";seria.TxCache.NumCache=[createItem("Close")]; seria.Cat=Cat;seria.xVal=Cat;series.push(seria);return series}},changeCurrentState:function(newState){this.curState=newState},updateSelectionState:function(bNoCheck){var text_object,drawingDocument=this.drawingObjects.getDrawingDocument();if(this.selection.textSelection)text_object=this.selection.textSelection;else if(this.selection.groupSelection)if(this.selection.groupSelection.selection.textSelection)text_object=this.selection.groupSelection.selection.textSelection;else{if(this.selection.groupSelection.selection.chartSelection&& this.selection.groupSelection.selection.chartSelection.selection.textSelection)text_object=this.selection.groupSelection.selection.chartSelection.selection.textSelection}else if(this.selection.chartSelection&&this.selection.chartSelection.selection.textSelection)text_object=this.selection.chartSelection.selection.textSelection;if(isRealObject(text_object))text_object.updateSelectionState(drawingDocument);else if(bNoCheck!==true){drawingDocument.UpdateTargetTransform(null);drawingDocument.TargetEnd(); drawingDocument.SelectEnabled(false);drawingDocument.SelectShow()}var oContent=this.getTargetDocContent();if(oContent){var oSelectedInfo=new CSelectedElementsInfo;oSelectedInfo=oContent.GetSelectedElementsInfo(oSelectedInfo);var Math=oSelectedInfo.GetMath();var bSelection=oContent.IsSelectionUse();var bEmptySelection=bSelection&&oContent.IsSelectionEmpty();if(null!==Math)drawingDocument.Update_MathTrack(true,!bSelection||bEmptySelection,Math);else drawingDocument.Update_MathTrack(false)}else drawingDocument.Update_MathTrack(false)}, remove:function(dir,bOnlyText,bRemoveOnlySelection,bOnTextAdd,isWord){if(Asc["editor"]&&Asc["editor"].isChartEditor&&!this.selection.chartSelection)return;this.checkSelectedObjectsAndCallback(this.removeCallback,[dir,bOnlyText,bRemoveOnlySelection,bOnTextAdd,isWord,undefined],false,AscDFH.historydescription_Spreadsheet_Remove)},removeCallback:function(dir,bOnlyText,bRemoveOnlySelection,bOnTextAdd,isWord,bNoCheck){var target_text_object=getTargetTextObject(this);if(target_text_object)if(target_text_object.getObjectType()=== AscDFH.historyitem_type_GraphicFrame)target_text_object.graphicObject.Remove(dir,bOnlyText,bRemoveOnlySelection,bOnTextAdd,isWord);else{var content=this.getTargetDocContent(true);if(content)content.Remove(dir,true,bRemoveOnlySelection,bOnTextAdd,isWord);bNoCheck!==true&&target_text_object.checkExtentsByDocContent&&target_text_object.checkExtentsByDocContent()}else if(this.selectedObjects.length>0){var aSO,oSp;var worksheet=this.drawingObjects.getWorksheet();var oWBView;if(worksheet)worksheet.endEditChart(); var aSlicerNames=[];if(this.selection.groupSelection)if(this.selection.groupSelection.selection.chartSelection)this.selection.groupSelection.selection.chartSelection.remove();else{aSO=this.selection.groupSelection.selectedObjects;this.resetConnectors(aSO);var group_map={},group_arr=[],i,cur_group,sp,xc,yc,hc,vc,rel_xc,rel_yc,j;for(i=0;i0&&oWBView){History.StartTransaction();oWBView.deleteSlicers(aSlicerNames)}return}}this.resetInternalSelection()}else if(this.selection.chartSelection)this.selection.chartSelection.remove();else{aSO=this.selectedObjects;this.resetConnectors(aSO);for(var i=0;i0&&oWBView){History.StartTransaction();oWBView.deleteSlicers(aSlicerNames)}}else if(this.drawingObjects.slideComments)this.drawingObjects.slideComments.removeSelectedComment()},getAllObjectsOnPage:function(pageIndex,bHdrFtr){return this.getDrawingArray()},selectNextObject:function(direction){var selection_array= this.selectedObjects;if(selection_array.length>0){var i,graphic_page;if(direction>0){var selectNext=function(oThis,last_selected_object){var search_array=oThis.getAllObjectsOnPage(last_selected_object.selectStartPage,last_selected_object.parent&&last_selected_object.parent.DocumentContent&&last_selected_object.parent.DocumentContent.IsHdrFtr(false));if(search_array.length>0){for(var i=search_array.length-1;i>-1;--i)if(search_array[i]===last_selected_object)break;if(i>-1){oThis.resetSelection();oThis.selectObject(search_array[i< search_array.length-1?i+1:0],last_selected_object.selectStartPage);return}else return}};if(this.selection.groupSelection){for(i=this.selection.groupSelection.arrGraphicObjects.length-1;i>-1;--i)if(this.selection.groupSelection.arrGraphicObjects[i].selected)break;if(i>-1)if(i0){this.resetSelection();this.selectObject(last_selected_object,last_selected_object.selectStartPage);this.selection.groupSelection=last_selected_object;last_selected_object.selectObject(last_selected_object.arrGraphicObjects[0],last_selected_object.selectStartPage)}else selectNext(this, last_selected_object)}}else{var selectPrev=function(oThis,first_selected_object){var search_array=oThis.getAllObjectsOnPage(first_selected_object.selectStartPage,first_selected_object.parent&&first_selected_object.parent.DocumentContent&&first_selected_object.parent.DocumentContent.IsHdrFtr(false));if(search_array.length>0){for(var i=0;i0?i-1: search_array.length-1],first_selected_object.selectStartPage);return}else return}};if(this.selection.groupSelection){for(i=0;i0){this.selection.groupSelection.resetSelection();this.selection.groupSelection.selectObject(this.selection.groupSelection.arrGraphicObjects[i-1],this.selection.groupSelection.selectStartPage)}else selectPrev(this, this.selection.groupSelection);else return}else{var first_selected_object=this.selectedObjects[0];if(first_selected_object.getObjectType()===AscDFH.historyitem_type_GroupShape&&first_selected_object.arrGraphicObjects.length>0){this.resetSelection();this.selectObject(first_selected_object,first_selected_object.selectStartPage);this.selection.groupSelection=first_selected_object;first_selected_object.selectObject(first_selected_object.arrGraphicObjects[first_selected_object.arrGraphicObjects.length- 1],first_selected_object.selectStartPage)}else selectPrev(this,first_selected_object)}}this.updateOverlay();if(this.drawingObjects&&this.drawingObjects.sendGraphicObjectProps)this.drawingObjects.sendGraphicObjectProps();else if(this.document&&this.document.Document_UpdateInterfaceState)this.document.Document_UpdateInterfaceState()}},moveSelectedObjects:function(dx,dy){if(!this.canEdit())return;var oldCurState=this.curState;this.checkSelectedObjectsForMove(this.selection.groupSelection?this.selection.groupSelection: null);this.swapTrackObjects();var move_state;if(!this.selection.groupSelection)move_state=new AscFormat.MoveState(this,this.selectedObjects[0],0,0);else move_state=new AscFormat.MoveInGroupState(this,this.selection.groupSelection.selectedObjects[0],this.selection.groupSelection,0,0);for(var i=0;i-1;--i)this.selection.groupSelection.selectObject(this.selection.groupSelection.arrGraphicObjects[i],0)}}else{if(!this.selection.chartSelection){this.resetSelection();var drawings=this.getDrawingObjects();for(i=drawings.length-1;i>-1;--i)this.selectObject(drawings[i],0)}}else{this.resetSelection();this.document.SetDocPosType(docpostype_Content);this.document.SelectAll()}this.updateSelectionState()},canEdit:function(){var oApi=this.getEditorApi();var _ret=true;if(oApi)_ret=oApi.canEdit();return _ret}, getEventListeners:function(){return this.eventListeners},onKeyUp:function(e){var aListeners=this.getEventListeners();for(var nObject=0;nObject0||this.arrPreTrackObjects.length>0},checkEndAddShape:function(){if(this.checkTrackDrawings()){this.endTrackNewShape(); if(Asc["editor"]){Asc["editor"].asc_endAddShape();var ws=Asc["editor"].wb.getWorksheet();if(ws){var ct=ws.getCursorTypeFromXY(ws.objectRender.lastX,ws.objectRender.lastY);if(ct)Asc["editor"].wb._onUpdateCursor(ct.cursor)}}return true}return false},onMouseWheel:function(deltaX,deltaY){var aSelection=this.selection.groupSelection?this.selection.groupSelection.selectedObjects:this.selectedObjects;if(aSelection.length===1&&aSelection[0].getObjectType()===AscDFH.historyitem_type_SlicerView)return aSelection[0].onWheel(deltaX, deltaY);return false},resetSelectionState:function(){if(this.bNoResetSeclectionState===true)return;this.checkChartTextSelection();this.resetSelection();this.clearPreTrackObjects();this.clearTrackObjects();this.changeCurrentState(new AscFormat.NullState(this,this.drawingObjects));this.updateSelectionState();Asc["editor"]&&Asc["editor"].asc_endAddShape()},resetSelectionState2:function(){var count=this.selectedObjects.length;while(count>0){this.selectedObjects[0].deselect(this);--count}this.changeCurrentState(new AscFormat.NullState(this, this.drawingObjects))},addTextWithPr:function(sText,oTextPr,isMoveCursorOutside){this.checkSelectedObjectsAndCallback(function(){var oTargetDocContent=this.getTargetDocContent(true,false);if(oTargetDocContent){oTargetDocContent.Remove(-1,true,true,true,undefined);var oCurrentTextPr=oTargetDocContent.GetDirectTextPr();var oParagraph=oTargetDocContent.GetCurrentParagraph();if(oParagraph&&oParagraph.GetParent()){var oTempPara=new Paragraph(this.drawingObjects.getDrawingDocument(),oParagraph.GetParent()); var oRun=new ParaRun(oTempPara,false);oRun.AddText(sText);oTempPara.AddToContent(0,oRun);oRun.SetPr(oCurrentTextPr.Copy());if(oTextPr)oRun.ApplyPr(oTextPr);var oAnchorPos=oParagraph.GetCurrentAnchorPosition();var oSelectedContent=new CSelectedContent;var oSelectedElement=new CSelectedElement;oSelectedElement.Element=oTempPara;oSelectedElement.SelectedAll=false;oSelectedContent.Add(oSelectedElement);oSelectedContent.On_EndCollectElements(oTargetDocContent,false);var isMath=false;if(oAnchorPos&&oAnchorPos.Paragraph){var oParaNearPos= oAnchorPos.Paragraph.Get_ParaNearestPos(oAnchorPos);var oLastClass=oParaNearPos.Classes[oParaNearPos.Classes.length-1];isMath=para_Math_Run===oLastClass.Type}oParagraph.GetParent().InsertContent(oSelectedContent,oAnchorPos);oSelectedElement=oSelectedContent.Elements[0];if(oSelectedElement){oTempPara=oSelectedElement.Element;if(oTempPara){oRun=oTempPara.Content[0];if(isMath)oTargetDocContent.MoveCursorRight(false,false,true);else if(oTargetDocContent.IsSelectionUse())if(isMoveCursorOutside){oTargetDocContent.RemoveSelection(); oRun.MoveCursorOutsideElement(false)}else oTargetDocContent.MoveCursorRight(false,false,true);else if(isMoveCursorOutside)oRun.MoveCursorOutsideElement(false)}}var oTargetTextObject=getTargetTextObject(this);if(oTargetTextObject&&oTargetTextObject.checkExtentsByDocContent)oTargetTextObject.checkExtentsByDocContent()}}},[],false,AscDFH.historydescription_Document_AddTextWithProperties)},getColorMapOverride:function(){return null},Document_UpdateInterfaceState:function(){},getChartObject:function(type, w,h){if(null!=type)return AscFormat.ExecuteNoHistory(function(){var options=new Asc.asc_ChartSettings;options.putType(type);options.style=1;options.putTitle(c_oAscChartTitleShowSettings.noOverlay);var chartSeries=DrawingObjectsController.prototype.getSeriesDefault.call(this,type);var ret=this.getChartSpace2(chartSeries,options);if(!ret){chartSeries=DrawingObjectsController.prototype.getSeriesDefault.call(this,c_oAscChartTypeSettings.barNormal);ret=this.getChartSpace2(chartSeries,options)}if(type=== c_oAscChartTypeSettings.scatter){var new_hor_axis_settings=new AscCommon.asc_ValAxisSettings;new_hor_axis_settings.setDefault();new_hor_axis_settings.putGridlines(c_oAscGridLinesSettings.major);options.addHorAxesProps(new_hor_axis_settings);var new_vert_axis_settings=new AscCommon.asc_ValAxisSettings;new_vert_axis_settings.setDefault();new_vert_axis_settings.putGridlines(c_oAscGridLinesSettings.major);options.addVertAxesProps(new_vert_axis_settings)}options.type=null;options.bCreate=true;this.applyPropsToChartSpace(options, ret);options.bCreate=false;this.applyPropsToChartSpace(options,ret);ret.theme=this.getTheme();CheckSpPrXfrm(ret);ret.spPr.xfrm.setOffX(0);ret.spPr.xfrm.setOffY(0);if(AscFormat.isRealNumber(w)&&w>0){var dAspect=w/ret.spPr.xfrm.extX;if(dAspect<1){ret.spPr.xfrm.setExtX(w);ret.spPr.xfrm.setExtY(ret.spPr.xfrm.extY*dAspect)}}ret.theme=this.getTheme();ret.colorMapOverride=this.getColorMapOverride();return ret},this,[]);else{var by_types=getObjectsByTypesFromArr(this.selection.groupSelection?this.selection.groupSelection.selectedObjects: this.selectedObjects,true);if(by_types.charts.length===1){by_types.charts[0].theme=this.getTheme();by_types.charts[0].colorMapOverride=this.getColorMapOverride();AscFormat.ExecuteNoHistory(function(){CheckSpPrXfrm2(by_types.charts[0])},this,[]);return by_types.charts[0]}}return null},checkNeedResetChartSelection:function(e,x,y,pageIndex,bTextFlag){var oTitle,oCursorInfo,oTargetTextObject=getTargetTextObject(this);if(oTargetTextObject instanceof AscFormat.CTitle)oTitle=oTargetTextObject;if(!oTitle)return true; this.handleEventMode=HANDLE_EVENT_MODE_CURSOR;oCursorInfo=this.curState.onMouseDown(e,x,y,pageIndex,bTextFlag);this.handleEventMode=HANDLE_EVENT_MODE_HANDLE;return!(isRealObject(oCursorInfo)&&oTitle===oCursorInfo.title)},checkChartTextSelection:function(bNoRedraw){if(this.bNoCheckChartTextSelection===true)return false;var chart_selection,bRet=false;var nPageNum1,nPageNum2;if(this.selection.chartSelection)chart_selection=this.selection.chartSelection;else if(this.selection.groupSelection&&this.selection.groupSelection.selection.chartSelection)chart_selection= this.selection.groupSelection.selection.chartSelection;if(chart_selection&&(chart_selection.selection.textSelection||chart_selection.selection.title)){var oTitle=chart_selection.selection.textSelection;if(!oTitle){oTitle=chart_selection.selection.title;nPageNum2=this.drawingObjects.num}var content=oTitle.getDocContent(),bDeleteTitle=false;if(content)if(content.Is_Empty())if(chart_selection.selection.title&&chart_selection.selection.title.parent){History.Create_NewPoint(AscDFH.historydescription_CommonControllerCheckChartText); chart_selection.selection.title.parent.setTitle(null);bDeleteTitle=true}if(chart_selection.recalcInfo.bRecalculatedTitle||bDeleteTitle){chart_selection.recalcInfo.recalcTitle=null;chart_selection.handleUpdateInternalChart(false);if(this.document){chart_selection.recalculate();nPageNum1=chart_selection.selectStartPage}else if(this.drawingObjects.cSld){chart_selection.recalculate();if(!(bNoRedraw===true))nPageNum1=this.drawingObjects.num}else{nPageNum1=0;chart_selection.recalculate()}chart_selection.recalcInfo.bRecalculatedTitle= false}}var oTargetTextObject=getTargetTextObject(this);var nSelectStartPage=0,bNoNeedRecalc=false;if(oTargetTextObject)nSelectStartPage=oTargetTextObject.selectStartPage;if(!(oTargetTextObject instanceof AscFormat.CShape)&&this.document)if(this.selectedObjects.length===1&&this.selectedObjects[0].parent){var oShape=this.selectedObjects[0].parent.isShapeChild(true);if(oShape){oTargetTextObject=oShape;nSelectStartPage=this.selectedObjects[0].selectStartPage;bNoNeedRecalc=true}}if(oTargetTextObject){var bRedraw= false;var warpGeometry=oTargetTextObject.recalcInfo&&oTargetTextObject.recalcInfo.warpGeometry;if(warpGeometry&&warpGeometry.preset!=="textNoShape"||oTargetTextObject.worksheet){if(oTargetTextObject.recalcInfo.bRecalculatedTitle){oTargetTextObject.recalcInfo.recalcTitle=null;oTargetTextObject.recalcInfo.bRecalculatedTitle=false;AscFormat.ExecuteNoHistory(function(){if(oTargetTextObject.bWordShape){if(!bNoNeedRecalc){oTargetTextObject.recalcInfo.oContentMetrics=oTargetTextObject.recalculateTxBoxContent(); oTargetTextObject.recalcInfo.recalculateTxBoxContent=false;oTargetTextObject.recalcInfo.AllDrawings=[];var oContent=oTargetTextObject.getDocContent();if(oContent)oContent.GetAllDrawingObjects(oTargetTextObject.recalcInfo.AllDrawings)}}else{oTargetTextObject.recalcInfo.oContentMetrics=oTargetTextObject.recalculateContent();oTargetTextObject.recalcInfo.recalculateContent=false}},this,[])}bRedraw=true}var oDocContent=this.getTargetDocContent();if(oDocContent){var oParagraph=oDocContent.GetElement(0); var oForm;if(oParagraph&&oParagraph.IsParagraph()&&oParagraph.IsInFixedForm()&&(oForm=oParagraph.GetInnerForm())){oDocContent.ResetShiftView();bRedraw=true}}if(bRedraw)if(this.document)nPageNum2=nSelectStartPage;else if(this.drawingObjects.cSld)nPageNum2=this.drawingObjects.num;else nPageNum2=0}if(AscFormat.isRealNumber(nPageNum1)){bRet=true;if(this.document){this.document.DrawingDocument.OnRecalculatePage(nPageNum1,this.document.Pages[nPageNum1]);this.document.DrawingDocument.OnEndRecalculate(false, true)}else if(this.drawingObjects.cSld){if(!(bNoRedraw===true)){editor.WordControl.m_oDrawingDocument.OnRecalculatePage(nPageNum1,this.drawingObjects);editor.WordControl.m_oDrawingDocument.OnEndRecalculate(false,true)}}else this.drawingObjects.showDrawingObjects()}if(AscFormat.isRealNumber(nPageNum2)&&nPageNum2!==nPageNum1){bRet=true;if(this.document){this.document.DrawingDocument.OnRecalculatePage(nPageNum2,this.document.Pages[nPageNum2]);this.document.DrawingDocument.OnEndRecalculate(false,true)}else if(this.drawingObjects.cSld){if(!(bNoRedraw=== true)){editor.WordControl.m_oDrawingDocument.OnRecalculatePage(nPageNum2,this.drawingObjects);editor.WordControl.m_oDrawingDocument.OnEndRecalculate(false,true)}}else this.drawingObjects.showDrawingObjects()}return bRet},resetSelection:function(noResetContentSelect,bNoCheckChart,bDoNotRedraw){if(bNoCheckChart!==true)this.checkChartTextSelection();this.resetInternalSelection(noResetContentSelect,bDoNotRedraw);for(var i=0;i1},getArrayForGrouping:function(){var graphic_objects=this.getDrawingObjects();var grouped_objects=[];for(var i=0;ibounds.l)min_x=bounds.l;if(min_y> bounds.t)min_y=bounds.t}return new AscFormat.CGraphicBounds(min_x,min_y,max_x,max_y)},getGroup:function(arrDrawings){if(!Array.isArray(arrDrawings))arrDrawings=this.getArrayForGrouping();if(arrDrawings.length<2)return null;var bounds=this.getBoundsForGroup(arrDrawings);var max_x=bounds.r;var max_y=bounds.b;var min_x=bounds.l;var min_y=bounds.t;var group=new AscFormat.CGroupShape;group.setSpPr(new AscFormat.CSpPr);group.spPr.setParent(group);group.spPr.setXfrm(new AscFormat.CXfrm);var xfrm=group.spPr.xfrm; xfrm.setParent(group.spPr);xfrm.setOffX(min_x);xfrm.setOffY(min_y);xfrm.setExtX(max_x-min_x);xfrm.setExtY(max_y-min_y);xfrm.setChExtX(max_x-min_x);xfrm.setChExtY(max_y-min_y);xfrm.setChOffX(0);xfrm.setChOffY(0);for(var i=0;i0){var nPageIndex,aDrawings,oRes,aSelectedCopy,i;if(this.selection.groupSelection){aDrawings=this.selection.groupSelection.selectedObjects;nPageIndex=this.selection.groupSelection.selectStartPage}else{aSelectedCopy= [].concat(this.selectedObjects);aSelectedCopy.sort(function(a,b){return a.selectStartPage-b.selectStartPage});nPageIndex=aSelectedCopy[0].selectStartPage;aDrawings=[];for(i=0;i0){this.resetSelection(); var i,j,cur_group,sp_tree,sp,nInsertPos;for(i=0;iEndPos){StartPos=paragraph.Selection.EndPos;EndPos=paragraph.Selection.StartPos}for(var CurPos=StartPos;CurPos<=EndPos;CurPos++){var Element=paragraph.Content[CurPos];if(true!==Element.IsSelectionEmpty()&¶_Hyperlink!==Element.Type)break;else if(true!==Element.IsSelectionEmpty()&¶_Hyperlink=== Element.Type)if(-1===HyperPos)HyperPos=CurPos;else break}if(paragraph.Selection.StartPos===paragraph.Selection.EndPos&¶_Hyperlink===paragraph.Content[paragraph.Selection.StartPos].Type)HyperPos=paragraph.Selection.StartPos}else if(para_Hyperlink===paragraph.Content[paragraph.CurPos.ContentPos].Type)HyperPos=paragraph.CurPos.ContentPos;if(-1!==HyperPos)return paragraph.Content[HyperPos]}return null},setSelectionState:function(state,stateIndex){if(!Array.isArray(state))return;var _state_index=AscFormat.isRealNumber(stateIndex)? stateIndex:state.length-1;var selection_state=state[_state_index];this.clearPreTrackObjects();this.clearTrackObjects();this.resetSelection(undefined,true,undefined);this.changeCurrentState(new AscFormat.NullState(this));if(selection_state.textObject&&!selection_state.textObject.bDeleted){this.selectObject(selection_state.textObject,selection_state.selectStartPage);this.selection.textSelection=selection_state.textObject;if(selection_state.textObject.getObjectType()===AscDFH.historyitem_type_GraphicFrame)selection_state.textObject.graphicObject.SetSelectionState(selection_state.textSelection, selection_state.textSelection.length-1);else selection_state.textObject.getDocContent().SetSelectionState(selection_state.textSelection,selection_state.textSelection.length-1)}else if(selection_state.groupObject&&!selection_state.groupObject.bDeleted){this.selectObject(selection_state.groupObject,selection_state.selectStartPage);this.selection.groupSelection=selection_state.groupObject;selection_state.groupObject.setSelectionState(selection_state.groupSelection)}else if(selection_state.chartObject&& !selection_state.chartObject.bDeleted){this.selectObject(selection_state.chartObject,selection_state.selectStartPage);this.selection.chartSelection=selection_state.chartObject;selection_state.chartObject.setSelectionState(selection_state.chartSelection)}else if(selection_state.wrapObject&&!selection_state.wrapObject.bDeleted){this.selectObject(selection_state.wrapObject,selection_state.selectStartPage);this.selection.wrapPolygonSelection=selection_state.wrapObject}else if(selection_state.cropObject&& !selection_state.cropObject.bDeleted){this.selectObject(selection_state.cropObject,selection_state.selectStartPage);this.selection.cropSelection=selection_state.cropObject;this.sendCropState();if(this.selection.cropSelection)this.selection.cropSelection.cropObject=null}else if(Array.isArray(selection_state.selection))for(var i=0;i0;selection_state.selection=[]; for(var i=0;i0},drawTracks:function(overlay){for(var i=0;i0},drawSelection:function(drawingDocument){DrawingObjectsController.prototype.drawSelect.call(this, 0,drawingDocument)},getTargetTransform:function(){var oRet=null;if(this.selection.textSelection)oRet=this.selection.textSelection.transformText;else if(this.selection.groupSelection)if(this.selection.groupSelection.selection.textSelection)oRet=this.selection.groupSelection.selection.textSelection.transformText;else{if(this.selection.groupSelection.selection.chartSelection&&this.selection.groupSelection.selection.chartSelection.selection.textSelection)oRet=this.selection.groupSelection.selection.chartSelection.selection.textSelection.transformText}else if(this.selection.chartSelection&& this.selection.chartSelection.selection.textSelection)oRet=this.selection.chartSelection.selection.textSelection.transformText;if(oRet){oRet=oRet.CreateDublicate();return oRet}return new AscCommon.CMatrix},drawTextSelection:function(num){var content=this.getTargetDocContent(undefined,true);if(content){this.drawingObjects.getDrawingDocument().UpdateTargetTransform(this.getTargetTransform());content.DrawSelectionOnPage(0)}},getSelectedObjects:function(){return this.selectedObjects},getSelectedArray:function(){if(this.selection.groupSelection)return this.selection.groupSelection.selectedObjects; return this.selectedObjects},getDrawingPropsFromArray:function(drawings){var image_props,shape_props,chart_props,table_props=undefined,new_image_props,new_shape_props,new_chart_props,new_table_props,shape_chart_props,locked;var drawing;var slicer_props,new_slicer_props;for(var i=0;iEndPos){StartPos=oParagraph.Selection.EndPos;EndPos=oParagraph.Selection.StartPos}for(var CurPos=StartPos;CurPos<=EndPos;CurPos++){var Element=oParagraph.Content[CurPos];if(true!==Element.IsSelectionEmpty()&¶_Math===Element.Type)ascSelectedObjects.push(new AscCommon.asc_CSelectedObject(Asc.c_oAscTypeSelectElement.Math,Element.Get_MenuProps()))}}else{var CurType=oParagraph.Content[oParagraph.CurPos.ContentPos].Type;if(para_Math===CurType)ascSelectedObjects.push(new AscCommon.asc_CSelectedObject(Asc.c_oAscTypeSelectElement.Math, oParagraph.Content[oParagraph.CurPos.ContentPos].Get_MenuProps()))}}return ascSelectedObjects},prepareParagraphProperties:function(ParaPr,TextPr,ascSelectedObjects){var _this=this;var trigger=this.drawingObjects.callTrigger;ParaPr.Subscript=TextPr.VertAlign===AscCommon.vertalign_SubScript?true:false;ParaPr.Superscript=TextPr.VertAlign===AscCommon.vertalign_SuperScript?true:false;ParaPr.Strikeout=TextPr.Strikeout;ParaPr.DStrikeout=TextPr.DStrikeout;ParaPr.AllCaps=TextPr.Caps;ParaPr.SmallCaps=TextPr.SmallCaps; ParaPr.TextSpacing=TextPr.Spacing;ParaPr.Position=TextPr.Position;if(true===ParaPr.Spacing.AfterAutoSpacing)ParaPr.Spacing.After=spacing_Auto;else if(undefined===ParaPr.Spacing.AfterAutoSpacing)ParaPr.Spacing.After=UnknownValue;if(true===ParaPr.Spacing.BeforeAutoSpacing)ParaPr.Spacing.Before=spacing_Auto;else if(undefined===ParaPr.Spacing.BeforeAutoSpacing)ParaPr.Spacing.Before=UnknownValue;if(-1===ParaPr.PStyle)ParaPr.StyleName="";if(null==ParaPr.NumPr||0===ParaPr.NumPr.NumId)ParaPr.ListType={Type:-1, SubType:-1};if(true===ParaPr.Spacing.AfterAutoSpacing)ParaPr.Spacing.After=spacing_Auto;else if(undefined===ParaPr.Spacing.AfterAutoSpacing)ParaPr.Spacing.After=UnknownValue;if(true===ParaPr.Spacing.BeforeAutoSpacing)ParaPr.Spacing.Before=spacing_Auto;else if(undefined===ParaPr.Spacing.BeforeAutoSpacing)ParaPr.Spacing.Before=UnknownValue;trigger("asc_onParaSpacingLine",new AscCommon.asc_CParagraphSpacing(ParaPr.Spacing));trigger("asc_onPrAlign",ParaPr.Jc);ascSelectedObjects.push(new AscCommon.asc_CSelectedObject(Asc.c_oAscTypeSelectElement.Paragraph, new Asc.asc_CParagraphProperty(ParaPr)))},createImage:function(rasterImageId,x,y,extX,extY,sVideoUrl,sAudioUrl){var image=new AscFormat.CImageShape;AscFormat.fillImage(image,rasterImageId,x,y,extX,extY,sVideoUrl,sAudioUrl);return image},createOleObject:function(data,sApplicationId,rasterImageId,x,y,extX,extY,nWidthPix,nHeightPix){var oleObject=new AscFormat.COleObject;AscFormat.fillImage(oleObject,rasterImageId,x,y,extX,extY);oleObject.setData(data);oleObject.setApplicationId(sApplicationId);oleObject.setPixSizes(nWidthPix, nHeightPix);return oleObject},createTextArt:function(nStyle,bWord,wsModel,sStartString){var MainLogicDocument=editor&&editor.WordControl&&editor.WordControl.m_oLogicDocument?editor&&editor.WordControl&&editor.WordControl.m_oLogicDocument:null;var TrackRevisions=false;if(MainLogicDocument&&MainLogicDocument.IsTrackRevisions&&MainLogicDocument.IsTrackRevisions()){TrackRevisions=MainLogicDocument.GetLocalTrackRevisions();MainLogicDocument.SetLocalTrackRevisions(false)}var oShape=new AscFormat.CShape; oShape.setWordShape(bWord===true);oShape.setBDeleted(false);if(wsModel)oShape.setWorksheet(wsModel);var nFontSize;if(bWord){nFontSize=36;oShape.createTextBoxContent()}else{nFontSize=54;oShape.createTextBody()}var bUseStartString=typeof sStartString==="string";if(bUseStartString)nFontSize=undefined;var oSpPr=new AscFormat.CSpPr;var oXfrm=new AscFormat.CXfrm;oXfrm.setOffX(0);oXfrm.setOffY(0);oXfrm.setExtX(1828800/36E3);oXfrm.setExtY(1828800/36E3);oSpPr.setXfrm(oXfrm);oXfrm.setParent(oSpPr);oSpPr.setFill(AscFormat.CreateNoFillUniFill()); oSpPr.setLn(AscFormat.CreateNoFillLine());oSpPr.setGeometry(AscFormat.CreateGeometry("rect"));oShape.setSpPr(oSpPr);oSpPr.setParent(oShape);var oContent=oShape.getDocContent();var sText,oSelectedContent,oNearestPos,sSelectedText;if(this.document){sSelectedText=this.document.GetSelectedText(false,{});oSelectedContent=this.document.GetSelectedContent(true);oContent.Recalculate_Page(0,true);oContent.MoveCursorToStartPos(false);oNearestPos=oContent.Get_NearestPos(0,0,0,false,undefined);oNearestPos.Paragraph.Check_NearestPos(oNearestPos); if(typeof sSelectedText==="string"&&sSelectedText.length>0)if(oSelectedContent&&this.document.Can_InsertContent(oSelectedContent,oNearestPos)){oSelectedContent.MoveDrawing=true;if(oSelectedContent.Elements.length>1&&oSelectedContent.Elements[oSelectedContent.Elements.length-1].Element.GetType()===AscCommonWord.type_Paragraph&&oSelectedContent.Elements[oSelectedContent.Elements.length-1].Element.IsEmpty())oSelectedContent.Elements.splice(oSelectedContent.Elements.length-1,1);if(oSelectedContent.Elements.length> 0)oSelectedContent.Elements[oSelectedContent.Elements.length-1].SelectedAll=false;oContent.InsertContent(oSelectedContent,oNearestPos);oContent.Selection.Start=false;oContent.Selection.Use=false;oContent.Selection.StartPos=0;oContent.Selection.EndPos=0;oContent.Selection.Flag=selectionflag_Common;oContent.SetDocPosType(docpostype_Content);oContent.CurPos.ContentPos=0;oShape.bSelectedText=true}else{sText=this.getDefaultText();AscFormat.AddToContentFromString(oContent,sText);oShape.bSelectedText=false}else{sText= this.getDefaultText();AscFormat.AddToContentFromString(oContent,sText);oShape.bSelectedText=false}}else if(this.drawingObjects.cSld){oShape.setParent(this.drawingObjects);var oTargetDocContent=this.getTargetDocContent();if(oTargetDocContent&&oTargetDocContent.Selection.Use&&oTargetDocContent.GetSelectedText(false,{}).length>0){oSelectedContent=new CSelectedContent;oTargetDocContent.GetSelectedContent(oSelectedContent);oSelectedContent.MoveDrawing=true;if(oSelectedContent.Elements.length>1&&oSelectedContent.Elements[oSelectedContent.Elements.length- 1].Element.GetType()===AscCommonWord.type_Paragraph&&oSelectedContent.Elements[oSelectedContent.Elements.length-1].Element.IsEmpty())oSelectedContent.Elements.splice(oSelectedContent.Elements.length-1,1);if(oSelectedContent.Elements.length>0)oSelectedContent.Elements[oSelectedContent.Elements.length-1].SelectedAll=false;oContent.Recalculate_Page(0,true);oContent.MoveCursorToStartPos(false);var paragraph=oContent.Content[oContent.CurPos.ContentPos];if(null!=paragraph&&type_Paragraph==paragraph.GetType()){oNearestPos= {Paragraph:paragraph,ContentPos:paragraph.Get_ParaContentPos(false,false)};paragraph.Check_NearestPos(oNearestPos);oContent.InsertContent(oSelectedContent,oNearestPos);oShape.bSelectedText=false}else{sText=this.getDefaultText();AscFormat.AddToContentFromString(oContent,sText);oShape.bSelectedText=false}}else{oShape.bSelectedText=false;sText=bUseStartString?sStartString:this.getDefaultText();AscFormat.AddToContentFromString(oContent,sText)}}else{sText=bUseStartString?sStartString:this.getDefaultText(); AscFormat.AddToContentFromString(oContent,sText)}var oTextPr;if(!bUseStartString){oTextPr=oShape.getTextArtPreviewManager().getStylesToApply()[nStyle].Copy();oTextPr.FontSize=nFontSize;oTextPr.RFonts.Ascii=undefined;if(!(typeof CGraphicObjects!=="undefined"&&this instanceof CGraphicObjects)){oTextPr.Unifill=oTextPr.TextFill;oTextPr.TextFill=undefined}}else{oTextPr=new CTextPr;oTextPr.FontSize=nFontSize;oTextPr.RFonts.Ascii={Name:"Cambria Math",Index:-1};oTextPr.RFonts.HAnsi={Name:"Cambria Math",Index:-1}; oTextPr.RFonts.CS={Name:"Cambria Math",Index:-1};oTextPr.RFonts.EastAsia={Name:"Cambria Math",Index:-1}}oContent.SetApplyToAll(true);oContent.AddToParagraph(new ParaTextPr(oTextPr));oContent.SetParagraphAlign(AscCommon.align_Center);oContent.SetApplyToAll(false);var oBodyPr=oShape.getBodyPr().createDuplicate();oBodyPr.rot=0;oBodyPr.spcFirstLastPara=false;oBodyPr.vertOverflow=AscFormat.nOTOwerflow;oBodyPr.horzOverflow=AscFormat.nOTOwerflow;oBodyPr.vert=AscFormat.nVertTThorz;oBodyPr.wrap=AscFormat.nTWTNone; oBodyPr.lIns=2.54;oBodyPr.tIns=1.27;oBodyPr.rIns=2.54;oBodyPr.bIns=1.27;oBodyPr.numCol=1;oBodyPr.spcCol=0;oBodyPr.rtlCol=0;oBodyPr.fromWordArt=false;oBodyPr.anchor=4;oBodyPr.anchorCtr=false;oBodyPr.forceAA=false;oBodyPr.compatLnSpc=true;oBodyPr.prstTxWarp=AscFormat.ExecuteNoHistory(function(){return AscFormat.CreatePrstTxWarpGeometry("textNoShape")},this,[]);oBodyPr.textFit=new AscFormat.CTextFit;oBodyPr.textFit.type=AscFormat.text_fit_Auto;if(bWord)oShape.setBodyPr(oBodyPr);else oShape.txBody.setBodyPr(oBodyPr); if(false!==TrackRevisions)MainLogicDocument.SetLocalTrackRevisions(TrackRevisions);return oShape},GetSelectedText:function(bCleartText,oPr){var content=this.getTargetDocContent();if(content)return content.GetSelectedText(bCleartText,oPr);else return""},putPrLineSpacing:function(type,value){this.checkSelectedObjectsAndCallback(this.setParagraphSpacing,[{LineRule:type,Line:value}],false,AscDFH.historydescription_Spreadsheet_PutPrLineSpacing)},putLineSpacingBeforeAfter:function(type,value){var arg;switch(type){case 0:{if(spacing_Auto=== value)arg={BeforeAutoSpacing:true};else arg={Before:value,BeforeAutoSpacing:false};break}case 1:{if(spacing_Auto===value)arg={AfterAutoSpacing:true};else arg={After:value,AfterAutoSpacing:false};break}}if(arg)this.checkSelectedObjectsAndCallback(this.setParagraphSpacing,[arg],false,AscDFH.historydescription_Spreadsheet_SetParagraphSpacing)},setGraphicObjectProps:function(props){if(typeof Asc.asc_CParagraphProperty!=="undefined"&&!(props instanceof Asc.asc_CParagraphProperty)){var aAdditionalObjects= null;if(AscFormat.isRealNumber(props.Width)&&AscFormat.isRealNumber(props.Height))aAdditionalObjects=this.getConnectorsForCheck2();var bNoSendProperties=AscCommon.isRealObject(props.SlicerProperties);this.checkSelectedObjectsAndCallback(this.setGraphicObjectPropsCallBack,[props],bNoSendProperties,AscDFH.historydescription_Spreadsheet_SetGraphicObjectsProps,aAdditionalObjects);var oApplyProps=null;if(props)if(props.ShapeProperties)oApplyProps=props.ShapeProperties;else oApplyProps=props;if(oApplyProps&& (oApplyProps.textArtProperties&&typeof oApplyProps.textArtProperties.asc_getForm()==="string"||oApplyProps.ChartProperties))this.updateSelectionState()}else this.checkSelectedObjectsAndCallback(this.paraApplyCallback,[props],false,AscDFH.historydescription_Spreadsheet_ParaApply)},checkSelectedObjectsAndCallback:function(callback,args,bNoSendProps,nHistoryPointType,aAdditionalObjects,bNoCheckLock){var oApi=Asc.editor;if(oApi&&oApi.collaborativeEditing&&oApi.collaborativeEditing.getGlobalLock())return; var selection_state=this.getSelectionState();var aId=[],i;if(!(bNoCheckLock===true)){for(i=0;i0){if(bSelected&&selected_objects.length>1){boundsObject=getAbsoluteRectBoundsArr(selected_objects);leftPos=boundsObject.minX}else leftPos=0;this.checkSelectedObjectsForMove(this.selection.groupSelection? this.selection.groupSelection:null);this.swapTrackObjects();var move_state,oTrack,oDrawing,oBounds;if(!this.selection.groupSelection)move_state=new AscFormat.MoveState(this,selected_objects[0],0,0);else move_state=new AscFormat.MoveInGroupState(this,selected_objects[0],this.selection.groupSelection,0,0);for(i=0;i0){if(bSelected&&selected_objects.length>1){boundsObject=getAbsoluteRectBoundsArr(selected_objects);rightPos=boundsObject.maxX}else rightPos=this.drawingObjects.Width;this.checkSelectedObjectsForMove(this.selection.groupSelection?this.selection.groupSelection:null); this.swapTrackObjects();var move_state,oTrack,oDrawing,oBounds;if(!this.selection.groupSelection)move_state=new AscFormat.MoveState(this,this.selectedObjects[0],0,0);else move_state=new AscFormat.MoveInGroupState(this,this.selection.groupSelection.selectedObjects[0],this.selection.groupSelection,0,0);for(i=0;i0){if(bSelected&&selected_objects.length>1){boundsObject=getAbsoluteRectBoundsArr(selected_objects);topPos=boundsObject.minY}else topPos=0;this.checkSelectedObjectsForMove(this.selection.groupSelection?this.selection.groupSelection:null);this.swapTrackObjects();var move_state, oTrack,oDrawing,oBounds;if(!this.selection.groupSelection)move_state=new AscFormat.MoveState(this,this.selectedObjects[0],0,0);else move_state=new AscFormat.MoveInGroupState(this,this.selection.groupSelection.selectedObjects[0],this.selection.groupSelection,0,0);for(i=0;i0){if(bSelected&&selected_objects.length>1){boundsObject=getAbsoluteRectBoundsArr(selected_objects);bottomPos=boundsObject.maxY}else bottomPos=this.drawingObjects.Height;this.checkSelectedObjectsForMove(this.selection.groupSelection?this.selection.groupSelection:null); this.swapTrackObjects();var move_state,oTrack,oDrawing,oBounds;if(!this.selection.groupSelection)move_state=new AscFormat.MoveState(this,this.selectedObjects[0],0,0);else move_state=new AscFormat.MoveInGroupState(this,this.selection.groupSelection.selectedObjects[0],this.selection.groupSelection,0,0);for(i=0;i0){if(bSelected&&selected_objects.length>1){boundsObject=getAbsoluteRectBoundsArr(selected_objects);centerPos=boundsObject.minX+(boundsObject.maxX-boundsObject.minX)/2}else centerPos=this.drawingObjects.Width/2;this.checkSelectedObjectsForMove(this.selection.groupSelection? this.selection.groupSelection:null);this.swapTrackObjects();var move_state,oTrack,oDrawing,oBounds;if(!this.selection.groupSelection)move_state=new AscFormat.MoveState(this,this.selectedObjects[0],0,0);else move_state=new AscFormat.MoveInGroupState(this,this.selection.groupSelection.selectedObjects[0],this.selection.groupSelection,0,0);for(i=0;i0){if(bSelected&&selected_objects.length>1){boundsObject=getAbsoluteRectBoundsArr(selected_objects);middlePos=boundsObject.minY+(boundsObject.maxY-boundsObject.minY)/2}else middlePos= this.drawingObjects.Height/2;this.checkSelectedObjectsForMove(this.selection.groupSelection?this.selection.groupSelection:null);this.swapTrackObjects();var move_state,oTrack,oDrawing,oBounds;if(!this.selection.groupSelection)move_state=new AscFormat.MoveState(this,this.selectedObjects[0],0,0);else move_state=new AscFormat.MoveInGroupState(this,this.selection.groupSelection.selectedObjects[0],this.selection.groupSelection,0,0);for(i=0;i0){boundsObject= getAbsoluteRectBoundsArr(selected_objects);this.checkSelectedObjectsForMove(this.selection.groupSelection?this.selection.groupSelection:null);this.swapTrackObjects();sortObjects=[];for(i=0;i2){pos1=sortObjects[0].bounds.minX;pos2=sortObjects[sortObjects.length-1].bounds.maxX;gap=(pos2-pos1-boundsObject.summWidth)/(sortObjects.length-1)}else if(boundsObject.summWidth0){boundsObject=getAbsoluteRectBoundsArr(selected_objects);this.checkSelectedObjectsForMove(this.selection.groupSelection?this.selection.groupSelection:null);this.swapTrackObjects();sortObjects= [];for(i=0;i2){pos1=sortObjects[0].bounds.minY;pos2=sortObjects[sortObjects.length-1].bounds.maxY;gap=(pos2-pos1-boundsObject.summHeight)/ (sortObjects.length-1)}else if(boundsObject.summHeight-1;--i)if(sp_tree[i].selected)sp_tree[i].deleteDrawingBase();for(i=0;i-1;--i){var sp=sp_tree[i];if(sp.selected&& i0&&!sp_tree[i-1].selected){sp.deleteDrawingBase();sp.addToDrawingObjects(i-1)}}else this.selection.groupSelection.bringBackward();this.drawingObjects.showDrawingObjects()},addEventListener:function(drawing){if(!this.isEventListener(drawing))this.eventListeners.push(drawing)},removeEventListener:function(drawing){for(var i=0;ithis.max_x)this.max_x=x;if(y>this.max_y)this.max_y=y},CheckPoint:function(x,y){if(xthis.max_x)this.max_x=x;if(y>this.max_y)this.max_y=y},CheckRect:function(x, y,w,h){this.CheckPoint1(x,y);this.CheckPoint2(x+w,y+h)},fromBounds:function(_bounds){this.min_x=_bounds.min_x;this.min_y=_bounds.min_y;this.max_x=_bounds.max_x;this.max_y=_bounds.max_y}};function CSlideBoundsChecker(){this.map_bounds_shape={};this.map_bounds_shape["heart"]=true;this.IsSlideBoundsCheckerType=true;this.Bounds=new CBoundsController;this.m_oCurFont=null;this.m_oTextPr=null;this.m_oCoordTransform=new AscCommon.CMatrixL;this.m_oTransform=new AscCommon.CMatrixL;this.m_oFullTransform=new AscCommon.CMatrixL; this.IsNoSupportTextDraw=true;this.LineWidth=null;this.AutoCheckLineWidth=false}CSlideBoundsChecker.prototype={DrawLockParagraph:function(){},GetIntegerGrid:function(){return false},AddSmartRect:function(){},drawCollaborativeChanges:function(){},drawSearchResult:function(x,y,w,h){},IsShapeNeedBounds:function(preset){if(preset===undefined||preset==null)return true;return true===this.map_bounds_shape[preset]?false:true},init:function(width_px,height_px,width_mm,height_mm){this.m_lHeightPix=height_px; this.m_lWidthPix=width_px;this.m_dWidthMM=width_mm;this.m_dHeightMM=height_mm;this.m_dDpiX=25.4*this.m_lWidthPix/this.m_dWidthMM;this.m_dDpiY=25.4*this.m_lHeightPix/this.m_dHeightMM;this.m_oCoordTransform.sx=this.m_dDpiX/25.4;this.m_oCoordTransform.sy=this.m_dDpiY/25.4;this.Bounds.ClearNoAttack()},SetCurrentPage:function(){},EndDraw:function(){},put_GlobalAlpha:function(enable,alpha){},Start_GlobalAlpha:function(){},End_GlobalAlpha:function(){},p_color:function(r,g,b,a){},p_width:function(w){},p_dash:function(params){}, b_color1:function(r,g,b,a){},b_color2:function(r,g,b,a){},SetIntegerGrid:function(){},transform:function(sx,shy,shx,sy,tx,ty){this.m_oTransform.sx=sx;this.m_oTransform.shx=shx;this.m_oTransform.shy=shy;this.m_oTransform.sy=sy;this.m_oTransform.tx=tx;this.m_oTransform.ty=ty;this.CalculateFullTransform()},CalculateFullTransform:function(){this.m_oFullTransform.sx=this.m_oTransform.sx;this.m_oFullTransform.shx=this.m_oTransform.shx;this.m_oFullTransform.shy=this.m_oTransform.shy;this.m_oFullTransform.sy= this.m_oTransform.sy;this.m_oFullTransform.tx=this.m_oTransform.tx;this.m_oFullTransform.ty=this.m_oTransform.ty;AscCommon.global_MatrixTransformer.MultiplyAppend(this.m_oFullTransform,this.m_oCoordTransform)},_s:function(){},_e:function(){},_z:function(){},_m:function(x,y){var _x=this.m_oFullTransform.TransformPointX(x,y);var _y=this.m_oFullTransform.TransformPointY(x,y);this.Bounds.CheckPoint(_x,_y)},_l:function(x,y){var _x=this.m_oFullTransform.TransformPointX(x,y);var _y=this.m_oFullTransform.TransformPointY(x, y);this.Bounds.CheckPoint(_x,_y)},_c:function(x1,y1,x2,y2,x3,y3){var _x1=this.m_oFullTransform.TransformPointX(x1,y1);var _y1=this.m_oFullTransform.TransformPointY(x1,y1);var _x2=this.m_oFullTransform.TransformPointX(x2,y2);var _y2=this.m_oFullTransform.TransformPointY(x2,y2);var _x3=this.m_oFullTransform.TransformPointX(x3,y3);var _y3=this.m_oFullTransform.TransformPointY(x3,y3);this.Bounds.CheckPoint(_x1,_y1);this.Bounds.CheckPoint(_x2,_y2);this.Bounds.CheckPoint(_x3,_y3)},_c2:function(x1,y1,x2, y2){var _x1=this.m_oFullTransform.TransformPointX(x1,y1);var _y1=this.m_oFullTransform.TransformPointY(x1,y1);var _x2=this.m_oFullTransform.TransformPointX(x2,y2);var _y2=this.m_oFullTransform.TransformPointY(x2,y2);this.Bounds.CheckPoint(_x1,_y1);this.Bounds.CheckPoint(_x2,_y2)},ds:function(){},df:function(){},save:function(){},restore:function(){},clip:function(){},reset:function(){this.m_oTransform.Reset();this.CalculateFullTransform()},transform3:function(m){this.m_oTransform=m.CreateDublicate(); this.CalculateFullTransform()},transform00:function(m){this.m_oTransform=m.CreateDublicate();this.m_oTransform.tx=0;this.m_oTransform.ty=0;this.CalculateFullTransform()},drawImage2:function(img,x,y,w,h){var _x1=this.m_oFullTransform.TransformPointX(x,y);var _y1=this.m_oFullTransform.TransformPointY(x,y);var _x2=this.m_oFullTransform.TransformPointX(x+w,y);var _y2=this.m_oFullTransform.TransformPointY(x+w,y);var _x3=this.m_oFullTransform.TransformPointX(x+w,y+h);var _y3=this.m_oFullTransform.TransformPointY(x+ w,y+h);var _x4=this.m_oFullTransform.TransformPointX(x,y+h);var _y4=this.m_oFullTransform.TransformPointY(x,y+h);this.Bounds.CheckPoint(_x1,_y1);this.Bounds.CheckPoint(_x2,_y2);this.Bounds.CheckPoint(_x3,_y3);this.Bounds.CheckPoint(_x4,_y4)},drawImage:function(img,x,y,w,h){return this.drawImage2(img,x,y,w,h)},font:function(font_id,font_size){this.m_oFontManager.LoadFontFromFile(font_id,font_size,this.m_dDpiX,this.m_dDpiY)},GetFont:function(){return this.m_oCurFont},SetFont:function(font){this.m_oCurFont= font},SetTextPr:function(textPr){this.m_oTextPr=textPr},SetFontSlot:function(slot,fontSizeKoef){},GetTextPr:function(){return this.m_oTextPr},FillText:function(x,y,text){if(this.m_bIsBreak)return;var _x=this.m_oFullTransform.TransformPointX(x,y);var _y=this.m_oFullTransform.TransformPointY(x,y);this.Bounds.CheckRect(_x,_y,1,1)},FillTextCode:function(x,y,lUnicode){if(this.m_bIsBreak)return;var _x=this.m_oFullTransform.TransformPointX(x,y);var _y=this.m_oFullTransform.TransformPointY(x,y);this.Bounds.CheckRect(_x, _y,1,1)},t:function(text,x,y){if(this.m_bIsBreak)return;var _x=this.m_oFullTransform.TransformPointX(x,y);var _y=this.m_oFullTransform.TransformPointY(x,y);this.Bounds.CheckRect(_x,_y,1,1)},FillText2:function(x,y,text,cropX,cropW){if(this.m_bIsBreak)return;var _x=this.m_oFullTransform.TransformPointX(x,y);var _y=this.m_oFullTransform.TransformPointY(x,y);this.Bounds.CheckRect(_x,_y,1,1)},t2:function(text,x,y,cropX,cropW){if(this.m_bIsBreak)return;var _x=this.m_oFullTransform.TransformPointX(x,y); var _y=this.m_oFullTransform.TransformPointY(x,y);this.Bounds.CheckRect(_x,_y,1,1)},charspace:function(space){},DrawHeaderEdit:function(yPos){},DrawFooterEdit:function(yPos){},DrawEmptyTableLine:function(x1,y1,x2,y2){},DrawSpellingLine:function(y0,x0,x1,w){},drawHorLine:function(align,y,x,r,penW){var _x1=this.m_oFullTransform.TransformPointX(x,y-penW);var _y1=this.m_oFullTransform.TransformPointY(x,y-penW);var _x2=this.m_oFullTransform.TransformPointX(x,y+penW);var _y2=this.m_oFullTransform.TransformPointY(x, y+penW);var _x3=this.m_oFullTransform.TransformPointX(r,y-penW);var _y3=this.m_oFullTransform.TransformPointY(r,y-penW);var _x4=this.m_oFullTransform.TransformPointX(r,y+penW);var _y4=this.m_oFullTransform.TransformPointY(r,y+penW);this.Bounds.CheckPoint(_x1,_y1);this.Bounds.CheckPoint(_x2,_y2);this.Bounds.CheckPoint(_x3,_y3);this.Bounds.CheckPoint(_x4,_y4)},drawHorLine2:function(align,y,x,r,penW){return this.drawHorLine(align,y,x,r,penW)},drawVerLine:function(align,x,y,b,penW){var _x1=this.m_oFullTransform.TransformPointX(x- penW,y);var _y1=this.m_oFullTransform.TransformPointY(x-penW,y);var _x2=this.m_oFullTransform.TransformPointX(x+penW,y);var _y2=this.m_oFullTransform.TransformPointY(x+penW,y);var _x3=this.m_oFullTransform.TransformPointX(x-penW,b);var _y3=this.m_oFullTransform.TransformPointY(x-penW,b);var _x4=this.m_oFullTransform.TransformPointX(x+penW,b);var _y4=this.m_oFullTransform.TransformPointY(x+penW,b);this.Bounds.CheckPoint(_x1,_y1);this.Bounds.CheckPoint(_x2,_y2);this.Bounds.CheckPoint(_x3,_y3);this.Bounds.CheckPoint(_x4, _y4)},drawHorLineExt:function(align,y,x,r,penW,leftMW,rightMW){this.drawHorLine(align,y,x+leftMW,r+rightMW)},rect:function(x,y,w,h){var _x1=this.m_oFullTransform.TransformPointX(x,y);var _y1=this.m_oFullTransform.TransformPointY(x,y);var _x2=this.m_oFullTransform.TransformPointX(x+w,y);var _y2=this.m_oFullTransform.TransformPointY(x+w,y);var _x3=this.m_oFullTransform.TransformPointX(x+w,y+h);var _y3=this.m_oFullTransform.TransformPointY(x+w,y+h);var _x4=this.m_oFullTransform.TransformPointX(x,y+h); var _y4=this.m_oFullTransform.TransformPointY(x,y+h);this.Bounds.CheckPoint(_x1,_y1);this.Bounds.CheckPoint(_x2,_y2);this.Bounds.CheckPoint(_x3,_y3);this.Bounds.CheckPoint(_x4,_y4)},rect2:function(x,y,w,h){var _x1=this.m_oFullTransform.TransformPointX(x,y);var _y1=this.m_oFullTransform.TransformPointY(x,y);var _x2=this.m_oFullTransform.TransformPointX(x+w,y);var _y2=this.m_oFullTransform.TransformPointY(x+w,y);var _x3=this.m_oFullTransform.TransformPointX(x+w,y-h);var _y3=this.m_oFullTransform.TransformPointY(x+ w,y-h);var _x4=this.m_oFullTransform.TransformPointX(x,y-h);var _y4=this.m_oFullTransform.TransformPointY(x,y-h);this.Bounds.CheckPoint(_x1,_y1);this.Bounds.CheckPoint(_x2,_y2);this.Bounds.CheckPoint(_x3,_y3);this.Bounds.CheckPoint(_x4,_y4)},TableRect:function(x,y,w,h){this.rect(x,y,w,h)},AddClipRect:function(x,y,w,h){},RemoveClipRect:function(){},SetClip:function(r){},RemoveClip:function(){},SavePen:function(){},RestorePen:function(){},SaveBrush:function(){},RestoreBrush:function(){},SavePenBrush:function(){}, RestorePenBrush:function(){},SaveGrState:function(){},RestoreGrState:function(){},StartClipPath:function(){},EndClipPath:function(){},CorrectBounds:function(){if(this.LineWidth!=null){var _correct=this.LineWidth/2;this.Bounds.min_x-=_correct;this.Bounds.min_y-=_correct;this.Bounds.max_x+=_correct;this.Bounds.max_y+=_correct}},CorrectBounds2:function(){if(this.LineWidth!=null){var _correct=this.LineWidth*this.m_oCoordTransform.sx/2;this.Bounds.min_x-=_correct;this.Bounds.min_y-=_correct;this.Bounds.max_x+= _correct;this.Bounds.max_y+=_correct}},CheckLineWidth:function(shape){if(!shape)return;var _ln=shape.pen;if(_ln!=null&&_ln.Fill!=null&&_ln.Fill.fill!=null){this.LineWidth=_ln.w==null?12700:parseInt(_ln.w);this.LineWidth/=36E3}},DrawLockObjectRect:function(){},DrawPresentationComment:function(type,x,y,w,h){this.rect(x,y,w,h)}};function GetMinSnapDistanceXObject(pointX,arrGrObjects){var min_dx=null;var ret=null;for(var i=0;i bounds.minX)minX=bounds.minX;if(minY>bounds.minY)minY=bounds.minY;if(maxX0){sResultLiter=aAlphaBet[modulo%aAlphaBet.length]+sResultLiter;modulo=modulo/aAlphaBet.length>> 0}return sResultLiter}function CMathPainter(_api){this.Api=_api;this.StartLoad=function(){var loader=AscCommon.g_font_loader;var fontinfo=g_fontApplication.GetFontInfo("Cambria Math");if(undefined===fontinfo)return;var isasync=loader.LoadFont(fontinfo,this.Api.asyncFontEndLoaded_MathDraw,this);if(false===isasync)this.Generate()};this.Generate2=function(){var bTurnOnId=false;if(false===g_oTableId.m_bTurnOff){g_oTableId.m_bTurnOff=true;bTurnOnId=true}History.TurnOff();var _math=new AscCommon.CAscMathCategory; var _canvas=document.createElement("canvas");var _sizes=[{w:24,h:24},{w:48,h:48},{w:48,h:48},{w:112,h:56},{w:60,h:60},{w:100,h:76},{w:80,h:76},{w:100,h:48},{w:100,h:40},{w:100,h:60},{w:60,h:40},{w:100,h:72}];var _excluded_arr=[c_oAscMathType.Bracket_Custom_5];var _excluded_obj={};for(var k=0;k<_excluded_arr.length;k++)_excluded_obj[""+_excluded_arr[k]]=true;var _types=[];for(var _name in c_oAscMathType){if(_excluded_obj[""+c_oAscMathType[_name]]!==undefined)continue;_types.push(c_oAscMathType[_name])}_types.sort(function(a, b){return a-b});var raster_koef=1;var _total_image=new AscFonts.CRasterHeapTotal;_total_image.CreateFirstChuck(1500*raster_koef,5E3*raster_koef);_total_image.Chunks[0].FindOnlyEqualHeight=true;_total_image.Chunks[0].CanvasCtx.globalCompositeOperation="source-over";var _types_len=_types.length;for(var t=0;t<_types_len;t++){var _type=_types[t];var _category1=_type>>24&255;var _category2=_type>>16&255;_type&=65535;if(_category1>=_sizes.length)continue;if(undefined==_math.Data[_category1]){_math.Data[_category1]= new AscCommon.CAscMathCategory;_math.Data[_category1].Id=_category1;_math.Data[_category1].W=_sizes[_category1].w;_math.Data[_category1].H=_sizes[_category1].h}if(undefined==_math.Data[_category1].Data[_category2]){_math.Data[_category1].Data[_category2]=new AscCommon.CAscMathCategory;_math.Data[_category1].Data[_category2].Id=_category2;_math.Data[_category1].Data[_category2].W=_sizes[_category1].w;_math.Data[_category1].Data[_category2].H=_sizes[_category1].h}var _menuType=new AscCommon.CAscMathType; _menuType.Id=_types[t];var _paraMath=new ParaMath;_paraMath.Root.Load_FromMenu(_menuType.Id);_paraMath.Root.Correct_Content(true);_paraMath.MathToImageConverter(false,_canvas,_sizes[_category1].w,_sizes[_category1].h,raster_koef);var _place=_total_image.Alloc(_canvas.width,_canvas.height);var _x=_place.Line.Height*_place.Index;var _y=_place.Line.Y;_menuType.X=_x;_menuType.Y=_y;_math.Data[_category1].Data[_category2].Data.push(_menuType);_total_image.Chunks[0].CanvasCtx.drawImage(_canvas,_x,_y)}var _total_w= _total_image.Chunks[0].CanvasImage.width;var _total_h=_total_image.Chunks[0].LinesFree[0].Y;var _total_canvas=document.createElement("canvas");_total_canvas.width=_total_w;_total_canvas.height=_total_h;_total_canvas.getContext("2d").drawImage(_total_image.Chunks[0].CanvasImage,0,0);var _url_total=_total_canvas.toDataURL("image/png");var _json_formulas=JSON.stringify(_math);_canvas=null;if(true===bTurnOnId)g_oTableId.m_bTurnOff=false;History.TurnOn();this.Api.sendMathTypesToMenu(_math)};this.Generate= function(){var _math_json=JSON.parse('{"Id":0,"Data":[{"Id":0,"Data":[{"Id":0,"Data":[{"Id":0,"X":0,"Y":0},{"Id":1,"X":24,"Y":0},{"Id":2,"X":48,"Y":0},{"Id":3,"X":72,"Y":0},{"Id":4,"X":96,"Y":0},{"Id":5,"X":120,"Y":0},{"Id":6,"X":144,"Y":0},{"Id":7,"X":168,"Y":0},{"Id":8,"X":192,"Y":0},{"Id":9,"X":216,"Y":0},{"Id":10,"X":240,"Y":0},{"Id":11,"X":264,"Y":0},{"Id":12,"X":288,"Y":0},{"Id":13,"X":312,"Y":0},{"Id":14,"X":336,"Y":0},{"Id":15,"X":360,"Y":0},{"Id":16,"X":384,"Y":0},{"Id":17,"X":408,"Y":0},{"Id":18,"X":432,"Y":0},{"Id":19,"X":456,"Y":0},{"Id":20,"X":480,"Y":0},{"Id":21,"X":504,"Y":0},{"Id":22,"X":528,"Y":0},{"Id":23,"X":552,"Y":0},{"Id":24,"X":576,"Y":0},{"Id":25,"X":600,"Y":0},{"Id":26,"X":624,"Y":0},{"Id":27,"X":648,"Y":0},{"Id":28,"X":672,"Y":0},{"Id":29,"X":696,"Y":0},{"Id":30,"X":720,"Y":0},{"Id":31,"X":744,"Y":0},{"Id":32,"X":768,"Y":0},{"Id":33,"X":792,"Y":0},{"Id":34,"X":816,"Y":0},{"Id":35,"X":840,"Y":0},{"Id":36,"X":864,"Y":0},{"Id":37,"X":888,"Y":0},{"Id":38,"X":912,"Y":0},{"Id":39,"X":936,"Y":0},{"Id":40,"X":960,"Y":0},{"Id":41,"X":984,"Y":0},{"Id":42,"X":1008,"Y":0},{"Id":43,"X":1032,"Y":0},{"Id":44,"X":1056,"Y":0},{"Id":45,"X":1080,"Y":0},{"Id":46,"X":1104,"Y":0},{"Id":47,"X":1128,"Y":0},{"Id":48,"X":1152,"Y":0},{"Id":49,"X":1176,"Y":0},{"Id":50,"X":1200,"Y":0},{"Id":51,"X":1224,"Y":0},{"Id":52,"X":1248,"Y":0},{"Id":53,"X":1272,"Y":0},{"Id":54,"X":1296,"Y":0},{"Id":55,"X":1320,"Y":0}],"W":24,"H":24},{"Id":1,"Data":[{"Id":65536,"X":1344,"Y":0},{"Id":65537,"X":1368,"Y":0},{"Id":65538,"X":1392,"Y":0},{"Id":65539,"X":1416,"Y":0},{"Id":65540,"X":1440,"Y":0},{"Id":65541,"X":1464,"Y":0},{"Id":65542,"X":0,"Y":24},{"Id":65543,"X":24,"Y":24},{"Id":65544,"X":48,"Y":24},{"Id":65545,"X":72,"Y":24},{"Id":65546,"X":96,"Y":24},{"Id":65547,"X":120,"Y":24},{"Id":65548,"X":144,"Y":24},{"Id":65549,"X":168,"Y":24},{"Id":65550,"X":192,"Y":24},{"Id":65551,"X":216,"Y":24},{"Id":65552,"X":240,"Y":24},{"Id":65553,"X":264,"Y":24},{"Id":65554,"X":288,"Y":24},{"Id":65555,"X":312,"Y":24},{"Id":65556,"X":336,"Y":24},{"Id":65557,"X":360,"Y":24},{"Id":65558,"X":384,"Y":24},{"Id":65559,"X":408,"Y":24},{"Id":65560,"X":432,"Y":24},{"Id":65561,"X":456,"Y":24},{"Id":65562,"X":480,"Y":24},{"Id":65563,"X":504,"Y":24},{"Id":65564,"X":528,"Y":24},{"Id":65565,"X":552,"Y":24}],"W":24,"H":24},{"Id":2,"Data":[{"Id":131072,"X":576,"Y":24},{"Id":131073,"X":600,"Y":24},{"Id":131074,"X":624,"Y":24},{"Id":131075,"X":648,"Y":24},{"Id":131076,"X":672,"Y":24},{"Id":131077,"X":696,"Y":24},{"Id":131078,"X":720,"Y":24},{"Id":131079,"X":744,"Y":24},{"Id":131080,"X":768,"Y":24},{"Id":131081,"X":792,"Y":24},{"Id":131082,"X":816,"Y":24},{"Id":131083,"X":840,"Y":24},{"Id":131084,"X":864,"Y":24},{"Id":131085,"X":888,"Y":24},{"Id":131086,"X":912,"Y":24},{"Id":131087,"X":936,"Y":24},{"Id":131088,"X":960,"Y":24},{"Id":131089,"X":984,"Y":24},{"Id":131090,"X":1008,"Y":24},{"Id":131091,"X":1032,"Y":24},{"Id":131092,"X":1056,"Y":24},{"Id":131093,"X":1080,"Y":24},{"Id":131094,"X":1104,"Y":24},{"Id":131095,"X":1128,"Y":24}],"W":24,"H":24}],"W":24,"H":24},{"Id":1,"Data":[{"Id":0,"Data":[{"Id":16777216,"X":0,"Y":48},{"Id":16777217,"X":48,"Y":48},{"Id":16777218,"X":96,"Y":48},{"Id":16777219,"X":144,"Y":48}],"W":48,"H":48},{"Id":1,"Data":[{"Id":16842752,"X":192,"Y":48},{"Id":16842753,"X":240,"Y":48},{"Id":16842754,"X":288,"Y":48},{"Id":16842755,"X":336,"Y":48},{"Id":16842756,"X":384,"Y":48}],"W":48,"H":48}],"W":48,"H":48},{"Id":2,"Data":[{"Id":0,"Data":[{"Id":33554432,"X":432,"Y":48},{"Id":33554433,"X":480,"Y":48},{"Id":33554434,"X":528,"Y":48},{"Id":33554435,"X":576,"Y":48}],"W":48,"H":48},{"Id":1,"Data":[{"Id":33619968,"X":624,"Y":48},{"Id":33619969,"X":672,"Y":48},{"Id":33619970,"X":720,"Y":48},{"Id":33619971,"X":768,"Y":48}],"W":48,"H":48}],"W":48,"H":48},{"Id":3,"Data":[{"Id":0,"Data":[{"Id":50331648,"X":0,"Y":96},{"Id":50331649,"X":112,"Y":96},{"Id":50331650,"X":224,"Y":96},{"Id":50331651,"X":336,"Y":96}],"W":112,"H":56},{"Id":1,"Data":[{"Id":50397184,"X":448,"Y":96},{"Id":50397185,"X":560,"Y":96}],"W":112,"H":56}],"W":112,"H":56},{"Id":4,"Data":[{"Id":0,"Data":[{"Id":67108864,"X":672,"Y":96},{"Id":67108865,"X":784,"Y":96},{"Id":67108866,"X":896,"Y":96},{"Id":67108867,"X":1008,"Y":96},{"Id":67108868,"X":1120,"Y":96},{"Id":67108869,"X":1232,"Y":96},{"Id":67108870,"X":1344,"Y":96},{"Id":67108871,"X":0,"Y":208},{"Id":67108872,"X":60,"Y":208}],"W":60,"H":60},{"Id":1,"Data":[{"Id":67174400,"X":120,"Y":208},{"Id":67174401,"X":180,"Y":208},{"Id":67174402,"X":240,"Y":208},{"Id":67174403,"X":300,"Y":208},{"Id":67174404,"X":360,"Y":208},{"Id":67174405,"X":420,"Y":208},{"Id":67174406,"X":480,"Y":208},{"Id":67174407,"X":540,"Y":208},{"Id":67174408,"X":600,"Y":208}],"W":60,"H":60},{"Id":2,"Data":[{"Id":67239936,"X":660,"Y":208},{"Id":67239937,"X":720,"Y":208},{"Id":67239938,"X":780,"Y":208}],"W":60,"H":60}],"W":60,"H":60},{"Id":5,"Data":[{"Id":0,"Data":[{"Id":83886080,"X":0,"Y":268},{"Id":83886081,"X":100,"Y":268},{"Id":83886082,"X":200,"Y":268},{"Id":83886083,"X":300,"Y":268},{"Id":83886084,"X":400,"Y":268}],"W":100,"H":76},{"Id":1,"Data":[{"Id":83951616,"X":500,"Y":268},{"Id":83951617,"X":600,"Y":268},{"Id":83951618,"X":700,"Y":268},{"Id":83951619,"X":800,"Y":268},{"Id":83951620,"X":900,"Y":268},{"Id":83951621,"X":1000,"Y":268},{"Id":83951622,"X":1100,"Y":268},{"Id":83951623,"X":1200,"Y":268},{"Id":83951624,"X":1300,"Y":268},{"Id":83951625,"X":1400,"Y":268}],"W":100,"H":76},{"Id":2,"Data":[{"Id":84017152,"X":0,"Y":368},{"Id":84017153,"X":100,"Y":368},{"Id":84017154,"X":200,"Y":368},{"Id":84017155,"X":300,"Y":368},{"Id":84017156,"X":400,"Y":368},{"Id":84017157,"X":500,"Y":368},{"Id":84017158,"X":600,"Y":368},{"Id":84017159,"X":700,"Y":368},{"Id":84017160,"X":800,"Y":368},{"Id":84017161,"X":900,"Y":368}],"W":100,"H":76},{"Id":3,"Data":[{"Id":84082688,"X":1000,"Y":368},{"Id":84082689,"X":1100,"Y":368},{"Id":84082690,"X":1200,"Y":368},{"Id":84082691,"X":1300,"Y":368},{"Id":84082692,"X":1400,"Y":368},{"Id":84082693,"X":0,"Y":468},{"Id":84082694,"X":100,"Y":468},{"Id":84082695,"X":200,"Y":468},{"Id":84082696,"X":300,"Y":468},{"Id":84082697,"X":400,"Y":468}],"W":100,"H":76},{"Id":4,"Data":[{"Id":84148224,"X":500,"Y":468},{"Id":84148225,"X":600,"Y":468},{"Id":84148226,"X":700,"Y":468},{"Id":84148227,"X":800,"Y":468},{"Id":84148228,"X":900,"Y":468}],"W":100,"H":76}],"W":100,"H":76},{"Id":6,"Data":[{"Id":0,"Data":[{"Id":100663296,"X":1000,"Y":468},{"Id":100663297,"X":1100,"Y":468},{"Id":100663298,"X":1200,"Y":468},{"Id":100663299,"X":1300,"Y":468},{"Id":100663300,"X":1400,"Y":468},{"Id":100663301,"X":0,"Y":568},{"Id":100663302,"X":80,"Y":568},{"Id":100663303,"X":160,"Y":568},{"Id":100663304,"X":240,"Y":568},{"Id":100663305,"X":320,"Y":568},{"Id":100663306,"X":400,"Y":568},{"Id":100663307,"X":480,"Y":568}],"W":80,"H":76},{"Id":1,"Data":[{"Id":100728832,"X":560,"Y":568},{"Id":100728833,"X":640,"Y":568},{"Id":100728834,"X":720,"Y":568},{"Id":100728835,"X":800,"Y":568}],"W":80,"H":76},{"Id":2,"Data":[{"Id":100794368,"X":880,"Y":568},{"Id":100794369,"X":960,"Y":568},{"Id":100794370,"X":1040,"Y":568},{"Id":100794371,"X":1120,"Y":568},{"Id":100794372,"X":1200,"Y":568},{"Id":100794373,"X":1280,"Y":568},{"Id":100794374,"X":1360,"Y":568},{"Id":100794375,"X":0,"Y":648},{"Id":100794376,"X":80,"Y":648},{"Id":100794377,"X":160,"Y":648},{"Id":100794378,"X":240,"Y":648},{"Id":100794379,"X":320,"Y":648},{"Id":100794380,"X":400,"Y":648},{"Id":100794381,"X":480,"Y":648},{"Id":100794382,"X":560,"Y":648},{"Id":100794383,"X":640,"Y":648},{"Id":100794384,"X":720,"Y":648},{"Id":100794385,"X":800,"Y":648}],"W":80,"H":76},{"Id":3,"Data":[{"Id":100859904,"X":880,"Y":648},{"Id":100859905,"X":960,"Y":648},{"Id":100859906,"X":1040,"Y":648},{"Id":100859907,"X":1120,"Y":648}],"W":80,"H":76},{"Id":4,"Data":[{"Id":100925441,"X":1200,"Y":648},{"Id":100925442,"X":1280,"Y":648}],"W":80,"H":76}],"W":80,"H":76},{"Id":7,"Data":[{"Id":0,"Data":[{"Id":117440512,"X":0,"Y":728},{"Id":117440513,"X":100,"Y":728},{"Id":117440514,"X":200,"Y":728},{"Id":117440515,"X":300,"Y":728},{"Id":117440516,"X":400,"Y":728},{"Id":117440517,"X":500,"Y":728}],"W":100,"H":48},{"Id":1,"Data":[{"Id":117506048,"X":600,"Y":728},{"Id":117506049,"X":700,"Y":728},{"Id":117506050,"X":800,"Y":728},{"Id":117506051,"X":900,"Y":728},{"Id":117506052,"X":1000,"Y":728},{"Id":117506053,"X":1100,"Y":728}],"W":100,"H":48},{"Id":2,"Data":[{"Id":117571584,"X":1200,"Y":728},{"Id":117571585,"X":1300,"Y":728},{"Id":117571586,"X":1400,"Y":728},{"Id":117571587,"X":0,"Y":828},{"Id":117571588,"X":100,"Y":828},{"Id":117571589,"X":200,"Y":828}],"W":100,"H":48},{"Id":3,"Data":[{"Id":117637120,"X":300,"Y":828},{"Id":117637121,"X":400,"Y":828},{"Id":117637122,"X":500,"Y":828},{"Id":117637123,"X":600,"Y":828},{"Id":117637124,"X":700,"Y":828},{"Id":117637125,"X":800,"Y":828}],"W":100,"H":48},{"Id":4,"Data":[{"Id":117702656,"X":900,"Y":828},{"Id":117702657,"X":1000,"Y":828},{"Id":117702658,"X":1100,"Y":828}],"W":100,"H":48}],"W":100,"H":48},{"Id":8,"Data":[{"Id":0,"Data":[{"Id":134217728,"X":1200,"Y":828},{"Id":134217729,"X":1300,"Y":828},{"Id":134217730,"X":1400,"Y":828},{"Id":134217731,"X":0,"Y":928},{"Id":134217732,"X":100,"Y":928},{"Id":134217733,"X":200,"Y":928},{"Id":134217734,"X":300,"Y":928},{"Id":134217735,"X":400,"Y":928},{"Id":134217736,"X":500,"Y":928},{"Id":134217737,"X":600,"Y":928},{"Id":134217738,"X":700,"Y":928},{"Id":134217739,"X":800,"Y":928},{"Id":134217740,"X":900,"Y":928},{"Id":134217741,"X":1000,"Y":928},{"Id":134217742,"X":1100,"Y":928},{"Id":134217743,"X":1200,"Y":928},{"Id":134217744,"X":1300,"Y":928},{"Id":134217745,"X":1400,"Y":928},{"Id":134217746,"X":0,"Y":1028},{"Id":134217747,"X":100,"Y":1028}],"W":100,"H":40},{"Id":1,"Data":[{"Id":134283264,"X":200,"Y":1028},{"Id":134283265,"X":300,"Y":1028}],"W":100,"H":40},{"Id":2,"Data":[{"Id":134348800,"X":400,"Y":1028},{"Id":134348801,"X":500,"Y":1028}],"W":100,"H":40},{"Id":3,"Data":[{"Id":134414336,"X":600,"Y":1028},{"Id":134414337,"X":700,"Y":1028},{"Id":134414338,"X":800,"Y":1028}],"W":100,"H":40}],"W":100,"H":40},{"Id":9,"Data":[{"Id":0,"Data":[{"Id":150994944,"X":900,"Y":1028},{"Id":150994945,"X":1000,"Y":1028},{"Id":150994946,"X":1100,"Y":1028},{"Id":150994947,"X":1200,"Y":1028},{"Id":150994948,"X":1300,"Y":1028},{"Id":150994949,"X":1400,"Y":1028}],"W":100,"H":60},{"Id":1,"Data":[{"Id":151060480,"X":0,"Y":1128},{"Id":151060481,"X":100,"Y":1128}],"W":100,"H":60}],"W":100,"H":60},{"Id":10,"Data":[{"Id":0,"Data":[{"Id":167772160,"X":840,"Y":208},{"Id":167772161,"X":900,"Y":208},{"Id":167772162,"X":960,"Y":208},{"Id":167772163,"X":1020,"Y":208},{"Id":167772164,"X":1080,"Y":208},{"Id":167772165,"X":1140,"Y":208},{"Id":167772166,"X":1200,"Y":208}],"W":60,"H":40},{"Id":1,"Data":[{"Id":167837696,"X":1260,"Y":208},{"Id":167837697,"X":1320,"Y":208},{"Id":167837698,"X":1380,"Y":208},{"Id":167837699,"X":1440,"Y":208},{"Id":167837700,"X":1360,"Y":648},{"Id":167837701,"X":200,"Y":1128},{"Id":167837702,"X":300,"Y":1128},{"Id":167837703,"X":400,"Y":1128},{"Id":167837704,"X":500,"Y":1128},{"Id":167837705,"X":600,"Y":1128},{"Id":167837706,"X":700,"Y":1128},{"Id":167837707,"X":800,"Y":1128}],"W":60,"H":40},{"Id":2,"Data":[{"Id":167903232,"X":900,"Y":1128},{"Id":167903233,"X":1000,"Y":1128}],"W":60,"H":40}],"W":60,"H":40},{"Id":11,"Data":[{"Id":0,"Data":[{"Id":184549376,"X":1100,"Y":1128},{"Id":184549377,"X":1200,"Y":1128},{"Id":184549378,"X":1300,"Y":1128},{"Id":184549379,"X":1400,"Y":1128},{"Id":184549380,"X":0,"Y":1228},{"Id":184549381,"X":100,"Y":1228},{"Id":184549382,"X":200,"Y":1228},{"Id":184549383,"X":300,"Y":1228}],"W":100,"H":72},{"Id":1,"Data":[{"Id":184614912,"X":400,"Y":1228},{"Id":184614913,"X":500,"Y":1228},{"Id":184614914,"X":600,"Y":1228},{"Id":184614915,"X":700,"Y":1228}],"W":100,"H":72},{"Id":2,"Data":[{"Id":184680448,"X":800,"Y":1228},{"Id":184680449,"X":900,"Y":1228},{"Id":184680450,"X":1000,"Y":1228},{"Id":184680451,"X":1100,"Y":1228}],"W":100,"H":72},{"Id":3,"Data":[{"Id":184745984,"X":1200,"Y":1228},{"Id":184745985,"X":1300,"Y":1228},{"Id":184745986,"X":1400,"Y":1228},{"Id":184745987,"X":0,"Y":1328}],"W":100,"H":72},{"Id":4,"Data":[{"Id":184811520,"X":100,"Y":1328},{"Id":184811521,"X":200,"Y":1328}],"W":100,"H":72}],"W":100,"H":72}],"W":0,"H":0}'); var _math=new AscCommon.CAscMathCategory;var _len1=_math_json["Data"].length;for(var i1=0;i1<_len1;i1++){var _catJS1=_math_json["Data"][i1];var _cat1=new AscCommon.CAscMathCategory;_cat1.Id=_catJS1["Id"];_cat1.W=_catJS1["W"];_cat1.H=_catJS1["H"];var _len2=_catJS1["Data"].length;for(var i2=0;i2<_len2;i2++){var _catJS2=_catJS1["Data"][i2];var _cat2=new AscCommon.CAscMathCategory;_cat2.Id=_catJS2["Id"];_cat2.W=_catJS2["W"];_cat2.H=_catJS2["H"];var _len3=_catJS2["Data"].length;for(var i3=0;i3<_len3;i3++){var _typeJS= _catJS2["Data"][i3];var _type=new AscCommon.CAscMathType;_type.Id=_typeJS["Id"];_type.X=_typeJS["X"];_type.Y=_typeJS["Y"];_cat2.Data.push(_type)}_cat1.Data.push(_cat2)}_math.Data.push(_cat1)}this.Api.sendMathTypesToMenu(_math)}}function fCreateSignatureShape(oPr,bWord,wsModel,Width,Height,sImgUrl){var oShape=new AscFormat.CShape;oShape.setWordShape(bWord===true);oShape.setBDeleted(false);if(wsModel)oShape.setWorksheet(wsModel);var oSpPr=new AscFormat.CSpPr;var oXfrm=new AscFormat.CXfrm;oXfrm.setOffX(0); oXfrm.setOffY(0);if(AscFormat.isRealNumber(Width)&&AscFormat.isRealNumber(Height)){oXfrm.setExtX(Width);oXfrm.setExtY(Height)}else{oXfrm.setExtX(1828800/36E3);oXfrm.setExtY(1828800/36E3)}if(typeof sImgUrl==="string"&&sImgUrl.length>0){var oBlipFillUnifill=AscFormat.CreateBlipFillUniFillFromUrl(sImgUrl);oSpPr.setFill(oBlipFillUnifill)}else oSpPr.setFill(AscFormat.CreateNoFillUniFill());oSpPr.setXfrm(oXfrm);oXfrm.setParent(oSpPr);oSpPr.setLn(AscFormat.CreateNoFillLine());oSpPr.setGeometry(AscFormat.CreateGeometry("rect")); oShape.setSpPr(oSpPr);oSpPr.setParent(oShape);var oSignatureLine=new AscFormat.CSignatureLine;oSignatureLine.id=AscCommon.CreateGUID();oSignatureLine.setProperties(oPr);oShape.setSignature(oSignatureLine);return oShape}function fGetListTypeFromBullet(Bullet){var ListType={Type:-1,SubType:-1};if(Bullet)if(Bullet&&Bullet.bulletType)switch(Bullet.bulletType.type){case AscFormat.BULLET_TYPE_BULLET_CHAR:{ListType.Type=0;ListType.SubType=undefined;switch(Bullet.bulletType.Char){case "\u2022":{ListType.SubType= 1;break}case "o":{ListType.SubType=2;break}case "\u00a7":{ListType.SubType=3;break}case String.fromCharCode(118):{ListType.SubType=4;break}case String.fromCharCode(216):{ListType.SubType=5;break}case String.fromCharCode(252):{ListType.SubType=6;break}case String.fromCharCode(119):{ListType.SubType=7;break}case String.fromCharCode(8211):{ListType.SubType=8;break}}break}case AscFormat.BULLET_TYPE_BULLET_BLIP:{ListType.Type=0;ListType.SubType=undefined;break}case AscFormat.BULLET_TYPE_BULLET_AUTONUM:{ListType.Type= 1;ListType.SubType=undefined;if(AscFormat.isRealNumber(Bullet.bulletType.AutoNumType)){var AutoNumType=undefined;switch(Bullet.bulletType.AutoNumType){case 1:{AutoNumType=5;break}case 2:{AutoNumType=6;break}case 5:{AutoNumType=4;break}case 11:{AutoNumType=2;break}case 12:{AutoNumType=1;break}case 31:{AutoNumType=7;break}case 34:{AutoNumType=3;break}}if(AscFormat.isRealNumber(AutoNumType)&&AutoNumType>0&&AutoNumType<9)ListType.SubType=AutoNumType}break}}return ListType}function fGetFontByNumInfo(Type, SubType){if(!AscFormat.isRealNumber(Type)||!AscFormat.isRealNumber(SubType))return null;if(SubType>=0)if(Type===0)switch(SubType){case 0:case 1:case 8:{return"Arial"}case 2:{return"Courier New"}case 3:case 4:case 5:case 6:case 7:{return"Wingdings"}}return null}function getNumberingType(nType){var numberingType=12;switch(nType){case 0:case 1:{numberingType=12;break}case 2:{numberingType=11;break}case 3:{numberingType=34;break}case 4:{numberingType=5;break}case 5:{numberingType=1;break}case 6:{numberingType= 2;break}case 7:{numberingType=31;break}case 8:{break}case 9:{break}case 10:{break}}return numberingType}function fFillBullet(NumInfo,bullet){if(NumInfo.SubType<0){bullet.bulletType=new AscFormat.CBulletType;bullet.bulletType.type=AscFormat.BULLET_TYPE_BULLET_NONE}else switch(NumInfo.Type){case 0:{switch(NumInfo.SubType){case 0:case 1:{var bulletText="\u2022";bullet.bulletTypeface=new AscFormat.CBulletTypeface;bullet.bulletTypeface.type=AscFormat.BULLET_TYPE_TYPEFACE_BUFONT;bullet.bulletTypeface.typeface= "Arial";break}case 2:{bulletText="o";bullet.bulletTypeface=new AscFormat.CBulletTypeface;bullet.bulletTypeface.type=AscFormat.BULLET_TYPE_TYPEFACE_BUFONT;bullet.bulletTypeface.typeface="Courier New";break}case 3:{bulletText="\u00a7";bullet.bulletTypeface=new AscFormat.CBulletTypeface;bullet.bulletTypeface.type=AscFormat.BULLET_TYPE_TYPEFACE_BUFONT;bullet.bulletTypeface.typeface="Wingdings";break}case 4:{bulletText=String.fromCharCode(118);bullet.bulletTypeface=new AscFormat.CBulletTypeface;bullet.bulletTypeface.type= AscFormat.BULLET_TYPE_TYPEFACE_BUFONT;bullet.bulletTypeface.typeface="Wingdings";break}case 5:{bulletText=String.fromCharCode(216);bullet.bulletTypeface=new AscFormat.CBulletTypeface;bullet.bulletTypeface.type=AscFormat.BULLET_TYPE_TYPEFACE_BUFONT;bullet.bulletTypeface.typeface="Wingdings";break}case 6:{bulletText=String.fromCharCode(252);bullet.bulletTypeface=new AscFormat.CBulletTypeface;bullet.bulletTypeface.type=AscFormat.BULLET_TYPE_TYPEFACE_BUFONT;bullet.bulletTypeface.typeface="Wingdings"; break}case 7:{bulletText=String.fromCharCode(119);bullet.bulletTypeface=new AscFormat.CBulletTypeface;bullet.bulletTypeface.type=AscFormat.BULLET_TYPE_TYPEFACE_BUFONT;bullet.bulletTypeface.typeface="Wingdings";break}case 8:{bulletText=String.fromCharCode(8211);bullet.bulletTypeface=new AscFormat.CBulletTypeface;bullet.bulletTypeface.type=AscFormat.BULLET_TYPE_TYPEFACE_BUFONT;bullet.bulletTypeface.typeface="Arial";break}}bullet.bulletType=new AscFormat.CBulletType;bullet.bulletType.type=AscFormat.BULLET_TYPE_BULLET_CHAR; bullet.bulletType.Char=bulletText;break}case 1:{bullet.bulletType=new AscFormat.CBulletType;bullet.bulletType.type=AscFormat.BULLET_TYPE_BULLET_AUTONUM;bullet.bulletType.AutoNumType=getNumberingType(NumInfo.SubType);break}default:{break}}}function fGetPresentationBulletByNumInfo(NumInfo){if(!AscFormat.isRealNumber(NumInfo.Type)&&!AscFormat.isRealNumber(NumInfo.SubType))return null;var bullet=new AscFormat.CBullet;fFillBullet(NumInfo,bullet);return bullet}function fResetConnectorsIds(aCopyObjects, oIdMaps){for(var i=0;irx&&ty>ry&&txMOVE_DELTA||Math.abs(this.startY-y)>MOVE_DELTA||this.pageIndex!==pageIndex))this.bMoved=true;var tx,ty;if(this.pageIndex!==pageIndex){var t=this.drawingObjects.drawingDocument.ConvertCoordsToAnotherPage(x,y,pageIndex,this.pageIndex);tx=t.X;ty=t.Y}else{tx=x;ty= y}this.drawingObjects.arrTrackObjects[0].track(e,tx,ty);this.drawingObjects.updateOverlay()}},onMouseUp:function(e,x,y,pageIndex){var bRet=false;if(this.bStart&&this.drawingObjects.arrTrackObjects.length>0){if(!this.bMoved&&this instanceof StartAddNewShape){var ext_x,ext_y;var oExt=AscFormat.fGetDefaultShapeExtents(this.preset);ext_x=oExt.x;ext_y=oExt.y;this.onMouseMove({IsLocked:true},this.startX+ext_x,this.startY+ext_y,this.pageIndex)}var oTrack=this.drawingObjects.arrTrackObjects[0];if(oTrack instanceof AscFormat.PolyLine)if(!oTrack.canCreateShape()){this.drawingObjects.clearTrackObjects();this.drawingObjects.clearPreTrackObjects();this.drawingObjects.updateOverlay();this.drawingObjects.changeCurrentState(new NullState(this.drawingObjects));editor.sync_StartAddShapeCallback(false);editor.sync_EndAddShape();return}var oLogicDocument=this.drawingObjects.document;oLogicDocument.StartAction(AscDFH.historydescription_Document_AddNewShape);var bounds=oTrack.getBounds();var shape=oTrack.getShape(true,this.drawingObjects.drawingDocument); var drawing=new ParaDrawing(shape.spPr.xfrm.extX,shape.spPr.xfrm.extY,shape,this.drawingObjects.drawingDocument,this.drawingObjects.document,null);var nearest_pos=this.drawingObjects.document.Get_NearestPos(this.pageIndex,bounds.min_x,bounds.min_y,true,drawing);if(nearest_pos&&false===oLogicDocument.Document_Is_SelectionLocked(AscCommon.changestype_None,{Type:AscCommon.changestype_2_Element_and_Type,Element:nearest_pos.Paragraph,CheckType:AscCommon.changestype_Paragraph_Content})){drawing.Set_DrawingType(drawing_Anchor); drawing.Set_GraphicObject(shape);shape.setParent(drawing);drawing.Set_WrappingType(WRAPPING_TYPE_NONE);drawing.Set_Distance(3.2,0,3.2,0);nearest_pos.Paragraph.Check_NearestPos(nearest_pos);nearest_pos.Page=this.pageIndex;drawing.Set_XYForAdd(shape.x,shape.y,nearest_pos,this.pageIndex);drawing.Add_ToDocument(nearest_pos,false);drawing.CheckWH();this.drawingObjects.resetSelection();shape.select(this.drawingObjects,this.pageIndex);this.drawingObjects.document.Recalculate();oLogicDocument.FinalizeAction(); if(this.preset==="textRect"){this.drawingObjects.selection.textSelection=shape;shape.selectionSetStart(e,x,y,pageIndex);shape.selectionSetEnd(e,x,y,pageIndex)}bRet=true}else{this.drawingObjects.document.Document_Undo();oLogicDocument.FinalizeAction(false)}}this.drawingObjects.clearTrackObjects();this.drawingObjects.clearPreTrackObjects();this.drawingObjects.updateOverlay();this.drawingObjects.changeCurrentState(new NullState(this.drawingObjects));editor.sync_StartAddShapeCallback(false);editor.sync_EndAddShape(); return bRet}};function NullState(drawingObjects){this.drawingObjects=drawingObjects;this.startTargetTextObject=null}NullState.prototype={onMouseDown:function(e,x,y,pageIndex,bTextFlag){var ret;var selection=this.drawingObjects.selection;var b_no_handle_selected=false;this.startTargetTextObject=AscFormat.getTargetTextObject(this.drawingObjects);var start_target_doc_content,end_target_doc_content;if(this.drawingObjects.handleEventMode===HANDLE_EVENT_MODE_HANDLE){this.drawingObjects.setStartTrackPos(x, y,pageIndex);start_target_doc_content=checkEmptyPlaceholderContent(this.drawingObjects.getTargetDocContent())}if(selection.wrapPolygonSelection){b_no_handle_selected=true;var object_page_x,object_page_y;var coords=AscFormat.CheckCoordsNeedPage(x,y,pageIndex,selection.wrapPolygonSelection.selectStartPage,this.drawingObjects.drawingDocument);object_page_x=coords.x;object_page_y=coords.y;var hit_to_wrap_polygon=selection.wrapPolygonSelection.parent.hitToWrapPolygonPoint(object_page_x,object_page_y); var wrap_polygon=selection.wrapPolygonSelection.parent.wrappingPolygon;if(hit_to_wrap_polygon.hit)if(this.drawingObjects.handleEventMode===HANDLE_EVENT_MODE_HANDLE)if(hit_to_wrap_polygon.hitType===WRAP_HIT_TYPE_POINT){if(!e.CtrlKey)this.drawingObjects.changeCurrentState(new PreChangeWrapContour(this.drawingObjects,selection.wrapPolygonSelection,hit_to_wrap_polygon.pointNum));else if(wrap_polygon.relativeArrPoints.length>3)if(false===this.drawingObjects.document.Document_Is_SelectionLocked(changestype_Drawing_Props, {Type:AscCommon.changestype_2_Element_and_Type,Element:selection.wrapPolygonSelection.parent.Get_ParentParagraph(),CheckType:AscCommon.changestype_Paragraph_Content})){this.drawingObjects.document.StartAction(AscDFH.historydescription_Document_EditWrapPolygon);var new_rel_array=[].concat(wrap_polygon.relativeArrPoints);new_rel_array.splice(hit_to_wrap_polygon.pointNum,1);wrap_polygon.setEdited(true);wrap_polygon.setArrRelPoints(new_rel_array);this.drawingObjects.document.Recalculate();this.drawingObjects.updateOverlay(); this.drawingObjects.document.FinalizeAction()}return true}else{this.drawingObjects.changeCurrentState(new PreChangeWrapContourAddPoint(this.drawingObjects,selection.wrapPolygonSelection,hit_to_wrap_polygon.pointNum1,object_page_x,object_page_y));return true}else return{objectId:selection.wrapPolygonSelection.Get_Id(),cursorType:"default"}}else if(selection.groupSelection){ret=AscFormat.handleSelectedObjects(this.drawingObjects,e,x,y,selection.groupSelection,pageIndex,true);if(ret){if(this.drawingObjects.handleEventMode=== HANDLE_EVENT_MODE_HANDLE){end_target_doc_content=checkEmptyPlaceholderContent(this.drawingObjects.getTargetDocContent());if((start_target_doc_content||end_target_doc_content)&&start_target_doc_content!==end_target_doc_content){this.drawingObjects.checkChartTextSelection(true);this.drawingObjects.drawingDocument.OnRecalculatePage(pageIndex,this.drawingObjects.document.Pages[pageIndex]);this.drawingObjects.drawingDocument.OnEndRecalculate(false,true)}}return ret}if(selection.groupSelection.selectStartPage=== pageIndex){ret=AscFormat.handleFloatObjects(this.drawingObjects,selection.groupSelection.arrGraphicObjects,e,x,y,selection.groupSelection,pageIndex,true);if(ret){if(this.drawingObjects.handleEventMode===HANDLE_EVENT_MODE_HANDLE){end_target_doc_content=checkEmptyPlaceholderContent(this.drawingObjects.getTargetDocContent());if((start_target_doc_content||end_target_doc_content)&&start_target_doc_content!==end_target_doc_content){this.drawingObjects.checkChartTextSelection(true);this.drawingObjects.drawingDocument.OnRecalculatePage(pageIndex, this.drawingObjects.document.Pages[pageIndex]);this.drawingObjects.drawingDocument.OnEndRecalculate(false,true)}}return ret}}}else if(selection.chartSelection);if(!b_no_handle_selected){ret=AscFormat.handleSelectedObjects(this.drawingObjects,e,x,y,null,pageIndex,true);if(ret){if(this.drawingObjects.handleEventMode===HANDLE_EVENT_MODE_HANDLE){end_target_doc_content=checkEmptyPlaceholderContent(this.drawingObjects.getTargetDocContent());if((start_target_doc_content||end_target_doc_content)&&start_target_doc_content!== end_target_doc_content){this.drawingObjects.checkChartTextSelection(true);this.drawingObjects.drawingDocument.OnRecalculatePage(pageIndex,this.drawingObjects.document.Pages[pageIndex]);this.drawingObjects.drawingDocument.OnEndRecalculate(false,true)}}return ret}}var drawing_page;if(this.drawingObjects.document.GetDocPosType()!==docpostype_HdrFtr)drawing_page=this.drawingObjects.graphicPages[pageIndex];else drawing_page=this.drawingObjects.getHdrFtrObjectsByPageIndex(pageIndex);if(drawing_page){ret= AscFormat.handleFloatObjects(this.drawingObjects,drawing_page.beforeTextObjects,e,x,y,null,pageIndex,true);if(ret){if(this.drawingObjects.handleEventMode===HANDLE_EVENT_MODE_HANDLE){end_target_doc_content=checkEmptyPlaceholderContent(this.drawingObjects.getTargetDocContent());if((start_target_doc_content||end_target_doc_content)&&start_target_doc_content!==end_target_doc_content){this.drawingObjects.checkChartTextSelection(true);this.drawingObjects.drawingDocument.OnRecalculatePage(pageIndex,this.drawingObjects.document.Pages[pageIndex]); this.drawingObjects.drawingDocument.OnEndRecalculate(false,true)}}return ret}var no_shape_child_array=[];for(var i=0;iMOVE_DELTA||Math.abs(y-this.dStartY)>MOVE_DELTA){this.drawingObjects.changeCurrentState(new MoveInlineObject(this.drawingObjects,this.majorObject));this.drawingObjects.OnMouseMove(e,x,y,pageIndex)}},onMouseUp:function(e,x,y,pageIndex){return AscFormat.handleMouseUpPreMoveState(this.drawingObjects, e,x,y,pageIndex,true)}};function MoveInlineObject(drawingObjects,majorObject){this.drawingObjects=drawingObjects;this.majorObject=majorObject;this.InlinePos=null}MoveInlineObject.prototype={onMouseDown:function(e,x,y,pageIndex){if(this.drawingObjects.handleEventMode===HANDLE_EVENT_MODE_CURSOR)return{cursorType:"default",objectId:this.majorObject.Get_Id()};if(this.drawingObjects.handleEventMode===HANDLE_EVENT_MODE_HANDLE){this.onMouseUp(e,x,y,pageIndex);this.drawingObjects.OnMouseDown(e,x,y,pageIndex)}}, onMouseMove:function(e,x,y,pageIndex){if(!e.IsLocked){this.onMouseUp(e,x,y,pageIndex);return}this.InlinePos=this.drawingObjects.document.Get_NearestPos(pageIndex,x,y,false,this.majorObject.parent);this.InlinePos.Page=pageIndex;this.drawingObjects.updateOverlay()},onMouseUp:function(e,x,y,pageIndex){var check_paragraphs=[];if(this.majorObject.parent.CanInsertToPos(this.InlinePos)){var oDstRun=null;var arrClasses=this.InlinePos.Paragraph.GetClassesByPos(this.InlinePos.ContentPos);for(var nIndex=arrClasses.length- 1;nIndex>=0;--nIndex)if(arrClasses[nIndex]instanceof ParaRun){oDstRun=arrClasses[nIndex];break}var oDstPictureCC=null;if(oDstRun){var arrContentControls=oDstRun.GetParentContentControls();for(var nIndex=arrContentControls.length-1;nIndex>=0;--nIndex)if(arrContentControls[nIndex].IsPicture()){oDstPictureCC=arrContentControls[nIndex];break}}if(oDstPictureCC){var arrParaDrawings=oDstPictureCC.GetAllDrawingObjects();if(this.majorObject.parent.IsPicture()&&arrParaDrawings.length>0&&!this.drawingObjects.document.IsSelectionLocked(AscCommon.changestype_None, {Type:AscCommon.changestype_Drawing_Props,Elements:[this.majorObject.parent.checkShapeChildAndGetTopParagraph(this.InlinePos.Paragraph)],CheckType:AscCommon.changestype_Paragraph_Content},false,this.drawingObjects.document.IsFillingFormMode())){this.drawingObjects.document.StartAction(AscDFH.historydescription_Document_CopyAndMoveInlineObject);var oDrawing=this.majorObject.copy(undefined);if(oDrawing.copyComments)oDrawing.copyComments(this.drawingObjects.document);oDrawing.setParent(arrParaDrawings[0]); arrParaDrawings[0].Set_GraphicObject(oDrawing);if(oDstPictureCC.IsPictureForm())oDstPictureCC.UpdatePictureFormLayout();var sKey=oDstPictureCC.GetFormKey();if(arrParaDrawings[0].IsPicture()&&sKey&&oDstPictureCC.GetLogicDocument())oDstPictureCC.GetLogicDocument().OnChangeForm(sKey,oDstPictureCC,arrParaDrawings[0].GraphicObj.getImageUrl());this.drawingObjects.resetSelection();this.drawingObjects.selectObject(oDrawing,pageIndex);this.drawingObjects.document.Recalculate();this.drawingObjects.document.FinalizeAction()}}else if(!e.CtrlKey){var arrCheckTypes= [];var parent_paragraph=this.majorObject.parent.checkShapeChildAndGetTopParagraph();check_paragraphs.push(parent_paragraph);arrCheckTypes.push(AscCommon.changestype_Drawing_Props);var new_check_paragraph=this.majorObject.parent.checkShapeChildAndGetTopParagraph(this.InlinePos.Paragraph);if(parent_paragraph!==new_check_paragraph){check_paragraphs.push(new_check_paragraph);arrCheckTypes.push(AscCommon.changestype_Paragraph_Content)}if(!this.drawingObjects.document.IsSelectionLocked(AscCommon.changestype_Drawing_Props, {Type:AscCommon.changestype_2_Element_and_Type_Array,Elements:check_paragraphs,CheckTypes:arrCheckTypes},true)){this.drawingObjects.document.StartAction(AscDFH.historydescription_Document_MoveInlineObject);this.majorObject.parent.OnEnd_MoveInline(this.InlinePos);this.drawingObjects.document.FinalizeAction()}}else{check_paragraphs.push(this.majorObject.parent.checkShapeChildAndGetTopParagraph(this.InlinePos.Paragraph));if(false===this.drawingObjects.document.Document_Is_SelectionLocked(changestype_Drawing_Props, {Type:changestype_2_ElementsArray_and_Type,Elements:check_paragraphs,CheckType:AscCommon.changestype_Paragraph_Content},true)){this.drawingObjects.document.StartAction(AscDFH.historydescription_Document_CopyAndMoveInlineObject);var new_para_drawing=new ParaDrawing(this.majorObject.parent.Extent.W,this.majorObject.parent.Extent.H,null,this.drawingObjects.drawingDocument,null,null);var drawing=this.majorObject.copy(undefined);new_para_drawing.SetForm(this.majorObject.parent.IsForm());var oRunPr=this.majorObject.parent&& this.majorObject.parent.GetRun()?this.majorObject.parent.GetRun().GetDirectTextPr():null;if(drawing.copyComments)drawing.copyComments(this.drawingObjects.document);drawing.setParent(new_para_drawing);new_para_drawing.Set_GraphicObject(drawing);new_para_drawing.Add_ToDocument(this.InlinePos,false,oRunPr);this.drawingObjects.resetSelection();this.drawingObjects.selectObject(drawing,pageIndex);this.drawingObjects.document.Recalculate();this.drawingObjects.document.FinalizeAction()}}}this.drawingObjects.changeCurrentState(new NullState(this.drawingObjects))}}; function PreRotateState(drawingObjects,majorObject){this.drawingObjects=drawingObjects;this.majorObject=majorObject}PreRotateState.prototype={onMouseDown:function(e,x,y,pageIndex){if(this.drawingObjects.handleEventMode===HANDLE_EVENT_MODE_HANDLE){this.onMouseUp(e,x,y,pageIndex);this.drawingObjects.OnMouseDown(e,x,y,pageIndex)}if(this.drawingObjects.handleEventMode===HANDLE_EVENT_MODE_CURSOR)return{cursorType:"default",objectId:this.majorObject.Get_Id(),bMarker:true}},onMouseMove:function(e,x,y,pageIndex){if(!e.IsLocked){this.onMouseUp(e, x,y,pageIndex);return}this.drawingObjects.swapTrackObjects();this.drawingObjects.changeCurrentState(new RotateState(this.drawingObjects,this.majorObject));this.drawingObjects.OnMouseMove(e,x,y,pageIndex)},onMouseUp:function(e,x,y,pageIndex){this.drawingObjects.clearPreTrackObjects();this.drawingObjects.changeCurrentState(new NullState(this.drawingObjects))}};function RotateState(drawingObjects,majorObject){this.drawingObjects=drawingObjects;this.majorObject=majorObject}RotateState.prototype={onMouseDown:function(e, x,y,pageIndex){if(this.drawingObjects.handleEventMode===HANDLE_EVENT_MODE_HANDLE){this.onMouseUp(e,x,y,pageIndex);this.drawingObjects.OnMouseDown(e,x,y,pageIndex)}if(this.drawingObjects.handleEventMode===HANDLE_EVENT_MODE_CURSOR)return{cursorType:"crosshair",objectId:this.majorObject.Get_Id(),bMarker:true}},onMouseMove:function(e,x,y,pageIndex){if(!e.IsLocked){this.onMouseUp(e,x,y,pageIndex);return}var coords=AscFormat.CheckCoordsNeedPage(x,y,pageIndex,this.majorObject.selectStartPage,this.drawingObjects.drawingDocument); this.drawingObjects.handleRotateTrack(e,coords.x,coords.y)},onMouseUp:function(e,x,y,pageIndex){var aTracks=this.drawingObjects.arrTrackObjects;if(aTracks[0]&&aTracks[0].chartSpace){if(false===this.drawingObjects.document.Document_Is_SelectionLocked(changestype_Drawing_Props,{Type:changestype_2_ElementsArray_and_Type,Elements:[],CheckType:AscCommon.changestype_Paragraph_Content},true)){this.drawingObjects.document.StartAction(AscDFH.historydescription_Document_RotateFlowDrawingNoCtrl);aTracks[0].trackEnd(); this.drawingObjects.document.Recalculate();this.drawingObjects.document.FinalizeAction()}}else{var bounds;if(this.majorObject.parent.Is_Inline&&this.majorObject.parent.Is_Inline()){if(this.drawingObjects.document.Document_Is_SelectionLocked(changestype_Drawing_Props)===false){this.drawingObjects.document.StartAction(AscDFH.historydescription_Document_RotateInlineDrawing);this.drawingObjects.arrTrackObjects[0].trackEnd(true);if(!this.drawingObjects.arrTrackObjects[0].view3D)this.majorObject.parent.CheckWH(); this.drawingObjects.document.Recalculate();this.drawingObjects.document.FinalizeAction()}}else if(this.bSamePos!==true){var aCheckParagraphs=[],aNearestPos=[],aParentParagraphs=[],aBounds=[],aDrawings=[],bMoveState=this instanceof MoveState,nearest_pos;var i,j,page_index,para_drawing;for(i=0;iMOVE_DELTA||Math.abs(this.startY- y)>MOVE_DELTA||pageIndex!==this.startPageIndex){this.drawingObjects.swapTrackObjects();this.drawingObjects.changeCurrentState(new MoveState(this.drawingObjects,this.majorObject,this.startX,this.startY));this.drawingObjects.OnMouseMove(e,x,y,pageIndex)}},onMouseUp:function(e,x,y,pageIndex){return AscFormat.handleMouseUpPreMoveState(this.drawingObjects,e,x,y,pageIndex,true)}};function MoveState(drawingObjects,majorObject,startX,startY){this.drawingObjects=drawingObjects;this.majorObject=majorObject; this.startX=startX;this.startY=startY;this.bSamePos=true}MoveState.prototype={onMouseDown:function(e,x,y,pageIndex){if(this.drawingObjects.handleEventMode===HANDLE_EVENT_MODE_HANDLE){this.onMouseUp(e,x,y,pageIndex);this.drawingObjects.OnMouseDown(e,x,y,pageIndex)}if(this.drawingObjects.handleEventMode===HANDLE_EVENT_MODE_CURSOR)return{cursorType:"default",objectId:this.majorObject.Get_Id()}},onMouseMove:function(e,x,y,pageIndex){if(!e.IsLocked){this.onMouseUp(e,x,y,pageIndex);return}var _arr_track_objects= this.drawingObjects.arrTrackObjects;var _objects_count=_arr_track_objects.length;var _object_index;var result_x,result_y;if(!e.ShiftKey){result_x=x;result_y=y}else{var abs_dist_x=Math.abs(this.startX-x);var abs_dist_y=Math.abs(this.startY-y);if(abs_dist_x>abs_dist_y){result_x=x;result_y=this.startY}else{result_x=this.startX;result_y=y}}var t=AscFormat.CheckCoordsNeedPage(x,y,pageIndex,this.majorObject.selectStartPage,this.drawingObjects.drawingDocument);var startPage=this.drawingObjects.graphicPages[this.majorObject.selectStartPage]; var startPos={x:this.startX,y:this.startY};var start_arr=startPage.beforeTextObjects.concat(startPage.inlineObjects,startPage.behindDocObjects);var min_dx=null,min_dy=null;var dx,dy;var snap_x=null,snap_y=null;var snapHorArray=[],snapVerArray=[];var page=this.drawingObjects.document.Pages[pageIndex];snapHorArray.push(page.Margins.Left);snapHorArray.push(page.Margins.Right);snapHorArray.push(page.Width/2);snapVerArray.push(page.Margins.Top);snapVerArray.push(page.Margins.Bottom);snapVerArray.push(page.Height/ 2);if(result_x===this.startX)min_dx=0;else for(var track_index=0;track_index<_arr_track_objects.length;++track_index){var cur_track_original_shape=_arr_track_objects[track_index].originalObject;var trackSnapArrayX=cur_track_original_shape.snapArrayX;if(!trackSnapArrayX)continue;var curDX=result_x-startPos.x;for(snap_index=0;snap_indexMath.abs(dx)){min_dx=dx;snap_x=snap_obj.pos}}}if(start_arr.length>0)for(var snap_index=0;snap_indexMath.abs(dx)){min_dx=dx;snap_x= snap_obj.pos}}}}if(result_y===this.startY)min_dy=0;else for(track_index=0;track_index<_arr_track_objects.length;++track_index){cur_track_original_shape=_arr_track_objects[track_index].originalObject;var trackSnapArrayY=cur_track_original_shape.snapArrayY;if(!trackSnapArrayY)continue;var curDY=result_y-startPos.y;for(snap_index=0;snap_indexMath.abs(dy)){min_dy=dy;snap_y=snap_obj.pos}}}if(start_arr.length>0)for(snap_index=0;snap_indexMath.abs(dy)){min_dy=dy;snap_y=snap_obj.pos}}}}if(min_dx=== null||Math.abs(min_dx)>SNAP_DISTANCE)min_dx=0;else if(AscFormat.isRealNumber(snap_x))this.drawingObjects.drawingDocument.DrawVerAnchor(pageIndex,snap_x);if(min_dy===null||Math.abs(min_dy)>SNAP_DISTANCE)min_dy=0;else if(AscFormat.isRealNumber(snap_y))this.drawingObjects.drawingDocument.DrawHorAnchor(pageIndex,snap_y);for(_object_index=0;_object_index<_objects_count;++_object_index)_arr_track_objects[_object_index].track(result_x-this.startX+min_dx,result_y-this.startY+min_dy,pageIndex);this.bSamePos= AscFormat.fApproxEqual(result_x-this.startX+min_dx,0)&&AscFormat.fApproxEqual(result_y-this.startY+min_dy,0)&&this.majorObject.selectStartPage===pageIndex;this.drawingObjects.updateOverlay()},onMouseUp:RotateState.prototype.onMouseUp};function PreMoveInGroupState(drawingObjects,group,startX,startY,ShiftKey,CtrlKey,majorObject,majorObjectIsSelected){this.drawingObjects=drawingObjects;this.group=group;this.startX=startX;this.startY=startY;this.ShiftKey=ShiftKey;this.CtrlKey=CtrlKey;this.majorObject= majorObject;this.majorObjectIsSelected=majorObjectIsSelected;this.startPageIndex=null;if(this.group&&this.group.parent)this.startPageIndex=this.group.parent.pageIndex}PreMoveInGroupState.prototype={onMouseDown:function(e,x,y,pageIndex){if(this.drawingObjects.handleEventMode===HANDLE_EVENT_MODE_HANDLE){this.onMouseUp(e,x,y,pageIndex);this.drawingObjects.OnMouseDown(e,x,y,pageIndex)}if(this.drawingObjects.handleEventMode===HANDLE_EVENT_MODE_CURSOR)return{cursorType:"default",objectId:this.majorObject.Get_Id()}}, onMouseMove:function(e,x,y,pageIndex){if(!e.IsLocked){this.onMouseUp(e,x,y,pageIndex);return}if(Math.abs(this.startX-x)>MOVE_DELTA||Math.abs(this.startY-y)>MOVE_DELTA||pageIndex!==this.startPageIndex){this.drawingObjects.swapTrackObjects();this.drawingObjects.changeCurrentState(new MoveInGroupState(this.drawingObjects,this.majorObject,this.group,this.startX,this.startY));this.drawingObjects.OnMouseMove(e,x,y,pageIndex)}},onMouseUp:function(e,x,y,pageIndex){if(e.CtrlKey&&this.majorObjectIsSelected){this.group.deselectObject(this.majorObject); if(this.group.selectedObjects.length===0)this.drawingObjects.resetInternalSelection();this.drawingObjects.document&&this.drawingObjects.document.Document_UpdateInterfaceState();this.drawingObjects.updateOverlay()}this.drawingObjects.clearPreTrackObjects();this.drawingObjects.changeCurrentState(new NullState(this.drawingObjects))}};function MoveInGroupState(drawingObjects,majorObject,group,startX,startY){this.drawingObjects=drawingObjects;this.majorObject=majorObject;this.group=group;this.startX=startX; this.startY=startY;this.bSamePos=true;this.startPageIndex=null;if(this.group&&this.group.parent)this.startPageIndex=this.group.parent.pageIndex}MoveInGroupState.prototype={onMouseDown:function(e,x,y,pageIndex){if(this.drawingObjects.handleEventMode===HANDLE_EVENT_MODE_HANDLE){this.onMouseUp(e,x,y,pageIndex);this.drawingObjects.OnMouseDown(e,x,y,pageIndex)}if(this.drawingObjects.handleEventMode===HANDLE_EVENT_MODE_CURSOR)return{cursorType:"default",objectId:this.majorObject.Get_Id()}},onMouseMove:MoveState.prototype.onMouseMove, onMouseUp:function(e,x,y,pageIndex){var parent_paragraph=this.group.parent.Get_ParentParagraph();var check_paragraphs=[];if(this.group.parent.Is_Inline())check_paragraphs.push(parent_paragraph);if(false===this.drawingObjects.document.Document_Is_SelectionLocked(changestype_Drawing_Props,{Type:changestype_2_ElementsArray_and_Type,Elements:check_paragraphs,CheckType:AscCommon.changestype_Paragraph_Content})){this.drawingObjects.document.StartAction(AscDFH.historydescription_Document_MoveInGroup);var i; var tracks=this.drawingObjects.arrTrackObjects;if(this instanceof MoveInGroupState&&e.CtrlKey){this.group.resetSelection();for(i=0;i>0,y:invert_transform.TransformPointY(calc_points[i].x,calc_points[i].y)/this.majorObject.extY*21600>>0};this.majorObject.parent.wrappingPolygon.setEdited(true);this.majorObject.parent.wrappingPolygon.setArrRelPoints(calc_points2);this.drawingObjects.document.Recalculate();this.drawingObjects.document.FinalizeAction()}this.drawingObjects.clearTrackObjects();this.drawingObjects.changeCurrentState(new NullState(this.drawingObjects))};function PreChangeWrapContourAddPoint(drawingObjects, majorObject,pointNum1,startX,startY){this.drawingObjects=drawingObjects;this.majorObject=majorObject;this.pointNum1=pointNum1;this.startX=startX;this.startY=startY}PreChangeWrapContourAddPoint.prototype={onMouseDown:function(e,x,y,pageIndex){if(this.drawingObjects.handleEventMode===HANDLE_EVENT_MODE_HANDLE){this.onMouseUp(e,x,y,pageIndex);this.drawingObjects.OnMouseDown(e,x,y,pageIndex)}},onMouseMove:function(e,x,y,pageIndex){if(!e.IsLocked){this.onMouseUp(e,x,y,pageIndex);return}this.drawingObjects.clearPreTrackObjects(); this.drawingObjects.addPreTrackObject(new TrackNewPointWrapPolygon(this.majorObject,this.pointNum1));this.drawingObjects.swapTrackObjects();this.drawingObjects.changeCurrentState(new ChangeWrapContourAddPoint(this.drawingObjects,this.majorObject));this.drawingObjects.OnMouseMove(e,x,y,pageIndex)},onMouseUp:function(e,x,y,pageIndex){this.drawingObjects.clearPreTrackObjects();this.drawingObjects.changeCurrentState(new NullState(this.drawingObjects))}};function ChangeWrapContourAddPoint(drawingObjects, majorObject){this.drawingObjects=drawingObjects;this.majorObject=majorObject}ChangeWrapContourAddPoint.prototype.onMouseDown=function(e,x,y,pageIndex){if(this.drawingObjects.handleEventMode===HANDLE_EVENT_MODE_HANDLE){this.onMouseUp(e,x,y,pageIndex);this.drawingObjects.OnMouseDown(e,x,y,pageIndex)}};ChangeWrapContourAddPoint.prototype.onMouseMove=function(e,x,y,pageIndex){var coords=AscFormat.CheckCoordsNeedPage(x,y,pageIndex,this.majorObject.selectStartPage);var tr_x,tr_y;tr_x=coords.x;tr_y=coords.y; this.drawingObjects.arrTrackObjects[0].track(tr_x,tr_y);this.drawingObjects.updateOverlay()};ChangeWrapContourAddPoint.prototype.onMouseUp=function(e,x,y,pageIndex){if(false===this.drawingObjects.document.Document_Is_SelectionLocked(changestype_Drawing_Props)){this.drawingObjects.document.StartAction(AscDFH.historydescription_Document_ChangeWrapContourAddPoint);var calc_points=[],calc_points2=[],i;for(i=0;i>0,y:invert_transform.TransformPointY(calc_points[i].x,calc_points[i].y)/this.majorObject.extY*21600>>0};this.majorObject.parent.wrappingPolygon.setEdited(true);this.majorObject.parent.wrappingPolygon.setArrRelPoints(calc_points2);this.drawingObjects.document.Recalculate(); this.drawingObjects.document.FinalizeAction()}this.drawingObjects.clearTrackObjects();this.drawingObjects.changeCurrentState(new NullState(this.drawingObjects))};function SplineBezierState(drawingObjects){this.drawingObjects=drawingObjects;this.polylineFlag=true}SplineBezierState.prototype={onMouseDown:function(e,x,y,pageIndex){if(this.drawingObjects.handleEventMode===HANDLE_EVENT_MODE_CURSOR)return{objectId:null,bMarker:true};this.drawingObjects.startTrackPos={x:x,y:y,pageIndex:pageIndex};this.drawingObjects.clearTrackObjects(); this.drawingObjects.clearPreTrackObjects();this.drawingObjects.addPreTrackObject(new AscFormat.Spline(this.drawingObjects,this.drawingObjects.document.theme,null,null,null,pageIndex));this.drawingObjects.arrPreTrackObjects[0].path.push(new AscFormat.SplineCommandMoveTo(x,y));this.drawingObjects.changeCurrentState(new SplineBezierState33(this.drawingObjects,x,y,pageIndex));this.drawingObjects.resetSelection();this.drawingObjects.updateOverlay()},onMouseMove:function(e,X,Y,pageIndex){},onMouseUp:function(e, X,Y,pageIndex){this.drawingObjects.changeCurrentState(new NullState(this.drawingObjects))}};function SplineBezierState33(drawingObjects,startX,startY,pageIndex){this.drawingObjects=drawingObjects;this.polylineFlag=true;this.pageIndex=pageIndex}SplineBezierState33.prototype={onMouseDown:function(e,x,y,pageIndex){if(this.drawingObjects.handleEventMode===HANDLE_EVENT_MODE_CURSOR)return{objectId:null,bMarker:true}},onMouseMove:function(e,x,y,pageIndex){var startPos=this.drawingObjects.startTrackPos;if(startPos.x=== x&&startPos.y===y&&startPos.pageIndex===pageIndex)return;var tr_x,tr_y;if(pageIndex===startPos.pageIndex){tr_x=x;tr_y=y}else{var tr_point=this.drawingObjects.drawingDocument.ConvertCoordsToAnotherPage(x,y,pageIndex,startPos.pageIndex);tr_x=tr_point.X;tr_y=tr_point.Y}this.drawingObjects.swapTrackObjects();this.drawingObjects.arrTrackObjects[0].path.push(new AscFormat.SplineCommandLineTo(tr_x,tr_y));this.drawingObjects.changeCurrentState(new SplineBezierState2(this.drawingObjects,this.pageIndex));this.drawingObjects.updateOverlay()}, onMouseUp:function(e,x,y,pageIndex){}};function SplineBezierState2(drawingObjects,pageIndex){this.drawingObjects=drawingObjects;this.polylineFlag=true;this.pageIndex=pageIndex}SplineBezierState2.prototype={onMouseDown:function(e,x,y,pageIndex){if(this.drawingObjects.handleEventMode===HANDLE_EVENT_MODE_CURSOR)return{objectId:null,bMarker:true};if(e.ClickCount>=2){this.bStart=true;this.pageIndex=this.drawingObjects.startTrackPos.pageIndex;StartAddNewShape.prototype.onMouseUp.call(this,e,x,y,pageIndex)}}, onMouseMove:function(e,x,y,pageIndex){var startPos=this.drawingObjects.startTrackPos;var tr_x,tr_y;if(pageIndex===startPos.pageIndex){tr_x=x;tr_y=y}else{var tr_point=this.drawingObjects.drawingDocument.ConvertCoordsToAnotherPage(x,y,pageIndex,startPos.pageIndex);tr_x=tr_point.X;tr_y=tr_point.Y}this.drawingObjects.arrTrackObjects[0].path[1].changeLastPoint(tr_x,tr_y);this.drawingObjects.updateOverlay()},onMouseUp:function(e,x,y,pageIndex){if(e.ClickCount<2){var tr_x,tr_y;if(pageIndex===this.drawingObjects.startTrackPos.pageIndex){tr_x= x;tr_y=y}else{var tr_point=this.drawingObjects.drawingDocument.ConvertCoordsToAnotherPage(x,y,pageIndex,this.drawingObjects.startTrackPos.pageIndex);tr_x=tr_point.x;tr_y=tr_point.y}this.drawingObjects.changeCurrentState(new SplineBezierState3(this.drawingObjects,tr_x,tr_y,this.pageIndex))}}};function SplineBezierState3(drawingObjects,startX,startY,pageIndex){this.drawingObjects=drawingObjects;this.startX=startX;this.startY=startY;this.polylineFlag=true;this.pageIndex=pageIndex}SplineBezierState3.prototype= {onMouseDown:function(e,x,y,pageIndex){if(this.drawingObjects.handleEventMode===HANDLE_EVENT_MODE_CURSOR)return{objectId:null,bMarker:true};if(e.ClickCount>=2){this.bStart=true;this.pageIndex=this.drawingObjects.startTrackPos.pageIndex;StartAddNewShape.prototype.onMouseUp.call(this,e,x,y,pageIndex)}},onMouseMove:function(e,x,y,pageIndex){if(x===this.startX&&y===this.startY&&pageIndex===this.drawingObjects.startTrackPos.pageIndex)return;var tr_x,tr_y;if(pageIndex===this.drawingObjects.startTrackPos.pageIndex){tr_x= x;tr_y=y}else{var tr_point=this.drawingObjects.drawingDocument.ConvertCoordsToAnotherPage(x,y,pageIndex,this.drawingObjects.startTrackPos.pageIndex);tr_x=tr_point.X;tr_y=tr_point.Y}var x0,y0,x1,y1,x2,y2,x3,y3,x4,y4,x5,y5,x6,y6;var spline=this.drawingObjects.arrTrackObjects[0];x0=spline.path[0].x;y0=spline.path[0].y;x3=spline.path[1].x;y3=spline.path[1].y;x6=tr_x;y6=tr_y;var vx=(x6-x0)/6;var vy=(y6-y0)/6;x2=x3-vx;y2=y3-vy;x4=x3+vx;y4=y3+vy;x1=(x0+x2)*.5;y1=(y0+y2)*.5;x5=(x4+x6)*.5;y5=(y4+y6)*.5;spline.path.length= 1;spline.path.push(new AscFormat.SplineCommandBezier(x1,y1,x2,y2,x3,y3));spline.path.push(new AscFormat.SplineCommandBezier(x4,y4,x5,y5,x6,y6));this.drawingObjects.updateOverlay();this.drawingObjects.changeCurrentState(new SplineBezierState4(this.drawingObjects,this.pageIndex))},onMouseUp:function(e,x,y,pageIndex){if(e.ClickCount>=2){this.bStart=true;this.pageIndex=this.drawingObjects.startTrackPos.pageIndex;StartAddNewShape.prototype.onMouseUp.call(this,e,x,y,pageIndex)}}};function SplineBezierState4(drawingObjects, pageIndex){this.drawingObjects=drawingObjects;this.polylineFlag=true;this.pageIndex=pageIndex}SplineBezierState4.prototype={onMouseDown:function(e,x,y,pageIndex){if(this.drawingObjects.handleEventMode===HANDLE_EVENT_MODE_CURSOR)return{objectId:null,bMarker:true};if(e.ClickCount>=2){this.bStart=true;this.pageIndex=this.drawingObjects.startTrackPos.pageIndex;StartAddNewShape.prototype.onMouseUp.call(this,e,x,y,pageIndex)}},onMouseMove:function(e,x,y,pageIndex){var spline=this.drawingObjects.arrTrackObjects[0]; var lastCommand=spline.path[spline.path.length-1];var preLastCommand=spline.path[spline.path.length-2];var x0,y0,x1,y1,x2,y2,x3,y3,x4,y4,x5,y5,x6,y6;if(spline.path[spline.path.length-3].id==0){x0=spline.path[spline.path.length-3].x;y0=spline.path[spline.path.length-3].y}else{x0=spline.path[spline.path.length-3].x3;y0=spline.path[spline.path.length-3].y3}x3=preLastCommand.x3;y3=preLastCommand.y3;var tr_x,tr_y;if(pageIndex===this.drawingObjects.startTrackPos.pageIndex){tr_x=x;tr_y=y}else{var tr_point= this.drawingObjects.drawingDocument.ConvertCoordsToAnotherPage(x,y,pageIndex,this.drawingObjects.startTrackPos.pageIndex);tr_x=tr_point.X;tr_y=tr_point.Y}x6=tr_x;y6=tr_y;var vx=(x6-x0)/6;var vy=(y6-y0)/6;x2=x3-vx;y2=y3-vy;x4=x3+vx;y4=y3+vy;x5=(x4+x6)*.5;y5=(y4+y6)*.5;if(spline.path[spline.path.length-3].id==0){preLastCommand.x1=(x0+x2)*.5;preLastCommand.y1=(y0+y2)*.5}preLastCommand.x2=x2;preLastCommand.y2=y2;preLastCommand.x3=x3;preLastCommand.y3=y3;lastCommand.x1=x4;lastCommand.y1=y4;lastCommand.x2= x5;lastCommand.y2=y5;lastCommand.x3=x6;lastCommand.y3=y6;this.drawingObjects.updateOverlay()},onMouseUp:function(e,x,y,pageIndex){if(e.ClickCount<2){var tr_x,tr_y;if(pageIndex===this.drawingObjects.startTrackPos.pageIndex){tr_x=x;tr_y=y}else{var tr_point=this.drawingObjects.drawingDocument.ConvertCoordsToAnotherPage(x,y,pageIndex,this.drawingObjects.startTrackPos.pageIndex);tr_x=tr_point.X;tr_y=tr_point.Y}this.drawingObjects.changeCurrentState(new SplineBezierState5(this.drawingObjects,tr_x,tr_y, this.pageIndex))}}};function SplineBezierState5(drawingObjects,startX,startY,pageIndex){this.drawingObjects=drawingObjects;this.startX=startX;this.startY=startY;this.polylineFlag=true;this.pageIndex=pageIndex}SplineBezierState5.prototype={onMouseDown:function(e,x,y,pageIndex){if(this.drawingObjects.handleEventMode===HANDLE_EVENT_MODE_CURSOR)return{objectId:null,bMarker:true};if(e.ClickCount>=2){this.bStart=true;this.pageIndex=this.drawingObjects.startTrackPos.pageIndex;StartAddNewShape.prototype.onMouseUp.call(this, e,x,y,pageIndex)}},onMouseMove:function(e,x,y,pageIndex){if(x===this.startX&&y===this.startY&&pageIndex===this.drawingObjects.startTrackPos.pageIndex)return;var spline=this.drawingObjects.arrTrackObjects[0];var lastCommand=spline.path[spline.path.length-1];var x0,y0,x1,y1,x2,y2,x3,y3,x4,y4,x5,y5,x6,y6;if(spline.path[spline.path.length-2].id==0){x0=spline.path[spline.path.length-2].x;y0=spline.path[spline.path.length-2].y}else{x0=spline.path[spline.path.length-2].x3;y0=spline.path[spline.path.length- 2].y3}x3=lastCommand.x3;y3=lastCommand.y3;var tr_x,tr_y;if(pageIndex===this.drawingObjects.startTrackPos.pageIndex){tr_x=x;tr_y=y}else{var tr_point=this.drawingObjects.drawingDocument.ConvertCoordsToAnotherPage(x,y,pageIndex,this.drawingObjects.startTrackPos.pageIndex);tr_x=tr_point.X;tr_y=tr_point.Y}x6=tr_x;y6=tr_y;var vx=(x6-x0)/6;var vy=(y6-y0)/6;x2=x3-vx;y2=y3-vy;x1=(x2+x1)*.5;y1=(y2+y1)*.5;x4=x3+vx;y4=y3+vy;x5=(x4+x6)*.5;y5=(y4+y6)*.5;if(spline.path[spline.path.length-2].id==0){lastCommand.x1= x1;lastCommand.y1=y1}lastCommand.x2=x2;lastCommand.y2=y2;spline.path.push(new AscFormat.SplineCommandBezier(x4,y4,x5,y5,x6,y6));this.drawingObjects.updateOverlay();this.drawingObjects.changeCurrentState(new SplineBezierState4(this.drawingObjects,this.pageIndex))},onMouseUp:function(e,x,y,pageIndex){if(e.ClickCount>=2){this.bStart=true;this.pageIndex=this.drawingObjects.startTrackPos.pageIndex;StartAddNewShape.prototype.onMouseUp.call(this,e,x,y,pageIndex)}}};function PolyLineAddState(drawingObjects){this.drawingObjects= drawingObjects;this.polylineFlag=true}PolyLineAddState.prototype={onMouseDown:function(e,x,y,pageIndex){if(this.drawingObjects.handleEventMode===HANDLE_EVENT_MODE_CURSOR)return{objectId:null,bMarker:true};this.drawingObjects.startTrackPos={x:x,y:y,pageIndex:pageIndex};this.drawingObjects.clearTrackObjects();this.drawingObjects.addTrackObject(new AscFormat.PolyLine(this.drawingObjects,this.drawingObjects.document.theme,null,null,null,pageIndex));this.drawingObjects.arrTrackObjects[0].tryAddPoint(x, y);this.drawingObjects.resetSelection();this.drawingObjects.updateOverlay();var _min_distance=this.drawingObjects.drawingDocument.GetMMPerDot(1);this.drawingObjects.changeCurrentState(new PolyLineAddState2(this.drawingObjects,_min_distance,pageIndex))},onMouseMove:function(){},onMouseUp:function(){this.drawingObjects.changeCurrentState(new NullState(this.drawingObjects))}};function PolyLineAddState2(drawingObjects,minDistance,pageIndex){this.drawingObjects=drawingObjects;this.minDistance=minDistance; this.polylineFlag=true;this.pageIndex=pageIndex}PolyLineAddState2.prototype={onMouseDown:function(e,x,y,pageIndex){if(this.drawingObjects.handleEventMode===HANDLE_EVENT_MODE_CURSOR)return{objectId:null,bMarker:true}},onMouseMove:function(e,x,y,pageIndex){var tr_x,tr_y;if(pageIndex===this.drawingObjects.startTrackPos.pageIndex){tr_x=x;tr_y=y}else{var tr_point=this.drawingObjects.drawingDocument.ConvertCoordsToAnotherPage(x,y,pageIndex,this.drawingObjects.startTrackPos.pageIndex);tr_x=tr_point.X;tr_y= tr_point.Y}this.drawingObjects.arrTrackObjects[0].tryAddPoint(tr_x,tr_y);this.drawingObjects.updateOverlay()},onMouseUp:function(e,x,y,pageIndex){if(this.drawingObjects.arrTrackObjects[0].canCreateShape()){this.bStart=true;this.pageIndex=this.drawingObjects.startTrackPos.pageIndex;StartAddNewShape.prototype.onMouseUp.call(this,e,x,y,pageIndex)}else{this.drawingObjects.clearTrackObjects();this.drawingObjects.updateOverlay();this.drawingObjects.changeCurrentState(new NullState(this.drawingObjects))}}}; function AddPolyLine2State(drawingObjects){this.drawingObjects=drawingObjects;this.polylineFlag=true}AddPolyLine2State.prototype={onMouseDown:function(e,x,y,pageIndex){if(this.drawingObjects.handleEventMode===HANDLE_EVENT_MODE_CURSOR)return{objectId:null,bMarker:true};this.drawingObjects.startTrackPos={x:x,y:y,pageIndex:pageIndex};this.drawingObjects.resetSelection();this.drawingObjects.updateOverlay();this.drawingObjects.clearTrackObjects();this.drawingObjects.clearPreTrackObjects();this.drawingObjects.addPreTrackObject(new AscFormat.PolyLine(this.drawingObjects, this.drawingObjects.document.theme,null,null,null,pageIndex));this.drawingObjects.arrPreTrackObjects[0].tryAddPoint(x,y);this.drawingObjects.changeCurrentState(new AddPolyLine2State2(this.drawingObjects,x,y))},onMouseMove:function(e,x,y,pageIndex){},onMouseUp:function(e,x,y,pageIndex){}};function AddPolyLine2State2(drawingObjects,x,y){this.drawingObjects=drawingObjects;this.X=x;this.Y=y;this.polylineFlag=true}AddPolyLine2State2.prototype={onMouseDown:function(e,x,y,pageIndex){if(this.drawingObjects.handleEventMode=== HANDLE_EVENT_MODE_CURSOR)return{objectId:null,bMarker:true};if(e.ClickCount>1){this.drawingObjects.clearTrackObjects();this.drawingObjects.clearPreTrackObjects();this.drawingObjects.changeCurrentState(new NullState(this.drawingObjects))}},onMouseMove:function(e,x,y,pageIndex){if(this.X!==x||this.Y!==y||this.drawingObjects.startTrackPos.pageIndex!==pageIndex){var tr_x,tr_y;if(pageIndex===this.drawingObjects.startTrackPos.pageIndex){tr_x=x;tr_y=y}else{var tr_point=this.drawingObjects.drawingDocument.ConvertCoordsToAnotherPage(x, y,pageIndex,this.drawingObjects.startTrackPos.pageIndex);tr_x=tr_point.X;tr_y=tr_point.Y}this.drawingObjects.swapTrackObjects();this.drawingObjects.arrTrackObjects[0].tryAddPoint(tr_x,tr_y);this.drawingObjects.changeCurrentState(new AddPolyLine2State3(this.drawingObjects,pageIndex))}},onMouseUp:function(e,x,y,pageIndex){}};function AddPolyLine2State3(drawingObjects,pageIndex){this.drawingObjects=drawingObjects;this.lastX=-1E3;this.lastY=-1E3;this.polylineFlag=true;this.pageIndex=pageIndex}AddPolyLine2State3.prototype= {onMouseDown:function(e,x,y,pageIndex){if(this.drawingObjects.handleEventMode===HANDLE_EVENT_MODE_CURSOR)return{objectId:null,bMarker:true};this.lastX=x;this.lastY=y;var tr_x,tr_y;if(pageIndex===this.drawingObjects.startTrackPos.pageIndex){tr_x=x;tr_y=y}else{var tr_point=this.drawingObjects.drawingDocument.ConvertCoordsToAnotherPage(x,y,pageIndex,this.drawingObjects.startTrackPos.pageIndex);tr_x=tr_point.X;tr_y=tr_point.Y}if(e.ClickCount>1){this.bStart=true;this.pageIndex=this.drawingObjects.startTrackPos.pageIndex; StartAddNewShape.prototype.onMouseUp.call(this,e,x,y,pageIndex)}else{var oTrack=this.drawingObjects.arrTrackObjects[0];oTrack.replaceLastPoint(tr_x,tr_y,false);oTrack.addPoint(tr_x,tr_y,true)}},onMouseMove:function(e,x,y,pageIndex){if(AscFormat.fApproxEqual(x,this.lastX)&&AscFormat.fApproxEqual(y,this.lastY))return;var tr_x,tr_y;if(pageIndex===this.drawingObjects.startTrackPos.pageIndex){tr_x=x;tr_y=y}else{var tr_point=this.drawingObjects.drawingDocument.ConvertCoordsToAnotherPage(x,y,pageIndex,this.drawingObjects.startTrackPos.pageIndex); tr_x=tr_point.X;tr_y=tr_point.Y}var oTrack=this.drawingObjects.arrTrackObjects[0];if(!e.IsLocked&&oTrack.getPointsCount()>1)oTrack.replaceLastPoint(tr_x,tr_y,true);else oTrack.tryAddPoint(tr_x,tr_y);this.drawingObjects.drawingDocument.m_oWordControl.OnUpdateOverlay();this.lastX=x;this.lastY=y},onMouseUp:function(e,x,y,pageIndex){this.lastX=x;this.lastY=y;if(e.ClickCount>1){this.bStart=true;this.pageIndex=this.drawingObjects.startTrackPos.pageIndex;StartAddNewShape.prototype.onMouseUp.call(this,e, x,y,pageIndex)}}};window["AscFormat"]=window["AscFormat"]||{};window["AscFormat"].MOVE_DELTA=MOVE_DELTA;window["AscFormat"].SNAP_DISTANCE=SNAP_DISTANCE;window["AscFormat"].StartAddNewShape=StartAddNewShape;window["AscFormat"].NullState=NullState;window["AscFormat"].PreChangeAdjState=PreChangeAdjState;window["AscFormat"].PreMoveInlineObject=PreMoveInlineObject;window["AscFormat"].PreRotateState=PreRotateState;window["AscFormat"].PreResizeState=PreResizeState;window["AscFormat"].PreMoveState=PreMoveState; window["AscFormat"].MoveState=MoveState;window["AscFormat"].PreMoveInGroupState=PreMoveInGroupState;window["AscFormat"].MoveInGroupState=MoveInGroupState;window["AscFormat"].PreRotateInGroupState=PreRotateInGroupState;window["AscFormat"].PreResizeInGroupState=PreResizeInGroupState;window["AscFormat"].PreChangeAdjInGroupState=PreChangeAdjInGroupState;window["AscFormat"].TextAddState=TextAddState;window["AscFormat"].SplineBezierState=SplineBezierState;window["AscFormat"].PolyLineAddState=PolyLineAddState; window["AscFormat"].AddPolyLine2State=AddPolyLine2State})(window);"use strict";(function(window,undefined){var drawingsChangesMap={};var drawingConstructorsMap={};var drawingContentChanges={};window["AscDFH"].drawingsChangesMap=drawingsChangesMap;window["AscDFH"].drawingsConstructorsMap=drawingConstructorsMap;window["AscDFH"].drawingContentChanges=drawingContentChanges;var oPosExtMap={};oPosExtMap[AscDFH.historyitem_Xfrm_SetOffX]=true;oPosExtMap[AscDFH.historyitem_Xfrm_SetOffY]=true;oPosExtMap[AscDFH.historyitem_Xfrm_SetExtX]= true;oPosExtMap[AscDFH.historyitem_Xfrm_SetExtY]=true;oPosExtMap[AscDFH.historyitem_Xfrm_SetChOffX]=true;oPosExtMap[AscDFH.historyitem_Xfrm_SetChOffY]=true;oPosExtMap[AscDFH.historyitem_Xfrm_SetChExtX]=true;oPosExtMap[AscDFH.historyitem_Xfrm_SetChExtY]=true;var oPosExtHor={};oPosExtHor[AscDFH.historyitem_Xfrm_SetOffX]=true;oPosExtHor[AscDFH.historyitem_Xfrm_SetExtX]=true;oPosExtHor[AscDFH.historyitem_Xfrm_SetChOffX]=true;oPosExtHor[AscDFH.historyitem_Xfrm_SetChExtX]=true;function private_SetValue(Value){if(!this.Class)return; if(AscDFH.drawingsChangesMap[this.Type]){var _Value=Value===undefined?null:Value;AscDFH.drawingsChangesMap[this.Type](this.Class,_Value,this.FromLoad)}}function CChangesDrawingsBool(Class,Type,OldPr,NewPr){this.Type=Type;var _OldPr=AscFormat.isRealBool(OldPr)?OldPr:undefined;var _NewPr=AscFormat.isRealBool(NewPr)?NewPr:undefined;AscDFH.CChangesBaseBoolProperty.call(this,Class,_OldPr,_NewPr)}CChangesDrawingsBool.prototype=Object.create(AscDFH.CChangesBaseBoolProperty.prototype);CChangesDrawingsBool.prototype.constructor= CChangesDrawingsBool;CChangesDrawingsBool.prototype.private_SetValue=private_SetValue;CChangesDrawingsBool.prototype.Load=function(){this.Redo();this.RefreshRecalcData()};CChangesDrawingsBool.prototype.CreateReverseChange=function(){return new this.constructor(this.Class,this.Type,this.New,this.Old,this.Color)};CChangesDrawingsBool.prototype.ReadFromBinary=function(reader){reader.Seek2(reader.GetCurPos()-4);this.Type=reader.GetLong();AscDFH.CChangesBaseBoolProperty.prototype.ReadFromBinary.call(this, reader)};window["AscDFH"].CChangesDrawingsBool=CChangesDrawingsBool;function CChangesDrawingsLong(Class,Type,OldPr,NewPr){this.Type=Type;var _OldPr=AscFormat.isRealNumber(OldPr)?OldPr+.5>>0:undefined;var _NewPr=AscFormat.isRealNumber(NewPr)?NewPr+.5>>0:undefined;AscDFH.CChangesBaseLongProperty.call(this,Class,_OldPr,_NewPr)}CChangesDrawingsLong.prototype=Object.create(AscDFH.CChangesBaseLongProperty.prototype);CChangesDrawingsLong.prototype.constructor=CChangesDrawingsLong;CChangesDrawingsLong.prototype.CreateReverseChange= function(){return new this.constructor(this.Class,this.Type,this.New,this.Old,this.Color)};CChangesDrawingsLong.prototype.private_SetValue=private_SetValue;CChangesDrawingsLong.prototype.Load=function(){this.Redo();this.RefreshRecalcData()};CChangesDrawingsLong.prototype.ReadFromBinary=function(reader){reader.Seek2(reader.GetCurPos()-4);this.Type=reader.GetLong();AscDFH.CChangesBaseLongProperty.prototype.ReadFromBinary.call(this,reader)};window["AscDFH"].CChangesDrawingsLong=CChangesDrawingsLong; function CChangesDrawingsDouble(Class,Type,OldPr,NewPr){this.Type=Type;var _OldPr=AscFormat.isRealNumber(OldPr)?OldPr:undefined;var _NewPr=AscFormat.isRealNumber(NewPr)?NewPr:undefined;AscDFH.CChangesBaseDoubleProperty.call(this,Class,_OldPr,_NewPr)}CChangesDrawingsDouble.prototype=Object.create(AscDFH.CChangesBaseDoubleProperty.prototype);CChangesDrawingsDouble.prototype.constructor=CChangesDrawingsDouble;CChangesDrawingsDouble.prototype.CreateReverseChange=function(){return new this.constructor(this.Class, this.Type,this.New,this.Old,this.Color)};CChangesDrawingsDouble.prototype.private_SetValue=private_SetValue;CChangesDrawingsDouble.prototype.Load=function(){this.Redo();this.RefreshRecalcData()};CChangesDrawingsDouble.prototype.ReadFromBinary=function(reader){reader.Seek2(reader.GetCurPos()-4);this.Type=reader.GetLong();AscDFH.CChangesBaseDoubleProperty.prototype.ReadFromBinary.call(this,reader)};CChangesDrawingsDouble.prototype.IsPosExtChange=function(){return!!oPosExtMap[this.Type]};CChangesDrawingsDouble.prototype.IsHorizontal= function(){return!!oPosExtHor[this.Type]};window["AscDFH"].CChangesDrawingsDouble=CChangesDrawingsDouble;function CChangesDrawingsDouble2(Class,Type,OldPr,NewPr){this.Type=Type;var _OldPr=AscFormat.isRealNumber(OldPr)?OldPr:undefined;var _NewPr=AscFormat.isRealNumber(NewPr)?NewPr:undefined;AscDFH.CChangesBaseDoubleProperty.call(this,Class,_OldPr,_NewPr)}CChangesDrawingsDouble2.prototype=Object.create(AscDFH.CChangesBaseDoubleProperty.prototype);CChangesDrawingsDouble2.prototype.constructor=CChangesDrawingsDouble2; CChangesDrawingsDouble2.prototype.CreateReverseChange=function(){return new this.constructor(this.Class,this.Type,this.New,this.Old,this.Color)};CChangesDrawingsDouble2.prototype.private_SetValue=private_SetValue;CChangesDrawingsDouble2.prototype.Load=function(){this.Redo();this.RefreshRecalcData()};CChangesDrawingsDouble2.prototype.WriteToBinary=function(Writer){var nFlags=0;if(false!==this.Color)nFlags|=1;if(undefined===this.New)nFlags|=2;if(undefined===this.Old)nFlags|=4;Writer.WriteLong(nFlags); if(undefined!==this.New)Writer.WriteDouble2(this.New);if(undefined!==this.Old)Writer.WriteDouble2(this.Old)};CChangesDrawingsDouble2.prototype.ReadFromBinary=function(Reader){Reader.Seek2(Reader.GetCurPos()-4);this.Type=Reader.GetLong();var nFlags=Reader.GetLong();if(nFlags&1)this.Color=true;else this.Color=false;if(nFlags&2)this.New=undefined;else this.New=Reader.GetDoubleLE();if(nFlags&4)this.Old=undefined;else this.Old=Reader.GetDoubleLE()};CChangesDrawingsDouble2.prototype.IsPosExtChange=function(){return!!oPosExtMap[this.Type]}; CChangesDrawingsDouble2.prototype.IsHorizontal=function(){return!!oPosExtHor[this.Type]};window["AscDFH"].CChangesDrawingsDouble2=CChangesDrawingsDouble2;function CChangesDrawingsString(Class,Type,OldPr,NewPr){this.Type=Type;var _OldPr=typeof OldPr==="string"?OldPr:undefined;var _NewPr=typeof NewPr==="string"?NewPr:undefined;AscDFH.CChangesBaseStringProperty.call(this,Class,_OldPr,_NewPr)}CChangesDrawingsString.prototype=Object.create(AscDFH.CChangesBaseStringProperty.prototype);CChangesDrawingsString.prototype.constructor= CChangesDrawingsString;CChangesDrawingsString.prototype.CreateReverseChange=function(){return new this.constructor(this.Class,this.Type,this.New,this.Old,this.Color)};CChangesDrawingsString.prototype.private_SetValue=private_SetValue;CChangesDrawingsString.prototype.Load=function(){this.Redo();this.RefreshRecalcData()};CChangesDrawingsString.prototype.ReadFromBinary=function(reader){reader.Seek2(reader.GetCurPos()-4);this.Type=reader.GetLong();AscDFH.CChangesBaseStringProperty.prototype.ReadFromBinary.call(this, reader)};window["AscDFH"].CChangesDrawingsString=CChangesDrawingsString;function CChangesDrawingsObjectNoId(Class,Type,OldPr,NewPr){this.Type=Type;this.FromLoad=false;var _OldPr=AscCommon.isRealObject(OldPr)?OldPr:undefined;var _NewPr=AscCommon.isRealObject(NewPr)?NewPr:undefined;AscDFH.CChangesBaseObjectProperty.call(this,Class,_OldPr,_NewPr)}CChangesDrawingsObjectNoId.prototype=Object.create(AscDFH.CChangesBaseObjectProperty.prototype);CChangesDrawingsObjectNoId.prototype.constructor=CChangesDrawingsObjectNoId; CChangesDrawingsObjectNoId.prototype.CreateReverseChange=function(){return new this.constructor(this.Class,this.Type,this.New,this.Old,this.Color)};CChangesDrawingsObjectNoId.prototype.private_SetValue=private_SetValue;CChangesDrawingsObjectNoId.prototype.Load=function(){this.Redo();this.RefreshRecalcData()};window["AscDFH"].CChangesDrawingsObjectNoId=CChangesDrawingsObjectNoId;CChangesDrawingsObjectNoId.prototype.ReadFromBinary=function(reader){reader.Seek2(reader.GetCurPos()-4);var nType=reader.GetLong(); this.Type=nType;this.FromLoad=true;AscDFH.CChangesBaseObjectProperty.prototype.ReadFromBinary.call(this,reader)};CChangesDrawingsObjectNoId.prototype.private_CreateObject=function(){if(AscDFH.drawingsConstructorsMap[this.Type])return new AscDFH.drawingsConstructorsMap[this.Type];return null};function CChangesDrawingsObject(Class,Type,OldPr,NewPr){this.Type=Type;var _OldPr=OldPr&&OldPr.Get_Id?OldPr.Get_Id():undefined;var _NewPr=NewPr&&NewPr.Get_Id?NewPr.Get_Id():undefined;AscDFH.CChangesBaseStringProperty.call(this, Class,_OldPr,_NewPr)}CChangesDrawingsObject.prototype=Object.create(AscDFH.CChangesBaseStringProperty.prototype);CChangesDrawingsObject.prototype.constructor=CChangesDrawingsObject;CChangesDrawingsObject.prototype.CreateReverseChange=function(){return new this.constructor(this.Class,this.Type,AscCommon.g_oTableId.Get_ById(this.New),AscCommon.g_oTableId.Get_ById(this.Old),this.Color)};window["AscDFH"].CChangesDrawingsObject=CChangesDrawingsObject;CChangesDrawingsObject.prototype.ReadFromBinary=function(reader){reader.Seek2(reader.GetCurPos()- 4);this.Type=reader.GetLong();AscDFH.CChangesBaseStringProperty.prototype.ReadFromBinary.call(this,reader)};CChangesDrawingsObject.prototype.private_SetValue=function(Value){var oObject=null;if(typeof Value==="string"){oObject=AscCommon.g_oTableId.Get_ById(Value);if(!oObject)oObject=null}if(AscDFH.drawingsChangesMap[this.Type])AscDFH.drawingsChangesMap[this.Type](this.Class,oObject)};CChangesDrawingsObject.prototype.Load=function(){this.Redo();this.RefreshRecalcData()};CChangesDrawingsObject.prototype.CheckCorrect= function(){if(this.Old){var oObject=AscCommon.g_oTableId.Get_ById(this.Old);if(oObject.CheckCorrect)if(!oObject.CheckCorrect())return false}return true};function CChangesDrawingsContent(Class,Type,Pos,Items,isAdd){this.Type=Type;AscDFH.CChangesBaseContentChange.call(this,Class,Pos,Items,isAdd)}CChangesDrawingsContent.prototype=Object.create(AscDFH.CChangesBaseContentChange.prototype);CChangesDrawingsContent.prototype.constructor=CChangesDrawingsContent;window["AscDFH"].CChangesDrawingsContent=CChangesDrawingsContent; CChangesDrawingsContent.prototype.ReadFromBinary=function(reader){reader.Seek2(reader.GetCurPos()-4);this.Type=reader.GetLong();this.Add=reader.GetBool();this.Pos=reader.GetLong();AscDFH.CChangesBaseContentChange.prototype.ReadFromBinary.call(this,reader)};CChangesDrawingsContent.prototype.WriteToBinary=function(writer){writer.WriteBool(this.IsAdd());writer.WriteLong(this.Pos);AscDFH.CChangesBaseContentChange.prototype.WriteToBinary.call(this,writer)};CChangesDrawingsContent.prototype.private_WriteItem= function(Writer,Item){Writer.WriteString2(Item.Get_Id())};CChangesDrawingsContent.prototype.private_ReadItem=function(Reader){var Id=Reader.GetString2();return AscCommon.g_oTableId.Get_ById(Id)};CChangesDrawingsContent.prototype.private_GetChangedArray=function(){if(drawingContentChanges[this.Type])return drawingContentChanges[this.Type](this.Class);return null};CChangesDrawingsContent.prototype.private_GetContentChanges=function(){if(this.Class&&this.Class.getContentChangesByType)return this.Class.getContentChangesByType(this.Type); return null};CChangesDrawingsContent.prototype.private_InsertInArrayLoad=function(){if(this.Items.length<=0)return;var aChangedArray=this.private_GetChangedArray();if(null!==aChangedArray){var oContentChanges=this.private_GetContentChanges(),nPos;for(var i=0;i-1;--j)if(aContent[j]=== this.Items[nIndex]){aContent.splice(j,1);if(this.Class.collaborativeMarks)this.Class.collaborativeMarks.Update_OnRemove(j,1);break}}};CChangesDrawingsContentPresentation.prototype.CheckCorrect=function(){if(!this.IsAdd())for(var nIndex=0;nIndex0)f.setPreset(prst);return f}function getPrstByNumber(nPreset){switch(nPreset){case 0:{return"textArchDown"}case 1:{return"textArchDownPour"}case 2:{return"textArchUp"}case 3:{return"textArchUpPour"}case 4:{return"textButton"}case 5:{return"textButtonPour"}case 6:{return"textCanDown"}case 7:{return"textCanUp"}case 8:{return"textCascadeDown"}case 9:{return"textCascadeUp"}case 10:{return"textChevron"}case 11:{return"textChevronInverted"}case 12:{return"textCircle"}case 13:{return"textCirclePour"}case 14:{return"textCurveDown"}case 15:{return"textCurveUp"}case 16:{return"textDeflate"}case 17:{return"textDeflateBottom"}case 18:{return"textDeflateInflate"}case 19:{return"textDeflateInflateDeflate"}case 20:{return"textDeflateTop"}case 21:{return"textDoubleWave1"}case 22:{return"textFadeDown"}case 23:{return"textFadeLeft"}case 24:{return"textFadeRight"}case 25:{return"textFadeUp"}case 26:{return"textInflate"}case 27:{return"textInflateBottom"}case 28:{return"textInflateTop"}case 29:{return"textNoShape"}case 30:{return"textPlain"}case 31:{return"textRingInside"}case 32:{return"textRingOutside"}case 33:{return"textSlantDown"}case 34:{return"textSlantUp"}case 35:{return"textStop"}case 36:{return"textTriangle"}case 37:{return"textTriangleInverted"}case 38:{return"textWave1"}case 39:{return"textWave2"}case 40:{return"textWave4"}}return"textNoShape"} function getNumByTxPrst(sPreset){if("textArchDown"==sPreset)return 0;if("textArchDownPour"==sPreset)return 1;if("textArchUp"==sPreset)return 2;if("textArchUpPour"==sPreset)return 3;if("textButton"==sPreset)return 4;if("textButtonPour"==sPreset)return 5;if("textCanDown"==sPreset)return 6;if("textCanUp"==sPreset)return 7;if("textCascadeDown"==sPreset)return 8;if("textCascadeUp"==sPreset)return 9;if("textChevron"==sPreset)return 10;if("textChevronInverted"==sPreset)return 11;if("textCircle"==sPreset)return 12; if("textCirclePour"==sPreset)return 13;if("textCurveDown"==sPreset)return 14;if("textCurveUp"==sPreset)return 15;if("textDeflate"==sPreset)return 16;if("textDeflateBottom"==sPreset)return 17;if("textDeflateInflate"==sPreset)return 18;if("textDeflateInflateDeflate"==sPreset)return 19;if("textDeflateTop"==sPreset)return 20;if("textDoubleWave1"==sPreset)return 21;if("textFadeDown"==sPreset)return 22;if("textFadeLeft"==sPreset)return 23;if("textFadeRight"==sPreset)return 24;if("textFadeUp"==sPreset)return 25; if("textInflate"==sPreset)return 26;if("textInflateBottom"==sPreset)return 27;if("textInflateTop"==sPreset)return 28;if("textNoShape"==sPreset)return 29;if("textPlain"==sPreset)return 30;if("textRingInside"==sPreset)return 31;if("textRingOutside"==sPreset)return 32;if("textSlantDown"==sPreset)return 33;if("textSlantUp"==sPreset)return 34;if("textStop"==sPreset)return 35;if("textTriangle"==sPreset)return 36;if("textTriangleInverted"==sPreset)return 37;if("textWave1"==sPreset)return 38;if("textWave2"== sPreset)return 39;if("textWave4"==sPreset)return 40;return 29}function CreatePrstTxWarpGeometry(prst){var f=new AscFormat.Geometry;switch(prst){case "textArchDown":{f.AddAdj("adj",15,"0");f.AddGuide("adval",10,"0","adj","21599999");f.AddGuide("v1",1,"10800000","0","adval");f.AddGuide("v2",1,"32400000","0","adval");f.AddGuide("nv1",1,"0","0","v1");f.AddGuide("stAng",3,"nv1","v2","v1");f.AddGuide("w1",1,"5400000","0","adval");f.AddGuide("w2",1,"16200000","0","adval");f.AddGuide("d1",1,"adval","0","stAng"); f.AddGuide("d2",1,"d1","0","21600000");f.AddGuide("v3",1,"0","0","10800000");f.AddGuide("c2",3,"w2","d1","d2");f.AddGuide("c1",3,"v1","d2","c2");f.AddGuide("c0",3,"w1","d1","c1");f.AddGuide("swAng",3,"stAng","c0","v3");f.AddGuide("wt1",12,"wd2","adj");f.AddGuide("ht1",7,"hd2","adj");f.AddGuide("dx1",6,"wd2","ht1","wt1");f.AddGuide("dy1",11,"hd2","ht1","wt1");f.AddGuide("x1",1,"hc","dx1","0");f.AddGuide("y1",1,"vc","dy1","0");f.AddGuide("wt2",12,"wd2","stAng");f.AddGuide("ht2",7,"hd2","stAng");f.AddGuide("dx2", 6,"wd2","ht2","wt2");f.AddGuide("dy2",11,"hd2","ht2","wt2");f.AddGuide("x2",1,"hc","dx2","0");f.AddGuide("y2",1,"vc","dy2","0");f.AddHandlePolar("adj","0","21599999",undefined,"0","0","x1","y1");f.AddPathCommand(0,false,"none",undefined,undefined,undefined);f.AddPathCommand(1,"x2","y2");f.AddPathCommand(3,"wd2","hd2","stAng","swAng");break}case "textArchDownPour":{f.AddAdj("adj1",15,"0");f.AddAdj("adj2",15,"25000");f.AddGuide("adval",10,"0","adj1","21599999");f.AddGuide("v1",1,"10800000","0","adval"); f.AddGuide("v2",1,"32400000","0","adval");f.AddGuide("nv1",1,"0","0","v1");f.AddGuide("stAng",3,"nv1","v2","v1");f.AddGuide("w1",1,"5400000","0","adval");f.AddGuide("w2",1,"16200000","0","adval");f.AddGuide("d1",1,"adval","0","stAng");f.AddGuide("d2",1,"d1","0","21600000");f.AddGuide("v3",1,"0","0","10800000");f.AddGuide("c2",3,"w2","d1","d2");f.AddGuide("c1",3,"v1","d2","c2");f.AddGuide("c0",3,"w1","d1","c1");f.AddGuide("swAng",3,"stAng","c0","v3");f.AddGuide("wt1",12,"wd2","stAng");f.AddGuide("ht1", 7,"hd2","stAng");f.AddGuide("dx1",6,"wd2","ht1","wt1");f.AddGuide("dy1",11,"hd2","ht1","wt1");f.AddGuide("x1",1,"hc","dx1","0");f.AddGuide("y1",1,"vc","dy1","0");f.AddGuide("adval2",10,"0","adj2","99000");f.AddGuide("ratio",0,"adval2","1","100000");f.AddGuide("iwd2",0,"wd2","ratio","1");f.AddGuide("ihd2",0,"hd2","ratio","1");f.AddGuide("wt2",12,"iwd2","adval");f.AddGuide("ht2",7,"ihd2","adval");f.AddGuide("dx2",6,"iwd2","ht2","wt2");f.AddGuide("dy2",11,"ihd2","ht2","wt2");f.AddGuide("x2",1,"hc","dx2", "0");f.AddGuide("y2",1,"vc","dy2","0");f.AddGuide("wt3",12,"iwd2","stAng");f.AddGuide("ht3",7,"ihd2","stAng");f.AddGuide("dx3",6,"iwd2","ht3","wt3");f.AddGuide("dy3",11,"ihd2","ht3","wt3");f.AddGuide("x3",1,"hc","dx3","0");f.AddGuide("y3",1,"vc","dy3","0");f.AddHandlePolar("adj1","0","21599999","adj2","0","100000","x2","y2");f.AddPathCommand(0,false,"none",undefined,undefined,undefined);f.AddPathCommand(1,"x3","y3");f.AddPathCommand(3,"iwd2","ihd2","stAng","swAng");f.AddPathCommand(0,false,"none", undefined,undefined,undefined);f.AddPathCommand(1,"x1","y1");f.AddPathCommand(3,"wd2","hd2","stAng","swAng");break}case "textArchUp":{f.AddAdj("adj",15,"cd2");f.AddGuide("adval",10,"0","adj","21599999");f.AddGuide("v1",1,"10800000","0","adval");f.AddGuide("v2",1,"32400000","0","adval");f.AddGuide("end",3,"v1","v1","v2");f.AddGuide("w1",1,"5400000","0","adval");f.AddGuide("w2",1,"16200000","0","adval");f.AddGuide("d1",1,"end","0","adval");f.AddGuide("d2",1,"21600000","d1","0");f.AddGuide("c2",3,"w2", "d1","d2");f.AddGuide("c1",3,"v1","d2","c2");f.AddGuide("swAng",3,"w1","d1","c1");f.AddGuide("wt1",12,"wd2","adj");f.AddGuide("ht1",7,"hd2","adj");f.AddGuide("dx1",6,"wd2","ht1","wt1");f.AddGuide("dy1",11,"hd2","ht1","wt1");f.AddGuide("x1",1,"hc","dx1","0");f.AddGuide("y1",1,"vc","dy1","0");f.AddHandlePolar("adj","0","21599999",undefined,"0","0","x1","y1");f.AddPathCommand(0,false,"none",undefined,undefined,undefined);f.AddPathCommand(1,"x1","y1");f.AddPathCommand(3,"wd2","hd2","adval","swAng");break}case "textArchUpPour":{f.AddAdj("adj1", 15,"cd2");f.AddAdj("adj2",15,"50000");f.AddGuide("adval",10,"0","adj1","21599999");f.AddGuide("v1",1,"10800000","0","adval");f.AddGuide("v2",1,"32400000","0","adval");f.AddGuide("end",3,"v1","v1","v2");f.AddGuide("w1",1,"5400000","0","adval");f.AddGuide("w2",1,"16200000","0","adval");f.AddGuide("d1",1,"end","0","adval");f.AddGuide("d2",1,"21600000","d1","0");f.AddGuide("c2",3,"w2","d1","d2");f.AddGuide("c1",3,"v1","d2","c2");f.AddGuide("swAng",3,"w1","d1","c1");f.AddGuide("wt1",12,"wd2","adval"); f.AddGuide("ht1",7,"hd2","adval");f.AddGuide("dx1",6,"wd2","ht1","wt1");f.AddGuide("dy1",11,"hd2","ht1","wt1");f.AddGuide("x1",1,"hc","dx1","0");f.AddGuide("y1",1,"vc","dy1","0");f.AddGuide("adval2",10,"0","adj2","99000");f.AddGuide("ratio",0,"adval2","1","100000");f.AddGuide("iwd2",0,"wd2","ratio","1");f.AddGuide("ihd2",0,"hd2","ratio","1");f.AddGuide("wt2",12,"iwd2","adval");f.AddGuide("ht2",7,"ihd2","adval");f.AddGuide("dx2",6,"iwd2","ht2","wt2");f.AddGuide("dy2",11,"ihd2","ht2","wt2");f.AddGuide("x2", 1,"hc","dx2","0");f.AddGuide("y2",1,"vc","dy2","0");f.AddHandlePolar("adj1","0","21599999","adj2","0","100000","x2","y2");f.AddPathCommand(0,false,"none",undefined,undefined,undefined);f.AddPathCommand(1,"x1","y1");f.AddPathCommand(3,"wd2","hd2","adval","swAng");f.AddPathCommand(0,false,"none",undefined,undefined,undefined);f.AddPathCommand(1,"x2","y2");f.AddPathCommand(3,"iwd2","ihd2","adval","swAng");break}case "textButton":{f.AddAdj("adj",15,"10800000");f.AddGuide("adval",10,"0","adj","21599999"); f.AddGuide("bot",1,"5400000","0","adval");f.AddGuide("lef",1,"10800000","0","adval");f.AddGuide("top",1,"16200000","0","adval");f.AddGuide("rig",1,"21600000","0","adval");f.AddGuide("c3",3,"top","adval","0");f.AddGuide("c2",3,"lef","10800000","c3");f.AddGuide("c1",3,"bot","rig","c2");f.AddGuide("stAng",3,"adval","c1","0");f.AddGuide("w1",1,"21600000","0","stAng");f.AddGuide("stAngB",3,"stAng","w1","0");f.AddGuide("td1",0,"bot","2","1");f.AddGuide("td2",0,"top","2","1");f.AddGuide("ntd2",1,"0","0", "td2");f.AddGuide("w2",1,"0","0","10800000");f.AddGuide("c6",3,"top","ntd2","w2");f.AddGuide("c5",3,"lef","10800000","c6");f.AddGuide("c4",3,"bot","td1","c5");f.AddGuide("v1",3,"adval","c4","10800000");f.AddGuide("swAngT",1,"0","0","v1");f.AddGuide("stT",3,"lef","stAngB","stAng");f.AddGuide("stB",3,"lef","stAng","stAngB");f.AddGuide("swT",3,"lef","v1","swAngT");f.AddGuide("swB",3,"lef","swAngT","v1");f.AddGuide("wt1",12,"wd2","stT");f.AddGuide("ht1",7,"hd2","stT");f.AddGuide("dx1",6,"wd2","ht1","wt1"); f.AddGuide("dy1",11,"hd2","ht1","wt1");f.AddGuide("x1",1,"hc","dx1","0");f.AddGuide("y1",1,"vc","dy1","0");f.AddGuide("wt2",12,"wd2","stB");f.AddGuide("ht2",7,"hd2","stB");f.AddGuide("dx2",6,"wd2","ht2","wt2");f.AddGuide("dy2",11,"hd2","ht2","wt2");f.AddGuide("x2",1,"hc","dx2","0");f.AddGuide("y2",1,"vc","dy2","0");f.AddGuide("wt3",12,"wd2","adj");f.AddGuide("ht3",7,"hd2","adj");f.AddGuide("dx3",6,"wd2","ht3","wt3");f.AddGuide("dy3",11,"hd2","ht3","wt3");f.AddGuide("x3",1,"hc","dx3","0");f.AddGuide("y3", 1,"vc","dy3","0");f.AddHandlePolar("adj","0","21599999",undefined,"0","0","x3","y3");f.AddPathCommand(0,false,"none",undefined,undefined,undefined);f.AddPathCommand(1,"x1","y1");f.AddPathCommand(3,"wd2","hd2","stT","swT");f.AddPathCommand(0,false,"none",undefined,undefined,undefined);f.AddPathCommand(1,"l","vc");f.AddPathCommand(2,"r","vc");f.AddPathCommand(0,false,"none",undefined,undefined,undefined);f.AddPathCommand(1,"x2","y2");f.AddPathCommand(3,"wd2","hd2","stB","swB");break}case "textButtonPour":{f.AddAdj("adj1", 15,"cd2");f.AddAdj("adj2",15,"50000");f.AddGuide("adval",10,"0","adj1","21599999");f.AddGuide("bot",1,"5400000","0","adval");f.AddGuide("lef",1,"10800000","0","adval");f.AddGuide("top",1,"16200000","0","adval");f.AddGuide("rig",1,"21600000","0","adval");f.AddGuide("c3",3,"top","adval","0");f.AddGuide("c2",3,"lef","10800000","c3");f.AddGuide("c1",3,"bot","rig","c2");f.AddGuide("stAng",3,"adval","c1","0");f.AddGuide("w1",1,"21600000","0","stAng");f.AddGuide("stAngB",3,"stAng","w1","0");f.AddGuide("td1", 0,"bot","2","1");f.AddGuide("td2",0,"top","2","1");f.AddGuide("ntd2",1,"0","0","td2");f.AddGuide("w2",1,"0","0","10800000");f.AddGuide("c6",3,"top","ntd2","w2");f.AddGuide("c5",3,"lef","10800000","c6");f.AddGuide("c4",3,"bot","td1","c5");f.AddGuide("v1",3,"adval","c4","10800000");f.AddGuide("swAngT",1,"0","0","v1");f.AddGuide("stT",3,"lef","stAngB","stAng");f.AddGuide("stB",3,"lef","stAng","stAngB");f.AddGuide("swT",3,"lef","v1","swAngT");f.AddGuide("swB",3,"lef","swAngT","v1");f.AddGuide("wt1",12, "wd2","stT");f.AddGuide("ht1",7,"hd2","stT");f.AddGuide("dx1",6,"wd2","ht1","wt1");f.AddGuide("dy1",11,"hd2","ht1","wt1");f.AddGuide("x1",1,"hc","dx1","0");f.AddGuide("y1",1,"vc","dy1","0");f.AddGuide("wt6",12,"wd2","stB");f.AddGuide("ht6",7,"hd2","stB");f.AddGuide("dx6",6,"wd2","ht6","wt6");f.AddGuide("dy6",11,"hd2","ht6","wt6");f.AddGuide("x6",1,"hc","dx6","0");f.AddGuide("y6",1,"vc","dy6","0");f.AddGuide("adval2",10,"40000","adj2","99000");f.AddGuide("ratio",0,"adval2","1","100000");f.AddGuide("iwd2", 0,"wd2","ratio","1");f.AddGuide("ihd2",0,"hd2","ratio","1");f.AddGuide("wt2",12,"iwd2","stT");f.AddGuide("ht2",7,"ihd2","stT");f.AddGuide("dx2",6,"iwd2","ht2","wt2");f.AddGuide("dy2",11,"ihd2","ht2","wt2");f.AddGuide("x2",1,"hc","dx2","0");f.AddGuide("y2",1,"vc","dy2","0");f.AddGuide("wt5",12,"iwd2","stB");f.AddGuide("ht5",7,"ihd2","stB");f.AddGuide("dx5",6,"iwd2","ht5","wt5");f.AddGuide("dy5",11,"ihd2","ht5","wt5");f.AddGuide("x5",1,"hc","dx5","0");f.AddGuide("y5",1,"vc","dy5","0");f.AddGuide("d1", 1,"hd2","0","ihd2");f.AddGuide("d12",0,"d1","1","2");f.AddGuide("yu",1,"vc","0","d12");f.AddGuide("yd",1,"vc","d12","0");f.AddGuide("v1",0,"d12","d12","1");f.AddGuide("v2",0,"ihd2","ihd2","1");f.AddGuide("v3",0,"v1","1","v2");f.AddGuide("v4",1,"1","0","v3");f.AddGuide("v5",0,"iwd2","iwd2","1");f.AddGuide("v6",0,"v4","v5","1");f.AddGuide("v7",13,"v6");f.AddGuide("xl",1,"hc","0","v7");f.AddGuide("xr",1,"hc","v7","0");f.AddGuide("wtadj",12,"iwd2","adj1");f.AddGuide("htadj",7,"ihd2","adj1");f.AddGuide("dxadj", 6,"iwd2","htadj","wtadj");f.AddGuide("dyadj",11,"ihd2","htadj","wtadj");f.AddGuide("xadj",1,"hc","dxadj","0");f.AddGuide("yadj",1,"vc","dyadj","0");f.AddHandlePolar("adj1","0","21599999","adj2","0","100000","xadj","yadj");f.AddPathCommand(0,false,"none",undefined,undefined,undefined);f.AddPathCommand(1,"x1","y1");f.AddPathCommand(3,"wd2","hd2","stT","swT");f.AddPathCommand(0,false,"none",undefined,undefined,undefined);f.AddPathCommand(1,"x2","y2");f.AddPathCommand(3,"iwd2","ihd2","stT","swT");f.AddPathCommand(0, false,"none",undefined,undefined,undefined);f.AddPathCommand(1,"xl","yu");f.AddPathCommand(2,"xr","yu");f.AddPathCommand(0,false,"none",undefined,undefined,undefined);f.AddPathCommand(1,"xl","yd");f.AddPathCommand(2,"xr","yd");f.AddPathCommand(0,false,"none",undefined,undefined,undefined);f.AddPathCommand(1,"x5","y5");f.AddPathCommand(3,"iwd2","ihd2","stB","swB");f.AddPathCommand(0,false,"none",undefined,undefined,undefined);f.AddPathCommand(1,"x6","y6");f.AddPathCommand(3,"wd2","hd2","stB","swB"); break}case "textCanDown":{f.AddAdj("adj",15,"14286");f.AddGuide("a",10,"0","adj","33333");f.AddGuide("dy",0,"a","h","100000");f.AddGuide("y0",1,"t","dy","0");f.AddGuide("y1",1,"b","0","dy");f.AddGuide("ncd2",0,"cd2","-1","1");f.AddHandleXY(undefined,"0","0","adj","0","33333","hc","y0");f.AddPathCommand(0,false,"none",undefined,undefined,undefined);f.AddPathCommand(1,"l","t");f.AddPathCommand(3,"wd2","y0","cd2","ncd2");f.AddPathCommand(0,false,"none",undefined,undefined,undefined);f.AddPathCommand(1, "l","y1");f.AddPathCommand(3,"wd2","y0","cd2","ncd2");break}case "textCanUp":{f.AddAdj("adj",15,"85714");f.AddGuide("a",10,"66667","adj","100000");f.AddGuide("dy1",0,"a","h","100000");f.AddGuide("dy",1,"h","0","dy1");f.AddGuide("y0",1,"t","dy1","0");f.AddGuide("y1",1,"t","dy","0");f.AddHandleXY(undefined,"0","0","adj","66667","100000","hc","y0");f.AddPathCommand(0,false,"none",undefined,undefined,undefined);f.AddPathCommand(1,"l","y1");f.AddPathCommand(3,"wd2","y1","cd2","cd2");f.AddPathCommand(0, false,"none",undefined,undefined,undefined);f.AddPathCommand(1,"l","b");f.AddPathCommand(3,"wd2","y1","cd2","cd2");break}case "textCascadeDown":{f.AddAdj("adj",15,"44444");f.AddGuide("a",10,"28570","adj","100000");f.AddGuide("dy",0,"a","h","100000");f.AddGuide("y1",1,"t","dy","0");f.AddGuide("dy2",1,"h","0","dy");f.AddGuide("dy3",0,"dy2","1","4");f.AddGuide("y2",1,"t","dy3","0");f.AddHandleXY(undefined,"0","0","adj","28570","100000","l","y1");f.AddPathCommand(0,false,"none",undefined,undefined,undefined); f.AddPathCommand(1,"l","t");f.AddPathCommand(2,"r","y2");f.AddPathCommand(0,false,"none",undefined,undefined,undefined);f.AddPathCommand(1,"l","y1");f.AddPathCommand(2,"r","b");break}case "textCascadeUp":{f.AddAdj("adj",15,"44444");f.AddGuide("a",10,"28570","adj","100000");f.AddGuide("dy",0,"a","h","100000");f.AddGuide("y1",1,"t","dy","0");f.AddGuide("dy2",1,"h","0","dy");f.AddGuide("dy3",0,"dy2","1","4");f.AddGuide("y2",1,"t","dy3","0");f.AddHandleXY(undefined,"0","0","adj","28570","100000","r", "y1");f.AddPathCommand(0,false,"none",undefined,undefined,undefined);f.AddPathCommand(1,"l","y2");f.AddPathCommand(2,"r","t");f.AddPathCommand(0,false,"none",undefined,undefined,undefined);f.AddPathCommand(1,"l","b");f.AddPathCommand(2,"r","y1");break}case "textChevron":{f.AddAdj("adj",15,"25000");f.AddGuide("a",10,"0","adj","50000");f.AddGuide("y",0,"a","h","100000");f.AddGuide("y1",1,"t","b","y");f.AddHandleXY(undefined,"0","0","adj","0","50000","l","y");f.AddPathCommand(0,false,"none",undefined, undefined,undefined);f.AddPathCommand(1,"l","y");f.AddPathCommand(2,"hc","t");f.AddPathCommand(2,"r","y");f.AddPathCommand(0,false,"none",undefined,undefined,undefined);f.AddPathCommand(1,"l","b");f.AddPathCommand(2,"hc","y1");f.AddPathCommand(2,"r","b");break}case "textChevronInverted":{f.AddAdj("adj",15,"75000");f.AddGuide("a",10,"50000","adj","100000");f.AddGuide("y",0,"a","h","100000");f.AddGuide("y1",1,"b","0","y");f.AddHandleXY(undefined,"0","0","adj","50000","100000","l","y");f.AddPathCommand(0, false,"none",undefined,undefined,undefined);f.AddPathCommand(1,"l","t");f.AddPathCommand(2,"hc","y1");f.AddPathCommand(2,"r","t");f.AddPathCommand(0,false,"none",undefined,undefined,undefined);f.AddPathCommand(1,"l","y");f.AddPathCommand(2,"hc","b");f.AddPathCommand(2,"r","y");break}case "textCircle":{f.AddAdj("adj",15,"10800000");f.AddGuide("adval",10,"0","adj","21599999");f.AddGuide("d0",1,"adval","0","10800000");f.AddGuide("d1",1,"10800000","0","adval");f.AddGuide("d2",1,"21600000","0","adval"); f.AddGuide("d3",3,"d1","d1","10799999");f.AddGuide("d4",3,"d0","d2","d3");f.AddGuide("swAng",0,"d4","2","1");f.AddGuide("wt1",12,"wd2","adj");f.AddGuide("ht1",7,"hd2","adj");f.AddGuide("dx1",6,"wd2","ht1","wt1");f.AddGuide("dy1",11,"hd2","ht1","wt1");f.AddGuide("x1",1,"hc","dx1","0");f.AddGuide("y1",1,"vc","dy1","0");f.AddHandlePolar("adj","0","21599999",undefined,"0","0","x1","y1");f.AddPathCommand(0,false,"none",undefined,undefined,undefined);f.AddPathCommand(1,"x1","y1");f.AddPathCommand(3,"wd2", "hd2","adval","swAng");break}case "textCirclePour":{f.AddAdj("adj1",15,"cd2");f.AddAdj("adj2",15,"50000");f.AddGuide("adval",10,"0","adj1","21599999");f.AddGuide("d0",1,"adval","0","10800000");f.AddGuide("d1",1,"10800000","0","adval");f.AddGuide("d2",1,"21600000","0","adval");f.AddGuide("d3",3,"d1","d1","10799999");f.AddGuide("d4",3,"d0","d2","d3");f.AddGuide("swAng",0,"d4","2","1");f.AddGuide("wt1",12,"wd2","adval");f.AddGuide("ht1",7,"hd2","adval");f.AddGuide("dx1",6,"wd2","ht1","wt1");f.AddGuide("dy1", 11,"hd2","ht1","wt1");f.AddGuide("x1",1,"hc","dx1","0");f.AddGuide("y1",1,"vc","dy1","0");f.AddGuide("adval2",10,"0","adj2","99000");f.AddGuide("ratio",0,"adval2","1","100000");f.AddGuide("iwd2",0,"wd2","ratio","1");f.AddGuide("ihd2",0,"hd2","ratio","1");f.AddGuide("wt2",12,"iwd2","adval");f.AddGuide("ht2",7,"ihd2","adval");f.AddGuide("dx2",6,"iwd2","ht2","wt2");f.AddGuide("dy2",11,"ihd2","ht2","wt2");f.AddGuide("x2",1,"hc","dx2","0");f.AddGuide("y2",1,"vc","dy2","0");f.AddHandlePolar("adj1","0", "21599999","adj2","0","100000","x2","y2");f.AddPathCommand(0,false,"none",undefined,undefined,undefined);f.AddPathCommand(1,"x1","y1");f.AddPathCommand(3,"wd2","hd2","adval","swAng");f.AddPathCommand(0,false,"none",undefined,undefined,undefined);f.AddPathCommand(1,"x2","y2");f.AddPathCommand(3,"iwd2","ihd2","adval","swAng");break}case "textCurveDown":{f.AddAdj("adj",15,"45977");f.AddGuide("a",10,"0","adj","56338");f.AddGuide("dy",0,"a","h","100000");f.AddGuide("gd1",0,"dy","3","4");f.AddGuide("gd2", 0,"dy","5","4");f.AddGuide("gd3",0,"dy","3","8");f.AddGuide("gd4",0,"dy","1","8");f.AddGuide("gd5",1,"h","0","gd3");f.AddGuide("gd6",1,"gd4","h","0");f.AddGuide("y0",1,"t","dy","0");f.AddGuide("y1",1,"t","gd1","0");f.AddGuide("y2",1,"t","gd2","0");f.AddGuide("y3",1,"t","gd3","0");f.AddGuide("y4",1,"t","gd4","0");f.AddGuide("y5",1,"t","gd5","0");f.AddGuide("y6",1,"t","gd6","0");f.AddGuide("x1",1,"l","wd3","0");f.AddGuide("x2",1,"r","0","wd3");f.AddHandleXY(undefined,"0","0","adj","0","56338","r","y0"); f.AddPathCommand(0,false,"none",undefined,undefined,undefined);f.AddPathCommand(1,"l","t");f.AddPathCommand(5,"x1","y1","x2","y2","r","y0");f.AddPathCommand(0,false,"none",undefined,undefined,undefined);f.AddPathCommand(1,"l","y5");f.AddPathCommand(5,"x1","y6","x2","y6","r","y5");break}case "textCurveUp":{f.AddAdj("adj",15,"45977");f.AddGuide("a",10,"0","adj","56338");f.AddGuide("dy",0,"a","h","100000");f.AddGuide("gd1",0,"dy","3","4");f.AddGuide("gd2",0,"dy","5","4");f.AddGuide("gd3",0,"dy","3", "8");f.AddGuide("gd4",0,"dy","1","8");f.AddGuide("gd5",1,"h","0","gd3");f.AddGuide("gd6",1,"gd4","h","0");f.AddGuide("y0",1,"t","dy","0");f.AddGuide("y1",1,"t","gd1","0");f.AddGuide("y2",1,"t","gd2","0");f.AddGuide("y3",1,"t","gd3","0");f.AddGuide("y4",1,"t","gd4","0");f.AddGuide("y5",1,"t","gd5","0");f.AddGuide("y6",1,"t","gd6","0");f.AddGuide("x1",1,"l","wd3","0");f.AddGuide("x2",1,"r","0","wd3");f.AddHandleXY(undefined,"0","0","adj","0","56338","l","y0");f.AddPathCommand(0,false,"none",undefined, undefined,undefined);f.AddPathCommand(1,"l","y0");f.AddPathCommand(5,"x1","y2","x2","y1","r","t");f.AddPathCommand(0,false,"none",undefined,undefined,undefined);f.AddPathCommand(1,"l","y5");f.AddPathCommand(5,"x1","y6","x2","y6","r","y5");break}case "textDeflate":{f.AddAdj("adj",15,"18750");f.AddGuide("a",10,"0","adj","37500");f.AddGuide("dy",0,"a","ss","100000");f.AddGuide("gd0",0,"dy","4","3");f.AddGuide("gd1",1,"h","0","gd0");f.AddGuide("adjY",1,"t","dy","0");f.AddGuide("y0",1,"t","gd0","0");f.AddGuide("y1", 1,"t","gd1","0");f.AddGuide("x0",1,"l","wd3","0");f.AddGuide("x1",1,"r","0","wd3");f.AddHandleXY(undefined,"0","0","adj","0","37500","hc","adjY");f.AddPathCommand(0,false,"none",undefined,undefined,undefined);f.AddPathCommand(1,"l","t");f.AddPathCommand(5,"x0","y0","x1","y0","r","t");f.AddPathCommand(0,false,"none",undefined,undefined,undefined);f.AddPathCommand(1,"l","b");f.AddPathCommand(5,"x0","y1","x1","y1","r","b");break}case "textDeflateBottom":{f.AddAdj("adj",15,"50000");f.AddGuide("a",10, "6250","adj","100000");f.AddGuide("dy",0,"a","ss","100000");f.AddGuide("dy2",1,"h","0","dy");f.AddGuide("y1",1,"t","dy","0");f.AddGuide("cp",1,"y1","0","dy2");f.AddHandleXY(undefined,"0","0","adj","6250","100000","hc","y1");f.AddPathCommand(0,false,"none",undefined,undefined,undefined);f.AddPathCommand(1,"l","t");f.AddPathCommand(2,"r","t");f.AddPathCommand(0,false,"none",undefined,undefined,undefined);f.AddPathCommand(1,"l","b");f.AddPathCommand(4,"hc","cp","r","b");break}case "textDeflateInflate":{f.AddAdj("adj", 15,"35000");f.AddGuide("a",10,"5000","adj","95000");f.AddGuide("dy",0,"a","h","100000");f.AddGuide("del",0,"h","5","100");f.AddGuide("dh1",0,"h","45","100");f.AddGuide("dh2",0,"h","55","100");f.AddGuide("yh",1,"dy","0","del");f.AddGuide("yl",1,"dy","del","0");f.AddGuide("y3",1,"yh","yh","dh1");f.AddGuide("y4",1,"yl","yl","dh2");f.AddHandleXY(undefined,"0","0","adj","5000","95000","hc","dy");f.AddPathCommand(0,false,"none",undefined,undefined,undefined);f.AddPathCommand(1,"l","t");f.AddPathCommand(2, "r","t");f.AddPathCommand(0,false,"none",undefined,undefined,undefined);f.AddPathCommand(1,"l","dh1");f.AddPathCommand(4,"hc","y3","r","dh1");f.AddPathCommand(0,false,"none",undefined,undefined,undefined);f.AddPathCommand(1,"l","dh2");f.AddPathCommand(4,"hc","y4","r","dh2");f.AddPathCommand(0,false,"none",undefined,undefined,undefined);f.AddPathCommand(1,"l","b");f.AddPathCommand(2,"r","b");break}case "textDeflateInflateDeflate":{f.AddAdj("adj",15,"25000");f.AddGuide("a",10,"3000","adj","47000"); f.AddGuide("dy",0,"a","h","100000");f.AddGuide("del",0,"h","3","100");f.AddGuide("ey1",0,"h","30","100");f.AddGuide("ey2",0,"h","36","100");f.AddGuide("ey3",0,"h","63","100");f.AddGuide("ey4",0,"h","70","100");f.AddGuide("by",1,"b","0","dy");f.AddGuide("yh1",1,"dy","0","del");f.AddGuide("yl1",1,"dy","del","0");f.AddGuide("yh2",1,"by","0","del");f.AddGuide("yl2",1,"by","del","0");f.AddGuide("y1",1,"yh1","yh1","ey1");f.AddGuide("y2",1,"yl1","yl1","ey2");f.AddGuide("y3",1,"yh2","yh2","ey3");f.AddGuide("y4", 1,"yl2","yl2","ey4");f.AddHandleXY(undefined,"0","0","adj","3000","47000","hc","dy");f.AddPathCommand(0,false,"none",undefined,undefined,undefined);f.AddPathCommand(1,"l","t");f.AddPathCommand(2,"r","t");f.AddPathCommand(0,false,"none",undefined,undefined,undefined);f.AddPathCommand(1,"l","ey1");f.AddPathCommand(4,"hc","y1","r","ey1");f.AddPathCommand(0,false,"none",undefined,undefined,undefined);f.AddPathCommand(1,"l","ey2");f.AddPathCommand(4,"hc","y2","r","ey2");f.AddPathCommand(0,false,"none", undefined,undefined,undefined);f.AddPathCommand(1,"l","ey3");f.AddPathCommand(4,"hc","y3","r","ey3");f.AddPathCommand(0,false,"none",undefined,undefined,undefined);f.AddPathCommand(1,"l","ey4");f.AddPathCommand(4,"hc","y4","r","ey4");f.AddPathCommand(0,false,"none",undefined,undefined,undefined);f.AddPathCommand(1,"l","b");f.AddPathCommand(2,"r","b");break}case "textDeflateTop":{f.AddAdj("adj",15,"50000");f.AddGuide("a",10,"0","adj","93750");f.AddGuide("dy",0,"a","h","100000");f.AddGuide("y1",1,"t", "dy","0");f.AddGuide("cp",1,"y1","dy","0");f.AddHandleXY(undefined,"0","0","adj","0","93750","hc","y1");f.AddPathCommand(0,false,"none",undefined,undefined,undefined);f.AddPathCommand(1,"l","t");f.AddPathCommand(4,"hc","cp","r","t");f.AddPathCommand(0,false,"none",undefined,undefined,undefined);f.AddPathCommand(1,"l","b");f.AddPathCommand(2,"r","b");break}case "textDoubleWave1":{f.AddAdj("adj1",15,"6250");f.AddAdj("adj2",15,"0");f.AddGuide("a1",10,"0","adj1","12500");f.AddGuide("a2",10,"-10000","adj2", "10000");f.AddGuide("y1",0,"h","a1","100000");f.AddGuide("dy2",0,"y1","10","3");f.AddGuide("y2",1,"y1","0","dy2");f.AddGuide("y3",1,"y1","dy2","0");f.AddGuide("y4",1,"b","0","y1");f.AddGuide("y5",1,"y4","0","dy2");f.AddGuide("y6",1,"y4","dy2","0");f.AddGuide("of",0,"w","a2","100000");f.AddGuide("of2",0,"w","a2","50000");f.AddGuide("x1",4,"of");f.AddGuide("dx2",3,"of2","0","of2");f.AddGuide("x2",1,"l","0","dx2");f.AddGuide("dx8",3,"of2","of2","0");f.AddGuide("x8",1,"r","0","dx8");f.AddGuide("dx3", 2,"dx2","x8","6");f.AddGuide("x3",1,"x2","dx3","0");f.AddGuide("dx4",2,"dx2","x8","3");f.AddGuide("x4",1,"x2","dx4","0");f.AddGuide("x5",2,"x2","x8","2");f.AddGuide("x6",1,"x5","dx3","0");f.AddGuide("x7",2,"x6","x8","2");f.AddGuide("x9",1,"l","dx8","0");f.AddGuide("x15",1,"r","dx2","0");f.AddGuide("x10",1,"x9","dx3","0");f.AddGuide("x11",1,"x9","dx4","0");f.AddGuide("x12",2,"x9","x15","2");f.AddGuide("x13",1,"x12","dx3","0");f.AddGuide("x14",2,"x13","x15","2");f.AddGuide("x16",1,"r","0","x1");f.AddGuide("xAdj", 1,"hc","of","0");f.AddHandleXY(undefined,"0","0","adj1","0","12500","l","y1");f.AddHandleXY("adj2","-10000","10000",undefined,"0","0","xAdj","b");f.AddPathCommand(0,false,"none",undefined,undefined,undefined);f.AddPathCommand(1,"x2","y1");f.AddPathCommand(5,"x3","y2","x4","y3","x5","y1");f.AddPathCommand(5,"x6","y2","x7","y3","x8","y1");f.AddPathCommand(0,false,"none",undefined,undefined,undefined);f.AddPathCommand(1,"x9","y4");f.AddPathCommand(5,"x10","y5","x11","y6","x12","y4");f.AddPathCommand(5, "x13","y5","x14","y6","x15","y4");break}case "textFadeDown":{f.AddAdj("adj",15,"33333");f.AddGuide("a",10,"0","adj","49999");f.AddGuide("dx",0,"a","w","100000");f.AddGuide("x1",1,"l","dx","0");f.AddGuide("x2",1,"r","0","dx");f.AddHandleXY("adj","0","49999",undefined,"0","0","x1","b");f.AddPathCommand(0,false,"none",undefined,undefined,undefined);f.AddPathCommand(1,"l","t");f.AddPathCommand(2,"r","t");f.AddPathCommand(0,false,"none",undefined,undefined,undefined);f.AddPathCommand(1,"x1","b");f.AddPathCommand(2, "x2","b");break}case "textFadeLeft":{f.AddAdj("adj",15,"33333");f.AddGuide("a",10,"0","adj","49999");f.AddGuide("dy",0,"a","h","100000");f.AddGuide("y1",1,"t","dy","0");f.AddGuide("y2",1,"b","0","dy");f.AddHandleXY(undefined,"0","0","adj","0","49999","l","y1");f.AddPathCommand(0,false,"none",undefined,undefined,undefined);f.AddPathCommand(1,"l","y1");f.AddPathCommand(2,"r","t");f.AddPathCommand(0,false,"none",undefined,undefined,undefined);f.AddPathCommand(1,"l","y2");f.AddPathCommand(2,"r","b"); break}case "textFadeRight":{f.AddAdj("adj",15,"33333");f.AddGuide("a",10,"0","adj","49999");f.AddGuide("dy",0,"a","h","100000");f.AddGuide("y1",1,"t","dy","0");f.AddGuide("y2",1,"b","0","dy");f.AddHandleXY(undefined,"0","0","adj","0","49999","r","y1");f.AddPathCommand(0,false,"none",undefined,undefined,undefined);f.AddPathCommand(1,"l","t");f.AddPathCommand(2,"r","y1");f.AddPathCommand(0,false,"none",undefined,undefined,undefined);f.AddPathCommand(1,"l","b");f.AddPathCommand(2,"r","y2");break}case "textFadeUp":{f.AddAdj("adj", 15,"33333");f.AddGuide("a",10,"0","adj","49999");f.AddGuide("dx",0,"a","w","100000");f.AddGuide("x1",1,"l","dx","0");f.AddGuide("x2",1,"r","0","dx");f.AddHandleXY("adj","0","49999",undefined,"0","0","x1","t");f.AddPathCommand(0,false,"none",undefined,undefined,undefined);f.AddPathCommand(1,"x1","t");f.AddPathCommand(2,"x2","t");f.AddPathCommand(0,false,"none",undefined,undefined,undefined);f.AddPathCommand(1,"l","b");f.AddPathCommand(2,"r","b");break}case "textInflate":{f.AddAdj("adj",15,"18750"); f.AddGuide("a",10,"0","adj","20000");f.AddGuide("dy",0,"a","h","100000");f.AddGuide("gd",0,"dy","1","3");f.AddGuide("gd0",1,"0","0","gd");f.AddGuide("gd1",1,"h","0","gd0");f.AddGuide("ty",1,"t","dy","0");f.AddGuide("by",1,"b","0","dy");f.AddGuide("y0",1,"t","gd0","0");f.AddGuide("y1",1,"t","gd1","0");f.AddGuide("x0",1,"l","wd3","0");f.AddGuide("x1",1,"r","0","wd3");f.AddHandleXY(undefined,"0","0","adj","0","20000","l","ty");f.AddPathCommand(0,false,"none",undefined,undefined,undefined);f.AddPathCommand(1, "l","ty");f.AddPathCommand(5,"x0","y0","x1","y0","r","ty");f.AddPathCommand(0,false,"none",undefined,undefined,undefined);f.AddPathCommand(1,"l","by");f.AddPathCommand(5,"x0","y1","x1","y1","r","by");break}case "textInflateBottom":{f.AddAdj("adj",15,"60000");f.AddGuide("a",10,"60000","adj","100000");f.AddGuide("dy",0,"a","h","100000");f.AddGuide("ty",1,"t","dy","0");f.AddHandleXY(undefined,"0","0","adj","60000","100000","l","ty");f.AddPathCommand(0,false,"none",undefined,undefined,undefined);f.AddPathCommand(1, "l","t");f.AddPathCommand(2,"r","t");f.AddPathCommand(0,false,"none",undefined,undefined,undefined);f.AddPathCommand(1,"l","ty");f.AddPathCommand(4,"hc","b","r","ty");break}case "textInflateTop":{f.AddAdj("adj",15,"40000");f.AddGuide("a",10,"0","adj","50000");f.AddGuide("dy",0,"a","h","100000");f.AddGuide("ty",1,"t","dy","0");f.AddHandleXY(undefined,"0","0","adj","0","50000","l","ty");f.AddPathCommand(0,false,"none",undefined,undefined,undefined);f.AddPathCommand(1,"l","ty");f.AddPathCommand(4,"hc", "t","r","ty");f.AddPathCommand(0,false,"none",undefined,undefined,undefined);f.AddPathCommand(1,"l","b");f.AddPathCommand(2,"r","b");break}case "textPlain":{f.AddAdj("adj",15,"50000");f.AddGuide("a",10,"30000","adj","70000");f.AddGuide("mid",0,"a","w","100000");f.AddGuide("midDir",1,"mid","0","hc");f.AddGuide("dl",1,"mid","0","l");f.AddGuide("dr",1,"r","0","mid");f.AddGuide("dl2",0,"dl","2","1");f.AddGuide("dr2",0,"dr","2","1");f.AddGuide("dx",3,"midDir","dr2","dl2");f.AddGuide("xr",1,"l","dx","0"); f.AddGuide("xl",1,"r","0","dx");f.AddGuide("tlx",3,"midDir","l","xl");f.AddGuide("trx",3,"midDir","xr","r");f.AddGuide("blx",3,"midDir","xl","l");f.AddGuide("brx",3,"midDir","r","xr");f.AddHandleXY("adj","30000","70000",undefined,"0","0","mid","b");f.AddPathCommand(0,false,"none",undefined,undefined,undefined);f.AddPathCommand(1,"tlx","t");f.AddPathCommand(2,"trx","t");f.AddPathCommand(0,false,"none",undefined,undefined,undefined);f.AddPathCommand(1,"blx","b");f.AddPathCommand(2,"brx","b");break}case "textRingInside":{f.AddAdj("adj", 15,"60000");f.AddGuide("a",10,"50000","adj","99000");f.AddGuide("dy",0,"a","h","100000");f.AddGuide("y",1,"t","dy","0");f.AddGuide("r",0,"dy","1","2");f.AddGuide("y1",1,"t","r","0");f.AddGuide("y2",1,"b","0","r");f.AddHandleXY(undefined,"0","0","adj","50000","99000","hc","y");f.AddPathCommand(0,false,"none",undefined,undefined,undefined);f.AddPathCommand(1,"l","y1");f.AddPathCommand(3,"wd2","y1","10800000","21599999");f.AddPathCommand(0,false,"none",undefined,undefined,undefined);f.AddPathCommand(1, "l","y2");f.AddPathCommand(3,"wd2","r","10800000","21599999");break}case "textRingOutside":{f.AddAdj("adj",15,"60000");f.AddGuide("a",10,"50000","adj","99000");f.AddGuide("dy",0,"a","h","100000");f.AddGuide("y",1,"t","dy","0");f.AddGuide("r",0,"dy","1","2");f.AddGuide("y1",1,"t","r","0");f.AddGuide("y2",1,"b","0","r");f.AddHandleXY(undefined,"0","0","adj","50000","99000","hc","y");f.AddPathCommand(0,false,"none",undefined,undefined,undefined);f.AddPathCommand(1,"l","y1");f.AddPathCommand(3,"wd2", "y1","10800000","-21599999");f.AddPathCommand(0,false,"none",undefined,undefined,undefined);f.AddPathCommand(1,"l","y2");f.AddPathCommand(3,"wd2","r","10800000","-21599999");break}case "textSlantDown":{f.AddAdj("adj",15,"44445");f.AddGuide("a",10,"28569","adj","100000");f.AddGuide("dy",0,"a","h","100000");f.AddGuide("y1",1,"t","dy","0");f.AddGuide("y2",1,"b","0","dy");f.AddHandleXY(undefined,"0","0","adj","28569","100000","l","y1");f.AddPathCommand(0,false,"none",undefined,undefined,undefined);f.AddPathCommand(1, "l","t");f.AddPathCommand(2,"r","y2");f.AddPathCommand(0,false,"none",undefined,undefined,undefined);f.AddPathCommand(1,"l","y1");f.AddPathCommand(2,"r","b");break}case "textSlantUp":{f.AddAdj("adj",15,"55555");f.AddGuide("a",10,"0","adj","71431");f.AddGuide("dy",0,"a","h","100000");f.AddGuide("y1",1,"t","dy","0");f.AddGuide("y2",1,"b","0","dy");f.AddHandleXY(undefined,"0","0","adj","0","71431","l","y1");f.AddPathCommand(0,false,"none",undefined,undefined,undefined);f.AddPathCommand(1,"l","y1");f.AddPathCommand(2, "r","t");f.AddPathCommand(0,false,"none",undefined,undefined,undefined);f.AddPathCommand(1,"l","b");f.AddPathCommand(2,"r","y2");break}case "textStop":{f.AddAdj("adj",15,"25000");f.AddGuide("a",10,"14286","adj","50000");f.AddGuide("dx",0,"w","1","3");f.AddGuide("dy",0,"a","h","100000");f.AddGuide("x1",1,"l","dx","0");f.AddGuide("x2",1,"r","0","dx");f.AddGuide("y1",1,"t","dy","0");f.AddGuide("y2",1,"b","0","dy");f.AddHandleXY(undefined,"0","0","adj","14286","50000","l","dy");f.AddPathCommand(0,false, "none",undefined,undefined,undefined);f.AddPathCommand(1,"l","y1");f.AddPathCommand(2,"x1","t");f.AddPathCommand(2,"x2","t");f.AddPathCommand(2,"r","y1");f.AddPathCommand(0,false,"none",undefined,undefined,undefined);f.AddPathCommand(1,"l","y2");f.AddPathCommand(2,"x1","b");f.AddPathCommand(2,"x2","b");f.AddPathCommand(2,"r","y2");break}case "textTriangle":{f.AddAdj("adj",15,"50000");f.AddGuide("a",10,"0","adj","100000");f.AddGuide("y",0,"a","h","100000");f.AddHandleXY(undefined,"0","0","adj","0", "100000","l","y");f.AddPathCommand(0,false,"none",undefined,undefined,undefined);f.AddPathCommand(1,"l","y");f.AddPathCommand(2,"hc","t");f.AddPathCommand(2,"r","y");f.AddPathCommand(0,false,"none",undefined,undefined,undefined);f.AddPathCommand(1,"l","b");f.AddPathCommand(2,"r","b");break}case "textTriangleInverted":{f.AddAdj("adj",15,"50000");f.AddGuide("a",10,"0","adj","100000");f.AddGuide("y",0,"a","h","100000");f.AddHandleXY(undefined,"0","0","adj","0","100000","l","y");f.AddPathCommand(0,false, "none",undefined,undefined,undefined);f.AddPathCommand(1,"l","t");f.AddPathCommand(2,"r","t");f.AddPathCommand(0,false,"none",undefined,undefined,undefined);f.AddPathCommand(1,"l","y");f.AddPathCommand(2,"hc","b");f.AddPathCommand(2,"r","y");break}case "textWave1":{f.AddAdj("adj1",15,"12500");f.AddAdj("adj2",15,"0");f.AddGuide("a1",10,"0","adj1","20000");f.AddGuide("a2",10,"-10000","adj2","10000");f.AddGuide("y1",0,"h","a1","100000");f.AddGuide("dy2",0,"y1","10","3");f.AddGuide("y2",1,"y1","0","dy2"); f.AddGuide("y3",1,"y1","dy2","0");f.AddGuide("y4",1,"b","0","y1");f.AddGuide("y5",1,"y4","0","dy2");f.AddGuide("y6",1,"y4","dy2","0");f.AddGuide("of",0,"w","a2","100000");f.AddGuide("of2",0,"w","a2","50000");f.AddGuide("x1",4,"of");f.AddGuide("dx2",3,"of2","0","of2");f.AddGuide("x2",1,"l","0","dx2");f.AddGuide("dx5",3,"of2","of2","0");f.AddGuide("x5",1,"r","0","dx5");f.AddGuide("dx3",2,"dx2","x5","3");f.AddGuide("x3",1,"x2","dx3","0");f.AddGuide("x4",2,"x3","x5","2");f.AddGuide("x6",1,"l","dx5","0"); f.AddGuide("x10",1,"r","dx2","0");f.AddGuide("x7",1,"x6","dx3","0");f.AddGuide("x8",2,"x7","x10","2");f.AddGuide("x9",1,"r","0","x1");f.AddGuide("xAdj",1,"hc","of","0");f.AddHandleXY(undefined,"0","0","adj1","0","20000","l","y1");f.AddHandleXY("adj2","-10000","10000",undefined,"0","0","xAdj","b");f.AddPathCommand(0,false,"none",undefined,undefined,undefined);f.AddPathCommand(1,"x2","y1");f.AddPathCommand(5,"x3","y2","x4","y3","x5","y1");f.AddPathCommand(0,false,"none",undefined,undefined,undefined); f.AddPathCommand(1,"x6","y4");f.AddPathCommand(5,"x7","y5","x8","y6","x10","y4");break}case "textWave2":{f.AddAdj("adj1",15,"12500");f.AddAdj("adj2",15,"0");f.AddGuide("a1",10,"0","adj1","20000");f.AddGuide("a2",10,"-10000","adj2","10000");f.AddGuide("y1",0,"h","a1","100000");f.AddGuide("dy2",0,"y1","10","3");f.AddGuide("y2",1,"y1","0","dy2");f.AddGuide("y3",1,"y1","dy2","0");f.AddGuide("y4",1,"b","0","y1");f.AddGuide("y5",1,"y4","0","dy2");f.AddGuide("y6",1,"y4","dy2","0");f.AddGuide("of",0,"w", "a2","100000");f.AddGuide("of2",0,"w","a2","50000");f.AddGuide("x1",4,"of");f.AddGuide("dx2",3,"of2","0","of2");f.AddGuide("x2",1,"l","0","dx2");f.AddGuide("dx5",3,"of2","of2","0");f.AddGuide("x5",1,"r","0","dx5");f.AddGuide("dx3",2,"dx2","x5","3");f.AddGuide("x3",1,"x2","dx3","0");f.AddGuide("x4",2,"x3","x5","2");f.AddGuide("x6",1,"l","dx5","0");f.AddGuide("x10",1,"r","dx2","0");f.AddGuide("x7",1,"x6","dx3","0");f.AddGuide("x8",2,"x7","x10","2");f.AddGuide("x9",1,"r","0","x1");f.AddGuide("xAdj", 1,"hc","of","0");f.AddHandleXY(undefined,"0","0","adj1","0","20000","l","y1");f.AddHandleXY("adj2","-10000","10000",undefined,"0","0","xAdj","b");f.AddPathCommand(0,false,"none",undefined,undefined,undefined);f.AddPathCommand(1,"x2","y1");f.AddPathCommand(5,"x3","y3","x4","y2","x5","y1");f.AddPathCommand(0,false,"none",undefined,undefined,undefined);f.AddPathCommand(1,"x6","y4");f.AddPathCommand(5,"x7","y6","x8","y5","x10","y4");break}case "textWave4":{f.AddAdj("adj1",15,"6250");f.AddAdj("adj2",15, "0");f.AddGuide("a1",10,"0","adj1","12500");f.AddGuide("a2",10,"-10000","adj2","10000");f.AddGuide("y1",0,"h","a1","100000");f.AddGuide("dy2",0,"y1","10","3");f.AddGuide("y2",1,"y1","0","dy2");f.AddGuide("y3",1,"y1","dy2","0");f.AddGuide("y4",1,"b","0","y1");f.AddGuide("y5",1,"y4","0","dy2");f.AddGuide("y6",1,"y4","dy2","0");f.AddGuide("of",0,"w","a2","100000");f.AddGuide("of2",0,"w","a2","50000");f.AddGuide("x1",4,"of");f.AddGuide("dx2",3,"of2","0","of2");f.AddGuide("x2",1,"l","0","dx2");f.AddGuide("dx8", 3,"of2","of2","0");f.AddGuide("x8",1,"r","0","dx8");f.AddGuide("dx3",2,"dx2","x8","6");f.AddGuide("x3",1,"x2","dx3","0");f.AddGuide("dx4",2,"dx2","x8","3");f.AddGuide("x4",1,"x2","dx4","0");f.AddGuide("x5",2,"x2","x8","2");f.AddGuide("x6",1,"x5","dx3","0");f.AddGuide("x7",2,"x6","x8","2");f.AddGuide("x9",1,"l","dx8","0");f.AddGuide("x15",1,"r","dx2","0");f.AddGuide("x10",1,"x9","dx3","0");f.AddGuide("x11",1,"x9","dx4","0");f.AddGuide("x12",2,"x9","x15","2");f.AddGuide("x13",1,"x12","dx3","0");f.AddGuide("x14", 2,"x13","x15","2");f.AddGuide("x16",1,"r","0","x1");f.AddGuide("xAdj",1,"hc","of","0");f.AddHandleXY(undefined,"0","0","adj1","0","12500","l","y1");f.AddHandleXY("adj2","-10000","10000",undefined,"0","0","xAdj","b");f.AddPathCommand(0,false,"none",undefined,undefined,undefined);f.AddPathCommand(1,"x2","y1");f.AddPathCommand(5,"x3","y3","x4","y2","x5","y1");f.AddPathCommand(5,"x6","y3","x7","y2","x8","y1");f.AddPathCommand(0,false,"none",undefined,undefined,undefined);f.AddPathCommand(1,"x9","y4"); f.AddPathCommand(5,"x10","y6","x11","y5","x12","y4");f.AddPathCommand(5,"x13","y6","x14","y5","x15","y4");break}}if(typeof prst==="string"&&prst.length>0)f.setPreset(prst);return f}window["AscFormat"]=window["AscFormat"]||{};window["AscFormat"].CreateGeometry=CreateGeometry;window["AscFormat"].getPrstByNumber=getPrstByNumber;window["AscFormat"].getNumByTxPrst=getNumByTxPrst;window["AscFormat"].CreatePrstTxWarpGeometry=CreatePrstTxWarpGeometry})(window);"use strict";(function(window,undefined){var ArcToCurvers= AscFormat.ArcToCurvers;var History=AscCommon.History;var EPSILON_TEXT_AUTOFIT=.001;var FORMULA_TYPE_MULT_DIV=0,FORMULA_TYPE_PLUS_MINUS=1,FORMULA_TYPE_PLUS_DIV=2,FORMULA_TYPE_IF_ELSE=3,FORMULA_TYPE_ABS=4,FORMULA_TYPE_AT2=5,FORMULA_TYPE_CAT2=6,FORMULA_TYPE_COS=7,FORMULA_TYPE_MAX=8,FORMULA_TYPE_MOD=9,FORMULA_TYPE_PIN=10,FORMULA_TYPE_SAT2=11,FORMULA_TYPE_SIN=12,FORMULA_TYPE_SQRT=13,FORMULA_TYPE_TAN=14,FORMULA_TYPE_VALUE=15,FORMULA_TYPE_MIN=16;var cToRad=Math.PI/(6E4*180);var cToDeg=1/cToRad;var MAX_ITER_COUNT= 50;var oGdLst={};oGdLst["_3cd4"]=162E5;oGdLst["_3cd8"]=81E5;oGdLst["_5cd8"]=135E5;oGdLst["_7cd8"]=189E5;oGdLst["cd2"]=108E5;oGdLst["cd4"]=54E5;oGdLst["cd8"]=27E5;oGdLst["l"]=0;oGdLst["t"]=0;function Cos(angle){return Math.cos(cToRad*angle)}function Sin(angle){return Math.sin(cToRad*angle)}function Tan(angle){return Math.tan(cToRad*angle)}function ATan(x){return cToDeg*Math.atan(x)}function ATan2(y,x){return cToDeg*Math.atan2(y,x)}function CAt2(x,y,z){return x*Math.cos(Math.atan2(z,y))}function SAt2(x, y,z){return x*Math.sin(Math.atan2(z,y))}function CalculateGuideValue(name,formula,x,y,z,gdLst){var xt,yt,zt;xt=gdLst[x];if(xt===undefined)xt=parseInt(x,10);yt=gdLst[y];if(yt===undefined)yt=parseInt(y,10);zt=gdLst[z];if(zt===undefined)zt=parseInt(z,10);switch(formula){case FORMULA_TYPE_MULT_DIV:{gdLst[name]=xt*yt/zt;break}case FORMULA_TYPE_PLUS_MINUS:{gdLst[name]=xt+yt-zt;break}case FORMULA_TYPE_PLUS_DIV:{gdLst[name]=(xt+yt)/zt;break}case FORMULA_TYPE_IF_ELSE:{if(xt>0)gdLst[name]=yt;else gdLst[name]= zt;break}case FORMULA_TYPE_ABS:{gdLst[name]=Math.abs(xt);break}case FORMULA_TYPE_AT2:{gdLst[name]=ATan2(yt,xt);break}case FORMULA_TYPE_CAT2:{gdLst[name]=CAt2(xt,yt,zt);break}case FORMULA_TYPE_COS:{gdLst[name]=xt*Cos(yt);break}case FORMULA_TYPE_MAX:{gdLst[name]=Math.max(xt,yt);break}case FORMULA_TYPE_MOD:{gdLst[name]=Math.sqrt(xt*xt+yt*yt+zt*zt);break}case FORMULA_TYPE_PIN:{if(ytzt)gdLst[name]=zt;else gdLst[name]=yt;break}case FORMULA_TYPE_SAT2:{gdLst[name]=SAt2(xt,yt, zt);break}case FORMULA_TYPE_SIN:{gdLst[name]=xt*Sin(yt);break}case FORMULA_TYPE_SQRT:{gdLst[name]=Math.sqrt(xt);break}case FORMULA_TYPE_TAN:{gdLst[name]=xt*Tan(yt);break}case FORMULA_TYPE_VALUE:{gdLst[name]=xt;break}case FORMULA_TYPE_MIN:{gdLst[name]=Math.min(xt,yt)}}}function CalculateGuideLst(gdLstInfo,gdLst){var info;for(var i=0,n=gdLstInfo.length;i-1;--i){var oCurGd=aGdLstInfo[i];if(oCurGd.name==this.Name&&oCurGd.formula==this.formula&&oCurGd.x==this.x&&oCurGd.y==this.y&&oCurGd.z==this.z)aGdLstInfo.splice(i,1)}};CChangesGeometryAddGuide.prototype.AddGuide=function(){this.Class.gdLstInfo.push({name:this.Name,formula:this.formula,x:this.x,y:this.y,z:this.z})};CChangesGeometryAddGuide.prototype.Undo=function(){if(this.bReverse)this.AddGuide();else this.RemoveGuide()}; CChangesGeometryAddGuide.prototype.Redo=function(){if(this.bReverse)this.RemoveGuide();else this.AddGuide()};CChangesGeometryAddGuide.prototype.WriteToBinary=function(Writer){Writer.WriteString2(this.Name);Writer.WriteLong(this.formula);AscFormat.writeString(Writer,this.x);AscFormat.writeString(Writer,this.y);AscFormat.writeString(Writer,this.z);Writer.WriteBool(!!this.bReverse)};CChangesGeometryAddGuide.prototype.ReadFromBinary=function(Reader){this.Name=Reader.GetString2();this.formula=Reader.GetLong(); this.x=AscFormat.readString(Reader);this.y=AscFormat.readString(Reader);this.z=AscFormat.readString(Reader);this.bReverse=Reader.GetBool()};CChangesGeometryAddGuide.prototype.CreateReverseChange=function(){return new CChangesGeometryAddGuide(this.Class,this.Name,this.formula,this.x,this.y,this.z,!this.bReverse)};AscDFH.changesFactory[AscDFH.historyitem_GeometryAddGuide]=CChangesGeometryAddGuide;function CChangesGeometryAddCnx(Class,ang,x,y,bReverse){this.Type=AscDFH.historyitem_GeometryAddCnx;this.ang= ang;this.x=x;this.y=y;this.bReverse=bReverse;AscDFH.CChangesBase.call(this,Class)}CChangesGeometryAddCnx.prototype=Object.create(AscDFH.CChangesBase.prototype);CChangesGeometryAddCnx.prototype.constructor=CChangesGeometryAddCnx;CChangesGeometryAddCnx.prototype.RemoveCnx=function(){var aCnxLstInfo=this.Class.cnxLstInfo;for(var i=aCnxLstInfo.length-1;i>-1;--i){var oCurCnx=aCnxLstInfo[i];if(oCurCnx.ang==this.ang&&oCurCnx.x==this.x&&oCurCnx.y==this.y)aCnxLstInfo.splice(i,1)}};CChangesGeometryAddCnx.prototype.AddCnx= function(){this.Class.cnxLstInfo.push({ang:this.ang,x:this.x,y:this.y})};CChangesGeometryAddCnx.prototype.Undo=function(){if(this.bReverse)this.AddCnx();else this.RemoveCnx()};CChangesGeometryAddCnx.prototype.Redo=function(){if(this.bReverse)this.RemoveCnx();else this.AddCnx()};CChangesGeometryAddCnx.prototype.WriteToBinary=function(Writer){AscFormat.writeString(Writer,this.ang);AscFormat.writeString(Writer,this.x);AscFormat.writeString(Writer,this.y);Writer.WriteBool(!!this.bReverse)};CChangesGeometryAddCnx.prototype.ReadFromBinary= function(Reader){this.ang=AscFormat.readString(Reader);this.x=AscFormat.readString(Reader);this.y=AscFormat.readString(Reader);this.bReverse=Reader.GetBool()};CChangesGeometryAddCnx.prototype.CreateReverseChange=function(){return new CChangesGeometryAddCnx(this.Class,this.ang,this.x,this.y,!this.bReverse)};AscDFH.changesFactory[AscDFH.historyitem_GeometryAddCnx]=CChangesGeometryAddCnx;function CChangesGeometryAddHandleXY(Class,gdRefX,minX,maxX,gdRefY,minY,maxY,posX,posY,bReverse){this.Type=AscDFH.historyitem_GeometryAddHandleXY; this.gdRefX=gdRefX;this.minX=minX;this.maxX=maxX;this.gdRefY=gdRefY;this.minY=minY;this.maxY=maxY;this.posX=posX;this.posY=posY;this.bReverse=bReverse;AscDFH.CChangesBase.call(this,Class)}CChangesGeometryAddHandleXY.prototype=Object.create(AscDFH.CChangesBase.prototype);CChangesGeometryAddHandleXY.prototype.constructor=CChangesGeometryAddHandleXY;CChangesGeometryAddHandleXY.prototype.RemoveHandleXY=function(){var ahXYLstInfo=this.Class.ahXYLstInfo;for(var i=ahXYLstInfo.length-1;i>-1;--i){var oCurXY= ahXYLstInfo[i];if(oCurXY.gdRefX==this.gdRefX&&oCurXY.minX==this.minX&&oCurXY.maxX==this.maxX&&oCurXY.gdRefY==this.gdRefY&&oCurXY.minY==this.minY&&oCurXY.maxY==this.maxY&&oCurXY.posX==this.posX&&oCurXY.posY==this.posY)ahXYLstInfo.splice(i,1)}};CChangesGeometryAddHandleXY.prototype.AddHandleXY=function(){this.Class.ahXYLstInfo.push({gdRefX:this.gdRefX,minX:this.minX,maxX:this.maxX,gdRefY:this.gdRefY,minY:this.minY,maxY:this.maxY,posX:this.posX,posY:this.posY})};CChangesGeometryAddHandleXY.prototype.Undo= function(){if(this.bReverse)this.AddHandleXY();else this.RemoveHandleXY()};CChangesGeometryAddHandleXY.prototype.Redo=function(){if(this.bReverse)this.RemoveHandleXY();else this.AddHandleXY()};CChangesGeometryAddHandleXY.prototype.WriteToBinary=function(Writer){AscFormat.writeString(Writer,this.gdRefX);AscFormat.writeString(Writer,this.minX);AscFormat.writeString(Writer,this.maxX);AscFormat.writeString(Writer,this.gdRefY);AscFormat.writeString(Writer,this.minY);AscFormat.writeString(Writer,this.maxY); AscFormat.writeString(Writer,this.posX);AscFormat.writeString(Writer,this.posY);Writer.WriteBool(!!this.bReverse)};CChangesGeometryAddHandleXY.prototype.ReadFromBinary=function(Reader){this.gdRefX=AscFormat.readString(Reader);this.minX=AscFormat.readString(Reader);this.maxX=AscFormat.readString(Reader);this.gdRefY=AscFormat.readString(Reader);this.minY=AscFormat.readString(Reader);this.maxY=AscFormat.readString(Reader);this.posX=AscFormat.readString(Reader);this.posY=AscFormat.readString(Reader); this.bReverse=Reader.GetBool()};CChangesGeometryAddHandleXY.prototype.CreateReverseChange=function(){return new CChangesGeometryAddHandleXY(this.Class,this.gdRefX,this.minX,this.maxX,this.gdRefY,this.minY,this.maxY,this.posX,this.posY,!this.bReverse)};AscDFH.changesFactory[AscDFH.historyitem_GeometryAddHandleXY]=CChangesGeometryAddHandleXY;function CChangesGeometryAddHandlePolar(Class,gdRefR,minR,maxR,gdRefAng,minAng,maxAng,posX,posY,bReverse){this.Type=AscDFH.historyitem_GeometryAddHandlePolar;this.gdRefAng= gdRefAng;this.minAng=minAng;this.maxAng=maxAng;this.gdRefR=gdRefR;this.minR=minR;this.maxR=maxR;this.posX=posX;this.posY=posY;this.bReverse=bReverse;AscDFH.CChangesBase.call(this,Class)}CChangesGeometryAddHandlePolar.prototype=Object.create(AscDFH.CChangesBase.prototype);CChangesGeometryAddHandlePolar.prototype.constructor=CChangesGeometryAddHandlePolar;CChangesGeometryAddHandlePolar.prototype.RemoveHandlePolar=function(){var ahPolarLstInfo=this.Class.ahPolarLstInfo;for(var i=ahPolarLstInfo.length- 1;i>-1;--i){var oCurPolar=ahPolarLstInfo[i];if(oCurPolar.gdRefR==this.gdRefR&&oCurPolar.minR==this.minR&&oCurPolar.maxR==this.maxR&&oCurPolar.gdRefAng==this.gdRefAng&&oCurPolar.minAng==this.minAng&&oCurPolar.maxAng==this.maxAng&&oCurPolar.posX==this.posX&&oCurPolar.posY==this.posY)ahPolarLstInfo.splice(i,1)}};CChangesGeometryAddHandlePolar.prototype.AddHandlePolar=function(){this.Class.ahPolarLstInfo.push({gdRefR:this.gdRefR,minR:this.minR,maxR:this.maxR,gdRefAng:this.gdRefAng,minAng:this.minAng, maxAng:this.maxAng,posX:this.posX,posY:this.posY})};CChangesGeometryAddHandlePolar.prototype.Undo=function(){if(this.bReverse)this.AddHandlePolar();else this.RemoveHandlePolar()};CChangesGeometryAddHandlePolar.prototype.Redo=function(){if(this.bReverse)this.RemoveHandlePolar();else this.AddHandlePolar()};CChangesGeometryAddHandlePolar.prototype.WriteToBinary=function(Writer){AscFormat.writeString(Writer,this.gdRefR);AscFormat.writeString(Writer,this.minR);AscFormat.writeString(Writer,this.maxR);AscFormat.writeString(Writer, this.gdRefAng);AscFormat.writeString(Writer,this.minAng);AscFormat.writeString(Writer,this.maxAng);AscFormat.writeString(Writer,this.posX);AscFormat.writeString(Writer,this.posY);Writer.WriteBool(!!this.bReverse)};CChangesGeometryAddHandlePolar.prototype.ReadFromBinary=function(Reader){this.gdRefR=AscFormat.readString(Reader);this.minR=AscFormat.readString(Reader);this.maxR=AscFormat.readString(Reader);this.gdRefAng=AscFormat.readString(Reader);this.minAng=AscFormat.readString(Reader);this.maxAng= AscFormat.readString(Reader);this.posX=AscFormat.readString(Reader);this.posY=AscFormat.readString(Reader);this.bReverse=Reader.GetBool()};CChangesGeometryAddHandlePolar.prototype.CreateReverseChange=function(){return new CChangesGeometryAddHandlePolar(this.Class,this.gdRefR,this.minR,this.maxR,this.gdRefAng,this.minAng,this.maxAng,this.posX,this.posY,!this.bReverse)};AscDFH.changesFactory[AscDFH.historyitem_GeometryAddHandlePolar]=CChangesGeometryAddHandlePolar;function CChangesGeometryAddRect(Class, l,t,r,b,bReverse){this.Type=AscDFH.historyitem_GeometryAddRect;this.l=l;this.t=t;this.r=r;this.b=b;this.bReverse=bReverse;AscDFH.CChangesBase.call(this,Class)}CChangesGeometryAddRect.prototype=Object.create(AscDFH.CChangesBase.prototype);CChangesGeometryAddRect.prototype.constructor=CChangesGeometryAddRect;CChangesGeometryAddRect.prototype.Undo=function(){if(this.bReverse)this.Class.rectS={l:this.l,t:this.t,r:this.r,b:this.b};else this.Class.rectS=null};CChangesGeometryAddRect.prototype.Redo=function(){if(this.bReverse)this.Class.rectS= null;else this.Class.rectS={l:this.l,t:this.t,r:this.r,b:this.b}};CChangesGeometryAddRect.prototype.WriteToBinary=function(Writer){AscFormat.writeString(Writer,this.l);AscFormat.writeString(Writer,this.t);AscFormat.writeString(Writer,this.r);AscFormat.writeString(Writer,this.b);Writer.WriteBool(!!this.bReverse)};CChangesGeometryAddRect.prototype.ReadFromBinary=function(Reader){this.l=AscFormat.readString(Reader);this.t=AscFormat.readString(Reader);this.r=AscFormat.readString(Reader);this.b=AscFormat.readString(Reader); this.bReverse=Reader.GetBool()};AscDFH.changesFactory[AscDFH.historyitem_GeometryAddRect]=CChangesGeometryAddRect;AscDFH.changesFactory[AscDFH.historyitem_GeometrySetPreset]=AscDFH.CChangesDrawingsString;AscDFH.drawingsChangesMap[AscDFH.historyitem_GeometrySetPreset]=function(oClass,value){oClass.preset=value};AscDFH.drawingsChangesMap[AscDFH.historyitem_GeometrySetParent]=function(oClass,value){oClass.parent=value};AscDFH.changesFactory[AscDFH.historyitem_GeometryAddPath]=AscDFH.CChangesDrawingsContent; AscDFH.changesFactory[AscDFH.historyitem_GeometrySetParent]=AscDFH.CChangesDrawingsObject;AscDFH.drawingContentChanges[AscDFH.historyitem_GeometryAddPath]=function(oClass){return oClass.pathLst};function Geometry(){this.gdLstInfo=[];this.gdLst={};this.avLst={};this.cnxLstInfo=[];this.cnxLst=[];this.ahXYLstInfo=[];this.ahXYLst=[];this.ahPolarLstInfo=[];this.ahPolarLst=[];this.pathLst=[];this.preset=null;this.rectS=null;this.parent=null;this.bDrawSmart=false;this.Id=AscCommon.g_oIdCounter.Get_NewId(); AscCommon.g_oTableId.Add(this,this.Id)}Geometry.prototype={Get_Id:function(){return this.Id},getObjectType:function(){return AscDFH.historyitem_type_Geometry},Write_ToBinary2:function(w){w.WriteLong(this.getObjectType());w.WriteString2(this.Get_Id())},Read_FromBinary2:function(r){this.Id=r.GetString2()},Refresh_RecalcData:function(data){if(this.parent&&this.parent.handleUpdateGeometry)this.parent.handleUpdateGeometry()},isEmpty:function(){if(this.pathLst.length===0)return true;if(this.pathLst.length=== 1)return this.pathLst[0].ArrPathCommandInfo.length===0;return false},createDuplicate:function(){var g=new Geometry;for(var i=0;ioWarpPathPolygon.dLen)dLength=oWarpPathPolygon.dLen}return dLength},draw:function(shape_drawer){if(shape_drawer.Graphics&&shape_drawer.Graphics.bDrawSmart||this.bDrawSmart){this.drawSmart(shape_drawer);return}for(var i=0,n=this.pathLst.length;i=2){if(first_point_x!==null&&first_point_y!==null)cur_polygon.push({x:first_point_x,y:first_point_y});arr_polygons.push(cur_polygon)}cur_polygon= [];last_command=cur_command}break}}}if(cur_polygon.length>=2)arr_polygons.push(cur_polygon);if(cur_polygon.length===1){cur_polygon.push({x:cur_polygon[0].x,y:cur_polygon[0].y});arr_polygons.push(cur_polygon)}}return arr_polygons},getBounds:function(){},getNewWHByTextRect:function(dTextWidth,dTextHeight,dGeometryWidth,dGeometryHeight){var dDelta=0;var dWi=dTextWidth,dHi=dTextHeight,dWNext,dHNext;var oGeometry=AscFormat.ExecuteNoHistory(function(){return this.createDuplicate()},this,[]);var iter_Count= 0;if(!AscFormat.isRealNumber(dGeometryWidth)&&!AscFormat.isRealNumber(dGeometryHeight)){do{oGeometry.Recalculate(dWi,dHi);dWNext=dTextWidth-(oGeometry.rect.r-oGeometry.rect.l)+dWi;dHNext=dTextHeight-(oGeometry.rect.b-oGeometry.rect.t)+dHi;dDelta=Math.max(Math.abs(dWNext-dWi),Math.abs(dHNext-dHi));dWi=dWNext;dHi=dHNext;++iter_Count}while(dDelta>EPSILON_TEXT_AUTOFIT&&iter_CountEPSILON_TEXT_AUTOFIT}}else if(AscFormat.isRealNumber(dGeometryWidth)){do{oGeometry.Recalculate(dGeometryWidth, dHi);dHNext=dTextHeight-(oGeometry.rect.b-oGeometry.rect.t)+dHi;dDelta=Math.abs(dHNext-dHi);dHi=dHNext;++iter_Count}while(dDelta>EPSILON_TEXT_AUTOFIT&&iter_CountEPSILON_TEXT_AUTOFIT}}else{do{oGeometry.Recalculate(dWi,dGeometryHeight);dWNext=dTextWidth-(oGeometry.rect.r-oGeometry.rect.l)+dWi;dDelta=Math.abs(dWNext-dWi);dWi=dWNext;++iter_Count}while(dDelta>EPSILON_TEXT_AUTOFIT&&iter_Count EPSILON_TEXT_AUTOFIT}}},checkBetweenPolygons:function(oBoundsController,oPolygonWrapper1,oPolygonWrapper2){var aPathLst=this.pathLst;for(var i=0;iy)return ret;else if(this.point1.y===this.point2.y)if(this.point1.x<=this.point2.x){ret.push(this.point1.x);ret.push(this.point2.x);return ret}else{ret.push(this.point2.x);ret.push(this.point1.x);return ret}else if(!(this.point1.x===this.point2.x)){var ret_x=this.point1.x+(y-this.point1.y)/(this.point2.y-this.point1.y)*(this.point2.x-this.point1.x);ret.push(ret_x);return ret}else{ret.push(this.point1.x);return ret}}}function GetArrayPolygonsByPaths(dEpsilon, aPathLst){var geom=new Geometry;var aByPaths=[];for(var i=0;i-1;--nChild){var oChild=aChildren[nChild];if(oChild&&oChild.traverse)if(oChild.traverse(fCallback))return true}return false};CBaseFormatObject.prototype.handleRemoveObject=function(sObjectId){return false};CBaseFormatObject.prototype.onRemoveChild=function(oChild){if(this.parent)this.parent.onRemoveChild(this)};CBaseFormatObject.prototype.notAllowedWithoutId=function(){return true};function CT_Hyperlink(){this.snd=null;this.id= null;this.invalidUrl=null;this.action=null;this.tgtFrame=null;this.tooltip=null;this.history=null;this.highlightClick=null;this.endSnd=null}CT_Hyperlink.prototype.Write_ToBinary=function(w){var nStartPos=w.GetCurPosition();var nFlags=0;w.WriteLong(0);if(null!==this.snd){nFlags|=1;w.WriteString2(this.snd)}if(null!==this.id){nFlags|=2;w.WriteString2(this.id)}if(null!==this.invalidUrl){nFlags|=4;w.WriteString2(this.invalidUrl)}if(null!==this.action){nFlags|=8;w.WriteString2(this.action)}if(null!==this.tgtFrame){nFlags|= 16;w.WriteString2(this.tgtFrame)}if(null!==this.tooltip){nFlags|=32;w.WriteString2(this.tooltip)}if(null!==this.history){nFlags|=64;w.WriteBool(this.history)}if(null!==this.highlightClick){nFlags|=128;w.WriteBool(this.highlightClick)}if(null!==this.endSnd){nFlags|=256;w.WriteBool(this.endSnd)}var nEndPos=w.GetCurPosition();w.Seek(nStartPos);w.WriteLong(nFlags);w.Seek(nEndPos)};CT_Hyperlink.prototype.Read_FromBinary=function(r){var nFlags=r.GetLong();if(nFlags&1)this.snd=r.GetString2();if(nFlags&2)this.id= r.GetString2();if(nFlags&4)this.invalidUrl=r.GetString2();if(nFlags&8)this.action=r.GetString2();if(nFlags&16)this.tgtFrame=r.GetString2();if(nFlags&32)this.tooltip=r.GetString2();if(nFlags&64)this.history=r.GetBool();if(nFlags&128)this.highlightClick=r.GetBool();if(nFlags&256)this.endSnd=r.GetBool()};CT_Hyperlink.prototype.createDuplicate=function(){var ret=new CT_Hyperlink;ret.snd=this.snd;ret.id=this.id;ret.invalidUrl=this.invalidUrl;ret.action=this.action;ret.tgtFrame=this.tgtFrame;ret.tooltip= this.tooltip;ret.history=this.history;ret.highlightClick=this.highlightClick;ret.endSnd=this.endSnd;return ret};var drawingsChangesMap=window["AscDFH"].drawingsChangesMap;var drawingConstructorsMap=window["AscDFH"].drawingsConstructorsMap;var drawingContentChanges=window["AscDFH"].drawingContentChanges;drawingsChangesMap[AscDFH.historyitem_DefaultShapeDefinition_SetSpPr]=function(oClass,value){oClass.spPr=value};drawingsChangesMap[AscDFH.historyitem_DefaultShapeDefinition_SetBodyPr]=function(oClass, value){oClass.bodyPr=value};drawingsChangesMap[AscDFH.historyitem_DefaultShapeDefinition_SetLstStyle]=function(oClass,value){oClass.lstStyle=value};drawingsChangesMap[AscDFH.historyitem_DefaultShapeDefinition_SetStyle]=function(oClass,value){oClass.style=value};drawingsChangesMap[AscDFH.historyitem_CNvPr_SetId]=function(oClass,value){oClass.id=value};drawingsChangesMap[AscDFH.historyitem_CNvPr_SetName]=function(oClass,value){oClass.name=value};drawingsChangesMap[AscDFH.historyitem_CNvPr_SetIsHidden]= function(oClass,value){oClass.isHidden=value};drawingsChangesMap[AscDFH.historyitem_CNvPr_SetDescr]=function(oClass,value){oClass.descr=value};drawingsChangesMap[AscDFH.historyitem_CNvPr_SetTitle]=function(oClass,value){oClass.title=value};drawingsChangesMap[AscDFH.historyitem_CNvPr_SetHlinkClick]=function(oClass,value){oClass.hlinkClick=value};drawingsChangesMap[AscDFH.historyitem_CNvPr_SetHlinkHover]=function(oClass,value){oClass.hlinkHover=value};drawingsChangesMap[AscDFH.historyitem_NvPr_SetIsPhoto]= function(oClass,value){oClass.isPhoto=value};drawingsChangesMap[AscDFH.historyitem_NvPr_SetUserDrawn]=function(oClass,value){oClass.userDrawn=value};drawingsChangesMap[AscDFH.historyitem_NvPr_SetPh]=function(oClass,value){oClass.ph=value};drawingsChangesMap[AscDFH.historyitem_Ph_SetHasCustomPrompt]=function(oClass,value){oClass.hasCustomPrompt=value};drawingsChangesMap[AscDFH.historyitem_Ph_SetIdx]=function(oClass,value){oClass.idx=value};drawingsChangesMap[AscDFH.historyitem_Ph_SetOrient]=function(oClass, value){oClass.orient=value};drawingsChangesMap[AscDFH.historyitem_Ph_SetSz]=function(oClass,value){oClass.sz=value};drawingsChangesMap[AscDFH.historyitem_Ph_SetType]=function(oClass,value){oClass.type=value};drawingsChangesMap[AscDFH.historyitem_UniNvPr_SetCNvPr]=function(oClass,value){oClass.cNvPr=value};drawingsChangesMap[AscDFH.historyitem_UniNvPr_SetUniPr]=function(oClass,value){oClass.uniPr=value};drawingsChangesMap[AscDFH.historyitem_UniNvPr_SetNvPr]=function(oClass,value){oClass.nvPr=value}; drawingsChangesMap[AscDFH.historyitem_ShapeStyle_SetLnRef]=function(oClass,value){oClass.lnRef=value};drawingsChangesMap[AscDFH.historyitem_ShapeStyle_SetFillRef]=function(oClass,value){oClass.fillRef=value};drawingsChangesMap[AscDFH.historyitem_ShapeStyle_SetFontRef]=function(oClass,value){oClass.fontRef=value};drawingsChangesMap[AscDFH.historyitem_ShapeStyle_SetEffectRef]=function(oClass,value){oClass.effectRef=value};drawingsChangesMap[AscDFH.historyitem_Xfrm_SetParent]=function(oClass,value){oClass.parent= value};drawingsChangesMap[AscDFH.historyitem_Xfrm_SetOffX]=function(oClass,value){oClass.offX=value;oClass.handleUpdatePosition()};drawingsChangesMap[AscDFH.historyitem_Xfrm_SetOffY]=function(oClass,value){oClass.offY=value;oClass.handleUpdatePosition()};drawingsChangesMap[AscDFH.historyitem_Xfrm_SetExtX]=function(oClass,value){oClass.extX=value;oClass.handleUpdateExtents()};drawingsChangesMap[AscDFH.historyitem_Xfrm_SetExtY]=function(oClass,value){oClass.extY=value;oClass.handleUpdateExtents()}; drawingsChangesMap[AscDFH.historyitem_Xfrm_SetChOffX]=function(oClass,value){oClass.chOffX=value;oClass.handleUpdateChildOffset()};drawingsChangesMap[AscDFH.historyitem_Xfrm_SetChOffY]=function(oClass,value){oClass.chOffY=value;oClass.handleUpdateChildOffset()};drawingsChangesMap[AscDFH.historyitem_Xfrm_SetChExtX]=function(oClass,value){oClass.chExtX=value;oClass.handleUpdateChildExtents()};drawingsChangesMap[AscDFH.historyitem_Xfrm_SetChExtY]=function(oClass,value){oClass.chExtY=value;oClass.handleUpdateChildExtents()}; drawingsChangesMap[AscDFH.historyitem_Xfrm_SetFlipH]=function(oClass,value){oClass.flipH=value;oClass.handleUpdateFlip()};drawingsChangesMap[AscDFH.historyitem_Xfrm_SetFlipV]=function(oClass,value){oClass.flipV=value;oClass.handleUpdateFlip()};drawingsChangesMap[AscDFH.historyitem_Xfrm_SetRot]=function(oClass,value){oClass.rot=value;oClass.handleUpdateRot()};drawingsChangesMap[AscDFH.historyitem_SpPr_SetParent]=function(oClass,value){oClass.parent=value};drawingsChangesMap[AscDFH.historyitem_SpPr_SetBwMode]= function(oClass,value){oClass.bwMode=value};drawingsChangesMap[AscDFH.historyitem_SpPr_SetXfrm]=function(oClass,value){oClass.xfrm=value};drawingsChangesMap[AscDFH.historyitem_SpPr_SetGeometry]=function(oClass,value){oClass.geometry=value;oClass.handleUpdateGeometry()};drawingsChangesMap[AscDFH.historyitem_SpPr_SetFill]=function(oClass,value,FromLoad){oClass.Fill=value;oClass.handleUpdateFill();if(FromLoad)if(typeof AscCommon.CollaborativeEditing!=="undefined")if(oClass.Fill&&oClass.Fill.fill&&oClass.Fill.fill.type=== c_oAscFill.FILL_TYPE_BLIP&&typeof oClass.Fill.fill.RasterImageId==="string"&&oClass.Fill.fill.RasterImageId.length>0)AscCommon.CollaborativeEditing.Add_NewImage(oClass.Fill.fill.RasterImageId)};drawingsChangesMap[AscDFH.historyitem_SpPr_SetLn]=function(oClass,value){oClass.ln=value;oClass.handleUpdateLn()};drawingsChangesMap[AscDFH.historyitem_SpPr_SetEffectPr]=function(oClass,value){oClass.effectProps=value;oClass.handleUpdateGeometry()};drawingsChangesMap[AscDFH.historyitem_ExtraClrScheme_SetClrScheme]= function(oClass,value){oClass.clrScheme=value};drawingsChangesMap[AscDFH.historyitem_ExtraClrScheme_SetClrMap]=function(oClass,value){oClass.clrMap=value};drawingsChangesMap[AscDFH.historyitem_ThemeSetColorScheme]=function(oClass,value){oClass.themeElements.clrScheme=value;var oWordGraphicObjects=oClass.GetWordDrawingObjects();if(oWordGraphicObjects){oWordGraphicObjects.drawingDocument.CheckGuiControlColors();oWordGraphicObjects.document.Api.chartPreviewManager.clearPreviews();oWordGraphicObjects.document.Api.textArtPreviewManager.clear()}}; drawingsChangesMap[AscDFH.historyitem_ThemeSetFontScheme]=function(oClass,value){oClass.themeElements.fontScheme=value};drawingsChangesMap[AscDFH.historyitem_ThemeSetFmtScheme]=function(oClass,value){oClass.themeElements.fmtScheme=value};drawingsChangesMap[AscDFH.historyitem_ThemeSetName]=function(oClass,value){oClass.name=value};drawingsChangesMap[AscDFH.historyitem_ThemeSetIsThemeOverride]=function(oClass,value){oClass.isThemeOverride=value};drawingsChangesMap[AscDFH.historyitem_ThemeSetSpDef]= function(oClass,value){oClass.spDef=value};drawingsChangesMap[AscDFH.historyitem_ThemeSetLnDef]=function(oClass,value){oClass.lnDef=value};drawingsChangesMap[AscDFH.historyitem_ThemeSetTxDef]=function(oClass,value){oClass.txDef=value};drawingsChangesMap[AscDFH.historyitem_HF_SetDt]=function(oClass,value){oClass.dt=value};drawingsChangesMap[AscDFH.historyitem_HF_SetFtr]=function(oClass,value){oClass.ftr=value};drawingsChangesMap[AscDFH.historyitem_HF_SetHdr]=function(oClass,value){oClass.hdr=value}; drawingsChangesMap[AscDFH.historyitem_HF_SetSldNum]=function(oClass,value){oClass.sldNum=value};drawingsChangesMap[AscDFH.historyitem_UniNvPr_SetUniSpPr]=function(oClass,value){oClass.nvUniSpPr=value};drawingsChangesMap[AscDFH.historyitem_NvPr_SetUniMedia]=function(oClass,value){oClass.unimedia=value};drawingContentChanges[AscDFH.historyitem_ClrMap_SetClr]=function(oClass){return oClass.color_map};drawingContentChanges[AscDFH.historyitem_ThemeAddExtraClrScheme]=function(oClass){return oClass.extraClrSchemeLst}; drawingContentChanges[AscDFH.historyitem_ThemeRemoveExtraClrScheme]=function(oClass){return oClass.extraClrSchemeLst};drawingConstructorsMap[AscDFH.historyitem_ClrMap_SetClr]=CUniColor;drawingConstructorsMap[AscDFH.historyitem_DefaultShapeDefinition_SetBodyPr]=CBodyPr;drawingConstructorsMap[AscDFH.historyitem_DefaultShapeDefinition_SetLstStyle]=TextListStyle;drawingConstructorsMap[AscDFH.historyitem_ShapeStyle_SetLnRef]=drawingConstructorsMap[AscDFH.historyitem_ShapeStyle_SetFillRef]=drawingConstructorsMap[AscDFH.historyitem_ShapeStyle_SetEffectRef]= StyleRef;drawingConstructorsMap[AscDFH.historyitem_ShapeStyle_SetFontRef]=FontRef;drawingConstructorsMap[AscDFH.historyitem_SpPr_SetFill]=CUniFill;drawingConstructorsMap[AscDFH.historyitem_SpPr_SetLn]=CLn;drawingConstructorsMap[AscDFH.historyitem_SpPr_SetEffectPr]=CEffectProperties;drawingConstructorsMap[AscDFH.historyitem_ThemeSetColorScheme]=ClrScheme;drawingConstructorsMap[AscDFH.historyitem_ThemeSetFontScheme]=FontScheme;drawingConstructorsMap[AscDFH.historyitem_ThemeSetFmtScheme]=FmtScheme;drawingConstructorsMap[AscDFH.historyitem_UniNvPr_SetUniSpPr]= CNvUniSpPr;drawingConstructorsMap[AscDFH.historyitem_CNvPr_SetHlinkClick]=CT_Hyperlink;drawingConstructorsMap[AscDFH.historyitem_CNvPr_SetHlinkHover]=CT_Hyperlink;AscDFH.changesFactory[AscDFH.historyitem_DefaultShapeDefinition_SetSpPr]=CChangesDrawingsObject;AscDFH.changesFactory[AscDFH.historyitem_DefaultShapeDefinition_SetBodyPr]=CChangesDrawingsObjectNoId;AscDFH.changesFactory[AscDFH.historyitem_DefaultShapeDefinition_SetLstStyle]=CChangesDrawingsObjectNoId;AscDFH.changesFactory[AscDFH.historyitem_DefaultShapeDefinition_SetStyle]= CChangesDrawingsObject;AscDFH.changesFactory[AscDFH.historyitem_CNvPr_SetId]=CChangesDrawingsLong;AscDFH.changesFactory[AscDFH.historyitem_CNvPr_SetName]=CChangesDrawingsString;AscDFH.changesFactory[AscDFH.historyitem_CNvPr_SetIsHidden]=CChangesDrawingsBool;AscDFH.changesFactory[AscDFH.historyitem_CNvPr_SetDescr]=CChangesDrawingsString;AscDFH.changesFactory[AscDFH.historyitem_CNvPr_SetTitle]=CChangesDrawingsString;AscDFH.changesFactory[AscDFH.historyitem_CNvPr_SetHlinkClick]=CChangesDrawingsObjectNoId; AscDFH.changesFactory[AscDFH.historyitem_CNvPr_SetHlinkHover]=CChangesDrawingsObjectNoId;AscDFH.changesFactory[AscDFH.historyitem_NvPr_SetIsPhoto]=CChangesDrawingsBool;AscDFH.changesFactory[AscDFH.historyitem_NvPr_SetUserDrawn]=CChangesDrawingsBool;AscDFH.changesFactory[AscDFH.historyitem_NvPr_SetPh]=CChangesDrawingsObject;AscDFH.changesFactory[AscDFH.historyitem_NvPr_SetUniMedia]=CChangesDrawingsObjectNoId;AscDFH.changesFactory[AscDFH.historyitem_Ph_SetHasCustomPrompt]=CChangesDrawingsBool;AscDFH.changesFactory[AscDFH.historyitem_Ph_SetIdx]= CChangesDrawingsString;AscDFH.changesFactory[AscDFH.historyitem_Ph_SetOrient]=CChangesDrawingsLong;AscDFH.changesFactory[AscDFH.historyitem_Ph_SetSz]=CChangesDrawingsLong;AscDFH.changesFactory[AscDFH.historyitem_Ph_SetType]=CChangesDrawingsLong;AscDFH.changesFactory[AscDFH.historyitem_UniNvPr_SetCNvPr]=CChangesDrawingsObject;AscDFH.changesFactory[AscDFH.historyitem_UniNvPr_SetUniPr]=CChangesDrawingsObject;AscDFH.changesFactory[AscDFH.historyitem_UniNvPr_SetNvPr]=CChangesDrawingsObject;AscDFH.changesFactory[AscDFH.historyitem_UniNvPr_SetUniSpPr]= CChangesDrawingsObjectNoId;AscDFH.changesFactory[AscDFH.historyitem_ShapeStyle_SetLnRef]=CChangesDrawingsObjectNoId;AscDFH.changesFactory[AscDFH.historyitem_ShapeStyle_SetFillRef]=CChangesDrawingsObjectNoId;AscDFH.changesFactory[AscDFH.historyitem_ShapeStyle_SetFontRef]=CChangesDrawingsObjectNoId;AscDFH.changesFactory[AscDFH.historyitem_ShapeStyle_SetEffectRef]=CChangesDrawingsObjectNoId;AscDFH.changesFactory[AscDFH.historyitem_Xfrm_SetParent]=CChangesDrawingsObject;AscDFH.changesFactory[AscDFH.historyitem_Xfrm_SetOffX]= CChangesDrawingsDouble;AscDFH.changesFactory[AscDFH.historyitem_Xfrm_SetOffY]=CChangesDrawingsDouble;AscDFH.changesFactory[AscDFH.historyitem_Xfrm_SetExtX]=CChangesDrawingsDouble;AscDFH.changesFactory[AscDFH.historyitem_Xfrm_SetExtY]=CChangesDrawingsDouble;AscDFH.changesFactory[AscDFH.historyitem_Xfrm_SetChOffX]=CChangesDrawingsDouble;AscDFH.changesFactory[AscDFH.historyitem_Xfrm_SetChOffY]=CChangesDrawingsDouble;AscDFH.changesFactory[AscDFH.historyitem_Xfrm_SetChExtX]=CChangesDrawingsDouble;AscDFH.changesFactory[AscDFH.historyitem_Xfrm_SetChExtY]= CChangesDrawingsDouble;AscDFH.changesFactory[AscDFH.historyitem_Xfrm_SetFlipH]=CChangesDrawingsBool;AscDFH.changesFactory[AscDFH.historyitem_Xfrm_SetFlipV]=CChangesDrawingsBool;AscDFH.changesFactory[AscDFH.historyitem_Xfrm_SetRot]=CChangesDrawingsDouble;AscDFH.changesFactory[AscDFH.historyitem_SpPr_SetParent]=CChangesDrawingsObject;AscDFH.changesFactory[AscDFH.historyitem_SpPr_SetBwMode]=CChangesDrawingsLong;AscDFH.changesFactory[AscDFH.historyitem_SpPr_SetXfrm]=CChangesDrawingsObject;AscDFH.changesFactory[AscDFH.historyitem_SpPr_SetGeometry]= CChangesDrawingsObject;AscDFH.changesFactory[AscDFH.historyitem_SpPr_SetFill]=CChangesDrawingsObjectNoId;AscDFH.changesFactory[AscDFH.historyitem_SpPr_SetLn]=CChangesDrawingsObjectNoId;AscDFH.changesFactory[AscDFH.historyitem_SpPr_SetEffectPr]=CChangesDrawingsObjectNoId;AscDFH.changesFactory[AscDFH.historyitem_ClrMap_SetClr]=CChangesDrawingsContentLongMap;AscDFH.changesFactory[AscDFH.historyitem_ExtraClrScheme_SetClrScheme]=CChangesDrawingsObjectNoId;AscDFH.changesFactory[AscDFH.historyitem_ExtraClrScheme_SetClrMap]= CChangesDrawingsObject;AscDFH.changesFactory[AscDFH.historyitem_ThemeSetColorScheme]=CChangesDrawingsObjectNoId;AscDFH.changesFactory[AscDFH.historyitem_ThemeSetFontScheme]=CChangesDrawingsObjectNoId;AscDFH.changesFactory[AscDFH.historyitem_ThemeSetFmtScheme]=CChangesDrawingsObjectNoId;AscDFH.changesFactory[AscDFH.historyitem_ThemeSetName]=CChangesDrawingsString;AscDFH.changesFactory[AscDFH.historyitem_ThemeSetIsThemeOverride]=CChangesDrawingsBool;AscDFH.changesFactory[AscDFH.historyitem_ThemeSetSpDef]= CChangesDrawingsObject;AscDFH.changesFactory[AscDFH.historyitem_ThemeSetLnDef]=CChangesDrawingsObject;AscDFH.changesFactory[AscDFH.historyitem_ThemeSetTxDef]=CChangesDrawingsObject;AscDFH.changesFactory[AscDFH.historyitem_ThemeAddExtraClrScheme]=CChangesDrawingsContent;AscDFH.changesFactory[AscDFH.historyitem_ThemeRemoveExtraClrScheme]=CChangesDrawingsContent;AscDFH.changesFactory[AscDFH.historyitem_HF_SetDt]=CChangesDrawingsBool;AscDFH.changesFactory[AscDFH.historyitem_HF_SetFtr]=CChangesDrawingsBool; AscDFH.changesFactory[AscDFH.historyitem_HF_SetHdr]=CChangesDrawingsBool;AscDFH.changesFactory[AscDFH.historyitem_HF_SetSldNum]=CChangesDrawingsBool;function CreateFontRef(idx,color){var ret=new FontRef;ret.idx=idx;ret.Color=color;return ret}function CreateStyleRef(idx,color){var ret=new StyleRef;ret.idx=idx;ret.Color=color;return ret}function CreatePresetColor(id){var ret=new CPrstColor;ret.idx=id;return ret}function sRGB_to_scRGB(value){if(value<0)return 0;if(value<=.04045)return value/12.92;if(value<= 1)return Math.pow((value+.055)/1.055,2.4);return 1}function scRGB_to_sRGB(value){if(value<0)return 0;if(value<=.0031308)return value*12.92;if(value<1)return 1.055*Math.pow(value,1/2.4)-.055;return 1}function checkRasterImageId(rasterImageId){var imageLocal=AscCommon.g_oDocumentUrls.getImageLocal(rasterImageId);return imageLocal?imageLocal:rasterImageId}var g_oThemeFontsName={};g_oThemeFontsName["+mj-cs"]=true;g_oThemeFontsName["+mj-ea"]=true;g_oThemeFontsName["+mj-lt"]=true;g_oThemeFontsName["+mn-cs"]= true;g_oThemeFontsName["+mn-ea"]=true;g_oThemeFontsName["+mn-lt"]=true;g_oThemeFontsName["majorAscii"]=true;g_oThemeFontsName["majorBidi"]=true;g_oThemeFontsName["majorEastAsia"]=true;g_oThemeFontsName["majorHAnsi"]=true;g_oThemeFontsName["minorAscii"]=true;g_oThemeFontsName["minorBidi"]=true;g_oThemeFontsName["minorEastAsia"]=true;g_oThemeFontsName["minorHAnsi"]=true;function isRealNumber(n){return typeof n==="number"&&!isNaN(n)}function isRealBool(b){return b===true||b===false}function writeLong(w, val){w.WriteBool(isRealNumber(val));if(isRealNumber(val))w.WriteLong(val)}function readLong(r){var ret;if(r.GetBool())ret=r.GetLong();else ret=null;return ret}function writeDouble(w,val){w.WriteBool(isRealNumber(val));if(isRealNumber(val))w.WriteDouble(val)}function readDouble(r){var ret;if(r.GetBool())ret=r.GetDouble();else ret=null;return ret}function writeBool(w,val){w.WriteBool(isRealBool(val));if(isRealBool(val))w.WriteBool(val)}function readBool(r){var ret;if(r.GetBool())ret=r.GetBool();else ret= null;return ret}function writeString(w,val){w.WriteBool(typeof val==="string");if(typeof val==="string")w.WriteString2(val)}function readString(r){var ret;if(r.GetBool())ret=r.GetString2();else ret=null;return ret}function writeObject(w,val){w.WriteBool(isRealObject(val));if(isRealObject(val))w.WriteString2(val.Get_Id())}function readObject(r){var ret;if(r.GetBool())ret=g_oTableId.Get_ById(r.GetString2());else ret=null;return ret}function checkThemeFonts(oFontMap,font_scheme){if(oFontMap["+mj-lt"]){if(font_scheme.majorFont&& typeof font_scheme.majorFont.latin==="string"&&font_scheme.majorFont.latin.length>0)oFontMap[font_scheme.majorFont.latin]=1;delete oFontMap["+mj-lt"]}if(oFontMap["+mj-ea"]){if(font_scheme.majorFont&&typeof font_scheme.majorFont.ea==="string"&&font_scheme.majorFont.ea.length>0)oFontMap[font_scheme.majorFont.ea]=1;delete oFontMap["+mj-ea"]}if(oFontMap["+mj-cs"]){if(font_scheme.majorFont&&typeof font_scheme.majorFont.cs==="string"&&font_scheme.majorFont.cs.length>0)oFontMap[font_scheme.majorFont.cs]= 1;delete oFontMap["+mj-cs"]}if(oFontMap["+mn-lt"]){if(font_scheme.minorFont&&typeof font_scheme.minorFont.latin==="string"&&font_scheme.minorFont.latin.length>0)oFontMap[font_scheme.minorFont.latin]=1;delete oFontMap["+mn-lt"]}if(oFontMap["+mn-ea"]){if(font_scheme.minorFont&&typeof font_scheme.minorFont.ea==="string"&&font_scheme.minorFont.ea.length>0)oFontMap[font_scheme.minorFont.ea]=1;delete oFontMap["+mn-ea"]}if(oFontMap["+mn-cs"]){if(font_scheme.minorFont&&typeof font_scheme.minorFont.cs==="string"&& font_scheme.minorFont.cs.length>0)oFontMap[font_scheme.minorFont.cs]=1;delete oFontMap["+mn-cs"]}}function ExecuteNoHistory(f,oThis,args){History.TurnOff&&History.TurnOff();var b_table_id=false;if(g_oTableId&&!g_oTableId.m_bTurnOff){g_oTableId.m_bTurnOff=true;b_table_id=true}var ret=f.apply(oThis,args);History.TurnOn&&History.TurnOn();if(b_table_id)g_oTableId.m_bTurnOff=false;return ret}function checkObjectUnifill(obj,theme,colorMap){if(obj&&obj.Unifill){obj.Unifill.check(theme,colorMap);var rgba= obj.Unifill.getRGBAColor();obj.Color=new CDocumentColor(rgba.R,rgba.G,rgba.B,false)}}function checkTableCellPr(cellPr,slide,layout,master,theme){cellPr.Check_PresentationPr(theme);var color_map,rgba;if(slide.clrMap)color_map=slide.clrMap;else if(layout.clrMap)color_map=layout.clrMap;else if(master.clrMap)color_map=master.clrMap;else color_map=AscFormat.G_O_DEFAULT_COLOR_MAP;checkObjectUnifill(cellPr.Shd,theme,color_map);if(cellPr.TableCellBorders){checkObjectUnifill(cellPr.TableCellBorders.Left,theme, color_map);checkObjectUnifill(cellPr.TableCellBorders.Top,theme,color_map);checkObjectUnifill(cellPr.TableCellBorders.Right,theme,color_map);checkObjectUnifill(cellPr.TableCellBorders.Bottom,theme,color_map);checkObjectUnifill(cellPr.TableCellBorders.InsideH,theme,color_map);checkObjectUnifill(cellPr.TableCellBorders.InsideV,theme,color_map)}return cellPr}var Ax_Counter={GLOBAL_AX_ID_COUNTER:1E3};var TYPE_TRACK={SHAPE:0,GROUP:0,GROUP_PASSIVE:1,TEXT:2,EMPTY_PH:3,CHART_TEXT:4,CROP:5};var TYPE_KIND= {SLIDE:0,LAYOUT:1,MASTER:2,NOTES:3,NOTES_MASTER:4};var TYPE_TRACK_SHAPE=0;var TYPE_TRACK_GROUP=TYPE_TRACK_SHAPE;var TYPE_TRACK_GROUP_PASSIVE=1;var TYPE_TRACK_TEXT=2;var TYPE_TRACK_EMPTY_PH=3;var TYPE_TRACK_CHART=4;var SLIDE_KIND=0;var LAYOUT_KIND=1;var MASTER_KIND=2;var map_prst_color={};map_prst_color["aliceBlue"]=15792383;map_prst_color["antiqueWhite"]=16444375;map_prst_color["aqua"]=65535;map_prst_color["aquamarine"]=8388564;map_prst_color["azure"]=15794175;map_prst_color["beige"]=16119260;map_prst_color["bisque"]= 16770244;map_prst_color["black"]=0;map_prst_color["blanchedAlmond"]=16772045;map_prst_color["blue"]=255;map_prst_color["blueViolet"]=9055202;map_prst_color["brown"]=10824234;map_prst_color["burlyWood"]=14596231;map_prst_color["cadetBlue"]=6266528;map_prst_color["chartreuse"]=8388352;map_prst_color["chocolate"]=13789470;map_prst_color["coral"]=16744272;map_prst_color["cornflowerBlue"]=6591981;map_prst_color["cornsilk"]=16775388;map_prst_color["crimson"]=14423100;map_prst_color["cyan"]=65535;map_prst_color["darkBlue"]= 139;map_prst_color["darkCyan"]=35723;map_prst_color["darkGoldenrod"]=12092939;map_prst_color["darkGray"]=11119017;map_prst_color["darkGreen"]=25600;map_prst_color["darkGrey"]=11119017;map_prst_color["darkKhaki"]=12433259;map_prst_color["darkMagenta"]=9109643;map_prst_color["darkOliveGreen"]=5597999;map_prst_color["darkOrange"]=16747520;map_prst_color["darkOrchid"]=10040012;map_prst_color["darkRed"]=9109504;map_prst_color["darkSalmon"]=15308410;map_prst_color["darkSeaGreen"]=9419919;map_prst_color["darkSlateBlue"]= 4734347;map_prst_color["darkSlateGray"]=3100495;map_prst_color["darkSlateGrey"]=3100495;map_prst_color["darkTurquoise"]=52945;map_prst_color["darkViolet"]=9699539;map_prst_color["deepPink"]=16716947;map_prst_color["deepSkyBlue"]=49151;map_prst_color["dimGray"]=6908265;map_prst_color["dimGrey"]=6908265;map_prst_color["dkBlue"]=139;map_prst_color["dkCyan"]=35723;map_prst_color["dkGoldenrod"]=12092939;map_prst_color["dkGray"]=11119017;map_prst_color["dkGreen"]=25600;map_prst_color["dkGrey"]=11119017; map_prst_color["dkKhaki"]=12433259;map_prst_color["dkMagenta"]=9109643;map_prst_color["dkOliveGreen"]=5597999;map_prst_color["dkOrange"]=16747520;map_prst_color["dkOrchid"]=10040012;map_prst_color["dkRed"]=9109504;map_prst_color["dkSalmon"]=15308410;map_prst_color["dkSeaGreen"]=9419915;map_prst_color["dkSlateBlue"]=4734347;map_prst_color["dkSlateGray"]=3100495;map_prst_color["dkSlateGrey"]=3100495;map_prst_color["dkTurquoise"]=52945;map_prst_color["dkViolet"]=9699539;map_prst_color["dodgerBlue"]= 2003199;map_prst_color["firebrick"]=11674146;map_prst_color["floralWhite"]=16775920;map_prst_color["forestGreen"]=2263842;map_prst_color["fuchsia"]=16711935;map_prst_color["gainsboro"]=14474460;map_prst_color["ghostWhite"]=16316671;map_prst_color["gold"]=16766720;map_prst_color["goldenrod"]=14329120;map_prst_color["gray"]=8421504;map_prst_color["green"]=32768;map_prst_color["greenYellow"]=11403055;map_prst_color["grey"]=8421504;map_prst_color["honeydew"]=15794160;map_prst_color["hotPink"]=16738740; map_prst_color["indianRed"]=13458524;map_prst_color["indigo"]=4915330;map_prst_color["ivory"]=16777200;map_prst_color["khaki"]=15787660;map_prst_color["lavender"]=15132410;map_prst_color["lavenderBlush"]=16773365;map_prst_color["lawnGreen"]=8190976;map_prst_color["lemonChiffon"]=16775885;map_prst_color["lightBlue"]=11393254;map_prst_color["lightCoral"]=15761536;map_prst_color["lightCyan"]=14745599;map_prst_color["lightGoldenrodYellow"]=16448210;map_prst_color["lightGray"]=13882323;map_prst_color["lightGreen"]= 9498256;map_prst_color["lightGrey"]=13882323;map_prst_color["lightPink"]=16758465;map_prst_color["lightSalmon"]=16752762;map_prst_color["lightSeaGreen"]=2142890;map_prst_color["lightSkyBlue"]=8900346;map_prst_color["lightSlateGray"]=7833753;map_prst_color["lightSlateGrey"]=7833753;map_prst_color["lightSteelBlue"]=11584734;map_prst_color["lightYellow"]=16777184;map_prst_color["lime"]=65280;map_prst_color["limeGreen"]=3329330;map_prst_color["linen"]=16445670;map_prst_color["ltBlue"]=11393254;map_prst_color["ltCoral"]= 15761536;map_prst_color["ltCyan"]=14745599;map_prst_color["ltGoldenrodYellow"]=16448120;map_prst_color["ltGray"]=13882323;map_prst_color["ltGreen"]=9498256;map_prst_color["ltGrey"]=13882323;map_prst_color["ltPink"]=16758465;map_prst_color["ltSalmon"]=16752762;map_prst_color["ltSeaGreen"]=2142890;map_prst_color["ltSkyBlue"]=8900346;map_prst_color["ltSlateGray"]=7833753;map_prst_color["ltSlateGrey"]=7833753;map_prst_color["ltSteelBlue"]=11584734;map_prst_color["ltYellow"]=16777184;map_prst_color["magenta"]= 16711935;map_prst_color["maroon"]=8388608;map_prst_color["medAquamarine"]=6737322;map_prst_color["medBlue"]=205;map_prst_color["mediumAquamarine"]=6737322;map_prst_color["mediumBlue"]=205;map_prst_color["mediumOrchid"]=12211667;map_prst_color["mediumPurple"]=9662683;map_prst_color["mediumSeaGreen"]=3978097;map_prst_color["mediumSlateBlue"]=8087790;map_prst_color["mediumSpringGreen"]=64154;map_prst_color["mediumTurquoise"]=4772300;map_prst_color["mediumVioletRed"]=13047173;map_prst_color["medOrchid"]= 12211667;map_prst_color["medPurple"]=9662683;map_prst_color["medSeaGreen"]=3978097;map_prst_color["medSlateBlue"]=8087790;map_prst_color["medSpringGreen"]=64154;map_prst_color["medTurquoise"]=4772300;map_prst_color["medVioletRed"]=13047173;map_prst_color["midnightBlue"]=1644912;map_prst_color["mintCream"]=16121850;map_prst_color["mistyRose"]=16770303;map_prst_color["moccasin"]=16770229;map_prst_color["navajoWhite"]=16768685;map_prst_color["navy"]=128;map_prst_color["oldLace"]=16643558;map_prst_color["olive"]= 8421376;map_prst_color["oliveDrab"]=7048739;map_prst_color["orange"]=16753920;map_prst_color["orangeRed"]=16729344;map_prst_color["orchid"]=14315734;map_prst_color["paleGoldenrod"]=15657130;map_prst_color["paleGreen"]=10025880;map_prst_color["paleTurquoise"]=11529966;map_prst_color["paleVioletRed"]=14381203;map_prst_color["papayaWhip"]=16773077;map_prst_color["peachPuff"]=16767673;map_prst_color["peru"]=13468991;map_prst_color["pink"]=16761035;map_prst_color["plum"]=13869267;map_prst_color["powderBlue"]= 11591910;map_prst_color["purple"]=8388736;map_prst_color["red"]=16711680;map_prst_color["rosyBrown"]=12357519;map_prst_color["royalBlue"]=4286945;map_prst_color["saddleBrown"]=9127187;map_prst_color["salmon"]=16416882;map_prst_color["sandyBrown"]=16032864;map_prst_color["seaGreen"]=3050327;map_prst_color["seaShell"]=16774638;map_prst_color["sienna"]=10506797;map_prst_color["silver"]=12632256;map_prst_color["skyBlue"]=8900331;map_prst_color["slateBlue"]=6970091;map_prst_color["slateGray"]=7372944; map_prst_color["slateGrey"]=7372944;map_prst_color["snow"]=16775930;map_prst_color["springGreen"]=65407;map_prst_color["steelBlue"]=4620980;map_prst_color["tan"]=13808780;map_prst_color["teal"]=32896;map_prst_color["thistle"]=14204888;map_prst_color["tomato"]=16741191;map_prst_color["turquoise"]=4251856;map_prst_color["violet"]=15631086;map_prst_color["wheat"]=16113331;map_prst_color["white"]=16777215;map_prst_color["whiteSmoke"]=16119285;map_prst_color["yellow"]=16776960;map_prst_color["yellowGreen"]= 10145074;function CColorMod(){this.name="";this.val=0}CColorMod.prototype={getObjectType:function(){return AscDFH.historyitem_type_ColorMod},Get_Id:function(){return this.Id},Refresh_RecalcData:function(){},setName:function(name){this.name=name},setVal:function(val){this.val=val},createDuplicate:function(){var duplicate=new CColorMod;duplicate.name=this.name;duplicate.val=this.val;return duplicate}};var cd16=1/6;var cd13=1/3;var cd23=2/3;var max_hls=255;var DEC_GAMMA=2.3;var INC_GAMMA=1/DEC_GAMMA; var MAX_PERCENT=1E5;function CColorModifiers(){this.Mods=[]}CColorModifiers.prototype.isUsePow=!AscCommon.AscBrowser.isSailfish||!AscCommon.AscBrowser.isEmulateDevicePixelRatio;CColorModifiers.prototype.getModValue=function(sName){if(Array.isArray(this.Mods))for(var i=0;iG?R:G;iMax=iMax>B?iMax:B;var iDelta=iMax-iMin;var dMax=(iMax+iMin)/255;var dDelta= iDelta/255;var H=0;var S=0;var L=dMax/2;if(iDelta!=0){if(L<.5)S=dDelta/dMax;else S=dDelta/(2-dMax);dDelta=dDelta*1530;var dR=(iMax-R)/dDelta;var dG=(iMax-G)/dDelta;var dB=(iMax-B)/dDelta;if(R==iMax)H=dB-dG;else if(G==iMax)H=cd13+dR-dB;else if(B==iMax)H=cd23+dG-dR;if(H<0)H+=1;if(H>1)H-=1}H=H*max_hls>>0&255;if(H<0)H=0;if(H>255)H=255;S=S*max_hls>>0&255;if(S<0)S=0;if(S>255)S=255;L=L*max_hls>>0&255;if(L<0)L=0;if(L>255)L=255;HLS.H=H;HLS.S=S;HLS.L=L};CColorModifiers.prototype.HSL2RGB=function(HSL,RGB){if(HSL.S== 0){RGB.R=HSL.L;RGB.G=HSL.L;RGB.B=HSL.L}else{var H=HSL.H/max_hls;var S=HSL.S/max_hls;var L=HSL.L/max_hls;var v2=0;if(L<.5)v2=L*(1+S);else v2=L+S-S*L;var v1=2*L-v2;var R=255*this.Hue_2_RGB(v1,v2,H+cd13)>>0;var G=255*this.Hue_2_RGB(v1,v2,H)>>0;var B=255*this.Hue_2_RGB(v1,v2,H-cd13)>>0;if(R<0)R=0;if(R>255)R=255;if(G<0)G=0;if(G>255)G=255;if(B<0)B=0;if(B>255)B=255;RGB.R=R;RGB.G=G;RGB.B=B}};CColorModifiers.prototype.Hue_2_RGB=function(v1,v2,vH){if(vH<0)vH+=1;if(vH>1)vH-=1;if(vH>0};CColorModifiers.prototype.RgbtoCrgb=function(RGBA){if(this.isUsePow){RGBA.R=Math.pow(RGBA.R/255,DEC_GAMMA)*MAX_PERCENT+.5>> 0;RGBA.G=Math.pow(RGBA.G/255,DEC_GAMMA)*MAX_PERCENT+.5>>0;RGBA.B=Math.pow(RGBA.B/255,DEC_GAMMA)*MAX_PERCENT+.5>>0}};CColorModifiers.prototype.CrgbtoRgb=function(RGBA){if(this.isUsePow){RGBA.R=Math.pow(RGBA.R/1E5,INC_GAMMA)*255+.5>>0;RGBA.G=Math.pow(RGBA.G/1E5,INC_GAMMA)*255+.5>>0;RGBA.B=Math.pow(RGBA.B/1E5,INC_GAMMA)*255+.5>>0}else{RGBA.R=AscFormat.ClampColor(RGBA.R);RGBA.G=AscFormat.ClampColor(RGBA.G);RGBA.B=AscFormat.ClampColor(RGBA.B)}};CColorModifiers.prototype.Apply=function(RGBA){if(null==this.Mods)return; var _len=this.Mods.length;for(var i=0;i<_len;i++){var colorMod=this.Mods[i];var val=colorMod.val/1E5;if(colorMod.name=="alpha")RGBA.A=AscFormat.ClampColor(255*val);else if(colorMod.name=="blue")RGBA.B=AscFormat.ClampColor(255*val);else if(colorMod.name=="blueMod")RGBA.B=AscFormat.ClampColor(RGBA.B*val);else if(colorMod.name=="blueOff")RGBA.B=AscFormat.ClampColor(RGBA.B+val*255);else if(colorMod.name=="green")RGBA.G=AscFormat.ClampColor(255*val);else if(colorMod.name=="greenMod")RGBA.G=AscFormat.ClampColor(RGBA.G* val);else if(colorMod.name=="greenOff")RGBA.G=AscFormat.ClampColor(RGBA.G+val*255);else if(colorMod.name=="red")RGBA.R=AscFormat.ClampColor(255*val);else if(colorMod.name=="redMod")RGBA.R=AscFormat.ClampColor(RGBA.R*val);else if(colorMod.name=="redOff")RGBA.R=AscFormat.ClampColor(RGBA.R+val*255);else if(colorMod.name=="hueOff"){var HSL={H:0,S:0,L:0};this.RGB2HSL(RGBA.R,RGBA.G,RGBA.B,HSL);var res=HSL.H+val*10/9+.5>>0;HSL.H=AscFormat.ClampColor2(res,0,max_hls);this.HSL2RGB(HSL,RGBA)}else if(colorMod.name== "inv"){RGBA.R^=255;RGBA.G^=255;RGBA.B^=255}else if(colorMod.name=="lumMod"){var HSL={H:0,S:0,L:0};this.RGB2HSL(RGBA.R,RGBA.G,RGBA.B,HSL);HSL.L=AscFormat.ClampColor2(HSL.L*val,0,max_hls);this.HSL2RGB(HSL,RGBA)}else if(colorMod.name=="lumOff"){var HSL={H:0,S:0,L:0};this.RGB2HSL(RGBA.R,RGBA.G,RGBA.B,HSL);var res=HSL.L+val*max_hls+.5>>0;HSL.L=AscFormat.ClampColor2(res,0,max_hls);this.HSL2RGB(HSL,RGBA)}else if(colorMod.name=="satMod"){var HSL={H:0,S:0,L:0};this.RGB2HSL(RGBA.R,RGBA.G,RGBA.B,HSL);HSL.S= AscFormat.ClampColor2(HSL.S*val,0,max_hls);this.HSL2RGB(HSL,RGBA)}else if(colorMod.name=="satOff"){var HSL={H:0,S:0,L:0};this.RGB2HSL(RGBA.R,RGBA.G,RGBA.B,HSL);var res=HSL.S+val*max_hls+.5>>0;HSL.S=AscFormat.ClampColor2(res,0,max_hls);this.HSL2RGB(HSL,RGBA)}else if(colorMod.name=="wordShade"){var val_=colorMod.val/255;var HSL={H:0,S:0,L:0};this.RGB2HSL(RGBA.R,RGBA.G,RGBA.B,HSL);HSL.L=AscFormat.ClampColor2(HSL.L*val_,0,max_hls);this.HSL2RGB(HSL,RGBA)}else if(colorMod.name=="wordTint"){var _val=colorMod.val/ 255;var HSL={H:0,S:0,L:0};this.RGB2HSL(RGBA.R,RGBA.G,RGBA.B,HSL);var L_=HSL.L*_val+(255-colorMod.val);HSL.L=AscFormat.ClampColor2(L_,0,max_hls);this.HSL2RGB(HSL,RGBA)}else if(colorMod.name=="shade"){this.RgbtoCrgb(RGBA);if(val<0)val=0;if(val>1)val=1;RGBA.R=RGBA.R*val;RGBA.G=RGBA.G*val;RGBA.B=RGBA.B*val;this.CrgbtoRgb(RGBA)}else if(colorMod.name=="tint"){this.RgbtoCrgb(RGBA);if(val<0)val=0;if(val>1)val=1;RGBA.R=MAX_PERCENT-(MAX_PERCENT-RGBA.R)*val;RGBA.G=MAX_PERCENT-(MAX_PERCENT-RGBA.G)*val;RGBA.B= MAX_PERCENT-(MAX_PERCENT-RGBA.B)*val;this.CrgbtoRgb(RGBA)}else if(colorMod.name=="gamma"){this.RgbtoCrgb(RGBA);RGBA.R=this.lclGamma(RGBA.R,INC_GAMMA);RGBA.G=this.lclGamma(RGBA.G,INC_GAMMA);RGBA.B=this.lclGamma(RGBA.B,INC_GAMMA);this.CrgbtoRgb(RGBA)}else if(colorMod.name=="invGamma"){this.RgbtoCrgb(RGBA);RGBA.R=this.lclGamma(RGBA.R,DEC_GAMMA);RGBA.G=this.lclGamma(RGBA.G,DEC_GAMMA);RGBA.B=this.lclGamma(RGBA.B,DEC_GAMMA);this.CrgbtoRgb(RGBA)}}};CColorModifiers.prototype.Merge=function(oOther){if(!oOther)return; this.Mods=oOther.Mods.concat(this.Mods)};function CSysColor(){this.type=c_oAscColor.COLOR_TYPE_SYS;this.id="";this.RGBA={R:0,G:0,B:0,A:255,needRecalc:true}}CSysColor.prototype={Get_Id:function(){return this.Id},Refresh_RecalcData:function(){},setR:function(pr){this.RGBA.R=pr},setG:function(pr){this.RGBA.G=pr},setB:function(pr){this.RGBA.B=pr},check:function(){var ret=this.RGBA.needRecalc;this.RGBA.needRecalc=false;return ret},getObjectType:function(){return AscDFH.historyitem_type_SysColor},Write_ToBinary:function(w){w.WriteLong(this.type); w.WriteString2(this.id);w.WriteLong((this.RGBA.R<<16&16711680)+(this.RGBA.G<<8&65280)+this.RGBA.B)},Read_FromBinary:function(r){this.id=r.GetString2();var RGB=r.GetLong();this.RGBA.R=RGB>>16&255;this.RGBA.G=RGB>>8&255;this.RGBA.B=RGB&255},setId:function(id){this.id=id},IsIdentical:function(color){return color&&color.type==this.type&&color.id==this.id},Calculate:function(obj){},createDuplicate:function(){var duplicate=new CSysColor;duplicate.id=this.id;duplicate.RGBA.R=this.RGBA.R;duplicate.RGBA.G= this.RGBA.G;duplicate.RGBA.B=this.RGBA.B;duplicate.RGBA.A=this.RGBA.A;return duplicate}};function CPrstColor(){this.type=c_oAscColor.COLOR_TYPE_PRST;this.id="";this.RGBA={R:0,G:0,B:0,A:255,needRecalc:true}}CPrstColor.prototype={Get_Id:function(){return this.Id},Refresh_RecalcData:function(){},getObjectType:function(){return AscDFH.historyitem_type_PrstColor},Write_ToBinary:function(w){w.WriteLong(this.type);w.WriteString2(this.id)},Read_FromBinary:function(r){this.id=r.GetString2()},setId:function(id){this.id= id},IsIdentical:function(color){return color&&color.type==this.type&&color.id==this.id},createDuplicate:function(){var duplicate=new CPrstColor;duplicate.id=this.id;duplicate.RGBA.R=this.RGBA.R;duplicate.RGBA.G=this.RGBA.G;duplicate.RGBA.B=this.RGBA.B;duplicate.RGBA.A=this.RGBA.A;return duplicate},Calculate:function(obj){var RGB=map_prst_color[this.id];this.RGBA.R=RGB>>16&255;this.RGBA.G=RGB>>8&255;this.RGBA.B=RGB&255},check:function(){var r,g,b,rgb;rgb=map_prst_color[this.id];r=rgb>>16&255;g=rgb>> 8&255;b=rgb&255;var RGBA=this.RGBA;if(RGBA.needRecalc){RGBA.R=r;RGBA.G=g;RGBA.B=b;RGBA.needRecalc=false;return true}else if(RGBA.R===r&&RGBA.G===g&&RGBA.B===b)return false;else{RGBA.R=r;RGBA.G=g;RGBA.B=b;return true}}};function CRGBColor(){this.type=c_oAscColor.COLOR_TYPE_SRGB;this.RGBA={R:0,G:0,B:0,A:255,needRecalc:true}}CRGBColor.prototype={Get_Id:function(){return this.Id},Refresh_RecalcData:function(){},check:function(){var ret=this.RGBA.needRecalc;this.RGBA.needRecalc=false;return ret},getObjectType:function(){return AscDFH.historyitem_type_RGBColor}, writeToBinaryLong:function(w){w.WriteLong((this.RGBA.R<<16&16711680)+(this.RGBA.G<<8&65280)+this.RGBA.B)},readFromBinaryLong:function(r){var RGB=r.GetLong();this.RGBA.R=RGB>>16&255;this.RGBA.G=RGB>>8&255;this.RGBA.B=RGB&255},Write_ToBinary:function(w){w.WriteLong(this.type);w.WriteLong((this.RGBA.R<<16&16711680)+(this.RGBA.G<<8&65280)+this.RGBA.B)},Read_FromBinary:function(r){var RGB=r.GetLong();this.RGBA.R=RGB>>16&255;this.RGBA.G=RGB>>8&255;this.RGBA.B=RGB&255},setColor:function(r,g,b){this.RGBA.R= r;this.RGBA.G=g;this.RGBA.B=b},IsIdentical:function(color){return color&&color.type==this.type&&color.RGBA.R==this.RGBA.R&&color.RGBA.G==this.RGBA.G&&color.RGBA.B==this.RGBA.B&&color.RGBA.A==this.RGBA.A},createDuplicate:function(){var duplicate=new CRGBColor;duplicate.id=this.id;duplicate.RGBA.R=this.RGBA.R;duplicate.RGBA.G=this.RGBA.G;duplicate.RGBA.B=this.RGBA.B;duplicate.RGBA.A=this.RGBA.A;return duplicate},Calculate:function(obj){}};function CSchemeColor(){this.type=c_oAscColor.COLOR_TYPE_SCHEME; this.id=0;this.RGBA={R:0,G:0,B:0,A:255,needRecalc:true}}CSchemeColor.prototype={Get_Id:function(){return this.Id},Refresh_RecalcData:function(){},check:function(theme,colorMap){var RGBA,colors=theme.themeElements.clrScheme.colors;if(colorMap[this.id]!=null&&colors[colorMap[this.id]]!=null)RGBA=colors[colorMap[this.id]].color.RGBA;else if(colors[this.id]!=null)RGBA=colors[this.id].color.RGBA;if(!RGBA)RGBA={R:0,G:0,B:0,A:255};var _RGBA=this.RGBA;if(this.RGBA.needRecalc){_RGBA.R=RGBA.R;_RGBA.G=RGBA.G; _RGBA.B=RGBA.B;_RGBA.A=RGBA.A;this.RGBA.needRecalc=false;return true}else if(_RGBA.R===RGBA.R&&_RGBA.G===RGBA.G&&_RGBA.B===RGBA.B&&_RGBA.A===RGBA.A)return false;else{_RGBA.R=RGBA.R;_RGBA.G=RGBA.G;_RGBA.B=RGBA.B;_RGBA.A=RGBA.A;return true}},getObjectType:function(){return AscDFH.historyitem_type_SchemeColor},Write_ToBinary:function(w){w.WriteLong(this.type);w.WriteLong(this.id)},Read_FromBinary:function(r){this.id=r.GetLong()},setId:function(id){this.id=id},IsIdentical:function(color){return color&& color.type==this.type&&color.id==this.id},createDuplicate:function(){var duplicate=new CSchemeColor;duplicate.id=this.id;duplicate.RGBA.R=this.RGBA.R;duplicate.RGBA.G=this.RGBA.G;duplicate.RGBA.B=this.RGBA.B;duplicate.RGBA.A=this.RGBA.A;return duplicate},Calculate:function(theme,slide,layout,masterSlide,RGBA,colorMap){if(theme.themeElements.clrScheme)if(this.id==phClr)this.RGBA=RGBA;else{var clrMap;if(colorMap&&colorMap.color_map)clrMap=colorMap.color_map;else if(slide!=null&&slide.clrMap!=null)clrMap= slide.clrMap.color_map;else if(layout!=null&&layout.clrMap!=null)clrMap=layout.clrMap.color_map;else if(masterSlide!=null&&masterSlide.clrMap!=null)clrMap=masterSlide.clrMap.color_map;else clrMap=AscFormat.DEFAULT_COLOR_MAP.color_map;if(clrMap[this.id]!=null&&theme.themeElements.clrScheme.colors[clrMap[this.id]]!=null&&theme.themeElements.clrScheme.colors[clrMap[this.id]].color!=null)this.RGBA=theme.themeElements.clrScheme.colors[clrMap[this.id]].color.RGBA;else if(theme.themeElements.clrScheme.colors[this.id]!= null&&theme.themeElements.clrScheme.colors[this.id].color!=null)this.RGBA=theme.themeElements.clrScheme.colors[this.id].color.RGBA}}};function CStyleColor(){this.bAuto=false;this.val=null}CStyleColor.prototype.type=c_oAscColor.COLOR_TYPE_STYLE;CStyleColor.prototype.check=function(theme,colorMap){};CStyleColor.prototype.Write_ToBinary=function(w){w.WriteLong(this.type);writeBool(w,this.bAuto);writeLong(w,this.val)};CStyleColor.prototype.Read_FromBinary=function(r){this.bAuto=readBool(r);this.val=readLong(r)}; CStyleColor.prototype.IsIdentical=function(color){return color&&color.type==this.type&&color.bAuto==this.bAuto&&this.val===color.val};CStyleColor.prototype.createDuplicate=function(){var duplicate=new CStyleColor;duplicate.bAuto=this.bAuto;duplicate.val=this.val;return duplicate};CStyleColor.prototype.Calculate=function(theme,slide,layout,masterSlide,RGBA,colorMap){};CStyleColor.prototype.getNoStyleUnicolor=function(nIdx,aColors){if(this.bAuto||this.val===null)return aColors[nIdx%aColors.length]; else return aColors[this.val%aColors.length]};function CUniColor(){this.color=null;this.Mods=null;this.RGBA={R:0,G:0,B:0,A:255}}CUniColor.prototype={checkPhColor:function(unicolor,bMergeMods){if(this.color&&this.color.type===c_oAscColor.COLOR_TYPE_SCHEME&&this.color.id===14)if(unicolor){if(unicolor.color)this.color=unicolor.color.createDuplicate();if(unicolor.Mods)if(!this.Mods||this.Mods.Mods.length===0)this.Mods=unicolor.Mods.createDuplicate();else if(bMergeMods)this.Mods.Merge(unicolor.Mods)}}, saveSourceFormatting:function(){var _ret=new CUniColor;_ret.color=new CRGBColor;_ret.color.RGBA.R=this.RGBA.R;_ret.color.RGBA.G=this.RGBA.G;_ret.color.RGBA.B=this.RGBA.B;return _ret},addColorMod:function(mod){if(!this.Mods)this.Mods=new CColorModifiers;this.Mods.addMod(mod.createDuplicate())},check:function(theme,colorMap){if(this.color&&this.color.check(theme,colorMap.color_map)){this.RGBA.R=this.color.RGBA.R;this.RGBA.G=this.color.RGBA.G;this.RGBA.B=this.color.RGBA.B;if(this.Mods)this.Mods.Apply(this.RGBA)}}, getModValue:function(sModName){if(this.Mods&&this.Mods.getModValue)return this.Mods.getModValue(sModName);return null},checkWordMods:function(){return this.Mods&&this.Mods.Mods.length===1&&(this.Mods.Mods[0].name==="wordTint"||this.Mods.Mods[0].name==="wordShade")},convertToPPTXMods:function(){if(this.checkWordMods()){var val_,mod_;if(this.Mods.Mods[0].name==="wordShade"){mod_=new CColorMod;mod_.setName("lumMod");mod_.setVal(this.Mods.Mods[0].val/255*1E5>>0);this.Mods.Mods.splice(0,this.Mods.Mods.length); this.Mods.Mods.push(mod_)}else{val_=this.Mods.Mods[0].val/255*1E5>>0;this.Mods.Mods.splice(0,this.Mods.Mods.length);mod_=new CColorMod;mod_.setName("lumMod");mod_.setVal(val_);this.Mods.Mods.push(mod_);mod_=new CColorMod;mod_.setName("lumOff");mod_.setVal(1E5-val_);this.Mods.Mods.push(mod_)}}},canConvertPPTXModsToWord:function(){return this.Mods&&(this.Mods.Mods.length===1&&this.Mods.Mods[0].name==="lumMod"&&this.Mods.Mods[0].val>0||this.Mods.Mods.length===2&&this.Mods.Mods[0].name==="lumMod"&&this.Mods.Mods[0].val> 0&&this.Mods.Mods[1].name==="lumOff"&&this.Mods.Mods[1].val>0)},convertToWordMods:function(){if(this.canConvertPPTXModsToWord()){var mod_=new CColorMod;mod_.setName(this.Mods.Mods.length===1?"wordShade":"wordTint");mod_.setVal(this.Mods.Mods[0].val*255/1E5>>0);this.Mods.Mods.splice(0,this.Mods.Mods.length);this.Mods.Mods.push(mod_)}},getObjectType:function(){return AscDFH.historyitem_type_UniColor},setColor:function(color){this.color=color},setMods:function(mods){this.Mods=mods},Write_ToBinary:function(w){if(this.color){w.WriteBool(true); this.color.Write_ToBinary(w)}else w.WriteBool(false);if(this.Mods){w.WriteBool(true);this.Mods.Write_ToBinary(w)}else w.WriteBool(false)},Read_FromBinary:function(r){if(r.GetBool()){var type=r.GetLong();switch(type){case c_oAscColor.COLOR_TYPE_NONE:{break}case c_oAscColor.COLOR_TYPE_SRGB:{this.color=new CRGBColor;this.color.Read_FromBinary(r);break}case c_oAscColor.COLOR_TYPE_PRST:{this.color=new CPrstColor;this.color.Read_FromBinary(r);break}case c_oAscColor.COLOR_TYPE_SCHEME:{this.color=new CSchemeColor; this.color.Read_FromBinary(r);break}case c_oAscColor.COLOR_TYPE_SYS:{this.color=new CSysColor;this.color.Read_FromBinary(r);break}case c_oAscColor.COLOR_TYPE_STYLE:{this.color=new CStyleColor;this.color.Read_FromBinary(r);break}}}if(r.GetBool()){this.Mods=new CColorModifiers;this.Mods.Read_FromBinary(r)}else this.Mods=null},createDuplicate:function(){var duplicate=new CUniColor;if(this.color!=null)duplicate.color=this.color.createDuplicate();if(this.Mods)duplicate.Mods=this.Mods.createDuplicate(); duplicate.RGBA.R=this.RGBA.R;duplicate.RGBA.G=this.RGBA.G;duplicate.RGBA.B=this.RGBA.B;duplicate.RGBA.A=this.RGBA.A;return duplicate},IsIdentical:function(unicolor){if(!isRealObject(unicolor))return false;if(!isRealObject(unicolor.color)&&isRealObject(this.color)||!isRealObject(this.color)&&isRealObject(unicolor.color)||isRealObject(this.color)&&!this.color.IsIdentical(unicolor.color))return false;if(!isRealObject(unicolor.Mods)&&isRealObject(this.Mods)&&this.Mods.Mods.length>0||!isRealObject(this.Mods)&& isRealObject(unicolor.Mods)&&unicolor.Mods.Mods.length>0||isRealObject(this.Mods)&&!this.Mods.IsIdentical(unicolor.Mods))return false;return true},Calculate:function(theme,slide,layout,masterSlide,RGBA,colorMap){if(this.color==null)return this.RGBA;this.color.Calculate(theme,slide,layout,masterSlide,RGBA,colorMap);this.RGBA={R:this.color.RGBA.R,G:this.color.RGBA.G,B:this.color.RGBA.B,A:this.color.RGBA.A};if(this.Mods)this.Mods.Apply(this.RGBA)},compare:function(unicolor){if(unicolor==null)return null; var _ret=new CUniColor;if(this.color==null||unicolor.color==null||this.color.type!==unicolor.color.type)return _ret;if(this.Mods&&unicolor.Mods){var aMods=this.Mods.Mods;var aMods2=unicolor.Mods.Mods;if(aMods.length===aMods2.length){for(var i=0;i>0;RGBA.G=RGBA.G/_len>>0;RGBA.B=RGBA.B/_len>>0;return RGBA}if(this.fill.type== c_oAscFill.FILL_TYPE_PATT)return this.fill.fgClr.RGBA;if(this.fill.type==c_oAscFill.FILL_TYPE_NOFILL)return{R:0,G:0,B:0}}return new FormatRGBAColor};CUniFill.prototype.createDuplicate=function(){var duplicate=new CUniFill;if(this.fill!=null)duplicate.fill=this.fill.createDuplicate();duplicate.transparent=this.transparent;return duplicate};CUniFill.prototype.saveSourceFormatting=function(){var duplicate=new CUniFill;if(this.fill)if(this.fill.saveSourceFormatting)duplicate.fill=this.fill.saveSourceFormatting(); else duplicate.fill=this.fill.createDuplicate();duplicate.transparent=this.transparent;return duplicate};CUniFill.prototype.merge=function(unifill){if(unifill){if(unifill.fill!=null){this.fill=unifill.fill.createDuplicate();if(this.fill.type===c_oAscFill.FILL_TYPE_PATT){var _patt_fill=this.fill;if(!_patt_fill.fgClr)_patt_fill.setFgColor(CreateUniColorRGB(0,0,0));if(!_patt_fill.bgClr)_patt_fill.bgClr=CreateUniColorRGB(255,255,255)}}if(unifill.transparent!=null)this.transparent=unifill.transparent}}; CUniFill.prototype.IsIdentical=function(unifill){if(unifill==null)return false;if(isRealNumber(this.transparent)!==isRealNumber(unifill.transparent)||isRealNumber(this.transparent)&&this.transparent!==unifill.transparent)return false;if(this.fill==null&&unifill.fill==null)return true;if(this.fill!=null)return this.fill.IsIdentical(unifill.fill);else return false};CUniFill.prototype.Is_Equal=function(unfill){return this.IsIdentical(unfill)};CUniFill.prototype.compare=function(unifill){if(unifill== null)return null;var _ret=new CUniFill;if(!(this.fill==null||unifill.fill==null))if(this.fill.compare)_ret.fill=this.fill.compare(unifill.fill);return _ret.fill};CUniFill.prototype.isSolidFillRGB=function(){return this.fill&&this.fill.color&&this.fill.color.color&&this.fill.color.color.type===window["Asc"].c_oAscColor.COLOR_TYPE_SRGB};CUniFill.prototype.isNoFill=function(){return this.fill&&this.fill.type===window["Asc"].c_oAscFill.FILL_TYPE_NOFILL};CUniFill.prototype.isVisible=function(){return this.fill&& this.fill.type!==window["Asc"].c_oAscFill.FILL_TYPE_NOFILL};function CompareUniFill(unifill_1,unifill_2){if(unifill_1==null||unifill_2==null)return null;var _ret=new CUniFill;if(!(unifill_1.transparent===null||unifill_2.transparent===null||unifill_1.transparent!==unifill_2.transparent))_ret.transparent=unifill_1.transparent;if(unifill_1.fill==null||unifill_2.fill==null||unifill_1.fill.type!=unifill_2.fill.type)return _ret;_ret.fill=unifill_1.compare(unifill_2);return _ret}function CompareBlipTiles(tile1, tile2){if(isRealObject(tile1))return tile1.IsIdentical(tile2);return tile1===tile2}function CompareUnifillBool(u1,u2){if(!u1&&!u2)return true;if(!u1&&u2||u1&&!u2)return false;if(isRealNumber(u1.transparent)!==isRealNumber(u2.transparent)||isRealNumber(u1.transparent)&&u1.transparent!==u2.transparent)return false;if(!u1.fill&&!u2.fill)return true;if(!u1.fill&&u2.fill||u1.fill&&!u2.fill)return false;if(u1.fill.type!==u2.fill.type)return false;switch(u1.fill.type){case c_oAscFill.FILL_TYPE_BLIP:{if(u1.fill.RasterImageId&& !u2.fill.RasterImageId||u2.fill.RasterImageId&&!u1.fill.RasterImageId)return false;if(typeof u1.fill.RasterImageId==="string"&&typeof u2.fill.RasterImageId==="string"&&AscCommon.getFullImageSrc2(u1.fill.RasterImageId)!==AscCommon.getFullImageSrc2(u2.fill.RasterImageId))return false;if(u1.fill.srcRect&&!u2.fill.srcRect||!u1.fill.srcRect&&u2.fill.srcRect)return false;if(u1.fill.srcRect&&u2.fill.srcRect)if(u1.fill.srcRect.l!==u2.fill.srcRect.l||u1.fill.srcRect.t!==u2.fill.srcRect.t||u1.fill.srcRect.r!== u2.fill.srcRect.r||u1.fill.srcRect.b!==u2.fill.srcRect.b)return false;if(u1.fill.stretch!==u2.fill.stretch||!CompareBlipTiles(u1.fill.tile,u2.fill.tile)||u1.fill.rotWithShape!==u2.fill.rotWithShape)return false;break}case c_oAscFill.FILL_TYPE_SOLID:{if(u1.fill.color&&u2.fill.color)return CompareUniColor(u1.fill.color,u2.fill.color);break}case c_oAscFill.FILL_TYPE_GRAD:{if(u1.fill.colors.length!==u2.fill.colors.length)return false;if(isRealObject(u1.fill.path)!==isRealObject(u2.fill.path))return false; if(u1.fill.path&&!u1.fill.path.IsIdentical(u2.fill.path))return false;if(isRealObject(u1.fill.lin)!==isRealObject(u2.fill.lin))return false;if(u1.fill.lin&&!u1.fill.lin.IsIdentical(u2.fill.lin))return false;for(var i=0;i0){w.WriteBool(true);w.WriteLong(this.stCnxIdx);w.WriteString2(this.stCnxId)}else w.WriteBool(false);if(AscFormat.isRealNumber(this.endCnxIdx)&&typeof this.endCnxId==="string"&&this.endCnxId.length>0){w.WriteBool(true);w.WriteLong(this.endCnxIdx); w.WriteString2(this.endCnxId)}else w.WriteBool(false)};CNvUniSpPr.prototype.Read_FromBinary=function(r){var bCnx=r.GetBool();if(bCnx)this.locks=r.GetLong();else this.locks=null;bCnx=r.GetBool();if(bCnx){this.stCnxIdx=r.GetLong();this.stCnxId=r.GetString2()}else{this.stCnxIdx=null;this.stCnxId=null}bCnx=r.GetBool();if(bCnx){this.endCnxIdx=r.GetLong();this.endCnxId=r.GetString2()}else{this.endCnxIdx=null;this.endCnxId=null}};CNvUniSpPr.prototype.copy=function(){var _ret=new CNvUniSpPr;_ret.locks=this.locks; _ret.stCnxId=this.stCnxId;_ret.stCnxIdx=this.stCnxIdx;_ret.endCnxId=this.endCnxId;_ret.endCnxIdx=this.endCnxIdx;return _ret};function UniNvPr(){this.cNvPr=new CNvPr;this.UniPr=null;this.nvPr=new NvPr;this.nvUniSpPr=new CNvUniSpPr;this.Id=g_oIdCounter.Get_NewId();g_oTableId.Add(this,this.Id)}UniNvPr.prototype={Get_Id:function(){return this.Id},Refresh_RecalcData:function(){},getObjectType:function(){return AscDFH.historyitem_type_UniNvPr},setCNvPr:function(cNvPr){History.Add(new CChangesDrawingsObject(this, AscDFH.historyitem_UniNvPr_SetCNvPr,this.cNvPr,cNvPr));this.cNvPr=cNvPr},setUniSpPr:function(pr){History.Add(new CChangesDrawingsObjectNoId(this,AscDFH.historyitem_UniNvPr_SetUniSpPr,this.nvUniSpPr,pr));this.nvUniSpPr=pr},setUniPr:function(uniPr){History.Add(new CChangesDrawingsObject(this,AscDFH.historyitem_UniNvPr_SetUniPr,this.UniPr,uniPr));this.UniPr=uniPr},setNvPr:function(nvPr){History.Add(new CChangesDrawingsObject(this,AscDFH.historyitem_UniNvPr_SetNvPr,this.nvPr,nvPr));this.nvPr=nvPr},createDuplicate:function(){var duplicate= new UniNvPr;this.cNvPr&&duplicate.setCNvPr(this.cNvPr.createDuplicate());this.nvPr&&duplicate.setNvPr(this.nvPr.createDuplicate());this.nvUniSpPr&&duplicate.setUniSpPr(this.nvUniSpPr.copy());return duplicate},Write_ToBinary2:function(w){w.WriteLong(this.getObjectType());w.WriteString2(this.Id);writeObject(w,this.cNvPr);writeObject(w,this.nvPr)},Read_FromBinary2:function(r){this.Id=r.GetString2();this.cNvPr=readObject(r);this.nvPr=readObject(r)}};function StyleRef(){this.idx=0;this.Color=new CUniColor} StyleRef.prototype={Get_Id:function(){return this.Id},isIdentical:function(styleRef){if(styleRef==null)return false;if(this.idx!==styleRef.idx)return false;if(this.Color.IsIdentical(styleRef.Color)==false)return false;return true},getObjectType:function(){return AscDFH.historyitem_type_StyleRef},setIdx:function(idx){this.idx=idx},setColor:function(color){this.Color=color},createDuplicate:function(){var duplicate=new StyleRef;duplicate.setIdx(this.idx);if(this.Color)duplicate.setColor(this.Color.createDuplicate()); return duplicate},Refresh_RecalcData:function(){},Write_ToBinary:function(w){writeLong(w,this.idx);w.WriteBool(isRealObject(this.Color));if(isRealObject(this.Color))this.Color.Write_ToBinary(w)},Read_FromBinary:function(r){this.idx=readLong(r);if(r.GetBool()){this.Color=new CUniColor;this.Color.Read_FromBinary(r)}},getNoStyleUnicolor:function(nIdx,aColors){if(this.Color&&this.Color.isCorrect())return this.Color.getNoStyleUnicolor(nIdx,aColors);return null}};function FontRef(){this.idx=AscFormat.fntStyleInd_none; this.Color=null}FontRef.prototype={Get_Id:function(){return this.Id},Refresh_RecalcData:function(){},setIdx:function(idx){this.idx=idx},setColor:function(color){this.Color=color},createDuplicate:function(){var duplicate=new FontRef;duplicate.setIdx(this.idx);if(this.Color)duplicate.setColor(this.Color.createDuplicate());return duplicate},Write_ToBinary:function(w){writeLong(w,this.idx);w.WriteBool(isRealObject(this.Color));if(isRealObject(this.Color))this.Color.Write_ToBinary(w)},Read_FromBinary:function(r){this.idx= readLong(r);if(r.GetBool()){this.Color=new CUniColor;this.Color.Read_FromBinary(r)}},getNoStyleUnicolor:function(nIdx,aColors){if(this.Color&&this.Color.isCorrect())return this.Color.getNoStyleUnicolor(nIdx,aColors);return null},getFirstPartThemeName:function(){if(this.idx===AscFormat.fntStyleInd_major)return"+mj-";return"+mn-"}};function CShapeStyle(){this.lnRef=null;this.fillRef=null;this.effectRef=null;this.fontRef=null;this.Id=g_oIdCounter.Get_NewId();g_oTableId.Add(this,this.Id)}CShapeStyle.prototype= {Get_Id:function(){return this.Id},Refresh_RecalcData:function(){},Write_ToBinary2:function(w){w.WriteLong(this.getObjectType());w.WriteString2(this.Id)},Read_FromBinary2:function(r){this.Id=r.GetString2()},merge:function(style){if(style!=null){if(style.lnRef!=null)this.lnRef=style.lnRef.createDuplicate();if(style.fillRef!=null)this.fillRef=style.fillRef.createDuplicate();if(style.effectRef!=null)this.effectRef=style.effectRef.createDuplicate();if(style.fontRef!=null)this.fontRef=style.fontRef.createDuplicate()}}, createDuplicate:function(){var duplicate=new CShapeStyle;if(this.lnRef!=null)duplicate.setLnRef(this.lnRef.createDuplicate());if(this.fillRef!=null)duplicate.setFillRef(this.fillRef.createDuplicate());if(this.effectRef!=null)duplicate.setEffectRef(this.effectRef.createDuplicate());if(this.fontRef!=null)duplicate.setFontRef(this.fontRef.createDuplicate());return duplicate},getObjectType:function(){return AscDFH.historyitem_type_ShapeStyle},setLnRef:function(pr){History.Add(new CChangesDrawingsObjectNoId(this, AscDFH.historyitem_ShapeStyle_SetLnRef,this.lnRef,pr));this.lnRef=pr},setFillRef:function(pr){History.Add(new CChangesDrawingsObjectNoId(this,AscDFH.historyitem_ShapeStyle_SetFillRef,this.fillRef,pr));this.fillRef=pr},setFontRef:function(pr){History.Add(new CChangesDrawingsObjectNoId(this,AscDFH.historyitem_ShapeStyle_SetFontRef,this.fontRef,pr));this.fontRef=pr},setEffectRef:function(pr){History.Add(new CChangesDrawingsObjectNoId(this,AscDFH.historyitem_ShapeStyle_SetEffectRef,this.effectRef,pr)); this.effectRef=pr}};var LINE_PRESETS_MAP={};LINE_PRESETS_MAP["line"]=true;LINE_PRESETS_MAP["bracePair"]=true;LINE_PRESETS_MAP["leftBrace"]=true;LINE_PRESETS_MAP["rightBrace"]=true;LINE_PRESETS_MAP["bracketPair"]=true;LINE_PRESETS_MAP["leftBracket"]=true;LINE_PRESETS_MAP["rightBracket"]=true;LINE_PRESETS_MAP["bentConnector2"]=true;LINE_PRESETS_MAP["bentConnector3"]=true;LINE_PRESETS_MAP["bentConnector4"]=true;LINE_PRESETS_MAP["bentConnector5"]=true;LINE_PRESETS_MAP["curvedConnector2"]=true;LINE_PRESETS_MAP["curvedConnector3"]= true;LINE_PRESETS_MAP["curvedConnector4"]=true;LINE_PRESETS_MAP["curvedConnector5"]=true;LINE_PRESETS_MAP["straightConnector1"]=true;LINE_PRESETS_MAP["arc"]=true;function CreateDefaultShapeStyle(preset){var b_line=typeof preset==="string"&&LINE_PRESETS_MAP[preset];var tx_color=b_line;var unicolor;var style=new CShapeStyle;var lnRef=new StyleRef;lnRef.setIdx(b_line?1:2);unicolor=new CUniColor;unicolor.setColor(new CSchemeColor);unicolor.color.setId(g_clr_accent1);var mod=new CColorMod;mod.setName("shade"); mod.setVal(5E4);unicolor.setMods(new CColorModifiers);unicolor.Mods.addMod(mod);lnRef.setColor(unicolor);style.setLnRef(lnRef);var fillRef=new StyleRef;unicolor=new CUniColor;unicolor.setColor(new CSchemeColor);unicolor.color.setId(g_clr_accent1);fillRef.setIdx(b_line?0:1);fillRef.setColor(unicolor);style.setFillRef(fillRef);var effectRef=new StyleRef;unicolor=new CUniColor;unicolor.setColor(new CSchemeColor);unicolor.color.setId(g_clr_accent1);effectRef.setIdx(0);effectRef.setColor(unicolor);style.setEffectRef(effectRef); var fontRef=new FontRef;unicolor=new CUniColor;unicolor.setColor(new CSchemeColor);unicolor.color.setId(tx_color?15:12);fontRef.setIdx(AscFormat.fntStyleInd_minor);fontRef.setColor(unicolor);style.setFontRef(fontRef);return style}function CXfrm(){this.offX=null;this.offY=null;this.extX=null;this.extY=null;this.chOffX=null;this.chOffY=null;this.chExtX=null;this.chExtY=null;this.flipH=null;this.flipV=null;this.rot=null;this.parent=null;this.Id=g_oIdCounter.Get_NewId();g_oTableId.Add(this,this.Id)}CXfrm.prototype= {Get_Id:function(){return this.Id},getObjectType:function(){return AscDFH.historyitem_type_Xfrm},Write_ToBinary2:function(w){w.WriteLong(this.getObjectType());w.WriteString2(this.Id)},Read_FromBinary2:function(r){this.Id=r.GetString2()},isNotNull:function(){return isRealNumber(this.offX)&&isRealNumber(this.offY)&&isRealNumber(this.extX)&&isRealNumber(this.extY)},isNotNullForGroup:function(){return isRealNumber(this.offX)&&isRealNumber(this.offY)&&isRealNumber(this.chOffX)&&isRealNumber(this.chOffY)&& isRealNumber(this.extX)&&isRealNumber(this.extY)&&isRealNumber(this.chExtX)&&isRealNumber(this.chExtY)},isEqual:function(xfrm){return xfrm&&this.offX==xfrm.offX&&this.offY==xfrm.offY&&this.extX==xfrm.extX&&this.extY==xfrm.extY&&this.chOffX==xfrm.chOffX&&this.chOffY==xfrm.chOffY&&this.chExtX==xfrm.chExtX&&this.chExtY==xfrm.chExtY},merge:function(xfrm){if(xfrm.offX!=null)this.offX=xfrm.offX;if(xfrm.offY!=null)this.offY=xfrm.offY;if(xfrm.extX!=null)this.extX=xfrm.extX;if(xfrm.extY!=null)this.extY=xfrm.extY; if(xfrm.chOffX!=null)this.chOffX=xfrm.chOffX;if(xfrm.chOffY!=null)this.chOffY=xfrm.chOffY;if(xfrm.chExtX!=null)this.chExtX=xfrm.chExtX;if(xfrm.chExtY!=null)this.chExtY=xfrm.chExtY;if(xfrm.flipH!=null)this.flipH=xfrm.flipH;if(xfrm.flipV!=null)this.flipV=xfrm.flipV;if(xfrm.rot!=null)this.rot=xfrm.rot},createDuplicate:function(){var duplicate=new CXfrm;duplicate.setOffX(this.offX);duplicate.setOffY(this.offY);duplicate.setExtX(this.extX);duplicate.setExtY(this.extY);duplicate.setChOffX(this.chOffX); duplicate.setChOffY(this.chOffY);duplicate.setChExtX(this.chExtX);duplicate.setChExtY(this.chExtY);duplicate.setFlipH(this.flipH);duplicate.setFlipV(this.flipV);duplicate.setRot(this.rot);return duplicate},setParent:function(pr){History.CanAddChanges()&&History.Add(new CChangesDrawingsObject(this,AscDFH.historyitem_Xfrm_SetParent,this.parent,pr));this.parent=pr},setOffX:function(pr){History.CanAddChanges()&&History.Add(new CChangesDrawingsDouble(this,AscDFH.historyitem_Xfrm_SetOffX,this.offX,pr)); this.offX=pr;this.handleUpdatePosition()},setOffY:function(pr){History.CanAddChanges()&&History.Add(new CChangesDrawingsDouble(this,AscDFH.historyitem_Xfrm_SetOffY,this.offY,pr));this.offY=pr;this.handleUpdatePosition()},setExtX:function(pr){History.CanAddChanges()&&History.Add(new CChangesDrawingsDouble(this,AscDFH.historyitem_Xfrm_SetExtX,this.extX,pr));this.extX=pr;this.handleUpdateExtents(true)},setExtY:function(pr){History.CanAddChanges()&&History.Add(new CChangesDrawingsDouble(this,AscDFH.historyitem_Xfrm_SetExtY, this.extY,pr));this.extY=pr;this.handleUpdateExtents(false)},setChOffX:function(pr){History.CanAddChanges()&&History.Add(new CChangesDrawingsDouble(this,AscDFH.historyitem_Xfrm_SetChOffX,this.chOffX,pr));this.chOffX=pr;this.handleUpdateChildOffset()},setChOffY:function(pr){History.CanAddChanges()&&History.Add(new CChangesDrawingsDouble(this,AscDFH.historyitem_Xfrm_SetChOffY,this.chOffY,pr));this.chOffY=pr;this.handleUpdateChildOffset()},setChExtX:function(pr){History.CanAddChanges()&&History.Add(new CChangesDrawingsDouble(this, AscDFH.historyitem_Xfrm_SetChExtX,this.chExtX,pr));this.chExtX=pr;this.handleUpdateChildExtents()},setChExtY:function(pr){History.CanAddChanges()&&History.Add(new CChangesDrawingsDouble(this,AscDFH.historyitem_Xfrm_SetChExtY,this.chExtY,pr));this.chExtY=pr;this.handleUpdateChildExtents()},setFlipH:function(pr){History.CanAddChanges()&&History.Add(new CChangesDrawingsBool(this,AscDFH.historyitem_Xfrm_SetFlipH,this.flipH,pr));this.flipH=pr;this.handleUpdateFlip()},setFlipV:function(pr){History.CanAddChanges()&& History.Add(new CChangesDrawingsBool(this,AscDFH.historyitem_Xfrm_SetFlipV,this.flipV,pr));this.flipV=pr;this.handleUpdateFlip()},setRot:function(pr){History.CanAddChanges()&&History.Add(new CChangesDrawingsDouble(this,AscDFH.historyitem_Xfrm_SetRot,this.rot,pr));this.rot=pr;this.handleUpdateRot()},handleUpdatePosition:function(){if(this.parent&&this.parent.handleUpdatePosition)this.parent.handleUpdatePosition()},handleUpdateExtents:function(bExtX){if(this.parent&&this.parent.handleUpdateExtents)this.parent.handleUpdateExtents(bExtX)}, handleUpdateChildOffset:function(){if(this.parent&&this.parent.handleUpdateChildOffset)this.parent.handleUpdateChildOffset()},handleUpdateChildExtents:function(){if(this.parent&&this.parent.handleUpdateChildExtents)this.parent.handleUpdateChildExtents()},handleUpdateFlip:function(){if(this.parent&&this.parent.handleUpdateFlip)this.parent.handleUpdateFlip()},handleUpdateRot:function(){if(this.parent&&this.parent.handleUpdateRot)this.parent.handleUpdateRot()},Refresh_RecalcData:function(data){switch(data.Type){case AscDFH.historyitem_Xfrm_SetOffX:{this.handleUpdatePosition(); break}case AscDFH.historyitem_Xfrm_SetOffY:{this.handleUpdatePosition();break}case AscDFH.historyitem_Xfrm_SetExtX:{this.handleUpdateExtents();break}case AscDFH.historyitem_Xfrm_SetExtY:{this.handleUpdateExtents();break}case AscDFH.historyitem_Xfrm_SetChOffX:{this.handleUpdateChildOffset();break}case AscDFH.historyitem_Xfrm_SetChOffY:{this.handleUpdateChildOffset();break}case AscDFH.historyitem_Xfrm_SetChExtX:{this.handleUpdateChildExtents();break}case AscDFH.historyitem_Xfrm_SetChExtY:{this.handleUpdateChildExtents(); break}case AscDFH.historyitem_Xfrm_SetFlipH:{this.handleUpdateFlip();break}case AscDFH.historyitem_Xfrm_SetFlipV:{this.handleUpdateFlip();break}case AscDFH.historyitem_Xfrm_SetRot:{this.handleUpdateRot();break}}}};function CEffectProperties(){this.EffectDag=null;this.EffectLst=null}CEffectProperties.prototype.createDuplicate=function(){var oCopy=new CEffectProperties;if(this.EffectDag)oCopy.EffectDag=this.EffectDag.createDuplicate();if(this.EffectLst)oCopy.EffectLst=this.EffectLst.createDuplicate(); return oCopy};CEffectProperties.prototype.Write_ToBinary=function(w){var nFlags=0;if(this.EffectDag)nFlags|=1;if(this.EffectLst)nFlags|=2;w.WriteLong(nFlags);if(this.EffectDag)this.EffectDag.Write_ToBinary(w);if(this.EffectLst)this.EffectLst.Write_ToBinary(w)};CEffectProperties.prototype.Read_FromBinary=function(r){var nFlags=r.GetLong();if(nFlags&1){this.EffectDag=new CEffectContainer;this.EffectDag.Read_FromBinary(r)}if(nFlags&2){this.EffectLst=new CEffectLst;this.EffectLst.Read_FromBinary(r)}}; function CEffectLst(){this.blur=null;this.fillOverlay=null;this.glow=null;this.innerShdw=null;this.outerShdw=null;this.prstShdw=null;this.reflection=null;this.softEdge=null}CEffectLst.prototype.createDuplicate=function(){var oCopy=new CEffectLst;if(this.blur)oCopy.blur=this.blur.createDuplicate();if(this.fillOverlay)oCopy.fillOverlay=this.fillOverlay.createDuplicate();if(this.glow)oCopy.glow=this.glow.createDuplicate();if(this.innerShdw)oCopy.innerShdw=this.innerShdw.createDuplicate();if(this.outerShdw)oCopy.outerShdw= this.outerShdw.createDuplicate();if(this.prstShdw)oCopy.prstShdw=this.prstShdw.createDuplicate();if(this.reflection)oCopy.reflection=this.reflection.createDuplicate();if(this.softEdge)oCopy.softEdge=this.softEdge.createDuplicate();return oCopy};CEffectLst.prototype.Write_ToBinary=function(w){var nFlags=0;if(this.blur)nFlags|=1;if(this.fillOverlay)nFlags|=2;if(this.glow)nFlags|=4;if(this.innerShdw)nFlags|=8;if(this.outerShdw)nFlags|=16;if(this.prstShdw)nFlags|=32;if(this.reflection)nFlags|=64;if(this.softEdge)nFlags|= 128;w.WriteLong(nFlags);if(this.blur)this.blur.Write_ToBinary(w);if(this.fillOverlay)this.fillOverlay.Write_ToBinary(w);if(this.glow)this.glow.Write_ToBinary(w);if(this.innerShdw)this.innerShdw.Write_ToBinary(w);if(this.outerShdw)this.outerShdw.Write_ToBinary(w);if(this.prstShdw)this.prstShdw.Write_ToBinary(w);if(this.reflection)this.reflection.Write_ToBinary(w);if(this.softEdge)this.softEdge.Write_ToBinary(w)};CEffectLst.prototype.Read_FromBinary=function(r){var nFlags=r.GetLong();if(nFlags&1){this.blur= new CBlur;r.GetLong();this.blur.Read_FromBinary(r)}if(nFlags&2){this.fillOverlay=new CFillOverlay;r.GetLong();this.fillOverlay.Read_FromBinary(r)}if(nFlags&4){this.glow=new CGlow;r.GetLong();this.glow.Read_FromBinary(r)}if(nFlags&8){this.innerShdw=new CInnerShdw;r.GetLong();this.innerShdw.Read_FromBinary(r)}if(nFlags&16){this.outerShdw=new COuterShdw;r.GetLong();this.outerShdw.Read_FromBinary(r)}if(nFlags&32){this.prstShdw=new CPrstShdw;r.GetLong();this.prstShdw.Read_FromBinary(r)}if(nFlags&64){this.reflection= new CReflection;r.GetLong();this.reflection.Read_FromBinary(r)}if(nFlags&128){this.softEdge=new CSoftEdge;r.GetLong();this.softEdge.Read_FromBinary(r)}};function CSpPr(){this.bwMode=0;this.xfrm=null;this.geometry=null;this.Fill=null;this.ln=null;this.parent=null;this.effectProps=null;this.Id=g_oIdCounter.Get_NewId();g_oTableId.Add(this,this.Id)}CSpPr.prototype={Get_Id:function(){return this.Id},Refresh_RecalcData:function(data){switch(data.Type){case AscDFH.historyitem_SpPr_SetParent:{break}case AscDFH.historyitem_SpPr_SetBwMode:{break}case AscDFH.historyitem_SpPr_SetXfrm:{this.handleUpdateExtents(); break}case AscDFH.historyitem_SpPr_SetGeometry:case AscDFH.historyitem_SpPr_SetEffectPr:{this.handleUpdateGeometry();break}case AscDFH.historyitem_SpPr_SetFill:{this.handleUpdateFill();break}case AscDFH.historyitem_SpPr_SetLn:{this.handleUpdateLn();break}}},Refresh_RecalcData2:function(data){},createDuplicate:function(){var duplicate=new CSpPr;duplicate.setBwMode(this.bwMode);if(this.xfrm){duplicate.setXfrm(this.xfrm.createDuplicate());duplicate.xfrm.setParent(duplicate)}if(this.geometry!=null)duplicate.setGeometry(this.geometry.createDuplicate()); if(this.Fill!=null)duplicate.setFill(this.Fill.createDuplicate());if(this.ln!=null)duplicate.setLn(this.ln.createDuplicate());if(this.effectProps)duplicate.setEffectPr(this.effectProps.createDuplicate());return duplicate},hasRGBFill:function(){return this.Fill&&this.Fill.fill&&this.Fill.fill.color&&this.Fill.fill.color.color&&this.Fill.fill.color.color.type===c_oAscColor.COLOR_TYPE_SRGB},hasNoFill:function(){if(this.Fill)return this.Fill.isNoFill();return false},hasNoFillLine:function(){if(this.ln)return this.ln.isNoFillLine(); return false},checkUniFillRasterImageId:function(unifill){if(unifill&&unifill.fill&&typeof unifill.fill.RasterImageId==="string"&&unifill.fill.RasterImageId.length>0)return unifill.fill.RasterImageId;return null},checkBlipFillRasterImage:function(images){var fill_image_id=this.checkUniFillRasterImageId(this.Fill);if(fill_image_id!==null)images.push(fill_image_id);if(this.ln){var line_image_id=this.checkUniFillRasterImageId(this.ln.Fill);if(line_image_id)images.push(line_image_id)}},changeShadow:function(oShadow){if(oShadow){var oEffectProps= this.effectProps?this.effectProps.createDuplicate():new AscFormat.CEffectProperties;if(!oEffectProps.EffectLst)oEffectProps.EffectLst=new CEffectLst;oEffectProps.EffectLst.outerShdw=oShadow.createDuplicate();this.setEffectPr(oEffectProps)}else if(this.effectProps)if(this.effectProps.EffectLst)if(this.effectProps.EffectLst.outerShdw){var oEffectProps=this.effectProps.createDuplicate();oEffectProps.EffectLst.outerShdw=null;this.setEffectPr(oEffectProps)}},merge:function(spPr){if(spPr.geometry!=null)this.geometry= spPr.geometry.createDuplicate();if(spPr.Fill!=null&&spPr.Fill.fill!=null);},getObjectType:function(){return AscDFH.historyitem_type_SpPr},Write_ToBinary2:function(w){w.WriteLong(this.getObjectType());w.WriteString2(this.Id)},Read_FromBinary2:function(r){this.Id=r.GetString2()},setParent:function(pr){History.Add(new CChangesDrawingsObject(this,AscDFH.historyitem_SpPr_SetParent,this.parent,pr));this.parent=pr},setBwMode:function(pr){History.Add(new CChangesDrawingsLong(this,AscDFH.historyitem_SpPr_SetBwMode, this.bwMode,pr));this.bwMode=pr},setXfrm:function(pr){History.Add(new CChangesDrawingsObject(this,AscDFH.historyitem_SpPr_SetXfrm,this.xfrm,pr));this.xfrm=pr},setGeometry:function(pr){History.Add(new CChangesDrawingsObject(this,AscDFH.historyitem_SpPr_SetGeometry,this.geometry,pr));this.geometry=pr;if(this.geometry)this.geometry.setParent(this);this.handleUpdateGeometry()},setFill:function(pr){History.Add(new CChangesDrawingsObjectNoId(this,AscDFH.historyitem_SpPr_SetFill,this.Fill,pr));this.Fill= pr;if(this.parent&&this.parent.handleUpdateFill)this.parent.handleUpdateFill()},setLn:function(pr){History.Add(new CChangesDrawingsObjectNoId(this,AscDFH.historyitem_SpPr_SetLn,this.ln,pr));this.ln=pr;if(this.parent&&this.parent.handleUpdateLn)this.parent.handleUpdateLn()},setEffectPr:function(pr){History.Add(new CChangesDrawingsObjectNoId(this,AscDFH.historyitem_SpPr_SetEffectPr,this.effectProps,pr));this.effectProps=pr},handleUpdatePosition:function(){if(this.parent&&this.parent.handleUpdatePosition)this.parent.handleUpdatePosition()}, handleUpdateExtents:function(bExtX){if(this.parent&&this.parent.handleUpdateExtents)this.parent.handleUpdateExtents(bExtX)},handleUpdateChildOffset:function(){if(this.parent&&this.parent.handleUpdateChildOffset)this.parent.handleUpdateChildOffset()},handleUpdateChildExtents:function(){if(this.parent&&this.parent.handleUpdateChildExtents)this.parent.handleUpdateChildExtents()},handleUpdateFlip:function(){if(this.parent&&this.parent.handleUpdateFlip)this.parent.handleUpdateFlip()},handleUpdateRot:function(){if(this.parent&& this.parent.handleUpdateRot)this.parent.handleUpdateRot()},handleUpdateGeometry:function(){if(this.parent&&this.parent.handleUpdateGeometry)this.parent.handleUpdateGeometry()},handleUpdateFill:function(){if(this.parent&&this.parent.handleUpdateFill)this.parent.handleUpdateFill()},handleUpdateLn:function(){if(this.parent&&this.parent.handleUpdateLn)this.parent.handleUpdateLn()},setLineFill:function(){if(this.ln&&this.ln.Fill)this.setFill(this.ln.Fill.createDuplicate())}};var g_clr_MIN=0;var g_clr_accent1= 0;var g_clr_accent2=1;var g_clr_accent3=2;var g_clr_accent4=3;var g_clr_accent5=4;var g_clr_accent6=5;var g_clr_dk1=6;var g_clr_dk2=7;var g_clr_folHlink=8;var g_clr_hlink=9;var g_clr_lt1=10;var g_clr_lt2=11;var g_clr_MAX=11;var g_clr_bg1=g_clr_lt1;var g_clr_bg2=g_clr_lt2;var g_clr_tx1=g_clr_dk1;var g_clr_tx2=g_clr_dk2;var phClr=14;var tx1=15;var tx2=16;function ClrScheme(){this.name="";this.colors=[];for(var i=g_clr_MIN;i<=g_clr_MAX;i++)this.colors[i]=null}ClrScheme.prototype={isIdentical:function(clrScheme){if(!(clrScheme instanceof ClrScheme))return false;if(clrScheme.name!==this.name)return false;for(var _clr_index=g_clr_MIN;_clr_index<=g_clr_MAX;++_clr_index)if(this.colors[_clr_index]){if(!this.colors[_clr_index].IsIdentical(clrScheme.colors[_clr_index]))return false}else if(clrScheme.colors[_clr_index])return false;return true},createDuplicate:function(){var _duplicate=new ClrScheme;_duplicate.name=this.name;for(var _clr_index=0;_clr_index<=this.colors.length;++_clr_index)if(this.colors[_clr_index])_duplicate.colors[_clr_index]= this.colors[_clr_index].createDuplicate();return _duplicate},Write_ToBinary:function(w){w.WriteLong(this.colors.length);w.WriteString2(this.name);for(var i=0;i=1&&number<=999){var ret=this.fillStyleLst[number-1];if(!ret)return null;var ret2=ret.createDuplicate();ret2.checkPhColor(unicolor,false);return ret2}else if(number>=1001){var ret=this.bgFillStyleLst[number- 1001];if(!ret)return null;var ret2=ret.createDuplicate();ret2.checkPhColor(unicolor,false);return ret2}return null},Write_ToBinary:function(w){writeString(w,this.name);var i;w.WriteLong(this.fillStyleLst.length);for(i=0;i0&&(AllFonts[major_font.latin]=1);typeof major_font.ea==="string"&&major_font.ea.length>0&&(AllFonts[major_font.ea]=1);typeof major_font.cs==="string"&&major_font.latin.length>0&&(AllFonts[major_font.cs]=1);var minor_font=font_scheme.minorFont;typeof minor_font.latin==="string"&&minor_font.latin.length> 0&&(AllFonts[minor_font.latin]=1);typeof minor_font.ea==="string"&&minor_font.ea.length>0&&(AllFonts[minor_font.ea]=1);typeof minor_font.cs==="string"&&minor_font.latin.length>0&&(AllFonts[minor_font.cs]=1)},getFillStyle:function(idx,unicolor){if(idx===0||idx===1E3)return AscFormat.CreateNoFillUniFill();var ret;if(idx>=1&&idx<=999){if(this.themeElements.fmtScheme.fillStyleLst[idx-1]){ret=this.themeElements.fmtScheme.fillStyleLst[idx-1].createDuplicate();if(ret){ret.checkPhColor(unicolor,false);return ret}}}else if(idx>= 1001)if(this.themeElements.fmtScheme.bgFillStyleLst[idx-1001]){ret=this.themeElements.fmtScheme.bgFillStyleLst[idx-1001].createDuplicate();if(ret){ret.checkPhColor(unicolor,false);return ret}}return CreateSolidFillRGBA(0,0,0,255)},getLnStyle:function(idx,unicolor){if(idx===0)return AscFormat.CreateNoFillLine();if(this.themeElements.fmtScheme.lnStyleLst[idx-1]){var ret=this.themeElements.fmtScheme.lnStyleLst[idx-1].createDuplicate();if(ret.Fill)ret.Fill.checkPhColor(unicolor,false);return ret}return new CLn}, getExtraClrScheme:function(sName){for(var i=0;i-1)this.removeExtraClrScheme(nIndex)},getExtraAscColorSchemes:function(){var asc_color_scheme;var aCustomSchemes=[];var _extra=this.extraClrSchemeLst;var _count=_extra.length;for(var i=0;i<_count;++i){var _scheme=_extra[i].clrScheme;asc_color_scheme=AscCommon.getAscColorScheme(_scheme,this);aCustomSchemes.push(asc_color_scheme)}return aCustomSchemes},setColorScheme:function(clrScheme){History.Add(new CChangesDrawingsObjectNoId(this,AscDFH.historyitem_ThemeSetColorScheme, this.themeElements.clrScheme,clrScheme));this.themeElements.clrScheme=clrScheme},setFontScheme:function(fontScheme){History.Add(new CChangesDrawingsObjectNoId(this,AscDFH.historyitem_ThemeSetFontScheme,this.themeElements.fontScheme,fontScheme));this.themeElements.fontScheme=fontScheme},setFormatScheme:function(fmtScheme){History.Add(new CChangesDrawingsObjectNoId(this,AscDFH.historyitem_ThemeSetFmtScheme,this.themeElements.fmtScheme,fmtScheme));this.themeElements.fmtScheme=fmtScheme},setName:function(pr){History.Add(new CChangesDrawingsString(this, AscDFH.historyitem_ThemeSetName,this.name,pr));this.name=pr},setIsThemeOverride:function(pr){History.Add(new CChangesDrawingsBool(this,AscDFH.historyitem_ThemeSetIsThemeOverride,this.isThemeOverride,pr));this.isThemeOverride=pr},setSpDef:function(pr){History.Add(new CChangesDrawingsObject(this,AscDFH.historyitem_ThemeSetSpDef,this.spDef,pr));this.spDef=pr},setLnDef:function(pr){History.Add(new CChangesDrawingsObject(this,AscDFH.historyitem_ThemeSetLnDef,this.spDef,pr));this.lnDef=pr},setTxDef:function(pr){History.Add(new CChangesDrawingsObject(this, AscDFH.historyitem_ThemeSetTxDef,this.spDef,pr));this.txDef=pr},addExtraClrSceme:function(pr,idx){var pos;if(AscFormat.isRealNumber(idx))pos=idx;else pos=this.extraClrSchemeLst.length;History.Add(new CChangesDrawingsContent(this,AscDFH.historyitem_ThemeAddExtraClrScheme,pos,[pr],true));this.extraClrSchemeLst.splice(pos,0,pr)},removeExtraClrScheme:function(idx){if(idx>-1&&idx0)presentation.backChangeThemeTimeOutId=setTimeout(function(){redrawSlide(arr_slides[arrInd[pos-1]],presentation,arrInd,pos-1,-1,arr_slides)},recalcSlideInterval);else presentation.backChangeThemeTimeOutId=null;if(pos0)if(pos0)presentation.backChangeThemeTimeOutId=setTimeout(function(){redrawSlide(arr_slides[arrInd[pos-1]],presentation,arrInd,pos-1,-1,arr_slides)},recalcSlideInterval);else presentation.backChangeThemeTimeOutId=null}function CTextFit(){this.type= 0;this.fontScale=null;this.lnSpcReduction=null}CTextFit.prototype={CreateDublicate:function(){var d=new CTextFit;d.type=this.type;d.fontScale=this.fontScale;d.lnSpcReduction=this.lnSpcReduction;return d},Write_ToBinary:function(w){writeLong(w,this.type);writeLong(w,this.fontScale);writeLong(w,this.lnSpcReduction)},Read_FromBinary:function(r){this.type=readLong(r);this.fontScale=readLong(r);this.lnSpcReduction=readLong(r)},Get_Id:function(){return this.Id},Refresh_RecalcData:function(){}};var nOTClip= 0;var nOTEllipsis=1;var nOTOwerflow=2;var nTextATB=0;var nTextATCtr=1;var nTextATDist=2;var nTextATJust=3;var nTextATT=4;function CBodyPr(){this.flatTx=null;this.anchor=null;this.anchorCtr=null;this.bIns=null;this.compatLnSpc=null;this.forceAA=null;this.fromWordArt=null;this.horzOverflow=null;this.lIns=null;this.numCol=null;this.rIns=null;this.rot=null;this.rtlCol=null;this.spcCol=null;this.spcFirstLastPara=null;this.tIns=null;this.upright=null;this.vert=null;this.vertOverflow=null;this.wrap=null; this.textFit=null;this.prstTxWarp=null;this.parent=null}CBodyPr.prototype={Get_Id:function(){return this.Id},Refresh_RecalcData:function(){},getLnSpcReduction:function(){if(this.textFit&&this.textFit.type===AscFormat.text_fit_NormAuto&&AscFormat.isRealNumber(this.textFit.lnSpcReduction))return this.textFit.lnSpcReduction/1E5;return undefined},getFontScale:function(){if(this.textFit&&this.textFit.type===AscFormat.text_fit_NormAuto&&AscFormat.isRealNumber(this.textFit.fontScale))return this.textFit.fontScale/ 1E5;return undefined},isNotNull:function(){return this.flatTx!==null||this.anchor!==null||this.anchorCtr!==null||this.bIns!==null||this.compatLnSpc!==null||this.forceAA!==null||this.fromWordArt!==null||this.horzOverflow!==null||this.lIns!==null||this.numCol!==null||this.rIns!==null||this.rot!==null||this.rtlCol!==null||this.spcCol!==null||this.spcFirstLastPara!==null||this.tIns!==null||this.upright!==null||this.vert!==null||this.vertOverflow!==null||this.wrap!==null||this.textFit!==null||this.prstTxWarp!== null},setAnchor:function(val){this.anchor=val},setVert:function(val){this.vert=val},setRot:function(val){this.rot=val},reset:function(){this.flatTx=null;this.anchor=null;this.anchorCtr=null;this.bIns=null;this.compatLnSpc=null;this.forceAA=null;this.fromWordArt=null;this.horzOverflow=null;this.lIns=null;this.numCol=null;this.rIns=null;this.rot=null;this.rtlCol=null;this.spcCol=null;this.spcFirstLastPara=null;this.tIns=null;this.upright=null;this.vert=null;this.vertOverflow=null;this.wrap=null;this.textFit= null;this.prstTxWarp=null},WritePrstTxWarp:function(w){w.WriteBool(isRealObject(this.prstTxWarp));if(isRealObject(this.prstTxWarp)){writeString(w,this.prstTxWarp.preset);var startPos=w.GetCurPosition(),countAv=0;w.Skip(4);for(var key in this.prstTxWarp.avLst)if(this.prstTxWarp.avLst.hasOwnProperty(key)){++countAv;w.WriteString2(key);w.WriteLong(this.prstTxWarp.gdLst[key])}var endPos=w.GetCurPosition();w.Seek(startPos);w.WriteLong(countAv);w.Seek(endPos)}},ReadPrstTxWarp:function(r){ExecuteNoHistory(function(){if(r.GetBool()){this.prstTxWarp= AscFormat.CreatePrstTxWarpGeometry(readString(r));var count=r.GetLong();for(var i=0;i0)AllFonts[this.bulletTypeface.typeface]=true};CBullet.prototype.putNumStartAt=function(NumStartAt){if(!this.bulletType)this.bulletType=new CBulletType;this.bulletType.type=AscFormat.BULLET_TYPE_BULLET_AUTONUM;this.bulletType.startAt=NumStartAt};CBullet.prototype.getNumStartAt=function(){if(this.bulletType)if(AscFormat.isRealNumber(this.bulletType.startAt))return Math.max(1, this.bulletType.startAt);return undefined};CBullet.prototype.isEqual=function(oBullet){if(!oBullet)return false;if(!this.bulletColor&&oBullet.bulletColor||!oBullet.bulletColor&&this.bulletColor)return false;if(this.bulletColor&&oBullet.bulletColor)if(!this.bulletColor.IsIdentical(oBullet.bulletColor))return false;if(!this.bulletSize&&oBullet.bulletSize||this.bulletSize&&!oBullet.bulletSize)return false;if(this.bulletSize&&oBullet.bulletSize)if(!this.bulletSize.IsIdentical(oBullet.bulletSize))return false; if(!this.bulletTypeface&&oBullet.bulletTypeface||this.bulletTypeface&&!oBullet.bulletTypeface)return false;if(this.bulletTypeface&&oBullet.bulletTypeface)if(!this.bulletTypeface.IsIdentical(oBullet.bulletTypeface))return false;if(!this.bulletType&&oBullet.bulletType||this.bulletType&&!oBullet.bulletType)return false;if(this.bulletType&&oBullet.bulletType)if(!this.bulletType.IsIdentical(oBullet.bulletType))return false;return true};var prot=CBullet.prototype;prot.asc_getSize=function(){var nRet=100; if(this.bulletSize)switch(this.bulletSize.type){case AscFormat.BULLET_TYPE_SIZE_NONE:{break}case AscFormat.BULLET_TYPE_SIZE_TX:{break}case AscFormat.BULLET_TYPE_SIZE_PCT:{nRet=this.bulletSize.val/1E3;break}case AscFormat.BULLET_TYPE_SIZE_PTS:{break}}return nRet};prot["get_Size"]=prot["asc_getSize"]=CBullet.prototype.asc_getSize;prot.asc_putSize=function(Size){if(AscFormat.isRealNumber(Size)){this.bulletSize=new AscFormat.CBulletSize;this.bulletSize.type=AscFormat.BULLET_TYPE_SIZE_PCT;this.bulletSize.val= Size*1E3>>0}};prot["put_Size"]=prot["asc_putSize"]=CBullet.prototype.asc_putSize;prot.asc_getColor=function(){if(this.bulletColor){if(this.bulletColor.UniColor)return AscCommon.CreateAscColor(this.bulletColor.UniColor)}else{var FirstTextPr=this.FirstTextPr;if(FirstTextPr&&FirstTextPr.Unifill)if(FirstTextPr.Unifill.fill instanceof AscFormat.CSolidFill&&FirstTextPr.Unifill.fill.color)return AscCommon.CreateAscColor(FirstTextPr.Unifill.fill.color);else{var RGBA=FirstTextPr.Unifill.getRGBAColor();return AscCommon.CreateAscColorCustom(RGBA.R, RGBA.G,RGBA.B)}}return AscCommon.CreateAscColorCustom(0,0,0)};prot["get_Color"]=prot["asc_getColor"]=prot.asc_getColor;prot.asc_putColor=function(color){this.bulletColor=new AscFormat.CBulletColor;this.bulletColor.type=AscFormat.BULLET_TYPE_COLOR_CLR;this.bulletColor.UniColor=AscFormat.CorrectUniColor(color,this.bulletColor.UniColor,0)};prot["put_Color"]=prot["asc_putColor"]=prot.asc_putColor;prot.asc_getFont=function(){var sRet="";if(this.bulletTypeface&&this.bulletTypeface.type===AscFormat.BULLET_TYPE_TYPEFACE_BUFONT&& typeof this.bulletTypeface.typeface==="string"&&this.bulletTypeface.typeface.length>0)sRet=this.bulletTypeface.typeface;else{var FirstTextPr=this.FirstTextPr;if(FirstTextPr&&FirstTextPr.FontFamily&&typeof FirstTextPr.FontFamily.Name==="string"&&FirstTextPr.FontFamily.Name.length>0)sRet=FirstTextPr.FontFamily.Name}return sRet};prot["get_Font"]=prot["asc_getFont"]=prot.asc_getFont;prot.asc_putFont=function(val){if(typeof val==="string"&&val.length>0){this.bulletTypeface=new AscFormat.CBulletTypeface; this.bulletTypeface.type=AscFormat.BULLET_TYPE_TYPEFACE_BUFONT;this.bulletTypeface.typeface=val}};prot["put_Font"]=prot["asc_putFont"]=prot.asc_putFont;prot.asc_putNumStartAt=function(NumStartAt){this.putNumStartAt(NumStartAt)};prot["put_NumStartAt"]=prot["asc_putNumStartAt"]=prot.asc_putNumStartAt;prot.asc_getNumStartAt=function(){return this.getNumStartAt()};prot["get_NumStartAt"]=prot["asc_getNumStartAt"]=prot.asc_getNumStartAt;prot.asc_getSymbol=function(){if(this.bulletType&&this.bulletType.type=== AscFormat.BULLET_TYPE_BULLET_CHAR)return this.bulletType.Char;return undefined};prot["get_Symbol"]=prot["asc_getSymbol"]=prot.asc_getSymbol;prot.asc_putSymbol=function(v){if(!this.bulletType)this.bulletType=new CBulletType;this.bulletType.AutoNumType=0;this.bulletType.type=AscFormat.BULLET_TYPE_BULLET_CHAR;this.bulletType.Char=v};prot["put_Symbol"]=prot["asc_putSymbol"]=prot.asc_putSymbol;prot.asc_putAutoNumType=function(val){if(!this.bulletType)this.bulletType=new CBulletType;this.bulletType.type= AscFormat.BULLET_TYPE_BULLET_AUTONUM;this.bulletType.AutoNumType=AscFormat.getNumberingType(val)};prot["put_AutoNumType"]=prot["asc_putAutoNumType"]=prot.asc_putAutoNumType;prot.asc_getAutoNumType=function(){if(this.bulletType&&this.bulletType.type===AscFormat.BULLET_TYPE_BULLET_AUTONUM)return AscFormat.fGetListTypeFromBullet(this).SubType;return-1};prot["get_AutoNumType"]=prot["asc_getAutoNumType"]=prot.asc_getAutoNumType;prot.asc_putListType=function(type,subtype){var NumberInfo={Type:type,SubType:subtype}; AscFormat.fFillBullet(NumberInfo,this)};prot["put_ListType"]=prot["asc_putListType"]=prot.asc_putListType;prot.asc_getListType=function(){return new AscCommon.asc_CListType(AscFormat.fGetListTypeFromBullet(this))};prot.asc_getType=function(){return this.bulletType&&this.bulletType.type};prot["get_Type"]=prot["asc_getType"]=prot.asc_getType;window["Asc"]["asc_CBullet"]=window["Asc"].asc_CBullet=CBullet;function CBulletColor(){this.type=AscFormat.BULLET_TYPE_COLOR_CLRTX;this.UniColor=null}CBulletColor.prototype.Set_FromObject= function(o){this.merge(o)};CBulletColor.prototype.merge=function(oBulletColor){if(!oBulletColor)return;if(oBulletColor.UniColor){this.type=oBulletColor.type;this.UniColor=oBulletColor.UniColor.createDuplicate()}};CBulletColor.prototype.IsIdentical=function(oBulletColor){if(!oBulletColor)return false;if(this.type!==oBulletColor.type)return false;if(this.UniColor&&!oBulletColor.UniColor||oBulletColor.UniColor&&!this.UniColor)return false;if(this.UniColor)if(!this.UniColor.IsIdentical(oBulletColor.UniColor))return false; return true};CBulletColor.prototype.createDuplicate=function(){var duplicate=new CBulletColor;duplicate.type=this.type;if(this.UniColor!=null)duplicate.UniColor=this.UniColor.createDuplicate();return duplicate};CBulletColor.prototype.Write_ToBinary=function(w){w.WriteBool(isRealNumber(this.type));if(isRealNumber(this.type))w.WriteLong(this.type);w.WriteBool(isRealObject(this.UniColor));if(isRealObject(this.UniColor))this.UniColor.Write_ToBinary(w)};CBulletColor.prototype.Read_FromBinary=function(r){if(r.GetBool())this.type= r.GetLong();if(r.GetBool()){this.UniColor=new CUniColor;this.UniColor.Read_FromBinary(r)}};function CBulletSize(){this.type=AscFormat.BULLET_TYPE_SIZE_NONE;this.val=0}CBulletSize.prototype={Set_FromObject:function(o){this.merge(o)},merge:function(oBulletSize){if(!oBulletSize)return;this.type=oBulletSize.type;this.val=oBulletSize.val},createDuplicate:function(){var d=new CBulletSize;d.type=this.type;d.val=this.val;return d},IsIdentical:function(oBulletSize){if(!oBulletSize)return false;return this.type=== oBulletSize.type&&this.val===oBulletSize.val},Write_ToBinary:function(w){w.WriteBool(isRealNumber(this.type));if(isRealNumber(this.type))w.WriteLong(this.type);w.WriteBool(isRealNumber(this.val));if(isRealNumber(this.val))w.WriteLong(this.val)},Read_FromBinary:function(r){if(r.GetBool())this.type=r.GetLong();if(r.GetBool())this.val=r.GetLong()}};function CBulletTypeface(){this.type=AscFormat.BULLET_TYPE_TYPEFACE_NONE;this.typeface=""}CBulletTypeface.prototype={Set_FromObject:function(o){this.merge(o)}, createDuplicate:function(){var d=new CBulletTypeface;d.type=this.type;d.typeface=this.typeface;return d},merge:function(oBulletTypeface){if(!oBulletTypeface)return;this.type=oBulletTypeface.type;this.typeface=oBulletTypeface.typeface},IsIdentical:function(oBulletTypeface){if(!oBulletTypeface)return false;return this.type===oBulletTypeface.type&&this.typeface===oBulletTypeface.typeface},Write_ToBinary:function(w){w.WriteBool(isRealNumber(this.type));if(isRealNumber(this.type))w.WriteLong(this.type); w.WriteBool(typeof this.typeface==="string");if(typeof this.typeface==="string")w.WriteString2(this.typeface)},Read_FromBinary:function(r){if(r.GetBool())this.type=r.GetLong();if(r.GetBool())this.typeface=r.GetString2()}};var BULLET_TYPE_BULLET_NONE=0;var BULLET_TYPE_BULLET_CHAR=1;var BULLET_TYPE_BULLET_AUTONUM=2;var BULLET_TYPE_BULLET_BLIP=3;function CBulletType(){this.type=null;this.Char=null;this.AutoNumType=null;this.startAt=null}CBulletType.prototype={Set_FromObject:function(o){this.merge(o)}, IsIdentical:function(oBulletType){if(!oBulletType)return false;return this.type===oBulletType.type&&this.Char===oBulletType.Char&&this.AutoNumType===oBulletType.AutoNumType&&this.startAt===oBulletType.startAt},merge:function(oBulletType){if(!oBulletType)return;if(oBulletType.type!==null&&this.type!==oBulletType.type){this.type=oBulletType.type;this.Char=oBulletType.Char;this.AutoNumType=oBulletType.AutoNumType;this.startAt=oBulletType.startAt}else{if(this.type===AscFormat.BULLET_TYPE_BULLET_CHAR)if(typeof oBulletType.Char=== "string"&&oBulletType.Char.length>0)if(this.Char!==oBulletType.Char)this.Char=oBulletType.Char;if(this.type===AscFormat.BULLET_TYPE_BULLET_AUTONUM){if(oBulletType.AutoNumType!==null&&this.AutoNumType!==oBulletType.AutoNumType)this.AutoNumType=oBulletType.AutoNumType;if(oBulletType.startAt!==null&&this.startAt!==oBulletType.startAt)this.startAt=oBulletType.startAt}}},createDuplicate:function(){var d=new CBulletType;d.type=this.type;d.Char=this.Char;d.AutoNumType=this.AutoNumType;d.startAt=this.startAt; return d},Write_ToBinary:function(w){w.WriteBool(isRealNumber(this.type));if(isRealNumber(this.type))w.WriteLong(this.type);w.WriteBool(typeof this.Char==="string");if(typeof this.Char==="string")w.WriteString2(this.Char);w.WriteBool(isRealNumber(this.AutoNumType));if(isRealNumber(this.AutoNumType))w.WriteLong(this.AutoNumType);w.WriteBool(isRealNumber(this.startAt));if(isRealNumber(this.startAt))w.WriteLong(this.startAt)},Read_FromBinary:function(r){if(r.GetBool())this.type=r.GetLong();if(r.GetBool()){this.Char= r.GetString2();if(AscFonts.IsCheckSymbols)AscFonts.FontPickerByCharacter.getFontsByString(this.Char)}if(r.GetBool())this.AutoNumType=r.GetLong();if(r.GetBool())this.startAt=r.GetLong()}};function TextListStyle(){this.levels=new Array(10);for(var i=0;i<10;i++)this.levels[i]=null}TextListStyle.prototype={Get_Id:function(){return this.Id},Refresh_RecalcData:function(){},createDuplicate:function(){var duplicate=new TextListStyle;for(var i=0;i<10;++i)if(this.levels[i]!=null)duplicate.levels[i]=this.levels[i].Copy(); return duplicate},Write_ToBinary:function(w){for(var i=0;i<10;++i){w.WriteBool(isRealObject(this.levels[i]));if(isRealObject(this.levels[i]))this.levels[i].Write_ToBinary(w)}},Read_FromBinary:function(r){for(var i=0;i<10;++i)if(r.GetBool()){this.levels[i]=new CParaPr;this.levels[i].Read_FromBinary(r)}else this.levels[i]=null},merge:function(oTextListStyle){if(!oTextListStyle)return;for(var i=0;i0)||!isRealNumber(_fill.type))break;ret.fill=new CBlipFill}if(_url!=null&&_url!==undefined&&_url!="")ret.fill.setRasterImageId(_url);if(ret.fill.RasterImageId==null)ret.fill.RasterImageId="";var tile=_fill.type;if(tile==c_oAscFillBlipType.STRETCH){ret.fill.tile=null;ret.fill.srcRect=null;ret.fill.stretch=true}else if(tile==c_oAscFillBlipType.TILE){ret.fill.tile=new CBlipFillTile;ret.fill.stretch=false;ret.fill.srcRect= null}break}case c_oAscFill.FILL_TYPE_PATT:{if(ret.fill==null)ret.fill=new CPattFill;if(ret.fill.type!=c_oAscFill.FILL_TYPE_PATT)if(undefined!=_fill.PatternType&&undefined!=_fill.fgClr&&undefined!=_fill.bgClr)ret.fill=new CPattFill;else break;if(undefined!=_fill.PatternType)ret.fill.ftype=_fill.PatternType;if(undefined!=_fill.fgClr)ret.fill.fgClr=CorrectUniColor(_fill.fgClr,ret.fill.fgClr,editorId);if(!ret.fill.fgClr)ret.fill.fgClr=CreateUniColorRGB(0,0,0);if(undefined!=_fill.bgClr)ret.fill.bgClr= CorrectUniColor(_fill.bgClr,ret.fill.bgClr,editorId);if(!ret.fill.bgClr)ret.fill.bgClr=CreateUniColorRGB(0,0,0);break}case c_oAscFill.FILL_TYPE_GRAD:{if(ret.fill==null)ret.fill=new CGradFill;var _colors=_fill.Colors;var _positions=_fill.Positions;if(ret.fill.type!=c_oAscFill.FILL_TYPE_GRAD)if(undefined!=_colors&&undefined!=_positions)ret.fill=new CGradFill;else break;if(undefined!=_colors&&undefined!=_positions){if(_colors.length===_positions.length)if(ret.fill.colors.length===_colors.length)for(var i= 0;i<_colors.length;i++){var _gs=ret.fill.colors[i]?ret.fill.colors[i]:new CGs;_gs.color=CorrectUniColor(_colors[i],_gs.color,editorId);_gs.pos=_positions[i];ret.fill.colors[i]=_gs}else{ret.fill.colors.length=0;for(var i=0;i<_colors.length;i++){var _gs=new CGs;_gs.color=CorrectUniColor(_colors[i],_gs.color,editorId);_gs.pos=_positions[i];ret.fill.colors.push(_gs)}}}else if(undefined!=_colors){if(_colors.length==ret.fill.colors.length)for(var i=0;i<_colors.length;i++)ret.fill.colors[i].color=CorrectUniColor(_colors[i], ret.fill.colors[i].color,editorId)}else if(undefined!=_positions)if(_positions.length<=ret.fill.colors.length){if(_positions.length>0;break}if(i===ret.fill.Effects.length){var oEffect=new CAlphaModFix;oEffect.amt=ret.transparent*1E5/255>>0;ret.fill.Effects.push(oEffect)}}return ret}function CreateAscStroke(ln,_canChangeArrows){if(null==ln||null==ln.Fill||ln.Fill.fill==null)return new Asc.asc_CStroke;var ret=new Asc.asc_CStroke;var _fill=ln.Fill.fill; if(_fill!=null)switch(_fill.type){case c_oAscFill.FILL_TYPE_BLIP:{break}case c_oAscFill.FILL_TYPE_SOLID:{ret.color=CreateAscColor(_fill.color);ret.type=c_oAscStrokeType.STROKE_COLOR;break}case c_oAscFill.FILL_TYPE_GRAD:{var _c=_fill.colors;if(_c!=0){ret.color=CreateAscColor(_fill.colors[0].color);ret.type=c_oAscStrokeType.STROKE_COLOR}break}case c_oAscFill.FILL_TYPE_PATT:{ret.color=CreateAscColor(_fill.fgClr);ret.type=c_oAscStrokeType.STROKE_COLOR;break}case c_oAscFill.FILL_TYPE_NOFILL:{ret.color= null;ret.type=c_oAscStrokeType.STROKE_NONE;break}default:{break}}ret.width=ln.w==null?12700:ln.w>>0;ret.width/=36E3;if(ln.cap!=null)ret.asc_putLinecap(ln.cap);if(ln.Join!=null)ret.asc_putLinejoin(ln.Join.type);if(ln.headEnd!=null){ret.asc_putLinebeginstyle(ln.headEnd.type==null?LineEndType.None:ln.headEnd.type);var _len=null==ln.headEnd.len?1:2-ln.headEnd.len;var _w=null==ln.headEnd.w?1:2-ln.headEnd.w;ret.asc_putLinebeginsize(_w*3+_len)}else ret.asc_putLinebeginstyle(LineEndType.None);if(ln.tailEnd!= null){ret.asc_putLineendstyle(ln.tailEnd.type==null?LineEndType.None:ln.tailEnd.type);var _len=null==ln.tailEnd.len?1:2-ln.tailEnd.len;var _w=null==ln.tailEnd.w?1:2-ln.tailEnd.w;ret.asc_putLineendsize(_w*3+_len)}else ret.asc_putLineendstyle(LineEndType.None);if(AscFormat.isRealNumber(ln.prstDash))ret.prstDash=ln.prstDash;else if(ln.prstDash===null)ret.prstDash=Asc.c_oDashType.solid;if(true===_canChangeArrows)ret.canChangeArrows=true;return ret}function CorrectUniStroke(asc_stroke,unistroke,flag){if(null== asc_stroke)return unistroke;var ret=unistroke;if(null==ret)ret=new CLn;var _type=asc_stroke.type;var _w=asc_stroke.width;if(_w!=null&&_w!==undefined)ret.w=_w*36E3;var _color=asc_stroke.color;if(_type==c_oAscStrokeType.STROKE_NONE){ret.Fill=new CUniFill;ret.Fill.fill=new CNoFill}else if(_type!=null)if(null!=_color&&undefined!==_color){ret.Fill=new CUniFill;ret.Fill.type=c_oAscFill.FILL_TYPE_SOLID;ret.Fill.fill=new CSolidFill;ret.Fill.fill.color=CorrectUniColor(_color,ret.Fill.fill.color,flag)}var _join= asc_stroke.LineJoin;if(null!=_join){ret.Join=new LineJoin;ret.Join.type=_join}var _cap=asc_stroke.LineCap;if(null!=_cap)ret.cap=_cap;var _begin_style=asc_stroke.LineBeginStyle;if(null!=_begin_style){if(ret.headEnd==null)ret.headEnd=new EndArrow;ret.headEnd.type=_begin_style}var _end_style=asc_stroke.LineEndStyle;if(null!=_end_style){if(ret.tailEnd==null)ret.tailEnd=new EndArrow;ret.tailEnd.type=_end_style}var _begin_size=asc_stroke.LineBeginSize;if(null!=_begin_size){if(ret.headEnd==null)ret.headEnd= new EndArrow;ret.headEnd.w=2-(_begin_size/3>>0);ret.headEnd.len=2-_begin_size%3}var _end_size=asc_stroke.LineEndSize;if(null!=_end_size){if(ret.tailEnd==null)ret.tailEnd=new EndArrow;ret.tailEnd.w=2-(_end_size/3>>0);ret.tailEnd.len=2-_end_size%3}if(AscFormat.isRealNumber(asc_stroke.prstDash))ret.prstDash=asc_stroke.prstDash;return ret}function CreateAscShapeProp(shape){if(null==shape)return new asc_CShapeProperty;var ret=new asc_CShapeProperty;ret.fill=CreateAscFill(shape.brush);ret.stroke=CreateAscStroke(shape.pen); ret.lockAspect=shape.getNoChangeAspect();var paddings=null;if(shape.textBoxContent){var body_pr=shape.bodyPr;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 ret}function CreateAscShapePropFromProp(shapeProp){var obj= new asc_CShapeProperty;if(!isRealObject(shapeProp))return obj;if(isRealBool(shapeProp.locked))obj.Locked=shapeProp.locked;obj.lockAspect=shapeProp.lockAspect;if(typeof shapeProp.type==="string")obj.type=shapeProp.type;if(isRealObject(shapeProp.fill))obj.fill=CreateAscFill(shapeProp.fill);if(isRealObject(shapeProp.stroke))obj.stroke=CreateAscStroke(shapeProp.stroke,shapeProp.canChangeArrows);if(isRealObject(shapeProp.paddings))obj.paddings=shapeProp.paddings;if(shapeProp.canFill===true||shapeProp.canFill=== false)obj.canFill=shapeProp.canFill;obj.bFromChart=shapeProp.bFromChart;obj.bFromGroup=shapeProp.bFromGroup;obj.bFromImage=shapeProp.bFromImage;obj.w=shapeProp.w;obj.h=shapeProp.h;obj.rot=shapeProp.rot;obj.flipH=shapeProp.flipH;obj.flipV=shapeProp.flipV;obj.vert=shapeProp.vert;obj.verticalTextAlign=shapeProp.verticalTextAlign;if(shapeProp.textArtProperties)obj.textArtProperties=CreateAscTextArtProps(shapeProp.textArtProperties);obj.title=shapeProp.title;obj.description=shapeProp.description;obj.columnNumber= shapeProp.columnNumber;obj.columnSpace=shapeProp.columnSpace;obj.textFitType=shapeProp.textFitType;obj.vertOverflowType=shapeProp.vertOverflowType;obj.shadow=shapeProp.shadow;if(shapeProp.signatureId)obj.signatureId=shapeProp.signatureId;return obj}function CorrectShapeProp(asc_shape_prop,shape){if(null==shape||null==asc_shape_prop)return;shape.spPr.Fill=CorrectUniFill(asc_shape_prop.asc_getFill(),shape.spPr.Fill);shape.spPr.ln=CorrectUniFill(asc_shape_prop.asc_getStroke(),shape.spPr.ln)}function CreateAscTextArtProps(oTextArtProps){if(!oTextArtProps)return undefined; var oRet=new Asc.asc_TextArtProperties;if(oTextArtProps.Fill)oRet.asc_putFill(CreateAscFill(oTextArtProps.Fill));if(oTextArtProps.Line)oRet.asc_putLine(CreateAscStroke(oTextArtProps.Line,false));oRet.asc_putForm(oTextArtProps.Form);return oRet}function CreateUnifillFromAscColor(asc_color,editorId){var Unifill=new CUniFill;Unifill.fill=new CSolidFill;Unifill.fill.color=CorrectUniColor(asc_color,Unifill.fill.color,editorId);return Unifill}function CorrectUniColor(asc_color,unicolor,flag){if(null==asc_color)return unicolor; var ret=unicolor;if(null==ret)ret=new CUniColor;var _type=asc_color.asc_getType();switch(_type){case c_oAscColor.COLOR_TYPE_PRST:{if(ret.color==null||ret.color.type!=c_oAscColor.COLOR_TYPE_PRST)ret.color=new CPrstColor;ret.color.id=asc_color.value;if(ret.Mods.Mods.length!=0)ret.Mods.Mods.splice(0,ret.Mods.Mods.length);break}case c_oAscColor.COLOR_TYPE_SCHEME:{if(ret.color==null||ret.color.type!=c_oAscColor.COLOR_TYPE_SCHEME)ret.color=new CSchemeColor;var _index=parseInt(asc_color.value);if(isNaN(_index))break; var _id=_index/6>>0;var _pos=_index-_id*6;var array_colors_types=[6,15,7,16,0,1,2,3,4,5];ret.color.id=array_colors_types[_id];if(!ret.Mods)ret.setMods(new CColorModifiers);if(ret.Mods.Mods.length!=0)ret.Mods.Mods.splice(0,ret.Mods.Mods.length);var __mods=null;var _flag;if(editor&&editor.WordControl&&editor.WordControl.m_oDrawingDocument&&editor.WordControl.m_oDrawingDocument.GuiControlColorsMap){var _map=editor.WordControl.m_oDrawingDocument.GuiControlColorsMap;_flag=isRealNumber(flag)?flag:1;__mods= AscCommon.GetDefaultMods(_map[_id].r,_map[_id].g,_map[_id].b,_pos,_flag)}else{var _editor=window["Asc"]&&window["Asc"]["editor"];if(_editor&&_editor.wbModel){var _theme=_editor.wbModel.theme;var _clrMap=_editor.wbModel.clrSchemeMap;if(_theme&&_clrMap){var _schemeClr=new CSchemeColor;_schemeClr.id=array_colors_types[_id];var _rgba={R:0,G:0,B:0,A:255};_schemeClr.Calculate(_theme,_clrMap.color_map,_rgba);_flag=isRealNumber(flag)?flag:0;__mods=AscCommon.GetDefaultMods(_schemeClr.RGBA.R,_schemeClr.RGBA.G, _schemeClr.RGBA.B,_pos,_flag)}}}if(null!=__mods)ret.Mods.Mods=__mods;break}default:{if(ret.color==null||ret.color.type!=c_oAscColor.COLOR_TYPE_SRGB)ret.color=new CRGBColor;ret.color.RGBA.R=asc_color.r;ret.color.RGBA.G=asc_color.g;ret.color.RGBA.B=asc_color.b;ret.color.RGBA.A=asc_color.a;if(ret.Mods&&ret.Mods.Mods.length!=0)ret.Mods.Mods.splice(0,ret.Mods.Mods.length)}}return ret}function deleteDrawingBase(aObjects,graphicId){var position=null;for(var i=0;i0){var aNumCache=[];for(i=0;i0){var oTitle=new AscFormat.CTitle;oTitle.setOverlay(false);oTitle.setTx(new AscFormat.CChartText);var oTextBody=AscFormat.CreateTextBodyFromString(sTitle,oDrawingDocument,oTitle.tx);if(AscFormat.isRealNumber(nFontSize)){oTextBody.content.SetApplyToAll(true); oTextBody.content.AddToParagraph(new ParaTextPr({FontSize:nFontSize,Bold:bIsBold}));oTextBody.content.SetApplyToAll(false)}oTitle.tx.setRich(oTextBody);return oTitle}return null}function builder_CreateTitle(sTitle,nFontSize,bIsBold,oChartSpace){if(typeof sTitle==="string"&&sTitle.length>0){var oTitle=new AscFormat.CTitle;oTitle.setOverlay(false);oTitle.setTx(new AscFormat.CChartText);var oTextBody=AscFormat.CreateTextBodyFromString(sTitle,oChartSpace.getDrawingDocument(),oTitle.tx);if(AscFormat.isRealNumber(nFontSize)){oTextBody.content.SetApplyToAll(true); oTextBody.content.AddToParagraph(new ParaTextPr({FontSize:nFontSize,Bold:bIsBold}));oTextBody.content.SetApplyToAll(false)}oTitle.tx.setRich(oTextBody);return oTitle}return null}function builder_SetChartTitle(oChartSpace,sTitle,nFontSize,bIsBold){if(oChartSpace)oChartSpace.chart.setTitle(builder_CreateChartTitle(sTitle,nFontSize,bIsBold,oChartSpace.getDrawingDocument()))}function builder_SetChartHorAxisTitle(oChartSpace,sTitle,nFontSize,bIsBold){if(oChartSpace){var horAxis=oChartSpace.chart.plotArea.getHorizontalAxis(); if(horAxis)horAxis.setTitle(builder_CreateTitle(sTitle,nFontSize,bIsBold,oChartSpace))}}function builder_SetChartVertAxisTitle(oChartSpace,sTitle,nFontSize,bIsBold){if(oChartSpace){var verAxis=oChartSpace.chart.plotArea.getVerticalAxis();if(verAxis)if(typeof sTitle==="string"&&sTitle.length>0){verAxis.setTitle(builder_CreateTitle(sTitle,nFontSize,bIsBold,oChartSpace));if(verAxis.title){var _body_pr=new AscFormat.CBodyPr;_body_pr.reset();if(!verAxis.title.txPr)verAxis.title.setTxPr(AscFormat.CreateTextBodyFromString("", oChartSpace.getDrawingDocument(),verAxis.title));var _text_body=verAxis.title.txPr;_text_body.setBodyPr(_body_pr);verAxis.title.setOverlay(false)}}else verAxis.setTitle(null)}}function builder_SetChartVertAxisOrientation(oChartSpace,bIsMinMax){if(oChartSpace){var verAxis=oChartSpace.chart.plotArea.getVerticalAxis();if(verAxis){if(!verAxis.scaling)verAxis.setScaling(new AscFormat.CScaling);var scaling=verAxis.scaling;if(bIsMinMax)scaling.setOrientation(AscFormat.ORIENTATION_MIN_MAX);else scaling.setOrientation(AscFormat.ORIENTATION_MAX_MIN)}}} function builder_SetChartHorAxisOrientation(oChartSpace,bIsMinMax){if(oChartSpace){var horAxis=oChartSpace.chart.plotArea.getHorizontalAxis();if(horAxis){if(!horAxis.scaling)horAxis.setScaling(new AscFormat.CScaling);var scaling=horAxis.scaling;if(bIsMinMax)scaling.setOrientation(AscFormat.ORIENTATION_MIN_MAX);else scaling.setOrientation(AscFormat.ORIENTATION_MAX_MIN)}}}function builder_SetChartLegendPos(oChartSpace,sLegendPos){if(oChartSpace&&oChartSpace.chart)if(sLegendPos==="none"){if(oChartSpace.chart.legend)oChartSpace.chart.setLegend(null)}else{var nLegendPos= null;switch(sLegendPos){case "left":{nLegendPos=Asc.c_oAscChartLegendShowSettings.left;break}case "top":{nLegendPos=Asc.c_oAscChartLegendShowSettings.top;break}case "right":{nLegendPos=Asc.c_oAscChartLegendShowSettings.right;break}case "bottom":{nLegendPos=Asc.c_oAscChartLegendShowSettings.bottom;break}}if(null!==nLegendPos){if(!oChartSpace.chart.legend)oChartSpace.chart.setLegend(new AscFormat.CLegend);if(oChartSpace.chart.legend.legendPos!==nLegendPos)oChartSpace.chart.legend.setLegendPos(nLegendPos); if(oChartSpace.chart.legend.overlay!==false)oChartSpace.chart.legend.setOverlay(false)}}}function builder_SetObjectFontSize(oObject,nFontSize,oDrawingDocument){if(!oObject)return;if(!oObject.txPr)oObject.setTxPr(new AscFormat.CTextBody);if(!oObject.txPr.bodyPr)oObject.txPr.setBodyPr(new AscFormat.CBodyPr);if(!oObject.txPr.content)oObject.txPr.setContent(new AscFormat.CDrawingDocContent(oObject.txPr,oDrawingDocument,0,0,100,500,false,false,true));var oPr=oObject.txPr.content.Content[0].Pr.Copy();if(!oPr.DefaultRunPr)oPr.DefaultRunPr= new AscCommonWord.CTextPr;oPr.DefaultRunPr.FontSize=nFontSize;oObject.txPr.content.Content[0].Set_Pr(oPr)}function builder_SetLegendFontSize(oChartSpace,nFontSize){builder_SetObjectFontSize(oChartSpace.chart.legend,nFontSize,oChartSpace.getDrawingDocument())}function builder_SetHorAxisFontSize(oChartSpace,nFontSize){builder_SetObjectFontSize(oChartSpace.chart.plotArea.getHorizontalAxis(),nFontSize,oChartSpace.getDrawingDocument())}function builder_SetVerAxisFontSize(oChartSpace,nFontSize){builder_SetObjectFontSize(oChartSpace.chart.plotArea.getVerticalAxis(), nFontSize,oChartSpace.getDrawingDocument())}function builder_SetShowPointDataLabel(oChartSpace,nSeriesIndex,nPointIndex,bShowSerName,bShowCatName,bShowVal,bShowPerecent){if(oChartSpace&&oChartSpace.chart&&oChartSpace.chart.plotArea&&oChartSpace.chart.plotArea.charts[0]){var oChart=oChartSpace.chart.plotArea.charts[0];var bPieChart=oChart.getObjectType()===AscDFH.historyitem_type_PieChart||oChart.getObjectType()===AscDFH.historyitem_type_DoughnutChart;var ser=oChart.series[nSeriesIndex];if(ser){{if(!ser.dLbls)if(oChart.dLbls)ser.setDLbls(oChart.dLbls.createDuplicate()); else{ser.setDLbls(new AscFormat.CDLbls);ser.dLbls.setSeparator(",");ser.dLbls.setShowSerName(false);ser.dLbls.setShowCatName(false);ser.dLbls.setShowVal(false);ser.dLbls.setShowLegendKey(false);if(bPieChart)ser.dLbls.setShowPercent(false);ser.dLbls.setShowBubbleSize(false)}var dLbl=ser.dLbls&&ser.dLbls.findDLblByIdx(nPointIndex);if(!dLbl){dLbl=new AscFormat.CDLbl;dLbl.setIdx(nPointIndex);if(ser.dLbls.txPr)dLbl.merge(ser.dLbls);ser.dLbls.addDLbl(dLbl)}dLbl.setSeparator(",");dLbl.setShowSerName(true== bShowSerName);dLbl.setShowCatName(true==bShowCatName);dLbl.setShowVal(true==bShowVal);dLbl.setShowLegendKey(false);if(bPieChart)dLbl.setShowPercent(true===bShowPerecent);dLbl.setShowBubbleSize(false)}}}}function builder_SetShowDataLabels(oChartSpace,bShowSerName,bShowCatName,bShowVal,bShowPerecent){if(oChartSpace&&oChartSpace.chart&&oChartSpace.chart.plotArea&&oChartSpace.chart.plotArea.charts[0]){var oChart=oChartSpace.chart.plotArea.charts[0];var bPieChart=oChart.getObjectType()===AscDFH.historyitem_type_PieChart|| oChart.getObjectType()===AscDFH.historyitem_type_DoughnutChart;if(false==bShowSerName&&false==bShowCatName&&false==bShowVal&&(bPieChart&&bShowPerecent===false))if(oChart.dLbls)oChart.setDLbls(null);if(!oChart.dLbls)oChart.setDLbls(new AscFormat.CDLbls);oChart.dLbls.setSeparator(",");oChart.dLbls.setShowSerName(true==bShowSerName);oChart.dLbls.setShowCatName(true==bShowCatName);oChart.dLbls.setShowVal(true==bShowVal);oChart.dLbls.setShowLegendKey(false);if(bPieChart)oChart.dLbls.setShowPercent(true=== bShowPerecent);oChart.dLbls.setShowBubbleSize(false)}}function builder_SetChartAxisLabelsPos(oAxis,sPosition){if(!oAxis||!oAxis.setTickLblPos)return;var nPositionType=null;var c_oAscTickLabelsPos=window["Asc"].c_oAscTickLabelsPos;switch(sPosition){case "high":{nPositionType=c_oAscTickLabelsPos.TICK_LABEL_POSITION_HIGH;break}case "low":{nPositionType=c_oAscTickLabelsPos.TICK_LABEL_POSITION_LOW;break}case "nextTo":{nPositionType=c_oAscTickLabelsPos.TICK_LABEL_POSITION_NEXT_TO;break}case "none":{nPositionType= c_oAscTickLabelsPos.TICK_LABEL_POSITION_NONE;break}}if(nPositionType!==null)oAxis.setTickLblPos(nPositionType)}function builder_SetChartVertAxisTickLablePosition(oChartSpace,sPosition){if(oChartSpace)builder_SetChartAxisLabelsPos(oChartSpace.chart.plotArea.getVerticalAxis(),sPosition)}function builder_SetChartHorAxisTickLablePosition(oChartSpace,sPosition){if(oChartSpace)builder_SetChartAxisLabelsPos(oChartSpace.chart.plotArea.getHorizontalAxis(),sPosition)}function builder_GetTickMark(sTickMark){var nNewTickMark= null;switch(sTickMark){case "cross":{nNewTickMark=Asc.c_oAscTickMark.TICK_MARK_CROSS;break}case "in":{nNewTickMark=Asc.c_oAscTickMark.TICK_MARK_IN;break}case "none":{nNewTickMark=Asc.c_oAscTickMark.TICK_MARK_NONE;break}case "out":{nNewTickMark=Asc.c_oAscTickMark.TICK_MARK_OUT;break}}return nNewTickMark}function builder_SetChartAxisMajorTickMark(oAxis,sTickMark){if(!oAxis)return;var nNewTickMark=builder_GetTickMark(sTickMark);if(nNewTickMark!==null)oAxis.setMajorTickMark(nNewTickMark)}function builder_SetChartAxisMinorTickMark(oAxis, sTickMark){if(!oAxis)return;var nNewTickMark=builder_GetTickMark(sTickMark);if(nNewTickMark!==null)oAxis.setMinorTickMark(nNewTickMark)}function builder_SetChartHorAxisMajorTickMark(oChartSpace,sTickMark){if(oChartSpace)builder_SetChartAxisMajorTickMark(oChartSpace.chart.plotArea.getHorizontalAxis(),sTickMark)}function builder_SetChartHorAxisMinorTickMark(oChartSpace,sTickMark){if(oChartSpace)builder_SetChartAxisMinorTickMark(oChartSpace.chart.plotArea.getHorizontalAxis(),sTickMark)}function builder_SetChartVerAxisMajorTickMark(oChartSpace, sTickMark){if(oChartSpace)builder_SetChartAxisMajorTickMark(oChartSpace.chart.plotArea.getVerticalAxis(),sTickMark)}function builder_SetChartVerAxisMinorTickMark(oChartSpace,sTickMark){if(oChartSpace)builder_SetChartAxisMinorTickMark(oChartSpace.chart.plotArea.getVerticalAxis(),sTickMark)}function builder_SetAxisMajorGridlines(oAxis,oLn){if(oAxis){if(!oAxis.majorGridlines)oAxis.setMajorGridlines(new AscFormat.CSpPr);oAxis.majorGridlines.setLn(oLn);if(!oAxis.majorGridlines.Fill&&!oAxis.majorGridlines.ln)oAxis.setMajorGridlines(null)}} function builder_SetAxisMinorGridlines(oAxis,oLn){if(oAxis){if(!oAxis.minorGridlines)oAxis.setMinorGridlines(new AscFormat.CSpPr);oAxis.minorGridlines.setLn(oLn);if(!oAxis.minorGridlines.Fill&&!oAxis.minorGridlines.ln)oAxis.setMinorGridlines(null)}}function builder_SetHorAxisMajorGridlines(oChartSpace,oLn){builder_SetAxisMajorGridlines(oChartSpace.chart.plotArea.getVerticalAxis(),oLn)}function builder_SetHorAxisMinorGridlines(oChartSpace,oLn){builder_SetAxisMinorGridlines(oChartSpace.chart.plotArea.getVerticalAxis(), oLn)}function builder_SetVerAxisMajorGridlines(oChartSpace,oLn){builder_SetAxisMajorGridlines(oChartSpace.chart.plotArea.getHorizontalAxis(),oLn)}function builder_SetVerAxisMinorGridlines(oChartSpace,oLn){builder_SetAxisMinorGridlines(oChartSpace.chart.plotArea.getHorizontalAxis(),oLn)}window["AscFormat"]=window["AscFormat"]||{};window["AscFormat"].CreateFontRef=CreateFontRef;window["AscFormat"].CreatePresetColor=CreatePresetColor;window["AscFormat"].isRealNumber=isRealNumber;window["AscFormat"].isRealBool= isRealBool;window["AscFormat"].writeLong=writeLong;window["AscFormat"].readLong=readLong;window["AscFormat"].writeDouble=writeDouble;window["AscFormat"].readDouble=readDouble;window["AscFormat"].writeBool=writeBool;window["AscFormat"].readBool=readBool;window["AscFormat"].writeString=writeString;window["AscFormat"].readString=readString;window["AscFormat"].writeObject=writeObject;window["AscFormat"].readObject=readObject;window["AscFormat"].checkThemeFonts=checkThemeFonts;window["AscFormat"].ExecuteNoHistory= ExecuteNoHistory;window["AscFormat"].checkTableCellPr=checkTableCellPr;window["AscFormat"].CColorMod=CColorMod;window["AscFormat"].CColorModifiers=CColorModifiers;window["AscFormat"].CSysColor=CSysColor;window["AscFormat"].CPrstColor=CPrstColor;window["AscFormat"].CRGBColor=CRGBColor;window["AscFormat"].CSchemeColor=CSchemeColor;window["AscFormat"].CStyleColor=CStyleColor;window["AscFormat"].CUniColor=CUniColor;window["AscFormat"].CreateUniColorRGB=CreateUniColorRGB;window["AscFormat"].CreateUniColorRGB2= CreateUniColorRGB2;window["AscFormat"].CreteSolidFillRGB=CreteSolidFillRGB;window["AscFormat"].CreateSolidFillRGBA=CreateSolidFillRGBA;window["AscFormat"].CSrcRect=CSrcRect;window["AscFormat"].CBlipFillTile=CBlipFillTile;window["AscFormat"].CBlipFill=CBlipFill;window["AscFormat"].CSolidFill=CSolidFill;window["AscFormat"].CGs=CGs;window["AscFormat"].GradLin=GradLin;window["AscFormat"].GradPath=GradPath;window["AscFormat"].CGradFill=CGradFill;window["AscFormat"].CPattFill=CPattFill;window["AscFormat"].CNoFill= CNoFill;window["AscFormat"].CGrpFill=CGrpFill;window["AscFormat"].CUniFill=CUniFill;window["AscFormat"].CompareUniFill=CompareUniFill;window["AscFormat"].CompareUnifillBool=CompareUnifillBool;window["AscFormat"].CompareShapeProperties=CompareShapeProperties;window["AscFormat"].EndArrow=EndArrow;window["AscFormat"].ConvertJoinAggType=ConvertJoinAggType;window["AscFormat"].LineJoin=LineJoin;window["AscFormat"].CLn=CLn;window["AscFormat"].DefaultShapeDefinition=DefaultShapeDefinition;window["AscFormat"].CNvPr= CNvPr;window["AscFormat"].NvPr=NvPr;window["AscFormat"].Ph=Ph;window["AscFormat"].UniNvPr=UniNvPr;window["AscFormat"].StyleRef=StyleRef;window["AscFormat"].FontRef=FontRef;window["AscFormat"].CShapeStyle=CShapeStyle;window["AscFormat"].CreateDefaultShapeStyle=CreateDefaultShapeStyle;window["AscFormat"].CXfrm=CXfrm;window["AscFormat"].CEffectProperties=CEffectProperties;window["AscFormat"].CEffectLst=CEffectLst;window["AscFormat"].CSpPr=CSpPr;window["AscFormat"].ClrScheme=ClrScheme;window["AscFormat"].ClrMap= ClrMap;window["AscFormat"].ExtraClrScheme=ExtraClrScheme;window["AscFormat"].FontCollection=FontCollection;window["AscFormat"].FontScheme=FontScheme;window["AscFormat"].FmtScheme=FmtScheme;window["AscFormat"].ThemeElements=ThemeElements;window["AscFormat"].CTheme=CTheme;window["AscFormat"].HF=HF;window["AscFormat"].CBgPr=CBgPr;window["AscFormat"].CBg=CBg;window["AscFormat"].CSld=CSld;window["AscFormat"].CTextStyles=CTextStyles;window["AscFormat"].redrawSlide=redrawSlide;window["AscFormat"].CTextFit= CTextFit;window["AscFormat"].CBodyPr=CBodyPr;window["AscFormat"].CHyperlink=CHyperlink;window["AscFormat"].CTextParagraphPr=CTextParagraphPr;window["AscFormat"].CompareBullets=CompareBullets;window["AscFormat"].CBullet=CBullet;window["AscFormat"].CBulletColor=CBulletColor;window["AscFormat"].CBulletSize=CBulletSize;window["AscFormat"].CBulletTypeface=CBulletTypeface;window["AscFormat"].CBulletType=CBulletType;window["AscFormat"].TextListStyle=TextListStyle;window["AscFormat"].GenerateDefaultTheme= GenerateDefaultTheme;window["AscFormat"].GenerateDefaultMasterSlide=GenerateDefaultMasterSlide;window["AscFormat"].GenerateDefaultSlideLayout=GenerateDefaultSlideLayout;window["AscFormat"].GenerateDefaultSlide=GenerateDefaultSlide;window["AscFormat"].CreateDefaultTextRectStyle=CreateDefaultTextRectStyle;window["AscFormat"].GenerateDefaultColorMap=GenerateDefaultColorMap;window["AscFormat"].CreateAscFill=CreateAscFill;window["AscFormat"].CorrectUniFill=CorrectUniFill;window["AscFormat"].CreateAscStroke= CreateAscStroke;window["AscFormat"].CorrectUniStroke=CorrectUniStroke;window["AscFormat"].CreateAscShapePropFromProp=CreateAscShapePropFromProp;window["AscFormat"].CreateAscTextArtProps=CreateAscTextArtProps;window["AscFormat"].CreateUnifillFromAscColor=CreateUnifillFromAscColor;window["AscFormat"].CorrectUniColor=CorrectUniColor;window["AscFormat"].deleteDrawingBase=deleteDrawingBase;window["AscFormat"].CNvUniSpPr=CNvUniSpPr;window["AscFormat"].UniMedia=UniMedia;window["AscFormat"].CT_Hyperlink= CT_Hyperlink;window["AscFormat"].builder_CreateShape=builder_CreateShape;window["AscFormat"].builder_CreateChart=builder_CreateChart;window["AscFormat"].builder_CreateGroup=builder_CreateGroup;window["AscFormat"].builder_CreateSchemeColor=builder_CreateSchemeColor;window["AscFormat"].builder_CreatePresetColor=builder_CreatePresetColor;window["AscFormat"].builder_CreateGradientStop=builder_CreateGradientStop;window["AscFormat"].builder_CreateLinearGradient=builder_CreateLinearGradient;window["AscFormat"].builder_CreateRadialGradient= builder_CreateRadialGradient;window["AscFormat"].builder_CreatePatternFill=builder_CreatePatternFill;window["AscFormat"].builder_CreateBlipFill=builder_CreateBlipFill;window["AscFormat"].builder_CreateLine=builder_CreateLine;window["AscFormat"].builder_SetChartTitle=builder_SetChartTitle;window["AscFormat"].builder_SetChartHorAxisTitle=builder_SetChartHorAxisTitle;window["AscFormat"].builder_SetChartVertAxisTitle=builder_SetChartVertAxisTitle;window["AscFormat"].builder_SetChartLegendPos=builder_SetChartLegendPos; window["AscFormat"].builder_SetShowDataLabels=builder_SetShowDataLabels;window["AscFormat"].builder_SetChartVertAxisOrientation=builder_SetChartVertAxisOrientation;window["AscFormat"].builder_SetChartHorAxisOrientation=builder_SetChartHorAxisOrientation;window["AscFormat"].builder_SetChartVertAxisTickLablePosition=builder_SetChartVertAxisTickLablePosition;window["AscFormat"].builder_SetChartHorAxisTickLablePosition=builder_SetChartHorAxisTickLablePosition;window["AscFormat"].builder_SetChartHorAxisMajorTickMark= builder_SetChartHorAxisMajorTickMark;window["AscFormat"].builder_SetChartHorAxisMinorTickMark=builder_SetChartHorAxisMinorTickMark;window["AscFormat"].builder_SetChartVerAxisMajorTickMark=builder_SetChartVerAxisMajorTickMark;window["AscFormat"].builder_SetChartVerAxisMinorTickMark=builder_SetChartVerAxisMinorTickMark;window["AscFormat"].builder_SetLegendFontSize=builder_SetLegendFontSize;window["AscFormat"].builder_SetHorAxisMajorGridlines=builder_SetHorAxisMajorGridlines;window["AscFormat"].builder_SetHorAxisMinorGridlines= builder_SetHorAxisMinorGridlines;window["AscFormat"].builder_SetVerAxisMajorGridlines=builder_SetVerAxisMajorGridlines;window["AscFormat"].builder_SetVerAxisMinorGridlines=builder_SetVerAxisMinorGridlines;window["AscFormat"].builder_SetHorAxisFontSize=builder_SetHorAxisFontSize;window["AscFormat"].builder_SetVerAxisFontSize=builder_SetVerAxisFontSize;window["AscFormat"].builder_SetShowPointDataLabel=builder_SetShowPointDataLabel;window["AscFormat"].Ax_Counter=Ax_Counter;window["AscFormat"].TYPE_TRACK= TYPE_TRACK;window["AscFormat"].TYPE_KIND=TYPE_KIND;window["AscFormat"].mapPrstColor=map_prst_color;window["AscFormat"].ar_arrow=ar_arrow;window["AscFormat"].ar_diamond=ar_diamond;window["AscFormat"].ar_none=ar_none;window["AscFormat"].ar_oval=ar_oval;window["AscFormat"].ar_stealth=ar_stealth;window["AscFormat"].ar_triangle=ar_triangle;window["AscFormat"].LineEndType=LineEndType;window["AscFormat"].LineEndSize=LineEndSize;window["AscFormat"].LineJoinType=LineJoinType;window["AscFormat"].phType_body= 0;window["AscFormat"].phType_chart=1;window["AscFormat"].phType_clipArt=2;window["AscFormat"].phType_ctrTitle=3;window["AscFormat"].phType_dgm=4;window["AscFormat"].phType_dt=5;window["AscFormat"].phType_ftr=6;window["AscFormat"].phType_hdr=7;window["AscFormat"].phType_media=8;window["AscFormat"].phType_obj=9;window["AscFormat"].phType_pic=10;window["AscFormat"].phType_sldImg=11;window["AscFormat"].phType_sldNum=12;window["AscFormat"].phType_subTitle=13;window["AscFormat"].phType_tbl=14;window["AscFormat"].phType_title= 15;window["AscFormat"].fntStyleInd_none=2;window["AscFormat"].fntStyleInd_major=0;window["AscFormat"].fntStyleInd_minor=1;window["AscFormat"].VERTICAL_ANCHOR_TYPE_BOTTOM=0;window["AscFormat"].VERTICAL_ANCHOR_TYPE_CENTER=1;window["AscFormat"].VERTICAL_ANCHOR_TYPE_DISTRIBUTED=2;window["AscFormat"].VERTICAL_ANCHOR_TYPE_JUSTIFIED=3;window["AscFormat"].VERTICAL_ANCHOR_TYPE_TOP=4;window["AscFormat"].nVertTTeaVert=0;window["AscFormat"].nVertTThorz=1;window["AscFormat"].nVertTTmongolianVert=2;window["AscFormat"].nVertTTvert= 3;window["AscFormat"].nVertTTvert270=4;window["AscFormat"].nVertTTwordArtVert=5;window["AscFormat"].nVertTTwordArtVertRtl=6;window["AscFormat"].nTWTNone=0;window["AscFormat"].nTWTSquare=1;window["AscFormat"]["text_fit_No"]=window["AscFormat"].text_fit_No=0;window["AscFormat"]["text_fit_Auto"]=window["AscFormat"].text_fit_Auto=1;window["AscFormat"]["text_fit_NormAuto"]=window["AscFormat"].text_fit_NormAuto=2;window["AscFormat"].BULLET_TYPE_COLOR_NONE=0;window["AscFormat"].BULLET_TYPE_COLOR_CLRTX=1; window["AscFormat"].BULLET_TYPE_COLOR_CLR=2;window["AscFormat"].BULLET_TYPE_SIZE_NONE=0;window["AscFormat"].BULLET_TYPE_SIZE_TX=1;window["AscFormat"].BULLET_TYPE_SIZE_PCT=2;window["AscFormat"].BULLET_TYPE_SIZE_PTS=3;window["AscFormat"].BULLET_TYPE_TYPEFACE_NONE=0;window["AscFormat"].BULLET_TYPE_TYPEFACE_TX=1;window["AscFormat"].BULLET_TYPE_TYPEFACE_BUFONT=2;window["AscFormat"].PARRUN_TYPE_NONE=0;window["AscFormat"].PARRUN_TYPE_RUN=1;window["AscFormat"].PARRUN_TYPE_FLD=2;window["AscFormat"].PARRUN_TYPE_BR= 3;window["AscFormat"].PARRUN_TYPE_MATH=4;window["AscFormat"].PARRUN_TYPE_MATHPARA=5;window["AscFormat"]._weight_body=_weight_body;window["AscFormat"]._weight_chart=_weight_chart;window["AscFormat"]._weight_clipArt=_weight_clipArt;window["AscFormat"]._weight_ctrTitle=_weight_ctrTitle;window["AscFormat"]._weight_dgm=_weight_dgm;window["AscFormat"]._weight_media=_weight_media;window["AscFormat"]._weight_obj=_weight_obj;window["AscFormat"]._weight_pic=_weight_pic;window["AscFormat"]._weight_subTitle= _weight_subTitle;window["AscFormat"]._weight_tbl=_weight_tbl;window["AscFormat"]._weight_title=_weight_title;window["AscFormat"]._ph_multiplier=_ph_multiplier;window["AscFormat"].nSldLtTTitle=nSldLtTTitle;window["AscFormat"].nSldLtTObj=nSldLtTObj;window["AscFormat"].nSldLtTTx=nSldLtTTx;window["AscFormat"]._arr_lt_types_weight=_arr_lt_types_weight;window["AscFormat"]._global_layout_summs_array=_global_layout_summs_array;window["AscFormat"].nOTOwerflow=window["AscFormat"]["nOTOwerflow"]=nOTOwerflow; window["AscFormat"].nOTClip=window["AscFormat"]["nOTClip"]=nOTClip;window["AscFormat"].nOTEllipsis=window["AscFormat"]["nOTEllipsis"]=nOTEllipsis;window["AscFormat"].BULLET_TYPE_BULLET_NONE=window["AscFormat"]["BULLET_TYPE_BULLET_NONE"]=BULLET_TYPE_BULLET_NONE;window["AscFormat"].BULLET_TYPE_BULLET_CHAR=window["AscFormat"]["BULLET_TYPE_BULLET_CHAR"]=BULLET_TYPE_BULLET_CHAR;window["AscFormat"].BULLET_TYPE_BULLET_AUTONUM=window["AscFormat"]["BULLET_TYPE_BULLET_AUTONUM"]=BULLET_TYPE_BULLET_AUTONUM;window["AscFormat"].BULLET_TYPE_BULLET_BLIP= window["AscFormat"]["BULLET_TYPE_BULLET_BLIP"]=BULLET_TYPE_BULLET_BLIP;window["AscFormat"].AUDIO_CD=AUDIO_CD;window["AscFormat"].WAV_AUDIO_FILE=WAV_AUDIO_FILE;window["AscFormat"].AUDIO_FILE=AUDIO_FILE;window["AscFormat"].VIDEO_FILE=VIDEO_FILE;window["AscFormat"].QUICK_TIME_FILE=QUICK_TIME_FILE;window["AscFormat"].fCreateEffectByType=fCreateEffectByType;window["AscFormat"].COuterShdw=COuterShdw;window["AscFormat"].CGlow=CGlow;window["AscFormat"].CDuotone=CDuotone;window["AscFormat"].CXfrmEffect=CXfrmEffect; window["AscFormat"].CBlur=CBlur;window["AscFormat"].CPrstShdw=CPrstShdw;window["AscFormat"].CInnerShdw=CInnerShdw;window["AscFormat"].CReflection=CReflection;window["AscFormat"].CSoftEdge=CSoftEdge;window["AscFormat"].CFillOverlay=CFillOverlay;window["AscFormat"].CAlphaCeiling=CAlphaCeiling;window["AscFormat"].CAlphaFloor=CAlphaFloor;window["AscFormat"].CTintEffect=CTintEffect;window["AscFormat"].CRelOff=CRelOff;window["AscFormat"].CLumEffect=CLumEffect;window["AscFormat"].CHslEffect=CHslEffect;window["AscFormat"].CGrayscl= CGrayscl;window["AscFormat"].CEffectElement=CEffectElement;window["AscFormat"].CAlphaRepl=CAlphaRepl;window["AscFormat"].CAlphaOutset=CAlphaOutset;window["AscFormat"].CAlphaModFix=CAlphaModFix;window["AscFormat"].CAlphaBiLevel=CAlphaBiLevel;window["AscFormat"].CBiLevel=CBiLevel;window["AscFormat"].CEffectContainer=CEffectContainer;window["AscFormat"].CFillEffect=CFillEffect;window["AscFormat"].CClrRepl=CClrRepl;window["AscFormat"].CClrChange=CClrChange;window["AscFormat"].CAlphaInv=CAlphaInv;window["AscFormat"].CAlphaMod= CAlphaMod;window["AscFormat"].CBlend=CBlend;window["AscFormat"].CreateNoneBullet=CreateNoneBullet;window["AscFormat"].ChartBuilderTypeToInternal=ChartBuilderTypeToInternal;window["AscFormat"].InitClass=InitClass;window["AscFormat"].CBaseObject=CBaseObject;window["AscFormat"].CBaseFormatObject=CBaseFormatObject;window["AscFormat"].DEFAULT_COLOR_MAP=GenerateDefaultColorMap()})(window);(function(window,undefined){var CBaseObject=AscFormat.CBaseObject;AscDFH.changesFactory[AscDFH.historyitem_AutoShapes_SetLocks]= AscDFH.CChangesDrawingsLong;AscDFH.changesFactory[AscDFH.historyitem_AutoShapes_SetDrawingBaseType]=AscDFH.CChangesDrawingsLong;AscDFH.changesFactory[AscDFH.historyitem_AutoShapes_SetDrawingBaseEditAs]=AscDFH.CChangesDrawingsLong;AscDFH.changesFactory[AscDFH.historyitem_AutoShapes_SetWorksheet]=AscDFH.CChangesDrawingsString;AscDFH.changesFactory[AscDFH.historyitem_ShapeSetBDeleted]=AscDFH.CChangesDrawingsBool;AscDFH.changesFactory[AscDFH.historyitem_ShapeSetMacro]=AscDFH.CChangesDrawingsString;AscDFH.changesFactory[AscDFH.historyitem_ShapeSetTextLink]= AscDFH.CChangesDrawingsString;AscDFH.changesFactory[AscDFH.historyitem_AutoShapes_SetDrawingBasePos]=AscDFH.CChangesDrawingsObjectNoId;AscDFH.changesFactory[AscDFH.historyitem_AutoShapes_SetDrawingBaseExt]=AscDFH.CChangesDrawingsObjectNoId;AscDFH.changesFactory[AscDFH.historyitem_AutoShapes_SetDrawingBaseCoors]=AscDFH.CChangesDrawingsObjectNoId;var drawingsChangesMap=window["AscDFH"].drawingsChangesMap;drawingsChangesMap[AscDFH.historyitem_AutoShapes_SetLocks]=function(oClass,value){oClass.locks= value};drawingsChangesMap[AscDFH.historyitem_ShapeSetBDeleted]=function(oClass,value){oClass.bDeleted=value};drawingsChangesMap[AscDFH.historyitem_AutoShapes_SetDrawingBaseType]=function(oClass,value){if(oClass.drawingBase){oClass.drawingBase.Type=value;oClass.handleUpdateExtents()}};drawingsChangesMap[AscDFH.historyitem_AutoShapes_SetDrawingBaseEditAs]=function(oClass,value){if(oClass.drawingBase){oClass.drawingBase.editAs=value;oClass.handleUpdateExtents()}};drawingsChangesMap[AscDFH.historyitem_AutoShapes_SetWorksheet]= function(oClass,value){if(typeof value==="string"){var oApi=window["Asc"]&&window["Asc"]["editor"];if(oApi&&oApi.wbModel)oClass.worksheet=oApi.wbModel.getWorksheetById(value);else oClass.worksheet=null}else oClass.worksheet=null};drawingsChangesMap[AscDFH.historyitem_AutoShapes_SetDrawingBasePos]=function(oClass,value){if(value)if(oClass.drawingBase&&oClass.drawingBase.Pos){oClass.drawingBase.Pos.X=value.a;oClass.drawingBase.Pos.Y=value.b;oClass.handleUpdatePosition()}};drawingsChangesMap[AscDFH.historyitem_AutoShapes_SetDrawingBaseExt]= function(oClass,value){if(value)if(oClass.drawingBase&&oClass.drawingBase.ext){oClass.drawingBase.ext.cx=value.a;oClass.drawingBase.ext.cy=value.b;oClass.handleUpdateExtents()}};drawingsChangesMap[AscDFH.historyitem_AutoShapes_SetDrawingBaseCoors]=function(oClass,value){if(value)if(oClass.drawingBase){oClass.drawingBase.from.col=value.fromCol;oClass.drawingBase.from.colOff=value.fromColOff;oClass.drawingBase.from.row=value.fromRow;oClass.drawingBase.from.rowOff=value.fromRowOff;oClass.drawingBase.to.col= value.toCol;oClass.drawingBase.to.colOff=value.toColOff;oClass.drawingBase.to.row=value.toRow;oClass.drawingBase.to.rowOff=value.toRowOff;oClass.drawingBase.Pos.X=value.posX;oClass.drawingBase.Pos.Y=value.posY;oClass.drawingBase.ext.cx=value.cx;oClass.drawingBase.ext.cy=value.cy;oClass.handleUpdateExtents()}};drawingsChangesMap[AscDFH.historyitem_ShapeSetMacro]=function(oClass,value){oClass.macro=value};drawingsChangesMap[AscDFH.historyitem_ShapeSetTextLink]=function(oClass,value){oClass.textLink= value};AscDFH.drawingsConstructorsMap[AscDFH.historyitem_AutoShapes_SetDrawingBasePos]=CDrawingBaseCoordsWritable;AscDFH.drawingsConstructorsMap[AscDFH.historyitem_AutoShapes_SetDrawingBaseExt]=CDrawingBaseCoordsWritable;AscDFH.drawingsConstructorsMap[AscDFH.historyitem_AutoShapes_SetDrawingBaseCoors]=CDrawingBasePosWritable;var LOCKS_MASKS={noGrp:1,noUngrp:4,noSelect:16,noRot:64,noChangeAspect:256,noMove:1024,noResize:4096,noEditPoints:16384,noAdjustHandles:65536,noChangeArrowheads:262144,noChangeShapeType:1048576, noDrilldown:4194304,noTextEdit:8388608,noCrop:16777216,txBox:33554432};function checkNormalRotate(rot){var _rot=normalizeRotate(rot);return _rot>=0&&_rot=3*Math.PI*.25&&_rot<5*Math.PI*.25||_rot>=7*Math.PI*.25&&_rot<2*Math.PI}function normalizeRotate(rot){var new_rot=rot;if(AscFormat.isRealNumber(new_rot)){while(new_rot>=2*Math.PI)new_rot-=2*Math.PI;while(new_rot<0)new_rot+=2*Math.PI;if(AscFormat.fApproxEqual(new_rot,2*Math.PI,.001))new_rot=0;return new_rot}return new_rot}function CDrawingBaseCoordsWritable(a, b){this.a=a;this.b=b}CDrawingBaseCoordsWritable.prototype.Write_ToBinary=function(Writer){Writer.WriteDouble(this.a);Writer.WriteDouble(this.b)};CDrawingBaseCoordsWritable.prototype.Read_FromBinary=function(Reader){this.a=Reader.GetDouble();this.b=Reader.GetDouble()};window["AscFormat"].CDrawingBaseCoordsWritable=CDrawingBaseCoordsWritable;function CDrawingBasePosWritable(oObject){this.fromCol=null;this.fromColOff=null;this.fromRow=null;this.fromRowOff=null;this.toCol=null;this.toColOff=null;this.toRow= null;this.toRowOff=null;this.posX=null;this.posY=null;this.cx=null;this.cy=null;if(oObject){this.fromCol=oObject.fromCol;this.fromColOff=oObject.fromColOff;this.fromRow=oObject.fromRow;this.fromRowOff=oObject.fromRowOff;this.toCol=oObject.toCol;this.toColOff=oObject.toColOff;this.toRow=oObject.toRow;this.toRowOff=oObject.toRowOff;this.posX=oObject.posX;this.posY=oObject.posY;this.cx=oObject.cx;this.cy=oObject.cy}}CDrawingBasePosWritable.prototype.Write_ToBinary=function(Writer){AscFormat.writeLong(Writer, this.fromCol);AscFormat.writeDouble(Writer,this.fromColOff);AscFormat.writeLong(Writer,this.fromRow);AscFormat.writeDouble(Writer,this.fromRowOff);AscFormat.writeLong(Writer,this.toCol);AscFormat.writeDouble(Writer,this.toColOff);AscFormat.writeLong(Writer,this.toRow);AscFormat.writeDouble(Writer,this.toRowOff);AscFormat.writeDouble(Writer,this.posX);AscFormat.writeDouble(Writer,this.posY);AscFormat.writeDouble(Writer,this.cx);AscFormat.writeDouble(Writer,this.cy)};CDrawingBasePosWritable.prototype.Read_FromBinary= function(Reader){this.fromCol=AscFormat.readLong(Reader);this.fromColOff=AscFormat.readDouble(Reader);this.fromRow=AscFormat.readLong(Reader);this.fromRowOff=AscFormat.readDouble(Reader);this.toCol=AscFormat.readLong(Reader);this.toColOff=AscFormat.readDouble(Reader);this.toRow=AscFormat.readLong(Reader);this.toRowOff=AscFormat.readDouble(Reader);this.posX=AscFormat.readDouble(Reader);this.posY=AscFormat.readDouble(Reader);this.cx=AscFormat.readDouble(Reader);this.cy=AscFormat.readDouble(Reader)}; function CGraphicBounds(l,t,r,b){this.l=l;this.t=t;this.r=r;this.b=b;this.checkWH()}CGraphicBounds.prototype.fromOther=function(oBounds){this.l=oBounds.l;this.t=oBounds.t;this.r=oBounds.r;this.b=oBounds.b;this.checkWH()};CGraphicBounds.prototype.copy=function(){return new CGraphicBounds(this.l,this.t,this.r,this.b)};CGraphicBounds.prototype.transform=function(oTransform){var xlt=oTransform.TransformPointX(this.l,this.t);var ylt=oTransform.TransformPointY(this.l,this.t);var xrt=oTransform.TransformPointX(this.r, this.t);var yrt=oTransform.TransformPointY(this.r,this.t);var xlb=oTransform.TransformPointX(this.l,this.b);var ylb=oTransform.TransformPointY(this.l,this.b);var xrb=oTransform.TransformPointX(this.r,this.b);var yrb=oTransform.TransformPointY(this.r,this.b);this.l=Math.min(xlb,xlt,xrb,xrt);this.t=Math.min(ylb,ylt,yrb,yrt);this.r=Math.max(xlb,xlt,xrb,xrt);this.b=Math.max(ylb,ylt,yrb,yrt);this.checkWH()};CGraphicBounds.prototype.checkByOther=function(oBounds){if(oBounds){if(oBounds.lthis.r)this.r=oBounds.r;if(oBounds.b>this.b)this.b=oBounds.b;this.checkWH()}};CGraphicBounds.prototype.checkWH=function(){this.x=this.l;this.y=this.t;this.w=this.r-this.l;this.h=this.b-this.t};CGraphicBounds.prototype.reset=function(l,t,r,b){this.l=l;this.t=t;this.r=r;this.b=b;this.checkWH()};CGraphicBounds.prototype.isIntersect=function(l,t,r,b){if(l>this.r)return false;if(rthis.b)return false;if(bAscFormat.MOVE_DELTA&&xfrm.setOffX(new_off_x);Math.abs(new_off_y-xfrm.offY)>AscFormat.MOVE_DELTA&&xfrm.setOffY(new_off_y);Math.abs(new_ext_x-xfrm.extX)>AscFormat.MOVE_DELTA&&xfrm.setExtX(new_ext_x);Math.abs(new_ext_y-xfrm.extY)>AscFormat.MOVE_DELTA&&xfrm.setExtY(new_ext_y)};CGraphicObjectBase.prototype.checkHitToBounds=function(x,y){if(this.parent&&(this.parent.Get_ParentTextTransform&&this.parent.Get_ParentTextTransform()))return true;var _x,_y;if(AscFormat.isRealNumber(this.posX)&&AscFormat.isRealNumber(this.posY)){_x= x-this.posX-this.bounds.x;_y=y-this.posY-this.bounds.y}else{_x=x-this.bounds.x;_y=y-this.bounds.y}var delta=3+(this.pen&&AscFormat.isRealNumber(this.pen.w)?this.pen.w/36E3:0);if(_x>=-delta&&_x<=this.bounds.w+delta&&_y>=-delta&&_y<=this.bounds.h+delta){var oClipRect;if(this.getClipRect)oClipRect=this.getClipRect();if(oClipRect)if(xoClipRect.x+oClipRect.w||yoClipRect.y+oClipRect.h)return false;return true}return false};CGraphicObjectBase.prototype.calculateSnapArrays= function(snapArrayX,snapArrayY,transform){var t=transform?transform:this.transform;snapArrayX.push(t.TransformPointX(0,0));snapArrayY.push(t.TransformPointY(0,0));snapArrayX.push(t.TransformPointX(this.extX,0));snapArrayY.push(t.TransformPointY(this.extX,0));snapArrayX.push(t.TransformPointX(this.extX*.5,this.extY*.5));snapArrayY.push(t.TransformPointY(this.extX*.5,this.extY*.5));snapArrayX.push(t.TransformPointX(this.extX,this.extY));snapArrayY.push(t.TransformPointY(this.extX,this.extY));snapArrayX.push(t.TransformPointX(0, this.extY));snapArrayY.push(t.TransformPointY(0,this.extY))};CGraphicObjectBase.prototype.recalculateSnapArrays=function(){this.snapArrayX.length=0;this.snapArrayY.length=0;this.calculateSnapArrays(this.snapArrayX,this.snapArrayY,null)};CGraphicObjectBase.prototype.setLocks=function(nLocks){AscCommon.History.Add(new AscDFH.CChangesDrawingsLong(this,AscDFH.historyitem_AutoShapes_SetLocks,this.locks,nLocks));this.locks=nLocks};CGraphicObjectBase.prototype.readMacro=function(oStream){var nLength=oStream.GetULong(); var nType=oStream.GetUChar();this.setMacro(oStream.GetString2())};CGraphicObjectBase.prototype.writeMacro=function(oWriter){if(typeof this.macro==="string"&&this.macro.length>0){oWriter.StartRecord(161);oWriter._WriteString1(0,this.macro);oWriter.EndRecord()}};CGraphicObjectBase.prototype.setMacro=function(sMacroName){History.Add(new AscDFH.CChangesDrawingsString(this,AscDFH.historyitem_ShapeSetMacro,this.macro,sMacroName));this.macro=sMacroName};CGraphicObjectBase.prototype.assignMacro=function(sGuid){if(typeof sGuid=== "string"&&sGuid.length>0)this.setMacro(AscFormat.MACRO_PREFIX+sGuid);else this.setMacro(null)};CGraphicObjectBase.prototype.setTextLink=function(sLink){History.Add(new AscDFH.CChangesDrawingsString(this,AscDFH.historyitem_ShapeSetTextLink,this.textLink,sLink));this.textLink=sLink};CGraphicObjectBase.prototype.hasMacro=function(){if(typeof this.macro==="string"&&this.macro.length>0)return true;return false};CGraphicObjectBase.prototype.hasJSAMacro=function(){if(typeof this.macro==="string"&&this.macro.indexOf(AscFormat.MACRO_PREFIX)=== 0)return true;return false};CGraphicObjectBase.prototype.getJSAMacroId=function(){if(typeof this.macro==="string"&&this.macro.indexOf(AscFormat.MACRO_PREFIX)===0)return this.macro.slice(AscFormat.MACRO_PREFIX.length);return null};CGraphicObjectBase.prototype.getLockValue=function(nMask){return!!(this.locks&nMask&&this.locks&nMask<<1)};CGraphicObjectBase.prototype.setLockValue=function(nMask,bValue){if(!AscFormat.isRealBool(bValue))this.setLocks(~nMask&this.locks);else this.setLocks(this.locks|nMask| (bValue?nMask<<1:0))};CGraphicObjectBase.prototype.getNoGrp=function(){return this.getLockValue(LOCKS_MASKS.noGrp)};CGraphicObjectBase.prototype.getNoUngrp=function(){return this.getLockValue(LOCKS_MASKS.noUngrp)};CGraphicObjectBase.prototype.getNoSelect=function(){return this.getLockValue(LOCKS_MASKS.noSelect)};CGraphicObjectBase.prototype.getNoRot=function(){return this.getLockValue(LOCKS_MASKS.noRot)};CGraphicObjectBase.prototype.getNoChangeAspect=function(){return this.getLockValue(LOCKS_MASKS.noChangeAspect)}; CGraphicObjectBase.prototype.getNoMove=function(){return this.getLockValue(LOCKS_MASKS.noMove)};CGraphicObjectBase.prototype.getNoResize=function(){return this.getLockValue(LOCKS_MASKS.noResize)};CGraphicObjectBase.prototype.getNoEditPoints=function(){return this.getLockValue(LOCKS_MASKS.noEditPoints)};CGraphicObjectBase.prototype.getNoAdjustHandles=function(){return this.getLockValue(LOCKS_MASKS.noAdjustHandles)};CGraphicObjectBase.prototype.getNoChangeArrowheads=function(){return this.getLockValue(LOCKS_MASKS.noChangeArrowheads)}; CGraphicObjectBase.prototype.getNoChangeShapeType=function(){return this.getLockValue(LOCKS_MASKS.noChangeShapeType)};CGraphicObjectBase.prototype.getNoDrilldown=function(){return this.getLockValue(LOCKS_MASKS.noDrilldown)};CGraphicObjectBase.prototype.getNoTextEdit=function(){return this.getLockValue(LOCKS_MASKS.noTextEdit)};CGraphicObjectBase.prototype.getNoCrop=function(){return this.getLockValue(LOCKS_MASKS.noCrop)};CGraphicObjectBase.prototype.getTxBox=function(){return this.getLockValue(LOCKS_MASKS.txBox)}; CGraphicObjectBase.prototype.setTxBox=function(bValue){return this.setLockValue(LOCKS_MASKS.txBox,bValue)};CGraphicObjectBase.prototype.setNoChangeAspect=function(bValue){return this.setLockValue(LOCKS_MASKS.noChangeAspect,bValue)};CGraphicObjectBase.prototype.canRotate=function(){return this.getNoRot()===false};CGraphicObjectBase.prototype.canResize=function(){return this.getNoResize()===false};CGraphicObjectBase.prototype.canMove=function(){var oApi=Asc.editor||editor;var isDrawHandles=oApi?oApi.isShowShapeAdjustments(): true;if(isDrawHandles===false)return false;return this.getNoMove()===false};CGraphicObjectBase.prototype.canGroup=function(){return this.getNoGrp()===false};CGraphicObjectBase.prototype.canUnGroup=function(){return this.getNoUngrp()===false};CGraphicObjectBase.prototype.canChangeAdjustments=function(){return this.getNoAdjustHandles()===false};CGraphicObjectBase.prototype.Reassign_ImageUrls=function(mapUrl){var blip_fill;if(this.blipFill)if(mapUrl[this.blipFill.RasterImageId])if(this.setBlipFill){blip_fill= this.blipFill.createDuplicate();blip_fill.setRasterImageId(mapUrl[this.blipFill.RasterImageId]);this.setBlipFill(blip_fill)}if(this.spPr&&this.spPr.Fill&&this.spPr.Fill.fill&&this.spPr.Fill.fill.RasterImageId)if(mapUrl[this.spPr.Fill.fill.RasterImageId]){blip_fill=this.spPr.Fill.fill.createDuplicate();blip_fill.setRasterImageId(mapUrl[this.spPr.Fill.fill.RasterImageId]);var oUniFill=this.spPr.Fill.createDuplicate();oUniFill.setFill(blip_fill);this.spPr.setFill(oUniFill)}if(Array.isArray(this.spTree))for(var i= 0;i=0&&_normalized_rot=7*Math.PI*.25&&_normalized_rot<2*Math.PI){_ret.dir=AscFormat.CARD_DIRECTION_E; if(flipH)_ret.dir=AscFormat.CARD_DIRECTION_W}else if(_normalized_rot>=Math.PI*.25&&_normalized_rot<3*Math.PI*.25){_ret.dir=AscFormat.CARD_DIRECTION_S;if(flipV)_ret.dir=AscFormat.CARD_DIRECTION_N}else if(_normalized_rot>=3*Math.PI*.25&&_normalized_rot<5*Math.PI*.25){_ret.dir=AscFormat.CARD_DIRECTION_W;if(flipH)_ret.dir=AscFormat.CARD_DIRECTION_E}else if(_normalized_rot>=5*Math.PI*.25&&_normalized_rot<7*Math.PI*.25){_ret.dir=AscFormat.CARD_DIRECTION_N;if(flipV)_ret.dir=AscFormat.CARD_DIRECTION_S}_ret.x= oTransform.TransformPointX(oConnectorInfo.x,oConnectorInfo.y);_ret.y=oTransform.TransformPointY(oConnectorInfo.x,oConnectorInfo.y);_ret.bounds.fromOther(oBounds);_ret.idx=oConnectorInfo.idx;return _ret};CGraphicObjectBase.prototype.getGeom=function(){var _geom;if(this.rectGeometry)_geom=this.rectGeometry;else if(this.calcGeometry)_geom=this.calcGeometry;else if(this.spPr&&this.spPr.geometry)_geom=this.spPr.geometry;else _geom=AscFormat.ExecuteNoHistory(function(){var _ret=AscFormat.CreateGeometry("rect"); _ret.Recalculate(this.extX,this.extY);return _ret},this,[]);return _geom};CGraphicObjectBase.prototype.findGeomConnector=function(x,y){var _geom=this.getGeom();var oInvertTransform=this.invertTransform;var _x=oInvertTransform.TransformPointX(x,y);var _y=oInvertTransform.TransformPointY(x,y);return _geom.findConnector(_x,_y,this.convertPixToMM(AscCommon.global_mouseEvent.KoefPixToMM*AscCommon.TRACK_CIRCLE_RADIUS))};CGraphicObjectBase.prototype.findConnector=function(x,y){var oConnGeom=this.findGeomConnector(x, y);if(oConnGeom){var _rot=this.rot;var _flipH=this.flipH;var _flipV=this.flipV;if(this.group){_rot=AscFormat.normalizeRotate(this.group.getFullRotate()+_rot);if(this.group.getFullFlipH())_flipH=!_flipH;if(this.group.getFullFlipV())_flipV=!_flipV}return this.convertToConnectionParams(_rot,_flipH,_flipV,this.transform,this.bounds,oConnGeom)}return null};CGraphicObjectBase.prototype.findConnectionShape=function(x,y){if(this.hit(x,y))return this;return null};CGraphicObjectBase.prototype.getAllDocContents= function(aDrawings){};CGraphicObjectBase.prototype.getFullRotate=function(){return!AscCommon.isRealObject(this.group)?this.rot:this.rot+this.group.getFullRotate()};CGraphicObjectBase.prototype.getAspect=function(num){var _tmp_x=this.extX!==0?this.extX:.1;var _tmp_y=this.extY!==0?this.extY:.1;return num===0||num===4?_tmp_x/_tmp_y:_tmp_y/_tmp_x};CGraphicObjectBase.prototype.getFullFlipH=function(){if(!AscCommon.isRealObject(this.group))return this.flipH;return this.group.getFullFlipH()?!this.flipH: this.flipH};CGraphicObjectBase.prototype.getFullFlipV=function(){if(!AscCommon.isRealObject(this.group))return this.flipV;return this.group.getFullFlipV()?!this.flipV:this.flipV};CGraphicObjectBase.prototype.getMainGroup=function(){if(!AscCommon.isRealObject(this.group)){if(this.getObjectType()===AscDFH.historyitem_type_GroupShape||this.getObjectType()===AscDFH.historyitem_type_LockedCanvas)return this;return null}return this.group.getMainGroup()};CGraphicObjectBase.prototype.drawConnectors=function(overlay){var _geom= this.getGeom();_geom.drawConnectors(overlay,this.transform)};CGraphicObjectBase.prototype.getConnectionParams=function(cnxIdx,_group){AscFormat.ExecuteNoHistory(function(){if(this.recalculateSizes)this.recalculateSizes();else if(this.recalculateTransform)this.recalculateTransform()},this,[]);if(cnxIdx!==null){var oConnectionObject=this.getGeom().cnxLst[cnxIdx];if(oConnectionObject){var g_conn_info={idx:cnxIdx,ang:oConnectionObject.ang,x:oConnectionObject.x,y:oConnectionObject.y};var _rot=AscFormat.normalizeRotate(this.getFullRotate()); var _flipH=this.getFullFlipH();var _flipV=this.getFullFlipV();var _bounds=this.bounds;var _transform=this.transform;if(_group){_rot=AscFormat.normalizeRotate((this.group?this.group.getFullRotate():0)+_rot-_group.getFullRotate());if(_group.getFullFlipH())_flipH=!_flipH;if(_group.getFullFlipV())_flipV=!_flipV;_bounds=_bounds.copy();_bounds.transform(_group.invertTransform);_transform=_transform.CreateDublicate();AscCommon.global_MatrixTransformer.MultiplyAppend(_transform,_group.invertTransform)}return this.convertToConnectionParams(_rot, _flipH,_flipV,_transform,_bounds,g_conn_info)}}return null};CGraphicObjectBase.prototype.getCardDirectionByNum=function(num){var num_north=this.getNumByCardDirection(AscFormat.CARD_DIRECTION_N);var full_flip_h=this.getFullFlipH();var full_flip_v=this.getFullFlipV();var same_flip=!full_flip_h&&!full_flip_v||full_flip_h&&full_flip_v;if(same_flip)return(num-num_north+AscFormat.CARD_DIRECTION_N+8)%8;return(AscFormat.CARD_DIRECTION_N-(num-num_north)+8)%8};CGraphicObjectBase.prototype.getTransformMatrix= function(){return this.transform};CGraphicObjectBase.prototype.getNumByCardDirection=function(cardDirection){var hc=this.extX*.5;var vc=this.extY*.5;var transform=this.getTransformMatrix();var y1,y3,y5,y7;y1=transform.TransformPointY(hc,0);y3=transform.TransformPointY(this.extX,vc);y5=transform.TransformPointY(hc,this.extY);y7=transform.TransformPointY(0,vc);var north_number;var full_flip_h=this.getFullFlipH();var full_flip_v=this.getFullFlipV();switch(Math.min(y1,y3,y5,y7)){case y1:{north_number= 1;break}case y3:{north_number=3;break}case y5:{north_number=5;break}default:{north_number=7;break}}var same_flip=!full_flip_h&&!full_flip_v||full_flip_h&&full_flip_v;if(same_flip)return(north_number+cardDirection)%8;return(north_number-cardDirection+8)%8};CGraphicObjectBase.prototype.getInvertTransform=function(){return this.invertTransform};CGraphicObjectBase.prototype.getResizeCoefficients=function(numHandle,x,y){var cx,cy;cx=this.extX>0?this.extX:.01;cy=this.extY>0?this.extY:.01;var invert_transform= this.getInvertTransform();if(!invert_transform)return{kd1:1,kd2:1};var t_x=invert_transform.TransformPointX(x,y);var t_y=invert_transform.TransformPointY(x,y);switch(numHandle){case 0:return{kd1:(cx-t_x)/cx,kd2:(cy-t_y)/cy};case 1:return{kd1:(cy-t_y)/cy,kd2:0};case 2:return{kd1:(cy-t_y)/cy,kd2:t_x/cx};case 3:return{kd1:t_x/cx,kd2:0};case 4:return{kd1:t_x/cx,kd2:t_y/cy};case 5:return{kd1:t_y/cy,kd2:0};case 6:return{kd1:t_y/cy,kd2:(cx-t_x)/cx};case 7:return{kd1:(cx-t_x)/cx,kd2:0}}return{kd1:1,kd2:1}}; CGraphicObjectBase.prototype.GetAllContentControls=function(arrContentControls){};CGraphicObjectBase.prototype.CheckContentControlEditingLock=function(){if(this.group){this.group.CheckContentControlEditingLock();return}if(this.parent&&this.parent.CheckContentControlEditingLock)this.parent.CheckContentControlEditingLock()};CGraphicObjectBase.prototype.hit=function(x,y){return false};CGraphicObjectBase.prototype.hitToAdjustment=function(){return{hit:false}};CGraphicObjectBase.prototype.hitToHandles= function(x,y){if(this.parent&&this.parent.kind===AscFormat.TYPE_KIND.NOTES)return-1;return AscFormat.hitToHandles(x,y,this)};CGraphicObjectBase.prototype.onMouseMove=function(e,x,y){return this.hit(x,y)};CGraphicObjectBase.prototype.drawLocks=function(transform,graphics){var bNotes=!!(this.parent&&this.parent.kind===AscFormat.TYPE_KIND.NOTES);if(!this.group&&!bNotes){var oLock;if(this.parent instanceof AscCommonWord.ParaDrawing)oLock=this.parent.Lock;else if(this.Lock)oLock=this.Lock;if(oLock&&AscCommon.locktype_None!== oLock.Get_Type()){var bCoMarksDraw=true;var oApi=editor||Asc["editor"];if(oApi)switch(oApi.getEditorId()){case AscCommon.c_oEditorId.Word:{bCoMarksDraw=true===oApi.isCoMarksDraw||AscCommon.locktype_Mine!==oLock.Get_Type();break}case AscCommon.c_oEditorId.Presentation:{bCoMarksDraw=!AscCommon.CollaborativeEditing.Is_Fast()||AscCommon.locktype_Mine!==oLock.Get_Type();break}case AscCommon.c_oEditorId.Spreadsheet:{bCoMarksDraw=!oApi.collaborativeEditing.getFast()||AscCommon.locktype_Mine!==oLock.Get_Type(); break}}if(bCoMarksDraw&&graphics.DrawLockObjectRect){graphics.transform3(transform);graphics.DrawLockObjectRect(oLock.Get_Type(),0,0,this.extX,this.extY);return true}}}return false};CGraphicObjectBase.prototype.getSignatureLineGuid=function(){return null};CGraphicObjectBase.prototype.getMacrosName=function(){var sGuid=this.getJSAMacroId();if(sGuid){var oApi=Asc.editor||editor;if(oApi)return oApi.asc_getMacrosByGuid(sGuid)}return this.macro};CGraphicObjectBase.prototype.getCopyWithSourceFormatting= function(oIdMap){return this.copy(oIdMap)};CGraphicObjectBase.prototype.checkNeedRecalculate=function(){return false};CGraphicObjectBase.prototype.handleAllContents=function(fCallback){};CGraphicObjectBase.prototype.canChangeArrows=function(){if(!this.spPr||this.spPr.geometry==null)return false;var _path_list=this.spPr.geometry.pathLst;var _path_index;var _path_command_index;var _path_command_arr;for(_path_index=0;_path_index<_path_list.length;++_path_index){_path_command_arr=_path_list[_path_index].ArrPathCommandInfo; for(_path_command_index=0;_path_command_index<_path_command_arr.length;++_path_command_index)if(_path_command_arr[_path_command_index].id==5)break;if(_path_command_index==_path_command_arr.length)return true}return false};CGraphicObjectBase.prototype.getStroke=function(){if(this.pen&&this.pen.Fill){if(this.getObjectType()===AscDFH.historyitem_type_ImageShape&&AscFormat.isRealNumber(this.pen.w)){var _ret=this.pen.createDuplicate();_ret.w/=2;return _ret}return this.pen}var ret=AscFormat.CreateNoFillLine(); ret.w=0;return ret};CGraphicObjectBase.prototype.getPresetGeom=function(){if(this.spPr&&this.spPr.geometry)return this.spPr.geometry.preset;else{if(this.calcGeometry)return this.calcGeometry.preset;return null}};CGraphicObjectBase.prototype.getFill=function(){if(this.brush&&this.brush.fill)return this.brush;return AscFormat.CreateNoFillUniFill()};CGraphicObjectBase.prototype.getClipRect=function(){if(this.parent&&this.parent.GetClipRect)return this.parent.GetClipRect();return null};CGraphicObjectBase.prototype.getBlipFill= function(){if(this.getObjectType()===AscDFH.historyitem_type_ImageShape||this.getObjectType()===AscDFH.historyitem_type_Shape){if(this.blipFill)return this.blipFill;if(this.brush&&this.brush.fill&&this.brush.fill.type===window["Asc"].c_oAscFill.FILL_TYPE_BLIP)return this.brush.fill}return null};CGraphicObjectBase.prototype.checkSrcRect=function(){if(this.getObjectType()===AscDFH.historyitem_type_ImageShape){if(this.blipFill.tile||!this.blipFill.srcRect||this.blipFill.stretch){var blipFill=this.blipFill.createDuplicate(); if(blipFill.tile)blipFill.tile=null;if(!blipFill.srcRect){blipFill.srcRect=new AscFormat.CSrcRect;blipFill.srcRect.l=0;blipFill.srcRect.t=0;blipFill.srcRect.r=100;blipFill.srcRect.b=100}if(blipFill.stretch)blipFill.stretch=null;this.setBlipFill(blipFill)}}else if(this.brush.fill.tile||!this.brush.fill.srcRect||this.brush.fill.stretch){var brush=this.brush.createDuplicate();if(brush.fill.tile)brush.fill.tile=null;if(!brush.fill.srcRect){brush.fill.srcRect=new AscFormat.CSrcRect;brush.fill.srcRect.l= 0;brush.fill.srcRect.t=0;brush.fill.srcRect.r=100;brush.fill.srcRect.b=100}if(brush.fill.stretch)brush.fill.stretch=null;this.brush=brush;this.spPr.setFill(brush)}};CGraphicObjectBase.prototype.getCropObject=function(){if(!this.cropObject)this.createCropObject();return this.cropObject};CGraphicObjectBase.prototype.createCropObject=function(){return AscFormat.ExecuteNoHistory(function(){var oBlipFill=this.getBlipFill();if(!oBlipFill)return;var srcRect=oBlipFill.srcRect;if(srcRect){var sRasterImageId= oBlipFill.RasterImageId;var _l=srcRect.l?srcRect.l:0;var _t=srcRect.t?srcRect.t:0;var _r=srcRect.r?srcRect.r:100;var _b=srcRect.b?srcRect.b:100;var oShapeDrawer=new AscCommon.CShapeDrawer;oShapeDrawer.bIsCheckBounds=true;oShapeDrawer.Graphics=new AscFormat.CSlideBoundsChecker;this.check_bounds(oShapeDrawer);var boundsW=oShapeDrawer.max_x-oShapeDrawer.min_x;var boundsH=oShapeDrawer.max_y-oShapeDrawer.min_y;var wpct=(_r-_l)/100;var hpct=(_b-_t)/100;var extX=boundsW/wpct;var extY=boundsH/hpct;var DX= -extX*_l/100+oShapeDrawer.min_x;var DY=-extY*_t/100+oShapeDrawer.min_y;var XC=DX+extX/2;var YC=DY+extY/2;var oTransform=this.transform.CreateDublicate();var XC_=oTransform.TransformPointX(XC,YC);var YC_=oTransform.TransformPointY(XC,YC);var X=XC_-extX/2;var Y=YC_-extY/2;var oImage=AscFormat.DrawingObjectsController.prototype.createImage(sRasterImageId,X,Y,extX,extY);oImage.isCrop=true;oImage.parentCrop=this;oImage.worksheet=this.worksheet;oImage.drawingBase=this.drawingBase;oImage.spPr.xfrm.setRot(this.rot); oImage.spPr.xfrm.setFlipH(this.flipH);oImage.spPr.xfrm.setFlipV(this.flipV);oImage.setParent(this.parent);oImage.recalculate();oImage.setParent(null);oImage.recalculateTransform();oImage.recalculateGeometry();oImage.invertTransform=AscCommon.global_MatrixTransformer.Invert(oImage.transform);oImage.recalculateBounds();oImage.setParent(this.parent);oImage.selectStartPage=this.selectStartPage;oImage.cropBrush=AscFormat.CreateUnfilFromRGB(128,128,128);oImage.cropBrush.transparent=100;oImage.pen=AscFormat.CreatePenBrushForChartTrack().pen; oImage.parent=this.parent;var oParentObjects=this.getParentObjects();oImage.cropBrush.calculate(oParentObjects.theme,oParentObjects.slide,oParentObjects.layout,oParentObjects.master,{R:0,G:0,B:0,A:255,needRecalc:true},AscFormat.G_O_DEFAULT_COLOR_MAP);this.cropObject=oImage;return true}return false},this,[])};CGraphicObjectBase.prototype.clearCropObject=function(){this.cropObject=null};CGraphicObjectBase.prototype.drawCropTrack=function(graphics,srcRect,transform,cropObjectTransform){};CGraphicObjectBase.prototype.calculateSrcRect= function(){var oldTransform=this.transform.CreateDublicate();var oldExtX=this.extX;var oldExtY=this.extY;AscFormat.ExecuteNoHistory(function(){var oldVal=this.recalcInfo.recalculateTransform;this.recalcInfo.recalculateTransform=false;this.recalculateGeometry();this.recalcInfo.recalculateTransform=oldVal},this,[]);this.transform=oldTransform;this.extX=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=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){var oApi=Asc.editor||editor;var isDrawHandles=oApi?oApi.isShowShapeAdjustments():true;if(isDrawHandles&&object&&object.isForm&&object.isForm()&&object.getInnerForm()&&object.getInnerForm().IsFormLocked())isDrawHandles=false;if(isDrawHandles===false)return-1;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_distAsc.c_nMaxHyperlinkLength)return hyperlink_ret.Content;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.SetAll("Cambria Math",-1)}return NewRPr}function CheckWordParagraphContent(aContent,oTextPr){var NewRPr,MergePr;for(var i=0;ioMax.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-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_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= (content_height2-_content_height)*.5;break}case 2:{_vertical_shift=(content_height2-_content_height)*.5;break}case 3:{_vertical_shift=(content_height2-_content_height)*.5;break}case 4:{_vertical_shift=0;break}}else _vertical_shift=0;var _text_rect_xc=_l+(_r-_l)*.5;var _text_rect_yc=_t+(_b-_t)*.5;var _vx=_text_rect_xc-_hc;var _vy=_text_rect_yc-_vc;var _transformed_text_xc,_transformed_text_yc;if(!_full_flip.flipH)_transformed_text_xc=_transformed_shape_xc+_vx;else _transformed_text_xc=_transformed_shape_xc- _vx;if(!_full_flip.flipV)_transformed_text_yc=_transformed_shape_yc+_vy;else _transformed_text_yc=_transformed_shape_yc-_vy;global_MatrixTransformer.TranslateAppend(_text_transform,0,_vertical_shift);if(_body_pr.vert===AscFormat.nVertTTvert||_body_pr.vert===AscFormat.nVertTTeaVert){global_MatrixTransformer.TranslateAppend(_text_transform,-_content_width*.5,-content_height2*.5);global_MatrixTransformer.RotateRadAppend(_text_transform,-Math.PI*.5);global_MatrixTransformer.TranslateAppend(_text_transform, _content_width*.5,content_height2*.5)}if(_body_pr.vert===AscFormat.nVertTTvert270){global_MatrixTransformer.TranslateAppend(_text_transform,-_content_width*.5,-content_height2*.5);global_MatrixTransformer.RotateRadAppend(_text_transform,-Math.PI*1.5);global_MatrixTransformer.TranslateAppend(_text_transform,_content_width*.5,content_height2*.5)}global_MatrixTransformer.TranslateAppend(_text_transform,_transformed_text_xc-_content_width*.5,_transformed_text_yc-content_height2*.5);var body_pr=this.bodyPr; var l_ins=typeof body_pr.lIns==="number"?body_pr.lIns:2.54;var t_ins=typeof body_pr.tIns==="number"?body_pr.tIns:1.27;var r_ins=typeof body_pr.rIns==="number"?body_pr.rIns:2.54;var b_ins=typeof body_pr.bIns==="number"?body_pr.bIns:1.27;this.clipRect={x:-1,y:-_vertical_shift-t_ins,w:Math.max(this.extX,this.extY)+2,h:this.contentHeight+(b_ins+t_ins)}}this.invertTransformText2=global_MatrixTransformer.Invert(this.transformText2)};CShape.prototype.getTextRect=function(){return this.spPr&&this.spPr.geometry&& this.spPr.geometry.rect?this.spPr.geometry.rect:{l:0,t:0,r:this.extX,b:this.extY}};CShape.prototype.getFormRelRect=function(){var oSpTransform=this.transform;var oInvTextTransform=this.invertTransformText;var aX=[0,this.extX];var aY=[0,this.extY];var fX0,fY0;if(!oSpTransform||!oInvTextTransform)return{X:0,Y:0,W:this.extX,H:this.extY,Page:this.parent.PageNum};var aRelX=[],aRelY=[];for(var nX=0;nX=_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}var XC=oContent.XLimit/2;var YC=_content_height/2;var _rot_angle=AscFormat.normalizeRotate((AscFormat.isRealNumber(oBodyPr.rot)?oBodyPr.rot:0)*AscFormat.cToRad);if(!AscFormat.fApproxEqual(_rot_angle, 0)){global_MatrixTransformer.TranslateAppend(oMatrix,-XC,-YC);global_MatrixTransformer.RotateRadAppend(oMatrix,-_rot_angle);global_MatrixTransformer.TranslateAppend(oMatrix,XC,YC)}_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;var oClipRect;var Diff=1.6;if(!oBodyPr.upright){if(!(oBodyPr.vert===AscFormat.nVertTTvert||oBodyPr.vert===AscFormat.nVertTTvert270||oBodyPr.vert===AscFormat.nVertTTeaVert)){if(bWordArtTransform)_vertical_shift=0;else if(!this.bWordShape&& oBodyPr.vertOverflow===AscFormat.nOTOwerflow||_content_height<_text_rect_height)switch(oBodyPr.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 if(!this.bWordShape&&oBodyPr.vertOverflow===AscFormat.nOTClip&&oContent.Content[0]&&oContent.Content[0].Lines[0]&& oContent.Content[0].Lines[0].Bottom>_text_rect_height){var _content_first_line=oContent.Content[0].Lines[0].Bottom;switch(oBodyPr.anchor){case 0:{_vertical_shift=_text_rect_height-_content_first_line;break}case 1:{_vertical_shift=(_text_rect_height-_content_first_line)*.5;break}case 2:{_vertical_shift=(_text_rect_height-_content_first_line)*.5;break}case 3:{_vertical_shift=(_text_rect_height-_content_first_line)*.5;break}case 4:{_vertical_shift=0;break}}}else if(this.bWordShape)_vertical_shift=0; else if(oBodyPr.anchor===0)_vertical_shift=_text_rect_height-_content_height;else _vertical_shift=0;global_MatrixTransformer.TranslateAppend(oMatrix,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(oMatrix,-alpha);global_MatrixTransformer.TranslateAppend(oMatrix,_t_x_lt,_t_y_lt)}else{alpha=Math.atan2(_dy_t,_dx_t);global_MatrixTransformer.RotateRadAppend(oMatrix,Math.PI-alpha);global_MatrixTransformer.TranslateAppend(oMatrix, _t_x_rt,_t_y_rt)}}else{if(bWordArtTransform)_vertical_shift=0;else if(!this.bWordShape&&oBodyPr.vertOverflow===AscFormat.nOTOwerflow||_content_height<=_text_rect_width)switch(oBodyPr.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 if(this.bWordShape)_vertical_shift= 0;else if(oBodyPr.anchor===0)_vertical_shift=_text_rect_width-_content_height;else _vertical_shift=0;global_MatrixTransformer.TranslateAppend(oMatrix,0,_vertical_shift);var _alpha;_alpha=Math.atan2(_dy_t,_dx_t);if(oBodyPr.vert===AscFormat.nVertTTvert||oBodyPr.vert===AscFormat.nVertTTeaVert)if(_dx_lt_rb*_dy_t-_dy_lt_rb*_dx_t<=0){global_MatrixTransformer.RotateRadAppend(oMatrix,-_alpha-Math.PI*.5);global_MatrixTransformer.TranslateAppend(oMatrix,_t_x_rt,_t_y_rt)}else{global_MatrixTransformer.RotateRadAppend(oMatrix, Math.PI*.5-_alpha);global_MatrixTransformer.TranslateAppend(oMatrix,_t_x_lt,_t_y_lt)}else if(_dx_lt_rb*_dy_t-_dy_lt_rb*_dx_t<=0){global_MatrixTransformer.RotateRadAppend(oMatrix,-_alpha-Math.PI*1.5);global_MatrixTransformer.TranslateAppend(oMatrix,_t_x_lb,_t_y_lb)}else{global_MatrixTransformer.RotateRadAppend(oMatrix,-Math.PI*.5-_alpha);global_MatrixTransformer.TranslateAppend(oMatrix,_t_x_rb,_t_y_rb)}}if(this.spPr&&isRealObject(this.spPr.geometry)&&isRealObject(this.spPr.geometry.rect)){var rect= this.spPr.geometry.rect;var clipW=rect.r-rect.l+Diff;if(clipW<=0)clipW=.01;var clipH=rect.b-rect.t+Diff-b_ins-t_ins;if(clipH<0)clipH=.01;oClipRect={x:rect.l-Diff,y:rect.t-Diff+t_ins,w:clipW,h:clipH}}else oClipRect={x:-1.6,y:t_ins,w:this.extX+3.2,h:this.extY-b_ins}}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.localTransform.TransformPointX(_hc,_vc);var _transformed_shape_yc=this.localTransform.TransformPointY(_hc, _vc);var _content_width,content_height2;if(checkNormalRotate(_full_rotate))if(!(oBodyPr.vert===AscFormat.nVertTTvert||oBodyPr.vert===AscFormat.nVertTTvert270||oBodyPr.vert===AscFormat.nVertTTeaVert)){_content_width=_r-_l;content_height2=_b-_t}else{_content_width=_b-_t;content_height2=_r-_l}else if(!(oBodyPr.vert===AscFormat.nVertTTvert||oBodyPr.vert===AscFormat.nVertTTvert270||oBodyPr.vert===AscFormat.nVertTTeaVert)){_content_width=_b-_t;content_height2=_r-_l}else{_content_width=_r-_l;content_height2= _b-_t}if(bWordArtTransform)_vertical_shift=0;else if(!(this.bWordShape||this.worksheet)||_content_height0){DiffLeft2=oBorders.Left.Space+oBorders.Left.Size;if(DiffLeft2>DiffLeft)DiffLeft=DiffLeft2}if(oBorders.Right&&AscFormat.isRealNumber(oBorders.Right.Space)&&AscFormat.isRealNumber(oBorders.Right.Size)&&oBorders.Right.Size>0){DiffRight2= oBorders.Right.Space+oBorders.Right.Size;if(oCompiledParaPr.Ind&&AscFormat.isRealNumber(oCompiledParaPr.Ind.Right))DiffRight2-=oCompiledParaPr.Ind.Right;if(DiffRight2>DiffRight)DiffRight=DiffRight2}}}}else if(nElementType===AscCommonWord.type_Table){DiffLeft2=-oElement.GetTableOffsetCorrection();if(DiffLeft2>DiffLeft)DiffLeft=DiffLeft2;DiffRight2=oElement.GetRightTableOffsetCorrection();if(DiffRight2>DiffRight)DiffRight=DiffRight2}else if(nElementType===AscCommonWord.type_BlockLevelSdt);}var clipW= oRect.r-oRect.l+DiffLeft+DiffRight;if(clipW<=0)clipW=.01;var clipH=oRect.b-oRect.t+Diff-b_ins-t_ins;if(clipH<0)clipH=.01;oClipRect={x:oRect.l-DiffLeft,y:oRect.t-Diff+t_ins,w:clipW,h:clipH}}else{var clipW=oRect.r-oRect.l+Diff-l_ins-r_ins;if(clipW<=0)clipW=.01;var clipH=oRect.b-oRect.t+Diff-b_ins-t_ins;if(clipH<0)clipH=.01;oClipRect={x:oRect.l+l_ins-Diff,y:oRect.t-Diff+t_ins,w:clipW,h:clipH}}}return oClipRect};CShape.prototype.setWordShape=function(pr){History.Add(new AscDFH.CChangesDrawingsBool(this, AscDFH.historyitem_ShapeSetWordShape,this.bWordShape,pr));this.bWordShape=pr};CShape.prototype.selectionCheck=function(X,Y,PageAbs,NearPos){var content=this.getDocContent();if(content){if(undefined!==NearPos)return content.CheckPosInSelection(X,Y,0,NearPos);if(isRealObject(content)&&this.hitInTextRect(X,Y)&&this.invertTransformText){var t_x=this.invertTransformText.TransformPointX(X,Y);var t_y=this.invertTransformText.TransformPointY(X,Y);return content.CheckPosInSelection(t_x,t_y,0,NearPos)}}return false}; CShape.prototype.fillObject=function(copy,oPr){if(this.nvSpPr)copy.setNvSpPr(this.nvSpPr.createDuplicate());if(this.spPr){copy.setSpPr(this.spPr.createDuplicate());copy.spPr.setParent(copy)}if(this.style)copy.setStyle(this.style.createDuplicate());if(this.txBody){copy.setTxBody(this.txBody.createDuplicate());copy.txBody.setParent(copy)}if(this.bodyPr)copy.setBodyPr(this.bodyPr.createDuplicate());if(this.textBoxContent)copy.setTextBoxContent(this.textBoxContent.Copy(copy,oPr&&oPr.drawingDocument,oPr&& oPr.contentCopyPr));if(this.signatureLine&©.setSignature)copy.setSignature(this.signatureLine.copy());if(this.macro!==null)copy.setMacro(this.macro);if(this.textLink!==null)copy.setTextLink(this.textLink);copy.setWordShape(this.bWordShape);copy.setBDeleted(this.bDeleted);copy.setLocks(this.locks);copy.cachedImage=this.getBase64Img();copy.cachedPixH=this.cachedPixH;copy.cachedPixW=this.cachedPixW};CShape.prototype.copy=function(oPr){var copy=new CShape;this.fillObject(copy,oPr);return copy};CShape.prototype.Get_Styles= function(level){var _level=AscFormat.isRealNumber(level)?level:0;if(this.recalcInfo.recalculateTextStyles[_level]){this.recalculateTextStyles(_level);this.recalcInfo.recalculateTextStyles[_level]=false}this.recalcInfo.recalculateTextStyles[_level]=true;var ret=this.compiledStyles[_level];this.compiledStyles[_level]=undefined;return ret};CShape.prototype.recalculateTextStyles=function(level){return AscFormat.ExecuteNoHistory(function(){var parent_objects=this.getParentObjects();var default_style=new CStyle("defaultStyle", null,null,null,true);default_style.ParaPr.Spacing.LineRule=Asc.linerule_Auto;default_style.ParaPr.Spacing.Line=1;default_style.ParaPr.Spacing.Before=0;default_style.ParaPr.Spacing.After=0;default_style.ParaPr.DefaultTab=25.4;default_style.ParaPr.Align=AscCommon.align_Center;if(parent_objects.theme)default_style.TextPr.RFonts.SetFontStyle(AscFormat.fntStyleInd_minor);if(!this.bCheckAutoFitFlag){var oBodyPr=this.getBodyPr&&this.getBodyPr();if(oBodyPr){default_style.ParaPr.LnSpcReduction=oBodyPr.getLnSpcReduction(); default_style.TextPr.FontScale=oBodyPr.getFontScale()}}else{if(this.tmpLnSpcReduction!==null&&this.tmpLnSpcReduction!==undefined)default_style.ParaPr.LnSpcReduction=this.tmpLnSpcReduction/1E5;if(this.tmpFontScale!==null&&this.tmpFontScale!==undefined)default_style.TextPr.FontScale=this.tmpFontScale/1E5}if(this.getObjectType&&this.getObjectType()===AscDFH.historyitem_type_GraphicFrame)default_style.TextPr.FontSize=18;if(isRealObject(parent_objects.presentation)&&isRealObject(parent_objects.presentation.defaultTextStyle)){if(isRealObject(parent_objects.presentation.defaultTextStyle.levels[9])){var default_ppt_style= parent_objects.presentation.defaultTextStyle.levels[9];default_style.ParaPr.Merge(default_ppt_style.Copy());default_ppt_style.DefaultRunPr&&default_style.TextPr.Merge(default_ppt_style.DefaultRunPr.Copy())}if(!isRealObject(parent_objects.master)||!isRealObject(parent_objects.master.txStyles)||!this.isPlaceholder())if(isRealObject(parent_objects.presentation.defaultTextStyle.levels[level])){var default_ppt_style=parent_objects.presentation.defaultTextStyle.levels[level];default_style.ParaPr.Merge(default_ppt_style.Copy()); default_ppt_style.DefaultRunPr&&default_style.TextPr.Merge(default_ppt_style.DefaultRunPr.Copy())}}var master_style;if(isRealObject(parent_objects.master)&&isRealObject(parent_objects.master.txStyles)){var master_ppt_styles;master_style=new CStyle("masterStyle",null,null,null,true);if(parent_objects.master.kind===AscFormat.TYPE_KIND.NOTES_MASTER)master_ppt_styles=parent_objects.master.txStyles;else if(this.isPlaceholder()&&!(this instanceof AscFormat.CGraphicFrame))master_ppt_styles=parent_objects.master.txStyles.getStyleByPhType(this.getPlaceholderType()); else master_ppt_styles=parent_objects.master.txStyles.otherStyle;if(isRealObject(master_ppt_styles)&&isRealObject(master_ppt_styles.levels)&&isRealObject(master_ppt_styles.levels[level])){var master_ppt_style=master_ppt_styles.levels[level];master_style.ParaPr=master_ppt_style.Copy();if(master_ppt_style.DefaultRunPr)master_style.TextPr=master_ppt_style.DefaultRunPr.Copy()}}var hierarchy=this.getHierarchy(false);var hierarchy_styles=[];for(var i=0;i-1;--i)if(hierarchy_styles[i]){Styles.Add(hierarchy_styles[i]);hierarchy_styles[i].BasedOn=last_style_id;last_style_id=hierarchy_styles[i].Id}if(shape_text_style){Styles.Add(shape_text_style);shape_text_style.BasedOn=last_style_id;last_style_id=shape_text_style.Id}this.compiledStyles[level]={styles:Styles,lastId:last_style_id,shape:this,slide:parent_objects.slide,layout:parent_objects.layout,master:parent_objects.master,presentation:parent_objects.presentation,notes:parent_objects.notes}; return this.compiledStyles[level]},this,[])};CShape.prototype.recalculateBrush=function(){var compiled_style=this.getCompiledStyle();var RGBA={R:0,G:0,B:0,A:255};var parents=this.getParentObjects();var oStyleBrush=null;var oLin;if(isRealObject(parents.theme)&&isRealObject(compiled_style)&&isRealObject(compiled_style.fillRef)){this.brush=parents.theme.getFillStyle(compiled_style.fillRef.idx,compiled_style.fillRef.Color);if(this.brush)oStyleBrush=this.brush.createDuplicate()}else this.brush=new AscFormat.CUniFill; this.brush.merge(this.getCompiledFill());this.brush.transparent=this.getCompiledTransparent();this.brush.calculate(parents.theme,parents.slide,parents.layout,parents.master,RGBA);if(this.brush.fill&&this.brush.fill.type===Asc.c_oAscFill.FILL_TYPE_GRAD){var oGradFill=this.brush.fill;if(!oGradFill.lin&&!oGradFill.path){if(oStyleBrush&&oStyleBrush.fill&&oStyleBrush.fill.type===Asc.c_oAscFill.FILL_TYPE_GRAD&&oStyleBrush.fill.lin)oLin=oStyleBrush.fill.lin.createDuplicate();else{oLin=new AscFormat.GradLin; oLin.setScale(false);oLin.setAngle(0);oGradFill.setLin(oLin)}oGradFill.setLin(oLin)}}};CShape.prototype.recalculatePen=function(){var compiled_style=this.getCompiledStyle();var RGBA={R:0,G:0,B:0,A:255};var parents=this.getParentObjects();if(isRealObject(parents.theme)&&isRealObject(compiled_style)&&isRealObject(compiled_style.lnRef))this.pen=parents.theme.getLnStyle(compiled_style.lnRef.idx,compiled_style.lnRef.Color);else this.pen=null;var oCompiledLine=this.getCompiledLine();if(oCompiledLine){if(!this.pen)this.pen= new AscFormat.CLn;this.pen.merge(oCompiledLine)}if(this.pen)this.pen.calculate(parents.theme,parents.slide,parents.layout,parents.master,RGBA)};CShape.prototype.Get_ParentTextTransform=function(){return this.transformText.CreateDublicate()};CShape.prototype.isEmptyPlaceholder=function(){if(this.isPlaceholder()){if(this.nvSpPr.nvPr.ph.type==AscFormat.phType_title||this.nvSpPr.nvPr.ph.type==AscFormat.phType_ctrTitle||this.nvSpPr.nvPr.ph.type==AscFormat.phType_body||this.nvSpPr.nvPr.ph.type==AscFormat.phType_subTitle|| this.nvSpPr.nvPr.ph.type==null||this.nvSpPr.nvPr.ph.type==AscFormat.phType_dt||this.nvSpPr.nvPr.ph.type==AscFormat.phType_ftr||this.nvSpPr.nvPr.ph.type==AscFormat.phType_hdr||this.nvSpPr.nvPr.ph.type==AscFormat.phType_sldNum||this.nvSpPr.nvPr.ph.type==AscFormat.phType_sldImg){if(this.txBody){if(this.txBody.content)return this.txBody.content.Is_Empty();return true}return true}if(this.nvSpPr.nvPr.ph.type==AscFormat.phType_chart||this.nvSpPr.nvPr.ph.type==AscFormat.phType_media)return true;if(this.nvSpPr.nvPr.ph.type== AscFormat.phType_pic){var _b_empty_text=true;if(this.txBody)if(this.txBody.content)_b_empty_text=this.txBody.content.Is_Empty();return _b_empty_text}}else return false};CShape.prototype.changeSize=function(kw,kh){if(this.spPr&&this.spPr.xfrm&&this.spPr.xfrm.isNotNull()){var xfrm=this.spPr.xfrm;{xfrm.setOffX(xfrm.offX*kw);xfrm.setOffY(xfrm.offY*kh);xfrm.setExtX(xfrm.extX*kw);xfrm.setExtY(xfrm.extY*kh)}}this.recalcTransform&&this.recalcTransform()};CShape.prototype.recalculateTransform=function(){this.cachedImage= null;this.recalculateLocalTransform(this.transform);this.invertTransform=global_MatrixTransformer.Invert(this.transform);this.localTransform=this.transform.CreateDublicate()};CShape.prototype.checkAutofit=function(bIgnoreWordShape){if(this.bWordShape||bIgnoreWordShape||this.bCheckAutoFitFlag){var content=this.getDocContent();if(content){var oBodyPr=this.getBodyPr();if(oBodyPr.textFit&&oBodyPr.textFit.type===AscFormat.text_fit_Auto||oBodyPr.wrap===AscFormat.nTWTNone)return true}}return false};CShape.prototype.Check_AutoFit= function(){return this.checkAutofit(true)||this.checkContentWordArt(this.getDocContent())||this.getBodyPr().prstTxWarp!=null};CShape.prototype.recalculateLocalTransform=function(transform){AscFormat.ExecuteNoHistory(function(){var bNotesShape=false;if(!isRealObject(this.group)){var bUserShape=false;if(this.parent instanceof AscFormat.CRelSizeAnchor||this.parent instanceof AscFormat.CAbsSizeAnchor)if(this.parent.parent instanceof AscFormat.CChartSpace){this.x=this.parent.parent.extX*this.parent.fromX; this.y=this.parent.parent.extY*this.parent.fromY;if(this.parent instanceof AscFormat.CRelSizeAnchor){this.extX=Math.max(0,this.parent.parent.extX*this.parent.toX-this.x);this.extY=Math.max(0,this.parent.parent.extY*this.parent.toY-this.y)}else{this.extX=Math.max(0,this.parent.toX);this.extY=Math.max(0,this.parent.toY)}var rot=0;if(this.spPr&&this.spPr.xfrm){if(AscFormat.isRealNumber(this.spPr.xfrm.rot))rot=AscFormat.normalizeRotate(this.spPr.xfrm.rot);this.flipH=this.spPr.xfrm.flipH===true;this.flipV= this.spPr.xfrm.flipV===true}this.rot=rot;bUserShape=true}if(bUserShape);else if(this.drawingBase&&!this.isCrop){var metrics=this.drawingBase.getGraphicObjectMetrics();this.x=metrics.x;this.y=metrics.y;var rot=0;if(this.spPr&&this.spPr.xfrm){if(AscFormat.isRealNumber(this.spPr.xfrm.rot))rot=AscFormat.normalizeRotate(this.spPr.xfrm.rot);this.flipH=this.spPr.xfrm.flipH===true;this.flipV=this.spPr.xfrm.flipV===true}this.rot=rot;var metricExtX,metricExtY;{metricExtX=metrics.extX;metricExtY=metrics.extY; if(checkNormalRotate(rot)){this.extX=metrics.extX;this.extY=metrics.extY}else{this.extX=metrics.extY;this.extY=metrics.extX}}if(checkNormalRotate(rot)){this.x=metrics.x;this.y=metrics.y}else{this.x=metrics.x+metricExtX/2-metricExtY/2;this.y=metrics.y+metricExtY/2-metricExtX/2}}else if(typeof AscCommonSlide!=="undefined"&&AscCommonSlide&&AscCommonSlide.CNotes&&this.parent&&this.parent instanceof AscCommonSlide.CNotes){bNotesShape=true;this.x=0;this.y=editor.WordControl.m_oLogicDocument.GetHeightMM(); this.extX=this.parent.getWidth();this.extY=2E3;this.rot=0;this.flipH=false;this.flipV=false}else if(this.spPr&&this.spPr.xfrm&&this.spPr.xfrm.isNotNull()){var xfrm=this.spPr.xfrm;var bAlign=false;if(this.parent)if(this.parent.PositionH&&this.parent.PositionH.Align||this.parent.PositionV&&this.parent.PositionV.Align)bAlign=true;if(bAlign){this.x=0;this.y=0}else{this.x=xfrm.offX;this.y=xfrm.offY}this.extX=xfrm.extX;this.extY=xfrm.extY;this.rot=AscFormat.isRealNumber(xfrm.rot)?xfrm.rot:0;this.flipH= xfrm.flipH===true;this.flipV=xfrm.flipV===true;if(this.extX<.01&&this.extY<.01){if(this.parent&&this.parent.Extent&&AscFormat.isRealNumber(this.parent.Extent.W)&&AscFormat.isRealNumber(this.parent.Extent.H)){this.extX=this.parent.Extent.W;this.extY=this.parent.Extent.H}}else{var oParaDrawing=getParaDrawing(this);if(oParaDrawing){if(oParaDrawing.Extent&&AscFormat.isRealNumber(oParaDrawing.Extent.W)&&AscFormat.isRealNumber(oParaDrawing.Extent.H)){this.extX=oParaDrawing.Extent.W;this.extY=oParaDrawing.Extent.H}if(oParaDrawing.SizeRelH|| oParaDrawing.SizeRelV){this.m_oSectPr=null;var oParentParagraph=oParaDrawing.Get_ParentParagraph();if(oParentParagraph){var oSectPr=oParentParagraph.Get_SectPr();if(oSectPr){if(oParaDrawing.SizeRelH&&oParaDrawing.SizeRelH.Percent>0){switch(oParaDrawing.SizeRelH.RelativeFrom){case c_oAscSizeRelFromH.sizerelfromhMargin:{this.extX=oSectPr.GetContentFrameWidth();break}case c_oAscSizeRelFromH.sizerelfromhPage:{this.extX=oSectPr.GetPageWidth();break}case c_oAscSizeRelFromH.sizerelfromhLeftMargin:{this.extX= oSectPr.GetPageMarginLeft();break}case c_oAscSizeRelFromH.sizerelfromhRightMargin:{this.extX=oSectPr.GetPageMarginRight();break}default:{this.extX=oSectPr.GetPageMarginLeft();break}}this.extX*=oParaDrawing.SizeRelH.Percent}if(oParaDrawing.SizeRelV&&oParaDrawing.SizeRelV.Percent>0){switch(oParaDrawing.SizeRelV.RelativeFrom){case c_oAscSizeRelFromV.sizerelfromvMargin:{this.extY=oSectPr.GetContentFrameHeight();break}case c_oAscSizeRelFromV.sizerelfromvPage:{this.extY=oSectPr.GetPageHeight();break}case c_oAscSizeRelFromV.sizerelfromvTopMargin:{this.extY= oSectPr.GetPageMarginTop();break}case c_oAscSizeRelFromV.sizerelfromvBottomMargin:{this.extY=oSectPr.GetPageMarginBottom();break}default:{this.extY=oSectPr.GetPageMarginTop();break}}this.extY*=oParaDrawing.SizeRelV.Percent}this.m_oSectPr=new CSectionPr;this.m_oSectPr.Copy(oSectPr)}}}}}}else if(this.isPlaceholder()){var hierarchy=this.getHierarchy();for(var i=0;i.001||Math.abs(Height-Height2)>.001;if(bRet){this.recalcBounds();this.recalcText();this.recalcGeometry();if(bSizRel)this.recalcTransform()}return bRet}else if(this.m_oSectPr){this.recalcBounds(); this.recalcText();this.recalcGeometry();bRet=true}return bRet};CShape.prototype.recalculateDocContent=function(oDocContent,oBodyPr){var nStartPage=this.Get_AbsolutePage?this.Get_AbsolutePage():0;var oRet={w:0,h:0,contentH:0};var l_ins,t_ins,r_ins,b_ins;if(oBodyPr){l_ins=AscFormat.isRealNumber(oBodyPr.lIns)?oBodyPr.lIns:2.54;r_ins=AscFormat.isRealNumber(oBodyPr.rIns)?oBodyPr.rIns:2.54;t_ins=AscFormat.isRealNumber(oBodyPr.tIns)?oBodyPr.tIns:1.27;b_ins=AscFormat.isRealNumber(oBodyPr.bIns)?oBodyPr.bIns: 1.27}else{l_ins=2.54;r_ins=2.54;t_ins=1.27;b_ins=1.27}if(this.bWordShape){var oPen=this.pen;if(oPen){var penW=oPen.w==null?12700:parseInt(oPen.w);penW/=36E3;switch(oPen.algn){case 1:{break}default:{penW/=2;break}}l_ins+=penW;r_ins+=penW;t_ins+=penW;b_ins+=penW}}var oRect=this.getTextRect();var w,h;w=oRect.r-oRect.l-(l_ins+r_ins);h=oRect.b-oRect.t-(t_ins+b_ins);if(oBodyPr.wrap===AscFormat.nTWTNone){var dMaxWidth=1E5;if(this.bWordShape){this.m_oSectPr=null;var oParaDrawing=getParaDrawing(this);if(oParaDrawing){var oParentParagraph= oParaDrawing.Get_ParentParagraph();if(oParentParagraph){var oSectPr=oParentParagraph.Get_SectPr();if(oSectPr){if(!(oBodyPr.vert===AscFormat.nVertTTvert||oBodyPr.vert===AscFormat.nVertTTvert270||oBodyPr.vert===AscFormat.nVertTTeaVert))dMaxWidth=oSectPr.GetContentFrameWidth()-l_ins-r_ins;else dMaxWidth=oSectPr.GetContentFrameHeight();this.m_oSectPr=new CSectionPr;this.m_oSectPr.Copy(oSectPr)}}}}var dMaxWidthRec=RecalculateDocContentByMaxLine(oDocContent,dMaxWidth,this.bWordShape);if(!(oBodyPr.vert=== AscFormat.nVertTTvert||oBodyPr.vert===AscFormat.nVertTTvert270||oBodyPr.vert===AscFormat.nVertTTeaVert)){if(dMaxWidthRec=0){this.tmpFontScale= aScales[nCurIndex-1];this.tmpLnSpcReduction=dReductionScale*(1E5-this.tmpFontScale)>>0;this.recalculateContentWitCompiledPr();if(this.contentHeight<=this.clipRect.h){this.tmpFontScale=aScales[nCurIndex];this.tmpLnSpcReduction=dReductionScale*(1E5-this.tmpFontScale)>>0;this.recalculateContentWitCompiledPr();if(this.contentHeight>=this.clipRect.h){this.tmpFontScale=aScales[nCurIndex-1];this.tmpLnSpcReduction=dReductionScale*(1E5-this.tmpFontScale)>>0;break}else nCurShift=Math.abs(nCurShift)/2}else nCurShift= -Math.abs(nCurShift)/2;if(Math.abs(nCurShift)<1)break}else{this.tmpFontScale=aScales[0];this.tmpLnSpcReduction=dReductionScale*(1E5-this.tmpFontScale)>>0;break}}if(AscFormat.isRealNumber(this.tmpFontScale)&&this.tmpFontScale<9E4)if(this.isPlaceholder()){var nType=this.getPlaceholderType();if(nType===AscFormat.phType_title||nType===AscFormat.phType_ctrTitle){this.tmpFontScale=9E4;this.tmpLnSpcReduction=dReductionScale*(1E5-this.tmpFontScale)>>0}}if(oBodyPr.textFit.lnSpcReduction!==this.tmpLnSpcReduction|| oBodyPr.textFit.fontScale!==this.tmpFontScale){oBodyPr=oBodyPr.createDuplicate();oBodyPr.textFit.lnSpcReduction=this.tmpLnSpcReduction;oBodyPr.textFit.fontScale=this.tmpFontScale;if(this.bWordShape)this.setBodyPr(oBodyPr);else if(this.txBody)this.txBody.setBodyPr(oBodyPr)}this.bCheckAutoFitFlag=false;this.tmpFontScale=undefined;this.tmpLnSpcReduction=undefined;this.recalculateContentWitCompiledPr()}else{var oForm;if(this.isForm()&&(oForm=this.getInnerForm())&&oForm.IsAutoFitContent()&&oForm.GetLogicDocument()&& oForm.GetLogicDocument().CheckFormAutoFit)oForm.GetLogicDocument().CheckFormAutoFit(oForm);if(bForce)this.recalculateContentWitCompiledPr()}}}return false};CShape.prototype.getTransformMatrix=function(){return this.transform};CShape.prototype.getTransform=function(){return{x:this.x,y:this.y,extX:this.extX,extY:this.extY,rot:this.rot,flipH:this.flipH,flipV:this.flipV}};CShape.prototype.getAngle=function(x,y){var px=this.invertTransform.TransformPointX(x,y);var py=this.invertTransform.TransformPointY(x, y);return Math.PI*.5+Math.atan2(px-this.extX*.5,py-this.extY*.5)};CShape.prototype.recalculateGeometry=function(){if(this.spPr&&isRealObject(this.spPr.geometry)){var transform=this.getTransform();this.spPr.geometry.Recalculate(transform.extX,transform.extY)}};CShape.prototype.drawAdjustments=function(drawingDocument){if(this.spPr&&isRealObject(this.spPr.geometry))this.spPr.geometry.drawAdjustments(drawingDocument,this.transform,false);if(this.recalcInfo.warpGeometry)this.recalcInfo.warpGeometry.drawAdjustments(drawingDocument, this.transformTextWordArt,true)};CShape.prototype.getHandlePosByIndex=function(numHandle){var t=this.transform;switch(numHandle){case 0:return{x:t.TransformPointX(0,0),y:t.TransformPointY(0,0)};case 1:return{x:t.TransformPointX(this.extX/2,0),y:t.TransformPointY(this.extX/2,0)};case 2:return{x:t.TransformPointX(this.extX,0),y:t.TransformPointY(this.extX,0)};case 3:return{x:t.TransformPointX(this.extX,this.extY/2),y:t.TransformPointY(this.extX,this.extY/2)};case 4:return{x:t.TransformPointX(this.extX, this.extY),y:t.TransformPointY(this.extX,this.extY)};case 5:return{x:t.TransformPointX(this.extX/2,this.extY),y:t.TransformPointY(this.extX/2,this.extY)};case 6:return{x:t.TransformPointX(0,this.extY),y:t.TransformPointY(0,this.extY)};case 7:return{x:t.TransformPointX(0,this.extY/2),y:t.TransformPointY(0,0)};default:}};CShape.prototype.getGroupHierarchy=function(){if(this.recalcInfo.recalculateGroupHierarchy){this.groupHierarchy=[];if(isRealObject(this.group)){var parent_group_hierarchy=this.group.getGroupHierarchy(); for(var i=0;i0)return this.cachedImage;if(!AscFormat.isRealNumber(this.x)||!AscFormat.isRealNumber(this.y)||!AscFormat.isRealNumber(this.extX)|| !AscFormat.isRealNumber(this.extY)||AscFormat.fApproxEqual(this.extX,0)&&AscFormat.fApproxEqual(this.extY,0))return"";var img_object=AscCommon.ShapeToImageConverter(this,this.pageIndex);if(img_object){if(img_object.ImageNative)try{this.cachedPixW=img_object.ImageNative.width;this.cachedPixH=img_object.ImageNative.height}catch(e){this.cachedPixW=50;this.cachedPixH=50}return img_object.ImageUrl}else return""};CShape.prototype.haveSelectedDrawingInContent=function(){if(this.bWordShape){var aAllDrawings= this.recalcInfo.AllDrawings;for(var i=0;i0)this.brush=AscFormat.CreateBlipFillUniFillFromUrl(sSignatureUrl)}if((geometry||this.getObjectType&&(this.getObjectType()===AscDFH.historyitem_type_DLbl||this.getObjectType()===AscDFH.historyitem_type_Title||this.getObjectType()===AscDFH.historyitem_type_Legend))&& (this.style||this.brush&&this.brush.fill||this.pen&&this.pen.Fill&&this.pen.Fill.fill)){graphics.SetIntegerGrid(false);graphics.transform3(_transform,false);var shape_drawer=new AscCommon.CShapeDrawer;shape_drawer.fromShape2(this,graphics,geometry);shape_drawer.draw(geometry)}if(!this.bWordShape&&this.isEmptyPlaceholder()&&!(this.parent&&this.parent.kind===AscFormat.TYPE_KIND.NOTES)&&!(this.pen&&this.pen.Fill&&this.pen.Fill.fill&&!(this.pen.Fill.fill instanceof AscFormat.CNoFill))&&graphics.IsNoDrawingEmptyPlaceholder!== true&&!AscCommon.IsShapeToImageConverter){var drawingObjects=this.getDrawingObjectsController();if(typeof editor!=="undefined"&&editor&&graphics.m_oContext!==undefined&&graphics.m_oContext!==null&&graphics.IsTrack===undefined&&(!drawingObjects||AscFormat.getTargetTextObject(drawingObjects)!==this)){var angle=_transform.GetRotation();if(AscFormat.fApproxEqual(angle,0,0)||AscFormat.fApproxEqual(angle,90,0)||AscFormat.fApproxEqual(angle,180,0)||AscFormat.fApproxEqual(angle,270,0)){graphics.transform3(_transform, false);var tr=graphics.m_oFullTransform;graphics.SetIntegerGrid(true);var _x=tr.TransformPointX(0,0);var _y=tr.TransformPointY(0,0);var _r=tr.TransformPointX(this.extX,this.extY);var _b=tr.TransformPointY(this.extX,this.extY);var __x=Math.min(_x,_r);var __y=Math.min(_y,_b);var __r=Math.max(_x,_r);var __b=Math.max(_y,_b);graphics.m_oContext.lineWidth=1;graphics.p_color(127,127,127,255);graphics._s();editor.WordControl.m_oDrawingDocument.AutoShapesTrack.AddRectDashClever(graphics.m_oContext,__x>>0, __y>>0,__r>>0,__b>>0,2,2,true);graphics._s()}else{graphics.transform3(_transform,false);var tr=graphics.m_oFullTransform;graphics.SetIntegerGrid(true);var _r=this.extX;var _b=this.extY;var x1=tr.TransformPointX(0,0)>>0;var y1=tr.TransformPointY(0,0)>>0;var x2=tr.TransformPointX(_r,0)>>0;var y2=tr.TransformPointY(_r,0)>>0;var x3=tr.TransformPointX(0,_b)>>0;var y3=tr.TransformPointY(0,_b)>>0;var x4=tr.TransformPointX(_r,_b)>>0;var y4=tr.TransformPointY(_r,_b)>>0;graphics.m_oContext.lineWidth=1;graphics.p_color(127, 127,127,255);graphics._s();editor.WordControl.m_oDrawingDocument.AutoShapesTrack.AddRectDash(graphics.m_oContext,x1,y1,x2,y2,x3,y3,x4,y4,3,1,true);graphics._s()}}else{graphics.SetIntegerGrid(false);graphics.p_width(70);graphics.transform3(_transform,false);graphics.p_color(0,0,0,255);graphics._s();graphics._m(0,0);graphics._l(this.extX,0);graphics._l(this.extX,this.extY);graphics._l(0,this.extY);graphics._z();graphics.ds();graphics.SetIntegerGrid(true)}}this.brush=_oldBrush;var oController=this.getDrawingObjectsController&& this.getDrawingObjectsController();if(!this.cropObject)if(!this.txWarpStruct&&!this.txWarpStructParamarksNoTransform||(!this.txWarpStructParamarksNoTransform&&oController&&AscFormat.getTargetTextObject(oController)===this||!this.txBody&&!this.textBoxContent)){if(this.txBody){graphics.SaveGrState();graphics.SetIntegerGrid(false);var transform_text;if((!this.txBody.content||this.txBody.content.Is_Empty())&&!AscCommon.IsShapeToImageConverter&&this.txBody.content2!=null&&!this.txBody.checkCurrentPlaceholder()&& (this.isEmptyPlaceholder?this.isEmptyPlaceholder():false)&&this.transformText2)transform_text=this.transformText2;else if(this.txBody.content)transform_text=_transform_text;if(this instanceof CShape)if(!(oController&&AscFormat.getTargetTextObject(oController)===this))this.clipTextRect(graphics,transform,transformText,pageIndex);graphics.transform3(transform_text,true);if(graphics.CheckUseFonts2!==undefined)graphics.CheckUseFonts2(transform_text);graphics.SetIntegerGrid(true);this.txBody.draw(graphics); if(graphics.UncheckUseFonts2!==undefined)graphics.UncheckUseFonts2(transform_text);graphics.RestoreGrState()}if(this.textBoxContent&&!graphics.IsNoSupportTextDraw&&this.transformText){var old_start_page=this.textBoxContent.Get_StartPage_Relative();this.textBoxContent.Set_StartPage(pageIndex);graphics.SaveGrState();graphics.SetIntegerGrid(false);this.clipTextRect(graphics,transform,transformText,pageIndex);var result_page_index=AscFormat.isRealNumber(graphics.shapePageIndex)?graphics.shapePageIndex: old_start_page;if(graphics.CheckUseFonts2!==undefined)graphics.CheckUseFonts2(this.transformText);if(AscCommon.IsShapeToImageConverter){this.textBoxContent.Set_StartPage(0);result_page_index=0}this.textBoxContent.Set_StartPage(result_page_index);this.textBoxContent.Draw(result_page_index,graphics);if(graphics.UncheckUseFonts2!==undefined)graphics.UncheckUseFonts2();this.textBoxContent.Set_StartPage(old_start_page);graphics.RestoreGrState()}}else{var oTheme=this.getParentObjects().theme;var oColorMap= this.Get_ColorMap();if(!this.bWordShape&&(!this.txBody.content||this.txBody.content.Is_Empty())&&!AscCommon.IsShapeToImageConverter&&this.txBody.content2!=null&&!this.txBody.checkCurrentPlaceholder()&&(this.isEmptyPlaceholder?this.isEmptyPlaceholder():false)){if(graphics.IsNoDrawingEmptyPlaceholder!==true&&graphics.IsNoDrawingEmptyPlaceholderText!==true)if(editor&&editor.ShowParaMarks)this.txWarpStructParamarks2.draw(graphics,this.transformTextWordArt2,oTheme,oColorMap);else if(this.txWarpStruct2)this.txWarpStruct2.draw(graphics, this.transformTextWordArt2,oTheme,oColorMap)}else{var oContent=this.getDocContent();var result_page_index=AscFormat.isRealNumber(graphics.shapePageIndex)?graphics.shapePageIndex:oContent?oContent.Get_StartPage_Relative():0;graphics.PageNum=result_page_index;var bNeedRestoreState=false;var bEditTextArt=isRealObject(oController)&&AscFormat.getTargetTextObject(oController)===this;if(this.bWordShape&&this.clipRect){bNeedRestoreState=true;var clip_rect=this.clipRect;if(!this.bodyPr.upright){graphics.SaveGrState(); graphics.SetIntegerGrid(false);graphics.transform3(this.transform);graphics.AddClipRect(clip_rect.x,clip_rect.y,clip_rect.w,clip_rect.h)}else{graphics.SaveGrState();graphics.SetIntegerGrid(false);graphics.transform3(this.transformText,true);graphics.AddClipRect(clip_rect.x,clip_rect.y,clip_rect.w,clip_rect.h)}}var oTransform=this.transformTextWordArt;if(editor&&editor.ShowParaMarks)if(bEditTextArt&&this.txWarpStructParamarksNoTransform)this.txWarpStructParamarksNoTransform.draw(graphics,this.transformText, oTheme,oColorMap);else{if(this.txWarpStructParamarks){this.txWarpStructParamarks.draw(graphics,oTransform,oTheme,oColorMap);if(this.checkNeedRecalcDocContentForTxWarp(this.bodyPr))if(this.txWarpStructParamarksNoTransform)this.txWarpStructParamarksNoTransform.drawComments(graphics,undefined,oTransform)}}else if(bEditTextArt&&this.txWarpStructNoTransform)this.txWarpStructNoTransform.draw(graphics,this.transformText,oTheme,oColorMap);else if(this.txWarpStruct){this.txWarpStruct.draw(graphics,oTransform, oTheme,oColorMap);if(this.checkNeedRecalcDocContentForTxWarp(this.bodyPr))if(this.txWarpStructNoTransform)this.txWarpStructNoTransform.drawComments(graphics,undefined,oTransform)}delete graphics.PageNum;if(bNeedRestoreState)graphics.RestoreGrState()}}this.drawLocks&&this.drawLocks(_transform,graphics);if(oClipRect)graphics.RestoreGrState();graphics.SetIntegerGrid(true);graphics.reset()};CShape.prototype.recalculateGeometry=function(){this.calcGeometry=null;if(isRealObject(this.spPr&&this.spPr.geometry))this.calcGeometry= this.spPr.geometry;else if(this.getHierarchy){var hierarchy=this.getHierarchy();for(var i=0;ithis.extX*.5?Math.atan2(Math.abs(v1_x*v2_y-v1_y*v2_x),v1_x*v2_x+v1_y*v2_y):-Math.atan2(Math.abs(v1_x*v2_y-v1_y*v2_x),v1_x*v2_x+v1_y*v2_y);return same_flip?angle:-angle};CShape.prototype.getRectBounds=function(){var transform=this.getTransformMatrix();var w=this.extX;var h=this.extY;var rect_points=[{x:0, y:0},{x:w,y:0},{x:w,y:h},{x:0,y:h}];var min_x,max_x,min_y,max_y;min_x=transform.TransformPointX(rect_points[0].x,rect_points[0].y);min_y=transform.TransformPointY(rect_points[0].x,rect_points[0].y);max_x=min_x;max_y=min_y;var cur_x,cur_y;for(var i=1;i<4;++i){cur_x=transform.TransformPointX(rect_points[i].x,rect_points[i].y);cur_y=transform.TransformPointY(rect_points[i].x,rect_points[i].y);if(cur_xmax_x)max_x=cur_x;if(cur_ymax_y)max_y=cur_y}return{minX:min_x, maxX:max_x,minY:min_y,maxY:max_y}};CShape.prototype.getInvertTransform=function(){return this.invertTransform?this.invertTransform:new CMatrix};CShape.prototype.getFullOffset=function(){if(!isRealObject(this.group))return{offX:this.x,offY:this.y};var group_offset=this.group.getFullOffset();return{offX:this.x+group_offset.offX,offY:this.y+group_offset.offY}};CShape.prototype.getTextArtProperties=function(){var oContent=this.getDocContent(),oTextPr,oRet=null;if(oContent){oRet={Fill:undefined,Line:undefined, Form:undefined};var oController=this.getDrawingObjectsController();{var oBodyPr=this.getBodyPr();if(oBodyPr&&oBodyPr.prstTxWarp)oRet.Form=oBodyPr.prstTxWarp.preset;else oRet.Form="textNoShape"}}return oRet};CShape.prototype.applyTextArtForm=function(sPreset){var oBodyPr=this.getBodyPr().createDuplicate();oBodyPr.prstTxWarp=AscFormat.ExecuteNoHistory(function(){return AscFormat.CreatePrstTxWarpGeometry(sPreset)},this,[]);if(this.bWordShape)this.setBodyPr(oBodyPr);else if(this.txBody)this.txBody.setBodyPr(oBodyPr)}; CShape.prototype.getParagraphParaPr=function(){if(this.txBody&&this.txBody.content){var _result;this.txBody.content.SetApplyToAll(true);_result=this.txBody.content.GetCalculatedParaPr();this.txBody.content.SetApplyToAll(false);return _result}return null};CShape.prototype.getParagraphTextPr=function(){if(this.txBody&&this.txBody.content){var _result;this.txBody.content.SetApplyToAll(true);_result=this.txBody.content.GetCalculatedTextPr();this.txBody.content.SetApplyToAll(false);return _result}return null}; CShape.prototype.getAllRasterImages=function(images){if(this.spPr&&this.spPr.Fill&&this.spPr.Fill.fill&&typeof this.spPr.Fill.fill.RasterImageId==="string"&&this.spPr.Fill.fill.RasterImageId.length>0)images.push(this.spPr.Fill.fill.RasterImageId);var compiled_style=this.getCompiledStyle();var parents=this.getParentObjects();if(isRealObject(parents.theme)&&isRealObject(compiled_style)&&isRealObject(compiled_style.fillRef)){var brush=parents.theme.getFillStyle(compiled_style.fillRef.idx,compiled_style.fillRef.Color); if(brush&&brush.fill&&typeof brush.fill.RasterImageId==="string"&&brush.fill.RasterImageId.length>0)images.push(brush.fill.RasterImageId)}var oContent=this.getDocContent();if(oContent){if(this.bWordShape){var drawings=oContent.GetAllDrawingObjects();for(var i=0;i0&&!(this.getObjectType&&this.getObjectType()===AscDFH.historyitem_type_ChartSpace))return oGeometry.hitInInnerArea(this.getCanvasContext(),x_t,y_t);if(this.getObjectType()===AscDFH.historyitem_type_Shape)return false;return x_t>0&&x_t0&&y_t>0)>0)oTextPr.FontSize=-1;oInterfaceTextPr=new Asc.CTextProp(oTextPr);if(oTextPr.TextFill){oTextPr.TextFill.check(this.Get_Theme(),this.Get_ColorMap());if(oTextPr.TextFill.fill&&oTextPr.TextFill.fill.type===c_oAscFill.FILL_TYPE_SOLID&&oTextPr.TextFill.fill.color)oInterfaceTextPr.put_Color(AscCommon.CreateAscColor(oTextPr.TextFill.fill.color));else{oRGBAColor=oTextPr.TextFill.getRGBAColor();oInterfaceTextPr.put_Color(AscCommon.CreateAscColorCustom(oRGBAColor.R, oRGBAColor.G,oRGBAColor.B,false))}oProps.put_Opacity(AscFormat.isRealNumber(oTextPr.TextFill.transparent)?oTextPr.TextFill.transparent:255)}oProps.put_TextPr(oInterfaceTextPr);oContent.SetApplyToAll(false);return oProps};CShape.prototype.Restart_CheckSpelling=function(){this.recalcInfo.recalculateShapeStyleForParagraph=true;var content=this.getDocContent();content&&content.Restart_CheckSpelling()};CShape.prototype.Refresh_RecalcData=function(data){switch(data.Type){case AscDFH.historyitem_AutoShapes_SetDrawingBaseCoors:{break}case AscDFH.historyitem_AutoShapes_RemoveFromDrawingObjects:{break}case AscDFH.historyitem_AutoShapes_AddToDrawingObjects:{break}case AscDFH.historyitem_AutoShapes_SetWorksheet:{break}case AscDFH.historyitem_ShapeSetBDeleted:{break}case AscDFH.historyitem_ShapeSetNvSpPr:{break}case AscDFH.historyitem_ShapeSetSpPr:{break}case AscDFH.historyitem_ShapeSetStyle:{break}case AscDFH.historyitem_ShapeSetTxBody:{this.Refresh_RecalcData2(); break}case AscDFH.historyitem_ShapeSetTextBoxContent:{this.Refresh_RecalcData2();break}case AscDFH.historyitem_ShapeSetParent:{break}case AscDFH.historyitem_ShapeSetGroup:{break}case AscDFH.historyitem_ShapeSetBodyPr:{this.Refresh_RecalcData2();break}case AscDFH.historyitem_ShapeSetWordShape:{break}default:{this.Refresh_RecalcData2()}}};CShape.prototype.Refresh_RecalcData2=function(pageIndex){this.recalcContent();this.recalcContent2&&this.recalcContent2();this.recalcTransformText();this.addToRecalculate(); var oController=this.getDrawingObjectsController();if(oController&&AscFormat.getTargetTextObject(oController)===this){this.recalcInfo.recalcTitle=this.getDocContent();this.recalcInfo.bRecalculatedTitle=true}if(this.parent&&this.parent.getObjectType&&this.parent.getObjectType()===AscDFH.historyitem_type_Notes)if(this.parent.slide&&this.parent.slide.addToRecalculate)this.parent.slide.addToRecalculate()};CShape.prototype.Load_LinkData=function(linkData){};CShape.prototype.Get_PageContentStartPos=function(pageNum){if(this.textBoxContent)if(this.spPr&& this.spPr.geometry&&this.spPr.geometry.rect){var rect=this.spPr.geometry.rect;return{X:0,Y:0,XLimit:rect.r-rect.l,YLimit:2E4}}else return{X:0,Y:0,XLimit:this.extX,YLimit:2E4};return null};CShape.prototype.OnContentRecalculate=function(){};CShape.prototype.recalculateBounds=function(){var boundsChecker=new AscFormat.CSlideBoundsChecker;this.draw(boundsChecker,this.localTransform,this.localTransformText);this.bounds.l=boundsChecker.Bounds.min_x;this.bounds.t=boundsChecker.Bounds.min_y;this.bounds.r= boundsChecker.Bounds.max_x;this.bounds.b=boundsChecker.Bounds.max_y;this.bounds.x=this.bounds.l;this.bounds.y=this.bounds.t;this.bounds.w=this.bounds.r-this.bounds.l;this.bounds.h=this.bounds.b-this.bounds.t};CShape.prototype.checkContentWordArt=function(oContent){if(!oContent)return false;return oContent.CheckRunContent(CheckWordArtTextPr)};CShape.prototype.checkNeedRecalcDocContentForTxWarp=function(oBodyPr){return oBodyPr&&oBodyPr.prstTxWarp&&oBodyPr.prstTxWarp.pathLst.length/2-(oBodyPr.prstTxWarp.pathLst.length/ 2>>0)>0};CShape.prototype.chekBodyPrTransform=function(oBodyPr){return isRealObject(oBodyPr)&&isRealObject(oBodyPr.prstTxWarp)&&oBodyPr.prstTxWarp.preset!=="textNoShape"};CShape.prototype.checkTextWarp=function(oContent,oBodyPr,dWidth,dHeight,bNeedNoTransform,bNeedWarp){return AscFormat.ExecuteNoHistory(function(){var oRet={oTxWarpStruct:null,oTxWarpStructParamarks:null,oTxWarpStructNoTransform:null,oTxWarpStructParamarksNoTransform:null};if(window["IS_NATIVE_EDITOR"])return oRet;var bTransform=this.chekBodyPrTransform(oBodyPr)&& bNeedWarp;var warpGeometry=oBodyPr.prstTxWarp;warpGeometry&&warpGeometry.Recalculate(dWidth,dHeight);this.recalcInfo.warpGeometry=warpGeometry;var bCheckWordArtContent=this.checkContentWordArt(oContent);var bColumns=oContent.Get_ColumnsCount()>1;var bContentRecalculated=false;if(bTransform||bCheckWordArtContent){var bNeedRecalc=this.checkNeedRecalcDocContentForTxWarp(oBodyPr),dOneLineWidth,dMinPolygonLength=0,dKoeff=1;var oTheme=this.Get_Theme(),oColorMap=this.Get_ColorMap();var oTextDrawer=new AscFormat.CTextDrawer(dWidth, dHeight,true,oTheme,bNeedRecalc);oTextDrawer.bCheckLines=bTransform&&bNeedWarp;var oContentToDraw=oContent;if(bNeedRecalc&&bNeedWarp){oContentToDraw=oContent.Copy(oContent.Parent,oContent.DrawingDocument);var bNeedTurnOn=false;if(this.bWordShape&&editor&&editor.WordControl.m_oLogicDocument)if(!editor.WordControl.m_oLogicDocument.TurnOffRecalc){bNeedTurnOn=true;editor.WordControl.m_oLogicDocument.TurnOff_Recalculate()}oContentToDraw.SetApplyToAll(true);oContentToDraw.SetParagraphSpacing({Before:0, After:0});oContentToDraw.SetApplyToAll(false);if(bNeedTurnOn)editor.WordControl.m_oLogicDocument.TurnOn_Recalculate(false);dMinPolygonLength=warpGeometry.getMinPathPolygonLength();dOneLineWidth=AscFormat.GetRectContentWidth(oContentToDraw);if(dOneLineWidth>dMinPolygonLength){dKoeff=dMinPolygonLength/dOneLineWidth;oContentToDraw.Reset(0,0,dOneLineWidth,2E4)}else oContentToDraw.Reset(0,0,dMinPolygonLength,2E4);oContentToDraw.Recalculate_Page(0,true)}else if(bTransform&&bColumns){oContentToDraw=oContent.Copy(oContent.Parent, oContent.DrawingDocument);oContentToDraw.Reset(0,0,oContent.XLimit,2E4);oContentToDraw.Recalculate_Page(0,true)}var dContentHeight=oContentToDraw.GetSummaryHeight();var OldShowParaMarks,width_=dWidth*dKoeff,height_=dHeight*dKoeff;if(isRealObject(editor)){OldShowParaMarks=editor.ShowParaMarks;editor.ShowParaMarks=true}if(bNeedWarp){oContentToDraw.Draw(oContentToDraw.StartPage,oTextDrawer);oRet.oTxWarpStructParamarks=oTextDrawer.m_oDocContentStructure;oRet.oTxWarpStructParamarks.Recalculate(oTheme, oColorMap,width_,height_,this);if(bTransform){oRet.oTxWarpStructParamarks.checkByWarpStruct(warpGeometry,dWidth,dHeight,oTheme,oColorMap,this,dOneLineWidth,oContentToDraw.XLimit,dContentHeight,dKoeff);if(bNeedNoTransform&&bCheckWordArtContent){if(oRet.oTxWarpStructParamarks.m_aComments.length>0){oContent.Recalculate_Page(0,true);bContentRecalculated=true}oContent.Draw(oContent.StartPage,oTextDrawer);oRet.oTxWarpStructParamarksNoTransform=oTextDrawer.m_oDocContentStructure;oRet.oTxWarpStructParamarksNoTransform.Recalculate(oTheme, oColorMap,dWidth,dHeight,this);oRet.oTxWarpStructParamarksNoTransform.checkUnionPaths()}}else{oRet.oTxWarpStructParamarks.checkUnionPaths();if(bNeedNoTransform&&bCheckWordArtContent)oRet.oTxWarpStructParamarksNoTransform=oRet.oTxWarpStructParamarks}}else if(bNeedNoTransform&&bCheckWordArtContent){oContent.Draw(oContent.StartPage,oTextDrawer);oRet.oTxWarpStructParamarksNoTransform=oTextDrawer.m_oDocContentStructure;oRet.oTxWarpStructParamarksNoTransform.Recalculate(oTheme,oColorMap,dWidth,dHeight, this);oRet.oTxWarpStructParamarksNoTransform.checkUnionPaths()}if(isRealObject(editor))editor.ShowParaMarks=false;if(bNeedWarp){oContentToDraw.Draw(oContentToDraw.StartPage,oTextDrawer);oRet.oTxWarpStruct=oTextDrawer.m_oDocContentStructure;oRet.oTxWarpStruct.Recalculate(oTheme,oColorMap,width_,height_,this);if(bTransform){oRet.oTxWarpStruct.checkByWarpStruct(warpGeometry,dWidth,dHeight,oTheme,oColorMap,this,dOneLineWidth,oContentToDraw.XLimit,dContentHeight,dKoeff);if(bNeedNoTransform&&bCheckWordArtContent){if(oRet.oTxWarpStruct.m_aComments.length> 0&&!bContentRecalculated)oContent.Recalculate_Page(0,true);oContent.Draw(oContent.StartPage,oTextDrawer);oRet.oTxWarpStructNoTransform=oTextDrawer.m_oDocContentStructure;oRet.oTxWarpStructNoTransform.Recalculate(oTheme,oColorMap,dWidth,dHeight,this);oRet.oTxWarpStructNoTransform.checkUnionPaths()}}else{oRet.oTxWarpStruct.checkUnionPaths();if(bNeedNoTransform&&bCheckWordArtContent)oRet.oTxWarpStructNoTransform=oRet.oTxWarpStruct}}else if(bNeedNoTransform&&bCheckWordArtContent){oContent.Draw(oContent.StartPage, oTextDrawer);oRet.oTxWarpStructNoTransform=oTextDrawer.m_oDocContentStructure;oRet.oTxWarpStructNoTransform.Recalculate(oTheme,oColorMap,dWidth,dHeight,this);oRet.oTxWarpStructNoTransform.checkUnionPaths()}if(isRealObject(editor))editor.ShowParaMarks=OldShowParaMarks}return oRet},this,[])};CShape.prototype.checkTypeCorrect=function(){if(!this.spPr)return false;return true};CShape.prototype.getColumnNumber=function(){if(this.bWordShape)return 1;var oBodyPr=this.getBodyPr();if(AscFormat.isRealNumber(oBodyPr.numCol))return oBodyPr.numCol; return 1};CShape.prototype.getColumnSpace=function(){if(this.bWordShape)return 0;var oBodyPr=this.getBodyPr();if(AscFormat.isRealNumber(oBodyPr.spcCol))return oBodyPr.spcCol;return 0};CShape.prototype.getTextFitType=function(){var oBodyPr=this.getBodyPr();if(AscCommon.isRealObject(oBodyPr.textFit)&&AscFormat.isRealNumber(oBodyPr.textFit.type))return oBodyPr.textFit.type;return AscFormat.text_fit_No};CShape.prototype.getVertOverflowType=function(){var oBodyPr=this.getBodyPr();if(AscFormat.isRealNumber(oBodyPr.vertOverflow))return oBodyPr.vertOverflow; return AscFormat.nOTOwerflow};CShape.prototype.checkWrap=function(){if(!this.txBody)return;var new_body_pr=this.getBodyPr();if(new_body_pr)if(new_body_pr.numCol>1)if(new_body_pr.wrap===AscFormat.nTWTNone){new_body_pr=new_body_pr.createDuplicate();new_body_pr.wrap=AscFormat.nTWTSquare;this.txBody.setBodyPr(new_body_pr)}};CShape.prototype.setColumnNumber=function(num){if(!this.bWordShape&&!CheckObjectLine(this)){var new_body_pr=this.getBodyPr();if(new_body_pr){new_body_pr=new_body_pr.createDuplicate(); new_body_pr.numCol=num>>0;if(!this.txBody)this.createTextBody();if(this.txBody)this.txBody.setBodyPr(new_body_pr);this.checkWrap()}}};CShape.prototype.setColumnSpace=function(spcCol){if(!this.bWordShape&&!CheckObjectLine(this)){var new_body_pr=this.getBodyPr();if(new_body_pr){new_body_pr=new_body_pr.createDuplicate();new_body_pr.spcCol=spcCol;if(!this.txBody)this.createTextBody();if(this.txBody)this.txBody.setBodyPr(new_body_pr);this.checkWrap()}}};CShape.prototype.GetAllContentControls=function(arrContentControls){var oContent= this.getDocContent();if(oContent)oContent.GetAllContentControls(arrContentControls)};CShape.prototype.getCopyWithSourceFormatting=function(){var oCopy=this.copy(undefined);if(this.pen||this.brush){if(!oCopy.spPr){oCopy.setSpPr(AscFormat.CSpPr());oCopy.spPr.setParent(oCopy)}if(this.brush)oCopy.spPr.setFill(this.brush.saveSourceFormatting());if(this.pen)oCopy.spPr.setLn(this.pen.createDuplicate(true))}if(oCopy.txBody&&oCopy.txBody.content){var oTheme=this.Get_Theme();var oColorMap=this.Get_ColorMap(); if(this.txBody&&this.txBody.content)SaveContentSourceFormatting(this.txBody.content.Content,oCopy.txBody.content.Content,oTheme,oColorMap)}if(oCopy.isPlaceholder()&&!this.recalcInfo.recalculateTransform){var oXfrm=oCopy.spPr.xfrm;if(!oXfrm||!oXfrm.isNotNull()){oCopy.x=this.x;oCopy.y=this.y;oCopy.extX=this.extX;oCopy.extY=this.extY;AscFormat.CheckSpPrXfrm(oCopy,true)}}return oCopy};CShape.prototype.getSignatureLineGuid=function(){if(this.signatureLine)return this.signatureLine.id;return null};CShape.prototype.GetAllFields= function(isUseSelection,arrFields){var oContent=this.getDocContent();if(oContent)return oContent.GetAllFields(isUseSelection,arrFields);return arrFields?arrFields:[]};CShape.prototype.GetAllSeqFieldsByType=function(sType,aFields){var oContent=this.getDocContent();if(oContent)return oContent.GetAllSeqFieldsByType(sType,aFields)};CShape.prototype.Get_TextBackGroundColor=function(){if(!this.brush)return undefined;var oTheme=this.Get_Theme&&this.Get_Theme();var oColorMap=this.Get_ColorMap&&this.Get_ColorMap(); if(oTheme&&oColorMap)this.brush.check(oTheme,oColorMap);return this.brush.Get_TextBackGroundColor()};CShape.prototype.checkResetAutoFit=function(bCheckMinVal){if(this.txBody){var oCompiledBodyPr=this.getBodyPr();var oNewBodyPr;var oTextFit=oCompiledBodyPr.textFit;if(oTextFit)if(oTextFit.type===AscFormat.text_fit_NormAuto)if(AscFormat.isRealNumber(oTextFit.fontScale))if(oTextFit.fontScale<1E5){var bReset=false;if(bCheckMinVal){if(oTextFit.fontScale<=25E3){bReset=true;var oContent=this.txBody.content; if(oContent)oContent.CheckRunContent(function(oRun){var oTextPr=oRun.Pr;var oCompiledPr=oRun.CompiledPr;if(AscFormat.isRealNumber(oTextPr.FontSize)&&AscFormat.isRealNumber(oCompiledPr.FontSize)&&oTextPr.FontSize!==oCompiledPr.FontSize){oRun.Set_FontSize(oCompiledPr.FontSize);if(oRun.IsParaEndRun()){var oParagraph=oRun.Paragraph;if(oParagraph)oParagraph.TextPr.Apply_TextPr(oTextPr)}}})}}else bReset=true;if(bReset){oNewBodyPr=oCompiledBodyPr.createDuplicate();oNewBodyPr.textFit=new AscFormat.CTextFit; oNewBodyPr.textFit.type=AscFormat.text_fit_No;this.txBody.setBodyPr(oNewBodyPr)}}}};CShape.prototype.getInnerForm=function(){return this.textBoxContent?this.textBoxContent.GetInnerForm():null};function CreateBinaryReader(szSrc,offset,srcLen){var nWritten=0;var index=-1+offset;var dst_len="";for(;index=srcLen)break;var nCh=DecodeBase64Char(szSrc.charCodeAt(index++));if(nCh==-1){i--;continue}dwCurr<<=6;dwCurr|=nCh;nBits+=6}dwCurr<<=24-nBits;for(i=0;i>>16;dwCurr<<=8}}else{var p=b64_decode;while(index= srcLen)break;var nCh=p[szSrc.charCodeAt(index++)];if(nCh==undefined){i--;continue}dwCurr<<=6;dwCurr|=nCh;nBits+=6}dwCurr<<=24-nBits;for(i=0;i>>16;dwCurr<<=8}}}return stream}function getParaDrawing(oDrawing){var oCurDrawing=oDrawing;while(oCurDrawing.group)oCurDrawing=oCurDrawing.group;if(oCurDrawing.parent instanceof AscCommonWord.ParaDrawing)return oCurDrawing.parent;return null}function checkDrawingsTransformBeforePaste(oEndContent,oSourceContent, oTempParent){var i,j;for(i=0;i-1){flipH=_begin.x>_end.x;flipV=_begin.y>_end.y}else{var sPrefix="bentConnector";if(sPreset.indexOf("curvedConnector")> -1)sPrefix="curvedConnector";switch(_end.dir){case AscFormat.CARD_DIRECTION_N:{if(_end.bounds.l>_begin.bounds.r)if(_end.bounds.t<_begin.y)if(_end.y<=_begin.y){sPreset="4";flipV=true;oMapAdj["adj1"]=1E5*(((_begin.bounds.r+_end.bounds.l)/2-_begin.x)/extX)+.5>>0;oMapAdj["adj2"]=1E5*(_begin.y-(_end.bounds.t-CONNECTOR_MARGIN))/extY+.5>>0}else{sPreset="4";oMapAdj["adj1"]=1E5*(((_begin.bounds.r+_end.bounds.l)/2-_begin.x)/extX)+.5>>0;oMapAdj["adj2"]=-1E5*((_begin.y-(_end.bounds.t-CONNECTOR_MARGIN))/extY)+ .5>>0}else sPreset="2";else if(_end.bounds.t>_begin.bounds.b)if(_end.x<_begin.x){sPreset="4";flipH=true;oMapAdj["adj1"]=-(1E5*(_begin.bounds.r+CONNECTOR_MARGIN-_begin.x)/extX+.5>>0);oMapAdj["adj2"]=1E5*((_end.bounds.t+_begin.bounds.b)/2-_begin.y)/extY>>0}else sPreset="2";else if(_end.bounds.b<_begin.bounds.t)if(_end.x<_begin.x){sPreset="4";flipH=true;flipV=true;oMapAdj["adj1"]=-(1E5*(_begin.bounds.r+CONNECTOR_MARGIN-_begin.x)/extX+.5>>0);oMapAdj["adj2"]=1E5*(_begin.y-(_end.bounds.t-CONNECTOR_MARGIN))/ extY+.5>>0}else{sPreset="4";flipV=true;oMapAdj["adj1"]=1E5*(Math.max(_begin.bounds.r,_end.bounds.r)+CONNECTOR_MARGIN-_begin.x)/extX>>0;oMapAdj["adj2"]=1E5*(_begin.y-(_end.bounds.t-CONNECTOR_MARGIN))/extY+.5>>0}else if(_end.y<_begin.y)if(_end.x<_begin.x){sPreset="4";flipH=true;flipV=true;oMapAdj["adj1"]=-(1E5*(_begin.bounds.r+CONNECTOR_MARGIN-_begin.x)/extX+.5>>0);oMapAdj["adj2"]=1E5*(_begin.y-(_end.bounds.t-CONNECTOR_MARGIN))/extY+.5>>0}else{sPreset="4";flipV=true;oMapAdj["adj1"]=1E5*(Math.max(_begin.bounds.r, _end.bounds.r)+CONNECTOR_MARGIN-_begin.x)/extX+.5>>0;oMapAdj["adj2"]=1E5*(_begin.y-(_end.bounds.t-CONNECTOR_MARGIN))/extY+.5>>0}else if(_end.x>_begin.x)sPreset="2";else{sPreset="4";flipH=true;oMapAdj["adj1"]=-(1E5*(Math.max(_begin.bounds.r,_end.bounds.r)+CONNECTOR_MARGIN-_begin.x)/extX+.5)>>0;oMapAdj["adj2"]=-(1E5*(_begin.y-(Math.min(_begin.bounds.t,_end.bounds.t)-CONNECTOR_MARGIN))/extY+.5>>0)}break}case AscFormat.CARD_DIRECTION_S:{if(_end.bounds.l>_begin.bounds.r)if(_end.bounds.b<_begin.y){sPreset= "2";flipV=true}else if(_end.y<_begin.y){sPreset="4";flipV=true;oMapAdj["adj2"]=-(1E5*((_end.bounds.b+CONNECTOR_MARGIN-_end.y)/extY)+.5>>0);oMapAdj["adj1"]=1E5*((_begin.bounds.r+_end.bounds.l)/2-_begin.x)/extX+.5>>0}else{sPreset="4";oMapAdj["adj1"]=1E5*(((_begin.bounds.r+_end.bounds.l)/2-_begin.x)/extX)+.5>>0;oMapAdj["adj2"]=1E5+(1E5*((_end.bounds.b+CONNECTOR_MARGIN-_end.y)/extY)+.5>>0)}else if(_end.bounds.b<_begin.bounds.t)if(_end.x>_begin.bounds.r){sPreset="2";flipV=true}else{sPreset="4";flipH=true; flipV=true;oMapAdj["adj1"]=-(1E5*(_begin.bounds.r+CONNECTOR_MARGIN-_begin.x)/extX+.5>>0);oMapAdj["adj2"]=1E5*(_begin.y-(_end.bounds.b+_begin.bounds.t)/2)/extY+.5>>0}else if(_end.x<_begin.x)if(_end.y>_begin.y){sPreset="4";flipH=true;oMapAdj["adj1"]=-(1E5*(Math.max(_begin.bounds.r,_end.bounds.r)+CONNECTOR_MARGIN-_begin.x)/extX+.5>>0);oMapAdj["adj2"]=1E5*((Math.max(_end.bounds.b,_begin.bounds.b)-_begin.y+CONNECTOR_MARGIN)/extY)+.5>>0}else{sPreset="4";flipH=true;flipV=true;oMapAdj["adj1"]=-(1E5*(Math.max(_begin.bounds.r, _end.bounds.r)+CONNECTOR_MARGIN-_begin.x)/extX+.5>>0);oMapAdj["adj2"]=-(1E5*((Math.max(_end.bounds.b,_begin.bounds.b)-_begin.y+CONNECTOR_MARGIN)/extY)+.5)>>0}else if(_end.y>_begin.y){sPreset="4";oMapAdj["adj1"]=1E5*(Math.max(_begin.bounds.r,_end.bounds.r)+CONNECTOR_MARGIN-_begin.x)/extX+.5>>0;oMapAdj["adj2"]=1E5*(_end.bounds.b+CONNECTOR_MARGIN-_begin.y)/extY+.5>>0}else{sPreset="2";flipV=true}break}case AscFormat.CARD_DIRECTION_W:{if(_begin.x<_end.x){sPreset="3";flipV=_begin.y>_end.y}else{sPreset= "5";if(_end.bounds.t>_begin.bounds.b){flipH=true;oMapAdj["adj1"]=-(1E5*(_begin.bounds.r+CONNECTOR_MARGIN-_begin.x)/extX+.5>>0);oMapAdj["adj2"]=1E5*((_end.bounds.t+_begin.bounds.b)/2-_begin.y)/extY+.5>>0;oMapAdj["adj3"]=1E5*(_begin.x-(_end.bounds.l-CONNECTOR_MARGIN))/extX+.5>>0}else if(_end.bounds.b<_begin.bounds.t){flipH=true;flipV=true;oMapAdj["adj1"]=-(1E5*(_begin.bounds.r+CONNECTOR_MARGIN-_begin.x)/extX+.5>>0);oMapAdj["adj2"]=1E5*(_begin.y-(_end.bounds.b+_begin.bounds.t)/2)/extY+.5>>0;oMapAdj["adj3"]= 1E5*(_begin.x-(_end.bounds.l-CONNECTOR_MARGIN))/extX+.5>>0}else if(_end.y>_begin.y){flipH=true;oMapAdj["adj1"]=-(1E5*(_begin.bounds.r+CONNECTOR_MARGIN-_begin.x)/extX+.5>>0);oMapAdj["adj2"]=1E5*(Math.max(_begin.bounds.b,_end.bounds.b)+CONNECTOR_MARGIN-_begin.y)/extY+.5>>0;oMapAdj["adj3"]=1E5*(_begin.x-(_end.bounds.l-CONNECTOR_MARGIN))/extX+.5>>0}else{flipH=true;flipV=true;oMapAdj["adj1"]=-(1E5*(_begin.bounds.r+CONNECTOR_MARGIN-_begin.x)/extX+.5>>0);oMapAdj["adj2"]=1E5*(_begin.y-(Math.min(_begin.bounds.t, _end.bounds.t)-CONNECTOR_MARGIN))/extY+.5>>0;oMapAdj["adj3"]=1E5*(_begin.x-(_end.bounds.l-CONNECTOR_MARGIN))/extX+.5>>0}}break}case AscFormat.CARD_DIRECTION_E:{if(_end.bounds.l>_begin.bounds.r)if(_end.bounds.b<_begin.y){sPreset="3";flipV=true;oMapAdj["adj1"]=1E5*(_end.bounds.r+CONNECTOR_MARGIN-_begin.x)/extX>>0}else if(_end.bounds.t>_begin.y){sPreset="3";oMapAdj["adj1"]=1E5+(1E5*(CONNECTOR_MARGIN/extX)+.5)>>0}else if(_end.y<_begin.y){sPreset="5";flipV=true;oMapAdj["adj1"]=1E5*((_end.bounds.l+_begin.bounds.r)/ 2-_begin.x)/extX+.5>>0;oMapAdj["adj2"]=1E5+1E5*(_end.y-(_end.bounds.t-CONNECTOR_MARGIN))/extY+.5>>0;oMapAdj["adj3"]=1E5+(1E5*(_end.bounds.r+CONNECTOR_MARGIN-_end.x)/extX+.5)>>0}else{sPreset="5";oMapAdj["adj1"]=1E5*((_end.bounds.l+_begin.bounds.r)/2-_begin.x)/extX+.5>>0;oMapAdj["adj2"]=-(1E5*(_begin.y-(_end.bounds.t-CONNECTOR_MARGIN))/extY+.5)>>0;oMapAdj["adj3"]=1E5+(1E5*(_end.bounds.r+CONNECTOR_MARGIN-_end.x)/extX+.5)>>0}else if(_end.x>=_begin.bounds.l||_end.y>_begin.bounds.b||_end.y<_begin.bounds.t)if(_end.y< _begin.y)if(_end.x<_begin.x){flipH=true;flipV=true;sPreset="3";oMapAdj["adj1"]=-(1E5*(Math.max(_end.bounds.r,_begin.bounds.r)+CONNECTOR_MARGIN-_begin.x)/extX+.5)>>0}else{flipV=true;sPreset="3";oMapAdj["adj1"]=1E5+(1E5*(Math.max(_end.bounds.r,_begin.bounds.r)+CONNECTOR_MARGIN-_end.x)/extX+.5)>>0}else if(_end.x<_begin.x){flipH=true;sPreset="3";oMapAdj["adj1"]=-(1E5*(Math.max(_end.bounds.r,_begin.bounds.r)+CONNECTOR_MARGIN-_begin.x)/extX+.5)>>0}else{sPreset="3";oMapAdj["adj1"]=1E5+(1E5*(Math.max(_end.bounds.r, _begin.bounds.r)+CONNECTOR_MARGIN-_end.x)/extX+.5)>>0}else if(_end.y>=_begin.y){sPreset="5";flipH=true;oMapAdj["adj1"]=-(1E5*(CONNECTOR_MARGIN/extX)+.5>>0);oMapAdj["adj2"]=1E5+1E5*(_begin.bounds.b+CONNECTOR_MARGIN-_end.y)/extY+.5>>0;oMapAdj["adj3"]=1E5*(_begin.x-(_end.bounds.r+_begin.bounds.l)/2)/extX+.5>>0}else{sPreset="5";flipH=true;flipV=true;oMapAdj["adj1"]=-(1E5*(CONNECTOR_MARGIN/extX)+.5>>0);oMapAdj["adj2"]=-(1E5*(_begin.bounds.b+CONNECTOR_MARGIN-_begin.y)/extY+.5)>>0;oMapAdj["adj3"]=1E5*(_begin.x- (_end.bounds.r+_begin.bounds.l)/2)/extX+.5>>0}break}}sPreset=sPrefix+sPreset}var _posX=(end.x+begin.x)/2-extX/2;var _posY=(end.y+begin.y)/2-extY/2;var _fAng=AscFormat.normalizeRotate(rot-fAngle);var oGeometry=AscFormat.CreateGeometry(sPreset);for(var key in oMapAdj)if(oMapAdj.hasOwnProperty(key))oGeometry.setAdjValue(key,oMapAdj[key]);oSpPr.setGeometry(oGeometry);oGeometry.setParent(oSpPr);oXfrm.setOffX(_posX);oXfrm.setOffY(_posY);oXfrm.setExtX(extX);oXfrm.setExtY(extY);oXfrm.setRot(_fAng);oXfrm.setFlipH(flipH); oXfrm.setFlipV(flipV);return oSpPr},this,[])}function fCalculateConnectionInfo(oConnInfo,x,y){var oConnecInfo2=new ConnectionParams;oConnecInfo2.x=x;oConnecInfo2.y=y;oConnecInfo2.bounds.fromOther(new AscFormat.CGraphicBounds(x,y,x,y));var diffX=x-oConnInfo.x;var diffY=y-oConnInfo.y;if(Math.abs(diffX)>Math.abs(diffY))if(diffX<0)oConnecInfo2.dir=AscFormat.CARD_DIRECTION_E;else oConnecInfo2.dir=AscFormat.CARD_DIRECTION_W;else if(diffY<0)oConnecInfo2.dir=AscFormat.CARD_DIRECTION_S;else oConnecInfo2.dir= AscFormat.CARD_DIRECTION_N;return oConnecInfo2}function CConnectionShape(){AscFormat.CShape.call(this)}CConnectionShape.prototype=Object.create(AscFormat.CShape.prototype);CConnectionShape.prototype.constructor=CConnectionShape;CConnectionShape.prototype.getObjectType=function(){return AscDFH.historyitem_type_Cnx};CConnectionShape.prototype.copy=function(oPr){var copy=new CConnectionShape;this.fillObject(copy);return copy};CConnectionShape.prototype.resetShape=function(oShape){if(!this.nvSpPr)return; var cnxPr=this.nvSpPr.nvUniSpPr;if(cnxPr.stCnxId===oShape.Id||cnxPr.endCnxId===oShape.Id){var oNewPr=cnxPr.copy();if(cnxPr.stCnxId===oShape.Id){oNewPr.stCnxId=null;oNewPr.stCnxIdx=null}if(cnxPr.endCnxId===oShape.Id){oNewPr.endCnxId=null;oNewPr.endCnxIdx=null}this.nvSpPr.setUniSpPr(oNewPr)}};CConnectionShape.prototype.getStCxnId=function(){return this.nvSpPr.nvUniSpPr.stCnxId};CConnectionShape.prototype.getEndCxnId=function(){return this.nvSpPr.nvUniSpPr.endCnxId};CConnectionShape.prototype.getStCxnIdx= function(){return this.nvSpPr.nvUniSpPr.stCnxIdx};CConnectionShape.prototype.getEndCxnIdx=function(){return this.nvSpPr.nvUniSpPr.endCnxIdx};CConnectionShape.prototype.assignConnection=function(oObjectsMap){var oPr=this.nvSpPr.nvUniSpPr;var oStartSp,oEndSp;var oCnx;var aCnx;if(AscFormat.isRealNumber(oPr.stCnxId)){oStartSp=oObjectsMap[oPr.stCnxId];if(AscCommon.isRealObject(oStartSp)){aCnx=oStartSp.getGeom().cnxLstInfo;if(aCnx)oCnx=aCnx[oPr.stCnxIdx];if(oCnx)oPr.stCnxId=oStartSp.Id;else{oPr.stCnxId= null;oPr.stCnxIdx=null}}else{oPr.stCnxId=null;oPr.stCnxIdx=null}}if(AscFormat.isRealNumber(oPr.endCnxId)){oEndSp=oObjectsMap[oPr.endCnxId];if(AscCommon.isRealObject(oEndSp)){aCnx=oEndSp.getGeom().cnxLstInfo;if(aCnx)oCnx=aCnx[oPr.endCnxIdx];if(oCnx)oPr.endCnxId=oEndSp.Id;else{oPr.endCnxId=null;oPr.endCnxIdx=null}}else{oPr.endCnxId=null;oPr.endCnxIdx=null}}this.nvSpPr.setUniSpPr(oPr.copy())};CConnectionShape.prototype.calculateTransform=function(bMove){var oBeginDrawing=null;var oEndDrawing=null;var sStId= this.getStCxnId();var sEndId=this.getEndCxnId();var _group;if(null!==sStId){oBeginDrawing=AscCommon.g_oTableId.Get_ById(sStId);if(oBeginDrawing&&oBeginDrawing.bDeleted)oBeginDrawing=null;if(oBeginDrawing){_group=oBeginDrawing.getMainGroup();if(_group)_group.recalculate();else oBeginDrawing.recalculate()}}if(null!==sEndId){oEndDrawing=AscCommon.g_oTableId.Get_ById(sEndId);if(oEndDrawing&&oEndDrawing.bDeleted)oEndDrawing=null;if(oEndDrawing){_group=oEndDrawing.getMainGroup();if(_group)_group.recalculate(); else oEndDrawing.recalculate()}}var _startConnectionParams,_endConnectionParams,_spPr,_xfrm2;var _xfrm=this.spPr.xfrm;if(oBeginDrawing&&oEndDrawing){_startConnectionParams=oBeginDrawing.getConnectionParams(this.getStCxnIdx(),null);_endConnectionParams=oEndDrawing.getConnectionParams(this.getEndCxnIdx(),null);_spPr=AscFormat.fCalculateSpPr(_startConnectionParams,_endConnectionParams,this.spPr.geometry.preset,this.pen.w);_xfrm2=_spPr.xfrm;_xfrm.setExtX(_xfrm2.extX);_xfrm.setExtY(_xfrm2.extY);if(!this.group){_xfrm.setOffX(_xfrm2.offX); _xfrm.setOffY(_xfrm2.offY);_xfrm.setFlipH(_xfrm2.flipH);_xfrm.setFlipV(_xfrm2.flipV);_xfrm.setRot(_xfrm2.rot)}else{var _xc=_xfrm2.offX+_xfrm2.extX/2;var _yc=_xfrm2.offY+_xfrm2.extY/2;var xc=this.group.invertTransform.TransformPointX(_xc,_yc);var yc=this.group.invertTransform.TransformPointY(_xc,_yc);_xfrm.setOffX(xc-_xfrm2.extX/2);_xfrm.setOffY(yc-_xfrm2.extY/2);_xfrm.setFlipH(this.group.getFullFlipH()?!_xfrm2.flipH:_xfrm2.flipH);_xfrm.setFlipV(this.group.getFullFlipV()?!_xfrm2.flipV:_xfrm2.flipV); _xfrm.setRot(AscFormat.normalizeRotate(_xfrm2.rot-this.group.getFullRotate()))}this.spPr.setGeometry(_spPr.geometry.createDuplicate());this.checkDrawingBaseCoords();this.recalculate()}else if(oBeginDrawing||oEndDrawing)if(bMove){var _x,_y;var _spX,_spY,diffX,diffY,bChecked=false;var _oCnxInfo;var _groupTransform;if(oBeginDrawing){_oCnxInfo=oBeginDrawing.getGeom().cnxLst[this.getStCxnIdx()];if(_oCnxInfo){_spX=oBeginDrawing.transform.TransformPointX(_oCnxInfo.x,_oCnxInfo.y);_spY=oBeginDrawing.transform.TransformPointY(_oCnxInfo.x, _oCnxInfo.y);_x=this.transform.TransformPointX(0,0);_y=this.transform.TransformPointY(0,0);bChecked=true}}else{_oCnxInfo=oEndDrawing.getGeom().cnxLst[this.getEndCxnIdx()];if(_oCnxInfo){_spX=oEndDrawing.transform.TransformPointX(_oCnxInfo.x,_oCnxInfo.y);_spY=oEndDrawing.transform.TransformPointY(_oCnxInfo.x,_oCnxInfo.y);_x=this.transform.TransformPointX(this.extX,this.extY);_y=this.transform.TransformPointY(this.extX,this.extY);bChecked=true}}if(bChecked){if(this.group){_groupTransform=this.group.invertTransform.CreateDublicate(); _groupTransform.tx=0;_groupTransform.ty=0;diffX=_groupTransform.TransformPointX(_spX-_x,_spY-_y);diffY=_groupTransform.TransformPointY(_spX-_x,_spY-_y)}else{diffX=_spX-_x;diffY=_spY-_y}this.spPr.xfrm.setOffX(this.spPr.xfrm.offX+diffX);this.spPr.xfrm.setOffY(this.spPr.xfrm.offY+diffY);this.recalculate()}}else{if(oBeginDrawing)_startConnectionParams=oBeginDrawing.getConnectionParams(this.getStCxnIdx(),null);if(oEndDrawing)_endConnectionParams=oEndDrawing.getConnectionParams(this.getEndCxnIdx(),null); var _tx,_ty;if(_startConnectionParams||_endConnectionParams){if(!_startConnectionParams){_tx=this.transform.TransformPointX(0,0);_ty=this.transform.TransformPointY(0,0);_startConnectionParams=AscFormat.fCalculateConnectionInfo(_endConnectionParams,_tx,_ty)}if(!_endConnectionParams){_tx=this.transform.TransformPointX(this.extX,this.extY);_ty=this.transform.TransformPointY(this.extX,this.extY);_endConnectionParams=AscFormat.fCalculateConnectionInfo(_startConnectionParams,_tx,_ty)}_spPr=AscFormat.fCalculateSpPr(_startConnectionParams, _endConnectionParams,this.spPr.geometry.preset,this.pen&&this.pen.w);_xfrm2=_spPr.xfrm;_xfrm.setExtX(_xfrm2.extX);_xfrm.setExtY(_xfrm2.extY);if(!this.group){_xfrm.setOffX(_xfrm2.offX);_xfrm.setOffY(_xfrm2.offY);_xfrm.setFlipH(_xfrm2.flipH);_xfrm.setFlipV(_xfrm2.flipV);_xfrm.setRot(_xfrm2.rot)}else{var _xc=_xfrm2.offX+_xfrm2.extX/2;var _yc=_xfrm2.offY+_xfrm2.extY/2;var xc=this.group.invertTransform.TransformPointX(_xc,_yc);var yc=this.group.invertTransform.TransformPointY(_xc,_yc);_xfrm.setOffX(xc- _xfrm2.extX/2);_xfrm.setOffY(yc-_xfrm2.extY/2);_xfrm.setFlipH(this.group.getFullFlipH()?!_xfrm2.flipH:_xfrm2.flipH);_xfrm.setFlipV(this.group.getFullFlipV()?!_xfrm2.flipV:_xfrm2.flipV);_xfrm.setRot(AscFormat.normalizeRotate(_xfrm2.rot-this.group.getFullRotate()))}this.spPr.setGeometry(_spPr.geometry.createDuplicate());this.checkDrawingBaseCoords();this.recalculate()}}};window["AscFormat"]=window["AscFormat"]||{};window["AscFormat"].fCalculateSpPr=fCalculateSpPr;window["AscFormat"].fCalculateConnectionInfo= fCalculateConnectionInfo;window["AscFormat"].ConnectionParams=ConnectionParams;window["AscFormat"].CConnectionShape=CConnectionShape})();"use strict";(function(window,undefined){var moveTo=0,lineTo=1,arcTo=2,bezier3=3,bezier4=4,close=5;var cToRad=AscFormat.cToRad;var HitToArc=AscFormat.HitToArc;var ArcToCurvers=AscFormat.ArcToCurvers;var ArcToOnCanvas=AscFormat.ArcToOnCanvas;var HitInLine=AscFormat.HitInLine;var HitInBezier4=AscFormat.HitInBezier4;var HitInBezier3=AscFormat.HitInBezier3;var MOVE_DELTA= AscFormat.MOVE_DELTA;var History=AscCommon.History;var cToRad2=Math.PI/6E4/180;function CChangesDrawingsAddPathCommand(Class,oCommand,nIndex,bReverse){this.Type=AscDFH.historyitem_PathAddPathCommand;this.Command=oCommand;this.Index=nIndex;this.bReverse=bReverse;AscDFH.CChangesBase.call(this,Class)}CChangesDrawingsAddPathCommand.prototype=Object.create(AscDFH.CChangesBase.prototype);CChangesDrawingsAddPathCommand.prototype.constructor=CChangesDrawingsAddPathCommand;CChangesDrawingsAddPathCommand.prototype.Undo= function(){if(this.bReverse)this.Class.ArrPathCommandInfo.splice(this.Index,0,this.Command);else this.Class.ArrPathCommandInfo.splice(this.Index,1)};CChangesDrawingsAddPathCommand.prototype.Redo=function(){if(this.bReverse)this.Class.ArrPathCommandInfo.splice(this.Index,1);else this.Class.ArrPathCommandInfo.splice(this.Index,0,this.Command)};CChangesDrawingsAddPathCommand.prototype.WriteToBinary=function(Writer){Writer.WriteLong(this.Index);Writer.WriteLong(this.Command.id);Writer.WriteBool(!!this.bReverse); switch(this.Command.id){case moveTo:case lineTo:{Writer.WriteString2(this.Command.X);Writer.WriteString2(this.Command.Y);break}case bezier3:{Writer.WriteString2(this.Command.X0);Writer.WriteString2(this.Command.Y0);Writer.WriteString2(this.Command.X1);Writer.WriteString2(this.Command.Y1);break}case bezier4:{Writer.WriteString2(this.Command.X0);Writer.WriteString2(this.Command.Y0);Writer.WriteString2(this.Command.X1);Writer.WriteString2(this.Command.Y1);Writer.WriteString2(this.Command.X2);Writer.WriteString2(this.Command.Y2); break}case arcTo:{Writer.WriteString2(this.Command.hR);Writer.WriteString2(this.Command.wR);Writer.WriteString2(this.Command.stAng);Writer.WriteString2(this.Command.swAng);break}case close:{break}}};CChangesDrawingsAddPathCommand.prototype.ReadFromBinary=function(Reader){this.Index=Reader.GetLong();this.Command={};this.Command.id=Reader.GetLong();this.bReverse=Reader.GetBool();switch(this.Command.id){case moveTo:case lineTo:{this.Command.X=Reader.GetString2();this.Command.Y=Reader.GetString2();break}case bezier3:{this.Command.X0= Reader.GetString2();this.Command.Y0=Reader.GetString2();this.Command.X1=Reader.GetString2();this.Command.Y1=Reader.GetString2();break}case bezier4:{this.Command.X0=Reader.GetString2();this.Command.Y0=Reader.GetString2();this.Command.X1=Reader.GetString2();this.Command.Y1=Reader.GetString2();this.Command.X2=Reader.GetString2();this.Command.Y2=Reader.GetString2();break}case arcTo:{this.Command.hR=Reader.GetString2();this.Command.wR=Reader.GetString2();this.Command.stAng=Reader.GetString2();this.Command.swAng= Reader.GetString2();break}case close:{break}}};AscDFH.changesFactory[AscDFH.historyitem_PathSetStroke]=AscDFH.CChangesDrawingsBool;AscDFH.changesFactory[AscDFH.historyitem_PathSetExtrusionOk]=AscDFH.CChangesDrawingsBool;AscDFH.changesFactory[AscDFH.historyitem_PathSetFill]=AscDFH.CChangesDrawingsString;AscDFH.changesFactory[AscDFH.historyitem_PathSetPathH]=AscDFH.CChangesDrawingsLong;AscDFH.changesFactory[AscDFH.historyitem_PathSetPathW]=AscDFH.CChangesDrawingsLong;AscDFH.changesFactory[AscDFH.historyitem_PathAddPathCommand]= CChangesDrawingsAddPathCommand;AscDFH.drawingsChangesMap[AscDFH.historyitem_PathSetStroke]=function(oClass,value){oClass.stroke=value};AscDFH.drawingsChangesMap[AscDFH.historyitem_PathSetExtrusionOk]=function(oClass,value){oClass.extrusionOk=value};AscDFH.drawingsChangesMap[AscDFH.historyitem_PathSetFill]=function(oClass,value){oClass.fill=value};AscDFH.drawingsChangesMap[AscDFH.historyitem_PathSetPathH]=function(oClass,value){oClass.pathH=value};AscDFH.drawingsChangesMap[AscDFH.historyitem_PathSetPathW]= function(oClass,value){oClass.pathW=value};function Path(){this.stroke=null;this.extrusionOk=null;this.fill=null;this.pathH=null;this.pathW=null;this.ArrPathCommandInfo=[];this.ArrPathCommand=[];this.Id=AscCommon.g_oIdCounter.Get_NewId();AscCommon.g_oTableId.Add(this,this.Id)}Path.prototype={Get_Id:function(){return this.Id},getObjectType:function(){return AscDFH.historyitem_type_Path},Write_ToBinary2:function(w){w.WriteLong(this.getObjectType());w.WriteString2(this.Get_Id())},Read_FromBinary2:function(r){this.Id= r.GetString2()},Refresh_RecalcData:function(){},createDuplicate:function(){var p=new Path;p.setStroke(this.stroke);p.setExtrusionOk(this.extrusionOk);p.setFill(this.fill);p.setPathH(this.pathH);p.setPathW(this.pathW);for(var i=0;i MOVE_DELTA)cw=gdLst["w"]/this.pathW;else cw=0;else cw=1;if(this.pathH!=undefined)if(this.pathH>MOVE_DELTA)ch=gdLst["h"]/this.pathH;else ch=0;else ch=1;var APCI=this.ArrPathCommandInfo,n=APCI.length,cmd;var x0,y0,x1,y1,x2,y2,wR,hR,stAng,swAng,lastX,lastY;for(var i=0;i0&&a3<0)swAng-=216E5;if(swAng<0&&a3>0)swAng+=216E5;if(swAng==0&&a3!=0)swAng=216E5;var a=wR*cw;var b=hR*ch;var sin2=Math.sin(stAng*cToRad);var cos2=Math.cos(stAng*cToRad);var _xrad=cos2/a;var _yrad=sin2/b; var l=1/Math.sqrt(_xrad*_xrad+_yrad*_yrad);var xc=lastX-l*cos2;var yc=lastY-l*sin2;var sin1=Math.sin((stAng+swAng)*cToRad);var cos1=Math.cos((stAng+swAng)*cToRad);var _xrad1=cos1/a;var _yrad1=sin1/b;var l1=1/Math.sqrt(_xrad1*_xrad1+_yrad1*_yrad1);this.ArrPathCommand[i]={id:arcTo,stX:lastX,stY:lastY,wR:wR*cw,hR:hR*ch,stAng:stAng*cToRad,swAng:swAng*cToRad};lastX=xc+l1*cos1;lastY=yc+l1*sin1;break}case close:{this.ArrPathCommand[i]={id:close};break}default:{break}}}if(bResetPathsInfo)delete this.ArrPathCommandInfo}, recalculate2:function(gdLst,bResetPathsInfo){var k=1E-9;var APCI=this.ArrPathCommandInfo,n=APCI.length,cmd;var stAng,swAng,lastX,lastY;for(var i=0;i0&&a3<0)swAng-=216E5;if(swAng<0&&a3>0)swAng+=216E5;if(swAng==0&&a3!=0)swAng=216E5;var a=cmd.wR*k;var b=cmd.hR*k;var sin2=Math.sin(stAng*cToRad);var cos2=Math.cos(stAng*cToRad);var _xrad=cos2/a;var _yrad=sin2/ b;var l=1/Math.sqrt(_xrad*_xrad+_yrad*_yrad);var xc=lastX-l*cos2;var yc=lastY-l*sin2;var sin1=Math.sin((stAng+swAng)*cToRad);var cos1=Math.cos((stAng+swAng)*cToRad);var _xrad1=cos1/a;var _yrad1=sin1/b;var l1=1/Math.sqrt(_xrad1*_xrad1+_yrad1*_yrad1);this.ArrPathCommand[i]={id:arcTo,stX:lastX,stY:lastY,wR:cmd.wR*k,hR:cmd.hR*k,stAng:stAng*cToRad,swAng:swAng*cToRad};lastX=xc+l1*cos1;lastY=yc+l1*sin1;break}case close:{this.ArrPathCommand[i]={id:close};break}default:{break}}}{delete this.ArrPathCommandInfo}}, draw:function(shape_drawer){if(shape_drawer.bIsCheckBounds===true&&this.fill=="none")return;var bIsDrawLast=false;var path=this.ArrPathCommand;shape_drawer._s();for(var j=0,l=path.length;j>0,1);_ctx.lineWidth= _lineWidth;if((_lineWidth&1)==1)bIsEven=true;if(_graphics.dash_no_smart){for(var index=0;index<_graphics.dash_no_smart.length;index++)_graphics.dash_no_smart[index]=_graphics.m_oCoordTransform.sx*_graphics.dash_no_smart[index]+.5>>0;_graphics.m_oContext.setLineDash(_graphics.dash_no_smart);_graphics.dash_no_smart=null}}var bIsDrawLast=false;var path=this.ArrPathCommand;shape_drawer._s();if(!isRect)for(var j=0,l=path.length;j>0;var _y=_full_trans.TransformPointY(cmd.X,cmd.Y)>>0;if(bIsEven){_x-=.5;_y-=.5}_ctx.moveTo(_x,_y);break}case lineTo:{bIsDrawLast=true;var _x=_full_trans.TransformPointX(cmd.X,cmd.Y)>>0;var _y=_full_trans.TransformPointY(cmd.X,cmd.Y)>>0;if(bIsEven){_x-=.5;_y-=.5}_ctx.lineTo(_x,_y);break}case close:{_ctx.closePath();break}}}else{var minX=1E5;var minY=1E5;var maxX=-1E5;var maxY=-1E5;bIsDrawLast=true;for(var j=0,l=path.length;j cmd.X)minX=cmd.X;if(minY>cmd.Y)minY=cmd.Y;if(maxX>0;var _y1=_full_trans.TransformPointY(minX,minY)>>0;var _x2=_full_trans.TransformPointX(maxX,maxY)>>0;var _y2=_full_trans.TransformPointY(maxX,maxY)>>0;if(bIsEven)_ctx.rect(_x1+.5,_y1+.5,_x2-_x1,_y2-_y1);else _ctx.rect(_x1,_y1,_x2-_x1,_y2-_y1)}if(bIsDrawLast)shape_drawer.drawFillStroke(true,this.fill,bIsStroke);shape_drawer._e();if(false== _old_int)_graphics.SetIntegerGrid(false)},isEmpty:function(){return this.ArrPathCommandInfo.length>0},checkBetweenPolygons:function(oBoundsController,oPolygonWrapper1,oPolygonWrapper2){},checkByPolygon:function(oPolygon,bFlag,XLimit,ContentHeight,dKoeff,oBounds){},transform:function(oTransform,dKoeff){}};function CheckPointByPaths(dX,dY,dWidth,dHeight,dMinX,dMinY,oPolygonWrapper1,oPolygonWrapper2){var cX,cY,point,topX,topY,bottomX,bottomY;cX=(dX-dMinX)/dWidth;cY=(dY-dMinY)/dHeight;if(cX>1)cX=1;if(cX< 0)cX=0;point=oPolygonWrapper1.getPointOnPolygon(cX);topX=point.x;topY=point.y;point=oPolygonWrapper2.getPointOnPolygon(cX);bottomX=point.x;bottomY=point.y;return{x:topX+cY*(bottomX-topX),y:topY+cY*(bottomY-topY)}}function Path2(oPathMemory){this.stroke=null;this.extrusionOk=null;this.fill=null;this.pathH=null;this.pathW=null;this.startPos=0;this.size=25;this.PathMemory=oPathMemory;this.ArrPathCommand=oPathMemory.ArrPathCommand;this.curLen=0;this.lastX=null;this.lastY=null;this.bEmpty=true}Path2.prototype= {isEmpty:function(){return this.bEmpty},checkArray:function(nSize){this.bEmpty=false;this.ArrPathCommand[this.startPos]+=nSize;this.PathMemory.curPos=this.startPos+this.ArrPathCommand[this.startPos];if(this.PathMemory.curPos+1>this.ArrPathCommand.length){var aNewArray=new Float64Array((3/2*(this.PathMemory.curPos+1)>>0)+1);for(var i=0;i0&&a3<0)swAng-=216E5;if(swAng< 0&&a3>0)swAng+=216E5;if(swAng==0&&a3!=0)swAng=216E5;var a=wR*1E-9;var b=hR*1E-9;var sin2=Math.sin(stAng*cToRad);var cos2=Math.cos(stAng*cToRad);var _xrad=cos2/a;var _yrad=sin2/b;var l=1/Math.sqrt(_xrad*_xrad+_yrad*_yrad);var xc=this.lastX-l*cos2;var yc=this.lastY-l*sin2;var sin1=Math.sin((stAng+swAng)*cToRad);var cos1=Math.cos((stAng+swAng)*cToRad);var _xrad1=cos1/a;var _yrad1=sin1/b;var l1=1/Math.sqrt(_xrad1*_xrad1+_yrad1*_yrad1);this.checkArray(7);this.ArrPathCommand[this.startPos+this.curLen++ + 1]=arcTo;this.ArrPathCommand[this.startPos+this.curLen++ +1]=this.lastX;this.ArrPathCommand[this.startPos+this.curLen++ +1]=this.lastY;this.ArrPathCommand[this.startPos+this.curLen++ +1]=wR*1E-9;this.ArrPathCommand[this.startPos+this.curLen++ +1]=hR*1E-9;this.ArrPathCommand[this.startPos+this.curLen++ +1]=stAng*cToRad;this.ArrPathCommand[this.startPos+this.curLen++ +1]=swAng*cToRad},quadBezTo:function(x0,y0,x1,y1){this.lastX=x1*1E-9;this.lastY=y1*1E-9;this.checkArray(5);this.ArrPathCommand[this.startPos+ this.curLen++ +1]=bezier3;this.ArrPathCommand[this.startPos+this.curLen++ +1]=x0*1E-9;this.ArrPathCommand[this.startPos+this.curLen++ +1]=y0*1E-9;this.ArrPathCommand[this.startPos+this.curLen++ +1]=this.lastX;this.ArrPathCommand[this.startPos+this.curLen++ +1]=this.lastY},cubicBezTo:function(x0,y0,x1,y1,x2,y2){this.lastX=x2*1E-9;this.lastY=y2*1E-9;this.checkArray(7);this.ArrPathCommand[this.startPos+this.curLen++ +1]=bezier4;this.ArrPathCommand[this.startPos+this.curLen++ +1]=x0*1E-9;this.ArrPathCommand[this.startPos+ this.curLen++ +1]=y0*1E-9;this.ArrPathCommand[this.startPos+this.curLen++ +1]=x1*1E-9;this.ArrPathCommand[this.startPos+this.curLen++ +1]=y1*1E-9;this.ArrPathCommand[this.startPos+this.curLen++ +1]=this.lastX;this.ArrPathCommand[this.startPos+this.curLen++ +1]=this.lastY},close:function(){this.checkArray(1);this.ArrPathCommand[this.startPos+this.curLen++ +1]=close},draw:function(shape_drawer){if(this.isEmpty())return;if(shape_drawer.bIsCheckBounds===true&&this.fill=="none")return;var bIsDrawLast= false;var path=this.ArrPathCommand;shape_drawer._s();var i=0;var len=this.PathMemory.ArrPathCommand[this.startPos];while(i1)return false;var cmd=path[this.startPos+i+1];switch(cmd){case moveTo:{if(0!==commandIndex)return false;i+=3;break}case lineTo:{if(1!==commandIndex)return false;i+=3;break}default:{return false}}++commandIndex}return true},isSmartRect:function(){var i=0;var path=this.PathMemory.ArrPathCommand; var len=path[this.startPos];var commandIndex=0;var x0,y0,x1,y1,x2,y2,x3,y3,x4,y4,isCommand4Close=false;while(i4)return false;var cmd=path[this.startPos+i+1];switch(cmd){case moveTo:{if(0!==commandIndex)return false;x0=path[this.startPos+i+2];y0=path[this.startPos+i+3];i+=3;break}case lineTo:{if(commandIndex===1){x1=path[this.startPos+i+2];y1=path[this.startPos+i+3]}else if(commandIndex===2){x2=path[this.startPos+i+2];y2=path[this.startPos+i+3]}else if(commandIndex===3){x3=path[this.startPos+ i+2];y3=path[this.startPos+i+3]}else if(commandIndex===4){x4=path[this.startPos+i+2];y4=path[this.startPos+i+3]}i+=3;break}case close:{if(4!==commandIndex)return false;isCommand4Close=true;break}default:{return false}}++commandIndex}if(AscFormat.fApproxEqual(x0,x1)){if(AscFormat.fApproxEqual(y1,y2))if(AscFormat.fApproxEqual(x2,x3)&&AscFormat.fApproxEqual(y3,y0)){if(isCommand4Close)return true;if(AscFormat.fApproxEqual(x0,x4)&&AscFormat.fApproxEqual(y0,y4))return true}}else if(AscFormat.fApproxEqual(y0, y1))if(AscFormat.fApproxEqual(x1,x2))if(AscFormat.fApproxEqual(y2,y3)&&AscFormat.fApproxEqual(x3,x0)){if(isCommand4Close)return true;if(AscFormat.fApproxEqual(x0,x4)&&AscFormat.fApproxEqual(y0,y4))return true}return false},drawSmart:function(shape_drawer){var _graphics=shape_drawer.Graphics;var _full_trans=_graphics.m_oFullTransform;if(!_graphics||!_full_trans||undefined==_graphics.m_bIntegerGrid||true===shape_drawer.bIsNoSmartAttack)return this.draw(shape_drawer);var bIsTransformed=_full_trans.shx== 0&&_full_trans.shy==0?false:true;if(bIsTransformed)return this.draw(shape_drawer);var isLine=this.isSmartLine();var isRect=false;if(!isLine)isRect=this.isSmartRect();if(window["NATIVE_EDITOR_ENJINE"]||!isLine&&!isRect&&!shape_drawer.bDrawSmartAttack)return this.draw(shape_drawer);var _old_int=_graphics.m_bIntegerGrid;if(false==_old_int)_graphics.SetIntegerGrid(true);var dKoefMMToPx=Math.max(_graphics.m_oCoordTransform.sx,.001);var _ctx=_graphics.m_oContext;var bIsStroke=shape_drawer.bIsNoStrokeAttack|| this.stroke!==true?false:true;var bIsEven=false;if(bIsStroke){var _lineWidth=Math.max(shape_drawer.StrokeWidth*dKoefMMToPx+.5>>0,1);_ctx.lineWidth=_lineWidth;if((_lineWidth&1)==1)bIsEven=true}var bIsDrawLast=false;var path=this.ArrPathCommand;shape_drawer._s();if(!isRect){var i=0;var len=this.PathMemory.ArrPathCommand[this.startPos];var X,Y;while(i>0;var _y=_full_trans.TransformPointY(X,Y)>>0;if(bIsEven){_x-=.5;_y-=.5}_ctx.moveTo(_x,_y);if(_graphics.ArrayPoints!=null)_graphics.ArrayPoints.push({x:X,y:Y});i+=3;break}case lineTo:{bIsDrawLast=true;X=path[this.startPos+i+2];Y=path[this.startPos+i+3];var _x=_full_trans.TransformPointX(X,Y)>>0;var _y=_full_trans.TransformPointY(X,Y)>>0;if(bIsEven){_x-=.5;_y-=.5}_ctx.lineTo(_x,_y);if(_graphics.ArrayPoints!=null)_graphics.ArrayPoints.push({x:X,y:Y});i+=3;break}case bezier3:{bIsDrawLast=true;i+= 5;break}case bezier4:{bIsDrawLast=true;i+=7;break}case arcTo:{bIsDrawLast=true;i+=7;break}case close:{_ctx.closePath();i+=1;break}}}}else{var minX=1E5;var minY=1E5;var maxX=-1E5;var maxY=-1E5;bIsDrawLast=true;var i=0;var len=this.PathMemory.ArrPathCommand[this.startPos],X,Y;while(iX)minX=X;if(minY>Y)minY=Y;if(maxX>0;var _y1=_full_trans.TransformPointY(minX,minY)>>0;var _x2=_full_trans.TransformPointX(maxX,maxY)>>0;var _y2=_full_trans.TransformPointY(maxX,maxY)>>0;if(bIsEven)_ctx.rect(_x1+.5,_y1+.5,_x2-_x1,_y2-_y1);else _ctx.rect(_x1,_y1,_x2-_x1,_y2-_y1)}if(bIsDrawLast){shape_drawer.isArrPix=true;shape_drawer.drawFillStroke(true,this.fill, bIsStroke);shape_drawer.isArrPix=false}shape_drawer._e();if(false==_old_int)_graphics.SetIntegerGrid(false)},recalculate:function(gdLst,bResetPathsInfo){},recalculate2:function(gdLst,bResetPathsInfo){},transformPointPolygon:function(x,y,oPolygon,bFlag,XLimit,ContentHeight,dKoeff,oBounds){var oRet={x:0,y:0},y0,y1,cX,oPointOnPolygon,x1t,y1t,dX,dY,x0t,y0t;y0=y;if(bFlag){y1=0;if(oBounds)y0-=oBounds.min_y}else{y1=ContentHeight*dKoeff;if(oBounds){y1=oBounds.max_y-oBounds.min_y;y0-=oBounds.min_y}}cX=x/XLimit; oPointOnPolygon=oPolygon.getPointOnPolygon(cX,true);x1t=oPointOnPolygon.x;y1t=oPointOnPolygon.y;dX=oPointOnPolygon.oP2.x-oPointOnPolygon.oP1.x;dY=oPointOnPolygon.oP2.y-oPointOnPolygon.oP1.y;if(bFlag){dX=-dX;dY=-dY}var dNorm=Math.sqrt(dX*dX+dY*dY);if(bFlag){x0t=x1t+dY/dNorm*y0;y0t=y1t-dX/dNorm*y0}else{x0t=x1t+dY/dNorm*(y1-y0);y0t=y1t-dX/dNorm*(y1-y0)}oRet.x=x0t;oRet.y=y0t;return oRet},checkBetweenPolygons:function(oBoundsController,oPolygonWrapper1,oPolygonWrapper2){var path=this.ArrPathCommand;var i= 0;var len=this.PathMemory.ArrPathCommand[this.startPos];var p;var dMinX=oBoundsController.min_x,dMinY=oBoundsController.min_y,dWidth=oBoundsController.max_x-oBoundsController.min_x,dHeight=oBoundsController.max_y-oBoundsController.min_y;while(i0)AscCommon.CollaborativeEditing.Add_NewImage(value.RasterImageId)}; AscDFH.drawingsChangesMap[AscDFH.historyitem_ImageShapeSetParent]=function(oClass,value){oClass.parent=value};AscDFH.drawingsChangesMap[AscDFH.historyitem_ImageShapeSetGroup]=function(oClass,value){oClass.group=value};AscDFH.drawingsChangesMap[AscDFH.historyitem_ImageShapeSetStyle]=function(oClass,value){oClass.style=value};AscDFH.drawingsChangesMap[AscDFH.historyitem_ImageShapeSetNvPicPr]=function(oClass,value){oClass.nvPicPr=value};AscDFH.drawingsConstructorsMap[AscDFH.historyitem_ImageShapeSetBlipFill]= AscFormat.CBlipFill;function CImageShape(){AscFormat.CGraphicObjectBase.call(this);this.nvPicPr=null;this.blipFill=null;this.style=null;this.cropBrush=false;this.isCrop=false;this.parentCrop=null;this.shdwSp=null}CImageShape.prototype=Object.create(AscFormat.CGraphicObjectBase.prototype);CImageShape.prototype.constructor=CImageShape;CImageShape.prototype.getObjectType=function(){return AscDFH.historyitem_type_ImageShape};CImageShape.prototype.setNvPicPr=function(pr){History.Add(new AscDFH.CChangesDrawingsObject(this, AscDFH.historyitem_ImageShapeSetNvPicPr,this.nvPicPr,pr));this.nvPicPr=pr};CImageShape.prototype.setSpPr=function(pr){History.Add(new AscDFH.CChangesDrawingsObject(this,AscDFH.historyitem_ImageShapeSetSpPr,this.spPr,pr));this.spPr=pr};CImageShape.prototype.setBlipFill=function(pr){History.Add(new AscDFH.CChangesDrawingsObjectNoId(this,AscDFH.historyitem_ImageShapeSetBlipFill,this.blipFill,pr));this.blipFill=pr};CImageShape.prototype.setParent=function(pr){History.Add(new AscDFH.CChangesDrawingsObject(this, AscDFH.historyitem_ImageShapeSetParent,this.parent,pr));this.parent=pr};CImageShape.prototype.setGroup=function(pr){History.Add(new AscDFH.CChangesDrawingsObject(this,AscDFH.historyitem_ImageShapeSetGroup,this.group,pr));this.group=pr};CImageShape.prototype.setStyle=function(pr){History.Add(new AscDFH.CChangesDrawingsObject(this,AscDFH.historyitem_ImageShapeSetStyle,this.style,pr));this.style=pr};CImageShape.prototype.copy=function(oPr){var copy=new CImageShape;if(this.nvPicPr)copy.setNvPicPr(this.nvPicPr.createDuplicate()); if(this.spPr){copy.setSpPr(this.spPr.createDuplicate());copy.spPr.setParent(copy)}if(this.blipFill)copy.setBlipFill(this.blipFill.createDuplicate());if(this.style)copy.setStyle(this.style.createDuplicate());copy.setBDeleted(this.bDeleted);if(this.macro!==null)copy.setMacro(this.macro);if(this.textLink!==null)copy.setTextLink(this.textLink);copy.cachedImage=this.getBase64Img();copy.cachedPixH=this.cachedPixH;copy.cachedPixW=this.cachedPixW;copy.setLocks(this.locks);return copy};CImageShape.prototype.getImageUrl= function(){if(isRealObject(this.blipFill))return this.blipFill.RasterImageId;return null};CImageShape.prototype.getSnapArrays=function(snapX,snapY){var transform=this.getTransformMatrix();snapX.push(transform.tx);snapX.push(transform.tx+this.extX*.5);snapX.push(transform.tx+this.extX);snapY.push(transform.ty);snapY.push(transform.ty+this.extY*.5);snapY.push(transform.ty+this.extY)};CImageShape.prototype.checkDrawingBaseCoords=CShape.prototype.checkDrawingBaseCoords;CImageShape.prototype.setDrawingBaseCoords= CShape.prototype.setDrawingBaseCoords;CImageShape.prototype.isPlaceholder=function(){return this.nvPicPr!=null&&this.nvPicPr.nvPr!=undefined&&this.nvPicPr.nvPr.ph!=undefined};CImageShape.prototype.isShape=function(){return false};CImageShape.prototype.isImage=function(){return true};CImageShape.prototype.isChart=function(){return false};CImageShape.prototype.isGroup=function(){return false};CImageShape.prototype.getWatermarkProps=function(){var oProps=new Asc.CAscWatermarkProperties;oProps.put_Type(Asc.c_oAscWatermarkType.Image); oProps.put_ImageUrl2(this.blipFill.RasterImageId);oProps.put_Scale(-1);var oApi;if(window["Asc"]&&window["Asc"]["editor"])oApi=window["Asc"]["editor"];else oApi=editor;if(oApi){var oImgP=new Asc.asc_CImgProperty;oImgP.ImageUrl=this.blipFill.RasterImageId;var oSize=oImgP.asc_getOriginSize(oApi);if(oSize){var dScale=(this.extX/oSize.Width*100+.5>>0)/100;oProps.put_Scale(dScale);var dAspect=this.extX/this.extY;var dAspect2=oSize.Width/oSize.Height;if(AscFormat.fApproxEqual(dAspect,dAspect2,.01)){var oParaDrawing= AscFormat.getParaDrawing(this);if(oParaDrawing){var oParentParagraph=oParaDrawing.Get_ParentParagraph();if(oParentParagraph){var oSectPr=oParentParagraph.Get_SectPr();if(oSectPr){var Width=oSectPr.GetContentFrameWidth();if(AscFormat.fApproxEqual(this.extX,Width,1))oProps.put_Scale(-1)}}}}}}return oProps};CImageShape.prototype.getParentObjects=CShape.prototype.getParentObjects;CImageShape.prototype.hitInPath=CShape.prototype.hitInPath;CImageShape.prototype.hitInInnerArea=CShape.prototype.hitInInnerArea; CImageShape.prototype.getRotateAngle=CShape.prototype.getRotateAngle;CImageShape.prototype.changeSize=CShape.prototype.changeSize;CImageShape.prototype.getRectBounds=function(){var transform=this.getTransformMatrix();var w=this.extX;var h=this.extY;var rect_points=[{x:0,y:0},{x:w,y:0},{x:w,y:h},{x:0,y:h}];var min_x,max_x,min_y,max_y;min_x=transform.TransformPointX(rect_points[0].x,rect_points[0].y);min_y=transform.TransformPointY(rect_points[0].x,rect_points[0].y);max_x=min_x;max_y=min_y;var cur_x, cur_y;for(var i=1;i<4;++i){cur_x=transform.TransformPointX(rect_points[i].x,rect_points[i].y);cur_y=transform.TransformPointY(rect_points[i].x,rect_points[i].y);if(cur_xmax_x)max_x=cur_x;if(cur_ymax_y)max_y=cur_y}return{minX:min_x,maxX:max_x,minY:min_y,maxY:max_y}};CImageShape.prototype.canRotate=function(){if(this.isCrop)return false;if(this.cropObject)return false;return AscFormat.CGraphicObjectBase.prototype.canRotate.call(this)};CImageShape.prototype.createRotateTrack= function(){return new AscFormat.RotateTrackShapeImage(this)};CImageShape.prototype.createResizeTrack=function(cardDirection){return new AscFormat.ResizeTrackShapeImage(this,cardDirection)};CImageShape.prototype.createMoveTrack=function(){return new AscFormat.MoveShapeImageTrack(this)};CImageShape.prototype.getInvertTransform=function(){if(this.recalcInfo.recalculateTransform){this.recalculateTransform();this.recalcInfo.recalculateTransform=true}return this.invertTransform};CImageShape.prototype.hitInTextRect= function(x,y){return false};CImageShape.prototype.getBase64Img=CShape.prototype.getBase64Img;CImageShape.prototype.convertToWord=function(document){this.setBDeleted(true);var oCopy=this.copy(undefined);oCopy.setBDeleted(false);return oCopy};CImageShape.prototype.convertToPPTX=function(drawingDocument,worksheet){var ret=this.copy(undefined);ret.setWorksheet(worksheet);ret.setParent(null);ret.setBDeleted(false);return ret};CImageShape.prototype.recalculateBrush=CShape.prototype.recalculateBrush;CImageShape.prototype.recalculatePen= function(){CShape.prototype.recalculatePen.call(this);if(this.pen)if(AscFormat.isRealNumber(this.pen.w))this.pen.w*=2};CImageShape.prototype.getCompiledLine=CShape.prototype.getCompiledLine;CImageShape.prototype.getCompiledFill=CShape.prototype.getCompiledFill;CImageShape.prototype.getCompiledTransparent=CShape.prototype.getCompiledTransparent;CImageShape.prototype.getAllRasterImages=function(images){this.blipFill&&typeof this.blipFill.RasterImageId==="string"&&this.blipFill.RasterImageId.length> 0&&images.push(this.blipFill.RasterImageId)};CImageShape.prototype.getHierarchy=function(){if(this.recalcInfo.recalculateShapeHierarchy){this.compiledHierarchy.length=0;var hierarchy=this.compiledHierarchy;if(this.isPlaceholder()){var ph_type=this.getPlaceholderType();var ph_index=this.getPlaceholderIndex();var b_is_single_body=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));hierarchy.push(this.parent.Layout.Master.getMatchingShape(ph_type, ph_index,b_is_single_body));break}case AscFormat.TYPE_KIND.LAYOUT:{hierarchy.push(this.parent.Master.getMatchingShape(ph_type,ph_index,b_is_single_body));break}}}this.recalcInfo.recalculateShapeHierarchy=true}return this.compiledHierarchy};CImageShape.prototype.recalculateTransform=function(){this.cachedImage=null;if(!isRealObject(this.group))if(this.spPr.xfrm.isNotNull()){var xfrm=this.spPr.xfrm;this.x=xfrm.offX;this.y=xfrm.offY;this.extX=xfrm.extX;this.extY=xfrm.extY;this.rot=AscFormat.isRealNumber(xfrm.rot)? xfrm.rot:0;this.flipH=xfrm.flipH===true;this.flipV=xfrm.flipV===true}else if(this.isPlaceholder()){var hierarchy=this.getHierarchy();for(var i=0;i0){var sExt=AscCommon.GetFileExtension(oUniMedia.media);if(this.blipFill&&typeof this.blipFill.RasterImageId==="string"){var sName=AscCommon.GetFileName(this.blipFill.RasterImageId); var sMediaFile=sName+"."+sExt;return sMediaFile}}}return null};CImageShape.prototype.setNvSpPr=function(pr){History.Add(new AscDFH.CChangesDrawingsObject(this,AscDFH.historyitem_ImageShapeSetNvPicPr,this.nvPicPr,pr));this.nvPicPr=pr};CImageShape.prototype.getAllImages=function(images){if(this.blipFill instanceof AscFormat.CBlipFill&&typeof this.blipFill.RasterImageId==="string")images[AscCommon.getFullImageSrc2(this.blipFill.RasterImageId)]=true};CImageShape.prototype.checkTypeCorrect=function(){if(!this.blipFill)return false; if(!this.spPr)return false;return true};CImageShape.prototype.Load_LinkData=function(linkData){};window["AscFormat"]=window["AscFormat"]||{};window["AscFormat"].CImageShape=CImageShape})(window);"use strict";(function(window,undefined){var c_oAscSizeRelFromH=AscCommon.c_oAscSizeRelFromH;var c_oAscSizeRelFromV=AscCommon.c_oAscSizeRelFromV;var isRealObject=AscCommon.isRealObject;var History=AscCommon.History;var global_MatrixTransformer=AscCommon.global_MatrixTransformer;var CShape=AscFormat.CShape; AscDFH.changesFactory[AscDFH.historyitem_GroupShapeSetNvGrpSpPr]=AscDFH.CChangesDrawingsObject;AscDFH.changesFactory[AscDFH.historyitem_GroupShapeSetSpPr]=AscDFH.CChangesDrawingsObject;AscDFH.changesFactory[AscDFH.historyitem_GroupShapeSetParent]=AscDFH.CChangesDrawingsObject;AscDFH.changesFactory[AscDFH.historyitem_GroupShapeAddToSpTree]=AscDFH.CChangesDrawingsContent;AscDFH.changesFactory[AscDFH.historyitem_GroupShapeSetGroup]=AscDFH.CChangesDrawingsObject;AscDFH.changesFactory[AscDFH.historyitem_GroupShapeRemoveFromSpTree]= AscDFH.CChangesDrawingsContent;AscDFH.drawingsChangesMap[AscDFH.historyitem_GroupShapeSetNvGrpSpPr]=function(oClass,value){oClass.nvGrpSpPr=value};AscDFH.drawingsChangesMap[AscDFH.historyitem_GroupShapeSetSpPr]=function(oClass,value){oClass.spPr=value};AscDFH.drawingsChangesMap[AscDFH.historyitem_GroupShapeSetParent]=function(oClass,value){oClass.parent=value};AscDFH.drawingsChangesMap[AscDFH.historyitem_GroupShapeSetGroup]=function(oClass,value){oClass.group=value};AscDFH.drawingContentChanges[AscDFH.historyitem_GroupShapeAddToSpTree]= AscDFH.drawingContentChanges[AscDFH.historyitem_GroupShapeRemoveFromSpTree]=function(oClass){return oClass.spTree};function CGroupShape(){AscFormat.CGraphicObjectBase.call(this);this.nvGrpSpPr=null;this.spTree=[];this.invertTransform=null;this.scaleCoefficients={cx:1,cy:1};this.arrGraphicObjects=[];this.selectedObjects=[];this.selection={groupSelection:null,chartSelection:null,textSelection:null}}CGroupShape.prototype=Object.create(AscFormat.CGraphicObjectBase.prototype);CGroupShape.prototype.constructor= CGroupShape;CGroupShape.prototype.getObjectType=function(){return AscDFH.historyitem_type_GroupShape};CGroupShape.prototype.GetAllDrawingObjects=function(DrawingObjects){for(var i=0;i-1;--i)if(this.spTree[i].Get_Id()===id)return this.removeFromSpTreeByPos(i);return null};CGroupShape.prototype.removeFromSpTreeByPos=function(pos){var aSplicedShape=this.spTree.splice(pos,1);History.Add(new AscDFH.CChangesDrawingsContent(this, AscDFH.historyitem_GroupShapeRemoveFromSpTree,pos,aSplicedShape,false));this.handleUpdateSpTree();return aSplicedShape[0]};CGroupShape.prototype.handleUpdateSpTree=function(){if(!this.group){this.recalcInfo.recalculateArrGraphicObjects=true;this.recalcBounds();this.addToRecalculate()}else{this.recalcInfo.recalculateArrGraphicObjects=true;this.group.handleUpdateSpTree();this.recalcBounds()}};CGroupShape.prototype.copy=function(oPr){var copy=new CGroupShape;this.copy2(copy,oPr);return copy};CGroupShape.prototype.copy2= function(copy,oPr){if(this.nvGrpSpPr)copy.setNvGrpSpPr(this.nvGrpSpPr.createDuplicate());if(this.spPr){copy.setSpPr(this.spPr.createDuplicate());copy.spPr.setParent(copy)}for(var i=0;i-1;--i)if(this.spTree[i].hit(x,y))return true;return false};CGroupShape.prototype.onMouseMove=function(e,x,y){for(var i=this.spTree.length-1;i> -1;--i)if(this.spTree[i].onMouseMove(e,x,y))return true;return false};CGroupShape.prototype.draw=function(graphics){if(this.checkNeedRecalculate&&this.checkNeedRecalculate())return;var oClipRect;if(!graphics.IsSlideBoundsCheckerType)oClipRect=this.getClipRect();if(oClipRect){graphics.SaveGrState();graphics.AddClipRect(oClipRect.x,oClipRect.y,oClipRect.w,oClipRect.h)}for(var i=0;imax_x)max_x=cur_x;if(cur_ymax_y)max_y=cur_y}return{minX:min_x,maxX:max_x,minY:min_y,maxY:max_y}};CGroupShape.prototype.getResultScaleCoefficients=function(){if(this.recalcInfo.recalculateScaleCoefficients){var cx,cy;if(this.spPr.xfrm.isNotNullForGroup()){var dExtX=this.spPr.xfrm.extX,dExtY=this.spPr.xfrm.extY; var oParaDrawing=AscFormat.getParaDrawing(this);if(false&&oParaDrawing)if(oParaDrawing.SizeRelH||oParaDrawing.SizeRelV){this.m_oSectPr=null;var oParentParagraph=oParaDrawing.Get_ParentParagraph();if(oParentParagraph){var oSectPr=oParentParagraph.Get_SectPr();if(oSectPr){if(oParaDrawing.SizeRelH&&oParaDrawing.SizeRelH.Percent>0){switch(oParaDrawing.SizeRelH.RelativeFrom){case c_oAscSizeRelFromH.sizerelfromhMargin:{dExtX=oSectPr.GetContentFrameWidth();break}case c_oAscSizeRelFromH.sizerelfromhPage:{dExtX= oSectPr.GetPageWidth();break}case c_oAscSizeRelFromH.sizerelfromhLeftMargin:{dExtX=oSectPr.GetPageMarginLeft();break}case c_oAscSizeRelFromH.sizerelfromhRightMargin:{dExtX=oSectPr.GetPageMarginRight();break}default:{dExtX=oSectPr.GetPageMarginLeft();break}}dExtX*=oParaDrawing.SizeRelH.Percent}if(oParaDrawing.SizeRelV&&oParaDrawing.SizeRelV.Percent>0){switch(oParaDrawing.SizeRelV.RelativeFrom){case c_oAscSizeRelFromV.sizerelfromvMargin:{dExtY=oSectPr.GetContentFrameHeight();break}case c_oAscSizeRelFromV.sizerelfromvPage:{dExtY= oSectPr.GetPageHeight();break}case c_oAscSizeRelFromV.sizerelfromvTopMargin:{dExtY=oSectPr.GetPageMarginTop();break}case c_oAscSizeRelFromV.sizerelfromvBottomMargin:{dExtY=oSectPr.GetPageMarginBottom();break}default:{dExtY=oSectPr.GetPageMarginTop();break}}dExtY*=oParaDrawing.SizeRelV.Percent}}}}if(this.drawingBase&&!this.group){var metrics=this.drawingBase.getGraphicObjectMetrics();var rot=0;if(this.spPr&&this.spPr.xfrm)if(AscFormat.isRealNumber(this.spPr.xfrm.rot))rot=AscFormat.normalizeRotate(this.spPr.xfrm.rot); var metricExtX,metricExtY;{if(AscFormat.checkNormalRotate(rot)){dExtX=metrics.extX;dExtY=metrics.extY}else{dExtX=metrics.extY;dExtY=metrics.extX}}}if(this.spPr.xfrm.chExtX>0)cx=dExtX/this.spPr.xfrm.chExtX;else cx=1;if(this.spPr.xfrm.chExtY>0)cy=dExtY/this.spPr.xfrm.chExtY;else cy=1}else{cx=1;cy=1}if(isRealObject(this.group)){var group_scale_coefficients=this.group.getResultScaleCoefficients();cx*=group_scale_coefficients.cx;cy*=group_scale_coefficients.cy}this.scaleCoefficients.cx=cx;this.scaleCoefficients.cy= cy;this.recalcInfo.recalculateScaleCoefficients=false}return this.scaleCoefficients};CGroupShape.prototype.getCompiledTransparent=function(){return null};CGroupShape.prototype.selectObject=function(object,pageIndex){object.select(this,pageIndex)};CGroupShape.prototype.recalculate=function(){var recalcInfo=this.recalcInfo;if(recalcInfo.recalculateBrush){this.recalculateBrush();recalcInfo.recalculateBrush=false}if(recalcInfo.recalculatePen){this.recalculatePen();recalcInfo.recalculatePen=false}if(recalcInfo.recalculateScaleCoefficients){this.getResultScaleCoefficients(); recalcInfo.recalculateScaleCoefficients=false}if(recalcInfo.recalculateTransform){this.recalculateTransform();recalcInfo.recalculateTransform=false}if(recalcInfo.recalculateArrGraphicObjects)this.recalculateArrGraphicObjects();for(var i=0;i 0)if(this.parent){this.parent.GoTo_Text();this.resetSelection()}}};CGroupShape.prototype.applyTextFunction=AscFormat.DrawingObjectsController.prototype.applyTextFunction;CGroupShape.prototype.applyDocContentFunction=AscFormat.DrawingObjectsController.prototype.applyDocContentFunction;CGroupShape.prototype.applyAllAlign=function(val){for(var i=0;i0)i=0;else i=this.arrGraphicObjects.length- 1;else if(SearchEngine.GetDirection()>0){for(i=0;i-1;--i)if(this.arrGraphicObjects[i].selected)break;if(i===-1)return}while(!SearchEngine.IsFound()){if(this.arrGraphicObjects[i].GetRevisionsChangeElement)this.arrGraphicObjects[i].GetRevisionsChangeElement(SearchEngine);if(SearchEngine.GetDirection()>0){if(i===this.arrGraphicObjects.length- 1)break;++i}else{if(i===0)break;--i}}};CGroupShape.prototype.Search=function(Str,Props,SearchEngine,Type){var Len=this.arrGraphicObjects.length;for(var i=0;i=0;i--)if(this.arrGraphicObjects[i].GetSearchElementId){Id=this.arrGraphicObjects[i].GetSearchElementId(false,i===Current?true:false);if(null!==Id)return Id}}return null};CGroupShape.prototype.FindNextFillingForm= function(isNext,isCurrent){if(this.graphicObject)return this.graphicObject.FindNextFillingForm(isNext,isCurrent);var Current=-1;var Len=this.arrGraphicObjects.length;var Id=null;if(true===isCurrent)for(var i=0;i=0;i--)if(this.arrGraphicObjects[i].FindNextFillingForm){Id=this.arrGraphicObjects[i].FindNextFillingForm(false,i===Current,i===Current);if(Id)return Id}}return null};CGroupShape.prototype.getCompiledFill=function(){this.compiledFill=null;if(isRealObject(this.spPr)&&isRealObject(this.spPr.Fill)&&isRealObject(this.spPr.Fill.fill)){this.compiledFill=this.spPr.Fill.createDuplicate();if(this.compiledFill&&this.compiledFill.fill&& this.compiledFill.fill.type===Asc.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;imax_x)max_x=cur_max_x;if(cur_min_xmax_y)max_y=cur_max_y;if(cur_min_y-1;--i){var old_gr=this.selectedObjects[i].group;var obj=this.selectedObjects[i];obj.group=this;obj.deselect(graphicObjects);obj.group=old_gr}};CGroupShape.prototype.resetInternalSelection=AscFormat.DrawingObjectsController.prototype.resetInternalSelection;CGroupShape.prototype.recalculateCurPos= AscFormat.DrawingObjectsController.prototype.recalculateCurPos;CGroupShape.prototype.loadDocumentStateAfterLoadChanges=AscFormat.DrawingObjectsController.prototype.loadDocumentStateAfterLoadChanges;CGroupShape.prototype.getAllConnectors=AscFormat.DrawingObjectsController.prototype.getAllConnectors;CGroupShape.prototype.getAllShapes=AscFormat.DrawingObjectsController.prototype.getAllShapes;CGroupShape.prototype.checkDrawingBaseCoords=CShape.prototype.checkDrawingBaseCoords;CGroupShape.prototype.setDrawingBaseCoords= CShape.prototype.setDrawingBaseCoords;CGroupShape.prototype.calculateSnapArrays=function(snapArrayX,snapArrayY){var sp;for(var i=0;i-1;--i)if(this.spTree[i].getObjectType()===AscDFH.historyitem_type_GroupShape)this.spTree[i].bringToFront();else if(this.spTree[i].selected)arrDrawings.push(this.removeFromSpTreeByPos(i));for(i=arrDrawings.length- 1;i>-1;--i)this.addToSpTree(null,arrDrawings[i])};CGroupShape.prototype.bringForward=function(){var i;for(i=this.spTree.length-1;i>-1;--i)if(this.spTree[i].getObjectType()===AscDFH.historyitem_type_GroupShape)this.spTree[i].bringForward();else if(i-1;--i)if(this.spTree[i].getObjectType()=== AscDFH.historyitem_type_GroupShape)this.spTree[i].sendToBack();else if(this.spTree[i].selected)arrDrawings.push(this.removeFromSpTreeByPos(i));arrDrawings.reverse();for(i=0;i0&&this.spTree[i].selected&&!this.spTree[i-1].selected)this.addToSpTree(i- 1,this.removeFromSpTreeByPos(i))};CGroupShape.prototype.Refresh_RecalcData=function(oData){if(oData)switch(oData.Type){case AscDFH.historyitem_ShapeSetBDeleted:{if(!this.bDeleted)this.addToRecalculate();break}case AscDFH.historyitem_GroupShapeAddToSpTree:case AscDFH.historyitem_GroupShapeRemoveFromSpTree:{if(!this.bDeleted)this.handleUpdateSpTree();break}}};CGroupShape.prototype.checkTypeCorrect=function(){if(!this.spPr)return false;if(this.spTree.length===0)return false;return true};CGroupShape.prototype.resetGroups= function(){for(var i=0;i-1;--i){var oConInfo=this.spTree[i].findConnector(x,y);if(oConInfo)return oConInfo}return null};CGroupShape.prototype.findConnectionShape=function(x,y){for(var i=this.spTree.length-1;i>-1;--i){var _ret=this.spTree[i].findConnectionShape(x,y);if(_ret)return _ret}return null}; CGroupShape.prototype.GetAllContentControls=function(arrContentControls){for(var i=0;i0&&oRect.fHorPadding>0){x0= this.x+oRect.fHorPadding;bResetHorPadding=false}else x0=Math.max(this.x,oRect.x);if(this.fVertPadding>0&&oRect.fVertPadding>0){y0=this.y+oRect.fVertPadding;bResetVertPadding=false}else y0=Math.max(this.y,oRect.y);if(this.fHorPadding<0&&oRect.fHorPadding<0){x1=this.x+this.w+oRect.fHorPadding;bResetHorPadding=false}else x1=Math.min(this.x+this.w,oRect.x+oRect.w);if(this.fVertPadding<0&&oRect.fVertPadding<0){y1=this.y+this.h+oRect.fVertPadding;bResetVertPadding=false}else y1=Math.min(this.y+this.h,oRect.y+ oRect.h);if(bResetHorPadding)this.fHorPadding=0;if(bResetVertPadding)this.fVertPadding=0;this.x=x0;this.y=y0;this.w=x1-x0;this.h=y1-y0;return true};function CreateUnifillSolidFillSchemeColorByIndex(index){var ret=new AscFormat.CUniFill;ret.setFill(new AscFormat.CSolidFill);ret.fill.setColor(new AscFormat.CUniColor);ret.fill.color.setColor(new AscFormat.CSchemeColor);ret.fill.color.color.setId(index);return ret}function CChartStyleManager(){this.styles=[]}CChartStyleManager.prototype={init:function(){AscFormat.ExecuteNoHistory(function(){var DefaultDataPointPerDataPoint= [[CreateUniFillSchemeColorWidthTint(8,.885),CreateUniFillSchemeColorWidthTint(8,.55),CreateUniFillSchemeColorWidthTint(8,.78),CreateUniFillSchemeColorWidthTint(8,.925),CreateUniFillSchemeColorWidthTint(8,.7),CreateUniFillSchemeColorWidthTint(8,.3)],[CreateUniFillSchemeColorWidthTint(0,0),CreateUniFillSchemeColorWidthTint(1,0),CreateUniFillSchemeColorWidthTint(2,0),CreateUniFillSchemeColorWidthTint(3,0),CreateUniFillSchemeColorWidthTint(4,0),CreateUniFillSchemeColorWidthTint(5,0)],[CreateUniFillSchemeColorWidthTint(0, -.5),CreateUniFillSchemeColorWidthTint(1,-.5),CreateUniFillSchemeColorWidthTint(2,-.5),CreateUniFillSchemeColorWidthTint(3,-.5),CreateUniFillSchemeColorWidthTint(4,-.5),CreateUniFillSchemeColorWidthTint(5,-.5)],[CreateUniFillSchemeColorWidthTint(8,.05),CreateUniFillSchemeColorWidthTint(8,.55),CreateUniFillSchemeColorWidthTint(8,.78),CreateUniFillSchemeColorWidthTint(8,.15),CreateUniFillSchemeColorWidthTint(8,.7),CreateUniFillSchemeColorWidthTint(8,.3)]];var s=DefaultDataPointPerDataPoint;var f=CreateUniFillSchemeColorWidthTint; this.styles[0]=new CChartStyle(EFFECT_NONE,EFFECT_SUBTLE,s[0],EFFECT_SUBTLE,EFFECT_NONE,[],3,s[0],7);this.styles[1]=new CChartStyle(EFFECT_NONE,EFFECT_SUBTLE,s[1],EFFECT_SUBTLE,EFFECT_NONE,[],3,s[1],7);for(var i=2;i<8;++i)this.styles[i]=new CChartStyle(EFFECT_NONE,EFFECT_SUBTLE,[f(i-2,0)],EFFECT_SUBTLE,EFFECT_NONE,[],3,[f(i-2,0)],7);this.styles[8]=new CChartStyle(EFFECT_SUBTLE,EFFECT_SUBTLE,s[0],EFFECT_SUBTLE,EFFECT_SUBTLE,[f(12,0)],5,s[0],9);this.styles[9]=new CChartStyle(EFFECT_SUBTLE,EFFECT_SUBTLE, s[1],EFFECT_SUBTLE,EFFECT_SUBTLE,[f(12,0)],5,s[1],9);for(i=10;i<16;++i)this.styles[i]=new CChartStyle(EFFECT_SUBTLE,EFFECT_SUBTLE,[f(i-10,0)],EFFECT_SUBTLE,EFFECT_SUBTLE,[f(12,0)],5,[f(i-10,0)],9);this.styles[16]=new CChartStyle(EFFECT_MODERATE,EFFECT_INTENSE,s[0],EFFECT_SUBTLE,EFFECT_NONE,[],5,s[0],9);this.styles[17]=new CChartStyle(EFFECT_MODERATE,EFFECT_INTENSE,s[1],EFFECT_INTENSE,EFFECT_NONE,[],5,s[1],9);for(i=18;i<24;++i)this.styles[i]=new CChartStyle(EFFECT_MODERATE,EFFECT_INTENSE,[f(i-18,0)], EFFECT_SUBTLE,EFFECT_NONE,[],5,[f(i-18,0)],9);this.styles[24]=new CChartStyle(EFFECT_INTENSE,EFFECT_INTENSE,s[0],EFFECT_SUBTLE,EFFECT_NONE,[],7,s[0],13);this.styles[25]=new CChartStyle(EFFECT_MODERATE,EFFECT_INTENSE,s[1],EFFECT_SUBTLE,EFFECT_NONE,[],7,s[1],13);for(i=26;i<32;++i)this.styles[i]=new CChartStyle(EFFECT_MODERATE,EFFECT_INTENSE,[f(i-26,0)],EFFECT_SUBTLE,EFFECT_NONE,[],7,[f(i-26,0)],13);this.styles[32]=new CChartStyle(EFFECT_NONE,EFFECT_SUBTLE,s[0],EFFECT_SUBTLE,EFFECT_SUBTLE,[f(8,-.5)], 5,s[0],9);this.styles[33]=new CChartStyle(EFFECT_NONE,EFFECT_SUBTLE,s[1],EFFECT_SUBTLE,EFFECT_SUBTLE,s[2],5,s[1],9);for(i=34;i<40;++i)this.styles[i]=new CChartStyle(EFFECT_NONE,EFFECT_SUBTLE,[f(i-34,0)],EFFECT_SUBTLE,EFFECT_SUBTLE,[f(i-34,-.5)],5,[f(i-34,0)],9);this.styles[40]=new CChartStyle(EFFECT_INTENSE,EFFECT_INTENSE,s[3],EFFECT_SUBTLE,EFFECT_NONE,[],5,s[3],9);this.styles[41]=new CChartStyle(EFFECT_INTENSE,EFFECT_INTENSE,s[1],EFFECT_INTENSE,EFFECT_NONE,[],5,s[1],9);for(i=42;i<48;++i)this.styles[i]= new CChartStyle(EFFECT_INTENSE,EFFECT_INTENSE,[f(i-42,0)],EFFECT_SUBTLE,EFFECT_NONE,[],5,[f(i-42,0)],9);this.defaultLineStyles=[];this.defaultLineStyles[0]=new ChartLineStyle(f(15,.75),f(15,.5),f(15,.75),f(15,0),EFFECT_SUBTLE);for(i=0;i<32;++i)this.defaultLineStyles[i]=this.defaultLineStyles[0];this.defaultLineStyles[32]=new ChartLineStyle(f(8,.75),f(8,.5),f(8,.75),f(8,0),EFFECT_SUBTLE);this.defaultLineStyles[33]=this.defaultLineStyles[32];this.defaultLineStyles[34]=new ChartLineStyle(f(8,.75),f(8, .5),f(8,.75),f(8,0),EFFECT_SUBTLE);for(i=35;i<40;++i)this.defaultLineStyles[i]=this.defaultLineStyles[34];this.defaultLineStyles[40]=new ChartLineStyle(f(8,.75),f(8,.9),f(12,0),f(12,0),EFFECT_NONE);for(i=41;i<48;++i)this.defaultLineStyles[i]=this.defaultLineStyles[40]},this,[])},getStyleByIndex:function(index){if(AscFormat.isRealNumber(index))return this.styles[(index-1)%48];return this.styles[1]},getDefaultLineStyleByIndex:function(index){if(AscFormat.isRealNumber(index))return this.defaultLineStyles[(index- 1)%48];return this.defaultLineStyles[2]}};CHART_STYLE_MANAGER=new CChartStyleManager;function ChartLineStyle(axisAndMajorGridLines,minorGridlines,chartArea,otherLines,floorChartArea){this.axisAndMajorGridLines=axisAndMajorGridLines;this.minorGridlines=minorGridlines;this.chartArea=chartArea;this.otherLines=otherLines;this.floorChartArea=floorChartArea}function CChartStyle(effect,fill1,fill2,fill3,line1,line2,line3,line4,markerSize){this.effect=effect;this.fill1=fill1;this.fill2=fill2;this.fill3=fill3; this.line1=line1;this.line2=line2;this.line3=line3;this.line4=line4;this.markerSize=markerSize}function CreateUniFillSchemeColorWidthTint(schemeColorId,tintVal){return AscFormat.ExecuteNoHistory(function(schemeColorId,tintVal){return CreateUniFillSolidFillWidthTintOrShade(CreateUnifillSolidFillSchemeColorByIndex(schemeColorId),tintVal)},this,[schemeColorId,tintVal])}function checkFiniteNumber(num){if(AscFormat.isRealNumber(num)&&isFinite(num)&&num>0)return num;return 0}var G_O_VISITED_HLINK_COLOR= CreateUniFillSolidFillWidthTintOrShade(CreateUnifillSolidFillSchemeColorByIndex(10),0);var G_O_HLINK_COLOR=CreateUniFillSolidFillWidthTintOrShade(CreateUnifillSolidFillSchemeColorByIndex(11),0);var G_O_NO_ACTIVE_COMMENT_BRUSH=AscFormat.CreateUniFillByUniColor(AscFormat.CreateUniColorRGB(248,231,195));var G_O_ACTIVE_COMMENT_BRUSH=AscFormat.CreateUniFillByUniColor(AscFormat.CreateUniColorRGB(240,200,120));var CChangesDrawingsBool=AscDFH.CChangesDrawingsBool;var CChangesDrawingsLong=AscDFH.CChangesDrawingsLong; var CChangesDrawingsDouble=AscDFH.CChangesDrawingsDouble;var CChangesDrawingsString=AscDFH.CChangesDrawingsString;var CChangesDrawingsObject=AscDFH.CChangesDrawingsObject;var CChangesDrawingsObjectNoId=AscDFH.CChangesDrawingsObjectNoId;var CChangesDrawingsContent=AscDFH.CChangesDrawingsContent;var drawingsChangesMap=window["AscDFH"].drawingsChangesMap;AscDFH.changesFactory[AscDFH.historyitem_ChartSpace_SetNvGrFrProps]=CChangesDrawingsObject;AscDFH.changesFactory[AscDFH.historyitem_ChartSpace_SetThemeOverride]= CChangesDrawingsObject;AscDFH.changesFactory[AscDFH.historyitem_ShapeSetBDeleted]=CChangesDrawingsBool;AscDFH.changesFactory[AscDFH.historyitem_ChartSpace_SetParent]=CChangesDrawingsObject;AscDFH.changesFactory[AscDFH.historyitem_ChartSpace_SetChart]=CChangesDrawingsObject;AscDFH.changesFactory[AscDFH.historyitem_ChartSpace_SetClrMapOvr]=CChangesDrawingsObject;AscDFH.changesFactory[AscDFH.historyitem_ChartSpace_SetDate1904]=CChangesDrawingsBool;AscDFH.changesFactory[AscDFH.historyitem_ChartSpace_SetExternalData]= CChangesDrawingsObject;AscDFH.changesFactory[AscDFH.historyitem_ChartSpace_SetLang]=CChangesDrawingsString;AscDFH.changesFactory[AscDFH.historyitem_ChartSpace_SetPivotSource]=CChangesDrawingsObject;AscDFH.changesFactory[AscDFH.historyitem_ChartSpace_SetPrintSettings]=CChangesDrawingsObject;AscDFH.changesFactory[AscDFH.historyitem_ChartSpace_SetProtection]=CChangesDrawingsObject;AscDFH.changesFactory[AscDFH.historyitem_ChartSpace_SetRoundedCorners]=CChangesDrawingsBool;AscDFH.changesFactory[AscDFH.historyitem_ChartSpace_SetSpPr]= CChangesDrawingsObject;AscDFH.changesFactory[AscDFH.historyitem_ChartSpace_SetStyle]=CChangesDrawingsLong;AscDFH.changesFactory[AscDFH.historyitem_ChartSpace_SetTxPr]=CChangesDrawingsObject;AscDFH.changesFactory[AscDFH.historyitem_ChartSpace_SetGroup]=CChangesDrawingsObject;AscDFH.changesFactory[AscDFH.historyitem_ChartSpace_AddUserShape]=CChangesDrawingsContent;AscDFH.changesFactory[AscDFH.historyitem_ChartSpace_RemoveUserShape]=CChangesDrawingsContent;AscDFH.changesFactory[AscDFH.historyitem_ChartSpace_ChartStyle]= CChangesDrawingsObject;AscDFH.changesFactory[AscDFH.historyitem_ChartSpace_ChartColors]=CChangesDrawingsObjectNoId;AscDFH.drawingContentChanges[AscDFH.historyitem_ChartSpace_RemoveUserShape]=AscDFH.drawingContentChanges[AscDFH.historyitem_ChartSpace_AddUserShape]=function(oClass){return oClass.userShapes};function CheckParagraphTextPr(oParagraph,oTextPr){var oParaPr=oParagraph.Pr.Copy();var oParaPr2=new CParaPr;var oCopyTextPr=oTextPr.Copy();if(oCopyTextPr.FontFamily)oCopyTextPr.RFonts.Set_FromObject({Ascii:{Name:oCopyTextPr.FontFamily.Name, Index:-1},EastAsia:{Name:oCopyTextPr.FontFamily.Name,Index:-1},HAnsi:{Name:oCopyTextPr.FontFamily.Name,Index:-1},CS:{Name:oCopyTextPr.FontFamily.Name,Index:-1}});oParaPr2.DefaultRunPr=oCopyTextPr;oParaPr.Merge(oParaPr2);oParagraph.Set_Pr(oParaPr)}function CheckObjectTextPr(oElement,oTextPr,oDrawingDocument){if(oElement){if(!oElement.txPr)oElement.setTxPr(AscFormat.CreateTextBodyFromString("",oDrawingDocument,oElement));oElement.txPr.content.Content[0].Set_DocumentIndex(0);CheckParagraphTextPr(oElement.txPr.content.Content[0], oTextPr);if(oElement.tx&&oElement.tx.rich){var aContent=oElement.tx.rich.content.Content;for(var i=0;i=this.ArrPathCommand.length){var aNewArray=new Float64Array((3/2*(this.curPos+1)>>0)+1);for(var i=0;ithis.maxMinWidth)this.maxMinWidth=fMinW;this.aLabels.push(oLbl);if(!oStyle)oStyle=oLbl.lastStyleObject;++this.count}else this.aLabels.push(null)}CLabelsBox.prototype.draw=function(graphics){for(var i=0;ithis.maxMinWidth)this.maxMinWidth=fMinW;if(!oStyle)oStyle=oLbl.lastStyleObject}}}return this.maxMinWidth>=0?this.maxMinWidth:0};CLabelsBox.prototype.hit=function(x,y){var tx,ty;if(this.chartSpace&&this.chartSpace.invertTransform){tx=this.chartSpace.invertTransform.TransformPointX(x,y);ty=this.chartSpace.invertTransform.TransformPointY(x, y);return tx>=this.x&&ty>=this.y&&tx<=this.x+this.extX&&ty<=this.y+this.extY}return false};CLabelsBox.prototype.updatePosition=function(x,y){for(var i=0;ifMaxHeight)fMaxHeight=fCurHeight;var fX,fY;fX=fCurX+fHorShift;if(fDistance>=0)fY=fAxisY+fDistance; else fY=fAxisY+fDistance-fCurHeight;var oTransform=oLabel.transformText;oTransform.Reset();global_MatrixTransformer.TranslateAppend(oTransform,fX,fY);oTransform=oLabel.localTransformText;oTransform.Reset();global_MatrixTransformer.TranslateAppend(oTransform,fX,fY);if(oFirstLabel===null){oFirstLabel=oLabel;fFirstLabelCenterX=fCurX+Math.abs(fInterval)/2}oLastLabel=oLabel;fLastLabelCenterX=fCurX+Math.abs(fInterval)/2}fCurX+=fInterval}var x0,x1;if(bOnTickMark&&oFirstLabel&&oLastLabel){var fFirstLabelContentWidth= oFirstLabel.tx.rich.getMaxContentWidth(fContentWidth);var fLastLabelContentWidth=oLastLabel.tx.rich.getMaxContentWidth(fContentWidth);x0=Math.min(fFirstLabelCenterX-fFirstLabelContentWidth/2,fLastLabelCenterX-fLastLabelContentWidth/2,fXStart,fXStart+fInterval*(this.aLabels.length-1));x1=Math.max(fFirstLabelCenterX+fFirstLabelContentWidth/2,fLastLabelCenterX+fLastLabelContentWidth/2,fXStart,fXStart+fInterval*(this.aLabels.length-1))}else{x0=Math.min(fXStart,fXStart+fInterval*this.aLabels.length);x1= Math.max(fXStart,fXStart+fInterval*this.aLabels.length)}this.x=x0;this.extX=x1-x0;if(fDistance>=0){this.y=fAxisY;this.extY=fDistance+fMaxHeight}else{this.y=fAxisY+fDistance-fMaxHeight;this.extY=fMaxHeight-fDistance}};CLabelsBox.prototype.layoutHorRotated=function(fAxisY,fDistance,fXStart,fXEnd,fInterval,bOnTickMark){var bTickLblSkip=AscFormat.isRealNumber(this.axis.tickLblSkip);if(bTickLblSkip)this.layoutHorRotated2(this.aLabels,fAxisY,fDistance,fXStart,fInterval,bOnTickMark);else{var fAngle=Math.PI/ 4,fMultiplier=Math.sin(fAngle);var aLabelsSource=[].concat(this.aLabels);var oLabel=aLabelsSource[0];var i=1;while(!oLabel&&i>0;var aLabels=[].concat(aLabelsSource);var index=0;if(nLblTickSkip>1)for(i=0;ifMaxHeight)fMaxHeight=fBoxH;var fX1,fY0,fXC,fYC;fY0=fAxisY+fDistance;if(fDistance>=0){fXC=fCurX-oSize.w*fMultiplier/2;fYC=fY0+fBoxH/2}else{fXC=fCurX+oSize.w*fMultiplier/2;fYC=fY0-fBoxH/2}var oTransform=oLabel.localTransformText;oTransform.Reset();global_MatrixTransformer.TranslateAppend(oTransform,-oSize.w/2,-oSize.h/2);global_MatrixTransformer.RotateRadAppend(oTransform,fAngle);global_MatrixTransformer.TranslateAppend(oTransform,fXC, fYC);oLabel.transformText=oTransform.CreateDublicate();if(null===fMinLeft||fXC-fBoxW/2fMaxRight)fMaxRight=fXC+fBoxW/2}fCurX+=fInterval}this.aLabels=aLabels;var aPoints=[];aPoints.push(fXStart);var nIntervalCount=bOnTickMark?aLabels.length-1:aLabels.length;aPoints.push(fXStart+fInterval*nIntervalCount);if(null!==fMinLeft)aPoints.push(fMinLeft);if(null!==fMaxRight)aPoints.push(fMaxRight);this.x=Math.min.apply(Math,aPoints);this.extX=Math.max.apply(Math, aPoints)-this.x;if(fDistance>=0){this.y=fAxisY;this.extY=fDistance+fMaxHeight}else{this.y=fAxisY+fDistance-fMaxHeight;this.extY=fMaxHeight-fDistance}};CLabelsBox.prototype.layoutVertNormal=function(fAxisX,fDistance,fYStart,fInterval,bOnTickMark,fMaxBlockWidth){var fCurY=bOnTickMark?fYStart:fYStart+fInterval/2;var fDistance_=Math.abs(fDistance);var oTransform,oContent,oLabel,fMinY=fYStart,fMaxY=fYStart+fInterval*(this.aLabels.length-1),fY,i;var fMaxContentWidth=0,oSize;var fLabelHeight=0;for(i=0;i< this.aLabels.length;++i){oLabel=this.aLabels[i];if(oLabel){oSize=oLabel.tx.rich.getContentOneStringSizes();fLabelHeight=oSize.h;break}}var nIntervalCount=bOnTickMark?this.count-1:this.count;var fInterval_=Math.abs(fMinY-fMaxY)/nIntervalCount;var nLblTickSkip=fLabelHeight/fInterval_>>0,index=0;if(nLblTickSkip>1)for(i=0;ifMaxBlockWidth)break;if(oSize.w>fMaxContentWidth)fMaxContentWidth=oSize.w;oTransform=oLabel.localTransformText;oTransform.Reset();fY=fCurY-oSize.h/2;if(fDistance>0)global_MatrixTransformer.TranslateAppend(oTransform,fAxisX+fDistance,fY);else global_MatrixTransformer.TranslateAppend(oTransform,fAxisX+ fDistance-oSize.w,fY);oLabel.transformText=oTransform.CreateDublicate();if(fYfMaxY)fMaxY=fY+oSize.h}fCurY+=fInterval}if(ifMaxContentWidth)fMaxContentWidth=fContentWidth;oContent.Reset(0,0,fContentWidth,2E4);oContent.Recalculate_Page(0,true);var fContentHeight=oContent.GetSummaryHeight();oTransform=oLabel.localTransformText;oTransform.Reset();fY=fCurY-fContentHeight/2;if(fDistance>0)global_MatrixTransformer.TranslateAppend(oTransform,fAxisX+fDistance,fY);else global_MatrixTransformer.TranslateAppend(oTransform, fAxisX+fDistance-fContentWidth,fY);oLabel.transformText=oTransform.CreateDublicate();if(fYfMaxY)fMaxY=fY+fContentHeight}fCurY+=fInterval}}if(fDistance>0)this.x=fAxisX;else this.x=fAxisX+fDistance-fMaxContentWidth;this.extX=fMaxContentWidth+fDistance_;this.y=fMinY;this.extY=fMaxY-fMinY};CLabelsBox.prototype.setPosition=function(x,y){this.x=x;this.y=y;for(var i=0;i1;var nIntervalCount=bOnTickMark_?nLabelsCount-1:nLabelsCount; var fInterval=fAxisLength/nIntervalCount;if(!bForceVertical||true){var fMaxMinWidth=oLabelsBox.checkMaxMinWidth();var fCheckInterval=AscFormat.isRealNumber(fForceContentWidth)?fForceContentWidth:Math.abs(fInterval);if(fMaxMinWidth<=fCheckInterval)oLabelsBox.layoutHorNormal(fY,fDistance,fXStart,fInterval,bOnTickMark_,fForceContentWidth);else oLabelsBox.layoutHorRotated(fY,fDistance,fXStart,fXEnd,fInterval,bOnTickMark_)}}function fLayoutVertLabelsBox(oLabelsBox,fX,fYStart,fYEnd,bOnTickMark,fDistance, bForceVertical){var fAxisLength=fYEnd-fYStart;var nLabelsCount=oLabelsBox.aLabels.length;var bOnTickMark_=bOnTickMark&&nLabelsCount>1;var nIntervalCount=bOnTickMark_?nLabelsCount-1:nLabelsCount;var fInterval=fAxisLength/nIntervalCount;if(!bForceVertical||true)oLabelsBox.layoutVertNormal(fX,fDistance,fYStart,fInterval,bOnTickMark_);else;}function CAxisGrid(){this.nType=0;this.fStart=0;this.fStride=0;this.bOnTickMark=true;this.nCount=0;this.minVal=0;this.maxVal=0;this.aStrings=[]}function CChartSpace(){AscFormat.CGraphicObjectBase.call(this); this.nvGraphicFramePr=null;this.chart=null;this.clrMapOvr=null;this.date1904=null;this.externalData=null;this.lang=null;this.pivotSource=null;this.printSettings=null;this.protection=null;this.roundedCorners=null;this.spPr=null;this.style=2;this.txPr=null;this.themeOverride=null;this.userShapes=[];this.chartStyle=null;this.chartColors=null;this.dataRefs=null;this.pathMemory=new CPathMemory;this.cachedCanvas=null;this.ptsCount=0;this.isSparkline=false;this.selection={title:null,legend:null,legendEntry:null, axisLbls:null,dataLbls:null,dataLbl:null,plotArea:null,rotatePlotArea:null,axis:null,minorGridlines:null,majorGridlines:null,gridLines:null,chart:null,series:null,datPoint:null,hiLowLines:null,upBars:null,downBars:null,markers:null,textSelection:null}}CChartSpace.prototype=Object.create(AscFormat.CGraphicObjectBase.prototype);CChartSpace.prototype.constructor=CChartSpace;CChartSpace.prototype.checkDrawingBaseCoords=CShape.prototype.checkDrawingBaseCoords;CChartSpace.prototype.setDrawingBaseCoords= CShape.prototype.setDrawingBaseCoords;CChartSpace.prototype.changeSize=CShape.prototype.changeSize;CChartSpace.prototype.isPlaceholder=CShape.prototype.isPlaceholder;CChartSpace.prototype.getBase64Img=CShape.prototype.getBase64Img;CChartSpace.prototype.getDataRefs=function(){if(!this.dataRefs)this.dataRefs=new AscFormat.CChartDataRefs(this);return this.dataRefs};CChartSpace.prototype.clearDataRefs=function(){if(this.dataRefs)this.dataRefs=null};CChartSpace.prototype.AllocPath=function(){return this.pathMemory.AllocPath().startPos}; CChartSpace.prototype.GetPath=function(index){return this.pathMemory.GetPath(index)};CChartSpace.prototype.checkTypeCorrect=function(){if(!this.chart)return false;if(!this.chart.plotArea)return false;if(this.chart.plotArea.charts.length===0)return false;var allSeries=this.getAllSeries();if(allSeries.length===0)return false;return true};CChartSpace.prototype.getSortedChartsId=function(){if(this.chartObj)return this.chartObj._sortChartsForDrawing(this);return[]};CChartSpace.prototype._getSeriesArrayIdx= function(oChart,nSeriesIdx){if(oChart.series[nSeriesIdx]&&oChart.series[nSeriesIdx].idx===nSeriesIdx)return nSeriesIdx;for(var i=0;i 0)text_pr.RFonts.Ascii={Name:minor_font.latin,Index:-1};if(typeof minor_font.ea==="string"&&minor_font.ea.length>0)text_pr.RFonts.EastAsia={Name:minor_font.ea,Index:-1};if(typeof minor_font.cs==="string"&&minor_font.cs.length>0)text_pr.RFonts.CS={Name:minor_font.cs,Index:-1};if(typeof minor_font.sym==="string"&&minor_font.sym.length>0)text_pr.RFonts.HAnsi={Name:minor_font.sym,Index:-1}}style.TextPr=text_pr;var chart_text_pr;if(this.txPr&&this.txPr.content&&this.txPr.content.Content[0]&&this.txPr.content.Content[0].Pr){style.ParaPr.Merge(this.txPr.content.Content[0].Pr); if(this.txPr.content.Content[0].Pr.DefaultRunPr){chart_text_pr=this.txPr.content.Content[0].Pr.DefaultRunPr;style.TextPr.Merge(chart_text_pr)}}if(this.txPr&&this.txPr.content&&this.txPr.content.Content[0]&&this.txPr.content.Content[0].Pr){style.ParaPr.Merge(this.txPr.content.Content[0].Pr);if(this.txPr.content.Content[0].Pr.DefaultRunPr)style.TextPr.Merge(this.txPr.content.Content[0].Pr.DefaultRunPr)}styles.Add(style);return{lastId:style.Id,styles:styles}},this,[])};CChartSpace.prototype.getParagraphTextPr= function(){if(this.selection.title&&!this.selection.textSelection)return GetTextPrFormArrObjects([this.selection.title]);else if(this.selection.legend)if(!AscFormat.isRealNumber(this.selection.legendEntry)){if(AscFormat.isRealNumber(this.legendLength)){var arrForProps=[];for(var i=0;i40)text_pr.Unifill=AscFormat.CreateUnfilFromRGB(255,255,255);else{var default_style=AscFormat.CHART_STYLE_MANAGER.getDefaultLineStyleByIndex(this.style); var oUnifill=default_style.axisAndMajorGridLines.createDuplicate();if(oUnifill&&oUnifill.fill&&oUnifill.fill.color&&oUnifill.fill.color.Mods)oUnifill.fill.color.Mods.Mods.length=0;text_pr.Unifill=oUnifill}else text_pr.Unifill=AscFormat.CreateUnfilFromRGB(0,0,0);text_pr.RFonts.SetFontStyle(AscFormat.fntStyleInd_minor);if(this.txPr&&this.txPr.content&&this.txPr.content.Content[0]&&this.txPr.content.Content[0].Pr.DefaultRunPr)text_pr.Merge(this.txPr.content.Content[0].Pr.DefaultRunPr.Copy());if(text_pr.RFonts&& text_pr.RFonts.Ascii&&text_pr.RFonts.Ascii.Name)text_pr.FontFamily.Name=text_pr.RFonts.Ascii.Name;return text_pr};CChartSpace.prototype.applyLabelsFunction=function(fCallback,value){if(this.selection.title){var DefaultFontSize=18;if(this.selection.title!==this.chart.title)DefaultFontSize=10;fCallback(this.selection.title,value,this.getDrawingDocument(),DefaultFontSize)}else if(this.selection.legend)if(!AscFormat.isRealNumber(this.selection.legendEntry)){fCallback(this.selection.legend,value,this.getDrawingDocument(), 10);for(var i=0;i-1;--i){cur_axis=axis[i];if(cur_axis){cur_axis&& cur_axis.title&&cur_axis.title.txBody&&cur_axis.title.txBody.content.Document_CreateFontMap(allFonts);if(cur_axis.labels)for(j=cur_axis.labels.aLabels.length-1;j>-1;--j)cur_axis.labels.aLabels[j]&&cur_axis.labels.aLabels[j].txBody&&cur_axis.labels.aLabels[j].txBody.content.Document_CreateFontMap(allFonts)}}var series,pts;for(i=this.chart.plotArea.charts.length-1;i>-1;--i){series=this.chart.plotArea.charts[i].series;for(j=series.length-1;j>-1;--j){pts=series[j].getNumPts();if(Array.isArray(pts))for(k= pts.length-1;k>-1;--k)pts[k].compiledDlb&&pts[k].compiledDlb.txBody&&pts[k].compiledDlb.txBody.content.Document_CreateFontMap(allFonts)}}}for(var i=0;ifChartSize)fRetPos-=fRetPos+fSize-fChartSize;if(fRetPos<0)fRetPos=0;return fRetPos};CChartSpace.prototype.calculateSizeByLayout=function(fPos,fChartSize,fLayoutSize,nSizeMode){if(!AscFormat.isRealNumber(fLayoutSize))return-1;var fRetSize=Math.min(fChartSize*fLayoutSize,fChartSize);if(nSizeMode===AscFormat.LAYOUT_MODE_EDGE)fRetSize=fRetSize-fPos;return fRetSize};CChartSpace.prototype.calculateLayoutByPos=function(fPos, nLayoutMode,fPosValue,fChartSize){var fRetLayoutValue=0;if(nLayoutMode===AscFormat.LAYOUT_MODE_EDGE)fRetLayoutValue=fPosValue/fChartSize;else fRetLayoutValue=(fPosValue-fPos)/fChartSize;return fRetLayoutValue};CChartSpace.prototype.calculateLayoutBySize=function(fPos,nSizeMode,fChartSize,fSize){var fRetLayout;if(nSizeMode===AscFormat.LAYOUT_MODE_EDGE)fRetLayout=(fSize-fPos)/fChartSize;else fRetLayout=fSize/fChartSize;return fRetLayout};CChartSpace.prototype.calculateLabelsPositions=function(b_recalc_labels, b_recalc_legend){var layout;for(var i=0;ithis.extX)pos.x-=pos.x+oLbl.extX-this.extX;if(pos.y+oLbl.extY> this.extY)pos.y-=pos.y+oLbl.extY-this.extY;if(pos.x<0)pos.x=0;if(pos.y<0)pos.y=0;oLbl.setPosition(pos.x,pos.y);break}}}this.recalcInfo.dataLbls.length=0;if(b_recalc_labels){if(this.chart&&this.chart.title){var pos=this.chartObj.recalculatePositionText(this.chart.title);if(this.chart.title.layout){layout=this.chart.title.layout;if(AscFormat.isRealNumber(layout.x))pos.x=this.calculatePosByLayout(pos.x,layout.xMode,layout.x,this.chart.title.extX,this.extX);if(AscFormat.isRealNumber(layout.y))pos.y=this.calculatePosByLayout(pos.y, layout.yMode,layout.y,this.chart.title.extY,this.extY)}this.chart.title.setPosition(pos.x,pos.y)}if(this.chart&&this.chart.plotArea){var aAxes=this.chart.plotArea.axId;for(var i=0;i0){oFirstSeries=aAllSeries[0]; if(oFirstSeries.getObjectType()!==AscDFH.historyitem_type_ScatterSer)return oFirstSeries.getValues(oFirstSeries.getValuesCount());else{if(oFirstSeries.xVal)return oFirstSeries.xVal.getValues();var oAxes=this.chart.plotArea.getAxisByTypes();var oValAxis=null;for(var nAxis=0;nAxis0)oLitFormat=oNumFormatCache.get(oLit.formatCode);if(oAxis.numFmt&&typeof oAxis.numFmt.formatCode==="string"&&oAxis.numFmt.formatCode.length>0)oLitFormat=oNumFormatCache.get(oAxis.numFmt.formatCode);nPtsLen=oLit.ptCount;var bTickSkip=AscFormat.isRealNumber(oAxis.tickLblSkip)||nPtsLen>=SKIP_LBL_LIMIT;var nTickLblSkip=AscFormat.isRealNumber(oAxis.tickLblSkip)? oAxis.tickLblSkip:nPtsLen0){oPtFormat=oNumFormatCache.get(oPt.formatCode);if(oPtFormat)sPt=oPtFormat.formatToChart(oPt.val);else sPt=oPt.val+""}else if(oLitFormat)sPt=oLitFormat.formatToChart(oPt.val);else sPt=oPt.val+"";aStrings.push(sPt)}else aStrings.push("")}else aStrings.push(null)}}var nPtsLength= 0;var aChartsForAxis=oPlotArea.getChartsForAxis(oAxis);for(i=0;i0)oLitFormatDate=oNumFormatCache.get(oAxis.numFmt.formatCode);if(nPtsLength>aStrings.length){bTickSkip=AscFormat.isRealNumber(oAxis.tickLblSkip)||nPtsLength>=SKIP_LBL_LIMIT;nTickLblSkip=AscFormat.isRealNumber(oAxis.tickLblSkip)?oAxis.tickLblSkip:nPtsLength0){while(aStrings.length0)break;aStrings.splice(0,0,"")}}break}case AscDFH.historyitem_type_ValAx:{var aVal= [].concat(oAxis.scale);var fMultiplier;if(oAxis.dispUnits)fMultiplier=oAxis.dispUnits.getMultiplier();else fMultiplier=1;var oNumFormat=null;var sFormatCode=oAxis.getFormatCode();if(typeof sFormatCode==="string")oNumFormat=oNumFormatCache.get(sFormatCode);if(!oNumFormat)oNumFormat=oNumFormatCache.get("General");for(var t=0;t1;var nIntervalsCount=bOnTickMark?aStrings.length-1:aStrings.length;var fInterval; oAxisGrid.nCount=nIntervalsCount;oAxisGrid.bOnTickMark=bOnTickMark;oAxisGrid.aStrings=aStrings;if(oAxis.axPos===AscFormat.AX_POS_B||oAxis.axPos===AscFormat.AX_POS_T){oAxisGrid.nType=0;fInterval=oRect.w/nIntervalsCount;if(nOrientation===AscFormat.ORIENTATION_MIN_MAX){oAxisGrid.fStart=oRect.x;oAxisGrid.fStride=fInterval}else{oAxisGrid.fStart=oRect.x+oRect.w;oAxisGrid.fStride=-fInterval}}else{oAxis.yPoints=[];oAxisGrid.nType=1;fInterval=oRect.h/nIntervalsCount;if(nOrientation===AscFormat.ORIENTATION_MIN_MAX){oAxisGrid.fStart= oRect.y+oRect.h;oAxisGrid.fStride=-fInterval}else{oAxisGrid.fStart=oRect.y;oAxisGrid.fStride=fInterval}}};CChartSpace.prototype.recalculateAxesSet=function(aAxesSet,oRect,oBaseRect,nIndex,fForceContentWidth){var oCorrectedRect=null;var bWithoutLabels=false;if(this.chart.plotArea.layout&&this.chart.plotArea.layout.layoutTarget===AscFormat.LAYOUT_TARGET_INNER)bWithoutLabels=true;var bCorrected=false;var fL=oRect.x,fT=oRect.y,fR=oRect.x+oRect.w,fB=oRect.y+oRect.h;var fHorPadding=0;var fVertPadding=0; var fHorInterval=null;var oCalcMap={};for(var i=0;i=oCurAxis.crossesAt){fCrossValue=oCurAxis.crossesAt;bCrossAt=true}else switch(oCurAxis.crosses){case AscFormat.CROSSES_MAX:{fCrossValue=oCrossAxis.scale[oCrossAxis.scale.length-1];if(!oCrossGrid.bOnTickMark)fCrossValue+= 1;if(nLabelsPos===c_oAscTickLabelsPos.TICK_LABEL_POSITION_NEXT_TO){fDistance=-fDistance;bLabelsExtremePosition=true}break}case AscFormat.CROSSES_MIN:{fCrossValue=oCrossAxis.scale[0];if(nLabelsPos===c_oAscTickLabelsPos.TICK_LABEL_POSITION_NEXT_TO)bLabelsExtremePosition=true;if(!oCrossGrid.bOnTickMark)fCrossValue-=1}default:{if(oCrossAxis.scale[0]<=0&&oCrossAxis.scale[oCrossAxis.scale.length-1]>=0)fCrossValue=0;else if(oCrossAxis.scale[0]>0)fCrossValue=oCrossAxis.scale[0];else fCrossValue=oCrossAxis.scale[oCrossAxis.scale.length- 1]}}if(AscFormat.fApproxEqual(fCrossValue,oCrossAxis.scale[0])||AscFormat.fApproxEqual(fCrossValue,oCrossAxis.scale[oCrossAxis.scale.length-1]))bLabelsExtremePosition=true;var fTickAdd=0;var bKoeff=1;if(oCrossAxis.scale.length>1)bKoeff=oCrossAxis.scale[1]-oCrossAxis.scale[0];fAxisPos=oCrossGrid.fStart;if(oCrossAxis.scale.length>0)fAxisPos+=(fCrossValue-oCrossAxis.scale[0])*oCrossGrid.fStride/bKoeff;var nOrientation=isRealObject(oCrossAxis.scaling)&&AscFormat.isRealNumber(oCrossAxis.scaling.orientation)? oCrossAxis.scaling.orientation:AscFormat.ORIENTATION_MIN_MAX;if(nOrientation===AscFormat.ORIENTATION_MAX_MIN)fDistance=-fDistance;var oLabelsBox=null,fPos;var fPosStart=oCurAxis.grid.fStart;var fPosEnd=oCurAxis.grid.fStart+oCurAxis.grid.nCount*oCurAxis.grid.fStride;var bForceVertical=false;var bNumbers=false;if(nLabelsPos!==c_oAscTickLabelsPos.TICK_LABEL_POSITION_NONE){oLabelsBox=new CLabelsBox(oCurAxis.grid.aStrings,oCurAxis,this);switch(nLabelsPos){case c_oAscTickLabelsPos.TICK_LABEL_POSITION_NEXT_TO:{fPos= fAxisPos;break}case c_oAscTickLabelsPos.TICK_LABEL_POSITION_HIGH:{fPos=oCrossGrid.fStart+oCrossGrid.nCount*oCrossGrid.fStride;fDistance=-fDistance;break}case c_oAscTickLabelsPos.TICK_LABEL_POSITION_LOW:{fPos=oCrossGrid.fStart;break}}}oCurAxis.labels=oLabelsBox;oCurAxis.posX=null;oCurAxis.posY=null;oCurAxis.xPoints=null;oCurAxis.yPoints=null;var aPoints=null;if(oCurAxis.getObjectType()===AscDFH.historyitem_type_SerAx);else if(oCurAxis.axPos===AscFormat.AX_POS_B||oCurAxis.axPos===AscFormat.AX_POS_T){oCurAxis.posY= fAxisPos;oCurAxis.xPoints=[];aPoints=oCurAxis.xPoints;if(oLabelsBox){if(!AscFormat.fApproxEqual(oRect.fVertPadding,0)){fPos-=oRect.fVertPadding;if(nLabelsPos===c_oAscTickLabelsPos.TICK_LABEL_POSITION_NEXT_TO)oCurAxis.posY-=oRect.fVertPadding}var nTickLblSkip=AscFormat.isRealNumber(oCurAxis.tickLblSkip)?oCurAxis.tickLblSkip:1;var bTickSkip=nTickLblSkip>1;var fAxisLength=fPosEnd-fPosStart;var nLabelsCount=oLabelsBox.aLabels.length;var bOnTickMark_=bOnTickMark&&nLabelsCount>1;var nIntervalCount=bOnTickMark_? nLabelsCount-1:nLabelsCount;fHorInterval=Math.abs(fAxisLength/nIntervalCount);if(bTickSkip&&!AscFormat.isRealNumber(fForceContentWidth))fForceContentWidth=Math.abs(fHorInterval)+fHorInterval/nTickLblSkip;if(AscFormat.isRealNumber(oCurAxis.lblOffset)){var fStakeOffset=oCurAxis.lblOffset/100;var oFirstTextPr=null;for(var tt=0;tt0)fVertPadding=-oLabelsBox.extY;else fVertPadding=oLabelsBox.extY}}else{fDistance=-fDistance;oCurAxis.posX=fAxisPos;oCurAxis.yPoints=[];aPoints=oCurAxis.yPoints;if(oLabelsBox){if(!AscFormat.fApproxEqual(oRect.fHorPadding, 0)){fPos-=oRect.fHorPadding;if(nLabelsPos===c_oAscTickLabelsPos.TICK_LABEL_POSITION_NEXT_TO)oCurAxis.posX-=oRect.fHorPadding}fLayoutVertLabelsBox(oLabelsBox,fPos,fPosStart,fPosEnd,bOnTickMark,fDistance,bForceVertical);if(bLabelsExtremePosition)if(fDistance>0)fHorPadding=-oLabelsBox.extX;else fHorPadding=oLabelsBox.extX}}if(null!==aPoints){var fStartSeriesPos=0;if(!bOnTickMark)fStartSeriesPos=oCurAxis.grid.fStride/2;for(var j=0;jfR)fR=oLabelsBox.x+oLabelsBox.extX;if(oLabelsBox.yfB)fB=oLabelsBox.y+oLabelsBox.extY}}if(nIndex<2){var fDiff;var fPrecision=.01;oCorrectedRect=new CRect(oRect.x,oRect.y,oRect.w,oRect.h);if(bWithoutLabels){fDiff=fL;if(fDiff<0&&!AscFormat.fApproxEqual(fDiff,0,fPrecision)){oCorrectedRect.x-=fDiff;bCorrected= true}fDiff=fR-this.extX;if(fDiff>0&&!AscFormat.fApproxEqual(fDiff,0,fPrecision)){oCorrectedRect.w-=fDiff;bCorrected=true}fDiff=fT;if(fDiff<0&&!AscFormat.fApproxEqual(fDiff,0,fPrecision)){oCorrectedRect.y-=fDiff;bCorrected=true}fDiff=fB-this.extY;if(fDiff>0&&!AscFormat.fApproxEqual(fDiff,0,fPrecision)){oCorrectedRect.h-=fB-this.extY;bCorrected=true}}else{fDiff=oBaseRect.x-fL;if(!AscFormat.fApproxEqual(fDiff,0,fPrecision)){oCorrectedRect.x+=fDiff;oCorrectedRect.w-=fDiff;bCorrected=true}fDiff=oBaseRect.x+ oBaseRect.w-fR;if(!AscFormat.fApproxEqual(fDiff,0,fPrecision)){oCorrectedRect.w+=fDiff;bCorrected=true}fDiff=oBaseRect.y-fT;if(!AscFormat.fApproxEqual(fDiff,0,fPrecision)){oCorrectedRect.y+=fDiff;oCorrectedRect.h-=fDiff;bCorrected=true}fDiff=oBaseRect.y+oBaseRect.h-fB;if(!AscFormat.fApproxEqual(fDiff,0,fPrecision)){oCorrectedRect.h+=fDiff;bCorrected=true}}if(oCorrectedRect&&bCorrected)if(oCorrectedRect.w>oRect.w)return this.recalculateAxesSet(aAxesSet,oCorrectedRect,oBaseRect,++nIndex,fHorInterval); else return this.recalculateAxesSet(aAxesSet,oCorrectedRect,oBaseRect,++nIndex)}var _ret=oRect.copy();_ret.fHorPadding=fHorPadding;_ret.fVertPadding=fVertPadding;return _ret};CChartSpace.prototype.getReplaceAxis=function(oAxis){var aAxes=this.chart.plotArea.axId;if(oAxis.bDelete&&oAxis.getObjectType()===AscDFH.historyitem_type_ValAx){var bHorizontal=oAxis.axPos===AscFormat.AX_POS_T||oAxis.axPos===AscFormat.AX_POS_B;for(var j=0;j-1;--j){oCurAxis=oChart.axId[j];oReplaceAxis=this.getReplaceAxis(oCurAxis);if(oReplaceAxis){bAdd=true;oChart.axId.push(oReplaceAxis)}}if(bAdd)oChartsToAxesCount[oChart.Id]=nAxesCount;for(j=0;j0){oCurAxis=aAxes.splice(0,1)[0];aCurAxesSet=[];aCurAxesSet.push(oCurAxis);for(i=aAxes.length-1;i>-1;--i){oCurAxis2=aAxes[i];for(j=0;j 1)aAllAxes.push(aCurAxesSet)}var oSize=this.getChartSizes();var oRect=new CRect(oSize.startX,oSize.startY,oSize.w,oSize.h);var oBaseRect=oRect;var aRects=[];for(i=0;i1){oRect=aRects[0].copy();for(i=1;iMath.abs(aRects[i].fVertPadding)){if(aRects2[i].fVertPadding>0){aRects[i].y+=aRects2[i].fVertPadding-aRects[i].fVertPadding;aRects[i].h-= aRects2[i].fVertPadding-aRects[i].fVertPadding}else aRects[i].h-=Math.abs(aRects2[i].fVertPadding-aRects[i].fVertPadding);aRects[i].fVertPadding=aRects2[i].fVertPadding;bCheckPaddings=true}if(Math.abs(aRects2[i].fHorPadding)>Math.abs(aRects[i].fHorPadding)){if(aRects2[i].fHorPadding>0){aRects[i].x+=aRects2[i].fHorPadding-aRects[i].fHorPadding;aRects[i].w-=aRects2[i].fHorPadding-aRects[i].fHorPadding}else aRects[i].w-=Math.abs(aRects2[i].fHorPadding-aRects[i].fHorPadding);aRects[i].fHorPadding=aRects2[i].fHorPadding; bCheckPaddings=true}}if(bCheckPaddings){oRect=aRects[0].copy();for(i=1;i0)dlbl.lastStyleObject=y_ax.labels.aLabels[0].lastStyleObject;var oRecalculateByMaxWord=dlbl.tx.rich.recalculateByMaxWord();var cur_width=oRecalculateByMaxWord.w;if(i===arr_strings.length-1)rect.y+=oRecalculateByMaxWord.h/2;if(cur_width>max_width)max_width=cur_width;y_ax.labels.aLabels.push(dlbl)}var hor_gap=y_ax.labels.aLabels[0].tx.rich.content.Content[0].CompiledPr.Pr.TextPr.FontSize*(25.4/72);y_ax.labels.extX= max_width+hor_gap;var arr_x_val=this.getXValAxisValues();var num_fmt=x_ax.numFmt;var string_pts=[];if(num_fmt&&typeof num_fmt.formatCode==="string"){var num_format=oNumFormatCache.get(num_fmt.formatCode);for(i=0;imax_height)max_height=cur_height;if(i===string_pts.length-1)rect.w-=oWH.w/2;x_ax.labels.aLabels.push(dlbl)}var vert_gap=x_ax.labels.aLabels[0].tx.rich.content.Content[0].CompiledPr.Pr.TextPr.FontSize*(25.4/72);x_ax.labels.extY=max_height+vert_gap;var x_ax_orientation=isRealObject(x_ax.scaling)&&AscFormat.isRealNumber(x_ax.scaling.orientation)?x_ax.scaling.orientation:AscFormat.ORIENTATION_MIN_MAX;var crosses;if(y_ax.crosses===AscFormat.CROSSES_AUTO_ZERO)if(arr_x_val[0]<=0&&arr_x_val[arr_x_val.length- 1]>=0)crosses=0;else if(arr_x_val[0]>0)crosses=arr_x_val[0];else crosses=arr_x_val[arr_x_val.length-1];else if(y_ax.crosses===AscFormat.CROSSES_MAX)crosses=arr_x_val[arr_x_val.length-1];else if(y_ax.crosses===AscFormat.CROSSES_MIN)crosses=arr_x_val[0];else if(AscFormat.isRealNumber(y_ax.crossesAt)&&arr_val[0]<=y_ax.crossesAt&&arr_val[arr_val.length-1]>=y_ax.crossesAt)crosses=y_ax.crossesAt;else if(arr_x_val[0]<=0&&arr_x_val[arr_x_val.length-1]>=0)crosses=0;else if(arr_x_val[0]>0)crosses=arr_x_val[0]; else crosses=arr_x_val[arr_x_val.length-1];var hor_interval_width=checkFiniteNumber(rect.w/(arr_x_val[arr_x_val.length-1]-arr_x_val[0]));var vert_interval_height=checkFiniteNumber(rect.h/(arr_val[arr_val.length-1]-arr_val[0]));var arr_x_points=[],arr_y_points=[];var labels_pos=y_ax.tickLblPos;var first_hor_label_half_width=x_ax.tickLblPos===c_oAscTickLabelsPos.TICK_LABEL_POSITION_NONE||x_ax.bDelete?0:x_ax.labels.aLabels[0].tx.rich.content.XLimit/2;var last_hor_label_half_width=x_ax.tickLblPos===c_oAscTickLabelsPos.TICK_LABEL_POSITION_NONE|| x_ax.bDelete?0:x_ax.labels.aLabels[x_ax.labels.aLabels.length-1].tx.rich.content.XLimit/2;var left_gap=0,right_gap=0;if(x_ax_orientation===AscFormat.ORIENTATION_MIN_MAX)switch(labels_pos){case c_oAscTickLabelsPos.TICK_LABEL_POSITION_HIGH:{left_align_labels=false;if(bNeedReflect)right_gap=Math.max(last_hor_label_half_width,0);else right_gap=Math.max(last_hor_label_half_width,y_ax.labels.extX);if(!bWithoutLabels){hor_interval_width=checkFiniteNumber((rect.w-right_gap-first_hor_label_half_width)/(arr_x_val[arr_x_val.length- 1]-arr_x_val[0]));for(i=0;ithis.extX&&!bNeedReflect){rect.w-=y_ax.labels.x+y_ax.labels.extX-this.extX;bCorrectedLayoutRect=true}if(bCorrectedLayoutRect){hor_interval_width=checkFiniteNumber(rect.w/(arr_x_val[arr_x_val.length- 1]-arr_x_val[0]));for(i=0;ithis.extX&&!bNeedReflect){rect.w-=y_ax.labels.x+y_ax.labels.extX-this.extX;bCorrectedLayoutRect=true}if(bCorrectedLayoutRect){hor_interval_width=checkFiniteNumber(rect.w/(arr_x_val[arr_x_val.length-1]-arr_x_val[0]));for(i=0;ithis.extX&&!bNeedReflect){rect.w-=y_ax.labels.x+y_ax.labels.extX-this.extX;bCorrectedLayoutRect=true}if(bCorrectedLayoutRect){y_ax.labels.x=rect.x+rect.w;y_ax.posX=rect.x+rect.w;hor_interval_width=checkFiniteNumber(rect.w/ (arr_x_val[arr_x_val.length-1]-arr_x_val[0]));for(i=0;ithis.extX&&!bNeedReflect){rect.w-=y_ax.labels.x+y_ax.labels.extX-this.extX;bCorrectedLayoutRect=true}if(bCorrectedLayoutRect){hor_interval_width=checkFiniteNumber(rect.w/(arr_x_val[arr_x_val.length-1]-arr_x_val[0]));y_ax.posX=rect.x+rect.w-(arr_x_val[arr_x_val.length-1]- crosses)*hor_interval_width;for(i=0;ithis.extX&&!bNeedReflect){rect.w-=y_ax.labels.x+y_ax.labels.extX-this.extX;bCorrectedLayoutRect=true}if(bCorrectedLayoutRect){hor_interval_width=checkFiniteNumber(rect.w/(arr_x_val[arr_x_val.length-1]-arr_x_val[0])); y_ax.posX=rect.x+rect.w-(crosses-arr_x_val[0])*hor_interval_width;for(i=0;ithis.extX&&!bNeedReflect){rect.w-=y_ax.labels.x+y_ax.labels.extX-this.extX;bCorrectedLayoutRect=true}if(bCorrectedLayoutRect){hor_interval_width=checkFiniteNumber(rect.w/(arr_x_val[arr_x_val.length-1]-arr_x_val[0]));y_ax.posX=rect.x+rect.w-(crosses-arr_x_val[0])*hor_interval_width; for(i=0;ithis.extX&&!bNeedReflect){rect.w-=y_ax.labels.x+y_ax.labels.extX-this.extX;bCorrectedLayoutRect=true}if(bCorrectedLayoutRect){hor_interval_width=checkFiniteNumber(rect.w/(arr_x_val[arr_x_val.length-1]-arr_x_val[0]));y_ax.posX=rect.x+rect.w-(crosses-arr_x_val[0])*hor_interval_width;y_ax.labels.x=y_ax.posX-(arr_x_val[arr_x_val.length- 1]-crosses)*hor_interval_width-y_ax.labels.extX}}}else{left_align_labels=false;if(!bWithoutLabels){hor_interval_width=checkFiniteNumber((rect.w-first_hor_label_half_width-last_hor_label_half_width)/(arr_x_val[arr_x_val.length-1]-arr_x_val[0]));if(!bNeedReflect&&first_hor_label_half_width+(crosses-arr_x_val[0])*hor_interval_widththis.extX&&!bNeedReflect){rect.w-= y_ax.labels.x+y_ax.labels.extX-this.extX;bCorrectedLayoutRect=true}if(bCorrectedLayoutRect){hor_interval_width=checkFiniteNumber(rect.w/(arr_x_val[arr_x_val.length-1]-arr_x_val[0]));left_align_labels=false;y_ax.posX=rect.x+hor_interval_width*(arr_x_val[arr_x_val.length-1]-crosses);y_ax.labels.x=y_ax.posX}}}for(i=0;i=0)crosses_x=0;else if(arr_val[0]>0)crosses_x=arr_val[0];else crosses_x=arr_val[arr_val.length-1];else if(x_ax.crosses===AscFormat.CROSSES_MAX)crosses_x=arr_val[arr_val.length-1];else if(x_ax.crosses===AscFormat.CROSSES_MIN)crosses_x=arr_val[0];else if(AscFormat.isRealNumber(x_ax.crossesAt)&&arr_val[0]<=x_ax.crossesAt&&arr_val[arr_val.length- 1]>=x_ax.crossesAt)crosses_x=x_ax.crossesAt;else if(arr_val[0]<=0&&arr_val[arr_val.length-1]>=0)crosses_x=0;else if(arr_val[0]>0)crosses_x=arr_val[0];else crosses_x=arr_val[arr_val.length-1];var tick_labels_pos_x=x_ax.tickLblPos;var first_vert_label_half_height=0;var last_vert_label_half_height=0;var bottom_gap=0,top_height=0;if(y_ax_orientation===AscFormat.ORIENTATION_MIN_MAX)switch(tick_labels_pos_x){case c_oAscTickLabelsPos.TICK_LABEL_POSITION_HIGH:{bottom_align_labels=false;var bottom_start_point= rect.y+rect.h-first_vert_label_half_height;top_height=Math.max(x_ax.labels.extY,last_vert_label_half_height);if(!bWithoutLabels){vert_interval_height=checkFiniteNumber((rect.h-top_height-first_vert_label_half_height)/(arr_val[arr_val.length-1]-arr_val[0]));x_ax.labels.y=bottom_start_point-(arr_val[arr_val.length-1]-arr_val[0])*vert_interval_height-x_ax.labels.extY;for(i=0;ithis.extY){bCheckXLabels=true;rect.h-=x_ax.labels.y+x_ax.labels.extY-this.extY}if(bCheckXLabels){vert_interval_height=checkFiniteNumber(rect.h/(arr_val[arr_val.length-1]-arr_val[0]));x_ax.labels.y=rect.y+rect.h-(arr_val[arr_val.length-1]-arr_val[0])*vert_interval_height-x_ax.labels.extY;for(i=0;ithis.extY){bCheckXLabels=true;rect.h-=x_ax.labels.y+x_ax.labels.extY-this.extY}if(bCheckXLabels){x_ax.labels.y=rect.y+rect.h;vert_interval_height=checkFiniteNumber(rect.h/ (arr_val[arr_val.length-1]-arr_val[0]));for(i=0;ithis.extY){bCheckXLabels=true;rect.h-=x_ax.labels.y+x_ax.labels.extY- this.extY}if(bCheckXLabels){vert_interval_height=checkFiniteNumber(rect.h/(arr_val[arr_val.length-1]-arr_val[0]));for(i=0;ithis.extY){bCheckXLabels=true;rect.h-=x_ax.labels.y+x_ax.labels.extY-this.extY}if(bCheckXLabels){vert_interval_height=checkFiniteNumber(rect.h/ (arr_val[arr_val.length-1]-arr_val[0]));x_ax.posY=rect.y+(arr_val[arr_val.length-1]-crosses_x)*vert_interval_height;x_ax.labels.y=x_ax.posY;for(i=0;ithis.extY){bCheckXLabels=true;rect.h-=x_ax.labels.y+x_ax.labels.extY-this.extY}if(bCheckXLabels){vert_interval_height=checkFiniteNumber(rect.h/(arr_val[arr_val.length-1]-arr_val[0]));x_ax.posY=rect.y+(crosses_x-arr_val[0])* vert_interval_height;for(i=0;ithis.extY){bCheckXLabels=true;rect.h-=x_ax.labels.y+x_ax.labels.extY-this.extY}if(bCheckXLabels){vert_interval_height=checkFiniteNumber(rect.h/(arr_val[arr_val.length-1]-arr_val[0]));x_ax.posY=rect.y+(crosses_x-arr_val[0])*vert_interval_height;for(i=0;ithis.extY){bCheckXLabels=true;rect.h-=x_ax.labels.y+x_ax.labels.extY-this.extY}if(bCheckXLabels){vert_interval_height=checkFiniteNumber(rect.h/(arr_val[arr_val.length-1]-arr_val[0]));x_ax.posY=rect.y+(crosses_x-arr_val[0])*vert_interval_height;for(i=0;ithis.extY){bCheckXLabels=true;rect.h-=x_ax.labels.y+x_ax.labels.extY-this.extY}if(bCheckXLabels){vert_interval_height=checkFiniteNumber(rect.h/(arr_val[arr_val.length-1]-arr_val[0]));x_ax.posY=rect.y+rect.h-vert_interval_height*(arr_val[arr_val.length-1]-crosses_x);x_ax.labels.y=x_ax.posY-x_ax.labels.extY;for(i=0;i max_width)max_width=cur_width;if(t.h>max_val_labels_text_height)max_val_labels_text_height=t.h;val_ax.labels.aLabels.push(dlbl);val_ax.yPoints.push({val:arr_val[i],pos:null})}var val_axis_labels_gap=val_ax.labels.aLabels[0].tx.rich.content.Content[0].CompiledPr.Pr.TextPr.FontSize*25.4/72;val_ax.labels.extX=max_width+val_axis_labels_gap;var ser=chart_object.series[0];var string_pts=[],pts_len=0;if(ser&&ser.cat){var lit,b_num_lit=true;lit=ser.cat.getLit();if(lit){b_num_lit=lit.getObjectType()===AscDFH.historyitem_type_NumLit; var lit_format=null,pt_format=null;if(b_num_lit&&typeof lit.formatCode==="string"&&lit.formatCode.length>0)lit_format=oNumFormatCache.get(lit.formatCode);pts_len=lit.ptCount;for(i=0;i0){pt_format=oNumFormatCache.get(pt.formatCode);if(pt_format)str_pt=pt_format.formatToChart(pt.val);else str_pt=pt.val}else if(lit_format)str_pt=lit_format.formatToChart(pt.val);else str_pt= pt.val;else str_pt=pt.val;string_pts.push({val:str_pt+""})}else string_pts.push({val:""})}}}var cross_between=this.getValAxisCrossType();if(cross_between===null)cross_between=AscFormat.CROSS_BETWEEN_BETWEEN;{pts_len=0;for(i=0;istring_pts.length)for(i=string_pts.length;i0)crosses= val_ax.crossesAt;else if(val_ax.crossesAt<=0)crosses=1;else crosses=string_pts.length;else crosses=1;cat_ax.maxCatVal=string_pts.length;var cat_ax_orientation=cat_ax.scaling&&AscFormat.isRealNumber(cat_ax.scaling.orientation)?cat_ax.scaling.orientation:AscFormat.ORIENTATION_MIN_MAX;var point_width=rect.w/string_pts.length;var labels_pos=val_ax.tickLblPos;if(val_ax.bDelete)labels_pos=c_oAscTickLabelsPos.TICK_LABEL_POSITION_NONE;var left_val_ax_labels_align=true;var intervals_count=cross_between=== AscFormat.CROSS_BETWEEN_MID_CAT?string_pts.length-1:string_pts.length;var point_interval=rect.w/intervals_count;if(cross_between===AscFormat.CROSS_BETWEEN_MID_CAT)point_interval=checkFiniteNumber(rect.w/(string_pts.length-1));else point_interval=checkFiniteNumber(rect.w/string_pts.length);var left_points_width,right_point_width;var arr_cat_labels_points=[];if(cat_ax_orientation===AscFormat.ORIENTATION_MIN_MAX)if(labels_pos===c_oAscTickLabelsPos.TICK_LABEL_POSITION_NEXT_TO||!AscFormat.isRealNumber(labels_pos))if(val_ax.crosses=== AscFormat.CROSSES_MAX){left_val_ax_labels_align=false;if(!bWithoutLabels){val_ax.labels.x=rect.x+rect.w-val_ax.labels.extX;if(!bNeedReflect)point_interval=checkFiniteNumber((rect.w-val_ax.labels.extX)/intervals_count);else point_interval=checkFiniteNumber(rect.w/intervals_count);val_ax.posX=val_ax.labels.x;if(cross_between===AscFormat.CROSS_BETWEEN_MID_CAT)for(i=0;ithis.extX){rect.w-=rect.x+rect.w-this.extX;bCorrectedLayoutRect=true}point_interval=checkFiniteNumber(rect.w/intervals_count);val_ax.posX=val_ax.labels.x;if(cross_between===AscFormat.CROSS_BETWEEN_MID_CAT)for(i=0;ithis.extX){rect.w-=rect.x+rect.w-this.extX;bCorrectedLayoutRect=true}point_interval=checkFiniteNumber(rect.w/intervals_count);if(cross_between===AscFormat.CROSS_BETWEEN_MID_CAT)for(i=0;ithis.extX){rect.w-=rect.x+rect.w-this.extX;bCorrectedLayoutRect=true}point_interval=checkFiniteNumber(rect.w/intervals_count);if(cross_between===AscFormat.CROSS_BETWEEN_MID_CAT)for(i=0;ithis.extX){rect.w-= rect.x+rect.w-this.extX;bCorrectedLayoutRect=true}point_interval=checkFiniteNumber(rect.w/intervals_count);if(cross_between===AscFormat.CROSS_BETWEEN_MID_CAT)for(i=0;ithis.extX){rect.w-=rect.x+rect.w-this.extX;bCorrectedLayoutRect=true}point_interval=checkFiniteNumber(rect.w/intervals_count);if(cross_between===AscFormat.CROSS_BETWEEN_MID_CAT)for(i=0;ithis.extX){rect.w-=rect.x+rect.w-this.extX;bCorrectedLayoutRect=true}point_interval=checkFiniteNumber(rect.w/intervals_count);if(cross_between===AscFormat.CROSS_BETWEEN_MID_CAT)for(i=0;i0)dlbl.lastStyleObject=cat_ax.labels.aLabels[0].lastStyleObject;var min_max=dlbl.tx.rich.content.RecalculateMinMaxContentWidth(); var max_min_content_width=min_max.Min;if(max_min_content_width>max_min_width)max_min_width=max_min_content_width;if(min_max.Max>max_max_width)max_max_width=min_max.Max;if(dlbl.tx.rich.content.Content[0].Content[0].TextHeight>fMaxContentStringH)fMaxContentStringH=dlbl.tx.rich.content.Content[0].Content[0].TextHeight}cat_ax.labels.aLabels.push(dlbl)}fMaxContentStringH*=1;var stake_offset=AscFormat.isRealNumber(cat_ax.lblOffset)?cat_ax.lblOffset/100:1;var labels_offset=cat_ax.labels.aLabels[0].tx.rich.content.Content[0].CompiledPr.Pr.TextPr.FontSize* (25.4/72)*stake_offset;if(max_min_widthmax_height)max_height=cur_height}cat_ax.labels.extY=max_height+labels_offset;if(cross_between===AscFormat.CROSS_BETWEEN_MID_CAT){var left_gap_point,right_gap_point;if(cat_ax_orientation=== AscFormat.ORIENTATION_MIN_MAX){var first_label_left_gap=cat_ax.labels.aLabels[0].tx.rich.getMaxContentWidth(max_cat_label_width)/2;var last_labels_right_gap=cat_ax.labels.aLabels[cat_ax.labels.aLabels.length-1]?cat_ax.labels.aLabels[cat_ax.labels.aLabels.length-1].tx.rich.getMaxContentWidth(max_cat_label_width)/2:0;left_gap_point=arr_cat_labels_points[0]-first_label_left_gap;if(rect.x>left_gap_point&&!bWithoutLabels){if(val_ax.labels)val_ax.labels.x=rect.x+(val_ax.labels.x-left_gap_point)*checkFiniteNumber(rect.w/ (rect.x+rect.w-left_gap_point));point_interval*=checkFiniteNumber(rect.w/(rect.x+rect.w-left_gap_point));for(i=0;irect.x+ rect.w&&!bWithoutLabels){if(val_ax.labels)val_ax.labels.x=rect.x+(val_ax.labels.x-rect.x)*checkFiniteNumber(rect.w/(right_gap_point-rect.x));point_interval*=checkFiniteNumber(rect.w/(right_gap_point-rect.x));for(i=0;ileft_gap_point&&!bWithoutLabels){if(val_ax.labels)val_ax.labels.x=rect.x+(val_ax.labels.x-left_gap_point)*checkFiniteNumber(rect.w/ (rect.x+rect.w-left_gap_point));point_interval*=checkFiniteNumber(rect.w/(rect.x+rect.w-left_gap_point));for(i=0;irect.x+rect.w&&!bWithoutLabels){if(val_ax.labels)val_ax.labels.x=rect.x+(val_ax.labels.x-rect.x)*checkFiniteNumber(rect.w/ (right_gap_point-rect.x));point_interval*=checkFiniteNumber(rect.w/(right_gap_point-rect.x));for(i=0;i0){nMaxCount=diagram_width/fMaxContentStringH;nSkip=Math.max(1,cat_ax.labels.aLabels.length/nMaxCount+1>>0)}else bTickSkip=true;for(i=0;imax_rotated_height)max_rotated_height=h2;nLblCount++;nCount++;cat_ax.labels.aLabels[i].widthForTransform=wh.w}else{arr_left_points[i]=arr_cat_labels_points[i];arr_right_points[i]=arr_cat_labels_points[i]}cat_ax.labels.extY=max_rotated_height+labels_offset;left_gap_point=Math.max(0,Math.min.apply(Math, arr_left_points));right_gap_point=Math.max(0,Math.max.apply(Math,arr_right_points));if(!bWithoutLabels)if(AscFormat.ORIENTATION_MIN_MAX===cat_ax_orientation){if(rect.x>left_gap_point){if(val_ax.labels)val_ax.labels.x=rect.x+(val_ax.labels.x-left_gap_point)*checkFiniteNumber(rect.w/(rect.x+rect.w-left_gap_point));point_interval*=checkFiniteNumber(rect.w/(rect.x+rect.w-left_gap_point));for(i=0;irect.x+rect.w){if(val_ax.labels)val_ax.labels.x=rect.x+(val_ax.labels.x-rect.x)*checkFiniteNumber(rect.w/(right_gap_point-rect.x));point_interval*=checkFiniteNumber((right_gap_point-rect.x)/(rect.x+rect.w-rect.x));for(i=0;ileft_gap_point){if(val_ax.labels)val_ax.labels.x=rect.x+(val_ax.labels.x-left_gap_point)*checkFiniteNumber(rect.w/(rect.x+rect.w-left_gap_point));point_interval*=rect.w/checkFiniteNumber(rect.x+rect.w-left_gap_point);for(i=0;irect.x+rect.w){if(val_ax.labels)val_ax.labels.x=rect.x+(val_ax.labels.x-rect.x)*checkFiniteNumber(rect.w/(right_gap_point-rect.x));point_interval*=checkFiniteNumber((right_gap_point-rect.x)/(rect.x+rect.w-rect.x));for(i=0;imax_width)max_width=cur_width;if(t.h>max_val_labels_text_height)max_val_labels_text_height=t.h;ser_ax.labels.aLabels.push(dlbl)}}var ser_axis_labels_gap=ser_ax.labels.aLabels[0].tx.rich.content.Content[0].CompiledPr.Pr.TextPr.FontSize*25.4/72;ser_ax.labels.extX=max_width+ser_axis_labels_gap;ser_ax.labels.extY=max_val_labels_text_height}else ser_ax.labels= null;var cat_labels_align_bottom=true;var crosses_val_ax;if(cat_ax.crosses===AscFormat.CROSSES_AUTO_ZERO)if(arr_val[0]<=0&&arr_val[arr_val.length-1]>=0)crosses_val_ax=0;else if(arr_val[arr_val.length-1]<0)crosses_val_ax=arr_val[arr_val.length-1];else crosses_val_ax=arr_val[0];else if(cat_ax.crosses===AscFormat.CROSSES_MIN)crosses_val_ax=arr_val[0];else if(cat_ax.crosses===AscFormat.CROSSES_MAX)crosses_val_ax=arr_val[arr_val.length-1];else if(AscFormat.isRealNumber(cat_ax.crossesAt)&&cat_ax.crossesAt>= arr_val[0]&&cat_ax.crossesAt<=arr_val[arr_val.length-1]){if(cat_ax.crossesAt>=arr_val[0]&&cat_ax.crossesAt<=arr_val[arr_val.length-1])crosses_val_ax=cat_ax.crossesAt}else if(arr_val[0]<=0&&arr_val[arr_val.length-1]>=0)crosses_val_ax=0;else if(arr_val[arr_val.length-1]<0)crosses_val_ax=arr_val[arr_val.length-1];else crosses_val_ax=arr_val[0];var val_ax_orientation=val_ax.scaling&&AscFormat.isRealNumber(val_ax.scaling.orientation)?val_ax.scaling.orientation:AscFormat.ORIENTATION_MIN_MAX;var hor_labels_pos= cat_ax.tickLblPos;var arr_val_labels_points=[];var top_val_axis_gap,bottom_val_axis_gap;var first_val_axis_label_half_height=0;var last_val_axis_label_half_height=0;var unit_height;if(!bWithoutLabels)unit_height=checkFiniteNumber((rect.h-first_val_axis_label_half_height-last_val_axis_label_half_height)/(arr_val[arr_val.length-1]-arr_val[0]));else unit_height=checkFiniteNumber(rect.h/(arr_val[arr_val.length-1]-arr_val[0]));var cat_ax_ext_y=cat_ax.labels?cat_ax.labels.extY:0;if(val_ax_orientation=== AscFormat.ORIENTATION_MIN_MAX)if(hor_labels_pos===c_oAscTickLabelsPos.TICK_LABEL_POSITION_NEXT_TO||!AscFormat.isRealNumber(hor_labels_pos)){if(cat_ax.crosses===AscFormat.CROSSES_MAX){cat_labels_align_bottom=false;top_val_axis_gap=Math.max(last_val_axis_label_half_height,cat_ax_ext_y);if(!bWithoutLabels){unit_height=checkFiniteNumber((rect.h-top_val_axis_gap-first_val_axis_label_half_height)/(arr_val[arr_val.length-1]-arr_val[0]));cat_labels_align_bottom=false;cat_ax.posY=rect.y+rect.h-first_val_axis_label_half_height- (crosses_val_ax-arr_val[0])*unit_height;if(cat_ax.labels)cat_ax.labels.y=cat_ax.posY-cat_ax_ext_y}else{unit_height=checkFiniteNumber(rect.h/(arr_val[arr_val.length-1]-arr_val[0]));cat_labels_align_bottom=false;cat_ax.posY=rect.y+rect.h-(crosses_val_ax-arr_val[0])*unit_height;if(cat_ax.labels){cat_ax.labels.y=cat_ax.posY-cat_ax_ext_y;if(true){var bCorrectedCat=false;if(cat_ax.labels.y<0){rect.y-=cat_ax.labels.y;rect.h+=cat_ax.labels.y;cat_ax.labels.y=0;bCorrectedCat=true}if(cat_ax.labels.y+cat_ax.labels.extY> this.extY){rect.h-=cat_ax.labels.y+cat_ax.labels.extY-this.extY;bCorrectedCat=true}if(bCorrectedCat){unit_height=checkFiniteNumber(rect.h/(arr_val[arr_val.length-1]-arr_val[0]));cat_labels_align_bottom=false;cat_ax.posY=rect.y+rect.h-(crosses_val_ax-arr_val[0])*unit_height}}}}}else if(!bWithoutLabels){var bottom_points_height=first_val_axis_label_half_height+(crosses_val_ax-arr_val[0])*unit_height;if(bottom_points_height this.extY){rect.h-=cat_ax.labels.y+cat_ax.labels.extY-this.extY;bCorrectedCat=true}if(bCorrectedCat){unit_height=checkFiniteNumber(rect.h/(arr_val[arr_val.length-1]-arr_val[0]));cat_ax.posY=rect.y+(arr_val[arr_val.length-1]-crosses_val_ax)*unit_height;cat_ax.labels.y=cat_ax.posY}}}}for(i=0;ithis.extY){rect.h-=cat_ax.labels.y+cat_ax.labels.extY-this.extY;bCorrectedCat=true}if(bCorrectedCat){unit_height=checkFiniteNumber(rect.h/(arr_val[arr_val.length-1]-arr_val[0]));cat_ax.posY= rect.y+(arr_val[arr_val.length-1]-crosses_val_ax)*unit_height;cat_ax.labels.y=rect.y+rect.h}}}for(i=0;ithis.extY){rect.h-=cat_ax.labels.y+cat_ax.labels.extY-this.extY;bCorrectedCat=true}if(bCorrectedCat){unit_height=checkFiniteNumber(rect.h/(arr_val[arr_val.length-1]-arr_val[0]));cat_ax.posY=rect.y+rect.h-(crosses_val_ax-arr_val[0])*unit_height;cat_ax.labels.y=rect.y-cat_ax_ext_y}}}for(i=0;ithis.extY){rect.h-=cat_ax.labels.y+cat_ax.labels.extY-this.extY;bCorrectedCat=true}if(bCorrectedCat){unit_height=checkFiniteNumber(rect.h/(arr_val[arr_val.length- 1]-arr_val[0]));cat_ax.posY=rect.y+(crosses_val_ax-arr_val[0])*unit_height;cat_ax.labels.y=rect.y+rect.h}}}}else{cat_labels_align_bottom=false;if(!bWithoutLabels){var top_points_height=first_val_axis_label_half_height+(crosses_val_ax-arr_val[0])*unit_height;if(top_points_heightthis.extY){rect.h-=cat_ax.labels.y+cat_ax.labels.extY-this.extY;bCorrectedCat=true}if(bCorrectedCat){unit_height= checkFiniteNumber(rect.h/(arr_val[arr_val.length-1]-arr_val[0]));cat_ax.posY=rect.y+rect.h-(arr_val[arr_val.length-1]-crosses_val_ax)*unit_height;cat_ax.labels.y=cat_ax.posY-cat_ax_ext_y}}}}}for(i=0;ithis.extY){rect.h-=cat_ax.labels.y+ cat_ax.labels.extY-this.extY;bCorrectedCat=true}if(bCorrectedCat){unit_height=checkFiniteNumber(rect.h/(arr_val[arr_val.length-1]-arr_val[0]));cat_ax.posY=rect.y+rect.h-(arr_val[arr_val.length-1]-crosses_val_ax)*unit_height;for(i=0;ithis.extY){rect.h-=cat_ax.labels.y+cat_ax.labels.extY-this.extY;bCorrectedCat=true}if(bCorrectedCat){unit_height= checkFiniteNumber(rect.h/(arr_val[arr_val.length-1]-arr_val[0]));cat_ax.posY=rect.y+(crosses_val_ax-arr_val[0])*unit_height;for(i=0;iright_x)right_x=xc+w2/2}local_text_transform=cat_ax.labels.aLabels[i].localTransformText;local_text_transform.Reset();global_MatrixTransformer.TranslateAppend(local_text_transform,-wh.w/2,-wh.h/2);global_MatrixTransformer.RotateRadAppend(local_text_transform,Math.PI/4);global_MatrixTransformer.TranslateAppend(local_text_transform,xc,yc)}}else for(i=0;iright_x)right_x=xc+w2/ 2}local_text_transform=cat_ax.labels.aLabels[i].localTransformText;local_text_transform.Reset();global_MatrixTransformer.TranslateAppend(local_text_transform,-wh.w/2,-wh.h/2);global_MatrixTransformer.RotateRadAppend(local_text_transform,Math.PI/4);global_MatrixTransformer.TranslateAppend(local_text_transform,xc,yc)}cat_ax.labels.x=left_x;cat_ax.labels.extX=right_x-left_x}}cat_ax.xPoints.sort(function(a,b){return a.val-b.val});val_ax.yPoints.sort(function(a,b){return a.val-b.val})}else this.bEmptySeries= true}else if(chart_type===AscDFH.historyitem_type_BarChart&&chart_object.barDir===AscFormat.BAR_DIR_BAR){var cat_ax,val_ax;var axis_by_types=chart_object.getAxisByTypes();cat_ax=axis_by_types.catAx[0];val_ax=axis_by_types.valAx[0];if(cat_ax&&val_ax){val_ax.labels=null;cat_ax.labels=null;val_ax.posX=null;cat_ax.posY=null;val_ax.posY=null;cat_ax.posX=null;val_ax.xPoints=null;cat_ax.yPoints=null;val_ax.yPoints=null;cat_ax.xPoints=null;val_ax.transformYPoints=null;cat_ax.transformXPoints=null;val_ax.transformXPoints= null;cat_ax.transformYPoints=null;var sizes=this.getChartSizes();rect={x:sizes.startX,y:sizes.startY,w:sizes.w,h:sizes.h};var arr_val=this.getValAxisValues();var arr_strings=[];var multiplier;if(val_ax.dispUnits)multiplier=val_ax.dispUnits.getMultiplier();else multiplier=1;var num_fmt=val_ax.numFmt;if(num_fmt&&typeof num_fmt.formatCode==="string"){var num_format=oNumFormatCache.get(num_fmt.formatCode);for(i=0;imax_val_ax_label_width)max_val_ax_label_width=t.w;if(h>max_height)max_height=h;val_ax.labels.aLabels.push(dlbl);val_ax.xPoints.push({val:arr_val[i],pos:null})}var val_axis_labels_gap=val_ax.labels.aLabels[0].tx.rich.content.Content[0].CompiledPr.Pr.TextPr.FontSize*25.4/72;val_ax.labels.extY=max_height+ val_axis_labels_gap;var ser=chart_object.series[0];var string_pts=[],pts_len=0;if(ser&&ser.cat){var lit,b_num_lit=true;lit=ser.cat.getLit();if(lit){b_num_lit=lit.getObjectType()===AscDFH.historyitem_type_NumLit;var lit_format=null,pt_format=null;if(b_num_lit&&typeof lit.formatCode==="string"&&lit.formatCode.length>0)lit_format=oNumFormatCache.get(lit.formatCode);pts_len=lit.ptCount;for(i=0;i0){pt_format=oNumFormatCache.get(pt.formatCode);if(pt_format)str_pt=pt_format.formatToChart(pt.val);else str_pt=pt.val}else if(lit_format)str_pt=lit_format.formatToChart(pt.val);else str_pt=pt.val;else str_pt=pt.val;string_pts.push({val:str_pt+""})}else string_pts.push({val:i+""})}}}{pts_len=0;for(i=0;istring_pts.length)for(i=string_pts.length;i 0)crosses=val_ax.crossesAt;else if(val_ax.crossesAt<=0)crosses=1;else crosses=string_pts.length;else crosses=1;cat_ax.maxCatVal=string_pts.length;var cat_ax_orientation=cat_ax.scaling&&AscFormat.isRealNumber(cat_ax.scaling.orientation)?cat_ax.scaling.orientation:AscFormat.ORIENTATION_MIN_MAX;var labels_pos=val_ax.tickLblPos;var cross_between=this.getValAxisCrossType();if(cross_between===null)cross_between=AscFormat.CROSS_BETWEEN_BETWEEN;var bottom_val_ax_labels_align=true;var intervals_count=cross_between=== AscFormat.CROSS_BETWEEN_MID_CAT?string_pts.length-1:string_pts.length;var point_interval=rect.h/intervals_count;var bottom_points_height,top_point_height;var arr_cat_labels_points=[];if(cat_ax_orientation===AscFormat.ORIENTATION_MIN_MAX)if(labels_pos===c_oAscTickLabelsPos.TICK_LABEL_POSITION_NONE||val_ax.bDelete===true){val_ax.labels=null;if(cross_between===AscFormat.CROSS_BETWEEN_MID_CAT)for(i=0;imax_max_width)max_max_width=min_max.Max;if(min_max.Min>max_min_width)max_min_width=min_max.Min;arr_min_max_min[i]=min_max.Min;dlbl.getMaxWidth= function(){return 2E4};dlbl.recalcInfo.recalculatePen=false;dlbl.recalcInfo.recalculateBrush=false;dlbl.recalculate();delete dlbl.getMaxWidth;if(dlbl.tx.rich.content.XLimit>max_content_width)max_content_width=dlbl.tx.rich.content.XLimit}cat_ax.labels.aLabels.push(dlbl)}var stake_offset=AscFormat.isRealNumber(cat_ax.lblOffset)?cat_ax.lblOffset/100:1;var labels_offset=cat_ax.labels.aLabels[0].tx.rich.content.Content[0].CompiledPr.Pr.TextPr.FontSize*(25.4/72)*stake_offset;var width_flag;if(max_content_width+ labels_offset=0)crosses_val_ax=0;else if(arr_val[arr_val.length-1]<0)crosses_val_ax= arr_val[arr_val.length-1];else crosses_val_ax=arr_val[0];else if(cat_ax.crosses===AscFormat.CROSSES_MIN)crosses_val_ax=arr_val[0];else if(cat_ax.crosses===AscFormat.CROSSES_MAX)crosses_val_ax=arr_val[arr_val.length-1];else if(AscFormat.isRealNumber(cat_ax.crossesAt)&&cat_ax.crossesAt>=arr_val[0]&&cat_ax.crossesAt<=arr_val[arr_val.length-1]){if(cat_ax.crossesAt>=arr_val[0]&&cat_ax.crossesAt<=arr_val[arr_val.length-1])crosses_val_ax=cat_ax.crossesAt}else if(arr_val[0]<=0&&arr_val[arr_val.length-1]>= 0)crosses_val_ax=0;else if(arr_val[arr_val.length-1]<0)crosses_val_ax=arr_val[arr_val.length-1];else crosses_val_ax=arr_val[0];var val_ax_orientation=val_ax.scaling&&AscFormat.isRealNumber(val_ax.scaling.orientation)?val_ax.scaling.orientation:AscFormat.ORIENTATION_MIN_MAX;var hor_labels_pos=cat_ax.tickLblPos;var first_val_lbl_half_width=val_ax.tickLblPos===c_oAscTickLabelsPos.TICK_LABEL_POSITION_NONE||val_ax.bDelete?0:val_ax.labels.aLabels[0].tx.rich.content.XLimit/2;var last_val_lbl_half_width= val_ax.tickLblPos===c_oAscTickLabelsPos.TICK_LABEL_POSITION_NONE||val_ax.bDelete?0:val_ax.labels.aLabels[val_ax.labels.aLabels.length-1].tx.rich.content.XLimit/2;var right_gap,left_gap;var arr_val_labels_points=[];var unit_width=checkFiniteNumber((rect.w-first_val_lbl_half_width-last_val_lbl_half_width)/(arr_val[arr_val.length-1]-arr_val[0]));var cat_ax_ext_x=cat_ax.labels&&!bWithoutLabels?cat_ax.labels.extX:0;if(val_ax_orientation===AscFormat.ORIENTATION_MIN_MAX)if(hor_labels_pos===c_oAscTickLabelsPos.TICK_LABEL_POSITION_NEXT_TO|| !AscFormat.isRealNumber(hor_labels_pos)){if(cat_ax.crosses===AscFormat.CROSSES_MAX){if(!bNeedReflect)right_gap=Math.max(last_val_lbl_half_width,cat_ax_ext_x);else right_gap=Math.max(last_val_lbl_half_width,0);cat_labels_align_left=false;if(cat_ax.labels)cat_ax.labels.x=rect.x+rect.w-right_gap;unit_width=checkFiniteNumber((rect.w-right_gap-first_val_lbl_half_width)/(arr_val[arr_val.length-1]-arr_val[0]));cat_ax.posX=rect.x+first_val_lbl_half_width+(crosses_val_ax-arr_val[0])*unit_width}else{if(!bNeedReflect&& (crosses_val_ax-arr_val[0])*unit_width+first_val_lbl_half_widthfBottomLabels)fBottomLabels=fBottomContent}}else if(oAxisLabels.align){var stake_offset=AscFormat.isRealNumber(oCatAx.lblOffset)?oCatAx.lblOffset/100:1;var labels_offset=oCatAx.labels.aLabels[0].tx.rich.content.Content[0].CompiledPr.Pr.TextPr.FontSize*(25.4/72)*stake_offset;for(i=0;ifBottomLabels)fBottomLabels=fBottomContent}}else{var stake_offset=AscFormat.isRealNumber(oCatAx.lblOffset)?oCatAx.lblOffset/100:1;var labels_offset=oCatAx.labels.aLabels[0].tx.rich.content.Content[0].CompiledPr.Pr.TextPr.FontSize* (25.4/72)*stake_offset;for(i=0;i0&&aYPoints.length>0){oAxisLabels.x=Math.min.apply(Math,aXPoints);oAxisLabels.y=Math.min.apply(Math,aYPoints);oAxisLabels.extX=Math.max.apply(Math,aXPoints)-oAxisLabels.x;oAxisLabels.extY=Math.max.apply(Math,aYPoints)-oAxisLabels.y}}}else if((oCatAx.axPos===AscFormat.AX_POS_L||oCatAx.axPos===AscFormat.AX_POS_R)&&oCatAx.yPoints&&((oValAx.axPos===AscFormat.AX_POS_T||oValAx.axPos===AscFormat.AX_POS_B)&&oValAx.xPoints)){oAxisLabels= oValAx.labels;if(oAxisLabels){var dZPositionValAxis=oProcessor3D.calculateZPositionValAxis();var dPosY,dPosY2;if(oAxisLabels.align){dPosY=oAxisLabels.y*this.chartObj.calcProp.pxToMM;dPosY2=oAxisLabels.y}else{dPosY=(oAxisLabels.y+oAxisLabels.extY)*this.chartObj.calcProp.pxToMM;dPosY2=oAxisLabels.y+oAxisLabels.extY}for(i=0;i 0&&aYPoints.length>0){oAxisLabels.x=Math.min.apply(Math,aXPoints);oAxisLabels.y=Math.min.apply(Math,aYPoints);oAxisLabels.extX=Math.max.apply(Math,aXPoints)-oAxisLabels.x;oAxisLabels.extY=Math.max.apply(Math,aYPoints)-oAxisLabels.y}}}}};CChartSpace.prototype.layoutLegendEntry=function(oEntry,fX,fY,fDistance){oEntry.localY=fY;var oFirstLine=oEntry.txBody.content.Content[0].Lines[0];var fYFirstLineMiddle=oEntry.localY+oFirstLine.Top+oFirstLine.Metrics.Descent/2+oFirstLine.Metrics.TextAscent-oFirstLine.Metrics.TextAscent2/ 2;var fPenWidth;var oUnionMarker=oEntry.calcMarkerUnion;var oLineMarker=oUnionMarker.lineMarker;var oMarker=oUnionMarker.marker;if(oLineMarker){oLineMarker.localX=fX;if(oLineMarker.pen)if(AscFormat.isRealNumber(oLineMarker.pen.w))fPenWidth=oLineMarker.pen.w/36E3;else fPenWidth=12700/36E3;else fPenWidth=0;oLineMarker.localY=fYFirstLineMiddle-fPenWidth/2;if(oMarker){oMarker.localX=oLineMarker.localX+oLineMarker.spPr.geometry.gdLst["w"]/2-oMarker.spPr.geometry.gdLst["w"]/2;oMarker.localY=fYFirstLineMiddle- oMarker.spPr.geometry.gdLst["h"]/2}oEntry.localX=oLineMarker.localX+oLineMarker.spPr.geometry.gdLst["w"]+fDistance}else if(oMarker){oMarker.localX=fX;var fMarkerWidth=oMarker.spPr.geometry.gdLst["w"];oMarker.localY=fYFirstLineMiddle-oMarker.spPr.geometry.gdLst["h"]/2;oEntry.localX=fX+fMarkerWidth+fDistance;if(this.chartStyle&&this.chartStyle.isSpecialStyle()){var fSpecialSize=oFirstLine.Bottom-oFirstLine.Top;oMarker.spPr.geometry.Recalculate(fSpecialSize,fSpecialSize);oMarker.localX=fX+(fMarkerWidth- fSpecialSize)/2;oMarker.localY=fYFirstLineMiddle-fSpecialSize/2}}else oEntry.localX=fX+fDistance};CChartSpace.prototype.hitInTextRect=function(){return false};CChartSpace.prototype.recalculateLegend=function(){if(this.chart&&this.chart.legend){var parents=this.getParentObjects();var RGBA={R:0,G:0,B:0,A:255};var legend=this.chart.legend;var arr_str_labels=[],i,j;var calc_entryes=legend.calcEntryes;calc_entryes.length=0;var series;var legend_pos=c_oAscChartLegendShowSettings.right;if(AscFormat.isRealNumber(legend.legendPos))legend_pos= legend.legendPos;var aCharts=this.chart.plotArea.charts;var oTypedChart;var aOrderedSeries=[];var aChartSeries;var nChart;var bStraightOrder;var bVericalLegend=false;if(aCharts.length===1&&(legend_pos===c_oAscChartLegendShowSettings.left||legend_pos===c_oAscChartLegendShowSettings.right||legend_pos===c_oAscChartLegendShowSettings.leftOverlay||legend_pos===c_oAscChartLegendShowSettings.rightOverlay||legend_pos===c_oAscChartLegendShowSettings.topRight))bVericalLegend=true;for(nChart=0;nChart1||bNoPieChart&&(!(oFirstChart.varyColors&& series.length===1)||bSurfaceChart);if(bSeriesLegend){if(bSurfaceChart){this.legendLength=this.chart.plotArea.charts[0].compiledBandFormats.length;ser=series[0]}else this.legendLength=series.length;for(i=0;imax_width)max_width=cur_width;cur_font_size=calc_entry.txBody.content.Content[0].CompiledPr.Pr.TextPr.FontSize;if(cur_font_size>max_font_size)max_font_size= cur_font_size;calc_entry.calcMarkerUnion=new AscFormat.CUnionMarker;union_marker=calc_entry.calcMarkerUnion;var pts=ser.getNumPts();switch(ser.getObjectType()){case AscDFH.historyitem_type_BarSeries:case AscDFH.historyitem_type_BubbleSeries:case AscDFH.historyitem_type_AreaSeries:case AscDFH.historyitem_type_PieSeries:{union_marker.marker=AscFormat.CreateMarkerGeometryByType(AscFormat.SYMBOL_SQUARE);union_marker.marker.pen=ser.compiledSeriesPen;union_marker.marker.brush=ser.compiledSeriesBrush;break}case AscDFH.historyitem_type_SurfaceSeries:{var oBandFmt= this.chart.plotArea.charts[0].compiledBandFormats[i];union_marker.marker=AscFormat.CreateMarkerGeometryByType(AscFormat.SYMBOL_SQUARE);union_marker.marker.pen=oBandFmt.spPr.ln;union_marker.marker.brush=oBandFmt.spPr.Fill;break}case AscDFH.historyitem_type_LineSeries:case AscDFH.historyitem_type_ScatterSer:case AscDFH.historyitem_type_RadarSeries:{if(AscFormat.CChartsDrawer.prototype._isSwitchCurrent3DChart(this)){union_marker.marker=AscFormat.CreateMarkerGeometryByType(AscFormat.SYMBOL_SQUARE);union_marker.marker.pen= ser.compiledSeriesPen;union_marker.marker.brush=ser.compiledSeriesBrush;break}if(ser.compiledSeriesMarker){var pts=ser.getNumPts();union_marker.marker=AscFormat.CreateMarkerGeometryByType(ser.compiledSeriesMarker.symbol);if(pts[0]&&pts[0].compiledMarker){union_marker.marker.brush=pts[0].compiledMarker.brush;union_marker.marker.pen=pts[0].compiledMarker.pen}}if(ser.compiledSeriesPen&&!b_scatter_no_line){union_marker.lineMarker=AscFormat.CreateMarkerGeometryByType(AscFormat.SYMBOL_DASH);union_marker.lineMarker.pen= ser.compiledSeriesPen.createDuplicate()}if(!b_scatter_no_line&&!AscFormat.CChartsDrawer.prototype._isSwitchCurrent3DChart(this))b_line_series=true;break}}if(union_marker.marker){union_marker.marker.pen&&union_marker.marker.pen.calculate(parents.theme,parents.slide,parents.layout,parents.master,RGBA,this.clrMapOvr);union_marker.marker.brush&&union_marker.marker.brush.calculate(parents.theme,parents.slide,parents.layout,parents.master,RGBA,this.clrMapOvr)}union_marker.lineMarker&&union_marker.lineMarker.pen&& union_marker.lineMarker.pen.calculate(parents.theme,parents.slide,parents.layout,parents.master,RGBA,this.clrMapOvr)}}else{ser=series[0];i=1;while(ser&&ser.isHidden){ser=series[i];++i}ser=ser||series[0];this.legendLength=0;if(ser){var pts=ser.getNumPts(),pt;var oLitForLegend;if(ser&&ser.cat)oLitForLegend=ser.cat.getLit();var oLitFormat=null,oPtFormat=null;if(oLitForLegend&&typeof oLitForLegend.formatCode==="string"&&oLitForLegend.formatCode.length>0)oLitFormat=oNumFormatCache.get(oLitForLegend.formatCode); this.legendLength=pts.length;var oNumLit=ser.getNumLit();var nEndIndex=pts.length;if(oNumLit)nEndIndex=oNumLit.ptCount;for(i=0;i0){oPtFormat=oNumFormatCache.get(str_pt.formatCode);if(oPtFormat)sPt=oPtFormat.formatToChart(str_pt.val); else sPt=str_pt.val+""}else if(oLitFormat)sPt=oLitFormat.formatToChart(str_pt.val);else sPt=str_pt.val+"";arr_str_labels.push(sPt)}else arr_str_labels.push((pt?pt.idx+1:"")+"");calc_entry=new AscFormat.CalcLegendEntry(legend,this,i);calc_entry.txBody=AscFormat.CreateTextBodyFromString(arr_str_labels[arr_str_labels.length-1],this.getDrawingDocument(),calc_entry);calc_entryes.push(calc_entry);cur_width=calc_entry.txBody.getRectWidth(2E3);if(cur_width>max_width)max_width=cur_width;cur_font_size=calc_entry.txBody.content.Content[0].CompiledPr.Pr.TextPr.FontSize; if(cur_font_size>max_font_size)max_font_size=cur_font_size;calc_entry.calcMarkerUnion=new AscFormat.CUnionMarker;union_marker=calc_entry.calcMarkerUnion;if(ser.getObjectType()===AscDFH.historyitem_type_LineSeries&&!AscFormat.CChartsDrawer.prototype._isSwitchCurrent3DChart(this)||ser.getObjectType()===AscDFH.historyitem_type_ScatterSer||ser.getObjectType()===AscDFH.historyitem_type_RadarSeries){if(pt){if(pt.compiledMarker){union_marker.marker=AscFormat.CreateMarkerGeometryByType(pt.compiledMarker.symbol); union_marker.marker.brush=pt.compiledMarker.pen.Fill;union_marker.marker.pen=pt.compiledMarker.pen}if(pt.pen){union_marker.lineMarker=AscFormat.CreateMarkerGeometryByType(AscFormat.SYMBOL_DASH);union_marker.lineMarker.pen=pt.pen}}if(!b_scatter_no_line&&!AscFormat.CChartsDrawer.prototype._isSwitchCurrent3DChart(this))b_line_series=true}else{b_no_line_series=false;union_marker.marker=AscFormat.CreateMarkerGeometryByType(AscFormat.SYMBOL_SQUARE);if(pt){union_marker.marker.pen=pt.pen;union_marker.marker.brush= pt.brush}else{var style=AscFormat.CHART_STYLE_MANAGER.getStyleByIndex(this.style);var base_fills=AscFormat.getArrayFillsFromBase(style.fill2,nEndIndex);union_marker.marker.brush=base_fills[i]}}if(union_marker.marker){union_marker.marker.pen&&union_marker.marker.pen.calculate(parents.theme,parents.slide,parents.layout,parents.master,RGBA,this.clrMapOvr);union_marker.marker.brush&&union_marker.marker.brush.calculate(parents.theme,parents.slide,parents.layout,parents.master,RGBA,this.clrMapOvr)}union_marker.lineMarker&& union_marker.lineMarker.pen&&union_marker.lineMarker.pen.calculate(parents.theme,parents.slide,parents.layout,parents.master,RGBA,this.clrMapOvr)}}}var marker_size;var distance_to_text;var line_marker_width;if(b_line_series){marker_size=2.5;line_marker_width=7.7;for(i=0;i133E3)calc_entry.calcMarkerUnion.lineMarker.pen.w=133E3;calc_entry.calcMarkerUnion.lineMarker.penWidth=calc_entry.calcMarkerUnion.lineMarker.pen&&AscFormat.isRealNumber(calc_entry.calcMarkerUnion.lineMarker.pen.w)?calc_entry.calcMarkerUnion.lineMarker.pen.w/36E3:0}if(calc_entryes[i].calcMarkerUnion.marker){var marker_width=marker_size;if(calc_entryes[i].series)if(calc_entryes[i].series.getObjectType()!==AscDFH.historyitem_type_LineSeries&&calc_entryes[i].series.getObjectType()!== AscDFH.historyitem_type_ScatterSer&&calc_entryes[i].series.getObjectType()!==AscDFH.historyitem_type_RadarSeries)marker_width=line_marker_width;calc_entryes[i].calcMarkerUnion.marker.spPr.geometry.Recalculate(marker_width,marker_size);calc_entryes[i].calcMarkerUnion.marker.extX=marker_width;calc_entryes[i].calcMarkerUnion.marker.extY=marker_size}}distance_to_text=.5}else{marker_size=.2*max_font_size;for(i=0;i0&&AscFormat.isRealNumber(fFixedHeight)&&fFixedHeight>0;if(bFixedSize){var oOldLayout= legend.layout;legend.layout=null;calc_entryes=[].concat(calc_entryes);this.recalculateLegend();legend.calcEntryes=calc_entryes;legend.naturalWidth=legend.extX;legend.naturalHeight=legend.extY;legend.layout=oOldLayout;var bResetLegendPos=false;if(!AscFormat.isRealNumber(this.chart.legend.legendPos)){bResetLegendPos=true;this.chart.legend.legendPos=Asc.c_oAscChartLegendShowSettings.bottom}this.checkPrecalculateChartObject();var pos=this.chartObj.recalculatePositionText(this.chart.legend);if(this.chart.legend.layout){if(AscFormat.isRealNumber(legend.layout.x))pos.x= this.calculatePosByLayout(pos.x,legend.layout.xMode,legend.layout.x,this.chart.legend.extX,this.extX);if(AscFormat.isRealNumber(legend.layout.y))pos.y=this.calculatePosByLayout(pos.y,legend.layout.yMode,legend.layout.y,this.chart.legend.extY,this.extY)}if(bResetLegendPos)this.chart.legend.legendPos=null;fFixedWidth=this.calculateSizeByLayout(pos.x,this.extX,legend.layout.w,legend.layout.wMode);fFixedHeight=this.calculateSizeByLayout(pos.y,this.extY,legend.layout.h,legend.layout.hMode)}}if(AscFormat.isRealNumber(legend_pos)){var max_legend_width, max_legend_height;var cut_index;if((legend_pos===c_oAscChartLegendShowSettings.left||legend_pos===c_oAscChartLegendShowSettings.leftOverlay||legend_pos===c_oAscChartLegendShowSettings.right||legend_pos===c_oAscChartLegendShowSettings.rightOverlay||legend_pos===c_oAscChartLegendShowSettings.topRight)&&!bFixedSize){max_legend_width=this.extX/3;var sizes=this.getChartSizes();max_legend_height=sizes.h;if(b_line_series){left_inset=line_marker_width+3*distance_to_text;var content_width=max_legend_width- left_inset;if(content_width<=0)content_width=.01;var cur_content_width,max_content_width=0;var arr_heights=[];var arr_heights2=[];for(i=0;imax_content_width)max_content_width=cur_content_width;arr_heights.push(calc_entry.txBody.getSummaryHeight());arr_heights2.push(calc_entry.txBody.getSummaryHeight3())}if(max_content_widthmax_legend_height){cut_index= i;break}}if(AscFormat.isRealNumber(cut_index))if(cut_index>0)legend_height=height_summ2-arr_heights[cut_index];else legend_height=max_legend_height;else{cut_index=arr_heights.length;legend_height=height_summ2}legend.x=0;legend.y=0;legend.extX=legend_width;legend.extY=legend_height;var summ_h=0;calc_entryes.splice(cut_index,calc_entryes.length-cut_index);for(i=0;imax_content_width)max_content_width=cur_content_width;arr_heights.push(calc_entry.txBody.getSummaryHeight());arr_heights2.push(calc_entry.txBody.getSummaryHeight3())}var chart_object; if(this.chart&&this.chart.plotArea&&this.chart.plotArea.charts[0])chart_object=this.chart.plotArea.charts[0];var b_reverse_order=false;if(chart_object&&chart_object.getObjectType()===AscDFH.historyitem_type_BarChart&&chart_object.barDir===AscFormat.BAR_DIR_BAR&&(cat_ax&&cat_ax.scaling&&AscFormat.isRealNumber(cat_ax.scaling.orientation)?cat_ax.scaling.orientation:AscFormat.ORIENTATION_MIN_MAX)===AscFormat.ORIENTATION_MIN_MAX||chart_object&&chart_object.getObjectType()===AscDFH.historyitem_type_SurfaceChart)b_reverse_order= true;var max_entry_height2=Math.max(0,Math.max.apply(Math,arr_heights));for(i=0;imax_legend_height){cut_index=i;break}}if(AscFormat.isRealNumber(cut_index))if(cut_index>0)legend_height=height_summ2-arr_heights[cut_index];else legend_height=max_legend_height;else{cut_index=arr_heights.length;legend_height=height_summ2}legend.x=0;legend.y=0;legend.extX=legend_width;legend.extY=legend_height;var summ_h=0;var b_reverse_order=false;var chart_object,cat_ax,start_index,end_index;if(this.chart&&this.chart.plotArea&&this.chart.plotArea.charts[0]){chart_object= this.chart.plotArea.charts[0];if(chart_object&&chart_object.getAxisByTypes){var axis_by_types=chart_object.getAxisByTypes();cat_ax=axis_by_types.catAx[0]}}if(chart_object&&chart_object.getObjectType()===AscDFH.historyitem_type_BarChart&&chart_object.barDir===AscFormat.BAR_DIR_BAR&&(cat_ax&&cat_ax.scaling&&AscFormat.isRealNumber(cat_ax.scaling.orientation)?cat_ax.scaling.orientation:AscFormat.ORIENTATION_MIN_MAX)===AscFormat.ORIENTATION_MIN_MAX)b_reverse_order=true;if(!b_reverse_order){calc_entryes.splice(cut_index, calc_entryes.length-cut_index);for(i=0;i-1;--i){calc_entry=calc_entryes[i];this.layoutLegendEntry(calc_entry,distance_to_text,summ_h,distance_to_text);summ_h+=arr_heights[i]}}legend.setPosition(0,0)}}else{var fMaxLegendHeight,fMaxLegendWidth;if(bFixedSize){fMaxLegendWidth= fFixedWidth;fMaxLegendHeight=fFixedHeight}else{fMaxLegendWidth=.9*this.extX;fMaxLegendHeight=(this.extY-(this.chart.title?this.chart.title.extY:0))*.6}var fMarkerWidth;if(b_line_series)fMarkerWidth=line_marker_width;else fMarkerWidth=marker_size;var oUnionMarker;var fMaxEntryWidth=0;var fSummWidth=0;var fCurEntryWidth,oCurEntry;var fLegendWidth,fLegendHeight;var aHeights=[];var aHeights2=[];var fMaxEntryHeight=0;var fCurEntryHeight=0;var fCurEntryHeight2=0;var aWidths=[];var fCurPosX;var fCurPosY; var fDistanceBetweenLabels;var fVertDistanceBetweenLabels;var oLineMarker,fPenWidth,oMarker;for(i=0;i>0);var nMaxRowsCount=Math.max(1, fMaxLegendHeight/fMaxEntryHeight>>0);var nMaxEntriesCount=nColsCount*nMaxRowsCount;if(calc_entryes.length>nMaxEntriesCount){calc_entryes.splice(nMaxEntriesCount,calc_entryes.length-nMaxEntriesCount);aWidths.splice(nMaxEntriesCount,aWidths.length-nMaxEntriesCount);aHeights.splice(nMaxEntriesCount,aHeights.length-nMaxEntriesCount);aHeights2.splice(nMaxEntriesCount,aHeights2.length-nMaxEntriesCount);fMaxEntryWidth=distance_to_text+fMarkerWidth+distance_to_text+Math.max.apply(Math,aWidths);fMaxEntryHeight= Math.max.apply(Math,aHeights2)}var nRowsCount=Math.ceil(calc_entryes.length/nColsCount);if(bFixedSize){fLegendWidth=fFixedWidth;fLegendHeight=fFixedHeight}else{fLegendWidth=fMaxEntryWidth*nColsCount;fLegendHeight=nRowsCount*Math.max.apply(Math,aHeights)}fDistanceBetweenLabels=(fLegendWidth-nColsCount*fMaxEntryWidth)/nColsCount;fVertDistanceBetweenLabels=(fLegendHeight-nRowsCount*Math.max.apply(Math,aHeights))/nRowsCount;legend.extX=fLegendWidth;legend.extY=fLegendHeight;fCurPosY=fVertDistanceBetweenLabels/ 2;for(i=0;i=1&&this.style<=40&&2===nSideType)if(parent_objects.theme&&parent_objects.theme.themeElements&&parent_objects.theme.themeElements.fmtScheme&&parent_objects.theme.themeElements.fmtScheme.lnStyleLst&&parent_objects.theme.themeElements.fmtScheme.lnStyleLst[0]){oCompiledPen=parent_objects.theme.themeElements.fmtScheme.lnStyleLst[0].createDuplicate();if(this.style>=1&&this.style<=32)oCompiledPen.Fill=CreateUnifillSolidFillSchemeColor(15, .75);else oCompiledPen.Fill=CreateUnifillSolidFillSchemeColor(8,.75)}oSide.pen=oCompiledPen}if(this.style>=1&&this.style<=32)if(oSide.spPr&&oSide.spPr.Fill){oSide.brush=oSide.spPr.Fill.createDuplicate();if(nSideType===0||nSideType===2){var cColorMod=new AscFormat.CColorMod;if(nSideType===2)cColorMod.val=45E3;else cColorMod.val=35E3;cColorMod.name="shade";oSide.brush.addColorMod(cColorMod)}}else oSide.brush=null;else{var oSubtleFill;if(parent_objects.theme&&parent_objects.theme.themeElements&&parent_objects.theme.themeElements.fmtScheme&& parent_objects.theme.themeElements.fmtScheme.fillStyleLst)oSubtleFill=parent_objects.theme.themeElements.fmtScheme.fillStyleLst[0];var oDefaultBrush;var tint=.2;if(this.style>=33&&this.style<=34)oDefaultBrush=CreateUnifillSolidFillSchemeColor(8,.2);else if(this.style>=35&&this.style<=40)oDefaultBrush=CreateUnifillSolidFillSchemeColor(this.style-35,tint);else oDefaultBrush=CreateUnifillSolidFillSchemeColor(8,.95);if(oSide.spPr)oDefaultBrush.merge(oSide.spPr.Fill);if(nSideType===0||nSideType===2){var cColorMod= new AscFormat.CColorMod;if(nSideType===0)cColorMod.val=45E3;else cColorMod.val=35E3;cColorMod.name="shade";oDefaultBrush.addColorMod(cColorMod)}oSide.brush=oDefaultBrush}if(oSide.brush)oSide.brush.calculate(parent_objects.theme,parent_objects.slide,parent_objects.layout,parent_objects.master,{R:0,G:0,B:0,A:255},this.clrMapOvr);if(oSide.pen)oSide.pen.calculate(parent_objects.theme,parent_objects.slide,parent_objects.layout,parent_objects.master,{R:0,G:0,B:0,A:255},this.clrMapOvr)};CChartSpace.prototype.recalculateWalls= function(){if(this.chart){this.internalCalculatePenBrushFloorWall(this.chart.sideWall,0);this.internalCalculatePenBrushFloorWall(this.chart.backWall,1);this.internalCalculatePenBrushFloorWall(this.chart.floor,2)}};CChartSpace.prototype.recalculateUpDownBars=function(){if(this.chart&&this.chart.plotArea){var aCharts=this.chart.plotArea.charts;for(var t=0;t=1&&this.style<=16)default_bar_line.setFill(CreateUnifillSolidFillSchemeColor(15,0));else if(this.style>= 17&&this.style<=32||this.style>=41&&this.style<=48)default_bar_line=CreateNoFillLine();else if(this.style===33||this.style===34)default_bar_line.setFill(CreateUnifillSolidFillSchemeColor(8,0));else if(this.style>=35&&this.style<=40)default_bar_line.setFill(CreateUnifillSolidFillSchemeColor(this.style-35,-.25))}if(up_bars){var default_up_bars_fill;if(this.style===1||this.style===9||this.style===17||this.style===25||this.style===41)default_up_bars_fill=CreateUnifillSolidFillSchemeColor(8,.25);else if(this.style=== 2||this.style===10||this.style===18||this.style===26)default_up_bars_fill=CreateUnifillSolidFillSchemeColor(8,.05);else if(this.style>=3&&this.style<=8)default_up_bars_fill=CreateUnifillSolidFillSchemeColor(this.style-3,.25);else if(this.style>=11&&this.style<=16)default_up_bars_fill=CreateUnifillSolidFillSchemeColor(this.style-11,.25);else if(this.style>=19&&this.style<=24)default_up_bars_fill=CreateUnifillSolidFillSchemeColor(this.style-19,.25);else if(this.style>=27&&this.style<=32)default_up_bars_fill= CreateUnifillSolidFillSchemeColor(this.style-27,.25);else if(this.style>=33&&this.style<=40||this.style===42)default_up_bars_fill=CreateUnifillSolidFillSchemeColor(12,0);else default_up_bars_fill=CreateUnifillSolidFillSchemeColor(this.style-43,.25);if(up_bars.Fill)default_up_bars_fill.merge(up_bars.Fill);default_up_bars_fill.calculate(parents.theme,parents.slide,parents.layout,parents.master,{R:0,G:0,B:0,A:255},this.clrMapOvr);oChart.upDownBars.upBarsBrush=default_up_bars_fill;var up_bars_line=default_bar_line.createDuplicate(); if(up_bars.ln)up_bars_line.merge(up_bars.ln);up_bars_line.calculate(parents.theme,parents.slide,parents.layout,parents.master,{R:0,G:0,B:0,A:255},this.clrMapOvr);oChart.upDownBars.upBarsPen=up_bars_line}if(down_bars){var default_down_bars_fill;if(this.style===1||this.style===9||this.style===17||this.style===25||this.style===41||this.style===33)default_down_bars_fill=CreateUnifillSolidFillSchemeColor(8,.85);else if(this.style===2||this.style===10||this.style===18||this.style===26||this.style===34)default_down_bars_fill= CreateUnifillSolidFillSchemeColor(8,.95);else if(this.style>=3&&this.style<=8)default_down_bars_fill=CreateUnifillSolidFillSchemeColor(this.style-3,-.25);else if(this.style>=11&&this.style<=16)default_down_bars_fill=CreateUnifillSolidFillSchemeColor(this.style-11,-.25);else if(this.style>=19&&this.style<=24)default_down_bars_fill=CreateUnifillSolidFillSchemeColor(this.style-19,-.25);else if(this.style>=27&&this.style<=32)default_down_bars_fill=CreateUnifillSolidFillSchemeColor(this.style-27,-.25); else if(this.style>=35&&this.style<=40)default_down_bars_fill=CreateUnifillSolidFillSchemeColor(this.style-35,-.25);else if(this.style===42)default_down_bars_fill=CreateUnifillSolidFillSchemeColor(8,0);else default_down_bars_fill=CreateUnifillSolidFillSchemeColor(this.style-43,-.25);if(down_bars.Fill)default_down_bars_fill.merge(down_bars.Fill);default_down_bars_fill.calculate(parents.theme,parents.slide,parents.layout,parents.master,{R:0,G:0,B:0,A:255},this.clrMapOvr);oChart.upDownBars.downBarsBrush= default_down_bars_fill;var down_bars_line=default_bar_line.createDuplicate();if(down_bars.ln)down_bars_line.merge(down_bars.ln);down_bars_line.calculate(parents.theme,parents.slide,parents.layout,parents.master,{R:0,G:0,B:0,A:255},this.clrMapOvr);oChart.upDownBars.downBarsPen=down_bars_line}}}}};CChartSpace.prototype.recalculatePlotAreaChartPen=function(){if(this.chart&&this.chart.plotArea)if(this.chart.plotArea.spPr&&this.chart.plotArea.spPr.ln){this.chart.plotArea.pen=this.chart.plotArea.spPr.ln; var parents=this.getParentObjects();this.chart.plotArea.pen.calculate(parents.theme,parents.slide,parents.layout,parents.master,{R:0,G:0,B:0,A:255},this.clrMapOvr)}else this.chart.plotArea.pen=null};CChartSpace.prototype.recalculatePenBrush=function(){var parents=this.getParentObjects(),RGBA={R:0,G:0,B:0,A:255};if(this.brush)this.brush.calculate(parents.theme,parents.slide,parents.layout,parents.master,RGBA,this.clrMapOvr);if(this.pen){this.pen.calculate(parents.theme,parents.slide,parents.layout, parents.master,RGBA,this.clrMapOvr);checkBlackUnifill(this.pen.Fill,true)}if(this.chart){if(this.chart.title){if(this.chart.title.brush)this.chart.title.brush.calculate(parents.theme,parents.slide,parents.layout,parents.master,RGBA,this.clrMapOvr);if(this.chart.title.pen)this.chart.title.pen.calculate(parents.theme,parents.slide,parents.layout,parents.master,RGBA,this.clrMapOvr)}if(this.chart.plotArea){if(this.chart.plotArea.brush)this.chart.plotArea.brush.calculate(parents.theme,parents.slide,parents.layout, parents.master,RGBA,this.clrMapOvr);if(this.chart.plotArea.pen)this.chart.plotArea.pen.calculate(parents.theme,parents.slide,parents.layout,parents.master,RGBA,this.clrMapOvr);for(var t=0;t0){var fSize2=this.calculateSizeByLayout(oChartSize.startY,this.extY,oLayout.h,oLayout.hMode); if(AscFormat.isRealNumber(fSize2)&&fSize2>0){oChartSize.w=fSize;oChartSize.h=fSize2;oChartSize.startX=this.calculatePosByLayout(oChartSize.startX,oLayout.xMode,oLayout.x,oChartSize.w,this.extX);oChartSize.startY=this.calculatePosByLayout(oChartSize.startY,oLayout.yMode,oLayout.y,oChartSize.h,this.extY);var aCharts=this.chart.plotArea.charts;for(var i=0;i0){var nOrder=oSeries.order;oSeries.setOrder(aAllSeries[i-1].order);aAllSeries[i-1].setOrder(nOrder)}break}this.sortSeries()};CChartSpace.prototype.moveSeriesDown=function(oSeries){var aAllSeries=this.getAllSeries();aAllSeries.sort(function(a,b){return a.order-b.order});for(var i=0;i=1&&this.style<=32)default_brush=CreateUnifillSolidFillSchemeColor(6,tint);else if(this.style>=33&&this.style<=34)default_brush=CreateUnifillSolidFillSchemeColor(8,.2); else if(this.style>=35&&this.style<=40)default_brush=CreateUnifillSolidFillSchemeColor(this.style-35,tint);else default_brush=CreateUnifillSolidFillSchemeColor(8,.95)}if(plot_area.spPr&&plot_area.spPr.Fill)default_brush.merge(plot_area.spPr.Fill);var parents=this.getParentObjects();default_brush.calculate(parents.theme,parents.slide,parents.layout,parents.master,{R:0,G:0,B:0,A:255},this.clrMapOvr);plot_area.brush=default_brush}};CChartSpace.prototype.recalculateChartPen=function(){var parent_objects= this.getParentObjects();var default_line=new AscFormat.CLn;if(parent_objects.theme&&parent_objects.theme.themeElements&&parent_objects.theme.themeElements.fmtScheme&&parent_objects.theme.themeElements.fmtScheme.lnStyleLst)default_line.merge(parent_objects.theme.themeElements.fmtScheme.lnStyleLst[0]);var fill;if(this.style>=1&&this.style<=32)fill=CreateUnifillSolidFillSchemeColor(15,.75);else if(this.style>=33&&this.style<=40)fill=CreateUnifillSolidFillSchemeColor(8,.75);else fill=CreateUnifillSolidFillSchemeColor(12, 0);default_line.setFill(fill);if(this.spPr&&this.spPr.ln)default_line.merge(this.spPr.ln);var parents=this.getParentObjects();default_line.calculate(parents.theme,parents.slide,parents.layout,parents.master,{R:0,G:0,B:0,A:255},this.clrMapOvr);this.pen=default_line;checkBlackUnifill(this.pen.Fill,true)};CChartSpace.prototype.recalculateChartBrush=function(){var default_brush;if(this.style>=1&&this.style<=32)default_brush=CreateUnifillSolidFillSchemeColor(6,0);else if(this.style>=33&&this.style<=40)default_brush= CreateUnifillSolidFillSchemeColor(12,0);else default_brush=CreateUnifillSolidFillSchemeColor(8,0);if(this.spPr&&this.spPr.Fill)default_brush.merge(this.spPr.Fill);var parents=this.getParentObjects();default_brush.calculate(parents.theme,parents.slide,parents.layout,parents.master,{R:0,G:0,B:0,A:255},this.clrMapOvr);this.brush=default_brush};CChartSpace.prototype.recalculateAxisTickMark=function(){if(this.chart&&this.chart.plotArea){var oThis=this;var calcMajorMinorGridLines=function(axis,defaultStyle, subtleLine,parents){function calcGridLine(defaultStyle,spPr,subtleLine,parents){var compiled_grid_lines=new AscFormat.CLn;compiled_grid_lines.merge(subtleLine);if(!compiled_grid_lines.Fill)compiled_grid_lines.setFill(new AscFormat.CUniFill);compiled_grid_lines.Fill.merge(defaultStyle);if(subtleLine&&subtleLine.Fill&&subtleLine.Fill.fill&&subtleLine.Fill.fill.color&&subtleLine.Fill.fill.color.Mods&&compiled_grid_lines.Fill&&compiled_grid_lines.Fill.fill&&compiled_grid_lines.Fill.fill.color)compiled_grid_lines.Fill.fill.color.Mods= subtleLine.Fill.fill.color.Mods.createDuplicate();compiled_grid_lines.calculate(parents.theme,parents.slide,parents.layout,parents.master,{R:0,G:0,B:0,A:255},oThis.clrMapOvr);checkBlackUnifill(compiled_grid_lines.Fill,true);if(spPr&&spPr.ln){compiled_grid_lines.merge(spPr.ln);compiled_grid_lines.calculate(parents.theme,parents.slide,parents.layout,parents.master,{R:0,G:0,B:0,A:255},oThis.clrMapOvr)}return compiled_grid_lines}axis.compiledLn=calcGridLine(defaultStyle.axisAndMajorGridLines,axis.spPr, subtleLine,parents);axis.compiledTickMarkLn=axis.compiledLn.createDuplicate();axis.compiledTickMarkLn.calculate(parents.theme,parents.slide,parents.layout,parents.master,{R:0,G:0,B:0,A:255},oThis.clrMapOvr);checkBlackUnifill(axis.compiledTickMarkLn.Fill,true)};var default_style=CHART_STYLE_MANAGER.getDefaultLineStyleByIndex(this.style);var parent_objects=this.getParentObjects();var subtle_line;if(parent_objects.theme&&parent_objects.theme.themeElements&&parent_objects.theme.themeElements.fmtScheme&& parent_objects.theme.themeElements.fmtScheme.lnStyleLst)subtle_line=parent_objects.theme.themeElements.fmtScheme.lnStyleLst[0];var aAxes=this.chart.plotArea.axId;for(var i=0;iMAX_LABELS_COUNT)bSkip=true;var nCount=0;var nLblCount=0;for(var i=0;iMAX_LABELS_COUNT*(nCount/this.ptsCount)){pt.compiledDlb=null;nCount++;continue}var compiled_dlb=new AscFormat.CDLbl;compiled_dlb.merge(default_lbl);compiled_dlb.merge(aCharts[t].dLbls);if(aCharts[t].dLbls)compiled_dlb.merge(aCharts[t].dLbls.findDLblByIdx(pt.idx),false);compiled_dlb.merge(ser.dLbls);if(ser.dLbls){var oSeriesDLbl= ser.dLbls.findDLblByIdx(pt.idx);if(oSeriesDLbl){oSeriesDLbl.chart=this;compiled_dlb.merge(oSeriesDLbl);if(oSeriesDLbl.tx)compiled_dlb.tx=oSeriesDLbl.tx}}if(compiled_dlb.checkNoLbl())pt.compiledDlb=null;else{pt.compiledDlb=compiled_dlb;pt.compiledDlb.chart=this;pt.compiledDlb.series=ser;pt.compiledDlb.pt=pt;pt.compiledDlb.recalculate();nLblCount++}++nCount}}}}};CChartSpace.prototype.recalculateHiLowLines=function(){if(this.chart&&this.chart.plotArea){var aCharts=this.chart.plotArea.charts;var parents= this.getParentObjects();for(var i=0;i=1&&this.style<=32)default_line.setFill(CreateUnifillSolidFillSchemeColor(15,0));else if(this.style>=33&&this.style<=34)default_line.setFill(CreateUnifillSolidFillSchemeColor(8,0));else if(this.style>=35&& this.style<=40)default_line.setFill(CreateUnifillSolidFillSchemeColor(8,-.25));else default_line.setFill(CreateUnifillSolidFillSchemeColor(12,0));default_line.merge(oCurChart.hiLowLines.ln);oCurChart.calculatedHiLowLines=default_line;default_line.calculate(parents.theme,parents.slide,parents.layout,parents.master,{R:0,G:0,B:0,A:255},this.clrMapOvr)}else oCurChart.calculatedHiLowLines=null}}};CChartSpace.prototype.recalculateSeriesColors=function(){this.cachedCanvas=null;this.ptsCount=0;if(this.chart&& this.chart.plotArea){var style=CHART_STYLE_MANAGER.getStyleByIndex(this.style);var parents=this.getParentObjects();var RGBA={R:0,G:0,B:0,A:255};var aCharts=this.chart.plotArea.charts;var aAllSeries=[];for(var t=0;t0&&axis_by_types.catAx.length>0){for(var i=0;i< axis_by_types.valAx.length;++i)if(axis_by_types.valAx[i].crossAx){for(var j=0;j1){oPlotArea.valAx=axis_by_types.valAx[1];oPlotArea.catAx=axis_by_types.valAx[0]}}}}};CChartSpace.prototype.checkDrawingCache=function(graphics){if(window["NATIVE_EDITOR_ENJINE"]||graphics.RENDERER_PDF_FLAG||this.isSparkline)return false;if(graphics.IsSlideBoundsCheckerType)return false;if(!this.transform.IsIdentity2())return false;var dBorderW=this.getBorderWidth();var dWidth=this.extX+2*dBorderW;var dHeight= this.extY+2*dBorderW;var nWidth=graphics.m_oCoordTransform.sx*dWidth+.5>>0;var nHeight=graphics.m_oCoordTransform.sy*dHeight+.5>>0;if(nWidth===0||nHeight===0)return false;if(this.cachedCanvas)if(this.cachedCanvas.width!==nWidth||this.cachedCanvas.height!==nHeight)this.cachedCanvas=null;var ctx;if(!this.cachedCanvas){var aImages=[];this.getAllRasterImages(aImages);var oApi=window["Asc"]["editor"]||editor;if(oApi&&oApi.ImageLoader)for(var i=0;i>0;g.m_oCoordTransform.ty=-((this.transform.ty-dBorderW)*graphics.m_oCoordTransform.sy+.5)>>0;g.transform(1,0,0,1,0,0);this.drawInternal(g)}var _x1=graphics.m_oCoordTransform.TransformPointX(this.transform.tx-dBorderW,this.transform.ty-dBorderW)+.5>>0;var _y1=graphics.m_oCoordTransform.TransformPointY(this.transform.tx-dBorderW,this.transform.ty-dBorderW)+.5>>0;graphics.SaveGrState();graphics.SetIntegerGrid(true);graphics.m_oContext.drawImage(this.cachedCanvas,_x1,_y1,nWidth,nHeight);graphics.RestoreGrState(); graphics.FreeFont();return true};CChartSpace.prototype.getBorderWidth=function(){var ln_width;if(this.pen&&AscFormat.isRealNumber(this.pen.w))ln_width=this.pen.w/36E3;else ln_width=0;return ln_width};CChartSpace.prototype.drawInternal=function(graphics){var oClipRect=this.getClipRect();if(oClipRect){graphics.SaveGrState();graphics.AddClipRect(oClipRect.x,oClipRect.y,oClipRect.w,oClipRect.h)}graphics.SaveGrState();graphics.SetIntegerGrid(false);graphics.transform3(this.transform,false);var ln_width= this.getBorderWidth();graphics.AddClipRect(-ln_width,-ln_width,this.extX+2*ln_width,this.extY+2*ln_width);if(this.chartObj)this.chartObj.draw(this,graphics);if(this.chart&&!this.bEmptySeries){if(this.chart.plotArea){var aCharts=this.chart.plotArea.charts;for(var t=0;t0)i=0;else i=titles.length-1;while(!SearchEngine.IsFound()){titles[i].GetRevisionsChangeElement(SearchEngine);if(SearchEngine.GetDirection()>0){if(i===titles.length-1)break;++i}else{if(i===0)break;--i}}}; CChartSpace.prototype.Search=function(Str,Props,SearchEngine,Type){var titles=this.getAllTitles();for(var i=0;i=0;i--)if(titles[i].GetSearchElementId){Id=titles[i].GetSearchElementId(false,i===Current?true:false);if(null!==Id)return Id}}return null};CChartSpace.prototype.FindNextFillingForm=function(isNext,isCurrent){return null};CChartSpace.prototype.isAccent1Background=function(){return this.spPr&&this.spPr.Fill&&this.spPr.Fill.isAccent1()};CChartSpace.prototype.addNewSeries= function(){var oLastChart=this.chart.plotArea.charts[this.chart.plotArea.charts.length-1];if(!oLastChart)return null;if(oLastChart.getObjectType()===AscDFH.historyitem_type_ScatterChart)return this.addScatterSeries(null,null,"={1}");else return this.addSeries(null,"={1}")};CChartSpace.prototype.setNewSeriesIdxAndOrder=function(oSeries){var aAllSeries=this.getAllSeries();var nSeries;var oFirstSeries=aAllSeries[0];var nIdx=0,nOrder=0;if(aAllSeries.length>0){if(oFirstSeries.idx>0)nIdx=0;else{var oCurSeries, oNextSeries;for(nSeries=0;nSeries1){nIdx=oCurSeries.idx+1;break}}if(nSeries===aAllSeries.length-1)nIdx=aAllSeries[aAllSeries.length-1].idx+1}aAllSeries.sort(function(a,b){return a.order-b.order});nOrder=aAllSeries[aAllSeries.length-1].order+1}oSeries.setIdx(nIdx);oSeries.setOrder(nOrder)};CChartSpace.prototype.addSeries=function(sName,sValues){var oLastChart=this.chart.plotArea.charts[this.chart.plotArea.charts.length- 1];if(!oLastChart)return null;History.Create_NewPoint(0);var oSeries;oSeries=oLastChart.series[0]?oLastChart.series[0].createDuplicate():oLastChart.getEmptySeries();oSeries.setName(sName);oSeries.setValues(sValues);this.setNewSeriesIdxAndOrder(oSeries);oLastChart.addSer(oSeries);this.reorderSeries();if(this.chartStyle&&this.chartColors)oSeries.applyChartStyle(this.chartStyle,this.chartColors,oChartStyleCache.getAdditionalData(this.getChartType(),this.chartStyle.id),true);else oSeries.resetFormatting(); return oSeries};CChartSpace.prototype.addScatterSeries=function(sName,sXValues,sYValues){var oLastChart=this.chart.plotArea.charts[this.chart.plotArea.charts.length-1];if(!oLastChart||oLastChart.getObjectType()!==AscDFH.historyitem_type_ScatterChart)return;History.Create_NewPoint(0);var oSeries;oSeries=oLastChart.series[0]?oLastChart.series[0].createDuplicate():oLastChart.getEmptySeries();oSeries.setName(sName);oSeries.setYValues(sYValues);oSeries.setXValues(sXValues);this.setNewSeriesIdxAndOrder(oSeries); oLastChart.addSer(oSeries);if(oSeries.spPr)oSeries.setSpPr(null);if(this.chartStyle&&this.chartColors)oSeries.applyChartStyle(this.chartStyle,this.chartColors,oChartStyleCache.getAdditionalData(this.getChartType(),this.chartStyle.id),true);else oSeries.resetFormatting();return oSeries};CChartSpace.prototype.collectRefsInsideRange=function(oRange,aRefs){var oDataRange=this.getDataRefs();oDataRange.collectRefsInsideRange(oRange,aRefs)};CChartSpace.prototype.collectIntersectionRefs=function(aRanges, aRefs){if(!Array.isArray(aRanges)||aRanges.length===0)return;var oDataRange=this.getDataRefs();oDataRange.collectIntersectionRefs(aRanges,aRefs)};CChartSpace.prototype.getCommonRange=function(){var oDataRange=this.getDataRefs();return oDataRange.getRange()};CChartSpace.prototype.fillSelectedRanges=function(oWSView){var oSelectedSeries=this.getSelectedSeries();if(oSelectedSeries){oSelectedSeries.fillSelectedRanges(oWSView);return}var oDataRange=this.getDataRefs();oDataRange.fillSelectedRanges(oWSView)}; CChartSpace.prototype.canResetToStyle=function(){if(this.chartStyle&&this.chartColors)return true};CChartSpace.prototype.resetToStyle=function(){if(!this.chartStyle||!this.chartColors)return;this.applyChartStyle(this.chartStyle,this.chartColors,oChartStyleCache.getAdditionalData(this.getChartType(),this.chartStyle.id),true)};CChartSpace.prototype.getChartStyleIdx=function(){if(!this.chartStyle||!this.chartColors)return null;return oChartStyleCache.getStyleIdx(this.getChartType(),this.chartStyle.id)}; CChartSpace.prototype.buildSeries=function(aRefs){if(!Array.isArray(aRefs))return Asc.c_oAscError.ID.No;if(aRefs.length>MAX_SERIES_COUNT)return Asc.c_oAscError.ID.MaxDataSeriesError;this.reindexSeries();var aAllSeries=this.getAllSeries();aAllSeries.sort(function(a,b){return a.order-b.order});var nRef,oRef;var nSeries,oSeries=null;var aAllCharts=this.chart.plotArea.charts;var oFirstChart=aAllCharts[0];var oLastChart=aAllCharts[aAllCharts.length-1];var oLastSeries;for(nRef=0;nRef=aAllSeries.length;if(this.chartStyle&&this.chartColors)oSeries.applyChartStyle(this.chartStyle,this.chartColors,oChartStyleCache.getAdditionalData(this.getChartType(), this.chartStyle.id),bNewSeries);else if(bNewSeries)oSeries.resetFormatting()}for(nSeries=aAllSeries.length-1;nSeries>=aRefs.length;--nSeries)aAllSeries[nSeries].remove();return Asc.c_oAscError.ID.No};CChartSpace.prototype.setRange=function(sRange){if(sRange===this.getCommonRange())return;var oDataRange=this.getDataRefs();var aRefs=oDataRange.getSeriesRefsFromUnionRefs(AscFormat.fParseChartFormulaExternal(sRange),undefined,AscFormat.isScatterChartType(this.getChartType()));if(!Array.isArray(aRefs))this.buildSeries([]); else this.buildSeries(aRefs);this.recalculate();if(this.pivotSource)this.setPivotSource(null)};CChartSpace.prototype.switchRowCol=function(){var oDataRange=this.getDataRefs();var aRefs=oDataRange.getSwitchedRefs(this.isScatterChartType());if(!aRefs)return Asc.c_oAscError.ID.No;var nResult=this.buildSeries(aRefs);if(Asc.c_oAscError.ID.No===nResult){this.recalculate();this.checkLegendLayoutSize()}return nResult};CChartSpace.prototype.fillDataFromTrack=function(oSelectedRange){var oSlectedSeries=this.getSelectedSeries(); if(oSlectedSeries){oSlectedSeries.fillFromSelectedRange(oSelectedRange);this.recalculate();return}var oDataRange=this.getDataRefs();var nResult=this.buildSeries(oDataRange.getSeriesRefsFromSelectedRange(oSelectedRange,this.isScatterChartType()));if(Asc.c_oAscError.ID.No===nResult)this.recalculate()};CChartSpace.prototype.checkLegendLayoutSize=function(){var oChart=this.chart;if(!oChart)return;var oLegend=oChart.legend;if(oLegend){var oLayout=oLegend.layout;if(oLayout)if(AscFormat.isRealNumber(oLayout.w)|| AscFormat.isRealNumber(oLayout.h)){oLegend.setLayout(null);this.recalcInfo.recalculateLegend=true;this.recalculate();if(AscFormat.isRealNumber(oLayout.w))oLayout.setW(this.calculateLayoutBySize(oLegend.x,oLayout.wMode,this.extX,oLegend.extX));if(AscFormat.isRealNumber(oLayout.h))oLayout.setH(this.calculateLayoutBySize(oLegend.y,oLayout.hMode,this.extY,oLegend.extY));oLegend.setLayout(oLayout);this.recalcInfo.recalculateLegend=true;this.recalculate()}}};CChartSpace.prototype.getCatFormula=function(){var aAllSeries= this.getAllSeries();var oFirstSeries=aAllSeries[0];if(oFirstSeries)return oFirstSeries.asc_getCatValues();return""};CChartSpace.prototype.setCatFormula=function(sFormula){var aAllSeries=this.getAllSeries();for(var i=0;imax_idx&&(max_idx=arr[i].idx);return max_idx+1}function getArrayFillsFromBase(arrBaseFills,needFillsCount){var ret=[];var nMaxCycleIdx=parseInt((needFillsCount-1)/arrBaseFills.length);for(var i=0;i>0;var fShadeTint=(nCycleIdx+1)/(nMaxCycleIdx+2)*1.4-.7;if(fShadeTint<0)fShadeTint=-(1+fShadeTint);else fShadeTint=1-fShadeTint;var color=CreateUniFillSolidFillWidthTintOrShade(arrBaseFills[i% arrBaseFills.length],fShadeTint);ret.push(color)}return ret}function GetTypeMarkerByIndex(index){return AscFormat.MARKER_SYMBOL_TYPE[index%9]}function CreateUnfilFromRGB(r,g,b){var ret=new AscFormat.CUniFill;ret.setFill(new AscFormat.CSolidFill);ret.fill.setColor(new AscFormat.CUniColor);ret.fill.color.setColor(new AscFormat.CRGBColor);ret.fill.color.color.setColor(r,g,b);return ret}function CreateColorMapByIndex(index){var ret=[];switch(index){case 1:{ret.push(CreateUnfilFromRGB(85,85,85));ret.push(CreateUnfilFromRGB(158, 158,158));ret.push(CreateUnfilFromRGB(114,114,114));ret.push(CreateUnfilFromRGB(70,70,70));ret.push(CreateUnfilFromRGB(131,131,131));ret.push(CreateUnfilFromRGB(193,193,193));break}case 2:{for(var i=0;i<6;++i)ret.push(CreateUnifillSolidFillSchemeColorByIndex(i));break}default:{ret.push(CreateUnifillSolidFillSchemeColorByIndex(index-3));break}}return ret}function CreateUniFillSolidFillWidthTintOrShade(unifill,effectVal){var ret=unifill.createDuplicate();var unicolor=ret.fill.color;if(effectVal!==0){effectVal*= 1E5;if(!unicolor.Mods)unicolor.setMods(new AscFormat.CColorModifiers);var mod=new AscFormat.CColorMod;if(effectVal>0){mod.setName("tint");mod.setVal(effectVal)}else{mod.setName("shade");mod.setVal(Math.abs(effectVal))}unicolor.Mods.addMod(mod)}return ret}function CreateUnifillSolidFillSchemeColor(colorId,tintOrShade){var unifill=new AscFormat.CUniFill;unifill.setFill(new AscFormat.CSolidFill);unifill.fill.setColor(new AscFormat.CUniColor);unifill.fill.color.setColor(new AscFormat.CSchemeColor);unifill.fill.color.color.setId(colorId); return CreateUniFillSolidFillWidthTintOrShade(unifill,tintOrShade)}function CreateNoFillLine(){var ret=new AscFormat.CLn;ret.setFill(CreateNoFillUniFill());return ret}function CreateNoFillUniFill(){var ret=new AscFormat.CUniFill;ret.setFill(new AscFormat.CNoFill);return ret}function CreateView3d(nRotX,nRotY,bRAngAx,nDepthPercent){var oView3d=new AscFormat.CView3d;AscFormat.isRealNumber(nRotX)&&oView3d.setRotX(nRotX);AscFormat.isRealNumber(nRotY)&&oView3d.setRotY(nRotY);AscFormat.isRealBool(bRAngAx)&& oView3d.setRAngAx(bRAngAx);AscFormat.isRealNumber(nDepthPercent)&&oView3d.setDepthPercent(nDepthPercent);return oView3d}function GetNumFormatFromSeries(aAscSeries){if(aAscSeries&&aAscSeries[0]&&aAscSeries[0].Val&&aAscSeries[0].Val.NumCache&&aAscSeries[0].Val.NumCache[0])if(typeof aAscSeries[0].Val.NumCache[0].numFormatStr==="string"&&aAscSeries[0].Val.NumCache[0].numFormatStr.length>0)return aAscSeries[0].Val.NumCache[0].numFormatStr;return"General"}function FillCatAxNumFormat(oCatAxis,aAscSeries){if(!oCatAxis)return; var sFormatCode=null;if(aAscSeries&&aAscSeries[0]&&aAscSeries[0].Cat&&aAscSeries[0].Cat.NumCache&&aAscSeries[0].Cat.NumCache[0])if(typeof aAscSeries[0].Cat.NumCache[0].numFormatStr==="string"&&aAscSeries[0].Cat.NumCache[0].numFormatStr.length>0)sFormatCode=aAscSeries[0].Cat.NumCache[0].numFormatStr;if(sFormatCode){oCatAxis.setNumFmt(new AscFormat.CNumFmt);oCatAxis.numFmt.setFormatCode(sFormatCode?sFormatCode:"General");oCatAxis.numFmt.setSourceLinked(true)}}function CreateTypedLineChart(type){var oLineChart= new AscFormat.CLineChart;oLineChart.setGrouping(type);oLineChart.setVaryColors(false);oLineChart.setMarker(true);oLineChart.setSmooth(false);return oLineChart}function CreateLineChart(chartSeries,type,bUseCache,oOptions,b3D){var asc_series=chartSeries;var chart_space=new CChartSpace;chart_space.setDate1904(false);chart_space.setLang("en-US");chart_space.setRoundedCorners(false);chart_space.setChart(new AscFormat.CChart);chart_space.setPrintSettings(new AscFormat.CPrintSettings);var chart=chart_space.chart; if(b3D){chart.setView3D(CreateView3d(15,20,true,100));chart.setDefaultWalls()}chart.setAutoTitleDeleted(false);chart.setPlotArea(new AscFormat.CPlotArea);chart.setPlotVisOnly(true);var disp_blanks_as;if(type===AscFormat.GROUPING_STANDARD)disp_blanks_as=DISP_BLANKS_AS_GAP;else disp_blanks_as=DISP_BLANKS_AS_ZERO;chart.setDispBlanksAs(disp_blanks_as);chart.setShowDLblsOverMax(false);var plot_area=chart.plotArea;plot_area.setLayout(new AscFormat.CLayout);plot_area.addChart(CreateTypedLineChart(type)); var cat_ax=new AscFormat.CCatAx;var val_ax=new AscFormat.CValAx;cat_ax.setAxId(++Ax_Counter.GLOBAL_AX_ID_COUNTER);val_ax.setAxId(++Ax_Counter.GLOBAL_AX_ID_COUNTER);cat_ax.setCrossAx(val_ax);val_ax.setCrossAx(cat_ax);plot_area.addAxis(cat_ax);plot_area.addAxis(val_ax);var line_chart=plot_area.charts[0];line_chart.addAxId(cat_ax);line_chart.addAxId(val_ax);val_ax.setCrosses(2);var bMarker=false;var nChartType=oOptions.type;if(nChartType===Asc.c_oAscChartTypeSettings.lineNormalMarker||nChartType===Asc.c_oAscChartTypeSettings.lineStackedMarker|| nChartType===Asc.c_oAscChartTypeSettings.lineStackedPerMarker)bMarker=true;bMarker=false;line_chart.setMarker(bMarker);for(var i=0;i1){chart.setLegend(new AscFormat.CLegend);var legend=chart.legend;legend.setLegendPos(c_oAscChartLegendShowSettings.right);legend.setLayout(new AscFormat.CLayout);legend.setOverlay(false)}chart_space.printSettings.setDefault(); line_chart.tryChangeType(oOptions.type);if(AscCommon.g_oChartStyles[oOptions.type])chart_space.applyChartStyleByIds(AscCommon.g_oChartStyles[oOptions.type][0]);return chart_space}function CreateTypedBarChart(type,b3D){var oBarChart=new AscFormat.CBarChart;if(b3D)oBarChart.set3D(true);oBarChart.setBarDir(AscFormat.BAR_DIR_COL);oBarChart.setGrouping(type);oBarChart.setVaryColors(false);oBarChart.setGapWidth(150);if(AscFormat.BAR_GROUPING_PERCENT_STACKED===type||AscFormat.BAR_GROUPING_STACKED===type)oBarChart.setOverlap(100); if(b3D)oBarChart.setShape(BAR_SHAPE_BOX);return oBarChart}function CreateBarChart(chartSeries,type,bUseCache,oOptions,b3D,bDepth){var asc_series=chartSeries;var chart_space=new CChartSpace;chart_space.setDate1904(false);chart_space.setLang("en-US");chart_space.setRoundedCorners(false);chart_space.setChart(new AscFormat.CChart);chart_space.setPrintSettings(new AscFormat.CPrintSettings);var chart=chart_space.chart;chart.setAutoTitleDeleted(false);if(b3D){chart.setView3D(CreateView3d(15,20,true,bDepth? 100:undefined));chart.setDefaultWalls()}chart.setPlotArea(new AscFormat.CPlotArea);chart.setPlotVisOnly(true);chart.setDispBlanksAs(DISP_BLANKS_AS_GAP);chart.setShowDLblsOverMax(false);var plot_area=chart.plotArea;plot_area.setLayout(new AscFormat.CLayout);plot_area.addChart(CreateTypedBarChart(type,b3D));var cat_ax=new AscFormat.CCatAx;var val_ax=new AscFormat.CValAx;cat_ax.setAxId(++Ax_Counter.GLOBAL_AX_ID_COUNTER);val_ax.setAxId(++Ax_Counter.GLOBAL_AX_ID_COUNTER);cat_ax.setCrossAx(val_ax);val_ax.setCrossAx(cat_ax); plot_area.addAxis(cat_ax);plot_area.addAxis(val_ax);var bar_chart=plot_area.charts[0];for(var i=0;i1){chart.setLegend(new AscFormat.CLegend);var legend=chart.legend;legend.setLegendPos(c_oAscChartLegendShowSettings.right);legend.setLayout(new AscFormat.CLayout);legend.setOverlay(false)}chart_space.printSettings.setDefault();if(AscCommon.g_oChartStyles[oOptions.type])chart_space.applyChartStyleByIds(AscCommon.g_oChartStyles[oOptions.type][0]);return chart_space}function CreateHBarChart(chartSeries, type,bUseCache,oOptions,b3D){var asc_series=chartSeries;var chart_space=new CChartSpace;chart_space.setDate1904(false);chart_space.setLang("en-US");chart_space.setRoundedCorners(false);chart_space.setChart(new AscFormat.CChart);chart_space.setPrintSettings(new AscFormat.CPrintSettings);var chart=chart_space.chart;chart.setAutoTitleDeleted(false);if(b3D){chart.setView3D(CreateView3d(15,20,true,undefined));chart.setDefaultWalls()}chart.setPlotArea(new AscFormat.CPlotArea);chart.setPlotVisOnly(true); chart.setDispBlanksAs(DISP_BLANKS_AS_GAP);chart.setShowDLblsOverMax(false);var plot_area=chart.plotArea;plot_area.setLayout(new AscFormat.CLayout);var oBarChart=new AscFormat.CBarChart;plot_area.addChart(oBarChart);if(b3D)oBarChart.set3D(true);var cat_ax=new AscFormat.CCatAx;var val_ax=new AscFormat.CValAx;cat_ax.setAxId(++Ax_Counter.GLOBAL_AX_ID_COUNTER);val_ax.setAxId(++Ax_Counter.GLOBAL_AX_ID_COUNTER);cat_ax.setCrossAx(val_ax);val_ax.setCrossAx(cat_ax);plot_area.addAxis(cat_ax);plot_area.addAxis(val_ax); var bar_chart=plot_area.charts[0];bar_chart.setBarDir(AscFormat.BAR_DIR_BAR);bar_chart.setGrouping(type);bar_chart.setVaryColors(false);for(var i=0;i1){chart.setLegend(new AscFormat.CLegend);var legend=chart.legend;legend.setLegendPos(c_oAscChartLegendShowSettings.right);legend.setLayout(new AscFormat.CLayout);legend.setOverlay(false)}chart_space.printSettings.setDefault(); if(AscCommon.g_oChartStyles[oOptions.type])chart_space.applyChartStyleByIds(AscCommon.g_oChartStyles[oOptions.type][0]);return chart_space}function CreateAreaChart(chartSeries,type,bUseCache,oOptions){var asc_series=chartSeries;var chart_space=new CChartSpace;chart_space.setDate1904(false);chart_space.setLang("en-US");chart_space.setRoundedCorners(false);chart_space.setChart(new AscFormat.CChart);chart_space.setPrintSettings(new AscFormat.CPrintSettings);var chart=chart_space.chart;chart.setAutoTitleDeleted(false); chart.setPlotArea(new AscFormat.CPlotArea);chart.setPlotVisOnly(true);chart.setDispBlanksAs(DISP_BLANKS_AS_ZERO);chart.setShowDLblsOverMax(false);var plot_area=chart.plotArea;plot_area.setLayout(new AscFormat.CLayout);plot_area.addChart(new AscFormat.CAreaChart);var cat_ax=new AscFormat.CCatAx;var val_ax=new AscFormat.CValAx;cat_ax.setAxId(++Ax_Counter.GLOBAL_AX_ID_COUNTER);val_ax.setAxId(++Ax_Counter.GLOBAL_AX_ID_COUNTER);cat_ax.setCrossAx(val_ax);val_ax.setCrossAx(cat_ax);plot_area.addAxis(cat_ax); plot_area.addAxis(val_ax);var area_chart=plot_area.charts[0];area_chart.setGrouping(type);area_chart.setVaryColors(false);for(var i=0;i1){chart.setLegend(new AscFormat.CLegend);var legend=chart.legend;legend.setLegendPos(c_oAscChartLegendShowSettings.right);legend.setLayout(new AscFormat.CLayout);legend.setOverlay(false)}chart_space.printSettings.setDefault();if(AscCommon.g_oChartStyles[oOptions.type])chart_space.applyChartStyleByIds(AscCommon.g_oChartStyles[oOptions.type][0]);return chart_space} function CreatePieChart(chartSeries,bDoughnut,bUseCache,oOptions,b3D){var asc_series=chartSeries;var chart_space=new CChartSpace;chart_space.setDate1904(false);chart_space.setLang("en-US");chart_space.setRoundedCorners(false);chart_space.setStyle(2);chart_space.setChart(new AscFormat.CChart);var chart=chart_space.chart;chart.setAutoTitleDeleted(false);if(b3D){chart.setView3D(CreateView3d(30,0,true,100));chart.setDefaultWalls()}chart.setPlotArea(new AscFormat.CPlotArea);var plot_area=chart.plotArea; plot_area.setLayout(new AscFormat.CLayout);plot_area.addChart(bDoughnut?new AscFormat.CDoughnutChart:new AscFormat.CPieChart);var pie_chart=plot_area.charts[0];pie_chart.setVaryColors(true);for(var i=0;i1){chart.setLegend(new AscFormat.CLegend);var legend=chart.legend;legend.setLegendPos(c_oAscChartLegendShowSettings.right);legend.setLayout(new AscFormat.CLayout);legend.setOverlay(false)}chart_space.setPrintSettings(new AscFormat.CPrintSettings);chart_space.printSettings.setDefault();if(oOptions&&oOptions.type!==Asc.c_oAscChartTypeSettings)scatter_chart.tryChangeType(oOptions.type); if(AscCommon.g_oChartStyles[oOptions.type])chart_space.applyChartStyleByIds(AscCommon.g_oChartStyles[oOptions.type][0]);return chart_space}function CreateStockChart(chartSeries,bUseCache,oOptions){var asc_series=chartSeries;var chart_space=new CChartSpace;chart_space.setDate1904(false);chart_space.setLang("en-US");chart_space.setRoundedCorners(false);chart_space.setChart(new AscFormat.CChart);chart_space.setPrintSettings(new AscFormat.CPrintSettings);var chart=chart_space.chart;chart.setAutoTitleDeleted(false); chart.setPlotArea(new AscFormat.CPlotArea);chart.setLegend(new AscFormat.CLegend);chart.setPlotVisOnly(true);var disp_blanks_as;disp_blanks_as=DISP_BLANKS_AS_GAP;chart.setDispBlanksAs(disp_blanks_as);chart.setShowDLblsOverMax(false);var plot_area=chart.plotArea;plot_area.setLayout(new AscFormat.CLayout);plot_area.addChart(new AscFormat.CStockChart);var cat_ax=new AscFormat.CCatAx;var val_ax=new AscFormat.CValAx;cat_ax.setAxId(++Ax_Counter.GLOBAL_AX_ID_COUNTER);val_ax.setAxId(++Ax_Counter.GLOBAL_AX_ID_COUNTER); cat_ax.setCrossAx(val_ax);val_ax.setCrossAx(cat_ax);plot_area.addAxis(cat_ax);plot_area.addAxis(val_ax);var oStockChart=plot_area.charts[0];oStockChart.addAxId(cat_ax);oStockChart.addAxId(val_ax);oStockChart.setHiLowLines(new AscFormat.CSpPr);oStockChart.setUpDownBars(new AscFormat.CUpDownBars);oStockChart.upDownBars.setGapWidth(150);oStockChart.upDownBars.setUpBars(new AscFormat.CSpPr);oStockChart.upDownBars.setDownBars(new AscFormat.CSpPr);for(var i=0;i0)AscFonts.FontPickerByCharacter.getFontsByString(value)};drawingsChangesMap[AscDFH.historyitem_StrRef_SetF]=function(oClass,value){oClass.internalSetFormula(value)};drawingsChangesMap[AscDFH.historyitem_StrRef_SetStrCache]=function(oClass,value){oClass.strCache=value};drawingsChangesMap[AscDFH.historyitem_SurfaceChart_SetWireframe]=function(oClass,value){oClass.wireframe=value};drawingsChangesMap[AscDFH.historyitem_SurfaceSeries_SetCat]=function(oClass,value){oClass.cat=value;oClass.onChangeDataRefs()}; drawingsChangesMap[AscDFH.historyitem_SurfaceSeries_SetIdx]=function(oClass,value){oClass.idx=value};drawingsChangesMap[AscDFH.historyitem_SurfaceSeries_SetOrder]=function(oClass,value){oClass.order=value};drawingsChangesMap[AscDFH.historyitem_SurfaceSeries_SetSpPr]=function(oClass,value){oClass.spPr=value};drawingsChangesMap[AscDFH.historyitem_SurfaceSeries_SetVal]=function(oClass,value){oClass.val=value;oClass.onChangeDataRefs()};drawingsChangesMap[AscDFH.historyitem_Title_SetLayout]=function(oClass, value){oClass.layout=value};drawingsChangesMap[AscDFH.historyitem_Title_SetOverlay]=function(oClass,value){oClass.overlay=value};drawingsChangesMap[AscDFH.historyitem_Title_SetSpPr]=function(oClass,value){oClass.spPr=value};drawingsChangesMap[AscDFH.historyitem_Title_SetTx]=function(oClass,value){if(oClass.tx&&oClass.tx.strRef||value&&value.strRef)oClass.onChangeDataRefs();oClass.tx=value};drawingsChangesMap[AscDFH.historyitem_Title_SetTxPr]=function(oClass,value){oClass.txPr=value};drawingsChangesMap[AscDFH.historyitem_Trendline_SetBackward]= function(oClass,value){oClass.backward=value};drawingsChangesMap[AscDFH.historyitem_Trendline_SetDispEq]=function(oClass,value){oClass.dispEq=value};drawingsChangesMap[AscDFH.historyitem_Trendline_SetDispRSqr]=function(oClass,value){oClass.dispRSqr=value};drawingsChangesMap[AscDFH.historyitem_Trendline_SetForward]=function(oClass,value){oClass.forward=value};drawingsChangesMap[AscDFH.historyitem_Trendline_SetIntercept]=function(oClass,value){oClass.intercept=value};drawingsChangesMap[AscDFH.historyitem_Trendline_SetName]= function(oClass,value){oClass.name=value};drawingsChangesMap[AscDFH.historyitem_Trendline_SetOrder]=function(oClass,value){oClass.order=value};drawingsChangesMap[AscDFH.historyitem_Trendline_SetPeriod]=function(oClass,value){oClass.period=value};drawingsChangesMap[AscDFH.historyitem_Trendline_SetSpPr]=function(oClass,value){oClass.spPr=value};drawingsChangesMap[AscDFH.historyitem_Trendline_SetTrendlineLbl]=function(oClass,value){oClass.trendlineLbl=value};drawingsChangesMap[AscDFH.historyitem_Trendline_SetTrendlineType]= function(oClass,value){oClass.trendlineType=value};drawingsChangesMap[AscDFH.historyitem_UpDownBars_SetDownBars]=function(oClass,value){oClass.downBars=value};drawingsChangesMap[AscDFH.historyitem_UpDownBars_SetGapWidth]=function(oClass,value){oClass.gapWidth=value};drawingsChangesMap[AscDFH.historyitem_UpDownBars_SetUpBars]=function(oClass,value){oClass.upBars=value};drawingsChangesMap[AscDFH.historyitem_YVal_SetNumLit]=function(oClass,value){oClass.numLit=value;oClass.onChangeDataRefs()};drawingsChangesMap[AscDFH.historyitem_YVal_SetNumRef]= function(oClass,value){oClass.numRef=value;oClass.onChangeDataRefs()};drawingsChangesMap[AscDFH.historyitem_Chart_SetAutoTitleDeleted]=function(oClass,value){oClass.autoTitleDeleted=value};drawingsChangesMap[AscDFH.historyitem_Chart_SetBackWall]=function(oClass,value){oClass.backWall=value};drawingsChangesMap[AscDFH.historyitem_Chart_SetDispBlanksAs]=function(oClass,value){oClass.dispBlanksAs=value};drawingsChangesMap[AscDFH.historyitem_Chart_SetFloor]=function(oClass,value){oClass.floor=value};drawingsChangesMap[AscDFH.historyitem_Chart_SetLegend]= function(oClass,value){oClass.legend=value};drawingsChangesMap[AscDFH.historyitem_Chart_SetPlotArea]=function(oClass,value){oClass.plotArea=value};drawingsChangesMap[AscDFH.historyitem_Chart_SetPlotVisOnly]=function(oClass,value){oClass.plotVisOnly=value};drawingsChangesMap[AscDFH.historyitem_Chart_SetShowDLblsOverMax]=function(oClass,value){oClass.showDLblsOverMax=value};drawingsChangesMap[AscDFH.historyitem_Chart_SetSideWall]=function(oClass,value){oClass.sideWall=value};drawingsChangesMap[AscDFH.historyitem_Chart_SetTitle]= function(oClass,value){oClass.title=value;oClass.onChangeDataRefs()};drawingsChangesMap[AscDFH.historyitem_Chart_SetView3D]=function(oClass,value){oClass.view3D=value;oClass.Refresh_RecalcData()};drawingsChangesMap[AscDFH.historyitem_ChartWall_SetPictureOptions]=function(oClass,value){oClass.pictureOptions=value};drawingsChangesMap[AscDFH.historyitem_ChartWall_SetSpPr]=function(oClass,value){oClass.spPr=value};drawingsChangesMap[AscDFH.historyitem_ChartWall_SetThickness]=function(oClass,value){oClass.thickness= value};drawingsChangesMap[AscDFH.historyitem_View3d_SetDepthPercent]=function(oClass,value){oClass.depthPercent=value;oClass.Refresh_RecalcData()};drawingsChangesMap[AscDFH.historyitem_View3d_SetHPercent]=function(oClass,value){oClass.hPercent=value;oClass.Refresh_RecalcData()};drawingsChangesMap[AscDFH.historyitem_View3d_SetPerspective]=function(oClass,value){oClass.perspective=value;oClass.Refresh_RecalcData()};drawingsChangesMap[AscDFH.historyitem_View3d_SetRAngAx]=function(oClass,value){oClass.rAngAx= value;oClass.Refresh_RecalcData()};drawingsChangesMap[AscDFH.historyitem_View3d_SetRotX]=function(oClass,value){oClass.rotX=value;oClass.Refresh_RecalcData()};drawingsChangesMap[AscDFH.historyitem_View3d_SetRotY]=function(oClass,value){oClass.rotY=value;oClass.Refresh_RecalcData()};drawingsChangesMap[AscDFH.historyitem_ExternalData_SetAutoUpdate]=function(oClass,value){oClass.autoUpdate=value};drawingsChangesMap[AscDFH.historyitem_ExternalData_SetId]=function(oClass,value){oClass.id=value};drawingsChangesMap[AscDFH.historyitem_PivotSource_SetFmtId]= function(oClass,value){oClass.fmtId=value};drawingsChangesMap[AscDFH.historyitem_PivotSource_SetName]=function(oClass,value){oClass.name=value};drawingsChangesMap[AscDFH.historyitem_Protection_SetChartObject]=function(oClass,value){oClass.chartObject=value};drawingsChangesMap[AscDFH.historyitem_Protection_SetData]=function(oClass,value){oClass.data=value};drawingsChangesMap[AscDFH.historyitem_Protection_SetFormatting]=function(oClass,value){oClass.formatting=value};drawingsChangesMap[AscDFH.historyitem_Protection_SetSelection]= function(oClass,value){oClass.selection=value};drawingsChangesMap[AscDFH.historyitem_Protection_SetUserInterface]=function(oClass,value){oClass.userInterface=value};drawingsChangesMap[AscDFH.historyitem_PrintSettingsSetHeaderFooter]=function(oClass,value){oClass.headerFooter=value};drawingsChangesMap[AscDFH.historyitem_PrintSettingsSetPageMargins]=function(oClass,value){oClass.pageMargins=value};drawingsChangesMap[AscDFH.historyitem_PrintSettingsSetPageSetup]=function(oClass,value){oClass.pageSetup= value};drawingsChangesMap[AscDFH.historyitem_HeaderFooterChartSetAlignWithMargins]=function(oClass,value){oClass.alignWithMargins=value};drawingsChangesMap[AscDFH.historyitem_HeaderFooterChartSetDifferentFirst]=function(oClass,value){oClass.differentFirst=value};drawingsChangesMap[AscDFH.historyitem_HeaderFooterChartSetDifferentOddEven]=function(oClass,value){oClass.differentOddEven=value};drawingsChangesMap[AscDFH.historyitem_HeaderFooterChartSetEvenFooter]=function(oClass,value){oClass.evenFooter= value};drawingsChangesMap[AscDFH.historyitem_HeaderFooterChartSetEvenHeader]=function(oClass,value){oClass.evenHeader=value};drawingsChangesMap[AscDFH.historyitem_HeaderFooterChartSetFirstFooter]=function(oClass,value){oClass.firstFooter=value};drawingsChangesMap[AscDFH.historyitem_HeaderFooterChartSetFirstHeader]=function(oClass,value){oClass.firstHeader=value};drawingsChangesMap[AscDFH.historyitem_HeaderFooterChartSetOddFooter]=function(oClass,value){oClass.oddFooter=value};drawingsChangesMap[AscDFH.historyitem_HeaderFooterChartSetOddHeader]= function(oClass,value){oClass.oddHeader=value};drawingsChangesMap[AscDFH.historyitem_PageMarginsSetB]=function(oClass,value){oClass.b=value};drawingsChangesMap[AscDFH.historyitem_PageMarginsSetFooter]=function(oClass,value){oClass.footer=value};drawingsChangesMap[AscDFH.historyitem_PageMarginsSetHeader]=function(oClass,value){oClass.header=value};drawingsChangesMap[AscDFH.historyitem_PageMarginsSetL]=function(oClass,value){oClass.l=value};drawingsChangesMap[AscDFH.historyitem_PageMarginsSetR]=function(oClass, value){oClass.r=value};drawingsChangesMap[AscDFH.historyitem_PageMarginsSetT]=function(oClass,value){oClass.t=value};drawingsChangesMap[AscDFH.historyitem_PageSetupSetBlackAndWhite]=function(oClass,value){oClass.blackAndWhite=value};drawingsChangesMap[AscDFH.historyitem_PageSetupSetCopies]=function(oClass,value){oClass.copies=value};drawingsChangesMap[AscDFH.historyitem_PageSetupSetDraft]=function(oClass,value){oClass.draft=value};drawingsChangesMap[AscDFH.historyitem_PageSetupSetFirstPageNumber]= function(oClass,value){oClass.firstPageNumber=value};drawingsChangesMap[AscDFH.historyitem_PageSetupSetHorizontalDpi]=function(oClass,value){oClass.horizontalDpi=value};drawingsChangesMap[AscDFH.historyitem_PageSetupSetOrientation]=function(oClass,value){oClass.orientation=value};drawingsChangesMap[AscDFH.historyitem_PageSetupSetPaperHeight]=function(oClass,value){oClass.paperHeight=value};drawingsChangesMap[AscDFH.historyitem_PageSetupSetPaperSize]=function(oClass,value){oClass.paperSize=value}; drawingsChangesMap[AscDFH.historyitem_PageSetupSetPaperWidth]=function(oClass,value){oClass.paperWidth=value};drawingsChangesMap[AscDFH.historyitem_PageSetupSetUseFirstPageNumb]=function(oClass,value){oClass.useFirstPageNumb=value};drawingsChangesMap[AscDFH.historyitem_PageSetupSetVerticalDpi]=function(oClass,value){oClass.verticalDpi=value};drawingsChangesMap[AscDFH.historyitem_CommonSeries_SetIdx]=function(oClass,value){oClass.idx=value;oClass.Refresh_RecalcData({Type:AscDFH.historyitem_CommonSeries_SetIdx})}; drawingsChangesMap[AscDFH.historyitem_CommonSeries_SetOrder]=function(oClass,value){oClass.order=value;oClass.Refresh_RecalcData({Type:AscDFH.historyitem_CommonSeries_SetOrder})};drawingsChangesMap[AscDFH.historyitem_CommonSeries_SetTx]=function(oClass,value){oClass.tx=value;oClass.Refresh_RecalcData({Type:AscDFH.historyitem_CommonSeries_SetTx});oClass.onChangeDataRefs()};drawingsChangesMap[AscDFH.historyitem_CommonSeries_SetSpPr]=function(oClass,value){oClass.spPr=value;oClass.Refresh_RecalcData({Type:AscDFH.historyitem_CommonSeries_SetSpPr})}; drawingsChangesMap[AscDFH.historyitem_ChartStyleAxisTitle]=function(oClass,value){oClass.axisTitle=value};drawingsChangesMap[AscDFH.historyitem_ChartStyleCategoryAxis]=function(oClass,value){oClass.categoryAxis=value};drawingsChangesMap[AscDFH.historyitem_ChartStyleChartArea]=function(oClass,value){oClass.chartArea=value};drawingsChangesMap[AscDFH.historyitem_ChartStyleDataLabel]=function(oClass,value){oClass.dataLabel=value};drawingsChangesMap[AscDFH.historyitem_ChartStyleDataLabelCallout]=function(oClass, value){oClass.dataLabelCallout=value};drawingsChangesMap[AscDFH.historyitem_ChartStyleDataPoint]=function(oClass,value){oClass.dataPoint=value};drawingsChangesMap[AscDFH.historyitem_ChartStyleDataPoint3D]=function(oClass,value){oClass.dataPoint3D=value};drawingsChangesMap[AscDFH.historyitem_ChartStyleDataPointLine]=function(oClass,value){oClass.dataPointLine=value};drawingsChangesMap[AscDFH.historyitem_ChartStyleDataPointMarker]=function(oClass,value){oClass.dataPointMarker=value};drawingsChangesMap[AscDFH.historyitem_ChartStyleDataPointWireframe]= function(oClass,value){oClass.dataPointWireframe=value};drawingsChangesMap[AscDFH.historyitem_ChartStyleDataTable]=function(oClass,value){oClass.dataTable=value};drawingsChangesMap[AscDFH.historyitem_ChartStyleDownBar]=function(oClass,value){oClass.downBar=value};drawingsChangesMap[AscDFH.historyitem_ChartStyleDropLine]=function(oClass,value){oClass.dropLine=value};drawingsChangesMap[AscDFH.historyitem_ChartStyleErrorBar]=function(oClass,value){oClass.errorBar=value};drawingsChangesMap[AscDFH.historyitem_ChartStyleFloor]= function(oClass,value){oClass.floor=value};drawingsChangesMap[AscDFH.historyitem_ChartStyleGridlineMajor]=function(oClass,value){oClass.gridlineMajor=value};drawingsChangesMap[AscDFH.historyitem_ChartStyleGridlineMinor]=function(oClass,value){oClass.gridlineMinor=value};drawingsChangesMap[AscDFH.historyitem_ChartStyleHiLoLine]=function(oClass,value){oClass.hiLoLine=value};drawingsChangesMap[AscDFH.historyitem_ChartStyleLeaderLine]=function(oClass,value){oClass.leaderLine=value};drawingsChangesMap[AscDFH.historyitem_ChartStyleLegend]= function(oClass,value){oClass.legend=value};drawingsChangesMap[AscDFH.historyitem_ChartStylePlotArea]=function(oClass,value){oClass.plotArea=value};drawingsChangesMap[AscDFH.historyitem_ChartStylePlotArea3D]=function(oClass,value){oClass.plotArea3D=value};drawingsChangesMap[AscDFH.historyitem_ChartStyleSeriesAxis]=function(oClass,value){oClass.seriesAxis=value};drawingsChangesMap[AscDFH.historyitem_ChartStyleSeriesLine]=function(oClass,value){oClass.seriesLine=value};drawingsChangesMap[AscDFH.historyitem_ChartStyleTitle]= function(oClass,value){oClass.title=value};drawingsChangesMap[AscDFH.historyitem_ChartStyleTrendline]=function(oClass,value){oClass.trendline=value};drawingsChangesMap[AscDFH.historyitem_ChartStyleTrendlineLabel]=function(oClass,value){oClass.trendlineLabel=value};drawingsChangesMap[AscDFH.historyitem_ChartStyleUpBar]=function(oClass,value){oClass.upBar=value};drawingsChangesMap[AscDFH.historyitem_ChartStyleValueAxis]=function(oClass,value){oClass.valueAxis=value};drawingsChangesMap[AscDFH.historyitem_ChartStyleWall]= function(oClass,value){oClass.wall=value};drawingsChangesMap[AscDFH.historyitem_ChartStyleMarkerLayout]=function(oClass,value){oClass.markerLayout=value};drawingsChangesMap[AscDFH.historyitem_ChartStyleMarkerId]=function(oClass,value){oClass.id=value};drawingsChangesMap[AscDFH.historyitem_ChartStyleEntryType]=function(oClass,value){oClass.type=value};drawingsChangesMap[AscDFH.historyitem_ChartStyleEntryLineWidthScale]=function(oClass,value){oClass.lineWidthScale=value};drawingsChangesMap[AscDFH.historyitem_ChartStyleEntryLnRef]= function(oClass,value){oClass.lnRef=value};drawingsChangesMap[AscDFH.historyitem_ChartStyleEntryFillRef]=function(oClass,value){oClass.fillRef=value};drawingsChangesMap[AscDFH.historyitem_ChartStyleEntryEffectRef]=function(oClass,value){oClass.effectRef=value};drawingsChangesMap[AscDFH.historyitem_ChartStyleEntryFontRef]=function(oClass,value){oClass.fontRef=value};drawingsChangesMap[AscDFH.historyitem_ChartStyleEntryDefRPr]=function(oClass,value){oClass.defRPr=value};drawingsChangesMap[AscDFH.historyitem_ChartStyleEntryBodyPr]= function(oClass,value){oClass.bodyPr=value};drawingsChangesMap[AscDFH.historyitem_ChartStyleEntrySpPr]=function(oClass,value){oClass.spPr=value};drawingsChangesMap[AscDFH.historyitem_MarkerLayoutSymbol]=function(oClass,value){oClass.symbol=value};drawingsChangesMap[AscDFH.historyitem_MarkerLayoutSize]=function(oClass,value){oClass.size=value};AscDFH.changesFactory[AscDFH.historyitem_DLbl_SetDelete]=window["AscDFH"].CChangesDrawingsBool;AscDFH.changesFactory[AscDFH.historyitem_DLbl_SetShowBubbleSize]= window["AscDFH"].CChangesDrawingsBool;AscDFH.changesFactory[AscDFH.historyitem_DLbl_SetShowCatName]=window["AscDFH"].CChangesDrawingsBool;AscDFH.changesFactory[AscDFH.historyitem_DLbl_SetShowLegendKey]=window["AscDFH"].CChangesDrawingsBool;AscDFH.changesFactory[AscDFH.historyitem_DLbl_SetShowPercent]=window["AscDFH"].CChangesDrawingsBool;AscDFH.changesFactory[AscDFH.historyitem_DLbl_SetShowSerName]=window["AscDFH"].CChangesDrawingsBool;AscDFH.changesFactory[AscDFH.historyitem_DLbl_SetShowVal]=window["AscDFH"].CChangesDrawingsBool; AscDFH.changesFactory[AscDFH.historyitem_BarChart_Set3D]=window["AscDFH"].CChangesDrawingsBool;AscDFH.changesFactory[AscDFH.historyitem_BarChart_SetVaryColors]=window["AscDFH"].CChangesDrawingsBool;AscDFH.changesFactory[AscDFH.historyitem_CommonChart_SetVaryColors]=window["AscDFH"].CChangesDrawingsBool;AscDFH.changesFactory[AscDFH.historyitem_AreaChart_SetVaryColors]=window["AscDFH"].CChangesDrawingsBool;AscDFH.changesFactory[AscDFH.historyitem_CatAxSetAuto]=window["AscDFH"].CChangesDrawingsBool; AscDFH.changesFactory[AscDFH.historyitem_CatAxSetDelete]=window["AscDFH"].CChangesDrawingsBool;AscDFH.changesFactory[AscDFH.historyitem_CatAxSetNoMultiLvlLbl]=window["AscDFH"].CChangesDrawingsBool;AscDFH.changesFactory[AscDFH.historyitem_DateAxAuto]=window["AscDFH"].CChangesDrawingsBool;AscDFH.changesFactory[AscDFH.historyitem_DateAxDelete]=window["AscDFH"].CChangesDrawingsBool;AscDFH.changesFactory[AscDFH.historyitem_SerAxSetDelete]=window["AscDFH"].CChangesDrawingsBool;AscDFH.changesFactory[AscDFH.historyitem_ValAxSetDelete]= window["AscDFH"].CChangesDrawingsBool;AscDFH.changesFactory[AscDFH.historyitem_BarSeries_SetInvertIfNegative]=window["AscDFH"].CChangesDrawingsBool;AscDFH.changesFactory[AscDFH.historyitem_BubbleChart_SetBubble3D]=window["AscDFH"].CChangesDrawingsBool;AscDFH.changesFactory[AscDFH.historyitem_BubbleChart_SetShowNegBubbles]=window["AscDFH"].CChangesDrawingsBool;AscDFH.changesFactory[AscDFH.historyitem_BubbleChart_SetVaryColors]=window["AscDFH"].CChangesDrawingsBool;AscDFH.changesFactory[AscDFH.historyitem_BubbleSeries_SetBubble3D]= window["AscDFH"].CChangesDrawingsBool;AscDFH.changesFactory[AscDFH.historyitem_BubbleSeries_SetInvertIfNegative]=window["AscDFH"].CChangesDrawingsBool;AscDFH.changesFactory[AscDFH.historyitem_DLbls_SetDelete]=window["AscDFH"].CChangesDrawingsBool;AscDFH.changesFactory[AscDFH.historyitem_DLbls_SetShowBubbleSize]=window["AscDFH"].CChangesDrawingsBool;AscDFH.changesFactory[AscDFH.historyitem_DLbls_SetShowCatName]=window["AscDFH"].CChangesDrawingsBool;AscDFH.changesFactory[AscDFH.historyitem_DLbls_SetShowLeaderLines]= window["AscDFH"].CChangesDrawingsBool;AscDFH.changesFactory[AscDFH.historyitem_DLbls_SetShowLegendKey]=window["AscDFH"].CChangesDrawingsBool;AscDFH.changesFactory[AscDFH.historyitem_DLbls_SetShowPercent]=window["AscDFH"].CChangesDrawingsBool;AscDFH.changesFactory[AscDFH.historyitem_DLbls_SetShowSerName]=window["AscDFH"].CChangesDrawingsBool;AscDFH.changesFactory[AscDFH.historyitem_DLbls_SetShowVal]=window["AscDFH"].CChangesDrawingsBool;AscDFH.changesFactory[AscDFH.historyitem_DPt_SetBubble3D]=window["AscDFH"].CChangesDrawingsBool; AscDFH.changesFactory[AscDFH.historyitem_DPt_SetInvertIfNegative]=window["AscDFH"].CChangesDrawingsBool;AscDFH.changesFactory[AscDFH.historyitem_DTable_SetShowHorzBorder]=window["AscDFH"].CChangesDrawingsBool;AscDFH.changesFactory[AscDFH.historyitem_DTable_SetShowKeys]=window["AscDFH"].CChangesDrawingsBool;AscDFH.changesFactory[AscDFH.historyitem_DTable_SetShowOutline]=window["AscDFH"].CChangesDrawingsBool;AscDFH.changesFactory[AscDFH.historyitem_DTable_SetShowVertBorder]=window["AscDFH"].CChangesDrawingsBool; AscDFH.changesFactory[AscDFH.historyitem_DoughnutChart_SetVaryColor]=window["AscDFH"].CChangesDrawingsBool;AscDFH.changesFactory[AscDFH.historyitem_ErrBars_SetNoEndCap]=window["AscDFH"].CChangesDrawingsBool;AscDFH.changesFactory[AscDFH.historyitem_Legend_SetOverlay]=window["AscDFH"].CChangesDrawingsBool;AscDFH.changesFactory[AscDFH.historyitem_LegendEntry_SetDelete]=window["AscDFH"].CChangesDrawingsBool;AscDFH.changesFactory[AscDFH.historyitem_LineChart_SetMarker]=window["AscDFH"].CChangesDrawingsBool; AscDFH.changesFactory[AscDFH.historyitem_LineChart_SetSmooth]=window["AscDFH"].CChangesDrawingsBool;AscDFH.changesFactory[AscDFH.historyitem_LineChart_SetVaryColors]=window["AscDFH"].CChangesDrawingsBool;AscDFH.changesFactory[AscDFH.historyitem_LineSeries_SetSmooth]=window["AscDFH"].CChangesDrawingsBool;AscDFH.changesFactory[AscDFH.historyitem_NumFmt_SetSourceLinked]=window["AscDFH"].CChangesDrawingsBool;AscDFH.changesFactory[AscDFH.historyitem_OfPieChart_SetVaryColors]=window["AscDFH"].CChangesDrawingsBool; AscDFH.changesFactory[AscDFH.historyitem_PieChart_SetVaryColors]=window["AscDFH"].CChangesDrawingsBool;AscDFH.changesFactory[AscDFH.historyitem_PieChart_3D]=window["AscDFH"].CChangesDrawingsBool;AscDFH.changesFactory[AscDFH.historyitem_RadarChart_SetVaryColors]=window["AscDFH"].CChangesDrawingsBool;AscDFH.changesFactory[AscDFH.historyitem_ScatterChart_SetVaryColors]=window["AscDFH"].CChangesDrawingsBool;AscDFH.changesFactory[AscDFH.historyitem_ScatterSer_SetSmooth]=window["AscDFH"].CChangesDrawingsBool; AscDFH.changesFactory[AscDFH.historyitem_SurfaceChart_SetWireframe]=window["AscDFH"].CChangesDrawingsBool;AscDFH.changesFactory[AscDFH.historyitem_Title_SetOverlay]=window["AscDFH"].CChangesDrawingsBool;AscDFH.changesFactory[AscDFH.historyitem_Trendline_SetDispEq]=window["AscDFH"].CChangesDrawingsBool;AscDFH.changesFactory[AscDFH.historyitem_Trendline_SetDispRSqr]=window["AscDFH"].CChangesDrawingsBool;AscDFH.changesFactory[AscDFH.historyitem_Chart_SetAutoTitleDeleted]=window["AscDFH"].CChangesDrawingsBool; AscDFH.changesFactory[AscDFH.historyitem_Chart_SetPlotVisOnly]=window["AscDFH"].CChangesDrawingsBool;AscDFH.changesFactory[AscDFH.historyitem_Chart_SetShowDLblsOverMax]=window["AscDFH"].CChangesDrawingsBool;AscDFH.changesFactory[AscDFH.historyitem_View3d_SetRAngAx]=window["AscDFH"].CChangesDrawingsBool;AscDFH.changesFactory[AscDFH.historyitem_ExternalData_SetAutoUpdate]=window["AscDFH"].CChangesDrawingsBool;AscDFH.changesFactory[AscDFH.historyitem_DLbl_SetDLblPos]=window["AscDFH"].CChangesDrawingsLong; AscDFH.changesFactory[AscDFH.historyitem_DLbl_SetIdx]=window["AscDFH"].CChangesDrawingsLong;AscDFH.changesFactory[AscDFH.historyitem_BarChart_SetGapDepth]=window["AscDFH"].CChangesDrawingsLong;AscDFH.changesFactory[AscDFH.historyitem_BarChart_SetShape]=window["AscDFH"].CChangesDrawingsLong;AscDFH.changesFactory[AscDFH.historyitem_BarChart_SetBarDir]=window["AscDFH"].CChangesDrawingsLong;AscDFH.changesFactory[AscDFH.historyitem_BarChart_SetGapWidth]=window["AscDFH"].CChangesDrawingsLong;AscDFH.changesFactory[AscDFH.historyitem_BarChart_SetGrouping]= window["AscDFH"].CChangesDrawingsLong;AscDFH.changesFactory[AscDFH.historyitem_BarChart_SetOverlap]=window["AscDFH"].CChangesDrawingsLong;AscDFH.changesFactory[AscDFH.historyitem_AreaChart_SetGrouping]=window["AscDFH"].CChangesDrawingsLong;AscDFH.changesFactory[AscDFH.historyitem_AreaSeries_SetIdx]=window["AscDFH"].CChangesDrawingsLong;AscDFH.changesFactory[AscDFH.historyitem_AreaSeries_SetOrder]=window["AscDFH"].CChangesDrawingsLong;AscDFH.changesFactory[AscDFH.historyitem_CatAxSetAxId]=window["AscDFH"].CChangesDrawingsLong; AscDFH.changesFactory[AscDFH.historyitem_CatAxSetAxPos]=window["AscDFH"].CChangesDrawingsLong;AscDFH.changesFactory[AscDFH.historyitem_CatAxSetCrosses]=window["AscDFH"].CChangesDrawingsLong;AscDFH.changesFactory[AscDFH.historyitem_CatAxSetLblAlgn]=window["AscDFH"].CChangesDrawingsLong;AscDFH.changesFactory[AscDFH.historyitem_CatAxSetLblOffset]=window["AscDFH"].CChangesDrawingsLong;AscDFH.changesFactory[AscDFH.historyitem_CatAxSetMajorTickMark]=window["AscDFH"].CChangesDrawingsLong;AscDFH.changesFactory[AscDFH.historyitem_CatAxSetMinorTickMark]= window["AscDFH"].CChangesDrawingsLong;AscDFH.changesFactory[AscDFH.historyitem_CatAxSetTickLblPos]=window["AscDFH"].CChangesDrawingsLong;AscDFH.changesFactory[AscDFH.historyitem_CatAxSetTickLblSkip]=window["AscDFH"].CChangesDrawingsLong;AscDFH.changesFactory[AscDFH.historyitem_CatAxSetTickMarkSkip]=window["AscDFH"].CChangesDrawingsLong;AscDFH.changesFactory[AscDFH.historyitem_DateAxAxPos]=window["AscDFH"].CChangesDrawingsLong;AscDFH.changesFactory[AscDFH.historyitem_DateAxCrosses]=window["AscDFH"].CChangesDrawingsLong; AscDFH.changesFactory[AscDFH.historyitem_DateAxLblOffset]=window["AscDFH"].CChangesDrawingsLong;AscDFH.changesFactory[AscDFH.historyitem_DateAxMajorTickMark]=window["AscDFH"].CChangesDrawingsLong;AscDFH.changesFactory[AscDFH.historyitem_DateAxMinorTickMark]=window["AscDFH"].CChangesDrawingsLong;AscDFH.changesFactory[AscDFH.historyitem_DateAxTickLblPos]=window["AscDFH"].CChangesDrawingsLong;AscDFH.changesFactory[AscDFH.historyitem_SerAxSetAxId]=window["AscDFH"].CChangesDrawingsLong;AscDFH.changesFactory[AscDFH.historyitem_SerAxSetAxPos]= window["AscDFH"].CChangesDrawingsLong;AscDFH.changesFactory[AscDFH.historyitem_SerAxSetMajorTickMark]=window["AscDFH"].CChangesDrawingsLong;AscDFH.changesFactory[AscDFH.historyitem_SerAxSetMinorTickMark]=window["AscDFH"].CChangesDrawingsLong;AscDFH.changesFactory[AscDFH.historyitem_SerAxSetTickLblPos]=window["AscDFH"].CChangesDrawingsLong;AscDFH.changesFactory[AscDFH.historyitem_SerAxSetTickLblSkip]=window["AscDFH"].CChangesDrawingsLong;AscDFH.changesFactory[AscDFH.historyitem_SerAxSetTickMarkSkip]= window["AscDFH"].CChangesDrawingsLong;AscDFH.changesFactory[AscDFH.historyitem_ValAxSetAxId]=window["AscDFH"].CChangesDrawingsLong;AscDFH.changesFactory[AscDFH.historyitem_ValAxSetAxPos]=window["AscDFH"].CChangesDrawingsLong;AscDFH.changesFactory[AscDFH.historyitem_ValAxSetCrossBetween]=window["AscDFH"].CChangesDrawingsLong;AscDFH.changesFactory[AscDFH.historyitem_ValAxSetMajorTickMark]=window["AscDFH"].CChangesDrawingsLong;AscDFH.changesFactory[AscDFH.historyitem_ValAxSetMinorTickMark]=window["AscDFH"].CChangesDrawingsLong; AscDFH.changesFactory[AscDFH.historyitem_ValAxSetTickLblPos]=window["AscDFH"].CChangesDrawingsLong;AscDFH.changesFactory[AscDFH.historyitem_BandFmt_SetIdx]=window["AscDFH"].CChangesDrawingsLong;AscDFH.changesFactory[AscDFH.historyitem_BarSeries_SetIdx]=window["AscDFH"].CChangesDrawingsLong;AscDFH.changesFactory[AscDFH.historyitem_BarSeries_SetOrder]=window["AscDFH"].CChangesDrawingsLong;AscDFH.changesFactory[AscDFH.historyitem_BubbleChart_SetBubbleScale]=window["AscDFH"].CChangesDrawingsLong;AscDFH.changesFactory[AscDFH.historyitem_BubbleChart_SetSizeRepresents]= window["AscDFH"].CChangesDrawingsLong;AscDFH.changesFactory[AscDFH.historyitem_BubbleSeries_SetIdx]=window["AscDFH"].CChangesDrawingsLong;AscDFH.changesFactory[AscDFH.historyitem_BubbleSeries_SetOrder]=window["AscDFH"].CChangesDrawingsLong;AscDFH.changesFactory[AscDFH.historyitem_DLbls_SetDLblPos]=window["AscDFH"].CChangesDrawingsLong;AscDFH.changesFactory[AscDFH.historyitem_DPt_SetExplosion]=window["AscDFH"].CChangesDrawingsLong;AscDFH.changesFactory[AscDFH.historyitem_DPt_SetIdx]=window["AscDFH"].CChangesDrawingsLong; AscDFH.changesFactory[AscDFH.historyitem_DispUnitsSetParent]=window["AscDFH"].CChangesDrawingsLong;AscDFH.changesFactory[AscDFH.historyitem_DoughnutChart_SetFirstSliceAng]=window["AscDFH"].CChangesDrawingsLong;AscDFH.changesFactory[AscDFH.historyitem_DoughnutChart_SetHoleSize]=window["AscDFH"].CChangesDrawingsLong;AscDFH.changesFactory[AscDFH.historyitem_ErrBars_SetErrBarType]=window["AscDFH"].CChangesDrawingsLong;AscDFH.changesFactory[AscDFH.historyitem_ErrBars_SetErrDir]=window["AscDFH"].CChangesDrawingsLong; AscDFH.changesFactory[AscDFH.historyitem_ErrBars_SetErrValType]=window["AscDFH"].CChangesDrawingsLong;AscDFH.changesFactory[AscDFH.historyitem_Layout_SetHMode]=window["AscDFH"].CChangesDrawingsLong;AscDFH.changesFactory[AscDFH.historyitem_Layout_SetLayoutTarget]=window["AscDFH"].CChangesDrawingsLong;AscDFH.changesFactory[AscDFH.historyitem_Layout_SetWMode]=window["AscDFH"].CChangesDrawingsLong;AscDFH.changesFactory[AscDFH.historyitem_Layout_SetXMode]=window["AscDFH"].CChangesDrawingsLong;AscDFH.changesFactory[AscDFH.historyitem_Layout_SetYMode]= window["AscDFH"].CChangesDrawingsLong;AscDFH.changesFactory[AscDFH.historyitem_Legend_SetLegendPos]=window["AscDFH"].CChangesDrawingsLong;AscDFH.changesFactory[AscDFH.historyitem_LegendEntry_SetIdx]=window["AscDFH"].CChangesDrawingsLong;AscDFH.changesFactory[AscDFH.historyitem_LineChart_SetGrouping]=window["AscDFH"].CChangesDrawingsLong;AscDFH.changesFactory[AscDFH.historyitem_LineSeries_SetIdx]=window["AscDFH"].CChangesDrawingsLong;AscDFH.changesFactory[AscDFH.historyitem_LineSeries_SetOrder]=window["AscDFH"].CChangesDrawingsLong; AscDFH.changesFactory[AscDFH.historyitem_Marker_SetSize]=window["AscDFH"].CChangesDrawingsLong;AscDFH.changesFactory[AscDFH.historyitem_Marker_SetSymbol]=window["AscDFH"].CChangesDrawingsLong;AscDFH.changesFactory[AscDFH.historyitem_MultiLvlStrCache_SetPtCount]=window["AscDFH"].CChangesDrawingsLong;AscDFH.changesFactory[AscDFH.historyitem_NumLit_SetPtCount]=window["AscDFH"].CChangesDrawingsLong;AscDFH.changesFactory[AscDFH.historyitem_OfPieChart_SetGapWidth]=window["AscDFH"].CChangesDrawingsLong; AscDFH.changesFactory[AscDFH.historyitem_OfPieChart_SetOfPieType]=window["AscDFH"].CChangesDrawingsLong;AscDFH.changesFactory[AscDFH.historyitem_OfPieChart_SetSecondPieSize]=window["AscDFH"].CChangesDrawingsLong;AscDFH.changesFactory[AscDFH.historyitem_OfPieChart_SetSplitType]=window["AscDFH"].CChangesDrawingsLong;AscDFH.changesFactory[AscDFH.historyitem_PictureOptions_SetPictureFormat]=window["AscDFH"].CChangesDrawingsLong;AscDFH.changesFactory[AscDFH.historyitem_PieChart_SetFirstSliceAng]=window["AscDFH"].CChangesDrawingsLong; AscDFH.changesFactory[AscDFH.historyitem_PieSeries_SetExplosion]=window["AscDFH"].CChangesDrawingsLong;AscDFH.changesFactory[AscDFH.historyitem_PieSeries_SetIdx]=window["AscDFH"].CChangesDrawingsLong;AscDFH.changesFactory[AscDFH.historyitem_PieSeries_SetOrder]=window["AscDFH"].CChangesDrawingsLong;AscDFH.changesFactory[AscDFH.historyitem_PivotFmt_SetIdx]=window["AscDFH"].CChangesDrawingsLong;AscDFH.changesFactory[AscDFH.historyitem_RadarSeries_SetIdx]=window["AscDFH"].CChangesDrawingsLong;AscDFH.changesFactory[AscDFH.historyitem_Scaling_SetOrientation]= window["AscDFH"].CChangesDrawingsLong;AscDFH.changesFactory[AscDFH.historyitem_ScatterChart_SetScatterStyle]=window["AscDFH"].CChangesDrawingsLong;AscDFH.changesFactory[AscDFH.historyitem_ScatterSer_SetIdx]=window["AscDFH"].CChangesDrawingsLong;AscDFH.changesFactory[AscDFH.historyitem_ScatterSer_SetOrder]=window["AscDFH"].CChangesDrawingsLong;AscDFH.changesFactory[AscDFH.historyitem_StrCache_SetPtCount]=window["AscDFH"].CChangesDrawingsLong;AscDFH.changesFactory[AscDFH.historyitem_StringLiteral_SetPtCount]= window["AscDFH"].CChangesDrawingsLong;AscDFH.changesFactory[AscDFH.historyitem_StrPoint_SetIdx]=window["AscDFH"].CChangesDrawingsLong;AscDFH.changesFactory[AscDFH.historyitem_SurfaceSeries_SetIdx]=window["AscDFH"].CChangesDrawingsLong;AscDFH.changesFactory[AscDFH.historyitem_SurfaceSeries_SetOrder]=window["AscDFH"].CChangesDrawingsLong;AscDFH.changesFactory[AscDFH.historyitem_Trendline_SetOrder]=window["AscDFH"].CChangesDrawingsLong;AscDFH.changesFactory[AscDFH.historyitem_Trendline_SetPeriod]=window["AscDFH"].CChangesDrawingsLong; AscDFH.changesFactory[AscDFH.historyitem_Trendline_SetTrendlineType]=window["AscDFH"].CChangesDrawingsLong;AscDFH.changesFactory[AscDFH.historyitem_UpDownBars_SetGapWidth]=window["AscDFH"].CChangesDrawingsLong;AscDFH.changesFactory[AscDFH.historyitem_Chart_SetDispBlanksAs]=window["AscDFH"].CChangesDrawingsLong;AscDFH.changesFactory[AscDFH.historyitem_ChartWall_SetThickness]=window["AscDFH"].CChangesDrawingsLong;AscDFH.changesFactory[AscDFH.historyitem_View3d_SetDepthPercent]=window["AscDFH"].CChangesDrawingsLong; AscDFH.changesFactory[AscDFH.historyitem_View3d_SetHPercent]=window["AscDFH"].CChangesDrawingsLong;AscDFH.changesFactory[AscDFH.historyitem_View3d_SetPerspective]=window["AscDFH"].CChangesDrawingsLong;AscDFH.changesFactory[AscDFH.historyitem_View3d_SetRotX]=window["AscDFH"].CChangesDrawingsLong;AscDFH.changesFactory[AscDFH.historyitem_View3d_SetRotY]=window["AscDFH"].CChangesDrawingsLong;AscDFH.changesFactory[AscDFH.historyitem_NumericPoint_SetIdx]=window["AscDFH"].CChangesDrawingsLong;AscDFH.changesFactory[AscDFH.historyitem_CatAxSetCrossesAt]= window["AscDFH"].CChangesDrawingsDouble;AscDFH.changesFactory[AscDFH.historyitem_DateAxBaseTimeUnit]=window["AscDFH"].CChangesDrawingsDouble;AscDFH.changesFactory[AscDFH.historyitem_DateAxCrossesAt]=window["AscDFH"].CChangesDrawingsDouble;AscDFH.changesFactory[AscDFH.historyitem_DateAxMajorTimeUnit]=window["AscDFH"].CChangesDrawingsDouble;AscDFH.changesFactory[AscDFH.historyitem_DateAxMajorUnit]=window["AscDFH"].CChangesDrawingsDouble;AscDFH.changesFactory[AscDFH.historyitem_DateAxMinorTimeUnit]= window["AscDFH"].CChangesDrawingsDouble;AscDFH.changesFactory[AscDFH.historyitem_DateAxMinorUnit]=window["AscDFH"].CChangesDrawingsDouble;AscDFH.changesFactory[AscDFH.historyitem_SerAxSetCrosses]=window["AscDFH"].CChangesDrawingsDouble;AscDFH.changesFactory[AscDFH.historyitem_SerAxSetCrossesAt]=window["AscDFH"].CChangesDrawingsDouble;AscDFH.changesFactory[AscDFH.historyitem_ValAxSetCrosses]=window["AscDFH"].CChangesDrawingsDouble;AscDFH.changesFactory[AscDFH.historyitem_ValAxSetCrossesAt]=window["AscDFH"].CChangesDrawingsDouble; AscDFH.changesFactory[AscDFH.historyitem_ValAxSetMajorUnit]=window["AscDFH"].CChangesDrawingsDouble;AscDFH.changesFactory[AscDFH.historyitem_ValAxSetMinorUnit]=window["AscDFH"].CChangesDrawingsDouble;AscDFH.changesFactory[AscDFH.historyitem_DispUnitsSetBuiltInUnit]=window["AscDFH"].CChangesDrawingsDouble;AscDFH.changesFactory[AscDFH.historyitem_ErrBars_SetVal]=window["AscDFH"].CChangesDrawingsDouble;AscDFH.changesFactory[AscDFH.historyitem_Layout_SetH]=window["AscDFH"].CChangesDrawingsDouble;AscDFH.changesFactory[AscDFH.historyitem_Layout_SetW]= window["AscDFH"].CChangesDrawingsDouble;AscDFH.changesFactory[AscDFH.historyitem_Layout_SetX]=window["AscDFH"].CChangesDrawingsDouble;AscDFH.changesFactory[AscDFH.historyitem_Layout_SetY]=window["AscDFH"].CChangesDrawingsDouble;AscDFH.changesFactory[AscDFH.historyitem_Layout_SetParent]=window["AscDFH"].CChangesDrawingsObject;AscDFH.changesFactory[AscDFH.historyitem_OfPieChart_SetSplitPos]=window["AscDFH"].CChangesDrawingsDouble;AscDFH.changesFactory[AscDFH.historyitem_PictureOptions_SetPictureStackUnit]= window["AscDFH"].CChangesDrawingsDouble;AscDFH.changesFactory[AscDFH.historyitem_Scaling_SetLogBase]=window["AscDFH"].CChangesDrawingsDouble2;AscDFH.changesFactory[AscDFH.historyitem_Scaling_SetMax]=window["AscDFH"].CChangesDrawingsDouble2;AscDFH.changesFactory[AscDFH.historyitem_Scaling_SetMin]=window["AscDFH"].CChangesDrawingsDouble2;AscDFH.changesFactory[AscDFH.historyitem_Trendline_SetBackward]=window["AscDFH"].CChangesDrawingsDouble;AscDFH.changesFactory[AscDFH.historyitem_Trendline_SetForward]= window["AscDFH"].CChangesDrawingsDouble;AscDFH.changesFactory[AscDFH.historyitem_Trendline_SetIntercept]=window["AscDFH"].CChangesDrawingsDouble;AscDFH.changesFactory[AscDFH.historyitem_NumericPoint_SetVal]=window["AscDFH"].CChangesDrawingsDouble2;AscDFH.changesFactory[AscDFH.historyitem_DLbl_SetSeparator]=window["AscDFH"].CChangesDrawingsString;AscDFH.changesFactory[AscDFH.historyitem_DateAxAxId]=window["AscDFH"].CChangesDrawingsString;AscDFH.changesFactory[AscDFH.historyitem_DLbls_SetSeparator]= window["AscDFH"].CChangesDrawingsString;AscDFH.changesFactory[AscDFH.historyitem_MultiLvlStrRef_SetF]=window["AscDFH"].CChangesDrawingsString;AscDFH.changesFactory[AscDFH.historyitem_NumRef_SetF]=window["AscDFH"].CChangesDrawingsString;AscDFH.changesFactory[AscDFH.historyitem_NumericPoint_SetFormatCode]=window["AscDFH"].CChangesDrawingsString;AscDFH.changesFactory[AscDFH.historyitem_NumFmt_SetFormatCode]=window["AscDFH"].CChangesDrawingsString;AscDFH.changesFactory[AscDFH.historyitem_NumLit_SetFormatCode]= window["AscDFH"].CChangesDrawingsString;AscDFH.changesFactory[AscDFH.historyitem_Tx_SetVal]=window["AscDFH"].CChangesDrawingsString;AscDFH.changesFactory[AscDFH.historyitem_StrPoint_SetVal]=window["AscDFH"].CChangesDrawingsString;AscDFH.changesFactory[AscDFH.historyitem_StrRef_SetF]=window["AscDFH"].CChangesDrawingsString;AscDFH.changesFactory[AscDFH.historyitem_Trendline_SetName]=window["AscDFH"].CChangesDrawingsString;AscDFH.changesFactory[AscDFH.historyitem_ExternalData_SetId]=window["AscDFH"].CChangesDrawingsString; AscDFH.changesFactory[AscDFH.historyitem_DLbl_SetLayout]=window["AscDFH"].CChangesDrawingsObject;AscDFH.changesFactory[AscDFH.historyitem_DLbl_SetNumFmt]=window["AscDFH"].CChangesDrawingsObject;AscDFH.changesFactory[AscDFH.historyitem_DLbl_SetSpPr]=window["AscDFH"].CChangesDrawingsObject;AscDFH.changesFactory[AscDFH.historyitem_DLbl_SetTx]=window["AscDFH"].CChangesDrawingsObject;AscDFH.changesFactory[AscDFH.historyitem_DLbl_SetTxPr]=window["AscDFH"].CChangesDrawingsObject;AscDFH.changesFactory[AscDFH.historyitem_DLbl_SetParent]= window["AscDFH"].CChangesDrawingsObject;AscDFH.changesFactory[AscDFH.historyitem_PlotArea_SetDTable]=window["AscDFH"].CChangesDrawingsObject;AscDFH.changesFactory[AscDFH.historyitem_PlotArea_SetLayout]=window["AscDFH"].CChangesDrawingsObject;AscDFH.changesFactory[AscDFH.historyitem_PlotArea_SetSpPr]=window["AscDFH"].CChangesDrawingsObject;AscDFH.changesFactory[AscDFH.historyitem_CommonChartFormat_SetParent]=window["AscDFH"].CChangesDrawingsObject;AscDFH.changesFactory[AscDFH.historyitem_CommonChart_SetDlbls]= window["AscDFH"].CChangesDrawingsObject;AscDFH.changesFactory[AscDFH.historyitem_BarChart_SetDLbls]=window["AscDFH"].CChangesDrawingsObject;AscDFH.changesFactory[AscDFH.historyitem_BarChart_SetSerLines]=window["AscDFH"].CChangesDrawingsObject;AscDFH.changesFactory[AscDFH.historyitem_AreaChart_SetDLbls]=window["AscDFH"].CChangesDrawingsObject;AscDFH.changesFactory[AscDFH.historyitem_AreaChart_SetDropLines]=window["AscDFH"].CChangesDrawingsObject;AscDFH.changesFactory[AscDFH.historyitem_AreaSeries_SetCat]= window["AscDFH"].CChangesDrawingsObject;AscDFH.changesFactory[AscDFH.historyitem_AreaSeries_SetDLbls]=window["AscDFH"].CChangesDrawingsObject;AscDFH.changesFactory[AscDFH.historyitem_AreaSeries_SetErrBars]=window["AscDFH"].CChangesDrawingsObject;AscDFH.changesFactory[AscDFH.historyitem_AreaSeries_SetPictureOptions]=window["AscDFH"].CChangesDrawingsObject;AscDFH.changesFactory[AscDFH.historyitem_AreaSeries_SetSpPr]=window["AscDFH"].CChangesDrawingsObject;AscDFH.changesFactory[AscDFH.historyitem_AreaSeries_SetTrendline]= window["AscDFH"].CChangesDrawingsObject;AscDFH.changesFactory[AscDFH.historyitem_AreaSeries_SetVal]=window["AscDFH"].CChangesDrawingsObject;AscDFH.changesFactory[AscDFH.historyitem_CatAxSetCrossAx]=window["AscDFH"].CChangesDrawingsObject;AscDFH.changesFactory[AscDFH.historyitem_CatAxSetMajorGridlines]=window["AscDFH"].CChangesDrawingsObject;AscDFH.changesFactory[AscDFH.historyitem_CatAxSetMinorGridlines]=window["AscDFH"].CChangesDrawingsObject;AscDFH.changesFactory[AscDFH.historyitem_CatAxSetNumFmt]= window["AscDFH"].CChangesDrawingsObject;AscDFH.changesFactory[AscDFH.historyitem_CatAxSetScaling]=window["AscDFH"].CChangesDrawingsObject;AscDFH.changesFactory[AscDFH.historyitem_CatAxSetSpPr]=window["AscDFH"].CChangesDrawingsObject;AscDFH.changesFactory[AscDFH.historyitem_CatAxSetTitle]=window["AscDFH"].CChangesDrawingsObject;AscDFH.changesFactory[AscDFH.historyitem_CatAxSetTxPr]=window["AscDFH"].CChangesDrawingsObject;AscDFH.changesFactory[AscDFH.historyitem_DateAxCrossAx]=window["AscDFH"].CChangesDrawingsObject; AscDFH.changesFactory[AscDFH.historyitem_DateAxMajorGridlines]=window["AscDFH"].CChangesDrawingsObject;AscDFH.changesFactory[AscDFH.historyitem_DateAxMajorGridlines]=window["AscDFH"].CChangesDrawingsObject;AscDFH.changesFactory[AscDFH.historyitem_DateAxNumFmt]=window["AscDFH"].CChangesDrawingsObject;AscDFH.changesFactory[AscDFH.historyitem_DateAxScaling]=window["AscDFH"].CChangesDrawingsObject;AscDFH.changesFactory[AscDFH.historyitem_DateAxSpPr]=window["AscDFH"].CChangesDrawingsObject;AscDFH.changesFactory[AscDFH.historyitem_DateAxTitle]= window["AscDFH"].CChangesDrawingsObject;AscDFH.changesFactory[AscDFH.historyitem_DateAxTxPr]=window["AscDFH"].CChangesDrawingsObject;AscDFH.changesFactory[AscDFH.historyitem_SerAxSetCrossAx]=window["AscDFH"].CChangesDrawingsObject;AscDFH.changesFactory[AscDFH.historyitem_SerAxSetMajorGridlines]=window["AscDFH"].CChangesDrawingsObject;AscDFH.changesFactory[AscDFH.historyitem_SerAxSetMinorGridlines]=window["AscDFH"].CChangesDrawingsObject;AscDFH.changesFactory[AscDFH.historyitem_SerAxSetNumFmt]=window["AscDFH"].CChangesDrawingsObject; AscDFH.changesFactory[AscDFH.historyitem_SerAxSetScaling]=window["AscDFH"].CChangesDrawingsObject;AscDFH.changesFactory[AscDFH.historyitem_SerAxSetSpPr]=window["AscDFH"].CChangesDrawingsObject;AscDFH.changesFactory[AscDFH.historyitem_SerAxSetTitle]=window["AscDFH"].CChangesDrawingsObject;AscDFH.changesFactory[AscDFH.historyitem_SerAxSetTxPr]=window["AscDFH"].CChangesDrawingsObject;AscDFH.changesFactory[AscDFH.historyitem_ValAxSetCrossAx]=window["AscDFH"].CChangesDrawingsObject;AscDFH.changesFactory[AscDFH.historyitem_ValAxSetDispUnits]= window["AscDFH"].CChangesDrawingsObject;AscDFH.changesFactory[AscDFH.historyitem_ValAxSetMajorGridlines]=window["AscDFH"].CChangesDrawingsObject;AscDFH.changesFactory[AscDFH.historyitem_ValAxSetMinorGridlines]=window["AscDFH"].CChangesDrawingsObject;AscDFH.changesFactory[AscDFH.historyitem_ValAxSetNumFmt]=window["AscDFH"].CChangesDrawingsObject;AscDFH.changesFactory[AscDFH.historyitem_ValAxSetScaling]=window["AscDFH"].CChangesDrawingsObject;AscDFH.changesFactory[AscDFH.historyitem_ValAxSetSpPr]=window["AscDFH"].CChangesDrawingsObject; AscDFH.changesFactory[AscDFH.historyitem_ValAxSetTitle]=window["AscDFH"].CChangesDrawingsObject;AscDFH.changesFactory[AscDFH.historyitem_ValAxSetTxPr]=window["AscDFH"].CChangesDrawingsObject;AscDFH.changesFactory[AscDFH.historyitem_BandFmt_SetSpPr]=window["AscDFH"].CChangesDrawingsObject;AscDFH.changesFactory[AscDFH.historyitem_BarSeries_SetCat]=window["AscDFH"].CChangesDrawingsObject;AscDFH.changesFactory[AscDFH.historyitem_BarSeries_SetDLbls]=window["AscDFH"].CChangesDrawingsObject;AscDFH.changesFactory[AscDFH.historyitem_BarSeries_SetErrBars]= window["AscDFH"].CChangesDrawingsObject;AscDFH.changesFactory[AscDFH.historyitem_BarSeries_SetPictureOptions]=window["AscDFH"].CChangesDrawingsObject;AscDFH.changesFactory[AscDFH.historyitem_BarSeries_SetShape]=window["AscDFH"].CChangesDrawingsLong;AscDFH.changesFactory[AscDFH.historyitem_BarSeries_SetSpPr]=window["AscDFH"].CChangesDrawingsObject;AscDFH.changesFactory[AscDFH.historyitem_BarSeries_SetTrendline]=window["AscDFH"].CChangesDrawingsObject;AscDFH.changesFactory[AscDFH.historyitem_BarSeries_SetVal]= window["AscDFH"].CChangesDrawingsObject;AscDFH.changesFactory[AscDFH.historyitem_BubbleChart_SetDLbls]=window["AscDFH"].CChangesDrawingsObject;AscDFH.changesFactory[AscDFH.historyitem_BubbleSeries_SetBubbleSize]=window["AscDFH"].CChangesDrawingsObject;AscDFH.changesFactory[AscDFH.historyitem_BubbleSeries_SetDLbls]=window["AscDFH"].CChangesDrawingsObject;AscDFH.changesFactory[AscDFH.historyitem_BubbleSeries_SetDPt]=window["AscDFH"].CChangesDrawingsContent;AscDFH.changesFactory[AscDFH.historyitem_BubbleSeries_SetErrBars]= window["AscDFH"].CChangesDrawingsObject;AscDFH.changesFactory[AscDFH.historyitem_BubbleSeries_SetSpPr]=window["AscDFH"].CChangesDrawingsObject;AscDFH.changesFactory[AscDFH.historyitem_BubbleSeries_SetTrendline]=window["AscDFH"].CChangesDrawingsObject;AscDFH.changesFactory[AscDFH.historyitem_BubbleSeries_SetXVal]=window["AscDFH"].CChangesDrawingsObject;AscDFH.changesFactory[AscDFH.historyitem_BubbleSeries_SetYVal]=window["AscDFH"].CChangesDrawingsObject;AscDFH.changesFactory[AscDFH.historyitem_Cat_SetMultiLvlStrRef]= window["AscDFH"].CChangesDrawingsObject;AscDFH.changesFactory[AscDFH.historyitem_Cat_SetNumLit]=window["AscDFH"].CChangesDrawingsObject;AscDFH.changesFactory[AscDFH.historyitem_Cat_SetNumRef]=window["AscDFH"].CChangesDrawingsObject;AscDFH.changesFactory[AscDFH.historyitem_Cat_SetStrLit]=window["AscDFH"].CChangesDrawingsObject;AscDFH.changesFactory[AscDFH.historyitem_Cat_SetStrRef]=window["AscDFH"].CChangesDrawingsObject;AscDFH.changesFactory[AscDFH.historyitem_ChartFormatSetChart]=window["AscDFH"].CChangesDrawingsObject; AscDFH.changesFactory[AscDFH.historyitem_ChartText_SetRich]=window["AscDFH"].CChangesDrawingsObject;AscDFH.changesFactory[AscDFH.historyitem_ChartText_SetStrRef]=window["AscDFH"].CChangesDrawingsObject;AscDFH.changesFactory[AscDFH.historyitem_DLbls_SetLeaderLines]=window["AscDFH"].CChangesDrawingsObject;AscDFH.changesFactory[AscDFH.historyitem_DLbls_SetNumFmt]=window["AscDFH"].CChangesDrawingsObject;AscDFH.changesFactory[AscDFH.historyitem_DLbls_SetSpPr]=window["AscDFH"].CChangesDrawingsObject;AscDFH.changesFactory[AscDFH.historyitem_DLbls_SetTxPr]= window["AscDFH"].CChangesDrawingsObject;AscDFH.changesFactory[AscDFH.historyitem_DPt_SetMarker]=window["AscDFH"].CChangesDrawingsObject;AscDFH.changesFactory[AscDFH.historyitem_DPt_SetPictureOptions]=window["AscDFH"].CChangesDrawingsObject;AscDFH.changesFactory[AscDFH.historyitem_DPt_SetSpPr]=window["AscDFH"].CChangesDrawingsObject;AscDFH.changesFactory[AscDFH.historyitem_DTable_SetSpPr]=window["AscDFH"].CChangesDrawingsObject;AscDFH.changesFactory[AscDFH.historyitem_DTable_SetTxPr]=window["AscDFH"].CChangesDrawingsObject; AscDFH.changesFactory[AscDFH.historyitem_DispUnitsSetCustUnit]=window["AscDFH"].CChangesDrawingsObject;AscDFH.changesFactory[AscDFH.historyitem_DispUnitsSetDispUnitsLbl]=window["AscDFH"].CChangesDrawingsObject;AscDFH.changesFactory[AscDFH.historyitem_DoughnutChart_SetDLbls]=window["AscDFH"].CChangesDrawingsObject;AscDFH.changesFactory[AscDFH.historyitem_ErrBars_SetMinus]=window["AscDFH"].CChangesDrawingsObject;AscDFH.changesFactory[AscDFH.historyitem_ErrBars_SetPlus]=window["AscDFH"].CChangesDrawingsObject; AscDFH.changesFactory[AscDFH.historyitem_ErrBars_SetSpPr]=window["AscDFH"].CChangesDrawingsObject;AscDFH.changesFactory[AscDFH.historyitem_Legend_SetLayout]=window["AscDFH"].CChangesDrawingsObject;AscDFH.changesFactory[AscDFH.historyitem_Legend_SetSpPr]=window["AscDFH"].CChangesDrawingsObject;AscDFH.changesFactory[AscDFH.historyitem_Legend_SetTxPr]=window["AscDFH"].CChangesDrawingsObject;AscDFH.changesFactory[AscDFH.historyitem_LegendEntry_SetTxPr]=window["AscDFH"].CChangesDrawingsObject;AscDFH.changesFactory[AscDFH.historyitem_LineChart_SetDLbls]= window["AscDFH"].CChangesDrawingsObject;AscDFH.changesFactory[AscDFH.historyitem_LineChart_SetDropLines]=window["AscDFH"].CChangesDrawingsObject;AscDFH.changesFactory[AscDFH.historyitem_LineChart_SetHiLowLines]=window["AscDFH"].CChangesDrawingsObject;AscDFH.changesFactory[AscDFH.historyitem_LineChart_SetUpDownBars]=window["AscDFH"].CChangesDrawingsObject;AscDFH.changesFactory[AscDFH.historyitem_LineSeries_SetCat]=window["AscDFH"].CChangesDrawingsObject;AscDFH.changesFactory[AscDFH.historyitem_LineSeries_SetDLbls]= window["AscDFH"].CChangesDrawingsObject;AscDFH.changesFactory[AscDFH.historyitem_LineSeries_SetErrBars]=window["AscDFH"].CChangesDrawingsObject;AscDFH.changesFactory[AscDFH.historyitem_LineSeries_SetMarker]=window["AscDFH"].CChangesDrawingsObject;AscDFH.changesFactory[AscDFH.historyitem_LineSeries_SetSpPr]=window["AscDFH"].CChangesDrawingsObject;AscDFH.changesFactory[AscDFH.historyitem_LineSeries_SetTrendline]=window["AscDFH"].CChangesDrawingsObject;AscDFH.changesFactory[AscDFH.historyitem_LineSeries_SetVal]= window["AscDFH"].CChangesDrawingsObject;AscDFH.changesFactory[AscDFH.historyitem_Marker_SetSpPr]=window["AscDFH"].CChangesDrawingsObject;AscDFH.changesFactory[AscDFH.historyitem_MinusPlus_SetNumLit]=window["AscDFH"].CChangesDrawingsObject;AscDFH.changesFactory[AscDFH.historyitem_MinusPlus_SetNumRef]=window["AscDFH"].CChangesDrawingsObject;AscDFH.changesFactory[AscDFH.historyitem_MultiLvlStrRef_SetMultiLvlStrCache]=window["AscDFH"].CChangesDrawingsObject;AscDFH.changesFactory[AscDFH.historyitem_NumRef_SetNumCache]= window["AscDFH"].CChangesDrawingsObject;AscDFH.changesFactory[AscDFH.historyitem_OfPieChart_SetDLbls]=window["AscDFH"].CChangesDrawingsObject;AscDFH.changesFactory[AscDFH.historyitem_OfPieChart_SetSerLines]=window["AscDFH"].CChangesDrawingsObject;AscDFH.changesFactory[AscDFH.historyitem_PictureOptions_SetApplyToEnd]=window["AscDFH"].CChangesDrawingsObject;AscDFH.changesFactory[AscDFH.historyitem_PictureOptions_SetApplyToFront]=window["AscDFH"].CChangesDrawingsObject;AscDFH.changesFactory[AscDFH.historyitem_PictureOptions_SetApplyToSides]= window["AscDFH"].CChangesDrawingsObject;AscDFH.changesFactory[AscDFH.historyitem_PieChart_SetDLbls]=window["AscDFH"].CChangesDrawingsObject;AscDFH.changesFactory[AscDFH.historyitem_PieSeries_SetCat]=window["AscDFH"].CChangesDrawingsObject;AscDFH.changesFactory[AscDFH.historyitem_PieSeries_SetDLbls]=window["AscDFH"].CChangesDrawingsObject;AscDFH.changesFactory[AscDFH.historyitem_PieSeries_SetSpPr]=window["AscDFH"].CChangesDrawingsObject;AscDFH.changesFactory[AscDFH.historyitem_PieSeries_SetVal]=window["AscDFH"].CChangesDrawingsObject; AscDFH.changesFactory[AscDFH.historyitem_PivotFmt_SetDLbl]=window["AscDFH"].CChangesDrawingsObject;AscDFH.changesFactory[AscDFH.historyitem_PivotFmt_SetMarker]=window["AscDFH"].CChangesDrawingsObject;AscDFH.changesFactory[AscDFH.historyitem_PivotFmt_SetSpPr]=window["AscDFH"].CChangesDrawingsObject;AscDFH.changesFactory[AscDFH.historyitem_PivotFmt_SetTxPr]=window["AscDFH"].CChangesDrawingsObject;AscDFH.changesFactory[AscDFH.historyitem_RadarChart_SetDLbls]=window["AscDFH"].CChangesDrawingsObject;AscDFH.changesFactory[AscDFH.historyitem_RadarChart_SetRadarStyle]= window["AscDFH"].CChangesDrawingsLong;AscDFH.changesFactory[AscDFH.historyitem_RadarSeries_SetCat]=window["AscDFH"].CChangesDrawingsObject;AscDFH.changesFactory[AscDFH.historyitem_RadarSeries_SetDLbls]=window["AscDFH"].CChangesDrawingsObject;AscDFH.changesFactory[AscDFH.historyitem_RadarSeries_SetCat]=window["AscDFH"].CChangesDrawingsObject;AscDFH.changesFactory[AscDFH.historyitem_RadarSeries_SetCat]=window["AscDFH"].CChangesDrawingsObject;AscDFH.changesFactory[AscDFH.historyitem_RadarSeries_SetCat]= window["AscDFH"].CChangesDrawingsObject;AscDFH.changesFactory[AscDFH.historyitem_RadarSeries_SetCat]=window["AscDFH"].CChangesDrawingsObject;AscDFH.changesFactory[AscDFH.historyitem_RadarSeries_SetCat]=window["AscDFH"].CChangesDrawingsObject;AscDFH.changesFactory[AscDFH.historyitem_Scaling_SetParent]=window["AscDFH"].CChangesDrawingsObject;AscDFH.changesFactory[AscDFH.historyitem_ScatterChart_SetDLbls]=window["AscDFH"].CChangesDrawingsObject;AscDFH.changesFactory[AscDFH.historyitem_ScatterSer_SetDLbls]= window["AscDFH"].CChangesDrawingsObject;AscDFH.changesFactory[AscDFH.historyitem_ScatterSer_SetDPt]=window["AscDFH"].CChangesDrawingsContent;AscDFH.changesFactory[AscDFH.historyitem_ScatterSer_SetErrBars]=window["AscDFH"].CChangesDrawingsObject;AscDFH.changesFactory[AscDFH.historyitem_ScatterSer_SetMarker]=window["AscDFH"].CChangesDrawingsObject;AscDFH.changesFactory[AscDFH.historyitem_ScatterSer_SetSpPr]=window["AscDFH"].CChangesDrawingsObject;AscDFH.changesFactory[AscDFH.historyitem_ScatterSer_SetTrendline]= window["AscDFH"].CChangesDrawingsObject;AscDFH.changesFactory[AscDFH.historyitem_ScatterSer_SetXVal]=window["AscDFH"].CChangesDrawingsObject;AscDFH.changesFactory[AscDFH.historyitem_ScatterSer_SetYVal]=window["AscDFH"].CChangesDrawingsObject;AscDFH.changesFactory[AscDFH.historyitem_Tx_SetStrRef]=window["AscDFH"].CChangesDrawingsObject;AscDFH.changesFactory[AscDFH.historyitem_StockChart_SetDLbls]=window["AscDFH"].CChangesDrawingsObject;AscDFH.changesFactory[AscDFH.historyitem_StockChart_SetDropLines]= window["AscDFH"].CChangesDrawingsObject;AscDFH.changesFactory[AscDFH.historyitem_StockChart_SetHiLowLines]=window["AscDFH"].CChangesDrawingsObject;AscDFH.changesFactory[AscDFH.historyitem_StockChart_SetUpDownBars]=window["AscDFH"].CChangesDrawingsObject;AscDFH.changesFactory[AscDFH.historyitem_StrRef_SetStrCache]=window["AscDFH"].CChangesDrawingsObject;AscDFH.changesFactory[AscDFH.historyitem_SurfaceSeries_SetCat]=window["AscDFH"].CChangesDrawingsObject;AscDFH.changesFactory[AscDFH.historyitem_SurfaceSeries_SetSpPr]= window["AscDFH"].CChangesDrawingsObject;AscDFH.changesFactory[AscDFH.historyitem_SurfaceSeries_SetVal]=window["AscDFH"].CChangesDrawingsObject;AscDFH.changesFactory[AscDFH.historyitem_Title_SetLayout]=window["AscDFH"].CChangesDrawingsObject;AscDFH.changesFactory[AscDFH.historyitem_Title_SetSpPr]=window["AscDFH"].CChangesDrawingsObject;AscDFH.changesFactory[AscDFH.historyitem_Title_SetTx]=window["AscDFH"].CChangesDrawingsObject;AscDFH.changesFactory[AscDFH.historyitem_Title_SetTxPr]=window["AscDFH"].CChangesDrawingsObject; AscDFH.changesFactory[AscDFH.historyitem_Trendline_SetSpPr]=window["AscDFH"].CChangesDrawingsObject;AscDFH.changesFactory[AscDFH.historyitem_Trendline_SetTrendlineLbl]=window["AscDFH"].CChangesDrawingsObject;AscDFH.changesFactory[AscDFH.historyitem_UpDownBars_SetDownBars]=window["AscDFH"].CChangesDrawingsObject;AscDFH.changesFactory[AscDFH.historyitem_UpDownBars_SetUpBars]=window["AscDFH"].CChangesDrawingsObject;AscDFH.changesFactory[AscDFH.historyitem_YVal_SetNumLit]=window["AscDFH"].CChangesDrawingsObject; AscDFH.changesFactory[AscDFH.historyitem_YVal_SetNumRef]=window["AscDFH"].CChangesDrawingsObject;AscDFH.changesFactory[AscDFH.historyitem_Chart_SetBackWall]=window["AscDFH"].CChangesDrawingsObject;AscDFH.changesFactory[AscDFH.historyitem_Chart_SetFloor]=window["AscDFH"].CChangesDrawingsObject;AscDFH.changesFactory[AscDFH.historyitem_Chart_SetLegend]=window["AscDFH"].CChangesDrawingsObject;AscDFH.changesFactory[AscDFH.historyitem_Chart_SetPlotArea]=window["AscDFH"].CChangesDrawingsObject;AscDFH.changesFactory[AscDFH.historyitem_Chart_SetSideWall]= window["AscDFH"].CChangesDrawingsObject;AscDFH.changesFactory[AscDFH.historyitem_Chart_SetTitle]=window["AscDFH"].CChangesDrawingsObject;AscDFH.changesFactory[AscDFH.historyitem_Chart_SetView3D]=window["AscDFH"].CChangesDrawingsObject;AscDFH.changesFactory[AscDFH.historyitem_ChartWall_SetPictureOptions]=window["AscDFH"].CChangesDrawingsObject;AscDFH.changesFactory[AscDFH.historyitem_ChartWall_SetSpPr]=window["AscDFH"].CChangesDrawingsObject;AscDFH.changesFactory[AscDFH.historyitem_PlotArea_AddAxis]= window["AscDFH"].CChangesDrawingsContent;AscDFH.changesFactory[AscDFH.historyitem_PlotArea_AddChart]=window["AscDFH"].CChangesDrawingsContent;AscDFH.changesFactory[AscDFH.historyitem_PlotArea_RemoveChart]=window["AscDFH"].CChangesDrawingsContent;AscDFH.changesFactory[AscDFH.historyitem_PlotArea_RemoveAxis]=window["AscDFH"].CChangesDrawingsContent;AscDFH.changesFactory[AscDFH.historyitem_CommonChart_RemoveSeries]=window["AscDFH"].CChangesDrawingsContent;AscDFH.changesFactory[AscDFH.historyitem_CommonChart_AddSeries]= window["AscDFH"].CChangesDrawingsContent;AscDFH.changesFactory[AscDFH.historyitem_CommonChart_AddFilteredSeries]=window["AscDFH"].CChangesDrawingsContent;AscDFH.changesFactory[AscDFH.historyitem_CommonChart_RemoveFilteredSeries]=window["AscDFH"].CChangesDrawingsContent;AscDFH.changesFactory[AscDFH.historyitem_BarChart_AddAxId]=window["AscDFH"].CChangesDrawingsContent;AscDFH.changesFactory[AscDFH.historyitem_CommonChart_AddAxId]=window["AscDFH"].CChangesDrawingsContent;AscDFH.changesFactory[AscDFH.historyitem_AreaChart_AddAxId]= window["AscDFH"].CChangesDrawingsContent;AscDFH.changesFactory[AscDFH.historyitem_AreaSeries_SetDPt]=window["AscDFH"].CChangesDrawingsContent;AscDFH.changesFactory[AscDFH.historyitem_CommonSeries_RemoveDPt]=window["AscDFH"].CChangesDrawingsContent;AscDFH.changesFactory[AscDFH.historyitem_BarSeries_SetDPt]=window["AscDFH"].CChangesDrawingsContent;AscDFH.changesFactory[AscDFH.historyitem_BubbleChart_AddAxId]=window["AscDFH"].CChangesDrawingsContent;AscDFH.changesFactory[AscDFH.historyitem_DLbls_SetDLbl]= window["AscDFH"].CChangesDrawingsContent;AscDFH.changesFactory[AscDFH.historyitem_Legend_AddLegendEntry]=window["AscDFH"].CChangesDrawingsContent;AscDFH.changesFactory[AscDFH.historyitem_LineChart_AddAxId]=window["AscDFH"].CChangesDrawingsContent;AscDFH.changesFactory[AscDFH.historyitem_LineSeries_SetDPt]=window["AscDFH"].CChangesDrawingsContent;AscDFH.changesFactory[AscDFH.historyitem_MultiLvlStrCache_SetLvl]=window["AscDFH"].CChangesDrawingsContent;AscDFH.changesFactory[AscDFH.historyitem_CommonLit_RemoveDPt]= window["AscDFH"].CChangesDrawingsContent;AscDFH.changesFactory[AscDFH.historyitem_NumLit_AddPt]=window["AscDFH"].CChangesDrawingsContent;AscDFH.changesFactory[AscDFH.historyitem_OfPieChart_AddCustSplit]=window["AscDFH"].CChangesDrawingsContent;AscDFH.changesFactory[AscDFH.historyitem_PieSeries_SetDPt]=window["AscDFH"].CChangesDrawingsContent;AscDFH.changesFactory[AscDFH.historyitem_RadarChart_AddAxId]=window["AscDFH"].CChangesDrawingsContent;AscDFH.changesFactory[AscDFH.historyitem_RadarSeries_SetDPt]= window["AscDFH"].CChangesDrawingsContent;AscDFH.changesFactory[AscDFH.historyitem_ScatterChart_AddAxId]=window["AscDFH"].CChangesDrawingsContent;AscDFH.changesFactory[AscDFH.historyitem_StockChart_AddAxId]=window["AscDFH"].CChangesDrawingsContent;AscDFH.changesFactory[AscDFH.historyitem_CommonLit_RemoveDPt]=window["AscDFH"].CChangesDrawingsContent;AscDFH.changesFactory[AscDFH.historyitem_StrCache_AddPt]=window["AscDFH"].CChangesDrawingsContent;AscDFH.changesFactory[AscDFH.historyitem_StringLiteral_SetPt]= window["AscDFH"].CChangesDrawingsContent;AscDFH.changesFactory[AscDFH.historyitem_SurfaceChart_AddAxId]=window["AscDFH"].CChangesDrawingsContent;AscDFH.changesFactory[AscDFH.historyitem_SurfaceChart_AddBandFmt]=window["AscDFH"].CChangesDrawingsContent;AscDFH.changesFactory[AscDFH.historyitem_Chart_AddPivotFmt]=window["AscDFH"].CChangesDrawingsContent;AscDFH.changesFactory[AscDFH.historyitem_CommonSeries_SetIdx]=window["AscDFH"].CChangesDrawingsLong;AscDFH.changesFactory[AscDFH.historyitem_CommonSeries_SetOrder]= window["AscDFH"].CChangesDrawingsLong;AscDFH.changesFactory[AscDFH.historyitem_CommonSeries_SetTx]=window["AscDFH"].CChangesDrawingsObject;AscDFH.changesFactory[AscDFH.historyitem_CommonSeries_SetSpPr]=window["AscDFH"].CChangesDrawingsObject;AscDFH.changesFactory[AscDFH.historyitem_PivotSource_SetFmtId]=window["AscDFH"].CChangesDrawingsLong;AscDFH.changesFactory[AscDFH.historyitem_PivotSource_SetName]=window["AscDFH"].CChangesDrawingsString;AscDFH.changesFactory[AscDFH.historyitem_Protection_SetChartObject]= window["AscDFH"].CChangesDrawingsBool;AscDFH.changesFactory[AscDFH.historyitem_Protection_SetData]=window["AscDFH"].CChangesDrawingsBool;AscDFH.changesFactory[AscDFH.historyitem_Protection_SetFormatting]=window["AscDFH"].CChangesDrawingsBool;AscDFH.changesFactory[AscDFH.historyitem_Protection_SetSelection]=window["AscDFH"].CChangesDrawingsBool;AscDFH.changesFactory[AscDFH.historyitem_Protection_SetUserInterface]=window["AscDFH"].CChangesDrawingsBool;AscDFH.changesFactory[AscDFH.historyitem_PrintSettingsSetHeaderFooter]= window["AscDFH"].CChangesDrawingsObject;AscDFH.changesFactory[AscDFH.historyitem_PrintSettingsSetPageMargins]=window["AscDFH"].CChangesDrawingsObject;AscDFH.changesFactory[AscDFH.historyitem_PrintSettingsSetPageSetup]=window["AscDFH"].CChangesDrawingsObject;AscDFH.changesFactory[AscDFH.historyitem_HeaderFooterChartSetAlignWithMargins]=window["AscDFH"].CChangesDrawingsBool;AscDFH.changesFactory[AscDFH.historyitem_HeaderFooterChartSetDifferentFirst]=window["AscDFH"].CChangesDrawingsBool;AscDFH.changesFactory[AscDFH.historyitem_HeaderFooterChartSetDifferentOddEven]= window["AscDFH"].CChangesDrawingsBool;AscDFH.changesFactory[AscDFH.historyitem_HeaderFooterChartSetEvenFooter]=window["AscDFH"].CChangesDrawingsString;AscDFH.changesFactory[AscDFH.historyitem_HeaderFooterChartSetEvenHeader]=window["AscDFH"].CChangesDrawingsString;AscDFH.changesFactory[AscDFH.historyitem_HeaderFooterChartSetFirstFooter]=window["AscDFH"].CChangesDrawingsString;AscDFH.changesFactory[AscDFH.historyitem_HeaderFooterChartSetFirstHeader]=window["AscDFH"].CChangesDrawingsString;AscDFH.changesFactory[AscDFH.historyitem_HeaderFooterChartSetOddFooter]= window["AscDFH"].CChangesDrawingsString;AscDFH.changesFactory[AscDFH.historyitem_HeaderFooterChartSetOddHeader]=window["AscDFH"].CChangesDrawingsString;AscDFH.changesFactory[AscDFH.historyitem_PageMarginsSetB]=window["AscDFH"].CChangesDrawingsDouble;AscDFH.changesFactory[AscDFH.historyitem_PageMarginsSetFooter]=window["AscDFH"].CChangesDrawingsDouble;AscDFH.changesFactory[AscDFH.historyitem_PageMarginsSetHeader]=window["AscDFH"].CChangesDrawingsDouble;AscDFH.changesFactory[AscDFH.historyitem_PageMarginsSetL]= window["AscDFH"].CChangesDrawingsDouble;AscDFH.changesFactory[AscDFH.historyitem_PageMarginsSetR]=window["AscDFH"].CChangesDrawingsDouble;AscDFH.changesFactory[AscDFH.historyitem_PageMarginsSetT]=window["AscDFH"].CChangesDrawingsDouble;AscDFH.changesFactory[AscDFH.historyitem_PageSetupSetBlackAndWhite]=window["AscDFH"].CChangesDrawingsBool;AscDFH.changesFactory[AscDFH.historyitem_PageSetupSetCopies]=window["AscDFH"].CChangesDrawingsLong;AscDFH.changesFactory[AscDFH.historyitem_PageSetupSetDraft]= window["AscDFH"].CChangesDrawingsBool;AscDFH.changesFactory[AscDFH.historyitem_PageSetupSetFirstPageNumber]=window["AscDFH"].CChangesDrawingsLong;AscDFH.changesFactory[AscDFH.historyitem_PageSetupSetHorizontalDpi]=window["AscDFH"].CChangesDrawingsLong;AscDFH.changesFactory[AscDFH.historyitem_PageSetupSetOrientation]=window["AscDFH"].CChangesDrawingsLong;AscDFH.changesFactory[AscDFH.historyitem_PageSetupSetPaperHeight]=window["AscDFH"].CChangesDrawingsDouble;AscDFH.changesFactory[AscDFH.historyitem_PageSetupSetPaperSize]= window["AscDFH"].CChangesDrawingsLong;AscDFH.changesFactory[AscDFH.historyitem_PageSetupSetPaperWidth]=window["AscDFH"].CChangesDrawingsDouble;AscDFH.changesFactory[AscDFH.historyitem_PageSetupSetUseFirstPageNumb]=window["AscDFH"].CChangesDrawingsBool;AscDFH.changesFactory[AscDFH.historyitem_PageSetupSetVerticalDpi]=window["AscDFH"].CChangesDrawingsLong;AscDFH.changesFactory[AscDFH.historyitem_ChartStyleAxisTitle]=window["AscDFH"].CChangesDrawingsObject;AscDFH.changesFactory[AscDFH.historyitem_ChartStyleCategoryAxis]= window["AscDFH"].CChangesDrawingsObject;AscDFH.changesFactory[AscDFH.historyitem_ChartStyleChartArea]=window["AscDFH"].CChangesDrawingsObject;AscDFH.changesFactory[AscDFH.historyitem_ChartStyleDataLabel]=window["AscDFH"].CChangesDrawingsObject;AscDFH.changesFactory[AscDFH.historyitem_ChartStyleDataLabelCallout]=window["AscDFH"].CChangesDrawingsObject;AscDFH.changesFactory[AscDFH.historyitem_ChartStyleDataPoint]=window["AscDFH"].CChangesDrawingsObject;AscDFH.changesFactory[AscDFH.historyitem_ChartStyleDataPoint3D]= window["AscDFH"].CChangesDrawingsObject;AscDFH.changesFactory[AscDFH.historyitem_ChartStyleDataPointLine]=window["AscDFH"].CChangesDrawingsObject;AscDFH.changesFactory[AscDFH.historyitem_ChartStyleDataPointMarker]=window["AscDFH"].CChangesDrawingsObject;AscDFH.changesFactory[AscDFH.historyitem_ChartStyleDataPointWireframe]=window["AscDFH"].CChangesDrawingsObject;AscDFH.changesFactory[AscDFH.historyitem_ChartStyleDataTable]=window["AscDFH"].CChangesDrawingsObject;AscDFH.changesFactory[AscDFH.historyitem_ChartStyleDownBar]= window["AscDFH"].CChangesDrawingsObject;AscDFH.changesFactory[AscDFH.historyitem_ChartStyleDropLine]=window["AscDFH"].CChangesDrawingsObject;AscDFH.changesFactory[AscDFH.historyitem_ChartStyleErrorBar]=window["AscDFH"].CChangesDrawingsObject;AscDFH.changesFactory[AscDFH.historyitem_ChartStyleFloor]=window["AscDFH"].CChangesDrawingsObject;AscDFH.changesFactory[AscDFH.historyitem_ChartStyleGridlineMajor]=window["AscDFH"].CChangesDrawingsObject;AscDFH.changesFactory[AscDFH.historyitem_ChartStyleGridlineMinor]= window["AscDFH"].CChangesDrawingsObject;AscDFH.changesFactory[AscDFH.historyitem_ChartStyleHiLoLine]=window["AscDFH"].CChangesDrawingsObject;AscDFH.changesFactory[AscDFH.historyitem_ChartStyleLeaderLine]=window["AscDFH"].CChangesDrawingsObject;AscDFH.changesFactory[AscDFH.historyitem_ChartStyleLegend]=window["AscDFH"].CChangesDrawingsObject;AscDFH.changesFactory[AscDFH.historyitem_ChartStylePlotArea]=window["AscDFH"].CChangesDrawingsObject;AscDFH.changesFactory[AscDFH.historyitem_ChartStylePlotArea3D]= window["AscDFH"].CChangesDrawingsObject;AscDFH.changesFactory[AscDFH.historyitem_ChartStyleSeriesAxis]=window["AscDFH"].CChangesDrawingsObject;AscDFH.changesFactory[AscDFH.historyitem_ChartStyleSeriesLine]=window["AscDFH"].CChangesDrawingsObject;AscDFH.changesFactory[AscDFH.historyitem_ChartStyleTitle]=window["AscDFH"].CChangesDrawingsObject;AscDFH.changesFactory[AscDFH.historyitem_ChartStyleTrendline]=window["AscDFH"].CChangesDrawingsObject;AscDFH.changesFactory[AscDFH.historyitem_ChartStyleTrendlineLabel]= window["AscDFH"].CChangesDrawingsObject;AscDFH.changesFactory[AscDFH.historyitem_ChartStyleUpBar]=window["AscDFH"].CChangesDrawingsObject;AscDFH.changesFactory[AscDFH.historyitem_ChartStyleValueAxis]=window["AscDFH"].CChangesDrawingsObject;AscDFH.changesFactory[AscDFH.historyitem_ChartStyleWall]=window["AscDFH"].CChangesDrawingsObject;AscDFH.changesFactory[AscDFH.historyitem_ChartStyleMarkerLayout]=window["AscDFH"].CChangesDrawingsObject;AscDFH.changesFactory[AscDFH.historyitem_ChartStyleMarkerId]= window["AscDFH"].CChangesDrawingsLong;AscDFH.changesFactory[AscDFH.historyitem_ChartStyleEntryType]=window["AscDFH"].CChangesDrawingsLong;AscDFH.changesFactory[AscDFH.historyitem_ChartStyleEntryLineWidthScale]=window["AscDFH"].CChangesDrawingsDouble2;AscDFH.changesFactory[AscDFH.historyitem_ChartStyleEntryLnRef]=window["AscDFH"].CChangesDrawingsObjectNoId;AscDFH.changesFactory[AscDFH.historyitem_ChartStyleEntryFillRef]=window["AscDFH"].CChangesDrawingsObjectNoId;AscDFH.changesFactory[AscDFH.historyitem_ChartStyleEntryEffectRef]= window["AscDFH"].CChangesDrawingsObjectNoId;AscDFH.changesFactory[AscDFH.historyitem_ChartStyleEntryFontRef]=window["AscDFH"].CChangesDrawingsObjectNoId;AscDFH.changesFactory[AscDFH.historyitem_ChartStyleEntryDefRPr]=window["AscDFH"].CChangesDrawingsObjectNoId;AscDFH.changesFactory[AscDFH.historyitem_ChartStyleEntryBodyPr]=window["AscDFH"].CChangesDrawingsObjectNoId;AscDFH.changesFactory[AscDFH.historyitem_ChartStyleEntrySpPr]=window["AscDFH"].CChangesDrawingsObject;AscDFH.changesFactory[AscDFH.historyitem_MarkerLayoutSymbol]= window["AscDFH"].CChangesDrawingsLong;AscDFH.changesFactory[AscDFH.historyitem_MarkerLayoutSize]=window["AscDFH"].CChangesDrawingsLong;AscDFH.drawingsConstructorsMap[AscDFH.historyitem_ChartStyleEntryLnRef]=AscFormat.StyleRef;AscDFH.drawingsConstructorsMap[AscDFH.historyitem_ChartStyleEntryFillRef]=AscFormat.StyleRef;AscDFH.drawingsConstructorsMap[AscDFH.historyitem_ChartStyleEntryEffectRef]=AscFormat.StyleRef;AscDFH.drawingsConstructorsMap[AscDFH.historyitem_ChartStyleEntryFontRef]=AscFormat.FontRef; AscDFH.drawingsConstructorsMap[AscDFH.historyitem_ChartStyleEntryBodyPr]=AscFormat.CBodyPr;drawingContentChanges[AscDFH.historyitem_PlotArea_AddAxis]=drawingContentChanges[AscDFH.historyitem_BarChart_AddAxId]=drawingContentChanges[AscDFH.historyitem_AreaChart_AddAxId]=drawingContentChanges[AscDFH.historyitem_CommonChart_AddAxId]=drawingContentChanges[AscDFH.historyitem_BubbleChart_AddAxId]=drawingContentChanges[AscDFH.historyitem_LineChart_AddAxId]=drawingContentChanges[AscDFH.historyitem_RadarChart_AddAxId]= drawingContentChanges[AscDFH.historyitem_ScatterChart_AddAxId]=drawingContentChanges[AscDFH.historyitem_StockChart_AddAxId]=drawingContentChanges[AscDFH.historyitem_SurfaceChart_AddAxId]=drawingContentChanges[AscDFH.historyitem_PlotArea_RemoveAxis]=function(oClass){return oClass.axId};drawingContentChanges[AscDFH.historyitem_PlotArea_AddChart]=drawingContentChanges[AscDFH.historyitem_PlotArea_RemoveChart]=function(oClass){oClass.onChangeDataRefs();return oClass.charts};drawingContentChanges[AscDFH.historyitem_CommonChart_RemoveSeries]= drawingContentChanges[AscDFH.historyitem_CommonChart_AddSeries]=function(oClass){oClass.onChangeDataRefs();return oClass.series};drawingContentChanges[AscDFH.historyitem_CommonChart_AddFilteredSeries]=drawingContentChanges[AscDFH.historyitem_CommonChart_RemoveFilteredSeries]=function(oClass){return oClass.filteredSeries};drawingContentChanges[AscDFH.historyitem_AreaSeries_SetDPt]=drawingContentChanges[AscDFH.historyitem_CommonSeries_RemoveDPt]=drawingContentChanges[AscDFH.historyitem_BarSeries_SetDPt]= drawingContentChanges[AscDFH.historyitem_LineSeries_SetDPt]=drawingContentChanges[AscDFH.historyitem_PieSeries_SetDPt]=drawingContentChanges[AscDFH.historyitem_ScatterSer_SetDPt]=drawingContentChanges[AscDFH.historyitem_BubbleSeries_SetDPt]=drawingContentChanges[AscDFH.historyitem_RadarSeries_SetDPt]=drawingContentChanges[AscDFH.historyitem_PieSeries_SetDPt]=drawingContentChanges[AscDFH.historyitem_LineSeries_SetDPt]=drawingContentChanges[AscDFH.historyitem_RadarSeries_SetDPt]=function(oClass){return oClass.dPt}; drawingContentChanges[AscDFH.historyitem_DLbls_SetDLbl]=function(oClass){oClass.onChangeDataRefs();return oClass.dLbl};drawingContentChanges[AscDFH.historyitem_Legend_AddLegendEntry]=function(oClass){return oClass.legendEntryes};drawingContentChanges[AscDFH.historyitem_MultiLvlStrCache_SetLvl]=function(oClass){return oClass.lvl};drawingContentChanges[AscDFH.historyitem_CommonLit_RemoveDPt]=drawingContentChanges[AscDFH.historyitem_NumLit_AddPt]=drawingContentChanges[AscDFH.historyitem_StrCache_AddPt]= drawingContentChanges[AscDFH.historyitem_StringLiteral_SetPt]=function(oClass){return oClass.pts};drawingContentChanges[AscDFH.historyitem_OfPieChart_AddCustSplit]=function(oClass){return oClass.custSplit};drawingContentChanges[AscDFH.historyitem_SurfaceChart_AddBandFmt]=function(oClass){return oClass.bandFmts};drawingContentChanges[AscDFH.historyitem_Chart_AddPivotFmt]=function(oClass){return oClass.pivotFmts};var CMatrix=AscCommon.CMatrix;var isRealObject=AscCommon.isRealObject;var History=AscCommon.History; var global_MatrixTransformer=AscCommon.global_MatrixTransformer;var CShape=AscFormat.CShape;var checkSpPrRasterImages=AscFormat.checkSpPrRasterImages;var c_oAscChartLegendShowSettings=Asc.c_oAscChartLegendShowSettings;var c_oAscChartDataLabelsPos=Asc.c_oAscChartDataLabelsPos;var c_oAscValAxisRule=Asc.c_oAscValAxisRule;var c_oAscValAxUnits=Asc.c_oAscValAxUnits;var c_oAscTickMark=Asc.c_oAscTickMark;var c_oAscTickLabelsPos=Asc.c_oAscTickLabelsPos;var c_oAscCrossesRule=Asc.c_oAscCrossesRule;var c_oAscBetweenLabelsRule= Asc.c_oAscBetweenLabelsRule;var c_oAscLabelsPosition=Asc.c_oAscLabelsPosition;var c_oAscAxisType=Asc.c_oAscAxisType;var CChangesDrawingsBool=AscDFH.CChangesDrawingsBool;var CChangesDrawingsLong=AscDFH.CChangesDrawingsLong;var CChangesDrawingsDouble=AscDFH.CChangesDrawingsDouble;var CChangesDrawingsString=AscDFH.CChangesDrawingsString;var CChangesDrawingsObjectNoId=AscDFH.CChangesDrawingsObjectNoId;var CChangesDrawingsObject=AscDFH.CChangesDrawingsObject;var CChangesDrawingsContent=AscDFH.CChangesDrawingsContent; var CChangesDrawingsDouble2=AscDFH.CChangesDrawingsDouble2;var InitClass=AscFormat.InitClass;var CBaseFormatObject=AscFormat.CBaseFormatObject;function CBaseChartObject(){CBaseFormatObject.call(this)}InitClass(CBaseChartObject,CBaseFormatObject,AscDFH.historyitem_type_Unknown);CBaseChartObject.prototype.notAllowedWithoutId=function(){return false};CBaseChartObject.prototype.getChartSpace=function(){var oCurElement=this;while(oCurElement){if(oCurElement.getObjectType()===AscDFH.historyitem_type_ChartSpace)return oCurElement; oCurElement=oCurElement.parent}};CBaseChartObject.prototype.getDrawingDocument=function(){var oChartSpace=this.getChartSpace();if(oChartSpace)return oChartSpace.getDrawingDocument();return null};CBaseChartObject.prototype.onChartInternalUpdate=function(bColors){var oChartSpace=this.getChartSpace();if(oChartSpace)oChartSpace.handleUpdateInternalChart(bColors)};CBaseChartObject.prototype.onChartUpdateType=function(){var oChartSpace=this.getChartSpace();if(oChartSpace)oChartSpace.handleUpdateType()}; CBaseChartObject.prototype.onChartUpdateDataLabels=function(){var oChartSpace=this.getChartSpace();if(oChartSpace)oChartSpace.handleUpdateDataLabels()};CBaseChartObject.prototype.getTxPrParaPr=function(){if(this.txPr)return this.txPr.getFirstParaParaPr();return null};CBaseChartObject.prototype.onChangeDataRefs=function(){var oChartSpace=this.getChartSpace();if(oChartSpace)oChartSpace.clearDataRefs()};CBaseChartObject.prototype.getTheme=function(){var oChartSpace=this.getChartSpace();if(oChartSpace)return oChartSpace.getTheme(); return null};CBaseChartObject.prototype.getSpPrFormStyleEntry=function(oStyleEntry,aColors,nIdx){var oTheme=this.getTheme();var oSpPr=oStyleEntry.spPr;var oFill;var oFillRef=oStyleEntry.fillRef;var oFillRefUnicolor=oFillRef.getNoStyleUnicolor(nIdx,aColors);oFill=oTheme.getFillStyle(oFillRef.idx,oFillRefUnicolor||aColors[nIdx]);if(oSpPr&&oSpPr.Fill){oFill=oSpPr.Fill.createDuplicate();var bIsSpecialStyle=oStyleEntry.isSpecialStyle();oFill.checkPhColor(oFillRefUnicolor||aColors[nIdx],bIsSpecialStyle); if(bIsSpecialStyle)if(AscFormat.isRealNumber(nIdx)){var nPatternType=oStyleEntry.getSpecialPatternType(nIdx);oFill.checkPatternType(nPatternType)}}var oLn;var oLineRef=oStyleEntry.lnRef;var oLineRefUnicolor=oLineRef.getNoStyleUnicolor(nIdx,aColors);oLn=oTheme.getLnStyle(oLineRef.idx,oLineRefUnicolor);if(oSpPr&&oSpPr.ln){oLn=oSpPr.ln.createDuplicate();oLn.Fill.checkPhColor(oLineRefUnicolor,false)}if(AscFormat.isRealNumber(oLn.w)&&AscFormat.isRealNumber(oStyleEntry.lineWidthScale))oLn.w*=oStyleEntry.lineWidthScale; var oResultSpPr=new AscFormat.CSpPr;oResultSpPr.setFill(oFill);oResultSpPr.setLn(oLn);return oResultSpPr};CBaseChartObject.prototype.getTxPrFormStyleEntry=function(oStyleEntry,aColors,nIdx){var oFontRef=oStyleEntry.fontRef;var oParaPr=new AscCommonWord.CParaPr;var oTextPr=new AscCommonWord.CTextPr;var oRFonts=oTextPr.RFonts;oRFonts.SetFontStyle(oFontRef.idx);var oFontUnicolor=oFontRef.getNoStyleUnicolor(nIdx,aColors);if(oFontUnicolor)oTextPr.SetUnifill(AscFormat.CreateUniFillByUniColor(oFontUnicolor)); if(oStyleEntry.defRPr){oTextPr.Merge(oStyleEntry.defRPr);if(oTextPr.Unifill)oTextPr.Unifill.checkPhColor(oFontUnicolor,false)}oParaPr.DefaultRunPr=oTextPr;var oTxPr=AscFormat.CreateTextBodyFromString("",this.getDrawingDocument(),this);if(oStyleEntry.bodyPr)oTxPr.setBodyPr(oStyleEntry.bodyPr.createDuplicate());oTxPr.content.Content[0].Set_Pr(oParaPr);return oTxPr};CBaseChartObject.prototype.applyStyleEntry=function(oStyleEntry,aColors,nIdx,bReset){if(!this.setSpPr&&!this.setTxPr||!oStyleEntry)return; if(this.setSpPr){var oSpPr=this.getSpPrFormStyleEntry(oStyleEntry,aColors,nIdx);if(this.spPr){if(bReset!==false||!this.spPr.Fill)this.spPr.setFill(oSpPr.Fill);if(bReset!==false||!this.spPr.ln)this.spPr.setLn(oSpPr.ln)}else this.setSpPr(oSpPr)}if(this.setTxPr)this.setTxPr(this.getTxPrFormStyleEntry(oStyleEntry,aColors,nIdx))};CBaseChartObject.prototype.resetFormatting=function(){this.resetOwnFormatting();var aChildren=this.getChildren();for(var nChild=0;nChild0)if(isRealObject(aPoints[0])&&AscFormat.isRealNumber(aPoints[0].val)&&isRealObject(aPoints[aPoints.length-1])&&AscFormat.isRealNumber(aPoints[aPoints.length-1].val))if(aPoints[0].val-aPoints[aPoints.length-1].val<=0)return{min:aPoints[0].val,max:aPoints[aPoints.length-1].val};else return{min:aPoints[aPoints.length-1].val,max:aPoints[0].val};return{min:null,max:null}}var SCALE_INSET_COEFF=1.016;function CDLbl(){CBaseChartObject.call(this);this.bDelete=null;this.dLblPos=null;this.idx= null;this.layout=null;this.numFmt=null;this.separator=null;this.showBubbleSize=null;this.showCatName=null;this.showLegendKey=null;this.showPercent=null;this.showSerName=null;this.showVal=null;this.spPr=null;this.tx=null;this.txPr=null;this.recalcInfo={recalcTransform:true,recalculateTransformText:true,recalcStyle:true,recalculateTxBody:true,recalculateBrush:true,recalculatePen:true,recalculateContent:true};this.chart=null;this.series=null;this.x=0;this.y=0;this.calcX=null;this.calcY=null;this.relPosX= null;this.relPosY=null;this.txBody=null;this.transform=new CMatrix;this.transformText=new CMatrix;this.ownTransform=new CMatrix;this.ownTransformText=new CMatrix;this.localTransform=new CMatrix;this.localTransformText=new CMatrix;this.compiledStyles=null}InitClass(CDLbl,CBaseChartObject,AscDFH.historyitem_type_DLbl);CDLbl.prototype.Refresh_RecalcData=function(){this.Refresh_RecalcData2()};CDLbl.prototype.Check_AutoFit=function(){return true};CDLbl.prototype.getChildren=function(){return[this.layout, this.numFmt,this.spPr,this.tx,this.txPr]};CDLbl.prototype.fillObject=function(oCopy,oIdMap){oCopy.setDelete(this.bDelete);oCopy.setDLblPos(this.dLblPos);oCopy.setIdx(this.idx);if(this.layout)oCopy.setLayout(this.layout.createDuplicate());if(this.numFmt)oCopy.setNumFmt(this.numFmt.createDuplicate());oCopy.setSeparator(this.separator);oCopy.setShowBubbleSize(this.showBubbleSize);oCopy.setShowCatName(this.showCatName);oCopy.setShowLegendKey(this.showLegendKey);oCopy.setShowPercent(this.showPercent); oCopy.setShowSerName(this.showSerName);oCopy.setShowVal(this.showVal);if(this.spPr)oCopy.setSpPr(this.spPr.createDuplicate());if(this.tx)oCopy.setTx(this.tx.createDuplicate());if(this.txPr)oCopy.setTxPr(this.txPr.createDuplicate())};CDLbl.prototype.checkShapeChildTransform=function(transform){this.updatePosition(this.posX,this.posY);global_MatrixTransformer.MultiplyAppend(this.transform,transform);global_MatrixTransformer.MultiplyAppend(this.transformText,transform);if(this instanceof CTitle||this instanceof CDLbl){this.invertTransform=global_MatrixTransformer.Invert(this.transform);this.invertTransformText=global_MatrixTransformer.Invert(this.transformText)}};CDLbl.prototype.getCompiledFill=function(){return this.spPr&&this.spPr.Fill?this.spPr.Fill:null};CDLbl.prototype.getCompiledLine=function(){return this.spPr&&this.spPr.ln?this.spPr.ln:null};CDLbl.prototype.getCompiledTransparent=function(){return this.spPr&&this.spPr.Fill?this.spPr.Fill.transparent:null};CDLbl.prototype.recalculate=function(){if(this.bDelete)return; AscFormat.ExecuteNoHistory(function(){if(this.recalcInfo.recalculateBrush){this.recalculateBrush();this.recalcInfo.recalculateBrush=false}if(this.recalcInfo.recalculatePen){this.recalculatePen();this.recalcInfo.recalculatePen=false}if(this.recalcInfo.recalcStyle)this.recalculateStyle();if(this.recalcInfo.recalculateTxBody){this.recalculateTxBody();this.recalcInfo.recalculateTxBody=false}if(this.recalcInfo.recalculateContent)this.recalculateContent();if(this.recalcInfo.recalcTransform)this.recalculateTransform(); if(this.recalcInfo.recalculateTransformText)this.recalculateTransformText();if(this.chart)this.chart.addToSetPosition(this)},this,[])};CDLbl.prototype.recalculateBrush=CShape.prototype.recalculateBrush;CDLbl.prototype.recalculatePen=CShape.prototype.recalculatePen;CDLbl.prototype.check_bounds=CShape.prototype.check_bounds;CDLbl.prototype.selectionCheck=CShape.prototype.selectionCheck;CDLbl.prototype.getInvertTransform=CShape.prototype.getInvertTransform;CDLbl.prototype.getDocContent=CShape.prototype.getDocContent; CDLbl.prototype.updateSelectionState=function(){if(this.txBody&&this.txBody.content)if(!this.txBody.content.DrawingDocument)if(this.chart){var oDrawingDocument=this.chart.getDrawingDocument();if(oDrawingDocument){this.txBody.content.DrawingDocument=oDrawingDocument;var aContent=this.txBody.content.Content;for(var i=0;i=0&&_x<=this.extX&&_y>=0&&_y=0&&tx<=this.extX&&ty>=0&&ty<=this.extY};CDLbl.prototype.hitInPath=CShape.prototype.hitInPath;CDLbl.prototype.hitInInnerArea=CShape.prototype.hitInInnerArea;CDLbl.prototype.hitInBoundingRect=CShape.prototype.hitInBoundingRect;CDLbl.prototype.hitInTextRect=function(x,y){var content=this.getDocContent&&this.getDocContent();if(content&&this.invertTransformText)return AscFormat.HitToRect(x,y,this.invertTransformText, 0,0,this.contentWidth,this.contentHeight)};CDLbl.prototype.getCompiledStyle=function(){return null};CDLbl.prototype.getChartSpace=function(){if(this.chart)return this.chart;return CBaseChartObject.prototype.getChartSpace.call(this)};CDLbl.prototype.getParentObjects=function(){var oChartSpace=this.getChartSpace();if(oChartSpace)return oChartSpace.getParentObjects()};CDLbl.prototype.recalculateTransform=function(){};CDLbl.prototype.recalculateTransformText=function(){if(this.txBody===null)return;this.ownTransformText.Reset(); var _text_transform=this.ownTransformText;var _shape_transform=this.ownTransform;var _body_pr=this.getBodyPr();var _content_height=this.txBody.content.GetSummaryHeight();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(isRealObject(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;var nVert=_body_pr.vert;if(!_body_pr.upright)if(!(nVert===AscFormat.nVertTTvert||nVert===AscFormat.nVertTTvert270)){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}}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{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}}global_MatrixTransformer.TranslateAppend(_text_transform, 0,_vertical_shift);var _alpha;_alpha=Math.atan2(_dy_t,_dx_t);if(nVert===AscFormat.nVertTTvert)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)}}else{var _full_flip={flipH:false,flipV:false};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(!(nVert===AscFormat.nVertTTvert||nVert===AscFormat.nVertTTvert270)){_content_width=_r-_l;content_height2=_b-_t}else{_content_width=_b-_t;content_height2=_r-_l}switch(_body_pr.anchor){case 0:{_vertical_shift=content_height2-_content_height;break}case 1:{_vertical_shift=(content_height2-_content_height)*.5;break}case 2:{_vertical_shift=(content_height2-_content_height)*.5;break}case 3:{_vertical_shift=(content_height2-_content_height)*.5;break}case 4:{_vertical_shift=0;break}}var _text_rect_xc=_l+ (_r-_l)*.5;var _text_rect_yc=_t+(_b-_t)*.5;var _vx=_text_rect_xc-_hc;var _vy=_text_rect_yc-_vc;var _transformed_text_xc,_transformed_text_yc;if(!_full_flip.flipH)_transformed_text_xc=_transformed_shape_xc+_vx;else _transformed_text_xc=_transformed_shape_xc-_vx;if(!_full_flip.flipV)_transformed_text_yc=_transformed_shape_yc+_vy;else _transformed_text_yc=_transformed_shape_yc-_vy;global_MatrixTransformer.TranslateAppend(_text_transform,0,_vertical_shift);if(nVert===AscFormat.nVertTTvert){global_MatrixTransformer.TranslateAppend(_text_transform, -_content_width*.5,-content_height2*.5);global_MatrixTransformer.RotateRadAppend(_text_transform,-Math.PI*1.5);global_MatrixTransformer.TranslateAppend(_text_transform,_content_width*.5,content_height2*.5)}if(nVert===AscFormat.nVertTTvert270){global_MatrixTransformer.TranslateAppend(_text_transform,-_content_width*.5,-content_height2*.5);global_MatrixTransformer.RotateRadAppend(_text_transform,-Math.PI*1.5);global_MatrixTransformer.TranslateAppend(_text_transform,_content_width*.5,content_height2* .5)}global_MatrixTransformer.TranslateAppend(_text_transform,_transformed_text_xc-_content_width*.5,_transformed_text_yc-content_height2*.5);this.clipRect={x:-_body_pr.lIns,y:-_vertical_shift-_body_pr.tIns,w:this.contentWidth+(_body_pr.rIns+_body_pr.lIns),h:this.contentHeight+(_body_pr.bIns+_body_pr.tIns)}}this.transformText=this.ownTransformText.CreateDublicate()};CDLbl.prototype.getStyles=function(){if(this.lastStyleObject)return this.lastStyleObject;return AscFormat.ExecuteNoHistory(function(){var styles= new CStyles(false);var style=new CStyle("dataLblStyle",null,null,null,true);var text_pr=new CTextPr;text_pr.FontSize=10;var oChartSpace=this.getChartSpace();if(oChartSpace&&AscFormat.isRealNumber(oChartSpace.style))if(oChartSpace.style>40)text_pr.Unifill=AscFormat.CreateUnfilFromRGB(255,255,255);else{var default_style=AscFormat.CHART_STYLE_MANAGER.getDefaultLineStyleByIndex(oChartSpace.style);var oUnifill=default_style.axisAndMajorGridLines.createDuplicate();if(oUnifill&&oUnifill.fill&&oUnifill.fill.color&& oUnifill.fill.color.Mods)oUnifill.fill.color.Mods.Mods.length=0;text_pr.Unifill=oUnifill}else text_pr.Unifill=AscFormat.CreateUnfilFromRGB(0,0,0);var para_pr=new CParaPr;para_pr.Jc=AscCommon.align_Center;para_pr.Spacing.Before=0;para_pr.Spacing.After=0;para_pr.Spacing.Line=1;para_pr.Spacing.LineRule=Asc.linerule_Auto;style.ParaPr=para_pr;text_pr.RFonts.SetFontStyle(AscFormat.fntStyleInd_minor);style.TextPr=text_pr;var chart_text_pr;var oParaPr=oChartSpace&&oChartSpace.getTxPrParaPr();if(oParaPr){style.ParaPr.Merge(oParaPr); if(oParaPr.DefaultRunPr){chart_text_pr=oParaPr.DefaultRunPr;style.TextPr.Merge(chart_text_pr)}}if(this instanceof CTitle||this.parent instanceof CTitle){style.TextPr.Bold=true;if(this.parent instanceof CChart||this.parent&&this.parent.parent instanceof CChart)if(chart_text_pr&&typeof chart_text_pr.FontSize==="number")style.TextPr.FontSize=chart_text_pr.FontSize*1.2>>0;else style.TextPr.FontSize=18}if(this instanceof CalcLegendEntry&&this.legend){oParaPr=this.legend.getTxPrParaPr();if(oParaPr){style.ParaPr.Merge(oParaPr); if(oParaPr.DefaultRunPr)style.TextPr.Merge(oParaPr.DefaultRunPr)}if(AscFormat.isRealNumber(this.idx)){var aLegendEntries=this.legend.legendEntryes;for(var i=0;i0)sFormatCode=this.numFmt.formatCode;else if(typeof this.pt.formatCode==="string"&&this.pt.formatCode.length>0)sFormatCode=this.pt.formatCode;else sFormatCode=this.series.getValObjectSourceNumFormat(this.pt.idx);var num_format=AscCommon.oNumFormatCache.get(sFormatCode);return num_format.formatToChart(this.pt.val)}return""};CDLbl.prototype.getDefaultTextForTxBody=function(){var compiled_string="";var separator;if(typeof this.separator=== "string")separator=this.separator+" ";else if(this.series.getObjectType()===AscDFH.historyitem_type_PieSeries)if(this.showPercent&&this.showCatName&&!this.showSerName&&!this.showVal)separator="\n";else separator=", ";else separator=", ";if(this.showSerName)compiled_string+=this.series.getSeriesName();if(this.showCatName){if(compiled_string.length>0)compiled_string+=separator;compiled_string+=this.series.getCatName(this.pt.idx)}if(this.showVal){if(compiled_string.length>0)compiled_string+=separator; compiled_string+=this.getValueString()}if(this.showPercent){if(compiled_string.length>0)compiled_string+=separator;compiled_string+=this.getPercentageString()}return compiled_string};CDLbl.prototype.getMaxWidth=function(bodyPr){var oChartSpace=this.getChartSpace();if(!(this.parent&&(this.parent.axPos===AX_POS_L||this.parent.axPos===AX_POS_R))){if(!oChartSpace)return 2E4;switch(bodyPr.vert){case AscFormat.nVertTTeaVert:case AscFormat.nVertTTmongolianVert:case AscFormat.nVertTTvert:case AscFormat.nVertTTwordArtVert:case AscFormat.nVertTTwordArtVertRtl:case AscFormat.nVertTTvert270:{return oChartSpace.extY/ 2}case AscFormat.nVertTThorz:{return oChartSpace.extX/5}}return oChartSpace.extX/5}else return 2E4};CDLbl.prototype.getBodyPr=function(){var ret=new AscFormat.CBodyPr;ret.setDefault();ret.anchor=1;var oBaseBodyPr=new AscFormat.CBodyPr;if(this.txPr&&this.txPr.bodyPr)oBaseBodyPr.merge(this.txPr.bodyPr);if(this.tx&&this.tx.rich)oBaseBodyPr.merge(this.tx.rich.bodyPr);if(this.parent&&(this.parent.axPos===AX_POS_L||this.parent.axPos===AX_POS_R)&&(oBaseBodyPr.vert===null&&oBaseBodyPr.rot===null))ret.vert= AscFormat.nVertTTvert270;ret.merge(oBaseBodyPr);var nVert=ret.vert;if(AscFormat.isRealNumber(ret.rot)&&0!==ret.rot)if(Math.abs(ret.rot-54E5)<1E3)if(ret.vert===AscFormat.nVertTTvert270)nVert=AscFormat.nVertTThorz;else{if(ret.vert===AscFormat.nVertTThorz)nVert=AscFormat.nVertTTvert}else if(Math.abs(ret.rot+54E5)<1E3)if(ret.vert===AscFormat.nVertTTvert)nVert=AscFormat.nVertTThorz;else if(ret.vert===AscFormat.nVertTThorz)nVert=AscFormat.nVertTTvert270;switch(nVert){case AscFormat.nVertTTeaVert:case AscFormat.nVertTTmongolianVert:case AscFormat.nVertTTvert:case AscFormat.nVertTTwordArtVert:case AscFormat.nVertTTwordArtVertRtl:case AscFormat.nVertTTvert270:{ret.lIns= SCALE_INSET_COEFF;ret.rIns=SCALE_INSET_COEFF;ret.tIns=SCALE_INSET_COEFF*.5;ret.bIns=SCALE_INSET_COEFF*.5;break}case AscFormat.nVertTThorz:{ret.lIns=SCALE_INSET_COEFF;ret.rIns=SCALE_INSET_COEFF;ret.tIns=SCALE_INSET_COEFF*.5;ret.bIns=SCALE_INSET_COEFF*.5;break}}ret.vert=nVert;return ret};CDLbl.prototype.recalculateContent=function(){if(this.txBody){var bodyPr=this.getBodyPr();var max_box_width=this.getMaxWidth(bodyPr);var max_content_width=max_box_width-2*SCALE_INSET_COEFF;var content=this.txBody.content; var sParPasteId=null;if(window["AscCommon"].g_specialPasteHelper&&window["AscCommon"].g_specialPasteHelper.showButtonIdParagraph){sParPasteId=window["AscCommon"].g_specialPasteHelper.showButtonIdParagraph;window["AscCommon"].g_specialPasteHelper.showButtonIdParagraph=null}content.RecalculateContent(max_content_width,2E4,0);if(sParPasteId)window["AscCommon"].g_specialPasteHelper.showButtonIdParagraph=sParPasteId;var pargs=content.Content;var max_width=0;for(var i=0;imax_width)max_width=par.Lines[j].Ranges[0].W}max_width+=1;content.RecalculateContent(max_width,2E4,0);switch(bodyPr.vert){case AscFormat.nVertTTeaVert:case AscFormat.nVertTTmongolianVert:case AscFormat.nVertTTvert:case AscFormat.nVertTTwordArtVert:case AscFormat.nVertTTwordArtVertRtl:case AscFormat.nVertTTvert270:{this.extX=Math.min(content.GetSummaryHeight()+4.4*SCALE_INSET_COEFF,max_box_width);this.extY=max_width+2*SCALE_INSET_COEFF; this.x=0;this.y=0;this.txBody.contentWidth=this.extY;this.txBody.contentHeight=this.extX;this.contentWidth=this.extY;this.contentHeight=this.extX;break}default:{var _rot=AscFormat.isRealNumber(bodyPr.rot)?bodyPr.rot*AscFormat.cToRad2:0;var t=new CMatrix;global_MatrixTransformer.RotateRadAppend(t,-_rot);var w,h,x0,y0,x1,y1,x2,y2,x3,y3;w=max_width;h=this.txBody.content.GetSummaryHeight();x0=0;y0=0;x1=t.TransformPointX(w,0);y1=t.TransformPointY(w,0);x2=t.TransformPointX(w,h);y2=t.TransformPointY(w,h); x3=t.TransformPointX(0,h);y3=t.TransformPointY(0,h);this.extX=Math.max(x0,x1,x2,x3)-Math.min(x0,x1,x2,x3)+1.25;this.extY=Math.max(y0,y1,y2,y3)-Math.min(y0,y1,y2,y3)+SCALE_INSET_COEFF;this.x=0;this.y=0;this.txBody.contentWidth=this.extX;this.txBody.contentHeight=this.extY;this.contentWidth=this.extX;this.contentHeight=this.extY;break}}}};CDLbl.prototype.recalculateTxBody=function(){if(this.tx&&this.tx.rich){this.txBody=this.tx.rich;this.txBody.parent=this}else this.txBody=AscFormat.CreateTextBodyFromString(this.getDefaultTextForTxBody(), this.getDrawingDocument(),this)};CDLbl.prototype.initDefault=function(nDefaultPosition){this.setDelete(false);this.setDLblPos(AscFormat.isRealNumber(nDefaultPosition)?nDefaultPosition:c_oAscChartDataLabelsPos.inBase);this.setIdx(null);this.setLayout(null);this.setNumFmt(null);this.setSeparator(null);this.setShowBubbleSize(false);this.setShowCatName(false);this.setShowLegendKey(false);this.setShowPercent(false);this.setShowSerName(false);this.setShowVal(false);this.setSpPr(null);this.setTx(null);this.setTxPr(null)}; CDLbl.prototype.merge=function(dLbl,noCopyTxBody){if(!dLbl)return;if(dLbl.bDelete!=null)this.setDelete(dLbl.bDelete);if(dLbl.dLblPos!=null)this.setDLblPos(dLbl.dLblPos);if(dLbl.idx!=null)this.setIdx(dLbl.idx);if(dLbl.layout!=null)this.setLayout(dLbl.layout.createDuplicate());if(dLbl.numFmt!=null)this.setNumFmt(dLbl.numFmt);if(dLbl.separator!=null)this.setSeparator(dLbl.separator);if(dLbl.showBubbleSize!=null)this.setShowBubbleSize(dLbl.showBubbleSize);if(dLbl.showCatName!=null)this.setShowCatName(dLbl.showCatName); if(dLbl.showLegendKey!=null)this.setShowLegendKey(dLbl.showLegendKey);if(dLbl.showPercent!=null)this.setShowPercent(dLbl.showPercent);if(dLbl.showSerName!=null)this.setShowSerName(dLbl.showSerName);if(dLbl.showVal!=null)this.setShowVal(dLbl.showVal);if(dLbl.spPr!=null){if(this.spPr==null)this.setSpPr(new AscFormat.CSpPr);if(dLbl.spPr.Fill){if(this.spPr.Fill==null)this.spPr.setFill(new AscFormat.CUniFill);this.spPr.Fill.merge(dLbl.spPr.Fill)}if(dLbl.spPr.ln){if(this.spPr.ln==null)this.spPr.setLn(new AscFormat.CLn); this.spPr.ln.merge(dLbl.spPr.ln)}}if(dLbl.tx){if(this.tx==null)this.setTx(new CChartText);this.tx.merge(dLbl.tx,noCopyTxBody)}if(dLbl.txPr){if(noCopyTxBody===true){var oldParent=dLbl.txPr.parent;this.setTxPr(dLbl.txPr);dLbl.txPr.parent=oldParent}else this.setTxPr(dLbl.txPr.createDuplicate());this.txPr.setParent(this)}};CDLbl.prototype.draw=CShape.prototype.draw;CDLbl.prototype.isEmptyPlaceholder=function(){return false};CDLbl.prototype.setPosition=function(x,y){this.x=x;this.y=y;this.calcX=this.x; this.calcY=this.y;this.localTransform.Reset();global_MatrixTransformer.TranslateAppend(this.localTransform,this.calcX,this.calcY);this.transform=this.localTransform.CreateDublicate();this.invertTransform=global_MatrixTransformer.Invert(this.transform);this.localTransformText=this.ownTransformText.CreateDublicate();global_MatrixTransformer.TranslateAppend(this.localTransformText,this.calcX,this.calcY);this.transformText=this.localTransformText.CreateDublicate();this.invertTransformText=global_MatrixTransformer.Invert(this.transformText)}; CDLbl.prototype.setPosition2=function(x,y){this.x=x;this.y=y;this.calcX=this.x;this.calcY=this.y;this.localTransform.tx=x;this.localTransform.ty=y;this.transform=this.localTransform.CreateDublicate();this.invertTransform=global_MatrixTransformer.Invert(this.transform);this.localTransformText.tx=x;this.localTransformText.ty=y;this.transformText=this.localTransformText.CreateDublicate();this.invertTransformText=global_MatrixTransformer.Invert(this.transformText)};CDLbl.prototype.updateTransformMatrix= function(){this.transform=this.localTransform.CreateDublicate();global_MatrixTransformer.TranslateAppend(this.transform,this.posX,this.posY);this.invertTransform=global_MatrixTransformer.Invert(this.transform);if(this.localTransformText){this.transformText=this.localTransformText.CreateDublicate();global_MatrixTransformer.TranslateAppend(this.transformText,this.posX,this.posY);this.invertTransformText=global_MatrixTransformer.Invert(this.transformText)}};CDLbl.prototype.updatePosition=function(x, y){this.posX=x;this.posY=y;this.transform=this.localTransform.CreateDublicate();global_MatrixTransformer.TranslateAppend(this.transform,x,y);this.transformText=this.localTransformText.CreateDublicate();global_MatrixTransformer.TranslateAppend(this.transformText,x,y);this.invertTransform=global_MatrixTransformer.Invert(this.transform);this.invertTransformText=global_MatrixTransformer.Invert(this.transformText)};CDLbl.prototype.setDelete=function(pr){History.CanAddChanges()&&History.Add(new CChangesDrawingsBool(this, AscDFH.historyitem_DLbl_SetDelete,this.bDelete,pr));this.bDelete=pr;this.Refresh_RecalcData2()};CDLbl.prototype.setDLblPos=function(pr){History.CanAddChanges()&&History.Add(new CChangesDrawingsLong(this,AscDFH.historyitem_DLbl_SetDLblPos,this.dLblPos,pr));this.dLblPos=pr};CDLbl.prototype.setIdx=function(pr){History.CanAddChanges()&&History.Add(new CChangesDrawingsLong(this,AscDFH.historyitem_DLbl_SetIdx,this.idx,pr));this.idx=pr};CDLbl.prototype.setLayout=function(pr){History.CanAddChanges()&&History.Add(new CChangesDrawingsObject(this, AscDFH.historyitem_DLbl_SetLayout,this.layout,pr));this.layout=pr;this.setParentToChild(pr)};CDLbl.prototype.setNumFmt=function(pr){History.CanAddChanges()&&History.Add(new CChangesDrawingsObject(this,AscDFH.historyitem_DLbl_SetNumFmt,this.numFmt,pr));this.numFmt=pr;this.setParentToChild(pr)};CDLbl.prototype.setSeparator=function(pr){History.CanAddChanges()&&History.Add(new CChangesDrawingsString(this,AscDFH.historyitem_DLbl_SetSeparator,this.separator,pr));this.separator=pr};CDLbl.prototype.setShowBubbleSize= function(pr){History.CanAddChanges()&&History.Add(new CChangesDrawingsBool(this,AscDFH.historyitem_DLbl_SetShowBubbleSize,this.showBubbleSize,pr));this.showBubbleSize=pr};CDLbl.prototype.setShowCatName=function(pr){History.CanAddChanges()&&History.Add(new CChangesDrawingsBool(this,AscDFH.historyitem_DLbl_SetShowCatName,this.showCatName,pr));this.showCatName=pr};CDLbl.prototype.setShowLegendKey=function(pr){History.CanAddChanges()&&History.Add(new CChangesDrawingsBool(this,AscDFH.historyitem_DLbl_SetShowLegendKey, this.showLegendKey,pr));this.showLegendKey=pr};CDLbl.prototype.setShowPercent=function(pr){History.CanAddChanges()&&History.Add(new CChangesDrawingsBool(this,AscDFH.historyitem_DLbl_SetShowPercent,this.showPercent,pr));this.showPercent=pr};CDLbl.prototype.setShowSerName=function(pr){History.CanAddChanges()&&History.Add(new CChangesDrawingsBool(this,AscDFH.historyitem_DLbl_SetShowSerName,this.showSerName,pr));this.showSerName=pr};CDLbl.prototype.setShowVal=function(pr){History.CanAddChanges()&&History.Add(new CChangesDrawingsBool(this, AscDFH.historyitem_DLbl_SetShowVal,this.showVal,pr));this.showVal=pr};CDLbl.prototype.setSpPr=function(pr){History.CanAddChanges()&&History.Add(new CChangesDrawingsObject(this,AscDFH.historyitem_DLbl_SetSpPr,this.spPr,pr));this.spPr=pr;this.setParentToChild(pr)};CDLbl.prototype.setTx=function(pr){if(this.tx&&this.tx.strRef||pr&&pr.strRef)this.onChangeDataRefs();History.CanAddChanges()&&History.Add(new CChangesDrawingsObject(this,AscDFH.historyitem_DLbl_SetTx,this.tx,pr));this.tx=pr;this.setParentToChild(pr)}; CDLbl.prototype.setTxPr=function(pr){History.CanAddChanges()&&History.Add(new CChangesDrawingsObject(this,AscDFH.historyitem_DLbl_SetTxPr,this.txPr,pr));this.txPr=pr;this.setParentToChild(pr)};CDLbl.prototype.handleUpdateFill=function(){this.Refresh_RecalcData2()};CDLbl.prototype.handleUpdateLn=function(){this.Refresh_RecalcData2()};CDLbl.prototype.Refresh_RecalcData2=function(pageIndex){if(this.parent&&this.parent.Refresh_RecalcData2)this.parent.Refresh_RecalcData2(pageIndex,this);else if(this.chart)this.chart.Refresh_RecalcData2(pageIndex, this)};CDLbl.prototype.checkPosition=function(aPositions){fCheckDLblPosition(this,aPositions)};CDLbl.prototype.setSettings=function(nPos,oProps){fCheckDLblSettings(this,nPos,oProps)};function CSeriesBase(){CBaseChartObject.call(this);this.idx=null;this.order=null;this.tx=null;this.spPr=null}InitClass(CSeriesBase,CBaseChartObject,AscDFH.historyitem_type_Unknown);CSeriesBase.prototype.updateData=function(displayEmptyCellsAs,displayHidden){if(this.val)this.val.update(displayEmptyCellsAs,displayHidden, this);if(this.yVal)this.yVal.update(displayEmptyCellsAs,displayHidden,this);if(this.cat)this.cat.update(this);if(this.xVal)this.xVal.update(this);if(this.tx)this.tx.update()};CSeriesBase.prototype.Refresh_RecalcData=function(oData){this.onChartUpdateType()};CSeriesBase.prototype.setIdx=function(val){if(this.idx!==val){if(History.CanAddChanges())History.Add(new CChangesDrawingsLong(this,AscDFH.historyitem_CommonSeries_SetIdx,this.idx,val));this.idx=val}};CSeriesBase.prototype.setOrder=function(val){if(this.order!== val){if(History.CanAddChanges())History.Add(new CChangesDrawingsLong(this,AscDFH.historyitem_CommonSeries_SetOrder,this.order,val));this.order=val}};CSeriesBase.prototype.setTx=function(val){History.CanAddChanges()&&History.Add(new CChangesDrawingsObject(this,AscDFH.historyitem_CommonSeries_SetTx,this.tx,val));this.tx=val;this.setParentToChild(val);this.onChangeDataRefs()};CSeriesBase.prototype.setSpPr=function(val){History.CanAddChanges()&&History.Add(new CChangesDrawingsObject(this,AscDFH.historyitem_CommonSeries_SetSpPr, this.spPr,val));this.spPr=val;this.setParentToChild(val)};CSeriesBase.prototype.getChildren=function(){return[this.spPr,this.tx,this.cat||this.xVal,this.val||this.yVal]};CSeriesBase.prototype.fillObject=function(oCopy,oIdMap){if(AscFormat.isRealNumber(this.idx))oCopy.setIdx(this.idx);if(AscFormat.isRealNumber(this.order))oCopy.setOrder(this.order);if(this.dLbls&&oCopy.setDLbls)oCopy.setDLbls(this.dLbls.createDuplicate());if(Array.isArray(this.dPt)&&this.dPt.length>0&&oCopy.addDPt)for(var nDpt=0;nDpt< this.dPt.length;++nDpt)oCopy.addDPt(this.dPt[nDpt].createDuplicate());if(AscCommon.isRealObject(this.spPr)){oCopy.setSpPr(this.spPr.createDuplicate());var nCopyType=oCopy.getObjectType();var nThisType=this.getObjectType();if(!(nCopyType===AscDFH.historyitem_type_LineSeries||nCopyType===AscDFH.historyitem_type_ScatterSer)&&(nThisType===AscDFH.historyitem_type_LineSeries||nThisType===AscDFH.historyitem_type_ScatterSer))if(oCopy.hasNoFill())oCopy.spPr.setFill(null);if((nCopyType===AscDFH.historyitem_type_LineSeries|| nCopyType===AscDFH.historyitem_type_ScatterSer)&&!(nThisType===AscDFH.historyitem_type_LineSeries||nThisType===AscDFH.historyitem_type_ScatterSer))if(oCopy.hasNoFillLine())oCopy.spPr.setLn(null)}if(AscCommon.isRealObject(this.tx))oCopy.setTx(this.tx.createDuplicate());var oCat=this.cat||this.xVal;if(AscCommon.isRealObject(oCat))oCopy.setCat(oCat.createDuplicate());var oVal=this.val||this.yVal;if(AscCommon.isRealObject(oVal))oCopy.setVal(oVal.createDuplicate())};CSeriesBase.prototype.getSeriesName= function(){if(this.tx){if(typeof this.tx.val==="string")return this.tx.val;if(this.tx.strRef&&this.tx.strRef.strCache&&AscFormat.isRealNumber(this.tx.strRef.strCache.ptCount)&&this.tx.strRef.strCache.ptCount>0){if(this.tx.strRef.strCache.pts.length>0)return this.tx.getText(false);return""}}return AscCommon.translateManager.getValue("Series")+" "+(this.idx+1)};CSeriesBase.prototype.handleUpdateFill=function(){this.onChartInternalUpdate()};CSeriesBase.prototype.handleUpdateLn=function(){this.onChartInternalUpdate()}; CSeriesBase.prototype.documentCreateFontMap=function(allFonts){this.dLbls&&this.dLbls.documentCreateFontMap(allFonts)};CSeriesBase.prototype.applyLabelsFunction=function(fCallback,value,oDD){this.dLbls&&this.dLbls.applyLabelsFunction(fCallback,value,oDD)};CSeriesBase.prototype.getAllRasterImages=function(images){this.spPr&&this.spPr.checkBlipFillRasterImage(images);this.dLbls&&this.dLbls.getAllRasterImages(images);this.marker&&this.marker.spPr&&this.marker.spPr.checkBlipFillRasterImage(images);if(this.dPt)for(var i= 0;i0&&AscFormat.isRealNumber(value))return Math.round(100*(value/summ))+"%"}return""};CSeriesBase.prototype.checkDlblsPosition=function(aPossiblePositions){if(this.dLbls)this.dLbls.checkPosition(aPossiblePositions)};CSeriesBase.prototype.isFiltered=function(){return!this.parent.isVisible(this)}; CSeriesBase.prototype.isVisible=function(){if(!this.parent)return true;return this.parent.getSeriesArrayIdx(this)>-1};CSeriesBase.prototype.setVisible=function(bVal){var oChart=this.parent;if(!oChart)return;if(bVal)if(this.isVisible())return;else{oChart.removeFilteredSeries(oChart.getFilteredSeriesArrayIdx(this));oChart.addSer(this)}else if(this.isVisible()){oChart.removeSeriesInternal(this.getSeriesArrayIdx(this));oChart.addFilteredSeries(this)}else return};CSeriesBase.prototype.getOrder=function(){return this.order}; CSeriesBase.prototype.setName=function(sName){var oResult;if(typeof sName==="string"&&sName.length>0){var oTx=new CTx;oResult=oTx.setValues(sName);if(oResult.isSuccessful()&&oTx.isValid())this.setTx(oTx);else{oResult=new CParseResult;this.setTx(null)}}else{oResult=new CParseResult;this.setTx(null)}return oResult.getError()};CSeriesBase.prototype.getName=function(){if(this.tx)return this.tx.getFormula();return""};CSeriesBase.prototype.setValues=function(sValues){var oResult;if(sValues===""||sValues=== null){oResult=new CParseResult;oResult.setError(Asc.c_oAscError.ID.NoValues);return oResult}var oVal=new CYVal;oResult=oVal.setValues(sValues);if(oVal.isValid())this.setVal(oVal);else{oResult=new CParseResult;oResult.setError(Asc.c_oAscError.ID.DataRangeError)}return oResult};CSeriesBase.prototype.setCategories=function(sValues){if(!this.setCat)return;var oResult;if(sValues===null||typeof sValues==="string"&&sValues.length===0){if(this.cat)this.setCat(null);oResult=new CParseResult;oResult.setError(Asc.c_oAscError.ID.No)}else{var oCat= new CCat;oResult=oCat.setValues(sValues);if(oCat.isValid())this.setCat(oCat);else{if(this.cat)this.setCat(null);oResult=new CParseResult;oResult.setError(Asc.c_oAscError.ID.DataRangeError)}}return oResult};CSeriesBase.prototype.getValues=function(nMaxValues){if(this.cat)return this.cat.getValues(nMaxValues);if(this.val){var ret=[];for(var nIndex=0;nIndex0)sDefaultValAxFormatCode=aPoints[0].formatCode;return sDefaultValAxFormatCode};CSeriesBase.prototype.setDlblsProps=function(oProps){if(!this.parent)return;var nPos=oProps.getDataLabelsPos();nPos=fCheckDLPostion(nPos,this.parent.getPossibleDLblsPosition()); if(!this.dLbls)this.setDLbls(new AscFormat.CDLbls);this.dLbls.setSettings(nPos,oProps);this.dLbls.checkChartStyle()};CSeriesBase.prototype.getCatSourceNumFormat=function(){var oCat=this.cat||this.xVal;if(!oCat)return"General";return oCat.getSourceNumFormat()};CSeriesBase.prototype.getValSourceNumFormat=function(){var oChart=this.parent;if(!oChart)return"General";if(oChart.getObjectType()===AscDFH.historyitem_type_BarChart){if(oChart.grouping===AscFormat.BAR_GROUPING_PERCENT_STACKED)return"0%"}else if(oChart.grouping=== AscFormat.GROUPING_PERCENT_STACKED)return"0%";return this.getValObjectSourceNumFormat(0)};CSeriesBase.prototype.getValObjectSourceNumFormat=function(nPtIdx){var oVal=this.val||this.yVal;if(!oVal)return"General";return oVal.getSourceNumFormat(nPtIdx)};CSeriesBase.prototype.handleOnChangeSheetName=function(sOldSheetName,sNewSheetName){if(this.val)this.val.handleOnChangeSheetName(sOldSheetName,sNewSheetName);if(this.yVal)this.yVal.handleOnChangeSheetName(sOldSheetName,sNewSheetName);if(this.cat)this.cat.handleOnChangeSheetName(sOldSheetName, sNewSheetName);if(this.xVal)this.xVal.handleOnChangeSheetName(sOldSheetName,sNewSheetName);if(this.tx)this.tx.handleOnChangeSheetName(sOldSheetName,sNewSheetName)};CSeriesBase.prototype.fillFromAscSeries=function(oAscSeries,bUseCache){var bIsScatter=this.isScatter();var oVal=new AscFormat.CYVal;if(bIsScatter)this.setYVal(oVal);else this.setVal(oVal);oVal.fillFromAsc(oAscSeries.Val,bUseCache);var oAscCat=oAscSeries.Cat;if(oAscCat&&typeof oAscCat.Formula==="string"&&oAscCat.Formula.length>0){var oCat= new CCat;if(bIsScatter)this.setXVal(oCat);else this.setCat(oCat);oCat.fillFromAsc(oAscCat,bUseCache)}var oAscTx=oAscSeries.TxCache;if(oAscTx&&typeof oAscTx.Formula==="string"&&oAscTx.Formula.length>0){this.setTx(new CTx);this.tx.fillFromAsc(oAscTx,bUseCache)}};CSeriesBase.prototype.getNumLit=function(){if(this.val)if(this.val.numRef&&this.val.numRef.numCache)return this.val.numRef.numCache;else{if(this.val.numLit)return this.val.numLit}else if(this.yVal)if(this.yVal.numRef&&this.yVal.numRef.numCache)return this.yVal.numRef.numCache; else if(this.yVal.numLit)return this.yVal.numLit;return null};CSeriesBase.prototype.getNumPts=function(){var oNumLit=this.getNumLit();if(oNumLit)return oNumLit.pts;return[]};CSeriesBase.prototype.hasNoFillLine=function(){if(this.spPr)return this.spPr.hasNoFillLine();return false};CSeriesBase.prototype.hasNoFill=function(){if(this.spPr)return this.spPr.hasNoFill();return false};CSeriesBase.prototype.checkR1C1ModeForExternal=function(sFormula){var bR1C1Mode=false;if(typeof AscCommonExcel==="object"&& AscCommonExcel!==null)bR1C1Mode=AscCommonExcel.g_R1C1Mode;if(!bR1C1Mode)return sFormula;else{var aRefs=fParseChartFormula(sFormula);if(!Array.isArray(aRefs)||aRefs.length===0)return sFormula;else{var oDataRefs=new CDataRefs(aRefs);return oDataRefs.getDataRange()}}return sFormula};CSeriesBase.prototype.isVaryColors=function(){if(!this.parent)return false;return this.parent.varyColors===true};CSeriesBase.prototype.getDataStyleEntry=function(oChartStyle){return oChartStyle.getDataEntry(this)};CSeriesBase.prototype.getDptByIdx= function(idx){if(Array.isArray(this.dPt))for(var i=0;i-1;--nDPt){oDPt=this.dPt[nDPt];if(oDPt.idx>=nDPtCount)this.removeDPt(nDPt)}}this.resetOwnFormatting()}else{nColorsCount= this.getMaxSeriesIdx()+1;aColors=oColors.generateColors(nColorsCount);this.removeAllDPts();this.applyStyleEntry(oDataStyleEntry,aColors,this.idx,bReset)}if(bMarkerChart){this.setMarker(new CMarker);if(this.marker)this.marker.applyChartStyle(oChartStyle,oColors,oAdditionalData,bReset)}if(bResetLine){if(!this.spPr)this.setSpPr(new AscFormat.CSpPr);this.spPr.setLn(AscFormat.CreateNoFillLine())}};CSeriesBase.prototype.getMaxSeriesIdx=function(){if(!this.parent)return-1;return this.parent.getMaxSeriesIdx()}; CSeriesBase.prototype.removeAllDPts=function(){if(Array.isArray(this.dPt))for(var nDPt=this.dPt.length-1;nDPt>-1;--nDPt)this.removeDPt(nDPt)};CSeriesBase.prototype.removeDPt=function(idx){if(!Array.isArray(this.dPt))return;if(this.dPt[idx]){var arrPt=this.dPt.splice(idx,1);History.CanAddChanges()&&History.Add(new CChangesDrawingsContent(this,AscDFH.historyitem_CommonSeries_RemoveDPt,idx,arrPt,false));arrPt[0].setParent(null)}};CSeriesBase.prototype.asc_getName=function(){var oThis=this;return AscFormat.ExecuteNoHistory(function(){return oThis.checkR1C1ModeForExternal(oThis.getName())}, this,[])};CSeriesBase.prototype["asc_getName"]=CSeriesBase.prototype.asc_getName;CSeriesBase.prototype.asc_getNameVal=function(){return AscFormat.ExecuteNoHistory(function(){if(this.tx)return this.tx.getText(false);return""},this,[])};CSeriesBase.prototype["asc_getNameVal"]=CSeriesBase.prototype.asc_getNameVal;CSeriesBase.prototype.asc_getSeriesName=function(){return this.getSeriesName()};CSeriesBase.prototype["asc_getSeriesName"]=CSeriesBase.prototype.asc_getSeriesName;CSeriesBase.prototype.asc_setName= function(sName){var oChartSpace=this.getChartSpace();if(!oChartSpace)return;this.setName(sName);oChartSpace.onDataUpdate()};CSeriesBase.prototype["asc_setName"]=CSeriesBase.prototype.asc_setName;CSeriesBase.prototype.asc_IsValidName=function(sName){return AscFormat.ExecuteNoHistory(function(){if(sName===""||sName===null)return Asc.c_oAscError.ID.No;var oTx=new CTx;return oTx.setValues(sName).getError()},this,[])};CSeriesBase.prototype["asc_IsValidName"]=CSeriesBase.prototype.asc_IsValidName;CSeriesBase.prototype.asc_setValues= function(sValues){var oChartSpace=this.getChartSpace();if(!oChartSpace)return;this.setValues(sValues);oChartSpace.onDataUpdate()};CSeriesBase.prototype["asc_setValues"]=CSeriesBase.prototype.asc_setValues;CSeriesBase.prototype.asc_IsValidValues=function(sValues){return AscFormat.ExecuteNoHistory(function(){if(sValues===""||sValues===null)return Asc.c_oAscError.ID.NoValues;var oVal=new CYVal;return oVal.setValues(sValues).getError()},this,[])};CSeriesBase.prototype["asc_IsValidValues"]=CSeriesBase.prototype.asc_IsValidValues; CSeriesBase.prototype.asc_getValues=function(){var oThis=this;return AscFormat.ExecuteNoHistory(function(){return oThis.checkR1C1ModeForExternal(oThis.val.getFormula())},this,[])};CSeriesBase.prototype["asc_getValues"]=CSeriesBase.prototype.asc_getValues;CSeriesBase.prototype.asc_getValuesArr=function(){return AscFormat.ExecuteNoHistory(function(){return this.val.getValues(this.val.getValuesCount())},this,[])};CSeriesBase.prototype["asc_getValuesArr"]=CSeriesBase.prototype.asc_getValuesArr;CSeriesBase.prototype.asc_setXValues= function(sValues){var oChartSpace=this.getChartSpace();if(!oChartSpace)return;this.setXValues(sValues);oChartSpace.onDataUpdate()};CSeriesBase.prototype["asc_setXValues"]=CSeriesBase.prototype.asc_setXValues;CSeriesBase.prototype.asc_IsValidXValues=function(sValues){return AscFormat.ExecuteNoHistory(function(){if(sValues===""||sValues===null)return Asc.c_oAscError.ID.No;else{var oCat=new CCat;return oCat.setValues(sValues).getError()}},this,[])};CSeriesBase.prototype["asc_IsValidXValues"]=CSeriesBase.prototype.asc_IsValidXValues; CSeriesBase.prototype.asc_getCatValues=function(){var oThis=this;return AscFormat.ExecuteNoHistory(function(){if(oThis.cat)return oThis.checkR1C1ModeForExternal(oThis.cat.getFormula());else return""},this,[])};CSeriesBase.prototype["asc_getCatValues"]=CSeriesBase.prototype.asc_getCatValues;CSeriesBase.prototype.asc_getXValues=function(){var oThis=this;return AscFormat.ExecuteNoHistory(function(){if(oThis.xVal)return oThis.checkR1C1ModeForExternal(oThis.xVal.getFormula());else return""},this,[])}; CSeriesBase.prototype["asc_getXValues"]=CSeriesBase.prototype.asc_getXValues;CSeriesBase.prototype.asc_getXValuesArr=function(){return AscFormat.ExecuteNoHistory(function(){if(this.xVal)return this.xVal.getValues();return[]},this,[])};CSeriesBase.prototype["asc_getXValuesArr"]=CSeriesBase.prototype.asc_getXValuesArr;CSeriesBase.prototype.asc_setYValues=function(sValues){var oChartSpace=this.getChartSpace();if(!oChartSpace)return;this.setYValues(sValues);oChartSpace.onDataUpdate()};CSeriesBase.prototype["asc_setYValues"]= CSeriesBase.prototype.asc_setYValues;CSeriesBase.prototype.asc_IsValidYValues=function(sValues){return this.asc_IsValidValues(sValues)};CSeriesBase.prototype["asc_IsValidYValues"]=CSeriesBase.prototype.asc_IsValidYValues;CSeriesBase.prototype.asc_getYValues=function(){var oThis=this;return AscFormat.ExecuteNoHistory(function(){if(oThis.yVal)return oThis.checkR1C1ModeForExternal(oThis.yVal.getFormula());else return""},this,[])};CSeriesBase.prototype["asc_getYValues"]=CSeriesBase.prototype.asc_getYValues; CSeriesBase.prototype.asc_getYValuesArr=function(){return AscFormat.ExecuteNoHistory(function(){if(this.yVal)return this.yVal.getValues();return[]},this,[])};CSeriesBase.prototype["asc_getYValuesArr"]=CSeriesBase.prototype.asc_getYValuesArr;CSeriesBase.prototype.asc_Remove=function(){var oChartSpace=this.getChartSpace();if(!oChartSpace)return;History.Create_NewPoint(0);this.remove();oChartSpace.onDataUpdate()};CSeriesBase.prototype["asc_Remove"]=CSeriesBase.prototype.asc_Remove;CSeriesBase.prototype.isScatter= function(){return this.getObjectType()===AscDFH.historyitem_type_ScatterSer};CSeriesBase.prototype.asc_IsScatter=function(){return this.isScatter()};CSeriesBase.prototype["asc_IsScatter"]=CSeriesBase.prototype.asc_IsScatter;CSeriesBase.prototype.asc_getOrder=function(){return this.getOrder()};CSeriesBase.prototype["asc_getOrder"]=CSeriesBase.prototype.asc_getOrder;CSeriesBase.prototype.asc_setOrder=function(nVal){var oChartSpace=this.getChartSpace();if(!oChartSpace)return;History.Create_NewPoint(0); this.setOrder(nVal);oChartSpace.onDataUpdate()};CSeriesBase.prototype["asc_setOrder"]=CSeriesBase.prototype.asc_setOrder;CSeriesBase.prototype.asc_getIdx=function(){return this.idx};CSeriesBase.prototype["asc_getIdx"]=CSeriesBase.prototype.asc_getIdx;CSeriesBase.prototype.asc_MoveUp=function(){var oChartSpace=this.getChartSpace();if(!oChartSpace)return;if(!this.parent)return;History.Create_NewPoint(0);this.parent.moveSeriesUp(this);oChartSpace.onDataUpdate()};CSeriesBase.prototype["asc_MoveUp"]=CSeriesBase.prototype.asc_MoveUp; CSeriesBase.prototype.asc_MoveDown=function(){var oChartSpace=this.getChartSpace();if(!oChartSpace)return;if(!this.parent)return;History.Create_NewPoint(0);this.parent.moveSeriesDown(this);oChartSpace.onDataUpdate()};CSeriesBase.prototype["asc_MoveDown"]=CSeriesBase.prototype.asc_MoveDown;CSeriesBase.prototype.onDataUpdate=function(){if(!this.parent)return;this.parent.onDataUpdate()};CSeriesBase.prototype.asc_getChartType=function(){if(this.parent)return this.parent.getChartType();return Asc.c_oAscChartTypeSettings.unknown}; CSeriesBase.prototype["asc_getChartType"]=CSeriesBase.prototype.asc_getChartType;CSeriesBase.prototype.getPreviewBrush=function(){if(this.compiledSeriesBrush)return this.compiledSeriesBrush;return null};CSeriesBase.prototype.drawPreviewRect=function(sDivId){var oCanvas=AscCommon.checkCanvasInDiv(sDivId);if(!oCanvas)return;var oContext=oCanvas.getContext("2d");if(!oContext)return;var dMMW=oCanvas.width/96*25.4;var dMMH=oCanvas.height/96*25.4;oContext.clearRect(0,0,oCanvas.width,oCanvas.height);var oGraphics= new AscCommon.CGraphics;oGraphics.init(oContext,oCanvas.width,oCanvas.height,dMMW,dMMH);oGraphics.m_oFontManager=AscCommon.g_fontManager;oGraphics.transform(1,0,0,1,0,0);oGraphics.SaveGrState();oGraphics.SetIntegerGrid(false);var ShapeDrawer=new AscCommon.CShapeDrawer;ShapeDrawer.fromShape2(new AscFormat.ObjectToDraw(this.getPreviewBrush(),null,dMMW,dMMH,null,new AscCommon.CMatrix),oGraphics,null);ShapeDrawer.draw(null);oGraphics.RestoreGrState()};CSeriesBase.prototype.asc_drawPreviewRect=function(sDivId){this.drawPreviewRect(sDivId)}; CSeriesBase.prototype["asc_drawPreviewRect"]=CSeriesBase.prototype.asc_drawPreviewRect;CSeriesBase.prototype.isSecondaryAxis=function(){if(this.parent)return this.parent.isSecondaryAxis();return false};CSeriesBase.prototype.asc_getIsSecondaryAxis=function(){return this.isSecondaryAxis()};CSeriesBase.prototype["asc_getIsSecondaryAxis"]=CSeriesBase.prototype.asc_getIsSecondaryAxis;CSeriesBase.prototype.canChangeAxisType=function(){if(!this.parent)return false;return this.parent.canChangeAxisType()}; CSeriesBase.prototype.asc_canChangeAxisType=function(){return this.canChangeAxisType()};CSeriesBase.prototype["asc_canChangeAxisType"]=CSeriesBase.prototype.asc_canChangeAxisType;CSeriesBase.prototype.tryChangeSeriesAxisType=function(bIsSecondary){if(!this.parent)return Asc.c_oAscError.ID.No;if(!this.canChangeAxisType())return Asc.c_oAscError.ID.No;return this.parent.tryChangeSeriesAxisType(this,bIsSecondary)};CSeriesBase.prototype.asc_TryChangeAxisType=function(bIsSecondary){var oChartSpace=this.getChartSpace(); if(!oChartSpace)return;History.Create_NewPoint(0);var nRes=this.tryChangeSeriesAxisType(bIsSecondary);if(nRes===Asc.c_oAscError.ID.No)oChartSpace.onDataUpdate();return nRes};CSeriesBase.prototype["asc_TryChangeAxisType"]=CSeriesBase.prototype.asc_TryChangeAxisType;CSeriesBase.prototype.tryChangeChartType=function(nType){if(!this.parent)return Asc.c_oAscError.ID.No;return this.parent.tryChangeSeriesChartType(this,nType)};CSeriesBase.prototype.asc_TryChangeChartType=function(nType){var oChartSpace= this.getChartSpace();if(!oChartSpace)return;History.Create_NewPoint(0);var nRes=this.tryChangeChartType(nType);if(nRes===Asc.c_oAscError.ID.No)oChartSpace.onDataUpdate();return nRes};CSeriesBase.prototype["asc_TryChangeChartType"]=CSeriesBase.prototype.asc_TryChangeChartType;function CPlotArea(){CBaseChartObject.call(this);this.charts=[];this.dTable=null;this.layout=null;this.spPr=null;this.axId=[];this.valAx=null;this.catAx=null;this.serAx=null;this.dateAx=null;this.chart=null;this.posX=0;this.posY= 0;this.x=0;this.y=0;this.rot=0;this.extX=5;this.extY=5;this.localTransform=new AscCommon.CMatrix;this.transform=new AscCommon.CMatrix;this.invertTransform=new AscCommon.CMatrix}InitClass(CPlotArea,CBaseChartObject,AscDFH.historyitem_type_PlotArea);CPlotArea.prototype.Refresh_RecalcData=function(data){switch(data.Type){case AscDFH.historyitem_CommonChartFormat_SetParent:{break}case AscDFH.historyitem_PlotArea_RemoveAxis:{break}case AscDFH.historyitem_PlotArea_RemoveChart:case AscDFH.historyitem_PlotArea_AddChart:{this.onChartUpdateType(); this.onChangeDataRefs();break}case AscDFH.historyitem_PlotArea_SetCatAx:{break}case AscDFH.historyitem_PlotArea_SetDateAx:{break}case AscDFH.historyitem_PlotArea_SetDTable:{break}case AscDFH.historyitem_PlotArea_SetLayout:{break}case AscDFH.historyitem_PlotArea_SetSerAx:{break}case AscDFH.historyitem_PlotArea_SetSpPr:{break}case AscDFH.historyitem_PlotArea_SetValAx:{break}case AscDFH.historyitem_PlotArea_AddAxis:{break}}};CPlotArea.prototype.Refresh_RecalcData2=function(data){if(this.parent)this.parent.Refresh_RecalcData2(data)}; CPlotArea.prototype.checkShapeChildTransform=function(t){this.transform=this.localTransform.CreateDublicate();global_MatrixTransformer.MultiplyAppend(this.transform,t);this.invertTransform=global_MatrixTransformer.Invert(this.transform)};CPlotArea.prototype.updatePosition=function(x,y){this.posX=x;this.posY=y;this.transform=this.localTransform.CreateDublicate();global_MatrixTransformer.TranslateAppend(this.transform,x,y);this.invertTransform=global_MatrixTransformer.Invert(this.transform)};CPlotArea.prototype.getChildren= function(){var aRet=[this.dTable,this.layout,this.spPr];for(var nAx=0;nAx0&& (oAxes.catAx.length>0||oAxes.dateAx.length>0))return oChart;else return null}}}return null};CPlotArea.prototype.addAxis=function(axis){if(!axis)return;var i;for(i=0;i=startPos;--i)this.removeChartByPos(i)};CPlotArea.prototype.removeAxisByPos=function(nPos){if(nPos>-1&&nPos-1;--i)if(this.axId[i]===axis)this.removeAxisByPos(i)};CPlotArea.prototype.setDTable=function(pr){History.CanAddChanges()&&History.Add(new CChangesDrawingsObject(this,AscDFH.historyitem_PlotArea_SetDTable,this.dTable,pr));this.dTable=pr;this.setParentToChild(pr)};CPlotArea.prototype.setLayout=function(pr){History.CanAddChanges()&&History.Add(new CChangesDrawingsObject(this,AscDFH.historyitem_PlotArea_SetLayout,this.layout,pr));this.layout=pr;this.setParentToChild(pr)};CPlotArea.prototype.setSpPr= function(pr){History.CanAddChanges()&&History.Add(new CChangesDrawingsObject(this,AscDFH.historyitem_PlotArea_SetSpPr,this.spPr,pr));this.spPr=pr;this.setParentToChild(pr)};CPlotArea.prototype.getHorizontalAxis=function(){if(this.charts[0]){var aAxes=this.charts[0].axId;if(aAxes)for(var i=0;i0){if(this.charts.length>1){if(this.charts.length===2){var oFirstChart=this.charts[0];var oSecondChart=this.charts[1];if(oFirstChart.getChartType()===Asc.c_oAscChartTypeSettings.barNormal&&oSecondChart.getChartType()===Asc.c_oAscChartTypeSettings.lineNormal){if(!oFirstChart.isSecondaryAxis())if(!oSecondChart.isSecondaryAxis())return Asc.c_oAscChartTypeSettings.comboBarLine; else return Asc.c_oAscChartTypeSettings.comboBarLineSecondary}else if(oFirstChart.getChartType()===Asc.c_oAscChartTypeSettings.areaNormal&&oSecondChart.getChartType()===Asc.c_oAscChartTypeSettings.barNormal)if(!oFirstChart.isSecondaryAxis())if(!oSecondChart.isSecondaryAxis())return Asc.c_oAscChartTypeSettings.comboAreaBar}return Asc.c_oAscChartTypeSettings.comboCustom}return this.charts[0].getChartType()}return Asc.c_oAscChartTypeSettings.unknown};CPlotArea.prototype.addChartWithAxes=function(oTypedChart){this.removeAllCharts(); this.removeAllAxes();this.addChart(oTypedChart,0);var aAxes=oTypedChart.axId;if(Array.isArray(aAxes))for(var nAx=0;nAx>0;aFirstChartSeries=aSeries.slice(0,nLength);aSecondChartSeries=aSeries.slice(nLength); if(nType===Asc.c_oAscChartTypeSettings.comboBarLine||nType===Asc.c_oAscChartTypeSettings.comboBarLineSecondary||nType===Asc.c_oAscChartTypeSettings.comboCustom){aAllAxes=aFirstAxes=aSecondAxes=this.createRegularAxes(this.getAxisNumFormatByType(Asc.c_oAscChartTypeSettings.barNormal,aFirstChartSeries),false);if(nType===Asc.c_oAscChartTypeSettings.comboBarLineSecondary){aSecondAxes=this.createRegularAxes(this.getAxisNumFormatByType(Asc.c_oAscChartTypeSettings.lineNormal,aSecondChartSeries),true);aAllAxes= aAllAxes.concat(aSecondAxes)}oTypedChart=this.charts[0];oBarChart=this.createBarChart(Asc.c_oAscChartTypeSettings.barNormal,aFirstChartSeries,aFirstAxes,oTypedChart);oLineChart=this.createLineChart(Asc.c_oAscChartTypeSettings.lineNormal,aSecondChartSeries,aSecondAxes,oTypedChart);aAllCharts.push(oBarChart);aAllCharts.push(oLineChart)}else if(nType===Asc.c_oAscChartTypeSettings.comboAreaBar){aAllAxes=aFirstAxes=aSecondAxes=this.createRegularAxes(this.getAxisNumFormatByType(Asc.c_oAscChartTypeSettings.barNormal, aFirstChartSeries),false);oTypedChart=this.charts[0];oAreaChart=this.createAreaChart(Asc.c_oAscChartTypeSettings.areaStacked,aFirstChartSeries,aFirstAxes,oTypedChart);oBarChart=this.createBarChart(Asc.c_oAscChartTypeSettings.barNormal,aSecondChartSeries,aSecondAxes,oTypedChart);aAllCharts.push(oAreaChart);aAllCharts.push(oBarChart)}if(aAllCharts.length>0){this.removeAllCharts();this.removeAllAxes();for(nChart=0;nChart=nEnd;--nAxIdx)this.removeAxisByPos(nAxIdx)};CPlotArea.prototype.checkDlblsPosition=function(){var aCharts=this.charts;for(var nChart=0;nChart0)for(var nChart=1;nChart-1;--nPos){nLblPos=aPositions[nPos];for(var nCurPos=0;nCurPos1)aRet.push(aCross)}return aRet};CPlotArea.prototype.getCatValMergeAxes=function(){var aCrosses=this.getAxesCrosses();var aCross=aCrosses[0];var oCatAxMerge=null,oValAxMerge=null,oAxis,nAx;if(aCross){for(nAx=0;nAx 1)this.parent.removeChart(this)};CChartBase.prototype.removeAllSeries=function(){for(var nSeries=this.series.length-1;nSeries>-1;--nSeries)this.removeSeriesInternal(nSeries)};CChartBase.prototype.reindexSeries=function(){if(this.parent)this.parent.reindexSeries()};CChartBase.prototype.reorderSeries=function(){if(this.parent)this.parent.reorderSeries()};CChartBase.prototype.moveSeriesUp=function(oSeries){if(this.parent)this.parent.moveSeriesUp(oSeries)};CChartBase.prototype.moveSeriesDown=function(oSeries){if(this.parent)this.parent.moveSeriesDown(oSeries)}; CChartBase.prototype.sortSeries=function(){var aAllSeries=[].concat(this.series);this.removeAllSeries();aAllSeries.sort(function(a,b){return a.order-b.order});for(var nSeries=0;nSeries0)if(aChartsSAxes.length===1&&aChartsSAxes[0]===this&&this.series.length===1){this.removeSeries(this.getSeriesArrayIdx(oSeries));bCreateAxes=true}else nResult=Asc.c_oAscError.ID.SecondaryAxis;else bCreateAxes=true;if(bCreateAxes){if(oPlotArea.isScatterType(nType))aNewAxes=oPlotArea.createScatterAxes(true);else if(oPlotArea.isHBarType(nType))aNewAxes=oPlotArea.createHBarAxes(oPlotArea.getAxisNumFormatByType(nType,[oSeries]),true);else aNewAxes=oPlotArea.createRegularAxes(oPlotArea.getAxisNumFormatByType(nType, [oSeries]),true);oPlotArea.addAxes(aNewAxes)}}if(aNewAxes.length>0)if(oPlotArea.isHBarType(nType)||oPlotArea.isBarType(nType))oNewChart=oPlotArea.createBarChart(nType,[oSeries],aNewAxes,this);else if(oPlotArea.isLineType(nType))oNewChart=oPlotArea.createLineChart(nType,[oSeries],aNewAxes,this);else if(oPlotArea.isAreaType(nType))oNewChart=oPlotArea.createAreaChart(nType,[oSeries],aNewAxes,this);else if(oPlotArea.isScatterType(nType))oNewChart=oPlotArea.createScatterChart(nType,[oSeries],aNewAxes, this);else if(oPlotArea.isStockChart(nType))oNewChart=oPlotArea.createStockChart(nType,[oSeries],aNewAxes,this)}if(oNewChart){this.removeSeries(this.getSeriesArrayIdx(oSeries));oPlotArea.addChart(oNewChart,null);nResult=Asc.c_oAscError.ID.No}return nResult};CChartBase.prototype.tryChangeSeriesChartType=function(oSeries,nType){if(!this.parent)return Asc.c_oAscError.ID.No;if(this.tryChangeType(nType))return Asc.c_oAscError.ID.No;var bIsSecondaryAxis=this.isSecondaryAxis();if(this.tryMoveSeries(oSeries, nType,bIsSecondaryAxis,false))return Asc.c_oAscError.ID.No;var nRes=this.tryCreateNewChartFormSeries(oSeries,nType,bIsSecondaryAxis);if(nRes===Asc.c_oAscError.ID.No)return nRes;if(this.tryMoveSeries(oSeries,nType,!bIsSecondaryAxis,true))return Asc.c_oAscError.ID.No;return this.tryCreateNewChartFormSeries(oSeries,nType,!bIsSecondaryAxis)};CChartBase.prototype.tryChangeSeriesAxisType=function(oSeries,bIsSecondaryAxis){if(this.isSecondaryAxis()===bIsSecondaryAxis)return Asc.c_oAscError.ID.No;if(!this.parent)return Asc.c_oAscError.ID.No; var nChartType=this.getChartType();if(this.tryMoveSeries(oSeries,nChartType,bIsSecondaryAxis,false))return Asc.c_oAscError.ID.No;return this.tryCreateNewChartFormSeries(oSeries,this.getChartType(),bIsSecondaryAxis)};CChartBase.prototype.tryChangeType=function(nNewType){if(!this.parent)return false;return this.getChartType()===nNewType};CChartBase.prototype.remove=function(){if(!this.parent)return;var nChart;var aCharts=this.parent.charts;for(nChart=0;nChart>0);bChanged=true}if(this.crossAx!==null){this.crossAx.setCrosses(null);bChanged=true}}}else if(crossesRule===c_oAscCrossesRule.maxValue){if(this.crossAx.crossesAt!==null){this.crossAx.setCrossesAt(null);bChanged=true}if(this.crossAx.crosses!==CROSSES_MAX){this.crossAx.setCrosses(CROSSES_MAX);bChanged=true}}else if(crossesRule===c_oAscCrossesRule.minValue){if(this.crossAx.crossesAt!==null){this.crossAx.setCrossesAt(null);bChanged=true}if(this.crossAx.crosses!== CROSSES_MIN){this.crossAx.setCrosses(CROSSES_MIN);bChanged=true}}if(AscFormat.isRealNumber(labelsPosition)&&isRealObject(this.crossAx)&&this.crossAx.setCrossBetween){var new_lbl_position=labelsPosition===c_oAscLabelsPosition.byDivisions?CROSS_BETWEEN_MID_CAT:CROSS_BETWEEN_BETWEEN;if(this.crossAx.crossBetween!==new_lbl_position){this.crossAx.setCrossBetween(new_lbl_position);bChanged=true}}if(props.getShow()!==null){var bDelete=!props.getShow();if(bDelete!==this.bDelete)this.setDelete(bDelete)}var nGridlines= props.getGridlines();if(nGridlines!==null)this.setGridlinesSetting(nGridlines);this.setLabelSetting(props.getLabel());var oAscFmt=props.getNumFmt();if(oAscFmt&&oAscFmt.isCorrect()){var oNumFmt=this.numFmt||new AscFormat.CNumFmt;oNumFmt.setFromAscObject(oAscFmt);if(!this.numFmt)this.setNumFmt(oNumFmt)}this.setAuto(props.getAuto())};CCatAx.prototype.setAuto=function(pr){History.CanAddChanges()&&History.Add(new CChangesDrawingsBool(this,AscDFH.historyitem_CatAxSetAuto,this.auto,pr));this.auto=pr;this.onUpdate()}; CCatAx.prototype.setLblAlgn=function(pr){History.CanAddChanges()&&History.Add(new CChangesDrawingsLong(this,AscDFH.historyitem_CatAxSetLblAlgn,this.lblAlgn,pr));this.lblAlgn=pr;this.onUpdate()};CCatAx.prototype.setLblOffset=function(pr){History.CanAddChanges()&&History.Add(new CChangesDrawingsLong(this,AscDFH.historyitem_CatAxSetLblOffset,this.lblOffset,pr));this.lblOffset=pr;this.onUpdate()};CCatAx.prototype.setNoMultiLvlLbl=function(pr){History.CanAddChanges()&&History.Add(new CChangesDrawingsBool(this, AscDFH.historyitem_CatAxSetNoMultiLvlLbl,this.noMultiLvlLbl,pr));this.noMultiLvlLbl=pr;this.onUpdate()};CCatAx.prototype.setTickLblSkip=function(pr){History.CanAddChanges()&&History.Add(new CChangesDrawingsLong(this,AscDFH.historyitem_CatAxSetTickLblSkip,this.tickLblSkip,pr));this.tickLblSkip=pr;this.onUpdate()};CCatAx.prototype.setTickMarkSkip=function(pr){History.CanAddChanges()&&History.Add(new CChangesDrawingsLong(this,AscDFH.historyitem_CatAxSetTickMarkSkip,this.tickMarkSkip,pr));this.tickMarkSkip= pr;this.onUpdate()};CCatAx.prototype.merge=function(oAxis){this.mergeBase(oAxis);if(AscFormat.isRealBool(oAxis.auto))this.setAuto(oAxis.auto);if(AscFormat.isRealNumber(oAxis.lblAlgn))this.setLblAlgn(oAxis.lblAlgn);if(AscFormat.isRealNumber(oAxis.lblOffset))this.setLblOffset(oAxis.lblOffset);if(AscFormat.isRealBool(oAxis.noMultiLvlLbl))this.setNoMultiLvlLbl(oAxis.noMultiLvlLbl);if(AscFormat.isRealNumber(oAxis.tickLblSkip))this.setTickLblSkip(oAxis.tickLblSkip);if(AscFormat.isRealNumber(oAxis.tickMarkSkip))this.setTickMarkSkip(oAxis.tickMarkSkip)}; CCatAx.prototype.getSourceFormatCode=function(){var oPlotArea=this.getPlotArea();var sDefault="General";if(!oPlotArea)return sDefault;var oSeries=oPlotArea.getSeriesWithSmallestIndexForAxis(this);if(!oSeries)return sDefault;return oSeries.getCatSourceNumFormat()};CCatAx.prototype.applyChartStyle=function(oChartStyle,oColors,oAdditionalData,bReset){if(!this.parent)return;if(bReset&&oAdditionalData)this.applyAdditionalSettings(oAdditionalData.catAx);this.applyStyleEntry(oChartStyle.categoryAxis,oColors.generateColors(1), 0,bReset);CAxisBase.prototype.applyChartStyle.call(this,oChartStyle,oColors,oAdditionalData,bReset)};function CDateAx(){CAxisBase.call(this);this.auto=null;this.baseTimeUnit=null;this.extLst=null;this.lblOffset=null;this.majorTimeUnit=null;this.majorUnit=null;this.minorTimeUnit=null;this.minorUnit=null}InitClass(CDateAx,CAxisBase,AscDFH.historyitem_type_DateAx);CDateAx.prototype.getMenuProps=function(){var oProps=CCatAx.prototype.getMenuProps.call(this);oProps.putAxisType(c_oAscAxisType.date);return oProps}; CDateAx.prototype.setMenuProps=CCatAx.prototype.setMenuProps;CDateAx.prototype.setAuto=function(pr){History.CanAddChanges()&&History.Add(new CChangesDrawingsBool(this,AscDFH.historyitem_DateAxAuto,this.auto,pr));this.auto=pr;this.onUpdate()};CDateAx.prototype.setBaseTimeUnit=function(pr){History.CanAddChanges()&&History.Add(new CChangesDrawingsDouble(this,AscDFH.historyitem_DateAxBaseTimeUnit,this.baseTimeUnit,pr));this.baseTimeUnit=pr;this.onUpdate()};CDateAx.prototype.setLblOffset=function(pr){History.CanAddChanges()&& History.Add(new CChangesDrawingsLong(this,AscDFH.historyitem_DateAxLblOffset,this.lblOffset,pr));this.lblOffset=pr;this.onUpdate()};CDateAx.prototype.setMajorTimeUnit=function(pr){History.CanAddChanges()&&History.Add(new CChangesDrawingsDouble(this,AscDFH.historyitem_DateAxMajorTimeUnit,this.majorTimeUnit,pr));this.majorTimeUnit=pr;this.onUpdate()};CDateAx.prototype.setMajorUnit=function(pr){History.CanAddChanges()&&History.Add(new CChangesDrawingsDouble(this,AscDFH.historyitem_DateAxMajorUnit,this.majorUnit, pr));this.majorUnit=pr;this.onUpdate()};CDateAx.prototype.setMinorTimeUnit=function(pr){History.CanAddChanges()&&History.Add(new CChangesDrawingsDouble(this,AscDFH.historyitem_DateAxMinorTimeUnit,this.minorTimeUnit,pr));this.minorTimeUnit=pr;this.onUpdate()};CDateAx.prototype.setMinorUnit=function(pr){History.CanAddChanges()&&History.Add(new CChangesDrawingsDouble(this,AscDFH.historyitem_DateAxMinorUnit,this.minorUnit,pr));this.minorUnit=pr;this.onUpdate()};CDateAx.prototype.merge=function(oAxis){this.mergeBase(oAxis); if(AscFormat.isRealNumber(oAxis.baseTimeUnit))this.setBaseTimeUnit(oAxis.baseTimeUnit);if(AscFormat.isRealNumber(oAxis.majorTimeUnit))this.setMajorTimeUnit(oAxis.majorTimeUnit);if(AscFormat.isRealNumber(oAxis.majorUnit))this.setMajorUnit(oAxis.majorUnit);if(AscFormat.isRealNumber(oAxis.minorTimeUnit))this.setMinorTimeUnit(oAxis.minorTimeUnit);if(AscFormat.isRealNumber(oAxis.minorUnit))this.setMinorUnit(oAxis.minorUnit);if(AscFormat.isRealBool(oAxis.auto))this.setAuto(oAxis.auto);if(AscFormat.isRealNumber(oAxis.lblOffset))this.setLblOffset(oAxis.lblOffset)}; CDateAx.prototype.getSourceFormatCode=function(){return CCatAx.prototype.getSourceFormatCode.call(this)};CDateAx.prototype.applyChartStyle=function(oChartStyle,oColors,oAdditionalData,bReset){if(!this.parent)return;if(bReset&&oAdditionalData)this.applyAdditionalSettings(oAdditionalData.catAx);this.applyStyleEntry(oChartStyle.categoryAxis,oColors.generateColors(1),0,bReset);CAxisBase.prototype.applyChartStyle.call(this,oChartStyle,oColors,oAdditionalData,bReset)};function CSerAx(){CAxisBase.call(this); this.extLst=null;this.tickLblSkip=null;this.tickMarkSkip=null}InitClass(CSerAx,CAxisBase,AscDFH.historyitem_type_SerAx);CSerAx.prototype.getMenuProps=CCatAx.prototype.getMenuProps;CSerAx.prototype.setMenuProps=CCatAx.prototype.setMenuProps;CSerAx.prototype.setTickLblSkip=function(pr){History.CanAddChanges()&&History.Add(new CChangesDrawingsLong(this,AscDFH.historyitem_SerAxSetTickLblSkip,this.tickLblSkip,pr));this.tickLblSkip=pr;this.onUpdate()};CSerAx.prototype.setTickMarkSkip=function(pr){History.CanAddChanges()&& History.Add(new CChangesDrawingsLong(this,AscDFH.historyitem_SerAxSetTickMarkSkip,this.tickMarkSkip,pr));this.tickMarkSkip=pr;this.onUpdate()};CSerAx.prototype.merge=function(oAxis){this.mergeBase(oAxis);if(AscFormat.isRealNumber(oAxis.tickLblSkip))this.setTickLblSkip(oAxis.tickLblSkip);if(AscFormat.isRealNumber(oAxis.tickMarkSkip))this.setTickMarkSkip(oAxis.tickMarkSkip)};CSerAx.prototype.applyChartStyle=function(oChartStyle,oColors,oAdditionalData,bReset){if(!this.parent)return;this.applyStyleEntry(oChartStyle.seriesAxis, oColors.generateColors(1),0,bReset);CAxisBase.prototype.applyChartStyle.call(this,oChartStyle,oColors,oAdditionalData,bReset)};function CValAx(){CAxisBase.call(this);this.crossBetween=null;this.majorUnit=null;this.minorUnit=null;this.dispUnits=null;this.extLst=null}InitClass(CValAx,CAxisBase,AscDFH.historyitem_type_ValAx);CValAx.prototype.setCrossBetween=function(pr){History.CanAddChanges()&&History.Add(new CChangesDrawingsLong(this,AscDFH.historyitem_ValAxSetCrossBetween,this.crossBetween,pr));this.crossBetween= pr;this.onUpdate()};CValAx.prototype.setDispUnits=function(pr){History.CanAddChanges()&&History.Add(new CChangesDrawingsObject(this,AscDFH.historyitem_ValAxSetDispUnits,this.dispUnits,pr));this.dispUnits=pr;this.setParentToChild(pr);this.onUpdate()};CValAx.prototype.setMajorUnit=function(pr){History.CanAddChanges()&&History.Add(new CChangesDrawingsDouble(this,AscDFH.historyitem_ValAxSetMajorUnit,this.majorUnit,pr));this.majorUnit=pr;this.onUpdate()};CValAx.prototype.setMinorUnit=function(pr){History.CanAddChanges()&& History.Add(new CChangesDrawingsDouble(this,AscDFH.historyitem_ValAxSetMinorUnit,this.minorUnit,pr));this.minorUnit=pr;this.onUpdate()};CValAx.prototype.getMenuProps=function(){var ret=new AscCommon.asc_ValAxisSettings;var scaling=this.scaling;if(scaling&&AscFormat.isRealNumber(scaling.logBase)){ret.putLogScale(true);ret.putLogBase(scaling.logBase)}else ret.putLogScale(false);var oMinMaxOnAxis;if(this.axPos===AX_POS_L||this.axPos===AX_POS_R)oMinMaxOnAxis=getMinMaxFromArrPoints(this.yPoints);else oMinMaxOnAxis= getMinMaxFromArrPoints(this.xPoints);if(scaling&&AscFormat.isRealNumber(scaling.max)){ret.putMaxValRule(c_oAscValAxisRule.fixed);ret.putMaxVal(scaling.max)}else{ret.putMaxValRule(c_oAscValAxisRule.auto);ret.putMaxVal(oMinMaxOnAxis.max)}if(scaling&&AscFormat.isRealNumber(scaling.min)){ret.putMinValRule(c_oAscValAxisRule.fixed);ret.putMinVal(scaling.min)}else{ret.putMinValRule(c_oAscValAxisRule.auto);ret.putMinVal(oMinMaxOnAxis.min)}ret.putInvertValOrder(scaling&&scaling.orientation===ORIENTATION_MAX_MIN); if(isRealObject(this.dispUnits)){var disp_units=this.dispUnits;if(AscFormat.isRealNumber(disp_units.builtInUnit)){ret.putDispUnitsRule(disp_units.builtInUnit);ret.putShowUnitsOnChart(isRealObject(disp_units.dispUnitsLbl))}else if(AscFormat.isRealNumber(disp_units.custUnit)){ret.putDispUnitsRule(c_oAscValAxUnits.CUSTOM);ret.putUnits(disp_units.custUnit);ret.putShowUnitsOnChart(isRealObject(disp_units.dispUnitsLbl))}else{ret.putDispUnitsRule(c_oAscValAxUnits.none);ret.putShowUnitsOnChart(false)}}else{ret.putDispUnitsRule(c_oAscValAxUnits.none); ret.putShowUnitsOnChart(false)}if(AscFormat.isRealNumber(this.majorTickMark))ret.putMajorTickMark(this.majorTickMark);else ret.putMajorTickMark(c_oAscTickMark.TICK_MARK_NONE);if(AscFormat.isRealNumber(this.minorTickMark))ret.putMinorTickMark(this.minorTickMark);else ret.putMinorTickMark(c_oAscTickMark.TICK_MARK_NONE);if(AscFormat.isRealNumber(this.tickLblPos))ret.putTickLabelsPos(this.tickLblPos);else ret.putTickLabelsPos(c_oAscTickLabelsPos.TICK_LABEL_POSITION_NEXT_TO);var crossAx=this.crossAx;if(crossAx)if(AscFormat.isRealNumber(crossAx.crossesAt)){ret.putCrossesRule(c_oAscCrossesRule.value); ret.putCrosses(crossAx.crossesAt)}else if(crossAx.crosses===CROSSES_MAX){ret.putCrossesRule(c_oAscCrossesRule.maxValue);ret.putCrosses(oMinMaxOnAxis.max)}else if(crossAx.crosses===CROSSES_MIN){ret.putCrossesRule(c_oAscCrossesRule.minValue);ret.putCrosses(oMinMaxOnAxis.min)}else{ret.putCrossesRule(c_oAscCrossesRule.auto);if(AscFormat.isRealNumber(oMinMaxOnAxis.min)&&AscFormat.isRealNumber(oMinMaxOnAxis.max))if(0>=oMinMaxOnAxis.min&&0<=oMinMaxOnAxis.max)ret.putCrosses(0);else if(oMinMaxOnAxis.min>0)ret.putCrosses(oMinMaxOnAxis.min); else ret.putCrosses(oMinMaxOnAxis.max)}ret.putShow(!this.bDelete);ret.putGridlines(this.getGridlinesSetting());ret.putLabel(this.getLabelSetting());ret.putNumFmt(new AscCommon.asc_CAxNumFmt(this));return ret};CValAx.prototype.setMenuProps=function(props){var bChanged=false;if(!(isRealObject(props)&&typeof props.getAxisType==="function"&&props.getAxisType()===c_oAscAxisType.val))return;if(!this.scaling)this.setScaling(new CScaling);var scaling=this.scaling;if(AscFormat.isRealNumber(props.minValRule))if(props.minValRule=== c_oAscValAxisRule.auto){if(AscFormat.isRealNumber(scaling.min)){scaling.setMin(null);bChanged=true}}else if(AscFormat.isRealNumber(props.minVal))if(!(props.maxValRule===c_oAscValAxisRule.fixed&&props.maxVal=2&&props.logBase<=1E3){if(scaling.logBase!==props.logBase){scaling.setLogBase(props.logBase); bChanged=true}}else if(!props.logBase&&scaling.logBase!==null){scaling.setLogBase(null);bChanged=true}if(AscFormat.isRealNumber(props.dispUnitsRule))if(props.dispUnitsRule===c_oAscValAxUnits.none){if(this.dispUnits){this.setDispUnits(null);bChanged=true}}else{if(!this.dispUnits){this.setDispUnits(new CDispUnits);bChanged=true}if(this.dispUnits.builtInUnit!==props.dispUnitsRule){this.dispUnits.setBuiltInUnit(props.dispUnitsRule);bChanged=true}if(AscFormat.isRealBool(this.showUnitsOnChart)){this.dispUnits.setDispUnitsLbl(new CDLbl); bChanged=true}}if(AscFormat.isRealNumber(props.majorTickMark)&&this.majorTickMark!==props.majorTickMark){this.setMajorTickMark(props.majorTickMark);bChanged=true}if(AscFormat.isRealNumber(props.minorTickMark)&&this.minorTickMark!==props.minorTickMark){this.setMinorTickMark(props.minorTickMark);bChanged=true}if(bChanged)if(this.spPr&&this.spPr.hasNoFillLine()&&(this.majorTickMark!==c_oAscTickMark.TICK_MARK_NONE||this.minorTickMark!==c_oAscTickMark.TICK_MARK_NONE))this.spPr.setLn(null);if(AscFormat.isRealNumber(props.tickLabelsPos)&& this.tickLblPos!==props.tickLabelsPos){this.setTickLblPos(props.tickLabelsPos);bChanged=true}if(AscFormat.isRealNumber(props.crossesRule)&&isRealObject(this.crossAx))if(props.crossesRule===c_oAscCrossesRule.auto){if(this.crossAx.crossesAt!==null){this.crossAx.setCrossesAt(null);bChanged=true}if(this.crossAx.crosses!==CROSSES_AUTO_ZERO){this.crossAx.setCrosses(CROSSES_AUTO_ZERO);bChanged=true}}else if(props.crossesRule===c_oAscCrossesRule.value){if(AscFormat.isRealNumber(props.crosses)){if(this.crossAx.crossesAt!== props.crosses){this.crossAx.setCrossesAt(props.crosses);bChanged=true}if(this.crossAx.crosses!==null){this.crossAx.setCrosses(null);bChanged=true}}}else if(props.crossesRule===c_oAscCrossesRule.maxValue){if(this.crossAx.crossesAt!==null){this.crossAx.setCrossesAt(null);bChanged=true}if(this.crossAx.crosses!==CROSSES_MAX){this.crossAx.setCrosses(CROSSES_MAX);bChanged=true}}else if(props.crossesRule===c_oAscCrossesRule.minValue){if(this.crossAx.crossesAt!==null){this.crossAx.setCrossesAt(null);bChanged= true}if(this.crossAx.crosses!==CROSSES_MIN){this.crossAx.setCrosses(CROSSES_MIN);bChanged=true}}if(bChanged)if(this.bDelete===true)this.setDelete(false);if(props.getShow()!==null){var bDelete=!props.getShow();if(bDelete!==this.bDelete)this.setDelete(bDelete)}var nGridlines=props.getGridlines();if(nGridlines!==null)this.setGridlinesSetting(nGridlines);this.setLabelSetting(props.getLabel());var oAscFmt=props.getNumFmt();if(oAscFmt&&oAscFmt.isCorrect()){var oNumFmt=this.numFmt||new AscFormat.CNumFmt; oNumFmt.setFromAscObject(oAscFmt);if(!this.numFmt)this.setNumFmt(oNumFmt)}};CValAx.prototype.getFormatCode=function(oChartSpace,oSeries){var oNumFmt=this.numFmt;var sFormatCode=null;if(oNumFmt){if(oNumFmt.sourceLinked)return this.getSourceFormatCode();sFormatCode=oNumFmt.formatCode;if(typeof sFormatCode==="string"&&sFormatCode.length>0)return sFormatCode}return"General"};CValAx.prototype.getSourceFormatCode=function(){var oPlotArea=this.getPlotArea();var sDefault="General";if(!oPlotArea)return sDefault; var oSeries=oPlotArea.getSeriesWithSmallestIndexForAxis(this);if(!oSeries)return sDefault;if(oSeries.getObjectType()===AscDFH.historyitem_type_ScatterSer&&this.isHorizontal())return oSeries.getCatSourceNumFormat();return oSeries.getValSourceNumFormat()};CValAx.prototype.merge=function(oAxis){if(!oAxis)return;this.mergeBase(oAxis);if(AscFormat.isRealNumber(oAxis.axPos))this.setAxPos(oAxis.axPos);if(AscFormat.isRealNumber(oAxis.crossBetween))this.setCrossBetween(oAxis.crossBetween);if(AscFormat.isRealNumber(oAxis.majorUnit))this.setMajorUnit(oAxis.majorUnit); if(AscFormat.isRealNumber(oAxis.minorUnit))this.setMinorUnit(oAxis.minorUnit);if(AscCommon.isRealObject(oAxis.dispUnits))this.setDispUnits(oAxis.dispUnits.createDuplicate())};CValAx.prototype.checkNumFormat=function(sNewFormat){if(typeof sNewFormat==="string"&&sNewFormat.length>0){if(!this.numFmt)this.setNumFmt(new AscFormat.CNumFmt);var oNumFmt=this.numFmt;if(oNumFmt.formatCode!==sNewFormat)oNumFmt.setFormatCode(sNewFormat);if(oNumFmt.sourceLinked!==true)oNumFmt.setSourceLinked(true)}};CValAx.prototype.applyChartStyle= function(oChartStyle,oColors,oAdditionalData,bReset){if(!this.parent)return;if(bReset&&oAdditionalData)this.applyAdditionalSettings(oAdditionalData.valAx);this.applyStyleEntry(oChartStyle.valueAxis,oColors.generateColors(1),0,bReset);CAxisBase.prototype.applyChartStyle.call(this,oChartStyle,oColors,oAdditionalData,bReset)};function CBandFmt(){CBaseChartObject.call(this);this.idx=null;this.spPr=null}InitClass(CBandFmt,CBaseChartObject,AscDFH.historyitem_type_BandFmt);CBandFmt.prototype.fillObject= function(oCopy,oIdMap){oCopy.setIdx(this.idx);if(this.spPr)oCopy.setSpPr(this.spPr.createDuplicate())};CBandFmt.prototype.getChildren=function(){return[this.spPr]};CBandFmt.prototype.setIdx=function(pr){History.CanAddChanges()&&History.Add(new CChangesDrawingsLong(this,AscDFH.historyitem_BandFmt_SetIdx,this.idx,pr));this.idx=pr};CBandFmt.prototype.setSpPr=function(pr){History.CanAddChanges()&&History.Add(new CChangesDrawingsObject(this,AscDFH.historyitem_BandFmt_SetSpPr,this.spPr,pr));this.spPr=pr; this.setParentToChild(pr)};function CBarSeries(){CSeriesBase.call(this);this.cat=null;this.dLbls=null;this.dPt=[];this.errBars=null;this.invertIfNegative=null;this.pictureOptions=null;this.shape=null;this.trendline=null;this.val=null}InitClass(CBarSeries,CSeriesBase,AscDFH.historyitem_type_BarSeries);CBarSeries.prototype.getChildren=function(){var aRet=CSeriesBase.prototype.getChildren.call(this);aRet.push(this.dLbls);for(var nDpt=0;nDpt-1;--nDLbl)if(this.dLbl[nDLbl].idx===pr.idx)this.removeDLbl(nDLbl);History.CanAddChanges()&&History.Add(new CChangesDrawingsContent(this,AscDFH.historyitem_DLbls_SetDLbl,this.dLbl.length,[pr],true));this.dLbl.push(pr);this.setParentToChild(pr);this.onChangeDataRefs()};CDLbls.prototype.removeDLbl=function(nIndex){if(nIndex>-1&&nIndex-1;--i)this.removeDLbl(i)};CDLbls.prototype.setDLblPos=function(pr){History.CanAddChanges()&&History.Add(new CChangesDrawingsLong(this,AscDFH.historyitem_DLbls_SetDLblPos,this.dLblPos,pr));this.dLblPos=pr;this.onChartUpdateDataLabels()};CDLbls.prototype.setLeaderLines=function(pr){History.CanAddChanges()&& History.Add(new CChangesDrawingsObject(this,AscDFH.historyitem_DLbls_SetLeaderLines,this.leaderLines,pr));this.leaderLines=pr;this.setParentToChild(pr)};CDLbls.prototype.setNumFmt=function(pr){History.CanAddChanges()&&History.Add(new CChangesDrawingsObject(this,AscDFH.historyitem_DLbls_SetNumFmt,this.numFmt,pr));this.numFmt=pr;this.setParentToChild(pr)};CDLbls.prototype.setSeparator=function(pr){History.CanAddChanges()&&History.Add(new CChangesDrawingsString(this,AscDFH.historyitem_DLbls_SetSeparator, this.separator,pr));this.separator=pr;this.onChartUpdateDataLabels()};CDLbls.prototype.setShowBubbleSize=function(pr){History.CanAddChanges()&&History.Add(new CChangesDrawingsBool(this,AscDFH.historyitem_DLbls_SetShowBubbleSize,this.showBubbleSize,pr));this.showBubbleSize=pr};CDLbls.prototype.setShowCatName=function(pr){History.CanAddChanges()&&History.Add(new CChangesDrawingsBool(this,AscDFH.historyitem_DLbls_SetShowCatName,this.showCatName,pr));this.showCatName=pr;this.onChartUpdateDataLabels()}; CDLbls.prototype.setShowLeaderLines=function(pr){History.CanAddChanges()&&History.Add(new CChangesDrawingsBool(this,AscDFH.historyitem_DLbls_SetShowLeaderLines,this.showLeaderLines,pr));this.showLeaderLines=pr;this.onChartUpdateDataLabels()};CDLbls.prototype.setShowLegendKey=function(pr){History.CanAddChanges()&&History.Add(new CChangesDrawingsBool(this,AscDFH.historyitem_DLbls_SetShowLegendKey,this.showLegendKey,pr));this.showLegendKey=pr;this.onChartUpdateDataLabels()};CDLbls.prototype.setShowPercent= function(pr){History.CanAddChanges()&&History.Add(new CChangesDrawingsBool(this,AscDFH.historyitem_DLbls_SetShowPercent,this.showPercent,pr));this.showPercent=pr};CDLbls.prototype.setShowSerName=function(pr){History.CanAddChanges()&&History.Add(new CChangesDrawingsBool(this,AscDFH.historyitem_DLbls_SetShowSerName,this.showSerName,pr));this.showSerName=pr;this.onChartUpdateDataLabels()};CDLbls.prototype.setShowVal=function(pr){History.CanAddChanges()&&History.Add(new CChangesDrawingsBool(this,AscDFH.historyitem_DLbls_SetShowVal, this.showVal,pr));this.showVal=pr;this.onChartUpdateDataLabels()};CDLbls.prototype.setSpPr=function(pr){History.CanAddChanges()&&History.Add(new CChangesDrawingsObject(this,AscDFH.historyitem_DLbls_SetSpPr,this.spPr,pr));this.spPr=pr;this.setParentToChild(pr);this.onChartUpdateDataLabels()};CDLbls.prototype.setTxPr=function(pr){History.CanAddChanges()&&History.Add(new CChangesDrawingsObject(this,AscDFH.historyitem_DLbls_SetTxPr,this.txPr,pr));this.txPr=pr;this.setParentToChild(pr);this.onChartUpdateDataLabels()}; CDLbls.prototype.setDeleteValue=function(bValue){if(bValue===false){if(this.bDelete!==null)this.setDelete(null);for(var nDlbl=this.dLbl.length-1;nDlbl>-1;--nDlbl){var oDlbl=this.dLbl[nDlbl];if(oDlbl.bDelete)this.removeDLbl(nDlbl);if(oDlbl.bDelete===false)oDlbl.setDelete(null)}}else if(this.bDelete!==true){this.setDelete(true);this.removeAllDLbls()}};CDLbls.prototype.checkPosition=function(aPositions){fCheckDLblPosition(this,aPositions)};CDLbls.prototype.setSettings=function(nPos,oProps){fCheckDLblSettings(this, nPos,oProps)};CDLbls.prototype.applyChartStyle=function(oChartStyle,oColors,oAdditionalData,bReset){if(!this.parent)return;var aColors;var nParentType=this.parent.getObjectType();if(nParentType===AscDFH.historyitem_type_BarChart||nParentType===AscDFH.historyitem_type_AreaChart||nParentType===AscDFH.historyitem_type_BubbleChart||nParentType===AscDFH.historyitem_type_DoughnutChart||nParentType===AscDFH.historyitem_type_LineChart||nParentType===AscDFH.historyitem_type_OfPieChart||nParentType===AscDFH.historyitem_type_PieChart|| nParentType===AscDFH.historyitem_type_RadarChart||nParentType===AscDFH.historyitem_type_ScatterChart||nParentType===AscDFH.historyitem_type_StockChart||nParentType===AscDFH.historyitem_type_SurfaceChart){this.removeAllDLbls();this.applyStyleEntry(oChartStyle.dataLabel,oColors.generateColors(1),0,bReset)}else if(nParentType===AscDFH.historyitem_type_AreaSeries||nParentType===AscDFH.historyitem_type_BarSeries||nParentType===AscDFH.historyitem_type_BubbleSeries||nParentType===AscDFH.historyitem_type_LineSeries|| nParentType===AscDFH.historyitem_type_PieSeries||nParentType===AscDFH.historyitem_type_RadarSeries||nParentType===AscDFH.historyitem_type_ScatterSer||nParentType===AscDFH.historyitem_type_SurfaceSeries){var nMaxSeriesIdx=this.parent.getMaxSeriesIdx()+1;aColors=oColors.generateColors(nMaxSeriesIdx+1);this.applyStyleEntry(oChartStyle.dataLabel,aColors,this.parent.idx,bReset);this.removeAllDLbls();if(this.bDelete!==true){if(this.bDelete!==null)this.setDelete(null);if(this.parent.isVaryColors()){var nPtsCount= this.parent.getValuesCount();aColors=oColors.generateColors(nPtsCount);for(var nDLbl=0;nDLbl0)oLbls.setSeparator(oProps.separator)}if(Array.isArray(oLbls.dLbl))for(var nLbl=0;nLbl0)return 1/this.custUnit;return 1};CDispUnits.prototype.onUpdate=function(){if(this.parent)this.parent.onUpdate()};CDispUnits.prototype.setBuiltInUnit=function(pr){History.CanAddChanges()&&History.Add(new CChangesDrawingsDouble(this,AscDFH.historyitem_DispUnitsSetBuiltInUnit,this.builtInUnit,pr));this.builtInUnit=pr;this.onUpdate()};CDispUnits.prototype.setCustUnit=function(pr){History.CanAddChanges()&&History.Add(new CChangesDrawingsObject(this,AscDFH.historyitem_DispUnitsSetCustUnit, this.custUnit,pr));this.custUnit=pr;this.setParentToChild(pr);this.onUpdate()};CDispUnits.prototype.setDispUnitsLbl=function(pr){History.CanAddChanges()&&History.Add(new CChangesDrawingsObject(this,AscDFH.historyitem_DispUnitsSetDispUnitsLbl,this.dispUnitsLbl,pr));this.dispUnitsLbl=pr;this.setParentToChild(pr);this.onUpdate()};function CDoughnutChart(){CChartBase.call(this);this.firstSliceAng=null;this.holeSize=null}InitClass(CDoughnutChart,CChartBase,AscDFH.historyitem_type_DoughnutChart);CDoughnutChart.prototype.Refresh_RecalcData= function(data){if(!isRealObject(data))return;switch(data.Type){case AscDFH.historyitem_CommonChartFormat_SetParent:{break}case AscDFH.historyitem_DoughnutChart_SetDLbls:{this.onChartUpdateDataLabels();break}case AscDFH.historyitem_DoughnutChart_SetFirstSliceAng:{break}case AscDFH.historyitem_DoughnutChart_SetHoleSize:{break}case AscDFH.historyitem_CommonChart_AddSeries:case AscDFH.historyitem_CommonChart_AddFilteredSeries:case AscDFH.historyitem_CommonChart_RemoveFilteredSeries:case AscDFH.historyitem_CommonChart_RemoveSeries:{this.onChartUpdateType(); this.onChangeDataRefs();break}case AscDFH.historyitem_DoughnutChart_SetVaryColor:{break}}};CDoughnutChart.prototype.getDefaultDataLabelsPosition=function(){return c_oAscChartDataLabelsPos.ctr};CDoughnutChart.prototype.getEmptySeries=function(){return new CPieSeries};CDoughnutChart.prototype.fillObject=function(oCopy,oIdMap){CChartBase.prototype.fillObject.call(this,oCopy,oIdMap);if(oCopy.setFirstSliceAng&&this.firstSliceAng!==null)oCopy.setFirstSliceAng(this.firstSliceAng);if(oCopy.setHoleSize&&this.holeSize!== null)oCopy.setHoleSize(this.holeSize)};CDoughnutChart.prototype.setFirstSliceAng=function(pr){History.CanAddChanges()&&History.Add(new CChangesDrawingsLong(this,AscDFH.historyitem_DoughnutChart_SetFirstSliceAng,this.firstSliceAng,pr));this.firstSliceAng=pr};CDoughnutChart.prototype.setHoleSize=function(pr){History.CanAddChanges()&&History.Add(new CChangesDrawingsLong(this,AscDFH.historyitem_DoughnutChart_SetHoleSize,this.holeSize,pr));this.holeSize=pr};CDoughnutChart.prototype.getChartType=function(){return Asc.c_oAscChartTypeSettings.doughnut}; function CErrBars(){CBaseChartObject.call(this);this.errBarType=null;this.errDir=null;this.errValType=null;this.minus=null;this.noEndCap=null;this.plus=null;this.spPr=null;this.val=null}InitClass(CErrBars,CBaseChartObject,AscDFH.historyitem_type_ErrBars);CErrBars.prototype.getChildren=function(){var aRet=[];aRet.push(this.minus);aRet.push(this.plus);aRet.push(this.spPr);return aRet};CErrBars.prototype.fillObject=function(oCopy,oIdMap){oCopy.setErrBarType(this.errBarType);oCopy.setErrDir(this.errDir); oCopy.setErrValType(this.errValType);if(this.minus)oCopy.setMinus(this.minus.createDuplicate());oCopy.setNoEndCap(this.noEndCap);if(this.plus)oCopy.setPlus(this.plus.createDuplicate());if(this.spPr)oCopy.setSpPr(this.spPr.createDuplicate());oCopy.setVal(this.val)};CErrBars.prototype.setErrBarType=function(pr){History.CanAddChanges()&&History.Add(new CChangesDrawingsLong(this,AscDFH.historyitem_ErrBars_SetErrBarType,this.errBarType,pr));this.errBarType=pr};CErrBars.prototype.setErrDir=function(pr){History.CanAddChanges()&& History.Add(new CChangesDrawingsLong(this,AscDFH.historyitem_ErrBars_SetErrDir,this.errDir,pr));this.errDir=pr};CErrBars.prototype.setErrValType=function(pr){History.CanAddChanges()&&History.Add(new CChangesDrawingsLong(this,AscDFH.historyitem_ErrBars_SetErrValType,this.errDir,pr));this.errValType=pr};CErrBars.prototype.setMinus=function(pr){History.CanAddChanges()&&History.Add(new CChangesDrawingsObject(this,AscDFH.historyitem_ErrBars_SetMinus,this.minus,pr));this.minus=pr;this.setParentToChild(pr)}; CErrBars.prototype.setNoEndCap=function(pr){History.CanAddChanges()&&History.Add(new CChangesDrawingsBool(this,AscDFH.historyitem_ErrBars_SetNoEndCap,this.noEndCap,pr));this.noEndCap=pr};CErrBars.prototype.setPlus=function(pr){History.CanAddChanges()&&History.Add(new CChangesDrawingsObject(this,AscDFH.historyitem_ErrBars_SetPlus,this.plus,pr));this.plus=pr;this.setParentToChild(pr)};CErrBars.prototype.setSpPr=function(pr){History.CanAddChanges()&&History.Add(new CChangesDrawingsObject(this,AscDFH.historyitem_ErrBars_SetSpPr, this.spPr,pr));this.spPr=pr;this.setParentToChild(pr)};CErrBars.prototype.setVal=function(pr){History.CanAddChanges()&&History.Add(new CChangesDrawingsDouble(this,AscDFH.historyitem_ErrBars_SetVal,this.val,pr));this.val=pr};CErrBars.prototype.applyChartStyle=function(oChartStyle,oColors,oAdditionalData,bReset){if(!this.parent)return;this.applyStyleEntry(oChartStyle.errorBar,oColors.generateColors(1),0,bReset)};function CLayout(){CBaseChartObject.call(this);this.h=null;this.hMode=null;this.layoutTarget= null;this.w=null;this.wMode=null;this.x=null;this.xMode=null;this.y=null;this.yMode=null}InitClass(CLayout,CBaseChartObject,AscDFH.historyitem_type_Layout);CLayout.prototype.Refresh_RecalcData=function(Data){if(this.parent&&this.parent.Refresh_RecalcData2)this.parent.Refresh_RecalcData2()};CLayout.prototype.fillObject=function(oCopy,oIdMap){oCopy.setH(this.h);oCopy.setHMode(this.hMode);oCopy.setLayoutTarget(this.layoutTarget);oCopy.setW(this.w);oCopy.setWMode(this.wMode);oCopy.setX(this.x);oCopy.setXMode(this.xMode); oCopy.setY(this.y);oCopy.setYMode(this.yMode)};CLayout.prototype.setH=function(pr){History.CanAddChanges()&&History.Add(new CChangesDrawingsDouble(this,AscDFH.historyitem_Layout_SetH,this.h,pr));this.h=pr};CLayout.prototype.setHMode=function(pr){History.CanAddChanges()&&History.Add(new CChangesDrawingsLong(this,AscDFH.historyitem_Layout_SetHMode,this.hMode,pr));this.hMode=pr};CLayout.prototype.setLayoutTarget=function(pr){History.CanAddChanges()&&History.Add(new CChangesDrawingsLong(this,AscDFH.historyitem_Layout_SetLayoutTarget, this.layoutTarget,pr));this.layoutTarget=pr};CLayout.prototype.setW=function(pr){History.CanAddChanges()&&History.Add(new CChangesDrawingsDouble(this,AscDFH.historyitem_Layout_SetW,this.w,pr));this.w=pr};CLayout.prototype.setWMode=function(pr){History.CanAddChanges()&&History.Add(new CChangesDrawingsLong(this,AscDFH.historyitem_Layout_SetWMode,this.wMode,pr));this.wMode=pr};CLayout.prototype.setX=function(pr){History.CanAddChanges()&&History.Add(new CChangesDrawingsDouble(this,AscDFH.historyitem_Layout_SetX, this.x,pr));this.x=pr};CLayout.prototype.setXMode=function(pr){History.CanAddChanges()&&History.Add(new CChangesDrawingsLong(this,AscDFH.historyitem_Layout_SetXMode,this.xMode,pr));this.xMode=pr};CLayout.prototype.setY=function(pr){History.CanAddChanges()&&History.Add(new CChangesDrawingsDouble(this,AscDFH.historyitem_Layout_SetY,this.y,pr));this.y=pr};CLayout.prototype.setYMode=function(pr){History.CanAddChanges()&&History.Add(new CChangesDrawingsLong(this,AscDFH.historyitem_Layout_SetYMode,this.yMode, pr));this.yMode=pr};function CLegend(){CBaseChartObject.call(this);this.layout=null;this.legendEntryes=[];this.legendPos=null;this.overlay=false;this.spPr=null;this.txPr=null;this.rot=0;this.flipH=false;this.flipV=false;this.x=null;this.y=null;this.extX=null;this.extY=null;this.calcEntryes=[];this.transform=new CMatrix;this.invertTransform=new CMatrix;this.localTransform=new CMatrix}InitClass(CLegend,CBaseChartObject,AscDFH.historyitem_type_Legend);CLegend.prototype.recalculatePen=CShape.prototype.recalculatePen; CLegend.prototype.recalculateBrush=CShape.prototype.recalculateBrush;CLegend.prototype.getCompiledLine=CShape.prototype.getCompiledLine;CLegend.prototype.getCompiledFill=CShape.prototype.getCompiledFill;CLegend.prototype.getCompiledTransparent=CShape.prototype.getCompiledTransparent;CLegend.prototype.check_bounds=CShape.prototype.check_bounds;CLegend.prototype.getCardDirectionByNum=CShape.prototype.getCardDirectionByNum;CLegend.prototype.getNumByCardDirection=CShape.prototype.getNumByCardDirection; CLegend.prototype.getResizeCoefficients=CShape.prototype.getResizeCoefficients;CLegend.prototype.getInvertTransform=CShape.prototype.getInvertTransform;CLegend.prototype.getTransformMatrix=CShape.prototype.getTransformMatrix;CLegend.prototype.hitToHandles=CShape.prototype.hitToHandles;CLegend.prototype.getFullFlipH=CShape.prototype.getFullFlipH;CLegend.prototype.getFullFlipV=CShape.prototype.getFullFlipV;CLegend.prototype.getAspect=CShape.prototype.getAspect;CLegend.prototype.getGeom=CShape.prototype.getGeom; CLegend.prototype.hitInBoundingRect=CShape.prototype.hitInBoundingRect;CLegend.prototype.hitInInnerArea=CShape.prototype.hitInInnerArea;CLegend.prototype.hitInPath=CShape.prototype.hitInPath;CLegend.prototype.Refresh_RecalcData=function(){this.Refresh_RecalcData2()};CLegend.prototype.convertPixToMM=function(pix){return this.parent&&this.parent.parent&&this.parent.parent.convertPixToMM&&this.parent.parent.convertPixToMM(pix)};CLegend.prototype.findCalcEntryByIdx=function(idx){for(var i=0;i= 0&&t_y>=0&&t_x<=this.extX&&t_y<=this.extY};CLegend.prototype.setPosition=function(x,y){this.x=x;this.y=y;this.localTransform.Reset();global_MatrixTransformer.TranslateAppend(this.localTransform,this.x,this.y);this.transform=this.localTransform.CreateDublicate();this.invertTransform=global_MatrixTransformer.Invert(this.transform);var entry;for(var i=0;i0))return;var nPtCount=0;var aParsedRef=AscFormat.fParseChartFormula(sFormula);if(aParsedRef.length>0){var nRows=0,nRef,oRef,oBBox,nPtIdx,nCol,oWS,oCell,sVal,nCols=0,nRow;var nLvl,oLvl;var bLvlsByRows=true;if(oSeries){var sSeriesFormula=oSeries.getValRefFormula();if(sSeriesFormula){if(sSeriesFormula.charAt(0)=== "=")sSeriesFormula=sSeriesFormula.slice(1);var aParsedSeriesRef=AscFormat.fParseChartFormula(sSeriesFormula);if(aParsedSeriesRef.length===aParsedRef.length){var oSeriesRef;for(nRef=0;nRef0)oLvl.addStringPoint(nPtIdx,sVal);++nPtIdx}else nPtIdx+=oBBox.c2-oBBox.c1+1}nPtCount=Math.max(nPtCount, nPtIdx);oLvl.setPtCount(nPtIdx);this.addLvl(oLvl)}}else{for(nRef=0;nRef0)oLvl.addStringPoint(nPtIdx,sVal);++nPtIdx}else nPtIdx+=oBBox.r2-oBBox.r1+1}nPtCount=Math.max(nPtCount,nPtIdx);oLvl.setPtCount(nPtIdx);this.addLvl(oLvl)}}}this.setPtCount(nPtCount)};CMultiLvlStrCache.prototype.getValues=function(nMaxValues){var ret=[];var nEnd=nMaxValues||this.ptCount;for(var nIndex=0;nIndex0)this.setF(sFormula)};CChartRefBase.prototype.handleRemoveWorksheets=function(aNames){var sFormula= this.f;var sName;if(sFormula!==null){for(var nName=0;nName0){var sFormula=this.f;if(sFormula.indexOf(sOldSheetName)>-1)this.setF(sFormula.replace(new RegExp(RegExp.escape(sOldSheetName),"g"),sNewSheetName))}};CChartRefBase.prototype.updateCache= function(){};CChartRefBase.prototype.updateCacheAndCat=function(){if(this.parent&&this.parent.getObjectType()===AscDFH.historyitem_type_Cat)this.parent.update();else this.updateCache()};CChartRefBase.prototype.fillObject=function(oCopy,oIdMap){oCopy.setF(this.f)};function CMultiLvlStrRef(){CChartRefBase.call(this);this.multiLvlStrCache=null}InitClass(CMultiLvlStrRef,CChartRefBase,AscDFH.historyitem_type_MultiLvlStrRef);CMultiLvlStrRef.prototype.getChildren=function(){return[this.multiLvlStrCache]}; CMultiLvlStrRef.prototype.fillObject=function(oCopy,oIdMap){CChartRefBase.prototype.fillObject.call(this,oCopy,oIdMap);if(this.multiLvlStrCache)oCopy.setMultiLvlStrCache(this.multiLvlStrCache.createDuplicate())};CMultiLvlStrRef.prototype.setMultiLvlStrCache=function(pr){History.CanAddChanges()&&History.Add(new CChangesDrawingsObject(this,AscDFH.historyitem_MultiLvlStrRef_SetMultiLvlStrCache,this.multiLvlStrCache,pr));this.multiLvlStrCache=pr;this.setParentToChild(pr)};CMultiLvlStrRef.prototype.updateCache= function(oSeries){AscFormat.ExecuteNoHistory(function(){this.setMultiLvlStrCache(new CMultiLvlStrCache);this.multiLvlStrCache.update(this.f,oSeries);this.onUpdateCache()},this,[])};CMultiLvlStrRef.prototype.getValues=function(nMaxValues){if(!this.multiLvlStrCache)this.updateCache();return this.multiLvlStrCache.getValues(nMaxValues)};CMultiLvlStrRef.prototype.getFirstLvlCache=function(){var oCache=this.multiLvlStrCache;if(oCache&&oCache.lvl[0])return oCache.lvl[0];return null};function CNumRef(){CChartRefBase.call(this); this.numCache=null}InitClass(CNumRef,CChartRefBase,AscDFH.historyitem_type_NumRef);CNumRef.prototype.getChildren=function(){return[this.numCache]};CNumRef.prototype.fillObject=function(oCopy,oIdMap){CChartRefBase.prototype.fillObject.call(this,oCopy,oIdMap);if(this.numCache)oCopy.setNumCache(this.numCache.createDuplicate())};CNumRef.prototype.setNumCache=function(pr){History.CanAddChanges()&&History.Add(new CChangesDrawingsObject(this,AscDFH.historyitem_NumRef_SetNumCache,this.numCache,pr));this.numCache= pr;this.setParentToChild(pr)};CNumRef.prototype.updateCache=function(displayEmptyCellsAs,displayHidden,ser){AscFormat.ExecuteNoHistory(function(){if(!this.numCache){this.setNumCache(new CNumLit);this.numCache.setFormatCode("General");this.numCache.setPtCount(0)}else this.numCache.removeAllPts();if(ser)ser.isHidden=true;this.numCache.update(this.f,displayEmptyCellsAs,displayHidden,ser);this.onUpdateCache()},this,[])};CNumRef.prototype.getValuesCount=function(){if(!this.numCache)this.updateCache(); return this.numCache.ptCount};CNumRef.prototype.getValues=function(nMaxValues){if(!this.numCache)this.updateCache();return this.numCache.getValues(nMaxValues)};CNumRef.prototype.getNumFormat=function(nPtIdx){if(!this.numCache)return"General";return this.numCache.getNumFormat(nPtIdx)};CNumRef.prototype.fillFromAsc=function(oValCache,bUseCache){this.setF(oValCache.Formula);if(bUseCache){this.setNumCache(new AscFormat.CNumLit);var oNumCache=this.numCache;oNumCache.setPtCount(oValCache.NumCache.length); for(var nPt=0;nPt0)sRet+=" ";sRet+=aValues[i]}return sRet};CStrRef.prototype.getValues=function(nMaxCount,bAddEmpty){if(!this.strCache)this.updateCache();return this.strCache.getValues(nMaxCount,bAddEmpty)};CStrRef.prototype.fillFromAsc=function(oCatCache,bUseCache){this.setF(oCatCache.Formula); if(bUseCache){this.setStrCache(new AscFormat.CStrCache);var oStrCache=this.strCache;oStrCache.setPtCount(oCatCache.NumCache.length);for(var nPt=0;nPt0)return this.formatCode;return"General"};function CNumFmt(){CBaseChartObject.call(this);this.formatCode=null;this.sourceLinked=null}InitClass(CNumFmt, CBaseChartObject,AscDFH.historyitem_type_NumFmt);CNumFmt.prototype.fillObject=function(oCopy,oIdMap){if(this.formatCode!==null)oCopy.setFormatCode(this.formatCode);if(this.sourceLinked!==null)oCopy.setSourceLinked(this.sourceLinked)};CNumFmt.prototype.setFormatCode=function(pr){History.CanAddChanges()&&History.Add(new CChangesDrawingsString(this,AscDFH.historyitem_NumFmt_SetFormatCode,this.formatCode,pr));this.formatCode=pr};CNumFmt.prototype.setSourceLinked=function(pr){History.CanAddChanges()&& History.Add(new CChangesDrawingsBool(this,AscDFH.historyitem_NumFmt_SetSourceLinked,this.sourceLinked,pr));this.sourceLinked=pr};CNumFmt.prototype.setFromAscObject=function(o){if(!o||!o.isCorrect())return;if(o.formatCode!==this.formatCode)this.setFormatCode(o.formatCode);if(o.sourceLinked!==this.sourceLinked)this.setSourceLinked(o.sourceLinked)};function CNumLit(){CBaseChartObject.call(this);this.formatCode=null;this.pts=[];this.ptCount=null}InitClass(CNumLit,CBaseChartObject,AscDFH.historyitem_type_NumLit); CNumLit.prototype.removeDPt=function(idx){if(this.pts[idx]){this.pts[idx].setParent(null);History.CanAddChanges()&&History.Add(new CChangesDrawingsContent(this,AscDFH.historyitem_CommonLit_RemoveDPt,idx,[this.pts[idx]],false));this.pts.splice(idx,1)}};CNumLit.prototype.fillObject=function(oCopy,oIdMap){oCopy.setFormatCode(this.formatCode);for(var i=0;i-1;--i)this.removeDPt(i);this.setPtCount(0)};CNumLit.prototype.addNumericPoint= function(idx,dNumber){var oPt=new CNumericPoint;oPt.setIdx(idx);oPt.setVal(dNumber);this.addPt(oPt);this.setPtCount(Math.max(this.pts.length,idx+1))};CNumLit.prototype.update=function(sFormula,displayEmptyCellsAs,displayHidden,ser){AscFormat.ExecuteNoHistory(function(){this.removeAllPts();if(!(typeof sFormula==="string"&&sFormula.length>0)){this.setPtCount(0);this.setFormatCode("General");return}var aParsedRef=AscFormat.fParseChartFormula(sFormula);var nRef,oRef,oMinRef,oWS,oBB,nPtIdx,nPtCount,nCount; var oHM,nHidden,nR,nC,oMinBB,oCell,aSpanPoints=[],oStartPoint;var dVal,sVal,oPt,sCellFC,nSpan,nLastNoEmptyIndex,nSpliceIndex;var sCommonFormatCode=null;var bHaveTotalRow;nPtCount=0;nPtIdx=0;for(nRef=0;nRef0)dVal=0}if(AscFormat.isRealNumber(dVal)){oPt=new AscFormat.CNumericPoint;oPt.setIdx(nPtIdx);oPt.setVal(dVal);sCellFC=oCell.getNumFormatStr();oPt.setFormatCode(sCellFC);if(sCommonFormatCode===null)sCommonFormatCode=sCellFC; else if(sCommonFormatCode!==undefined)if(sCommonFormatCode!==sCellFC)sCommonFormatCode=undefined;this.addPt(oPt);if(aSpanPoints.length>0){if(AscFormat.isRealNumber(nLastNoEmptyIndex)){oStartPoint=this.getPtByIndex(nLastNoEmptyIndex);if(oStartPoint)for(nSpan=0;nSpan0){oPt=new AscFormat.CNumericPoint;oPt.setIdx(nPtIdx);oPt.setVal(0);this.addPt(oPt);if(aSpanPoints.length>0){if(AscFormat.isRealNumber(nLastNoEmptyIndex)){oStartPoint=this.getPtByIndex(nLastNoEmptyIndex);if(oStartPoint)for(nSpan=0;nSpan0)return oPt.formatCode;if(typeof this.formatCode==="string"&&this.formatCode.length>0)return this.formatCode;return"General"};function COfPieChart(){CChartBase.call(this); this.custSplit=[];this.gapWidth=null;this.ofPieType=null;this.secondPieSize=null;this.serLines=null;this.splitPos=null;this.splitType=null}InitClass(COfPieChart,CChartBase,AscDFH.historyitem_type_OfPieChart);COfPieChart.prototype.getEmptySeries=function(){return new CPieSeries};COfPieChart.prototype.getDefaultDataLabelsPosition=function(){return c_oAscChartDataLabelsPos.bestFit};COfPieChart.prototype.getChildren=function(){var aRet=CChartBase.prototype.getChildren.call(this);for(var i=0;i0)sRet=this.val;else if(this.strRef)sRet= this.strRef.getText(bNoUpdate);return sRet};CTx.prototype.getFormula=function(){var sRet="";if(typeof this.val==="string"&&this.val.length>0)sRet='="'+this.val+'"';else if(this.strRef)sRet=this.strRef.getFormula();return sRet};CTx.prototype.getDataRefs=function(){if(this.strRef)return this.strRef.getDataRefs();return new CDataRefs([])};CTx.prototype.collectRefs=function(aRefs){if(this.strRef)aRefs.push(this.strRef)};CTx.prototype.setValues=function(sName){var oResult=new CParseResult;var oParser, bResult,oLastElem;if(typeof sName==="string"&&sName.length>0){fParseStrRef(sName,false,oResult);if(oResult.isSuccessful()){this.setStrRef(oResult.getObject());this.setVal(null)}else{var aParsed=AscFormat.fParseChartFormula(sName);if(aParsed.length>0)return oResult;if(sName[0]==="="){oParser=new AscCommonExcel.parserFormula(sName.slice(1),null,Asc.editor.wbModel.aWorksheets[0]);bResult=oParser.parse(true,true);if(bResult&&oParser.outStack.length===1&&(oLastElem=oParser.outStack[0])&&oLastElem.type=== AscCommonExcel.cElementType.string){if(this.strRef)this.setStrRef(null);this.setVal(oLastElem.getValue());oResult.setError(Asc.c_oAscError.ID.No);oResult.setObject(oLastElem.getValue())}else oResult.setError(Asc.c_oAscError.ID.ErrorInFormula)}else{if(this.strRef)this.setStrRef(null);this.setVal(sName);oResult.setError(Asc.c_oAscError.ID.No);oResult.setObject(sName)}}}else oResult.setError(Asc.c_oAscError.ID.DataRangeError);return oResult};CTx.prototype.isValid=function(){if(this.strRef||typeof this.val=== "string")return true;return false};CTx.prototype.update=function(){if(this.strRef)this.strRef.updateCache()};CTx.prototype.handleOnChangeSheetName=function(sOldSheetName,sNewSheetName){if(this.strRef)this.strRef.handleOnChangeSheetName(sOldSheetName,sNewSheetName)};CTx.prototype.fillFromAsc=function(oTxCache,bUseCache){this.setStrRef(new AscFormat.CStrRef);this.strRef.fillFromAsc(oTxCache,bUseCache)};function CStockChart(){CChartBase.call(this);this.dropLines=null;this.hiLowLines=null;this.upDownBars= null}InitClass(CStockChart,CChartBase,AscDFH.historyitem_type_StockChart);CStockChart.prototype.getDefaultDataLabelsPosition=function(){return c_oAscChartDataLabelsPos.r};CStockChart.prototype.Refresh_RecalcData=function(){this.onChartUpdateType()};CStockChart.prototype.getEmptySeries=function(){return new CLineSeries};CStockChart.prototype.getChildren=function(){var aRet=CChartBase.prototype.getChildren.call(this);aRet.push(this.dLbls);aRet.push(this.dropLines);aRet.push(this.hiLowLines);aRet.push(this.upDownBars); return aRet};CStockChart.prototype.fillObject=function(oCopy,oIdMap){CChartBase.prototype.fillObject.call(this,oCopy,oIdMap);if(this.dLbls&&oCopy.setDLbls)oCopy.setDLbls(this.dLbls.createDuplicate());if(this.dropLines&&oCopy.setDropLines)oCopy.setDropLines(this.dropLines.createDuplicate());if(this.hiLowLines&&oCopy.setHiLowLines)oCopy.setHiLowLines(this.hiLowLines.createDuplicate());if(this.upDownBars&&oCopy.setUpDownBars)oCopy.setUpDownBars(this.upDownBars.createDuplicate())};CStockChart.prototype.setDropLines= function(pr){History.CanAddChanges()&&History.Add(new CChangesDrawingsObject(this,AscDFH.historyitem_StockChart_SetDropLines,this.dropLines,pr));this.dropLines=pr;this.setParentToChild(pr)};CStockChart.prototype.setHiLowLines=function(pr){History.CanAddChanges()&&History.Add(new CChangesDrawingsObject(this,AscDFH.historyitem_StockChart_SetHiLowLines,this.hiLowLines,pr));this.hiLowLines=pr;this.setParentToChild(pr)};CStockChart.prototype.setUpDownBars=function(pr){History.CanAddChanges()&&History.Add(new CChangesDrawingsObject(this, AscDFH.historyitem_StockChart_SetUpDownBars,this.upDownBars,pr));this.upDownBars=pr;this.setParentToChild(pr)};CStockChart.prototype.getChartType=function(){return Asc.c_oAscChartTypeSettings.stock};CStockChart.prototype.isMarkerChart=function(){return false};CStockChart.prototype.isNoLine=function(){return false};CStockChart.prototype.isSmooth=function(){return false};function CStrCache(){CBaseChartObject.call(this);this.pts=[];this.ptCount=null}InitClass(CStrCache,CBaseChartObject,AscDFH.historyitem_type_StrCache); CStrCache.prototype.removeDPt=function(idx){if(this.pts[idx]){this.pts[idx].setParent(null);History.CanAddChanges()&&History.Add(new CChangesDrawingsContent(this,AscDFH.historyitem_CommonLit_RemoveDPt,idx,[this.pts[idx]],false));this.pts.splice(idx,1)}};CStrCache.prototype.removeAllPts=function(){var start_idx=this.pts.length-1;for(var i=start_idx;i>-1;--i)this.removeDPt(i);this.setPtCount(0)};CStrCache.prototype.fillObject=function(oCopy,oIdMap){for(var i=0;i0))return;var pt_index=0,i,j,cell,pt,value_width_format,row_hidden,col_hidden,nPtCount=0;var aParsedRef=AscFormat.fParseChartFormula(sFormula); var str_cache=this;var fParseTableDataString=function(oRef,oCache){if(Array.isArray(oRef))for(var i=0;i0){pt=new AscFormat.CStringPoint;pt.setIdx(nPtCount);pt.setVal(value_width_format);if(str_cache.pts.length===0)pt.formatCode=cell.getNumFormatStr();str_cache.addPt(pt)}++nPtCount}pt_index++}}else{col_hidden= source_worksheet.getColHidden(range.c1);j=range.r1;while(i===0&&source_worksheet.getRowHidden(j)&&j<=range.r2)++j;for(;j<=range.r2;++j){if(!col_hidden&&!source_worksheet.getRowHidden(j)){cell=source_worksheet.getCell3(j,range.c1);value_width_format=cell.getValueWithFormat();if(typeof value_width_format==="string"&&value_width_format.length>0){pt=new AscFormat.CStringPoint;pt.setIdx(nPtCount);pt.setVal(cell.getValueWithFormat());if(str_cache.pts.length===0)pt.formatCode=cell.getNumFormatStr();str_cache.addPt(pt)}++nPtCount}pt_index++}}}else fParseTableDataString(oCurRef)}this.setPtCount(nPtCount)}, this,[])};CStrCache.prototype.addStringPoint=function(idx,sStr){var oPt=new CStringPoint;oPt.setIdx(idx);oPt.setVal(sStr);this.addPt(oPt);this.setPtCount(Math.max(this.pts.length,idx+1))};CStrCache.prototype.getValues=function(nMaxCount,bAddEmpty){var ret=[];var nEnd=nMaxCount||this.ptCount;for(var nIndex=0;nIndex0)AscFonts.FontPickerByCharacter.getFontsByString(pr)};function CSurfaceChart(){CChartBase.call(this);this.bandFmts=[];this.wireframe=null;this.compiledBandFormats=[]}InitClass(CSurfaceChart,CChartBase,AscDFH.historyitem_type_SurfaceChart); CSurfaceChart.prototype.Refresh_RecalcData=function(data){if(!isRealObject(data))return;switch(data.Type){case AscDFH.historyitem_CommonChartFormat_SetParent:{break}case AscDFH.historyitem_SurfaceChart_AddAxId:case AscDFH.historyitem_CommonChart_AddAxId:{break}case AscDFH.historyitem_SurfaceChart_AddBandFmt:{break}case AscDFH.historyitem_CommonChart_AddSeries:case AscDFH.historyitem_CommonChart_AddFilteredSeries:case AscDFH.historyitem_CommonChart_RemoveFilteredSeries:case AscDFH.historyitem_CommonChart_RemoveSeries:{this.onChartUpdateType(); this.onChangeDataRefs();break}case AscDFH.historyitem_SurfaceChart_SetWireframe:{break}}};CSurfaceChart.prototype.isWireframe=function(){return this.wireframe===true};CSurfaceChart.prototype.getBandFmtByIndex=function(idx){for(var i=0;i0)return sText}var key="Axis Title";if(this.parent)if(this.parent.getObjectType()===AscDFH.historyitem_type_Chart){if(this.parent.plotArea&&this.parent.plotArea.charts.length===1&&Array.isArray(this.parent.plotArea.charts[0].series)&&this.parent.plotArea.charts[0].series.length===1&&this.parent.plotArea.charts[0].series[0].tx){var oTx=this.parent.plotArea.charts[0].series[0].tx;sText=oTx.getText(false);if(typeof sText=== "string"&&sText.length>0)return sText}key="Diagram Title"}else if(this.parent.axPos===AX_POS_B||this.parent.axPos===AX_POS_T)key="X Axis";else key="Y Axis";return AscCommon.translateManager.getValue(key)};CTitle.prototype.recalculate=function(){AscFormat.ExecuteNoHistory(function(){if(this.recalcInfo.recalculateBrush){this.recalculateBrush();this.recalcInfo.recalculateBrush=false}if(this.recalcInfo.recalculatePen){this.recalculatePen();this.recalcInfo.recalculatePen=false}if(this.recalcInfo.recalcStyle){this.recalculateStyle(); this.recalcInfo.recalcStyle=false}if(this.recalcInfo.recalculateTxBody){this.recalculateTxBody();this.recalcInfo.recalculateTxBody=false}if(this.recalcInfo.recalculateContent){this.recalculateContent();this.recalcInfo.recalculateContent=false}if(this.recalcInfo.recalcTransform){this.recalculateTransform();this.recalcInfo.recalcTransform=false}if(this.recalcInfo.recalculateGeometry){this.recalculateGeometry&&this.recalculateGeometry();this.recalcInfo.recalculateGeometry=false}if(this.recalcInfo.recalculateTransformText){this.recalculateTransformText(); this.recalcInfo.recalculateTransformText=false}if(this.chart)this.chart.addToSetPosition(this)},this,[])};CTitle.prototype.setLayout=function(pr){History.CanAddChanges()&&History.Add(new CChangesDrawingsObject(this,AscDFH.historyitem_Title_SetLayout,this.layout,pr));this.layout=pr;this.setParentToChild(pr)};CTitle.prototype.setOverlay=function(pr){History.CanAddChanges()&&History.Add(new CChangesDrawingsBool(this,AscDFH.historyitem_Title_SetOverlay,this.overlay,pr));this.overlay=pr;this.onUpdate()}; CTitle.prototype.setSpPr=function(pr){History.CanAddChanges()&&History.Add(new CChangesDrawingsObject(this,AscDFH.historyitem_Title_SetSpPr,this.spPr,pr));this.spPr=pr;this.setParentToChild(pr);this.onUpdate()};CTitle.prototype.setTx=function(pr){if(this.tx&&this.tx.strRef||pr&&pr.strRef)this.onChangeDataRefs();History.CanAddChanges()&&History.Add(new CChangesDrawingsObject(this,AscDFH.historyitem_Title_SetTx,this.tx,pr));this.tx=pr;this.setParentToChild(pr);this.onUpdate()};CTitle.prototype.setTxPr= function(pr){History.CanAddChanges()&&History.Add(new CChangesDrawingsObject(this,AscDFH.historyitem_Title_SetTxPr,this.txPr,pr));this.txPr=pr;this.setParentToChild(pr);this.onUpdate()};CTitle.prototype.applyChartStyle=function(oChartStyle,oColors,oAdditionalData,bReset){if(!this.parent)return;var nParentType=this.parent.getObjectType();if(nParentType===AscDFH.historyitem_type_Chart)this.applyStyleEntry(oChartStyle.title,oColors.generateColors(1),0,bReset);else if(nParentType===AscDFH.historyitem_type_ValAx|| nParentType===AscDFH.historyitem_type_CatAx||nParentType===AscDFH.historyitem_type_DateAx||nParentType===AscDFH.historyitem_type_SerAx)this.applyStyleEntry(oChartStyle.axisTitle,oColors.generateColors(1),0,bReset)};function CTrendLine(){CBaseChartObject.call(this);this.backward=null;this.dispEq=null;this.dispRSqr=null;this.forward=null;this.intercept=null;this.name=null;this.order=null;this.period=null;this.spPr=null;this.trendlineLbl=null;this.trendlineType=null}InitClass(CTrendLine,CBaseChartObject, AscDFH.historyitem_type_TrendLine);CTrendLine.prototype.setBackward=function(pr){History.CanAddChanges()&&History.Add(new CChangesDrawingsDouble(this,AscDFH.historyitem_Trendline_SetBackward,this.backward,pr));this.backward=pr};CTrendLine.prototype.setDispEq=function(pr){History.CanAddChanges()&&History.Add(new CChangesDrawingsBool(this,AscDFH.historyitem_Trendline_SetDispEq,this.dispEq,pr));this.dispEq=pr};CTrendLine.prototype.setDispRSqr=function(pr){History.CanAddChanges()&&History.Add(new CChangesDrawingsBool(this, AscDFH.historyitem_Trendline_SetDispRSqr,this.dispRSqr,pr));this.dispRSqr=pr};CTrendLine.prototype.setForward=function(pr){History.CanAddChanges()&&History.Add(new CChangesDrawingsDouble(this,AscDFH.historyitem_Trendline_SetForward,this.forward,pr));this.forward=pr};CTrendLine.prototype.setIntercept=function(pr){History.CanAddChanges()&&History.Add(new CChangesDrawingsDouble(this,AscDFH.historyitem_Trendline_SetIntercept,this.intercept,pr));this.intercept=pr};CTrendLine.prototype.setName=function(pr){History.CanAddChanges()&& History.Add(new CChangesDrawingsString(this,AscDFH.historyitem_Trendline_SetName,this.name,pr));this.name=pr};CTrendLine.prototype.setOrder=function(pr){History.CanAddChanges()&&History.Add(new CChangesDrawingsLong(this,AscDFH.historyitem_Trendline_SetOrder,this.order,pr));this.order=pr};CTrendLine.prototype.setPeriod=function(pr){History.CanAddChanges()&&History.Add(new CChangesDrawingsLong(this,AscDFH.historyitem_Trendline_SetPeriod,this.period,pr));this.period=pr};CTrendLine.prototype.setSpPr= function(pr){History.CanAddChanges()&&History.Add(new CChangesDrawingsObject(this,AscDFH.historyitem_Trendline_SetSpPr,this.spPr,pr));this.spPr=pr;this.setParentToChild(pr)};CTrendLine.prototype.setTrendlineLbl=function(pr){History.CanAddChanges()&&History.Add(new CChangesDrawingsObject(this,AscDFH.historyitem_Trendline_SetTrendlineLbl,this.trendlineLbl,pr));this.trendlineLbl=pr;this.setParentToChild(pr)};CTrendLine.prototype.setTrendlineType=function(pr){History.CanAddChanges()&&History.Add(new CChangesDrawingsLong(this, AscDFH.historyitem_Trendline_SetTrendlineType,this.trendlineType,pr));this.trendlineType=pr};CTrendLine.prototype.getChildren=function(){return[this.spPr]};CTrendLine.prototype.fillObject=function(oCopy,oIdMap){if(AscFormat.isRealNumber(this.backward))oCopy.setBackward(this.backward);if(AscFormat.isRealBool(this.dispEq))oCopy.setDispEq(this.dispEq);if(AscFormat.isRealBool(this.dispRSqr))oCopy.setDispRSqr(this.dispRSqr);if(AscFormat.isRealNumber(this.forward))oCopy.setForward(this.forward);if(AscFormat.isRealNumber(this.intercept))oCopy.setIntercept(this.intercept); if(typeof this.name==="string")oCopy.setName(this.name);if(AscFormat.isRealNumber(this.order))oCopy.setOrder(this.order);if(AscFormat.isRealNumber(this.period))oCopy.setPeriod(this.period);if(isRealObject(this.spPr))oCopy.setSpPr(this.spPr.createDuplicate());if(AscFormat.isRealNumber(this.trendlineType))oCopy.setTrendlineType(this.trendlineType)};CTrendLine.prototype.applyChartStyle=function(oChartStyle,oColors,oAdditionalData,bReset){if(!this.parent)return;this.applyStyleEntry(oChartStyle.trendline, oColors.generateColors(1),0,bReset)};function CUpDownBars(){CBaseChartObject.call(this);this.downBars=null;this.gapWidth=null;this.upBars=null}InitClass(CUpDownBars,CBaseChartObject,AscDFH.historyitem_type_UpDownBars);CUpDownBars.prototype.Refresh_RecalcData=function(){if(this.parent)this.parent.Refresh_RecalcData&&this.parent.Refresh_RecalcData()};CUpDownBars.prototype.setDownBars=function(pr){History.CanAddChanges()&&History.Add(new CChangesDrawingsObject(this,AscDFH.historyitem_UpDownBars_SetDownBars, this.downBars,pr));this.downBars=pr;this.setParentToChild(pr)};CUpDownBars.prototype.setGapWidth=function(pr){History.CanAddChanges()&&History.Add(new CChangesDrawingsLong(this,AscDFH.historyitem_UpDownBars_SetGapWidth,this.downBars,pr));this.gapWidth=pr};CUpDownBars.prototype.setUpBars=function(pr){History.CanAddChanges()&&History.Add(new CChangesDrawingsObject(this,AscDFH.historyitem_UpDownBars_SetUpBars,this.downBars,pr));this.upBars=pr;this.setParentToChild(pr)};CUpDownBars.prototype.handleUpdateFill= function(){this.Refresh_RecalcData()};CUpDownBars.prototype.handleUpdateLn=function(){this.Refresh_RecalcData()};CUpDownBars.prototype.getChildren=function(){return[this.upBars,this.downBars]};CUpDownBars.prototype.fillObject=function(oCopy,oIdMap){if(AscFormat.isRealNumber(this.gapWidth))oCopy.setGapWidth(this.gapWidth);if(isRealObject(this.upBars))oCopy.setUpBars(this.upBars.createDuplicate());if(isRealObject(this.downBars))oCopy.setDownBars(this.downBars.createDuplicate())};function CYVal(){CBaseChartObject.call(this); this.numLit=null;this.numRef=null}InitClass(CYVal,CBaseChartObject,AscDFH.historyitem_type_YVal);CYVal.prototype.getChildren=function(){return[this.numLit,this.numRef]};CYVal.prototype.fillObject=function(oCopy,oIdMap){if(this.numLit)oCopy.setNumLit(this.numLit.createDuplicate());if(this.numRef)oCopy.setNumRef(this.numRef.createDuplicate())};CYVal.prototype.setNumLit=function(pr){History.CanAddChanges()&&History.Add(new CChangesDrawingsObject(this,AscDFH.historyitem_YVal_SetNumLit,this.numLit,pr)); this.numLit=pr;this.onChangeDataRefs();this.setParentToChild(pr)};CYVal.prototype.setNumRef=function(pr){History.CanAddChanges()&&History.Add(new CChangesDrawingsObject(this,AscDFH.historyitem_YVal_SetNumRef,this.numRef,pr));this.numRef=pr;this.onChangeDataRefs();this.setParentToChild(pr)};CYVal.prototype.setValues=function(sValues){var oResult;if(typeof sValues==="string"&&sValues.length>0){oResult=new CParseResult;fParseNumLit(sValues,true,oResult);if(oResult.isSuccessful()){if(this.numRef)this.setNumRef(null); this.setNumLit(oResult.getObject())}else{oResult=new CParseResult;fParseNumRef(sValues,true,oResult);if(oResult.isSuccessful()){if(this.numLit)this.setNumLit(null);this.setNumRef(oResult.getObject())}}}else{oResult=new CParseResult;oResult.setError(Asc.c_oAscError.NoValues)}return oResult};CYVal.prototype.getValuesCount=function(){if(this.numLit)return this.numLit.ptCount;if(this.numRef)return this.numRef.getValuesCount();return 0};CYVal.prototype.getValues=function(nMaxValues){if(this.numLit)return this.numLit.getValues(nMaxValues); if(this.numRef)return this.numRef.getValues(nMaxValues)};CYVal.prototype.getFormula=function(){if(this.numLit)return this.numLit.getFormula();if(this.numRef)return this.numRef.getFormula()};CYVal.prototype.getRefFormula=function(){if(this.numRef)return this.numRef.getFormula();return null};CYVal.prototype.getDataRefs=function(){if(this.numRef)return this.numRef.getDataRefs();return new CDataRefs([])};CYVal.prototype.collectRefs=function(aRefs){if(this.numRef)aRefs.push(this.numRef)};CYVal.prototype.isValid= function(){if(this.numRef||this.numLit)return true;return false};CYVal.prototype.update=function(displayEmptyCellsAs,displayHidden,ser){if(this.numRef)this.numRef.updateCache(displayEmptyCellsAs,displayHidden,ser)};CYVal.prototype.getSourceNumFormat=function(nPtIdx){if(this.numRef)return this.numRef.getNumFormat(nPtIdx);if(this.numLit)return this.numLit.getNumFormat(nPtIdx);return"General"};CYVal.prototype.handleOnChangeSheetName=function(sOldSheetName,sNewSheetName){if(this.numRef)this.numRef.handleOnChangeSheetName(sOldSheetName, sNewSheetName)};CYVal.prototype.fillFromAsc=function(oValCache,bUseCache){this.setNumRef(new AscFormat.CNumRef);var oNumRef=this.numRef;oNumRef.fillFromAsc(oValCache,bUseCache)};CYVal.prototype.getNumCache=function(){if(this.numRef&&this.numRef.numCache)return this.numRef.numCache;else if(this.numLit)return this.numLit;return null};function CCat(){CBaseChartObject.call(this);this.multiLvlStrRef=null;this.numLit=null;this.numRef=null;this.strLit=null;this.strRef=null;this.calculatedRef=null}InitClass(CCat, CBaseChartObject,AscDFH.historyitem_type_Cat);CCat.prototype.getChildren=function(){return[this.multiLvlStrRef,this.numLit,this.numRef,this.strLit,this.strRef]};CCat.prototype.fillObject=function(oCopy,oIdMap){if(this.multiLvlStrRef)oCopy.setMultiLvlStrRef(this.multiLvlStrRef.createDuplicate());if(this.numLit)oCopy.setNumLit(this.numLit.createDuplicate());if(this.numRef)oCopy.setNumRef(this.numRef.createDuplicate());if(this.strLit)oCopy.setStrLit(this.strLit.createDuplicate());if(this.strRef)oCopy.setStrRef(this.strRef.createDuplicate())}; CCat.prototype.setMultiLvlStrRef=function(pr){History.CanAddChanges()&&History.Add(new CChangesDrawingsObject(this,AscDFH.historyitem_Cat_SetMultiLvlStrRef,this.multiLvlStrRef,pr));this.multiLvlStrRef=pr;this.onChangeDataRefs();this.setParentToChild(pr)};CCat.prototype.setNumLit=function(pr){History.CanAddChanges()&&History.Add(new CChangesDrawingsObject(this,AscDFH.historyitem_Cat_SetNumLit,this.multiLvlStrRef,pr));this.numLit=pr;this.onChangeDataRefs();this.setParentToChild(pr)};CCat.prototype.setNumRef= function(pr){History.CanAddChanges()&&History.Add(new CChangesDrawingsObject(this,AscDFH.historyitem_Cat_SetNumRef,this.multiLvlStrRef,pr));this.numRef=pr;this.onChangeDataRefs();this.setParentToChild(pr)};CCat.prototype.setStrLit=function(pr){History.CanAddChanges()&&History.Add(new CChangesDrawingsObject(this,AscDFH.historyitem_Cat_SetStrLit,this.multiLvlStrRef,pr));this.strLit=pr;this.setParentToChild(pr)};CCat.prototype.setStrRef=function(pr){History.CanAddChanges()&&History.Add(new CChangesDrawingsObject(this, AscDFH.historyitem_Cat_SetStrRef,this.multiLvlStrRef,pr));this.strRef=pr;this.onChangeDataRefs();this.setParentToChild(pr)};CCat.prototype.setValues=function(sValues){this.calculatedRef=null;var oNumRef,oNumLit,oStrRef,oStrLit,oMultiLvl,oRef,oResult;oResult=new CParseResult;fParseNumRef(sValues,false,oResult);oNumRef=oResult.getObject();if(!oNumRef){fParseStrRef(sValues,true,oResult);oRef=oResult.getObject();if(oRef)if(oRef.getObjectType()===AscDFH.historyitem_type_StrRef)oStrRef=oRef;else if(oRef.getObjectType()=== AscDFH.historyitem_type_MultiLvlStrRef)oMultiLvl=oRef;if(!oStrRef&&!oMultiLvl){fParseNumLit(sValues,false,oResult);oNumLit=oResult.getObject();if(!oNumLit){fParseStrLit(sValues,oResult);oStrLit=oResult.getObject()}}}if(oNumRef||oNumLit||oStrRef||oStrLit||oMultiLvl)if(oNumRef){this.setNumRef(oNumRef);this.setNumLit(null);this.setStrRef(null);this.setStrLit(null);this.setMultiLvlStrRef(null)}else if(oStrRef){this.setStrRef(oStrRef);this.setNumRef(null);this.setNumLit(null);this.setStrLit(null);this.setMultiLvlStrRef(null)}else if(oMultiLvl){this.setMultiLvlStrRef(oMultiLvl); this.setNumRef(null);this.setNumLit(null);this.setStrRef(null);this.setStrLit(null)}else if(oNumLit){this.setNumLit(oNumLit);this.setNumRef(null);this.setStrRef(null);this.setStrLit(null);this.setMultiLvlStrRef(null)}else if(oStrLit){this.setStrLit(oStrLit);this.setNumRef(null);this.setNumLit(null);this.setStrRef(null);this.setMultiLvlStrRef(null)}return oResult};CCat.prototype.getValues=function(nMaxCount){if(this.numLit)return this.numLit.getValues(nMaxCount);if(this.numRef)return this.numRef.getValues(nMaxCount); if(this.strLit)return this.strLit.getValues(nMaxCount);if(this.strRef)return this.strRef.getValues(nMaxCount,true);if(this.multiLvlStrRef)return this.multiLvlStrRef.getValues(nMaxCount)};CCat.prototype.getFormula=function(){if(this.numLit)return this.numLit.getFormula();if(this.numRef)return this.numRef.getFormula();if(this.strLit)return this.strLit.getFormula();if(this.strRef)return this.strRef.getFormula();if(this.multiLvlStrRef)return this.multiLvlStrRef.getFormula();return""};CCat.prototype.getDataRefs= function(){if(this.numRef)return this.numRef.getDataRefs();if(this.strRef)return this.strRef.getDataRefs();if(this.multiLvlStrRef)return this.multiLvlStrRef.getDataRefs();return new CDataRefs([])};CCat.prototype.collectRefs=function(aRefs){if(this.numRef)aRefs.push(this.numRef);if(this.strRef)aRefs.push(this.strRef);if(this.multiLvlStrRef)aRefs.push(this.multiLvlStrRef)};CCat.prototype.isValid=function(){if(this.multiLvlStrRef||this.numLit||this.numRef||this.strLit||this.strRef)return true;return false}; CCat.prototype.getStringPointsLit=function(){if(this.calculatedRef){if(this.calculatedRef.strCache)return this.calculatedRef.strCache;return null}if(this.strRef&&this.strRef.strCache)return this.strRef.strCache;else if(this.strLit)return this.strLit;else if(this.multiLvlStrRef)return this.multiLvlStrRef.getFirstLvlCache();return null};CCat.prototype.getLit=function(){if(this.calculatedRef){if(this.calculatedRef.strCache)return this.calculatedRef.strCache;if(this.calculatedRef.numCache)return this.calculatedRef.numCache; if(this.calculatedRef.getFirstLvlCache)return this.calculatedRef.getFirstLvlCache();return null}var oLit=null;if(this.strRef&&this.strRef.strCache)oLit=this.strRef.strCache;else if(this.strLit)oLit=this.strLit;else if(this.numRef&&this.numRef.numCache)oLit=this.numRef.numCache;else if(this.numLit)oLit=this.numLit;else if(this.multiLvlStrRef)oLit=this.multiLvlStrRef.getFirstLvlCache();return oLit};CCat.prototype.update=function(oSeries){return AscFormat.ExecuteNoHistory(function(){this.calculatedRef= null;if(this.numRef||this.strRef||this.multiLvlStrRef){var sFormula=this.getFormula();if(typeof sFormula==="string"&&sFormula.length>0){var oTestCat=new CCat;var oRes=oTestCat.setValues(sFormula);var oNumRef=oTestCat.numRef;var oStrRef=oTestCat.strRef;var oMultiLvlStrRef=oTestCat.multiLvlStrRef;if(oRes&&oRes.error===Asc.c_oAscError.ID.No&&(oNumRef||oStrRef||oMultiLvlStrRef)){this.calculatedRef=oNumRef||oStrRef||oMultiLvlStrRef;if(this.calculatedRef)if(this.calculatedRef.getObjectType()===AscDFH.historyitem_type_MultiLvlStrRef)this.calculatedRef.updateCache(oSeries); else this.calculatedRef.updateCache()}}}if(this.multiLvlStrRef)this.multiLvlStrRef.updateCache(oSeries);if(this.numRef)this.numRef.updateCache();if(this.strRef)this.strRef.updateCache();if(!this.calculatedRef)this.calculatedRef=this.multiLvlStrRef||this.numRef||this.strRef},this,[])};CCat.prototype.getSourceNumFormat=function(){if(this.calculatedRef){if(this.calculatedRef.getObjectType()===AscDFH.historyitem_type_NumRef)return this.calculatedRef.getNumFormat();return"General"}if(this.numRef)return this.numRef.getNumFormat(); if(this.numLit)return this.numLit.getNumFormat();return"General"};CCat.prototype.handleOnChangeSheetName=function(sOldSheetName,sNewSheetName){if(this.multiLvlStrRef)this.multiLvlStrRef.handleOnChangeSheetName(sOldSheetName,sNewSheetName);if(this.numRef)this.numRef.handleOnChangeSheetName(sOldSheetName,sNewSheetName);if(this.strRef)this.strRef.handleOnChangeSheetName(sOldSheetName,sNewSheetName)};CCat.prototype.fillFromAsc=function(oCatCache,bUseCache){var bVal=false;var sFormatCode=oCatCache.formatCode; var oNumFormat=null;if(typeof sFormatCode==="string"&&sFormatCode.length>0)oNumFormat=AscCommon.oNumFormatCache.get(oCatCache.formatCode);if(oNumFormat&&oNumFormat.isDateTimeFormat()){var aPts=oCatCache.NumCache,oPt,nPt;for(nPt=0;nPt0){oNumFormat=AscCommon.oNumFormatCache.get(sFormatCode);if(!oNumFormat.isDateTimeFormat()||!AscFormat.isRealNumber(parseFloat(oPt.val)))break}}}if(nPt=== aPts.length)bVal=true}if(bVal){this.setNumRef(new CNumRef);this.numRef.fillFromAsc(oCatCache,bUseCache)}else{this.setStrRef(new CStrRef);this.strRef.fillFromAsc(oCatCache,bUseCache)}};CCat.prototype.getNumCache=function(){if(this.calculatedRef){if(this.calculatedRef.getObjectType()===AscDFH.historyitem_type_NumRef)return this.calculatedRef.numCache;return null}if(this.numRef&&this.numRef.numCache)return this.numRef.numCache;else if(this.numLit)return this.numLit;return null};function CChart(){CBaseChartObject.call(this); this.autoTitleDeleted=null;this.backWall=null;this.dispBlanksAs=null;this.floor=null;this.legend=null;this.pivotFmts=[];this.plotArea=null;this.plotVisOnly=null;this.showDLblsOverMax=null;this.sideWall=null;this.title=null;this.view3D=null}InitClass(CChart,CBaseChartObject,AscDFH.historyitem_type_Chart);CChart.prototype.Refresh_RecalcData=function(){this.onChartInternalUpdate()};CChart.prototype.CheckCorrect=function(){if(!this.plotArea)return false;return true};CChart.prototype.getView3d=function(){return AscFormat.ExecuteNoHistory(function(){var _ret; var oChart=this.plotArea&&this.plotArea.charts[0];if(oChart){if(this.view3D){_ret=this.view3D.createDuplicate();if(oChart.getObjectType()===AscDFH.historyitem_type_SurfaceChart){if(!AscFormat.isRealNumber(_ret.rotX))_ret.rotX=15;if(!AscFormat.isRealNumber(_ret.rotY))_ret.rotY=20}else{if(!AscFormat.isRealNumber(_ret.rotX))_ret.rotX=0;if(!AscFormat.isRealNumber(_ret.rotY))_ret.rotY=0}return _ret}if(oChart.b3D){_ret=new CView3d;_ret.setRotX(30);_ret.setRotY(0);_ret.setRAngAx(false);_ret.setDepthPercent(100); return _ret}}return null},this,[])};CChart.prototype.getParentObjects=function(){return this.parent&&this.parent.getParentObjects()};CChart.prototype.handleUpdateDataLabels=function(){this.onChartUpdateDataLabels()};CChart.prototype.handleUpdateFill=function(){if(this.parent&&this.parent.handleUpdateFill)this.parent.handleUpdateFill()};CChart.prototype.handleUpdateLn=function(){if(this.parent&&this.parent.handleUpdateLn)this.parent.handleUpdateLn()};CChart.prototype.setDefaultWalls=function(){var oFloor= new CChartWall;oFloor.setThickness(0);this.setFloor(oFloor);var oSideWall=new CChartWall;oSideWall.setThickness(0);this.setSideWall(oSideWall);var oBackWall=new CChartWall;oBackWall.setThickness(0);this.setBackWall(oBackWall)};CChart.prototype.getChildren=function(){var aRet=[];aRet.push(this.backWall);aRet.push(this.floor);aRet.push(this.legend);var Count=this.pivotFmts.length;for(var i=0;i=this.x&&ty>=this.y&&tx<=this.x+this.extX&&ty<=this.y+this.extY}return false};CValAxisLabels.prototype.draw=function(g){if(this.chart);for(var i=0;imax_width)max_width=par.Lines[j].Ranges[0].W;this.contentWidth=max_width;this.contentHeight=this.txBody.getSummaryHeight()};CalcLegendEntry.prototype.hit=function(x,y){var tx,ty,oGeometry;if(this.invertTransformText){tx=this.invertTransformText.TransformPointX(x,y);ty=this.invertTransformText.TransformPointY(x, y);if(tx>=0&&tx<=this.contentWidth&&ty>=0&&ty<=this.contentHeight)return true}if(this.chart){var oCanvasHit=this.chart.getCanvasContext();var calcMarkerUnion=this.calcMarkerUnion;if(calcMarkerUnion.marker&&calcMarkerUnion.marker.invertTransform){tx=calcMarkerUnion.marker.invertTransform.TransformPointX(x,y);ty=calcMarkerUnion.marker.invertTransform.TransformPointY(x,y);oGeometry=calcMarkerUnion.marker.spPr.geometry;if(oGeometry.hitInInnerArea(oCanvasHit,tx,ty)||oGeometry.hitInPath(oCanvasHit,tx,ty))return true}if(calcMarkerUnion.lineMarker&& calcMarkerUnion.lineMarker.invertTransform){tx=calcMarkerUnion.lineMarker.invertTransform.TransformPointX(x,y);ty=calcMarkerUnion.lineMarker.invertTransform.TransformPointY(x,y);oGeometry=calcMarkerUnion.lineMarker.spPr.geometry;if(oGeometry.hitInInnerArea(oCanvasHit,tx,ty)||oGeometry.hitInPath(oCanvasHit,tx,ty))return true}}return false};CalcLegendEntry.prototype.getTxPrParaPr=function(){if(this.txPr)return this.txPr.getFirstParaParaPr();return null};CalcLegendEntry.prototype.isForm=function(){return false}; function CompiledMarker(){this.spPr=new AscFormat.CSpPr;this.x=null;this.y=null;this.extX=null;this.extY=null;this.localX=null;this.localY=null;this.transform=new CMatrix;this.localTransform=new CMatrix;this.pen=null;this.brush=null}CompiledMarker.prototype.draw=CShape.prototype.draw;CompiledMarker.prototype.check_bounds=CShape.prototype.check_bounds;CompiledMarker.prototype.isEmptyPlaceholder=function(){return false};function CUnionMarker(){this.lineMarker=null;this.marker=null}CUnionMarker.prototype.draw= function(g){this.lineMarker&&this.lineMarker.draw(g);this.marker&&this.marker.draw(g)};function CreateMarkerGeometryByType(type){var ret=new AscFormat.Geometry;var w=43200,h=43200;function AddRect(geom,w,h){geom.AddPathCommand(1,"0","0");geom.AddPathCommand(2,w+"","0");geom.AddPathCommand(2,w+"",h+"");geom.AddPathCommand(2,"0",h+"");geom.AddPathCommand(6)}function AddPlus(geom,w,h){geom.AddPathCommand(0,undefined,"none",undefined,w,h);geom.AddPathCommand(1,w/2+"","0");geom.AddPathCommand(2,w/2+"", h+"");geom.AddPathCommand(1,"0",h/2+"");geom.AddPathCommand(2,w+"",h/2+"")}function AddX(geom,w,h){geom.AddPathCommand(0,undefined,"none",undefined,w,h);geom.AddPathCommand(1,"0","0");geom.AddPathCommand(2,w+"",h+"");geom.AddPathCommand(1,w+"","0");geom.AddPathCommand(2,"0",h+"")}switch(type){case SYMBOL_CIRCLE:{ret.AddPathCommand(0,undefined,undefined,undefined,w,h);ret.AddPathCommand(1,"0",h/2+"");ret.AddPathCommand(3,w/2+"",h/2+"","cd2","cd4");ret.AddPathCommand(3,w/2+"",h/2+"","_3cd4","cd4"); ret.AddPathCommand(3,w/2+"",h/2+"","0","cd4");ret.AddPathCommand(3,w/2+"",h/2+"","cd4","cd4");ret.AddPathCommand(6);break}case SYMBOL_DASH:case SYMBOL_DOT:{ret.AddPathCommand(0,undefined,"none",undefined,w,h);ret.AddPathCommand(1,type===SYMBOL_DASH?"0":w/2+"",h/2+"");ret.AddPathCommand(2,w+"",h/2+"");break}case SYMBOL_DIAMOND:{ret.AddPathCommand(0,undefined,undefined,undefined,w,h);ret.AddPathCommand(1,w/2+"","0");ret.AddPathCommand(2,w+"",h/2+"");ret.AddPathCommand(2,w/2+"",h+"");ret.AddPathCommand(2, "0",h/2+"");ret.AddPathCommand(6);break}case SYMBOL_NONE:{break}case SYMBOL_PICTURE:case SYMBOL_SQUARE:{ret.AddPathCommand(0,undefined,undefined,undefined,w,h);AddRect(ret,w,h);break}case SYMBOL_PLUS:{ret.AddPathCommand(0,undefined,undefined,false,w,h);AddRect(ret,w,h);ret.AddPathCommand(0,undefined,"none",false,w,h);AddPlus(ret,w,h);break}case SYMBOL_STAR:{ret.AddPathCommand(0,undefined,undefined,false,w,h);AddRect(ret,w,h);ret.AddPathCommand(0,undefined,"none",false,w,h);AddPlus(ret,w,h);AddX(ret, w,h);break}case SYMBOL_TRIANGLE:{ret.AddPathCommand(0,undefined,undefined,undefined,w,h);ret.AddPathCommand(1,w/2+"","0");ret.AddPathCommand(2,w+"",h+"");ret.AddPathCommand(2,"0",h+"");ret.AddPathCommand(6);break}case SYMBOL_X:{ret.AddPathCommand(0,undefined,undefined,false,w,h);AddRect(ret,w,h);ret.AddPathCommand(0,undefined,"none",false,w,h);AddX(ret,w,h);break}}var ret2=new CompiledMarker;ret2.spPr.geometry=ret;return ret2}function isScatterChartType(nType){return Asc.c_oAscChartTypeSettings.scatter=== nType||Asc.c_oAscChartTypeSettings.scatterLine===nType||Asc.c_oAscChartTypeSettings.scatterLineMarker===nType||Asc.c_oAscChartTypeSettings.scatterMarker===nType||Asc.c_oAscChartTypeSettings.scatterNone===nType||Asc.c_oAscChartTypeSettings.scatterSmooth===nType||Asc.c_oAscChartTypeSettings.scatterSmoothMarker===nType}function isStockChartType(nType){return Asc.c_oAscChartTypeSettings.stock===nType}function isComboChartType(nType){return Asc.c_oAscChartTypeSettings.comboAreaBar===nType||Asc.c_oAscChartTypeSettings.comboBarLine=== nType||Asc.c_oAscChartTypeSettings.comboBarLineSecondary===nType||Asc.c_oAscChartTypeSettings.comboCustom===nType}function CParseResult(){this.error=Asc.c_oAscError.ID.No;this.obj=null}CParseResult.prototype.setError=function(val){this.error=val;if(val!==Asc.c_oAscError.ID.No)this.obj=null};CParseResult.prototype.setObject=function(val){this.obj=val};CParseResult.prototype.isSuccessful=function(){return this.error===Asc.c_oAscError.ID.No&&this.obj!==null};CParseResult.prototype.getObject=function(){return this.obj}; CParseResult.prototype.getError=function(){return this.error};function fParseChartFormula(sFormula){var res;AscCommonExcel.executeInR1C1Mode(false,function(){res=fParseChartFormulaInternal(sFormula)});return res}function fParseChartFormulaExternal(sFormula){var res;AscCommonExcel.executeInR1C1Mode(false,function(){res=fParseChartFormulaInternal(sFormula)});if(!Array.isArray(res)||res.length===0)AscCommonExcel.executeInR1C1Mode(true,function(){res=fParseChartFormulaInternal(sFormula)});return res} function fParseChartFormulaInternal(sFormula){if(!(typeof sFormula==="string"&&sFormula.length>0))return[];var oWB=Asc.editor&&Asc.editor.wbModel;if(!oWB)return[];var _sFormula=sFormula;if(_sFormula.charAt(0)==="=")_sFormula=_sFormula.slice(1);var oWS=oWB.getWorksheet(0);if(!oWS)return[];var aParsed=AscCommonExcel.getRangeByRef(_sFormula,oWS);for(var nParsed=aParsed.length-1;nParsed>-1;nParsed--)if(!aParsed[nParsed].bbox||!aParsed[nParsed].worksheet)aParsed.splice(nParsed,1);return aParsed}function fCreateRef(oBBoxInfo){if(oBBoxInfo)return AscCommon.parserHelp.getEscapeSheetName(oBBoxInfo.worksheet.getName())+ "!"+oBBoxInfo.bbox.getAbsName();return null}function fParseSingleRow(sVal,fCallback){if(sVal[0]!=="{"||sVal[sVal.length-1]!=="}")return null;var oParser,bResult,result=null;oParser=new AscCommonExcel.parserFormula(sVal,null,Asc.editor.wbModel.aWorksheets[0]);bResult=oParser.parse(true,true);if(bResult&&oParser.outStack.length===1){var oLastElem=oParser.outStack[0];if(oLastElem.type===AscCommonExcel.cElementType.array&&oLastElem.getRowCount()===1){var aRow=oLastElem.getRow(0);result=fCallback(aRow)}}return result} function fParseNumArray(sVal,bForce){return fParseSingleRow(sVal,function(bForce){return function(aRow){var result=null,oToken,nIndex;if(aRow.length>0){result=[];for(nIndex=0;nIndex0){result=[];for(nIndex=0;nIndex0){if(sVal[0]==="="){sParsed=sVal.slice(1);aNumbers=fParseNumArray(sParsed,bForce)}else{sParsed=sVal;aNumbers=fParseNumArray(sParsed,bForce);if(!Array.isArray(aNumbers)){sParsed="{"+sParsed+"}";aNumbers=fParseNumArray(sParsed, bForce)}}if(Array.isArray(aNumbers)&&aNumbers.length>0){result=new CNumLit;result.setFormatCode("General");for(nIndex=0;nIndex0){if(sVal[0]=== "="){sParsed=sVal.slice(1);aStr=fParseStrArray(sParsed)}else{sParsed=sVal;aStr=fParseStrArray(sParsed);if(!Array.isArray(aStr)){sParsed="{"+sParsed+"}";aStr=fParseStrArray(sParsed)}}if(Array.isArray(aStr)&&aStr.length>0){result=new CStrCache;for(nIndex=0;nIndex 0){aParsed=fGetParsedArray(sVal);if(Array.isArray(aParsed)&&aParsed.length>0){var aRanges=fParseChartFormulaExternal(sVal);if(aRanges.length===aParsed.length){var sFormula;if(aParsed.length>1)sFormula="(";else sFormula="";for(nIndex=0;nIndex0)sFormula+=",";AscCommonExcel.executeInR1C1Mode(false,function(){sFormula+=fCreateRef(oRange)})}if(aParsed.length>1)sFormula+=")";result=new CNumRef;result.setF(sFormula);oResult.setError(Asc.c_oAscError.ID.No);oResult.setObject(result)}else fCheckParseRefsError(aParsed, oResult)}else oResult.setError(Asc.c_oAscError.ID.ErrorInFormula)}else oResult.setError(Asc.c_oAscError.ID.ErrorInFormula)}function fParseStrRef(sVal,bMultiLvl,oResult){var result=null,aParsed,nIndex,oRange;var bMultyRange=false;if(typeof sVal==="string"&&sVal.length>0){aParsed=fGetParsedArray(sVal);if(Array.isArray(aParsed)&&aParsed.length>0){var aRanges=fParseChartFormulaExternal(sVal);if(aRanges.length===aParsed.length){var sFormula;if(aRanges.length>1)sFormula="(";else sFormula="";for(nIndex= 0;nIndex0)sFormula+=",";AscCommonExcel.executeInR1C1Mode(false,function(){sFormula+=fCreateRef(oRange)})}if(aParsed.length>1)sFormula+=")";if(bMultyRange){result=new CMultiLvlStrRef;result.setF(sFormula)}else{result=new CStrRef;result.setF(sFormula)}oResult.setError(Asc.c_oAscError.ID.No); oResult.setObject(result)}else fCheckParseRefsError(aParsed,oResult)}}}var SERIES_FLAG_HOR_VALUE=1;var SERIES_FLAG_VERT_VALUE=2;var SERIES_FLAG_CAT=4;var SERIES_FLAG_TX=8;var SERIES_FLAG_CONTINUOUS=16;function CDataRefs(aRefs){this.aRefs=[];this.ref=null;for(var nRef=0;nRef-1;--nRef){oRef=this.aRefs[nRef];oBBox=oRef.bbox;for(nOtherRef= nRef-1;nOtherRef>-1;--nOtherRef){oOtherRef=this.aRefs[nOtherRef];oOtherBBox=oOtherRef.bbox;if(oRef.worksheet===oOtherRef.worksheet)if(oBBox.isNeighbor(oOtherBBox)){oBBox.union2(oOtherBBox);this.aRefs.splice(nOtherRef,1);break}}if(nOtherRef>-1)break}while(nRef>-1)};CDataRefs.prototype.clone=function(){var oCopy=new CDataRefs([]);for(var nRef=0;nRef0)sResult="="+sResult;return sResult};CDataRefs.prototype.getFormula=function(){var sRes;var oThis=this;AscCommonExcel.executeInR1C1Mode(false,function(){sRes=oThis.getFormulaWithCurrentMode()});return sRes};CDataRefs.prototype.getFormulaWithCurrentMode=function(){var sResult="";var sCurRef;for(var nRef=0;nRef0;--nRef)if(aHorRefs[nRef].bbox.c10;--nRef)if(aVertRefs[nRef].bbox.r1=oBBox.c1){for(nRow=oBBox.r1+1;nRow<=oBBox.r2;++nRow){for(nCol=oBBox.c1;nCol<=nEndCol;++nCol){oCell=oRef.worksheet.getCell3(nRow,nCol);if(!oCell.isEmptyTextString())break}if(nCol<=nEndCol)break}nEndRow=nRow-1;if(nEndCol===oBBox.c2)if(aGridRow.length===1)if(oBBox.c1===oBBox.c2)nEndCol=oBBox.c1-1;else nEndCol=oBBox.c1;if(nEndRow=== oBBox.r2)if(aGrid.length===1)if(oBBox.r1===oBBox.r2)nEndRow=oBBox.r1-1;else nEndRow=oBBox.r1;nTopHeader=nEndRow-oBBox.r1;nLeftHeader=nEndCol-oBBox.c1}if(nTopHeader<0&&nLeftHeader<0){aGridRow=aGrid[0];oRef=aGridRow[aGridRow.length-1];oBBox=oRef.bbox;nCol=oBBox.c2;var nStartRow=oBBox.r2;if(aGridRow.length===1){for(nRow=oBBox.r2-1;nRow>=oBBox.r1;--nRow)if(!this.privateCheckCellDateTimeFormatFull(oRef.worksheet.getCell3(nRow,nCol)))break;nStartRow=nRow}for(nRow=nStartRow;nRow>=oBBox.r1;--nRow)if(this.privateCheckCellValueForHeader(oRef.worksheet.getCell3(nRow, nCol)))break;nTopHeader=nRow-oBBox.r1;if(nRow===oBBox.r2)if(aGridRow.length===1)nTopHeader-=1;aGridRow=aGrid[aGrid.length-1];oRef=aGridRow[0];oBBox=oRef.bbox;nRow=oBBox.r2;var nStartCol=oBBox.c2;if(aGrid.length===1){for(nCol=oBBox.c2-1;nCol>=oBBox.c1;--nCol)if(!this.privateCheckCellDateTimeFormatFull(oRef.worksheet.getCell3(nRow,nCol)))break;nStartCol=nCol}for(nCol=nStartCol;nCol>=oBBox.c1;--nCol)if(this.privateCheckCellValueForHeader(oRef.worksheet.getCell3(nRow,nCol)))break;nLeftHeader=nCol-oBBox.c1; if(nCol===oBBox.r2)if(aGrid.length===1)nLeftHeader-=1}bHorizontalValues=bHorValue;nRowsCount=0;nColsCount=0;for(nRow=0;nRownColsCount)bHorizontalValues=false;else bHorizontalValues= true;if(bScatter)if(bHorizontalValues){if(nTopHeader===-1&&nRowsCount>1)nTopHeader=0}else if(nLeftHeader===-1&&nColsCount>1)nLeftHeader=0;oVal=new CDataRefs([]);oCat=new CDataRefs([]);oTx=new CDataRefs([]);if(nTopHeader>-1){if(bHorizontalValues)nInfo|=SERIES_FLAG_CAT;else nInfo|=SERIES_FLAG_TX;aGridRow=aGrid[0];for(nRef=0;nRef-1){if(bHorizontalValues)nInfo|=SERIES_FLAG_TX;else nInfo|=SERIES_FLAG_CAT;for(nGridRow=0;nGridRownColsCount)bHorizontalValues=false;else bHorizontalValues=true}for(nRef=0;nRef0)for(nCatRef=0;nCatRef0)for(nTxRef=0;nTxRef0)for(nCatRef=0;nCatRef0)for(nTxRef=0;nTxRefAscFormat.MAX_SERIES_COUNT)return Asc.c_oAscError.ID.MaxDataSeriesError;for(nRef=0;nRefAscFormat.MAX_POINTS_COUNT)return Asc.c_oAscError.ID.MaxDataPointsError;return Asc.c_oAscError.ID.No};CChartDataRefs.prototype.fillSelectedRanges= function(oWSView){this.updateDataRefs();fFillSelectedRanges(this.val,this.cat,this.tx,this.info,false,oWSView)};CChartDataRefs.prototype.fillFromSelectedRange=function(oSelectedRange){this.updateDataRefs();fFillDataFromSelectedRange(this,oSelectedRange)};CChartDataRefs.prototype.privateCheckCellValueForHeader=function(oCell){if(!this.privateCheckCellValueNumberOrEmpty(oCell))return true;return this.privateCheckCellDateTimeFormat(oCell)};CChartDataRefs.prototype.privateCheckCellValueNumberOrEmpty= function(oCell){var sValue=oCell.getValue();if(AscCommon.isNumber(sValue)||sValue==="")return true;return false};CChartDataRefs.prototype.privateCheckCellDateTimeFormat=function(oCell){var nNumFmtType=oCell.getNumFormatType();if(Asc.c_oAscNumFormatType.Time===nNumFmtType||Asc.c_oAscNumFormatType.Date===nNumFmtType)return true;return false};CChartDataRefs.prototype.privateCheckCellDateTimeFormatFull=function(oCell){if(this.privateCheckCellValueNumberOrEmpty(oCell)&&this.privateCheckCellDateTimeFormat(oCell))return true; return false};CChartDataRefs.prototype.hasIntersection=function(oRange){var sWSName=oRange.worksheet.getName();var oSheetBounds=this.boundsByWS[sWSName];if(!oSheetBounds)return false;if(!oSheetBounds.isIntersect(oRange))return false;if(this.info!==0){if(this.val.hasIntersection(oRange))return true;if(this.cat.hasIntersection(oRange))return true;if(this.tx.hasIntersection(oRange))return true}else for(var nSeries=0;nSeries0){for(var nSeries=0;nSeries0){var nVariation=nColor/aBaseColors.length>>0;oVariation=aVariations[nVariation%aVariations.length]}var oColor=oBaseColor.createDuplicate();if(oVariation)oColor.Mods=oVariation.createDuplicate(); aColors.push(oColor)}return aColors};CChartColors.prototype.generateWithinLinearColors=function(aBaseColors,aVariations,nCount){return this.generateCycleColors(aBaseColors,aVariations,nCount)};CChartColors.prototype.generateAcrossLinearColors=function(aBaseColors,aVariations,nCount){return this.generateCycleColors(aBaseColors,aVariations,nCount)};CChartColors.prototype.generateWithinLinearReversedColors=function(aBaseColors,aVariations,nCount){return this.generateCycleColors(aBaseColors,aVariations, nCount)};CChartColors.prototype.generateAcrossLinearReversedColors=function(aBaseColors,aVariations,nCount){return this.generateCycleColors(aBaseColors,aVariations,nCount)};CChartColors.prototype.generateColors=function(nCount){var aBaseColors=this.getBaseColors();var aVariations=this.getVariations();var sMeth=this.meth||"cycle";if("cycle"===sMeth)return this.generateCycleColors(aBaseColors,aVariations,nCount);else if("withinLinear"===sMeth)return this.generateWithinLinearColors(aBaseColors,aVariations, nCount);else if("acrossLinear"===sMeth)return this.generateAcrossLinearColors(aBaseColors,aVariations,nCount);else if("withinLinearReversed"===sMeth)return this.generateWithinLinearReversedColors(aBaseColors,aVariations,nCount);else if("acrossLinearReversed"===sMeth)return this.generateAcrossLinearReversedColors(aBaseColors,aVariations,nCount);return[]};AscDFH.drawingsConstructorsMap[AscDFH.historyitem_ChartSpace_ChartColors]=CChartColors;window["AscFormat"]=window["AscFormat"]||{};window["AscFormat"].CDLbl= CDLbl;window["AscFormat"].CPlotArea=CPlotArea;window["AscFormat"].CBarChart=CBarChart;window["AscFormat"].CAreaChart=CAreaChart;window["AscFormat"].CAreaSeries=CAreaSeries;window["AscFormat"].CCatAx=CCatAx;window["AscFormat"].CDateAx=CDateAx;window["AscFormat"].CSerAx=CSerAx;window["AscFormat"].CValAx=CValAx;window["AscFormat"].CBandFmt=CBandFmt;window["AscFormat"].CBarSeries=CBarSeries;window["AscFormat"].CBubbleChart=CBubbleChart;window["AscFormat"].CBubbleSeries=CBubbleSeries;window["AscFormat"].CCat= CCat;window["AscFormat"].CChartText=CChartText;window["AscFormat"].CDLbls=CDLbls;window["AscFormat"].CDPt=CDPt;window["AscFormat"].CDTable=CDTable;window["AscFormat"].CDispUnits=CDispUnits;window["AscFormat"].CDoughnutChart=CDoughnutChart;window["AscFormat"].CErrBars=CErrBars;window["AscFormat"].CLayout=CLayout;window["AscFormat"].CLegend=CLegend;window["AscFormat"].CLegendEntry=CLegendEntry;window["AscFormat"].CLineChart=CLineChart;window["AscFormat"].CLineSeries=CLineSeries;window["AscFormat"].CMarker= CMarker;window["AscFormat"].CMinusPlus=CMinusPlus;window["AscFormat"].CMultiLvlStrCache=CMultiLvlStrCache;window["AscFormat"].CMultiLvlStrRef=CMultiLvlStrRef;window["AscFormat"].CNumRef=CNumRef;window["AscFormat"].CNumericPoint=CNumericPoint;window["AscFormat"].CNumFmt=CNumFmt;window["AscFormat"].CNumLit=CNumLit;window["AscFormat"].COfPieChart=COfPieChart;window["AscFormat"].CPictureOptions=CPictureOptions;window["AscFormat"].CPieChart=CPieChart;window["AscFormat"].CPieSeries=CPieSeries;window["AscFormat"].CPivotFmt= CPivotFmt;window["AscFormat"].CRadarChart=CRadarChart;window["AscFormat"].CRadarSeries=CRadarSeries;window["AscFormat"].CScaling=CScaling;window["AscFormat"].CScatterChart=CScatterChart;window["AscFormat"].CScatterSeries=CScatterSeries;window["AscFormat"].CTx=CTx;window["AscFormat"].CStockChart=CStockChart;window["AscFormat"].CStrCache=CStrCache;window["AscFormat"].CStringPoint=CStringPoint;window["AscFormat"].CStrRef=CStrRef;window["AscFormat"].CSurfaceChart=CSurfaceChart;window["AscFormat"].CSurfaceSeries= CSurfaceSeries;window["AscFormat"].CTitle=CTitle;window["AscFormat"].CTrendLine=CTrendLine;window["AscFormat"].CUpDownBars=CUpDownBars;window["AscFormat"].CYVal=CYVal;window["AscFormat"].CChart=CChart;window["AscFormat"].CChartWall=CChartWall;window["AscFormat"].CView3d=CView3d;window["AscFormat"].CExternalData=CExternalData;window["AscFormat"].CPivotSource=CPivotSource;window["AscFormat"].CProtection=CProtection;window["AscFormat"].CPrintSettings=CPrintSettings;window["AscFormat"].CHeaderFooterChart= CHeaderFooterChart;window["AscFormat"].CPageMarginsChart=CPageMarginsChart;window["AscFormat"].CPageSetup=CPageSetup;window["AscFormat"].CreateTextBodyFromString=CreateTextBodyFromString;window["AscFormat"].CreateDocContentFromString=CreateDocContentFromString;window["AscFormat"].AddToContentFromString=AddToContentFromString;window["AscFormat"].CheckContentTextAndAdd=CheckContentTextAndAdd;window["AscFormat"].CValAxisLabels=CValAxisLabels;window["AscFormat"].CalcLegendEntry=CalcLegendEntry;window["AscFormat"].CUnionMarker= CUnionMarker;window["AscFormat"].CreateMarkerGeometryByType=CreateMarkerGeometryByType;window["AscFormat"].isScatterChartType=isScatterChartType;window["AscFormat"].fParseChartFormula=fParseChartFormula;window["AscFormat"].fParseChartFormulaExternal=fParseChartFormulaExternal;window["AscFormat"].fCreateRef=fCreateRef;window["AscFormat"].CChartDataRefs=CChartDataRefs;window["AscFormat"].getIsMarkerByType=getIsMarkerByType;window["AscFormat"].getIsSmoothByType=getIsSmoothByType;window["AscFormat"].getIsLineByType= getIsLineByType;window["AscFormat"].getIsLineType=getIsLineType;window["AscFormat"].isValidChartRange=isValidChartRange;window["AscFormat"].CChartStyle=CChartStyle;window["AscFormat"].CStyleEntry=CStyleEntry;window["AscFormat"].CMarkerLayout=CMarkerLayout;window["AscFormat"].CChartColors=CChartColors;window["AscFormat"].CBaseChartObject=CBaseChartObject;window["AscFormat"].AX_POS_L=AX_POS_L;window["AscFormat"].AX_POS_T=AX_POS_T;window["AscFormat"].AX_POS_R=AX_POS_R;window["AscFormat"].AX_POS_B=AX_POS_B; window["AscFormat"].CROSSES_AUTO_ZERO=CROSSES_AUTO_ZERO;window["AscFormat"].CROSSES_MAX=CROSSES_MAX;window["AscFormat"].CROSSES_MIN=CROSSES_MIN;window["AscFormat"].LBL_ALG_CTR=LBL_ALG_CTR;window["AscFormat"].LBL_ALG_L=LBL_ALG_L;window["AscFormat"].LBL_ALG_R=LBL_ALG_R;window["AscFormat"].TIME_UNIT_DAYS=TIME_UNIT_DAYS;window["AscFormat"].TIME_UNIT_MONTHS=TIME_UNIT_MONTHS;window["AscFormat"].TIME_UNIT_YEARS=TIME_UNIT_YEARS;window["AscFormat"].CROSS_BETWEEN_BETWEEN=CROSS_BETWEEN_BETWEEN;window["AscFormat"].CROSS_BETWEEN_MID_CAT= CROSS_BETWEEN_MID_CAT;window["AscFormat"].SYMBOL_CIRCLE=SYMBOL_CIRCLE;window["AscFormat"].SYMBOL_DASH=SYMBOL_DASH;window["AscFormat"].SYMBOL_DIAMOND=SYMBOL_DIAMOND;window["AscFormat"].SYMBOL_DOT=SYMBOL_DOT;window["AscFormat"].SYMBOL_NONE=SYMBOL_NONE;window["AscFormat"].SYMBOL_PICTURE=SYMBOL_PICTURE;window["AscFormat"].SYMBOL_PLUS=SYMBOL_PLUS;window["AscFormat"].SYMBOL_SQUARE=SYMBOL_SQUARE;window["AscFormat"].SYMBOL_STAR=SYMBOL_STAR;window["AscFormat"].SYMBOL_TRIANGLE=SYMBOL_TRIANGLE;window["AscFormat"].SYMBOL_X= SYMBOL_X;window["AscFormat"].MARKER_SYMBOL_TYPE=MARKER_SYMBOL_TYPE;window["AscFormat"].ORIENTATION_MAX_MIN=ORIENTATION_MAX_MIN;window["AscFormat"].ORIENTATION_MIN_MAX=ORIENTATION_MIN_MAX;window["AscFormat"].SERIES_FLAG_HOR_VALUE=SERIES_FLAG_HOR_VALUE;window["AscFormat"].SERIES_FLAG_VERT_VALUE=SERIES_FLAG_VERT_VALUE;window["AscFormat"].SERIES_FLAG_CAT=SERIES_FLAG_CAT;window["AscFormat"].SERIES_FLAG_TX=SERIES_FLAG_TX;window["AscFormat"].SERIES_FLAG_CONTINUOUS=SERIES_FLAG_CONTINUOUS})(window);"use strict"; (function(window,undefined){var isRealObject=AscCommon.isRealObject;var History=AscCommon.History;AscDFH.changesFactory[AscDFH.historyitem_TextBodySetParent]=AscDFH.CChangesDrawingsObject;AscDFH.changesFactory[AscDFH.historyitem_TextBodySetBodyPr]=AscDFH.CChangesDrawingsObjectNoId;AscDFH.changesFactory[AscDFH.historyitem_TextBodySetContent]=AscDFH.CChangesDrawingsObject;AscDFH.changesFactory[AscDFH.historyitem_TextBodySetLstStyle]=AscDFH.CChangesDrawingsObjectNoId;AscDFH.drawingsChangesMap[AscDFH.historyitem_TextBodySetParent]= function(oClass,value){oClass.parent=value};AscDFH.drawingsChangesMap[AscDFH.historyitem_TextBodySetBodyPr]=function(oClass,value){if(CheckNeedRecalcAutoFit(oClass.bodyPr,value))if(oClass.parent){oClass.parent.recalcInfo.recalculateContent=true;oClass.parent.recalcInfo.recalculateContent2=true;oClass.parent.recalcInfo.recalculateTransformText=true}if(oClass.content)oClass.content.Recalc_AllParagraphs_CompiledPr();oClass.bodyPr=value;oClass.recalcInfo.recalculateBodyPr=true};AscDFH.drawingsChangesMap[AscDFH.historyitem_TextBodySetContent]= function(oClass,value){oClass.content=value};AscDFH.drawingsChangesMap[AscDFH.historyitem_TextBodySetLstStyle]=function(oClass,value){oClass.lstStyle=value};AscDFH.drawingsConstructorsMap[AscDFH.historyitem_TextBodySetBodyPr]=AscFormat.CBodyPr;AscDFH.drawingsConstructorsMap[AscDFH.historyitem_TextBodySetLstStyle]=AscFormat.TextListStyle;var InitClass=AscFormat.InitClass;var CBaseFormatObject=AscFormat.CBaseFormatObject;function CTextBody(){CBaseFormatObject.call(this);this.bodyPr=null;this.lstStyle= null;this.content=null;this.parent=null;this.content2=null;this.compiledBodyPr=null;this.parent=null;this.bFit=true;this.recalcInfo={recalculateBodyPr:true,recalculateContent2:true}}InitClass(CTextBody,CBaseFormatObject,AscDFH.historyitem_type_TextBody);CTextBody.prototype.fillObject=function(oCopy,oIdMap){if(this.bodyPr)oCopy.setBodyPr(this.bodyPr.createDuplicate());if(this.lstStyle)oCopy.setLstStyle(this.lstStyle.createDuplicate());if(this.content)oCopy.setContent(this.content.Copy(oCopy))};CTextBody.prototype.createDuplicate2= function(){var ret=new CTextBody;if(this.bodyPr)ret.setBodyPr(this.bodyPr.createDuplicate());if(this.lstStyle)ret.setLstStyle(this.lstStyle.createDuplicate());if(this.content){var bTrackRevision=false;if(typeof editor!=="undefined"&&editor&&editor.WordControl&&editor.WordControl.m_oLogicDocument.TrackRevisions===true){bTrackRevision=editor.WordControl.m_oLogicDocument.GetLocalTrackRevisions();editor.WordControl.m_oLogicDocument.SetLocalTrackRevisions(false)}ret.setContent(this.content.Copy3(ret)); if(false!==bTrackRevision)editor.WordControl.m_oLogicDocument.SetLocalTrackRevisions(bTrackRevision)}return ret};CTextBody.prototype.Is_TopDocument=function(){return false};CTextBody.prototype.Is_DrawingShape=function(bRetShape){if(bRetShape===true)return this.parent;return true};CTextBody.prototype.IsInTable=function(bReturnTopTable){if(true===bReturnTopTable)return null;return false};CTextBody.prototype.Get_Theme=function(){if(this.parent)return this.parent.Get_Theme();return null};CTextBody.prototype.Get_ColorMap= function(){if(this.parent)return this.parent.Get_ColorMap();return null};CTextBody.prototype.setBodyPr=function(pr){History.Add(new AscDFH.CChangesDrawingsObjectNoId(this,AscDFH.historyitem_TextBodySetBodyPr,this.bodyPr,pr));this.bodyPr=pr;var oParent=this.parent;if(oParent){if(oParent.recalcInfo){oParent.recalcInfo.recalculateContent=true;oParent.recalcInfo.recalculateContent2=true;oParent.recalcInfo.recalculateTransformText=true;if(this.content)this.content.Recalc_AllParagraphs_CompiledPr();if(oParent.addToRecalculate)oParent.addToRecalculate()}if(oParent.onChartInternalUpdate)oParent.onChartInternalUpdate()}}; CTextBody.prototype.setContent=function(pr){History.Add(new AscDFH.CChangesDrawingsObject(this,AscDFH.historyitem_TextBodySetContent,this.content,pr));this.content=pr};CTextBody.prototype.setLstStyle=function(lstStyle){History.Add(new AscDFH.CChangesDrawingsObjectNoId(this,AscDFH.historyitem_TextBodySetLstStyle,this.lstStyle,lstStyle));this.lstStyle=lstStyle};CTextBody.prototype.recalculate=function(){};CTextBody.prototype.recalculateBodyPr=function(){AscFormat.ExecuteNoHistory(function(){if(!this.compiledBodyPr)this.compiledBodyPr= new AscFormat.CBodyPr;this.compiledBodyPr.setDefault();if(this.parent&&this.parent.isPlaceholder&&this.parent.isPlaceholder()){var hierarchy=this.parent.getHierarchy();for(var i=hierarchy.length-1;i>-1;--i)if(isRealObject(hierarchy[i])&&isRealObject(hierarchy[i].txBody)&&isRealObject(hierarchy[i].txBody.bodyPr))this.compiledBodyPr.merge(hierarchy[i].txBody.bodyPr)}if(isRealObject(this.bodyPr))this.compiledBodyPr.merge(this.bodyPr)},this,[])};CTextBody.prototype.Check_AutoFit=function(){return this.parent&& this.parent.Check_AutoFit&&this.parent.Check_AutoFit(true)||false};CTextBody.prototype.Refresh_RecalcData=function(Data){if(this.parent&&this.parent.recalcInfo){this.parent.recalcInfo.recalculateContent=true;this.parent.recalcInfo.recalculateContent2=true;this.parent.recalcInfo.recalculateTransformText=true;if(this.parent.addToRecalculate)this.parent.addToRecalculate()}if(AscCommon.isRealObject(Data))if(Data.Type===AscDFH.historyitem_TextBodySetBodyPr)this.recalcInfo.recalculateBodyPr=true};CTextBody.prototype.isEmpty= function(){return this.content.Is_Empty()};CTextBody.prototype.OnContentReDraw=function(){if(this.parent&&this.parent.OnContentReDraw)this.parent.OnContentReDraw()};CTextBody.prototype.Get_StartPage_Absolute=function(){return 0};CTextBody.prototype.Get_AbsolutePage=function(CurPage){if(this.parent&&this.parent.Get_AbsolutePage)return this.parent.Get_AbsolutePage();return 0};CTextBody.prototype.Get_AbsoluteColumn=function(CurPage){return 0};CTextBody.prototype.Get_TextBackGroundColor=function(){if(this.parent&& this.parent.Get_TextBackGroundColor)return this.parent.Get_TextBackGroundColor();return undefined};CTextBody.prototype.IsHdrFtr=function(bReturnHdrFtr){if(bReturnHdrFtr)return null;return false};CTextBody.prototype.IsFootnote=function(bReturnFootnote){if(bReturnFootnote)return null;return false};CTextBody.prototype.Get_PageContentStartPos=function(pageNum){return{X:0,Y:0,XLimit:this.contentWidth,YLimit:2E4}};CTextBody.prototype.Get_Numbering=function(){return new CNumbering};CTextBody.prototype.Set_CurrentElement= function(bUpdate,pageIndex){if(this.parent.Set_CurrentElement)this.parent.Set_CurrentElement(bUpdate,pageIndex)};CTextBody.prototype.checkDocContent=function(){this.parent&&this.parent.checkDocContent&&this.parent.checkDocContent()};CTextBody.prototype.getBodyPr=function(){if(this.recalcInfo.recalculateBodyPr){this.recalculateBodyPr();this.recalcInfo.recalculateBodyPr=false}return this.compiledBodyPr};CTextBody.prototype.getSummaryHeight=function(){return this.content.GetSummaryHeight()};CTextBody.prototype.getSummaryHeight2= function(){return this.content2?this.content2.GetSummaryHeight():0};CTextBody.prototype.getSummaryHeight3=function(){if(this.content&&this.content.GetSummaryHeight_)return this.content.GetSummaryHeight_();return 0};CTextBody.prototype.getCompiledBodyPr=function(){this.recalculateBodyPr();return this.compiledBodyPr};CTextBody.prototype.Get_TableStyleForPara=function(){return null};CTextBody.prototype.checkCurrentPlaceholder=function(){return false};CTextBody.prototype.draw=function(graphics){if((!this.content|| this.content.Is_Empty())&&!AscCommon.IsShapeToImageConverter&&this.parent.isEmptyPlaceholder()&&!this.checkCurrentPlaceholder()){if(graphics.IsNoDrawingEmptyPlaceholder!==true&&graphics.IsNoDrawingEmptyPlaceholderText!==true&&this.content2){if(graphics.IsNoSupportTextDraw){var _w2=this.content2.XLimit;var _h2=this.content2.GetSummaryHeight();graphics.rect(this.content2.X,this.content2.Y,_w2,_h2)}this.content2.Set_StartPage(0);this.content2.Draw(0,graphics)}}else if(this.content){if(graphics.IsNoSupportTextDraw){var bEmpty= this.content.IsEmpty();var _w=bEmpty?.1:this.content.XLimit;var _h=this.content.GetSummaryHeight();graphics.rect(this.content.X,this.content.Y,_w,_h)}var old_start_page=this.content.StartPage;this.content.Set_StartPage(0);this.content.Draw(0,graphics);this.content.Set_StartPage(old_start_page)}};CTextBody.prototype.Get_Styles=function(level){if(this.parent&&this.parent.getStyles)return this.parent.getStyles(level);return AscFormat.ExecuteNoHistory(function(){var oStyles=new CStyles(false);var Style_Para_Def= new CStyle("Normal",null,null,styletype_Paragraph);Style_Para_Def.CreateNormal();oStyles.Default.Paragraph=oStyles.Add(Style_Para_Def);return{styles:oStyles,lastId:oStyles.Default.Paragraph}},this,[])};CTextBody.prototype.IsCell=function(isReturnCell){if(true===isReturnCell)return null;return false};CTextBody.prototype.OnContentRecalculate=function(){};CTextBody.prototype.getMargins=function(){var _parent_transform=this.parent.transform;var _l;var _r;var _b;var _t;var _body_pr=this.getBodyPr();var sp= this.parent;if(isRealObject(sp.spPr)&&isRealObject(sp.spPr.geometry)&&isRealObject(sp.spPr.geometry.rect)){var _rect=sp.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=sp.extX-_body_pr.rIns;_b=sp.extY-_body_pr.bIns}var x_lt,y_lt,x_rb,y_rb;x_lt=_parent_transform.TransformPointX(_l,_t);y_lt=_parent_transform.TransformPointY(_l,_t);x_rb=_parent_transform.TransformPointX(_r,_b);y_rb=_parent_transform.TransformPointY(_r, _b);var hc=(_r-_l)/2;var vc=(_b-_t)/2;var xc=(x_lt+x_rb)/2;var yc=(y_lt+y_rb)/2;return{L:xc-hc,T:yc-vc,R:xc+hc,B:yc+vc,textMatrix:this.parent.transform}};CTextBody.prototype.Refresh_RecalcData2=function(pageIndex){this.parent&&this.parent.Refresh_RecalcData2&&this.parent.Refresh_RecalcData2(pageIndex,this)};CTextBody.prototype.checkContentFit=function(sText){var oContent=this.content;if(!oContent.Is_Empty()){var oFirstPara=oContent.Content[0];oFirstPara.Content=[oFirstPara.Content[oFirstPara.Content.length- 1]]}AscFormat.AddToContentFromString(oContent,sText);AscFormat.CShape.prototype.recalculateContent.call(this.parent);var oFirstParagraph=oContent.Content[0];return oFirstParagraph.Lines.length===1};CTextBody.prototype.recalculateOneString=function(sText){if(this.checkContentFit(sText)){this.bFit=true;return}this.bFit=false;var nLeftPos=0,nRightPos=sText.length;var nMiddlePos;var sEnd="...";var sFitText=sText+sEnd;while(nRightPos-nLeftPos>1){nMiddlePos=(nRightPos+nLeftPos)/2+.5>>0;sFitText=sText.slice(0, nMiddlePos-1);sFitText+=sEnd;if(!this.checkContentFit(sFitText))nRightPos=nMiddlePos;else nLeftPos=nMiddlePos}sFitText=sText.slice(0,nLeftPos-1);sFitText+=sEnd;if(!this.checkContentFit(sFitText)){var bFound=false;for(var i=sEnd.length-1;i>-1;i--){sFitText=sEnd.slice(0,i);if(this.checkContentFit(sFitText)){bFound=true;break}}if(!bFound)this.checkContentFit("")}};CTextBody.prototype.getContentOneStringSizes=function(){return GetContentOneStringSizes(this.content)};CTextBody.prototype.recalculateByMaxWord= function(){var max_content=this.content.RecalculateMinMaxContentWidth().Max;this.content.SetApplyToAll(true);this.content.SetParagraphAlign(AscCommon.align_Center);this.content.SetApplyToAll(false);this.content.Reset(0,0,max_content,2E4);this.content.Recalculate_Page(0,true);return{w:max_content,h:this.content.GetSummaryHeight()}};CTextBody.prototype.GetFirstElementInNextCell=function(){return null};CTextBody.prototype.GetLastElementInPrevCell=function(){return null};CTextBody.prototype.getRectWidth= function(maxWidth){var body_pr=this.getBodyPr();var r_ins=body_pr.rIns;var l_ins=body_pr.lIns;var max_content_width=maxWidth-r_ins-l_ins;this.content.Reset(0,0,max_content_width,2E4);this.content.Recalculate_Page(0,true);var max_width=0;for(var i=0;imax_width)max_width=par.Lines[j].Ranges[0].W}return max_width+2+r_ins+l_ins};CTextBody.prototype.getMaxContentWidth=function(maxWidth, bLeft){this.content.Reset(0,0,maxWidth-.01,2E4);if(bLeft){this.content.SetApplyToAll(true);this.content.SetParagraphAlign(AscCommon.align_Left);this.content.SetApplyToAll(false)}this.content.Recalculate_Page(0,true);var max_width=0,arr_content=this.content.Content,paragraph_lines,i,j;for(i=0;imax_width)max_width=paragraph_lines[j].Ranges[0].W}return max_width+.01};CTextBody.prototype.GetPrevElementEndInfo= function(CurElement){return null};CTextBody.prototype.Is_UseInDocument=function(Id){if(Id!=undefined)if(!this.content||this.content.Get_Id()!==Id)return false;if(this.parent&&this.parent.Is_UseInDocument)return this.parent.Is_UseInDocument();return false};CTextBody.prototype.Get_ParentTextTransform=function(){if(this.parent&&this.parent.transformText)return this.parent.transformText.CreateDublicate();return null};CTextBody.prototype.Is_ThisElementCurrent=function(){if(this.parent&&this.parent.Is_ThisElementCurrent)return this.parent.Is_ThisElementCurrent(); return false};CTextBody.prototype.getFirstParaParaPr=function(){if(!this.content)return null;var oParagraph=this.content.GetFirstParagraph();if(!oParagraph)return null;oParagraph.Set_DocumentIndex(0);return oParagraph.Pr};function GetContentOneStringSizes(oContent){oContent.Reset(0,0,2E4,2E4);oContent.Recalculate_Page(0,true);return{w:oContent.Content[0].Lines[0].Ranges[0].W+.1,h:oContent.GetSummaryHeight()+.1}}function CheckNeedRecalcAutoFit(oBP1,oBP2){if(AscCommon.isFileBuild())return false;var oTF1= oBP1&&oBP1.textFit;var oTF2=oBP2&&oBP2.textFit;var oTFType1=oTF1&&oTF1.type||0;var oTFType2=oTF2&&oTF2.type||0;if(oTFType1===AscFormat.text_fit_NormAuto&&oTFType2===AscFormat.text_fit_NormAuto)return oTF1.lnSpcReduction!==oTF2.lnSpcReduction||oTF1.fontScale!==oTF2.fontScale;return oTFType1===AscFormat.text_fit_NormAuto||oTFType2===AscFormat.text_fit_NormAuto}window["AscFormat"]=window["AscFormat"]||{};window["AscFormat"].GetContentOneStringSizes=GetContentOneStringSizes;window["AscFormat"].CTextBody= CTextBody;window["AscFormat"].CheckNeedRecalcAutoFit=CheckNeedRecalcAutoFit})(window);"use strict";(function(window,undefined){var CShape=AscFormat.CShape;var HitInLine=AscFormat.HitInLine;var isRealObject=AscCommon.isRealObject;var History=AscCommon.History;window["AscDFH"].drawingsChangesMap[AscDFH.historyitem_GraphicFrameSetSpPr]=function(oClass,value){oClass.spPr=value};window["AscDFH"].drawingsChangesMap[AscDFH.historyitem_GraphicFrameSetGraphicObject]=function(oClass,value){oClass.graphicObject= value;if(value){value.Parent=oClass;oClass.graphicObject.Index=0}};window["AscDFH"].drawingsChangesMap[AscDFH.historyitem_GraphicFrameSetSetNvSpPr]=function(oClass,value){oClass.nvGraphicFramePr=value};window["AscDFH"].drawingsChangesMap[AscDFH.historyitem_GraphicFrameSetSetParent]=function(oClass,value){oClass.parent=value};window["AscDFH"].drawingsChangesMap[AscDFH.historyitem_GraphicFrameSetSetGroup]=function(oClass,value){oClass.group=value};AscDFH.changesFactory[AscDFH.historyitem_GraphicFrameSetSpPr]= AscDFH.CChangesDrawingsObject;AscDFH.changesFactory[AscDFH.historyitem_GraphicFrameSetGraphicObject]=AscDFH.CChangesDrawingsObject;AscDFH.changesFactory[AscDFH.historyitem_GraphicFrameSetSetNvSpPr]=AscDFH.CChangesDrawingsObject;AscDFH.changesFactory[AscDFH.historyitem_GraphicFrameSetSetParent]=AscDFH.CChangesDrawingsObject;AscDFH.changesFactory[AscDFH.historyitem_GraphicFrameSetSetGroup]=AscDFH.CChangesDrawingsObject;function CGraphicFrame(){AscFormat.CGraphicObjectBase.call(this);this.graphicObject= null;this.nvGraphicFramePr=null;this.compiledHierarchy=[];this.Pages=[];this.compiledStyles=[];this.recalcInfo={recalculateTransform:true,recalculateSizes:true,recalculateNumbering:true,recalculateShapeHierarchy:true,recalculateTable:true};this.RecalcInfo={}}CGraphicFrame.prototype=Object.create(AscFormat.CGraphicObjectBase.prototype);CGraphicFrame.prototype.constructor=CGraphicFrame;CGraphicFrame.prototype.addToRecalculate=CShape.prototype.addToRecalculate;CGraphicFrame.prototype.Get_Theme=CShape.prototype.Get_Theme; CGraphicFrame.prototype.Get_ColorMap=CShape.prototype.Get_ColorMap;CGraphicFrame.prototype.setBDeleted=CShape.prototype.setBDeleted;CGraphicFrame.prototype.getBase64Img=CShape.prototype.getBase64Img;CGraphicFrame.prototype.checkDrawingBaseCoords=CShape.prototype.checkDrawingBaseCoords;CGraphicFrame.prototype.getSlideIndex=CShape.prototype.getSlideIndex;CGraphicFrame.prototype.Is_UseInDocument=CShape.prototype.Is_UseInDocument;CGraphicFrame.prototype.convertPixToMM=CShape.prototype.convertPixToMM; CGraphicFrame.prototype.hit=CShape.prototype.hit;CGraphicFrame.prototype.GetDocumentPositionFromObject=function(arrPos){if(!arrPos)arrPos=[];return arrPos};CGraphicFrame.prototype.Is_DrawingShape=function(bRetShape){if(bRetShape===true)return null;return false};CGraphicFrame.prototype.handleUpdatePosition=function(){this.recalcInfo.recalculateTransform=true;this.addToRecalculate()};CGraphicFrame.prototype.handleUpdateTheme=function(){this.compiledStyles=[];if(this.graphicObject){this.graphicObject.Recalc_CompiledPr2(); this.graphicObject.RecalcInfo.Recalc_AllCells();this.recalcInfo.recalculateSizes=true;this.recalcInfo.recalculateShapeHierarchy=true;this.recalcInfo.recalculateTable=true;this.addToRecalculate()}};CGraphicFrame.prototype.handleUpdateFill=function(){};CGraphicFrame.prototype.handleUpdateLn=function(){};CGraphicFrame.prototype.handleUpdateExtents=function(){this.recalcInfo.recalculateTransform=true;this.addToRecalculate()};CGraphicFrame.prototype.recalcText=function(){this.compiledStyles=[];if(this.graphicObject){this.graphicObject.Recalc_CompiledPr2(); this.graphicObject.RecalcInfo.Reset(true)}this.recalcInfo.recalculateTable=true;this.recalcInfo.recalculateSizes=true};CGraphicFrame.prototype.Get_TextBackGroundColor=function(){return undefined};CGraphicFrame.prototype.GetPrevElementEndInfo=function(){return null};CGraphicFrame.prototype.Get_PageFields=function(){return editor.WordControl.m_oLogicDocument.Get_PageFields()};CGraphicFrame.prototype.Get_ParentTextTransform=function(){return this.transformText};CGraphicFrame.prototype.getDocContent= function(){if(this.graphicObject&&this.graphicObject.CurCell&&(false===this.graphicObject.Selection.Use||true===this.graphicObject.Selection.Use&&table_Selection_Text===this.graphicObject.Selection.Type))return this.graphicObject.CurCell.Content;return null};CGraphicFrame.prototype.setSpPr=function(spPr){History.Add(new AscDFH.CChangesDrawingsObject(this,AscDFH.historyitem_GraphicFrameSetSpPr,this.spPr,spPr));this.spPr=spPr};CGraphicFrame.prototype.setGraphicObject=function(graphicObject){History.Add(new AscDFH.CChangesDrawingsObject(this, AscDFH.historyitem_GraphicFrameSetGraphicObject,this.graphicObject,graphicObject));this.graphicObject=graphicObject;if(this.graphicObject){this.graphicObject.Index=0;this.graphicObject.Parent=this}};CGraphicFrame.prototype.setNvSpPr=function(pr){History.Add(new AscDFH.CChangesDrawingsObject(this,AscDFH.historyitem_GraphicFrameSetSetNvSpPr,this.nvGraphicFramePr,pr));this.nvGraphicFramePr=pr};CGraphicFrame.prototype.setParent=function(parent){History.Add(new AscDFH.CChangesDrawingsObject(this,AscDFH.historyitem_GraphicFrameSetSetParent, this.parent,parent));this.parent=parent};CGraphicFrame.prototype.setGroup=function(group){History.Add(new AscDFH.CChangesDrawingsObject(this,AscDFH.historyitem_GraphicFrameSetSetGroup,this.group,group));this.group=group};CGraphicFrame.prototype.getObjectType=function(){return AscDFH.historyitem_type_GraphicFrame};CGraphicFrame.prototype.Search=function(Str,Props,SearchEngine,Type){if(this.graphicObject)this.graphicObject.Search(Str,Props,SearchEngine,Type)};CGraphicFrame.prototype.GetSearchElementId= function(bNext,bCurrent){if(this.graphicObject)return this.graphicObject.GetSearchElementId(bNext,bCurrent);return null};CGraphicFrame.prototype.FindNextFillingForm=function(isNext,isCurrent){if(this.graphicObject)return this.graphicObject.FindNextFillingForm(isNext,isCurrent);return null};CGraphicFrame.prototype.copy=function(oPr){var ret=new CGraphicFrame;if(this.graphicObject){ret.setGraphicObject(this.graphicObject.Copy(ret));if(editor&&editor.WordControl&&editor.WordControl.m_oLogicDocument&& isRealObject(editor.WordControl.m_oLogicDocument.globalTableStyles))ret.graphicObject.Reset(0,0,this.graphicObject.XLimit,this.graphicObject.YLimit,ret.graphicObject.PageNum)}if(this.nvGraphicFramePr)ret.setNvSpPr(this.nvGraphicFramePr.createDuplicate());if(this.spPr){ret.setSpPr(this.spPr.createDuplicate());ret.spPr.setParent(ret)}ret.setBDeleted(false);if(this.macro!==null)ret.setMacro(this.macro);if(this.textLink!==null)ret.setTextLink(this.textLink);if(!this.recalcInfo.recalculateTable&&!this.recalcInfo.recalculateSizes&& !this.recalcInfo.recalculateTransform){ret.cachedImage=this.getBase64Img();ret.cachedPixW=this.cachedPixW;ret.cachedPixH=this.cachedPixH}return ret};CGraphicFrame.prototype.getAllFonts=function(fonts){if(this.graphicObject){for(var i=0;imax_x)max_x=cur_x;if(cur_ymax_y)max_y= cur_y}return{minX:min_x,maxX:max_x,minY:min_y,maxY:max_y}};CGraphicFrame.prototype.changeSize=function(kw,kh){if(this.spPr&&this.spPr.xfrm&&this.spPr.xfrm.isNotNull()){var xfrm=this.spPr.xfrm;xfrm.setOffX(xfrm.offX*kw);xfrm.setOffY(xfrm.offY*kh)}this.recalcTransform&&this.recalcTransform()};CGraphicFrame.prototype.recalcTransform=function(){this.recalcInfo.recalculateTransform=true};CGraphicFrame.prototype.getTransform=function(){if(this.recalcInfo.recalculateTransform){this.recalculateTransform(); this.recalcInfo.recalculateTransform=false}return{x:this.x,y:this.y,extX:this.extX,extY:this.extY,rot:this.rot,flipH:this.flipH,flipV:this.flipV}};CGraphicFrame.prototype.canRotate=function(){return false};CGraphicFrame.prototype.canGroup=function(){return false};CGraphicFrame.prototype.createRotateTrack=function(){return new AscFormat.RotateTrackShapeImage(this)};CGraphicFrame.prototype.createResizeTrack=function(cardDirection){return new AscFormat.ResizeTrackShapeImage(this,cardDirection)};CGraphicFrame.prototype.createMoveTrack= function(){return new AscFormat.MoveShapeImageTrack(this)};CGraphicFrame.prototype.getSnapArrays=function(snapX,snapY){var transform=this.getTransformMatrix();snapX.push(transform.tx);snapX.push(transform.tx+this.extX*.5);snapX.push(transform.tx+this.extX);snapY.push(transform.ty);snapY.push(transform.ty+this.extY*.5);snapY.push(transform.ty+this.extY)};CGraphicFrame.prototype.hitInInnerArea=function(x,y){var invert_transform=this.getInvertTransform();if(!invert_transform)return false;var x_t=invert_transform.TransformPointX(x, y);var y_t=invert_transform.TransformPointY(x,y);return x_t>0&&x_t0&&y_t0?this.TxCache.NumCache[0].val: ""},asc_setTitle:function(title){this.TxCache.NumCache=[{numFormatStr:"General",isDateTimeFormat:false,val:title,isHidden:false}]},asc_getTitleFormula:function(){return this.TxCache.Formula},asc_setTitleFormula:function(val){this.TxCache.Formula=val},asc_getMarkerSize:function(){return this.Marker.Size},asc_setMarkerSize:function(size){this.Marker.Size=size},asc_getMarkerSymbol:function(){return this.Marker.Symbol},asc_setMarkerSymbol:function(symbol){this.Marker.Symbol=symbol},asc_getFormatCode:function(){return this.FormatCode}, asc_setFormatCode:function(format){this.FormatCode=format}};var nSparklineMultiplier=3.75;function CSparklineView(){this.col=null;this.row=null;this.ws=null;this.extX=null;this.extY=null;this.chartSpace=null}function CreateSparklineMarker(oUniFill,bPreview){var oMarker=new AscFormat.CMarker;oMarker.symbol=AscFormat.SYMBOL_DIAMOND;oMarker.size=10;if(bPreview)oMarker.size=30;oMarker.spPr=new AscFormat.CSpPr;oMarker.spPr.Fill=oUniFill;oMarker.spPr.ln=AscFormat.CreateNoFillLine();return oMarker}function CreateUniFillFromExcelColor(oExcelColor){var oUnifill; {oUnifill=AscFormat.CreateUnfilFromRGB(oExcelColor.getR(),oExcelColor.getG(),oExcelColor.getB())}return oUnifill}CSparklineView.prototype.initFromSparkline=function(oSparkline,oSparklineGroup,worksheetView,bForPreview){AscFormat.ExecuteNoHistory(function(){this.ws=worksheetView;var settings=new Asc.asc_ChartSettings;var nSparklineType=oSparklineGroup.asc_getType();switch(nSparklineType){case Asc.c_oAscSparklineType.Column:{settings.type=c_oAscChartTypeSettings.barNormal;break}case Asc.c_oAscSparklineType.Stacked:{settings.type= c_oAscChartTypeSettings.barStackedPer;break}default:{settings.type=c_oAscChartTypeSettings.lineNormal;break}}var ser=new asc_CChartSeria;ser.Val.Formula=oSparkline.f;if(oSparkline.oCache)ser.Val.NumCache=oSparkline.oCache;var chartSeries=[ser];var chart_space=AscFormat.DrawingObjectsController.prototype._getChartSpace(chartSeries,settings,true);chart_space.isSparkline=true;chart_space.setBDeleted(false);if(worksheetView)chart_space.setWorksheet(worksheetView.model);chart_space.displayHidden=oSparklineGroup.asc_getDisplayHidden(); chart_space.displayEmptyCellsAs=oSparklineGroup.asc_getDisplayEmpty();settings.putTitle(c_oAscChartTitleShowSettings.none);settings.putLegendPos(Asc.c_oAscChartLegendShowSettings.none);chart_space.recalculateReferences();chart_space.recalcInfo.recalculateReferences=false;var oSerie=chart_space.chart.plotArea.charts[0].series[0];var aSeriesPoints=oSerie.getNumPts();var val_ax_props=new AscCommon.asc_ValAxisSettings;var i,fMinVal=null,fMaxVal=null;if(settings.type!==c_oAscChartTypeSettings.barStackedPer){if(oSparklineGroup.asc_getMinAxisType()=== Asc.c_oAscSparklineAxisMinMax.Custom&&oSparklineGroup.asc_getManualMin()!==null){val_ax_props.putMinValRule(c_oAscValAxisRule.fixed);val_ax_props.putMinVal(oSparklineGroup.asc_getManualMin())}else{val_ax_props.putMinValRule(c_oAscValAxisRule.auto);for(i=0;iaSeriesPoints[i].val)fMinVal=aSeriesPoints[i].val}if(oSparklineGroup.asc_getMaxAxisType()===Asc.c_oAscSparklineAxisMinMax.Custom&&oSparklineGroup.asc_getManualMax()!== null){val_ax_props.putMinValRule(c_oAscValAxisRule.fixed);val_ax_props.putMinVal(oSparklineGroup.asc_getManualMax())}else{val_ax_props.putMaxValRule(c_oAscValAxisRule.auto);for(i=0;i0)if(fCallbackSeries){if(oSparklineGroup.negative&&oSparklineGroup.colorNegative)for(i=0;iaMaxPoints[0].val){aMaxPoints.length=0;aMaxPoints.push(aSeriesPoints[i])}else if(aSeriesPoints[i].val===aMaxPoints[0].val)aMaxPoints.push(aSeriesPoints[i]);for(i=0;i1){aSeriesPoints=[].concat(aSeriesPoints);var dMinVal,dMaxVal,bSorted=false;if(val_ax_props.minVal==null)if(aMinPoints)dMinVal=aMinPoints[0].val;else{aSeriesPoints.sort(function(a,b){return a.val-b.val});bSorted=true;dMinVal=aSeriesPoints[0].val}else dMinVal=val_ax_props.minVal;if(val_ax_props.maxVal==null)if(aMaxPoints)dMaxVal=aMaxPoints[0].val;else{if(!bSorted){aSeriesPoints.sort(function(a, b){return a.val-b.val});bSorted=true}dMaxVal=aSeriesPoints[aSeriesPoints.length-1].val}else dMaxVal=val_ax_props.maxVal;if(dMaxVal!==dMinVal&&(dMaxVal<0||dMinVal>0))oAxis.catAx[0].setDelete(true)}if(oSparklineGroup.colorSeries){var oUnifill=CreateUniFillFromExcelColor(oSparklineGroup.colorSeries);var oSerie=chart_space.chart.plotArea.charts[0].series[0];if(nSparklineType===Asc.c_oAscSparklineType.Line){var oLn=oSerie.spPr.ln;oLn.setFill(oUnifill);oSerie.spPr.setLn(oLn)}else{oSerie.spPr.setFill(oUnifill); oSerie.spPr.ln=new AscFormat.CLn;oSerie.spPr.ln.Fill=oSerie.spPr.Fill.createDuplicate();oSerie.spPr.ln.w=dLineWidthSpaces}}this.chartSpace=chart_space;if(worksheetView){var oBBox=oSparkline.sqRef;this.col=oBBox.c1;this.row=oBBox.r1;this.x=worksheetView.getCellLeft(oBBox.c1,3);this.y=worksheetView.getCellTop(oBBox.r1,3);var oMergeInfo=worksheetView.model.getMergedByCell(oBBox.r1,oBBox.c1);if(oMergeInfo){this.extX=0;for(i=oMergeInfo.c1;i<=oMergeInfo.c2;++i)this.extX+=worksheetView.getColumnWidth(i, 3);this.extY=0;for(i=oMergeInfo.r1;i<=oMergeInfo.r2;++i)this.extY=worksheetView.getRowHeight(i,3)}else{this.extX=worksheetView.getColumnWidth(oBBox.c1,3);this.extY=worksheetView.getRowHeight(oBBox.r1,3)}AscFormat.CheckSpPrXfrm(this.chartSpace);this.updatePlotAreaLayout();this.chartSpace.recalculate()}},this,[])};CSparklineView.prototype.updatePlotAreaLayout=function(){if(!this.chartSpace)return;var offX=this.x*nSparklineMultiplier;var offY=this.y*nSparklineMultiplier;var extX=this.extX*nSparklineMultiplier; var extY=this.extY*nSparklineMultiplier;this.chartSpace.spPr.xfrm.setOffX(offX);this.chartSpace.spPr.xfrm.setOffY(offY);this.chartSpace.spPr.xfrm.setExtX(extX);this.chartSpace.spPr.xfrm.setExtY(extY);var oLayout=new AscFormat.CLayout;oLayout.setXMode(AscFormat.LAYOUT_MODE_EDGE);oLayout.setYMode(AscFormat.LAYOUT_MODE_EDGE);oLayout.setLayoutTarget(AscFormat.LAYOUT_TARGET_INNER);var fInset=2;var fPosX,fPosY,fExtX,fExtY;fExtX=extX-2*fInset;fExtY=extY-2*fInset;this.chartSpace.bEmptySeries=false;if(fExtX<= 0||fExtY<=0){this.chartSpace.bEmptySeries=true;return}fPosX=(extX-fExtX)/2;fPosY=(extY-fExtY)/2;var fLayoutX=this.chartSpace.calculateLayoutByPos(0,oLayout.xMode,fPosX,extX);var fLayoutY=this.chartSpace.calculateLayoutByPos(0,oLayout.yMode,fPosY,extY);var fLayoutW=this.chartSpace.calculateLayoutBySize(fPosX,oLayout.wMode,extX,fExtX);var fLayoutH=this.chartSpace.calculateLayoutBySize(fPosY,oLayout.hMode,extY,fExtY);oLayout.setX(fLayoutX);oLayout.setY(fLayoutY);oLayout.setW(fLayoutW);oLayout.setH(fLayoutH); this.chartSpace.chart.plotArea.setLayout(oLayout)};CSparklineView.prototype.draw=function(graphics,offX,offY){var x=this.ws.getCellLeft(this.col,3)-offX;var y=this.ws.getCellTop(this.row,3)-offY;var i;var extX;var extY;var oMergeInfo=this.ws.model.getMergedByCell(this.row,this.col);if(oMergeInfo){extX=0;for(i=oMergeInfo.c1;i<=oMergeInfo.c2;++i)extX+=this.ws.getColumnWidth(i,3);extY=0;for(i=oMergeInfo.r1;i<=oMergeInfo.r2;++i)extY=this.ws.getRowHeight(i,3)}else{extX=this.ws.getColumnWidth(this.col, 3);extY=this.ws.getRowHeight(this.row,3)}var bExtent=Math.abs(this.extX-extX)>.01||Math.abs(this.extY-extY)>.01;var bPosition=Math.abs(this.x-x)>.01||Math.abs(this.y-y)>.01;if(bExtent||bPosition){this.x=x;this.y=y;this.extX=extX;this.extY=extY;AscFormat.ExecuteNoHistory(function(){if(bPosition){this.chartSpace.spPr.xfrm.setOffX(x*nSparklineMultiplier);this.chartSpace.spPr.xfrm.setOffY(y*nSparklineMultiplier)}if(bExtent){this.chartSpace.spPr.xfrm.setExtX(extX*nSparklineMultiplier);this.chartSpace.spPr.xfrm.setExtY(extY* nSparklineMultiplier);this.updatePlotAreaLayout()}},this,[]);if(bExtent){this.chartSpace.handleUpdateExtents();this.chartSpace.recalculate()}else{this.chartSpace.x=x*nSparklineMultiplier;this.chartSpace.y=y*nSparklineMultiplier;this.chartSpace.transform.tx=this.chartSpace.x;this.chartSpace.transform.ty=this.chartSpace.y}}var _true_height=this.chartSpace.chartObj.calcProp.trueHeight;var _true_width=this.chartSpace.chartObj.calcProp.trueWidth;this.chartSpace.chartObj.calcProp.trueWidth=this.chartSpace.extX* this.chartSpace.chartObj.calcProp.pxToMM;this.chartSpace.chartObj.calcProp.trueHeight=this.chartSpace.extY*this.chartSpace.chartObj.calcProp.pxToMM;this.chartSpace.draw(graphics);this.chartSpace.chartObj.calcProp.trueWidth=_true_width;this.chartSpace.chartObj.calcProp.trueHeight=_true_height};CSparklineView.prototype.setMinMaxValAx=function(minVal,maxVal,oSparklineGroup){var oAxis=this.chartSpace.chart.plotArea.getAxisByTypes();var oValAx=oAxis.valAx[0];if(oValAx){if(minVal!==null){if(!oValAx.scaling)oValAx.setScaling(new AscFormat.CScaling); if(oValAx.scaling.min===null||!AscFormat.fApproxEqual(oValAx.scaling.min,minVal))oValAx.scaling.setMin(minVal)}if(maxVal!==null){if(!oValAx.scaling)oValAx.setScaling(new AscFormat.CScaling);if(oValAx.scaling.max===null||!AscFormat.fApproxEqual(oValAx.scaling.max,maxVal))oValAx.scaling.setMax(maxVal)}if(oSparklineGroup.displayXAxis){var aSeriesPoints=this.chartSpace.chart.plotArea.charts[0].series[0].getNumPts();if(aSeriesPoints.length>1){aSeriesPoints=[].concat(aSeriesPoints);var dMinVal,dMaxVal, bSorted=false;if(minVal==null){aSeriesPoints.sort(function(a,b){return a.val-b.val});bSorted=true;dMinVal=aSeriesPoints[0].val}else dMinVal=minVal;if(maxVal==null){if(!bSorted){aSeriesPoints.sort(function(a,b){return a.val-b.val});bSorted=true}dMaxVal=aSeriesPoints[aSeriesPoints.length-1].val}else dMaxVal=maxVal;if(dMaxVal<0||dMinVal>0)oAxis.catAx[0].setDelete(true);else oAxis.catAx[0].setDelete(false)}}this.chartSpace.recalculate()}};function GraphicOption(rect){this.rect=null;if(rect)this.rect= rect.copy()}GraphicOption.prototype.getRect=function(){return this.rect};GraphicOption.prototype.union=function(oGraphicOption){if(!this.rect)return this;if(!oGraphicOption.rect)return oGraphicOption;this.rect.checkByOther(oGraphicOption.rect);return this};var rAF=function(){return window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.oRequestAnimationFrame||window.msRequestAnimationFrame||function(callback){return setTimeout(callback,1E3/60)}}(); var cAF=function(){return window.cancelAnimationFrame||window.cancelRequestAnimationFrame||window.webkitCancelAnimationFrame||window.webkitCancelRequestAnimationFrame||window.mozCancelRequestAnimationFrame||window.oCancelRequestAnimationFrame||window.msCancelRequestAnimationFrame||clearTimeout}();function DrawingObjects(){var ScrollOffset=function(){this.getX=function(){return 2*worksheet._getColLeft(0)-worksheet._getColLeft(worksheet.getFirstVisibleCol(true))};this.getY=function(){return 2*worksheet._getRowTop(0)- worksheet._getRowTop(worksheet.getFirstVisibleRow(true))}};var _this=this;var asc=window["Asc"];var api=asc["editor"];var worksheet=null;var drawingCtx=null;var overlayCtx=null;var scrollOffset=new ScrollOffset;var aObjects=[];var aImagesSync=[];var oStateBeforeLoadChanges=null;_this.zoom={last:1,current:1};_this.canEdit=null;_this.drawingArea=null;_this.drawingDocument=null;_this.asyncImageEndLoaded=null;_this.CompositeInput=null;_this.lastX=0;_this.lastY=0;_this.nCurPointItemsLength=-1;_this.bUpdateMetrics= true;_this.shiftMap={};_this.animId=null;_this.drawTask=null;function drawTaskFunction(){_this.drawingDocument.CheckTargetShow();if(_this.drawTask){_this.showDrawingObjectsEx(_this.drawTask.getRect());_this.drawTask=null}_this.animId=null}function DrawingBase(ws){this.worksheet=ws;this.Type=c_oAscCellAnchorType.cellanchorTwoCell;this.Pos={X:0,Y:0};this.editAs=c_oAscCellAnchorType.cellanchorTwoCell;this.from=new CCellObjectInfo;this.to=new CCellObjectInfo;this.ext={cx:0,cy:0};this.graphicObject=null; this.boundsFromTo={from:new CCellObjectInfo,to:new CCellObjectInfo}}DrawingBase.prototype.isUseInDocument=function(){if(worksheet&&worksheet.model){var aDrawings=worksheet.model.Drawings;for(var i=0;i0?bounds.x:0),fromY=mmToPx(bounds.y>0?bounds.y:0),toX=mmToPx(bounds.x+bounds.w),toY=mmToPx(bounds.y+bounds.h);if(toX<0)toX=0;if(toY<0)toY=0;var fromColCell=worksheet.findCellByXY(fromX,fromY,true,false,true);var fromRowCell=worksheet.findCellByXY(fromX,fromY,true,true,false);var toColCell=worksheet.findCellByXY(toX,toY,true,false, true);var toRowCell=worksheet.findCellByXY(toX,toY,true,true,false);_t.boundsFromTo.from.col=fromColCell.col;_t.boundsFromTo.from.colOff=pxToMm(fromColCell.colOff);_t.boundsFromTo.from.row=fromRowCell.row;_t.boundsFromTo.from.rowOff=pxToMm(fromRowCell.rowOff);_t.boundsFromTo.to.col=toColCell.col;_t.boundsFromTo.to.colOff=pxToMm(toColCell.colOff);_t.boundsFromTo.to.row=toRowCell.row;_t.boundsFromTo.to.rowOff=pxToMm(toRowCell.rowOff)}};DrawingBase.prototype.getRealTopOffset=function(){var _t=this;var val= _t.worksheet._getRowTop(_t.from.row)+mmToPx(_t.from.rowOff);return asc.round(val)};DrawingBase.prototype.getRealLeftOffset=function(){var _t=this;var val=_t.worksheet._getColLeft(_t.from.col)+mmToPx(_t.from.colOff);return asc.round(val)};DrawingBase.prototype.getWidthFromTo=function(){return this.worksheet._getColLeft(this.to.col)+mmToPx(this.to.colOff)-this.worksheet._getColLeft(this.from.col)-mmToPx(this.from.colOff)};DrawingBase.prototype.getHeightFromTo=function(){return this.worksheet._getRowTop(this.to.row)+ mmToPx(this.to.rowOff)-this.worksheet._getRowTop(this.from.row)-mmToPx(this.from.rowOff)};DrawingBase.prototype.getVisibleTopOffset=function(withHeader){var _t=this;var headerRowOff=_t.worksheet._getRowTop(0);var fvr=_t.worksheet._getRowTop(_t.worksheet.getFirstVisibleRow(true));var off=_t.getRealTopOffset()-fvr;off=off>0?off:0;return withHeader?headerRowOff+off:off};DrawingBase.prototype.getVisibleLeftOffset=function(withHeader){var _t=this;var headerColOff=_t.worksheet._getColLeft(0);var fvc=_t.worksheet._getColLeft(_t.worksheet.getFirstVisibleCol(true)); var off=_t.getRealLeftOffset()-fvc;off=off>0?off:0;return withHeader?headerColOff+off:off};DrawingBase.prototype.getDrawingObjects=function(){return _this};DrawingBase.prototype.checkTarget=function(target,bEdit){if(!this.graphicObject)return false;if(AscCommon.isFileBuild())return false;var bUpdateExtents=false;var nType=bEdit?this.graphicObject.getDrawingBaseType():this.Type;if(target.target===AscCommonExcel.c_oTargetType.RowResize)if(nType===AscCommon.c_oAscCellAnchorType.cellanchorTwoCell||nType=== AscCommon.c_oAscCellAnchorType.cellanchorOneCell)if(this.from.row>=target.row)bUpdateExtents=true;else{if(this.to.row>=target.row&&nType===AscCommon.c_oAscCellAnchorType.cellanchorTwoCell)bUpdateExtents=true}else{this.checkBoundsFromTo();if(this.boundsFromTo.to.row>=target.row)bUpdateExtents=true}else if(nType===AscCommon.c_oAscCellAnchorType.cellanchorTwoCell||nType===AscCommon.c_oAscCellAnchorType.cellanchorOneCell)if(this.from.col>=target.col)bUpdateExtents=true;else{if(this.to.col>=target.col&& nType===AscCommon.c_oAscCellAnchorType.cellanchorTwoCell)bUpdateExtents=true}else{this.checkBoundsFromTo();if(this.boundsFromTo.to.col>=target.col)bUpdateExtents=true}return bUpdateExtents};DrawingBase.prototype.draw=function(graphics){if(this.graphicObject)this.graphicObject.draw(graphics)};DrawingBase.prototype.getBoundsFromTo=function(){return this.boundsFromTo};DrawingBase.prototype.onUpdate=function(oRect){if(AscCommon.isFileBuild())return;var oDO=this.getDrawingObjects();if(!oDO)return;var oRange, oClipRect=null;if(this.isUseInDocument())if(!oRect){var oB=this.getBoundsFromTo();var c1=oB.from.col;var r1=oB.from.row;var c2=oB.to.col;var r2=oB.to.row;oRange=new Asc.Range(c1,r1,c2,r2,true);oClipRect=worksheet.rangeToRectAbs(oRange,3)}else oClipRect=oRect;oDO.showDrawingObjects(new AscFormat.GraphicOption(oClipRect))};DrawingBase.prototype.onSlicerUpdate=function(sName){if(!this.graphicObject)return false;return this.graphicObject.onSlicerUpdate(sName)};DrawingBase.prototype.onSlicerDelete=function(sName){if(!this.graphicObject)return false; return this.graphicObject.onSlicerDelete(sName)};DrawingBase.prototype.onSlicerLock=function(sName,bLock){if(!this.graphicObject)return;this.graphicObject.onSlicerLock(sName,bLock)};DrawingBase.prototype.onSlicerChangeName=function(sName,sNewName){if(!this.graphicObject)return;this.graphicObject.onSlicerChangeName(sName,sNewName)};DrawingBase.prototype.getSlicerViewByName=function(name){if(!this.graphicObject)return;return this.graphicObject.getSlicerViewByName(name)};DrawingBase.prototype.handleObject= function(fCallback){if(!this.graphicObject)return;this.graphicObject.handleObject(fCallback)};_this.addShapeOnSheet=function(sType){if(this.controller)if(_this.canEdit()){_this.controller.resetSelection();var activeCell=worksheet.model.selectionRange.activeCell;var metrics={};metrics.col=activeCell.col;metrics.colOff=0;metrics.row=activeCell.row;metrics.rowOff=0;var coordsFrom=_this.calculateCoords(metrics);var ext_x,ext_y;var oExt=AscFormat.fGetDefaultShapeExtents(sType);ext_x=oExt.x;ext_y=oExt.y; History.Create_NewPoint();var posX=pxToMm(coordsFrom.x)+MOVE_DELTA;var posY=pxToMm(coordsFrom.y)+MOVE_DELTA;var oTrack=new AscFormat.NewShapeTrack(sType,posX,posY,_this.controller.getTheme(),null,null,null,0);oTrack.track({},posX+ext_x,posY+ext_y);var oShape=oTrack.getShape(false,_this.drawingDocument,null);oShape.setWorksheet(worksheet.model);oShape.addToDrawingObjects();oShape.checkDrawingBaseCoords();oShape.select(_this.controller,0);_this.controller.startRecalculate();worksheet.setSelectionShape(true)}}; _this.getScrollOffset=function(){return scrollOffset};_this.saveStateBeforeLoadChanges=function(){if(this.controller){oStateBeforeLoadChanges={};this.controller.Save_DocumentStateBeforeLoadChanges(oStateBeforeLoadChanges)}else oStateBeforeLoadChanges=null;return oStateBeforeLoadChanges};_this.loadStateAfterLoadChanges=function(){if(_this.controller){_this.controller.clearPreTrackObjects();_this.controller.clearTrackObjects();_this.controller.resetSelection();_this.controller.changeCurrentState(new AscFormat.NullState(this.controller)); if(oStateBeforeLoadChanges)_this.controller.loadDocumentStateAfterLoadChanges(oStateBeforeLoadChanges)}oStateBeforeLoadChanges=null;return oStateBeforeLoadChanges};_this.getStateBeforeLoadChanges=function(){return oStateBeforeLoadChanges};_this.createDrawingObject=function(type){var drawingBase=new DrawingBase(worksheet);if(AscFormat.isRealNumber(type))drawingBase.Type=type;return drawingBase};_this.cloneDrawingObject=function(object){var copyObject=_this.createDrawingObject();copyObject.Type=object.Type; copyObject.editAs=object.editAs;copyObject.Pos.X=object.Pos.X;copyObject.Pos.Y=object.Pos.Y;copyObject.ext.cx=object.ext.cx;copyObject.ext.cy=object.ext.cy;copyObject.from.col=object.from.col;copyObject.from.colOff=object.from.colOff;copyObject.from.row=object.from.row;copyObject.from.rowOff=object.from.rowOff;copyObject.to.col=object.to.col;copyObject.to.colOff=object.to.colOff;copyObject.to.row=object.to.row;copyObject.to.rowOff=object.to.rowOff;copyObject.boundsFromTo.from.col=object.boundsFromTo.from.col; copyObject.boundsFromTo.from.colOff=object.boundsFromTo.from.colOff;copyObject.boundsFromTo.from.row=object.boundsFromTo.from.row;copyObject.boundsFromTo.from.rowOff=object.boundsFromTo.from.rowOff;copyObject.boundsFromTo.to.col=object.boundsFromTo.to.col;copyObject.boundsFromTo.to.colOff=object.boundsFromTo.to.colOff;copyObject.boundsFromTo.to.row=object.boundsFromTo.to.row;copyObject.boundsFromTo.to.rowOff=object.boundsFromTo.to.rowOff;copyObject.graphicObject=object.graphicObject;return copyObject}; _this.createShapeAndInsertContent=function(oParaContent){var track_object=new AscFormat.NewShapeTrack("textRect",0,0,Asc["editor"].wbModel.theme,null,null,null,0);track_object.track({},0,0);var shape=track_object.getShape(false,_this.drawingDocument,this);shape.spPr.setFill(AscFormat.CreateNoFillUniFill());shape.txBody.content.Content[0].Add_ToContent(0,oParaContent.Copy());var body_pr=shape.getBodyPr();var w=shape.txBody.getMaxContentWidth(150,true)+body_pr.lIns+body_pr.rIns;var h=shape.txBody.content.GetSummaryHeight()+ body_pr.tIns+body_pr.bIns;shape.spPr.xfrm.setExtX(w);shape.spPr.xfrm.setExtY(h);shape.spPr.xfrm.setOffX(0);shape.spPr.xfrm.setOffY(0);shape.spPr.setLn(AscFormat.CreateNoFillLine());shape.setWorksheet(worksheet.model);return shape};_this.init=function(currentSheet){var api=window["Asc"]["editor"];worksheet=currentSheet;drawingCtx=currentSheet.drawingGraphicCtx;overlayCtx=currentSheet.overlayGraphicCtx;_this.drawingArea=currentSheet.drawingArea;_this.drawingArea.init();_this.drawingDocument=currentSheet.getDrawingDocument(); _this.drawingDocument.drawingObjects=this;_this.drawingDocument.AutoShapesTrack=api.wb.autoShapeTrack;_this.drawingDocument.TargetHtmlElement=document.getElementById("id_target_cursor");_this.drawingDocument.InitGuiCanvasShape(api.shapeElementId);_this.controller=new AscFormat.DrawingObjectsController(_this);_this.canEdit=function(){return api.canEdit()};aImagesSync=[];var i;aObjects=currentSheet.model.Drawings;for(i=0;currentSheet.model.Drawings&&i0){var old_val=api.ImageLoader.bIsAsyncLoadDocumentImages;api.ImageLoader.bIsAsyncLoadDocumentImages=true;api.ImageLoader.LoadDocumentImages(aImagesSync);api.ImageLoader.bIsAsyncLoadDocumentImages=old_val}_this.recalculate(true);worksheet.model.Drawings=aObjects};_this.getSelectedDrawingsRange=function(){var i,rmin=gc_nMaxRow,rmax=0,cmin=gc_nMaxCol,cmax=0,selectedObjects=this.controller.selectedObjects,drawingBase;for(i=0;i< selectedObjects.length;++i){drawingBase=selectedObjects[i].drawingBase;if(drawingBase){if(drawingBase.from.colcmax)cmax=drawingBase.to.col;if(drawingBase.to.row>rmax)rmax=drawingBase.to.row}}return new Asc.Range(cmin,rmin,cmax,rmax,true)};_this.getContextMenuPosition=function(){if(!worksheet)return new AscCommon.asc_CRect(0,0,5,5);var oPos=this.controller.getContextMenuPosition(0);var _x=oPos.X* Asc.getCvtRatio(3,0,worksheet._getPPIX())+scrollOffset.getX();var _y=oPos.Y*Asc.getCvtRatio(3,0,worksheet._getPPIY())+scrollOffset.getY();return new AscCommon.asc_CRect(_x,_y,0,0)};_this.recalculate=function(all){_this.controller.recalculate2(all)};_this.preCopy=function(){_this.shiftMap={};var selected_objects=_this.controller.selectedObjects;if(selected_objects.length>0){var min_x,min_y,i;min_x=selected_objects[0].x;min_y=selected_objects[0].y;for(i=1;i0){var oVisibleRange=worksheet.getVisibleRange();var nSlicerCount=aNames.length;var dSlicerWidth=2*25.4;var dSlicerHeight=2.76*25.4;var dSlicerInset=10;var dTotalWidth=dSlicerWidth+nSlicerCount*dSlicerInset;var dTotalHeight=dSlicerHeight+nSlicerCount*dSlicerInset;var dLeft=worksheet.getCellLeft(oVisibleRange.c1,3);var dTop=worksheet.getCellTop(oVisibleRange.r1,3);var dRight=worksheet.getCellLeft(oVisibleRange.c2,3)+worksheet.getColumnWidth(oVisibleRange.c2, 3);var dBottom=worksheet.getCellTop(oVisibleRange.r2,3)+worksheet.getRowHeight(oVisibleRange.r2,3);_this.controller.resetSelection();var dStartPosX=Math.max(0,(dLeft+dRight)/2-dTotalWidth/2);var dStartPosY=Math.max(0,(dTop+dBottom)/2-dTotalHeight/2);var oSlicer,x,y;for(var nSlicerIndex=0;nSlicerIndex0?cache.formatCode:"General";var sFormula=ref.f+"";if(sFormula[0]==="(")sFormula=sFormula.slice(1);if(sFormula[sFormula.length-1]=== ")")sFormula=sFormula.slice(0,-1);var f1=sFormula;var arr_f=f1.split(",");var pt_index=0,i,j,pt,nPtCount,k;for(i=0;imax_r)max_r=range.r1;if(range.r2>max_r)max_r=range.r2;if(range.c1>max_c)max_c=range.c1;if(range.c2>max_c)max_c= range.c2;if(i===arr_f.length-1){nPtCount=cache.getPtCount();if(nPtCount-pt_index<=range.r2-range.r1+1){for(k=range.c1;k<=range.c2;++k)for(j=range.r1;j<=range.r2;++j)source_worksheet._getCell(j,k,function(cell){pt=cache.getPtByIndex(pt_index+j-range.r1);if(pt)fFillCell(cell,typeof pt.formatCode==="string"&&pt.formatCode.length>0?pt.formatCode:lit_format_code,pt.val)});pt_index+=range.r2-range.r1+1}else if(nPtCount-pt_index<=range.c2-range.c1+1){for(k=range.r1;k<=range.r2;++k)for(j=range.c1;j<=range.c2;++j)source_worksheet._getCell(k, j,function(cell){pt=cache.getPtByIndex(pt_index+j-range.c1);if(pt)fFillCell(cell,typeof pt.formatCode==="string"&&pt.formatCode.length>0?pt.formatCode:lit_format_code,pt.val)});pt_index+=range.c2-range.c1+1}}else if(range.r1===range.r2)for(j=range.c1;j<=range.c2;++j)source_worksheet._getCell(range.r1,j,function(cell){pt=cache.getPtByIndex(pt_index);if(pt)fFillCell(cell,typeof pt.formatCode==="string"&&pt.formatCode.length>0?pt.formatCode:lit_format_code,pt.val);++pt_index});else for(j=range.r1;j<= range.r2;++j)source_worksheet._getCell(j,range.c1,function(cell){pt=cache.getPtByIndex(pt_index);if(pt)fFillCell(cell,typeof pt.formatCode==="string"&&pt.formatCode.length>0?pt.formatCode:lit_format_code,pt.val);++pt_index})}}}}}}var first_num_ref;if(series[0])if(series[0].val)first_num_ref=series[0].val.numRef;else if(series[0].yVal)first_num_ref=series[0].yVal.numRef;if(first_num_ref){var resultRef=parserHelp.parse3DRef(first_num_ref.f);if(resultRef){model.workbook.aWorksheets[0].sName=resultRef.sheet; var oCat,oVal;for(var i=0;i0)window["Asc"]["editor"].ImageLoader.LoadDocumentImages(aImagesSync); History.Clear()})})}};_this.editChartDrawingObject=function(chart){if(chart){if(api.isChartEditor)_this.controller.selectObject(aObjects[0].graphicObject,0);_this.controller.editChartDrawingObjects(chart)}};_this.checkSparklineGroupMinMaxVal=function(oSparklineGroup){var maxVal=null,minVal=null,i,j,sparkline,nPtCount=0;if(oSparklineGroup.type!==Asc.c_oAscSparklineType.Stacked&&(Asc.c_oAscSparklineAxisMinMax.Group===oSparklineGroup.minAxisType||Asc.c_oAscSparklineAxisMinMax.Group===oSparklineGroup.maxAxisType)){for(i= 0;iaPoints[j].val)minVal=aPoints[j].val}}if(maxVal!==null||minVal!==null){if(maxVal!==null&&minVal!==null&&AscFormat.fApproxEqual(minVal,maxVal))if(nPtCount>1){minVal-=.1;maxVal+=.1}else if(maxVal>=0)minVal=null;else maxVal=null;if(maxVal!==null)maxVal-=.01;if(minVal!==null)minVal+=.01;for(i=0;iobj.from.col&&updateRange.c1<=obj.to.col)if(bCanResize)metrics.to.col+=count;else metrics=null;else metrics=null;break}case c_oAscInsertOptions.InsertCellsAndShiftRight:{break}case c_oAscInsertOptions.InsertRows:{count= updateRange.r2-updateRange.r1+1;if(updateRange.r1<=obj.from.row)if(bCanMove){metrics.from.row+=count;metrics.to.row+=count}else metrics=null;else if(updateRange.r1>obj.from.row&&updateRange.r1<=obj.to.row)if(bCanResize)metrics.to.row+=count;else metrics=null;else metrics=null;break}case c_oAscInsertOptions.InsertCellsAndShiftDown:{break}}else switch(operType){case c_oAscDeleteOptions.DeleteColumns:{count=updateRange.c2-updateRange.c1+1;if(updateRange.c1<=obj.from.col)if(updateRange.c20)offset=obj.to.col-updateRange.c2-1;else{offset=1;metrics.to.colOff=0}metrics.to.col=metrics.from.col+offset}else metrics=null;else if(updateRange.c1>obj.from.col&&updateRange.c1<=obj.to.col)if(bCanResize)if(updateRange.c2>=obj.to.col){metrics.to.col=updateRange.c1;metrics.to.colOff=0}else metrics.to.col-=count;else metrics=null;else metrics= null;break}case c_oAscDeleteOptions.DeleteCellsAndShiftLeft:{break}case c_oAscDeleteOptions.DeleteRows:{count=updateRange.r2-updateRange.r1+1;if(updateRange.r1<=obj.from.row)if(updateRange.r20)offset=obj.to.row-updateRange.r2-1;else{offset=1;metrics.to.colOff=0}metrics.to.row=metrics.from.row+offset}else metrics= null;else if(updateRange.r1>obj.from.row&&updateRange.r1<=obj.to.row)if(bCanResize)if(updateRange.r2>=obj.to.row){metrics.to.row=updateRange.r1;metrics.to.colOff=0}else metrics.to.row-=count;else metrics=null;else metrics=null;break}case c_oAscDeleteOptions.DeleteCellsAndShiftTop:{break}}if(metrics){if(metrics.from.col<0){metrics.from.col=0;metrics.from.colOff=0}if(metrics.to.col<=0){metrics.to.col=1;metrics.to.colOff=0}if(metrics.from.row<0){metrics.from.row=0;metrics.from.rowOff=0}if(metrics.to.row<= 0){metrics.to.row=1;metrics.to.rowOff=0}if(metrics.from.col==metrics.to.col){metrics.to.col++;metrics.to.colOff=0}if(metrics.from.row==metrics.to.row){metrics.to.row++;metrics.to.rowOff=0}obj.graphicObject.setDrawingBaseCoords(metrics.from.col,metrics.from.colOff,metrics.from.row,metrics.from.rowOff,metrics.to.col,metrics.to.colOff,metrics.to.row,metrics.to.rowOff,obj.Pos.X,obj.Pos.Y,obj.ext.cx,obj.ext.cy);obj.graphicObject.recalculate();if(obj.graphicObject.spPr&&obj.graphicObject.spPr.xfrm){obj.graphicObject.spPr.xfrm.setOffX(obj.graphicObject.x); obj.graphicObject.spPr.xfrm.setOffY(obj.graphicObject.y);obj.graphicObject.spPr.xfrm.setExtX(obj.graphicObject.extX);obj.graphicObject.spPr.xfrm.setExtY(obj.graphicObject.extY)}obj.graphicObject.recalculate();bNeedRedraw=true}}bNeedRedraw&&_this.showDrawingObjects()};_this.updateDrawingsTransform=function(target){if(false===_this.bUpdateMetrics)return;if(!AscCommon.isRealObject(target))return;if(target.target===AscCommonExcel.c_oTargetType.RowResize||target.target===AscCommonExcel.c_oTargetType.ColumnResize)for(var i= 0;i0){var aId=[];for(i= 0;i0};_this.loadImageRedraw=function(imageUrl){var _image=api.ImageLoader.LoadImage(imageUrl,1);if(null!=_image)imageLoaded(_image);else _this.asyncImageEndLoaded= function(_image){imageLoaded(_image);_this.asyncImageEndLoaded=null};function imageLoaded(_image){if(!_image.Image)worksheet.model.workbook.handlers.trigger("asc_onError",c_oAscError.ID.UplImageUrl,c_oAscError.Level.NoCritical);else _this.showDrawingObjects()}};_this.getOriginalImageSize=function(){var selectedObjects=_this.controller.selectedObjects;if(selectedObjects.length==1){if(AscFormat.isRealNumber(selectedObjects[0].m_fDefaultSizeX)&&AscFormat.isRealNumber(selectedObjects[0].m_fDefaultSizeY))return new AscCommon.asc_CImageSize(selectedObjects[0].m_fDefaultSizeX, selectedObjects[0].m_fDefaultSizeY,true);if(selectedObjects[0].isImage()){var imageUrl=selectedObjects[0].getImageUrl();var oImagePr=new Asc.asc_CImgProperty;oImagePr.asc_putImageUrl(imageUrl);return oImagePr.asc_getOriginSize(api)}}return new AscCommon.asc_CImageSize(50,50,false)};_this.getSelectionImg=function(){return _this.controller.getSelectionImage().asc_getImageUrl()};_this.sendGraphicObjectProps=function(){if(worksheet)worksheet.handlers.trigger("selectionChanged")};_this.setGraphicObjectProps= function(props){var objectProperties=props;var _img;if(!AscCommon.isNullOrEmptyString(objectProperties.ImageUrl)){_img=api.ImageLoader.LoadImage(objectProperties.ImageUrl,1);if(null!=_img)_this.controller.setGraphicObjectProps(objectProperties);else _this.asyncImageEndLoaded=function(_image){_this.controller.setGraphicObjectProps(objectProperties);_this.asyncImageEndLoaded=null}}else if(objectProperties.ShapeProperties&&objectProperties.ShapeProperties.fill&&objectProperties.ShapeProperties.fill.fill&& !AscCommon.isNullOrEmptyString(objectProperties.ShapeProperties.fill.fill.url))if(window["IS_NATIVE_EDITOR"])_this.controller.setGraphicObjectProps(objectProperties);else{_img=api.ImageLoader.LoadImage(objectProperties.ShapeProperties.fill.fill.url,1);if(null!=_img)_this.controller.setGraphicObjectProps(objectProperties);else _this.asyncImageEndLoaded=function(_image){_this.controller.setGraphicObjectProps(objectProperties);_this.asyncImageEndLoaded=null}}else if(objectProperties.ShapeProperties&& objectProperties.ShapeProperties.textArtProperties&&objectProperties.ShapeProperties.textArtProperties.Fill&&objectProperties.ShapeProperties.textArtProperties.Fill.fill&&!AscCommon.isNullOrEmptyString(objectProperties.ShapeProperties.textArtProperties.Fill.fill.url))if(window["IS_NATIVE_EDITOR"])_this.controller.setGraphicObjectProps(objectProperties);else{_img=api.ImageLoader.LoadImage(objectProperties.ShapeProperties.textArtProperties.Fill.fill.url,1);if(null!=_img)_this.controller.setGraphicObjectProps(objectProperties); else _this.asyncImageEndLoaded=function(_image){_this.controller.setGraphicObjectProps(objectProperties);_this.asyncImageEndLoaded=null}}else{objectProperties.ImageUrl=null;if(!api.noCreatePoint||api.exucuteHistory){if(!api.noCreatePoint&&!api.exucuteHistory&&api.exucuteHistoryEnd){if(_this.nCurPointItemsLength===-1)_this.controller.setGraphicObjectProps(props);else{_this.controller.setGraphicObjectPropsCallBack(props);_this.controller.startRecalculate();_this.sendGraphicObjectProps()}api.exucuteHistoryEnd= false;_this.nCurPointItemsLength=-1}else _this.controller.setGraphicObjectProps(props);if(api.exucuteHistory){var Point=History.Points[History.Index];if(Point)_this.nCurPointItemsLength=Point.Items.length;else _this.nCurPointItemsLength=-1;api.exucuteHistory=false}if(api.exucuteHistoryEnd)api.exucuteHistoryEnd=false}else{var Point=History.Points[History.Index];if(Point&&Point.Items.length>0)if(this.nCurPointItemsLength>-1){var nBottomIndex=-1;for(var Index=Point.Items.length-1;Index>nBottomIndex;Index--){var Item= Point.Items[Index];if(!Item.Class.Read_FromBinary2)Item.Class.Undo(Item.Type,Item.Data,Item.SheetId);else Item.Class.Undo(Item.Data)}_this.controller.setSelectionState(Point.SelectionState);Point.Items.length=0;_this.controller.setGraphicObjectPropsCallBack(props);_this.controller.startRecalculate()}else{_this.controller.setGraphicObjectProps(props);var Point=History.Points[History.Index];if(Point)_this.nCurPointItemsLength=Point.Items.length;else _this.nCurPointItemsLength=-1}}api.exucuteHistoryEnd= false}};_this.showChartSettings=function(){api.wb.handlers.trigger("asc_onShowChartDialog",true)};_this.setDrawImagePlaceParagraph=function(element_id,props){_this.drawingDocument.InitGuiCanvasTextProps(element_id);_this.drawingDocument.DrawGuiCanvasTextProps(props)};_this.graphicObjectMouseDown=function(e,x,y){var offsets=_this.drawingArea.getOffsets(x,y,true);if(offsets)_this.controller.onMouseDown(e,pxToMm(x-offsets.x),pxToMm(y-offsets.y))};_this.graphicObjectMouseMove=function(e,x,y){e.IsLocked= e.isLocked;_this.lastX=x;_this.lastY=y;var offsets=_this.drawingArea.getOffsets(x,y,true);if(offsets)_this.controller.onMouseMove(e,pxToMm(x-offsets.x),pxToMm(y-offsets.y))};_this.graphicObjectMouseUp=function(e,x,y){var offsets=_this.drawingArea.getOffsets(x,y,true);if(offsets)_this.controller.onMouseUp(e,pxToMm(x-offsets.x),pxToMm(y-offsets.y))};_this.isPointInDrawingObjects3=function(x,y,page,bSelected,bText){var offsets=_this.drawingArea.getOffsets(x,y,true);if(offsets)return _this.controller.isPointInDrawingObjects3(pxToMm(x- offsets.x),pxToMm(y-offsets.y),page,bSelected,bText);return false};_this.graphicObjectKeyDown=function(e){return _this.controller.onKeyDown(e)};_this.graphicObjectKeyUp=function(e){return _this.controller.onKeyUp(e)};_this.graphicObjectKeyPress=function(e){e.KeyCode=e.keyCode;e.CtrlKey=e.metaKey||e.ctrlKey;e.AltKey=e.altKey;e.ShiftKey=e.shiftKey;e.Which=e.which;return _this.controller.onKeyPress(e)};_this.cleanWorksheet=function(){};_this.getWordChartObject=function(){for(var i=0;irowHeight?rowHeight:cell.rowOff;var resultColOff=cell.colOff>colWidth?colWidth:cell.colOff;coords.y=ws._getRowTop(cell.row)+ws.objectRender.convertMetric(resultRowOff,3,0)-ws._getRowTop(0);coords.x=ws._getColLeft(cell.col)+ws.objectRender.convertMetric(resultColOff, 3,0)-ws._getColLeft(0)}return coords};function ClickCounter(){this.x=0;this.y=0;this.lastX=-1E3;this.lastY=-1E3;this.button=0;this.time=0;this.clickCount=0;this.log=false}ClickCounter.prototype.mouseDownEvent=function(x,y,button){var currTime=getCurrentTime();if(undefined===button)button=0;var _eps=3*global_mouseEvent.KoefPixToMM;var oApi=Asc&&Asc.editor;if(oApi&&oApi.isMobileVersion&&!window["NATIVE_EDITOR_ENJINE"])_eps*=2;if(Math.abs(global_mouseEvent.X-global_mouseEvent.LastX)>_eps||Math.abs(global_mouseEvent.Y- global_mouseEvent.LastY)>_eps){global_mouseEvent.LastClickTime=-1;global_mouseEvent.ClickCount=0}this.x=x;this.y=y;if(this.button===button&&Math.abs(this.x-this.lastX)<=_eps&&Math.abs(this.y-this.lastY)<=_eps&&currTime-this.time<500)++this.clickCount;else this.clickCount=1;this.lastX=this.x;this.lastY=this.y;if(this.log){console.log("-----");console.log("x-> "+this.x+" : "+x);console.log("y-> "+this.y+" : "+y);console.log("Time: "+(currTime-this.time));console.log("Count: "+this.clickCount);console.log("")}this.time= currTime};ClickCounter.prototype.mouseMoveEvent=function(x,y){if(this.x!==x||this.y!==y){this.x=x;this.y=y;this.clickCount=0;if(this.log)console.log("Reset counter")}};ClickCounter.prototype.getClickCount=function(){return this.clickCount};var prot;window["AscFormat"]=window["AscFormat"]||{};window["Asc"]=window["Asc"]||{};window["AscFormat"].isObject=isObject;window["AscFormat"].CCellObjectInfo=CCellObjectInfo;window["Asc"]["asc_CChartBinary"]=window["Asc"].asc_CChartBinary=asc_CChartBinary;prot= asc_CChartBinary.prototype;prot["asc_getBinary"]=prot.asc_getBinary;prot["asc_setBinary"]=prot.asc_setBinary;prot["asc_getThemeBinary"]=prot.asc_getThemeBinary;prot["asc_setThemeBinary"]=prot.asc_setThemeBinary;prot["asc_setColorMapBinary"]=prot.asc_setColorMapBinary;prot["asc_getColorMapBinary"]=prot.asc_getColorMapBinary;window["AscFormat"].asc_CChartSeria=asc_CChartSeria;prot=asc_CChartSeria.prototype;prot["asc_getValFormula"]=prot.asc_getValFormula;prot["asc_setValFormula"]=prot.asc_setValFormula; prot["asc_getxValFormula"]=prot.asc_getxValFormula;prot["asc_setxValFormula"]=prot.asc_setxValFormula;prot["asc_getCatFormula"]=prot.asc_getCatFormula;prot["asc_setCatFormula"]=prot.asc_setCatFormula;prot["asc_getTitle"]=prot.asc_getTitle;prot["asc_setTitle"]=prot.asc_setTitle;prot["asc_getTitleFormula"]=prot.asc_getTitleFormula;prot["asc_setTitleFormula"]=prot.asc_setTitleFormula;prot["asc_getMarkerSize"]=prot.asc_getMarkerSize;prot["asc_setMarkerSize"]=prot.asc_setMarkerSize;prot["asc_getMarkerSymbol"]= prot.asc_getMarkerSymbol;prot["asc_setMarkerSymbol"]=prot.asc_setMarkerSymbol;prot["asc_getFormatCode"]=prot.asc_getFormatCode;prot["asc_setFormatCode"]=prot.asc_setFormatCode;window["AscFormat"].GraphicOption=GraphicOption;window["AscFormat"].DrawingObjects=DrawingObjects;window["AscFormat"].ClickCounter=ClickCounter;window["AscFormat"].aSparklinesStyles=aSparklinesStyles;window["AscFormat"].CSparklineView=CSparklineView})(window);"use strict";(function(window,undefined){var ORIENTATION_MIN_MAX= AscFormat.ORIENTATION_MIN_MAX;var globalBasePercent=100;var global3DPersperctive=30;var c_oChartFloorPosition={None:0,Left:1,Right:2,Bottom:3,Top:4};function Processor3D(width,height,left,right,bottom,top,chartSpace,chartsDrawer){this.widthCanvas=width;this.heightCanvas=height;this.left=left?left:0;this.right=right?right:0;this.bottom=bottom?bottom:0;this.top=top?top:0;this.cameraDiffZ=0;this.cameraDiffX=0;this.cameraDiffY=0;this.scaleY=1;this.scaleX=1;this.scaleZ=1;this.aspectRatioY=1;this.aspectRatioX= 1;this.aspectRatioZ=1;this.specialStandardScaleX=1;this.view3D=chartSpace.chart.getView3d();this.chartSpace=chartSpace;this.chartsDrawer=chartsDrawer;this.rPerspective=0;this.hPercent=null;this.angleOx=this.view3D&&this.view3D.rotX?-this.view3D.rotX/360*(Math.PI*2):0;this.angleOy=this.view3D&&this.view3D.rotY?-this.view3D.rotY/360*(Math.PI*2):0;if(!this.view3D.getRAngAx()&&AscFormat.c_oChartTypes.Pie===this.chartsDrawer.calcProp.type)this.angleOy=0;this.orientationCatAx=null;this.orientationValAx= null;this.matrixRotateOx=null;this.matrixRotateOy=null;this.matrixRotateAllAxis=null;this.matrixShearXY=null;this.projectMatrix=null}Processor3D.prototype.calaculate3DProperties=function(baseDepth,gapDepth,bIsCheck){this.calculateCommonOptions();this._calculateAutoHPercent();this._calcAspectRatio();this.depthPerspective=this.view3D.getRAngAx()?this._calculateDepth():this._calculateDepthPerspective();this._calculatePerspective(this.view3D);if(this.view3D.getRAngAx())this._calculateScaleFromDepth(); if(!bIsCheck){this._calculateCameraDiff();if(this.view3D.getRAngAx())this._recalculateScaleWithMaxWidth()}if(AscFormat.c_oChartTypes.Pie===this.chartsDrawer.calcProp.type&&!this.view3D.getRAngAx())this.tempChangeAspectRatioForPie()};Processor3D.prototype.tempChangeAspectRatioForPie=function(){var perspectiveDepth=this.depthPerspective;var widthCanvas=this.widthCanvas;var originalWidthChart=widthCanvas-this.left-this.right;var heightCanvas=this.heightCanvas;var heightChart=heightCanvas-this.top-this.bottom; var points=[],faces=[];points.push(new Point3D(this.left+originalWidthChart/2,this.top,perspectiveDepth,this));points.push(new Point3D(this.left,this.top,perspectiveDepth/2,this));points.push(new Point3D(this.left+originalWidthChart,this.top,perspectiveDepth/2,this));points.push(new Point3D(this.left+originalWidthChart/2,this.top,0,this));points.push(new Point3D(this.left+originalWidthChart/2,this.top+heightChart,perspectiveDepth,this));points.push(new Point3D(this.left,this.top+heightChart,perspectiveDepth/ 2,this));points.push(new Point3D(this.left+originalWidthChart,this.top+heightChart,perspectiveDepth/2,this));points.push(new Point3D(this.left+originalWidthChart/2,this.top+heightChart,0,this));faces.push([0,1,2,3]);faces.push([2,5,4,3]);faces.push([1,6,7,0]);faces.push([6,5,4,7]);faces.push([7,4,3,0]);faces.push([1,6,2,5]);var minMaxOx=this._getMinMaxOx(points,faces);var minMaxOy=this._getMinMaxOy(points,faces);var kF=(minMaxOx.right-minMaxOx.left)/originalWidthChart;if((minMaxOy.bottom-minMaxOy.top)/ kF>heightChart)kF=(minMaxOy.bottom-minMaxOy.top)/heightChart;this.aspectRatioX=this.aspectRatioX*kF;this.aspectRatioY=this.aspectRatioY*kF;this.aspectRatioZ=this.aspectRatioZ*kF};Processor3D.prototype.calculateCommonOptions=function(){this.orientationCatAx=this.chartSpace&&this.chartSpace.chart.plotArea.catAx?this.chartSpace.chart.plotArea.catAx.scaling.orientation:ORIENTATION_MIN_MAX;this.orientationValAx=this.chartSpace&&this.chartSpace.chart.plotArea.valAx?this.chartSpace.chart.plotArea.valAx.scaling.orientation: ORIENTATION_MIN_MAX};Processor3D.prototype._calculateAutoHPercent=function(){var widthLine=this.widthCanvas-(this.left+this.right);var heightLine=this.heightCanvas-(this.top+this.bottom);if(this.hPercent==null){this.hPercent=this.view3D.hPercent===null?heightLine/widthLine:this.view3D.hPercent/100;if(this.chartsDrawer.calcProp.type===AscFormat.c_oChartTypes.HBar&&(this.view3D.hPercent===null&&this.view3D.getRAngAx()||this.view3D.hPercent!==null&&!this.view3D.getRAngAx()))this.hPercent=1/this.hPercent; if(AscFormat.c_oChartTypes.Pie===this.chartsDrawer.calcProp.type)this.hPercent=.12}};Processor3D.prototype._recalculateScaleWithMaxWidth=function(){var widthLine=this.widthCanvas-(this.left+this.right);var heightLine=this.heightCanvas-(this.top+this.bottom);var widthCanvas=this.widthCanvas;var optimalWidth=heightLine*10;var subType=this.chartsDrawer.calcProp.subType;var type=this.chartsDrawer.calcProp.type;var isStandardType=subType==="standard"||type===AscFormat.c_oChartTypes.Line||type===AscFormat.c_oChartTypes.Area&& subType==="normal"||type===AscFormat.c_oChartTypes.Surface;var optimalWidthLine,kF;if(!isStandardType){this.widthCanvas=optimalWidth+(this.left+this.right);this._calculateScaleNStandard();optimalWidthLine=Math.abs(this.depthPerspective*Math.sin(-this.angleOy))+(this.widthCanvas-(this.left+this.right))/this.aspectRatioX/this.scaleX;kF=optimalWidthLine/widthLine;if(optimalWidthLineMath.PI){this.widthCanvas=optimalWidth+(this.left+this.right);this.calaculate3DProperties(null,null,true);var newDepth=Math.abs(this.depthPerspective* Math.sin(-this.angleOy));optimalWidthLine=newDepth+(this.widthCanvas-(this.left+this.right))/this.aspectRatioX/this.scaleX;kF=optimalWidthLine/widthLine;if(optimalWidthLine=Math.PI/2&&angleOyAbs=3*Math.PI/2&&angleOyAbs<2*Math.PI)result=this.depthPerspective}else if(this.chartsDrawer.calcProp.type!==AscFormat.c_oChartTypes.HBar&&this.orientationCatAx!==ORIENTATION_MIN_MAX&&this.depthPerspective!==undefined)result=this.depthPerspective;else if(this.chartsDrawer.calcProp.type===AscFormat.c_oChartTypes.HBar&& this.orientationCatAx!==ORIENTATION_MIN_MAX&&this.depthPerspective!==undefined)result=this.depthPerspective;return result};Processor3D.prototype.calculateZPositionCatAxis=function(){var result=0;if(!this.view3D.getRAngAx())result=Math.cos(this.angleOy)>0?0:this.depthPerspective;else if(this.chartsDrawer.calcProp.type!==AscFormat.c_oChartTypes.HBar&&this.orientationValAx!==ORIENTATION_MIN_MAX&&this.depthPerspective!==undefined){if(this.chartSpace.chart.plotArea.valAx&&this.chartSpace.chart.plotArea.valAx.yPoints&& this.chartSpace.chart.plotArea.catAx.posY===this.chartSpace.chart.plotArea.valAx.yPoints[0].pos)result=this.depthPerspective}else if(this.chartsDrawer.calcProp.type===AscFormat.c_oChartTypes.HBar&&this.orientationValAx!==ORIENTATION_MIN_MAX&&this.depthPerspective!==undefined)result=this.depthPerspective;return result};Processor3D.prototype.calculateFloorPosition=function(){var res,absOy;if(this.view3D.getRAngAx())if(this.chartsDrawer.calcProp.type===AscFormat.c_oChartTypes.HBar){absOy=Math.abs(this.angleOy); res=c_oChartFloorPosition.Left;if(absOy>Math.PI)res=c_oChartFloorPosition.Right}else{res=c_oChartFloorPosition.Bottom;if(this.angleOx>0)res=c_oChartFloorPosition.None}else if(this.chartsDrawer.calcProp.type===AscFormat.c_oChartTypes.HBar){absOy=Math.abs(this.angleOy);res=c_oChartFloorPosition.Left;if(absOy>Math.PI)res=c_oChartFloorPosition.Right}else{res=c_oChartFloorPosition.Bottom;if(this.angleOx>0)res=c_oChartFloorPosition.None}return res};Processor3D.prototype.convertAndTurnPoint=function(x,y, z,isNScale,isNRotate,isNProject){var res=null;if(this.view3D.getRAngAx())res=this.convertAndTurnPointRAngAx(x,y,z);else res=this.convertAndTurnPointPerspective(x,y,z,isNScale,isNRotate,isNProject);return res};Processor3D.prototype.convertAndTurnPointRAngAx=function(x,y,z){var heightChart=this.heightCanvas-this.top-this.bottom;var widthOriginalChart=this.widthCanvas-this.left-this.right;var point3D=new Point3D(x,y,z,this);this.scale(point3D);var centerXDiff=heightChart/2+this.left/2;var centerYDiff= heightChart/2+this.top;var centerZDiff=this.depthPerspective/2;point3D.offset(-centerXDiff,-centerYDiff,-centerZDiff);var matrixRotateAllAxis=this._shearXY();point3D.multiplyPointOnMatrix1(matrixRotateAllAxis);point3D.offset(this.cameraDiffX,this.cameraDiffY,this.cameraDiffZ);var specialReverseDiff=this.widthCanvas/2+(this.left-this.right)/2;point3D.offset(specialReverseDiff,centerYDiff,centerZDiff);return{x:point3D.x,y:point3D.y,z:z}};Processor3D.prototype.convertAndTurnPointPerspective=function(x, y,z,isNScale,isNRotate,isNProject){var point3D=new Point3D(x,y,z,this);if(!isNScale)this.scale(point3D);if(!isNRotate)this.rotatePerspective(point3D);if(!isNProject)this.projectPerspective(point3D);return{x:point3D.x,y:point3D.y,z:point3D.z}};Processor3D.prototype.scale=function(point3D){point3D.x=point3D.x/this.aspectRatioX;point3D.y=point3D.y/this.aspectRatioY;point3D.x=point3D.x/this.scaleX;point3D.y=point3D.y/this.scaleY;point3D.z=point3D.z/this.scaleZ};Processor3D.prototype.rotatePerspective= function(point3D){point3D.offset(-this.widthCanvas/2/this.aspectRatioX,-this.heightCanvas/2/this.aspectRatioY,0);var matrixRotateAllAxis=this._getMatrixRotateAllAxis();point3D.multiplyPointOnMatrix1(matrixRotateAllAxis);point3D.offset(this.widthCanvas/2/this.aspectRatioX,this.heightCanvas/2/this.aspectRatioY,0)};Processor3D.prototype.projectPerspective=function(point3D){point3D.offset(-this.widthCanvas/2/this.aspectRatioX,-this.heightCanvas/2/this.aspectRatioY,0);point3D.offset(this.cameraDiffX,this.cameraDiffY, this.cameraDiffZ);var projectiveMatrix=this._getPerspectiveProjectionMatrix(1/this.rPerspective);point3D.project(projectiveMatrix);var specialReverseDiffX=this.widthCanvas/2+(this.left-this.right)/2;var specialReverseDiffY=this.heightCanvas/2+(this.top-this.bottom)/2;point3D.offset(specialReverseDiffX,specialReverseDiffY,0)};Processor3D.prototype.calculatePointManual=function(x,y,z,diffX,diffY,diffZ){diffX=diffX!==undefined?diffX:this.cameraDiffX;diffY=diffY!==undefined?diffY:this.cameraDiffY;diffZ= diffZ!==undefined?diffZ:this.cameraDiffZ;var diffAndScalePoints=this.diffAndScale(x,y,z);var x11=diffAndScalePoints.x;var y11=diffAndScalePoints.y;var z11=diffAndScalePoints.z;var rotatePoints=this.rotate(x11,y11,z11);var x111=rotatePoints.x;var y111=rotatePoints.y;var z111=rotatePoints.z;var x1111=x111+diffX;var y1111=y111+diffY;var z1111=z111+diffZ;var projectPoints=this.project(x1111,y1111,z1111);var x11111=projectPoints.x;var y11111=projectPoints.y;return{x:x11111,y:y11111}};Processor3D.prototype.diffAndScale= function(x,y,z){var aRX=this.aspectRatioX;var aRY=this.aspectRatioY;var w=this.widthCanvas;var h=this.heightCanvas;var x1=x/aRX;var x11=x1-w/2/aRX;var z1=z;var z11=z1;var y1=y/aRY;var y11=y1-h/2/aRY;return{x:x11,y:y11,z:z11}};Processor3D.prototype.rotate=function(x11,y11,z11){var sinOY=Math.sin(-this.angleOy);var cosOY=Math.cos(-this.angleOy);var sinOX=Math.sin(-this.angleOx);var cosOX=Math.cos(-this.angleOx);var x111=z11*sinOY+x11*cosOY;var y111=x11*sinOX*sinOY+y11*cosOX-z11*sinOX*cosOY;var z111= -x11*sinOY*cosOX+y11*sinOX+z11*(cosOY*cosOX);return{x:x111,y:y111,z:z111}};Processor3D.prototype.project=function(x1111,y1111,z1111){var fov=1/this.rPerspective;var w=this.widthCanvas;var h=this.heightCanvas;var x11111=fov*x1111/(z1111+fov)+w/2;var y11111=fov*y1111/(z1111+fov)+h/2;return{x:x11111,y:y11111}};Processor3D.prototype.convertAndTurnPointForPie=function(x,y,z,cameraDiffZ){var heightChart=this.heightCanvas-this.top-this.bottom;var point3D=new Point3D(x,y,z,this);var centerXDiff=heightChart/ 2+this.left/2;var centerYDiff=heightChart/2+this.top;var centerZDiff=this.depthPerspective/2;point3D.offset(-centerXDiff,-centerYDiff,-centerZDiff);var matrixRotateAllAxis;if(!this.view3D.getRAngAx())matrixRotateAllAxis=this._getMatrixRotateAllAxis();else matrixRotateAllAxis=this._shearXY();point3D.multiplyPointOnMatrix1(matrixRotateAllAxis);point3D.offset(this.cameraDiffX,this.cameraDiffY,this.cameraDiffZ);var projectionPoint=point3D;if(!this.view3D.getRAngAx()){var projectiveMatrix=this._getPerspectiveProjectionMatrix(1/ this.rPerspective);projectionPoint=point3D.project(projectiveMatrix)}var specialReverseDiff=this.widthCanvas/2+(this.left-this.right)/2;projectionPoint.offset(specialReverseDiff,centerYDiff,centerZDiff);return{x:projectionPoint.x,y:projectionPoint.y}};Processor3D.prototype.calculatePropertiesForPieCharts=function(){var sinAngleOx=Math.sin(-this.angleOx);var cosAngleOx=Math.cos(-this.angleOx);var widthCharts=this.widthCanvas-this.left-this.right;var heightCharts=this.heightCanvas-this.bottom-this.top; var radius1=widthCharts/2;var radius2=radius1*sinAngleOx;var depth=(widthCharts+4.89)/8.37*cosAngleOx;if(radius2*2+depth>heightCharts){var kF=(radius2*2+depth)/heightCharts;radius1=radius1/kF;radius2=radius2/kF;depth=depth/kF}if(0===radius2)radius2=1;return{radius1:radius1,radius2:radius2,depth:depth}};Processor3D.prototype._shearXY=function(){if(null===this.matrixShearXY){this.matrixShearXY=new Matrix4D;this.matrixShearXY.a31=Math.sin(-this.angleOy);this.matrixShearXY.a32=Math.sin(this.angleOx); this.matrixShearXY.a33=0;this.matrixShearXY.a44=0}return this.matrixShearXY};Processor3D.prototype._shearXY2=function(){if(null===this.matrixShearXY)this.matrixShearXY=[[1,0,0,0],[0,1,0,0],[Math.sin(-this.angleOy),Math.sin(this.angleOx),0,0],[0,0,0,0]];return this.matrixShearXY};Processor3D.prototype._getMatrixRotateAllAxis=function(){var matrixRotateOY=this._getMatrixRotateOy();var matrixRotateOX=this._getMatrixRotateOx();if(null===this.matrixRotateAllAxis)this.matrixRotateAllAxis=matrixRotateOY.multiply(matrixRotateOX); return this.matrixRotateAllAxis};Processor3D.prototype._getMatrixRotateOx=function(){if(null===this.matrixRotateOx){this.matrixRotateOx=new Matrix4D;var cos=Math.cos(-this.angleOx);var sin=Math.sin(-this.angleOx);this.matrixRotateOx.a22=cos;this.matrixRotateOx.a23=sin;this.matrixRotateOx.a32=-sin;this.matrixRotateOx.a33=cos;this.matrixRotateOx.a34=1}return this.matrixRotateOx};Processor3D.prototype._getMatrixRotateOy=function(){if(null===this.matrixRotateOy){this.matrixRotateOy=new Matrix4D;var cos= Math.cos(-this.angleOy);var sin=Math.sin(-this.angleOy);this.matrixRotateOy.a11=cos;this.matrixRotateOy.a13=-sin;this.matrixRotateOy.a31=sin;this.matrixRotateOy.a33=cos;this.matrixRotateOy.a34=1}return this.matrixRotateOy};Processor3D.prototype._getMatrixRotateOz=function(){return[[1,0,0,0],[0,1,0,0],[0,0,0,1],[0,0,0,1]]};Processor3D.prototype._getPerspectiveProjectionMatrix=function(fov){if(null===this.projectMatrix){this.projectMatrix=new Matrix4D;this.projectMatrix.a33=0;this.projectMatrix.a34= 1/fov}return this.projectMatrix};Processor3D.prototype.correctPointsPosition=function(chartSpace){if(this.chartsDrawer.calcProp.type===AscFormat.c_oChartTypes.Pie)return;var pxToMM=1/AscCommon.g_dKoef_pix_to_mm;var t=this;var xPoints=chartSpace.chart.plotArea&&chartSpace.chart.plotArea.catAx?chartSpace.chart.plotArea.catAx.xPoints:null;if(!xPoints)xPoints=chartSpace.chart.plotArea&&chartSpace.chart.plotArea.valAx?chartSpace.chart.plotArea.valAx.xPoints:null;var coordYAxisOx=chartSpace.chart.plotArea.catAx.posY; if(!coordYAxisOx)coordYAxisOx=chartSpace.chart.plotArea.valAx.posY!=undefined?chartSpace.chart.plotArea.valAx.posY:chartSpace.chart.plotArea.valAx.posY;var yPoints=chartSpace.chart.plotArea&&chartSpace.chart.plotArea.valAx?chartSpace.chart.plotArea.valAx.yPoints:null;if(!yPoints)yPoints=chartSpace.chart.plotArea&&chartSpace.chart.plotArea.catAx?chartSpace.chart.plotArea.catAx.yPoints:null;var coordXAxisOy=chartSpace.chart.plotArea.catAx.posX?chartSpace.chart.plotArea.catAx.posX:chartSpace.chart.plotArea.catAx.xPos; if(!coordXAxisOy)coordXAxisOy=chartSpace.chart.plotArea.valAx.posX!=undefined?chartSpace.chart.plotArea.valAx.posX:null;var correctPointsOx=function(){var z=t.calculateZPositionCatAxis();var valCatAx=chartSpace.chart.plotArea.catAx;if(!valCatAx.transformXPoints)valCatAx.transformXPoints=[];for(var i=0;i=Math.PI/2&&angleOyAbs<3*Math.PI/2))diffXText=-diffXText;valCatAx.transformYPoints[i]={x:(point.x-(diffXText+widthText))/pxToMM,y:point.y/pxToMM}}};var correctPointsOyHBar=function(){var zPosition=t.calculateZPositionCatAxis();var valCatAx=chartSpace.chart.plotArea.catAx;if(!valCatAx.transformYPoints)valCatAx.transformYPoints=[];for(var i=0;imaxX)maxX=point3D.x}this.cameraDiffZ=-minZ;this.checkOutSideArea2(newPoints)};Processor3D.prototype.checkOutSideArea2=function(newPoints){var i=0;var maxI=1E3;var t=this;var heightChart=this.heightCanvas- this.top-this.bottom;var widthChart=this.widthCanvas-this.left-this.right;var calculateZ=function(step){var minMaxOx=t._getMinMaxOxPoints(newPoints,-t.cameraDiffZ);t.cameraDiffX=-minMaxOx.diffX;var x111=t.convertAndTurnPoint(minMaxOx.tempX1,minMaxOx.tempY1,minMaxOx.tempZ1);var x222=t.convertAndTurnPoint(minMaxOx.tempX2,minMaxOx.tempY2,minMaxOx.tempZ2);var diffX=Math.abs(x222.x-x111.x);var minMaxOy=t._getMinMaxOyPoints(newPoints,t.cameraDiffZ);t.cameraDiffY=-minMaxOy.diffY;var y111=t.convertAndTurnPoint(minMaxOy.tempX1, minMaxOy.tempY1,minMaxOy.tempZ1);var y222=t.convertAndTurnPoint(minMaxOy.tempX2,minMaxOy.tempY2,minMaxOy.tempZ2);var diffY=Math.abs(y222.y-y111.y);if(diffXmaxI)break}else if(diffX>widthChart||diffY>heightChart)while(diffX>widthChart||diffY>heightChart){t.cameraDiffZ+=step;i++;minMaxOx=t._getMinMaxOxPoints(newPoints,-t.cameraDiffZ);t.cameraDiffX=-minMaxOx.diffX;x111=t.convertAndTurnPoint(minMaxOx.tempX1, minMaxOx.tempY1,minMaxOx.tempZ1);x222=t.convertAndTurnPoint(minMaxOx.tempX2,minMaxOx.tempY2,minMaxOx.tempZ2);diffX=Math.abs(x222.x-x111.x);minMaxOy=t._getMinMaxOyPoints(newPoints,t.cameraDiffZ);t.cameraDiffY=-minMaxOy.diffY;y111=t.convertAndTurnPoint(minMaxOy.tempX1,minMaxOy.tempY1,minMaxOy.tempZ1);y222=t.convertAndTurnPoint(minMaxOy.tempX2,minMaxOy.tempY2,minMaxOy.tempZ2);diffY=Math.abs(y222.y-y111.y);if(i>maxI)break}};calculateZ(100);calculateZ(10);calculateZ(1)};Processor3D.prototype.checkOutSideArea= function(newPoints){var t=this;var heightChart=this.heightCanvas-this.top-this.bottom;var widthChart=this.widthCanvas-this.left-this.right;var DELTA=3;var maxCount=1E3;var calculateZ=function(){var minMaxOx=t._getMinMaxOxPoints(newPoints,-t.cameraDiffZ);t.cameraDiffX=-minMaxOx.diffX;var x111=t.convertAndTurnPoint(minMaxOx.tempX1,minMaxOx.tempY1,minMaxOx.tempZ1);var x222=t.convertAndTurnPoint(minMaxOx.tempX2,minMaxOx.tempY2,minMaxOx.tempZ2);var diffX=Math.abs(x222.x-x111.x);var minMaxOy=t._getMinMaxOyPoints(newPoints, t.cameraDiffZ);t.cameraDiffY=-minMaxOy.diffY;var y111=t.convertAndTurnPoint(minMaxOy.tempX1,minMaxOy.tempY1,minMaxOy.tempZ1);var y222=t.convertAndTurnPoint(minMaxOy.tempX2,minMaxOy.tempY2,minMaxOy.tempZ2);var diffY=Math.abs(y222.y-y111.y);if(diffX<=widthChart&&diffY<=heightChart&&(widthChart-diffX=widthChart||diffY>=heightChart){count++;t.cameraDiffZ+=fStart/2;minMaxOx=t._getMinMaxOxPoints(newPoints,-t.cameraDiffZ);t.cameraDiffX=-minMaxOx.diffX;x111=t.convertAndTurnPoint(minMaxOx.tempX1,minMaxOx.tempY1,minMaxOx.tempZ1);x222=t.convertAndTurnPoint(minMaxOx.tempX2,minMaxOx.tempY2,minMaxOx.tempZ2);diffX=Math.abs(x222.x-x111.x);minMaxOy=t._getMinMaxOyPoints(newPoints,t.cameraDiffZ);t.cameraDiffY=-minMaxOy.diffY;y111=t.convertAndTurnPoint(minMaxOy.tempX1,minMaxOy.tempY1, minMaxOy.tempZ1);y222=t.convertAndTurnPoint(minMaxOy.tempX2,minMaxOy.tempY2,minMaxOy.tempZ2);diffY=Math.abs(y222.y-y111.y);if(count>maxCount)return}if(diffX<=widthChart&&diffY<=heightChart&&(widthChart-diffXwidthChart||diffY>heightChart||fRightDiffZ-fLeftDiffZ>DELTA){t.cameraDiffZ=fLeftDiffZ+(fRightDiffZ-fLeftDiffZ)/2;count++;minMaxOx=t._getMinMaxOxPoints(newPoints,-t.cameraDiffZ);t.cameraDiffX=-minMaxOx.diffX;var x111= t.convertAndTurnPoint(minMaxOx.tempX1,minMaxOx.tempY1,minMaxOx.tempZ1);var x222=t.convertAndTurnPoint(minMaxOx.tempX2,minMaxOx.tempY2,minMaxOx.tempZ2);var diffX=Math.abs(x222.x-x111.x);var minMaxOy=t._getMinMaxOyPoints(newPoints,t.cameraDiffZ);t.cameraDiffY=-minMaxOy.diffY;var y111=t.convertAndTurnPoint(minMaxOy.tempX1,minMaxOy.tempY1,minMaxOy.tempZ1);var y222=t.convertAndTurnPoint(minMaxOy.tempX2,minMaxOy.tempY2,minMaxOy.tempZ2);var diffY=Math.abs(y222.y-y111.y);if(diffXmaxCount)return}};calculateZ()};Processor3D.prototype._getMinMaxOxPoints=function(points,minZ){var fov=1/this.rPerspective;var t=this;var aspectRatioX=this.aspectRatioX;var aspectRatioY=this.aspectRatioY;var diffAndRotatePoint=function(point){var point3D=new Point3D(point.x,point.y,point.z,t);point3D.scale(aspectRatioX,aspectRatioY,1);point3D.offset(-t.widthCanvas/2/aspectRatioX,-t.heightCanvas/ 2/aspectRatioY,0);var matrixRotateAllAxis=t._getMatrixRotateAllAxis();point3D.multiplyPointOnMatrix1(matrixRotateAllAxis);return point3D};var calculateDiffX=function(x1,x2,z1,z2,minZ,y1,y2){var diffAndScalePoints1=t.diffAndScale(x1,y1,z1);x1=diffAndScalePoints1.x;y1=diffAndScalePoints1.y;z1=diffAndScalePoints1.z;var rotatePoints1=t.rotate(x1,y1,z1);var a1=rotatePoints1.x;var z1S=rotatePoints1.z-minZ;var diffAndScalePoints2=t.diffAndScale(x2,y2,z2);x2=diffAndScalePoints2.x;y2=diffAndScalePoints2.y; z2=diffAndScalePoints2.z;var rotatePoints2=t.rotate(x2,y2,z2);var a2=rotatePoints2.x;var z2S=rotatePoints2.z-minZ;return(-a1*z2S-a1*fov-a2*z1S-a2*fov)/(-z2S-fov-z1S-fov)};var w=t.widthCanvas;var tempArray=this._getArrayAllVergeCube(points);var x11,x22,y11,y22,z11,z22;var tempX1,tempY1,tempZ1,tempX2,tempY2,tempZ2,start,end;for(var i=0;ix22){start=i+1;end=i;x11=tempArray[start].x-t.widthCanvas/2;x22=tempArray[end].x-t.widthCanvas/2;y11=tempArray[start].y-t.heightCanvas/2;y22=tempArray[end].y-t.heightCanvas/2;z11=tempArray[start].z;z22=tempArray[end].z;tempX1=tempArray[start].x;tempY1=tempArray[start].y;tempZ1=tempArray[start].z; tempX2=tempArray[end].x;tempY2=tempArray[end].y;tempZ2=tempArray[end].z}var diffX=calculateDiffX(tempX1,tempX2,tempZ1,tempZ2,minZ,tempY1,tempY2);var projectiveMatrix=t._getPerspectiveProjectionMatrix(1/t.rPerspective);var rotatePoint1=diffAndRotatePoint(tempArray[start]);rotatePoint1.offset(-diffX,0,-minZ);rotatePoint1=rotatePoint1.project(projectiveMatrix);var x1=Math.floor(rotatePoint1.x+t.widthCanvas/2);var rotatePoint2=diffAndRotatePoint(tempArray[end]);rotatePoint2.offset(-diffX,0,-minZ);rotatePoint2= rotatePoint2.project(projectiveMatrix);var x2=Math.floor(rotatePoint2.x+t.widthCanvas/2);var leftMargin=x1;var rightMargin=Math.floor(w-x2);if(!(leftMargin>=rightMargin-1&&leftMargin<=rightMargin+1))continue;var isTrue=true;for(var l=0;lx2){isTrue=false;break}}else if(tempX11> x1||tempX11tempY2){start=i+1;end=i;tempX1=tempArray[start].x;tempY1=tempArray[start].y;tempZ1=tempArray[start].z;tempX2=tempArray[end].x;tempY2=tempArray[end].y;tempZ2=tempArray[end].z}var diffY=calculateDiffY(tempX1,tempX2,tempY1,tempY2,tempZ1,tempZ2,minZ);var rotatePoint1=this.calculatePointManual(tempX1,tempY1,tempZ1, this.cameraDiffX,-diffY,minZ);var y1=rotatePoint1.y;var rotatePoint2=this.calculatePointManual(tempX2,tempY2,tempZ2,this.cameraDiffX,-diffY,minZ);var y2=rotatePoint2.y;var topMargin=y1;var bottomMargin=Math.floor(h-y2);if(!(topMargin>=bottomMargin-1&&topMargin<=bottomMargin+1))continue;var isTrue=true;for(var l=0;ly2){isTrue=false;break}}else if(tempY11>y1||tempY11tempY2){start=i+1;end=i;tempX1=tempArray[start].x;tempY1=tempArray[start].y;tempZ1=tempArray[start].z;tempX2=tempArray[end].x;tempY2=tempArray[end].y;tempZ2=tempArray[end].z}var correctOffset=this._correctZPositionOY(tempX1,tempX2,tempZ1,tempZ2,minZ,tempY1,tempY2);var diffZ=correctOffset.minZ;var diffY=correctOffset.diffY;var rotatePoint1= this.calculatePointManual(tempX1,tempY1,tempZ1,this.cameraDiffX,diffY,diffZ);var y1=rotatePoint1.y;var rotatePoint2=this.calculatePointManual(tempX2,tempY2,tempZ2,this.cameraDiffX,diffY,diffZ);var y2=rotatePoint2.y;var topMargin=y1;var bottomMargin=Math.floor(h-y2);if(!(topMargin>=bottomMargin-1&&topMargin<=bottomMargin+1))continue;var isTrue=true;for(var l=0;ly2){isTrue=false;break}}else if(tempY11>y1||tempY11xRight){xRight=x1;mostRightPointX=new Point3D(points[faces[i][k]].x,points[faces[i][k]].y,points[faces[i][k]].z, this.cChartDrawer)}}}return{left:xLeft,right:xRight,mostLeftPointX:mostLeftPointX,mostRightPointX:mostRightPointX}};Processor3D.prototype._getMinMaxOy=function(points,faces){var mostTopPointY;var mostBottomPointY;var xTop=this.top+this.heightCanvas;var xBottom=0;for(var i=0;i=xBottom){xBottom=y1;mostBottomPointY=new Point3D(points[faces[i][k]].x,points[faces[i][k]].y,points[faces[i][k]].z,this.cChartDrawer)}if(y2>=xBottom){xBottom=y2;mostBottomPointY= new Point3D(points[faces[i][k+1]].x,points[faces[i][k+1]].y,points[faces[i][k+1]].z,this.cChartDrawer)}}return{top:xTop,bottom:xBottom,mostTopPointY:mostTopPointY,mostBottomPointY:mostBottomPointY}};Processor3D.prototype._calcAspectRatio=function(){var widthOriginalChart=this.widthCanvas-(this.left+this.right);var heightOriginalChart=this.heightCanvas-(this.top+this.bottom);var hPercent=this.hPercent;var depthPercent=this._getDepthPercent();var aspectRatioX=1;var aspectRatioY=1;var subType=this.chartsDrawer.calcProp.subType; if((subType==="standard"||this.chartsDrawer.calcProp.type===AscFormat.c_oChartTypes.Line||this.chartsDrawer.calcProp.type===AscFormat.c_oChartTypes.Area&&subType=="normal"||this.chartsDrawer.calcProp.type===AscFormat.c_oChartTypes.Surface)&&!this.view3D.getRAngAx()){this._calcSpecialStandardScaleX();aspectRatioX=widthOriginalChart/(heightOriginalChart/hPercent)*this.specialStandardScaleX}else if(subType==="standard"||this.chartsDrawer.calcProp.type===AscFormat.c_oChartTypes.Line||this.chartsDrawer.calcProp.type=== AscFormat.c_oChartTypes.Surface){var seriesCount=this.chartsDrawer.calcProp.seriesCount;var ptCount=this.chartsDrawer.calcProp.ptCount;var depth=this.view3D.getRAngAx()?this._calculateDepth():this._calculateDepthPerspective();var width=depth/depthPercent*(ptCount/seriesCount);aspectRatioX=widthOriginalChart/width}else if(hPercent!==null)aspectRatioX=widthOriginalChart/(heightOriginalChart/hPercent);if(aspectRatioX<1&&this.view3D.getRAngAx()){aspectRatioY=1/aspectRatioX;aspectRatioX=1}this.aspectRatioX= aspectRatioX;this.aspectRatioY=aspectRatioY};Processor3D.prototype._getDepthPercent=function(){if(AscFormat.c_oChartTypes.Pie===this.chartsDrawer.calcProp.type)return globalBasePercent/100;return this.view3D&&this.view3D.depthPercent?this.view3D.depthPercent/100:globalBasePercent/100};function Point3D(x,y,z,chartsDrawer){this.x=x;this.y=y;this.z=z;this.t=1;if(chartsDrawer){this.chartProp=chartsDrawer.calcProp;this.cChartDrawer=chartsDrawer;this.cChartSpace=chartsDrawer.cChartSpace}}Point3D.prototype= {constructor:Point3D,rotate:function(angleOx,angleOy,angleOz){var x=this.x;var y=this.y;var z=this.z;var cosy=Math.cos(angleOy);var siny=Math.sin(angleOy);var cosx=Math.cos(angleOx);var sinx=Math.sin(angleOx);var cosz=Math.cos(angleOz);var sinz=Math.sin(angleOz);var newX=cosy*(sinz*y+cosz*x)-siny*z;var newY=sinx*(cosy*z+siny*(sinz*y+cosz*x))+cosx*(cosz*y-sinz*x);var newZ=cosx*(cosy*z+siny*(sinz*y+cosz*x))-sinx*(cosz*y-sinz*x);this.x=newX;this.y=newY;this.z=newZ;return this},project:function(matrix){var projectPoint= matrix.multiplyPoint(this);var newX=projectPoint.x/projectPoint.t;var newY=projectPoint.y/projectPoint.t;this.x=newX;this.y=newY;return this},offset:function(offsetX,offsetY,offsetZ){this.x=this.x+offsetX;this.y=this.y+offsetY;this.z=this.z+offsetZ;return this},scale:function(aspectRatioOx,aspectRatioOy,aspectRatioOz){this.x=this.x/aspectRatioOx;this.y=this.y/aspectRatioOy;this.z=this.z/aspectRatioOz;return this},multiplyPointOnMatrix1:function(matrix){var multiplyMatrix=matrix.multiplyPoint(this); this.x=multiplyMatrix.x;this.y=multiplyMatrix.y;this.z=multiplyMatrix.z}};function Matrix4D(){this.a11=1;this.a12=0;this.a13=0;this.a14=0;this.a21=0;this.a22=1;this.a23=0;this.a24=0;this.a31=0;this.a32=0;this.a33=1;this.a34=0;this.a41=0;this.a42=0;this.a43=0;this.a44=1;return this}Matrix4D.prototype.reset=function(){this.a11=1;this.a12=0;this.a13=0;this.a14=0;this.a21=0;this.a22=1;this.a23=0;this.a24=0;this.a31=0;this.a32=0;this.a33=1;this.a34=0;this.a41=0;this.a42=0;this.a43=0;this.a44=1};Matrix4D.prototype.multiply= function(m){var res=new Matrix4D;res.a11=this.a11*m.a11+this.a12*m.a21+this.a13*m.a31+this.a14*m.a41;res.a12=this.a11*m.a12+this.a12*m.a22+this.a13*m.a32+this.a14*m.a42;res.a13=this.a11*m.a13+this.a12*m.a23+this.a13*m.a33+this.a14*m.a43;res.a14=this.a11*m.a14+this.a12*m.a24+this.a13*m.a34+this.a14*m.a44;res.a21=this.a21*m.a11+this.a22*m.a21+this.a23*m.a31+this.a24*m.a41;res.a22=this.a21*m.a12+this.a22*m.a22+this.a23*m.a32+this.a24*m.a42;res.a23=this.a21*m.a13+this.a22*m.a23+this.a23*m.a33+this.a24* m.a43;res.a24=this.a21*m.a14+this.a22*m.a24+this.a23*m.a34+this.a24*m.a44;res.a31=this.a31*m.a11+this.a32*m.a21+this.a33*m.a31+this.a34*m.a41;res.a32=this.a31*m.a12+this.a32*m.a22+this.a33*m.a32+this.a34*m.a42;res.a33=this.a31*m.a13+this.a32*m.a23+this.a33*m.a33+this.a34*m.a43;res.a34=this.a31*m.a14+this.a32*m.a24+this.a33*m.a34+this.a34*m.a44;res.a41=this.a41*m.a11+this.a42*m.a21+this.a43*m.a31+this.a44*m.a41;res.a42=this.a41*m.a12+this.a42*m.a22+this.a43*m.a32+this.a44*m.a42;res.a43=this.a41*m.a13+ this.a42*m.a23+this.a43*m.a33+this.a44*m.a43;res.a44=this.a41*m.a14+this.a42*m.a24+this.a43*m.a34+this.a44*m.a44;return res};Matrix4D.prototype.multiplyPoint=function(p){var res=new Point3D;res.x=p.x*this.a11+p.y*this.a21+p.z*this.a31+this.a41;res.y=p.x*this.a12+p.y*this.a22+p.z*this.a32+this.a42;res.z=p.x*this.a13+p.y*this.a23+p.z*this.a33+this.a43;res.t=p.x*this.a14+p.y*this.a24+p.z*this.a34+this.a44;return res};function CSortFaces(cChartDrawer,centralViewPoint){this.cChartDrawer=cChartDrawer;this.chartProp= cChartDrawer.calcProp;this.centralViewPoint=null;this._initProperties(centralViewPoint)}CSortFaces.prototype={constructor:CSortFaces,_initProperties:function(centralViewPoint){if(!centralViewPoint){var top=this.chartProp.chartGutter._top;var bottom=this.chartProp.chartGutter._bottom;var left=this.chartProp.chartGutter._left;var right=this.chartProp.chartGutter._right;var widthCanvas=this.chartProp.widthCanvas;var heightCanvas=this.chartProp.heightCanvas;var heightChart=heightCanvas-top-bottom;var widthChart= widthCanvas-left-right;var centerChartY=top+heightChart/2;var centerChartX=left+widthChart/2;var diffX=centerChartX;var diffY=centerChartY;var diffZ=-1/this.cChartDrawer.processor3D.rPerspective;if(!this.cChartDrawer.processor3D.view3D.getRAngAx()&&this.chartProp.type===AscFormat.c_oChartTypes.Bar){diffX-=this.cChartDrawer.processor3D.cameraDiffX;diffY-=this.cChartDrawer.processor3D.cameraDiffY;diffZ-=this.cChartDrawer.processor3D.cameraDiffZ}if(diffZ>0&&this.chartProp.type===AscFormat.c_oChartTypes.Bar&& this.cChartDrawer.processor3D.view3D.getRAngAx()&&(this.chartProp.subType==="stackedPer"||this.chartProp.subType=="stacked"))diffZ-=500;this.centralViewPoint={x:diffX,y:diffY,z:diffZ}}else this.centralViewPoint=centralViewPoint},sortParallelepipeds:function(parallelepipeds){var intersectionsParallelepipeds=this._getIntersectionsParallelepipeds(parallelepipeds);var revIntersections=intersectionsParallelepipeds.reverseIntersections;var countIntersection=intersectionsParallelepipeds.countIntersection; var startIndexes=[];for(var i=0;imax){max=time_out[i];res=i}return res};for(var i=0;i=start&& point<=end)res=true;return res},_isEqualPoints:function(point1,point2){var res=false;if(parseInt(point1.x)===parseInt(point2.x)&&parseInt(point1.y)===parseInt(point2.y)&&parseInt(point1.y)===parseInt(point2.y))res=true;return res}};window["AscFormat"]=window["AscFormat"]||{};window["AscFormat"].Processor3D=Processor3D;window["AscFormat"].Point3D=Point3D;window["AscFormat"].CSortFaces=CSortFaces;window["AscCommon"].c_oChartFloorPosition=c_oChartFloorPosition})(window);"use strict";(function(window, undefined){var cToDeg=AscFormat.cToDeg;var ORIENTATION_MIN_MAX=AscFormat.ORIENTATION_MIN_MAX;var Point3D=AscFormat.Point3D;var c_oAscTickMark=Asc.c_oAscTickMark;var c_oAscChartDataLabelsPos=Asc.c_oAscChartDataLabelsPos;var c_oAscChartLegendShowSettings=Asc.c_oAscChartLegendShowSettings;var test_compare_paths=false;var test_compare_paths_arr;var c_oChartTypes={Bar:0,Line:1,HBar:2,Pie:3,Scatter:4,Area:5,Stock:6,DoughnutChart:7,Radar:8,BubbleChart:9,Surface:10};var c_oChartBar3dFaces={front:0,up:1,left:2, right:3,down:4,back:5};var globalGapDepth=150;var isTurnOn3DCharts=true;var standartMarginForCharts=13;function arrReverse(arr){if(!arr||!arr.length)return;var newarr=[];for(var i=0;ithis.calcProp.heightCanvas/pxToMM)y=this.calcProp.heightCanvas/pxToMM-heightAxisTitle;x=(this.calcProp.chartGutter._left+this.calcProp.trueWidth/2)/pxToMM-widthAxisTitle/2;break}case window["AscFormat"].AX_POS_T:{y=standartMarginForCharts/pxToMM;x=(this.calcProp.chartGutter._left+this.calcProp.trueWidth/2)/pxToMM-widthAxisTitle/ 2;if(legend&&legend.legendPos===c_oAscChartLegendShowSettings.top)y+=legend.extY+standartMarginForCharts/2/pxToMM;if(title!==null&&!title.overlay)y+=title.extY+standartMarginForCharts/2/pxToMM;break}case window["AscFormat"].AX_POS_L:{y=(this.calcProp.chartGutter._top+this.calcProp.trueHeight/2)/pxToMM-heightAxisTitle/2;x=standartMarginForCharts/pxToMM;if(legend&&legend.legendPos===c_oAscChartLegendShowSettings.left)x+=legend.extX;break}case window["AscFormat"].AX_POS_R:{y=(this.calcProp.chartGutter._top+ this.calcProp.trueHeight/2)/pxToMM-heightAxisTitle/2;x=(this.calcProp.widthCanvas-standartMarginForCharts)/pxToMM-widthAxisTitle;if(legend&&legend.legendPos===c_oAscChartLegendShowSettings.right)x-=legend.extX;break}}}else switch(axis.axPos){case window["AscFormat"].AX_POS_B:{y=(this.calcProp.heightCanvas-standartMarginForCharts)/pxToMM-heightAxisTitle;x=(this.calcProp.chartGutter._left+this.calcProp.trueWidth/2)/pxToMM-widthAxisTitle/2;if(legend&&legend.legendPos===c_oAscChartLegendShowSettings.bottom)y-= legend.extY+standartMarginForCharts/2/pxToMM;break}case window["AscFormat"].AX_POS_T:{y=standartMarginForCharts/pxToMM;x=(this.calcProp.chartGutter._left+this.calcProp.trueWidth/2)/pxToMM-widthAxisTitle/2;if(legend&&legend.legendPos===c_oAscChartLegendShowSettings.top)y+=legend.extY+standartMarginForCharts/2/pxToMM;if(title!==null&&!title.overlay)y+=title.extY+standartMarginForCharts/2/pxToMM;break}case window["AscFormat"].AX_POS_L:{y=(this.calcProp.chartGutter._top+this.calcProp.trueHeight/2)/pxToMM- heightAxisTitle/2;x=standartMarginForCharts/pxToMM;if(legend&&legend.legendPos===c_oAscChartLegendShowSettings.left)x+=legend.extX;break}case window["AscFormat"].AX_POS_R:{y=(this.calcProp.chartGutter._top+this.calcProp.trueHeight/2)/pxToMM-heightAxisTitle/2;x=(this.calcProp.widthCanvas-standartMarginForCharts)/pxToMM-widthAxisTitle;if(legend&&legend.legendPos===c_oAscChartLegendShowSettings.right)x-=legend.extX;break}}if(this.nDimensionCount===3){var convertResult;if(axis instanceof AscFormat.CCatAx){convertResult= this._convertAndTurnPoint((x+widthAxisTitle/2)*pxToMM,y*pxToMM,this.processor3D.calculateZPositionCatAxis());x=convertResult.x/pxToMM-widthAxisTitle/2}else if(!this.processor3D.view3D.getRAngAx()&&(this.calcProp.type===c_oChartTypes.Bar||this.calcProp.type===c_oChartTypes.Line)){var posX=axis.posX;var widthLabels=axis.labels&&axis.labels.extX?axis.labels.extX:0;var yPoints=axis.yPoints;var upYPoint=yPoints&&yPoints[0]?yPoints[0].pos:0;var downYPoint=yPoints&&yPoints[yPoints.length-1]?yPoints[yPoints.length- 1].pos:0;var tempX=posX-widthLabels;var convertResultX=this._convertAndTurnPoint(tempX*pxToMM,y*pxToMM,0);x=convertResultX.x/pxToMM-widthAxisTitle;var convertResultY1=this._convertAndTurnPoint(posX*pxToMM,upYPoint*pxToMM,0);var convertResultY2=this._convertAndTurnPoint(posX*pxToMM,downYPoint*pxToMM,0);var heightPerspectiveChart=convertResultY1.y-convertResultY2.y;y=(convertResultY2.y+heightPerspectiveChart/2)/pxToMM-heightAxisTitle/2}else{convertResult=this._convertAndTurnPoint(x*pxToMM,y*pxToMM, 0);y=convertResult.y/pxToMM}}}return{x:x,y:y}},_calculatePositionLegend:function(legend){var widthLegend=legend.extX;var heightLegend=legend.extY;var x,y;var nLegendPos=legend.legendPos!==null?legend.legendPos:c_oAscChartLegendShowSettings.right;switch(nLegendPos){case c_oAscChartLegendShowSettings.left:case c_oAscChartLegendShowSettings.leftOverlay:{x=standartMarginForCharts/2/this.calcProp.pxToMM;y=this.calcProp.heightCanvas/2/this.calcProp.pxToMM-heightLegend/2;break}case c_oAscChartLegendShowSettings.top:{x= this.calcProp.widthCanvas/2/this.calcProp.pxToMM-widthLegend/2;y=standartMarginForCharts/2/this.calcProp.pxToMM;if(legend.parent.title!==null&&!legend.parent.title.overlay)y+=legend.parent.title.extY+standartMarginForCharts/2/this.calcProp.pxToMM;break}case c_oAscChartLegendShowSettings.right:case c_oAscChartLegendShowSettings.rightOverlay:{x=(this.calcProp.widthCanvas-standartMarginForCharts/2)/this.calcProp.pxToMM-widthLegend;y=this.calcProp.heightCanvas/2/this.calcProp.pxToMM-heightLegend/2;break}case c_oAscChartLegendShowSettings.bottom:{x= this.calcProp.widthCanvas/2/this.calcProp.pxToMM-widthLegend/2;y=(this.calcProp.heightCanvas-standartMarginForCharts/2)/this.calcProp.pxToMM-heightLegend;break}case c_oAscChartLegendShowSettings.topRight:{x=(this.calcProp.widthCanvas-standartMarginForCharts/2)/this.calcProp.pxToMM-widthLegend;y=standartMarginForCharts/2/this.calcProp.pxToMM;if(legend.parent.title!==null&&!legend.parent.title.overlay)y+=legend.parent.title.extY+standartMarginForCharts/2/this.calcProp.pxToMM;break}default:{x=(this.calcProp.widthCanvas- standartMarginForCharts/2)/this.calcProp.pxToMM-widthLegend;y=this.calcProp.heightCanvas/this.calcProp.pxToMM-heightLegend/2;break}}return{x:x,y:y}},_calculateMarginsChart:function(chartSpace,dNotPutResult){this.calcProp.chartGutter={};if(this._isSwitchCurrent3DChart(chartSpace))standartMarginForCharts=16;if(!this.calcProp.pxToMM)this.calcProp.pxToMM=1/AscCommon.g_dKoef_pix_to_mm;var pxToMM=this.calcProp.pxToMM;var plotArea=chartSpace.chart.plotArea;var marginOnPoints=this._calculateMarginOnPoints(chartSpace); var calculateLeft=marginOnPoints.calculateLeft,calculateRight=marginOnPoints.calculateRight,calculateTop=marginOnPoints.calculateTop,calculateBottom=marginOnPoints.calculateBottom;var labelsMargin=this._calculateMarginLabels(chartSpace);var left=labelsMargin.left,right=labelsMargin.right,top=labelsMargin.top,bottom=labelsMargin.bottom;var leftTextLabels=0;var rightTextLabels=0;var topTextLabels=0;var bottomTextLabels=0;var axId=chartSpace.chart.plotArea.axId;if(axId)for(var i=0;iheight?height:width;left+=(width-pieSize)/2;right+=(width-pieSize)/2;top+=(height-pieSize)/2;bottom+=(height-pieSize)/2}if(null===pieChart||is3dChart){left+=this._getStandartMargin(left,leftKey,leftTextLabels,0)+leftKey+leftTextLabels;bottom+=this._getStandartMargin(bottom, bottomKey,bottomTextLabels,0)+bottomKey+bottomTextLabels;top+=this._getStandartMargin(top,topKey,topTextLabels,topMainTitle)+topKey+topTextLabels+topMainTitle;right+=this._getStandartMargin(right,rightKey,rightTextLabels,0)+rightKey+rightTextLabels}var pxLeft=calculateLeft?calculateLeft*pxToMM:left*pxToMM;var pxRight=calculateRight?calculateRight*pxToMM:right*pxToMM;var pxTop=calculateTop?calculateTop*pxToMM:top*pxToMM;var pxBottom=calculateBottom?calculateBottom*pxToMM:bottom*pxToMM;if(topMainTitle&& topMainTitle*pxToMM>pxTop)pxTop=(this._getStandartMargin(top,topKey,topTextLabels,topMainTitle)/2+topMainTitle)*pxToMM;if(pieChart&&plotArea.charts.length===1)if(plotArea.layout){var oLayout=plotArea.layout;pxLeft=chartSpace.calculatePosByLayout(pxLeft/pxToMM,oLayout.xMode,oLayout.x,(pxRight-pxLeft)/pxToMM,chartSpace.extX)*pxToMM;pxTop=chartSpace.calculatePosByLayout(pxTop/pxToMM,oLayout.yMode,oLayout.y,(pxBottom-pxTop)/pxToMM,chartSpace.extY)*pxToMM;var fWidthPlotArea=chartSpace.calculateSizeByLayout(pxLeft/ pxToMM,chartSpace.extX,oLayout.w,oLayout.wMode);if(fWidthPlotArea>0)pxRight=chartSpace.extX*pxToMM-(pxLeft+fWidthPlotArea*pxToMM);var fHeightPlotArea=chartSpace.calculateSizeByLayout(pxTop/pxToMM,chartSpace.extY,oLayout.h,oLayout.hMode);if(fHeightPlotArea>0)pxBottom=chartSpace.extY*pxToMM-(pxTop+fHeightPlotArea*pxToMM)}if(dNotPutResult)return{left:pxLeft,right:pxRight,top:pxTop,bottom:pxBottom};else{this.calcProp.chartGutter._left=pxLeft;this.calcProp.chartGutter._right=pxRight;this.calcProp.chartGutter._top= pxTop;this.calcProp.chartGutter._bottom=pxBottom}this._checkMargins()},_checkMargins:function(){if(this.calcProp.chartGutter._left<0)this.calcProp.chartGutter._left=standartMarginForCharts;if(this.calcProp.chartGutter._right<0)this.calcProp.chartGutter._right=standartMarginForCharts;if(this.calcProp.chartGutter._top<0)this.calcProp.chartGutter._top=standartMarginForCharts;if(this.calcProp.chartGutter._bottom<0)this.calcProp.chartGutter._bottom=standartMarginForCharts;if(this.calcProp.chartGutter._left+ this.calcProp.chartGutter._right>this.calcProp.widthCanvas)this.calcProp.chartGutter._left=standartMarginForCharts;if(this.calcProp.chartGutter._right>this.calcProp.widthCanvas)this.calcProp.chartGutter._right=standartMarginForCharts;if(this.calcProp.chartGutter._top+this.calcProp.chartGutter._bottom>this.calcProp.heightCanvas)this.calcProp.chartGutter._top=0;if(this.calcProp.chartGutter._bottom>this.calcProp.heightCanvas)this.calcProp.chartGutter._bottom=0},_calculateMarginOnPoints:function(chartSpace){var calculateLeft= 0,calculateRight=0,calculateTop=0,calculateBottom=0,diffPoints,curBetween;var pxToMM=this.calcProp.pxToMM;var horizontalAxes=this._getHorizontalAxes(chartSpace);var verticalAxes=this._getVerticalAxes(chartSpace);var horizontalAxis=horizontalAxes?horizontalAxes[0]:null;var verticalAxis=verticalAxes?verticalAxes[0]:null;var crossBetween=null;if(verticalAxis instanceof AscFormat.CValAx)crossBetween=verticalAxis.crossBetween;else if(horizontalAxis instanceof AscFormat.CValAx)crossBetween=horizontalAxis.crossBetween; if(horizontalAxis&&horizontalAxis.xPoints&&horizontalAxis.xPoints.length&&this.calcProp.widthCanvas!=undefined)if(horizontalAxis instanceof AscFormat.CValAx)if(horizontalAxis.scaling.orientation==ORIENTATION_MIN_MAX){calculateLeft=horizontalAxis.xPoints[0].pos;calculateRight=this.calcProp.widthCanvas/pxToMM-horizontalAxis.xPoints[horizontalAxis.xPoints.length-1].pos}else{calculateLeft=horizontalAxis.xPoints[horizontalAxis.xPoints.length-1].pos;calculateRight=this.calcProp.widthCanvas/pxToMM-horizontalAxis.xPoints[0].pos}else if((horizontalAxis instanceof AscFormat.CCatAx||horizontalAxis instanceof AscFormat.CDateAx)&&verticalAxis&&!isNaN(verticalAxis.posX)){diffPoints=horizontalAxis.xPoints[1]?Math.abs(horizontalAxis.xPoints[1].pos-horizontalAxis.xPoints[0].pos):Math.abs(horizontalAxis.xPoints[0].pos-verticalAxis.posX)*2;curBetween=0;if(horizontalAxis.scaling.orientation===ORIENTATION_MIN_MAX){if(crossBetween===AscFormat.CROSS_BETWEEN_BETWEEN)curBetween=diffPoints/2;calculateLeft=horizontalAxis.xPoints[0].pos-curBetween;calculateRight=this.calcProp.widthCanvas/ pxToMM-(horizontalAxis.xPoints[horizontalAxis.xPoints.length-1].pos+curBetween)}else{if(crossBetween===AscFormat.CROSS_BETWEEN_BETWEEN)curBetween=diffPoints/2;calculateLeft=horizontalAxis.xPoints[horizontalAxis.xPoints.length-1].pos-curBetween;calculateRight=this.calcProp.widthCanvas/pxToMM-(horizontalAxis.xPoints[0].pos+curBetween)}}if(verticalAxis&&verticalAxis.yPoints&&verticalAxis.yPoints.length&&this.calcProp.heightCanvas!=undefined)if(verticalAxis instanceof AscFormat.CValAx)if(verticalAxis.scaling.orientation=== ORIENTATION_MIN_MAX){calculateTop=verticalAxis.yPoints[verticalAxis.yPoints.length-1].pos;calculateBottom=this.calcProp.heightCanvas/pxToMM-verticalAxis.yPoints[0].pos}else{calculateTop=verticalAxis.yPoints[0].pos;calculateBottom=this.calcProp.heightCanvas/pxToMM-verticalAxis.yPoints[verticalAxis.yPoints.length-1].pos}else if((verticalAxis instanceof AscFormat.CCatAx||verticalAxis instanceof AscFormat.CDateAx)&&horizontalAxis&&!isNaN(horizontalAxis.posY)){diffPoints=verticalAxis.yPoints[1]?Math.abs(verticalAxis.yPoints[1].pos- verticalAxis.yPoints[0].pos):Math.abs(verticalAxis.yPoints[0].pos-horizontalAxis.posY)*2;curBetween=0;if(verticalAxis.scaling.orientation===ORIENTATION_MIN_MAX){if(crossBetween===AscFormat.CROSS_BETWEEN_BETWEEN)curBetween=diffPoints/2;calculateTop=verticalAxis.yPoints[verticalAxis.yPoints.length-1].pos-curBetween;calculateBottom=this.calcProp.heightCanvas/pxToMM-(verticalAxis.yPoints[0].pos+curBetween)}else{if(crossBetween===AscFormat.CROSS_BETWEEN_BETWEEN)curBetween=diffPoints/2;calculateTop=verticalAxis.yPoints[0].pos- curBetween;calculateBottom=this.calcProp.heightCanvas/pxToMM-(verticalAxis.yPoints[verticalAxis.yPoints.length-1].pos+curBetween)}}return{calculateLeft:calculateLeft,calculateRight:calculateRight,calculateTop:calculateTop,calculateBottom:calculateBottom}},_getStandartMargin:function(labelsMargin,keyMargin,textMargin,topMainTitleMargin){var defMargin=standartMarginForCharts/this.calcProp.pxToMM;var result;if(labelsMargin==0&&keyMargin==0&&textMargin==0&&topMainTitleMargin==0)result=defMargin;else if(labelsMargin!= 0&&keyMargin==0&&textMargin==0&&topMainTitleMargin==0)result=defMargin/2;else if(labelsMargin!=0&&keyMargin==0&&textMargin!=0&&topMainTitleMargin==0)result=defMargin;else if(labelsMargin!=0&&keyMargin!=0&&textMargin!=0&&topMainTitleMargin==0)result=defMargin+defMargin/2;else if(labelsMargin==0&&keyMargin!=0&&textMargin==0&&topMainTitleMargin==0)result=defMargin;else if(labelsMargin==0&&keyMargin==0&&textMargin!=0&&topMainTitleMargin==0)result=defMargin;else if(labelsMargin==0&&keyMargin!=0&&textMargin!= 0&&topMainTitleMargin==0)result=defMargin+defMargin/2;else if(labelsMargin!=0&&keyMargin!=0&&textMargin==0&&topMainTitleMargin==0)result=defMargin;else if(labelsMargin==0&&keyMargin!=0&&textMargin!=0&&topMainTitleMargin==0)result=defMargin+defMargin/2;else if(labelsMargin==0&&keyMargin==0&&topMainTitleMargin!=0)result=defMargin+defMargin/2;else if(labelsMargin==0&&keyMargin!=0&&topMainTitleMargin!=0)result=2*defMargin;else if(labelsMargin!=0&&keyMargin==0&&topMainTitleMargin!=0)result=defMargin;else if(labelsMargin!= 0&&keyMargin!=0&&topMainTitleMargin!=0)result=2*defMargin;return result},_calculateMarginLabels:function(chartSpace){var left=0,right=0,bottom=0,top=0;var leftDownPointX,leftDownPointY,rightUpPointX,rightUpPointY;var crossBetween=chartSpace.getValAxisCrossType();var horizontalAxes=this._getHorizontalAxes(chartSpace);var verticalAxes=this._getVerticalAxes(chartSpace);var horizontalAxis=horizontalAxes?horizontalAxes[0]:null;var verticalAxis=verticalAxes?verticalAxes[0]:null;var diffPoints;if(horizontalAxis&& horizontalAxis.xPoints&&horizontalAxis.xPoints.length){var orientationHorAxis=horizontalAxis.scaling.orientation===ORIENTATION_MIN_MAX;diffPoints=0;if((horizontalAxis instanceof AscFormat.CDateAx||horizontalAxis instanceof AscFormat.CCatAx)&&crossBetween===AscFormat.CROSS_BETWEEN_BETWEEN)diffPoints=Math.abs(horizontalAxis.interval/2);if(orientationHorAxis){leftDownPointX=horizontalAxis.xPoints[0].pos-diffPoints;rightUpPointX=horizontalAxis.xPoints[horizontalAxis.xPoints.length-1].pos+diffPoints}else{leftDownPointX= horizontalAxis.xPoints[horizontalAxis.xPoints.length-1].pos-diffPoints;rightUpPointX=horizontalAxis.xPoints[0].pos+diffPoints}if(verticalAxis.labels&&!verticalAxis.bDelete)if(leftDownPointX>=verticalAxis.labels.x)left=leftDownPointX-verticalAxis.labels.x;else if(verticalAxis.labels.x+verticalAxis.labels.extX>=rightUpPointX)right=verticalAxis.labels.x+verticalAxis.labels.extX-rightUpPointX}if(verticalAxis&&verticalAxis.yPoints&&verticalAxis.yPoints.length){var orientationVerAxis=verticalAxis.scaling.orientation=== ORIENTATION_MIN_MAX;diffPoints=0;if((verticalAxis instanceof AscFormat.CDateAx||verticalAxis instanceof AscFormat.CCatAx)&&crossBetween===AscFormat.CROSS_BETWEEN_BETWEEN)diffPoints=Math.abs(verticalAxis.interval/2);if(orientationVerAxis){leftDownPointY=verticalAxis.yPoints[0].pos+diffPoints;rightUpPointY=verticalAxis.yPoints[verticalAxis.yPoints.length-1].pos-diffPoints}else{leftDownPointY=verticalAxis.yPoints[verticalAxis.yPoints.length-1].pos+diffPoints;rightUpPointY=verticalAxis.yPoints[0].pos- diffPoints}if(horizontalAxis.labels&&!horizontalAxis.bDelete)if(horizontalAxis.labels.y+horizontalAxis.labels.extY>=leftDownPointY)bottom=horizontalAxis.labels.y+horizontalAxis.labels.extY-leftDownPointY;else if(horizontalAxis.labels.y<=rightUpPointY)top=rightUpPointY-horizontalAxis.labels.y}return{left:left,right:right,top:top,bottom:bottom}},_getHorizontalAxes:function(chartSpace){var res=null;var axId=chartSpace.chart.plotArea.axId;for(var i=0;imax)max=minMaxData.max}else{if(i==0||minMaxData.yminmax)max=minMaxData.ymax}else{if(i==0||minMaxData.min< min)min=minMaxData.min;if(i==0||minMaxData.max>max)max=minMaxData.max}}return{min:min,max:max}};for(var j=0;jmax)max=tempValX;if(tempValYmaxY)maxY=tempValY};var generateArrValues=function(){var seria,numCache,pts;if(AscDFH.historyitem_type_ValAx===axis.getObjectType()){var isEn=false,numSeries=0;for(var l=0;lmax)max=value;if(!isNaN(value)&&value0){seria=series[0];numCache=t.getNumCache(seria.val);min=1;if(numCache)max=numCache.ptCount;else max=1}};var generateArrValuesScatter=function(){newArr=[];for(var l=0;l0){manualMax=2*axisMin;axisMax=manualMax}else axisMin=2*axisMax;firstDegree=this._getFirstDegree(Math.abs(axisMax-axisMin)/10);var bIsManualStep=false;if(axis&&axis.majorUnit!=null){step=axis.majorUnit;bIsManualStep=true}else{if(axis.axPos===window["AscFormat"].AX_POS_B||axis.axPos===window["AscFormat"].AX_POS_T)step=this._getStep(firstDegree.val+firstDegree.val/ 10*3);else step=this._getStep(firstDegree.val);step=step*firstDegree.numPow}if(isNaN(step)||step===0)arrayValues=[0,.2,.4,.6,.8,1,1.2];else arrayValues=this._getArrayDataValues(step,axisMin,axisMax,manualMin,manualMax);if(!bIsManualStep&&!chartSpace.isSparkline){var props={arrayValues:arrayValues,step:step,axisMin:axisMin,axisMax:axisMax,manualMin:manualMin,manualMax:manualMax};arrayValues=this._correctDataValuesFromHeight(props,chartSpace)}if(this._isSwitchCurrent3DChart(chartSpace))if(yMax>0&&yMin< 0){if(manualMax==null&&yMax<=arrayValues[arrayValues.length-2])arrayValues.splice(arrayValues.length-1,1);if(manualMin==null&&yMin>=arrayValues[1])arrayValues.splice(0,1)}else if(yMax>0&&yMin>=0){if(manualMax==null&&yMax<=arrayValues[arrayValues.length-2])arrayValues.splice(arrayValues.length-1,1)}else if(yMin<0&&yMax<=0)if(manualMin==null&&yMin>=arrayValues[1])arrayValues.splice(0,1);return arrayValues},_correctDataValuesFromHeight:function(props,chartSpace,isOxAxis){var res=props.arrayValues;var heightCanvas= chartSpace.extY*this.calcProp.pxToMM;var margins=this._calculateMarginsChart(chartSpace,true);var trueHeight=heightCanvas-margins.top-margins.bottom;var axisMin=props.axisMin;var axisMax=props.axisMax;var manualMin=props.manualMin;var manualMax=props.manualMax;var newStep=props.step;if(isOxAxis);else if(axisMin<0&&axisMax>0);else{var limitArr=[0,0,32,26,24,22,21,19,18,17,16];var limit=limitArr[res.length-1];var heightGrid=Math.round(trueHeight/(res.length-1));while(heightGrid<=limit){var firstDegreeStep= this._getFirstDegree(newStep);var tempStep=this._getNextStep(firstDegreeStep.val);newStep=tempStep*firstDegreeStep.numPow;res=this._getArrayDataValues(newStep,axisMin,axisMax,manualMin,manualMax);if(res.length<=2)break;limit=limitArr[res.length-1];heightGrid=Math.round(trueHeight/(res.length-1))}}return res},_getNextStep:function(step){if(step===1)step=2;else if(step===2)step=5;else if(step===5)step=10;return step},_getArrayDataValues:function(step,axisMin,axisMax,manualMin,manualMax){var arrayValues; var minUnit=0;if(manualMin!=null)minUnit=manualMin;else if(manualMin==null&&axisMin!=null&&axisMin!=0&&axisMin>0&&axisMax>0)minUnit=parseInt(axisMin/step)*step;else if(axisMin<0)while(minUnit>axisMin)minUnit-=step;else if(axisMin>0)while(minUnitaxisMin-step)minUnit+=step;arrayValues=this._getArrayAxisValues(minUnit,axisMin,axisMax,step,manualMin,manualMax);return arrayValues},_getLogArray:function(yMin,yMax,logBase,axis){var result=[];var temp;var pow=0;var tempPow=yMin;var kF=1E9; var manualMin=axis.scaling&&axis.scaling.min!==null?Math.round(axis.scaling.min*kF)/kF:null;var manualMax=axis.scaling&&axis.scaling.max!==null?Math.round(axis.scaling.max*kF)/kF:null;if(manualMin!==null)yMin=manualMin;if(yMin<1&&yMin>0){temp=this._getFirstDegree(yMin).numPow;tempPow=temp;while(tempPow<1){pow--;tempPow=tempPow*10}}else temp=Math.pow(logBase,0);if(logBase<1)logBase=2;var step=0;var lMax=1;if(yMin<1&&yMin>0){if(lMaxlMax)lMax=manualMax; while(temptemp){pow++;continue}if(manualMax!==null&&manualMaxyMax)yMax=manualMax;while(temp<=yMax){temp=Math.pow(logBase,pow);if(manualMin!==null&&manualMin>temp){pow++;continue}if(manualMax!==null&&manualMaxstackedPerMax)stackedPerMax=step;var maxPointsCount=40;for(var i=0;istackedPerMax)break;arrayValues[i]=minUnit+step*i;if(axisMax==0&&axisMin<0&&arrayValues[i]==axisMax)break;else if(manualMax!=null&&arrayValues[i]>=axisMax||manualMax==null&&arrayValues[i]>axisMax){if(this.calcProp.subType==="stackedPer")arrayValues[i]=arrayValues[i]; break}else if(this.calcProp.subType==="stackedPer")arrayValues[i]=arrayValues[i]}if(!arrayValues.length)arrayValues=[.2,.4,.6,.8,1,1.2];return arrayValues},_getStep:function(step){if(step>1&&step<=2)step=2;else if(step>2&&step<=5)step=5;else if(step>5&&step<=10)step=10;else if(step>10&&step<=20)step=20;return step},_getTrueMinMax:function(yMin,yMax,isStackedType){var axisMax,axisMin,diffMaxMin;var cDiff=1/6;if(yMin>=0&&yMax>=0){diffMaxMin=(yMax-yMin)/yMax;if(cDiff>diffMaxMin){axisMin=yMin-(yMax-yMin)/ 2;axisMax=isStackedType?yMax:yMax+.05*(yMax-yMin)}else{axisMin=0;axisMax=isStackedType?yMax:yMax+.05*(yMax-0)}}else if(yMin<=0&&yMax<=0){diffMaxMin=(yMin-yMax)/yMin;axisMin=isStackedType?yMin:yMin+.05*(yMin-yMax);if(cDiff0&&yMin<0){axisMax=isStackedType?yMax:yMax+.05*(yMax-yMin);axisMin=isStackedType?yMin:yMin+.05*(yMin-yMax)}if(axisMin===axisMax)if(axisMin<0)axisMax=0;else axisMin=0;return{min:axisMin,max:axisMax}},preCalculateData:function(chartSpace){this._calculateChangeAxisMap(chartSpace); this.cChartSpace=chartSpace;this.calcProp.pxToMM=1/AscCommon.g_dKoef_pix_to_mm;this.calcProp.pathH=1E9;this.calcProp.pathW=1E9;this.calcProp.type=this._getChartType(chartSpace.chart.plotArea.chart);this.calcProp.subType=this.getChartGrouping(chartSpace.chart.plotArea.chart);this.calcProp.xaxispos=null;this.calcProp.yaxispos=null;this._calculateExtremumAllCharts(chartSpace);this.calcProp.series=chartSpace.chart.plotArea.chart.series;var countSeries=this.calculateCountSeries(chartSpace.chart.plotArea.chart); this.calcProp.seriesCount=countSeries.series;this.calcProp.ptCount=countSeries.points;this.calcProp.widthCanvas=chartSpace.extX*this.calcProp.pxToMM;this.calcProp.heightCanvas=chartSpace.extY*this.calcProp.pxToMM},_getChartType:function(chart){var res;var typeChart=chart.getObjectType();switch(typeChart){case AscDFH.historyitem_type_LineChart:{res=c_oChartTypes.Line;break}case AscDFH.historyitem_type_BarChart:{if(chart.barDir!==AscFormat.BAR_DIR_BAR)res=c_oChartTypes.Bar;else res=c_oChartTypes.HBar; break}case AscDFH.historyitem_type_PieChart:{res=c_oChartTypes.Pie;break}case AscDFH.historyitem_type_AreaChart:{res=c_oChartTypes.Area;break}case AscDFH.historyitem_type_ScatterChart:{res=c_oChartTypes.Scatter;break}case AscDFH.historyitem_type_StockChart:{res=c_oChartTypes.Stock;break}case AscDFH.historyitem_type_DoughnutChart:{res=c_oChartTypes.DoughnutChart;break}case AscDFH.historyitem_type_RadarChart:{res=c_oChartTypes.Radar;break}case AscDFH.historyitem_type_BubbleChart:{res=c_oChartTypes.BubbleChart; break}case AscDFH.historyitem_type_SurfaceChart:{res=c_oChartTypes.Surface;break}}return res},getChartGrouping:function(chart){var res=null;var grouping=chart.grouping;var typeChart=chart.getObjectType();if(typeChart===AscDFH.historyitem_type_LineChart||typeChart===AscDFH.historyitem_type_AreaChart)res=grouping===AscFormat.GROUPING_PERCENT_STACKED?"stackedPer":grouping===AscFormat.GROUPING_STACKED?"stacked":"normal";else if(this.nDimensionCount===3&&grouping===AscFormat.BAR_GROUPING_STANDARD)res= "standard";else res=grouping===AscFormat.BAR_GROUPING_PERCENT_STACKED?"stackedPer":grouping===AscFormat.BAR_GROUPING_STACKED?"stacked":"normal";return res},calculateSizePlotArea:function(chartSpace,bNotRecalculate){if(!bNotRecalculate||undefined===this.calcProp.chartGutter)this._calculateMarginsChart(chartSpace);var widthCanvas=chartSpace.extX;var heightCanvas=chartSpace.extY;var w=widthCanvas-(this.calcProp.chartGutter._left+this.calcProp.chartGutter._right)/this.calcProp.pxToMM;var h=heightCanvas- (this.calcProp.chartGutter._top+this.calcProp.chartGutter._bottom)/this.calcProp.pxToMM;return{w:w,h:h,startX:this.calcProp.chartGutter._left/this.calcProp.pxToMM,startY:this.calcProp.chartGutter._top/this.calcProp.pxToMM}},drawPaths:function(paths,series,useNextPoint,bIsYVal,byIdx){var seria,brush,pen,numCache,point;var seriesPaths=paths.series;var pointDiff=useNextPoint?1:0;if(!seriesPaths)return;var getSerByIdx=function(_idx){for(var k=0;kyPoints[yPoints.length-1].pos||result yPoints[yPoints.length-1].val){var test=yPoints[1]?yPoints[1]:yPoints[0];resPos=Math.abs(test.pos-yPoints[0].pos);resVal=test.val-yPoints[0].val;diffVal=Math.abs(yPoints[yPoints.length-1].val-val);if(axis.scaling.orientation===ORIENTATION_MIN_MAX)if(isOx)result=yPoints[yPoints.length-1].pos+diffVal/resVal*resPos;else result=yPoints[yPoints.length-1].pos-diffVal/resVal*resPos;else if(isOx)result=yPoints[yPoints.length-1].pos-diffVal/resVal*resPos;else result=yPoints[yPoints.length-1].pos+diffVal/resVal* resPos;if(!ignoreAxisLimits&&(result>yPoints[yPoints.length-1].pos||result=yPoints[k].val&&yPoints[k+1]&&val<=yPoints[k+1].val){result=getResult(k);break}else if(val=minVal){if(yPoints[i+1]){startPos=yPoints[i+1].pos;diffPos=yPoints[i].pos-yPoints[i+1].pos}else{startPos=yPoints[i].pos;diffPos=yPoints[i-1].pos-yPoints[i].pos}break}result=startPos+parseFloat("0."+parseVal[1])*diffPos}else{parseVal= logVal.toString().split(".");minVal=Math.pow(logBase,parseVal[0]);maxVal=Math.pow(logBase,parseFloat(parseVal[0])+1);for(var i=0;i=minVal){if(yPoints[i+1]){startPos=yPoints[i].pos;diffPos=yPoints[i].pos-yPoints[i+1].pos}else{startPos=yPoints[i].pos;diffPos=yPoints[i-1].pos-yPoints[i].pos}break}result=startPos-parseFloat("0."+parseVal[1])*diffPos}return result},getLogarithmicValue:function(val,logBase){if(val<0)return 0;var logVal=Math.log(val)/ Math.log(logBase);var temp=0;if(logVal>0)for(var l=0;llogVal){temp+=(logVal-l)*Math.pow(logBase,l+1);break}}else{var parseTemp=logVal.toString().split(".");temp=Math.pow(logBase,parseFloat(parseTemp[0]));temp=temp-temp*parseFloat("0."+parseTemp[1])}return temp},_calaculate3DProperties:function(chartSpace){var widthCanvas=this.calcProp.widthCanvas;var heightCanvas=this.calcProp.heightCanvas;var left=this.calcProp.chartGutter._left;var right=this.calcProp.chartGutter._right; var bottom=this.calcProp.chartGutter._bottom;var top=this.calcProp.chartGutter._top;standartMarginForCharts=17;this.processor3D=new AscFormat.Processor3D(widthCanvas,heightCanvas,left,right,bottom,top,chartSpace,this);this.processor3D.calaculate3DProperties();this.processor3D.correctPointsPosition(chartSpace)},_convertAndTurnPoint:function(x,y,z,isNScale,isNRotate,isNProject){return this.processor3D.convertAndTurnPoint(x,y,z,isNScale,isNRotate,isNProject)},calculatePositionLabelsCatAxFromAngle:function(chartSpace){var res= null;var oView3D=chartSpace.chart.getView3d();var angleOy=oView3D&&oView3D.rotY?-oView3D.rotY/360*(Math.PI*2):0;if(oView3D&&!oView3D.getRAngAx()&&angleOy!==0){angleOy=Math.abs(angleOy);res=angleOy>=Math.PI/2&&angleOy<3*Math.PI/2}return res},_getSumArray:function(arr,isAbs){if(typeof arr==="number")return arr;else if(typeof arr==="string")return parseFloat(arr);var i,sum;for(i=0,sum=0;imax)max=array[i][j];if(array[i][j]=0){if(originalData[num][i]>=0)summ+=originalData[num][i]}else if(originalData[num][i]< 0)summ+=originalData[num][i];return summ},_getFirstDegree:function(val){var secPart=val.toString().split(".");var numPow=1,tempMax,expNum;if(secPart[1]&&secPart[1].toString().indexOf("e+")!=-1&&secPart[0]&&secPart[0].toString().length==1){expNum=secPart[1].toString().split("e+");numPow=Math.pow(10,expNum[1])}else if(secPart[1]&&secPart[1].toString().indexOf("e-")!=-1&&secPart[0]&&secPart[0].toString().length==1){expNum=secPart[1].toString().split("e");numPow=Math.pow(10,expNum[1])}else if(0!=secPart[0])numPow= Math.pow(10,secPart[0].toString().length-1);else if(0==secPart[0]&&secPart[1]!=undefined){tempMax=val;var num=0;while(1>tempMax){tempMax=tempMax*10;num--}numPow=Math.pow(10,num);val=tempMax}if(tempMax==undefined)val=val/numPow;return{val:val,numPow:numPow}},getIdxPoint:function(seria,index,bXVal){var res=null;var ser;if(bXVal)ser=seria.val?seria.val:seria.xVal;else ser=seria.val?seria.val:seria.yVal;if(!ser)return null;var numCache=this.getNumCache(ser);var pts=numCache?numCache.pts:null;if(pts== null)return null;if(pts[index]&&pts[index].idx===index)return pts[index];for(var i=0;i=d12/2&&d13/6>=d12/2){bz[1]=this.XYZAdd(pts[1],this.XYZMult(this.XYZSub(pts[2],pts[0]),d12/2/d02));bz[2]= this.XYZAdd(pts[2],this.XYZMult(this.XYZSub(pts[1],pts[3]),d12/2/d13))}else if(d02/6>=d12/2){bz[1]=this.XYZAdd(pts[1],this.XYZMult(this.XYZSub(pts[2],pts[0]),d12/2/d02));bz[2]=this.XYZAdd(pts[2],this.XYZMult(this.XYZSub(pts[1],pts[3]),d12/2/d13*(d13/d02)))}else{bz[1]=this.XYZAdd(pts[1],this.XYZMult(this.XYZSub(pts[2],pts[0]),d12/2/d02*(d02/d13)));bz[2]=this.XYZAdd(pts[2],this.XYZMult(this.XYZSub(pts[1],pts[3]),d12/2/d13))}bz[3]=pts[2];return bz},calculate_Bezier:function(x,y,x1,y1,x2,y2,x3,y3,t){var pts= [],bz=[];pts[0]={x:x,y:y};pts[1]={x:x1,y:y1};pts[2]={x:x2,y:y2};pts[3]={x:x3,y:y3};var d01=this.XYZDist(pts[0],pts[1]);var d12=this.XYZDist(pts[1],pts[2]);var d23=this.XYZDist(pts[2],pts[3]);var d02=this.XYZDist(pts[0],pts[2]);var d13=this.XYZDist(pts[1],pts[3]);bz[0]=pts[1];if(d02/6=d12/2&&d13/6>=d12/2){bz[1]=this.XYZAdd(pts[1],this.XYZMult(this.XYZSub(pts[2],pts[0]),d12/2/d02));bz[2]=this.XYZAdd(pts[2],this.XYZMult(this.XYZSub(pts[1],pts[3]),d12/2/d13))}else if(d02/6>=d12/2){bz[1]=this.XYZAdd(pts[1],this.XYZMult(this.XYZSub(pts[2],pts[0]),d12/2/d02));bz[2]=this.XYZAdd(pts[2],this.XYZMult(this.XYZSub(pts[1],pts[3]),d12/2/d13*(d13/d02)))}else{bz[1]=this.XYZAdd(pts[1],this.XYZMult(this.XYZSub(pts[2],pts[0]),d12/2/d02*(d02/d13)));bz[2]=this.XYZAdd(pts[2],this.XYZMult(this.XYZSub(pts[1], pts[3]),d12/2/d13))}bz[3]=pts[2];var pt=this._bezier4(bz[0],bz[1],bz[2],bz[3],t);return[pt.x,pt.y]},_bezier4:function(p1,p2,p3,p4,t){var mum1,mum13,t3,mum12,t2;var p={};mum1=1-t;mum13=mum1*mum1*mum1;mum12=mum1*mum1;t2=t*t;t3=t*t*t;p.x=mum13*p1.x+3*t*mum12*p2.x+3*t2*mum1*p3.x+t3*p4.x;p.y=mum13*p1.y+3*t*mum12*p2.y+3*t2*mum1*p3.y+t3*p4.y;return p},XYZAdd:function(a,b){return{x:a.x+b.x,y:a.y+b.y}},XYZSub:function(a,b){return{x:a.x-b.x,y:a.y-b.y}},XYZMult:function(a,b){return{x:a.x*b,y:a.y*b}},XYZDist:function(a, b){return Math.pow(Math.pow(a.x-b.x,2)+Math.pow(a.y-b.y,2),.5)},calculateCountSeries:function(chart){var series=chart.series;var typeChart=chart.getObjectType();var counter=0,numCache,seriaVal,ptCount;for(var i=0;i=projPoint1.x&&convertResult.x<=projPoint2.x||convertResult.x<=projPoint1.x&&convertResult.x>=projPoint2.x;var isBetweenY=convertResult.y>=projPoint1.y&&convertResult.y<=projPoint2.y||convertResult.y<=projPoint1.y&&convertResult.y>=projPoint2.y;if(isBetweenX&&isBetweenY){var vectorMultiplication=(convertResult.x-projPoint1.x)*(projPoint2.y-projPoint1.y)-(convertResult.y- projPoint1.y)*(projPoint2.x-projPoint1.x);if(Math.round(vectorMultiplication)===0)res=convertResult}return res},isPoint2DLieOnLine:function(lineEquation,point){return Math.round(point.y*1E3)/1E3===Math.round((lineEquation.k*point.x+lineEquation.b)*1E3)/1E3},isPointLieIntoPlane:function(planeEquation,point){var resEquation=planeEquation.a*point.x+planeEquation.b*point.y+planeEquation.c*point.z+planeEquation.d;return Math.round(resEquation)===0},isPointsLieIntoOnePlane2:function(point1,point2,point3, point4){var bRes=false;var plain1=this.getPlainEquation(point1,point2,point3);var plain2=this.getPlainEquation(point3,point4,point1);if(Math.round(plain1.a)===Math.round(plain2.a)&&Math.round(plain1.b)===Math.round(plain2.b)&&Math.round(plain1.c)===Math.round(plain2.c)&&Math.round(plain1.d)===Math.round(plain2.d))bRes=true;return bRes},isPointsLieIntoOnePlane:function(point1,point2,point3,point4){var bRes=false;var plain1=this.getPlainEquation(point1,point2,point3);if(this.isPointLieIntoPlane(plain1, point4))bRes=true;return bRes},isPointsLieIntoOnePlane3:function(point1,point2,point3,point4){var vector1={x:point4.x-point1.x,y:point4.y-point1.y,z:point4.z-point1.z};var vector2={x:point4.x-point2.x,y:point4.y-point2.y,z:point4.z-point2.z};var vector3={x:point4.x-point3.x,y:point4.y-point3.y,z:point4.z-point3.z};var a1=vector1.x;var b1=vector1.y;var c1=vector1.z;var a2=vector2.x;var b2=vector2.y;var c2=vector2.z;var a3=vector3.x;var b3=vector3.y;var c3=vector3.z;var res=a1*b2*c3+a3*b1*c2+a2*b3* c1-a3*b2*c1-a1*b3*c2-a2*b1*c3;return res},getAreaQuadrilateral:function(point0,point1,point2,point3){var a=Math.sqrt(Math.pow(point3.x-point0.x,2)+Math.pow(point3.y-point0.y,2));var b=Math.sqrt(Math.pow(point1.x-point0.x,2)+Math.pow(point1.y-point0.y,2));var c=Math.sqrt(Math.pow(point2.x-point1.x,2)+Math.pow(point2.y-point1.y,2));var d=Math.sqrt(Math.pow(point3.x-point2.x,2)+Math.pow(point3.y-point2.y,2));var e=Math.sqrt(Math.pow(point3.x-point1.x,2)+Math.pow(point3.y-point1.y,2));var f=Math.sqrt(Math.pow(point0.x- point2.x,2)+Math.pow(point0.y-point2.y,2));var p=(a+b+c+d)/2;var res=Math.sqrt((p-a)*(p-b)*(p-c)*(p-d)+1/4*((e*f+a*c+b*d)*(e*f-a*c-b*d)));return res},getAreaTriangle:function(point0,point1,point2){var a=Math.sqrt(Math.pow(point1.x-point0.x,2)+Math.pow(point1.y-point0.y,2));var b=Math.sqrt(Math.pow(point2.x-point1.x,2)+Math.pow(point2.y-point1.y,2));var c=Math.sqrt(Math.pow(point2.x-point0.x,2)+Math.pow(point2.y-point0.y,2));var p=(a+b+c)/2;return Math.sqrt(p*(p-a)*(p-b)*(p-c))},getMinMaxPoints:function(points){var minX, maxX,minY,maxY,minZ,maxZ;for(var n=0;nmaxX)maxX=points[n].x;if(points[n].ymaxY)maxY=points[n].y;if(points[n].zmaxZ)maxZ=points[n].z}return{minX:minX,maxX:maxX,minY:minY,maxY:maxY,minZ:minZ,maxZ:maxZ}},getPlainEquation3:function(point1,point2, point3){var a1=point1.x,b1=point1.y,c1=point1.z,a2=point2.x,b2=point2.y,c2=point2.z,a3=point3.x,b3=point3.y,c3=point3.z;var subMatrix=function(oldmat,row,col){var i;var j;var m=0;var k=0;var len=oldmat.length;var retmat=[];if(len<=row||len<=col)return 0;for(j=0;j0&&visible< 0||val<0&&visible>0;if(!(this.calcProp.subType==="stacked")&&!(this.calcProp.subType==="stackedPer")&&this.cChartSpace.chart.plotArea.valAx.scaling.orientation!==ORIENTATION_MIN_MAX)result=!result}else if(this.calcProp.type===c_oChartTypes.Line)result=visible<0;else if(this.calcProp.type===c_oChartTypes.HBar){result=val<0&&visible<0||val>0&&visible>0;if(!(this.calcProp.subType==="stacked")&&!(this.calcProp.subType==="stackedPer")&&this.cChartSpace.chart.plotArea.valAx.scaling.orientation!==ORIENTATION_MIN_MAX)result= !result}return result},calculatePolygon:function(array){if(!array)return null;var pathId=this.cChartSpace.AllocPath();var path=this.cChartSpace.GetPath(pathId);var pathH=this.calcProp.pathH;var pathW=this.calcProp.pathW;for(var i=0;ibottomMargin)break;if(!minorGridLines)minorGridLines=pathIdMinor;this._calculateGridLine(posX,posMinorY,posX+widthLine,posMinorY,pathMinor)}}return{gridLines:gridLines, minorGridLines:minorGridLines}},getVerticalGridLines:function(axis,isCatAxis){var gridLines,minorGridLines;var crossBetween=this.cChartSpace.getValAxisCrossType();if(null===crossBetween&&isCatAxis)crossBetween=axis.crossAx?axis.crossAx.crossBetween:null;var heightLine=this.calcProp.heightCanvas-(this.calcProp.chartGutter._bottom+this.calcProp.chartGutter._top);var rightMargin=this.calcProp.widthCanvas-this.calcProp.chartGutter._right;var posY=this.calcProp.chartGutter._top;var posMinorX;var points= axis.xPoints;if(!points)return;if(!axis.majorGridlines&&!axis.minorGridlines)return;var minorLinesCount=isCatAxis?2:5;var posAxis=this.calcProp.chartGutter._left/this.calcProp.pxToMM;var stepX=points[1]?Math.abs(points[1].pos-points[0].pos):Math.abs(points[0].pos-posAxis)*2;var minorStep=stepX*this.calcProp.pxToMM/minorLinesCount;var posX,crossDiff;if(crossBetween===AscFormat.CROSS_BETWEEN_BETWEEN&&isCatAxis)crossDiff=points[1]?Math.abs((points[1].pos-points[0].pos)/2):Math.abs(points[0].pos-posAxis); var pathId=this.cChartSpace.AllocPath();var path=this.cChartSpace.GetPath(pathId);var i;for(i=0;irightMargin)break;if(!minorGridLines)minorGridLines=pathIdMinor;this._calculateGridLine(posMinorX, posY,posMinorX,posY+heightLine,pathMinor)}}return{gridLines:gridLines,minorGridLines:minorGridLines}},_calculateGridLine:function(x,y,x1,y1,path){var t=this;var calculate2DLine=function(x,y,x1,y1){if(!path){var pathId=t.cChartSpace.AllocPath();path=t.cChartSpace.GetPath(pathId)}var pathH=t.calcProp.pathH;var pathW=t.calcProp.pathW;path.stroke=true;var pxToMm=t.calcProp.pxToMM;path.moveTo(x/pxToMm*pathW,y/pxToMm*pathH);path.lnTo(x1/pxToMm*pathW,y1/pxToMm*pathH);return pathId};var calculate3DLine=function(x, y,x1,y1,x2,y2,x3,y3){if(!path){var pathId=t.cChartSpace.AllocPath();path=t.cChartSpace.GetPath(pathId)}var pathH=t.calcProp.pathH;var pathW=t.calcProp.pathW;path.stroke=true;var pxToMm=t.calcProp.pxToMM;path.moveTo(x/pxToMm*pathW,y/pxToMm*pathH);path.lnTo(x1/pxToMm*pathW,y1/pxToMm*pathH);path.lnTo(x2/pxToMm*pathW,y2/pxToMm*pathH);if(x3!==undefined&&y3!==undefined){path.lnTo(x3/pxToMm*pathW,y3/pxToMm*pathH);path.lnTo(x/pxToMm*pathW,y/pxToMm*pathH)}return pathId};if(this.nDimensionCount===3){var view3DProp= this.cChartSpace.chart.getView3d();var angleOx=view3DProp&&view3DProp.rotX?-view3DProp.rotX/360*(Math.PI*2):0;var angleOy=view3DProp&&view3DProp.rotY?-view3DProp.rotY/360*(Math.PI*2):0;var perspectiveDepth=this.processor3D.depthPerspective;var angleOz=0;var rAngAx=this.processor3D.view3D.getRAngAx();var isVertLine=x===x1;var convertResult=this._convertAndTurnPoint(x,y,0);var x1n=convertResult.x;var y1n=convertResult.y;convertResult=this._convertAndTurnPoint(x,y,perspectiveDepth);var x2n=convertResult.x; var y2n=convertResult.y;convertResult=this._convertAndTurnPoint(x1,y1,perspectiveDepth);var x3n=convertResult.x;var y3n=convertResult.y;convertResult=this._convertAndTurnPoint(x1,y1,0);var x4n=convertResult.x;var y4n=convertResult.y;if(!isVertLine)if(rAngAx)path=calculate3DLine(x1n,y1n,x2n,y2n,x3n,y3n);else{var angleOyAbs=Math.abs(angleOy);if(angleOyAbs>=0&&angleOyAbs=Math.PI/2&&angleOyAbs=Math.PI&&angleOyAbs<3*Math.PI/2)path=calculate3DLine(x1n,y1n,x4n,y4n,x3n,y3n);else path=calculate3DLine(x2n,y2n,x3n,y3n,x4n,y4n)}else if(rAngAx)path=calculate3DLine(x2n,y2n,x3n,y3n,x4n,y4n);else path=calculate3DLine(x2n,y2n,x3n,y3n,x4n,y4n)}else path=calculate2DLine(x,y,x1,y1);return path},getAxisFromAxId:function(axId,type){var res=null;for(var i=0;i0)isValMoreZero=true;else if(val<0)isValLessZero++;val=parseFloat(seria[j].val);idx=seria[j].idx!=null?seria[j].idx:j;prevVal=0;if(this.subType==="stacked"||this.subType==="stackedPer")for(k=0;k0)prevVal+=tempValues[k][idx];tempValues[i][idx]=val;startYColumnPosition=this._getStartYColumnPosition(seriesHeight,i,idx, val,yPoints,prevVal);startY=startYColumnPosition.startY;height=startYColumnPosition.height;seriesHeight[i][idx]=height;if(this.catAx.scaling.orientation===ORIENTATION_MIN_MAX)if(xPoints[1]&&xPoints[1].pos&&xPoints[idx])startXPosition=xPoints[idx].pos-Math.abs((xPoints[1].pos-xPoints[0].pos)/2);else if(xPoints[idx])startXPosition=xPoints[idx].pos-Math.abs(xPoints[0].pos-this.valAx.posX);else startXPosition=xPoints[0].pos-Math.abs(xPoints[0].pos-this.valAx.posX);else if(xPoints[1]&&xPoints[1].pos&& xPoints[idx])startXPosition=xPoints[idx].pos+Math.abs((xPoints[1].pos-xPoints[0].pos)/2);else if(xPoints[idx])startXPosition=xPoints[idx].pos+Math.abs(xPoints[0].pos-this.valAx.posX);else startXPosition=xPoints[0].pos+Math.abs(xPoints[0].pos-this.valAx.posX);if(this.catAx.scaling.orientation===ORIENTATION_MIN_MAX)if(seriesCounter===0)startX=startXPosition*this.chartProp.pxToMM+hmargin+seriesCounter*individualBarWidth;else startX=startXPosition*this.chartProp.pxToMM+hmargin+(seriesCounter*individualBarWidth- seriesCounter*widthOverLap);else if(i===0)startX=startXPosition*this.chartProp.pxToMM-hmargin-seriesCounter*individualBarWidth;else startX=startXPosition*this.chartProp.pxToMM-hmargin-(seriesCounter*individualBarWidth-seriesCounter*widthOverLap);if(this.catAx.scaling.orientation!==ORIENTATION_MIN_MAX)startX=startX-individualBarWidth;if(this.valAx.scaling.orientation!==ORIENTATION_MIN_MAX&&(this.subType==="stackedPer"||this.subType==="stacked"))startY=startY+height;if(this.cChartDrawer.nDimensionCount=== 3){paths=this._calculateRect3D(startX,startY,individualBarWidth,height,val,isValMoreZero,isValLessZero,i);for(k=0;k0&&axisMin>0||axisMax<0&&axisMin<0)testHeight=Math.abs(yPoints[0].pos-yPoints[yPoints.length-1].pos)*this.chartProp.pxToMM;else{var endBlockPosition, startBlockPosition;if(val>0){endBlockPosition=this.cChartDrawer.getYPosition(axisMax,this.valAx)*this.chartProp.pxToMM;startBlockPosition=prevVal?this.cChartDrawer.getYPosition(0,this.valAx)*this.chartProp.pxToMM:nullPositionOX;testHeight=startBlockPosition-endBlockPosition}else{endBlockPosition=this.cChartDrawer.getYPosition(axisMin,this.valAx)*this.chartProp.pxToMM;startBlockPosition=prevVal?this.cChartDrawer.getYPosition(0,this.valAx)*this.chartProp.pxToMM:nullPositionOX;testHeight=startBlockPosition- endBlockPosition}}this.calculateParallalepiped(startX,startY,individualBarWidth,testHeight,val,isValMoreZero,isValLessZero,i,idx,cubeCount,this.temp2);this.calculateParallalepiped(startX,startY,individualBarWidth,height,val,isValMoreZero,isValLessZero,i,idx,cubeCount,this.temp);cubeCount++}else paths=this._calculateRect(startX,startY,individualBarWidth,height);var serIdx=this.chart.series[i].idx;if(!this.paths.series)this.paths.series=[];if(!this.paths.series[serIdx])this.paths.series[serIdx]=[]; this.paths.series[serIdx][idx]=paths}seriesCounter++}var cSortFaces;if(this.cChartDrawer.nDimensionCount===3)if(this.subType==="stacked"||this.subType==="stackedPer"){cSortFaces=new window["AscFormat"].CSortFaces(this.cChartDrawer);this.sortParallelepipeds=cSortFaces.sortParallelepipeds(this.temp)}else if("normal"===this.subType){cSortFaces=new window["AscFormat"].CSortFaces(this.cChartDrawer);this.sortParallelepipeds=cSortFaces.sortParallelepipeds(this.temp2)}else{var getMinZ=function(arr){var zIndex= 0;for(var i=0;i=0&&curVal>0)result+=parseFloat(curVal);else if(idxPoint&&val<=0&&curVal<0)result+=parseFloat(curVal)}return result},_calculateDLbl:function(chartSpace,ser,val,bLayout,serIdx){var point=this.cChartDrawer.getIdxPoint(this.chart.series[ser], val);if(!this.paths.series[serIdx][val]||!point||!point.compiledDlb)return;var path=this.paths.series[serIdx][val];if(this.cChartDrawer.nDimensionCount===3)if(AscFormat.isRealNumber(path[0]))path=path[0];else if(AscFormat.isRealNumber(path[5]))path=path[5];else if(AscFormat.isRealNumber(path[2]))path=path[2];else if(AscFormat.isRealNumber(path[3]))path=path[3];else if(AscFormat.isRealNumber(path[1]))path=path[1];if(!AscFormat.isRealNumber(path))return;var oPath=this.cChartSpace.GetPath(path);var oCommand0= oPath.getCommandByIndex(0);var oCommand1=oPath.getCommandByIndex(1);var oCommand2=oPath.getCommandByIndex(2);var x=oCommand0.X;var y=oCommand0.Y;var h=oCommand0.Y-oCommand1.Y;var w=oCommand2.X-oCommand1.X;var pxToMm=this.chartProp.pxToMM;var width=point.compiledDlb.extX;var height=point.compiledDlb.extY;var centerX,centerY;switch(point.compiledDlb.dLblPos){case c_oAscChartDataLabelsPos.bestFit:{break}case c_oAscChartDataLabelsPos.ctr:{centerX=x+w/2-width/2;centerY=y-h/2-height/2;break}case c_oAscChartDataLabelsPos.inBase:{centerX= x+w/2-width/2;centerY=y;if(point.val>0)centerY=y-height;break}case c_oAscChartDataLabelsPos.inEnd:{centerX=x+w/2-width/2;centerY=y-h;if(point.val<0)centerY=centerY-height;break}case c_oAscChartDataLabelsPos.outEnd:{centerX=x+w/2-width/2;centerY=y-h-height;if(point.val<0)centerY=centerY+height;break}}if(centerX<0)centerX=0;if(centerX+width>this.chartProp.widthCanvas/pxToMm)centerX=this.chartProp.widthCanvas/pxToMm-width;if(centerY<0)centerY=0;if(centerY+height>this.chartProp.heightCanvas/pxToMm)centerY= this.chartProp.heightCanvas/pxToMm-height;return{x:centerX,y:centerY}},_calculateRect:function(x,y,w,h){var pathId=this.cChartSpace.AllocPath();var path=this.cChartSpace.GetPath(pathId);var pathH=this.chartProp.pathH;var pathW=this.chartProp.pathW;var pxToMm=this.chartProp.pxToMM;path.moveTo(x/pxToMm*pathW,y/pxToMm*pathH);path.lnTo(x/pxToMm*pathW,(y-h)/pxToMm*pathH);path.lnTo((x+w)/pxToMm*pathW,(y-h)/pxToMm*pathH);path.lnTo((x+w)/pxToMm*pathW,y/pxToMm*pathH);path.lnTo(x/pxToMm*pathW,y/pxToMm*pathH); return pathId},_DrawBars3D2:function(){var t=this;var processor3D=this.cChartDrawer.processor3D;var verges={front:0,down:1,left:2,right:3,up:4,unfront:5};var drawVerges=function(i,j,paths,onlyLessNull,start,stop){var brush,pen,options;options=t._getOptionsForDrawing(i,j,onlyLessNull);if(options!==null){pen=options.pen;brush=options.brush;for(var k=start;k<=stop;k++)t._drawBar3D(paths[k],pen,brush,k)}};var draw=function(onlyLessNull,start,stop){for(var i=0;i0&&onlyLessNull===true||pt.val<0&&onlyLessNull===false)return null; if(pt.pen)pen=pt.pen;if(pt.brush)brush=pt.brush;return{pen:pen,brush:brush,val:pt.val}},_drawBar3D:function(path,pen,brush,k,val){if(null===pen||null!==pen&&null===pen.Fill||null!==pen&&null!==pen.Fill&&null===pen.Fill.fill)pen=AscFormat.CreatePenFromParams(brush,undefined,undefined,undefined,undefined,.1);if(k!==5&&k!==0){var props=this.cChartSpace.getParentObjects();var duplicateBrush=brush;if(null!==brush){duplicateBrush=brush.createDuplicate();var cColorMod=new AscFormat.CColorMod;if(k===1||k=== 4){if(duplicateBrush.fill&&AscDFH.historyitem_type_GradFill===duplicateBrush.fill.getObjectType()){var colors=duplicateBrush.fill.colors;var color;var valAxOrientation=this.valAx.scaling.orientation;if(val>0&&valAxOrientation===ORIENTATION_MIN_MAX||val<0&&valAxOrientation!==ORIENTATION_MIN_MAX)if(k===4&&colors&&colors[0]&&colors[0].color)color=colors[0].color;else{if(k===1&&colors[colors.length-1]&&colors[colors.length-1].color)color=colors[colors.length-1].color}else if(k===4&&colors&&colors[0]&& colors[0].color)color=colors[colors.length-1].color;else if(k===1&&colors[colors.length-1]&&colors[colors.length-1].color)color=colors[0].color;var tempColor=new AscFormat.CUniFill;tempColor.setFill(new AscFormat.CSolidFill);tempColor.fill.setColor(color);duplicateBrush=tempColor}cColorMod.val=45E3}else cColorMod.val=35E3;cColorMod.name="shade";duplicateBrush.addColorMod(cColorMod);duplicateBrush.calculate(props.theme,props.slide,props.layout,props.master,(new AscFormat.CUniColor).RGBA,this.cChartSpace.clrMapOvr); if(null===pen)pen.setFill(duplicateBrush)}this.cChartDrawer.drawPath(path,pen,duplicateBrush)}else this.cChartDrawer.drawPath(path,pen,brush)},_calculateRect3D:function(startX,startY,individualBarWidth,height,val,isValMoreZero,isValLessZero,serNum){var perspectiveDepth=this.cChartDrawer.processor3D.depthPerspective;var gapDepth=this.chart.gapDepth!=null?this.chart.gapDepth:globalGapDepth;if(this.subType==="standard")perspectiveDepth=perspectiveDepth/(gapDepth/100+1)/this.seriesCount;else perspectiveDepth= perspectiveDepth/(gapDepth/100+1);var DiffGapDepth=perspectiveDepth*(gapDepth/2)/100;if(this.subType==="standard")gapDepth=(perspectiveDepth+DiffGapDepth+DiffGapDepth)*serNum+DiffGapDepth;else gapDepth=DiffGapDepth;var x1=startX,y1=startY,z1=0+gapDepth;var x2=startX,y2=startY,z2=perspectiveDepth+gapDepth;var x3=startX+individualBarWidth,y3=startY,z3=perspectiveDepth+gapDepth;var x4=startX+individualBarWidth,y4=startY,z4=0+gapDepth;var x5=startX,y5=startY-height,z5=0+gapDepth;var x6=startX,y6=startY- height,z6=perspectiveDepth+gapDepth;var x7=startX+individualBarWidth,y7=startY-height,z7=perspectiveDepth+gapDepth;var x8=startX+individualBarWidth,y8=startY-height,z8=0+gapDepth;var point1=this.cChartDrawer._convertAndTurnPoint(x1,y1,z1);var point2=this.cChartDrawer._convertAndTurnPoint(x2,y2,z2);var point3=this.cChartDrawer._convertAndTurnPoint(x3,y3,z3);var point4=this.cChartDrawer._convertAndTurnPoint(x4,y4,z4);var point5=this.cChartDrawer._convertAndTurnPoint(x5,y5,z5);var point6=this.cChartDrawer._convertAndTurnPoint(x6, y6,z6);var point7=this.cChartDrawer._convertAndTurnPoint(x7,y7,z7);var point8=this.cChartDrawer._convertAndTurnPoint(x8,y8,z8);var isNotDrawDownVerge;var points=[point1,point2,point3,point4,point5,point6,point7,point8];var paths=this.cChartDrawer.calculateRect3D(points,val,isNotDrawDownVerge);height=this.chartProp.heightCanvas-this.chartProp.chartGutter._top-this.chartProp.chartGutter._bottom;var controlPoint1=this.cChartDrawer._convertAndTurnPoint(x1+individualBarWidth/2,y1-height/2,z1);var controlPoint2= this.cChartDrawer._convertAndTurnPoint(x1+individualBarWidth/2,y1,z1+perspectiveDepth/2);var controlPoint3=this.cChartDrawer._convertAndTurnPoint(x1,y1-height/2,z1+perspectiveDepth/2);var controlPoint4=this.cChartDrawer._convertAndTurnPoint(x4,y4-height/2,z4+perspectiveDepth/2);var controlPoint5=this.cChartDrawer._convertAndTurnPoint(x5+individualBarWidth/2,y5,z5+perspectiveDepth/2);var controlPoint6=this.cChartDrawer._convertAndTurnPoint(x2+individualBarWidth/2,y2-height/2,z2);var facePoints=[[point1, point5,point8,point4],[point1,point2,point3,point4],[point1,point2,point6,point5],[point4,point3,point7,point8],[point5,point6,point7,point8],[point2,point3,point7,point6]];var sortPaths=[controlPoint1,controlPoint2,controlPoint3,controlPoint4,controlPoint5,controlPoint6];return{paths:paths,x:point1.x,y:point1.y,zIndex:point1.z,sortPaths:sortPaths,facePoints:facePoints}}};function drawLineChart(chart,chartsDrawer){this.chartProp=chartsDrawer.calcProp;this.cChartDrawer=chartsDrawer;this.cChartSpace= chartsDrawer.cChartSpace;this.chart=chart;this.catAx=null;this.valAx=null;this.ptCount=null;this.seriesCount=null;this.subType=null;this.paths={}}drawLineChart.prototype={constructor:drawLineChart,draw:function(){if(this.cChartDrawer.nDimensionCount===3)this._drawLines3D();else this._drawLines()},recalculate:function(){this.paths={};var countSeries=this.cChartDrawer.calculateCountSeries(this.chart);this.seriesCount=countSeries.series;this.ptCount=countSeries.points;this.subType=this.cChartDrawer.getChartGrouping(this.chart); this.catAx=this.cChartDrawer.getAxisFromAxId(this.chart.axId,AscDFH.historyitem_type_CatAx);if(!this.catAx)this.catAx=this.cChartDrawer.getAxisFromAxId(this.chart.axId,AscDFH.historyitem_type_DateAx);this.valAx=this.cChartDrawer.getAxisFromAxId(this.chart.axId,AscDFH.historyitem_type_ValAx);this._calculateLines()},_calculateLines:function(){var xPoints=this.catAx.xPoints;var yPoints=this.valAx.yPoints;if(!xPoints||!yPoints)return;var points,y,x,val,seria,dataSeries,compiledMarkerSize,compiledMarkerSymbol, idx,numCache,idxPoint;for(var i=0;ithis.chartProp.widthCanvas/pxToMm)centerX=this.chartProp.widthCanvas/pxToMm-width;if(centerY<0)centerY=0;if(centerY+ height>this.chartProp.heightCanvas/pxToMm)centerY=this.chartProp.heightCanvas/pxToMm-height;return{x:centerX,y:centerY}},_drawLines:function(){var diffPen=3;var leftRect=this.chartProp.chartGutter._left/this.chartProp.pxToMM;var topRect=(this.chartProp.chartGutter._top-diffPen)/this.chartProp.pxToMM;var rightRect=this.chartProp.trueWidth/this.chartProp.pxToMM;var bottomRect=(this.chartProp.trueHeight+diffPen)/this.chartProp.pxToMM;this.cChartDrawer.cShapeDrawer.Graphics.SaveGrState();this.cChartDrawer.cShapeDrawer.Graphics.AddClipRect(leftRect, topRect,rightRect,bottomRect);this.cChartDrawer.drawPaths(this.paths,this.chart.series,true);this.cChartDrawer.cShapeDrawer.Graphics.RestoreGrState();this.cChartDrawer.drawPathsPoints(this.paths,this.chart.series)},_getYVal:function(n,i){var tempVal;var val=0;var idxPoint;var k;if(this.subType==="stacked")for(k=0;k<=i;k++){idxPoint=this.cChartDrawer.getPointByIndex(this.chart.series[k],n);tempVal=idxPoint?parseFloat(idxPoint.val):0;if(tempVal)val+=tempVal}else if(this.subType==="stackedPer"){var sumVal= 0;for(k=0;k=0;j--){if(!t.paths.series)return;for(var i=0;iMath.PI/2&&angle<3*Math.PI/2)onSeries();else reverseSeriesOnSeries()}else reverseSeriesOnSeries()},_drawLine3D:function(path,pen,brush,k){if(k!==2){var props=this.cChartSpace.getParentObjects();var duplicateBrush=brush.createDuplicate();var cColorMod=new AscFormat.CColorMod;cColorMod.name="shade";if(k===1||k===4)cColorMod.val=45E3;else cColorMod.val=35E3;this._addColorMods(cColorMod, duplicateBrush);duplicateBrush.calculate(props.theme,props.slide,props.layout,props.master,(new AscFormat.CUniColor).RGBA,this.cChartSpace.clrMapOvr);pen=AscFormat.CreatePenFromParams(duplicateBrush,undefined,undefined,undefined,undefined,.1);this.cChartDrawer.drawPath(path,pen,duplicateBrush)}else{pen=AscFormat.CreatePenFromParams(brush,undefined,undefined,undefined,undefined,.1);this.cChartDrawer.drawPath(path,pen,brush)}},_addColorMods:function(cColorMod,duplicateBrush){if(duplicateBrush)duplicateBrush.addColorMod(cColorMod)}}; function drawAreaChart(chart,chartsDrawer){this.chartProp=chartsDrawer.calcProp;this.cChartDrawer=chartsDrawer;this.cChartSpace=chartsDrawer.cChartSpace;this.chart=chart;this.catAx=null;this.valAx=null;this.ptCount=null;this.seriesCount=null;this.subType=null;this.points=null;this.paths={};this.upFaces=[];this.downFaces=[];this.sortZIndexPaths=[];this.sortZIndexPathsFront=[];this.sortZIndexPathsBack=[];this.sortZIndexPathsRight=[];this.sortZIndexPathsLeft=[];this.intersections=[];this.intersectionsFar= [];this.xPoints=null;this.yPoints=null;this.darkFaces=null;this.gapDepth=null;this.perspectiveDepth=null}drawAreaChart.prototype={constructor:drawAreaChart,draw:function(){if(this.cChartDrawer.nDimensionCount===3)this._drawBars3D();else this._drawLines()},recalculate:function(){this.paths={};this.points=null;var countSeries=this.cChartDrawer.calculateCountSeries(this.chart);this.seriesCount=countSeries.series;this.ptCount=countSeries.points;this.subType=this.cChartDrawer.getChartGrouping(this.chart); this.catAx=this.cChartDrawer.getAxisFromAxId(this.chart.axId,AscDFH.historyitem_type_CatAx);if(!this.catAx)this.catAx=this.cChartDrawer.getAxisFromAxId(this.chart.axId,AscDFH.historyitem_type_DateAx);this.valAx=this.cChartDrawer.getAxisFromAxId(this.chart.axId,AscDFH.historyitem_type_ValAx);this._calculateProps();this._calculate()},_calculateProps:function(){if(this.cChartDrawer.nDimensionCount===3){var gapDepth=this.chart.gapDepth!=null?this.chart.gapDepth:globalGapDepth;var perspectiveDepth=this.cChartDrawer.processor3D.depthPerspective; perspectiveDepth=this.subType==="normal"?perspectiveDepth/(gapDepth/100+1)/this.seriesCount:perspectiveDepth/(gapDepth/100+1);var DiffGapDepth=perspectiveDepth*(gapDepth/2)/100;this.perspectiveDepth=perspectiveDepth;if(this.subType==="normal"){this.gapDepth=[];for(var i=0;i=0;i--){point=prevPoints[i];path.lnTo(point.x*pathW,point.y*pathH);if(i===0)path.lnTo(points[0].x*pathW,points[0].y*pathH)}else{path.lnTo(points[points.length-1].x*pathW,nullPositionOX/pxToMm*pathH); path.lnTo(points[0].x*pathW,nullPositionOX/pxToMm*pathH);path.lnTo(points[0].x*pathW,points[0].y*pathH)}}else{var startSegmentPoint;for(var i=0;i=0;i--)if(i===pointsIn3D[number].length-1&&isFirstPoint)path.moveTo(pointsIn3D[number][i].x/pxToMm*pathW,pointsIn3D[number][i].y/pxToMm*pathH);else path.lnTo(pointsIn3D[number][i].x/pxToMm*pathW,pointsIn3D[number][i].y/pxToMm*pathH)};var calculateRect=function(p1,p2,p3,p4){var pathId=oThis.cChartSpace.AllocPath();var path=oThis.cChartSpace.GetPath(pathId);path.moveTo(p1.x/pxToMm*pathW,p1.y/pxToMm*pathH);path.lnTo(p2.x/pxToMm*pathW,p2.y/pxToMm* pathH);path.lnTo(p3.x/pxToMm*pathW,p3.y/pxToMm*pathH);path.lnTo(p4.x/pxToMm*pathW,p4.y/pxToMm*pathH);path.lnTo(p1.x/pxToMm*pathW,p1.y/pxToMm*pathH);return pathId};var calculateUpDownFace=function(isDown){var arrayPaths=[];for(var i=0;ipoint1Down.y&&point2Up.ypoint2Down.y){path=calculateRect(point1Down,point1DownFar,point2DownFar,point2Down);arrayPaths.push(path);path=calculateRect(point1Up,point1UpFar,point2UpFar,point2Up);arrayPaths.push(path)}else{path= calculateRect(point1Up,point1UpFar,point2UpFar,point2Up);arrayPaths.push(path)}else if(point1Up.y>point1Down.y&&point2Up.ypoint2Down.y){path=calculateRect(point1Up,point1UpFar,point2UpFar,point2Up);arrayPaths.push(path);path=calculateRect(point1Down,point1DownFar,point2DownFar, point2Down);arrayPaths.push(path)}else{path=calculateRect(point1Down,point1DownFar,point2DownFar,point2Down);arrayPaths.push(path)}}return arrayPaths};var paths=[];var upNear=0,downNear=1,upFar=2,downFar=3;var point1=pointsIn3D[downNear][0];var point2=pointsIn3D[downFar][0];var point3=pointsIn3D[downFar][pointsIn3D[downFar].length-1];var point4=pointsIn3D[downNear][pointsIn3D[downNear].length-1];var point5=pointsIn3D[upNear][0];var point6=pointsIn3D[upFar][0];var point7=pointsIn3D[upFar][pointsIn3D[upFar].length- 1];var point8=pointsIn3D[upNear][pointsIn3D[upNear].length-1];paths[0]=null;if(this.darkFaces[seriaNum]["front"]){pathId=this.cChartSpace.AllocPath();path=this.cChartSpace.GetPath(pathId);calculateFace(upNear,false,true);calculateFace(downNear,true);path.lnTo(point5.x/pxToMm*pathW,point5.y/pxToMm*pathH);paths[0]=pathId}paths[1]=null;var arrayPaths=calculateUpDownFace(true);paths[1]=arrayPaths;paths[2]=null;if(this.darkFaces[seriaNum]["left"]){arrayPaths=calculateRect(pointsIn3D[0][0],pointsIn3D[1][0], pointsIn3D[3][0],pointsIn3D[2][0]);paths[2]=arrayPaths}paths[3]=null;if(this.darkFaces[seriaNum]["right"]){arrayPaths=calculateRect(pointsIn3D[0][pointsIn3D[0].length-1],pointsIn3D[1][pointsIn3D[1].length-1],pointsIn3D[3][pointsIn3D[3].length-1],pointsIn3D[2][pointsIn3D[2].length-1]);paths[3]=arrayPaths}paths[4]=null;arrayPaths=calculateUpDownFace();paths[4]=arrayPaths;paths[5]=null;if(this.darkFaces[seriaNum]["unfront"]){pathId=this.cChartSpace.AllocPath();path=this.cChartSpace.GetPath(pathId);calculateFace(upFar, false,true);calculateFace(downFar,true);path.lnTo(pointsIn3D[upFar][0].x/pxToMm*pathW,pointsIn3D[upFar][0].y/pxToMm*pathH);paths[5]=pathId}return paths},_calculateRect3DStacked:function(arrPoints,arrPointsProject,arrNotRotatePoints,point,seria){var pxToMm=this.chartProp.pxToMM,t=this;var pathH=this.chartProp.pathH;var pathW=this.chartProp.pathW;var p1=arrNotRotatePoints[0];var p2=arrNotRotatePoints[1];var p3=arrNotRotatePoints[2];var p4=arrNotRotatePoints[3];var p5=arrNotRotatePoints[4];var p6=arrNotRotatePoints[5]; var p7=arrNotRotatePoints[6];var p8=arrNotRotatePoints[7];var point1=arrPointsProject[0];var point2=arrPointsProject[1];var point3=arrPointsProject[2];var point4=arrPointsProject[3];var point5=arrPointsProject[4];var point6=arrPointsProject[5];var point7=arrPointsProject[6];var point8=arrPointsProject[7];var point11=arrPoints[0];var point22=arrPoints[1];var point33=arrPoints[2];var point44=arrPoints[3];var point55=arrPoints[4];var point66=arrPoints[5];var point77=arrPoints[6];var point88=arrPoints[7]; var oThis=this;var generateFace=function(p11,p22,p33,p44,p111,p222,p333,p444,p1111,p2222,p3333,p4444,faceIndex,ser){if(ser===undefined)ser=seria;var pathId=oThis.cChartSpace.AllocPath();var path=oThis.cChartSpace.GetPath(pathId);path.moveTo(p11.x/pxToMm*pathW,p11.y/pxToMm*pathH);path.lnTo(p22.x/pxToMm*pathW,p22.y/pxToMm*pathH);path.lnTo(p33.x/pxToMm*pathW,p33.y/pxToMm*pathH);path.lnTo(p44.x/pxToMm*pathW,p44.y/pxToMm*pathH);path.lnTo(p11.x/pxToMm*pathW,p11.y/pxToMm*pathH);var arrPoints=[p11,p22,p33, p44];var arrPoints2=[p111,p222,p333,p444];var plainEquation=t.cChartDrawer.getPlainEquation(p111,p222,p333);var plainArea=t.cChartDrawer.getAreaQuadrilateral(p11,p22,p33,p44);var arrPointsNotRotate=[p1111,p2222,p3333,p4444];var midY=(p1111.y+p2222.y+p3333.y+p4444.y)/4;return{seria:ser,point:0,verge:faceIndex,paths:pathId,points:arrPoints2,points2:arrPoints,plainEquation:plainEquation,plainArea:plainArea,arrPointsNotRotate:arrPointsNotRotate,midY:midY}};this._calculateSimpleRect(arrPoints,arrPointsProject, point,seria);var breakFaces=this.intersections[point]&&this.intersections[point][seria]?this.intersections[point][seria]:null;if(breakFaces&&breakFaces.up&&breakFaces.up.length){breakFaces.up=breakFaces.up.sort(function sortArr(a,b){return a.x-b.x});var prevNear,prevFar,prevNearProject,prevFarProject,prevNotRotateNear,prevNotRotateFar,prevPoint;var near,far,nearProject,farProject,notRotateNear,notRotateFar,face;for(var i=0;i curPoint3.y){curPoint1=curRect.prevPoint1;curPoint2=curRect.prevPoint2;curPoint3=curRect.point1;curPoint4=curRect.point2}var addToArr=function(point,seria,isDown,elem){if(!t.intersections[point])t.intersections[point]=[];if(!t.intersections[point][seria])t.intersections[point][seria]={};if(isDown&&!t.intersections[point][seria].down)t.intersections[point][seria].down=[];if(!isDown&&!t.intersections[point][seria].up)t.intersections[point][seria].up=[];var arr=isDown?t.intersections[point][seria].down: t.intersections[point][seria].up;arr.push(elem)};var curLine1=this.cChartDrawer.getLineEquation(curPoint1,curPoint2);var curLine2=this.cChartDrawer.getLineEquation(curPoint3,curPoint4);var curTempIntersection=this.cChartDrawer.isIntersectionLineAndLine(curLine1,curLine2);var curDown=[{start:curPoint3,end:curPoint4,eq:curLine2}];var curIntersection=null;if(curTempIntersection&&curTempIntersection.x>curPoint3.x&&curTempIntersection.xcurPoint1.x&&curTempIntersection.xline1.start.x&&intersection.xline2.start.x&&intersection.xline1.start.x&&intersection.xline2.start.x&&intersection.x=0;p--)if(points[p]){prevPoints=points[p];break}return prevPoints},_calculateDLbl:function(chartSpace,ser,val){var pxToMm=this.chartProp.pxToMM;var point=this.cChartDrawer.getIdxPoint(this.chart.series[ser],val);var path;if(!point)return;path=this.points[ser][val]; if(!path)return;var x=path.x;var y=path.y;if(this.cChartDrawer.nDimensionCount===3){var gapDepth=this.gapDepth;if(this.subType==="normal")gapDepth=this.gapDepth[ser];var turnPoint=this.cChartDrawer._convertAndTurnPoint(x*pxToMm,y*pxToMm,gapDepth);x=turnPoint.x/pxToMm;y=turnPoint.y/pxToMm}var constMargin=5/pxToMm;var width=point.compiledDlb.extX;var height=point.compiledDlb.extY;var centerX=x-width/2;var centerY=y-height/2;switch(point.compiledDlb.dLblPos){case c_oAscChartDataLabelsPos.b:{centerY= centerY+height/2+constMargin;break}case c_oAscChartDataLabelsPos.bestFit:{break}case c_oAscChartDataLabelsPos.ctr:{break}case c_oAscChartDataLabelsPos.l:{centerX=centerX-width/2-constMargin;break}case c_oAscChartDataLabelsPos.r:{centerX=centerX+width/2+constMargin;break}case c_oAscChartDataLabelsPos.t:{centerY=centerY-height/2-constMargin;break}}if(centerX<0)centerX=0;if(centerX+width>this.chartProp.widthCanvas/pxToMm)centerX=this.chartProp.widthCanvas/pxToMm-width;if(centerY<0)centerY=0;if(centerY+ height>this.chartProp.heightCanvas/pxToMm)centerY=this.chartProp.heightCanvas/pxToMm-height;return{x:centerX,y:centerY}},_drawLines:function(){var brush;var pen;var seria,dataSeries,numCache;this.cChartDrawer.cShapeDrawer.Graphics.SaveGrState();this.cChartDrawer.cShapeDrawer.Graphics.AddClipRect(this.chartProp.chartGutter._left/this.chartProp.pxToMM,(this.chartProp.chartGutter._top-1)/this.chartProp.pxToMM,this.chartProp.trueWidth/this.chartProp.pxToMM,this.chartProp.trueHeight/this.chartProp.pxToMM); for(var i=0;iMath.PI/2&&angle<3*Math.PI/2)for(var j=0;j=0;j--){seria=this.chart.series[j];brush=seria.brush;pen=seria.pen;numCache= this.cChartDrawer.getNumCache(seria.val);if(numCache.pts[0]&&numCache.pts[0].pen)pen=numCache.pts[0].pen;if(numCache.pts[0]&&numCache.pts[0].brush)brush=numCache.pts[0].brush;if(!this.paths.series[j])continue;this._drawBar3D(this.paths.series[j][1],pen,brush,1);this._drawBar3D(this.paths.series[j][4],pen,brush,4);this._drawBar3D(this.paths.series[j][2],pen,brush,2);this._drawBar3D(this.paths.series[j][3],pen,brush,3);this._drawBar3D(this.paths.series[j][5],pen,brush,5);this._drawBar3D(this.paths.series[j][0], pen,brush,0)}}else{var drawVerges=function(i,j,paths,onlyLessNull,k){var brush,pen,options;options=t._getOptionsForDrawing(i,j,onlyLessNull);if(paths!==null&&options!==null){pen=options.pen;brush=options.brush;t._drawBar3D(paths,pen,brush,k)}};for(var i=0;i0&&onlyLessNull===true||pt.val<0&&onlyLessNull===false)return null;if(pt.pen)pen=pt.pen;if(pt.brush)brush=pt.brush;return{pen:pen,brush:brush}},_isVisibleVerge3D:function(k,n,m){var aX=n.x*m.y-m.x*n.y;var bY=-(k.x*m.y-m.x*k.y);var cZ=k.x*n.y-n.x*k.y;var visible= aX+bY+cZ;return visible<0},_getIntersectionLines:function(line1Point1,line1Point2,line2Point1,line2Point2){var chartHeight=this.chartProp.trueHeight;var top=this.chartProp.chartGutter._top;var x1=line1Point1.x;var x2=line1Point2.x;var y1=line1Point1.y;var y2=line1Point2.y;var x3=line2Point1.x;var x4=line2Point2.x;var y3=line2Point1.y;var y4=line2Point2.y;var x=((x1*y2-x2*y1)*(x4-x3)-(x3*y4-x4*y3)*(x2-x1))/((y1-y2)*(x4-x3)-(y3-y4)*(x2-x1));var y=((y3-y4)*x-(x3*y4-x4*y3))/(x4-x3);x=-x;var res=null; if(ytop&&x>line1Point1.x&&x0)isValMoreZero=true;else if(val<0)isValLessZero++;if(this.valAx&&this.valAx.scaling.logBase)val=this.cChartDrawer.getLogarithmicValue(val,this.valAx.scaling.logBase,xPoints);idx=seria[j].idx!=null?seria[j].idx:j;startXColumnPosition=this._getStartYColumnPosition(seriesHeight,idx,i,val,xPoints);startX= startXColumnPosition.startY/this.chartProp.pxToMM;width=startXColumnPosition.width/this.chartProp.pxToMM;seriesHeight[i][idx]=startXColumnPosition.width;if(this.catAx.scaling.orientation===ORIENTATION_MIN_MAX)if(yPoints[1]&&yPoints[1].pos&&yPoints[idx])startYPosition=yPoints[idx].pos+Math.abs((yPoints[1].pos-yPoints[0].pos)/2);else if(yPoints[idx])startYPosition=yPoints[idx].pos+Math.abs(yPoints[0].pos-this.valAx.posY);else startYPosition=yPoints[0].pos+Math.abs(yPoints[0].pos-this.valAx.posY);else if(yPoints[1]&& yPoints[1].pos&&yPoints[idx])startYPosition=yPoints[idx].pos-Math.abs((yPoints[1].pos-yPoints[0].pos)/2);else if(yPoints[idx])startYPosition=yPoints[idx].pos-Math.abs(yPoints[0].pos-this.valAx.posY);else startYPosition=yPoints[0].pos-Math.abs(yPoints[0].pos-this.valAx.posY);if(this.catAx.scaling.orientation===ORIENTATION_MIN_MAX)if(seriesCounter===0)startY=startYPosition*this.chartProp.pxToMM-hmargin-seriesCounter*individualBarHeight;else startY=startYPosition*this.chartProp.pxToMM-hmargin-(seriesCounter* individualBarHeight-seriesCounter*widthOverLap);else if(i===0)startY=startYPosition*this.chartProp.pxToMM+hmargin+seriesCounter*individualBarHeight;else startY=startYPosition*this.chartProp.pxToMM+hmargin+(seriesCounter*individualBarHeight-seriesCounter*widthOverLap);newStartY=startY;if(this.catAx.scaling.orientation!==ORIENTATION_MIN_MAX)newStartY=startY+individualBarHeight;newStartX=startX;if(this.valAx.scaling.orientation!==ORIENTATION_MIN_MAX&&(this.subType==="stackedPer"||this.subType==="stacked"))newStartX= startX-width;if(this.cChartDrawer.nDimensionCount===3){paths=this.calculateParallalepiped(newStartX,newStartY,val,width,DiffGapDepth,perspectiveDepth,individualBarHeight,seriesHeight,i,idx,cubeCount);cubeCount++}else paths=this._calculateRect(newStartX,newStartY/this.chartProp.pxToMM,width,individualBarHeight/this.chartProp.pxToMM);var serIdx=this.chart.series[i].idx;if(!this.paths.series)this.paths.series=[];if(!this.paths.series[serIdx])this.paths.series[serIdx]=[];if(height!==0)this.paths.series[serIdx][idx]= paths}seriesCounter++}if(this.cChartDrawer.nDimensionCount===3)if(this.cChartDrawer.processor3D.view3D.getRAngAx()){var angle=Math.abs(this.cChartDrawer.processor3D.angleOy);this.sortZIndexPaths.sort(function sortArr(a,b){if(b.zIndex===a.zIndex)if(angle0&&onlyLessNull===true||pt.val<0&&onlyLessNull===false)return null;if(pt.pen)pen=pt.pen;if(pt.brush)brush=pt.brush;return{pen:pen,brush:brush}},_getStartYColumnPosition:function(seriesHeight,j,i,val,xPoints){var startY,width,curVal,prevVal,endBlockPosition,startBlockPosition;var catAx=this.catAx;var axisMin=xPoints[0].valaxisMax)curVal=axisMax;if(curValaxisMax)curVal=axisMax*test;if(curVal/testaxisMax)prevVal=axisMax*test;if(prevVal/test0&&curVal>0)result+=parseFloat(curVal);else if(idxPoint&&val<0&&curVal<0)result+=parseFloat(curVal)}return result}, _drawBars:function(){this.cChartDrawer.cShapeDrawer.Graphics.SaveGrState();this.cChartDrawer.cShapeDrawer.Graphics.AddClipRect((this.chartProp.chartGutter._left-1)/this.chartProp.pxToMM,(this.chartProp.chartGutter._top-1)/this.chartProp.pxToMM,this.chartProp.trueWidth/this.chartProp.pxToMM,this.chartProp.trueHeight/this.chartProp.pxToMM);this.cChartDrawer.drawPaths(this.paths,this.chart.series,null,null,true);this.cChartDrawer.cShapeDrawer.Graphics.RestoreGrState()},_calculateDLbl:function(chartSpace, ser,val,bLayout,serIdx){var point=this.cChartDrawer.getIdxPoint(this.chart.series[ser],val);var path=this.paths.series[serIdx][val];if(!point)return;if(this.cChartDrawer.nDimensionCount===3&&path.frontPaths){var frontPaths=path.frontPaths;if(this.cChartDrawer.nDimensionCount===3)if(AscFormat.isRealNumber(frontPaths[0]))path=frontPaths[0];else if(AscFormat.isRealNumber(frontPaths[5]))path=frontPaths[5];else if(AscFormat.isRealNumber(frontPaths[2]))path=frontPaths[2];else if(AscFormat.isRealNumber(frontPaths[3]))path= frontPaths[3]}if(!AscFormat.isRealNumber(path))return;var oPath=this.cChartSpace.GetPath(path);var oCommand0=oPath.getCommandByIndex(0);var oCommand1=oPath.getCommandByIndex(1);var oCommand2=oPath.getCommandByIndex(2);var x=oCommand0.X;var y=oCommand0.Y;var h=oCommand0.Y-oCommand1.Y;var w=oCommand2.X-oCommand1.X;var pxToMm=this.chartProp.pxToMM;var width=point.compiledDlb.extX;var height=point.compiledDlb.extY;var centerX,centerY;switch(point.compiledDlb.dLblPos){case c_oAscChartDataLabelsPos.bestFit:{break}case c_oAscChartDataLabelsPos.ctr:{centerX= x+w/2-width/2;centerY=y-h/2-height/2;break}case c_oAscChartDataLabelsPos.inBase:{centerX=x;centerY=y-h/2-height/2;if(point.val<0)centerX=x-width;break}case c_oAscChartDataLabelsPos.inEnd:{centerX=x+w-width;centerY=y-h/2-height/2;if(point.val<0)centerX=x+w;break}case c_oAscChartDataLabelsPos.outEnd:{centerX=x+w;centerY=y-h/2-height/2;if(point.val<0)centerX=x+w-width;break}}if(centerX<0)centerX=0;if(centerX+width>this.chartProp.widthCanvas/pxToMm)centerX=this.chartProp.widthCanvas/pxToMm-width;if(centerY< 0)centerY=0;if(centerY+height>this.chartProp.heightCanvas/pxToMm)centerY=this.chartProp.heightCanvas/pxToMm-height;return{x:centerX,y:centerY}},_calculateRect:function(x,y,w,h){var pathId=this.cChartSpace.AllocPath();var path=this.cChartSpace.GetPath(pathId);var pathH=this.chartProp.pathH;var pathW=this.chartProp.pathW;path.moveTo(x*pathW,y*pathH);path.lnTo(x*pathW,(y-h)*pathH);path.lnTo((x+w)*pathW,(y-h)*pathH);path.lnTo((x+w)*pathW,y*pathH);path.lnTo(x*pathW,y*pathH);return pathId},calculateParallalepiped:function(newStartX, newStartY,val,width,DiffGapDepth,perspectiveDepth,individualBarHeight,seriesHeight,i,idx,cubeCount){var paths;var point1,point2,point3,point4,point5,point6,point7,point8;var x1,y1,z1,x2,y2,z2,x3,y3,z3,x4,y4,z4,x5,y5,z5,x6,y6,z6,x7,y7,z7,x8,y8,z8;var xPoints=this.valAx.xPoints;var scaleAxis=this.valAx.scale;var axisMax=scaleAxis[0]=0;--j){options=t._getOptionsForDrawing(j,i,onlyLessNull);if(options!==null){pen=options.pen;brush=options.brush}else continue;for(var k=0;k=0&&angle<45)if(faceIndex===c_oChartBar3dFaces.up||faceIndex===c_oChartBar3dFaces.down)gradientBrush=this._applyColorModeByBrush(brushFill,shadeValue1);else if(faceIndex===c_oChartBar3dFaces.left)gradientBrush=getCSolidColor(colors[0].color);else{if(faceIndex===c_oChartBar3dFaces.right)gradientBrush= getCSolidColor(colors[colors.length-1].color)}else if(angle>=45&&angle<90)if(faceIndex===c_oChartBar3dFaces.up||faceIndex===c_oChartBar3dFaces.left)gradientBrush=getCSolidColor(colors[0].color,shadeValue1);else if(faceIndex===c_oChartBar3dFaces.right)gradientBrush=this._applyColorModeByBrush(brushFill,shadeValue1);else{if(faceIndex===c_oChartBar3dFaces.down)gradientBrush=getCSolidColor(colors[colors.length-1].color)}else if(angle>=90&&angle<135)if(faceIndex===c_oChartBar3dFaces.up||faceIndex===c_oChartBar3dFaces.left)gradientBrush= getCSolidColor(colors[0].color,shadeValue1);else if(faceIndex===c_oChartBar3dFaces.right)gradientBrush=this._applyColorModeByBrush(brushFill,shadeValue1);else{if(faceIndex===c_oChartBar3dFaces.down)gradientBrush=getCSolidColor(colors[colors.length-1].color)}else if(angle>=135&&angle<180)if(faceIndex===c_oChartBar3dFaces.up||faceIndex===c_oChartBar3dFaces.left||faceIndex===c_oChartBar3dFaces.right)gradientBrush=getCSolidColor(colors[0].color,shadeValue1);else{if(faceIndex===c_oChartBar3dFaces.down)gradientBrush= this._applyColorModeByBrush(brushFill,shadeValue1)}else if(angle>=180&&angle<225)if(faceIndex===c_oChartBar3dFaces.up||faceIndex===c_oChartBar3dFaces.down)gradientBrush=this._applyColorModeByBrush(brushFill,shadeValue1);else if(faceIndex===c_oChartBar3dFaces.right)gradientBrush=getCSolidColor(colors[0].color,shadeValue1);else{if(faceIndex===c_oChartBar3dFaces.left)gradientBrush=getCSolidColor(colors[colors.length-1].color,shadeValue1)}else if(angle>=225&&angle<270)if(faceIndex===c_oChartBar3dFaces.up)gradientBrush= this._applyColorModeByBrush(brushFill,shadeValue1);else{if(faceIndex===c_oChartBar3dFaces.left||faceIndex===c_oChartBar3dFaces.down||faceIndex===c_oChartBar3dFaces.right)gradientBrush=getCSolidColor(colors[0].color,shadeValue1)}else if(angle>=270&&angle<315)if(faceIndex===c_oChartBar3dFaces.up)gradientBrush=getCSolidColor(colors[colors.length-1].color);else if(faceIndex===c_oChartBar3dFaces.left||faceIndex===c_oChartBar3dFaces.down)gradientBrush=getCSolidColor(colors[0].color,shadeValue1);else{if(faceIndex=== c_oChartBar3dFaces.right)gradientBrush=this._applyColorModeByBrush(brushFill,shadeValue1)}else if(angle>=315&&angle<=360)if(faceIndex===c_oChartBar3dFaces.up||faceIndex===c_oChartBar3dFaces.right)gradientBrush=this._applyColorModeByBrush(brushFill,shadeValue1);else if(faceIndex===c_oChartBar3dFaces.left||faceIndex===c_oChartBar3dFaces.down)gradientBrush=getCSolidColor(colors[0].color,shadeValue1)}return{pen:gradientPen,brush:gradientBrush}},_applyColorModeByBrush:function(brushFill,val){var props= this.cChartSpace.getParentObjects();var duplicateBrush=brushFill.createDuplicate();var cColorMod=new AscFormat.CColorMod;cColorMod.val=val;cColorMod.name="shade";duplicateBrush.addColorMod(cColorMod);duplicateBrush.calculate(props.theme,props.slide,props.layout,props.master,(new AscFormat.CUniColor).RGBA,this.cChartSpace.clrMapOvr);return duplicateBrush}};function drawPieChart(chart,chartsDrawer){this.chartProp=chartsDrawer.calcProp;this.cChartDrawer=chartsDrawer;this.cChartSpace=chartsDrawer.cChartSpace; this.chart=chart;this.tempAngle=null;this.paths={};this.cX=null;this.cY=null;this.angleFor3D=null;this.properties3d=null;this.usually3dPropsCalc=[];this.tempDrawOrder=null}drawPieChart.prototype={constructor:drawPieChart,draw:function(){if(this.cChartDrawer.nDimensionCount===3)this._drawPie3D();else this._drawPie()},recalculate:function(){this.tempAngle=null;this.paths={};if(this.cChartDrawer.nDimensionCount===3)if(this.cChartDrawer.processor3D.view3D.getRAngAx()){this.properties3d=this.cChartDrawer.processor3D.calculatePropertiesForPieCharts(); this._recalculatePie3D()}else this._recalculatePie3DPerspective();else this._recalculatePie()},_drawPie:function(){var numCache=this._getFirstRealNumCache(true);if(!numCache)return;var brush,pen,val,path;for(var i=numCache.ptCount-1;i>=0;i--){var point=numCache.getPtByIndex(i);brush=point?point.brush:null;pen=point?point.pen:null;path=this.paths.series[i];this.cChartDrawer.drawPath(path,pen,brush)}},_recalculatePie:function(){var trueWidth=this.chartProp.trueWidth;var trueHeight=this.chartProp.trueHeight; var numCache=this._getFirstRealNumCache(true);if(!numCache)return;var sumData=this.cChartDrawer._getSumArray(numCache.pts,true);var radius=Math.min(trueHeight,trueWidth)/2;var xCenter=this.chartProp.chartGutter._left+trueWidth/2;var yCenter=this.chartProp.chartGutter._top+trueHeight/2;var firstSliceAng=this.chart&&this.chart.firstSliceAng?this.chart.firstSliceAng:0;this.tempAngle=Math.PI/2-firstSliceAng/180*Math.PI;var angle;for(var i=numCache.ptCount-1;i>=0;i--){var point=numCache.getPtByIndex(i); var val=point?point.val:0;angle=Math.abs(parseFloat(val/sumData)*(Math.PI*2));if(angle<1E-15)angle=0;if(!this.paths.series)this.paths.series=[];if(sumData===0)this.paths.series[i]=this._calculateEmptySegment(radius,xCenter,yCenter);else this.paths.series[i]=this._calculateSegment(angle,radius,xCenter,yCenter)}},_getFirstRealNumCache:function(returnCache){var series=this.chart.series;var numCache;for(var i=0;ixCenter)cX=xCenter+(x0-xCenter)/kFX;else cX=xCenter;var cY;if(y0yCenter)cY=yCenter+(y0-yCenter)/kFY;else cY=yCenter;var x01=xCenter+radius*Math.cos(stAng+swAng);var y01=yCenter-radius*Math.sin(stAng+swAng);var aX;if(x01xCenter)aX= xCenter+(x01-xCenter)/kFX;else aX=xCenter;var aY;if(y01yCenter)aY=yCenter+(y01-yCenter)/kFY;else aY=yCenter;this.cX=aX;this.cY=aY;var a=Math.sqrt(Math.pow(cX-xCenter,2)+Math.pow(cY-yCenter,2));var b=Math.sqrt(Math.pow(aX-cX,2)+Math.pow(aY-cY,2));var c=Math.sqrt(Math.pow(aX-xCenter,2)+Math.pow(aY-yCenter,2));var cosNewAngle=(Math.pow(c,2)+Math.pow(a,2)-Math.pow(b,2))/(2*c*a);if(cosNewAngle>1)cosNewAngle=1;if(cosNewAngle<-1)cosNewAngle=-1;var res;if(Math.abs(swAng)> Math.PI)res=2*Math.PI-Math.acos(cosNewAngle);else res=Math.acos(cosNewAngle);return res},_calculateDLbl:function(chartSpace,ser,val,bLayout){var pxToMm=this.chartProp.pxToMM;if(!this.paths.series[val]){var numCache=this._getFirstRealNumCache();if(numCache)for(var i=0;icenterX&&tempCenterY< centerY){centerX=tempCenterX-width;centerY=tempCenterY}else if(tempCenterXcenterY){centerX=tempCenterX;centerY=tempCenterY-height}else{centerX=tempCenterX-width;centerY=tempCenterY-height}break}case c_oAscChartDataLabelsPos.outEnd:{tempCenterX=centerX+radius*Math.cos(-1*stAng-swAng/2);tempCenterY=centerY-radius*Math.sin(-1*stAng-swAng/2);if(tempCenterXcenterX&&tempCenterY< centerY){centerX=tempCenterX;centerY=tempCenterY-height}else if(tempCenterXcenterY){centerX=tempCenterX-width;centerY=tempCenterY}else{centerX=tempCenterX;centerY=tempCenterY}break}}if(centerX<0)centerX=0;if(centerX+width>this.chartProp.widthCanvas/pxToMm)centerX=this.chartProp.widthCanvas/pxToMm-width;if(centerY<0)centerY=0;if(centerY+height>this.chartProp.heightCanvas/pxToMm)centerY=this.chartProp.heightCanvas/pxToMm-height;return{x:centerX,y:centerY}},_recalculatePie3D:function(){var trueWidth= this.chartProp.trueWidth;var trueHeight=this.chartProp.trueHeight;var numCache=this._getFirstRealNumCache(true);if(!numCache||!numCache.pts)return;var sumData=this.cChartDrawer._getSumArray(numCache.pts,true);var radius=Math.min(trueHeight,trueWidth)/2;if(radius<0)radius=0;var xCenter=this.chartProp.chartGutter._left+trueWidth/2;var yCenter=this.chartProp.chartGutter._top+trueHeight/2;var startAngle=this.cChartDrawer.processor3D.angleOy?this.cChartDrawer.processor3D.angleOy:0;var startAngle3D=startAngle!== 0&&startAngle!==undefined?this._changeAngle(radius,Math.PI/2,startAngle,xCenter,yCenter,this.properties3d.depth,this.properties3d.radius1,this.properties3d.radius2):0;this.angleFor3D=Math.PI/2-startAngle3D;startAngle=startAngle+Math.PI/2;for(var i=numCache.ptCount-1;i>=0;i--){var point=numCache.getPtByIndex(i);var val=point?point.val:0;var partOfSum=val/sumData;var swapAngle=Math.abs(parseFloat(partOfSum)*(Math.PI*2));if(!this.paths.series)this.paths.series=[];this.paths.series[i]=this._calculateSegment3D(startAngle, swapAngle,radius,xCenter,yCenter);startAngle+=swapAngle}},_recalculatePie3DPerspective:function(){var left=this.chartProp.chartGutter._left;var right=this.chartProp.chartGutter._right;var top=this.chartProp.chartGutter._top;var bottom=this.chartProp.chartGutter._bottom;var trueWidth=this.chartProp.trueWidth;var widthCanvas=this.chartProp.widthCanvas;var heightCanvas=this.chartProp.heightCanvas;var height=heightCanvas-(top+bottom);var width=widthCanvas-(left+right);var tempDepth=this.cChartDrawer.processor3D.depthPerspective; var x1=left,y1=top+height,z1=0;var x2=left,y2=top,z2=0;var x3=left+width,y3=top,z3=0;var x4=left+width,y4=top+height,z4=0;var x5=left,y5=top+height,z5=tempDepth;var x6=left,y6=top,z6=tempDepth;var x7=left+width,y7=top,z7=tempDepth;var x8=left+width,y8=top+height,z8=tempDepth;var point1=this.cChartDrawer._convertAndTurnPoint(x1,y1,z1);var point2=this.cChartDrawer._convertAndTurnPoint(x2,y2,z2);var point5=this.cChartDrawer._convertAndTurnPoint(x5,y5,z5);var point6=this.cChartDrawer._convertAndTurnPoint(x6, y6,z6);var radius3D1=(z6-z2)/2;var radius3D2=(z5-z1)/2;var center3D1=new Point3D(x2+(x3-x2)/2,y2,z2+radius3D1);var center3D2=new Point3D(x1+(x4-x1)/2,y1,z1+radius3D2);var pointCenter1=this.cChartDrawer._convertAndTurnPoint(center3D1.x,center3D1.y,center3D1.z);var pointCenter2=this.cChartDrawer._convertAndTurnPoint(center3D2.x,center3D2.y,center3D2.z);var test1=this.cChartDrawer._convertAndTurnPoint(x2,y2,center3D1.z);var test2=this.cChartDrawer._convertAndTurnPoint(x3,y3,center3D1.z);var test11=this.cChartDrawer._convertAndTurnPoint(x4, y4,center3D2.z);var test22=this.cChartDrawer._convertAndTurnPoint(x1,y1,center3D2.z);var radius11=Math.abs((test2.x-test1.x)/2);var radius12=Math.abs((point6.y-point2.y)/2);var radius21=Math.abs((test22.x-test11.x)/2);var radius22=Math.abs((point5.y-point1.y)/2);var center1={x:this.chartProp.chartGutter._left+trueWidth/2,y:(point2.y-point6.y)/2+point6.y};var center2={x:this.chartProp.chartGutter._left+trueWidth/2,y:(point1.y-point5.y)/2+point5.y};var angles1=this._calculateAngles3DPerspective(center1.x, center1.y,radius11,radius12,radius3D1,center3D1);var angles2=this._calculateAngles3DPerspective(center2.x,center2.y,radius21,radius22,radius3D2,center3D2);if(!this.paths.series)this.paths.series=[];for(var i=0;i=Math.PI/2||angle>=-3*Math.PI/2&&angle<=-Math.PI/2)x111=xCenter-x11;else x111=widthCanvas-(xCenter-x11);return{x:x111,y:y11}};var angles= [];for(var i=numCache.ptCount;i>=0;i--){var swapAngle;if(i===numCache.ptCount)swapAngle=firstAngle;else{var point=numCache.getPtByIndex(i);var val=point?point.val:0;var partOfSum=val/sumData;swapAngle=Math.abs(parseFloat(partOfSum)*(Math.PI*2))}var tempSwapAngle=0,newSwapAngle=0,tempStartAngle=startAngle;while(true){if(i===numCache.length&&swapAngle<0)if(tempStartAngle-Math.PI/2>startAngle+swapAngle)tempSwapAngle=-Math.PI/2;else tempSwapAngle=startAngle+swapAngle-tempStartAngle;else if(tempStartAngle+ Math.PI/2startAngle+swapAngle)tempStartAngle-=Math.PI/2;else{if(i!==numCache.ptCount)angles.push({start:newStartAngle, swap:newSwapAngle,end:newStartAngle+newSwapAngle});break}else if(tempStartAngle+Math.PI/2_ang&&_ang-startAng>deltaAng&&endAng-_ang>deltaAng};res.push({angle:startAng});if(_compare(-2*Math.PI))res.push({angle:-2* Math.PI});if(_compare(-Math.PI))res.push({angle:-Math.PI});if(startAng<0&&endAng>0)res.push({angle:0});if(_compare(Math.PI))res.push({angle:Math.PI});if(_compare(2*Math.PI))res.push({angle:2*Math.PI});res.push({angle:endAng});return res};var calculateInsideFaces=function(startAng,swapAng){var pathId=oChartSpace.AllocPath();var path=oChartSpace.GetPath(pathId);var endAng=startAng+swapAng;var p=getSegmentPoints(startAng,endAng);path.moveTo(xCenter/pxToMm*pathW,yCenter/pxToMm*pathH);path.lnTo(p.x0/pxToMm* pathW,p.y0/pxToMm*pathH);path.lnTo(p.x1/pxToMm*pathW,p.y1/pxToMm*pathH);path.lnTo(xCenter/pxToMm*pathW,(yCenter+depth)/pxToMm*pathH);path.moveTo(xCenter/pxToMm*pathW,yCenter/pxToMm*pathH);path.lnTo(p.x2/pxToMm*pathW,p.y2/pxToMm*pathH);path.lnTo(p.x3/pxToMm*pathW,p.y3/pxToMm*pathH);path.lnTo(xCenter/pxToMm*pathW,(yCenter+depth)/pxToMm*pathH);return pathId};var calculateFrontFace=function(startAng,swapAng){var pathId=oChartSpace.AllocPath();var path=oChartSpace.GetPath(pathId);var endAng=startAng+swapAng; var p=getSegmentPoints(startAng,endAng);path.moveTo(p.x0/pxToMm*pathW,p.y0/pxToMm*pathH);path.arcTo(radius1/pxToMm*pathW,radius2/pxToMm*pathH,-1*startAng*cToDeg,-1*swapAng*cToDeg);path.lnTo(p.x3/pxToMm*pathW,p.y3/pxToMm*pathH);path.arcTo(radius1/pxToMm*pathW,radius2/pxToMm*pathH,-1*startAng*cToDeg-1*swapAng*cToDeg,1*swapAng*cToDeg);path.lnTo(p.x0/pxToMm*pathW,p.y0/pxToMm*pathH);return pathId};var calculateUpFace=function(startAng,swapAng){var pathId=oChartSpace.AllocPath();var path=oChartSpace.GetPath(pathId); var endAng=startAng+swapAng;var p=getSegmentPoints(startAng,endAng);path.moveTo(xCenter/pxToMm*pathW,yCenter/pxToMm*pathH);path.lnTo(p.x0/pxToMm*pathW,p.y0/pxToMm*pathH);path.arcTo(radius1/pxToMm*pathW,radius2/pxToMm*pathH,-1*stAng*cToDeg,-1*swapAng*cToDeg);path.lnTo(xCenter/pxToMm*pathW,yCenter/pxToMm*pathH);return pathId};var calculateDownFace=function(startAng,swapAng){var pathId=oChartSpace.AllocPath();var path=oChartSpace.GetPath(pathId);var endAng=startAng+swapAng;var p=getSegmentPoints(startAng, endAng);path.moveTo(xCenter/pxToMm*pathW,(yCenter+depth)/pxToMm*pathH);path.lnTo(p.x0/pxToMm*pathW,(p.y0+depth)/pxToMm*pathH);path.arcTo(radius1/pxToMm*pathW,radius2/pxToMm*pathH,-1*stAng*cToDeg,-1*swapAng*cToDeg);path.lnTo(xCenter/pxToMm*pathW,(yCenter+depth)/pxToMm*pathH);return pathId};var arrAngles=breakAng(stAng,swAng);var frontPath=[];for(var i=1;i=0&&start>=Math.PI&&start<=2*Math.PI|| start<0&&start>=-Math.PI&&start<=0)frontPath.push(calculateFrontFace(start,swap))}var insidePath=calculateInsideFaces(stAng,swAng);var upPath=calculateUpFace(stAng,swAng);var downPath=calculateDownFace(stAng,swAng);this.angleFor3D+=swAng;return{frontPath:frontPath,upPath:upPath,insidePath:insidePath,downPath:downPath}},_calculateSegment3D:function(startAngle,swapAngle,radius,xCenter,yCenter){if(isNaN(swapAngle))return null;if(radius<0)radius=0;var path=[];path.push(this._calculateArc3D(radius,startAngle, swapAngle,xCenter,yCenter));return path},_calculateSegment3DPerspective:function(radiusUp1,radiusUp2,radiusDown1,radiusDown2,angles1,angles2,center1,center2,pointCenter1,pointCenter2,upFaceSign){var xCenter=center1.x,yCenter=center1.y,xCenter1=center2.x,yCenter1=center2.y;var startAngle1=angles1.start,swapAngle1=angles1.swap,startAngle2=angles2.start,swapAngle2=angles2.swap;var pxToMm=this.chartProp.pxToMM;var pathH=this.chartProp.pathH;var pathW=this.chartProp.pathW;var oThis=this;var getSegmentPoints= function(startAng,endAng,startAng2,endAng2){var radiusSpec=radiusUp1*radiusUp2/Math.sqrt(Math.pow(radiusUp2,2)*Math.pow(Math.cos(startAng),2)+Math.pow(radiusUp1,2)*Math.pow(Math.sin(startAng),2));var radiusSpec2=radiusUp1*radiusUp2/Math.sqrt(Math.pow(radiusUp2,2)*Math.pow(Math.cos(endAng),2)+Math.pow(radiusUp1,2)*Math.pow(Math.sin(endAng),2));var radiusSpec11=radiusDown1*radiusDown2/Math.sqrt(Math.pow(radiusDown2,2)*Math.pow(Math.cos(startAng2),2)+Math.pow(radiusDown1,2)*Math.pow(Math.sin(startAng2), 2));var radiusSpec12=radiusDown1*radiusDown2/Math.sqrt(Math.pow(radiusDown2,2)*Math.pow(Math.cos(endAng2),2)+Math.pow(radiusDown1,2)*Math.pow(Math.sin(endAng2),2));var x0=xCenter+radiusSpec*Math.cos(startAng);var y0=yCenter-radiusSpec*Math.sin(startAng);var x1=xCenter1+radiusSpec11*Math.cos(startAng2);var y1=yCenter1-radiusSpec11*Math.sin(startAng2);var x2=xCenter+radiusSpec2*Math.cos(endAng);var y2=yCenter-radiusSpec2*Math.sin(endAng);var x3=xCenter1+radiusSpec12*Math.cos(endAng2);var y3=yCenter1- radiusSpec12*Math.sin(endAng2);return{x0:x0,y0:y0,x1:x1,y1:y1,x2:x2,y2:y2,x3:x3,y3:y3}};var breakAng=function(startAng,swapAng){var res=[];var endAng=startAng+swapAng;res.push({angle:startAng});var tempStartAng=startAng;var tempEndAng=endAng;var tempPI=Math.PI;if(tempStartAng<=-2*tempPI&&tempEndAng>-2*tempPI)res.push({angle:-2*Math.PI});if(tempStartAng<=-tempPI&&tempEndAng>-tempPI)res.push({angle:-Math.PI});if(tempStartAng<=0&&tempEndAng>0)res.push({angle:0});if(tempStartAng<=tempPI&&tempEndAng>tempPI)res.push({angle:Math.PI}); if(tempStartAng<=2*tempPI&&tempEndAng>2*tempPI)res.push({angle:2*Math.PI});res.push({angle:endAng});return res};var calculateInsideFaces=function(startAng1,swapAng1,startAng2,swapAng2){var pathId=oThis.cChartSpace.AllocPath();var path=oThis.cChartSpace.GetPath(pathId);var endAng1=startAng1+swapAng1;var endAng2=startAng2+swapAng2;var p=getSegmentPoints(startAng1,endAng1,startAng2,endAng2);path.moveTo(pointCenter1.x/pxToMm*pathW,pointCenter1.y/pxToMm*pathH);path.lnTo(p.x0/pxToMm*pathW,p.y0/pxToMm*pathH); path.lnTo(p.x1/pxToMm*pathW,p.y1/pxToMm*pathH);path.lnTo(pointCenter2.x/pxToMm*pathW,pointCenter2.y/pxToMm*pathH);path.moveTo(pointCenter1.x/pxToMm*pathW,pointCenter1.y/pxToMm*pathH);path.lnTo(p.x2/pxToMm*pathW,p.y2/pxToMm*pathH);path.lnTo(p.x3/pxToMm*pathW,p.y3/pxToMm*pathH);path.lnTo(pointCenter2.x/pxToMm*pathW,pointCenter2.y/pxToMm*pathH);return pathId};var calculateFrontFace=function(startAng,swapAng,startAng2,swapAng2){if(isNaN(startAng)||isNaN(swapAng))return null;var pathId=oThis.cChartSpace.AllocPath(); var path=oThis.cChartSpace.GetPath(pathId);var endAng=startAng+swapAng;var endAng2=startAng2+swapAng2;var p=getSegmentPoints(startAng,endAng,startAng2,endAng2);path.moveTo(p.x0/pxToMm*pathW,p.y0/pxToMm*pathH);path.arcTo(radiusUp1/pxToMm*pathW,radiusUp2/pxToMm*pathH,-1*startAng*cToDeg,-1*swapAng*cToDeg);path.lnTo(p.x3/pxToMm*pathW,p.y3/pxToMm*pathH);path.arcTo(radiusDown1/pxToMm*pathW,radiusDown2/pxToMm*pathH,-1*startAng2*cToDeg-1*swapAng2*cToDeg,1*swapAng2*cToDeg);path.lnTo(p.x0/pxToMm*pathW,p.y0/ pxToMm*pathH);return pathId};var calculateUpFace=function(startAng,swapAng){if(isNaN(startAng)||isNaN(swapAng))return null;var pathId=oThis.cChartSpace.AllocPath();var path=oThis.cChartSpace.GetPath(pathId);var radiusSpec=radiusUp1*radiusUp2/Math.sqrt(Math.pow(radiusUp2,2)*Math.pow(Math.cos(startAng),2)+Math.pow(radiusUp1,2)*Math.pow(Math.sin(startAng),2));var x0=xCenter+radiusSpec*Math.cos(startAng);var y0=yCenter-radiusSpec*Math.sin(startAng);path.moveTo(pointCenter1.x/pxToMm*pathW,pointCenter1.y/ pxToMm*pathH);path.lnTo(x0/pxToMm*pathW,y0/pxToMm*pathH);path.arcTo(radiusUp1/pxToMm*pathW,radiusUp2/pxToMm*pathH,-1*startAng*cToDeg,-1*swapAng*cToDeg);path.lnTo(pointCenter1.x/pxToMm*pathW,pointCenter1.y/pxToMm*pathH);return pathId};var calculateDownFace=function(startAng,swapAng){if(isNaN(startAng)||isNaN(swapAng))return null;var pathId=oThis.cChartSpace.AllocPath();var path=oThis.cChartSpace.GetPath(pathId);var radiusSpec=radiusDown1*radiusDown2/Math.sqrt(Math.pow(radiusDown2,2)*Math.pow(Math.cos(startAng), 2)+Math.pow(radiusDown1,2)*Math.pow(Math.sin(startAng),2));var x=xCenter1+radiusSpec*Math.cos(startAng);var y=yCenter1-radiusSpec*Math.sin(startAng);path.moveTo(pointCenter2.x/pxToMm*pathW,pointCenter2.y/pxToMm*pathH);path.lnTo(x/pxToMm*pathW,y/pxToMm*pathH);path.arcTo(radiusDown1/pxToMm*pathW,radiusDown2/pxToMm*pathH,-1*startAng*cToDeg,-1*swapAng*cToDeg);path.lnTo(pointCenter2.x/pxToMm*pathW,pointCenter2.y/pxToMm*pathH);return pathId};var arrAngles=breakAng(startAngle1,swapAngle1);var arrAngles2= breakAng(startAngle2,swapAngle2);var frontPath=[];for(var i=1;i=0&&start>=Math.PI&&start<=2*Math.PI||start<0&&start>=-Math.PI&&start<=0)frontPath.push(calculateFrontFace(upFaceSign*start,upFaceSign*swap,start2,swap2))}var insidePath=calculateInsideFaces(upFaceSign* startAngle1,upFaceSign*swapAngle1,startAngle2,swapAngle2);var upPath=calculateUpFace(upFaceSign*startAngle1,upFaceSign*swapAngle1);var downPath=calculateDownFace(startAngle2,swapAngle2);return{frontPath:frontPath,upPath:upPath,insidePath:insidePath,downPath:downPath}},_drawPie3D:function(){var numCache=this._getFirstRealNumCache(true);var t=this;var shade="shade";var shadeValue=35E3;var drawPath=function(path,pen,brush,isShadePen,isShadeBrush){if(path){if(brush){var props=t.cChartSpace.getParentObjects(); var duplicateBrush=brush.createDuplicate();var cColorMod=new AscFormat.CColorMod;cColorMod.val=shadeValue;cColorMod.name=shade;if(duplicateBrush){duplicateBrush.addColorMod(cColorMod);duplicateBrush.calculate(props.theme,props.slide,props.layout,props.master,(new AscFormat.CUniColor).RGBA,t.cChartSpace.clrMapOvr)}if(isShadePen)pen=AscFormat.CreatePenFromParams(duplicateBrush,undefined,undefined,undefined,undefined,0);if(isShadeBrush)brush=duplicateBrush}t.cChartDrawer.drawPath(path,pen,brush)}};var _firstPoint= numCache.getPtByIndex(0);var pen=_firstPoint?_firstPoint.pen:null;drawPath(this.paths.test,pen,null);var sides={down:0,inside:1,up:2,front:3};var drawPaths=function(side){for(var i=0,len=numCache.ptCount;i=0;j--)if(side===sides.down)drawPath(path[j].downPath,pen,null);else if(side===sides.inside){if(pen&&pen.Join){pen=pen.createDuplicate(); pen.Join.type=Asc["c_oAscLineJoinType"].Round}drawPath(path[j].insidePath,pen,brush,null,true)}else if(side===sides.up)drawPath(path[j].upPath,pen,brush);else if(side===sides.front)for(var k=0;k>0; var fLengthCoeff=(fBisectAngle2+Math.PI/4-Math.PI/2*nIndexArea)/(Math.PI/2);var fXs=fCenterX+fPieRadius*Math.cos(fBisectAngle);var fYs=fCenterY+fPieRadius*Math.sin(fBisectAngle);var fDeltaX,fDeltaY,oSolvation;switch(nIndexArea){case 0:{if(fBisectAngle2<0){fDeltaX=fLabelWidth;fDeltaY=-(1-fLengthCoeff)*fLabelHeight}else{fDeltaX=fLabelWidth;fDeltaY=fLabelHeight*fLengthCoeff}oSolvation=AscFormat.fSolveQuadraticEquation(fPieRadius*fPieRadius,2*(fDeltaX*(fXs-fCenterX)+fDeltaY*(fYs-fCenterY)),fDeltaX*fDeltaX+ fDeltaY*fDeltaY-fPieRadius*fPieRadius);if(!oSolvation.bError)if(oSolvation.x1>0&&oSolvation.x1<1){oResult.bError=false;oResult.fX=fCenterX+oSolvation.x1*(fXs-fCenterX);oResult.fY=fCenterY+oSolvation.x1*(fYs-fCenterY)-(1-fLengthCoeff)*fLabelHeight}else if(oSolvation.x2>0&&oSolvation.x2<1){oResult.bError=false;oResult.fX=fCenterX+oSolvation.x2*(fXs-fCenterX);oResult.fY=fCenterY+oSolvation.x2*(fYs-fCenterY)-(1-fLengthCoeff)*fLabelHeight}break}case 1:{if(fBisectAngle0&&oSolvation.x1<1){oResult.bError=false;oResult.fX=fCenterX+oSolvation.x1*(fXs-fCenterX)-fLabelWidth*fLengthCoeff;oResult.fY=fCenterY+oSolvation.x1*(fYs-fCenterY)}else if(oSolvation.x2>0&&oSolvation.x2< 1){oResult.bError=false;oResult.fX=fCenterX+oSolvation.x2*(fXs-fCenterX)-fLabelWidth*fLengthCoeff;oResult.fY=fCenterY+oSolvation.x2*(fYs-fCenterY)}break}case 2:{if(fBisectAngle 0&&oSolvation.x1<1){oResult.bError=false;oResult.fX=fCenterX+oSolvation.x1*(fXs-fCenterX)-fLabelWidth;oResult.fY=fCenterY+oSolvation.x1*(fYs-fCenterY)-fLabelHeight*fLengthCoeff}else if(oSolvation.x2>0&&oSolvation.x2<1){oResult.bError=false;oResult.fX=fCenterX+oSolvation.x2*(fXs-fCenterX)-fLabelWidth;oResult.fY=fCenterY+oSolvation.x2*(fYs-fCenterY)-fLabelHeight*fLengthCoeff}break}case 3:{fLengthCoeff=1-fLengthCoeff;if(fBisectAngle<3*Math.PI/2){fDeltaX=-fLabelWidth*fLengthCoeff;fDeltaY=-fLabelHeight}else{fDeltaX= (1-fLengthCoeff)*fLabelWidth;fDeltaY=-fLabelHeight}oSolvation=AscFormat.fSolveQuadraticEquation(fPieRadius*fPieRadius,2*(fDeltaX*(fXs-fCenterX)+fDeltaY*(fYs-fCenterY)),fDeltaX*fDeltaX+fDeltaY*fDeltaY-fPieRadius*fPieRadius);if(!oSolvation.bError)if(oSolvation.x1>0&&oSolvation.x1<1){oResult.bError=false;oResult.fX=fCenterX+oSolvation.x1*(fXs-fCenterX)-fLabelWidth*fLengthCoeff;oResult.fY=fCenterY+oSolvation.x1*(fYs-fCenterY)-fLabelHeight}else if(oSolvation.x2>0&&oSolvation.x2<1){oResult.bError=false; oResult.fX=fCenterX+oSolvation.x2*(fXs-fCenterX)-fLabelWidth*fLengthCoeff;oResult.fY=fCenterY+oSolvation.x2*(fYs-fCenterY)-fLabelHeight}break}}return oResult},_calculateBestFitPositionOuter:function(fStartAngle,fEndAngle,fPieRadius,fLabelWidth,fLabelHeight,fCenterX,fCenterY){var oResult={bError:true};var fBisectAngle=AscFormat.normalizeRotate((fStartAngle+fEndAngle)/2);var fBisectAngle2=AscFormat.normalizeRotate(fBisectAngle+Math.PI/4)-Math.PI/4;var nIndexArea=(fBisectAngle2+Math.PI/4)/(Math.PI/2)>> 0;var fLengthCoeff=(fBisectAngle2+Math.PI/4-Math.PI/2*nIndexArea)/(Math.PI/2);var fXs=fCenterX+fPieRadius*Math.cos(fBisectAngle);var fYs=fCenterY+fPieRadius*Math.sin(fBisectAngle);var fDeltaX,fDeltaY,oSolvation;var fAngleApproxDelta=1E-4;switch(nIndexArea){case 0:{if(AscFormat.fApproxEqual(fBisectAngle2,0,fAngleApproxDelta)){fDeltaX=0;fDeltaY=0}else if(fBisectAngle2<0){fDeltaX=0;fDeltaY=fLengthCoeff*fLabelHeight}else{fDeltaX=0;fDeltaY=-(1-fLengthCoeff)*fLabelHeight}oSolvation=AscFormat.fSolveQuadraticEquation(fPieRadius* fPieRadius,2*(fDeltaX*(fXs-fCenterX)+fDeltaY*(fYs-fCenterY)),fDeltaX*fDeltaX+fDeltaY*fDeltaY-fPieRadius*fPieRadius);if(!oSolvation.bError)if(oSolvation.x1>=1){oResult.bError=false;oResult.fX=fCenterX+oSolvation.x1*(fXs-fCenterX);oResult.fY=fCenterY+oSolvation.x1*(fYs-fCenterY)-(1-fLengthCoeff)*fLabelHeight}else if(oSolvation.x2>=1){oResult.bError=false;oResult.fX=fCenterX+oSolvation.x2*(fXs-fCenterX);oResult.fY=fCenterY+oSolvation.x2*(fYs-fCenterY)-(1-fLengthCoeff)*fLabelHeight}else if(oSolvation.x1>= 0){oResult.bError=false;oResult.fX=fCenterX+oSolvation.x1*(fXs-fCenterX);oResult.fY=fCenterY+oSolvation.x1*(fYs-fCenterY)-(1-fLengthCoeff)*fLabelHeight}else if(oSolvation.x2>=0){oResult.bError=false;oResult.fX=fCenterX+oSolvation.x2*(fXs-fCenterX);oResult.fY=fCenterY+oSolvation.x2*(fYs-fCenterY)-(1-fLengthCoeff)*fLabelHeight}break}case 1:{if(AscFormat.fApproxEqual(fBisectAngle,Math.PI/2,fAngleApproxDelta)){fDeltaX=0;fDeltaY=0}else if(fBisectAngle=1){oResult.bError=false;oResult.fX=fCenterX+oSolvation.x1*(fXs-fCenterX)-fLabelWidth*fLengthCoeff;oResult.fY=fCenterY+oSolvation.x1*(fYs-fCenterY)}else if(oSolvation.x2>=1){oResult.bError=false;oResult.fX=fCenterX+oSolvation.x2*(fXs-fCenterX)- fLabelWidth*fLengthCoeff;oResult.fY=fCenterY+oSolvation.x2*(fYs-fCenterY)}else if(oSolvation.x1>=0){oResult.bError=false;oResult.fX=fCenterX+oSolvation.x1*(fXs-fCenterX)-fLabelWidth*fLengthCoeff;oResult.fY=fCenterY+oSolvation.x1*(fYs-fCenterY)}else if(oSolvation.x2>=0){oResult.bError=false;oResult.fX=fCenterX+oSolvation.x2*(fXs-fCenterX)-fLabelWidth*fLengthCoeff;oResult.fY=fCenterY+oSolvation.x2*(fYs-fCenterY)}break}case 2:{if(AscFormat.fApproxEqual(fBisectAngle,Math.PI,fAngleApproxDelta)){fDeltaX= 0;fDeltaY=0}else if(fBisectAngle=1){oResult.bError=false;oResult.fX=fCenterX+oSolvation.x1*(fXs-fCenterX)-fLabelWidth;oResult.fY=fCenterY+oSolvation.x1*(fYs-fCenterY)-fLabelHeight*fLengthCoeff}else if(oSolvation.x2>= 1){oResult.bError=false;oResult.fX=fCenterX+oSolvation.x2*(fXs-fCenterX)-fLabelWidth;oResult.fY=fCenterY+oSolvation.x2*(fYs-fCenterY)-fLabelHeight*fLengthCoeff}else if(oSolvation.x1>=0){oResult.bError=false;oResult.fX=fCenterX+oSolvation.x1*(fXs-fCenterX)-fLabelWidth;oResult.fY=fCenterY+oSolvation.x1*(fYs-fCenterY)-fLabelHeight*fLengthCoeff}else if(oSolvation.x2>=0){oResult.bError=false;oResult.fX=fCenterX+oSolvation.x2*(fXs-fCenterX)-fLabelWidth;oResult.fY=fCenterY+oSolvation.x2*(fYs-fCenterY)-fLabelHeight* fLengthCoeff}break}case 3:{if(fBisectAngle<3*Math.PI/2){fDeltaX=fLabelWidth*fLengthCoeff;fDeltaY=0}else{fDeltaX=-(1-fLengthCoeff)*fLabelWidth;fDeltaY=0}oSolvation=AscFormat.fSolveQuadraticEquation(fPieRadius*fPieRadius,2*(fDeltaX*(fXs-fCenterX)+fDeltaY*(fYs-fCenterY)),fDeltaX*fDeltaX+fDeltaY*fDeltaY-fPieRadius*fPieRadius);if(!oSolvation.bError)if(oSolvation.x1>=1){oResult.bError=false;oResult.fX=fCenterX+oSolvation.x1*(fXs-fCenterX)-(1-fLengthCoeff)*fLabelWidth;oResult.fY=fCenterY+oSolvation.x1*(fYs- fCenterY)-fLabelHeight}else if(oSolvation.x2>=1){oResult.bError=false;oResult.fX=fCenterX+oSolvation.x2*(fXs-fCenterX)-(1-fLengthCoeff)*fLabelWidth;oResult.fY=fCenterY+oSolvation.x2*(fYs-fCenterY)-fLabelHeight}else if(oSolvation.x1>=0){oResult.bError=false;oResult.fX=fCenterX+oSolvation.x1*(fXs-fCenterX)-(1-fLengthCoeff)*fLabelWidth;oResult.fY=fCenterY+oSolvation.x1*(fYs-fCenterY)-fLabelHeight}else if(oSolvation.x2>=0){oResult.bError=false;oResult.fX=fCenterX+oSolvation.x2*(fXs-fCenterX)-(1-fLengthCoeff)* fLabelWidth;oResult.fY=fCenterY+oSolvation.x2*(fYs-fCenterY)-fLabelHeight}break}}return oResult},_calculateInEndDLblPosition:function(fStartAngle,fSweepAngle,fPieRadius,fLabelWidth,fLabelHeight,fCenterX,fCenterY){var fEndAngle=fStartAngle+fSweepAngle;var oResult={bError:true,fX:0,fY:0};var fBisectAngle=AscFormat.normalizeRotate((fStartAngle+fEndAngle)/2);var nQuadrantIndex=2*fBisectAngle/Math.PI>>0;var fHalfRectWidthVector=fLabelWidth/2,fHalfRectHeightVector=fLabelHeight/2;if(nQuadrantIndex===1|| nQuadrantIndex==2)fHalfRectWidthVector=-fHalfRectWidthVector;if(nQuadrantIndex===2||nQuadrantIndex==3)fHalfRectHeightVector=-fHalfRectHeightVector;var fXs=fCenterX+fPieRadius*Math.cos(fBisectAngle),fYs=fCenterY+fPieRadius*Math.sin(fBisectAngle);var a=fPieRadius*fPieRadius,b=2*((fXs-fCenterX)*fHalfRectWidthVector+(fYs-fCenterY)*fHalfRectHeightVector),c=fHalfRectWidthVector*fHalfRectWidthVector+fHalfRectHeightVector*fHalfRectHeightVector-fPieRadius*fPieRadius;var oSolution=AscFormat.fSolveQuadraticEquation(a, b,c);if(oSolution.bError)return oResult;var D=b*b-4*a*c;if(D<0)return oResult;var t1=oSolution.x1,t2=oSolution.x2;if(t1>0&&t1<1){oResult.bError=false;oResult.fX=fCenterX+t1*(fXs-fCenterX)-fLabelWidth/2;oResult.fY=fCenterY+t1*(fYs-fCenterY)-fLabelHeight/2;return oResult}if(t2>0&&t2<1){oResult.bError=false;oResult.fX=fCenterX+t2*(fXs-fCenterX)-fLabelWidth/2;oResult.fY=fCenterY+t2*(fYs-fCenterY)-fLabelHeight/2;return oResult}return oResult},_calculateTestFrame:function(point1,point2,point3,point4,point5, point6,point7,point8){var pxToMm=this.chartProp.pxToMM;var pathH=this.chartProp.pathH;var pathW=this.chartProp.pathW;var pathId=this.cChartSpace.AllocPath();var path=this.cChartSpace.GetPath(pathId);path.moveTo(point1.x/pxToMm*pathW,point1.y/pxToMm*pathH);path.lnTo(point2.x/pxToMm*pathW,point2.y/pxToMm*pathH);path.lnTo(point3.x/pxToMm*pathW,point3.y/pxToMm*pathH);path.lnTo(point4.x/pxToMm*pathW,point4.y/pxToMm*pathH);path.lnTo(point1.x/pxToMm*pathW,point1.y/pxToMm*pathH);path.moveTo(point5.x/pxToMm* pathW,point5.y/pxToMm*pathH);path.lnTo(point6.x/pxToMm*pathW,point6.y/pxToMm*pathH);path.lnTo(point7.x/pxToMm*pathW,point7.y/pxToMm*pathH);path.lnTo(point8.x/pxToMm*pathW,point8.y/pxToMm*pathH);path.lnTo(point5.x/pxToMm*pathW,point5.y/pxToMm*pathH);path.moveTo(point1.x/pxToMm*pathW,point1.y/pxToMm*pathH);path.lnTo(point5.x/pxToMm*pathW,point5.y/pxToMm*pathH);path.moveTo(point2.x/pxToMm*pathW,point2.y/pxToMm*pathH);path.lnTo(point6.x/pxToMm*pathW,point6.y/pxToMm*pathH);path.moveTo(point3.x/pxToMm* pathW,point3.y/pxToMm*pathH);path.lnTo(point7.x/pxToMm*pathW,point7.y/pxToMm*pathH);path.moveTo(point4.x/pxToMm*pathW,point4.y/pxToMm*pathH);path.lnTo(point8.x/pxToMm*pathW,point8.y/pxToMm*pathH);this.paths.test=pathId},_recalculatePie3D_Slow:function(){var trueWidth=this.chartProp.trueWidth;var trueHeight=this.chartProp.trueHeight;var numCache=this._getFirstRealNumCache();if(!numCache)return;var sumData=this.cChartDrawer._getSumArray(numCache,true);var radius=Math.min(trueHeight,trueWidth)/2;if(radius< 0)radius=0;var xCenter=this.chartProp.chartGutter._left+trueWidth/2;var yCenter=this.chartProp.chartGutter._top+trueHeight/2;var startAngle=this.cChartDrawer.processor3D.angleOy?this.cChartDrawer.processor3D.angleOy:0;var startAngle3D=startAngle!==0&&startAngle!==undefined?this._changeAngle(radius,Math.PI/2,startAngle,xCenter,yCenter,this.properties3d):0;this.tempAngle=Math.PI/2+startAngle;this.angleFor3D=Math.PI/2-startAngle3D;var depth=this.properties3d.depth;for(var n=0;n=0;i--){var angle=Math.abs(parseFloat(numCache[i].val/sumData)*(Math.PI*2));if(!this.paths.series[n])this.paths.series[n]=[];if(sumData===0)this.paths.series[n][i]=this._calculateEmptySegment(radius,xCenter,yCenter);else this.paths.series[n][i]=this._calculateSegment3D(angle,radius,xCenter,yCenter,n,i)}}},_calculateSegment3D_Slow:function(angle,radius,xCenter,yCenter,depth,i){if(isNaN(angle))return null;var startAngle=this.tempAngle;var path=this._calculateArc3D(radius, startAngle,angle,xCenter,yCenter,depth,i);this.tempAngle+=angle;return path},_calculateArc3D_Slow:function(radius,stAng,swAng,xCenter,yCenter,depth,seriaNum){var radius1=this.properties3d.radius1;var radius2=this.properties3d.radius2;var pxToMm=this.chartProp.pxToMM;var t=this;var x0,y0,radiusSpec;var calculateProps=function(){if(t.usually3dPropsCalc&&t.usually3dPropsCalc[seriaNum]){swAng=t.usually3dPropsCalc[seriaNum].swAng;stAng=t.usually3dPropsCalc[seriaNum].stAng;radiusSpec=t.usually3dPropsCalc[seriaNum].radiusSpec; x0=t.usually3dPropsCalc[seriaNum].x0;yCenter=yCenter+t.properties3d.depth/2-depth;y0=yCenter-radiusSpec*Math.sin(stAng)}else{swAng=t._changeAngle(radius,stAng,swAng,xCenter,yCenter,t.properties3d);stAng=t.angleFor3D;yCenter=yCenter+t.properties3d.depth/2-depth;radiusSpec=radius1*radius2/Math.sqrt(Math.pow(radius2,2)*Math.pow(Math.cos(stAng),2)+Math.pow(radius1,2)*Math.pow(Math.sin(stAng),2));x0=xCenter+radiusSpec*Math.cos(stAng);y0=yCenter-radiusSpec*Math.sin(stAng)}};var pathId=this.cChartSpace.AllocPath(); var path=this.cChartSpace.GetPath(pathId);var pathH=this.chartProp.pathH;var pathW=this.chartProp.pathW;calculateProps();path.moveTo(xCenter/pxToMm*pathW,yCenter/pxToMm*pathH);path.lnTo(x0/pxToMm*pathW,y0/pxToMm*pathH);path.arcTo(radius1/pxToMm*pathW,radius2/pxToMm*pathH,-1*stAng*cToDeg,-1*swAng*cToDeg);path.lnTo(xCenter/pxToMm*pathW,yCenter/pxToMm*pathH);this.angleFor3D+=swAng;if(!this.usually3dPropsCalc[seriaNum])this.usually3dPropsCalc[seriaNum]={swAng:swAng,stAng:stAng,xCenter:xCenter,x0:x0,radiusSpec:radiusSpec}; return pathId},_drawPie3D_Slow:function(){var numCache=this._getFirstRealNumCache();if(!numCache)return;var props=this.cChartSpace.getParentObjects();var brush,pen,val;var path;for(var n=0;n=0;k--){idxPoint=this.cChartDrawer.getPointByIndex(this.chart.series[n],k);curVal=idxPoint?idxPoint.val:0;angle=Math.abs(parseFloat(curVal/sumData)*(Math.PI*2));if(angle<1E-15)angle=0;if(!this.paths.series)this.paths.series=[];if(!this.paths.series[n])this.paths.series[n]=[];if(angle)this.paths.series[n][k]=this._calculateSegment(angle,radius,xCenter,yCenter,radius+step*(seriesCounter+1),radius+step*seriesCounter, firstSliceAng);else this.paths.series[n][k]=null}if(numCache.pts.length)seriesCounter++}},_calculateSegment:function(angle,radius,xCenter,yCenter,radius1,radius2,firstSliceAng){var startAngle=this.tempAngle-firstSliceAng;var endAngle=angle;if(radius<0)radius=0;var path=this._calculateArc(radius,startAngle,endAngle,xCenter,yCenter,radius1,radius2);this.tempAngle+=angle;return path},_calculateArc:function(radius,stAng,swAng,xCenter,yCenter,radius1,radius2){var pathId=this.cChartSpace.AllocPath();var path= this.cChartSpace.GetPath(pathId);var pathH=this.chartProp.pathH;var pathW=this.chartProp.pathW;var pxToMm=this.chartProp.pxToMM;var x2=xCenter+radius1*Math.cos(stAng);var y2=yCenter-radius1*Math.sin(stAng);var x1=xCenter+radius2*Math.cos(stAng);var y1=yCenter-radius2*Math.sin(stAng);var x4=xCenter+radius2*Math.cos(stAng+swAng);var y4=yCenter-radius2*Math.sin(stAng+swAng);path.moveTo(x1/pxToMm*pathW,y1/pxToMm*pathH);path.lnTo(x2/pxToMm*pathW,y2/pxToMm*pathH);path.arcTo(radius1/pxToMm*pathW,radius1/ pxToMm*pathH,-1*stAng*cToDeg,-1*swAng*cToDeg);path.lnTo(x4/pxToMm*pathW,y4/pxToMm*pathH);path.arcTo(radius2/pxToMm*pathW,radius2/pxToMm*pathH,-1*stAng*cToDeg-swAng*cToDeg,swAng*cToDeg);path.moveTo(xCenter/pxToMm*pathW,yCenter/pxToMm*pathH);return pathId},_calculateDLbl:function(chartSpace,ser,val){if(!AscFormat.isRealNumber(this.paths.series[ser][val]))return;var path=this.paths.series[ser][val];var oPath=this.cChartSpace.GetPath(path);var oCommand2=oPath.getCommandByIndex(2);var oCommand4=oPath.getCommandByIndex(4); var oCommand5=oPath.getCommandByIndex(5);var radius1=oCommand2.hR;var stAng=oCommand2.stAng;var swAng=oCommand2.swAng;var radius2=oCommand4.hR;var xCenter=oCommand5.X;var yCenter=oCommand5.Y;var newRadius=radius2+(radius1-radius2)/2;var centerX=xCenter+newRadius*Math.cos(-1*stAng-swAng/2);var centerY=yCenter-newRadius*Math.sin(-1*stAng-swAng/2);var numCache=this.cChartDrawer.getNumCache(this.chart.series[ser].val);var point=null;if(numCache)point=numCache.getPtByIndex(val);if(!point)return;var width= point.compiledDlb.extX;var height=point.compiledDlb.extY;switch(point.compiledDlb.dLblPos){case c_oAscChartDataLabelsPos.ctr:{centerX=centerX-width/2;centerY=centerY-height/2;break}case c_oAscChartDataLabelsPos.inBase:{centerX=centerX-width/2;centerY=centerY-height/2;break}}if(centerX<0)centerX=0;if(centerY<0)centerY=0;return{x:centerX,y:centerY}}};function drawRadarChart(chart,chartsDrawer){this.chartProp=chartsDrawer.calcProp;this.cChartDrawer=chartsDrawer;this.cChartSpace=chartsDrawer.cChartSpace; this.chart=chart;this.subType=null;this.valAx=null;this.paths={}}drawRadarChart.prototype={constructor:drawRadarChart,draw:function(){this._drawLines()},recalculate:function(){this.paths={};this.subType=this.cChartDrawer.getChartGrouping(this.chart);this.valAx=this.cChartDrawer.getAxisFromAxId(this.chart.axId,AscDFH.historyitem_type_ValAx);this._calculateLines()},_calculateLines:function(){var yPoints=this.valAx.yPoints;var trueWidth=this.chartProp.trueWidth;var trueHeight=this.chartProp.trueHeight; var xCenter=(this.chartProp.chartGutter._left+trueWidth/2)/this.chartProp.pxToMM;var yCenter=(this.chartProp.chartGutter._top+trueHeight/2)/this.chartProp.pxToMM;var y,y1,x,x1,val,nextVal,seria,dataSeries;var numCache=this.cChartDrawer.getNumCache(this.chart.series[0].val).pts;if(!numCache)return;var tempAngle=2*Math.PI/numCache.length;var xDiff=trueHeight/2/yPoints.length/this.chartProp.pxToMM;var radius,radius1,xFirst,yFirst;for(var i=0;ithis.chartProp.widthCanvas/pxToMm)centerX=this.chartProp.widthCanvas/pxToMm-width;if(centerY<0)centerY=0;if(centerY+ height>this.chartProp.heightCanvas/pxToMm)centerY=this.chartProp.heightCanvas/pxToMm-height;return{x:centerX,y:centerY}},_drawLines:function(){var brush,pen,dataSeries,seria,markerBrush,markerPen,numCache;for(var i=0;ithis.chartProp.widthCanvas/pxToMm)centerX=this.chartProp.widthCanvas/pxToMm-width;if(centerY<0)centerY=0;if(centerY+height>this.chartProp.heightCanvas/pxToMm)centerY=this.chartProp.heightCanvas/pxToMm-height;return{x:centerX,y:centerY}},_calculateSplineLine2:function(points,k,xPoints,yPoints){var pathId=this.cChartSpace.AllocPath();var path=this.cChartSpace.GetPath(pathId);var pathH=this.chartProp.pathH;var pathW=this.chartProp.pathW;var x=points[k-1]?points[k-1].x:points[k].x;var y=points[k- 1]?points[k-1].y:points[k].y;var x1=points[k].x;var y1=points[k].y;var x2=points[k+1]?points[k+1].x:points[k].x;var y2=points[k+1]?points[k+1].y:points[k].y;var x3=points[k+2]?points[k+2].x:points[k+1]?points[k+1].x:points[k].x;var y3=points[k+2]?points[k+2].y:points[k+1]?points[k+1].y:points[k].y;var splineCoords=this.cChartDrawer.calculate_Bezier(x,y,x1,y1,x2,y2,x3,y3);x=this.cChartDrawer.getYPosition(splineCoords[0].x,this.catAx);y=this.cChartDrawer.getYPosition(splineCoords[0].y,this.valAx);x1= this.cChartDrawer.getYPosition(splineCoords[1].x,this.catAx);y1=this.cChartDrawer.getYPosition(splineCoords[1].y,this.valAx);x2=this.cChartDrawer.getYPosition(splineCoords[2].x,this.catAx);y2=this.cChartDrawer.getYPosition(splineCoords[2].y,this.valAx);x3=this.cChartDrawer.getYPosition(splineCoords[3].x,this.catAx);y3=this.cChartDrawer.getYPosition(splineCoords[3].y,this.valAx);path.moveTo(x*pathW,y*pathH);path.cubicBezTo(x1*pathW,y1*pathH,x2*pathW,y2*pathH,x3*pathW,y3*pathH);return pathId}};function drawStockChart(chart, chartsDrawer){this.chartProp=chartsDrawer.calcProp;this.cChartDrawer=chartsDrawer;this.cChartSpace=chartsDrawer.cChartSpace;this.chart=chart;this.catAx=null;this.valAx=null;this.paths={}}drawStockChart.prototype={constructor:drawStockChart,draw:function(){this._drawLines()},recalculate:function(){this.paths={};this.catAx=this.chart.axId[0].xPoints?this.chart.axId[0]:this.chart.axId[1];this.catAx=this.cChartDrawer._searchChangedAxis(this.catAx);this.valAx=this.chart.axId[0].yPoints?this.chart.axId[0]: this.chart.axId[1];this.valAx=this.cChartDrawer._searchChangedAxis(this.valAx);this._calculateLines()},_calculateLines:function(){var xPoints=this.catAx.xPoints;var yPoints=this.valAx.yPoints;var trueWidth=this.chartProp.trueWidth;var numCache=this.cChartDrawer.getNumCache(this.chart.series[0].val);if(!numCache)return;var koffX=trueWidth/numCache.pts.length;var gapWidth=this.chart.upDownBars&&AscFormat.isRealNumber(this.chart.upDownBars.gapWidth)?this.chart.upDownBars.gapWidth:150;var widthBar=koffX/ (1+gapWidth/100);var val1,val2,val3,val4,xVal,yVal1,yVal2,yVal3,yVal4,curNumCache,lastNamCache;for(var i=0;iparseFloat(curNumCache.pts[i].val))val2=curNumCache.pts[i].val;if(parseFloat(val3)parseFloat(val4))this.paths.values[i].downBars=this._calculateUpDownBars(xVal,yVal1,xVal,yVal4,widthBar/this.chartProp.pxToMM);else this.paths.values[i].upBars= this._calculateUpDownBars(xVal,yVal1,xVal,yVal4,widthBar/this.chartProp.pxToMM)}},_drawLines:function(){var brush;var pen;var numCache=this.cChartDrawer.getNumCache(this.chart.series[0].val);if(!numCache)return;for(var i=0;ithis.chartProp.widthCanvas/pxToMm)centerX=this.chartProp.widthCanvas/pxToMm-width;if(centerY<0)centerY=0;if(centerY+height> this.chartProp.heightCanvas/pxToMm)centerY=this.chartProp.heightCanvas/pxToMm-height;return{x:centerX,y:centerY}},_calculateUpDownBars:function(x,y,x1,y1,width){var pathId=this.cChartSpace.AllocPath();var path=this.cChartSpace.GetPath(pathId);var pathH=this.chartProp.pathH;var pathW=this.chartProp.pathW;path.moveTo((x-width/2)*pathW,y*pathH);path.lnTo((x-width/2)*pathW,y1*pathH);path.lnTo((x+width/2)*pathW,y1*pathH);path.lnTo((x+width/2)*pathW,y*pathH);path.lnTo((x-width/2)*pathW,y*pathH);return pathId}}; function drawBubbleChart(chart,chartsDrawer){this.chartProp=chartsDrawer.calcProp;this.cChartDrawer=chartsDrawer;this.cChartSpace=chartsDrawer.cChartSpace;this.chart=chart;this.catAx=null;this.valAx=null;this.paths={}}drawBubbleChart.prototype={constructor:drawBubbleChart,recalculate:function(){this.paths={};this.catAx=this.chart.axId[0].xPoints?this.chart.axId[0]:this.chart.axId[1];this.catAx=this.cChartDrawer._searchChangedAxis(this.catAx);this.valAx=this.chart.axId[0].yPoints?this.chart.axId[0]: this.chart.axId[1];this.valAx=this.cChartDrawer._searchChangedAxis(this.valAx);this._recalculateScatter()},draw:function(){this._drawScatter()},_recalculateScatter:function(){var xPoints=this.catAx.xPoints;var yPoints=this.valAx.yPoints;var seria,yVal,xVal,points,x,y,yNumCache,xNumCache;for(var i=0;ithis.chartProp.widthCanvas/pxToMm)centerX=this.chartProp.widthCanvas/pxToMm-width;if(centerY<0)centerY=0;if(centerY+height>this.chartProp.heightCanvas/pxToMm)centerY=this.chartProp.heightCanvas/pxToMm-height;return{x:centerX,y:centerY}},_calculateBubble:function(x,y,bubbleSize,k){var defaultSize=4;if(bubbleSize){var maxSize,curSize,yPoints,maxDiamBubble, diffSize,maxArea;maxSize=this.cChartDrawer._getMaxMinValueArray(bubbleSize).max;curSize=bubbleSize[k].val;yPoints=this.valAx.yPoints?this.valAx.yPoints:this.catAx.yPoints;maxDiamBubble=Math.abs(yPoints[1].pos-yPoints[0].pos)*2;diffSize=maxSize/curSize;var isDiam=false;if(isDiam)defaultSize=maxDiamBubble/diffSize/2;else{maxArea=1/4*(Math.PI*(maxDiamBubble*maxDiamBubble));defaultSize=Math.sqrt(maxArea/diffSize/Math.PI)}}var pathId=this.cChartSpace.AllocPath();var path=this.cChartSpace.GetPath(pathId); var pathH=this.chartProp.pathH;var pathW=this.chartProp.pathW;path.moveTo((x+defaultSize)*pathW,y*pathH);path.arcTo(defaultSize*pathW,defaultSize*pathW,0,Math.PI*2*cToDeg);return pathId}};function drawSurfaceChart(chart,chartsDrawer){this.chartProp=chartsDrawer.calcProp;this.cChartDrawer=chartsDrawer;this.cChartSpace=chartsDrawer.cChartSpace;this.chart=chart;this.catAx=null;this.valAx=null;this.paths={}}drawSurfaceChart.prototype={constructor:drawSurfaceChart,recalculate:function(){this.paths={}; var countSeries=this.cChartDrawer.calculateCountSeries(this.chart);this.ptCount=countSeries.points;this.catAx=this.cChartDrawer.getAxisFromAxId(this.chart.axId,AscDFH.historyitem_type_CatAx);if(!this.catAx)this.catAx=this.cChartDrawer.getAxisFromAxId(this.chart.axId,AscDFH.historyitem_type_DateAx);this.valAx=this.cChartDrawer.getAxisFromAxId(this.chart.axId,AscDFH.historyitem_type_ValAx);this._recalculate()},draw:function(){this._draw()},_recalculate:function(){var yPoints=this.valAx.yPoints;var xPoints= this.catAx.xPoints;var perspectiveDepth=this.cChartDrawer.processor3D.depthPerspective;var y,x,z,val,seria,dataSeries,idx,numCache,idxPoint,points=[],points3d=[],idx2,val2;for(var i=0;imax){max=arrVal[m].val;maxIndex=m}var lines1,pointsValue1,lines2,pointsValue2;if(p1.val+p2.val=3&&cleanPoints2.length>=3)newPath=cleanPoints1.concat(cleanPoints2)}else if(pointsFace1[l])newPath=pointsFace1[l];else if(pointsFace2[l])newPath=pointsFace2[l];if(newPath){if(!t.paths.test2[l])t.paths.test2[l]=[];var path2=t._calculateTempFace(newPath);t.paths.test2[l].push(path2)}}}}},_getIntersectionPlanesAndLines:function(lines,pointsValue,bIsAddIntoPaths){var t=this;var yPoints=this.valAx.yPoints;var xPoints= this.catAx.xPoints;var perspectiveDepth=this.cChartDrawer.processor3D.depthPerspective;var getGridPlain=function(index){var gridX1=xPoints[0].pos*t.chartProp.pxToMM;var gridX2=xPoints[xPoints.length-1].pos*t.chartProp.pxToMM;var gridY1=yPoints[index].pos*t.chartProp.pxToMM;var gridY2=yPoints[index].pos*t.chartProp.pxToMM;var gridPlain=t.cChartDrawer.getPlainEquation({x:gridX1,y:gridY1,z:0},{x:gridX2,y:gridY2,z:0},{x:gridX2,y:gridY2,z:perspectiveDepth});return gridPlain};var getMinMaxValArray=function(pointsValue){var min, max;if(pointsValue.length===4){min=Math.min(pointsValue[0].val,pointsValue[1].val,pointsValue[2].val,pointsValue[3].val);max=Math.max(pointsValue[0].val,pointsValue[1].val,pointsValue[2].val,pointsValue[3].val)}else{min=Math.min(pointsValue[0].val,pointsValue[1].val,pointsValue[2].val);max=Math.max(pointsValue[0].val,pointsValue[1].val,pointsValue[2].val)}return{min:min,max:max}};var calculateFaceBetween2GridLines=function(minVal,maxVal,k,pointsValue,res){var result=false;if(yPoints[k-1]&&minVal>= yPoints[k-1].val&&maxVal<=yPoints[k].val){var p1=pointsValue[0];var p2=pointsValue[1];var p3=pointsValue[2];var p4=pointsValue[3]?pointsValue[3]:pointsValue[2];var path=t._calculateTempFace([p1,p2,p3,p4]);var addIndex=k;if(minVal===maxVal&&yPoints[k]&&minVal===yPoints[k].val)addIndex=k+1;if(bIsAddIntoPaths){if(!t.paths.test2[addIndex])t.paths.test2[addIndex]=[];t.paths.test2[addIndex].push(path)}res[k]=[p1,p2,p3,p4];result=true}return result};var minMaxVal=getMinMaxValArray(pointsValue);var minVal= minMaxVal.min;var maxVal=minMaxVal.max;var res=[];var prevPoints=null;for(var k=0;kmaxVal&&yPoints[k-1].val>=maxVal)break;var pointNeedAddIntoFace=null;if(yPoints[k-1])for(var i=0;i=pointsValue[i].val){if(null===pointNeedAddIntoFace)pointNeedAddIntoFace=[];pointNeedAddIntoFace.push(pointsValue[i])}var isCalculatePrevPoints= false;if(null===prevPoints)for(var j=0;j=yPoints[k-1].val){if(!points)points=[];points.push(pointsValue[j]);isCalculatePrevPoints=true}var arrPoints= null,p1,p2,p3,p4;if(null!==points&&prevPoints){p1=prevPoints[0];p2=prevPoints[1]?prevPoints[1]:prevPoints[0];p3=points[0];p4=points[1]?points[1]:points[0];arrPoints=[p1,p2,p3,p4];if(points[2])arrPoints.push(points[2]);res[k]=arrPoints}else if(prevPoints&&prevPoints.length===3&&!points&&isCalculatePrevPoints){p1=prevPoints[0];p2=prevPoints[1];p3=prevPoints[2];p4=prevPoints[3]?prevPoints[3]:prevPoints[2];arrPoints=[p1,p2,p3,p4];res[k]=arrPoints}if(arrPoints&&null!==pointNeedAddIntoFace)for(var i=0;i< pointNeedAddIntoFace.length;i++)arrPoints.push(pointNeedAddIntoFace[i]);if(arrPoints&&bIsAddIntoPaths){var path=t._calculateTempFace(arrPoints);if(!t.paths.test2[k])t.paths.test2[k]=[];t.paths.test2[k].push(path)}if(points!==null)prevPoints=points}return res},_getIntersectionPlaneAndLines:function(gridPlain,lines,pointsValue){var res=null;var clearIntersectionPoints=[];var segmentIntersectionPoints=[];for(var n=0;n2){sortArray.sort(function sortArr(a,b){return b.tan-a.tan});path=this.cChartDrawer.calculatePathFacesArray(sortArray,true)}return path},_getYVal:function(n, i){var idxPoint=this.cChartDrawer.getIdxPoint(this.chart.series[i],n);var val=idxPoint?parseFloat(idxPoint.val):null;return val},_calculatePath:function(x,y,x1,y1){var pathId=this.cChartSpace.AllocPath();var path=this.cChartSpace.GetPath(pathId);var pxToMm=this.chartProp.pxToMM;var pathH=this.chartProp.pathH;var pathW=this.chartProp.pathW;var gdLst=[];path.pathH=pathH;path.pathW=pathW;gdLst["w"]=1;gdLst["h"]=1;path.moveTo(x/pxToMm*pathW,y/pxToMm*pathH);path.lnTo(x1/pxToMm*pathW,y1/pxToMm*pathH);return pathId}, _draw:function(){var style=AscFormat.CHART_STYLE_MANAGER.getStyleByIndex(this.cChartSpace.style);for(var i=0;i=yPoints.length)break;if(yPoints[k].val<0)continue;posY=yPoints[k].pos+firstDiff/2;if(!this.paths.tickMarks)this.paths.tickMarks=pathId;this._calculateLine(posX,posY,posX+widthLine/this.chartProp.pxToMM,posY,path);if((i+1)*tickMarkSkip===yPoints.length){var posYtemp=yPoints[yPoints.length-1].pos-firstDiff/ 2;this._calculateLine(posX-crossMajorStep/this.chartProp.pxToMM,posYtemp,posX+widthLine/this.chartProp.pxToMM,posYtemp,path)}if(widthMinorLine!==0)for(n=1;nyPoints[yPoints.length-1].pos-firstDiff/2&&orientation!==ORIENTATION_MIN_MAX)break;this._calculateLine(posX-crossMinorStep/this.chartProp.pxToMM,posMinorY,posX+widthMinorLine/this.chartProp.pxToMM, posMinorY,path)}}}else{var xPoints=this.catAx.xPoints;if(!xPoints)return;var stepX=xPoints[1]?Math.abs(xPoints[1].pos-xPoints[0].pos):Math.abs(xPoints[0].pos-this.catAx.posX)*2;minorStep=stepX/minorLinesCount;posY=this.catAx.posY;var posMinorX;if(this.catAx.crossAx.crossBetween===AscFormat.CROSS_BETWEEN_BETWEEN)if(xPoints[1])firstDiff=Math.abs(xPoints[1].pos-xPoints[0].pos);else if(this.cChartSpace.chart.plotArea.valAx.posX)firstDiff=Math.abs(this.cChartSpace.chart.plotArea.valAx.posX-xPoints[0].pos)* 2;if(orientation!==ORIENTATION_MIN_MAX){minorStep=-minorStep;firstDiff=-firstDiff}for(i=0;i=xPoints.length)break;if(xPoints[k].val<0)continue;posX=xPoints[k].pos-firstDiff/2;if(!this.paths.tickMarks)this.paths.tickMarks=pathId;this._calculateLine(posX,posY-crossMajorStep/this.chartProp.pxToMM,posX,posY+widthLine/this.chartProp.pxToMM,path);if((i+1)*tickMarkSkip===xPoints.length){var posXtemp=xPoints[xPoints.length-1].pos+firstDiff/2;this._calculateLine(posXtemp, posY-crossMajorStep/this.chartProp.pxToMM,posXtemp,posY+widthLine/this.chartProp.pxToMM,path)}if(widthMinorLine!==0)for(n=1;nxPoints[xPoints.length-1].pos+firstDiff/2&&orientation===ORIENTATION_MIN_MAX||posMinorXyPoints[yPoints.length-1].pos?yPoints[0].pos* this.chartProp.pxToMM:yPoints[yPoints.length-1].pos*this.chartProp.pxToMM;maxPositionOy=yPoints[0].posyPoints[yPoints.length-1].pos?yPoints[0].pos*this.chartProp.pxToMM:yPoints[yPoints.length-1].pos*this.chartProp.pxToMM;maxPositionOy=yPoints[0].posyPoints[yPoints.length-1].pos?yPoints[0].pos*this.chartProp.pxToMM:yPoints[yPoints.length-1].pos*this.chartProp.pxToMM;maxPositionOy=yPoints[0].pos0){this.coeffX=(this.adjastment.maxX-this.adjastment.minX)/(this.maxRealX-this.minRealX);this.xFlag=true}}var _ref_y=this.adjastment.gdRefY;if(typeof _ref_y==="string"&&typeof _gd_lst[_ref_y]==="number"&&typeof this.adjastment.minY==="number"&&typeof this.adjastment.maxY==="number"){_gd_lst[_ref_y]=this.adjastment.minY; this.geometry.Recalculate(this.shapeWidth,this.shapeHeight);this.minRealY=this.adjastment.posY;_gd_lst[_ref_y]=this.adjastment.maxY;this.geometry.Recalculate(this.shapeWidth,this.shapeHeight);this.maxRealY=this.adjastment.posY;this.maximalRealY=Math.max(this.maxRealY,this.minRealY);this.minimalRealY=Math.min(this.maxRealY,this.minRealY);this.minimalRealativeY=Math.min(this.adjastment.minY,this.adjastment.maxY);this.maximalRealativeY=Math.max(this.adjastment.minY,this.adjastment.maxY);if(this.maximalRealY- this.minimalRealY>0){this.coeffY=(this.adjastment.maxY-this.adjastment.minY)/(this.maxRealY-this.minRealY);this.yFlag=true}}if(this.xFlag)this.refX=_ref_x;if(this.yFlag)this.refY=_ref_y}this.overlayObject=new AscFormat.OverlayObject(this.geometry,this.shapeWidth,this.shapeHeight,oBrush,oPen,this.transform)},this,[])}XYAdjustmentTrack.prototype.getBounds=function(){var bounds_checker=new AscFormat.CSlideBoundsChecker;bounds_checker.init(Page_Width,Page_Height,Page_Width,Page_Height);this.draw(bounds_checker); var tr=this.originalShape.transform;var arr_p_x=[];var arr_p_y=[];arr_p_x.push(tr.TransformPointX(0,0));arr_p_y.push(tr.TransformPointY(0,0));arr_p_x.push(tr.TransformPointX(this.originalShape.extX,0));arr_p_y.push(tr.TransformPointY(this.originalShape.extX,0));arr_p_x.push(tr.TransformPointX(this.originalShape.extX,this.originalShape.extY));arr_p_y.push(tr.TransformPointY(this.originalShape.extX,this.originalShape.extY));arr_p_x.push(tr.TransformPointX(0,this.originalShape.extY));arr_p_y.push(tr.TransformPointY(0, this.originalShape.extY));arr_p_x.push(bounds_checker.Bounds.min_x);arr_p_x.push(bounds_checker.Bounds.max_x);arr_p_y.push(bounds_checker.Bounds.min_y);arr_p_y.push(bounds_checker.Bounds.max_y);bounds_checker.Bounds.min_x=Math.min.apply(Math,arr_p_x);bounds_checker.Bounds.max_x=Math.max.apply(Math,arr_p_x);bounds_checker.Bounds.min_y=Math.min.apply(Math,arr_p_y);bounds_checker.Bounds.max_y=Math.max.apply(Math,arr_p_y);bounds_checker.Bounds.posX=this.originalShape.x;bounds_checker.Bounds.posY=this.originalShape.y; bounds_checker.Bounds.extX=this.originalShape.extX;bounds_checker.Bounds.extY=this.originalShape.extY;return bounds_checker.Bounds};XYAdjustmentTrack.prototype.draw=function(overlay){if(AscFormat.isRealNumber(this.originalShape.selectStartPage)&&overlay.SetCurrentPage)overlay.SetCurrentPage(this.originalShape.selectStartPage);this.overlayObject.draw(overlay)};XYAdjustmentTrack.prototype.track=function(posX,posY){this.bIsTracked=true;var invert_transform=this.invertTransform;var _relative_x=invert_transform.TransformPointX(posX, posY);var _relative_y=invert_transform.TransformPointY(posX,posY);var bRecalculate=false;if(this.xFlag){var _new_x=this.adjastment.minX+this.coeffX*(_relative_x-this.minRealX);if(_new_x<=this.maximalRealativeX&&_new_x>=this.minimalRealativeX){if(this.geometry.gdLst[this.adjastment.gdRefX]!==_new_x)bRecalculate=true;this.geometry.gdLst[this.adjastment.gdRefX]=_new_x}else if(_new_x>this.maximalRealativeX){if(this.geometry.gdLst[this.adjastment.gdRefX]!==this.maximalRealativeX)bRecalculate=true;this.geometry.gdLst[this.adjastment.gdRefX]= this.maximalRealativeX}else{if(this.geometry.gdLst[this.adjastment.gdRefX]!==this.minimalRealativeX)bRecalculate=true;this.geometry.gdLst[this.adjastment.gdRefX]=this.minimalRealativeX}}if(this.yFlag){var _new_y=this.adjastment.minY+this.coeffY*(_relative_y-this.minRealY);if(_new_y<=this.maximalRealativeY&&_new_y>=this.minimalRealativeY){if(this.geometry.gdLst[this.adjastment.gdRefY]!==_new_y)bRecalculate=true;this.geometry.gdLst[this.adjastment.gdRefY]=_new_y}else if(_new_y>this.maximalRealativeY){if(this.geometry.gdLst[this.adjastment.gdRefY]!== this.maximalRealativeY)bRecalculate=true;this.geometry.gdLst[this.adjastment.gdRefY]=this.maximalRealativeY}else{if(this.geometry.gdLst[this.adjastment.gdRefY]!==this.minimalRealativeY)bRecalculate=true;this.geometry.gdLst[this.adjastment.gdRefY]=this.minimalRealativeY}}if(bRecalculate)this.geometry.Recalculate(this.shapeWidth,this.shapeHeight)};XYAdjustmentTrack.prototype.trackEnd=function(){if(!this.bIsTracked)return;var oGeometryToSet;if(!this.bTextWarp){if(!this.originalShape.spPr.geometry)this.originalShape.spPr.setGeometry(this.geometry.createDuplicate()); oGeometryToSet=this.originalShape.spPr.geometry;if(this.xFlag)oGeometryToSet.setAdjValue(this.refX,this.geometry.gdLst[this.adjastment.gdRefX]+"");if(this.yFlag)oGeometryToSet.setAdjValue(this.refY,this.geometry.gdLst[this.adjastment.gdRefY]+"");if(this.originalShape.checkExtentsByDocContent)this.originalShape.checkExtentsByDocContent(true,true)}else{var new_body_pr=this.originalShape.getBodyPr();if(new_body_pr){oGeometryToSet=AscFormat.ExecuteNoHistory(function(){var oGeom=this.geometry.createDuplicate(); if(this.xFlag)oGeom.setAdjValue(this.refX,this.geometry.gdLst[this.adjastment.gdRefX]+"");if(this.yFlag)oGeom.setAdjValue(this.refY,this.geometry.gdLst[this.adjastment.gdRefY]+"");return oGeom},this,[]);new_body_pr=new_body_pr.createDuplicate();new_body_pr.prstTxWarp=oGeometryToSet;if(this.originalShape.bWordShape)this.originalShape.setBodyPr(new_body_pr);else if(this.originalShape.txBody)this.originalShape.txBody.setBodyPr(new_body_pr)}}};function PolarAdjustmentTrack(originalShape,adjIndex,bTextWarp){AscFormat.ExecuteNoHistory(function(){this.bIsTracked= false;this.originalShape=originalShape;var oPen,oBrush;if(bTextWarp!==true){if(originalShape.spPr&&originalShape.spPr.geometry)this.geometry=originalShape.spPr.geometry.createDuplicate();else if(originalShape.calcGeometry)this.geometry=originalShape.calcGeometry.createDuplicate();this.shapeWidth=originalShape.extX;this.shapeHeight=originalShape.extY;this.transform=originalShape.transform;this.invertTransform=originalShape.invertTransform;oPen=originalShape.pen;oBrush=originalShape.brush}else{this.geometry= originalShape.recalcInfo.warpGeometry.createDuplicate();this.shapeWidth=originalShape.recalcInfo.warpGeometry.gdLst["w"];this.shapeHeight=originalShape.recalcInfo.warpGeometry.gdLst["h"];this.transform=originalShape.transformTextWordArt;this.invertTransform=originalShape.invertTransformTextWordArt;oPen=null;oBrush=null}this.geometry.Recalculate(this.shapeWidth,this.shapeHeight);this.adjastment=this.geometry.ahPolarLst[adjIndex];this.bTextWarp=bTextWarp===true;this.radiusFlag=false;this.angleFlag= false;this.originalObject=originalShape;if(this.adjastment!==null&&typeof this.adjastment==="object"){var _ref_r=this.adjastment.gdRefR;var _gd_lst=this.geometry.gdLst;if(typeof _ref_r==="string"&&typeof _gd_lst[_ref_r]==="number"&&typeof this.adjastment.minR==="number"&&typeof this.adjastment.maxR==="number"){_gd_lst[_ref_r]=this.adjastment.minR;this.geometry.Recalculate(this.shapeWidth,this.shapeHeight);var _dx=this.adjastment.posX-this.shapeWidth*.5;var _dy=this.adjastment.posY-this.shapeWidth* .5;this.minRealR=Math.sqrt(_dx*_dx+_dy*_dy);_gd_lst[_ref_r]=this.adjastment.maxR;this.geometry.Recalculate(this.shapeWidth,this.shapeHeight);_dx=this.adjastment.posX-this.shapeWidth*.5;_dy=this.adjastment.posY-this.shapeHeight*.5;this.maxRealR=Math.sqrt(_dx*_dx+_dy*_dy);this.maximalRealRadius=Math.max(this.maxRealR,this.minRealR);this.minimalRealRadius=Math.min(this.maxRealR,this.minRealR);this.minimalRealativeRadius=Math.min(this.adjastment.minR,this.adjastment.maxR);this.maximalRealativeRadius= Math.max(this.adjastment.minR,this.adjastment.maxR);if(this.maximalRealRadius-this.minimalRealRadius>0){this.coeffR=(this.adjastment.maxR-this.adjastment.minR)/(this.maxRealR-this.minRealR);this.radiusFlag=true}}var _ref_ang=this.adjastment.gdRefAng;if(typeof _ref_ang==="string"&&typeof _gd_lst[_ref_ang]==="number"&&typeof this.adjastment.minAng==="number"&&typeof this.adjastment.maxAng==="number"){this.angleFlag=true;this.minimalAngle=Math.min(this.adjastment.minAng,this.adjastment.maxAng);this.maximalAngle= Math.max(this.adjastment.minAng,this.adjastment.maxAng)}}this.overlayObject=new AscFormat.OverlayObject(this.geometry,this.shapeWidth,this.shapeHeight,oBrush,oPen,this.transform)},this,[]);this.draw=function(overlay){if(this.originalShape.parent&&AscFormat.isRealNumber(this.originalShape.selectStartPage)&&overlay.SetCurrentPage)overlay.SetCurrentPage(this.originalShape.selectStartPage);this.overlayObject.draw(overlay)};this.track=function(posX,posY){this.bIsTracked=true;var invert_transform=this.invertTransform; var _relative_x=invert_transform.TransformPointX(posX,posY);var _relative_y=invert_transform.TransformPointY(posX,posY);var _pos_x_relative_center=_relative_x-this.shapeWidth*.5;var _pos_y_relative_center=_relative_y-this.shapeHeight*.5;if(this.radiusFlag){var _radius=Math.sqrt(_pos_x_relative_center*_pos_x_relative_center+_pos_y_relative_center*_pos_y_relative_center);var _new_radius=this.adjastment.minR+this.coeffR*(_radius-this.minRealR);if(_new_radius<=this.maximalRealativeRadius&&_new_radius>= this.minimalRealativeRadius)this.geometry.gdLst[this.adjastment.gdRefR]=_new_radius;else if(_new_radius>this.maximalRealativeRadius)this.geometry.gdLst[this.adjastment.gdRefR]=this.maximalRealativeRadius;else this.geometry.gdLst[this.adjastment.gdRefR]=this.minimalRealativeRadius}if(this.angleFlag){if(this.geometry.preset==="mathNotEqual"){_pos_y_relative_center=-_pos_y_relative_center;_pos_x_relative_center=-_pos_x_relative_center}var _angle=Math.atan2(_pos_y_relative_center,_pos_x_relative_center); while(_angle<0)_angle+=2*Math.PI;while(_angle>=2*Math.PI)_angle-=2*Math.PI;_angle*=AscFormat.cToDeg;if(_angle>=this.minimalAngle&&_angle<=this.maximalAngle)this.geometry.gdLst[this.adjastment.gdRefAng]=_angle;else if(_angle>=this.maximalAngle)this.geometry.gdLst[this.adjastment.gdRefAng]=this.maximalAngle;else if(_angle<=this.minimalAngle)this.geometry.gdLst[this.adjastment.gdRefAng]=this.minimalAngle}this.geometry.Recalculate(this.shapeWidth,this.shapeHeight)};this.trackEnd=function(){if(!this.bIsTracked)return; var oGeometryToSet;if(!this.bTextWarp){if(!this.originalShape.spPr.geometry)this.originalShape.spPr.setGeometry(this.geometry.createDuplicate());oGeometryToSet=this.originalShape.spPr.geometry;if(this.radiusFlag)oGeometryToSet.setAdjValue(this.adjastment.gdRefR,this.geometry.gdLst[this.adjastment.gdRefR]+"");if(this.angleFlag)oGeometryToSet.setAdjValue(this.adjastment.gdRefAng,this.geometry.gdLst[this.adjastment.gdRefAng]+"");if(this.originalShape.checkExtentsByDocContent)this.originalShape.checkExtentsByDocContent(true, true)}else{var new_body_pr=this.originalShape.getBodyPr();if(new_body_pr){oGeometryToSet=AscFormat.ExecuteNoHistory(function(){var oGeom=this.geometry.createDuplicate();if(this.radiusFlag)oGeom.setAdjValue(this.adjastment.gdRefR,this.geometry.gdLst[this.adjastment.gdRefR]+"");if(this.angleFlag)oGeom.setAdjValue(this.adjastment.gdRefAng,this.geometry.gdLst[this.adjastment.gdRefAng]+"");return oGeom},this,[]);new_body_pr=new_body_pr.createDuplicate();new_body_pr.prstTxWarp=oGeometryToSet;if(this.originalShape.bWordShape)this.originalShape.setBodyPr(new_body_pr); else if(this.originalShape.txBody)this.originalShape.txBody.setBodyPr(new_body_pr)}}}}PolarAdjustmentTrack.prototype.getBounds=XYAdjustmentTrack.prototype.getBounds;window["AscFormat"]=window["AscFormat"]||{};window["AscFormat"].XYAdjustmentTrack=XYAdjustmentTrack;window["AscFormat"].PolarAdjustmentTrack=PolarAdjustmentTrack})(window);"use strict";(function(window,undefined){var CMatrix=AscCommon.CMatrix;var global_MatrixTransformer=AscCommon.global_MatrixTransformer;function MoveShapeImageTrack(originalObject){this.bIsTracked= false;this.originalObject=originalObject;this.transform=new CMatrix;this.x=null;this.y=null;this.pageIndex=null;this.originalShape=originalObject;this.lastDx=0;this.lastDy=0;var nObjectType=originalObject.getObjectType&&originalObject.getObjectType();if(nObjectType===AscDFH.historyitem_type_ChartSpace||nObjectType===AscDFH.historyitem_type_GraphicFrame||nObjectType===AscDFH.historyitem_type_SlicerView){var pen_brush=AscFormat.CreatePenBrushForChartTrack();this.brush=pen_brush.brush;this.pen=pen_brush.pen}else{if(originalObject.blipFill){this.brush= new AscFormat.CUniFill;this.brush.fill=originalObject.blipFill}else this.brush=originalObject.brush;this.pen=originalObject.pen}if(this.originalObject.cropObject&&this.brush)this.brush=this.brush.createDuplicate();if(this.originalObject.cropObject)this.cropObject=this.originalObject.cropObject;this.overlayObject=new AscFormat.OverlayObject(originalObject.getGeom(),this.originalObject.extX,this.originalObject.extY,this.brush,this.pen,this.transform);this.groupInvertMatrix=null;if(this.originalObject.group){this.groupInvertMatrix= this.originalObject.group.invertTransform.CreateDublicate();this.groupInvertMatrix.tx=0;this.groupInvertMatrix.ty=0}this.track=function(dx,dy,pageIndex){this.bIsTracked=true;this.lastDx=dx;this.lastDy=dy;var original=this.originalObject;var dx2,dy2;if(this.groupInvertMatrix){dx2=this.groupInvertMatrix.TransformPointX(dx,dy);dy2=this.groupInvertMatrix.TransformPointY(dx,dy)}else{dx2=dx;dy2=dy}this.x=original.x+dx2;this.y=original.y+dy2;this.transform.Reset();var hc=original.extX*.5;var vc=original.extY* .5;global_MatrixTransformer.TranslateAppend(this.transform,-hc,-vc);if(original.flipH)global_MatrixTransformer.ScaleAppend(this.transform,-1,1);if(original.flipV)global_MatrixTransformer.ScaleAppend(this.transform,1,-1);global_MatrixTransformer.RotateRadAppend(this.transform,-original.rot);global_MatrixTransformer.TranslateAppend(this.transform,this.x+hc,this.y+vc);if(this.originalObject.group)global_MatrixTransformer.MultiplyAppend(this.transform,this.originalObject.group.transform);if(AscFormat.isRealNumber(pageIndex))this.pageIndex= pageIndex;if(this.originalObject.cropObject){var oShapeDrawer=new AscCommon.CShapeDrawer;oShapeDrawer.bIsCheckBounds=true;oShapeDrawer.Graphics=new AscFormat.CSlideBoundsChecker;this.originalObject.check_bounds(oShapeDrawer);this.brush.fill.srcRect=AscFormat.CalculateSrcRect(this.transform,oShapeDrawer,global_MatrixTransformer.Invert(this.originalObject.cropObject.transform),this.originalObject.cropObject.extX,this.originalObject.cropObject.extY)}};this.draw=function(overlay){if(AscFormat.isRealNumber(this.pageIndex)&& overlay.SetCurrentPage)overlay.SetCurrentPage(this.pageIndex);if(this.originalObject.isCrop){var dOldAlpha=null;var oGraphics=overlay.Graphics?overlay.Graphics:overlay;if(AscFormat.isRealNumber(oGraphics.globalAlpha)&&oGraphics.put_GlobalAlpha){dOldAlpha=oGraphics.globalAlpha;oGraphics.put_GlobalAlpha(false,1)}this.overlayObject.draw(overlay);var oldFill=this.brush.fill;this.brush.fill=this.originalObject.cropBrush.fill;this.overlayObject.shapeDrawer.Clear();this.overlayObject.draw(overlay);this.brush.fill= oldFill;var oldSrcRect,oldPen;var parentCrop=this.originalObject.parentCrop;var oShapeDrawer=new AscCommon.CShapeDrawer;oShapeDrawer.bIsCheckBounds=true;oShapeDrawer.Graphics=new AscFormat.CSlideBoundsChecker;parentCrop.check_bounds(oShapeDrawer);var srcRect=AscFormat.CalculateSrcRect(parentCrop.transform,oShapeDrawer,global_MatrixTransformer.Invert(this.transform),this.originalObject.extX,this.originalObject.extY);oldPen=this.originalObject.parentCrop.pen;this.originalObject.parentCrop.pen=AscFormat.CreatePenBrushForChartTrack().pen; if(this.originalObject.parentCrop.blipFill){oldSrcRect=this.originalObject.parentCrop.blipFill.srcRect;this.originalObject.parentCrop.blipFill.srcRect=srcRect;this.originalObject.parentCrop.draw(overlay);this.originalObject.parentCrop.blipFill.srcRect=oldSrcRect}else{oldSrcRect=this.originalObject.parentCrop.brush.fill.srcRect;this.originalObject.parentCrop.brush.fill.srcRect=srcRect;this.originalObject.parentCrop.draw(overlay);this.originalObject.parentCrop.brush.fill.srcRect=oldSrcRect}this.originalObject.parentCrop.pen= oldPen;if(AscFormat.isRealNumber(dOldAlpha)&&oGraphics.put_GlobalAlpha)oGraphics.put_GlobalAlpha(true,dOldAlpha);return}if(this.originalObject.cropObject){var dOldAlpha=null;var oGraphics=overlay.Graphics?overlay.Graphics:overlay;if(AscFormat.isRealNumber(oGraphics.globalAlpha)&&oGraphics.put_GlobalAlpha){dOldAlpha=oGraphics.globalAlpha;oGraphics.put_GlobalAlpha(false,1)}this.originalObject.cropObject.draw(overlay);var oldCropObj=this.originalObject.cropObject;var oldSrcRect,oldTransform,oldPen;var parentCrop= this.originalObject;oldTransform=parentCrop.transform;parentCrop.transform=this.transform;var oShapeDrawer=new AscCommon.CShapeDrawer;oShapeDrawer.bIsCheckBounds=true;oShapeDrawer.Graphics=new AscFormat.CSlideBoundsChecker;parentCrop.check_bounds(oShapeDrawer);var srcRect=AscFormat.CalculateSrcRect(this.transform,oShapeDrawer,global_MatrixTransformer.Invert(oldCropObj.transform),oldCropObj.extX,oldCropObj.extY);oldPen=this.originalObject.pen;this.originalObject.pen=AscFormat.CreatePenBrushForChartTrack().pen; if(this.originalObject.blipFill){oldSrcRect=this.originalObject.blipFill.srcRect;this.originalObject.blipFill.srcRect=srcRect;this.originalObject.draw(overlay);this.originalObject.blipFill.srcRect=oldSrcRect}else{oldSrcRect=this.originalObject.brush.fill.srcRect;this.originalObject.brush.fill.srcRect=srcRect;this.originalObject.draw(overlay);this.originalObject.brush.fill.srcRect=oldSrcRect}this.originalObject.pen=oldPen;parentCrop.transform=oldTransform;if(AscFormat.isRealNumber(dOldAlpha)&&oGraphics.put_GlobalAlpha)oGraphics.put_GlobalAlpha(true, dOldAlpha);return}this.overlayObject.draw(overlay)};this.trackEnd=function(bWord,bNoResetCnx){if(!this.bIsTracked)return;if(bWord)if(this.originalObject.selectStartPage!==this.pageIndex)this.originalObject.selectStartPage=this.pageIndex;var scale_coefficients,ch_off_x,ch_off_y;if(this.originalObject.isCrop)AscFormat.ExecuteNoHistory(function(){AscFormat.CheckSpPrXfrm(this.originalObject)},this,[]);else if(!this.originalObject.group)AscFormat.CheckSpPrXfrm3(this.originalObject,true);else AscFormat.CheckSpPrXfrm(this.originalObject, true);if(this.originalObject.group){scale_coefficients=this.originalObject.group.getResultScaleCoefficients();ch_off_x=this.originalObject.group.spPr.xfrm.chOffX;ch_off_y=this.originalObject.group.spPr.xfrm.chOffY}else{if(bWord&&!this.originalObject.isCrop)if(this.originalObject.spPr.xfrm.offX===0&&this.originalObject.spPr.xfrm.offY===0){if(this.originalObject.cropObject){this.originalObject.transform=this.transform;this.originalObject.invertTransform=AscCommon.global_MatrixTransformer.Invert(this.transform); this.originalObject.calculateSrcRect();var oParaDrawing=this.originalObject.parent;if(oParaDrawing&&oParaDrawing.Check_WrapPolygon)oParaDrawing.Check_WrapPolygon()}return}scale_coefficients={cx:1,cy:1};ch_off_x=0;ch_off_y=0;if(bWord&&!this.originalObject.isCrop){this.x=0;this.y=0}}var _xfrm=this.originalObject.spPr.xfrm;var _x=_xfrm.offX;var _y=_xfrm.offY;if(this.originalObject.isCrop)AscFormat.ExecuteNoHistory(function(){this.originalObject.spPr.xfrm.setOffX(this.x/scale_coefficients.cx+ch_off_x); this.originalObject.spPr.xfrm.setOffY(this.y/scale_coefficients.cy+ch_off_y)},this,[]);else{this.originalObject.spPr.xfrm.setOffX(this.x/scale_coefficients.cx+ch_off_x);this.originalObject.spPr.xfrm.setOffY(this.y/scale_coefficients.cy+ch_off_y)}if(this.originalObject.getObjectType()===AscDFH.historyitem_type_Cnx)if(!AscFormat.fApproxEqual(_x,_xfrm.offX)||!AscFormat.fApproxEqual(_y,_xfrm.offY)){var nvUniSpPr=this.originalObject.nvSpPr.nvUniSpPr;var bResetBegin=false,bResetEnd=false;var oBeginShape= AscCommon.g_oTableId.Get_ById(nvUniSpPr.stCnxId);var oEndShape=AscCommon.g_oTableId.Get_ById(nvUniSpPr.endCnxId);if(oBeginShape)if(oBeginShape.bDeleted)bResetBegin=true;else if(!oBeginShape.selected)bResetBegin=true;if(oEndShape)if(oEndShape.bDeleted)bResetEnd=true;else if(!oEndShape.selected)bResetEnd=true;if((bResetEnd||bResetBegin)&&bNoResetCnx!==false){var _copy_nv_sp_pr=nvUniSpPr.copy();if(bResetBegin){_copy_nv_sp_pr.stCnxId=null;_copy_nv_sp_pr.stCnxIdx=null}if(bResetEnd){_copy_nv_sp_pr.endCnxId= null;_copy_nv_sp_pr.endCnxIdx=null}this.originalObject.nvSpPr.setUniSpPr(_copy_nv_sp_pr)}}if(this.originalObject.isCrop){AscFormat.ExecuteNoHistory(function(){this.originalObject.checkDrawingBaseCoords()},this,[]);this.originalObject.transform=this.transform;this.originalObject.invertTransform=AscCommon.global_MatrixTransformer.Invert(this.transform)}else this.originalObject.checkDrawingBaseCoords();if(this.originalObject.isCrop){if(!this.originalObject.parentCrop.cropObject)this.originalObject.parentCrop.cropObject= this.originalObject;this.originalObject.parentCrop.calculateSrcRect()}if(this.cropObject&&!this.originalObject.cropObject)this.originalObject.cropObject=this.cropObject;if(this.originalObject.cropObject){this.originalObject.transform=this.transform;this.originalObject.invertTransform=AscCommon.global_MatrixTransformer.Invert(this.transform);this.originalObject.calculateSrcRect()}}}MoveShapeImageTrack.prototype.getBounds=function(){var boundsChecker=new AscFormat.CSlideBoundsChecker;this.draw(boundsChecker); var tr=this.transform;var arr_p_x=[];var arr_p_y=[];arr_p_x.push(tr.TransformPointX(0,0));arr_p_y.push(tr.TransformPointY(0,0));arr_p_x.push(tr.TransformPointX(this.originalObject.extX,0));arr_p_y.push(tr.TransformPointY(this.originalObject.extX,0));arr_p_x.push(tr.TransformPointX(this.originalObject.extX,this.originalObject.extY));arr_p_y.push(tr.TransformPointY(this.originalObject.extX,this.originalObject.extY));arr_p_x.push(tr.TransformPointX(0,this.originalObject.extY));arr_p_y.push(tr.TransformPointY(0, this.originalObject.extY));arr_p_x.push(boundsChecker.Bounds.min_x);arr_p_x.push(boundsChecker.Bounds.max_x);arr_p_y.push(boundsChecker.Bounds.min_y);arr_p_y.push(boundsChecker.Bounds.max_y);boundsChecker.Bounds.min_x=Math.min.apply(Math,arr_p_x);boundsChecker.Bounds.max_x=Math.max.apply(Math,arr_p_x);boundsChecker.Bounds.min_y=Math.min.apply(Math,arr_p_y);boundsChecker.Bounds.max_y=Math.max.apply(Math,arr_p_y);boundsChecker.Bounds.posX=this.x;boundsChecker.Bounds.posY=this.y;boundsChecker.Bounds.extX= this.originalObject.extX;boundsChecker.Bounds.extY=this.originalObject.extY;return boundsChecker.Bounds};function MoveGroupTrack(originalObject){this.bIsTracked=false;this.x=null;this.y=null;this.originalObject=originalObject;this.transform=new CMatrix;this.pageIndex=null;this.overlayObjects=[];this.arrTransforms2=[];var arr_graphic_objects=originalObject.getArrGraphicObjects();var group_invert_transform=originalObject.invertTransform;for(var i=0;i0)Flags|=2;return Flags};this.draw=function(overlay){var Flags=this.getFlags();var dd=editor.WordControl.m_oDrawingDocument;overlay.DrawPresentationComment(Flags, this.x,this.y,dd.GetCommentWidth(Flags),dd.GetCommentHeight(Flags))};this.trackEnd=function(){if(!this.bIsTracked)return;this.comment.setPosition(this.x,this.y)};this.getBounds=function(){var dd=editor.WordControl.m_oDrawingDocument;var Flags=this.getFlags();var W=dd.GetCommentWidth(Flags);var H=dd.GetCommentHeight(Flags);var boundsChecker=new AscFormat.CSlideBoundsChecker;boundsChecker.Bounds.min_x=this.x;boundsChecker.Bounds.max_x=this.x+W;boundsChecker.Bounds.min_y=this.y;boundsChecker.Bounds.max_y= this.y+H;boundsChecker.Bounds.posX=this.x;boundsChecker.Bounds.posY=this.y;boundsChecker.Bounds.extX=W;boundsChecker.Bounds.extY=H;return boundsChecker.Bounds}}function MoveChartObjectTrack(oObject,oChartSpace){this.bIsTracked=false;this.originalObject=oObject;this.x=oObject.x;this.y=oObject.y;this.chartSpace=oChartSpace;this.transform=oObject.transform.CreateDublicate();this.overlayObject=new AscFormat.OverlayObject(oObject.calcGeometry?oObject.calcGeometry:AscFormat.ExecuteNoHistory(function(){var geom= AscFormat.CreateGeometry("rect");geom.Recalculate(oObject.extX,oObject.extY);return geom},this,[]),oObject.extX,oObject.extY,oObject.brush,oObject.pen,this.transform);this.track=function(dx,dy){this.bIsTracked=true;var original=this.originalObject;this.x=original.x+dx;this.y=original.y+dy;this.transform.Reset();this.transform.Translate(this.x,this.y,true);this.transform.Multiply(this.chartSpace.transform)};this.draw=function(overlay){if(AscFormat.isRealNumber(this.chartSpace.selectStartPage)&&overlay.SetCurrentPage)overlay.SetCurrentPage(this.chartSpace.selectStartPage); this.overlayObject.draw(overlay)};this.trackEnd=function(){if(!this.bIsTracked)return;History.Create_NewPoint(1);var oObjectToSet=null;if(this.originalObject instanceof AscFormat.CDLbl)oObjectToSet=this.originalObject.checkDlbl();else oObjectToSet=this.originalObject;if(!oObjectToSet)return;if(!oObjectToSet.layout)oObjectToSet.setLayout(new AscFormat.CLayout);if(oObjectToSet.getObjectType()===AscDFH.historyitem_type_PlotArea){oObjectToSet.layout.setLayoutTarget(AscFormat.LAYOUT_TARGET_INNER);oObjectToSet.layout.setXMode(AscFormat.LAYOUT_MODE_EDGE); oObjectToSet.layout.setYMode(AscFormat.LAYOUT_MODE_EDGE);var fLayoutW=this.chartSpace.calculateLayoutBySize(this.resizedPosX,oObjectToSet.layout.wMode,this.chartSpace.extX,oObjectToSet.extX);var fLayoutH=this.chartSpace.calculateLayoutBySize(this.resizedPosY,oObjectToSet.layout.hMode,this.chartSpace.extY,oObjectToSet.extY);oObjectToSet.layout.setW(fLayoutW);oObjectToSet.layout.setH(fLayoutH)}var pos=this.chartSpace.chartObj.recalculatePositionText(this.originalObject);var fLayoutX=this.chartSpace.calculateLayoutByPos(pos.x, oObjectToSet.layout.xMode,this.x,this.chartSpace.extX);var fLayoutY=this.chartSpace.calculateLayoutByPos(pos.y,oObjectToSet.layout.yMode,this.y,this.chartSpace.extY);oObjectToSet.layout.setX(fLayoutX);oObjectToSet.layout.setY(fLayoutY)};this.getBounds=function(){var boundsChecker=new AscFormat.CSlideBoundsChecker;boundsChecker.Bounds.min_x=this.x;boundsChecker.Bounds.max_x=this.x+oObject.extX;boundsChecker.Bounds.min_y=this.y;boundsChecker.Bounds.max_y=this.y+oObject.extY;boundsChecker.Bounds.posX= this.x;boundsChecker.Bounds.posY=this.y;boundsChecker.Bounds.extX=oObject.extX;boundsChecker.Bounds.extY=oObject.extY;return boundsChecker.Bounds}}window["AscFormat"]=window["AscFormat"]||{};window["AscFormat"].MoveShapeImageTrack=MoveShapeImageTrack;window["AscFormat"].MoveGroupTrack=MoveGroupTrack;window["AscFormat"].MoveComment=MoveComment;window["AscFormat"].MoveChartObjectTrack=MoveChartObjectTrack})(window);"use strict";(function(window,undefined){var MIN_SHAPE_SIZE=1.27;var MIN_SHAPE_SIZE_DIV2= MIN_SHAPE_SIZE/2;var SHAPE_ASPECTS={};SHAPE_ASPECTS["can"]=3616635/4810125;SHAPE_ASPECTS["moon"]=457200/914400;SHAPE_ASPECTS["leftBracket"]=73152/914400;SHAPE_ASPECTS["rightBracket"]=73152/914400;SHAPE_ASPECTS["leftBrace"]=155448/914400;SHAPE_ASPECTS["rightBrace"]=155448/914400;SHAPE_ASPECTS["triangle"]=1060704/914400;SHAPE_ASPECTS["parallelogram"]=1216152/914400;SHAPE_ASPECTS["trapezoid"]=914400/1216152;SHAPE_ASPECTS["pentagon"]=960120/914400;SHAPE_ASPECTS["hexagon"]=1060704/914400;SHAPE_ASPECTS["bracePair"]= 1069848/914400;SHAPE_ASPECTS["rightArrow"]=978408/484632;SHAPE_ASPECTS["leftArrow"]=978408/484632;SHAPE_ASPECTS["upArrow"]=484632/978408;SHAPE_ASPECTS["downArrow"]=484632/978408;SHAPE_ASPECTS["leftRightArrow"]=1216152/484632;SHAPE_ASPECTS["upDownArrow"]=484632/1216152;SHAPE_ASPECTS["bentArrow"]=813816/868680;SHAPE_ASPECTS["uturnArrow"]=886968/877824;SHAPE_ASPECTS["bentUpArrow"]=850392/731520;SHAPE_ASPECTS["curvedRightArrow"]=731520/1216152;SHAPE_ASPECTS["curvedLeftArrow"]=731520/1216152;SHAPE_ASPECTS["curvedUpArrow"]= 1216152/731520;SHAPE_ASPECTS["curvedDownArrow"]=1216152/731520;SHAPE_ASPECTS["stripedRightArrow"]=978408/484632;SHAPE_ASPECTS["notchedRightArrow"]=978408/484632;SHAPE_ASPECTS["homePlate"]=978408/484632;SHAPE_ASPECTS["leftRightArrowCallout"]=1216152/576072;SHAPE_ASPECTS["flowChartProcess"]=914400/612648;SHAPE_ASPECTS["flowChartAlternateProcess"]=914400/612648;SHAPE_ASPECTS["flowChartDecision"]=914400/612648;SHAPE_ASPECTS["flowChartInputOutput"]=914400/612648;SHAPE_ASPECTS["flowChartPredefinedProcess"]= 914400/612648;SHAPE_ASPECTS["flowChartDocument"]=914400/612648;SHAPE_ASPECTS["flowChartMultidocument"]=1060704/758952;SHAPE_ASPECTS["flowChartTerminator"]=914400/301752;SHAPE_ASPECTS["flowChartPreparation"]=1060704/612648;SHAPE_ASPECTS["flowChartManualInput"]=914400/457200;SHAPE_ASPECTS["flowChartManualOperation"]=914400/612648;SHAPE_ASPECTS["flowChartPunchedCard"]=914400/804672;SHAPE_ASPECTS["flowChartPunchedTape"]=914400/804672;SHAPE_ASPECTS["flowChartPunchedTape"]=457200/914400;SHAPE_ASPECTS["flowChartSort"]= 457200/914400;SHAPE_ASPECTS["flowChartOnlineStorage"]=914400/612648;SHAPE_ASPECTS["flowChartMagneticDisk"]=914400/612648;SHAPE_ASPECTS["flowChartMagneticDrum"]=914400/685800;SHAPE_ASPECTS["flowChartDisplay"]=914400/612648;SHAPE_ASPECTS["ribbon2"]=1216152/612648;SHAPE_ASPECTS["ribbon"]=1216152/612648;SHAPE_ASPECTS["ellipseRibbon2"]=1216152/758952;SHAPE_ASPECTS["ellipseRibbon"]=1216152/758952;SHAPE_ASPECTS["verticalScroll"]=1033272/1143E3;SHAPE_ASPECTS["horizontalScroll"]=1143E3/1033272;SHAPE_ASPECTS["wedgeRectCallout"]= 914400/612648;SHAPE_ASPECTS["wedgeRoundRectCallout"]=914400/612648;SHAPE_ASPECTS["wedgeEllipseCallout"]=914400/612648;SHAPE_ASPECTS["cloudCallout"]=914400/612648;SHAPE_ASPECTS["borderCallout1"]=914400/612648;SHAPE_ASPECTS["borderCallout2"]=914400/612648;SHAPE_ASPECTS["borderCallout3"]=914400/612648;SHAPE_ASPECTS["accentCallout1"]=914400/612648;SHAPE_ASPECTS["accentCallout2"]=914400/612648;SHAPE_ASPECTS["accentCallout3"]=914400/612648;SHAPE_ASPECTS["callout1"]=914400/612648;SHAPE_ASPECTS["callout2"]= 914400/612648;SHAPE_ASPECTS["callout3"]=914400/612648;SHAPE_ASPECTS["accentBorderCallout1"]=914400/612648;SHAPE_ASPECTS["accentBorderCallout2"]=914400/612648;SHAPE_ASPECTS["accentBorderCallout3"]=914400/612648;function NewShapeTrack(presetGeom,startX,startY,theme,master,layout,slide,pageIndex,drawingsController){this.presetGeom=presetGeom;this.startX=startX;this.startY=startY;this.x=null;this.y=null;this.extX=null;this.extY=null;this.rot=0;this.arrowsCount=0;this.transform=new AscCommon.CMatrix;this.pageIndex= pageIndex;this.theme=theme;this.drawingsController=drawingsController;this.bConnector=false;this.startConnectionInfo=null;this.oShapeDrawConnectors=null;this.lastSpPr=null;this.startShape=null;this.endShape=null;this.endConnectionInfo=null;AscFormat.ExecuteNoHistory(function(){if(this.drawingsController){this.bConnector=AscFormat.isConnectorPreset(presetGeom);if(this.bConnector){var aSpTree=[];this.drawingsController.getAllSingularDrawings(this.drawingsController.getDrawingArray(),aSpTree);var oConnector= null;for(var i=aSpTree.length-1;i>-1;--i){oConnector=aSpTree[i].findConnector(startX,startY);if(oConnector){this.startConnectionInfo=oConnector;this.startX=oConnector.x;this.startY=oConnector.y;this.startShape=aSpTree[i];break}}}}var style;if(presetGeom.indexOf("WithArrow")>-1){presetGeom=presetGeom.substr(0,presetGeom.length-9);this.presetGeom=presetGeom;this.arrowsCount=1}if(presetGeom.indexOf("WithTwoArrows")>-1){presetGeom=presetGeom.substr(0,presetGeom.length-13);this.presetGeom=presetGeom;this.arrowsCount= 2}var spDef=theme.spDef;if(presetGeom!=="textRect")if(spDef&&spDef.style)style=spDef.style.createDuplicate();else style=AscFormat.CreateDefaultShapeStyle(this.presetGeom);else style=AscFormat.CreateDefaultTextRectStyle();var brush=theme.getFillStyle(style.fillRef.idx);style.fillRef.Color.Calculate(theme,slide,layout,master,{R:0,G:0,B:0,A:255});var RGBA=style.fillRef.Color.RGBA;if(style.fillRef.Color.color)if(brush.fill&&brush.fill.type===Asc.c_oAscFill.FILL_TYPE_SOLID)brush.fill.color=style.fillRef.Color.createDuplicate(); var pen=theme.getLnStyle(style.lnRef.idx,style.lnRef.Color);style.lnRef.Color.Calculate(theme,slide,layout,master);RGBA=style.lnRef.Color.RGBA;if(presetGeom==="textRect"){var ln,fill;ln=new AscFormat.CLn;ln.w=6350;ln.Fill=new AscFormat.CUniFill;ln.Fill.fill=new AscFormat.CSolidFill;ln.Fill.fill.color=new AscFormat.CUniColor;ln.Fill.fill.color.color=new AscFormat.CPrstColor;ln.Fill.fill.color.color.id="black";fill=new AscFormat.CUniFill;fill.fill=new AscFormat.CSolidFill;fill.fill.color=new AscFormat.CUniColor; fill.fill.color.color=new AscFormat.CSchemeColor;fill.fill.color.color.id=12;pen.merge(ln);brush.merge(fill);if(slide){brush=AscFormat.CreateNoFillUniFill();pen=AscFormat.CreateNoFillLine()}}if(this.arrowsCount>0){pen.setTailEnd(new AscFormat.EndArrow);pen.tailEnd.setType(AscFormat.LineEndType.Arrow);pen.tailEnd.setLen(AscFormat.LineEndSize.Mid);if(this.arrowsCount===2){pen.setHeadEnd(new AscFormat.EndArrow);pen.headEnd.setType(AscFormat.LineEndType.Arrow);pen.headEnd.setLen(AscFormat.LineEndSize.Mid)}}if(presetGeom!== "textRect")if(spDef&&spDef.spPr){if(spDef.spPr.Fill)brush.merge(spDef.spPr.Fill);if(spDef.spPr.ln)pen.merge(spDef.spPr.ln)}var geometry=AscFormat.CreateGeometry(presetGeom!=="textRect"?presetGeom:"rect");this.startGeom=geometry;if(pen.Fill)pen.Fill.calculate(theme,slide,layout,master,RGBA);brush.calculate(theme,slide,layout,master,RGBA);this.isLine=this.presetGeom==="line";this.overlayObject=new AscFormat.OverlayObject(geometry,5,5,brush,pen,this.transform);this.shape=null},this,[]);this.track=function(e, x,y){var bConnectorHandled=false;this.oShapeDrawConnectors=null;this.lastSpPr=null;this.endShape=null;this.endConnectionInfo=null;if(this.bConnector){var aSpTree=[];this.drawingsController.getAllSingularDrawings(this.drawingsController.getDrawingArray(),aSpTree);var oConnector=null;var oEndConnectionInfo=null;for(var i=aSpTree.length-1;i>-1;--i){oConnector=aSpTree[i].findConnector(x,y);if(oConnector){oEndConnectionInfo=oConnector;this.oShapeDrawConnectors=aSpTree[i];this.endShape=aSpTree[i];this.endConnectionInfo= oEndConnectionInfo;break}}if(this.startConnectionInfo||oEndConnectionInfo){var _startInfo=this.startConnectionInfo;var _endInfo=oEndConnectionInfo;if(!_startInfo)_startInfo=AscFormat.fCalculateConnectionInfo(_endInfo,this.startX,this.startY);else if(!_endInfo)_endInfo=AscFormat.fCalculateConnectionInfo(_startInfo,x,y);var oSpPr=AscFormat.fCalculateSpPr(_startInfo,_endInfo,this.presetGeom,this.overlayObject.pen.w);this.flipH=oSpPr.xfrm.flipH===true;this.flipV=oSpPr.xfrm.flipV===true;this.rot=AscFormat.isRealNumber(oSpPr.xfrm.rot)? oSpPr.xfrm.rot:0;this.extX=oSpPr.xfrm.extX;this.extY=oSpPr.xfrm.extY;this.x=oSpPr.xfrm.offX;this.y=oSpPr.xfrm.offY;this.overlayObject=new AscFormat.OverlayObject(oSpPr.geometry,5,5,this.overlayObject.brush,this.overlayObject.pen,this.transform);bConnectorHandled=true;this.lastSpPr=oSpPr}if(!this.oShapeDrawConnectors)for(var i=aSpTree.length-1;i>-1;--i){var oCs=aSpTree[i].findConnectionShape(x,y);if(oCs){oEndConnectionInfo=oConnector;this.oShapeDrawConnectors=oCs;break}}if(false===bConnectorHandled)this.overlayObject= new AscFormat.OverlayObject(this.startGeom,5,5,this.overlayObject.brush,this.overlayObject.pen,this.transform)}if(false===bConnectorHandled){var real_dist_x=x-this.startX;var abs_dist_x=Math.abs(real_dist_x);var real_dist_y=y-this.startY;var abs_dist_y=Math.abs(real_dist_y);this.flipH=false;this.flipV=false;this.rot=0;if(this.isLine||this.bConnector){if(x= MIN_SHAPE_SIZE?abs_dist_x:this.isLine?0:MIN_SHAPE_SIZE;this.extY=abs_dist_y>=MIN_SHAPE_SIZE?abs_dist_y:this.isLine?0:MIN_SHAPE_SIZE;if(real_dist_x>=0)this.x=this.startX;else this.x=abs_dist_x>=MIN_SHAPE_SIZE?x:this.startX-this.extX;if(real_dist_y>=0)this.y=this.startY;else this.y=abs_dist_y>=MIN_SHAPE_SIZE?y:this.startY-this.extY}else if(e.CtrlKey&&!e.ShiftKey){if(abs_dist_x>=MIN_SHAPE_SIZE_DIV2){this.x=this.startX-abs_dist_x;this.extX=2*abs_dist_x}else{this.x=this.startX-MIN_SHAPE_SIZE_DIV2;this.extX= MIN_SHAPE_SIZE}if(abs_dist_y>=MIN_SHAPE_SIZE_DIV2){this.y=this.startY-abs_dist_y;this.extY=2*abs_dist_y}else{this.y=this.startY-MIN_SHAPE_SIZE_DIV2;this.extY=MIN_SHAPE_SIZE}}else if(!e.CtrlKey&&e.ShiftKey){var new_width,new_height;var prop_coefficient=typeof AscFormat.SHAPE_ASPECTS[this.presetGeom]==="number"?AscFormat.SHAPE_ASPECTS[this.presetGeom]:1;if(abs_dist_y===0){new_width=abs_dist_x>MIN_SHAPE_SIZE?abs_dist_x:MIN_SHAPE_SIZE;new_height=abs_dist_x/prop_coefficient}else{var new_aspect=abs_dist_x/ abs_dist_y;if(new_aspect>=prop_coefficient){new_width=abs_dist_x;new_height=abs_dist_x/prop_coefficient}else{new_height=abs_dist_y;new_width=abs_dist_y*prop_coefficient}}if(new_width=0)this.x=this.startX;else this.x=this.startX-this.extX;if(real_dist_y>=0)this.y=this.startY;else this.y=this.startY-this.extY;if(this.isLine){var angle=Math.atan2(real_dist_y,real_dist_x);if(angle>=0&&angle<=Math.PI/8||angle<=0&&angle>=-Math.PI/8||angle>=7*Math.PI/8&&angle<=Math.PI){this.extY=0;this.y=this.startY}else if(angle>=3*Math.PI/8&&angle<=5*Math.PI/8|| angle<=-3*Math.PI/8&&angle>=-5*Math.PI/8){this.extX=0;this.x=this.startX}}}else{var new_width,new_height;var prop_coefficient=typeof AscFormat.SHAPE_ASPECTS[this.presetGeom]==="number"?AscFormat.SHAPE_ASPECTS[this.presetGeom]:1;if(abs_dist_y===0){new_width=abs_dist_x>MIN_SHAPE_SIZE_DIV2?abs_dist_x*2:MIN_SHAPE_SIZE;new_height=new_width/prop_coefficient}else{var new_aspect=abs_dist_x/abs_dist_y;if(new_aspect>=prop_coefficient){new_width=abs_dist_x*2;new_height=new_width/prop_coefficient}else{new_height= abs_dist_y*2;new_width=new_height*prop_coefficient}}if(new_width0){var ln=new AscFormat.CLn;ln.setTailEnd(new AscFormat.EndArrow);ln.tailEnd.setType(AscFormat.LineEndType.Arrow);ln.tailEnd.setLen(AscFormat.LineEndSize.Mid);if(this.arrowsCount===2){ln.setHeadEnd(new AscFormat.EndArrow);ln.headEnd.setType(AscFormat.LineEndType.Arrow);ln.headEnd.setLen(AscFormat.LineEndSize.Mid)}shape.spPr.setLn(ln)}var spDef=this.theme&&this.theme.spDef;if(spDef){if(spDef.style)shape.setStyle(spDef.style.createDuplicate()); if(spDef.spPr){if(spDef.spPr.Fill)shape.spPr.setFill(spDef.spPr.Fill.createDuplicate());if(spDef.spPr.ln)if(shape.spPr.ln)shape.spPr.ln.merge(spDef.spPr.ln);else shape.spPr.setLn(spDef.spPr.ln.createDuplicate())}}}shape.x=this.x;shape.y=this.y;return shape};this.getBounds=function(){var boundsChecker=new AscFormat.CSlideBoundsChecker;this.draw(boundsChecker);var tr=this.transform;var arr_p_x=[];var arr_p_y=[];arr_p_x.push(tr.TransformPointX(0,0));arr_p_y.push(tr.TransformPointY(0,0));arr_p_x.push(tr.TransformPointX(this.extX, 0));arr_p_y.push(tr.TransformPointY(this.extX,0));arr_p_x.push(tr.TransformPointX(this.extX,this.extY));arr_p_y.push(tr.TransformPointY(this.extX,this.extY));arr_p_x.push(tr.TransformPointX(0,this.extY));arr_p_y.push(tr.TransformPointY(0,this.extY));arr_p_x.push(boundsChecker.Bounds.min_x);arr_p_x.push(boundsChecker.Bounds.max_x);arr_p_y.push(boundsChecker.Bounds.min_y);arr_p_y.push(boundsChecker.Bounds.max_y);boundsChecker.Bounds.min_x=Math.min.apply(Math,arr_p_x);boundsChecker.Bounds.max_x=Math.max.apply(Math, arr_p_x);boundsChecker.Bounds.min_y=Math.min.apply(Math,arr_p_y);boundsChecker.Bounds.max_y=Math.max.apply(Math,arr_p_y);boundsChecker.Bounds.posX=this.x;boundsChecker.Bounds.posY=this.y;boundsChecker.Bounds.extX=this.extX;boundsChecker.Bounds.extY=this.extY;return boundsChecker.Bounds}}window["AscFormat"]=window["AscFormat"]||{};window["AscFormat"].SHAPE_ASPECTS=SHAPE_ASPECTS;window["AscFormat"].NewShapeTrack=NewShapeTrack})(window);"use strict";(function(window,undefined){function CPoint(x,y,bTemporary){this.x= x;this.y=y;this.bTemporary=bTemporary===true}CPoint.prototype.reset=function(x,y,bTemporary){this.x=x;this.y=y;this.bTemporary=bTemporary===true};CPoint.prototype.distance=function(x,y){var dx=this.x-x;var dy=this.y-y;return Math.sqrt(dx*dx+dy*dy)};CPoint.prototype.distanceFromOther=function(oPoint){return this.distance(oPoint.x,oPoint.y)};CPoint.prototype.isNear=function(x,y){return this.distance(x,y)1){var dx=this.arrPoint[0].x-this.arrPoint[nLastIndex].x;var dy=this.arrPoint[0].y-this.arrPoint[nLastIndex].y;if(Math.sqrt(dx*dx+dy*dy)xMax)xMax=this.arrPoint[i].x;if(this.arrPoint[i].y>yMax)yMax=this.arrPoint[i].y;if(this.arrPoint[i].x0){pathW=43200;kw=43200/w}else{pathW=0;kw=0}if(h>0){pathH=43200;kh=43200/h}else{pathH=0;kh=0}geometry.AddPathCommand(0,undefined,bClosed?"norm":"none",undefined,pathW,pathH);geometry.AddRect("l","t","r","b");geometry.AddPathCommand(1,((this.arrPoint[0].x-xMin)* kw>>0)+"",((this.arrPoint[0].y-yMin)*kh>>0)+"");for(i=1;i<_n;++i)geometry.AddPathCommand(2,((this.arrPoint[i].x-xMin)*kw>>0)+"",((this.arrPoint[i].y-yMin)*kh>>0)+"");if(bClosed)geometry.AddPathCommand(6);shape.spPr.setGeometry(geometry);shape.setBDeleted(false);shape.recalculate();shape.x=xMin;shape.y=yMin;return shape};PolyLine.prototype.tryAddPoint=function(x,y){var oLastPoint=this.arrPoint[this.arrPoint.length-1];if(!oLastPoint){this.addPoint(x,y);return}if(oLastPoint.isNear(x,y)){oLastPoint.reset(x, y);return}this.addPoint(x,y)};PolyLine.prototype.addPoint=function(x,y,bTemporary){this.arrPoint.push(new CPoint(x,y,bTemporary))};PolyLine.prototype.replaceLastPoint=function(x,y,bTemporary){var oLastPoint=this.arrPoint[this.arrPoint.length-1];if(!oLastPoint){this.addPoint(x,y,bTemporary);return}oLastPoint.reset(x,y,bTemporary)};PolyLine.prototype.canCreateShape=function(){var nCount=this.arrPoint.length;if(nCount<2)return false;var oLast=this.arrPoint[this.arrPoint.length-1];if(oLast.bTemporary)--nCount; return nCount>1};PolyLine.prototype.getPointsCount=function(){return this.arrPoint.length};function PolylineForDrawer(polyline){this.polyline=polyline;this.pen=polyline.pen;this.brush=polyline.brush;this.TransformMatrix=polyline.TransformMatrix;this.Matrix=polyline.Matrix;this.Draw=function(graphics){graphics.SetIntegerGrid(false);graphics.transform3(this.Matrix);var shape_drawer=new AscCommon.CShapeDrawer;shape_drawer.fromShape(this,graphics);shape_drawer.draw(this)};this.draw=function(g){g._e(); if(this.polyline.arrPoint.length<2)return;g._m(this.polyline.arrPoint[0].x,this.polyline.arrPoint[0].y);for(var i=1;i-1;--i){if(aDrawings[i]===this.originalObject)continue; oConnectionInfo=aDrawings[i].findConnector(x,y);if(oConnectionInfo){oNewShape=aDrawings[i];this.oNewShape=oNewShape;break}}if(!this.oNewShape)for(var i=aDrawings.length-1;i>-1;--i){if(aDrawings[i]===this.originalObject)continue;var oCs=aDrawings[i].findConnectionShape(x,y);if(oCs){this.oNewShape=oCs;break}}var _beginConnectionInfo,_endConnectionInfo;if(this.numberHandle===0){if(oEndShape){var oConectionObject=oEndShape.getGeom().cnxLst[oConnectorInfo.endCnxIdx];var g_conn_info={idx:oConnectorInfo.endCnxIdx, ang:oConectionObject.ang,x:oConectionObject.x,y:oConectionObject.y};var _flipH=oEndShape.flipH;var _flipV=oEndShape.flipV;var _rot=oEndShape.rot;if(oEndShape.group){_rot=AscFormat.normalizeRotate(oEndShape.group.getFullRotate()+_rot);if(oEndShape.group.getFullFlipH())_flipH=!_flipH;if(oEndShape.group.getFullFlipV())_flipV=!_flipV}_endConnectionInfo=oEndShape.convertToConnectionParams(_rot,_flipH,_flipV,oEndShape.transform,oEndShape.bounds,g_conn_info)}_beginConnectionInfo=oConnectionInfo;if(_beginConnectionInfo){this.beginShapeId= this.oNewShape.Id;this.beginShapeIdx=_beginConnectionInfo.idx}}else{if(oBeginShape){var oConectionObject=oBeginShape.getGeom().cnxLst[oConnectorInfo.stCnxIdx];var g_conn_info={idx:oConnectorInfo.stCnxIdx,ang:oConectionObject.ang,x:oConectionObject.x,y:oConectionObject.y};var _flipH=oBeginShape.flipH;var _flipV=oBeginShape.flipV;var _rot=oBeginShape.rot;if(oBeginShape.group){_rot=AscFormat.normalizeRotate(oBeginShape.group.getFullRotate()+_rot);if(oBeginShape.group.getFullFlipH())_flipH=!_flipH;if(oBeginShape.group.getFullFlipV())_flipV= !_flipV}_beginConnectionInfo=oBeginShape.convertToConnectionParams(_rot,_flipH,_flipV,oBeginShape.transform,oBeginShape.bounds,g_conn_info)}_endConnectionInfo=oConnectionInfo;if(_endConnectionInfo){this.endShapeId=this.oNewShape.Id;this.endShapeIdx=_endConnectionInfo.idx}}var _x,_y;if(_beginConnectionInfo||_endConnectionInfo){if(!_beginConnectionInfo)if(this.numberHandle===0)_beginConnectionInfo=AscFormat.fCalculateConnectionInfo(_endConnectionInfo,x,y);else{_x=this.originalObject.transform.TransformPointX(0, 0);_y=this.originalObject.transform.TransformPointY(0,0);_beginConnectionInfo=AscFormat.fCalculateConnectionInfo(_endConnectionInfo,_x,_y)}if(!_endConnectionInfo)if(this.numberHandle===0){_x=this.originalObject.transform.TransformPointX(this.originalObject.extX,this.originalObject.extY);_y=this.originalObject.transform.TransformPointY(this.originalObject.extX,this.originalObject.extY);_endConnectionInfo=AscFormat.fCalculateConnectionInfo(_beginConnectionInfo,_x,_y)}else _endConnectionInfo=AscFormat.fCalculateConnectionInfo(_beginConnectionInfo, x,y)}if(_beginConnectionInfo&&_endConnectionInfo){this.oSpPr=AscFormat.fCalculateSpPr(_beginConnectionInfo,_endConnectionInfo,this.originalObject.spPr.geometry.preset,this.overlayObject.pen.w);if(this.originalObject.group){var _xc=this.oSpPr.xfrm.offX+this.oSpPr.xfrm.extX/2;var _yc=this.oSpPr.xfrm.offY+this.oSpPr.xfrm.extY/2;var xc=this.originalObject.group.invertTransform.TransformPointX(_xc,_yc);var yc=this.originalObject.group.invertTransform.TransformPointY(_xc,_yc);this.oSpPr.xfrm.setOffX(xc- this.oSpPr.xfrm.extX/2);this.oSpPr.xfrm.setOffY(yc-this.oSpPr.xfrm.extY/2);this.oSpPr.xfrm.setFlipH(this.originalObject.group.getFullFlipH()?!this.oSpPr.xfrm.flipH:this.oSpPr.xfrm.flipH);this.oSpPr.xfrm.setFlipV(this.originalObject.group.getFullFlipV()?!this.oSpPr.xfrm.flipV:this.oSpPr.xfrm.flipV);this.oSpPr.xfrm.setRot(AscFormat.normalizeRotate(this.oSpPr.xfrm.rot-this.originalObject.group.getFullRotate()))}var _xfrm=this.oSpPr.xfrm;this.resizedExtX=_xfrm.extX;this.resizedExtY=_xfrm.extY;this.resizedflipH= _xfrm.flipH;this.resizedflipV=_xfrm.flipV;this.resizedPosX=_xfrm.offX;this.resizedPosY=_xfrm.offY;this.resizedRot=_xfrm.rot;this.recalculateTransform();this.geometry=this.oSpPr.geometry;this.overlayObject.geometry=this.geometry;this.geometry.Recalculate(this.oSpPr.xfrm.extX,this.oSpPr.xfrm.extY)}else{this.oSpPr=null;this.resizedRot=this.originalObject.rot;this.geometry=AscFormat.ExecuteNoHistory(function(){return originalObject.spPr.geometry.createDuplicate()},this,[]);this.overlayObject.geometry= this.geometry;this.resize(kd1,kd2,e.ShiftKey)}};this.track=function(kd1,kd2,e,x,y){AscFormat.ExecuteNoHistory(function(){this.bIsTracked=true;if(this.bConnector)this.resizeConnector(kd1,kd2,e,x,y);else if(!e.CtrlKey)this.resize(kd1,kd2,e.ShiftKey);else this.resizeRelativeCenter(kd1,kd2,e.ShiftKey)},this,[])};this.resize=function(kd1,kd2,ShiftKey){this.bLastCenter=false;var _cos=this.cos;var _sin=this.sin;var _real_height,_real_width;var _abs_height,_abs_width;var _new_resize_half_width;var _new_resize_half_height; var _new_used_half_width;var _new_used_half_height;var _temp;if(this.originalObject.getObjectType&&this.originalObject.getObjectType()===AscDFH.historyitem_type_GraphicFrame){if(kd1<0)kd1=0;if(kd2<0)kd2=0}var isCrop=this.originalObject.isCrop||!!this.originalObject.cropObject;if((ShiftKey===true||window.AscAlwaysSaveAspectOnResizeTrack===true&&!this.isLine||!isCrop&&this.originalObject.getNoChangeAspect())&&this.bAspect===true){var _new_aspect=this.aspect*Math.abs(kd1/kd2);if(_new_aspect>=this.aspect)kd2= Math.abs(kd1)*(kd2>=0?1:-1);else kd1=Math.abs(kd2)*(kd1>=0?1:-1)}if(this.bChangeCoef){_temp=kd1;kd1=kd2;kd2=_temp}switch(this.translatetNumberHandle){case 0:case 1:{if(this.translatetNumberHandle===0){_real_width=this.usedExtX*kd1;_abs_width=Math.abs(_real_width);if(!this.isLine)this.resizedExtX=_abs_width>=MIN_SHAPE_SIZE?_abs_width:MIN_SHAPE_SIZE;else this.resizedExtX=_abs_width>=MIN_SHAPE_SIZE?_abs_width:0;if(_real_width<0)this.resizedflipH=!this.originalFlipH;else this.resizedflipH=this.originalFlipH}if(this.translatetNumberHandle=== 1){_temp=kd1;kd1=kd2;kd2=_temp}_real_height=this.usedExtY*kd2;_abs_height=Math.abs(_real_height);if(!this.isLine)this.resizedExtY=_abs_height>=MIN_SHAPE_SIZE?_abs_height:MIN_SHAPE_SIZE;else this.resizedExtY=_abs_height>=MIN_SHAPE_SIZE?_abs_height:0;this.resizedExtY=_abs_height>=MIN_SHAPE_SIZE||this.isLine?_abs_height:MIN_SHAPE_SIZE;if(_real_height<0){this.resizedflipV=!this.originalFlipV;if(this.isLine&&ShiftKey)this.resizedflipH=!this.originalFlipH}else{this.resizedflipV=this.originalFlipV;if(this.isLine&& ShiftKey&&this.resizedflipH!==this.originalFlipH)this.resizedflipV=!this.originalFlipV}_new_resize_half_width=this.resizedExtX*.5;_new_resize_half_height=this.resizedExtY*.5;if(this.resizedflipH!==this.originalFlipH)_new_used_half_width=-_new_resize_half_width;else _new_used_half_width=_new_resize_half_width;if(this.resizedflipV!==this.originalFlipV)_new_used_half_height=-_new_resize_half_height;else _new_used_half_height=_new_resize_half_height;this.resizedPosX=this.fixedPointX+(-_new_used_half_width* _cos+_new_used_half_height*_sin)-_new_resize_half_width;this.resizedPosY=this.fixedPointY+(-_new_used_half_width*_sin-_new_used_half_height*_cos)-_new_resize_half_height;break}case 2:case 3:{if(this.translatetNumberHandle===2){_temp=kd2;kd2=kd1;kd1=_temp;_real_height=this.usedExtY*kd2;_abs_height=Math.abs(_real_height);this.resizedExtY=_abs_height>=MIN_SHAPE_SIZE?_abs_height:this.isLine?0:MIN_SHAPE_SIZE;if(_real_height<0)this.resizedflipV=!this.originalFlipV;else this.resizedflipV=this.originalFlipV}_real_width= this.usedExtX*kd1;_abs_width=Math.abs(_real_width);this.resizedExtX=_abs_width>=MIN_SHAPE_SIZE?_abs_width:this.isLine?0:MIN_SHAPE_SIZE;if(_real_width<0){this.resizedflipH=!this.originalFlipH;if(this.isLine&&ShiftKey)this.resizedflipV=!this.originalFlipV}else{this.resizedflipH=this.originalFlipH;if(this.isLine&&ShiftKey&&this.resizedflipV!==this.originalFlipV)this.resizedflipH=!this.originalFlipH}_new_resize_half_width=this.resizedExtX*.5;_new_resize_half_height=this.resizedExtY*.5;if(this.resizedflipH!== this.originalFlipH)_new_used_half_width=-_new_resize_half_width;else _new_used_half_width=_new_resize_half_width;if(this.resizedflipV!==this.originalFlipV)_new_used_half_height=-_new_resize_half_height;else _new_used_half_height=_new_resize_half_height;this.resizedPosX=this.fixedPointX+(_new_used_half_width*_cos+_new_used_half_height*_sin)-_new_resize_half_width;this.resizedPosY=this.fixedPointY+(_new_used_half_width*_sin-_new_used_half_height*_cos)-_new_resize_half_height;break}case 4:case 5:{if(this.translatetNumberHandle=== 4){_real_width=this.usedExtX*kd1;_abs_width=Math.abs(_real_width);this.resizedExtX=_abs_width>=MIN_SHAPE_SIZE?_abs_width:this.isLine?0:MIN_SHAPE_SIZE;if(_real_width<0)this.resizedflipH=!this.originalFlipH;else this.resizedflipH=this.originalFlipH}else{_temp=kd2;kd2=kd1;kd1=_temp}_real_height=this.usedExtY*kd2;_abs_height=Math.abs(_real_height);this.resizedExtY=_abs_height>=MIN_SHAPE_SIZE?_abs_height:this.isLine?0:MIN_SHAPE_SIZE;if(_real_height<0){this.resizedflipV=!this.originalFlipV;if(this.isLine&& ShiftKey)this.resizedflipH=!this.originalFlipH}else{this.resizedflipV=this.originalFlipV;if(this.isLine&&ShiftKey&&this.resizedflipH!==this.originalFlipH)this.resizedflipV=!this.originalFlipV}_new_resize_half_width=this.resizedExtX*.5;_new_resize_half_height=this.resizedExtY*.5;if(this.resizedflipH!==this.originalFlipH)_new_used_half_width=-_new_resize_half_width;else _new_used_half_width=_new_resize_half_width;if(this.resizedflipV!==this.originalFlipV)_new_used_half_height=-_new_resize_half_height; else _new_used_half_height=_new_resize_half_height;this.resizedPosX=this.fixedPointX+(_new_used_half_width*_cos-_new_used_half_height*_sin)-_new_resize_half_width;this.resizedPosY=this.fixedPointY+(_new_used_half_width*_sin+_new_used_half_height*_cos)-_new_resize_half_height;break}case 6:case 7:{if(this.translatetNumberHandle===6){_real_height=this.usedExtY*kd1;_abs_height=Math.abs(_real_height);this.resizedExtY=_abs_height>=MIN_SHAPE_SIZE?_abs_height:this.isLine?0:MIN_SHAPE_SIZE;if(_real_height< 0)this.resizedflipV=!this.originalFlipV;else this.resizedflipV=this.originalFlipV}else{_temp=kd2;kd2=kd1;kd1=_temp}_real_width=this.usedExtX*kd2;_abs_width=Math.abs(_real_width);this.resizedExtX=_abs_width>=MIN_SHAPE_SIZE?_abs_width:this.isLine?0:MIN_SHAPE_SIZE;if(_real_width<0){this.resizedflipH=!this.originalFlipH;if(this.isLine&&ShiftKey)this.resizedflipV=!this.originalFlipV}else{this.resizedflipH=this.originalFlipH;if(this.isLine&&ShiftKey&&this.resizedflipV!==this.originalFlipV)this.resizedflipH= !this.originalFlipH}_new_resize_half_width=this.resizedExtX*.5;_new_resize_half_height=this.resizedExtY*.5;if(this.resizedflipH!==this.originalFlipH)_new_used_half_width=-_new_resize_half_width;else _new_used_half_width=_new_resize_half_width;if(this.resizedflipV!==this.originalFlipV)_new_used_half_height=-_new_resize_half_height;else _new_used_half_height=_new_resize_half_height;this.resizedPosX=this.fixedPointX+(-_new_used_half_width*_cos-_new_used_half_height*_sin)-_new_resize_half_width;this.resizedPosY= this.fixedPointY+(-_new_used_half_width*_sin+_new_used_half_height*_cos)-_new_resize_half_height;break}}if(isCrop){this.resizedflipH=this.originalFlipH;this.resizedflipV=this.originalFlipV}if(this.originalObject.signatureLine||this.originalObject.getObjectType&&this.originalObject.getObjectType()===AscDFH.historyitem_type_OleObject){this.resizedflipH=false;this.resizedflipV=false}this.geometry.Recalculate(this.resizedExtX,this.resizedExtY);this.overlayObject.updateExtents(this.resizedExtX,this.resizedExtY); this.recalculateTransform();if(this.bConnector)if(this.numberHandle===0){this.beginShapeIdx=null;this.beginShapeId=null}else{this.endShapeIdx=null;this.endShapeId=null}};this.resizeRelativeCenter=function(kd1,kd2,ShiftKey){if(this.isLine){this.resize(kd1,kd2,ShiftKey);return}this.bLastCenter=true;kd1=2*kd1-1;kd2=2*kd2-1;if(this.originalObject.getObjectType&&this.originalObject.getObjectType()===AscDFH.historyitem_type_GraphicFrame){if(kd1<0)kd1=0;if(kd2<0)kd2=0}var _real_height,_real_width;var _abs_height, _abs_width;var isCrop=this.originalObject.isCrop||!!this.originalObject.cropObject;if((ShiftKey===true||window.AscAlwaysSaveAspectOnResizeTrack===true||!isCrop&&this.originalObject.getNoChangeAspect())&&this.bAspect===true){var _new_aspect=this.aspect*Math.abs(kd1/kd2);if(_new_aspect>=this.aspect)kd2=Math.abs(kd1)*(kd2>=0?1:-1);else kd1=Math.abs(kd2)*(kd1>=0?1:-1)}var _temp;if(this.bChangeCoef){_temp=kd1;kd1=kd2;kd2=_temp}if(this.mod===0||this.mod===1){if(this.mod===0){_real_width=this.usedExtX*kd1; _abs_width=Math.abs(_real_width);this.resizedExtX=_abs_width>=MIN_SHAPE_SIZE||this.isLine?_abs_width:MIN_SHAPE_SIZE;this.resizedflipH=_real_width<0?!this.originalFlipH:this.originalFlipH}else{_temp=kd1;kd1=kd2;kd2=_temp}_real_height=this.usedExtY*kd2;_abs_height=Math.abs(_real_height);this.resizedExtY=_abs_height>=MIN_SHAPE_SIZE||this.isLine?_abs_height:MIN_SHAPE_SIZE;this.resizedflipV=_real_height<0?!this.originalFlipV:this.originalFlipV}else{if(this.mod===2){_temp=kd1;kd1=kd2;kd2=_temp;_real_height= this.usedExtY*kd2;_abs_height=Math.abs(_real_height);this.resizedExtY=_abs_height>=MIN_SHAPE_SIZE||this.isLine?_abs_height:MIN_SHAPE_SIZE;this.resizedflipV=_real_height<0?!this.originalFlipV:this.originalFlipV}_real_width=this.usedExtX*kd1;_abs_width=Math.abs(_real_width);this.resizedExtX=_abs_width>=MIN_SHAPE_SIZE||this.isLine?_abs_width:MIN_SHAPE_SIZE;this.resizedflipH=_real_width<0?!this.originalFlipH:this.originalFlipH}if(isCrop){this.resizedflipH=this.originalFlipH;this.resizedflipV=this.originalFlipV}this.resizedPosX= this.centerPointX-this.resizedExtX*.5;this.resizedPosY=this.centerPointY-this.resizedExtY*.5;this.geometry.Recalculate(this.resizedExtX,this.resizedExtY);this.overlayObject.updateExtents(this.resizedExtX,this.resizedExtY);this.recalculateTransform()};this.recalculateTransform=function(){var _transform=this.transform;_transform.Reset();var _horizontal_center=this.resizedExtX*.5;var _vertical_center=this.resizedExtY*.5;global_MatrixTransformer.TranslateAppend(_transform,-_horizontal_center,-_vertical_center); if(this.resizedflipH)global_MatrixTransformer.ScaleAppend(_transform,-1,1);if(this.resizedflipV)global_MatrixTransformer.ScaleAppend(_transform,1,-1);global_MatrixTransformer.RotateRadAppend(_transform,-this.resizedRot);global_MatrixTransformer.TranslateAppend(_transform,this.resizedPosX,this.resizedPosY);global_MatrixTransformer.TranslateAppend(_transform,_horizontal_center,_vertical_center);if(this.originalObject.group)global_MatrixTransformer.MultiplyAppend(_transform,this.originalObject.group.transform); if(this.originalObject.parent){var parent_transform=this.originalObject.parent.Get_ParentTextTransform&&this.originalObject.parent.Get_ParentTextTransform();if(parent_transform)global_MatrixTransformer.MultiplyAppend(_transform,parent_transform)}if(this.chartSpace)global_MatrixTransformer.MultiplyAppend(_transform,this.chartSpace.transform);if(this.originalObject.cropObject){var oShapeDrawer=new AscCommon.CShapeDrawer;oShapeDrawer.bIsCheckBounds=true;oShapeDrawer.Graphics=new AscFormat.CSlideBoundsChecker; this.overlayObject.check_bounds(oShapeDrawer);this.brush.fill.srcRect=AscFormat.CalculateSrcRect(_transform,oShapeDrawer,this.originalObject.cropObject.invertTransform,this.originalObject.cropObject.extX,this.originalObject.cropObject.extY)}};this.draw=function(overlay,transform){if(AscFormat.isRealNumber(this.originalObject.selectStartPage)&&overlay.SetCurrentPage)overlay.SetCurrentPage(this.originalObject.selectStartPage);if(this.originalObject.isCrop){var dOldAlpha=null;var oGraphics=overlay.Graphics? overlay.Graphics:overlay;if(AscFormat.isRealNumber(oGraphics.globalAlpha)&&oGraphics.put_GlobalAlpha){dOldAlpha=oGraphics.globalAlpha;oGraphics.put_GlobalAlpha(false,1)}this.overlayObject.draw(overlay);var oldFill=this.brush.fill;this.brush.fill=this.originalObject.cropBrush.fill;this.overlayObject.shapeDrawer.Clear();this.overlayObject.draw(overlay);this.brush.fill=oldFill;var oldSrcRect,oldPen;var parentCrop=this.originalObject.parentCrop;var oShapeDrawer=new AscCommon.CShapeDrawer;oShapeDrawer.bIsCheckBounds= true;oShapeDrawer.Graphics=new AscFormat.CSlideBoundsChecker;parentCrop.check_bounds(oShapeDrawer);var srcRect=AscFormat.CalculateSrcRect(parentCrop.transform,oShapeDrawer,global_MatrixTransformer.Invert(this.transform),this.resizedExtX,this.resizedExtY);oldPen=this.originalObject.parentCrop.pen;this.originalObject.parentCrop.pen=AscFormat.CreatePenBrushForChartTrack().pen;if(this.originalObject.parentCrop.blipFill){oldSrcRect=this.originalObject.parentCrop.blipFill.srcRect;this.originalObject.parentCrop.blipFill.srcRect= srcRect;this.originalObject.parentCrop.draw(overlay);this.originalObject.parentCrop.blipFill.srcRect=oldSrcRect}else{oldSrcRect=this.originalObject.parentCrop.brush.fill.srcRect;this.originalObject.parentCrop.brush.fill.srcRect=srcRect;this.originalObject.parentCrop.draw(overlay);this.originalObject.parentCrop.brush.fill.srcRect=oldSrcRect}this.originalObject.parentCrop.pen=oldPen;if(AscFormat.isRealNumber(dOldAlpha)&&oGraphics.put_GlobalAlpha)oGraphics.put_GlobalAlpha(true,dOldAlpha);return}if(this.originalObject.cropObject){var dOldAlpha= null;var oGraphics=overlay.Graphics?overlay.Graphics:overlay;if(AscFormat.isRealNumber(oGraphics.globalAlpha)&&oGraphics.put_GlobalAlpha){dOldAlpha=oGraphics.globalAlpha;oGraphics.put_GlobalAlpha(false,1)}this.originalObject.cropObject.draw(overlay);this.overlayObject.pen=AscFormat.CreatePenBrushForChartTrack().pen;this.overlayObject.draw(overlay,transform);if(AscFormat.isRealNumber(dOldAlpha)&&oGraphics.put_GlobalAlpha)oGraphics.put_GlobalAlpha(true,dOldAlpha);return}if(this.oNewShape)this.oNewShape.drawConnectors(overlay); this.overlayObject.draw(overlay,transform)};this.getBounds=function(){var boundsChecker=new AscFormat.CSlideBoundsChecker;var tr=null;if(this.originalObject&&this.originalObject.parent){var parent_transform=this.originalObject.parent.Get_ParentTextTransform&&this.originalObject.parent.Get_ParentTextTransform();if(parent_transform){tr=this.transform.CreateDublicate();global_MatrixTransformer.MultiplyAppend(tr,global_MatrixTransformer.Invert(parent_transform))}}this.draw(boundsChecker,tr?tr:null);tr= this.transform;var arr_p_x=[];var arr_p_y=[];arr_p_x.push(tr.TransformPointX(0,0));arr_p_y.push(tr.TransformPointY(0,0));arr_p_x.push(tr.TransformPointX(this.resizedExtX,0));arr_p_y.push(tr.TransformPointY(this.resizedExtX,0));arr_p_x.push(tr.TransformPointX(this.resizedExtX,this.resizedExtY));arr_p_y.push(tr.TransformPointY(this.resizedExtX,this.resizedExtY));arr_p_x.push(tr.TransformPointX(0,this.resizedExtY));arr_p_y.push(tr.TransformPointY(0,this.resizedExtY));arr_p_x.push(boundsChecker.Bounds.min_x); arr_p_x.push(boundsChecker.Bounds.max_x);arr_p_y.push(boundsChecker.Bounds.min_y);arr_p_y.push(boundsChecker.Bounds.max_y);boundsChecker.Bounds.min_x=Math.min.apply(Math,arr_p_x);boundsChecker.Bounds.max_x=Math.max.apply(Math,arr_p_x);boundsChecker.Bounds.min_y=Math.min.apply(Math,arr_p_y);boundsChecker.Bounds.max_y=Math.max.apply(Math,arr_p_y);boundsChecker.Bounds.posX=this.resizedPosX;boundsChecker.Bounds.posY=this.resizedPosY;boundsChecker.Bounds.extX=this.resizedExtX;boundsChecker.Bounds.extY= this.resizedExtY;return boundsChecker.Bounds};this.trackEnd=function(bWord){if(!this.bIsTracked)return;if(this.chartSpace){var oObjectToSet=this.originalObject;if(!oObjectToSet.layout)oObjectToSet.setLayout(new AscFormat.CLayout);var pos=this.chartSpace.chartObj.recalculatePositionText(this.originalObject);oObjectToSet.layout.setXMode(AscFormat.LAYOUT_MODE_EDGE);oObjectToSet.layout.setYMode(AscFormat.LAYOUT_MODE_EDGE);if(oObjectToSet instanceof AscFormat.CPlotArea)oObjectToSet.layout.setLayoutTarget(AscFormat.LAYOUT_TARGET_INNER); var fLayoutX=this.chartSpace.calculateLayoutByPos(pos.x,oObjectToSet.layout.xMode,this.resizedPosX,this.chartSpace.extX);var fLayoutY=this.chartSpace.calculateLayoutByPos(pos.y,oObjectToSet.layout.yMode,this.resizedPosY,this.chartSpace.extY);var fLayoutW=this.chartSpace.calculateLayoutBySize(this.resizedPosX,oObjectToSet.layout.wMode,this.chartSpace.extX,this.resizedExtX);var fLayoutH=this.chartSpace.calculateLayoutBySize(this.resizedPosY,oObjectToSet.layout.hMode,this.chartSpace.extY,this.resizedExtY); oObjectToSet.layout.setX(fLayoutX);oObjectToSet.layout.setY(fLayoutY);oObjectToSet.layout.setW(fLayoutW);oObjectToSet.layout.setH(fLayoutH);return}if(!this.bConnector||!this.oSpPr){var scale_coefficients,ch_off_x,ch_off_y;if(this.originalObject.group){scale_coefficients=this.originalObject.group.getResultScaleCoefficients();ch_off_x=this.originalObject.group.spPr.xfrm.chOffX;ch_off_y=this.originalObject.group.spPr.xfrm.chOffY}else{scale_coefficients={cx:1,cy:1};ch_off_x=0;ch_off_y=0;if(bWord){this.resizedPosX= 0;this.resizedPosY=0}}if(!this.originalObject.isCrop)AscFormat.CheckSpPrXfrm(this.originalObject);else AscFormat.ExecuteNoHistory(function(){AscFormat.CheckSpPrXfrm(this.originalObject)},this,[]);var xfrm=this.originalObject.spPr.xfrm;if(this.originalObject.getObjectType()!==AscDFH.historyitem_type_GraphicFrame)if(!this.originalObject.isCrop){xfrm.setOffX(this.resizedPosX/scale_coefficients.cx+ch_off_x);xfrm.setOffY(this.resizedPosY/scale_coefficients.cy+ch_off_y);xfrm.setExtX(this.resizedExtX/scale_coefficients.cx); xfrm.setExtY(this.resizedExtY/scale_coefficients.cy)}else AscFormat.ExecuteNoHistory(function(){xfrm.setOffX(this.resizedPosX/scale_coefficients.cx+ch_off_x);xfrm.setOffY(this.resizedPosY/scale_coefficients.cy+ch_off_y);xfrm.setExtX(this.resizedExtX/scale_coefficients.cx);xfrm.setExtY(this.resizedExtY/scale_coefficients.cy)},this,[]);else{var oldX=xfrm.offX;var oldY=xfrm.offY;var newX=this.resizedPosX/scale_coefficients.cx+ch_off_x;var newY=this.resizedPosY/scale_coefficients.cy+ch_off_y;this.originalObject.graphicObject.Resize(this.resizedExtX, this.resizedExtY);this.originalObject.recalculateTable();this.originalObject.recalculateSizes();if(!this.bLastCenter){if(!AscFormat.fApproxEqual(oldX,newX,.5))xfrm.setOffX(this.resizedPosX/scale_coefficients.cx+ch_off_x-this.originalObject.extX+this.resizedExtX);if(!AscFormat.fApproxEqual(oldY,newY,.5))xfrm.setOffY(this.resizedPosY/scale_coefficients.cy+ch_off_y-this.originalObject.extY+this.resizedExtY)}else{xfrm.setOffX(this.resizedPosX+this.resizedExtX/2-this.originalObject.extX/2);xfrm.setOffY(this.resizedPosY+ this.resizedExtY/2-this.originalObject.extY/2)}}if(this.originalObject.getObjectType()!==AscDFH.historyitem_type_ChartSpace&&this.originalObject.getObjectType()!==AscDFH.historyitem_type_GraphicFrame&&this.originalObject.getObjectType()!==AscDFH.historyitem_type_SlicerView)if(!this.originalObject.isCrop){xfrm.setFlipH(this.resizedflipH);xfrm.setFlipV(this.resizedflipV)}else AscFormat.ExecuteNoHistory(function(){xfrm.setFlipH(this.resizedflipH);xfrm.setFlipV(this.resizedflipV)},this,[]);if(this.originalObject.getObjectType&& this.originalObject.getObjectType()===AscDFH.historyitem_type_OleObject){var api=window.editor||window["Asc"]["editor"];if(api){var pluginData=new Asc.CPluginData;pluginData.setAttribute("data",this.originalObject.m_sData);pluginData.setAttribute("guid",this.originalObject.m_sApplicationId);pluginData.setAttribute("width",xfrm.extX);pluginData.setAttribute("height",xfrm.extY);pluginData.setAttribute("objectId",this.originalObject.Get_Id());api.asc_pluginResize(pluginData)}}if(this.bConnector){var nvUniSpPr= this.originalObject.nvSpPr.nvUniSpPr.copy();if(this.numberHandle===0){nvUniSpPr.stCnxIdx=this.beginShapeIdx;nvUniSpPr.stCnxId=this.beginShapeId;this.originalObject.nvSpPr.setUniSpPr(nvUniSpPr)}else{nvUniSpPr.endCnxIdx=this.endShapeIdx;nvUniSpPr.endCnxId=this.endShapeId;this.originalObject.nvSpPr.setUniSpPr(nvUniSpPr)}}if(this.originalObject.isCrop){AscFormat.ExecuteNoHistory(function(){this.originalObject.recalculateGeometry()},this,[]);this.originalObject.transform=this.transform;this.originalObject.invertTransform= AscCommon.global_MatrixTransformer.Invert(this.transform);this.originalObject.extX=this.resizedExtX;this.originalObject.extY=this.resizedExtY;if(!this.originalObject.parentCrop.cropObject)this.originalObject.parentCrop.cropObject=this.originalObject;this.originalObject.parentCrop.calculateSrcRect()}if(this.cropObject&&!this.originalObject.cropObject)this.originalObject.cropObject=this.cropObject;if(this.originalObject.cropObject){this.originalObject.transform=this.transform;this.originalObject.invertTransform= AscCommon.global_MatrixTransformer.Invert(this.transform);this.originalObject.extX=this.resizedExtX;this.originalObject.extY=this.resizedExtY;this.originalObject.calculateSrcRect()}}else{var _xfrm=this.originalObject.spPr.xfrm;var _xfrm2=this.oSpPr.xfrm;_xfrm.setOffX(_xfrm2.offX);_xfrm.setOffY(_xfrm2.offY);_xfrm.setExtX(_xfrm2.extX);_xfrm.setExtY(_xfrm2.extY);_xfrm.setFlipH(_xfrm2.flipH);_xfrm.setFlipV(_xfrm2.flipV);_xfrm.setRot(_xfrm2.rot);this.originalObject.spPr.setGeometry(this.oSpPr.geometry.createDuplicate()); var nvUniSpPr=this.originalObject.nvSpPr.nvUniSpPr.copy();if(this.numberHandle===0){nvUniSpPr.stCnxIdx=this.beginShapeIdx;nvUniSpPr.stCnxId=this.beginShapeId;this.originalObject.nvSpPr.setUniSpPr(nvUniSpPr)}else{nvUniSpPr.endCnxIdx=this.endShapeIdx;nvUniSpPr.endCnxId=this.endShapeId;this.originalObject.nvSpPr.setUniSpPr(nvUniSpPr)}}if(!this.originalObject.isCrop){AscFormat.CheckShapeBodyAutoFitReset(this.originalObject);this.originalObject.checkDrawingBaseCoords();if(this.originalObject.checkExtentsByDocContent)this.originalObject.checkExtentsByDocContent(true, true)}else AscFormat.ExecuteNoHistory(function(){AscFormat.CheckShapeBodyAutoFitReset(this.originalObject);this.originalObject.checkDrawingBaseCoords()},this,[]);if(this.originalObject instanceof AscFormat.CShape&&this.originalObject.isForm()){var nW=this.originalObject.spPr.xfrm.extX;var nH=this.originalObject.spPr.xfrm.extY;var oForm=this.originalObject.getInnerForm();if(oForm)oForm.OnChangeFixedFormTrack(nW,nH)}}},this,[])}function ResizeTrackGroup(originalObject,cardDirection,parentTrack){AscFormat.ExecuteNoHistory(function(){this.bIsTracked= false;this.original=originalObject;this.originalObject=originalObject;this.parentTrack=parentTrack;var numberHandle;if(AscFormat.isRealNumber(cardDirection)){this.numberHandle=originalObject.getNumByCardDirection(cardDirection);numberHandle=this.numberHandle}this.x=originalObject.x;this.y=originalObject.y;this.extX=originalObject.extX;this.extY=originalObject.extY;this.rot=originalObject.rot;this.flipH=originalObject.flipH;this.flipV=originalObject.flipV;this.transform=originalObject.transform.CreateDublicate(); this.bSwapCoef=!AscFormat.checkNormalRotate(this.rot);this.childs=[];var a=originalObject.spTree;for(var i=0;i=this.aspect)kd2=Math.abs(kd1)*(kd2>=0?1:-1);else kd1=Math.abs(kd2)*(kd1>=0?1:-1)}if(this.bChangeCoef){_temp=kd1;kd1=kd2;kd2=_temp}switch(this.translatetNumberHandle){case 0:case 1:{if(this.translatetNumberHandle===0){_real_width=this.usedExtX*kd1;_abs_width=Math.abs(_real_width);this.resizedExtX=_abs_width>=MIN_SHAPE_SIZE||this.lineFlag?_abs_width:MIN_SHAPE_SIZE;if(_real_width<0)this.resizedflipH=!this.originalFlipH; else this.resizedflipH=this.originalFlipH}if(this.translatetNumberHandle===1){_temp=kd1;kd1=kd2;kd2=_temp}_real_height=this.usedExtY*kd2;_abs_height=Math.abs(_real_height);this.resizedExtY=_abs_height>=MIN_SHAPE_SIZE||this.lineFlag?_abs_height:MIN_SHAPE_SIZE;if(_real_height<0)this.resizedflipV=!this.originalFlipV;else this.resizedflipV=this.originalFlipV;_new_resize_half_width=this.resizedExtX*.5;_new_resize_half_height=this.resizedExtY*.5;if(this.resizedflipH!==this.originalFlipH)_new_used_half_width= -_new_resize_half_width;else _new_used_half_width=_new_resize_half_width;if(this.resizedflipV!==this.originalFlipV)_new_used_half_height=-_new_resize_half_height;else _new_used_half_height=_new_resize_half_height;this.resizedPosX=this.fixedPointX+(-_new_used_half_width*_cos+_new_used_half_height*_sin)-_new_resize_half_width;this.resizedPosY=this.fixedPointY+(-_new_used_half_width*_sin-_new_used_half_height*_cos)-_new_resize_half_height;break}case 2:case 3:{if(this.translatetNumberHandle===2){_temp= kd2;kd2=kd1;kd1=_temp;_real_height=this.usedExtY*kd2;_abs_height=Math.abs(_real_height);this.resizedExtY=_abs_height>=MIN_SHAPE_SIZE||this.lineFlag?_abs_height:MIN_SHAPE_SIZE;if(_real_height<0)this.resizedflipV=!this.originalFlipV;else this.resizedflipV=this.originalFlipV}_real_width=this.usedExtX*kd1;_abs_width=Math.abs(_real_width);this.resizedExtX=_abs_width>=MIN_SHAPE_SIZE||this.lineFlag?_abs_width:MIN_SHAPE_SIZE;if(_real_width<0)this.resizedflipH=!this.originalFlipH;else this.resizedflipH=this.originalFlipH; _new_resize_half_width=this.resizedExtX*.5;_new_resize_half_height=this.resizedExtY*.5;if(this.resizedflipH!==this.originalFlipH)_new_used_half_width=-_new_resize_half_width;else _new_used_half_width=_new_resize_half_width;if(this.resizedflipV!==this.originalFlipV)_new_used_half_height=-_new_resize_half_height;else _new_used_half_height=_new_resize_half_height;this.resizedPosX=this.fixedPointX+(_new_used_half_width*_cos+_new_used_half_height*_sin)-_new_resize_half_width;this.resizedPosY=this.fixedPointY+ (_new_used_half_width*_sin-_new_used_half_height*_cos)-_new_resize_half_height;break}case 4:case 5:{if(this.translatetNumberHandle===4){_real_width=this.usedExtX*kd1;_abs_width=Math.abs(_real_width);this.resizedExtX=_abs_width>=MIN_SHAPE_SIZE||this.lineFlag?_abs_width:MIN_SHAPE_SIZE;if(_real_width<0)this.resizedflipH=!this.originalFlipH;else this.resizedflipH=this.originalFlipH}else{_temp=kd2;kd2=kd1;kd1=_temp}_real_height=this.usedExtY*kd2;_abs_height=Math.abs(_real_height);this.resizedExtY=_abs_height>= MIN_SHAPE_SIZE||this.lineFlag?_abs_height:MIN_SHAPE_SIZE;if(_real_height<0)this.resizedflipV=!this.originalFlipV;else this.resizedflipV=this.originalFlipV;_new_resize_half_width=this.resizedExtX*.5;_new_resize_half_height=this.resizedExtY*.5;if(this.resizedflipH!==this.originalFlipH)_new_used_half_width=-_new_resize_half_width;else _new_used_half_width=_new_resize_half_width;if(this.resizedflipV!==this.originalFlipV)_new_used_half_height=-_new_resize_half_height;else _new_used_half_height=_new_resize_half_height; this.resizedPosX=this.fixedPointX+(_new_used_half_width*_cos-_new_used_half_height*_sin)-_new_resize_half_width;this.resizedPosY=this.fixedPointY+(_new_used_half_width*_sin+_new_used_half_height*_cos)-_new_resize_half_height;break}case 6:case 7:{if(this.translatetNumberHandle===6){_real_height=this.usedExtY*kd1;_abs_height=Math.abs(_real_height);this.resizedExtY=_abs_height>=MIN_SHAPE_SIZE||this.lineFlag?_abs_height:MIN_SHAPE_SIZE;if(_real_height<0)this.resizedflipV=!this.originalFlipV;else this.resizedflipV= this.originalFlipV}else{_temp=kd2;kd2=kd1;kd1=_temp}_real_width=this.usedExtX*kd2;_abs_width=Math.abs(_real_width);this.resizedExtX=_abs_width>=MIN_SHAPE_SIZE||this.lineFlag?_abs_width:MIN_SHAPE_SIZE;if(_real_width<0)this.resizedflipH=!this.originalFlipH;else this.resizedflipH=this.originalFlipH;_new_resize_half_width=this.resizedExtX*.5;_new_resize_half_height=this.resizedExtY*.5;if(this.resizedflipH!==this.originalFlipH)_new_used_half_width=-_new_resize_half_width;else _new_used_half_width=_new_resize_half_width; if(this.resizedflipV!==this.originalFlipV)_new_used_half_height=-_new_resize_half_height;else _new_used_half_height=_new_resize_half_height;this.resizedPosX=this.fixedPointX+(-_new_used_half_width*_cos-_new_used_half_height*_sin)-_new_resize_half_width;this.resizedPosY=this.fixedPointY+(-_new_used_half_width*_sin+_new_used_half_height*_cos)-_new_resize_half_height;break}}this.x=this.resizedPosX;this.y=this.resizedPosY;this.extX=this.resizedExtX;this.extY=this.resizedExtY;this.flipH=this.resizedflipH; this.flipV=this.resizedflipV;var _transform=this.transform;_transform.Reset();var _horizontal_center=this.resizedExtX*.5;var _vertical_center=this.resizedExtY*.5;global_MatrixTransformer.TranslateAppend(_transform,-_horizontal_center,-_vertical_center);if(this.resizedflipH)global_MatrixTransformer.ScaleAppend(_transform,-1,1);if(this.resizedflipV)global_MatrixTransformer.ScaleAppend(_transform,1,-1);global_MatrixTransformer.RotateRadAppend(_transform,-this.resizedRot);global_MatrixTransformer.TranslateAppend(_transform, this.resizedPosX,this.resizedPosY);global_MatrixTransformer.TranslateAppend(_transform,_horizontal_center,_vertical_center);var originalExtX,originalExtY;if(AscFormat.isRealNumber(this.original.extX)&&AscFormat.isRealNumber(this.original.extY)){originalExtX=this.original.extX;originalExtY=this.original.extY;if(AscFormat.fApproxEqual(0,originalExtX))originalExtX=1;if(AscFormat.fApproxEqual(0,originalExtY))originalExtY=1}else{var xfrm=this.original.spPr.xfrm;if(xfrm){originalExtX=xfrm.extX;originalExtY= xfrm.extY}if(!AscFormat.isRealNumber(originalExtX))originalExtX=1;if(!AscFormat.isRealNumber(originalExtY))originalExtY=1}if(AscFormat.fApproxEqual(0,originalExtX))originalExtX=1;if(AscFormat.fApproxEqual(0,originalExtY))originalExtY=1;var kw=this.resizedExtX/originalExtX;var kh=this.resizedExtY/originalExtY;for(var i=0;i=this.aspect)kd2=Math.abs(kd1)*(kd2>=0?1:-1);else kd1=Math.abs(kd2)*(kd1>=0?1:-1)}var _temp;if(this.bChangeCoef){_temp=kd1;kd1=kd2;kd2=_temp}if(this.mod===0||this.mod===1){if(this.mod===0){_real_width= this.usedExtX*kd1;_abs_width=Math.abs(_real_width);this.resizedExtX=_abs_width>=MIN_SHAPE_SIZE||this.lineFlag?_abs_width:MIN_SHAPE_SIZE;this.resizedflipH=_real_width<0?!this.originalFlipH:this.originalFlipH}else{_temp=kd1;kd1=kd2;kd2=_temp}_real_height=this.usedExtY*kd2;_abs_height=Math.abs(_real_height);this.resizedExtY=_abs_height>=MIN_SHAPE_SIZE||this.lineFlag?_abs_height:MIN_SHAPE_SIZE;this.resizedflipV=_real_height<0?!this.originalFlipV:this.originalFlipV}else{if(this.mod===2){_temp=kd1;kd1= kd2;kd2=_temp;_real_height=this.usedExtY*kd2;_abs_height=Math.abs(_real_height);this.resizedExtY=_abs_height>=MIN_SHAPE_SIZE||this.lineFlag?_abs_height:MIN_SHAPE_SIZE;this.resizedflipV=_real_height<0?!this.originalFlipV:this.originalFlipV}_real_width=this.usedExtX*kd1;_abs_width=Math.abs(_real_width);this.resizedExtX=_abs_width>=MIN_SHAPE_SIZE||this.lineFlag?_abs_width:MIN_SHAPE_SIZE;this.resizedflipH=_real_width<0?!this.originalFlipH:this.originalFlipH}this.resizedPosX=this.centerPointX-this.resizedExtX* .5;this.resizedPosY=this.centerPointY-this.resizedExtY*.5;this.x=this.resizedPosX;this.y=this.resizedPosY;this.extX=this.resizedExtX;this.extY=this.resizedExtY;this.flipH=this.resizedflipH;this.flipV=this.resizedflipV;var _transform=this.transform;_transform.Reset();var _horizontal_center=this.resizedExtX*.5;var _vertical_center=this.resizedExtY*.5;global_MatrixTransformer.TranslateAppend(_transform,-_horizontal_center,-_vertical_center);if(this.resizedflipH)global_MatrixTransformer.ScaleAppend(_transform, -1,1);if(this.resizedflipV)global_MatrixTransformer.ScaleAppend(_transform,1,-1);global_MatrixTransformer.RotateRadAppend(_transform,-this.resizedRot);global_MatrixTransformer.TranslateAppend(_transform,this.resizedPosX,this.resizedPosY);global_MatrixTransformer.TranslateAppend(_transform,_horizontal_center,_vertical_center);var xfrm=this.original.spPr.xfrm;var kw=this.resizedExtX/xfrm.extX;var kh=this.resizedExtY/xfrm.extY;for(var i=0;i=2*Math.PI)new_rot-=2*Math.PI;if(new_rot2*Math.PI-MIN_ANGLE)new_rot=0;if(Math.abs(new_rot-Math.PI*.5)=2*Math.PI)new_rot-=2*Math.PI;if(new_rot2*Math.PI-MIN_ANGLE)new_rot=0;if(Math.abs(new_rot-Math.PI*.5)90)this.view3D.rotY=90}while(this.view3D.rotY<0)this.view3D.rotY+=360;while(this.view3D.rotY>=360)this.view3D.rotY-=360;var StratRotX=_view3d&&_view3d.rotX?_view3d.rotX:0;deltaAng=90*(ty-this.startY)/(this.chartSizes.h/2);this.view3D.rotX= StratRotX+deltaAng;if(oChartSpace.chart.plotArea&&oChartSpace.chart.plotArea.charts[0]&&oChartSpace.chart.plotArea.charts[0].getObjectType()===AscDFH.historyitem_type_PieChart)if(this.view3D.rotX<0)this.view3D.rotX=0;if(this.view3D.rotX<-90)this.view3D.rotX=-90;if(this.view3D.rotX>90)this.view3D.rotX=90;var OldView=oChartSpace.chart.view3D;if(this.bChartTrack){oChartSpace.chart.view3D=this.view3D;oChartSpace.recalcInfo.recalculateChart=true;oChartSpace.recalculate();oChartSpace.chart.view3D=OldView}else{oChartSpace.chart.view3D= this.view3D;oChartSpace.chartObj.recalculateOnly3dProps(oChartSpace);oChartSpace.chart.view3D=OldView;this.calculateGeometry()}};this.trackEnd=function(){if(!this.bIsTracked)return;oChartSpace.chart.setView3D(this.view3D.createDuplicate());oChartSpace.setRecalculateInfo()}}window["AscFormat"]=window["AscFormat"]||{};window["AscFormat"].OverlayObject=OverlayObject;window["AscFormat"].ObjectToDraw=ObjectToDraw;window["AscFormat"].RotateTrackShapeImage=RotateTrackShapeImage;window["AscFormat"].RotateTrackGroup= RotateTrackGroup;window["AscFormat"].Chart3dAdjustTrack=Chart3dAdjustTrack})(window);"use strict";(function(window,undefined){function SplineCommandMoveTo(x,y){this.id=0;this.x=x;this.y=y}function SplineCommandLineTo(x,y){this.id=1;this.x=x;this.y=y;this.changeLastPoint=function(x,y){this.x=x;this.y=y}}function SplineCommandBezier(x1,y1,x2,y2,x3,y3){this.id=2;this.x1=x1;this.y1=y1;this.x2=x2;this.y2=y2;this.x3=x3;this.y3=y3;this.changeLastPoint=function(x,y){this.x3=x;this.y3=y;this.x2=this.x1+(this.x3- this.x1)*.5;this.y2=this.y1+(this.y3-this.y1)*.5}}function Spline(drawingObjects,theme,master,layout,slide,pageIndex){AscFormat.ExecuteNoHistory(function(){this.pageIndex=pageIndex;this.path=[];this.drawingObjects=drawingObjects;this.Matrix=new AscCommon.CMatrix;this.TransformMatrix=new AscCommon.CMatrix;this.style=AscFormat.CreateDefaultShapeStyle();var style=this.style;style.fillRef.Color.Calculate(theme,slide,layout,master,{R:0,G:0,B:0,A:255});var RGBA=style.fillRef.Color.RGBA;var pen=theme.getLnStyle(style.lnRef.idx, style.lnRef.Color);style.lnRef.Color.Calculate(theme,slide,layout,master);RGBA=style.lnRef.Color.RGBA;if(pen.Fill)pen.Fill.calculate(theme,slide,layout,master,RGBA);this.pen=pen;this.splineForDraw=new SplineForDrawer(this)},this,[]);this.Draw=function(graphics){graphics.SetIntegerGrid(false);graphics.transform3(this.Matrix);var shape_drawer=new AscCommon.CShapeDrawer;shape_drawer.fromShape(this,graphics);shape_drawer.draw(this)};this.draw=function(g){if(AscFormat.isRealNumber(this.pageIndex)&&g.SetCurrentPage)g.SetCurrentPage(this.pageIndex); this.splineForDraw.Draw(g);return;for(var i=0;i2){var dx=this.path[0].x-this.path[this.path.length-1].x3;var dy=this.path[0].y-this.path[this.path.length-1].y3;if(Math.sqrt(dx*dx+dy*dy)<3){bClosed=true;this.path[this.path.length-1].x3=this.path[0].x;this.path[this.path.length-1].y3=this.path[0].y;if(this.path.length>3){var vx=(this.path[1].x3-this.path[this.path.length-2].x3)/6;var vy=(this.path[1].y3-this.path[this.path.length- 2].y3)/6}else{vx=-(this.path[1].y3-this.path[0].y)/6;vy=(this.path[1].x3-this.path[0].x)/6}this.path[1].x1=this.path[0].x+vx;this.path[1].y1=this.path[0].y+vy;this.path[this.path.length-1].x2=this.path[0].x-vx;this.path[this.path.length-1].y2=this.path[0].y-vy}}var min_x=this.path[0].x;var max_x=min_x;var min_y=this.path[0].y;var max_y=min_y;var last_x=this.path[0].x,last_y=this.path[0].y;for(var index=1;index path_command.x)min_x=path_command.x;if(max_xpath_command.y)min_y=path_command.y;if(max_ycur_point.x)min_x=cur_point.x;if(max_xcur_point.y)min_y=cur_point.y;if(max_y0){pathW=43200;kw=43200/w}else{pathW=0;kw=0}if(h>0){pathH=43200;kh=43200/h}else{pathH=0;kh=0}geometry.AddPathCommand(0,undefined,bClosed?"norm":"none",undefined,pathW,pathH);geometry.AddRect("l","t","r","b");for(i=0;i>0)+"",((this.path[i].y-yMin)*kh>>0)+"");break}case 1:{geometry.AddPathCommand(2,((this.path[i].x-xMin)*kw>>0)+"",((this.path[i].y-yMin)*kh>>0)+"");break}case 2:{geometry.AddPathCommand(5,((this.path[i].x1-xMin)*kw>>0)+"",((this.path[i].y1-yMin)*kh>>0)+"",((this.path[i].x2-xMin)*kw>>0)+"",((this.path[i].y2-yMin)*kh>>0)+"",((this.path[i].x3-xMin)*kw>>0)+"",((this.path[i].y3-yMin)*kh>>0)+"");break}}if(bClosed)geometry.AddPathCommand(6);shape.spPr.setGeometry(geometry);shape.setBDeleted(false); shape.recalculate();shape.x=xMin;shape.y=yMin;return shape};this.addPathCommand=function(pathCommand){this.path.push(pathCommand)};this.getBounds=function(){var boundsChecker=new AscFormat.CSlideBoundsChecker;this.draw(boundsChecker);boundsChecker.Bounds.posX=boundsChecker.Bounds.min_x;boundsChecker.Bounds.posY=boundsChecker.Bounds.min_y;boundsChecker.Bounds.extX=boundsChecker.Bounds.max_x-boundsChecker.Bounds.min_x;boundsChecker.Bounds.extY=boundsChecker.Bounds.max_y-boundsChecker.Bounds.min_y;return boundsChecker.Bounds}} function SplineForDrawer(spline){this.spline=spline;this.pen=spline.pen;this.brush=spline.brush;this.TransformMatrix=spline.TransformMatrix;this.Matrix=spline.Matrix;this.Draw=function(graphics){graphics.SetIntegerGrid(false);graphics.transform3(this.Matrix);var shape_drawer=new AscCommon.CShapeDrawer;shape_drawer.fromShape(this,graphics);shape_drawer.draw(this)};this.draw=function(g){g._e();for(var i=0;i-1){ret=drawingObjectsController.handleHandleHit(hit_to_handles,oCropSelection,group);drawing=oCropSelection}if(!ret)if(oCropSelection.hitInBoundingRect(tx,ty))ret=drawingObjectsController.handleMoveHit(oCropSelection,e,tx,ty,group,true,oCropSelection.selectStartPage,true);var oldSelectedObjects; if(group){oldSelectedObjects=group.selectedObjects;group.selectedObjects=[oCropObject]}else{oldSelectedObjects=drawingObjectsController.selectedObjects;drawingObjectsController.selectedObjects=[oCropObject]}if(!ret){hit_to_handles=oCropObject.hitToHandles(tx,ty);if(hit_to_handles>-1){ret=drawingObjectsController.handleHandleHit(hit_to_handles,oCropObject,group);drawing=oCropObject}}if(!ret)if(oCropObject.hitInBoundingRect(tx,ty))ret=drawingObjectsController.handleMoveHit(oCropObject,e,tx,ty,group, true,oCropSelection.selectStartPage,true);if(!ret)if(oCropSelection.hit(tx,ty))ret=drawingObjectsController.handleMoveHit(oCropObject,e,tx,ty,group,true,oCropSelection.selectStartPage,true);if(!ret)if(oCropObject.hit(tx,ty))ret=drawingObjectsController.handleMoveHit(oCropObject,e,tx,ty,group,true,oCropSelection.selectStartPage,true);if(group)group.selectedObjects=oldSelectedObjects;else drawingObjectsController.selectedObjects=oldSelectedObjects}}if(!ret)if(selected_objects.length===1){if(window["IS_NATIVE_EDITOR"]&& e.ClickCount>1)if(selected_objects[0].getObjectType()===AscDFH.historyitem_type_Shape)return null;if(bWord&&pageIndex!==selected_objects[0].selectStartPage){t=drawingObjectsController.drawingDocument.ConvertCoordsToAnotherPage(x,y,pageIndex,selected_objects[0].selectStartPage);tx=t.X;ty=t.Y}else{tx=x;ty=y}if(selected_objects[0].canChangeAdjustments()){var hit_to_adj=selected_objects[0].hitToAdjustment(tx,ty);if(hit_to_adj.hit){ret=drawingObjectsController.handleAdjustmentHit(hit_to_adj,selected_objects[0], group,pageIndex);drawing=selected_objects[0]}}}if(!ret)for(var i=selected_objects.length-1;i>-1;--i){if(bWord&&pageIndex!==selected_objects[i].selectStartPage){t=drawingObjectsController.drawingDocument.ConvertCoordsToAnotherPage(x,y,pageIndex,selected_objects[i].selectStartPage);tx=t.X;ty=t.Y}else{tx=x;ty=y}if(selected_objects[i].getObjectType()===AscDFH.historyitem_type_ChartSpace){ret=handleInternalChart(selected_objects[i],drawingObjectsController,e,tx,ty,group,pageIndex,bWord);if(ret){drawing= selected_objects[i];break}}if(!ret){hit_to_handles=selected_objects[i].hitToHandles(tx,ty);if(hit_to_handles>-1){if(window["IS_NATIVE_EDITOR"]&&e.ClickCount>1)if(selected_objects[i].getObjectType()===AscDFH.historyitem_type_Shape)return null;ret=drawingObjectsController.handleHandleHit(hit_to_handles,selected_objects[i],group);drawing=selected_objects[i];break}}}if(!ret)for(i=selected_objects.length-1;i>-1;--i){if(bWord&&pageIndex!==selected_objects[i].selectStartPage){t=drawingObjectsController.drawingDocument.ConvertCoordsToAnotherPage(x, y,pageIndex,selected_objects[i].selectStartPage);tx=t.X;ty=t.Y}else{tx=x;ty=y}if(selected_objects[i].getObjectType()===AscDFH.historyitem_type_ChartSpace){ret=handleInternalChart(selected_objects[i],drawingObjectsController,e,tx,ty,group,pageIndex,bWord);drawing=selected_objects[i]}if(!ret)if(selected_objects[i].hitInBoundingRect(tx,ty)){if(window["IS_NATIVE_EDITOR"])if(selected_objects[i]===AscFormat.getTargetTextObject(drawingObjectsController))return null;if(bWord&&selected_objects[i].parent&& selected_objects[i].parent.Is_Inline())ret=handleInlineHitNoText(selected_objects[i],drawingObjectsController,e,tx,ty,pageIndex,true);else ret=drawingObjectsController.handleMoveHit(selected_objects[i],e,tx,ty,group,true,selected_objects[i].selectStartPage,true)}if(ret){drawing=selected_objects[i];break}}if(ret&&drawing)if(drawingObjectsController.handleEventMode===AscFormat.HANDLE_EVENT_MODE_CURSOR&&drawingObjectsController&&drawingObjectsController.drawingObjects&&drawingObjectsController.drawingObjects.cSld)if(drawing.Lock.Is_Locked()){var MMData= new AscCommon.CMouseMoveData;var Coords=drawingObjectsController.getDrawingDocument().ConvertCoordsToCursorWR(drawing.bounds.x,drawing.bounds.y,pageIndex,null);MMData.X_abs=Coords.X-5;MMData.Y_abs=Coords.Y;MMData.Type=Asc.c_oAscMouseMoveDataTypes.LockedObject;MMData.UserId=drawing.Lock.Get_UserId();MMData.HaveChanges=drawing.Lock.Have_Changes();editor.sync_MouseMoveCallback(MMData)}return ret}function handleFloatObjects(drawingObjectsController,drawingArr,e,x,y,group,pageIndex,bWord){var ret=null, drawing;for(var i=drawingArr.length-1;i>-1;--i){drawing=drawingArr[i];switch(drawing.getObjectType()){case AscDFH.historyitem_type_SlicerView:{ret=handleSlicer(drawing,drawingObjectsController,e,x,y,group,pageIndex,bWord);break}case AscDFH.historyitem_type_Shape:case AscDFH.historyitem_type_ImageShape:case AscDFH.historyitem_type_OleObject:case AscDFH.historyitem_type_Cnx:case AscDFH.historyitem_type_LockedCanvas:{ret=handleShapeImage(drawing,drawingObjectsController,e,x,y,group,pageIndex,bWord); break}case AscDFH.historyitem_type_ChartSpace:{ret=handleChart(drawing,drawingObjectsController,e,x,y,group,pageIndex,bWord);break}case AscDFH.historyitem_type_GroupShape:{ret=handleGroup(drawing,drawingObjectsController,e,x,y,group,pageIndex,bWord);break}case AscDFH.historyitem_type_GraphicFrame:{ret=!drawingObjectsController.isSlideShow()&&handleFloatTable(drawing,drawingObjectsController,e,x,y,group,pageIndex);break}}if(ret){if(drawingObjectsController.handleEventMode===AscFormat.HANDLE_EVENT_MODE_CURSOR&& drawingObjectsController&&drawingObjectsController.drawingObjects&&drawingObjectsController.drawingObjects.cSld)if(drawing.Lock.Is_Locked()){var MMData=new AscCommon.CMouseMoveData;var Coords=drawingObjectsController.getDrawingDocument().ConvertCoordsToCursorWR(drawing.bounds.x,drawing.bounds.y,pageIndex,null);MMData.X_abs=Coords.X-5;MMData.Y_abs=Coords.Y;MMData.Type=Asc.c_oAscMouseMoveDataTypes.LockedObject;MMData.UserId=drawing.Lock.Get_UserId();MMData.HaveChanges=drawing.Lock.Have_Changes();editor.sync_MouseMoveCallback(MMData)}return ret}}return ret} function handleSlicer(drawing,drawingObjectsController,e,x,y,group,pageIndex,bWord){if(drawingObjectsController.handleEventMode===HANDLE_EVENT_MODE_HANDLE){var bRet=drawing.onMouseDown(e,x,y);if(!bRet)return handleShapeImage(drawing,drawingObjectsController,e,x,y,group,pageIndex,bWord);else drawingObjectsController.changeCurrentState(new AscFormat.SlicerState(drawingObjectsController,drawing));return bRet}else{var oCursorInfo=drawing.getCursorInfo(e,x,y);if(oCursorInfo)return oCursorInfo;return handleShapeImage(drawing, drawingObjectsController,e,x,y,group,pageIndex,bWord)}}function handleSlicerInGroup(drawingObjectsController,drawing,shape,e,x,y,pageIndex,bWord){if(drawingObjectsController.handleEventMode===HANDLE_EVENT_MODE_HANDLE){var bRet=shape.onMouseDown(e,x,y);if(!bRet)return handleShapeImageInGroup(drawingObjectsController,drawing,shape,e,x,y,pageIndex,bWord);else drawingObjectsController.changeCurrentState(new AscFormat.SlicerState(drawingObjectsController,shape));return bRet}else{var oCursorInfo=shape.getCursorInfo(e, x,y);if(oCursorInfo)return oCursorInfo;return handleShapeImageInGroup(drawingObjectsController,drawing,shape,e,x,y,pageIndex,bWord)}}function handleShapeImage(drawing,drawingObjectsController,e,x,y,group,pageIndex,bWord){var hit_in_inner_area=drawing.hitInInnerArea&&drawing.hitInInnerArea(x,y);var hit_in_path=drawing.hitInPath&&drawing.hitInPath(x,y);var hit_in_text_rect=drawing.hitInTextRect&&drawing.hitInTextRect(x,y);if(hit_in_inner_area||hit_in_path)if(drawingObjectsController.checkDrawingHyperlinkAndMacro){var ret= drawingObjectsController.checkDrawingHyperlinkAndMacro(drawing,e,hit_in_text_rect,x,y,pageIndex);if(ret)return ret}if(window["IS_NATIVE_EDITOR"])if(drawing.getObjectType()===AscDFH.historyitem_type_Shape&&drawing.getDocContent&&drawing.getDocContent())if(e.ClickCount>1&&!e.ShiftKey&&!e.CtrlKey&&(drawingObjectsController.selection.groupSelection&&drawingObjectsController.selection.groupSelection.selectedObjects.length===1||drawingObjectsController.selectedObjects.length===1))if(!hit_in_text_rect&& (hit_in_inner_area||hit_in_path)){hit_in_text_rect=true;hit_in_inner_area=false;hit_in_path=false}if(!hit_in_text_rect&&(hit_in_inner_area||hit_in_path)){if(drawingObjectsController.isSlideShow()){var sMediaFile=drawing.getMediaFileName();if(!sMediaFile)return false}return drawingObjectsController.handleMoveHit(drawing,e,x,y,group,false,pageIndex,bWord)}else if(hit_in_text_rect){if(bWord){if(drawing.getObjectType()===AscDFH.historyitem_type_Shape&&drawing.isForm()&&drawing.getInnerForm()&&drawing.getInnerForm().IsPicture())return drawingObjectsController.handleMoveHit(drawing, e,x,y,group,false,pageIndex,bWord);var all_drawings=drawing.getDocContent().GetAllDrawingObjects();var drawings2=[];for(var i=0;i-1;--j){var cur_grouped_object=grouped_objects[j];switch(cur_grouped_object.getObjectType()){case AscDFH.historyitem_type_SlicerView:{ret=handleSlicerInGroup(drawingObjectsController,drawing,cur_grouped_object, e,x,y,pageIndex,bWord);if(ret)return ret;break}case AscDFH.historyitem_type_Shape:case AscDFH.historyitem_type_ImageShape:case AscDFH.historyitem_type_OleObject:case AscDFH.historyitem_type_Cnx:case AscDFH.historyitem_type_LockedCanvas:{ret=handleShapeImageInGroup(drawingObjectsController,drawing,cur_grouped_object,e,x,y,pageIndex,bWord);if(ret)return ret;break}case AscDFH.historyitem_type_ChartSpace:{if(!drawingObjectsController.isSlideShow()){var ret,i,title;if(cur_grouped_object.hit(x,y)){var chart_titles= cur_grouped_object.getAllTitles();for(i=0;i-1;j--){var id=sortCharts[j];var chartModel=t._getChartModelById(drawing.chart.plotArea,id);if(!chartModel)continue;var oDrawChart=t.charts[id];var pointsPaths= oDrawChart.paths.points;if(Array.isArray(pointsPaths)){for(var k=pointsPaths.length-1;k>-1;--k)if(Array.isArray(pointsPaths[k])){var aPointsPaths=pointsPaths[k];for(var l=0;l-1)break}var seriesPaths= oDrawChart.paths.series;var bPie=chartModel.getObjectType()===AscDFH.historyitem_type_PieChart;if(Array.isArray(seriesPaths)){for(var k=seriesPaths.length-1;k>-1;--k)if(Array.isArray(seriesPaths[k])){var aPointsPaths=seriesPaths[k];for(var l=0;l -1)break}else if(chartModel.getObjectType()===AscDFH.historyitem_type_StockChart){seriesPaths=oDrawChart.paths.values;if(Array.isArray(seriesPaths))for(var k=0;k-1;i--){var oPathsObject=t.chart.sortZIndexPaths[i]; if(AscFormat.isRealNumber(t.chart.sortZIndexPaths[i].paths)){var oPath=drawing.pathMemory.GetPath(t.chart.sortZIndexPaths[i].paths);if(oPath.hitInInnerArea(oCanvas,dTx,dTy)||oPath.hitInPath(oCanvas,dTx,dTy))bSeries=true}else{if(!bSeries&&AscFormat.isRealNumber(t.chart.sortZIndexPaths[i].frontPaths)){var oPath=drawing.pathMemory.GetPath(t.chart.sortZIndexPaths[i].frontPaths);if(oPath.hitInInnerArea(oCanvas,dTx,dTy)||oPath.hitInPath(oCanvas,dTx,dTy))bSeries=true}if(!bSeries&&AscFormat.isRealNumber(t.chart.sortZIndexPaths[i].darkPaths)){var oPath= drawing.pathMemory.GetPath(t.chart.sortZIndexPaths[i].darkPaths);if(oPath.hitInInnerArea(oCanvas,dTx,dTy)||oPath.hitInPath(oCanvas,dTx,dTy))bSeries=true}}if(bSeries){if(drawing.selection.chart===t.chart.chart.Id&&drawing.selection.series===t.chart.sortZIndexPaths[i].seria){selector.resetSelection();selector.selectObject(drawing,pageIndex);selector.selection.chartSelection=drawing;drawing.selection.chart=t.chart.chart.Id;drawing.selection.series=t.chart.sortZIndexPaths[i].seria;drawing.selection.datPoint= t.chart.sortZIndexPaths[i].point}else{selector.resetSelection();selector.selectObject(drawing,pageIndex);selector.selection.chartSelection=drawing;drawing.selection.chart=t.chart.chart.Id;drawing.selection.series=t.chart.sortZIndexPaths[i].seria;drawing.selection.datPoint=null}break}}if(!bSeries){j=0;if(Array.isArray(t.catAxisChart))for(j=0;j 1)return false;var ret=false,i,title,hit_to_handles;var bIsMobileVersion=oApi&&oApi.isMobileVersion;if(drawing.hit(x,y)){var bClickFlag=!window["IS_NATIVE_EDITOR"]&&(drawingObjectsController.handleEventMode===AscFormat.HANDLE_EVENT_MODE_CURSOR||e.ClickCount<2);var selector=group?group:drawingObjectsController;var legend=drawing.getLegend();if(legend&&(legend.hit(x,y)||drawing.selection.legend===legend&&!AscFormat.isRealNumber(drawing.selection.legendEntry)&&(legend.hitInBoundingRect(x,y)||legend.hitToHandles(x, y)>-1))&&bClickFlag)if(drawing.selection.legend!==legend)if(drawingObjectsController.handleEventMode===HANDLE_EVENT_MODE_HANDLE){drawingObjectsController.checkChartTextSelection();selector.resetSelection();selector.selectObject(drawing,pageIndex);selector.selection.chartSelection=drawing;drawing.selection.legend=legend;drawingObjectsController.arrPreTrackObjects.length=0;drawingObjectsController.arrPreTrackObjects.push(new AscFormat.MoveChartObjectTrack(legend,drawing));drawingObjectsController.changeCurrentState(new AscFormat.PreMoveState(drawingObjectsController, x,y,false,false,drawing,true,true));drawingObjectsController.updateSelectionState();drawingObjectsController.updateOverlay();return true}else return{objectId:drawing.Get_Id(),cursorType:"move",bMarker:false};else{if(!AscFormat.isRealNumber(drawing.selection.legendEntry)){hit_to_handles=legend.hitToHandles(x,y);if(hit_to_handles>-1)if(drawingObjectsController.handleEventMode===HANDLE_EVENT_MODE_HANDLE){drawingObjectsController.arrPreTrackObjects.length=0;var oTrack=new AscFormat.ResizeTrackShapeImage(legend, legend.getCardDirectionByNum(hit_to_handles),drawingObjectsController);oTrack.chartSpace=drawing;drawingObjectsController.arrPreTrackObjects.push(oTrack);legend.selectStartPage=drawing.selectStartPage;drawingObjectsController.changeCurrentState(new AscFormat.PreResizeState(drawingObjectsController,legend,legend.getCardDirectionByNum(hit_to_handles)));drawingObjectsController.updateSelectionState();drawingObjectsController.updateOverlay();return true}else{var card_direction=legend.getCardDirectionByNum(hit_to_handles); return{objectId:drawing.Get_Id(),cursorType:AscFormat.CURSOR_TYPES_BY_CARD_DIRECTION[card_direction],bMarker:true}}if(legend.hitInBoundingRect(x,y))if(drawingObjectsController.handleEventMode===HANDLE_EVENT_MODE_HANDLE){drawingObjectsController.checkChartTextSelection();selector.resetSelection();selector.selectObject(drawing,pageIndex);selector.selection.chartSelection=drawing;drawing.selection.legend=legend;drawingObjectsController.arrPreTrackObjects.length=0;drawingObjectsController.arrPreTrackObjects.push(new AscFormat.MoveChartObjectTrack(legend, drawing));drawingObjectsController.changeCurrentState(new AscFormat.PreMoveState(drawingObjectsController,x,y,false,false,drawing,true,true));drawingObjectsController.updateSelectionState();drawingObjectsController.updateOverlay();return true}else return{objectId:drawing.Get_Id(),cursorType:"move",title:null}}var aCalcEntries=legend.calcEntryes;for(var i=0;i-1)if(drawingObjectsController.handleEventMode===HANDLE_EVENT_MODE_HANDLE){drawingObjectsController.arrPreTrackObjects.length=0;var oTrack=new AscFormat.ResizeTrackShapeImage(oPlotArea,oPlotArea.getCardDirectionByNum(hit_to_handles),drawingObjectsController);oTrack.chartSpace=drawing;drawingObjectsController.arrPreTrackObjects.push(oTrack); oPlotArea.selectStartPage=drawing.selectStartPage;drawingObjectsController.changeCurrentState(new AscFormat.PreResizeState(drawingObjectsController,oPlotArea,oPlotArea.getCardDirectionByNum(hit_to_handles)));drawingObjectsController.updateSelectionState();drawingObjectsController.updateOverlay();return true}else{var card_direction=oPlotArea.getCardDirectionByNum(hit_to_handles);return{objectId:drawing.Get_Id(),cursorType:AscFormat.CURSOR_TYPES_BY_CARD_DIRECTION[card_direction],bMarker:true}}if(oPlotArea.hitInBoundingRect(x, y))if(drawingObjectsController.handleEventMode===HANDLE_EVENT_MODE_HANDLE){drawingObjectsController.checkChartTextSelection();selector.resetSelection();selector.selectObject(drawing,pageIndex);selector.selection.chartSelection=drawing;drawing.selection.plotArea=oPlotArea;drawingObjectsController.arrPreTrackObjects.length=0;drawingObjectsController.arrPreTrackObjects.push(new AscFormat.MoveChartObjectTrack(oPlotArea,drawing));drawingObjectsController.changeCurrentState(new AscFormat.PreMoveState(drawingObjectsController, x,y,false,false,drawing,true,true));drawingObjectsController.updateSelectionState();drawingObjectsController.updateOverlay();return true}else return{objectId:drawing.Get_Id(),cursorType:"move",title:null}}var aCharts=drawing.chart.plotArea.charts;var series=drawing.getAllSeries();var _len=aCharts.length===1&&aCharts[0].getObjectType()===AscDFH.historyitem_type_PieChart?Math.min(1,series.length):series.length;for(var i=_len-1;i>-1;--i){var ser=series[i];var pts=ser.getNumPts();var oDLbl;for(var j= 0;j=oChartSizes.startX&&dTx<=oChartSizes.startX+oChartSizes.w&&dTy>=oChartSizes.startY&&dTy<=oChartSizes.startY+oChartSizes.h)if(drawingObjectsController.handleEventMode===HANDLE_EVENT_MODE_HANDLE){if(drawing.selection.plotArea==null||!AscFormat.CChartsDrawer.prototype._isSwitchCurrent3DChart(drawing)||!drawing.chartObj|| !drawing.chartObj.processor3D||!drawingObjectsController.canEdit()){drawingObjectsController.checkChartTextSelection();var bSeries=handleChartElements(drawing,drawingObjectsController,e,dTx,dTy,group,pageIndex,bWord);if(!bSeries){var oLabels;var aAxes=drawing.chart.plotArea.axId;for(var i=0;i1&&!e.ShiftKey&&!e.CtrlKey&&(drawingObjects.selection.groupSelection&& drawingObjects.selection.groupSelection.selectedObjects.length===1||drawingObjects.selectedObjects.length===1))if(drawing.getObjectType()===AscDFH.historyitem_type_ChartSpace&&drawingObjects.handleChartDoubleClick)drawingObjects.handleChartDoubleClick(drawing.parent,drawing,e,x,y,pageIndex);else if(drawing.getObjectType()===AscDFH.historyitem_type_OleObject&&drawingObjects.handleOleObjectDoubleClick)drawingObjects.handleOleObjectDoubleClick(drawing.parent,drawing,e,x,y,pageIndex);else if(drawing.signatureLine&& drawingObjects.handleSignatureDblClick)drawingObjects.handleSignatureDblClick(drawing.signatureLine.id,drawing.extX,drawing.extY);else if(2===e.ClickCount&&drawing.parent instanceof AscCommonWord.ParaDrawing&&drawing.parent.IsMathEquation())drawingObjects.handleMathDrawingDoubleClick(drawing.parent,e,x,y,pageIndex);else if(drawing.getObjectType()===AscDFH.historyitem_type_Shape)drawingObjects.handleDblClickEmptyShape(drawing);drawingObjects.updateOverlay();return true}else return{objectId:drawing.Get_Id(), cursorType:"move"};if(drawingObjects.handleEventMode===HANDLE_EVENT_MODE_HANDLE)return{objectId:drawing.Get_Id(),cursorType:"move"};return false}function handleInlineObjects(drawingObjectsController,drawingArr,e,x,y,pageIndex,bWord){var i;var drawing,ret;for(i=drawingArr.length-1;i>-1;--i){drawing=drawingArr[i];if(drawing.parent&&AscFormat.isRealNumber(drawing.parent.LineTop)&&AscFormat.isRealNumber(drawing.parent.LineBottom))if(ydrawing.parent.LineBottom)continue;switch(drawing.getObjectType()){case AscDFH.historyitem_type_Shape:case AscDFH.historyitem_type_ImageShape:case AscDFH.historyitem_type_OleObject:case AscDFH.historyitem_type_Cnx:case AscDFH.historyitem_type_LockedCanvas:{ret= handleInlineShapeImage(drawing,drawingObjectsController,e,x,y,pageIndex);if(ret)return ret;break}case AscDFH.historyitem_type_ChartSpace:{ret=handleInlineChart(drawing,drawingObjectsController,e,x,y,pageIndex);if(ret)return ret;break}case AscDFH.historyitem_type_GroupShape:{ret=handleGroup(drawing,drawingObjectsController,e,x,y,null,pageIndex,bWord);if(ret)return ret;break}}}return false}function handleMouseUpPreMoveState(drawingObjects,e,x,y,pageIndex,bWord){var state=drawingObjects.curState;state.drawingObjects.clearPreTrackObjects(); state.drawingObjects.changeCurrentState(new AscFormat.NullState(state.drawingObjects));var bHandle=false;if(!state.shift&&!state.ctrl&&state.bInside&&state.majorObjectIsSelected&&e.Button!==AscCommon.g_mouse_button_right)switch(state.majorObject.getObjectType()){case AscDFH.historyitem_type_GroupShape:{state.drawingObjects.checkChartTextSelection();state.drawingObjects.resetSelection();state.drawingObjects.selectObject(state.majorObject,pageIndex);state.drawingObjects.selection.groupSelection=state.majorObject; state.drawingObjects.OnMouseDown(e,x,y,pageIndex);state.drawingObjects.OnMouseUp(e,x,y,pageIndex);state.drawingObjects.drawingObjects&&state.drawingObjects.drawingObjects.sendGraphicObjectProps&&state.drawingObjects.drawingObjects.sendGraphicObjectProps();state.drawingObjects.document&&state.drawingObjects.document.Document_UpdateInterfaceState();bHandle=true;break}case AscDFH.historyitem_type_ChartSpace:{break}case AscDFH.historyitem_type_ImageShape:{break}}if(!bHandle)if(!state.shift&&!state.ctrl&& state.bInside&&state.majorObject.getObjectType()===AscDFH.historyitem_type_ImageShape){var sMediaName=state.majorObject.getMediaFileName();if(sMediaName){var oApi=state.drawingObjects.getEditorApi();if(oApi&&oApi.showVideoControl){oApi.showVideoControl(sMediaName,state.majorObject.extX,state.majorObject.extY,state.majorObject.transform);bHandle=true}}}if(!bHandle)if(e.CtrlKey&&state.majorObjectIsSelected){drawingObjects.deselectObject(state.majorObject);state.drawingObjects.drawingObjects&&state.drawingObjects.drawingObjects.sendGraphicObjectProps&& state.drawingObjects.drawingObjects.sendGraphicObjectProps();state.drawingObjects.document&&state.drawingObjects.document.Document_UpdateInterfaceState();drawingObjects.updateOverlay()}}function handleFloatTable(drawing,drawingObjectsController,e,x,y,group,pageIndex){if(drawing.hitInBoundingRect(x,y))return drawingObjectsController.handleMoveHit(drawing,e,x,y,group,false,pageIndex,false);else if(drawing.hitInInnerArea(x,y)){var content,invert_transform_text,tx,ty,hit_paragraph,par,check_hyperlink; if(drawingObjectsController.handleEventMode===HANDLE_EVENT_MODE_HANDLE){drawingObjectsController.resetSelection(true);(group?group:drawingObjectsController).selectObject(drawing,pageIndex);if(!group){drawingObjectsController.selection.textSelection=drawing;drawing.selectionSetStart(e,x,y,pageIndex)}else{group.selection.textSelection=drawing;drawing.selectionSetStart(e,x,y,pageIndex);drawingObjectsController.selectObject(group,pageIndex);drawingObjectsController.selection.groupSelection=group}drawingObjectsController.changeCurrentState(new AscFormat.TextAddState(drawingObjectsController, drawing,x,y));return true}else{drawing.updateCursorType(x,y,e);return{objectId:drawing.Get_Id(),cursorType:"text",updated:true}}}return false}window["AscFormat"]=window["AscFormat"]||{};window["AscFormat"].CheckCoordsNeedPage=CheckCoordsNeedPage;window["AscFormat"].handleSelectedObjects=handleSelectedObjects;window["AscFormat"].handleFloatObjects=handleFloatObjects;window["AscFormat"].handleInlineObjects=handleInlineObjects;window["AscFormat"].handleMouseUpPreMoveState=handleMouseUpPreMoveState})(window); "use strict";(function(window,undefined){var g_fontApplication=AscFonts.g_fontApplication;var g_oTextMeasurer=AscCommon.g_oTextMeasurer;var Geometry=AscFormat.Geometry;var EPSILON_TEXT_AUTOFIT=AscFormat.EPSILON_TEXT_AUTOFIT;var ObjectToDraw=AscFormat.ObjectToDraw;var PATH_DIV_EPSILON=.1;var UNDERLINE_DIV_EPSILON=3;function ParaDrawingStruct(nPageIndex,pDrawing){this.oDrawing=pDrawing;this.nPageIndex=nPageIndex}ParaDrawingStruct.prototype.Draw=function(pGraphics){if(this.oDrawing)this.oDrawing.Draw(0, 0,pGraphics,this.nPageIndex,0)};function CDocContentStructure(){this.m_nType=DRAW_COMMAND_CONTENT;this.m_aContent=[];this.m_aByLines=null;this.m_aDrawingsStruct=[];this.m_aBackgrounds=[];this.m_aBorders=[];this.m_aParagraphBackgrounds=[];this.m_oBoundsRect1=null;this.m_oBoundsRect2=null;this.m_aComments=[]}CDocContentStructure.prototype.Recalculate=function(oTheme,oColorMap,dWidth,dHeight,oShape){for(var i=0;i>0)>0;var nDivCount=bOddPaths?oWarpStruct.pathLst.length:oWarpStruct.pathLst.length>>1,oNextPointOnPolygon,oObjectToDrawNext,oMatrix=new AscCommon.CMatrix;aByPaths=oWarpStruct.getArrayPolygonsByPaths(PATH_DIV_EPSILON);var nLastIndex=0,dTmp,oBoundsChecker,oTemp,nIndex,aWarpedObjects2=[]; oBoundsChecker=new AscFormat.CSlideBoundsChecker;oBoundsChecker.init(100,100,100,100);var dMinX,dMaxX;for(j=0;j>0)+(dTmp-(dTmp>>0)>0?1:0);aWarpedObjects.length=0;oBoundsChecker.Bounds.ClearNoAttack(); for(j=nLastIndex;jdMinX)oBoundsChecker.Bounds.min_x=dMinX;if(oBoundsChecker.Bounds.max_x1?oBoundsChecker.Bounds:null);else{oNextPointOnPolygon=this.checkTransformByOddPath(oMatrix,oWarpedObject,aWarpedObjects[t+1],oNextPointOnPolygon, dContentHeight,dKoeff,bArcDown,oPolygon,XLimit);oWarpedObject.geometry.transform(oMatrix,dKoeff)}}}nLastIndex=nIndex}this.checkUnionPaths(aWarpedObjects2)};CDocContentStructure.prototype.checkContentReduct=function(oWarpStruct,dWidth,dHeight,oTheme,oColorMap,oShape,dOneLineWidth,XLimit,dContentHeight,dKoeff){var i,j,t,aByPaths,aWarpedObjects=[];var bOddPaths=oWarpStruct.pathLst.length/2-(oWarpStruct.pathLst.length/2>>0)>0;var nDivCount=bOddPaths?oWarpStruct.pathLst.length:oWarpStruct.pathLst.length>> 1,oNextPointOnPolygon,oObjectToDrawNext,oMatrix;aByPaths=oWarpStruct.getArrayPolygonsByPaths(PATH_DIV_EPSILON);var nLastIndex=0,dTmp,oBoundsChecker,oTemp,nIndex,aWarpedObjects2=[];oBoundsChecker=new AscFormat.CSlideBoundsChecker;oBoundsChecker.init(100,100,100,100);for(j=0;j>0)+(dTmp-(dTmp>>0)>0?1:0);aWarpedObjects.length=0;for(j=nLastIndex;joRet.maxDx)oRet.maxDx=oIntersection.DX;if(oIntersection.DY=0&&((X1-X3)*(Y4-Y3)-(Y1-Y3)*(X4-X3))*((X2-X3)*(Y4-Y3)-(Y2-Y3)*(X4-X3))>=0}function BoundsRect(){this.arrBounds=[{X0:0,Y0:0,X1:0,Y1:0},{X0:0,Y0:0,X1:0,Y1:0},{X0:0,Y0:0,X1:0,Y1:0},{X0:0,Y0:0,X1:0,Y1:0}]}BoundsRect.prototype.fromBoundsAndTransform=function(oBounds,oTransform){this.arrBounds[0].X0=oTransform.TransformPointX(oBounds.min_x,oBounds.min_y);this.arrBounds[0].Y0=oTransform.TransformPointY(oBounds.min_x,oBounds.min_y); this.arrBounds[0].X1=oTransform.TransformPointX(oBounds.max_x,oBounds.min_y);this.arrBounds[0].Y1=oTransform.TransformPointY(oBounds.max_x,oBounds.min_y);this.arrBounds[1].X0=oTransform.TransformPointX(oBounds.max_x,oBounds.max_y);this.arrBounds[1].Y0=oTransform.TransformPointY(oBounds.max_x,oBounds.max_y);this.arrBounds[1].X1=oTransform.TransformPointX(oBounds.max_x,oBounds.min_y);this.arrBounds[1].Y1=oTransform.TransformPointY(oBounds.max_x,oBounds.min_y);this.arrBounds[2].X0=oTransform.TransformPointX(oBounds.max_x, oBounds.max_y);this.arrBounds[2].Y0=oTransform.TransformPointY(oBounds.max_x,oBounds.max_y);this.arrBounds[2].X1=oTransform.TransformPointX(oBounds.min_x,oBounds.max_y);this.arrBounds[2].Y1=oTransform.TransformPointY(oBounds.min_x,oBounds.max_y);this.arrBounds[3].X0=oTransform.TransformPointX(oBounds.min_x,oBounds.max_y);this.arrBounds[3].Y0=oTransform.TransformPointY(oBounds.min_x,oBounds.max_y);this.arrBounds[3].X1=oTransform.TransformPointX(oBounds.min_x,oBounds.min_y);this.arrBounds[3].Y1=oTransform.TransformPointY(oBounds.min_x, oBounds.min_y)};BoundsRect.prototype.checkIntersection=function(oBoundsRect){var i,j,oCurBound1,oCurBound2;for(i=0;i<4;++i){oCurBound1=this.arrBounds[i];for(j=0;j<4;++j){oCurBound2=oBoundsRect[j];if(CheckIntervalIntersection(oCurBound1.X0,oCurBound1.Y0,oCurBound1.X1,oCurBound1.Y1,oCurBound2.X0,oCurBound2.Y0,oCurBound2.X1,oCurBound2.Y1))return true}}return false};BoundsRect.prototype.getParamValueProjection=function(x0,y0,x1,y1,x,y){var dX=x1-x0,dY=y1-y0;if(Math.abs(dX)>0){var dXSq=dX*dX;var xi=(x* dXSq+dX*dY*y-dY*(x1*y0-x0*y1))/(dXSq+dY*dY);return(xi-x1)/dX}else if(Math.abs(dY)>0){var dYSq=dY*dY;var yi=(y*dYSq+dX*dY*x+dX*(x1*y0-x0*y1))/(dX*dX+dYSq);return(yi-y1)/dY}return-1};BoundsRect.prototype.checkIntervalProjection=function(oInterval1,oInterval2){var param0=this.getParamValueProjection(oInterval1.X0,oInterval1.Y0,oInterval1.X1,oInterval1.Y1,oInterval2.X0,oInterval2.Y0);var param1=this.getParamValueProjection(oInterval1.X0,oInterval1.Y0,oInterval1.X1,oInterval1.Y1,oInterval2.X1,oInterval2.Y1); if(Math.abs(param0-.5)<=.5||Math.abs(param1-.5)<=.5){var dX=oInterval1.X0-oInterval1.X1,dY=oInterval1.Y0-oInterval1.Y1;var dLen=Math.sqrt(dX*dX+dY*dY);return((param1>1?1:param1<0?0:param1)-(param0>1?1:param0<0?0:param0))*dLen}else return 0};BoundsRect.prototype.checkBoundsRectProjection=function(oBoundsRect){var dX=0,dY=0,dLTemp;dLTemp=this.checkIntervalProjection(this.arrBounds[1],oBoundsRect.arrBounds[1]);if(dLTempdX)dX=Math.abs(dLTemp);dLTemp=this.checkIntervalProjection(this.arrBounds[2],oBoundsRect.arrBounds[3]);if(Math.abs(dLTemp)>dX)dX=Math.abs(dLTemp);dLTemp=this.checkIntervalProjection(this.arrBounds[0], oBoundsRect.arrBounds[1]);if(Math.abs(dLTemp)>dX)dX=Math.abs(dLTemp);dLTemp=this.checkIntervalProjection(this.arrBounds[0],oBoundsRect.arrBounds[3]);if(Math.abs(dLTemp)>dX)dX=Math.abs(dLTemp);return{DX:dX,DY:dY}};CDocContentStructure.prototype.checkIntersectionBounds=function(oBounds1,oTransform1,oBounds2,oTransform2,nDist){if(!this.m_oBoundsRect1){this.m_oBoundsRect1=new BoundsRect;this.m_oBoundsRect2=new BoundsRect}this.m_oBoundsRect1.fromBoundsAndTransform(oBounds1,oTransform1);this.m_oBoundsRect2.fromBoundsAndTransform(oBounds2, oTransform2);if(this.m_oBoundsRect1.checkIntersection(this.m_oBoundsRect2.arrBounds)){var oBounds=this.m_oBoundsRect1.checkBoundsRectProjection(this.m_oBoundsRect2);oBounds.DX/=nDist;return oBounds}return{DX:0,DY:0}};CDocContentStructure.prototype.checkTransformByOddPath=function(oMatrix,oWarpedObject,oObjectToDrawNext,oNextPointOnPolygon,dContentHeight,dKoeff,bArcDown,oPolygon,XLimit){var x0,y0,x1,y1,x0t,y0t,x1t,y1t,cX,cX2,dX,dY,dX2,dY2,dNorm,oPointOnPolygon;x0=oWarpedObject.x*dKoeff;y0=oWarpedObject.y* dKoeff;x1=x0;if(bArcDown)y1=0;else y1=dContentHeight*dKoeff;cX=oWarpedObject.x/XLimit;var oRet=null;if(oNextPointOnPolygon)oPointOnPolygon=oNextPointOnPolygon;else oPointOnPolygon=oPolygon.getPointOnPolygon(cX,true);x1t=oPointOnPolygon.x;y1t=oPointOnPolygon.y;dX=oPointOnPolygon.oP2.x-oPointOnPolygon.oP1.x;dY=oPointOnPolygon.oP2.y-oPointOnPolygon.oP1.y;if(bArcDown){dX=-dX;dY=-dY}if(oObjectToDrawNext&&AscFormat.isRealNumber(oObjectToDrawNext.x)&&AscFormat.isRealNumber(oObjectToDrawNext.y)&&oObjectToDrawNext.x> oWarpedObject.x){cX2=oObjectToDrawNext.x/XLimit;oRet=oPolygon.getPointOnPolygon(cX2,true);dX2=oRet.oP2.x-oRet.oP1.x;dY2=oRet.oP2.y-oRet.oP1.y;if(bArcDown){dX2=-dX2;dY2=-dY2}dX=dX+dX2;dY=dY+dY2}else oRet=null;dNorm=Math.sqrt(dX*dX+dY*dY);if(bArcDown){x0t=x1t+dY/dNorm*y0;y0t=y1t-dX/dNorm*y0}else{x0t=x1t+dY/dNorm*(dContentHeight*dKoeff-y0);y0t=y1t-dX/dNorm*(dContentHeight*dKoeff-y0)}oMatrix.shx=(x1t-x0t)/(y1-y0);oMatrix.sy=(y1t-y0t)/(y1-y0);oMatrix.sx=oMatrix.sy;oMatrix.shy=-oMatrix.shx;oMatrix.tx=x0t- x0*oMatrix.sx-y0*oMatrix.shx;oMatrix.ty=y0t-x0*oMatrix.shy-y0*oMatrix.sy;return oRet};CDocContentStructure.prototype.checkUnionPaths=function(aWarpedObjects){var aToCheck=[];var aWarpedObjects2,i,j,k;if(Array.isArray(aWarpedObjects))aToCheck.push(aWarpedObjects);else for(j=0;j>0);oLine.setFill(oUnifill);return oLine}function CTextDrawer(dWidth,dHeight,bDivByLInes,oTheme,bDivGlyphs){this.m_oFont={Name:"",FontSize:-1,Style:-1};this.m_oTheme=oTheme;this.Width=dWidth;this.Height=dHeight;this.m_oTransform=new AscCommon.CMatrix;this.pathW=1E9;this.pathH=1E9;this.xKoeff=this.pathW;this.yKoeff=this.pathH;this.m_aStack=[];this.m_oDocContentStructure= null;this.m_aCommands=[];this.m_aDrawings=[];this.m_oTextPr=null;this.m_oGrFonts=new AscCommon.CGrRFonts;this.m_oCurComment=null;this.m_oPen=new AscCommon.CPen;this.m_oBrush=new AscCommon.CBrush;this.m_oLine=null;this.m_oFill=null;this.m_oPen.Color.R=-1;this.m_oBrush.Color1.R=-1;this.m_oBrush.Color2.R=-1;this.m_oFontSlotFont=new AscCommon.CFontSetup;this.LastFontOriginInfo={Name:"",Replace:null};this.GrState=new AscCommon.CGrState;this.GrState.Parent=this;this.m_bDivByLines=bDivByLInes===true;this.m_bDivGlyphs= bDivGlyphs===true;this.m_aByLines=null;this.m_nCurLineIndex=-1;this.m_aStackLineIndex=null;this.m_aStackCurRowMaxIndex=null;this.m_aByParagraphs=null;this.m_oObjectToDraw=null;this.m_bTurnOff=false;this.bCheckLines=false;this.lastX=null;this.lastY=null;if(this.m_bDivByLines){this.m_aByLines=[];this.m_aStackLineIndex=[];this.m_aStackCurRowMaxIndex=[]}else this.m_aByParagraphs=[];this.m_bIsTextDrawer=true;this.pathMemory=new AscFormat.CPathMemory}CTextDrawer.prototype={SetObjectToDraw:function(oObjectToDraw){this.m_oObjectToDraw= oObjectToDraw},p_color:function(r,g,b,a){if(this.m_oPen.Color.R!=r||this.m_oPen.Color.G!=g||this.m_oPen.Color.B!=b){this.m_oPen.Color.R=r;this.m_oPen.Color.G=g;this.m_oPen.Color.B=b}if(this.m_oPen.Color.A!=a)this.m_oPen.Color.A=a;var oLastCommand=this.m_aStack[this.m_aStack.length-1];if(oLastCommand)if(oLastCommand.m_nType===DRAW_COMMAND_LINE&&oLastCommand.m_nDrawType===3)if(this.m_oTextPr&&this.m_oTheme){var oTextPr=this.m_oTextPr.Copy();if(!oTextPr.TextOutline)oTextPr.TextOutline=new AscFormat.CLn; oTextPr.TextOutline.Fill=AscFormat.CreateUnfilFromRGB(r,g,b);this.SetTextPr(oTextPr,this.m_oTheme);return}this.Get_PathToDraw(false,true)},AddSmartRect:function(){},p_width:function(w){var val=w/1E3;if(this.m_oPen.Size!=val)this.m_oPen.Size=val;this.Get_PathToDraw(false,true)},p_dash:function(w){},b_color1:function(r,g,b,a){if(this.m_oBrush.Color1.R!==r||this.m_oBrush.Color1.G!==g||this.m_oBrush.Color1.B!==b){this.m_oBrush.Color1.R=r;this.m_oBrush.Color1.G=g;this.m_oBrush.Color1.B=b}if(this.m_oBrush.Color1.A!== a)this.m_oBrush.Color1.A=a;var oLastCommand=this.m_aStack[this.m_aStack.length-1];if(oLastCommand)if(oLastCommand.m_nType===DRAW_COMMAND_LINE&&oLastCommand.m_nDrawType===0)if(this.m_oTextPr&&this.m_oTheme){var oTextPr=this.m_oTextPr.Copy();oTextPr.Unifill=undefined;oTextPr.TextFill=undefined;oTextPr.FontRef=undefined;oTextPr.Color=new CDocumentColor(r,g,b,false);this.SetTextPr(oTextPr,this.m_oTheme);return}this.Get_PathToDraw(false,true)},set_fillColor:function(R,G,B){this.m_oFill=AscFormat.CreateUniFillByUniColor(AscFormat.CreateUniColorRGB(R, G,B));this.Get_PathToDraw(false,true)},b_color2:function(r,g,b,a){if(this.m_oBrush.Color2.R!=r||this.m_oBrush.Color2.G!=g||this.m_oBrush.Color2.B!=b){this.m_oBrush.Color2.R=r;this.m_oBrush.Color2.G=g;this.m_oBrush.Color2.B=b}if(this.m_oBrush.Color2.A!=a)this.m_oBrush.Color2.A=a;this.Get_PathToDraw(false,true)},put_brushTexture:function(src,mode){this.m_oBrush.Color1.R=-1;this.m_oBrush.Color1.G=-1;this.m_oBrush.Color1.B=-1;this.m_oBrush.Color1.A=-1;this.Get_PathToDraw(false,true)},SetShd:function(oShd){if(oShd)if(oShd.Value!== Asc.c_oAscShdNil)if(oShd.Unifill)this.m_oFill=oShd.Unifill;else if(oShd.Color)this.m_oFill=AscFormat.CreateUnfilFromRGB(oShd.Color.r,oShd.Color.g,oShd.Color.b);else this.m_oFill=null;else this.m_oFill=null;else this.m_oFill=null;this.Get_PathToDraw(false,true)},SetBorder:function(oBorder){if(oBorder&&oBorder.Value!==border_None)this.m_oLine=CreatePenFromParams(oBorder.Unifill?oBorder.Unifill:AscFormat.CreateUnfilFromRGB(oBorder.Color.r,oBorder.Color.g,oBorder.Color.b),this.m_oPen.Style,this.m_oPen.LineCap, this.m_oPen.LineJoin,this.m_oPen.LineWidth,this.m_oPen.Size);else this.m_oLine=null},SetAdditionalProps:function(oProps){oProps&&this.SetTextPr(oProps,this.m_oTheme)},put_BrushTextureAlpha:function(alpha){},put_BrushGradient:function(gradFill,points,transparent){},StartCheckTableDraw:function(){this.Start_Command(DRAW_COMMAND_TABLE)},EndCheckTableDraw:function(){this.End_Command()},Start_Command:function(commandId,param,index,nType){this.m_aCommands.push(commandId);var oNewStructure=null;switch(commandId){case DRAW_COMMAND_NO_CREATE_GEOM:{break}case DRAW_COMMAND_CONTENT:{oNewStructure= new CDocContentStructure;this.m_aStackLineIndex.push(this.m_nCurLineIndex);break}case DRAW_COMMAND_PARAGRAPH:{oNewStructure=new CParagraphStructure;if(!this.m_bDivByLines)this.m_aByParagraphs[this.m_aByParagraphs.length]=[];break}case DRAW_COMMAND_LINE:{var oPrevStruct=this.m_aStack[this.m_aStack.length-1];if(oPrevStruct.m_nType===DRAW_COMMAND_PARAGRAPH&&oPrevStruct.m_aContent[index]){oPrevStruct.m_aContent[index].m_nDrawType=nType;this.m_aStack.push(oPrevStruct.m_aContent[index])}else{oNewStructure= new CLineStructure(param);oNewStructure.m_nDrawType=nType;if(this.m_bDivByLines){++this.m_nCurLineIndex;if(!Array.isArray(this.m_aByLines[this.m_nCurLineIndex]))this.m_aByLines[this.m_nCurLineIndex]=[];this.m_aByLines[this.m_nCurLineIndex].push(oNewStructure);if(this.m_aStackCurRowMaxIndex[this.m_aStackCurRowMaxIndex.length-1]>2;for(i=0;i>0;var oUnifill=oCopyTextPr.TextFill?oCopyTextPr.TextFill:oCopyTextPr.Unifill;if((!oUnifill|| !oUnifill.fill||!oUnifill.fill.type===Asc.c_oAscFill._SOLID||!oUnifill.fill.color)&&oCopyTextPr.Color)oUnifill=AscFormat.CreateUniFillByUniColor(AscFormat.CreateUniColorRGB(oCopyTextPr.Color.r,oCopyTextPr.Color.g,oCopyTextPr.Color.b));if(oUnifill)oCopyTextPr.TextOutline.Fill=oUnifill;this.SetTextPr(oCopyTextPr,this.m_oTheme)}this._s();this._m(x,y);this._l(r,y);this.ds();if(oCopyTextPr)this.SetTextPr(oTextPr,this.m_oTheme);return}this._s();this._m(x,y);this.checkCurveBezier(x,y,x+(r-x)/3,y,x+2/3*(r- x),y,r,y);this._l(r,y+penW);this.checkCurveBezier(r,y+penW,x+2/3*(r-x),y+penW,x+(r-x)/3,y+penW,x,y+penW);this._z();this.ds();this.df()},drawHorLine2:function(align,y,x,r,penW){var _y=y;switch(align){case 0:{_y=y+penW/2;break}case 1:{break}case 2:{_y=y-penW/2;break}}{this._s();this._m(x,_y-penW);this.checkCurveBezier(x,_y-penW,x+(r-x)/3,_y-penW,x+2/3*(r-x),_y-penW,r,_y-penW);this._l(r,_y);this.checkCurveBezier(r,_y,x+2/3*(r-x),_y,x+(r-x)/3,_y,x,_y);this._z();this.ds();this.df();this._s();this._m(x, _y+penW);this.checkCurveBezier(x,_y+penW,x+(r-x)/3,_y+penW,x+2/3*(r-x),_y+penW,r,_y+penW);this._l(r,_y+penW+penW);this.checkCurveBezier(r,_y+penW+penW,x+2/3*(r-x),_y+penW+penW,x+(r-x)/3,_y+penW+penW,x,_y+penW+penW);this._z();this.ds();this._e()}},drawVerLine:function(align,x,y,b,penW,bMath){if(bMath){var oTextPr=this.GetTextPr();var oCopyTextPr;if(oTextPr){oCopyTextPr=oTextPr.Copy();oCopyTextPr.TextOutline=new AscFormat.CLn;oCopyTextPr.TextOutline.w=36E3*penW>>0;var oUnifill=oCopyTextPr.TextFill? oCopyTextPr.TextFill:oCopyTextPr.Unifill;if((!oUnifill||!oUnifill.fill||!oUnifill.fill.type===Asc.c_oAscFill.FILL_TYPE_SOLID||!oUnifill.fill.color)&&oCopyTextPr.Color)oUnifill=AscFormat.CreateUniFillByUniColor(AscFormat.CreateUniColorRGB(oCopyTextPr.Color.r,oCopyTextPr.Color.g,oCopyTextPr.Color.b));if(oUnifill)oCopyTextPr.TextOutline.Fill=oUnifill;this.SetTextPr(oCopyTextPr,this.m_oTheme)}this._s();var _x=x;switch(align){case 0:{_x=x+penW/2;break}case 1:{break}case 2:{_x=x-penW/2}}this._m(_x,y);this._l(_x, b);this.ds();if(oCopyTextPr)this.SetTextPr(oTextPr,this.m_oTheme);return}var nLastCommand=this.m_aCommands[this.m_aCommands.length-1],bOldVal;if(nLastCommand===DRAW_COMMAND_TABLE){bOldVal=this.bCheckLines;this.bCheckLines=false}this.p_width(1E3*penW);this._s();var _x=x;switch(align){case 0:{_x=x+penW/2;break}case 1:{break}case 2:{_x=x-penW/2}}this._m(_x,y);this._l(_x,b);this.ds();if(nLastCommand===DRAW_COMMAND_TABLE)this.bCheckLines=bOldVal},drawHorLineExt:function(align,y,x,r,penW,leftMW,rightMW){var nLastCommand= this.m_aCommands[this.m_aCommands.length-1];if(nLastCommand===DRAW_COMMAND_TABLE){var bOldVal=this.bCheckLines;this.bCheckLines=false;this.p_width(penW*1E3);this._s();this._m(x,y);this._l(r,y);this.ds();this.bCheckLines=bOldVal}else this.drawHorLine(align,y,x+leftMW,r+rightMW,penW)},DrawTextArtComment:function(Element){this.m_oCurComment=Element;this.rect(Element.x0,Element.y0,Element.x1-Element.x0,Element.y1-Element.y0);this.df();this.m_oCurComment=null},rect:function(x,y,w,h){if(this.m_bTurnOff)return; var oLastCommand=this.m_aStack[this.m_aStack.length-1];if(oLastCommand&&(oLastCommand.m_nDrawType===2||oLastCommand.m_nDrawType===4)){this.Get_PathToDraw(true,true);this._m(x,y);this.checkCurveBezier(x,y,x+w/3,y,x+2/3*w,y,x+w,y);this._l(x+w,y+h);this.checkCurveBezier(x+w,y+h,x+2/3*w,y+h,x+w/3,y+h,x,y+h);this._z();this.ds()}else{var _x=x;var _y=y;var _r=x+w;var _b=y+h;this.Get_PathToDraw(true,true);this._m(_x,_y);this._l(_r,_y);this._l(_r,_b);this._l(_x,_b);this._l(_x,_y)}},TableRect:function(x,y, w,h){this.rect(x,y,w,h);this.df()},AddClipRect:function(x,y,w,h){var __rect=new AscCommon._rect;__rect.x=x;__rect.y=y;__rect.w=w;__rect.h=h;this.GrState.AddClipRect(__rect)},RemoveClipRect:function(){},SetClip:function(r){},RemoveClip:function(){},GetTransform:function(){return this.m_oTransform},GetLineWidth:function(){return 0},GetPen:function(){return 0},GetBrush:function(){return 0},drawFlowAnchor:function(x,y){},SavePen:function(){this.GrState.SavePen()},RestorePen:function(){this.GrState.RestorePen()}, SaveBrush:function(){this.GrState.SaveBrush()},RestoreBrush:function(){this.GrState.RestoreBrush()},SavePenBrush:function(){this.GrState.SavePenBrush()},RestorePenBrush:function(){this.GrState.RestorePenBrush()},SaveGrState:function(){this.GrState.SaveGrState()},RestoreGrState:function(){this.GrState.RestoreGrState()},StartClipPath:function(){this.m_bTurnOff=true},EndClipPath:function(){this.m_bTurnOff=false},SetTextPr:function(textPr,theme){if(theme&&textPr&&textPr.ReplaceThemeFonts)textPr.ReplaceThemeFonts(theme.themeElements.fontScheme); var bNeedGetPath=false;if(!this.CheckCompareFillBrush(textPr,this.m_oTextPr))bNeedGetPath=true;this.m_oTextPr=textPr;if(bNeedGetPath)this.Get_PathToDraw(false,true);if(theme)this.m_oGrFonts.checkFromTheme(theme.themeElements.fontScheme,this.m_oTextPr.RFonts);else this.m_oGrFonts=this.m_oTextPr.RFonts},CheckCompareFillBrush:function(oTextPr1,oTextPr2){if(!oTextPr1&&oTextPr2||oTextPr1&&!oTextPr2)return false;if(oTextPr1&&oTextPr2){var oFill1=this.GetFillFromTextPr(oTextPr1);var oFill2=this.GetFillFromTextPr(oTextPr2); if(!CompareBrushes(oFill1,oFill2))return false;var oPen1=this.GetPenFromTextPr(oTextPr1);var oPen2=this.GetPenFromTextPr(oTextPr2);if(!CompareBrushes(oPen1,oPen2))return false}return true},GetFillFromTextPr:function(oTextPr){if(oTextPr){if(oTextPr.TextFill)return oTextPr.TextFill;if(oTextPr.Unifill)return oTextPr.Unifill;if(oTextPr.Color){var oColor=oTextPr.Color;if(oColor.Auto&&oTextPr.FontRef&&oTextPr.FontRef.Color&&this.m_oTheme){var oColorMap=AscFormat.DEFAULT_COLOR_MAP;var oApi=window&&window.editor; if(oApi){var oDoc=oApi.WordControl&&oApi.WordControl.m_oLogicDocument;if(oDoc&&oDoc.Get_ColorMap){var _cm=oDoc.Get_ColorMap();if(_cm)oColorMap=_cm}}oTextPr.FontRef.Color.check(this.m_oTheme,oColorMap);var RGBA=oTextPr.FontRef.Color.RGBA;oColor=new CDocumentColor(RGBA.R,RGBA.G,RGBA.B,RGBA.A)}return AscFormat.CreateUnfilFromRGB(oColor.r,oColor.g,oColor.b)}return null}else if(this.m_oBrush.Color1.R!==-1){var Color=this.m_oBrush.Color1;return AscFormat.CreateUnfilFromRGB(Color.R,Color.G,Color.B)}else return AscFormat.CreateUnfilFromRGB(0, 0,0)},GetPenFromTextPr:function(oTextPr){if(oTextPr)return oTextPr.TextOutline;return null},GetTextPr:function(){return this.m_oTextPr},DrawPresentationComment:function(type,x,y,w,h){},private_removeVectors:function(){},private_restoreVectors:function(){},drawMailMergeField:function(x,y,w,h){}};function PolygonWrapper(oPolygon){this.oPolygon=oPolygon;var dCurLen=0;this.aLength=[];this.aLength[0]=0;var oPrevPoint=oPolygon[0],oCurPoint,dDX,dDY;for(var i=1;i>1;var nStartIndex=0,nDelta=nIndex-nStartIndex,dNextBool,nTempIndex;nTempIndex=nIndex+1;dNextBool=nTempIndex0&&(this.aLength[nIndex]> dFindLen||dNextBool)){if(dNextBool)nStartIndex=nIndex;nIndex=nStartIndex+(nDelta>>1);nTempIndex=nIndex+1;dNextBool=nTempIndex0&&Math.abs(dx)max_width)max_width=par.Lines[j].Ranges[0].W}return max_width+2}window["AscFormat"]=window["AscFormat"]||{};window["AscFormat"].PATH_DIV_EPSILON=PATH_DIV_EPSILON;window["AscFormat"].ParaDrawingStruct=ParaDrawingStruct;window["AscFormat"].DRAW_COMMAND_TABLE=DRAW_COMMAND_TABLE;window["AscFormat"].DRAW_COMMAND_CONTENT=DRAW_COMMAND_CONTENT;window["AscFormat"].DRAW_COMMAND_PARAGRAPH= DRAW_COMMAND_PARAGRAPH;window["AscFormat"].DRAW_COMMAND_LINE=DRAW_COMMAND_LINE;window["AscFormat"].DRAW_COMMAND_DRAWING=DRAW_COMMAND_DRAWING;window["AscFormat"].DRAW_COMMAND_HIDDEN_ELEM=DRAW_COMMAND_HIDDEN_ELEM;window["AscFormat"].DRAW_COMMAND_NO_CREATE_GEOM=DRAW_COMMAND_NO_CREATE_GEOM;window["AscFormat"].DRAW_COMMAND_TABLE_ROW=DRAW_COMMAND_TABLE_ROW;window["AscFormat"].CreatePenFromParams=CreatePenFromParams;window["AscFormat"].CTextDrawer=CTextDrawer;window["AscFormat"].PolygonWrapper=PolygonWrapper; window["AscFormat"].GetRectContentWidth=GetRectContentWidth})(window);"use strict";(function(window,document){var FontStyle=AscFonts.FontStyle;var DecodeBase64Char=AscFonts.DecodeBase64Char;var b64_decode=AscFonts.b64_decode;var g_map_font_index={};var g_fonts_streams=[];function ZBase32Encoder(){this.EncodingTable="ybndrfg8ejkmcpqxot1uwisza345h769";this.DecodingTable="undefined"==typeof Uint8Array?new Array(128):new Uint8Array(128);var ii=0;for(ii=0;ii<128;ii++)this.DecodingTable[ii]=255;var _len_32= this.EncodingTable.length;for(ii=0;ii<_len_32;ii++)this.DecodingTable[this.EncodingTable.charCodeAt(ii)]=ii;this.GetUTF16_fromUnicodeChar=function(code){if(code<65536)return String.fromCharCode(code);else{code-=65536;return String.fromCharCode(55296|code>>10&1023)+String.fromCharCode(56320|code&1023)}};this.GetUTF16_fromUTF8=function(pBuffer){var _res="";var lIndex=0;var lCount=pBuffer.length;var val=0;while(lIndex= 55296&&code<=57343&&pCur>6);result.push(128|code&63)}else if(code<65536){result.push(224|code>>12);result.push(128|code>>6&63);result.push(128|code&63)}else if(code<2097151){result.push(240|code>>18);result.push(128|code>>12&63);result.push(128|code>>6&63);result.push(128|code&63)}else if(code<67108863){result.push(248|code>>24);result.push(128|code>>18&63);result.push(128| code>>12&63);result.push(128|code>>6&63);result.push(128|code&63)}else if(code<2147483647){result.push(252|code>>30);result.push(128|code>>24&63);result.push(128|code>>18&63);result.push(128|code>>12&63);result.push(128|code>>6&63);result.push(128|code&63)}}return result};this.Encode=function(sData){return encodeURIComponent(sData);var data=this.GetUTF8_fromUTF16(sData);var encodedResult="";var len=data.length;for(var i=0;i0){var index=0;if(bitCount>=5){var _del=Math.pow(2,bitCount-5);index=buffer/_del&31}else{index=buffer&31>>5-bitCount;index<<=5-bitCount}encodedResult+=this.EncodingTable.charAt(index);bitCount-=5}}return encodedResult};this.Decode=function(data){var result=[];var _len=data.length;var obj={data:data,index:new Array(8)};var cur=0;while(cur<_len){cur=this.CreateIndexByOctetAndMovePosition(obj,cur);var shortByteCount=0;var buffer=0;for(var j= 0;j<8&&obj.index[j]!=-1;++j){buffer*=32;buffer+=this.DecodingTable[obj.index[j]]&31;shortByteCount++}var bitCount=shortByteCount*5;while(bitCount>=8){var _del=Math.pow(2,bitCount-8);var _res=buffer/_del&255;result.push(_res);bitCount-=8}}this.GetUTF16_fromUTF8(result)};this.CreateIndexByOctetAndMovePosition=function(obj,currentPosition){var j=0;while(j<8){if(currentPosition>=obj.data.length){obj.index[j++]=-1;continue}if(this.IgnoredSymbol(obj.data.charCodeAt(currentPosition))){currentPosition++; continue}obj.index[j]=obj.data[currentPosition];j++;currentPosition++}return currentPosition};this.IgnoredSymbol=function(checkedSymbol){return checkedSymbol>=128||this.DecodingTable[checkedSymbol]==255}}var bIsLocalFontsUse=false;function _is_support_cors(){if(window["NATIVE_EDITOR_ENJINE"]===true)return false;var xhrSupported=new XMLHttpRequest;return!!xhrSupported&&"withCredentials"in xhrSupported}var bIsSupportOriginalFormatFonts=_is_support_cors();function postLoadScript(scriptName){window.postMessage({type:"FROM_PAGE_LOAD_SCRIPT", text:scriptName},"*")}function CFontFileLoader(id){this.LoadingCounter=0;this.Id=id;this.Status=-1;this.stream_index=-1;this.callback=null;this.IsNeedAddJSToFontPath=true;this.CanUseOriginalFormat=true;var oThis=this;this.CheckLoaded=function(){return 0==this.Status||1==this.Status};this._callback_font_load=function(){if(!window[oThis.Id]){oThis.LoadingCounter++;if(oThis.LoadingCounter=srcLen)break;var nCh=DecodeBase64Char(szSrc.charCodeAt(index++));if(nCh== -1){i--;continue}dwCurr<<=6;dwCurr|=nCh;nBits+=6}dwCurr<<=24-nBits;for(i=0;i>>16;dwCurr<<=8}}else{var p=b64_decode;while(index=srcLen)break;var nCh=p[szSrc.charCodeAt(index++)];if(nCh==undefined){i--;continue}dwCurr<<=6;dwCurr|=nCh;nBits+=6}dwCurr<<=24-nBits;for(i=0;i>>16;dwCurr<<=8}}}}var g_font_files,g_font_infos;(function(){var i, l;var files=window["__fonts_files"];if(!files&&window["native"]&&window["native"]["GenerateAllFonts"])window["native"]["GenerateAllFonts"]();files=window["__fonts_files"];l=files?files.length:0;g_font_files=new Array(l);for(i=0;i=0;i--){var _id=AscCommon.getFullImageSrc2(_images[i]);if(this.map_image_index[_id]&&this.map_image_index[_id].Status===ImageLoadStatus.Complete)_images.splice(i,1)}if(0===_images.length)return}if(this.ThemeLoader==null)this.Api.asyncImagesDocumentStartLoaded();else this.ThemeLoader.asyncImagesStartLoaded();this.images_loading=[];for(var id in _images)this.images_loading[this.images_loading.length]= AscCommon.getFullImageSrc2(_images[id]);if(!this.bIsAsyncLoadDocumentImages){this.nNoByOrderCounter=0;this._LoadImages()}else{var _len=this.images_loading.length;if(_len===0)return void this.LoadDocumentImagesCallback();var todo=_len;var that=this;var done=function(){todo--;if(todo===0){that.images_loading.splice(0,_len);setTimeout(function(){that.LoadDocumentImagesCallback()},100);done=function(){}}};for(var i=0;i<_len;i++)this.LoadImageAsync(i,done);return;this.images_loading.splice(0,_len);var that= this;setTimeout(function(){that.LoadDocumentImagesCallback()},3E3)}};this.loadImageByUrl=function(_image,_url){if(this.isBlockchainSupport)_image.preload_crypto(_url);else _image.src=_url};this._LoadImages=function(){for(var i=0;i>0)+"px";this.HtmlElement.style.top=(_y*g_dKoef_mm_to_pix+.5>> 0)+"px";this.HtmlElement.style.width=((_r-_x)*g_dKoef_mm_to_pix+.5>>0)+"px";this.HtmlElement.style.height=((_b-_y)*g_dKoef_mm_to_pix+.5>>0)+"px";if(api!==undefined&&api.CheckRetinaElement&&api.CheckRetinaElement(this.HtmlElement)){var _W=(_r-_x)*g_dKoef_mm_to_pix+.5>>0;var _H=(_b-_y)*g_dKoef_mm_to_pix+.5>>0;this.HtmlElement.style.width=_W+"px";this.HtmlElement.style.height=_H+"px";if(this.HtmlElement.tagName==="CANVAS")AscCommon.calculateCanvasSize(this.HtmlElement);else if(AscCommon.AscBrowser.isCustomScalingAbove2()){this.HtmlElement.width= _W<<1;this.HtmlElement.height=_H<<1}else{this.HtmlElement.width=_W;this.HtmlElement.height=_H}}else{this.HtmlElement.width=(_r-_x)*g_dKoef_mm_to_pix+.5>>0;this.HtmlElement.height=(_b-_y)*g_dKoef_mm_to_pix+.5>>0}};this.GetCSS_width=function(){return(this.AbsolutePosition.R-this.AbsolutePosition.L)*g_dKoef_mm_to_pix+.5>>0};this.GetCSS_height=function(){return(this.AbsolutePosition.B-this.AbsolutePosition.T)*g_dKoef_mm_to_pix+.5>>0}}function CControlContainer(){this.Bounds=new CBounds;this.Anchor=g_anchor_left| g_anchor_top;this.Name=null;this.Parent=null;this.TabIndex=null;this.HtmlElement=null;this.AbsolutePosition=new CBounds;this.Controls=[];this.AddControl=function(ctrl){ctrl.Parent=this;this.Controls[this.Controls.length]=ctrl};this.Resize=function(_width,_height,api){if(null==this.Parent){this.AbsolutePosition.L=0;this.AbsolutePosition.T=0;this.AbsolutePosition.R=_width;this.AbsolutePosition.B=_height;if(null!=this.HtmlElement){var lCount=this.Controls.length;for(var i=0;i>0)+"px";this.HtmlElement.style.top=(_y*g_dKoef_mm_to_pix+.5>>0)+"px";this.HtmlElement.style.width=((_r-_x)*g_dKoef_mm_to_pix+.5>>0)+"px";this.HtmlElement.style.height=((_b-_y)*g_dKoef_mm_to_pix+.5>>0)+"px";var lCount=this.Controls.length;for(var i=0;i>0};this.GetCSS_height=function(){return(this.AbsolutePosition.B-this.AbsolutePosition.T)*g_dKoef_mm_to_pix+.5>>0}}function CreateControlContainer(name){var ctrl=new CControlContainer;ctrl.Name=name;ctrl.HtmlElement=document.getElementById(name);return ctrl}function CreateControl(name){var ctrl=new CControl;ctrl.Name=name;ctrl.HtmlElement=document.getElementById(name);return ctrl} window["AscCommon"]=window["AscCommon"]||{};window["AscCommon"].g_anchor_left=g_anchor_left;window["AscCommon"].g_anchor_top=g_anchor_top;window["AscCommon"].g_anchor_right=g_anchor_right;window["AscCommon"].g_anchor_bottom=g_anchor_bottom;window["AscCommon"].CreateControlContainer=CreateControlContainer;window["AscCommon"].CreateControl=CreateControl})(window);"use strict";(function(window,undefined){var AscBrowser=AscCommon.AscBrowser;var TRACK_CIRCLE_RADIUS=5;var TRACK_RECT_SIZE2=4;var TRACK_RECT_SIZE= 8;var TRACK_RECT_SIZE_CT=6;var TRACK_DISTANCE_ROTATE=25;var TRACK_DISTANCE_ROTATE2=25;var TRACK_ADJUSTMENT_SIZE=10;var TRACK_WRAPPOINTS_SIZE=6;var ROTATE_TRACK_W=21;var bIsUseImageRotateTrack=true;if(bIsUseImageRotateTrack){window.g_track_rotate_marker=new Image;window.g_track_rotate_marker;window.g_track_rotate_marker.asc_complete=false;window.g_track_rotate_marker.onload=function(){window.g_track_rotate_marker.asc_complete=true};window.g_track_rotate_marker.src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABUAAAAVCAMAAACeyVWkAAAAVFBMVEUAAAD///////////////////////////////////////////////////////98fHy2trb09PTT09OysrKqqqqJiYng4ODr6+uamprGxsbi4uKGhoYjgM0eAAAADnRSTlMAy00k7/z0jbeuMzDljsugwZgAAACpSURBVBjTdZHbEoMgDESDAl6bgIqX9v//s67UYpm6D0xyYMImoaiuUr3pVdVRUtnwqaY8YaE5SRcfaPgqc+DSIh7WIGGaEVoUqRGN4oZlcDIiqYlaPjQz5CNu6cFJwLiuSO3nlLBDrKhn3l4rcnH4NcAdGd5EZMfCsoMFBxM6CD57G+u6vC48PMVnHtrYhP/x+7+3cw7zdJnD3cyA7QXa4nYXaW+a9Xdvb6zqE5Jb7LmzAAAAAElFTkSuQmCC"; window.g_track_rotate_marker2=new Image;window.g_track_rotate_marker2;window.g_track_rotate_marker2.asc_complete=false;window.g_track_rotate_marker2.onload=function(){window.g_track_rotate_marker2.asc_complete=true};window.g_track_rotate_marker2.src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACgAAAAoCAMAAAC7IEhfAAAAeFBMVEUAAAD///////////////////////////////////////////////////////////////////////////+Tk5Obm5v8/PzAwMD5+fmWlpbt7e3k5OSfn5/z8/PLy8vn5+fExMSsrKyqqqrf39+vr6+9vb2urq7c3NxSmuRpAAAAE3RSTlMA+u2XA+PTrId4WBwTN7EKtLY4iqQP6AAAAWhJREFUOMudVe2SgjAMLN+goN51CxTLp3r3/m943BAqIJTR/RU6O02yTRY2g5tEgW9blu0HUeKyLRxDj0/ghcdVWuxYfAHLiV95B5uvwD4saK7DN+DMSj1f+CYu58l9J27A6XnnJG9R3ZWU6l4Vk+y6D310baHRXvUxdRSP/aYZILJbmebFLRNAlo69x7PEeQdZ5Xz8qiS6fJr8aOnEquATFApdSsr/v1HINUo+Q6nwoDDspfH4JmoJ6shzWcINaNBSlLCI6uvLfyXmAlR2xIKBB/A1ZKiGIGA+8QCtphBawRt+hsBnNvE0M0OPZmwcijRnFvE0U6CuIcbrIUlJRnJL9L0YifTQCgU3p/aH4I7fnWaCIajwMMszCl5A7Aj+TWctGuMT6qG4QtbGodBj9oAyjpke3LSDYXCXq9A8V6GZrsLGcqXlcrneW9elAQgpxdwA3rcUdv4ymdQHtrdvpPvW/LHZ7/8+/gBTWGFPbAkGiAAAAABJRU5ErkJggg=="; TRACK_DISTANCE_ROTATE2=18}function COverlay(){this.m_oControl=null;this.m_oContext=null;this.min_x=65535;this.min_y=65535;this.max_x=-65535;this.max_y=-65535;this.m_bIsShow=false;this.m_bIsAlwaysUpdateOverlay=false;this.m_oHtmlPage=null;this.DashLineColor="#000000";this.ClearAll=false;this.IsCellEditor=false}COverlay.prototype={init:function(context,controlName,x,y,w_pix,h_pix,w_mm,h_mm){this.m_oContext=context;this.m_oControl=AscCommon.CreateControl(controlName);this.m_oHtmlPage=new AscCommon.CHtmlPage; this.m_oHtmlPage.init(x,y,w_pix,h_pix,w_mm,h_mm)},Clear:function(){if(null==this.m_oContext){this.m_oContext=this.m_oControl.HtmlElement.getContext("2d");this.m_oContext.imageSmoothingEnabled=false;this.m_oContext.mozImageSmoothingEnabled=false;this.m_oContext.oImageSmoothingEnabled=false;this.m_oContext.webkitImageSmoothingEnabled=false}this.SetBaseTransform();this.m_oContext.beginPath();if(this.max_x!=-65535&&this.max_y!=-65535)if(this.ClearAll===true){this.m_oContext.clearRect(0,0,this.m_oControl.HtmlElement.width, this.m_oControl.HtmlElement.height);this.ClearAll=false}else{var _eps=5;this.m_oContext.clearRect(this.min_x-_eps,this.min_y-_eps,this.max_x-this.min_x+2*_eps,this.max_y-this.min_y+2*_eps)}this.min_x=65535;this.min_y=65535;this.max_x=-65535;this.max_y=-65535},GetImageTrackRotationImage:function(){return AscCommon.AscBrowser.isCustomScalingAbove2()?window.g_track_rotate_marker2:window.g_track_rotate_marker},SetTransform:function(sx,shy,shx,sy,tx,ty){this.SetBaseTransform();this.m_oContext.setTransform(sx, shy,shx,sy,tx,ty)},SetBaseTransform:function(){this.m_oContext.setTransform(1,0,0,1,0,0)},Show:function(){if(this.m_bIsShow)return;this.m_bIsShow=true;this.m_oControl.HtmlElement.style.display="block"},UnShow:function(){if(!this.m_bIsShow)return;this.m_bIsShow=false;this.m_oControl.HtmlElement.style.display="none"},VertLine:function(position,bIsSimpleAdd){var rPR=AscCommon.AscBrowser.retinaPixelRatio;if(bIsSimpleAdd!==true){this.Clear();if(this.m_bIsAlwaysUpdateOverlay||true)if(!editor.WordControl.OnUpdateOverlay())editor.WordControl.EndUpdateOverlay()}position*= rPR;if(this.min_x>position)this.min_x=position;if(this.max_x>0)+.5*this.m_oContext.lineWidth;var y=0;this.m_oContext.strokeStyle=this.DashLineColor;this.m_oContext.beginPath();var lineWidth=this.m_oContext.lineWidth;while(yposition)this.min_x=position;if(this.max_x>0)+indent;var y=0; this.m_oContext.strokeStyle=this.DashLineColor;this.m_oContext.beginPath();var dist=this.m_oContext.lineWidth;while(yposition)this.min_y=position;if(this.max_y>0)+.5*this.m_oContext.lineWidth;var x=0;this.m_oContext.strokeStyle=this.DashLineColor;this.m_oContext.beginPath();var lineWidth=this.m_oContext.lineWidth;while(xposition)this.min_y=position;if(this.max_y>0)+indent;var x=0;this.m_oContext.strokeStyle= this.DashLineColor;this.m_oContext.beginPath();var dist=this.m_oContext.lineWidth;while(xthis.max_x)this.max_x=x;if(y>this.max_y)this.max_y=y},CheckPoint:function(x,y){if(xthis.max_x)this.max_x=x;if(y>this.max_y)this.max_y=y},AddRect2:function(x,y,r){var _x=x-(r/2>>0);var _y=y-(r/2>>0);this.CheckPoint1(_x,_y);this.CheckPoint2(_x+r,_y+r);this.m_oContext.moveTo(_x,_y);this.m_oContext.rect(_x,_y,r,r)},AddRect3:function(x,y,r,ex1,ey1,ex2,ey2){var _r=r/2;var x1=x+_r*(ex2-ex1);var y1=y+_r*(ey2-ey1);var x2=x+_r*(ex2+ex1);var y2=y+_r*(ey2+ey1);var x3=x+_r*(-ex2+ex1);var y3=y+_r*(-ey2+ey1);var x4=x+_r*(-ex2-ex1);var y4=y+_r*(-ey2-ey1);this.CheckPoint(x1, y1);this.CheckPoint(x2,y2);this.CheckPoint(x3,y3);this.CheckPoint(x4,y4);var ctx=this.m_oContext;ctx.moveTo(x1,y1);ctx.lineTo(x2,y2);ctx.lineTo(x3,y3);ctx.lineTo(x4,y4);ctx.closePath()},AddRect:function(x,y,w,h){this.CheckPoint1(x,y);this.CheckPoint2(x+w,y+h);this.m_oContext.moveTo(x,y);this.m_oContext.rect(x,y,w,h)},CheckRectT:function(x,y,w,h,trans,eps){var x1=trans.TransformPointX(x,y);var y1=trans.TransformPointY(x,y);var x2=trans.TransformPointX(x+w,y);var y2=trans.TransformPointY(x+w,y);var x3= trans.TransformPointX(x+w,y+h);var y3=trans.TransformPointY(x+w,y+h);var x4=trans.TransformPointX(x,y+h);var y4=trans.TransformPointY(x,y+h);this.CheckPoint(x1,y1);this.CheckPoint(x2,y2);this.CheckPoint(x3,y3);this.CheckPoint(x4,y4);if(eps!==undefined){this.min_x-=eps;this.min_y-=eps;this.max_x+=eps;this.max_y+=eps}},CheckRect:function(x,y,w,h){this.CheckPoint1(x,y);this.CheckPoint2(x+w,y+h)},AddEllipse:function(x,y,r){this.CheckPoint1(x-r,y-r);this.CheckPoint2(x+r,y+r);this.m_oContext.moveTo(x+r, y);this.m_oContext.arc(x,y,r,0,Math.PI*2,false)},AddEllipse2:function(x,y,r){this.m_oContext.moveTo(x+r,y);this.m_oContext.arc(x,y,r,0,Math.PI*2,false)},AddDiamond:function(x,y,r){this.CheckPoint1(x-r,y-r);this.CheckPoint2(x+r,y+r);this.m_oContext.moveTo(x-r,y);this.m_oContext.lineTo(x,y-r);this.m_oContext.lineTo(x+r,y);this.m_oContext.lineTo(x,y+r);this.m_oContext.lineTo(x-r,y)},AddRoundRect:function(x,y,w,h,r){if(w<2*r||h<2*r)return this.AddRect(x,y,w,h);this.CheckPoint1(x,y);this.CheckPoint2(x+ w,y+h);var _ctx=this.m_oContext;_ctx.moveTo(x+r,y);_ctx.lineTo(x+w-r,y);_ctx.quadraticCurveTo(x+w,y,x+w,y+r);_ctx.lineTo(x+w,y+h-r);_ctx.quadraticCurveTo(x+w,y+h,x+w-r,y+h);_ctx.lineTo(x+r,y+h);_ctx.quadraticCurveTo(x,y+h,x,y+h-r);_ctx.lineTo(x,y+r);_ctx.quadraticCurveTo(x,y,x+r,y);_ctx.closePath()},AddRoundRectCtx:function(ctx,x,y,w,h,r){if(w<2*r||h<2*r)return ctx.rect(x,y,w,h);var _ctx=this.m_oContext;_ctx.moveTo(x+r,y);_ctx.lineTo(x+w-r,y);_ctx.quadraticCurveTo(x+w,y,x+w,y+r);_ctx.lineTo(x+w,y+ h-r);_ctx.quadraticCurveTo(x+w,y+h,x+w-r,y+h);_ctx.lineTo(x+r,y+h);_ctx.quadraticCurveTo(x,y+h,x,y+h-r);_ctx.lineTo(x,y+r);_ctx.quadraticCurveTo(x,y,x+r,y);_ctx.closePath()},DrawFrozenPlaceHorLine:function(y,left,right){this.m_oContext.strokeStyle="#AAAAAA";var nW=2;if(AscCommon.AscBrowser.isRetina)nW=AscCommon.AscBrowser.convertToRetinaValue(nW,true);this.CheckPoint1(left,y-nW);this.CheckPoint2(right,y+nW);this.m_oContext.lineWidth=nW;this.m_oContext.beginPath();this.m_oContext.moveTo(left,y);this.m_oContext.lineTo(right, y);this.m_oContext.stroke()},DrawFrozenPlaceVerLine:function(x,top,bottom){this.m_oContext.strokeStyle="#AAAAAA";var nW=2;if(AscCommon.AscBrowser.isRetina)nW=AscCommon.AscBrowser.convertToRetinaValue(nW,true);this.CheckPoint1(x-nW,top);this.CheckPoint2(x+nW,bottom);this.m_oContext.lineWidth=nW;this.m_oContext.beginPath();this.m_oContext.moveTo(x,top);this.m_oContext.lineTo(x,bottom);this.m_oContext.stroke()},drawArrow:function(ctx,x,y,len,rgb,needToCorrectLen){var rPR=AscCommon.AscBrowser.retinaPixelRatio; ctx.beginPath();var arrowSize=Math.round(13*rPR);if(needToCorrectLen&&0==(len&1))len+=1;var _data,px,_x=Math.round((arrowSize-len)/2),_y=Math.floor(arrowSize/2),r,g,b;var __x=_x,__y=_y,_len=len;var r=rgb.r,g=rgb.g,b=rgb.b;_data=ctx.createImageData(arrowSize,arrowSize);px=_data.data;while(_len>0){var ind=4*(arrowSize*__y+__x);for(var i=0;i<_len;i++){px[ind++]=r;px[ind++]=g;px[ind++]=b;px[ind++]=255}r=r>>0;g=g>>0;b=b>>0;__x+=1;__y-=1;_len-=2}ctx.putImageData(_data,x,y)}};function CAutoshapeTrack(){this.m_oContext= null;this.m_oOverlay=null;this.Graphics=null;this.MaxEpsLine=0;this.IsTrack=true;this.PageIndex=-1;this.CurrentPageInfo=null}CAutoshapeTrack.prototype={SetFont:function(font){},init:function(overlay,x,y,r,b,w_mm,h_mm){this.m_oOverlay=overlay;this.m_oContext=this.m_oOverlay.m_oContext;this.Graphics=new AscCommon.CGraphics;var _scale=this.m_oOverlay.IsCellEditor?1:AscCommon.AscBrowser.retinaPixelRatio;this.Graphics.init(this.m_oContext,_scale*(r-x),_scale*(b-y),w_mm,h_mm);this.Graphics.m_oCoordTransform.tx= _scale*x;this.Graphics.m_oCoordTransform.ty=_scale*y;this.Graphics.SetIntegerGrid(false);this.Graphics.globalAlpha=.5;this.m_oContext.globalAlpha=.5},SetIntegerGrid:function(b){},p_color:function(r,g,b,a){this.Graphics.p_color(r,g,b,a)},p_width:function(w){this.Graphics.p_width(w);var xx1=0;var yy1=0;var xx2=1;var yy2=1;var xxx1=this.Graphics.m_oFullTransform.TransformPointX(xx1,yy1);var yyy1=this.Graphics.m_oFullTransform.TransformPointY(xx1,yy1);var xxx2=this.Graphics.m_oFullTransform.TransformPointX(xx2, yy2);var yyy2=this.Graphics.m_oFullTransform.TransformPointY(xx2,yy2);var _len2=(xxx2-xxx1)*(xxx2-xxx1)+(yyy2-yyy1)*(yyy2-yyy1);var koef=Math.sqrt(_len2/2);var _EpsLine=w*koef/1E3>>0;_EpsLine+=5;if(_EpsLine>this.MaxEpsLine)this.MaxEpsLine=_EpsLine},p_dash:function(params){this.Graphics.p_dash(params)},b_color1:function(r,g,b,a){this.Graphics.b_color1(r,g,b,a)},_s:function(){this.Graphics._s()},_e:function(){this.Graphics._e()},_z:function(){this.Graphics._z()},_m:function(x,y){this.Graphics._m(x, y);var _x=this.Graphics.m_oFullTransform.TransformPointX(x,y);var _y=this.Graphics.m_oFullTransform.TransformPointY(x,y);this.m_oOverlay.CheckPoint(_x,_y)},_l:function(x,y){this.Graphics._l(x,y);var _x=this.Graphics.m_oFullTransform.TransformPointX(x,y);var _y=this.Graphics.m_oFullTransform.TransformPointY(x,y);this.m_oOverlay.CheckPoint(_x,_y)},_c:function(x1,y1,x2,y2,x3,y3){this.Graphics._c(x1,y1,x2,y2,x3,y3);var _x1=this.Graphics.m_oFullTransform.TransformPointX(x1,y1);var _y1=this.Graphics.m_oFullTransform.TransformPointY(x1, y1);var _x2=this.Graphics.m_oFullTransform.TransformPointX(x2,y2);var _y2=this.Graphics.m_oFullTransform.TransformPointY(x2,y2);var _x3=this.Graphics.m_oFullTransform.TransformPointX(x3,y3);var _y3=this.Graphics.m_oFullTransform.TransformPointY(x3,y3);this.m_oOverlay.CheckPoint(_x1,_y1);this.m_oOverlay.CheckPoint(_x2,_y2);this.m_oOverlay.CheckPoint(_x3,_y3)},_c2:function(x1,y1,x2,y2){this.Graphics._c2(x1,y1,x2,y2);var _x1=this.Graphics.m_oFullTransform.TransformPointX(x1,y1);var _y1=this.Graphics.m_oFullTransform.TransformPointY(x1, y1);var _x2=this.Graphics.m_oFullTransform.TransformPointX(x2,y2);var _y2=this.Graphics.m_oFullTransform.TransformPointY(x2,y2);this.m_oOverlay.CheckPoint(_x1,_y1);this.m_oOverlay.CheckPoint(_x2,_y2)},ds:function(){this.Graphics.ds()},df:function(){this.Graphics.df()},save:function(){this.Graphics.save()},restore:function(){this.Graphics.restore()},clip:function(){this.Graphics.clip()},reset:function(){this.Graphics.reset()},transform3:function(m){this.Graphics.transform3(m)},transform:function(sx, shy,shx,sy,tx,ty){this.Graphics.transform(sx,shy,shx,sy,tx,ty)},drawImage:function(image,x,y,w,h,alpha,srcRect,nativeImage){this.Graphics.drawImage(image,x,y,w,h,undefined,srcRect,nativeImage);var _x1=this.Graphics.m_oFullTransform.TransformPointX(x,y);var _y1=this.Graphics.m_oFullTransform.TransformPointY(x,y);var _x2=this.Graphics.m_oFullTransform.TransformPointX(x+w,y);var _y2=this.Graphics.m_oFullTransform.TransformPointY(x+w,y);var _x3=this.Graphics.m_oFullTransform.TransformPointX(x+w,y+h); var _y3=this.Graphics.m_oFullTransform.TransformPointY(x+w,y+h);var _x4=this.Graphics.m_oFullTransform.TransformPointX(x,y+h);var _y4=this.Graphics.m_oFullTransform.TransformPointY(x,y+h);this.m_oOverlay.CheckPoint(_x1,_y1);this.m_oOverlay.CheckPoint(_x2,_y2);this.m_oOverlay.CheckPoint(_x3,_y3);this.m_oOverlay.CheckPoint(_x4,_y4)},CorrectOverlayBounds:function(){this.m_oOverlay.SetBaseTransform();this.m_oOverlay.min_x-=this.MaxEpsLine;this.m_oOverlay.min_y-=this.MaxEpsLine;this.m_oOverlay.max_x+= this.MaxEpsLine;this.m_oOverlay.max_y+=this.MaxEpsLine},SetCurrentPage:function(nPageIndex,isAttack){if(nPageIndex==this.PageIndex&&!isAttack)return;var oPage=this.m_oOverlay.m_oHtmlPage.GetDrawingPageInfo(nPageIndex);this.PageIndex=nPageIndex;var drawPage=oPage.drawingPage;this.Graphics=new AscCommon.CGraphics;var _scale=this.m_oOverlay.IsCellEditor?1:AscCommon.AscBrowser.retinaPixelRatio;this.Graphics.init(this.m_oContext,_scale*(drawPage.right-drawPage.left),_scale*(drawPage.bottom-drawPage.top), oPage.width_mm,oPage.height_mm);this.Graphics.m_oCoordTransform.tx=_scale*drawPage.left;this.Graphics.m_oCoordTransform.ty=_scale*drawPage.top;this.Graphics.SetIntegerGrid(false);this.Graphics.globalAlpha=.5;this.m_oContext.globalAlpha=.5},init2:function(overlay){this.m_oOverlay=overlay;this.m_oContext=this.m_oOverlay.m_oContext;this.PageIndex=-1},SetClip:function(r){},AddClipRect:function(){},RemoveClip:function(){},SavePen:function(){this.Graphics.SavePen()},RestorePen:function(){this.Graphics.RestorePen()}, SaveBrush:function(){this.Graphics.SaveBrush()},RestoreBrush:function(){this.Graphics.RestoreBrush()},SavePenBrush:function(){this.Graphics.SavePenBrush()},RestorePenBrush:function(){this.Graphics.RestorePenBrush()},SaveGrState:function(){this.Graphics.SaveGrState()},RestoreGrState:function(){this.Graphics.RestoreGrState()},StartClipPath:function(){this.Graphics.StartClipPath()},EndClipPath:function(){this.Graphics.EndClipPath()},DrawTrack:function(type,matrix,left,top,width,height,isLine,isCanRotate, isNoMove,isDrawHandles){if(true===isNoMove)return;var bDrawHandles=isDrawHandles!==false;if(bDrawHandles===false)type=AscFormat.TYPE_TRACK.SHAPE;if(this.m_oOverlay.IsCellEditor){left/=AscCommon.AscBrowser.retinaPixelRatio;top/=AscCommon.AscBrowser.retinaPixelRatio;width/=AscCommon.AscBrowser.retinaPixelRatio;height/=AscCommon.AscBrowser.retinaPixelRatio;if(matrix){matrix.tx/=AscCommon.AscBrowser.retinaPixelRatio;matrix.ty/=AscCommon.AscBrowser.retinaPixelRatio}}var overlay=this.m_oOverlay;overlay.Show(); var bIsClever=false;this.CurrentPageInfo=overlay.m_oHtmlPage.GetDrawingPageInfo(this.PageIndex);var drPage=this.CurrentPageInfo.drawingPage;var rPR=AscCommon.AscBrowser.retinaPixelRatio;var xDst=this.m_oOverlay.IsCellEditor?drPage.left:drPage.left*rPR;var yDst=this.m_oOverlay.IsCellEditor?drPage.top:drPage.top*rPR;var wDst=(drPage.right-drPage.left)*rPR;var hDst=(drPage.bottom-drPage.top)*rPR;var dKoefX=wDst/this.CurrentPageInfo.width_mm;var dKoefY=hDst/this.CurrentPageInfo.height_mm;var r=left+width; var b=top+height;var dx1=xDst+dKoefX*matrix.TransformPointX(left,top);var dy1=yDst+dKoefY*matrix.TransformPointY(left,top);var dx2=xDst+dKoefX*matrix.TransformPointX(r,top);var dy2=yDst+dKoefY*matrix.TransformPointY(r,top);var dx3=xDst+dKoefX*matrix.TransformPointX(left,b);var dy3=yDst+dKoefY*matrix.TransformPointY(left,b);var dx4=xDst+dKoefX*matrix.TransformPointX(r,b);var dy4=yDst+dKoefY*matrix.TransformPointY(r,b);var x1=dx1>>0;var y1=dy1>>0;var x2=dx2>>0;var y2=dy2>>0;var x3=dx3>>0;var y3=dy3>> 0;var x4=dx4>>0;var y4=dy4>>0;var _eps=.01;if(Math.abs(dx1-dx3)<_eps&&Math.abs(dx2-dx4)<_eps&&Math.abs(dy1-dy2)<_eps&&Math.abs(dy3-dy4)<_eps&&x1x2){var tmp=x1;x1=x2;x3=x2;x2=tmp;x4=tmp}if(y1>y3){var tmp= y1;y1=y3;y2=y3;y3=tmp;y4=tmp}nType=0;bIsClever=true}}if(!nIsCleverWithTransform&&Math.abs(dx1-dx2)<_eps&&Math.abs(dx3-dx4)<_eps&&Math.abs(dy1-dy3)<_eps&&Math.abs(dy2-dy4)<_eps){x2=x1;x4=x3;y3=y1;y4=y2;nIsCleverWithTransform=true;nType=2}var ctx=overlay.m_oContext;var bIsEllipceCorner=false;var _style_blue="#939393";var _style_green="#84E036";var _style_white="#FFFFFF";var _style_black="#000000";var _len_x=Math.sqrt((x1-x2)*(x1-x2)+(y1-y2)*(y1-y2));var _len_y=Math.sqrt((x1-x3)*(x1-x3)+(y1-y3)*(y1- y3));if(_len_x<1)_len_x=1;if(_len_y<1)_len_y=1;var bIsRectsTrackX=_len_x>=30?true:false;var bIsRectsTrackY=_len_y>=30?true:false;var bIsRectsTrack=bIsRectsTrackX||bIsRectsTrackY?true:false;if(bIsRectsTrack&&type==AscFormat.TYPE_TRACK.CHART_TEXT)bIsRectsTrack=false;if(nType==2){var _tmp=bIsRectsTrackX;bIsRectsTrackX=bIsRectsTrackY;bIsRectsTrackY=_tmp}ctx.lineWidth=Math.round(rPR);ctx.beginPath();var _oldGlobalAlpha=ctx.globalAlpha;ctx.globalAlpha=1;var SCALE_TRACK_RECT_SIZE=Math.round(TRACK_RECT_SIZE* rPR),SCALE_TRACK_RECT_SIZE_CT=Math.round(TRACK_RECT_SIZE_CT*rPR);var indent=.5*Math.round(rPR);switch(type){case AscFormat.TYPE_TRACK.SHAPE:case AscFormat.TYPE_TRACK.GROUP:case AscFormat.TYPE_TRACK.CHART_TEXT:{if(bIsClever){overlay.CheckRect(x1,y1,x4-x1,y4-y1);ctx.strokeStyle=_style_blue;if(!isLine){ctx.rect(x1+indent,y2+indent,x4-x1,y4-y1);ctx.stroke();ctx.beginPath()}if(bDrawHandles){var xC=(x1+x2)/2>>0;if(!isLine&&isCanRotate){if(!bIsUseImageRotateTrack){ctx.beginPath();overlay.AddEllipse(xC,y1- Math.round(TRACK_DISTANCE_ROTATE*rPR),Math.round(TRACK_CIRCLE_RADIUS*rPR));ctx.fillStyle=_style_green;ctx.fill();ctx.stroke()}else{var _image_track_rotate=overlay.GetImageTrackRotationImage();if(_image_track_rotate.asc_complete){var _w=Math.round(ROTATE_TRACK_W*rPR),_xI=xC+indent-_w/2>>0,_yI=y1-Math.round(TRACK_DISTANCE_ROTATE*rPR),radius=Math.round(6*rPR);overlay.CheckRect(_xI,_yI-radius*2,_w,_w);ctx.fillStyle="#939393";var cnvs=document.createElement("canvas"),cntx=cnvs.getContext("2d");overlay.drawArrow(cntx, 0,0,Math.round(4*rPR),{r:147,g:147,b:147},true);ctx.drawImage(cnvs,xC-Math.round(12.5*rPR),_yI-Math.round(4.5*rPR));ctx.beginPath();ctx.lineWidth=Math.round(rPR);ctx.arc(xC,_yI+Math.round(rPR),radius,-3/4*Math.PI,Math.PI);ctx.stroke();ctx.beginPath();ctx.arc(xC,_yI+Math.round(rPR),_w/16,0,2*Math.PI);ctx.stroke();ctx.closePath();ctx.beginPath();ctx.globalCompositeOperation="destination-over";ctx.arc(xC,_yI+Math.round(rPR),_w/2,0,2*Math.PI);ctx.fillStyle="#ffffff";ctx.fill();ctx.closePath();ctx.globalCompositeOperation= "source-over"}}ctx.beginPath();ctx.moveTo(xC+indent,y1);ctx.lineTo(xC+indent,y1-Math.round(TRACK_DISTANCE_ROTATE2*rPR));ctx.stroke();ctx.beginPath()}ctx.fillStyle=type!=AscFormat.TYPE_TRACK.CHART_TEXT?_style_white:_style_blue;var TRACK_RECT_SIZE_CUR=type!=AscFormat.TYPE_TRACK.CHART_TEXT?SCALE_TRACK_RECT_SIZE:SCALE_TRACK_RECT_SIZE_CT;if(type==AscFormat.TYPE_TRACK.CHART_TEXT)ctx.strokeStyle=_style_white;if(bIsEllipceCorner){overlay.AddEllipse(x1,y1,Math.round(TRACK_CIRCLE_RADIUS*rPR));if(!isLine){overlay.AddEllipse(x2, y2,Math.round(TRACK_CIRCLE_RADIUS*rPR));overlay.AddEllipse(x3,y3,Math.round(TRACK_CIRCLE_RADIUS*rPR))}overlay.AddEllipse(x4,y4,Math.round(TRACK_CIRCLE_RADIUS*rPR))}else{overlay.AddRect2(x1+indent,y1+indent,TRACK_RECT_SIZE_CUR);if(!isLine){overlay.AddRect2(x2+indent,y2+indent,TRACK_RECT_SIZE_CUR);overlay.AddRect2(x3+indent,y3+indent,TRACK_RECT_SIZE_CUR)}overlay.AddRect2(x4+indent,y4+indent,TRACK_RECT_SIZE_CUR)}if(bIsRectsTrack&&!isLine){var _xC=((x1+x2)/2>>0)+indent;var _yC=((y1+y3)/2>>0)+indent;if(bIsRectsTrackX){overlay.AddRect2(_xC, y1+indent,SCALE_TRACK_RECT_SIZE);overlay.AddRect2(_xC,y3+indent,SCALE_TRACK_RECT_SIZE)}if(bIsRectsTrackY){overlay.AddRect2(x2+indent,_yC,SCALE_TRACK_RECT_SIZE);overlay.AddRect2(x1+indent,_yC,SCALE_TRACK_RECT_SIZE)}}}ctx.fill();ctx.stroke();ctx.beginPath()}else{var _x1=x1;var _y1=y1;var _x2=x2;var _y2=y2;var _x3=x3;var _y3=y3;var _x4=x4;var _y4=y4;if(nIsCleverWithTransform){var _x1=x1;if(x2<_x1)_x1=x2;if(x3<_x1)_x1=x3;if(x4<_x1)_x1=x4;var _x4=x1;if(x2>_x4)_x4=x2;if(x3>_x4)_x4=x3;if(x4>_x4)_x4=x4;var _y1= y1;if(y2<_y1)_y1=y2;if(y3<_y1)_y1=y3;if(y4<_y1)_y1=y4;var _y4=y1;if(y2>_y4)_y4=y2;if(y3>_y4)_y4=y3;if(y4>_y4)_y4=y4;_x2=_x4;_y2=_y1;_x3=_x1;_y3=_y4}ctx.strokeStyle=_style_blue;if(!isLine)if(nIsCleverWithTransform){ctx.rect(_x1+indent,_y2+indent,_x4-_x1,_y4-_y1);ctx.stroke();ctx.beginPath()}else{ctx.moveTo(x1,y1);ctx.lineTo(x2,y2);ctx.lineTo(x4,y4);ctx.lineTo(x3,y3);ctx.closePath();ctx.stroke()}overlay.CheckPoint(x1,y1);overlay.CheckPoint(x2,y2);overlay.CheckPoint(x3,y3);overlay.CheckPoint(x4,y4); var ex1=(x2-x1)/_len_x;var ey1=(y2-y1)/_len_x;var ex2=(x1-x3)/_len_y;var ey2=(y1-y3)/_len_y;var _bAbsX1=Math.abs(ex1)<.01;var _bAbsY1=Math.abs(ey1)<.01;var _bAbsX2=Math.abs(ex2)<.01;var _bAbsY2=Math.abs(ey2)<.01;if(_bAbsX2&&_bAbsY2)if(_bAbsX1&&_bAbsY1){ex1=1;ey1=0;ex2=0;ey2=1}else{ex2=-ey1;ey2=ex1}else if(_bAbsX1&&_bAbsY1){ex1=ey2;ey1=-ex2}var xc1=(x1+x2)/2;var yc1=(y1+y2)/2;ctx.beginPath();if(isDrawHandles){if(!isLine&&isCanRotate){if(!bIsUseImageRotateTrack){ctx.beginPath();overlay.AddEllipse(xc1+ ex2*TRACK_DISTANCE_ROTATE*rPR,yc1+ey2*TRACK_DISTANCE_ROTATE*rPR,Math.round(TRACK_CIRCLE_RADIUS*rPR));ctx.fillStyle=_style_green;ctx.fill();ctx.stroke()}else{var _image_track_rotate=overlay.GetImageTrackRotationImage();if(_image_track_rotate.asc_complete){var _xI=Math.round(xc1+ex2*TRACK_DISTANCE_ROTATE*rPR);var _yI=Math.round(yc1+ey2*TRACK_DISTANCE_ROTATE*rPR);var _w=Math.round(ROTATE_TRACK_W*rPR);var _w2=Math.round(ROTATE_TRACK_W/2*rPR);if(nIsCleverWithTransform){_xI>>=0;_yI>>=0;_w2>>=0;_w2+=1}var _matrix= matrix.CreateDublicate();_matrix.tx=0;_matrix.ty=0;var _xx=_matrix.TransformPointX(0,1);var _yy=_matrix.TransformPointY(0,1);var _angle=Math.atan2(_xx,-_yy)-Math.PI;var _px=Math.cos(_angle);var _py=Math.sin(_angle);ctx.save();var cnvs=document.createElement("canvas"),cntx=cnvs.getContext("2d"),cnvsRotate=document.createElement("canvas"),cntxRotate=cnvsRotate.getContext("2d"),x=Math.round(13*rPR)/2,y=Math.round(13*rPR)/2,radius=Math.round(6*rPR);ctx.beginPath();overlay.drawArrow(cntx,0,0,Math.round(4* rPR),{r:147,g:147,b:147},true);cntxRotate.translate(x,y);cntxRotate.rotate(_angle);cntxRotate.translate(-x,-y);cntxRotate.drawImage(cnvs,0,0);ctx.drawImage(cnvsRotate,Math.round(_xI-6.4*rPR-radius*_px),Math.round(_yI-6.4*rPR-radius*_py));ctx.beginPath();ctx.lineWidth=Math.round(rPR);ctx.arc(_xI,_yI,radius,-3/4*Math.PI+_angle,Math.PI+_angle);ctx.stroke();ctx.beginPath();ctx.arc(_xI,_yI,_w/16,0,2*Math.PI);ctx.stroke();ctx.globalCompositeOperation="destination-over";ctx.arc(_xI,_yI,_w/2,0,2*Math.PI); ctx.fillStyle="#ffffff";ctx.fill();ctx.closePath();ctx.globalCompositeOperation="source-over";ctx.restore();overlay.CheckRect(_xI-_w2,_yI-_w2,_w,_w)}}ctx.beginPath();if(!nIsCleverWithTransform){ctx.moveTo(xc1,yc1);ctx.lineTo(xc1+ex2*(TRACK_DISTANCE_ROTATE2*rPR+Math.round(rPR)),yc1+ey2*(TRACK_DISTANCE_ROTATE2*rPR+Math.round(rPR)))}else{ctx.moveTo((xc1>>0)+indent,(yc1>>0)+indent);ctx.lineTo((xc1+ex2*TRACK_DISTANCE_ROTATE2*rPR>>0)+indent,(yc1+ey2*TRACK_DISTANCE_ROTATE2*rPR>>0)+indent)}ctx.stroke();ctx.beginPath()}ctx.fillStyle= type!=AscFormat.TYPE_TRACK.CHART_TEXT?_style_white:_style_blue;var TRACK_RECT_SIZE_CUR=type!=AscFormat.TYPE_TRACK.CHART_TEXT?SCALE_TRACK_RECT_SIZE:SCALE_TRACK_RECT_SIZE_CT;if(type==AscFormat.TYPE_TRACK.CHART_TEXT)ctx.strokeStyle=_style_white;if(!nIsCleverWithTransform)if(bIsEllipceCorner){overlay.AddEllipse(x1,y1,Math.round(TRACK_CIRCLE_RADIUS*rPR));if(!isLine){overlay.AddEllipse(x2,y2,Math.round(TRACK_CIRCLE_RADIUS*rPR));overlay.AddEllipse(x3,y3,Math.round(TRACK_CIRCLE_RADIUS*rPR))}overlay.AddEllipse(x4, y4,Math.round(TRACK_CIRCLE_RADIUS*rPR))}else{overlay.AddRect3(x1,y1,TRACK_RECT_SIZE_CUR,ex1,ey1,ex2,ey2);if(!isLine){overlay.AddRect3(x2,y2,TRACK_RECT_SIZE_CUR,ex1,ey1,ex2,ey2);overlay.AddRect3(x3,y3,TRACK_RECT_SIZE_CUR,ex1,ey1,ex2,ey2)}overlay.AddRect3(x4,y4,TRACK_RECT_SIZE_CUR,ex1,ey1,ex2,ey2)}else if(bIsEllipceCorner){overlay.AddEllipse(_x1,_y1,Math.round(TRACK_CIRCLE_RADIUS*rPR));if(!isLine){overlay.AddEllipse(_x2,_y2,Math.round(TRACK_CIRCLE_RADIUS*rPR));overlay.AddEllipse(_x3,_y3,Math.round(TRACK_CIRCLE_RADIUS* rPR))}overlay.AddEllipse(_x4,_y4,Math.round(TRACK_CIRCLE_RADIUS*rPR))}else if(!isLine){overlay.AddRect2(_x1+indent,_y1+indent,TRACK_RECT_SIZE_CUR);overlay.AddRect2(_x2+indent,_y2+indent,TRACK_RECT_SIZE_CUR);overlay.AddRect2(_x3+indent,_y3+indent,TRACK_RECT_SIZE_CUR);overlay.AddRect2(_x4+indent,_y4+indent,TRACK_RECT_SIZE_CUR)}else{overlay.AddRect2(x1+indent,y1+indent,TRACK_RECT_SIZE_CUR);overlay.AddRect2(x4+indent,y4+indent,TRACK_RECT_SIZE_CUR)}if(!isLine)if(!nIsCleverWithTransform){if(bIsRectsTrack){if(bIsRectsTrackX){overlay.AddRect3((x1+ x2)/2,(y1+y2)/2,SCALE_TRACK_RECT_SIZE,ex1,ey1,ex2,ey2);overlay.AddRect3((x3+x4)/2,(y3+y4)/2,SCALE_TRACK_RECT_SIZE,ex1,ey1,ex2,ey2)}if(bIsRectsTrackY){overlay.AddRect3((x2+x4)/2,(y2+y4)/2,SCALE_TRACK_RECT_SIZE,ex1,ey1,ex2,ey2);overlay.AddRect3((x3+x1)/2,(y3+y1)/2,SCALE_TRACK_RECT_SIZE,ex1,ey1,ex2,ey2)}}}else{var _xC=((_x1+_x2)/2>>0)+indent;var _yC=((_y1+_y3)/2>>0)+indent;if(bIsRectsTrackX){overlay.AddRect2(_xC,_y1+indent,SCALE_TRACK_RECT_SIZE);overlay.AddRect2(_xC,_y3+indent,SCALE_TRACK_RECT_SIZE)}if(bIsRectsTrackY){overlay.AddRect2(_x2+ indent,_yC,SCALE_TRACK_RECT_SIZE);overlay.AddRect2(_x1+indent,_yC,SCALE_TRACK_RECT_SIZE)}}}ctx.fill();ctx.stroke();ctx.beginPath()}break}case AscFormat.TYPE_TRACK.TEXT:case AscFormat.TYPE_TRACK.GROUP_PASSIVE:{if(bIsClever){overlay.CheckRect(x1,y1,x4-x1,y4-y1);ctx.strokeStyle=_style_blue;this.AddRectDashClever(ctx,x1,y1,x4,y4,8,3,true);ctx.beginPath();if(isCanRotate){var xC=(x1+x2)/2>>0;if(!bIsUseImageRotateTrack){ctx.beginPath();overlay.AddEllipse(xC,y1-Math.round(TRACK_DISTANCE_ROTATE*rPR),Math.round(TRACK_CIRCLE_RADIUS* rPR));ctx.fillStyle=_style_green;ctx.fill();ctx.stroke()}else{var _image_track_rotate=overlay.GetImageTrackRotationImage();if(_image_track_rotate.asc_complete){var _w=Math.round(ROTATE_TRACK_W*rPR),_xI=xC+indent-_w/2>>0,_yI=y1-Math.round(TRACK_DISTANCE_ROTATE*rPR),radius=Math.round(6*rPR);overlay.CheckRect(_xI,_yI-radius*2,_w,_w);ctx.fillStyle="#939393";var cnvs=document.createElement("canvas"),cntx=cnvs.getContext("2d");overlay.drawArrow(cntx,0,0,Math.round(4*rPR),{r:147,g:147,b:147},true);ctx.drawImage(cnvs, xC-Math.round(12.5*rPR),_yI-Math.round(4.5*rPR));ctx.beginPath();ctx.lineWidth=Math.round(rPR);ctx.arc(xC,_yI+Math.round(rPR),radius,-3/4*Math.PI,Math.PI);ctx.stroke();ctx.beginPath();ctx.arc(xC,_yI+Math.round(rPR),_w/16,0,2*Math.PI);ctx.stroke();ctx.closePath();ctx.beginPath();ctx.globalCompositeOperation="destination-over";ctx.arc(xC,_yI+Math.round(rPR),_w/2,0,2*Math.PI);ctx.fillStyle="#ffffff";ctx.fill();ctx.closePath();ctx.globalCompositeOperation="source-over"}}ctx.beginPath();ctx.moveTo(xC+ indent,y1);ctx.lineTo(xC+indent,y1-Math.round(TRACK_DISTANCE_ROTATE2*rPR));ctx.stroke();ctx.beginPath()}ctx.fillStyle=_style_white;if(bIsEllipceCorner){overlay.AddEllipse(x1,y1,Math.round(TRACK_CIRCLE_RADIUS*rPR));overlay.AddEllipse(x2,y2,Math.round(TRACK_CIRCLE_RADIUS*rPR));overlay.AddEllipse(x3,y3,Math.round(TRACK_CIRCLE_RADIUS*rPR));overlay.AddEllipse(x4,y4,Math.round(TRACK_CIRCLE_RADIUS*rPR))}else{overlay.AddRect2(x1+indent,y1+indent,SCALE_TRACK_RECT_SIZE);overlay.AddRect2(x2+indent,y2+indent, SCALE_TRACK_RECT_SIZE);overlay.AddRect2(x3+indent,y3+indent,SCALE_TRACK_RECT_SIZE);overlay.AddRect2(x4+indent,y4+indent,SCALE_TRACK_RECT_SIZE)}if(bIsRectsTrack){var _xC=((x1+x2)/2>>0)+indent;var _yC=((y1+y3)/2>>0)+indent;if(bIsRectsTrackX){overlay.AddRect2(_xC,y1+indent,SCALE_TRACK_RECT_SIZE);overlay.AddRect2(_xC,y3+indent,SCALE_TRACK_RECT_SIZE)}if(bIsRectsTrackY){overlay.AddRect2(x2+indent,_yC,SCALE_TRACK_RECT_SIZE);overlay.AddRect2(x1+indent,_yC,SCALE_TRACK_RECT_SIZE)}}ctx.fill();ctx.stroke();ctx.beginPath()}else{var _x1= x1;var _y1=y1;var _x2=x2;var _y2=y2;var _x3=x3;var _y3=y3;var _x4=x4;var _y4=y4;if(nIsCleverWithTransform){var _x1=x1;if(x2<_x1)_x1=x2;if(x3<_x1)_x1=x3;if(x4<_x1)_x1=x4;var _x4=x1;if(x2>_x4)_x4=x2;if(x3>_x4)_x4=x3;if(x4>_x4)_x4=x4;var _y1=y1;if(y2<_y1)_y1=y2;if(y3<_y1)_y1=y3;if(y4<_y1)_y1=y4;var _y4=y1;if(y2>_y4)_y4=y2;if(y3>_y4)_y4=y3;if(y4>_y4)_y4=y4;_x2=_x4;_y2=_y1;_x3=_x1;_y3=_y4}overlay.CheckPoint(x1,y1);overlay.CheckPoint(x2,y2);overlay.CheckPoint(x3,y3);overlay.CheckPoint(x4,y4);ctx.strokeStyle= _style_blue;if(!nIsCleverWithTransform)this.AddRectDash(ctx,x1,y1,x2,y2,x3,y3,x4,y4,8,3,true);else this.AddRectDashClever(ctx,_x1,_y1,_x4,_y4,8,3,true);var ex1=(x2-x1)/_len_x;var ey1=(y2-y1)/_len_x;var ex2=(x1-x3)/_len_y;var ey2=(y1-y3)/_len_y;var _bAbsX1=Math.abs(ex1)<.01;var _bAbsY1=Math.abs(ey1)<.01;var _bAbsX2=Math.abs(ex2)<.01;var _bAbsY2=Math.abs(ey2)<.01;if(_bAbsX2&&_bAbsY2)if(_bAbsX1&&_bAbsY1){ex1=1;ey1=0;ex2=0;ey2=1}else{ex2=-ey1;ey2=ex1}else if(_bAbsX1&&_bAbsY1){ex1=ey2;ey1=-ex2}var xc1= (x1+x2)/2;var yc1=(y1+y2)/2;ctx.beginPath();if(isCanRotate){if(!bIsUseImageRotateTrack){ctx.beginPath();overlay.AddEllipse(xc1+ex2*TRACK_DISTANCE_ROTATE*rPR,yc1+ey2*TRACK_DISTANCE_ROTATE*rPR,Math.round(TRACK_CIRCLE_RADIUS*rPR));ctx.fillStyle=_style_green;ctx.fill();ctx.stroke()}else{var _image_track_rotate=overlay.GetImageTrackRotationImage();if(_image_track_rotate.asc_complete){var _xI=Math.round(xc1+ex2*TRACK_DISTANCE_ROTATE*rPR);var _yI=Math.round(yc1+ey2*TRACK_DISTANCE_ROTATE*rPR);var _w=Math.round(ROTATE_TRACK_W* rPR);var _w2=Math.round(ROTATE_TRACK_W/2*rPR);if(nIsCleverWithTransform){_xI>>=0;_yI>>=0;_w2>>=0;_w2+=1}var _matrix=matrix.CreateDublicate();_matrix.tx=0;_matrix.ty=0;var _xx=_matrix.TransformPointX(0,1);var _yy=_matrix.TransformPointY(0,1);var _angle=Math.atan2(_xx,-_yy)-Math.PI;var _px=Math.cos(_angle);var _py=Math.sin(_angle);ctx.save();var cnvs=document.createElement("canvas"),cntx=cnvs.getContext("2d"),cnvsRotate=document.createElement("canvas"),cntxRotate=cnvsRotate.getContext("2d"),x=Math.round(13* rPR)/2,y=Math.round(13*rPR)/2,radius=Math.round(6*rPR);ctx.beginPath();overlay.drawArrow(cntx,0,0,Math.round(4*rPR),{r:147,g:147,b:147},true);cntxRotate.translate(x,y);cntxRotate.rotate(_angle);cntxRotate.translate(-x,-y);cntxRotate.drawImage(cnvs,0,0);ctx.drawImage(cnvsRotate,Math.round(_xI-6.4*rPR-radius*_px),Math.round(_yI-6.4*rPR-radius*_py));ctx.beginPath();ctx.lineWidth=Math.round(rPR);ctx.arc(_xI,_yI,radius,-3/4*Math.PI+_angle,Math.PI+_angle);ctx.stroke();ctx.beginPath();ctx.arc(_xI,_yI,_w/ 16,0,2*Math.PI);ctx.stroke();ctx.globalCompositeOperation="destination-over";ctx.arc(_xI,_yI,_w/2,0,2*Math.PI);ctx.fillStyle="#ffffff";ctx.fill();ctx.closePath();ctx.globalCompositeOperation="source-over";ctx.restore();overlay.CheckRect(_xI-_w2,_yI-_w2,_w,_w)}}ctx.beginPath();if(!nIsCleverWithTransform){ctx.moveTo(xc1,yc1);ctx.lineTo(xc1+ex2*(TRACK_DISTANCE_ROTATE2*rPR+Math.round(rPR)),yc1+ey2*(TRACK_DISTANCE_ROTATE2*rPR+Math.round(rPR)))}else{ctx.moveTo((xc1>>0)+indent,(yc1>>0)+indent);ctx.lineTo((xc1+ ex2*TRACK_DISTANCE_ROTATE2*rPR>>0)+indent,(yc1+ey2*TRACK_DISTANCE_ROTATE2*rPR>>0)+indent)}ctx.stroke();ctx.beginPath()}ctx.fillStyle=_style_white;if(!nIsCleverWithTransform)if(bIsEllipceCorner){overlay.AddEllipse(x1,y1,Math.round(TRACK_CIRCLE_RADIUS*rPR));overlay.AddEllipse(x2,y2,Math.round(TRACK_CIRCLE_RADIUS*rPR));overlay.AddEllipse(x3,y3,Math.round(TRACK_CIRCLE_RADIUS*rPR));overlay.AddEllipse(x4,y4,Math.round(TRACK_CIRCLE_RADIUS*rPR))}else{overlay.AddRect3(x1,y1,SCALE_TRACK_RECT_SIZE,ex1,ey1,ex2, ey2);overlay.AddRect3(x2,y2,SCALE_TRACK_RECT_SIZE,ex1,ey1,ex2,ey2);overlay.AddRect3(x3,y3,SCALE_TRACK_RECT_SIZE,ex1,ey1,ex2,ey2);overlay.AddRect3(x4,y4,SCALE_TRACK_RECT_SIZE,ex1,ey1,ex2,ey2)}else if(bIsEllipceCorner){overlay.AddEllipse(x1,y1,Math.round(TRACK_CIRCLE_RADIUS*rPR));overlay.AddEllipse(x2,y2,Math.round(TRACK_CIRCLE_RADIUS*rPR));overlay.AddEllipse(x3,y3,Math.round(TRACK_CIRCLE_RADIUS*rPR));overlay.AddEllipse(x4,y4,Math.round(TRACK_CIRCLE_RADIUS*rPR))}else{overlay.AddRect2(_x1+indent,_y1+ indent,SCALE_TRACK_RECT_SIZE);overlay.AddRect2(_x2+indent,_y2+indent,SCALE_TRACK_RECT_SIZE);overlay.AddRect2(_x3+indent,_y3+indent,SCALE_TRACK_RECT_SIZE);overlay.AddRect2(_x4+indent,_y4+indent,SCALE_TRACK_RECT_SIZE)}if(!nIsCleverWithTransform){if(bIsRectsTrack){if(bIsRectsTrackX){overlay.AddRect3((x1+x2)/2,(y1+y2)/2,SCALE_TRACK_RECT_SIZE,ex1,ey1,ex2,ey2);overlay.AddRect3((x3+x4)/2,(y3+y4)/2,SCALE_TRACK_RECT_SIZE,ex1,ey1,ex2,ey2)}if(bIsRectsTrackY){overlay.AddRect3((x2+x4)/2,(y2+y4)/2,SCALE_TRACK_RECT_SIZE, ex1,ey1,ex2,ey2);overlay.AddRect3((x3+x1)/2,(y3+y1)/2,SCALE_TRACK_RECT_SIZE,ex1,ey1,ex2,ey2)}}}else if(bIsRectsTrack){var _xC=((_x1+_x2)/2>>0)+indent;var _yC=((_y1+_y3)/2>>0)+indent;if(bIsRectsTrackX){overlay.AddRect2(_xC,_y1+indent,SCALE_TRACK_RECT_SIZE);overlay.AddRect2(_xC,_y3+indent,SCALE_TRACK_RECT_SIZE)}if(bIsRectsTrackY){overlay.AddRect2(_x2+indent,_yC,SCALE_TRACK_RECT_SIZE);overlay.AddRect2(_x1+indent,_yC,SCALE_TRACK_RECT_SIZE)}}ctx.fill();ctx.stroke();ctx.beginPath()}break}case AscFormat.TYPE_TRACK.EMPTY_PH:{if(bIsClever){overlay.CheckRect(x1, y1,x4-x1,y4-y1);ctx.rect(x1+indent,y2+indent,x4-x1+1,y4-y1);ctx.fillStyle=_style_white;ctx.stroke();ctx.beginPath();ctx.strokeStyle=_style_blue;this.AddRectDashClever(ctx,x1,y1,x4,y4,8,3,true);ctx.beginPath();var xC=(x1+x2)/2>>0;if(!bIsUseImageRotateTrack){ctx.beginPath();overlay.AddEllipse(xC,y1-Math.round(TRACK_DISTANCE_ROTATE*rPR));ctx.fillStyle=_style_green;ctx.fill();ctx.stroke()}else{var _image_track_rotate=overlay.GetImageTrackRotationImage();if(_image_track_rotate.asc_complete){var _w=Math.round(ROTATE_TRACK_W* rPR);var _xI=xC+indent-_w/2>>0;var _yI=y1-Math.round(TRACK_DISTANCE_ROTATE*rPR)-(_w>>1);overlay.CheckRect(_xI,_yI,_w,_w);ctx.drawImage(_image_track_rotate,_xI,_yI,_w,_w)}}ctx.beginPath();ctx.moveTo(xC+indent,y1);ctx.lineTo(xC+indent,y1-Math.round(TRACK_DISTANCE_ROTATE2*rPR));ctx.stroke();ctx.beginPath();ctx.fillStyle=_style_white;if(bIsEllipceCorner){overlay.AddEllipse(x1,y1,Math.round(TRACK_CIRCLE_RADIUS*rPR));overlay.AddEllipse(x2,y2,Math.round(TRACK_CIRCLE_RADIUS*rPR));overlay.AddEllipse(x3,y3, Math.round(TRACK_CIRCLE_RADIUS*rPR));overlay.AddEllipse(x4,y4,Math.round(TRACK_CIRCLE_RADIUS*rPR))}else{overlay.AddRect2(x1+indent,y1+indent,SCALE_TRACK_RECT_SIZE);overlay.AddRect2(x2+indent,y2+indent,SCALE_TRACK_RECT_SIZE);overlay.AddRect2(x3+indent,y3+indent,SCALE_TRACK_RECT_SIZE);overlay.AddRect2(x4+indent,y4+indent,SCALE_TRACK_RECT_SIZE)}if(bIsRectsTrack&&false){var _xC=((x1+x2)/2>>0)+indent;var _yC=((y1+y3)/2>>0)+indent;overlay.AddRect2(_xC,y1+indent,SCALE_TRACK_RECT_SIZE);overlay.AddRect2(x2+ indent,_yC,SCALE_TRACK_RECT_SIZE);overlay.AddRect2(_xC,y3+indent,SCALE_TRACK_RECT_SIZE);overlay.AddRect2(x1+indent,_yC,SCALE_TRACK_RECT_SIZE)}ctx.fill();ctx.stroke();ctx.beginPath()}else{overlay.CheckPoint(x1,y1);overlay.CheckPoint(x2,y2);overlay.CheckPoint(x3,y3);overlay.CheckPoint(x4,y4);ctx.moveTo(x1,y1);ctx.lineTo(x2,y2);ctx.lineTo(x3,y3);ctx.lineTo(x4,y4);ctx.closePath();overlay.CheckPoint(x1,y1);overlay.CheckPoint(x2,y2);overlay.CheckPoint(x3,y3);overlay.CheckPoint(x4,y4);ctx.strokeStyle=_style_white; ctx.stroke();ctx.beginPath();ctx.strokeStyle=_style_blue;this.AddRectDash(ctx,x1,y1,x2,y2,x3,y3,x4,y4,8,3,true);ctx.beginPath();var ex1=(x2-x1)/_len_x;var ey1=(y2-y1)/_len_x;var ex2=(x1-x3)/_len_y;var ey2=(y1-y3)/_len_y;var _bAbsX1=Math.abs(ex1)<.01;var _bAbsY1=Math.abs(ey1)<.01;var _bAbsX2=Math.abs(ex2)<.01;var _bAbsY2=Math.abs(ey2)<.01;if(_bAbsX2&&_bAbsY2)if(_bAbsX1&&_bAbsY1){ex1=1;ey1=0;ex2=0;ey2=1}else{ex2=-ey1;ey2=ex1}else if(_bAbsX1&&_bAbsY1){ex1=ey2;ey1=-ex2}var xc1=(x1+x2)/2;var yc1=(y1+y2)/ 2;ctx.beginPath();if(!bIsUseImageRotateTrack){ctx.beginPath();overlay.AddEllipse(xc1+ex2*TRACK_DISTANCE_ROTATE*rPR,yc1+ey2*TRACK_DISTANCE_ROTATE*rPR,Math.round(TRACK_DISTANCE_ROTATE*rPR));ctx.fillStyle=_style_green;ctx.fill();ctx.stroke()}else{var _image_track_rotate=overlay.GetImageTrackRotationImage();if(_image_track_rotate.asc_complete){var _xI=xc1+ex2*TRACK_DISTANCE_ROTATE*rPR;var _yI=yc1+ey2*TRACK_DISTANCE_ROTATE*rPR;var _w=Math.round(ROTATE_TRACK_W*rPR);var _w2=Math.round(ROTATE_TRACK_W/2*rPR); ctx.save();overlay.transform(ex1,ey1,-ey1,ex1,_xI,_yI);ctx.drawImage(_image_track_rotate,-_w2,-_w2,_w,_w);overlay.SetBaseTransform();ctx.restore();overlay.CheckRect(_xI-_w2,_yI-_w2,_w,_w)}}ctx.beginPath();ctx.moveTo(xc1,yc1);ctx.lineTo(xc1+ex2*TRACK_DISTANCE_ROTATE2*rPR,yc1+ey2*TRACK_DISTANCE_ROTATE2*rPR);ctx.stroke();ctx.beginPath();ctx.fillStyle=_style_white;if(bIsEllipceCorner){overlay.AddEllipse(x1,y1,Math.round(TRACK_CIRCLE_RADIUS*rPR));overlay.AddEllipse(x2,y2,Math.round(TRACK_CIRCLE_RADIUS* rPR));overlay.AddEllipse(x3,y3,Math.round(TRACK_CIRCLE_RADIUS*rPR));overlay.AddEllipse(x4,y4,Math.round(TRACK_CIRCLE_RADIUS*rPR))}else{overlay.AddRect3(x1,y1,SCALE_TRACK_RECT_SIZE,ex1,ey1,ex2,ey2);overlay.AddRect3(x2,y2,SCALE_TRACK_RECT_SIZE,ex1,ey1,ex2,ey2);overlay.AddRect3(x3,y3,SCALE_TRACK_RECT_SIZE,ex1,ey1,ex2,ey2);overlay.AddRect3(x4,y4,SCALE_TRACK_RECT_SIZE,ex1,ey1,ex2,ey2)}if(bIsRectsTrack){overlay.AddRect3((x1+x2)/2,(y1+y2)/2,SCALE_TRACK_RECT_SIZE,ex1,ey1,ex2,ey2);overlay.AddRect3((x2+x4)/ 2,(y2+y4)/2,SCALE_TRACK_RECT_SIZE,ex1,ey1,ex2,ey2);overlay.AddRect3((x3+x4)/2,(y3+y4)/2,SCALE_TRACK_RECT_SIZE,ex1,ey1,ex2,ey2);overlay.AddRect3((x3+x1)/2,(y3+y1)/2,SCALE_TRACK_RECT_SIZE,ex1,ey1,ex2,ey2)}ctx.fill();ctx.stroke();ctx.beginPath()}break}case AscFormat.TYPE_TRACK.CROP:{if(bIsClever){overlay.CheckRect(x1,y1,x4-x1,y4-y1);var widthCorner=x4-x1+1>>1;var isCentralMarkerX=widthCorner>Math.round(40*rPR)?true:false;var cropMarkerSize=Math.round(17*rPR);if(widthCorner>cropMarkerSize)widthCorner= cropMarkerSize;var heightCorner=y4-y1+1>>1;var isCentralMarkerY=heightCorner>Math.round(40*rPR)?true:false;if(heightCorner>cropMarkerSize)heightCorner=cropMarkerSize;ctx.rect(x1+indent,y2+indent,x4-x1+1,y4-y1);ctx.strokeStyle=_style_black;ctx.stroke();ctx.beginPath();ctx.strokeStyle=_style_white;ctx.fillStyle=_style_black;var roundRPR=Math.round(rPR);ctx.moveTo(x1+indent,y1+indent);ctx.lineTo(x1+widthCorner+indent,y1+indent);ctx.lineTo(x1+widthCorner+indent,y1+5.5*roundRPR);ctx.lineTo(x1+5.5*roundRPR, y1+5.5*roundRPR);ctx.lineTo(x1+5.5*roundRPR,y1+widthCorner+indent);ctx.lineTo(x1+indent,y1+widthCorner+indent);ctx.closePath();ctx.moveTo(x2-widthCorner+indent,y2+indent);ctx.lineTo(x2+indent,y2+indent);ctx.lineTo(x2+indent,y2+heightCorner+indent);ctx.lineTo(x2-4.5*roundRPR,y2+heightCorner+indent);ctx.lineTo(x2-4.5*roundRPR,y2+5.5*roundRPR);ctx.lineTo(x2-widthCorner+indent,y2+5.5*roundRPR);ctx.closePath();ctx.moveTo(x4-4.5*roundRPR,y4-heightCorner+indent);ctx.lineTo(x4+indent,y4-heightCorner+indent); ctx.lineTo(x4+indent,y4+indent);ctx.lineTo(x4-widthCorner+indent,y4+indent);ctx.lineTo(x4-widthCorner+indent,y4-4.5*roundRPR);ctx.lineTo(x4-4.5*roundRPR,y4-4.5*roundRPR);ctx.closePath();ctx.moveTo(x3+indent,y3-heightCorner+indent);ctx.lineTo(x3+5.5*roundRPR,y3-heightCorner+indent);ctx.lineTo(x3+5.5*roundRPR,y3-4.5*roundRPR);ctx.lineTo(x3+widthCorner+indent,y3-4.5*roundRPR);ctx.lineTo(x3+widthCorner+indent,y3+indent);ctx.lineTo(x3+indent,y3+indent);ctx.closePath();if(isCentralMarkerX){var xCentral= x4+x1-widthCorner>>1;ctx.moveTo(xCentral+indent,y1+indent);ctx.lineTo(xCentral+widthCorner+indent,y1+indent);ctx.lineTo(xCentral+widthCorner+indent,y1+5.5*roundRPR);ctx.lineTo(xCentral+indent,y1+5.5*roundRPR);ctx.closePath();ctx.moveTo(xCentral+indent,y4-4.5*roundRPR);ctx.lineTo(xCentral+widthCorner+indent,y4-4.5*roundRPR);ctx.lineTo(xCentral+widthCorner+indent,y4);ctx.lineTo(xCentral+indent,y4+indent);ctx.closePath()}if(isCentralMarkerY){var yCentral=y4+y1-heightCorner>>1;ctx.moveTo(x1+indent,yCentral+ indent);ctx.lineTo(x1+5.5*roundRPR,yCentral+indent);ctx.lineTo(x1+5.5*roundRPR,yCentral+heightCorner+indent);ctx.lineTo(x1+indent,yCentral+heightCorner+indent);ctx.closePath();ctx.moveTo(x4-4.5*roundRPR,yCentral+indent);ctx.lineTo(x4+indent,yCentral+indent);ctx.lineTo(x4+indent,yCentral+heightCorner+indent);ctx.lineTo(x4-4.5*roundRPR,yCentral+heightCorner+indent);ctx.closePath()}ctx.fill();ctx.stroke();ctx.beginPath()}else{overlay.CheckPoint(x1,y1);overlay.CheckPoint(x2,y2);overlay.CheckPoint(x3, y3);overlay.CheckPoint(x4,y4);var ex1=(x2-x1)/_len_x;var ey1=(y2-y1)/_len_x;var ex2=(x1-x3)/_len_y;var ey2=(y1-y3)/_len_y;var _bAbsX1=Math.abs(ex1)<.01;var _bAbsY1=Math.abs(ey1)<.01;var _bAbsX2=Math.abs(ex2)<.01;var _bAbsY2=Math.abs(ey2)<.01;if(_bAbsX2&&_bAbsY2)if(_bAbsX1&&_bAbsY1){ex1=1;ey1=0;ex2=0;ey2=1}else{ex2=-ey1;ey2=ex1}else if(_bAbsX1&&_bAbsY1){ex1=ey2;ey1=-ex2}var widthCorner=_len_x>>1;var isCentralMarkerX=widthCorner>Math.round(40*rPR)?true:false;var cropMarkerSize=Math.round(17*rPR);if(widthCorner> cropMarkerSize)widthCorner=cropMarkerSize;var heightCorner=_len_y>>1;var isCentralMarkerY=heightCorner>Math.round(40*rPR)?true:false;if(heightCorner>cropMarkerSize)heightCorner=cropMarkerSize;ctx.moveTo(x1,y1);ctx.lineTo(x2,y2);ctx.lineTo(x4,y4);ctx.lineTo(x3,y3);ctx.closePath();ctx.strokeStyle=_style_black;ctx.stroke();ctx.beginPath();ctx.strokeStyle=_style_white;ctx.fillStyle=_style_black;var xOff1=widthCorner*ex1;var xOff2=5*ex1;var xOff3=-heightCorner*ex2;var xOff4=-5*ex2;var yOff1=widthCorner* ey1;var yOff2=5*ey1;var yOff3=-heightCorner*ey2;var yOff4=-5*ey2;ctx.moveTo(x1,y1);ctx.lineTo(x1+xOff1,y1+yOff1);ctx.lineTo(x1+xOff1+xOff4,y1+yOff1+yOff4);ctx.lineTo(x1+xOff2+xOff4,y1+yOff2+yOff4);ctx.lineTo(x1+xOff2+xOff3,y1+yOff2+yOff3);ctx.lineTo(x1+xOff3,y1+yOff3);ctx.closePath();ctx.moveTo(x2-xOff1,y2-yOff1);ctx.lineTo(x2,y2);ctx.lineTo(x2+xOff3,y2+yOff3);ctx.lineTo(x2+xOff3-xOff2,y2+yOff3-yOff2);ctx.lineTo(x2-xOff2+xOff4,y2-yOff2+yOff4);ctx.lineTo(x2-xOff1+xOff4,y2-yOff1+yOff4);ctx.closePath(); ctx.moveTo(x4-xOff3-xOff2,y4-yOff3-yOff2);ctx.lineTo(x4-xOff3,y4-yOff3);ctx.lineTo(x4,y4);ctx.lineTo(x4-xOff1,y4-yOff1);ctx.lineTo(x4-xOff1-xOff4,y4-yOff1-yOff4);ctx.lineTo(x4-xOff2-xOff4,y4-yOff2-yOff4);ctx.closePath();ctx.moveTo(x3-xOff3,y3-yOff3);ctx.lineTo(x3-xOff3+xOff2,y3-yOff3+yOff2);ctx.lineTo(x3-xOff4+xOff2,y3-yOff4+yOff2);ctx.lineTo(x3+xOff1-xOff4,y3+yOff1-yOff4);ctx.lineTo(x3+xOff1,y3+yOff1);ctx.lineTo(x3,y3);ctx.closePath();if(isCentralMarkerX){var xCentral=x1+ex1*(_len_x-widthCorner)/ 2;var yCentral=y1+ey1*(_len_x-widthCorner)/2;ctx.moveTo(xCentral,yCentral);ctx.lineTo(xCentral+xOff1,yCentral+yOff1);ctx.lineTo(xCentral+xOff1+xOff4,yCentral+yOff1+yOff4);ctx.lineTo(xCentral+xOff4,yCentral+yOff4);ctx.closePath();xCentral=x3+ex1*(_len_x-widthCorner)/2-xOff4;yCentral=y3+ey1*(_len_x-widthCorner)/2-yOff4;ctx.moveTo(xCentral,yCentral);ctx.lineTo(xCentral+xOff1,yCentral+yOff1);ctx.lineTo(xCentral+xOff1+xOff4,yCentral+yOff1+yOff4);ctx.lineTo(xCentral+xOff4,yCentral+yOff4);ctx.closePath()}if(isCentralMarkerY){var xCentral= x1-ex2*(_len_y-heightCorner)/2;var yCentral=y1-ey2*(_len_y-heightCorner)/2;ctx.moveTo(xCentral,yCentral);ctx.lineTo(xCentral+xOff2,yCentral+yOff2);ctx.lineTo(xCentral+xOff2+xOff3,yCentral+yOff2+yOff3);ctx.lineTo(xCentral+xOff3,yCentral+yOff3);ctx.closePath();xCentral=x2-ex2*(_len_y-heightCorner)/2-xOff2;yCentral=y2-ey2*(_len_y-heightCorner)/2-yOff2;ctx.moveTo(xCentral,yCentral);ctx.lineTo(xCentral+xOff2,yCentral+yOff2);ctx.lineTo(xCentral+xOff2+xOff3,yCentral+yOff2+yOff3);ctx.lineTo(xCentral+xOff3, yCentral+yOff3);ctx.closePath()}ctx.fill();ctx.stroke();ctx.beginPath()}break}default:break}ctx.globalAlpha=_oldGlobalAlpha;if(this.m_oOverlay.IsCellEditor){this.m_oOverlay.SetBaseTransform();if(matrix){matrix.tx*=AscCommon.AscBrowser.retinaPixelRatio;matrix.ty*=AscCommon.AscBrowser.retinaPixelRatio}}},DrawTrackSelectShapes:function(x,y,w,h){var overlay=this.m_oOverlay;overlay.Show();this.CurrentPageInfo=overlay.m_oHtmlPage.GetDrawingPageInfo(this.PageIndex);var drPage=this.CurrentPageInfo.drawingPage; var rPR=AscCommon.AscBrowser.retinaPixelRatio;var xDst=drPage.left*rPR;var yDst=drPage.top*rPR;var wDst=(drPage.right-drPage.left)*rPR;var hDst=(drPage.bottom-drPage.top)*rPR;var indent=.5*Math.round(rPR);var dKoefX=wDst/this.CurrentPageInfo.width_mm;var dKoefY=hDst/this.CurrentPageInfo.height_mm;var x1=xDst+dKoefX*x>>0;var y1=yDst+dKoefY*y>>0;var x2=xDst+dKoefX*(x+w)>>0;var y2=yDst+dKoefY*(y+h)>>0;if(x1>x2){var tmp=x1;x1=x2;x2=tmp}if(y1>y2){var tmp=y1;y1=y2;y2=tmp}overlay.CheckRect(x1,y1,x2-x1,y2- y1);var ctx=overlay.m_oContext;overlay.SetBaseTransform();var globalAlphaOld=ctx.globalAlpha;ctx.globalAlpha=.5;ctx.beginPath();ctx.fillStyle="rgba(51,102,204,255)";ctx.strokeStyle="#9ADBFE";ctx.lineWidth=1;ctx.fillRect(x1,y1,x2-x1,y2-y1);ctx.beginPath();ctx.strokeRect(x1-indent,y1-indent,x2-x1+1,y2-y1+1);ctx.globalAlpha=globalAlphaOld},AddRect:function(ctx,x,y,r,b,bIsClever){if(bIsClever){var indent=.5*Math.round(AscCommon.AscBrowser.retinaPixelRatio);ctx.rect(x+indent,y+indent,r-x+1,b-y+1)}else{ctx.moveTo(x, y);ctx.rect(x,y,r-x+1,b-y+1)}},AddRectDashClever:function(ctx,x,y,r,b,w_dot,w_dist,bIsStrokeAndCanUseNative){var _support_native_dash=undefined!==ctx.setLineDash;var rPR=AscCommon.AscBrowser.retinaPixelRatio;var indent=.5*Math.round(rPR);w_dot*=Math.round(rPR);w_dist*=Math.round(rPR);var _x=x+indent;var _y=y+indent;var _r=r+indent;var _b=b+indent;if(_support_native_dash&&bIsStrokeAndCanUseNative===true){ctx.setLineDash([w_dot,w_dist]);ctx.moveTo(x,_y);ctx.lineTo(r-1,_y);ctx.moveTo(_r,y);ctx.lineTo(_r, b-1);ctx.moveTo(r+1,_b);ctx.lineTo(x+2,_b);ctx.moveTo(_x,b+1);ctx.lineTo(_x,y+2);ctx.stroke();ctx.setLineDash([]);return}for(var i=x;ir-1)i=r-1;ctx.lineTo(i,_y)}for(var i=y;ib-1)i=b-1;ctx.lineTo(_r,i)}for(var i=r+1;i>x+1;i-=w_dist){ctx.moveTo(i,_b);i-=w_dot;if(iy+1;i-=w_dist){ctx.moveTo(_x,i);i-=w_dot;if(ix2)i=x2;if(j>y2)j=y2;ctx.lineTo(i,j)}else if(x1<= x2&&y1>y2)for(var i=x1,j=y1;i<=x2&&j>=y2;i+=len_x2,j-=len_y2){ctx.moveTo(i,j);i+=len_x1;j-=len_y1;if(i>x2)i=x2;if(jx2&&y1<=y2)for(var i=x1,j=y1;i>=x2&&j<=y2;i-=len_x2,j+=len_y2){ctx.moveTo(i,j);i-=len_x1;j+=len_y1;if(iy2)j=y2;ctx.lineTo(i,j)}else for(var i=x1,j=y1;i>=x2&&j>=y2;i-=len_x2,j-=len_y2){ctx.moveTo(i,j);i-=len_x1;j-=len_y1;if(i>0;var cy=yDst+dKoefY*matrix.TransformPointY(x,y)>>0;var _style_blue="#4D7399";var _style_yellow="#FDF54A";var _style_text_adj="#F888FF";var ctx=overlay.m_oContext;var dist=TRACK_ADJUSTMENT_SIZE*rPR/2;ctx.lineWidth=Math.round(rPR);ctx.moveTo(cx-dist,cy);ctx.lineTo(cx,cy-dist);ctx.lineTo(cx+dist,cy);ctx.lineTo(cx,cy+dist);ctx.closePath();overlay.CheckRect(cx-dist,cy-dist,Math.round(TRACK_ADJUSTMENT_SIZE*rPR),Math.round(TRACK_ADJUSTMENT_SIZE*rPR));if(bTextWarp===true)ctx.fillStyle=_style_text_adj; else ctx.fillStyle=_style_yellow;ctx.strokeStyle=_style_blue;ctx.fill();ctx.stroke();ctx.beginPath()},DrawEditWrapPointsPolygon:function(points,matrix){var _len=points.length;if(0==_len)return;var overlay=this.m_oOverlay;overlay.SetBaseTransform();var ctx=overlay.m_oContext;var rPR=AscCommon.AscBrowser.retinaPixelRatio;var indent=.5*Math.round(rPR);this.CurrentPageInfo=overlay.m_oHtmlPage.GetDrawingPageInfo(this.PageIndex);var drPage=this.CurrentPageInfo.drawingPage;var xDst=drPage.left*rPR;var yDst= drPage.top*rPR;var wDst=(drPage.right-drPage.left)*rPR;var hDst=(drPage.bottom-drPage.top)*rPR;var dKoefX=wDst/this.CurrentPageInfo.width_mm;var dKoefY=hDst/this.CurrentPageInfo.height_mm;var _tr_points_x=new Array(_len);var _tr_points_y=new Array(_len);for(var i=0;i<_len;i++){_tr_points_x[i]=xDst+dKoefX*matrix.TransformPointX(points[i].x,points[i].y)>>0;_tr_points_y[i]=yDst+dKoefY*matrix.TransformPointY(points[i].x,points[i].y)>>0}ctx.beginPath();for(var i=0;i<_len;i++){if(0==i)ctx.moveTo(_tr_points_x[i], _tr_points_y[i]);else ctx.lineTo(_tr_points_x[i],_tr_points_y[i]);overlay.CheckPoint(_tr_points_x[i],_tr_points_y[i])}ctx.closePath();ctx.lineWidth=Math.round(rPR);ctx.strokeStyle="#FF0000";ctx.stroke();ctx.beginPath();for(var i=0;i<_len;i++)overlay.AddRect2(_tr_points_x[i]+indent,_tr_points_y[i]+indent,Math.round(TRACK_WRAPPOINTS_SIZE*rPR));ctx.strokeStyle="#FFFFFF";ctx.fillStyle="#000000";ctx.fill();ctx.stroke();ctx.beginPath()},DrawEditWrapPointsTrackLines:function(points,matrix){var _len=points.length; if(0==_len)return;var overlay=this.m_oOverlay;overlay.SetBaseTransform();var ctx=overlay.m_oContext;this.CurrentPageInfo=overlay.m_oHtmlPage.GetDrawingPageInfo(this.PageIndex);var drPage=this.CurrentPageInfo.drawingPage;var rPR=AscCommon.AscBrowser.retinaPixelRatio;var xDst=drPage.left*rPR;var yDst=drPage.top*rPR;var wDst=(drPage.right-drPage.left)*rPR;var hDst=(drPage.bottom-drPage.top)*rPR;var dKoefX=wDst/this.CurrentPageInfo.width_mm;var dKoefY=hDst/this.CurrentPageInfo.height_mm;var _tr_points_x= new Array(_len);var _tr_points_y=new Array(_len);for(var i=0;i<_len;i++){_tr_points_x[i]=xDst+dKoefX*matrix.TransformPointX(points[i].x,points[i].y)>>0;_tr_points_y[i]=yDst+dKoefY*matrix.TransformPointY(points[i].x,points[i].y)>>0}var globalAlpha=ctx.globalAlpha;ctx.globalAlpha=1;ctx.beginPath();for(var i=0;i<_len;i++){if(0==i)ctx.moveTo(_tr_points_x[i],_tr_points_y[i]);else ctx.lineTo(_tr_points_x[i],_tr_points_y[i]);overlay.CheckPoint(_tr_points_x[i],_tr_points_y[i])}ctx.lineWidth=1;ctx.strokeStyle= "#FFFFFF";ctx.stroke();ctx.beginPath();for(var i=1;i<_len;i++)this.AddLineDash(ctx,_tr_points_x[i-1],_tr_points_y[i-1],_tr_points_x[i],_tr_points_y[i],4,4);ctx.lineWidth=Math.round(rPR);ctx.strokeStyle="#000000";ctx.stroke();ctx.beginPath();ctx.globalAlpha=globalAlpha},DrawInlineMoveCursor:function(x,y,h,matrix,overlayNotes){var overlay=this.m_oOverlay;this.CurrentPageInfo=overlay.m_oHtmlPage.GetDrawingPageInfo(this.PageIndex);var drPage=this.CurrentPageInfo.drawingPage;var rPR=AscCommon.AscBrowser.retinaPixelRatio; var xDst=drPage.left*rPR;var yDst=drPage.top*rPR;var wDst=(drPage.right-drPage.left)*rPR;var hDst=(drPage.bottom-drPage.top)*rPR;var dKoefX=wDst/this.CurrentPageInfo.width_mm;var dKoefY=hDst/this.CurrentPageInfo.height_mm;if(overlayNotes){dKoefX=AscCommon.g_dKoef_mm_to_pix*rPR;dKoefY=AscCommon.g_dKoef_mm_to_pix*rPR;overlay=overlayNotes;var offsets=overlayNotes.getNotesOffsets();xDst=offsets.X;yDst=offsets.Y}var bIsIdentMatr=true;if(matrix!==undefined&&matrix!=null)if(matrix.IsIdentity2()){x+=matrix.tx; y+=matrix.ty}else bIsIdentMatr=false;overlay.SetBaseTransform();if(bIsIdentMatr){var __x=xDst+dKoefX*x>>0;var __y=yDst+dKoefY*y>>0;var __h=h*dKoefY>>0;overlay.CheckRect(__x,__y,2,__h);var ctx=overlay.m_oContext;var _oldAlpha=ctx.globalAlpha;ctx.globalAlpha=1;ctx.lineWidth=Math.round(rPR);ctx.strokeStyle="#000000";var indent=.5*Math.round(rPR);var step=Math.round(rPR);for(var i=0;i<__h;i+=2*step){ctx.moveTo(__x,__y+i+indent);ctx.lineTo(__x+2*step,__y+i+indent)}ctx.stroke();ctx.beginPath();ctx.strokeStyle= "#FFFFFF";for(var i=step;i<__h;i+=2*step){ctx.moveTo(__x,__y+i+indent);ctx.lineTo(__x+2*step,__y+i+indent)}ctx.stroke();ctx.globalAlpha=_oldAlpha}else{var _x1=matrix.TransformPointX(x,y);var _y1=matrix.TransformPointY(x,y);var _x2=matrix.TransformPointX(x,y+h);var _y2=matrix.TransformPointY(x,y+h);_x1=xDst+dKoefX*_x1;_y1=yDst+dKoefY*_y1;_x2=xDst+dKoefX*_x2;_y2=yDst+dKoefY*_y2;overlay.CheckPoint(_x1,_y1);overlay.CheckPoint(_x2,_y2);var ctx=overlay.m_oContext;var _oldAlpha=ctx.globalAlpha;ctx.globalAlpha= 1;ctx.lineWidth=2*Math.round(rPR);ctx.beginPath();ctx.strokeStyle="#FFFFFF";ctx.moveTo(_x1,_y1);ctx.lineTo(_x2,_y2);ctx.stroke();ctx.beginPath();ctx.strokeStyle="#000000";var _vec_len=Math.sqrt((_x2-_x1)*(_x2-_x1)+(_y2-_y1)*(_y2-_y1));var _dx=(_x2-_x1)/_vec_len;var _dy=(_y2-_y1)/_vec_len;var __x=_x1;var __y=_y1;var step=rPR;_dx*=step;_dy*=step;for(var i=0;i<_vec_len;i+=2*step){ctx.moveTo(__x,__y);__x+=_dx;__y+=_dy;ctx.lineTo(__x,__y);__x+=_dx;__y+=_dy}ctx.stroke();ctx.globalAlpha=_oldAlpha}},drawFlowAnchor:function(x, y){var _flow_anchor=AscCommon.OverlayRasterIcons&&AscCommon.OverlayRasterIcons.Anchor?AscCommon.OverlayRasterIcons.Anchor.get():undefined;if(!_flow_anchor||(!editor||!editor.ShowParaMarks))return;var overlay=this.m_oOverlay;this.CurrentPageInfo=overlay.m_oHtmlPage.GetDrawingPageInfo(this.PageIndex);var drPage=this.CurrentPageInfo.drawingPage;var rPR=AscCommon.AscBrowser.retinaPixelRatio;var xDst=drPage.left*rPR;var yDst=drPage.top*rPR;var wDst=(drPage.right-drPage.left)*rPR;var hDst=(drPage.bottom- drPage.top)*rPR;var dKoefX=wDst/this.CurrentPageInfo.width_mm;var dKoefY=hDst/this.CurrentPageInfo.height_mm;var __x=xDst+dKoefX*x>>0;var __y=yDst+dKoefY*y>>0;__x-=Math.round(8*rPR);overlay.CheckRect(__x,__y,Math.round(13*rPR),Math.round(15*rPR));var ctx=overlay.m_oContext;var _oldAlpha=ctx.globalAlpha;ctx.globalAlpha=1;overlay.SetBaseTransform();var _w=Math.round(13*rPR);var _h=Math.round(15*rPR);if(Math.abs(_w-_flow_anchor.width)<2)_w=_flow_anchor.width;if(Math.abs(_h-_flow_anchor.height)<2)_h= _flow_anchor.height;ctx.drawImage(_flow_anchor,__x,__y,_w,_h);ctx.globalAlpha=_oldAlpha},DrawPresentationComment:function(type,x,y,w,h){if(!AscCommon.g_comment_image||!AscCommon.g_comment_image.asc_complete)return;var overlay=this.m_oOverlay;this.CurrentPageInfo=overlay.m_oHtmlPage.GetDrawingPageInfo(this.PageIndex);var drPage=this.CurrentPageInfo.drawingPage;var rPR=AscCommon.AscBrowser.retinaPixelRatio;var xDst=drPage.left*rPR;var yDst=drPage.top*rPR;var wDst=(drPage.right-drPage.left)*rPR;var hDst= (drPage.bottom-drPage.top)*rPR;var dKoefX=wDst/this.CurrentPageInfo.width_mm;var dKoefY=hDst/this.CurrentPageInfo.height_mm;var __x=xDst+dKoefX*x>>0;var __y=yDst+dKoefY*y>>0;var ctx=overlay.m_oContext;var _oldAlpha=ctx.globalAlpha;ctx.globalAlpha=.5;overlay.SetBaseTransform();var _index=0;if((type&2)==2)_index=2;if((type&1)==1)_index+=1;var _offset=AscCommon.g_comment_image_offsets[_index];overlay.CheckRect(__x,__y,rPR*_offset[2],rPR*_offset[3]);this.m_oContext.drawImage(AscCommon.g_comment_image, _offset[0],_offset[1],_offset[2],_offset[3],__x,__y,rPR*_offset[2],rPR*_offset[3]);ctx.globalAlpha=_oldAlpha},DrawFrozenPaneBorderHor:function(y,left,right){this.m_oOverlay.SetBaseTransform();autoShapeTrack.p_color(170,170,170);var nW=BORDER_WIDTH;if(AscCommon.AscBrowser.isRetina)nW=AscCommon.AscBrowser.convertToRetinaValue(nW,true);autoShapeTrack.Graphics.SetIntegerGrid(true);autoShapeTrack.p_width(nW);autoShapeTrack._s();autoShapeTrack._m(left,y);autoShapeTrack._l(right,y);autoShapeTrack.ds();autoShapeTrack.Graphics.SetIntegerGrid(false)}}; function DrawTextByCenter(){var shape=new AscFormat.CShape;shape.setTxBody(AscFormat.CreateTextBodyFromString("",this,shape));var par=shape.txBody.content.Content[0];par.Reset(0,0,1E3,1E3,0);par.MoveCursorToStartPos();var _paraPr=new CParaPr;par.Pr=_paraPr;var _textPr=new CTextPr;_textPr.FontFamily={Name:this.Font,Index:-1};_textPr.RFonts.Ascii={Name:this.Font,Index:-1};_textPr.RFonts.EastAsia={Name:this.Font,Index:-1};_textPr.RFonts.CS={Name:this.Font,Index:-1};_textPr.RFonts.HAnsi={Name:this.Font, Index:-1};_textPr.Bold=this.Bold;_textPr.Italic=this.Italic;_textPr.FontSize=this.Size;_textPr.FontSizeCS=this.Size;var parRun=new ParaRun(par);var Pos=0;parRun.Set_Pr(_textPr);parRun.AddText(this.Text);par.AddToContent(0,parRun);par.Recalculate_Page(0);par.Recalculate_Page(0);var _bounds=par.Get_PageBounds(0);var _canvas=this.getCanvas();var _ctx=_canvas.getContext("2d");var _wPx=_canvas.width;var _hPx=_canvas.height;var _wMm=_wPx*AscCommon.g_dKoef_pix_to_mm;var _hMm=_hPx*AscCommon.g_dKoef_pix_to_mm; _ctx.clearRect(0,0,_wPx,_hPx);var _pxBoundsW=par.Lines[0].Ranges[0].W*AscCommon.g_dKoef_mm_to_pix;var _pxBoundsH=(_bounds.Bottom-_bounds.Top)*AscCommon.g_dKoef_mm_to_pix;var _yOffset=_hPx-_pxBoundsH>>1;var _xOffset=_wPx-_pxBoundsW>>1;var graphics=new AscCommon.CGraphics;graphics.init(_ctx,_wPx,_hPx,_wMm,_hMm);graphics.m_oFontManager=AscCommon.g_fontManager;graphics.m_oCoordTransform.tx=_xOffset;graphics.m_oCoordTransform.ty=_yOffset;graphics.transform(1,0,0,1,0,0);par.Draw(0,graphics)}window["AscCommon"]= window["AscCommon"]||{};window["AscCommon"].TRACK_CIRCLE_RADIUS=TRACK_CIRCLE_RADIUS;window["AscCommon"].TRACK_DISTANCE_ROTATE=TRACK_DISTANCE_ROTATE;window["AscCommon"].COverlay=COverlay;window["AscCommon"].CAutoshapeTrack=CAutoshapeTrack;window["AscCommon"].DrawTextByCenter=DrawTextByCenter})(window);"use strict";(function(window,undefined){var global_hatch_data=[0,0,0,0,0,0,0,0,0,1,1,1,0,1,1,1,0,1,1,1,0,1,1,1,0,1,1,1,0,1,1,1,0,0,0,0,0,0,0,0,0,1,1,1,0,1,1,1,0,1,1,1,0,1,1,1,0,1,1,1,0,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,1,1,1,1,1,0,1,1,1,0,1,1,1,1,0,1,1,1,0,1,1,1,1,0,1,1,1,0,1,1,1,1,0,1,1,1,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,1,1,1,0,1,1,0,1,1,1,0,1,1,0,1,1,1,0,1,1,0,1,1,1,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,1,1,1,1,1,1,1,0,1,1,1,1,1,1,1,0,1,1,1,1,1,1,1,0,1,1,1,1,1,1,1,1,1,1,1,0,1,1,1,1,1,1,1,0,1,1,1,1,1,1,1,0,1,1,1,1,1,1,1,0,1,1, 1,1,1,1,1,1,1,1,0,1,1,1,1,1,1,0,1,1,1,1,1,1,0,1,1,1,1,1,1,0,1,1,1,1,1,1,0,0,1,1,1,1,1,0,1,1,0,1,1,1,0,1,1,1,1,0,1,0,1,1,1,1,1,1,0,0,1,1,1,1,1,0,1,1,0,1,1,1,0,1,1,1,1,0,1,0,1,1,1,1,1,1,0,1,1,1,1,1,1,0,1,0,1,1,1,1,0,1,1,1,0,1,1,0,1,1,1,1,1,0,1,1,1,1,1,1,1,1,0,1,1,1,1,1,1,1,1,1,1,1,0,1,1,1,1,1,1,1,1,0,1,1,1,1,1,1,0,1,1,1,1,1,1,1,1,1,1,1,1,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,1,1,1,1,1,1,1,0,0,1,1,0,0,1,1,1,0,0,1,1,0,0,1,1,1,0,0,1,1,0,0,0,1,1,0,0,1,1,0,0,0,1,1,0,0,1,1,1,0,0,1,1,0,0,1,1,1,0,0,1,1,0,0,0,1, 1,0,0,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,1,1,0,0,1,0,0,1,1,0,0,1,0,0,1,1,0,0,1,1,0,1,1,0,0,1,1,0,1,1,0,0,1,1,0,0,1,0,0,1,1,0,0,1,0,0,1,1,0,0,1,1,0,1,1,0,0,1,1,0,0,0,1,1,0,0,1,1,0,0,1,1,0,0,1,1,0,0,1,1,0,0,1,1,0,0,1,1,0,0,1,1,0,0,1,1,0,0,1,1,0,0,1,1,0,0,1,1,0,0,1,1,0,0,1,1,0,0,1,1,0,0,1,1,0,1,1,1,0,1,1,1,1,0,1,1,1,0,1,1,1,1,0,1,1,1,0,1,1,1,1,0,1,1,1,0,0,1,1,1,0,1,1,1,1,0,1,1,1,0,1,1,1,1,0,1,1, 1,0,1,1,1,1,0,1,1,1,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,1,1,1,0,1,1,1,1,1,1,1,1,1,1,1,1,1,0,1,1,1,1,1,1,1,1,1,1,1,1,1,0,1,1,1,0,1,1,1,1,1,1,1,1,1,0,1,0,1,0,1,0,1,1,1,1,1,1,1,1,1,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,0,1,1,1,1,1,1,1,0,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,1,1,1,1,0,1,1,1, 1,1,1,1,0,1,1,1,1,1,1,1,0,1,1,1,0,0,0,0,1,1,1,1,0,0,0,0,1,1,1,1,0,0,0,0,1,1,1,1,0,0,0,0,1,1,1,1,1,1,1,1,0,0,0,0,1,1,1,1,0,0,0,0,1,1,1,1,0,0,0,0,1,1,1,1,0,0,0,0,0,1,0,0,1,1,1,0,1,1,0,0,1,1,1,1,1,1,1,1,1,1,0,0,1,1,1,0,0,1,0,0,0,0,1,0,0,1,1,1,0,0,1,1,1,1,1,1,1,1,1,1,0,0,1,1,0,1,1,1,0,0,1,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,0,1,1,1,1,1,1,1,0,1,1,1,1,1,1,1,0,1,1,1,1,1,1,1,0,1,1,1,1,1,1,1,0,1,1,1,1,1,1,1,0,1,1,1,1,1,1,1,0,1,1,1,0,1,1,1,1,0,1,1,1,0,1,1,1,1,0,1,1,1,0,1,1,1,1,0,1,1,1,0,0,1,1,1,0,1,1,1,1,0,1, 1,1,0,1,1,1,1,0,1,1,1,0,1,1,1,1,0,1,1,1,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,1,1,1,0,1,1,0,1,1,1,0,1,1,0,1,1,1,0,1,1,0,1,1,1,0,1,1,1,1,1,1,0,1,1,1,0,1,1,0,1,1,1,0,1,1,0,1,1,1,0,1,1,0,1,1,1,0,1,1,1,0,1,1,1,0,1,1,1,0,1,1,1,0,1,1,1,0,1,1,1,0,1,1,1,0,1,1,1,0,1,1,1,0,1,1,1,0,1,1,1,0,1,1,1,0,1,1,1,0,1,1,1,0,1,1,1,0,1,1,1,0,1,1,1,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,0,0,0,0,0,0, 0,0,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,0,1,1,1,1,1,0,1,1,0,1,1,1,0,1,1,1,1,0,1,0,1,1,1,1,1,1,0,1,1,1,1,1,1,0,1,0,1,1,1,1,0,1,1,1,0,1,1,0,1,1,1,1,1,0,1,1,1,1,1,1,1,1,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,1,1,1,1,1,1,1,1,1,1,1,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,1,1,1,1,1,1,1,1,1,1,1,0,1,1,1,0,1,1,1,1,1,1,1,1,1,1,1,1,1,0,1,1,1,0,1,1,1,1,1,1,1,1,1,0, 1,1,1,0,1,1,1,1,1,1,1,1,1,1,1,1,1,0,1,1,1,0,1,1,1,1,1,1,1,1,1,0,1,1,1,0,1,1,1,1,1,0,1,1,1,0,1,0,1,1,1,0,1,1,1,1,1,0,1,1,1,0,1,0,1,1,1,0,1,1,1,1,1,0,1,1,1,0,1,0,1,1,1,0,1,1,1,1,1,0,1,1,1,0,1,0,1,0,1,0,1,0,1,1,0,1,1,1,0,1,1,0,1,0,1,0,1,0,1,1,1,1,0,1,1,1,0,0,1,0,1,0,1,0,1,1,0,1,1,1,0,1,1,0,1,0,1,0,1,0,1,1,1,1,0,1,1,1,0,0,1,0,1,0,1,0,1,1,0,1,0,1,0,1,0,0,1,0,1,0,1,0,1,1,0,1,0,1,1,1,0,0,1,0,1,0,1,0,1,1,0,1,0,1,0,1,0,0,1,0,1,0,1,0,1,1,1,1,0,1,0,1,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,1,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,1,0,1,0,1,0,1,1,0,1,0,1,0,1,0,0,1,0,1,0,1,0,1,1,0,1,0,1,0,1,0,0,1,0,1,0,1,0,1,1,0,1,0,1,0,1,0,0,1,0,1,0,1,0,1,1,0,1,0,1,0,1,0,0,0,0,1,0,0,0,1,1,0,1,0,1,0,1,0,0,1,0,0,0,1,0,0,1,0,1,0,1,0,1,0,0,0,0,1,0,0,0,1,1,0,1,0,1,0,1,0,0,1,0,0,0,1,0,0,1,0,1,0,1,0,1,0,1,0,0,0,1,0,0,0,0,0,1,0,0,0,1,0,1,0,0,0,1,0,0,0,0,0,1,0,0,0,1,0,1,0,0,0,1,0,0,0,0,0,1,0,0,0,1,0,1,0,0,0,1,0,0,0,0,0,1,0,0,0,1,0,1,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,1, 0,0,0,0,0,0,0,0,0,1,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,1,0,1,0,1,0,1,1,0,1,0,1,0,1,0,0,1,0,1,0,1,0,1,1,0,1,0,1,0,1,0,0,0,0,0,1,1,1,1,0,0,0,0,1,1,1,1,0,0,0,0,1,1,1,1,0,0,0,0,1,1,1,1,1,1,1,1,1,1,0,0,0,1,1,1,1,0,1,1,1,0, 1,1,0,1,1,1,1,1,0,0,1,1,1,1,1,1,1,1,0,0,1,1,1,1,1,1,1,1,0,1,1,1,1,1,1,1,1,0,1,1,1,1,1,1,1,0,0,1,1,0,0,1,1,0,1,0,0,1,1,0,0,1,1,0,0,1,1,0,0,1,0,1,1,0,0,1,1,0,0,1,1,0,0,1,1,0,1,0,0,1,1,0,0,1,1,0,0,1,1,0,0,1,0,1,1,0,0,1,1,0,0,1,1,1,1,1,1,1,1,1,1,1,0,1,1,1,1,0,1,1,1,1,1,1,1,1,1,1,1,1,0,1,1,1,1,0,1,1,1,1,1,1,1,1,1,1,1,0,1,1,0,1,1,1,1,1,1,1,1,1,1,0,1,1,0,0,0,0,0,0,0,0,0,1,1,1,0,1,1,1,0,1,1,1,0,1,1,1,0,1,1,1,0,1,1,1,0,0,0,0,0,0,0,0,0,1,1,1,0,1,1,1,0,1,1,1,0,1,1,1,0,1,1,1,0,1,1,1,1,1,1,0,1,1,1,1,1,1,0,0,0, 1,1,1,1,0,0,0,0,0,1,1,0,0,0,0,0,0,0,1,1,0,0,0,0,0,1,1,1,1,0,0,0,1,1,1,1,1,1,0,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,1,0,0,0,0,1,1,1,0,1,1,0,0,1,1,1,0,0,0,0,0,1,1,1,0,0,0,0,1,0,0,0,1,0,0,0,0,1,1,0,0,1,1,1,0,0,0,0,0,1,1,1,0,0,0,0,0,1,1,1,0,0,0,0,0,0,0,0,1,0,0,1,1,0,0,1,0,0,0,0,0,0,0,0,0,1,1,0,0,1,1,0,0,0,0,0,0,0,0,0,1,0,0,1,1,0,0,1,0,0,0,0,0,0,0,0,0,1,1,0,0,1,1,0,1,1,0,0,1,1,0,0,1,0,0,1,1,0,0,1,0,0,1,1,0,0,1,1,0,1,1,0,0,1,1,0,1,1,0,0,1,1,0,0,1,0,0,1,1,0,0,1,0,0,1,1,0,0,1,1,0,1,1,0,0,1,1,0,0,1,1,1,0,1,1,1, 0,1,1,1,0,1,1,1,0,1,1,1,0,1,1,1,0,1,1,1,0,1,1,1,0,1,1,1,0,1,1,1,0,1,1,1,0,1,1,1,0,1,1,1,0,1,1,1,0,1,1,1,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,1,1,1,1,1,0,1,1,0,1,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,1,1,1,1,1,0,1,1,0,1,0,0,0,1,1,1,1,1,1,0,0,1,1,1,1,1,0,0,0,0,1,1,1,1,1,1,0,0,0,1,1,1,1,1,1,0,0,0,1,1,1,1,1,1,0,0,0,1,1,1,1,1,1,0,0,0,1,1,1,1,1,1,0,0,0,0,1,1,1,1,1,0,0,0,1,1,1,1,1,0,0,1,1,1,1,1,0,0,0,1,1,1,1,0,0,0,1,1,1,1,0,0,0,1,1,1,1,0,0,0,1,1,1,1,0,0,0,1,1,1,1,0,0,0,1,1,1,1,1,0,0,1,1,1,1,1,0,0,1,1, 1,0,1,1,1,1,0,1,0,1,0,1,1,1,1,0,1,1,1,0,1,1,0,1,1,1,0,1,1,0,1,1,1,0,1,1,1,1,1,1,0,1,0,1,1,1,1,0,1,1,1,0,1,1,0,1,0,1,1,1,0,0,1,1,1,1,1,1,0,1,0,1,1,1,1,0,1,1,1,0,1,1,0,1,1,1,1,1,0,0,1,1,1,0,1,1,1,1,1,1,0,1,0,1,1,1,1,0,1,1,1,0,1,1,0,1,1,1,1,1,0,0,1,1,1];var HATCH_TX_SIZE=8;var global_hatch_offsets={};global_hatch_offsets["cross"]=0;global_hatch_offsets["dashDnDiag"]=1;global_hatch_offsets["dashHorz"]=2;global_hatch_offsets["dashUpDiag"]=3;global_hatch_offsets["dashVert"]=4;global_hatch_offsets["diagBrick"]= 5;global_hatch_offsets["diagCross"]=6;global_hatch_offsets["divot"]=7;global_hatch_offsets["dkDnDiag"]=8;global_hatch_offsets["dkHorz"]=9;global_hatch_offsets["dkUpDiag"]=10;global_hatch_offsets["dkVert"]=11;global_hatch_offsets["dnDiag"]=12;global_hatch_offsets["dotDmnd"]=13;global_hatch_offsets["dotGrid"]=14;global_hatch_offsets["horz"]=15;global_hatch_offsets["horzBrick"]=16;global_hatch_offsets["lgCheck"]=17;global_hatch_offsets["lgConfetti"]=18;global_hatch_offsets["lgGrid"]=19;global_hatch_offsets["ltDnDiag"]= 20;global_hatch_offsets["ltHorz"]=21;global_hatch_offsets["ltUpDiag"]=22;global_hatch_offsets["ltVert"]=23;global_hatch_offsets["narHorz"]=24;global_hatch_offsets["narVert"]=25;global_hatch_offsets["openDmnd"]=26;global_hatch_offsets["pct10"]=27;global_hatch_offsets["pct20"]=28;global_hatch_offsets["pct25"]=29;global_hatch_offsets["pct30"]=30;global_hatch_offsets["pct40"]=31;global_hatch_offsets["pct5"]=32;global_hatch_offsets["pct50"]=33;global_hatch_offsets["pct60"]=34;global_hatch_offsets["pct70"]= 35;global_hatch_offsets["pct75"]=36;global_hatch_offsets["pct80"]=37;global_hatch_offsets["pct90"]=38;global_hatch_offsets["plaid"]=39;global_hatch_offsets["shingle"]=40;global_hatch_offsets["smCheck"]=41;global_hatch_offsets["smConfetti"]=42;global_hatch_offsets["smGrid"]=43;global_hatch_offsets["solidDmnd"]=44;global_hatch_offsets["sphere"]=45;global_hatch_offsets["trellis"]=46;global_hatch_offsets["upDiag"]=47;global_hatch_offsets["vert"]=48;global_hatch_offsets["wave"]=49;global_hatch_offsets["wdDnDiag"]= 50;global_hatch_offsets["wdUpDiag"]=51;global_hatch_offsets["weave"]=52;global_hatch_offsets["zigZag"]=53;var global_hatch_names=["cross","dashDnDiag","dashHorz","dashUpDiag","dashVert","diagBrick","diagCross","divot","dkDnDiag","dkHorz","dkUpDiag","dkVert","dnDiag","dotDmnd","dotGrid","horz","horzBrick","lgCheck","lgConfetti","lgGrid","ltDnDiag","ltHorz","ltUpDiag","ltVert","narHorz","narVert","openDmnd","pct10","pct20","pct25","pct30","pct40","pct5","pct50","pct60","pct70","pct75","pct80","pct90", "plaid","shingle","smCheck","smConfetti","smGrid","solidDmnd","sphere","trellis","upDiag","vert","wave","wdDnDiag","wdUpDiag","weave","zigZag"];var global_hatch_offsets_count=54;var global_hatch_brushes={};function CHatchBrush(){this.Name="";this.Canvas=null;this.Ctx=null;this.Data=null;this.fgClr={R:-1,G:-1,B:-1,A:255};this.bgClr={R:-1,G:-1,B:-1,A:255}}CHatchBrush.prototype={Create:function(name){this.Name=name;if(undefined===global_hatch_offsets[name])this.Name="cross";if(!window["NATIVE_EDITOR_ENJINE"]){this.Canvas= document.createElement("canvas");this.Canvas.width=HATCH_TX_SIZE;this.Canvas.height=HATCH_TX_SIZE;this.Ctx=this.Canvas.getContext("2d");this.Data=this.Ctx.createImageData(HATCH_TX_SIZE,HATCH_TX_SIZE)}else this.Data=new Uint8Array(4*HATCH_TX_SIZE*HATCH_TX_SIZE)},CheckColors:function(r,g,b,a,br,bg,bb,ba){if(null==this.Data)return;if(this.fgClr.R==r&&this.fgClr.G==g&&this.fgClr.B==b&&this.fgClr.A==a&&this.bgClr.R==br&&this.bgClr.G==bg&&this.bgClr.B==bb&&this.bgClr.A==ba)return;this.fgClr.R=r;this.fgClr.G= g;this.fgClr.B=b;this.fgClr.A=a;this.bgClr.R=br;this.bgClr.G=bg;this.bgClr.B=bb;this.bgClr.A=ba;var _len=HATCH_TX_SIZE*HATCH_TX_SIZE;var _src_data_offset=global_hatch_offsets[this.Name]*_len;var _src_data=global_hatch_data;var _dst_data=this.Canvas?this.Data.data:this.Data;var _ind=0;for(var i=0;i<_len;i++)if(_src_data[_src_data_offset+i]==0){_dst_data[_ind++]=r;_dst_data[_ind++]=g;_dst_data[_ind++]=b;_dst_data[_ind++]=a}else{_dst_data[_ind++]=br;_dst_data[_ind++]=bg;_dst_data[_ind++]=bb;_dst_data[_ind++]= ba}if(this.Canvas)this.Ctx.putImageData(this.Data,0,0)},toDataURL:function(){if(this.Canvas)return this.Canvas.toDataURL("image/png");return"data:onlyoffice_hatch,"+AscCommon.Base64Encode(this.Data,4*HATCH_TX_SIZE*HATCH_TX_SIZE)}};function GetHatchBrush(name,r,g,b,a,br,bg,bb,ba){var _brush=global_hatch_brushes[name];if(_brush!==undefined){_brush.CheckColors(r,g,b,a,br,bg,bb,ba);return _brush}_brush=new CHatchBrush;_brush.Create(name);_brush.CheckColors(r,g,b,a,br,bg,bb,ba);global_hatch_brushes[name]= _brush;return _brush}window["AscCommon"]=window["AscCommon"]||{};window["AscCommon"].global_hatch_names=global_hatch_names;window["AscCommon"].global_hatch_offsets=global_hatch_offsets;window["AscCommon"].GetHatchBrush=GetHatchBrush})(window);"use strict";(function(window,undefined){var AscBrowser=window["AscCommon"].AscBrowser;var debug=false;var ArrowType={NONE:0,ARROW_TOP:1,ARROW_RIGHT:2,ARROW_BOTTOM:3,ARROW_LEFT:4};var AnimationType={NONE:0,SCROLL_HOVER:1,ARROW_HOVER:2,SCROLL_ACTIVE:3,ARROW_ACTIVE:4}; function GetClientWidth(elem){var _w=elem.clientWidth;if(0!=_w)return _w;var _string_w=""+elem.style.width;if(-1<_string_w.indexOf("%"))return 0;var _intVal=parseInt(_string_w);if(!isNaN(_intVal)&&0<_intVal)return _intVal;return 0}function GetClientHeight(elem){var _w=elem.clientHeight;if(0!=_w)return _w;var _string_w=""+elem.style.height;if(-1<_string_w.indexOf("%"))return 0;var _intVal=parseInt(_string_w);if(!isNaN(_intVal)&&0<_intVal)return _intVal;return 0}function CArrowDrawer(settings){this.Size= 16;this.SizeW=16;this.SizeH=16;this.SizeNaturalW=this.SizeW;this.SizeNaturalH=this.SizeH;this.IsRetina=false;this.ColorGradStart={R:_HEXTORGB_(settings.arrowColor).R,G:_HEXTORGB_(settings.arrowColor).G,B:_HEXTORGB_(settings.arrowColor).B};this.IsDrawBorderInNoneMode=false;this.IsDrawBorders=true;this.pxCount=settings.slimScroll?4:6;this.ImageLeft=null;this.ImageTop=null;this.ImageRight=null;this.ImageBottom=null;this.fadeInFadeOutDelay=settings.fadeInFadeOutDelay||30}CArrowDrawer.prototype.checkSettings= function(settings){this.ColorGradStart={R:_HEXTORGB_(settings.arrowColor).R,G:_HEXTORGB_(settings.arrowColor).G,B:_HEXTORGB_(settings.arrowColor).B}};CArrowDrawer.prototype.InitSize=function(sizeW,sizeH,is_retina){var dPR=AscBrowser.retinaPixelRatio;this.SizeW=Math.max(sizeW,1);this.SizeH=Math.max(sizeH,1);this.IsRetina=is_retina;this.SizeNaturalW=this.SizeW;this.SizeNaturalH=this.SizeH;if(null==this.ImageLeft||null==this.ImageTop||null==this.ImageRight||null==this.ImageBottom){this.ImageLeft=document.createElement("canvas"); this.ImageTop=document.createElement("canvas");this.ImageRight=document.createElement("canvas");this.ImageBottom=document.createElement("canvas")}var len=Math.floor(this.pxCount*dPR);if(this.SizeH>1,_data,px,_x=this.SizeW-len>>1,_y=this.SizeH-(this.SizeH-countPart>>1),r,g,b;var __x=_x,__y=_y,_len=len;r=this.ColorGradStart.R;g=this.ColorGradStart.G;b=this.ColorGradStart.B;this.ImageTop.width=this.SizeW;this.ImageTop.height=this.SizeH;this.ImageBottom.width= this.SizeW;this.ImageBottom.height=this.SizeH;this.ImageLeft.width=this.SizeW;this.ImageLeft.height=this.SizeH;this.ImageRight.width=this.SizeW;this.ImageRight.height=this.SizeH;var ctx=this.ImageTop.getContext("2d");var ctxBottom=this.ImageBottom.getContext("2d");var ctxLeft=this.ImageLeft.getContext("2d");var ctxRight=this.ImageRight.getContext("2d");_data=ctx.createImageData(this.SizeW,this.SizeH);px=_data.data;while(_len>0){var ind=4*(this.SizeW*__y+__x);for(var i=0;i<_len;i++){px[ind++]=r;px[ind++]= g;px[ind++]=b;px[ind++]=255}r=r>>0;g=g>>0;b=b>>0;__x+=1;__y-=1;_len-=2}var dy=dPR<=1?-1:0;ctx.putImageData(_data,0,dy);_data=ctxLeft.createImageData(this.SizeW,this.SizeH);px=_data.data;_len=len;__x=_x,__y=_y;while(_len>0){var ind=4*(this.SizeH*__x+__y);var xx=__x;for(var i=0;i<_len;i++){px[ind++]=r;px[ind++]=g;px[ind++]=b;px[ind++]=255;++xx;ind=4*(this.SizeH*xx+__y)}r=r>>0;g=g>>0;b=b>>0;__x+=1;__y-=1;_len-=2}var dx=dPR<=1?-1:0;var dy=this.SizeW%2===0?1:0;ctxLeft.putImageData(_data,dx,dy);dx=this.SizeW% 2===0?1:0;ctxBottom.translate(this.SizeW/2,this.SizeH/2);ctxBottom.rotate(Math.PI);ctxBottom.translate(-this.SizeW/2,-this.SizeH/2);ctxBottom.drawImage(this.ImageTop,dx,0,this.ImageBottom.width,this.ImageBottom.height);dy=this.SizeH%2===0?-1:0;ctxRight.translate(this.SizeW/2,this.SizeH/2);ctxRight.rotate(Math.PI);ctxRight.translate(-this.SizeW/2,-this.SizeH/2);ctxRight.drawImage(this.ImageLeft,0,dy,this.ImageRight.width,this.ImageRight.height)};function ScrollSettings(){this.showArrows=true;this.screenW= -1;this.screenH=-1;this.screenAddH=0;this.contentH=0;this.contentW=0;this.initialDelay=300;this.arrowRepeatFreq=50;this.trackClickRepeatFreq=70;this.scrollPagePercent=1/8;this.scrollerMinHeight=34;this.scrollerMaxHeight=99999;this.scrollerMinWidth=34;this.scrollerMaxWidth=99999;this.arrowDim=Math.round(13*AscBrowser.retinaPixelRatio);this.scrollerColor="#f1f1f1";this.scrollerHoverColor="#cfcfcf";this.scrollerActiveColor="#adadad";this.scrollBackgroundColor="#f4f4f4";this.scrollBackgroundColorHover= "#f4f4f4";this.scrollBackgroundColorActive="#f4f4f4";this.strokeStyleNone="#cfcfcf";this.strokeStyleOver="#cfcfcf";this.strokeStyleActive="#ADADAD";this.vscrollStep=10;this.hscrollStep=10;this.wheelScrollLines=1;this.arrowColor="#ADADAD";this.arrowHoverColor="#f1f1f1";this.arrowActiveColor="#f1f1f1";this.arrowBorderColor="#cfcfcf";this.arrowOverBorderColor="#cfcfcf";this.arrowOverBackgroundColor="#cfcfcf";this.arrowActiveBorderColor="#ADADAD";this.arrowActiveBackgroundColor="#ADADAD";this.fadeInFadeOutDelay= 20;this.targetColor="#cfcfcf";this.targetHoverColor="#f1f1f1";this.targetActiveColor="#f1f1f1";this.defaultColor=241;this.hoverColor=207;this.activeColor=173;this.arrowSizeW=Math.round(13*AscBrowser.retinaPixelRatio);this.arrowSizeH=Math.round(13*AscBrowser.retinaPixelRatio);this.cornerRadius=0;this.slimScroll=false;this.alwaysVisible=false;this.isVerticalScroll=true;this.isHorizontalScroll=false}function ScrollObject(elemID,settings,dbg){if(dbg)debug=dbg;this.that=this;this.settings=settings;this.ArrowDrawer= new CArrowDrawer(this.settings);this.mouseUp=false;this.mouseDown=false;this.that.mouseover=false;this.scrollerMouseDown=false;this.animState=AnimationType.NONE;this.lastAnimState=this.animState;this.arrowState=ArrowType.NONE;this.lastArrowState=this.arrowState;this.moveble=false;this.lock=false;this.scrollTimeout=null;this.StartMousePosition={x:0,y:0};this.EndMousePosition={x:0,y:0};this.dragMinY=0;this.dragMaxY=0;this.scrollVCurrentY=0;this.scrollHCurrentX=0;this.arrowPosition=0;this.verticalTrackHeight= 0;this.horizontalTrackWidth=0;this.paneHeight=0;this.paneWidth=0;this.maxScrollY=0;this.maxScrollX=0;this.maxScrollY2=0;this.maxScrollX2=0;this.scrollCoeff=0;this.isResizeArrows=false;this.scroller={x:0,y:1,h:0,w:0};this.canvas=null;this.context=null;this.eventListeners=[];this.IsRetina=false;this.canvasW=1;this.canvasH=1;this.canvasOriginalW=1;this.canvasOriginalH=1;this.scrollColor=_HEXTORGB_(this.settings.scrollerColor).R;this.arrowColor=_HEXTORGB_(this.settings.arrowColor).R;this.firstArrow={arrowColor:_HEXTORGB_(this.settings.arrowColor).R, arrowBackColor:_HEXTORGB_(this.settings.scrollerColor).R,arrowStrokeColor:_HEXTORGB_(this.settings.strokeStyleNone).R};this.secondArrow={arrowColor:_HEXTORGB_(this.settings.arrowColor).R,arrowBackColor:_HEXTORGB_(this.settings.scrollerColor).R,arrowStrokeColor:_HEXTORGB_(this.settings.strokeStyleNone).R};this.targetColor=_HEXTORGB_(this.settings.targetColor).R;this.strokeColor=_HEXTORGB_(this.settings.strokeStyleNone).R;this.fadeTimeoutScroll=null;this.fadeTimeoutArrows=null;this.IsRetina=AscBrowser.isRetina; this.disableCurrentScroll=false;this._initPiperImg();this._init(elemID)}ScrollObject.prototype._initPiperImg=function(){var dPR=AscBrowser.retinaPixelRatio;this.piperImgVert=document.createElement("canvas");this.piperImgHor=document.createElement("canvas");this.piperImgVert.height=Math.round(13*dPR);this.piperImgVert.width=Math.round(5*dPR);this.piperImgHor.width=Math.round(13*dPR);this.piperImgHor.height=Math.round(5*dPR);if(this.settings.slimScroll)this.piperImgVert.width=this.piperImgHor.height= Math.round(3*dPR);var ctx_piperImg;ctx_piperImg=this.piperImgVert.getContext("2d");ctx_piperImg.beginPath();ctx_piperImg.lineWidth=Math.floor(dPR);var count=0;var _dPR=dPR<.5?Math.ceil(dPR):Math.round(dPR);for(var i=0;i6&&dPR>=1)break}ctx_piperImg=this.piperImgHor.getContext("2d");ctx_piperImg.beginPath(); ctx_piperImg.lineWidth=Math.floor(dPR);var count=0;for(var i=0;i6&&dPR>=1)break}};ScrollObject.prototype._init=function(elemID){if(!elemID)return false;var dPR=AscBrowser.retinaPixelRatio;var holder=document.getElementById(elemID);if(holder.getElementsByTagName("canvas").length==0)this.canvas= holder.appendChild(document.createElement("CANVAS"));else this.canvas=holder.children[1];this.canvas.style.width="100%";this.canvas.style.height="100%";this.canvas.that=this;this.canvas.style.zIndex=100;this.canvas.style.position="absolute";this.canvas.style.top="0px";this.canvas.style["msTouchAction"]="none";if(navigator.userAgent.toLowerCase().indexOf("webkit")!=-1)this.canvas.style.webkitUserSelect="none";this.context=this.canvas.getContext("2d");this._setDimension(holder.clientHeight,holder.clientWidth); this.maxScrollY=this.maxScrollY2=this.settings.contentH-this.settings.screenH>0?this.settings.contentH-this.settings.screenH:0;this.maxScrollX=this.maxScrollX2=this.settings.contentW-this.settings.screenW>0?this.settings.contentW-this.settings.screenW:0;if(this.settings.isVerticalScroll&&!this.settings.alwaysVisible)this.canvas.style.display=this.maxScrollY==0?"none":"";if(this.settings.isHorizontalScroll&&!this.settings.alwaysVisible)this.canvas.style.display=this.maxScrollX==0?"none":"";this._setScrollerHW(); this.settings.arrowDim=this.settings.slimScroll&&this.settings.isVerticalScroll?this.scroller.w:this.settings.arrowDim;this.settings.arrowDim=this.settings.slimScroll&&this.settings.isHorizontalScroll?this.scroller.h:this.settings.arrowDim;this.arrowPosition=this.settings.showArrows?Math.round(this.settings.arrowDim+this._roundForScale(dPR)+this._roundForScale(dPR)):Math.round(dPR);this.paneHeight=this.canvasH-this.arrowPosition*2;this.paneWidth=this.canvasW-this.arrowPosition*2;this.RecalcScroller(); AscCommon.addMouseEvent(this.canvas,"down",this.evt_mousedown);AscCommon.addMouseEvent(this.canvas,"move",this.evt_mousemove);AscCommon.addMouseEvent(this.canvas,"up",this.evt_mouseup);AscCommon.addMouseEvent(this.canvas,"over",this.evt_mouseover);AscCommon.addMouseEvent(this.canvas,"out",this.evt_mouseout);this.canvas.onmousewheel=this.evt_mousewheel;var _that=this;this.canvas.ontouchstart=function(e){_that.evt_mousedown(e.touches[0]);return false};this.canvas.ontouchmove=function(e){_that.evt_mousemove(e.touches[0]); return false};this.canvas.ontouchend=function(e){_that.evt_mouseup(e.changedTouches[0]);return false};if(this.canvas.addEventListener)this.canvas.addEventListener("DOMMouseScroll",this.evt_mousewheel,false);this.context.fillStyle=this.settings.scrollBackgroundColor;this.context.fillRect(0,0,this.canvasW,this.canvasH);this._drawArrows();this._draw();return true};ScrollObject.prototype.disableCurrentScroll=function(){this.disableCurrentScroll=true};ScrollObject.prototype.checkDisableCurrentScroll=function(){var ret= this.disableCurrentScroll;this.disableCurrentScroll=false;return ret};ScrollObject.prototype.getMousePosition=function(evt){var obj=this.canvas;var top=0;var left=0;while(obj&&obj.tagName!="BODY"){top+=obj.offsetTop;left+=obj.offsetLeft;obj=obj.offsetParent}var dPR=AscBrowser.retinaPixelRatio;var mouseX=((evt.clientX*AscBrowser.zoom>>0)-left+window.pageXOffset)*dPR;var mouseY=((evt.clientY*AscBrowser.zoom>>0)-top+window.pageYOffset)*dPR;return{x:mouseX,y:mouseY}};ScrollObject.prototype.RecalcScroller= function(startpos){var dPR=AscBrowser.retinaPixelRatio;if(this.settings.isVerticalScroll){if(this.settings.showArrows){this.verticalTrackHeight=this.canvasH-this.arrowPosition*2;this.scroller.y=this.arrowPosition}else{this.verticalTrackHeight=this.canvasH;this.scroller.y=Math.round(dPR)}var percentInViewV;percentInViewV=(this.maxScrollY*dPR+this.paneHeight)/this.paneHeight;this.scroller.h=Math.ceil(Math.ceil(1/percentInViewV*this.verticalTrackHeight/dPR)*dPR);var scrollMinH=Math.round(this.settings.scrollerMinHeight* dPR);if(this.scroller.hthis.settings.scrollerMaxHeight)this.scroller.h=this.settings.scrollerMaxHeight;this.scrollCoeff=this.maxScrollY/Math.max(1,this.paneHeight-this.scroller.h);if(startpos)this.scroller.y=startpos/this.scrollCoeff+this.arrowPosition;this.dragMaxY=this.canvasH-this.arrowPosition-this.scroller.h+1;this.dragMinY=this.arrowPosition}if(this.settings.isHorizontalScroll){if(this.settings.showArrows){this.horizontalTrackWidth= this.canvasW-this.arrowPosition*2;this.scroller.x=this.arrowPosition}else{this.horizontalTrackWidth=this.canvasW;this.scroller.x=Math.round(dPR)}var percentInViewH;percentInViewH=(this.maxScrollX*dPR+this.paneWidth)/this.paneWidth;this.scroller.w=Math.ceil(Math.ceil(1/percentInViewH*this.horizontalTrackWidth/dPR)*dPR);var scrollMinW=Math.round(this.settings.scrollerMinWidth*dPR);if(this.scroller.wthis.settings.scrollerMaxWidth)this.scroller.w= this.settings.scrollerMaxWidth;this.scrollCoeff=this.maxScrollX/Math.max(1,this.paneWidth-this.scroller.w);if(typeof startpos!=="undefined")this.scroller.x=startpos/this.scrollCoeff+this.arrowPosition;this.dragMaxX=this.canvasW-this.arrowPosition-this.scroller.w;this.dragMinX=this.arrowPosition}};ScrollObject.prototype.Repos=function(settings,bIsHorAttack,bIsVerAttack,pos){var dPR=AscBrowser.retinaPixelRatio;var isChangeTheme=settings&&this.settings.scrollBackgroundColor!==settings.scrollBackgroundColor; if(isChangeTheme)for(var i in settings)this.settings[i]=settings[i];if(this.settings.showArrows){this.settings.arrowSizeW=Math.round(13*dPR);this.settings.arrowSizeH=Math.round(13*dPR);this.ArrowDrawer.InitSize(this.settings.arrowSizeH,this.settings.arrowSizeW,this.IsRetina)}if(bIsVerAttack){var _canvasH=settings.screenH;if(undefined!==_canvasH&&settings.screenAddH)_canvasH+=settings.screenAddH;if(_canvasH==this.canvasH&&undefined!==settings.contentH){var _maxScrollY=settings.contentH-settings.screenH> 0?settings.contentH-settings.screenH:0;if(_maxScrollY==this.maxScrollY&&!isChangeTheme)return}}if(bIsHorAttack)if(settings.screenW==this.canvasW&&undefined!==settings.contentW){var _maxScrollX=settings.contentW-settings.screenW>0?settings.contentW-settings.screenW:0;if(_maxScrollX==this.maxScrollX&&!isChangeTheme)return}var dPR=AscBrowser.retinaPixelRatio;var _parentClientW=GetClientWidth(this.canvas.parentNode);var _parentClientH=GetClientHeight(this.canvas.parentNode);var _firstChildW=settings.contentW; var _firstChildH=settings.contentH;this.maxScrollY=this.maxScrollY2=_firstChildH-settings.screenH>0?_firstChildH-settings.screenH:0;this.maxScrollX=this.maxScrollX2=_firstChildW-settings.screenW>0?_firstChildW-settings.screenW:0;this._setDimension(_parentClientH,_parentClientW);this._setScrollerHW();this.settings.arrowDim=Math.round(13*dPR);this.settings.arrowDim=this.settings.slimScroll&&this.settings.isVerticalScroll?this.scroller.w:this.settings.arrowDim;this.settings.arrowDim=this.settings.slimScroll&& this.settings.isHorizontalScroll?this.scroller.h:this.settings.arrowDim;this.arrowPosition=this.settings.showArrows?Math.round(this.settings.arrowDim+this._roundForScale(dPR)+this._roundForScale(dPR)):Math.round(dPR);this.paneHeight=this.canvasH-this.arrowPosition*2;this.paneWidth=this.canvasW-this.arrowPosition*2;this.RecalcScroller();if(this.settings.isVerticalScroll&&!this.settings.alwaysVisible){if(this.scrollVCurrentY>this.maxScrollY)this.scrollVCurrentY=this.maxScrollY;this.scrollToY(this.scrollVCurrentY); if(this.maxScrollY==0)this.canvas.style.display="none";else this.canvas.style.display=""}else if(this.settings.isHorizontalScroll){if(this.scrollHCurrentX>this.maxScrollX)this.scrollHCurrentX=this.maxScrollX;this.scrollToX(this.scrollHCurrentX);if(this.maxScrollX==0&&!this.settings.alwaysVisible)this.canvas.style.display="none";else this.canvas.style.display=""}this.reinit=true;if(this.settings.isVerticalScroll&&pos)pos!==undefined?this.scrollByY(pos-this.scrollVCurrentY):this.scrollToY(this.scrollVCurrentY); if(this.settings.isHorizontalScroll&&pos)pos!==undefined?this.scrollByX(pos-this.scrollHCurrentX):this.scrollToX(this.scrollHCurrentX);this.reinit=false;if(this.isResizeArrows||isChangeTheme){this.context.fillStyle=this.settings.scrollBackgroundColor;this.context.fillRect(0,0,this.canvasW,this.canvasH);this.firstArrow={arrowColor:_HEXTORGB_(this.settings.arrowColor).R,arrowBackColor:_HEXTORGB_(this.settings.scrollerColor).R,arrowStrokeColor:_HEXTORGB_(this.settings.strokeStyleNone).R};this.secondArrow= {arrowColor:_HEXTORGB_(this.settings.arrowColor).R,arrowBackColor:_HEXTORGB_(this.settings.scrollerColor).R,arrowStrokeColor:_HEXTORGB_(this.settings.strokeStyleNone).R};this._drawArrows()}this._initPiperImg();this._draw()};ScrollObject.prototype._scrollV=function(that,evt,pos,isTop,isBottom,bIsAttack){if(!this.settings.isVerticalScroll)return;if(that.scrollVCurrentY!==pos||bIsAttack===true){var oldPos=that.scrollVCurrentY;that.scrollVCurrentY=pos;evt.scrollD=evt.scrollPositionY=that.scrollVCurrentY; evt.maxScrollY=that.maxScrollY;that.handleEvents("onscrollvertical",evt);if(that.checkDisableCurrentScroll()){that.scrollVCurrentY=oldPos;return}that._draw()}else if(that.scrollVCurrentY===pos&&pos>0&&!this.reinit&&!this.moveble&&!this.lock){evt.pos=pos;that.handleEvents("onscrollVEnd",evt)}};ScrollObject.prototype._correctScrollV=function(that,yPos){if(!this.settings.isVerticalScroll)return null;var events=that.eventListeners["oncorrectVerticalScroll"];if(events){if(events.length!=1)return null; return events[0].handler.apply(that,[yPos])}return null};ScrollObject.prototype._correctScrollByYDelta=function(that,delta){if(!this.settings.isVerticalScroll)return null;var events=that.eventListeners["oncorrectVerticalScrollDelta"];if(events){if(events.length!=1)return null;return events[0].handler.apply(that,[delta])}return null};ScrollObject.prototype._scrollH=function(that,evt,pos,isTop,isBottom){if(!this.settings.isHorizontalScroll)return;if(that.scrollHCurrentX!==pos){that.scrollHCurrentX= pos;evt.scrollD=evt.scrollPositionX=that.scrollHCurrentX;evt.maxScrollX=that.maxScrollX;that._draw();that.handleEvents("onscrollhorizontal",evt)}else if(that.scrollHCurrentX===pos&&pos>0&&!this.reinit&&!this.moveble&&!this.lock){evt.pos=pos;that.handleEvents("onscrollHEnd",evt)}};ScrollObject.prototype.scrollByY=function(delta,isAttack){if(!this.settings.isVerticalScroll)return;var dPR=AscBrowser.retinaPixelRatio;var result=this._correctScrollByYDelta(this,delta);if(result!=null&&result.isChange=== true)delta=result.Pos;var destY=this.scrollVCurrentY+delta,isTop=false,isBottom=false,vend=false;if(this.scrollVCurrentY+delta<0){destY=0;isTop=true;isBottom=false}else if(this.scrollVCurrentY+delta>this.maxScrollY2){this.handleEvents("onscrollVEnd",destY-this.maxScrollY);vend=true;destY=this.maxScrollY2;isTop=false;isBottom=true}var scrollCoeff=this.scrollCoeff===0?1:this.scrollCoeff;this.scroller.y=destY/scrollCoeff+this.arrowPosition;if(this.scroller.ythis.dragMaxY)this.scroller.y=this.dragMaxY;var arrow=this.settings.showArrows?this.arrowPosition:0;if(this.scroller.y+this.scroller.h>this.canvasH-arrow)this.scroller.y-=Math.abs(this.canvasH-arrow-this.scroller.y-this.scroller.h);this.scroller.y=Math.round(this.scroller.y);if(vend)this.moveble=true;this._scrollV(this,{},destY,isTop,isBottom,isAttack);if(vend)this.moveble=false};ScrollObject.prototype.scrollToY=function(destY){if(!this.settings.isVerticalScroll)return;this.scroller.y= destY/Math.max(1,this.scrollCoeff)+this.arrowPosition;if(this.scroller.ythis.dragMaxY)this.scroller.y=this.dragMaxY;var arrow=this.settings.showArrows?this.arrowPosition:0;if(this.scroller.y+this.scroller.h>this.canvasH-arrow)this.scroller.y-=Math.abs(this.canvasH-arrow-this.scroller.y-this.scroller.h);this.scroller.y=Math.round(this.scroller.y);this._scrollV(this,{},destY,false,false)};ScrollObject.prototype.scrollByX=function(delta){if(!this.settings.isHorizontalScroll)return; var dPR=AscBrowser.retinaPixelRatio;var destX=this.scrollHCurrentX+delta,isTop=false,isBottom=false,hend=false;if(destX<0){destX=0;isTop=true;isBottom=false}else if(destX>this.maxScrollX2){this.handleEvents("onscrollHEnd",destX-this.maxScrollX);hend=true;destX=this.maxScrollX2;isTop=false;isBottom=true}var scrollCoeff=this.scrollCoeff===0?1:this.scrollCoeff;this.scroller.x=destX/scrollCoeff+this.arrowPosition;if(this.scroller.x this.dragMaxX)this.scroller.x=this.dragMaxX;var arrow=this.settings.showArrows?this.arrowPosition:0;if(this.scroller.x+this.scroller.w>this.canvasW-arrow)this.scroller.x-=Math.abs(this.canvasW-arrow-this.scroller.x-this.scroller.w);this.scroller.x=Math.round(this.scroller.x);if(hend)this.moveble=true;this._scrollH(this,{},destX,isTop,isBottom);if(hend)this.moveble=true};ScrollObject.prototype.scrollToX=function(destX){if(!this.settings.isHorizontalScroll)return;this.scroller.x=destX/Math.max(1,this.scrollCoeff)+ this.arrowPosition;if(this.scroller.xthis.dragMaxX)this.scroller.x=this.dragMaxX;var arrow=this.settings.showArrows?this.arrowPosition:0;if(this.scroller.x+this.scroller.w>this.canvasW-arrow)this.scroller.x-=Math.abs(this.canvasW-arrow-this.scroller.x-this.scroller.w);this.scroller.x=Math.round(this.scroller.x);this._scrollH(this,{},destX,false,false)};ScrollObject.prototype.scrollTo=function(destX,destY){this.scrollToX(destX); this.scrollToY(destY)};ScrollObject.prototype.scrollBy=function(deltaX,deltaY){this.scrollByX(deltaX);this.scrollByY(deltaY)};ScrollObject.prototype.roundRect=function(x,y,width,height,radius){if(typeof radius==="undefined")radius=1;this.context.beginPath();this.context.moveTo(x+radius,y);this.context.lineTo(x+width-radius,y);this.context.quadraticCurveTo(x+width,y,x+width,y+radius);this.context.lineTo(x+width,y+height-radius);this.context.quadraticCurveTo(x+width,y+height,x+width-radius,y+height); this.context.lineTo(x+radius,y+height);this.context.quadraticCurveTo(x,y+height,x,y+height-radius);this.context.lineTo(x,y+radius);this.context.quadraticCurveTo(x,y,x+radius,y);this.context.closePath()};ScrollObject.prototype._clearContent=function(){this.context.clearRect(0,0,this.canvasW,this.canvasH)};ScrollObject.prototype._drawArrows=function(){var that=this;if(!that.settings.showArrows)return;var t=that.ArrowDrawer;var xDeltaBORDER=.5,yDeltaBORDER=1.5;var roundDPR=that._roundForScale(AscBrowser.retinaPixelRatio); var x1=0,y1=0,x2=0,y2=0;var ctx=that.context;ctx.beginPath();ctx.fillStyle=that.settings.scrollerColor;var arrowImage=that.ArrowDrawer.ImageTop;var imgContext=arrowImage.getContext("2d");imgContext.globalCompositeOperation="source-in";imgContext.fillStyle=that.settings.arrowColor;ctx.lineWidth=roundDPR;if(that.settings.isVerticalScroll)for(var i=0;i<2;i++){imgContext.fillRect(x1+xDeltaBORDER*ctx.lineWidth,0,t.SizeW-roundDPR,t.SizeH-roundDPR);ctx.fillRect(x1,y1+roundDPR,t.SizeW,t.SizeH);ctx.drawImage(arrowImage, x1,y2,t.SizeW,t.SizeH);if(t.IsDrawBorders){ctx.strokeStyle=that.settings.strokeStyleNone;ctx.rect(x1+xDeltaBORDER*ctx.lineWidth,y1+yDeltaBORDER*ctx.lineWidth,t.SizeW-roundDPR,t.SizeH-roundDPR);ctx.stroke()}y1=that.canvasH-t.SizeH-2*roundDPR;y2=that.canvasH-t.SizeH;arrowImage=that.ArrowDrawer.ImageBottom;imgContext=arrowImage.getContext("2d");imgContext.globalCompositeOperation="source-in";imgContext.fillStyle=that.settings.arrowColor}var arrowImage=that.ArrowDrawer.ImageLeft;var imgContext=arrowImage.getContext("2d"); imgContext.globalCompositeOperation="source-in";imgContext.fillStyle=that.settings.arrowColor;if(that.settings.isHorizontalScroll)for(var i=0;i<2;i++){imgContext.fillRect(0,y1+yDeltaBORDER*ctx.lineWidth,t.SizeW-roundDPR,t.SizeH-roundDPR);ctx.fillRect(x1+roundDPR,y1,t.SizeW,t.SizeH);ctx.drawImage(arrowImage,x2,y2,t.SizeW,t.SizeH);if(t.IsDrawBorders){ctx.strokeStyle=that.settings.strokeStyleNone;ctx.lineWidth=roundDPR;ctx.rect(x1+yDeltaBORDER*ctx.lineWidth,y1+xDeltaBORDER*ctx.lineWidth,t.SizeW-roundDPR, t.SizeH-roundDPR);ctx.stroke()}x1=that.canvasW-t.SizeW-2*roundDPR;x2=that.canvasW-t.SizeW;y2=0;arrowImage=that.ArrowDrawer.ImageRight;imgContext=arrowImage.getContext("2d");imgContext.globalCompositeOperation="source-in";imgContext.fillStyle=that.settings.arrowColor}};ScrollObject.prototype._drawScroll=function(fillColor,targetColor,strokeColor){fillColor=Math.round(fillColor);targetColor=Math.round(targetColor);strokeColor=Math.round(strokeColor);var that=this;that.context.beginPath();var roundDPR= this._roundForScale(AscBrowser.retinaPixelRatio);that.context.lineWidth=roundDPR;if(that.settings.isVerticalScroll){var _y=that.settings.showArrows?that.arrowPosition:0,_h=that.canvasH-(_y<<1);if(_h>0)that.context.rect(0,_y,that.canvasW,_h)}else if(that.settings.isHorizontalScroll){var _x=that.settings.showArrows?that.arrowPosition:0,_w=that.canvasW-(_x<<1);if(_w>0)that.context.rect(_x,0,_w,that.canvasH)}switch(that.animState){case AnimationType.SCROLL_HOVER:{that.context.fillStyle=that.settings.scrollBackgroundColorHover; break}case AnimationType.SCROLL_ACTIVE:{that.context.fillStyle=that.settings.scrollBackgroundColorActive;break}case AnimationType.NONE:default:{that.context.fillStyle=that.settings.scrollBackgroundColor;break}}that.context.fill();that.context.beginPath();if(that.settings.isVerticalScroll&&that.maxScrollY!=0){var _y=that.scroller.y>>0,arrow=that.settings.showArrows?that.arrowPosition:0;if(_ythat.canvasH-arrow-1)_b=that.canvasH- arrow-1;if(_b>_y)that.roundRect(that.scroller.x-.5*that.context.lineWidth,_y+.5*that.context.lineWidth,that.scroller.w-roundDPR,that.scroller.h-roundDPR,that.settings.cornerRadius*roundDPR)}else if(that.settings.isHorizontalScroll&&that.maxScrollX!=0){var _x=that.scroller.x>>0,arrow=that.settings.showArrows?that.arrowPosition:0;if(_x>0;if(_r>that.canvasW-arrow-2)_r=that.canvasW-arrow-1;if(_r>_x)that.roundRect(_x+.5*that.context.lineWidth,that.scroller.y- .5*that.context.lineWidth,that.scroller.w-roundDPR,that.scroller.h-roundDPR,that.settings.cornerRadius*roundDPR)}that.context.fillStyle="rgb("+fillColor+","+fillColor+","+fillColor+")";that.context.fill();that.context.strokeStyle="rgb("+strokeColor+","+strokeColor+","+strokeColor+")";that.strokeColor=strokeColor;that.context.stroke();var ctx_piperImg,_data,px,img,x,y;if(that._checkPiperImagesV()){x=Math.round((that.scroller.w-that.piperImgVert.width)/2);y=Math.floor(that.scroller.y+Math.floor(that.scroller.h/ 2)-6*AscBrowser.retinaPixelRatio);ctx_piperImg=that.piperImgVert.getContext("2d");ctx_piperImg.globalCompositeOperation="source-in";ctx_piperImg.fillStyle="rgb("+targetColor+","+targetColor+","+targetColor+")";ctx_piperImg.fillRect(0,0,that.scroller.w-1,that.scroller.h-1);img=that.piperImgVert}else if(that._checkPiperImagesH()){x=Math.round(that.scroller.x+(that.scroller.w-that.piperImgHor.width)/2);y=Math.round((that.scroller.h-that.piperImgHor.height)/2);ctx_piperImg=that.piperImgHor.getContext("2d"); ctx_piperImg.globalCompositeOperation="source-in";ctx_piperImg.fillStyle="rgb("+targetColor+","+targetColor+","+targetColor+")";ctx_piperImg.fillRect(0,0,that.scroller.w-1,that.scroller.h-1);img=that.piperImgHor}if(img)that.context.drawImage(img,x,y);that.scrollColor=fillColor;that.targetColor=targetColor};ScrollObject.prototype._animateArrow=function(fadeIn,curArrowType,backgroundColorUnfade){var that=this;var roundDPR=that._roundForScale(AscBrowser.retinaPixelRatio);var sizeW=that.ArrowDrawer.SizeW, sizeH=that.ArrowDrawer.SizeH;if(!that.settings.showArrows||!curArrowType)return;var cnvs=document.createElement("canvas"),arrowType,ctx=cnvs.getContext("2d"),context=that.context,hoverColor=_HEXTORGB_(that.settings.scrollerHoverColor).R,defaultColor=_HEXTORGB_(that.settings.scrollerColor).R,arrowColor=_HEXTORGB_(that.settings.arrowColor).R,arrowHoverColor=_HEXTORGB_(that.settings.arrowHoverColor).R,strokeColor=_HEXTORGB_(that.settings.strokeStyleNone).R,strokeHoverColor=_HEXTORGB_(that.settings.strokeStyleOver).R; cnvs.width=sizeW;cnvs.height=sizeH;if(curArrowType===ArrowType.ARROW_TOP||curArrowType===ArrowType.ARROW_LEFT)arrowType=this.firstArrow;else if(curArrowType===ArrowType.ARROW_BOTTOM||curArrowType===ArrowType.ARROW_RIGHT)arrowType=this.secondArrow;else return;var x=0,y=0,fillRectX=0,fillRectY=0,strokeRectX=0,strokeRectY=0;var arrowImage=that.settings.isVerticalScroll?that.ArrowDrawer.ImageTop:that.ArrowDrawer.ImageLeft;switch(curArrowType){case ArrowType.ARROW_TOP:{fillRectY=roundDPR;break}case ArrowType.ARROW_BOTTOM:{y= that.canvasH-sizeH;fillRectY=-roundDPR;strokeRectY=-2*roundDPR;arrowImage=that.ArrowDrawer.ImageBottom;break}case ArrowType.ARROW_RIGHT:{y=0;x=that.canvasW-sizeW;fillRectX=-roundDPR;strokeRectX=-roundDPR;strokeRectY=-roundDPR;arrowImage=that.ArrowDrawer.ImageRight;break}case ArrowType.ARROW_LEFT:{y=0;x=0;fillRectX=roundDPR;strokeRectX=roundDPR;strokeRectY=-roundDPR;break}}var stepsCount=17;var step=Math.abs(defaultColor-hoverColor)/stepsCount;if(fadeIn){if(arrowType.arrowColor===arrowHoverColor&& arrowType.arrowBackColor===hoverColor)return;if(arrowType.arrowBackColor-hoverColor>step)arrowType.arrowBackColor-=step;else if(arrowType.arrowBackColor-hoverColor<-step)arrowType.arrowBackColor+=step;else arrowType.arrowBackColor=hoverColor;step=Math.abs(strokeColor-strokeHoverColor)/stepsCount;if(arrowType.arrowStrokeColor-strokeHoverColor>step)arrowType.arrowStrokeColor-=step;else if(arrowType.arrowStrokeColor-strokeHoverColor<-step)arrowType.arrowStrokeColor+=step;else arrowType.arrowStrokeColor= strokeHoverColor;step=Math.abs(arrowColor-arrowHoverColor)/stepsCount;if(arrowType.arrowColor-arrowHoverColor>step)arrowType.arrowColor-=step;else if(arrowType.arrowColor-arrowHoverColor<-step)arrowType.arrowColor+=step;else arrowType.arrowColor=arrowHoverColor}else if(fadeIn===false){if(arrowType.arrowColor===arrowColor&&arrowType.arrowBackColor===defaultColor)return;if(arrowType.arrowBackColor-defaultColor<-step)arrowType.arrowBackColor+=step;else if(arrowType.arrowBackColor-defaultColor>step)arrowType.arrowBackColor-= step;else arrowType.arrowBackColor=defaultColor;step=Math.abs(arrowColor-arrowHoverColor)/stepsCount;if(arrowType.arrowColor-arrowColor>step)arrowType.arrowColor-=step;else if(arrowType.arrowColor-arrowColor<-step)arrowType.arrowColor+=step;else arrowType.arrowColor=arrowColor;step=Math.abs(strokeColor-strokeHoverColor)/stepsCount;if(arrowType.arrowStrokeColor-strokeColor>step)arrowType.arrowStrokeColor-=step;else if(arrowType.arrowStrokeColor-strokeColor<-step)arrowType.arrowStrokeColor+=step;else arrowType.arrowStrokeColor= strokeColor}else{arrowType.arrowBackColor=backgroundColorUnfade;switch(backgroundColorUnfade){case _HEXTORGB_(that.settings.scrollerColor).R:arrowType.arrowColor=_HEXTORGB_(that.settings.arrowColor).R;arrowType.arrowStrokeColor=_HEXTORGB_(that.settings.strokeStyleNone).R;break;case _HEXTORGB_(that.settings.scrollerHoverColor).R:arrowType.arrowColor=_HEXTORGB_(that.settings.arrowHoverColor).R;arrowType.arrowStrokeColor=_HEXTORGB_(that.settings.strokeStyleOver).R;break;case _HEXTORGB_(that.settings.scrollerActiveColor).R:arrowType.arrowColor= _HEXTORGB_(that.settings.arrowActiveColor).R;arrowType.arrowStrokeColor=_HEXTORGB_(that.settings.strokeStyleActive).R;break}}ctx=that.context;ctx.beginPath();var arrowBackColor=Math.round(arrowType.arrowBackColor);ctx.fillStyle="rgb("+arrowBackColor+","+arrowBackColor+","+arrowBackColor+")";ctx.fillRect(x+fillRectX,y+fillRectY,sizeW,sizeH);if(that.ArrowDrawer.IsDrawBorders){var arrowStrokeColor=Math.round(arrowType.arrowStrokeColor);ctx.strokeStyle="rgb("+arrowStrokeColor+","+arrowStrokeColor+","+ arrowStrokeColor+")";ctx.lineWidth=roundDPR;ctx.rect(x+.5*ctx.lineWidth+strokeRectX,y+1.5*ctx.lineWidth+strokeRectY,sizeW-roundDPR,sizeH-roundDPR);ctx.stroke()}var imgContext=arrowImage.getContext("2d");imgContext.globalCompositeOperation="source-in";var arrowColor=Math.round(arrowType.arrowColor);imgContext.fillStyle="rgb("+arrowColor+","+arrowColor+","+arrowColor+")";imgContext.fillRect(.5,1.5,sizeW,sizeH);ctx.drawImage(arrowImage,x,y,sizeW,sizeH);ctx.closePath();context.drawImage(cnvs,x,y);if(fadeIn=== undefined)return;that.fadeTimeoutArrows=setTimeout(function(){that._animateArrow(fadeIn,curArrowType,backgroundColorUnfade)},that.settings.fadeInFadeOutDelay)};ScrollObject.prototype._animateScroll=function(fadeIn){var that=this;var hoverColor=_HEXTORGB_(that.settings.scrollerHoverColor).R,defaultColor=_HEXTORGB_(that.settings.scrollerColor).R,targetDefaultColor=_HEXTORGB_(that.settings.targetColor).R,targetHoverColor=_HEXTORGB_(that.settings.targetHoverColor).R,strokeHoverColor=_HEXTORGB_(that.settings.strokeStyleOver).R, strokeColor=_HEXTORGB_(that.settings.strokeStyleNone).R;that.context.beginPath();that._drawScroll(that.scrollColor,that.targetColor,that.strokeColor);if(fadeIn&&that.scrollColor===hoverColor&&that.targetColor===targetHoverColor||!fadeIn&&that.scrollColor===defaultColor&&that.targetColor===targetDefaultColor)return;var stepsCount=17;var step=Math.abs(defaultColor-hoverColor)/stepsCount;if(fadeIn){if(that.scrollColor-hoverColor>step)that.scrollColor-=step;else if(that.scrollColor-hoverColor<-step)that.scrollColor+= step;else that.scrollColor=hoverColor;step=Math.abs(targetDefaultColor-targetHoverColor)/stepsCount;if(that.targetColor-targetHoverColor>step)that.targetColor-=step;else if(that.targetColor-targetHoverColor<-step)that.targetColor+=step;else that.targetColor=targetHoverColor;step=Math.abs(strokeColor-strokeHoverColor)/stepsCount;if(that.strokeColor-strokeHoverColor>step)that.strokeColor-=step;else if(that.strokeColor-strokeHoverColor<-step)that.strokeColor+=step;else that.strokeColor=strokeHoverColor}else if(fadeIn=== false){if(that.scrollColor-defaultColor>step)that.scrollColor-=step;else if(that.scrollColor-defaultColor<-step)that.scrollColor+=step;else that.scrollColor=defaultColor;step=Math.abs(targetDefaultColor-targetHoverColor)/stepsCount;if(that.targetColor-targetDefaultColor>step)that.targetColor-=step;else if(that.targetColor-targetDefaultColor<-step)that.targetColor+=step;else{that.targetColor=targetDefaultColor;that.strokeColor=strokeColor}step=Math.abs(strokeColor-strokeHoverColor)/stepsCount;if(that.strokeColor- strokeColor>step)that.strokeColor-=step;else if(that.strokeColor-strokeColor<-step)that.strokeColor+=step;else that.strokeColor=strokeColor}that.fadeTimeoutScroll=setTimeout(function(){that._animateScroll(fadeIn)},that.settings.fadeInFadeOutDelay)};ScrollObject.prototype._doAnimation=function(lastAnimState){var that=this,secondArrow,hoverColor=_HEXTORGB_(that.settings.scrollerHoverColor).R,defaultColor=_HEXTORGB_(that.settings.scrollerColor).R,activeColor=_HEXTORGB_(that.settings.scrollerActiveColor).R, targetColor=_HEXTORGB_(that.settings.targetColor).R,targetHoverColor=_HEXTORGB_(that.settings.targetHoverColor).R,targetActiveColor=_HEXTORGB_(that.settings.targetActiveColor).R,strokeColor=_HEXTORGB_(that.settings.strokeStyleNone).R,strokeHoverColor=_HEXTORGB_(that.settings.strokeStyleOver).R,strokeActiveColor=_HEXTORGB_(that.settings.strokeStyleActive).R;switch(that.arrowState){case ArrowType.ARROW_TOP:secondArrow=ArrowType.ARROW_BOTTOM;break;case ArrowType.ARROW_BOTTOM:secondArrow=ArrowType.ARROW_TOP; break;case ArrowType.ARROW_LEFT:secondArrow=ArrowType.ARROW_RIGHT;break;case ArrowType.ARROW_RIGHT:secondArrow=ArrowType.ARROW_LEFT;break}if(that.animState===AnimationType.NONE&&lastAnimState===AnimationType.NONE)that._drawScroll(defaultColor,targetColor,strokeColor);else if(that.animState===AnimationType.SCROLL_HOVER&&lastAnimState===AnimationType.SCROLL_HOVER){that._animateArrow(false,that.arrowState);that._animateScroll(true)}else if(that.animState===AnimationType.ARROW_HOVER&&lastAnimState=== AnimationType.NONE){that._animateArrow(false,secondArrow);that._animateArrow(true,that.arrowState);that._animateScroll(true)}else if(that.animState===AnimationType.SCROLL_HOVER&&lastAnimState===AnimationType.NONE){that._animateArrow(false,that.arrowState);that._animateScroll(true)}else if(that.animState===AnimationType.NONE&&lastAnimState===AnimationType.ARROW_HOVER){that._animateArrow(false,that.arrowState);that._animateScroll(false)}else if(that.animState===AnimationType.NONE&&lastAnimState===AnimationType.SCROLL_ACTIVE){that._animateArrow(false, that.arrowState);that._drawScroll(defaultColor,targetColor,strokeColor)}else if(that.animState===AnimationType.SCROLL_HOVER&&lastAnimState===AnimationType.ARROW_HOVER){that._animateArrow(false,that.arrowState);that._animateScroll(true)}else if(that.animState===AnimationType.NONE&&lastAnimState===AnimationType.SCROLL_HOVER){that._animateArrow(false,that.arrowState);that._animateScroll(false)}else if(that.animState===AnimationType.ARROW_HOVER&&lastAnimState===AnimationType.SCROLL_HOVER){that._animateArrow(false, secondArrow);that._animateArrow(true,that.arrowState);that._animateScroll(true)}else if(this.animState===AnimationType.SCROLL_HOVER&&lastAnimState===AnimationType.SCROLL_ACTIVE){that._animateArrow(undefined,that.arrowState,defaultColor);that._drawScroll(hoverColor,targetHoverColor,strokeHoverColor)}else if(this.animState===AnimationType.SCROLL_HOVER&&lastAnimState===AnimationType.ARROW_ACTIVE){that._animateArrow(undefined,that.arrowState,defaultColor);that._drawScroll(hoverColor,targetHoverColor, strokeHoverColor)}else if(this.animState===AnimationType.ARROW_ACTIVE){that._animateArrow(undefined,that.arrowState,activeColor);that._animateScroll(true)}else if(this.animState===AnimationType.ARROW_HOVER&&lastAnimState===AnimationType.ARROW_ACTIVE)if(this.lastArrowState&&this.lastArrowState!==this.arrowState){that._animateArrow(undefined,secondArrow,defaultColor);that._animateArrow(true,that.arrowState);that._animateScroll(true)}else{that._animateArrow(undefined,that.arrowState,hoverColor);that._animateScroll(true)}else if(this.animState=== AnimationType.NONE&&lastAnimState===AnimationType.ARROW_ACTIVE){that._animateArrow(undefined,that.arrowState,defaultColor);that._animateScroll(false)}else if(this.animState===AnimationType.ARROW_HOVER&&lastAnimState===AnimationType.SCROLL_ACTIVE){that._animateArrow(false,secondArrow);that._animateArrow(true,that.arrowState);if(that.mouseUp&&!that.mouseDown)that._drawScroll(hoverColor,targetHoverColor,strokeHoverColor);else if(that.mouseDown&&that.scrollerMouseDown)that._drawScroll(activeColor,targetActiveColor, strokeActiveColor)}else if(this.animState===AnimationType.SCROLL_ACTIVE){that._animateArrow(false,that.arrowState);that._drawScroll(activeColor,targetActiveColor,strokeActiveColor)}else if(this.animState===AnimationType.ARROW_HOVER&&lastAnimState===AnimationType.ARROW_HOVER){that._animateArrow(true,that.arrowState);that._drawScroll(hoverColor,targetHoverColor,strokeHoverColor)}else return};ScrollObject.prototype._draw=function(){clearTimeout(this.fadeTimeoutScroll);this.fadeTimeoutScroll=null;clearTimeout(this.fadeTimeoutArrows); this.fadeTimeoutArrows=null;this._doAnimation(this.lastAnimState);this.lastAnimState=this.animState};ScrollObject.prototype._checkPiperImagesV=function(){if(this.settings.isVerticalScroll&&this.maxScrollY!=0&&this.scroller.h>=Math.round(13*AscBrowser.retinaPixelRatio))return true;return false};ScrollObject.prototype._checkPiperImagesH=function(){if(this.settings.isHorizontalScroll&&this.maxScrollX!=0&&this.scroller.w>=Math.round(13*AscBrowser.retinaPixelRatio))return true;return false};ScrollObject.prototype._setDimension= function(h,w){var dPR=AscBrowser.retinaPixelRatio;if(this.canvasH===Math.round(h*dPR)&&this.canvasW===Math.round(w*dPR)){this.isResizeArrows=false;return}this.isResizeArrows=true;this.canvasH=Math.round(h*dPR);this.canvasW=Math.round(w*dPR);this.canvasOriginalH=h;this.canvasOriginalW=w;this.canvas.height=this.canvasH;this.canvas.width=this.canvasW};ScrollObject.prototype._setScrollerHW=function(){var dPR=AscBrowser.retinaPixelRatio;if(this.settings.isVerticalScroll){this.scroller.x=this._roundForScale(dPR); this.scroller.w=Math.round((this.canvasOriginalW-1)*dPR);if(this.settings.slimScroll)this.settings.arrowSizeW=this.settings.arrowSizeH=this.scroller.w;if(this.settings.showArrows)this.ArrowDrawer.InitSize(this.settings.arrowSizeW,this.settings.arrowSizeH,this.IsRetina)}else if(this.settings.isHorizontalScroll){this.scroller.y=this._roundForScale(dPR);this.scroller.h=Math.round((this.canvasOriginalH-1)*dPR);if(this.settings.slimScroll)this.settings.arrowSizeH=this.settings.arrowSizeW=this.scroller.h; if(this.settings.showArrows)this.ArrowDrawer.InitSize(this.settings.arrowSizeH,this.settings.arrowSizeW,this.IsRetina)}};ScrollObject.prototype._MouseHoverOnScroller=function(mp){if(this.settings.isVerticalScroll&&mp.x>=0&&mp.x<=this.scroller.x+this.scroller.w&&mp.y>=this.scroller.y&&mp.y<=this.scroller.y+this.scroller.h)return true;else if(this.settings.isHorizontalScroll&&mp.x>=this.scroller.x&&mp.x<=this.scroller.x+this.scroller.w&&mp.y>=0&&mp.y<=this.scroller.y+this.scroller.h)return true;else return false}; ScrollObject.prototype._MouseArrowHover=function(mp){var arrowDim=this.settings.arrowDim;if(this.settings.isVerticalScroll)if(mp.x>=0&&mp.x<=this.canvasW&&mp.y>=0&&mp.y<=arrowDim)return ArrowType.ARROW_TOP;else if(mp.x>=0&&mp.x<=this.canvasW&&mp.y>=this.canvasH-arrowDim&&mp.y<=this.canvasH)return ArrowType.ARROW_BOTTOM;else return ArrowType.NONE;if(this.settings.isHorizontalScroll)if(mp.x>=0&&mp.x<=arrowDim&&mp.y>=0&&mp.y<=this.canvasH)return ArrowType.ARROW_LEFT;else if(mp.x>=this.canvasW-arrowDim&& mp.x<=this.canvasW&&mp.y>=0&&mp.y<=this.canvasH)return ArrowType.ARROW_RIGHT;else return ArrowType.NONE};ScrollObject.prototype._arrowDownMouseDown=function(){var that=this,scrollTimeout,isFirst=true,doScroll=function(){if(that.settings.isVerticalScroll)that.scrollByY(that.settings.vscrollStep);else if(that.settings.isHorizontalScroll)that.scrollByX(that.settings.hscrollStep);if(that.mouseDown)scrollTimeout=setTimeout(doScroll,isFirst?that.settings.initialDelay:that.settings.arrowRepeatFreq);isFirst= false};doScroll();this.bind("mouseup.main mouseout",function(){scrollTimeout&&clearTimeout(scrollTimeout);scrollTimeout=null})};ScrollObject.prototype._arrowUpMouseDown=function(){var that=this,scrollTimeout,isFirst=true,doScroll=function(){if(that.settings.isVerticalScroll)that.scrollByY(-that.settings.vscrollStep);else if(that.settings.isHorizontalScroll)that.scrollByX(-that.settings.hscrollStep);if(that.mouseDown)scrollTimeout=setTimeout(doScroll,isFirst?that.settings.initialDelay:that.settings.arrowRepeatFreq); isFirst=false};doScroll();this.bind("mouseup.main mouseout",function(){scrollTimeout&&clearTimeout(scrollTimeout);scrollTimeout=null})};ScrollObject.prototype.getCurScrolledX=function(){return this.scrollHCurrentX};ScrollObject.prototype.getCurScrolledY=function(){return this.scrollVCurrentY};ScrollObject.prototype.getMaxScrolledY=function(){return this.maxScrollY};ScrollObject.prototype.getMaxScrolledX=function(){return this.maxScrollX};ScrollObject.prototype.getIsLockedMouse=function(){return this.that.mouseDownArrow|| this.that.mouseDown};ScrollObject.prototype.evt_mousemove=function(e){if(this.style)this.style.cursor="default";var evt=e||window.event;if(evt.preventDefault)evt.preventDefault();else evt.returnValue=false;var mousePos=this.that.getMousePosition(evt);this.that.EndMousePosition.x=mousePos.x;this.that.EndMousePosition.y=mousePos.y;var arrowHover=this.that._MouseArrowHover(mousePos);var dPR=AscBrowser.retinaPixelRatio;if(this.that.settings.showArrows&&this.that.mouseDownArrow){if(arrowHover&&arrowHover=== this.that.arrowState)this.that.arrowState=arrowHover;this.that.animState=AnimationType.ARROW_ACTIVE}else if(!this.that.mouseDownArrow)if(!arrowHover||!this.that.settings.showArrows)this.that.animState=AnimationType.SCROLL_HOVER;else{this.that.animState=AnimationType.ARROW_HOVER;this.that.arrowState=arrowHover}if(this.that.mouseDown&&this.that.scrollerMouseDown)this.that.moveble=true;else this.that.moveble=false;if(this.that.settings.isVerticalScroll){if(this.that.moveble&&this.that.scrollerMouseDown){var isTop= false,isBottom=false;if(arrowHover&&this.that.settings.showArrows)this.that.animState=AnimationType.ARROW_HOVER;else this.that.animState=AnimationType.SCROLL_ACTIVE;var _dlt=this.that.EndMousePosition.y-this.that.StartMousePosition.y;_dlt=_dlt>=0?Math.floor(_dlt):Math.ceil(_dlt);if(this.that.EndMousePosition.y==this.that.StartMousePosition.y)return;else if(this.that.EndMousePosition.y this.that.canvasH-this.that.arrowPosition){this.that.EndMousePosition.y=this.that.canvasH-this.that.arrowPosition;this.that.scroller.y=this.that.canvasH-this.that.arrowPosition-this.that.scroller.h}else{var dltY=_dlt>0?this.that.canvasH-this.that.arrowPosition-this.that.scroller.h-this.that.scroller.y:this.that.arrowPosition-this.that.scroller.y;_dlt=_dlt>0?dltY<_dlt?dltY:_dlt:dltY>_dlt?dltY:_dlt;if(_dlt>0&&this.that.scroller.y+this.that.scroller.h+_dlt+Math.round(dPR)<=this.that.canvasH-this.that.arrowPosition|| _dlt<0&&this.that.scroller.y+_dlt>=this.that.arrowPosition)this.that.scroller.y+=_dlt;else if(_dlt>0)this.that.scroller.y=this.that.canvasH-this.that.arrowPosition-this.that.scroller.h;else if(_dlt<0)this.that.scroller.y=this.that.arrowPosition}var destY=(this.that.scroller.y-this.that.arrowPosition)*this.that.scrollCoeff;var result=this.that._correctScrollV(this.that,destY);if(result!=null&&result.isChange===true)destY=result.Pos;this.that._scrollV(this.that,evt,destY,isTop,isBottom);this.that.StartMousePosition.x= this.that.EndMousePosition.x;this.that.StartMousePosition.y=this.that.EndMousePosition.y}}else if(this.that.settings.isHorizontalScroll)if(this.that.moveble&&this.that.scrollerMouseDown){var isTop=false,isBottom=false;if(arrowHover&&this.that.settings.showArrows)this.that.animState=AnimationType.ARROW_HOVER;else this.that.animState=AnimationType.SCROLL_ACTIVE;var _dlt=this.that.EndMousePosition.x-this.that.StartMousePosition.x;_dlt=_dlt>=0?Math.floor(_dlt):Math.ceil(_dlt);if(this.that.EndMousePosition.x== this.that.StartMousePosition.x)return;else if(this.that.EndMousePosition.xthis.that.canvasW-this.that.arrowPosition){this.that.EndMousePosition.x=this.that.canvasW-this.that.arrowPosition;this.that.scroller.x=this.that.canvasW-this.that.arrowPosition-this.that.scroller.w}else{var dltX=_dlt>0?this.that.canvasW-this.that.arrowPosition-this.that.scroller.w- this.that.scroller.x:this.that.arrowPosition-this.that.scroller.x;_dlt=_dlt>0?dltX<_dlt?dltX:_dlt:dltX>_dlt?dltX:_dlt;if(_dlt>0&&this.that.scroller.x+this.that.scroller.w+_dlt<=this.that.canvasW-this.that.arrowPosition||_dlt<0&&this.that.scroller.x+_dlt>=this.that.arrowPosition)this.that.scroller.x+=_dlt;else if(_dlt>0)this.that.scroller.x=this.that.canvasW-this.that.arrowPosition-this.that.scroller.w;else if(_dlt<0)this.that.scroller.x=this.that.arrowPosition}var destX=(this.that.scroller.x-this.that.arrowPosition)* this.that.scrollCoeff;this.that._scrollH(this.that,evt,destX,isTop,isBottom);this.that.StartMousePosition.x=this.that.EndMousePosition.x;this.that.StartMousePosition.y=this.that.EndMousePosition.y}this.that.moveble=false;if(this.that.lastAnimState!=this.that.animState)this.that._draw()};ScrollObject.prototype.evt_mouseout=function(e){var evt=e||window.event;if(this.that.settings.showArrows){this.that.mouseDown=this.that.mouseDownArrow?false:this.that.mouseDown;this.that.mouseDownArrow=false;this.that.handleEvents("onmouseout", evt)}if(this.that.mouseDown&&this.that.scrollerMouseDown)this.that.animState=AnimationType.SCROLL_ACTIVE;else this.that.animState=AnimationType.NONE;this.that._draw()};ScrollObject.prototype.evt_mouseover=function(e){this.that.mouseover=true};ScrollObject.prototype.evt_mouseup=function(e){var evt=e||window.event;this.that.handleEvents("onmouseup",evt);if(window.g_asc_plugins)window.g_asc_plugins.enablePointerEvents();if(evt.preventDefault)evt.preventDefault();else evt.returnValue=false;this.that.mouseDown= false;var mousePos=this.that.getMousePosition(evt);var arrowHover=this.that._MouseArrowHover(mousePos);var mouseHover=this.that._MouseHoverOnScroller(mousePos);this.that.scrollTimeout&&clearTimeout(this.that.scrollTimeout);this.that.scrollTimeout=null;if(this.that.scrollerMouseDown){this.that.mouseUp=true;this.that.scrollerMouseDown=false;this.that.mouseDownArrow=false;if(this.that._MouseHoverOnScroller(mousePos))this.that.animState=AnimationType.SCROLL_HOVER;else if(arrowHover&&this.that.settings.showArrows){this.that.lastAnimState= AnimationType.SCROLL_ACTIVE;this.that.animState=AnimationType.ARROW_HOVER}else if(mouseHover)this.that.animState=AnimationType.SCROLL_HOVER;else this.that.animState=AnimationType.NONE}else{if(arrowHover&&this.that.settings.showArrows){this.that.lastArrowState=this.that.arrowState;this.that.arrowState=arrowHover;this.that.animState=AnimationType.ARROW_HOVER}else if(this.that._MouseHoverOnScroller(mousePos))this.that.animState=AnimationType.SCROLL_HOVER;else this.that.animState=AnimationType.NONE;this.that.mouseDownArrow= false}this.that._draw();if(this.that.onLockMouse&&this.that.offLockMouse)this.that.offLockMouse(evt)};ScrollObject.prototype.evt_mousedown=function(e){var evt=e||window.event;if(window.g_asc_plugins)window.g_asc_plugins.disablePointerEvents();var mousePos=this.that.getMousePosition(evt),arrowHover=this.that._MouseArrowHover(mousePos);this.that.mouseDown=true;if(this.that.settings.showArrows&&arrowHover){this.that.mouseDownArrow=true;this.that.arrowState=arrowHover;this.that.animState=AnimationType.ARROW_ACTIVE; if(arrowHover===ArrowType.ARROW_TOP||arrowHover===ArrowType.ARROW_LEFT)this.that._arrowUpMouseDown();else if(arrowHover===ArrowType.ARROW_BOTTOM||arrowHover===ArrowType.ARROW_RIGHT)this.that._arrowDownMouseDown();this.that._draw()}else{this.that.mouseUp=false;if(this.that._MouseHoverOnScroller(mousePos)){this.that.scrollerMouseUp=false;this.that.scrollerMouseDown=true;if(this.that.onLockMouse)this.that.onLockMouse(evt);this.that.StartMousePosition.x=mousePos.x;this.that.StartMousePosition.y=mousePos.y; this.that.animState=AnimationType.SCROLL_ACTIVE;this.that._draw()}else{if(this.that.settings.isVerticalScroll){var _tmp=this,direction=mousePos.y-this.that.scroller.y-this.that.scroller.h/2,step=this.that.paneHeight*this.that.settings.scrollPagePercent,isFirst=true,doScroll=function(){_tmp.that.lock=true;if(direction>0)if(_tmp.that.scroller.y+_tmp.that.scroller.h/2+stepmousePos.y)_tmp.that.scrollByY(-step*_tmp.that.scrollCoeff);else{var _step=Math.abs(_tmp.that.scroller.y+_tmp.that.scroller.h/2-mousePos.y);_tmp.that.scrollByY(-_step*_tmp.that.scrollCoeff);cancelClick();return}_tmp.that.scrollTimeout=setTimeout(doScroll,isFirst?_tmp.that.settings.initialDelay:_tmp.that.settings.trackClickRepeatFreq);isFirst=false},cancelClick= function(){_tmp.that.scrollTimeout&&clearTimeout(_tmp.that.scrollTimeout);_tmp.that.scrollTimeout=null;_tmp.that.unbind("mouseup.main",cancelClick);_tmp.that.lock=false};if(this.that.onLockMouse)this.that.onLockMouse(evt);doScroll();this.that.bind("mouseup.main",cancelClick)}if(this.that.settings.isHorizontalScroll){var _tmp=this,direction=mousePos.x-this.that.scroller.x-this.that.scroller.w/2,step=this.that.paneWidth*this.that.settings.scrollPagePercent,isFirst=true,doScroll=function(){_tmp.that.lock= true;if(direction>0)if(_tmp.that.scroller.x+_tmp.that.scroller.w/2+stepmousePos.x)_tmp.that.scrollByX(-step*_tmp.that.scrollCoeff);else{var _step=Math.abs(_tmp.that.scroller.x+_tmp.that.scroller.w/2-mousePos.x);_tmp.that.scrollByX(-_step* _tmp.that.scrollCoeff);cancelClick();return}_tmp.that.scrollTimeout=setTimeout(doScroll,isFirst?_tmp.that.settings.initialDelay:_tmp.that.settings.trackClickRepeatFreq);isFirst=false},cancelClick=function(){_tmp.that.scrollTimeout&&clearTimeout(_tmp.that.scrollTimeout);_tmp.that.scrollTimeout=null;_tmp.that.unbind("mouseup.main",cancelClick);_tmp.that.lock=false};if(this.that.onLockMouse)this.that.onLockMouse(evt);doScroll();this.that.bind("mouseup.main",cancelClick)}}}};ScrollObject.prototype.evt_mousewheel= function(e){var evt=e||window.event;var delta=1;if(this.that.settings.isHorizontalScroll)return;if(undefined!=evt.wheelDelta)delta=evt.wheelDelta>0?-this.that.settings.vscrollStep:this.that.settings.vscrollStep;else delta=evt.detail>0?this.that.settings.vscrollStep:-this.that.settings.vscrollStep;delta*=this.that.settings.wheelScrollLines;this.that.scroller.y+=delta;if(this.that.scroller.y<0)this.that.scroller.y=0;else if(this.that.scroller.y+this.that.scroller.h>this.that.canvasH)this.that.scroller.y= this.that.canvasH-this.that.arrowPosition-this.that.scroller.h;this.that.scrollByY(delta)};ScrollObject.prototype.evt_click=function(e){var evt=e||window.event;var mousePos=this.that.getMousePosition(evt);if(this.that.settings.isHorizontalScroll)if(mousePos.x>this.arrowPosition&&mousePos.xmousePos.x)this.that.scrollByX(-this.that.settings.vscrollStep);if(this.that.scroller.xmousePos.x)return false; if(this.that.scroller.x+this.that.scroller.wthis.that.arrowPosition&&mousePos.ymousePos.y)this.that.scrollByY(-this.that.settings.vscrollStep);if(this.that.scroller.ymousePos.y)return false;if(this.that.scroller.y+this.that.scroller.h1?parts[1]:"";if(!this.eventListeners[baseEvent])this.eventListeners[baseEvent]=[];this.eventListeners[baseEvent].push({name:name,handler:handler})}};ScrollObject.prototype.unbind=function(typesStr){var types=typesStr.split(" ");for(var n=0;n< types.length;n++){var type=types[n];var event=type.indexOf("touch")==-1?"on"+type:type;var parts=event.split(".");var baseEvent=parts[0];if(this.eventListeners[baseEvent]&&parts.length>1){var name=parts[1];for(var i=0;i0){destination=wrapperSize?wrapperSize/2.5*(speed/8):0;distance=Math.abs(current)+destination;duration=distance/speed}return{destination:Math.round(destination),duration:duration}};var _transform=_prefixStyle("transform");var _hasPointer=AscCommon.AscBrowser.isIE?!("ontouchstart"in window)&&!!(window.PointerEvent||window.MSPointerEvent):false;if(AscCommon.AscBrowser.isAppleDevices&&AscCommon.AscBrowser.iosVersion>=13)_hasPointer=true;me.extend(me,{hasTransform:_transform!==false,hasPerspective:_prefixStyle("perspective")in _elementStyle,hasTouch:"ontouchstart"in window,hasPointer:_hasPointer,hasTransition:_prefixStyle("transition")in _elementStyle});me.isBadAndroid=function(){var appVersion=window.navigator.appVersion;if(/Android/.test(appVersion)&&!/Chrome\/\d/.test(appVersion)){var safariVersion= appVersion.match(/Safari\/(\d+.\d)/);if(safariVersion&&typeof safariVersion==="object"&&safariVersion.length>=2)return parseFloat(safariVersion[1])<535.19;else return true}else return false}();me.extend(me.style={},{transform:_transform,transitionTimingFunction:_prefixStyle("transitionTimingFunction"),transitionDuration:_prefixStyle("transitionDuration"),transitionDelay:_prefixStyle("transitionDelay"),transformOrigin:_prefixStyle("transformOrigin")});me.hasClass=function(e,c){var re=new RegExp("(^|\\s)"+ c+"(\\s|$)");return re.test(e.className)};me.addClass=function(e,c){if(me.hasClass(e,c))return;var newclass=e.className.split(" ");newclass.push(c);e.className=newclass.join(" ")};me.removeClass=function(e,c){if(!me.hasClass(e,c))return;var re=new RegExp("(^|\\s)"+c+"(\\s|$)","g");e.className=e.className.replace(re," ")};me.offset=function(el){var left=-el.offsetLeft,top=-el.offsetTop;while(el=el.offsetParent){left-=el.offsetLeft;top-=el.offsetTop}return{left:left,top:top}};me.preventDefaultException= function(el,exceptions){for(var i in exceptions)if(exceptions[i].test(el[i]))return true;return false};me.extend(me.eventType={},{touchstart:1,touchmove:1,touchend:1,mousedown:2,mousemove:2,mouseup:2,pointerdown:3,pointermove:3,pointerup:3,MSPointerDown:3,MSPointerMove:3,MSPointerUp:3});me.extend(me.ease={},{quadratic:{style:"cubic-bezier(0.25, 0.46, 0.45, 0.94)",fn:function(k){return k*(2-k)}},circular:{style:"cubic-bezier(0.1, 0.57, 0.1, 1)",fn:function(k){return Math.sqrt(1- --k*k)}},back:{style:"cubic-bezier(0.175, 0.885, 0.32, 1.275)", fn:function(k){var b=4;return(k=k-1)*k*((b+1)*k+b)+1}},bounce:{style:"",fn:function(k){if((k/=1)<1/2.75)return 7.5625*k*k;else if(k<2/2.75)return 7.5625*(k-=1.5/2.75)*k+.75;else if(k<2.5/2.75)return 7.5625*(k-=2.25/2.75)*k+.9375;else return 7.5625*(k-=2.625/2.75)*k+.984375}},elastic:{style:"",fn:function(k){var f=.22,e=.4;if(k===0)return 0;if(k==1)return 1;return e*Math.pow(2,-10*k)*Math.sin((k-f/4)*(2*Math.PI)/f)+1}}});me.tap=function(e,eventName){var ev=document.createEvent("Event");ev.initEvent(eventName, true,true);ev.pageX=e.pageX;ev.pageY=e.pageY;e.target.dispatchEvent(ev)};me.click=function(e){return;var target=e.target,ev;if(!/(SELECT|INPUT|TEXTAREA)/i.test(target.tagName)){ev=document.createEvent(window.MouseEvent?"MouseEvents":"Event");ev.initEvent("click",true,true);ev.view=e.view||window;ev.detail=1;ev.screenX=target.screenX||0;ev.screenY=target.screenY||0;ev.clientX=target.clientX||0;ev.clientY=target.clientY||0;ev.ctrlKey=!!e.ctrlKey;ev.altKey=!!e.altKey;ev.shiftKey=!!e.shiftKey;ev.metaKey= !!e.metaKey;ev.button=0;ev.relatedTarget=null;ev._constructed=true;target.dispatchEvent(ev)}};return me}();function IScroll(el,options){this.wrapper=typeof el=="string"?document.querySelector(el):el;this.scroller=typeof options.scroller_id=="string"?document.getElementById(options.scroller_id):this.wrapper.children[0];this.scrollerStyle=this.scroller.style;this.eventsElement=options.eventsElement;this.options={resizeScrollbars:true,mouseWheelSpeed:20,snapThreshold:.334,disablePointer:!utils.hasPointer, disableTouch:utils.hasPointer||!utils.hasTouch,disableMouse:utils.hasPointer||utils.hasTouch,startX:0,startY:0,scrollY:true,directionLockThreshold:5,momentum:true,bounce:true,bounceTime:600,bounceEasing:"",preventDefault:true,preventDefaultException:{tagName:/^(INPUT|TEXTAREA|BUTTON|SELECT)$/},HWCompositing:true,useTransition:true,useTransform:true,bindToWrapper:typeof window.onmousedown==="undefined"};for(var i in options)this.options[i]=options[i];if(AscCommon.AscBrowser.isAppleDevices&&AscCommon.AscBrowser.iosVersion>= 13)this.options.click=true;this.translateZ=this.options.HWCompositing&&utils.hasPerspective?" translateZ(0)":"";this.options.useTransition=utils.hasTransition&&this.options.useTransition;this.options.useTransform=utils.hasTransform&&this.options.useTransform;this.options.eventPassthrough=this.options.eventPassthrough===true?"vertical":this.options.eventPassthrough;this.options.preventDefault=!this.options.eventPassthrough&&this.options.preventDefault;this.options.scrollY=this.options.eventPassthrough== "vertical"?false:this.options.scrollY;this.options.scrollX=this.options.eventPassthrough=="horizontal"?false:this.options.scrollX;this.options.freeScroll=this.options.freeScroll&&!this.options.eventPassthrough;this.options.directionLockThreshold=this.options.eventPassthrough?0:this.options.directionLockThreshold;this.options.bounceEasing=typeof this.options.bounceEasing=="string"?utils.ease[this.options.bounceEasing]||utils.ease.circular:this.options.bounceEasing;this.options.resizePolling=this.options.resizePolling=== undefined?60:this.options.resizePolling;if(this.options.tap===true)this.options.tap="tap";if(!this.options.useTransition&&!this.options.useTransform)if(!/relative|absolute/i.test(this.scrollerStyle.position))this.scrollerStyle.position="relative";if(this.options.shrinkScrollbars=="scale")this.options.useTransition=false;this.options.invertWheelDirection=this.options.invertWheelDirection?-1:1;this.x=0;this.y=0;this.directionX=0;this.directionY=0;this._events={};this._init();this.refresh();this.scrollTo(this.options.startX, this.options.startY);this.enable();this.isDown=false;this.isDownBeforeClick=false;this.isUpBeforeClick=false;this.isUseLongTapTimer=!!this.options.useLongTap;this.longTapActionEvent=null;this.longTapInterval=500;this.longTapIntervalTimer=-1}IScroll.prototype={version:"5.2.0",_init:function(){this._initEvents();if(this.options.scrollbars||this.options.indicators)this._initIndicators();if(this.options.mouseWheel)this._initWheel();if(this.options.snap)this._initSnap();if(this.options.keyBindings)this._initKeys()}, destroy:function(){this._initEvents(true);clearTimeout(this.resizeTimeout);this.resizeTimeout=null;this._execEvent("destroy")},_transitionEnd:function(e){if(e.target!=this.scroller||!this.isInTransition)return;this._transitionTime();if(!this.resetPosition(this.options.bounceTime)){this.isInTransition=false;this._execEvent("scrollEnd")}},_start:function(e){if(utils.eventType[e.type]!=1){var button;if(!e.which)button=e.button<2?0:e.button==4?1:2;else button=e.button;if(button!==0)return}if(!this.enabled|| this.initiated&&utils.eventType[e.type]!==this.initiated)return;if(this.options.preventDefault&&!utils.isBadAndroid&&!utils.preventDefaultException(e.target,this.options.preventDefaultException))e.preventDefault();var point=e.touches?e.touches[0]:e,pos;this.initiated=utils.eventType[e.type];this.moved=false;this.distX=0;this.distY=0;this.directionX=0;this.directionY=0;this.directionLocked=0;this.startTime=utils.getTime();if(this.options.useTransition&&this.isInTransition){this._transitionTime();this.isInTransition= false;pos=this.getComputedPosition();this._translate(Math.round(pos.x),Math.round(pos.y));this._execEvent("scrollEnd")}else if(!this.options.useTransition&&this.isAnimating){this.isAnimating=false;this._execEvent("scrollEnd")}this.startX=this.x;this.startY=this.y;this.absStartX=this.x;this.absStartY=this.y;this.pointX=point.pageX;this.pointY=point.pageY;this._execEvent("beforeScrollStart")},_move:function(e){if(!this.enabled||utils.eventType[e.type]!==this.initiated)return;if(this.options.preventDefault)e.preventDefault(); var point=e.touches?e.touches[0]:e,deltaX=point.pageX-this.pointX,deltaY=point.pageY-this.pointY,timestamp=utils.getTime(),newX,newY,absDistX,absDistY;this.pointX=point.pageX;this.pointY=point.pageY;this.distX+=deltaX;this.distY+=deltaY;absDistX=Math.abs(this.distX);absDistY=Math.abs(this.distY);if(timestamp-this.endTime>300&&(absDistX<10&&absDistY<10))return;if(!this.directionLocked&&!this.options.freeScroll)if(absDistX>absDistY+this.options.directionLockThreshold)this.directionLocked="h";else if(absDistY>= absDistX+this.options.directionLockThreshold)this.directionLocked="v";else this.directionLocked="n";if(this.directionLocked=="h"){if(this.options.eventPassthrough=="vertical")e.preventDefault();else if(this.options.eventPassthrough=="horizontal"){this.initiated=false;return}deltaY=0}else if(this.directionLocked=="v"){if(this.options.eventPassthrough=="horizontal")e.preventDefault();else if(this.options.eventPassthrough=="vertical"){this.initiated=false;return}deltaX=0}deltaX=this.hasHorizontalScroll? deltaX:0;deltaY=this.hasVerticalScroll?deltaY:0;newX=this.x+deltaX;newY=this.y+deltaY;if(newX>0||newX0?0:this.maxScrollX;if(newY>0||newY0?0:this.maxScrollY;this.directionX=deltaX>0?-1:deltaX<0?1:0;this.directionY=deltaY>0?-1:deltaY<0?1:0;if(!this.moved)this._execEvent("scrollStart");this.moved=true;this._translate(newX,newY);if(timestamp-this.startTime>300){this.startTime= timestamp;this.startX=this.x;this.startY=this.y}this._execEvent("scroll")},_end:function(e){if(!this.enabled||utils.eventType[e.type]!==this.initiated)return;if(this.options.preventDefault&&!utils.preventDefaultException(e.target,this.options.preventDefaultException))e.preventDefault();var point=e.changedTouches?e.changedTouches[0]:e,momentumX,momentumY,duration=utils.getTime()-this.startTime,newX=Math.round(this.x),newY=Math.round(this.y),distanceX=Math.abs(newX-this.startX),distanceY=Math.abs(newY- this.startY),time=0,easing="";this.isInTransition=0;this.initiated=0;this.endTime=utils.getTime();if(this.resetPosition(this.options.bounceTime))return;this.scrollTo(newX,newY);if(!this.moved){if(this.options.tap)utils.tap(e,this.options.tap);if(this.options.click)utils.click(e);this._execEvent("scrollCancel");return}if(this._events.flick&&duration<200&&distanceX<100&&distanceY<100){this._execEvent("flick");return}if(this.options.momentum&&duration<300){momentumX=this.hasHorizontalScroll?utils.momentum(this.x, this.startX,duration,this.maxScrollX,this.options.bounce?this.wrapperWidth:0,this.options.deceleration):{destination:newX,duration:0};momentumY=this.hasVerticalScroll?utils.momentum(this.y,this.startY,duration,this.maxScrollY,this.options.bounce?this.wrapperHeight:0,this.options.deceleration):{destination:newY,duration:0};newX=momentumX.destination;newY=momentumY.destination;time=Math.max(momentumX.duration,momentumY.duration);this.isInTransition=1}if(this.options.snap){var snap=this._nearestSnap(newX, newY);this.currentPage=snap;time=this.options.snapSpeed||Math.max(Math.max(Math.min(Math.abs(newX-snap.x),1E3),Math.min(Math.abs(newY-snap.y),1E3)),300);newX=snap.x;newY=snap.y;this.directionX=0;this.directionY=0;easing=this.options.bounceEasing}if(newX!=this.x||newY!=this.y){if(newX>0||newX0||newY0)x=0;else if(this.x0)y=0;else if(this.y-1)this._events[type].splice(index,1)},_execEvent:function(type){if(!this._events[type])return;var i=0,l=this._events[type].length;if(!l)return;for(;i0;var transitionType=this.options.useTransition&& easing.style;if(!time||transitionType){if(transitionType){this._transitionTimingFunction(easing.style);this._transitionTime(time)}this._translate(x,y)}else this._animate(x,y,time,easing.fn)},scrollToElement:function(el,time,offsetX,offsetY,easing){el=el.nodeType?el:this.scroller.querySelector(el);if(!el)return;var pos=utils.offset(el);pos.left-=this.wrapperOffset.left;pos.top-=this.wrapperOffset.top;if(offsetX===true)offsetX=Math.round(el.offsetWidth/2-this.wrapper.offsetWidth/2);if(offsetY===true)offsetY= Math.round(el.offsetHeight/2-this.wrapper.offsetHeight/2);pos.left-=offsetX||0;pos.top-=offsetY||0;pos.left=pos.left>0?0:pos.left0?0:pos.top0)newX--;else if(wheelDeltaX<0)newX++;if(wheelDeltaY>0)newY--;else if(wheelDeltaY<0)newY++;this.goToPage(newX,newY);return}newX=this.x+Math.round(this.hasHorizontalScroll?wheelDeltaX:0);newY=this.y+Math.round(this.hasVerticalScroll?wheelDeltaY:0);this.directionX= wheelDeltaX>0?-1:wheelDeltaX<0?1:0;this.directionY=wheelDeltaY>0?-1:wheelDeltaY<0?1:0;if(newX>0)newX=0;else if(newX0)newY=0;else if(newY-this.scrollerWidth){this.pages[i]=[];l=0;y=0;while(y>-this.scrollerHeight){this.pages[i][l]={x:Math.max(x,this.maxScrollX),y:Math.max(y,this.maxScrollY),width:stepX,height:stepY,cx:x-cx,cy:y-cy};y-=stepY;l++}x-=stepX;i++}}else{el=this.options.snap; l=el.length;n=-1;for(;ithis.maxScrollX)m++}}this.goToPage(this.currentPage.pageX||0,this.currentPage.pageY||0,0);if(this.options.snapThreshold% 1===0){this.snapThresholdX=this.options.snapThreshold;this.snapThresholdY=this.options.snapThreshold}else{this.snapThresholdX=Math.round(this.pages[this.currentPage.pageX][this.currentPage.pageY].width*this.options.snapThreshold);this.snapThresholdY=Math.round(this.pages[this.currentPage.pageX][this.currentPage.pageY].height*this.options.snapThreshold)}});this.on("flick",function(){var time=this.options.snapSpeed||Math.max(Math.max(Math.min(Math.abs(this.x-this.startX),1E3),Math.min(Math.abs(this.y- this.startY),1E3)),300);this.goToPage(this.currentPage.pageX+this.directionX,this.currentPage.pageY+this.directionY,time)})},_nearestSnap:function(x,y){if(!this.pages.length)return{x:0,y:0,pageX:0,pageY:0};var i=0,l=this.pages.length,m=0;if(Math.abs(x-this.absStartX)0)x=0;else if(x0)y=0;else if(y=this.pages[i][0].cx){x= this.pages[i][0].x;break}l=this.pages[i].length;for(;m=this.pages[0][m].cy){y=this.pages[0][m].y;break}if(i==this.currentPage.pageX){i+=this.directionX;if(i<0)i=0;else if(i>=this.pages.length)i=this.pages.length-1;x=this.pages[i][0].x}if(m==this.currentPage.pageY){m+=this.directionY;if(m<0)m=0;else if(m>=this.pages[0].length)m=this.pages[0].length-1;y=this.pages[0][m].y}return{x:x,y:y,pageX:i,pageY:m}},goToPage:function(x,y,time,easing){easing=easing||this.options.bounceEasing;if(x>=this.pages.length)x= this.pages.length-1;else if(x<0)x=0;if(y>=this.pages[x].length)y=this.pages[x].length-1;else if(y<0)y=0;var posX=this.pages[x][y].x,posY=this.pages[x][y].y;time=time===undefined?this.options.snapSpeed||Math.max(Math.max(Math.min(Math.abs(posX-this.x),1E3),Math.min(Math.abs(posY-this.y),1E3)),300):time;this.currentPage={x:posX,y:posY,pageX:x,pageY:y};this.scrollTo(posX,posY,time,easing)},next:function(time,easing){var x=this.currentPage.pageX,y=this.currentPage.pageY;x++;if(x>=this.pages.length&&this.hasVerticalScroll){x= 0;y++}this.goToPage(x,y,time,easing)},prev:function(time,easing){var x=this.currentPage.pageX,y=this.currentPage.pageY;x--;if(x<0&&this.hasVerticalScroll){x=0;y--}this.goToPage(x,y,time,easing)},_initKeys:function(e){var keys={pageUp:33,pageDown:34,end:35,home:36,left:37,up:38,right:39,down:40};var i;if(typeof this.options.keyBindings=="object")for(i in this.options.keyBindings){if(typeof this.options.keyBindings[i]=="string")this.options.keyBindings[i]=this.options.keyBindings[i].toUpperCase().charCodeAt(0)}else this.options.keyBindings= {};for(i in keys)this.options.keyBindings[i]=this.options.keyBindings[i]||keys[i];utils.addEvent(window,"keydown",this);this.on("destroy",function(){utils.removeEvent(window,"keydown",this)})},_key:function(e){if(!this.enabled)return;var snap=this.options.snap,newX=snap?this.currentPage.pageX:this.x,newY=snap?this.currentPage.pageY:this.y,now=utils.getTime(),prevTime=this.keyTime||0,acceleration=.25,pos;if(this.options.useTransition&&this.isInTransition){pos=this.getComputedPosition();this._translate(Math.round(pos.x), Math.round(pos.y));this.isInTransition=false}this.keyAcceleration=now-prevTime<200?Math.min(this.keyAcceleration+acceleration,50):0;switch(e.keyCode){case this.options.keyBindings.pageUp:if(this.hasHorizontalScroll&&!this.hasVerticalScroll)newX+=snap?1:this.wrapperWidth;else newY+=snap?1:this.wrapperHeight;break;case this.options.keyBindings.pageDown:if(this.hasHorizontalScroll&&!this.hasVerticalScroll)newX-=snap?1:this.wrapperWidth;else newY-=snap?1:this.wrapperHeight;break;case this.options.keyBindings.end:newX= snap?this.pages.length-1:this.maxScrollX;newY=snap?this.pages[0].length-1:this.maxScrollY;break;case this.options.keyBindings.home:newX=0;newY=0;break;case this.options.keyBindings.left:newX+=snap?-1:5+this.keyAcceleration>>0;break;case this.options.keyBindings.up:newY+=snap?1:5+this.keyAcceleration>>0;break;case this.options.keyBindings.right:newX-=snap?-1:5+this.keyAcceleration>>0;break;case this.options.keyBindings.down:newY-=snap?1:5+this.keyAcceleration>>0;break;default:return}if(snap){this.goToPage(newX, newY);return}if(newX>0){newX=0;this.keyAcceleration=0}else if(newX0){newY=0;this.keyAcceleration=0}else if(newY=destTime){that.isAnimating= false;that._translate(destX,destY);if(!that.resetPosition(that.options.bounceTime))that._execEvent("scrollEnd");return}now=(now-startTime)/duration;easing=easingFn(now);newX=(destX-startX)*easing+startX;newY=(destY-startY)*easing+startY;that._translate(newX,newY);if(that.isAnimating)rAF(step);that._execEvent("scroll")}this.isAnimating=true;step()},handleEvent:function(e){switch(e.type){case "touchstart":case "pointerdown":case "MSPointerDown":case "mousedown":this.isDown=true;this.isDownBeforeClick= true;this.eventsElement?this.manager.mainOnTouchStart(e):this._start(e);this.enableLongTapAction(e);break;case "touchmove":case "pointermove":case "MSPointerMove":case "mousemove":if(this.isDown||e.srcElement==this.eventsElement)this.eventsElement?this.manager.mainOnTouchMove(e):e;this.disableLongTapAction();break;case "touchend":case "pointerup":case "MSPointerUp":case "mouseup":case "touchcancel":case "pointercancel":case "MSPointerCancel":case "mousecancel":if(this.isDown||e.srcElement==this.eventsElement)this.eventsElement? this.manager.mainOnTouchEnd(e):this._end(e);this.isUpBeforeClick=true;this.isDown=false;this.disableLongTapAction();break;case "orientationchange":case "resize":this._resize();break;case "transitionend":case "webkitTransitionEnd":case "oTransitionEnd":case "MSTransitionEnd":this._transitionEnd(e);break;case "wheel":case "DOMMouseScroll":case "mousewheel":this._wheel(e);break;case "keydown":this._key(e);break;case "click":if(this.enabled&&!e._constructed){e.preventDefault();e.stopPropagation()}this.disableLongTapAction(); if(!this.isDownBeforeClick&&!this.isUpBeforeClick&&this.eventsElement){this.manager.mainOnTouchStart(e);this.manager.mainOnTouchEnd(e)}this.isDownBeforeClick=false;this.isUpBeforeClick=false;break}},enableLongTapAction:function(e){if(!this.isUseLongTapTimer)return;this.disableLongTapAction();var _e=e.touches?e.touches[0]:e;this.longTapActionEvent={type:e.type,pageX:_e.pageX,pageY:_e.pageY,clientX:_e.clientX,clientY:_e.clientY,altKey:_e.altKey,shiftKey:_e.shiftKey,ctrlKey:_e.ctrlKey,metaKey:_e.metaKey, srcElement:_e.srcElement,target:_e.target};var _t=this;this.longTapIntervalTimer=setTimeout(function(){_t.doLongTapAction(_t.longTapActionEvent)},this.longTapInterval)},disableLongTapAction:function(){if(-1!==this.longTapIntervalTimer){clearInterval(this.longTapIntervalTimer);this.longTapIntervalTimer=-1}},doLongTapAction:function(e){this.manager.mainOnTouchStart(e);this.manager.mainOnTouchEnd(e);this.manager.mainOnTouchStart(e);this.manager.mainOnTouchEnd(e)}};function createDefaultScrollbar(direction, interactive,type){var scrollbar=document.createElement("div"),indicator=document.createElement("div");if(type===true){scrollbar.style.cssText="position:absolute;z-index:9999";indicator.style.cssText="-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box;position:absolute;background:rgba(0,0,0,0.5);border:1px solid rgba(255,255,255,0.9);border-radius:3px"}indicator.className="iScrollIndicator";if(direction=="h"){if(type===true){scrollbar.style.cssText+=";height:7px;left:2px;right:2px;bottom:0"; indicator.style.height="100%"}scrollbar.className="iScrollHorizontalScrollbar"}else{if(type===true){scrollbar.style.cssText+=";width:7px;bottom:2px;top:2px;right:1px";indicator.style.width="100%"}scrollbar.className="iScrollVerticalScrollbar"}scrollbar.style.cssText+=";overflow:hidden";if(!interactive)scrollbar.style.pointerEvents="none";scrollbar.appendChild(indicator);return scrollbar}function Indicator(scroller,options){this.wrapper=typeof options.el=="string"?document.querySelector(options.el): options.el;this.wrapperStyle=this.wrapper.style;this.indicator=this.wrapper.children[0];this.indicatorStyle=this.indicator.style;this.scroller=scroller;this.options={listenX:true,listenY:true,interactive:false,resize:true,defaultScrollbars:false,shrink:false,fade:false,speedRatioX:0,speedRatioY:0};for(var i in options)this.options[i]=options[i];this.sizeRatioX=1;this.sizeRatioY=1;this.maxPosX=0;this.maxPosY=0;if(this.options.interactive){if(!this.options.disableTouch){utils.addEvent(this.indicator, "touchstart",this);utils.addEvent(window,"touchend",this)}if(!this.options.disablePointer){utils.addEvent(this.indicator,utils.prefixPointerEvent("pointerdown"),this);utils.addEvent(window,utils.prefixPointerEvent("pointerup"),this)}if(!this.options.disableMouse){utils.addEvent(this.indicator,"mousedown",this);utils.addEvent(window,"mouseup",this)}}if(this.options.fade){this.wrapperStyle[utils.style.transform]=this.scroller.translateZ;var durationProp=utils.style.transitionDuration;if(!durationProp)return; this.wrapperStyle[durationProp]=utils.isBadAndroid?"0.0001ms":"0ms";var self=this;if(utils.isBadAndroid)rAF(function(){if(self.wrapperStyle[durationProp]==="0.0001ms")self.wrapperStyle[durationProp]="0s"});this.wrapperStyle.opacity="0"}}Indicator.prototype={handleEvent:function(e){switch(e.type){case "touchstart":case "pointerdown":case "MSPointerDown":case "mousedown":this._start(e);break;case "touchmove":case "pointermove":case "MSPointerMove":case "mousemove":this._move(e);break;case "touchend":case "pointerup":case "MSPointerUp":case "mouseup":case "touchcancel":case "pointercancel":case "MSPointerCancel":case "mousecancel":this._end(e); break}},destroy:function(){if(this.options.fadeScrollbars){clearTimeout(this.fadeTimeout);this.fadeTimeout=null}if(this.options.interactive){utils.removeEvent(this.indicator,"touchstart",this);utils.removeEvent(this.indicator,utils.prefixPointerEvent("pointerdown"),this);utils.removeEvent(this.indicator,"mousedown",this);utils.removeEvent(window,"touchmove",this);utils.removeEvent(window,utils.prefixPointerEvent("pointermove"),this);utils.removeEvent(window,"mousemove",this);utils.removeEvent(window, "touchend",this);utils.removeEvent(window,utils.prefixPointerEvent("pointerup"),this);utils.removeEvent(window,"mouseup",this)}if(this.options.defaultScrollbars)this.wrapper.parentNode.removeChild(this.wrapper)},_start:function(e){var point=e.touches?e.touches[0]:e;e.preventDefault();e.stopPropagation();this.transitionTime();this.initiated=true;this.moved=false;this.lastPointX=point.pageX;this.lastPointY=point.pageY;this.startTime=utils.getTime();if(!this.options.disableTouch)utils.addEvent(window, "touchmove",this);if(!this.options.disablePointer)utils.addEvent(window,utils.prefixPointerEvent("pointermove"),this);if(!this.options.disableMouse)utils.addEvent(window,"mousemove",this);this.scroller._execEvent("beforeScrollStart")},_move:function(e){var point=e.touches?e.touches[0]:e,deltaX,deltaY,newX,newY,timestamp=utils.getTime();if(!this.moved)this.scroller._execEvent("scrollStart");this.moved=true;deltaX=point.pageX-this.lastPointX;this.lastPointX=point.pageX;deltaY=point.pageY-this.lastPointY; this.lastPointY=point.pageY;newX=this.x+deltaX;newY=this.y+deltaY;this._pos(newX,newY);e.preventDefault();e.stopPropagation()},_end:function(e){if(!this.initiated)return;this.initiated=false;e.preventDefault();e.stopPropagation();utils.removeEvent(window,"touchmove",this);utils.removeEvent(window,utils.prefixPointerEvent("pointermove"),this);utils.removeEvent(window,"mousemove",this);if(this.scroller.options.snap){var snap=this.scroller._nearestSnap(this.scroller.x,this.scroller.y);var time=this.options.snapSpeed|| Math.max(Math.max(Math.min(Math.abs(this.scroller.x-snap.x),1E3),Math.min(Math.abs(this.scroller.y-snap.y),1E3)),300);if(this.scroller.x!=snap.x||this.scroller.y!=snap.y){this.scroller.directionX=0;this.scroller.directionY=0;this.scroller.currentPage=snap;this.scroller.scrollTo(snap.x,snap.y,time,this.scroller.options.bounceEasing)}}if(this.moved)this.scroller._execEvent("scrollEnd")},transitionTime:function(time){time=time||0;var durationProp=utils.style.transitionDuration;if(!durationProp)return; this.indicatorStyle[durationProp]=time+"ms";if(!time&&utils.isBadAndroid){this.indicatorStyle[durationProp]="0.0001ms";var self=this;rAF(function(){if(self.indicatorStyle[durationProp]==="0.0001ms")self.indicatorStyle[durationProp]="0s"})}},transitionTimingFunction:function(easing){this.indicatorStyle[utils.style.transitionTimingFunction]=easing},refresh:function(){this.transitionTime();if(this.options.listenX&&!this.options.listenY)this.indicatorStyle.display=this.scroller.hasHorizontalScroll?"block": "none";else if(this.options.listenY&&!this.options.listenX)this.indicatorStyle.display=this.scroller.hasVerticalScroll?"block":"none";else this.indicatorStyle.display=this.scroller.hasHorizontalScroll||this.scroller.hasVerticalScroll?"block":"none";if(this.scroller.hasHorizontalScroll&&this.scroller.hasVerticalScroll){utils.addClass(this.wrapper,"iScrollBothScrollbars");utils.removeClass(this.wrapper,"iScrollLoneScrollbar");if(this.options.defaultScrollbars&&this.options.customStyle)if(this.options.listenX)this.wrapper.style.right= "8px";else this.wrapper.style.bottom="8px"}else{utils.removeClass(this.wrapper,"iScrollBothScrollbars");utils.addClass(this.wrapper,"iScrollLoneScrollbar");if(this.options.defaultScrollbars&&this.options.customStyle)if(this.options.listenX)this.wrapper.style.right="2px";else this.wrapper.style.bottom="2px"}var r=this.wrapper.offsetHeight;if(this.options.listenX){this.wrapperWidth=this.wrapper.clientWidth;if(this.options.resize){this.indicatorWidth=Math.max(Math.round(this.wrapperWidth*this.wrapperWidth/ (this.scroller.scrollerWidth||this.wrapperWidth||1)),8);this.indicatorStyle.width=this.indicatorWidth+"px"}else this.indicatorWidth=this.indicator.clientWidth;this.maxPosX=this.wrapperWidth-this.indicatorWidth;if(this.options.shrink=="clip"){this.minBoundaryX=-this.indicatorWidth+8;this.maxBoundaryX=this.wrapperWidth-8}else{this.minBoundaryX=0;this.maxBoundaryX=this.maxPosX}this.sizeRatioX=this.options.speedRatioX||this.scroller.maxScrollX&&this.maxPosX/this.scroller.maxScrollX}if(this.options.listenY){this.wrapperHeight= this.wrapper.clientHeight;if(this.options.resize){this.indicatorHeight=Math.max(Math.round(this.wrapperHeight*this.wrapperHeight/(this.scroller.scrollerHeight||this.wrapperHeight||1)),8);this.indicatorStyle.height=this.indicatorHeight+"px"}else this.indicatorHeight=this.indicator.clientHeight;this.maxPosY=this.wrapperHeight-this.indicatorHeight;if(this.options.shrink=="clip"){this.minBoundaryY=-this.indicatorHeight+8;this.maxBoundaryY=this.wrapperHeight-8}else{this.minBoundaryY=0;this.maxBoundaryY= this.maxPosY}this.maxPosY=this.wrapperHeight-this.indicatorHeight;this.sizeRatioY=this.options.speedRatioY||this.scroller.maxScrollY&&this.maxPosY/this.scroller.maxScrollY}this.updatePosition()},updatePosition:function(){var x=this.options.listenX&&Math.round(this.sizeRatioX*this.scroller.x)||0,y=this.options.listenY&&Math.round(this.sizeRatioY*this.scroller.y)||0;if(!this.options.ignoreBoundaries){if(xthis.maxBoundaryX)if(this.options.shrink=="scale"){this.width=Math.max(this.indicatorWidth-(x-this.maxPosX),8);this.indicatorStyle.width=this.width+"px";x=this.maxPosX+this.indicatorWidth-this.width}else x=this.maxBoundaryX;else if(this.options.shrink=="scale"&&this.width!=this.indicatorWidth){this.width=this.indicatorWidth;this.indicatorStyle.width=this.width+"px"}if(ythis.maxBoundaryY)if(this.options.shrink=="scale"){this.height=Math.max(this.indicatorHeight-(y-this.maxPosY)*3,8);this.indicatorStyle.height=this.height+"px";y=this.maxPosY+this.indicatorHeight-this.height}else y=this.maxBoundaryY;else if(this.options.shrink=="scale"&&this.height!=this.indicatorHeight){this.height=this.indicatorHeight;this.indicatorStyle.height=this.height+"px"}}this.x= x;this.y=y;if(this.scroller.options.useTransform)this.indicatorStyle[utils.style.transform]="translate("+x+"px,"+y+"px)"+this.scroller.translateZ;else{this.indicatorStyle.left=x+"px";this.indicatorStyle.top=y+"px"}},_pos:function(x,y){if(x<0)x=0;else if(x>this.maxPosX)x=this.maxPosX;if(y<0)y=0;else if(y>this.maxPosY)y=this.maxPosY;x=this.options.listenX?Math.round(x/this.sizeRatioX):this.scroller.x;y=this.options.listenY?Math.round(y/this.sizeRatioY):this.scroller.y;this.scroller.scrollTo(x,y)},fade:function(val, hold){if(hold&&!this.visible)return;clearTimeout(this.fadeTimeout);this.fadeTimeout=null;var time=val?250:500,delay=val?0:300;val=val?"1":"0";this.wrapperStyle[utils.style.transitionDuration]=time+"ms";this.fadeTimeout=setTimeout(function(val){this.wrapperStyle.opacity=val;this.visible=+val}.bind(this,val),delay)}};IScroll.utils=utils;IScroll.prototype["handleEvent"]=IScroll.prototype.handleEvent;Indicator.prototype["handleEvent"]=Indicator.prototype.handleEvent;window.IScrollMobile=IScroll})(window, document,Math);(function(window,undefined){function LCS(a,b){this.a=a;this.b=b}LCS.prototype.equals=function(a,b){return a===b};LCS.prototype.compute=function(callback,T,limit){var midleft=new KPoint,midright=new KPoint,d;if(typeof limit==="undefined")limit=this.defaultLimit();if(limit.N<=0&&limit.M<=0)return 0;if(limit.N>0&&limit.M===0){midleft.set(0,0).translate(limit.left);midright.set(1,1).translate(limit.left);for(d=0;d0){midleft.set(0,0).translate(limit.left);midright.set(0,-1).translate(limit.left);for(d=0;dn&&this.equals(this.a[bx+x],this.b[by+x]))x--;V[k]=x;return k0};LCS.prototype.middleSnake=function(lefthead,righthead,limit){var d,k,head,k0;var delta=limit.delta;var dmax=Math.ceil(limit.dmax/2);var checkBwSnake=delta%2===0;var Vf={};var Vb={};Vf[1]=0;Vb[delta-1]=limit.N;for(d=0;d<=dmax;d++){for(k=-d;k<=d;k+=2){k0=this.nextSnakeHeadForward(righthead,k,-d,d,limit,Vf);if(!checkBwSnake&&k>=-d-1+delta&&k<=d-1+delta)if(Vf[k]>=Vb[k]){lefthead.set(Vf[k0],k0).translate(limit.left); return 2*d-1}}for(k=-d+delta;k<=d+delta;k+=2){k0=this.nextSnakeHeadBackward(lefthead,k,-d+delta,d+delta,limit,Vb);if(checkBwSnake&&k>=-d&&k<=d)if(Vf[k]>=Vb[k]){righthead.set(Vb[k0],k0).translate(limit.left);return 2*d}}}};LCS.prototype.defaultLimit=function(){return new Limit(new KPoint(0,0),new KPoint(this.a.length,this.a.length-this.b.length))};LCS.prototype.forEachPositionInSnake=function(left,right,callback,T){var k=right.k;var x=k>left.k?left.x+1:left.x;var n=right.x;while(x 0||this.inserts.length>0){this.callback.call(this.T,this.removes,this.inserts);this.removes=[];this.inserts=[]}};function DeltaCollector(matching,root_a,root_b){this.matching=matching;this.root_a=root_a;this.root_b=root_b||matching.get(root_a)}DeltaCollector.prototype.equals=function(a,b){return a.value===b.value};DeltaCollector.prototype.forEachChange=function(callback,T,root_a,root_b,path){var parambuf,i,k,a_nodes,b_nodes,a,b,op,me=this;path=path||[];root_a=root_a||this.root_a;root_b=root_b||this.root_b; if(root_a!==this.matching.get(root_b))throw new Error("Parameter error, root_a and root_b must be partners");if(!this.equals(root_a,root_b)){op=new AttachedOperation(new Anchor(this.root_a,root_a),UPDATE_NODE_TYPE,path.slice(),[root_a],[root_b]);callback.call(T,op)}parambuf=new ParameterBuffer(function(removes,inserts){var start=i-removes.length;var op=new AttachedOperation(new Anchor(me.root_a,root_a,start),UPDATE_FOREST_TYPE,path.concat(start),removes,inserts);callback.call(T,op)});a_nodes=root_a.children; b_nodes=root_b.children;i=0;k=0;while(a_nodes[i]||b_nodes[k]){a=a_nodes[i];b=b_nodes[k];if(a&&!this.matching.get(a)){parambuf.pushRemove(a);i++}else if(b&&!this.matching.get(b)){parambuf.pushInsert(b);k++}else if(a&&b&&a===this.matching.get(b)){parambuf.flush();this.forEachChange(callback,T,a,b,path.concat(i));i++;k++}else throw new Error("Matching is not consistent.");}parambuf.flush();return};function AttachedOperation(anchor,type,path,remove,insert,handler){this.anchor=anchor;this.type=type;this.path= path;this.remove=remove;this.insert=insert;this.handler=handler}function Diff(a,b){this.a=a;this.b=b}Diff.prototype.matchTrees=function(matching){matching.put(this.b,this.a);this.matchContent(matching);this.matchStructure(matching)};Diff.prototype.isContent=function(node){return node.children.length===0};Diff.prototype.isStructure=function(node){return!this.isContent(node)};Diff.prototype.equals=function(a,b){return a.value===b.value};Diff.prototype.equalContent=function(a,b){var i;if(a.children.length!== b.children.length)return false;for(i=0;i0||b_xmatch.length>0)callback.call(T,a_xmatch,b_xmatch,a,b)};Diff.prototype.matchStructure=function(matching){this.forEachUnmatchedSequenceOfSiblings(matching,this.a.children,this.b.children,function(a_nodes,b_nodes){var a_bones=[],b_bones=[],lcsinst=new LCS(a_bones, b_bones);lcsinst.equals=function(that){return function(a,b){return that.equalStructure(matching,a,b)}}(this);a_nodes.forEach(function(n){Array.prototype.push.apply(a_bones,this.collectBones(n))},this);b_nodes.forEach(function(n){Array.prototype.push.apply(b_bones,this.collectBones(n))},this);lcsinst.forEachCommonSymbol(function(x,y){var a=a_bones[x],b=b_bones[y];if(this.matchingCheckAncestors(matching,a,b))this.matchingPutAncestors(matching,a,b)},this)},this)};window["AscCommon"]=window["AscCommon"]|| {};window["AscCommon"].Diff=Diff;window["AscCommon"].LCS=LCS;window["AscCommon"].KPoint=KPoint;window["AscCommon"].Limit=Limit;window["AscCommon"].Anchor=Anchor;window["AscCommon"].ParameterBuffer=ParameterBuffer;window["AscCommon"].DeltaCollector=DeltaCollector;window["AscCommon"].AttachedOperation=AttachedOperation})(window);"use strict";(function(window,undefined){var AscCommon=window["AscCommon"];var global_mouseEvent=AscCommon.global_mouseEvent;AscCommon.MobileTouchMode={None:0,Scroll:1,Zoom:2, Select:3,InlineObj:4,FlowObj:5,Cursor:6,TableMove:7,TableRuler:8,SelectTrack:9};AscCommon.MobileTouchContextMenuType={None:0,Target:1,Select:2,Object:3,Slide:4};function MobileTouchContextMenuLastInfo(){this.targetPos=null;this.selectText=null;this.selectCell=null;this.objectBounds=null;this.objectSlideThumbnail=null}MobileTouchContextMenuLastInfo.prototype={Clear:function(){this.targetPos=null;this.selectText=null;this.selectCell=null;this.objectBounds=null;this.objectSlideThumbnail=null},CopyTo:function(dst){dst.targetPos= this.targetPos;dst.selectText=this.selectText;dst.selectCell=this.selectCell;dst.objectBounds=this.objectBounds;dst.objectSlideThumbnail=this.objectSlideThumbnail}};AscCommon.MobileTouchContextMenuLastInfo=MobileTouchContextMenuLastInfo;AscCommon.MOBILE_SELECT_TRACK_ROUND=14;AscCommon.MOBILE_TABLE_RULER_DIAMOND=7;function CMobileDelegateSimple(_manager){this.Manager=_manager;this.Api=_manager.Api}CMobileDelegateSimple.prototype.Init=function(){this.Manager.iScroll.manager=this.Manager;this.Manager.iScroll.on("scroll", function(){this.manager.delegate.ScrollTo(this)});this.Manager.iScroll.on("scrollEnd",function(){this.manager.delegate.ScrollEnd(this)})};CMobileDelegateSimple.prototype.Resize=function(){return null};CMobileDelegateSimple.prototype.GetSelectionTransform=function(){return null};CMobileDelegateSimple.prototype.ConvertCoordsToCursor=function(x,y,page,isCanvas){return null};CMobileDelegateSimple.prototype.ConvertCoordsFromCursor=function(x,y){return null};CMobileDelegateSimple.prototype.GetElementOffset= function(){return null};CMobileDelegateSimple.prototype.GetTableDrawing=function(){return null};CMobileDelegateSimple.prototype.GetZoom=function(){return null};CMobileDelegateSimple.prototype.SetZoom=function(_value){};CMobileDelegateSimple.prototype.GetObjectTrack=function(x,y,page,bSelected,bText){return false};CMobileDelegateSimple.prototype.GetContextMenuType=function(){return AscCommon.MobileTouchContextMenuType.None};CMobileDelegateSimple.prototype.GetContextMenuInfo=function(info){info.Clear()}; CMobileDelegateEditor.prototype.GetContextMenuPosition=function(){return null};CMobileDelegateSimple.prototype.GetZoomFit=function(){return 100};CMobileDelegateSimple.prototype.GetScrollerParent=function(){return null};CMobileDelegateSimple.prototype.GetScrollerSize=function(){return{W:100,H:100}};CMobileDelegateSimple.prototype.GetScrollPosition=function(){return null};CMobileDelegateSimple.prototype.ScrollTo=function(_scroll){return};CMobileDelegateSimple.prototype.ScrollEnd=function(_scroll){return}; CMobileDelegateSimple.prototype.GetSelectionRectsBounds=function(){return this.LogicDocument.GetSelectionBounds()};CMobileDelegateSimple.prototype.IsReader=function(){return false};function CMobileDelegateEditor(_manager){CMobileDelegateSimple.call(this,_manager);this.HtmlPage=this.Api.WordControl;this.LogicDocument=this.Api.WordControl.m_oLogicDocument;this.DrawingDocument=this.Api.WordControl.m_oDrawingDocument}CMobileDelegateEditor.prototype=Object.create(CMobileDelegateSimple.prototype);CMobileDelegateEditor.prototype.constructor= CMobileDelegateEditor;CMobileDelegateEditor.prototype.GetSelectionTransform=function(){return this.DrawingDocument.SelectionMatrix};CMobileDelegateEditor.prototype.ConvertCoordsToCursor=function(x,y,page,isGlobal){return this.DrawingDocument.ConvertCoordsToCursor3(x,y,page,isGlobal!==false)};CMobileDelegateEditor.prototype.ConvertCoordsFromCursor=function(x,y){return this.DrawingDocument.ConvertCoordsFromCursor2(x,y)};CMobileDelegateEditor.prototype.GetElementOffset=function(){var _xOffset=this.HtmlPage.X; var _yOffset=this.HtmlPage.Y;if(true===this.HtmlPage.m_bIsRuler){_xOffset+=5*AscCommon.g_dKoef_mm_to_pix;_yOffset+=7*AscCommon.g_dKoef_mm_to_pix}return{X:_xOffset,Y:_yOffset}};CMobileDelegateEditor.prototype.GetTableDrawing=function(){return this.DrawingDocument.TableOutlineDr};CMobileDelegateEditor.prototype.GetZoom=function(){return this.HtmlPage.m_nZoomValue};CMobileDelegateEditor.prototype.SetZoom=function(_value){this.HtmlPage.m_oApi.zoom(_value)};CMobileDelegateEditor.prototype.GetObjectTrack= function(x,y,page,bSelected,bText){return this.LogicDocument.DrawingObjects.isPointInDrawingObjects3(x,y,page,bSelected,bText)};CMobileDelegateEditor.prototype.GetContextMenuType=function(){var _mode=AscCommon.MobileTouchContextMenuType.None;if(!this.LogicDocument.IsSelectionUse())_mode=AscCommon.MobileTouchContextMenuType.Target;var selectionBounds=this.LogicDocument.GetSelectionBounds();var eps=1E-4;if(selectionBounds&&selectionBounds.Start&&selectionBounds.End&&Math.abs(selectionBounds.Start.W)> eps&&Math.abs(selectionBounds.End.W)>eps)_mode=AscCommon.MobileTouchContextMenuType.Select;if(_mode==0&&this.LogicDocument.DrawingObjects.getSelectedObjectsBounds())_mode=AscCommon.MobileTouchContextMenuType.Object;return _mode};CMobileDelegateEditor.prototype.GetContextMenuInfo=function(info){info.Clear();var _info=null;var _transform=null;var _x=0;var _y=0;var _target=this.LogicDocument.IsSelectionUse();if(_target===false){_info={X:this.LogicDocument.TargetPos.X,Y:this.LogicDocument.TargetPos.Y, Page:this.LogicDocument.TargetPos.PageNum};_transform=this.DrawingDocument.TextMatrix;if(_transform){_x=_transform.TransformPointX(_info.X,_info.Y);_y=_transform.TransformPointY(_info.X,_info.Y);_info.X=_x;_info.Y=_y}info.targetPos=_info;return}var _select=this.LogicDocument.GetSelectionBounds();if(_select){var _rect1=_select.Start;var _rect2=_select.End;_info={X1:_rect1.X,Y1:_rect1.Y,Page1:_rect1.Page,X2:_rect2.X+_rect2.W,Y2:_rect2.Y+_rect2.H,Page2:_rect2.Page};_transform=this.DrawingDocument.SelectionMatrix; if(_transform){_x=_transform.TransformPointX(_info.X1,_info.Y1);_y=_transform.TransformPointY(_info.X1,_info.Y1);_info.X1=_x;_info.Y1=_y;_x=_transform.TransformPointX(_info.X2,_info.Y2);_y=_transform.TransformPointY(_info.X2,_info.Y2);_info.X2=_x;_info.Y2=_y}info.selectText=_info;return}var _object_bounds=this.LogicDocument.DrawingObjects.getSelectedObjectsBounds();if(_object_bounds)info.objectBounds={X:_object_bounds.minX,Y:_object_bounds.minY,R:_object_bounds.maxX,B:_object_bounds.maxY,Page:_object_bounds.pageIndex}}; CMobileDelegateEditor.prototype.GetContextMenuPosition=function(){var _posX=0;var _posY=0;var _page=0;var _transform=null;var tmpX,tmpY,tmpX2,tmpY2;var _pos=null;var _mode=0;var _target=this.LogicDocument.IsSelectionUse();if(_target===false){_posX=this.DrawingDocument.m_dTargetX;_posY=this.DrawingDocument.m_dTargetY;_page=this.DrawingDocument.m_lTargetPage;_transform=this.DrawingDocument.TextMatrix;if(_transform){tmpX=_transform.TransformPointX(_posX,_posY);tmpY=_transform.TransformPointY(_posX,_posY)}else{tmpX= _posX;tmpY=_posY}_pos=this.DrawingDocument.ConvertCoordsToCursorWR(tmpX,tmpY,_page);_posX=_pos.X;_posY=_pos.Y;_mode=1}var _select=this.LogicDocument.GetSelectionBounds();if(_select){var _rect1=_select.Start;var _rect2=_select.End;tmpX=_rect1.X;tmpY=_rect1.Y;tmpX2=_rect2.X+_rect2.W;tmpY2=_rect2.Y+_rect2.H;_transform=this.DrawingDocument.SelectionMatrix;if(_transform){_posX=_transform.TransformPointX(tmpX,tmpY);_posY=_transform.TransformPointY(tmpX,tmpY);tmpX=_posX;tmpY=_posY;_posX=_transform.TransformPointX(tmpX2, tmpY2);_posY=_transform.TransformPointY(tmpX2,tmpY2);tmpX2=_posX;tmpY2=_posY}_pos=this.DrawingDocument.ConvertCoordsToCursorWR(tmpX,tmpY,_rect1.Page);_posX=_pos.X;_posY=_pos.Y;_pos=this.DrawingDocument.ConvertCoordsToCursorWR(tmpX2,tmpY2,_rect2.Page);_posX+=_pos.X;_posX=_posX>>1;_mode=2}var _object_bounds=this.LogicDocument.DrawingObjects.getSelectedObjectsBounds(true);if(_object_bounds){_pos=this.DrawingDocument.ConvertCoordsToCursorWR(_object_bounds.minX,_object_bounds.minY,_object_bounds.pageIndex); _posX=_pos.X;_posY=_pos.Y;_pos=this.DrawingDocument.ConvertCoordsToCursorWR(_object_bounds.maxX,_object_bounds.maxY,_object_bounds.pageIndex);_posX+=_pos.X;_posX=_posX>>1;_mode=3}return{X:_posX,Y:_posY,Mode:_mode}};CMobileDelegateEditor.prototype.GetZoomFit=function(){var Zoom=100;var w=this.HtmlPage.m_oEditor.AbsolutePosition.R-this.HtmlPage.m_oEditor.AbsolutePosition.L;if(0!=this.HtmlPage.m_dDocumentPageWidth){Zoom=100*(w-10)/this.HtmlPage.m_dDocumentPageWidth;if(Zoom<5)Zoom=5;if(this.HtmlPage.m_oApi.isMobileVersion){var _w= this.HtmlPage.m_oEditor.HtmlElement.width;_w/=AscCommon.AscBrowser.retinaPixelRatio;Zoom=100*_w*AscCommon.g_dKoef_pix_to_mm/this.HtmlPage.m_dDocumentPageWidth}}return Zoom-.5>>0};CMobileDelegateEditor.prototype.GetScrollerParent=function(){return this.HtmlPage.m_oMainView.HtmlElement};CMobileDelegateEditor.prototype.GetScrollerSize=function(){return{W:this.HtmlPage.m_dDocumentWidth,H:this.HtmlPage.m_dDocumentHeight}};CMobileDelegateEditor.prototype.ScrollTo=function(_scroll){this.HtmlPage.NoneRepaintPages= true===_scroll.isAnimating?true:false;if(_scroll.directionLocked=="v")this.HtmlPage.m_oScrollVerApi.scrollToY(-_scroll.y);else if(_scroll.directionLocked=="h")this.HtmlPage.m_oScrollHorApi.scrollToX(-_scroll.x);else if(_scroll.directionLocked=="n"){this.HtmlPage.m_oScrollHorApi.scrollToX(-_scroll.x);this.HtmlPage.m_oScrollVerApi.scrollToY(-_scroll.y)}};CMobileDelegateEditor.prototype.ScrollEnd=function(_scroll){this.HtmlPage.NoneRepaintPages=true===_scroll.isAnimating?true:false;this.HtmlPage.OnScroll(); _scroll.manager.OnScrollAnimationEnd()};CMobileDelegateEditor.prototype.GetSelectionRectsBounds=function(){return this.LogicDocument.GetSelectionBounds()};CMobileDelegateEditor.prototype.IsReader=function(){return null!=this.DrawingDocument.m_oDocumentRenderer};CMobileDelegateEditor.prototype.Logic_GetNearestPos=function(x,y,page){return this.LogicDocument.Get_NearestPos(page,x,y)};CMobileDelegateEditor.prototype.Logic_OnMouseDown=function(e,x,y,page){return this.LogicDocument.OnMouseDown(e,x,y,page)}; CMobileDelegateEditor.prototype.Logic_OnMouseMove=function(e,x,y,page){return this.LogicDocument.OnMouseMove(e,x,y,page)};CMobileDelegateEditor.prototype.Logic_OnMouseUp=function(e,x,y,page){return this.LogicDocument.OnMouseUp(e,x,y,page)};CMobileDelegateEditor.prototype.Drawing_OnMouseDown=function(e){return this.HtmlPage.onMouseDown(e)};CMobileDelegateEditor.prototype.Drawing_OnMouseMove=function(e){return this.HtmlPage.onMouseMove(e)};CMobileDelegateEditor.prototype.Drawing_OnMouseUp=function(e){return this.HtmlPage.onMouseUp(e)}; function CMobileTouchManagerBase(_config){this.Api=null;this.Mode=AscCommon.MobileTouchMode.None;this.IsTouching=false;this.ReadingGlassTime=750;this.TimeDown=0;this.DownPoint=null;this.DownPointOriginal={X:0,Y:0};this.MoveAfterDown=false;this.MoveMinDist=10;this.SelectEnabled=_config.isSelection!==false;this.RectSelect1=null;this.RectSelect2=null;this.PageSelect1=0;this.PageSelect2=0;this.RectSelectType=0;this.TrackTargetEps=20;this.ZoomEnabled=_config.isZoomEnabled!==false;this.ZoomDistance=0;this.ZoomValue= 100;this.ZoomValueMin=50;this.ZoomValueMax=300;this.TableTrackEnabled=_config.isTableTrack!==false;this.TableMovePoint=null;this.TableHorRulerPoints=null;this.TableVerRulerPoints=null;this.TableStartTrack_Check=false;this.TableRulersRectOffset=5;this.TableRulersRectSize=20;this.TableCurrentMoveDir=-1;this.TableCurrentMovePos=-1;this.TableCurrentMoveValue=0;this.TableCurrentMoveValueOld=0;this.TableCurrentMoveValueMin=null;this.TableCurrentMoveValueMax=null;this.ContextMenuLastMode=AscCommon.MobileTouchContextMenuType.None; this.ContextMenuLastInfo=new AscCommon.MobileTouchContextMenuLastInfo;this.ContextMenuLastShow=false;this.ContextMenuLastModeCounter=0;this.ContextMenuShowTimerId=-1;this.iScroll=null;this.iScrollElement="mobile_scroller_id";this.delegate=null;this.eventsElement=_config.eventsElement;this.pointerTouchesCoords={};this.IsZoomCheckFit=false;this.isShowingContextMenu=false;this.isMobileContextMenuShowResize=false}CMobileTouchManagerBase.prototype.initEvents=function(_id){this.eventsElement=_id;this.iScroll.eventsElement= this.eventsElement;this.iScroll._initEvents()};CMobileTouchManagerBase.prototype.CreateScrollerDiv=function(_wrapper){var _scroller=document.createElement("div");var _style="position: absolute; z-index: 0; margin: 0; padding: 0; -webkit-tap-highlight-color: rgba(0,0,0,0); width: 100%; heigth: 100%; display: block;";_style+="-webkit-transform: translateZ(0); -moz-transform: translateZ(0); -ms-transform: translateZ(0); -o-transform: translateZ(0); transform: translateZ(0);";_style+="touch-action:none;-webkit-touch-callout: none; -webkit-user-select: none; -moz-user-select: none; -ms-user-select: none; user-select: none;"; _style+="-webkit-text-size-adjust: none; -moz-text-size-adjust: none; -ms-text-size-adjust: none; -o-text-size-adjust: none; text-size-adjust: none;";_scroller.setAttribute("style",_style);_scroller.id=this.iScrollElement;_wrapper.appendChild(_scroller)};CMobileTouchManagerBase.prototype.LoadMobileImages=function(){};CMobileTouchManagerBase.prototype.CheckSelectTrack=function(){if(!this.SelectEnabled)return false;var _matrix=this.delegate.GetSelectionTransform();if(_matrix&&global_MatrixTransformer.IsIdentity(_matrix))_matrix= null;if(null!=this.RectSelect1&&null!=this.RectSelect2){var pos1=null;var pos4=null;if(!_matrix){pos1=this.delegate.ConvertCoordsToCursor(this.RectSelect1.x,this.RectSelect1.y,this.PageSelect1);pos4=this.delegate.ConvertCoordsToCursor(this.RectSelect2.x+this.RectSelect2.w,this.RectSelect2.y+this.RectSelect2.h,this.PageSelect2)}else{var _xx1=_matrix.TransformPointX(this.RectSelect1.x,this.RectSelect1.y);var _yy1=_matrix.TransformPointY(this.RectSelect1.x,this.RectSelect1.y);var _xx2=_matrix.TransformPointX(this.RectSelect2.x+ this.RectSelect2.w,this.RectSelect2.y+this.RectSelect2.h);var _yy2=_matrix.TransformPointY(this.RectSelect2.x+this.RectSelect2.w,this.RectSelect2.y+this.RectSelect2.h);pos1=this.delegate.ConvertCoordsToCursor(_xx1,_yy1,this.PageSelect1);pos4=this.delegate.ConvertCoordsToCursor(_xx2,_yy2,this.PageSelect2)}if(Math.abs(pos1.X-global_mouseEvent.X)posLT.X-_offset-_eps&&_xposLT.Y-_offset-_eps&&_yposLT.Y-_offset-_eps&&_y_dist){_indexF= i;_minF=_dist}}if(_minF<_eps){var _p=this.TableHorRulerPoints[_indexF];this.TableCurrentMoveDir=0;this.TableCurrentMovePos=_indexF;this.TableCurrentMoveValue=_p.X;this.TableCurrentMoveValueOld=this.TableCurrentMoveValue;this.Mode=AscCommon.MobileTouchMode.TableRuler;if(_indexF==0)this.TableCurrentMoveValueMin=this.TableMovePoint.X;else this.TableCurrentMoveValueMin=this.TableHorRulerPoints[_indexF-1].X+this.TableHorRulerPoints[_indexF-1].W;if(_indexF<_len-1)this.TableCurrentMoveValueMax=this.TableHorRulerPoints[_indexF+ 1].X;else this.TableCurrentMoveValueMax=null;bIsTable=true}}if(!bIsTable&&_x>=posLT.X-_offset-_eps&&_x<=posLT.X-this.TableRulersRectOffset+_eps){var _len=this.TableVerRulerPoints.length;var _indexF=-1;var _minF=1E6;for(var i=0;i<_len;i++){var posM1=this.delegate.ConvertCoordsToCursor(this.TableMovePoint.X,this.TableVerRulerPoints[i].Y,_PageNum);var posM2=this.delegate.ConvertCoordsToCursor(this.TableMovePoint.X,this.TableVerRulerPoints[i].Y+this.TableVerRulerPoints[i].H,_PageNum);if(_y>=posM1.Y-_eps&& _y<=posM2.Y+_eps){var _dist=Math.abs(_y-(posM1.Y+posM2.Y)/2);if(_minF>_dist){_indexF=i;_minF=_dist}}}if(_indexF!=-1){var _p=this.TableVerRulerPoints[_indexF];this.TableCurrentMoveDir=1;this.TableCurrentMovePos=_indexF;this.TableCurrentMoveValue=_p.Y;this.TableCurrentMoveValueOld=this.TableCurrentMoveValue;this.Mode=AscCommon.MobileTouchMode.TableRuler;if(_indexF==0)this.TableCurrentMoveValueMin=this.TableMovePoint.Y;else this.TableCurrentMoveValueMin=this.TableVerRulerPoints[_indexF-1].Y+this.TableVerRulerPoints[_indexF- 1].H;if(_indexF<_len-1)this.TableCurrentMoveValueMax=this.TableVerRulerPoints[_indexF+1].Y;else this.TableCurrentMoveValueMax=null;bIsTable=true}}}}else{var pos=this.delegate.ConvertCoordsFromCursor(global_mouseEvent.X,global_mouseEvent.Y);if(pos.Page==_PageNum){var _invert=global_MatrixTransformer.Invert(_Transform);var _posx=_invert.TransformPointX(pos.X,pos.Y);var _posy=_invert.TransformPointY(pos.X,pos.Y);var _koef=AscCommon.g_dKoef_pix_to_mm*100/this.delegate.GetZoom();var _eps1=this.TrackTargetEps* _koef;var _offset1=this.TableRulersRectOffset*_koef;var _offset2=_offset1+this.TableRulersRectSize*_koef;if(_posx>=this.TableMovePoint.X-_offset2-_eps1&&_posx<=this.TableMovePoint.X-_offset1+_eps1&&_posy>=this.TableMovePoint.Y-_offset2-_eps1&&_posy<=this.TableMovePoint.Y-_offset1+_eps1){this.Mode=AscCommon.MobileTouchMode.TableMove;bIsTable=true}if(!bIsTable){if(_posy>this.TableMovePoint.Y-_offset2-_eps1&&_posy_p.X-_eps1&&_posx<_p.X+_p.W+_eps1){this.TableCurrentMoveDir=0;this.TableCurrentMovePos=i;this.TableCurrentMoveValue=this.TableHorRulerPoints[i].X;this.TableCurrentMoveValueOld=this.TableCurrentMoveValue;this.Mode=AscCommon.MobileTouchMode.TableRuler;if(i==0)this.TableCurrentMoveValueMin=this.TableMovePoint.X;else this.TableCurrentMoveValueMin=this.TableHorRulerPoints[i-1].X+this.TableHorRulerPoints[i-1].W;if(i<_len-1)this.TableCurrentMoveValueMax= this.TableHorRulerPoints[i+1].X;else this.TableCurrentMoveValueMax=null;bIsTable=true;break}}}if(!bIsTable&&_posx>=this.TableMovePoint.X-_offset2-_eps1&&_posx<=this.TableMovePoint.X-_offset1+_eps1){var _len=this.TableVerRulerPoints.length;for(var i=0;i<_len;i++){var _p=this.TableVerRulerPoints[i];if(_posy>=_p.Y-_eps1&&_posy<=_p.Y+_p.H+_eps1){this.TableCurrentMoveDir=1;this.TableCurrentMovePos=i;this.TableCurrentMoveValue=this.TableVerRulerPoints[i].Y;this.TableCurrentMoveValueOld=this.TableCurrentMoveValue; this.Mode=AscCommon.MobileTouchMode.TableRuler;if(i==0)this.TableCurrentMoveValueMin=this.TableMovePoint.Y;else this.TableCurrentMoveValueMin=this.TableVerRulerPoints[i-1].Y+this.TableVerRulerPoints[i-1].H;if(i<_len-1)this.TableCurrentMoveValueMax=this.TableVerRulerPoints[i+1].Y;else this.TableCurrentMoveValueMax=null;bIsTable=true;break}}}}}}}return bIsTable};CMobileTouchManagerBase.prototype.CheckObjectTrack=function(){var pos=this.delegate.ConvertCoordsFromCursor(global_mouseEvent.X,global_mouseEvent.Y); global_mouseEvent.KoefPixToMM=5;if(this.delegate.GetObjectTrack(pos.X,pos.Y,pos.Page,true))this.Mode=AscCommon.MobileTouchMode.FlowObj;else this.Mode=AscCommon.MobileTouchMode.None;global_mouseEvent.KoefPixToMM=1;return AscCommon.MobileTouchMode.FlowObj==this.Mode};CMobileTouchManagerBase.prototype.CheckObjectTrackBefore=function(){var pos=this.delegate.ConvertCoordsFromCursor(global_mouseEvent.X,global_mouseEvent.Y);global_mouseEvent.KoefPixToMM=5;var bResult=this.delegate.GetObjectTrack(pos.X,pos.Y, pos.Page,false);global_mouseEvent.KoefPixToMM=1;return bResult};CMobileTouchManagerBase.prototype.CheckObjectText=function(){var pos=this.delegate.ConvertCoordsFromCursor(global_mouseEvent.X,global_mouseEvent.Y);global_mouseEvent.KoefPixToMM=5;var bResult=this.delegate.GetObjectTrack(pos.X,pos.Y,pos.Page,false,true);global_mouseEvent.KoefPixToMM=1;return bResult};CMobileTouchManagerBase.prototype.CheckZoomCriticalValues=function(zoomMin){if(zoomMin!==undefined){this.ZoomValueMin=zoomMin;return}var _new_value= this.delegate.GetZoomFit();this.ZoomValueMin=_new_value;if(this.ZoomValue1?true:false)},500)};CMobileTouchManagerBase.prototype.CheckContextMenuTouchEndOld=function(isCheck,isSelectTouch,isGlassTouch,isTableRuler){if(isCheck){var _mode=this.delegate.GetContextMenuType();if(_mode==this.ContextMenuLastMode){this.ContextMenuLastModeCounter++;this.ContextMenuLastModeCounter&=1}else this.ContextMenuLastModeCounter=0;this.ContextMenuLastMode=_mode}if(this.ContextMenuLastMode>AscCommon.MobileTouchContextMenuType.None&&1==this.ContextMenuLastModeCounter)this.SendShowContextMenu()}; CMobileTouchManagerBase.prototype.CheckContextMenuTouchEnd=function(isCheck,isSelectTouch,isGlassTouch,isTableRuler){var isShowContextMenu=false;var isSelectCell=false;if(isCheck){var oldLastInfo=new AscCommon.MobileTouchContextMenuLastInfo;this.ContextMenuLastInfo.CopyTo(oldLastInfo);var oldLasdMode=this.ContextMenuLastMode;this.ContextMenuLastMode=this.delegate.GetContextMenuType();this.delegate.GetContextMenuInfo(this.ContextMenuLastInfo);isSelectCell=this.ContextMenuLastInfo.selectCell!=null; var _data1=null;var _data2=null;if(this.ContextMenuLastMode==oldLasdMode){var isEqual=false;switch(this.ContextMenuLastMode){case AscCommon.MobileTouchContextMenuType.Target:{_data1=this.ContextMenuLastInfo.targetPos;_data2=oldLastInfo.targetPos;if(_data1&&_data2)if(_data1.Page==_data1.Page&&Math.abs(_data1.X-_data2.X)<10&&Math.abs(_data1.Y-_data2.Y)<10)isEqual=true;break}case AscCommon.MobileTouchContextMenuType.Select:{_data1=this.ContextMenuLastInfo.selectText;_data2=oldLastInfo.selectText;if(_data1&& _data2){if(_data1.Page1==_data2.Page1&&_data1.Page2==_data2.Page2&&Math.abs(_data1.X1-_data2.X1)<.1&&Math.abs(_data1.Y1-_data2.Y1)<.1&&Math.abs(_data1.X2-_data2.X2)<.1&&Math.abs(_data1.Y2-_data2.Y2)<.1)isEqual=true}else{_data1=this.ContextMenuLastInfo.selectCell;_data2=oldLastInfo.selectCell;if(_data1&&_data2)if(Math.abs(_data1.X-_data2.X)<.1&&Math.abs(_data1.Y-_data2.Y)<.1&&Math.abs(_data1.W-_data2.W)<.1&&Math.abs(_data1.H-_data2.H)<.1)isEqual=true}break}case AscCommon.MobileTouchContextMenuType.Object:{_data1= this.ContextMenuLastInfo.objectBounds;_data2=oldLastInfo.objectBounds;if(_data1&&_data2)if(_data1.Page==_data2.Page&&Math.abs(_data1.X-_data2.X)<.1&&Math.abs(_data1.Y-_data2.Y)<.1&&Math.abs(_data1.R-_data2.R)<.1&&Math.abs(_data1.B-_data2.B)<.1)isEqual=true;break}case AscCommon.MobileTouchContextMenuType.Slide:{_data1=this.ContextMenuLastInfo.objectSlideThumbnail;_data2=oldLastInfo.objectSlideThumbnail;if(_data1&&_data2){if(_data1.Slide==_data2.Slide)isEqual=true}else isEqual=true;break}default:break}}if(isTableRuler)isEqual= false;if(this.ContextMenuLastMode==oldLasdMode&&isEqual){this.ContextMenuLastModeCounter++;this.ContextMenuLastModeCounter&=1}else this.ContextMenuLastModeCounter=0;switch(this.ContextMenuLastMode){case AscCommon.MobileTouchContextMenuType.Target:{isShowContextMenu=1==this.ContextMenuLastModeCounter;break}case AscCommon.MobileTouchContextMenuType.Select:{if(isSelectCell)isShowContextMenu=1==this.ContextMenuLastModeCounter;else isShowContextMenu=true;break}case AscCommon.MobileTouchContextMenuType.Object:{isShowContextMenu= 0==this.ContextMenuLastModeCounter;break}case AscCommon.MobileTouchContextMenuType.Slide:{isShowContextMenu=1==this.ContextMenuLastModeCounter;break}default:{isShowContextMenu=1==this.ContextMenuLastModeCounter;break}}}else{isSelectCell=this.ContextMenuLastInfo&&this.ContextMenuLastInfo.selectCell!=null?true:false;isShowContextMenu=!isSelectCell&&this.ContextMenuLastMode==AscCommon.MobileTouchContextMenuType.Select;if(this.ContextMenuLastShow||isTableRuler)switch(this.ContextMenuLastMode){case AscCommon.MobileTouchContextMenuType.Target:case AscCommon.MobileTouchContextMenuType.Select:{this.ContextMenuLastModeCounter= 0;break}case AscCommon.MobileTouchContextMenuType.Object:{this.ContextMenuLastModeCounter=1;break}case AscCommon.MobileTouchContextMenuType.Slide:{this.ContextMenuLastModeCounter=0;break}default:{break}}}if(isSelectTouch)isShowContextMenu=true;if(isGlassTouch)isShowContextMenu=true;if(this.ContextMenuLastMode>AscCommon.MobileTouchContextMenuType.None&&isShowContextMenu){this.ContextMenuLastShow=true;this.SendShowContextMenu()}else this.ContextMenuLastShow=false};CMobileTouchManagerBase.prototype.ClearContextMenu= function(){if(this.ContextMenuShowTimerId!=-1)clearTimeout(this.ContextMenuShowTimerId);this.isShowingContextMenu=false;this.Api.sendEvent("asc_onHidePopMenu")};CMobileTouchManagerBase.prototype.OnScrollAnimationEnd=function(){if(this.Api.isViewMode)return;this.CheckContextMenuTouchEnd(false)};CMobileTouchManagerBase.prototype.CheckSelectRects=function(){this.RectSelect1=null;this.RectSelect2=null;var _select=this.delegate.GetSelectionRectsBounds();if(!_select)return;this.RectSelectType=_select.Type=== undefined?0:_select.Type;var _rect1=_select.Start;var _rect2=_select.End;if(!_rect1||!_rect2)return;if(0==_rect1.W&&0==_rect1.H&&_rect2.W==0&&_rect2.H==0)return;this.RectSelect1=new AscCommon._rect;this.RectSelect1.x=_rect1.X;this.RectSelect1.y=_rect1.Y;this.RectSelect1.w=_rect1.W;this.RectSelect1.h=_rect1.H;this.PageSelect1=_rect1.Page;this.RectSelect2=new AscCommon._rect;this.RectSelect2.x=_rect2.X;this.RectSelect2.y=_rect2.Y;this.RectSelect2.w=_rect2.W;this.RectSelect2.h=_rect2.H;this.PageSelect2= _rect2.Page};CMobileTouchManagerBase.prototype.CheckSelect=function(overlay){if(!this.SelectEnabled)return;this.CheckSelectRects();if(null==this.RectSelect1||null==this.RectSelect2)return;var _matrix=this.delegate.GetSelectionTransform();var ctx=overlay.m_oContext;ctx.strokeStyle="#146FE1";ctx.fillStyle="#146FE1";var rPR=AscCommon.AscBrowser.retinaPixelRatio;var _oldGlobalAlpha=ctx.globalAlpha;ctx.globalAlpha=1;if(!_matrix||global_MatrixTransformer.IsIdentity(_matrix)){var pos1=this.delegate.ConvertCoordsToCursor(this.RectSelect1.x, this.RectSelect1.y,this.PageSelect1,false);var pos2=this.delegate.ConvertCoordsToCursor(this.RectSelect1.x,this.RectSelect1.y+this.RectSelect1.h,this.PageSelect1,false);var pos3=this.delegate.ConvertCoordsToCursor(this.RectSelect2.x+this.RectSelect2.w,this.RectSelect2.y,this.PageSelect2,false);var pos4=this.delegate.ConvertCoordsToCursor(this.RectSelect2.x+this.RectSelect2.w,this.RectSelect2.y+this.RectSelect2.h,this.PageSelect2,false);ctx.beginPath();ctx.moveTo(rPR*pos1.X>>0,rPR*pos1.Y>>0);ctx.lineTo(rPR* pos2.X>>0,rPR*pos2.Y>>0);ctx.moveTo(rPR*pos3.X>>0,rPR*pos3.Y>>0);ctx.lineTo(rPR*pos4.X>>0,rPR*pos4.Y>>0);ctx.lineWidth=2;ctx.stroke();ctx.beginPath();overlay.AddEllipse(rPR*pos1.X,rPR*(pos1.Y-5),rPR*AscCommon.MOBILE_SELECT_TRACK_ROUND/2);overlay.AddEllipse(rPR*pos4.X,rPR*(pos4.Y+5),rPR*AscCommon.MOBILE_SELECT_TRACK_ROUND/2);ctx.fill();ctx.beginPath()}else{var _xx11=_matrix.TransformPointX(this.RectSelect1.x,this.RectSelect1.y);var _yy11=_matrix.TransformPointY(this.RectSelect1.x,this.RectSelect1.y); var _xx12=_matrix.TransformPointX(this.RectSelect1.x,this.RectSelect1.y+this.RectSelect1.h);var _yy12=_matrix.TransformPointY(this.RectSelect1.x,this.RectSelect1.y+this.RectSelect1.h);var _xx21=_matrix.TransformPointX(this.RectSelect2.x+this.RectSelect2.w,this.RectSelect2.y);var _yy21=_matrix.TransformPointY(this.RectSelect2.x+this.RectSelect2.w,this.RectSelect2.y);var _xx22=_matrix.TransformPointX(this.RectSelect2.x+this.RectSelect2.w,this.RectSelect2.y+this.RectSelect2.h);var _yy22=_matrix.TransformPointY(this.RectSelect2.x+ this.RectSelect2.w,this.RectSelect2.y+this.RectSelect2.h);var pos1=this.delegate.ConvertCoordsToCursor(_xx11,_yy11,this.PageSelect1,false);var pos2=this.delegate.ConvertCoordsToCursor(_xx12,_yy12,this.PageSelect1,false);var pos3=this.delegate.ConvertCoordsToCursor(_xx21,_yy21,this.PageSelect2,false);var pos4=this.delegate.ConvertCoordsToCursor(_xx22,_yy22,this.PageSelect2,false);ctx.beginPath();ctx.moveTo(rPR*pos1.X,rPR*pos1.Y);ctx.lineTo(rPR*pos2.X,rPR*pos2.Y);ctx.moveTo(rPR*pos3.X,rPR*pos3.Y);ctx.lineTo(rPR* pos4.X,rPR*pos4.Y);ctx.lineWidth=2;ctx.stroke();ctx.beginPath();var ex01=_matrix.TransformPointX(0,0);var ey01=_matrix.TransformPointY(0,0);var ex11=_matrix.TransformPointX(0,1);var ey11=_matrix.TransformPointY(0,1);var _len=Math.sqrt((ex11-ex01)*(ex11-ex01)+(ey11-ey01)*(ey11-ey01));if(_len==0)_len=.01;var ex=5*(ex11-ex01)/_len;var ey=5*(ey11-ey01)/_len;var _x1=pos1.X-ex>>0;var _y1=pos1.Y-ey>>0;var _x2=pos4.X+ex>>0;var _y2=pos4.Y+ey>>0;overlay.AddEllipse(rPR*_x1,rPR*_y1,rPR*AscCommon.MOBILE_SELECT_TRACK_ROUND/ 2);overlay.AddEllipse(rPR*_x2,rPR*_y2,rPR*AscCommon.MOBILE_SELECT_TRACK_ROUND/2);ctx.fill();ctx.beginPath()}ctx.globalAlpha=_oldGlobalAlpha};CMobileTouchManagerBase.prototype.CheckTableRules=function(overlay){if(this.Api.isViewMode||!this.TableTrackEnabled)return;var HtmlPage=this.delegate.HtmlPage;var DrawingDocument=this.delegate.DrawingDocument;var rPR=AscCommon.AscBrowser.retinaPixelRatio;var horRuler=HtmlPage.m_oHorRuler;var verRuler=HtmlPage.m_oVerRuler;var _table_outline_dr=this.delegate.GetTableDrawing(); var _tableOutline=_table_outline_dr.TableOutline;if(horRuler.CurrentObjectType!=RULER_OBJECT_TYPE_TABLE||verRuler.CurrentObjectType!=RULER_OBJECT_TYPE_TABLE||!_tableOutline){this.TableMovePoint=null;this.TableHorRulerPoints=null;this.TableVerRulerPoints=null;return}var _table_markup=horRuler.m_oTableMarkup;if(_table_markup.Rows.length==0)return;HtmlPage.CheckShowOverlay();var _epsRects=this.TableRulersRectOffset;var _rectWidth=this.TableRulersRectSize;var ctx=overlay.m_oContext;ctx.strokeStyle="#616161"; ctx.lineWidth=1;var _tableW=0;var _cols=_table_markup.Cols;for(var i=0;i<_cols.length;i++)_tableW+=_cols[i];var _mainFillStyle="rgba(223, 223, 223, 0.5)";var _drawingPage=null;if(DrawingDocument.m_arrPages)_drawingPage=DrawingDocument.m_arrPages[DrawingDocument.m_lCurrentPage].drawingPage;else _drawingPage=DrawingDocument.SlideCurrectRect;var _posMoveX=0;var _posMoveY=0;var _PageNum=_table_outline_dr.CurrentPageIndex;var _lineW=Math.round(rPR);var _pixelNet=_lineW/2;if(!_table_outline_dr.TableMatrix|| global_MatrixTransformer.IsIdentity(_table_outline_dr.TableMatrix)){this.TableMovePoint={X:_tableOutline.X,Y:_tableOutline.Y};var pos1=DrawingDocument.ConvertCoordsToCursorWR(_tableOutline.X,_tableOutline.Y,_tableOutline.PageNum);var pos2=DrawingDocument.ConvertCoordsToCursorWR(_tableOutline.X+_tableW,_tableOutline.Y,_tableOutline.PageNum);ctx.beginPath();var TableMoveRect_x=(pos1.X>>0)+.5-(_epsRects+_rectWidth);var TableMoveRect_y=(pos1.Y>>0)+.5-(_epsRects+_rectWidth);overlay.CheckPoint(TableMoveRect_x, TableMoveRect_y);overlay.CheckPoint(TableMoveRect_x+_rectWidth,TableMoveRect_y+_rectWidth);ctx.lineWidth=_lineW;overlay.AddRoundRect(Math.round(pos1.X*rPR)+_pixelNet,Math.round(TableMoveRect_y*rPR)-_pixelNet,Math.round((pos2.X-pos1.X)*rPR),Math.round(_rectWidth*rPR),Math.round(4*rPR));ctx.fillStyle=_mainFillStyle;ctx.fill();ctx.stroke();ctx.beginPath();var _count=_table_markup.Rows.length;var _y1=0;var _y2=0;for(var i=0;i<_count;i++){if(i==0)_y1=_table_markup.Rows[i].Y;_y2=_table_markup.Rows[i].Y; _y2+=_table_markup.Rows[i].H}var pos3=DrawingDocument.ConvertCoordsToCursorWR(_tableOutline.X,_y1,DrawingDocument.m_lCurrentPage);var pos4=DrawingDocument.ConvertCoordsToCursorWR(_tableOutline.X,_y2,DrawingDocument.m_lCurrentPage);if(this.delegate.Name!="slide"){var moveX=Math.round(pos1.X*rPR)+1+_pixelNet-Math.round((_epsRects+_rectWidth)*rPR);var moveY=Math.round(TableMoveRect_y*rPR)-_pixelNet;var moveW=Math.round(_rectWidth*rPR);var moveH=Math.round(_rectWidth*rPR);overlay.AddRoundRect(moveX,moveY, moveW,moveH,Math.round(4*rPR));ctx.fill();ctx.stroke();ctx.beginPath();var offsetMove=2;var cellMoveX=moveX-_pixelNet;var cellMoveY=moveY-_pixelNet;var cellMoveW=moveW+2*_pixelNet;var cellMoveH=moveH+2*_pixelNet;var moveX2=cellMoveX+cellMoveW/2;var moveY2=cellMoveY+cellMoveH/2;var dist_moveX4=cellMoveW/4+offsetMove/2>>0;var dist_moveY4=cellMoveH/4+offsetMove/2>>0;var offset_distY4_NotCeil=cellMoveH/2-dist_moveX4+offsetMove;var offset_distX4_NotCeil=cellMoveW/2-dist_moveY4+offsetMove;ctx.moveTo(cellMoveX+ offsetMove,moveY2);ctx.lineTo(cellMoveX+dist_moveX4,cellMoveY+offset_distY4_NotCeil);ctx.lineTo(cellMoveX+dist_moveX4,cellMoveY+cellMoveH-offset_distY4_NotCeil);ctx.closePath();ctx.moveTo(moveX2,cellMoveY+offsetMove);ctx.lineTo(cellMoveX+offset_distX4_NotCeil,cellMoveY+dist_moveY4);ctx.lineTo(cellMoveX+cellMoveW-offset_distX4_NotCeil,cellMoveY+dist_moveY4);ctx.closePath();ctx.moveTo(cellMoveX+cellMoveW-offsetMove,moveY2);ctx.lineTo(cellMoveX+cellMoveW-dist_moveX4,cellMoveY+offset_distY4_NotCeil); ctx.lineTo(cellMoveX+cellMoveW-dist_moveX4,cellMoveY+cellMoveH-offset_distY4_NotCeil);ctx.closePath();ctx.moveTo(moveX2,cellMoveY+cellMoveH-offsetMove);ctx.lineTo(cellMoveX+offset_distX4_NotCeil,cellMoveY+cellMoveH-dist_moveY4);ctx.lineTo(cellMoveX+cellMoveW-offset_distX4_NotCeil,cellMoveY+cellMoveH-dist_moveY4);ctx.closePath();ctx.fillStyle="#146FE1";ctx.fill();ctx.beginPath()}ctx.fillStyle=_mainFillStyle;overlay.AddRoundRect(Math.round(pos1.X*rPR)+1+_pixelNet-Math.round((_epsRects+_rectWidth)*rPR), Math.round(pos3.Y*rPR)+_pixelNet,Math.round((_rectWidth-1)*rPR),Math.round((pos4.Y-pos3.Y)*rPR),Math.round(4*rPR));ctx.fill();ctx.stroke();ctx.beginPath();var dKoef=HtmlPage.m_nZoomValue*AscCommon.g_dKoef_mm_to_pix/100;var xDst=_drawingPage.left;var yDst=_drawingPage.top;var _oldY=_table_markup.Rows[0].Y+_table_markup.Rows[0].H;this.TableVerRulerPoints=[];var _rectIndex=0;var _x=pos1.X-_epsRects-_rectWidth>>0;ctx.fillStyle="#146FE1";for(var i=1;i<=_count;i++){var _newPos=i!=_count?_table_markup.Rows[i].Y: _oldY;var _p={Y:_oldY,H:_newPos-_oldY};var _y=DrawingDocument.ConvertCoordsToCursorWR(0,_oldY,_PageNum);ctx.beginPath();overlay.AddDiamond(Math.round(_x*rPR)+1.5+Math.round(Math.round(_rectWidth*rPR)/2),Math.round(_y.Y*rPR),Math.round(AscCommon.MOBILE_TABLE_RULER_DIAMOND*rPR));ctx.fill();ctx.beginPath();this.TableVerRulerPoints[_rectIndex++]=_p;if(i!=_count)_oldY=_table_markup.Rows[i].Y+_table_markup.Rows[i].H}this.TableHorRulerPoints=[];_rectIndex=0;var _col=_table_markup.X;for(var i=1;i<=_cols.length;i++){_col+= _cols[i-1];var _x=_col-_table_markup.Margins[i-1].Right;var _r=_col+(i==_cols.length?0:_table_markup.Margins[i].Left);var __c=xDst+dKoef*_col>>0;ctx.beginPath();overlay.AddDiamond(Math.round(__c*rPR)+.5,Math.round(TableMoveRect_y*rPR)+Math.round(_rectWidth*rPR/2),Math.round(AscCommon.MOBILE_TABLE_RULER_DIAMOND*rPR));ctx.fill();ctx.beginPath();this.TableHorRulerPoints[_rectIndex++]={X:_x,W:_r-_x,C:_col}}ctx.beginPath();if(this.Mode==AscCommon.MobileTouchMode.TableRuler)if(0==this.TableCurrentMoveDir){var _pos= this.delegate.ConvertCoordsToCursor(this.TableCurrentMoveValue,0,_table_outline_dr.CurrentPageIndex,false);overlay.VertLine(_pos.X,true)}else{var _pos=this.delegate.ConvertCoordsToCursor(0,this.TableCurrentMoveValue,_table_outline_dr.CurrentPageIndex,false);overlay.HorLine(_pos.Y,true)}}else{var dKoef=HtmlPage.m_nZoomValue*AscCommon.g_dKoef_mm_to_pix/100;var xDst=_drawingPage.left;var yDst=_drawingPage.top;ctx.lineWidth=1/dKoef;dKoef*=AscCommon.AscBrowser.retinaPixelRatio;var _coord_transform=new AscCommon.CMatrix; _coord_transform.sx=dKoef;_coord_transform.sy=dKoef;_coord_transform.tx=xDst;_coord_transform.ty=yDst;var _diamond_size=AscCommon.MOBILE_TABLE_RULER_DIAMOND;_coord_transform.tx*=AscCommon.AscBrowser.retinaPixelRatio;_coord_transform.ty*=AscCommon.AscBrowser.retinaPixelRatio;_diamond_size*=AscCommon.AscBrowser.retinaPixelRatio;ctx.save();_coord_transform.Multiply(_table_outline_dr.TableMatrix,AscCommon.MATRIX_ORDER_PREPEND);ctx.setTransform(_coord_transform.sx,_coord_transform.shy,_coord_transform.shx, _coord_transform.sy,_coord_transform.tx,_coord_transform.ty);this.TableMovePoint={X:_tableOutline.X,Y:_tableOutline.Y};ctx.beginPath();var _rectW=_rectWidth/dKoef;var _offset=(_epsRects+_rectWidth)/dKoef;_rectW*=AscCommon.AscBrowser.retinaPixelRatio;_offset*=AscCommon.AscBrowser.retinaPixelRatio;if(this.delegate.Name!="slide"){var moveX=this.TableMovePoint.X-_offset;var moveY=this.TableMovePoint.Y-_offset;var moveW=_rectW;var moveH=_rectW;ctx.fillStyle=_mainFillStyle;overlay.AddRoundRectCtx(ctx,moveX, moveY,moveW,moveH,5/dKoef);ctx.fill();ctx.stroke();ctx.beginPath();var offsetMove=2/dKoef;var cellMoveX=moveX;var cellMoveY=moveY;var cellMoveW=moveW;var cellMoveH=moveH;var moveX2=cellMoveX+cellMoveW/2;var moveY2=cellMoveY+cellMoveH/2;var dist_moveX4=cellMoveW/4+offsetMove/2;var dist_moveY4=cellMoveH/4+offsetMove/2;var offset_distY4_NotCeil=cellMoveH/2-dist_moveX4+offsetMove;var offset_distX4_NotCeil=cellMoveW/2-dist_moveY4+offsetMove;ctx.moveTo(cellMoveX+offsetMove,moveY2);ctx.lineTo(cellMoveX+ dist_moveX4,cellMoveY+offset_distY4_NotCeil);ctx.lineTo(cellMoveX+dist_moveX4,cellMoveY+cellMoveH-offset_distY4_NotCeil);ctx.closePath();ctx.moveTo(moveX2,cellMoveY+offsetMove);ctx.lineTo(cellMoveX+offset_distX4_NotCeil,cellMoveY+dist_moveY4);ctx.lineTo(cellMoveX+cellMoveW-offset_distX4_NotCeil,cellMoveY+dist_moveY4);ctx.closePath();ctx.moveTo(cellMoveX+cellMoveW-offsetMove,moveY2);ctx.lineTo(cellMoveX+cellMoveW-dist_moveX4,cellMoveY+offset_distY4_NotCeil);ctx.lineTo(cellMoveX+cellMoveW-dist_moveX4, cellMoveY+cellMoveH-offset_distY4_NotCeil);ctx.closePath();ctx.moveTo(moveX2,cellMoveY+cellMoveH-offsetMove);ctx.lineTo(cellMoveX+offset_distX4_NotCeil,cellMoveY+cellMoveH-dist_moveY4);ctx.lineTo(cellMoveX+cellMoveW-offset_distX4_NotCeil,cellMoveY+cellMoveH-dist_moveY4);ctx.closePath();ctx.fillStyle="#146FE1";ctx.fill();ctx.beginPath()}ctx.fillStyle=_mainFillStyle;overlay.AddRoundRectCtx(ctx,this.TableMovePoint.X,this.TableMovePoint.Y-_offset,_tableW,_rectW,5/dKoef);ctx.fill();ctx.stroke();ctx.beginPath(); var _count=_table_markup.Rows.length;var _y1=0;var _y2=0;for(var i=0;i<_count;i++){if(i==0)_y1=_table_markup.Rows[i].Y;_y2=_table_markup.Rows[i].Y;_y2+=_table_markup.Rows[i].H}ctx.fillStyle=_mainFillStyle;overlay.AddRoundRectCtx(ctx,this.TableMovePoint.X-_offset,this.TableMovePoint.Y,_rectW,_y2-_y1,5/dKoef);overlay.CheckRectT(this.TableMovePoint.X,this.TableMovePoint.Y,_tableW,_y2-_y1,_coord_transform,2*(_epsRects+_rectWidth));ctx.fill();ctx.stroke();ctx.beginPath();var _oldY=_table_markup.Rows[0].Y+ _table_markup.Rows[0].H;_oldY-=_table_outline_dr.TableMatrix.ty;ctx.fillStyle="#146FE1";this.TableVerRulerPoints=[];var _rectIndex=0;var _xx=this.TableMovePoint.X-_offset;for(var i=1;i<=_count;i++){var _newPos=i!=_count?_table_markup.Rows[i].Y-_table_outline_dr.TableMatrix.ty:_oldY;var _p={Y:_oldY,H:_newPos-_oldY};var ___y=_p.Y+_p.H/2;ctx.beginPath();overlay.AddDiamond(_xx+_rectW/2,___y,_diamond_size/dKoef);ctx.fill();ctx.beginPath();this.TableVerRulerPoints[_rectIndex++]=_p;if(i!=_count){_oldY=_table_markup.Rows[i].Y+ _table_markup.Rows[i].H;_oldY-=_table_outline_dr.TableMatrix.ty}}this.TableHorRulerPoints=[];_rectIndex=0;var _col=this.TableMovePoint.X;for(var i=1;i<=_cols.length;i++){_col+=_cols[i-1];var _x=_col-_table_markup.Margins[i-1].Right;var _r=_col+(i==_cols.length?0:_table_markup.Margins[i].Left);ctx.beginPath();overlay.AddDiamond(_col,this.TableMovePoint.Y-_offset+_rectW/2,_diamond_size/dKoef);ctx.fill();ctx.beginPath();this.TableHorRulerPoints[_rectIndex++]={X:_x,W:_r-_x,C:_col}}ctx.restore();ctx.beginPath(); if(this.Mode==AscCommon.MobileTouchMode.TableRuler)if(0==this.TableCurrentMoveDir){_posMoveX=_table_outline_dr.TableMatrix.TransformPointX(this.TableCurrentMoveValue,0);_posMoveY=_table_outline_dr.TableMatrix.TransformPointY(this.TableCurrentMoveValue,0);var _pos=this.delegate.ConvertCoordsToCursor(_posMoveX,_posMoveY,_table_outline_dr.CurrentPageIndex,false);overlay.VertLine(_pos.X,true)}else{_posMoveX=_table_outline_dr.TableMatrix.TransformPointX(0,this.TableCurrentMoveValue);_posMoveY=_table_outline_dr.TableMatrix.TransformPointY(0, this.TableCurrentMoveValue);var _pos=this.delegate.ConvertCoordsToCursor(_posMoveX,_posMoveY,_table_outline_dr.CurrentPageIndex,false);overlay.HorLine(_pos.Y,true)}}};CMobileTouchManagerBase.prototype.onTouchStart_renderer=function(e){AscCommon.check_MouseDownEvent(e.touches?e.touches[0]:e,true);global_mouseEvent.LockMouse();this.MoveAfterDown=false;if(e.touches&&2==e.touches.length||2==this.getPointerCount())this.Mode=AscCommon.MobileTouchMode.Zoom;switch(this.Mode){case AscCommon.MobileTouchMode.None:{this.Mode= AscCommon.MobileTouchMode.Scroll;this.DownPoint=this.delegate.ConvertCoordsFromCursor(global_mouseEvent.X,global_mouseEvent.Y);this.DownPointOriginal.X=global_mouseEvent.X;this.DownPointOriginal.Y=global_mouseEvent.Y;this.iScroll._start(e);break}case AscCommon.MobileTouchMode.Scroll:{this.DownPoint=this.delegate.ConvertCoordsFromCursor(global_mouseEvent.X,global_mouseEvent.Y);this.DownPointOriginal.X=global_mouseEvent.X;this.DownPointOriginal.Y=global_mouseEvent.Y;this.iScroll._start(e);break}case AscCommon.MobileTouchMode.Zoom:{this.delegate.HtmlPage.NoneRepaintPages= true;this.ZoomDistance=this.getPointerDistance(e);this.ZoomValue=this.delegate.GetZoom();break}}AscCommon.stopEvent(e);return false};CMobileTouchManagerBase.prototype.onTouchMove_renderer=function(e){AscCommon.check_MouseMoveEvent(e.touches?e.touches[0]:e);if(!this.MoveAfterDown)if(Math.abs(this.DownPointOriginal.X-global_mouseEvent.X)>this.MoveMinDist||Math.abs(this.DownPointOriginal.Y-global_mouseEvent.Y)>this.MoveMinDist)this.MoveAfterDown=true;switch(this.Mode){case AscCommon.MobileTouchMode.Scroll:{var _offsetX= global_mouseEvent.X-this.DownPointOriginal.X;var _offsetY=global_mouseEvent.Y-this.DownPointOriginal.Y;this.iScroll._move(e);break}case AscCommon.MobileTouchMode.Zoom:{var isTouch2=e.touches&&2==e.touches.length||2==this.getPointerCount();if(!isTouch2){this.Mode=AscCommon.MobileTouchMode.None;return}var zoomCurrentDist=this.getPointerDistance(e);if(zoomCurrentDist==0)zoomCurrentDist=1;var _zoomFix=this.ZoomValue/100;var _zoomCur=_zoomFix*(zoomCurrentDist/this.ZoomDistance);_zoomCur=_zoomCur*100>> 0;if(_zoomCurthis.ZoomValueMax)_zoomCur=this.ZoomValueMax;this.delegate.SetZoom(_zoomCur);break}default:break}AscCommon.stopEvent(e);return false};CMobileTouchManagerBase.prototype.onTouchEnd_renderer=function(e){AscCommon.check_MouseUpEvent(e.changedTouches?e.changedTouches[0]:e);switch(this.Mode){case AscCommon.MobileTouchMode.Scroll:{this.iScroll._end(e);this.Mode=AscCommon.MobileTouchMode.None;if(!this.MoveAfterDown)this.Api.sendEvent("asc_onTapEvent", e);break}case AscCommon.MobileTouchMode.Zoom:{this.delegate.HtmlPage.NoneRepaintPages=false;this.delegate.HtmlPage.m_bIsFullRepaint=true;this.delegate.HtmlPage.OnScroll();this.Mode=AscCommon.MobileTouchMode.None;break}default:break}if(!AscCommon.AscBrowser.isAndroid)AscCommon.stopEvent(e);return false};CMobileTouchManagerBase.prototype.MoveCursorToPoint=function(isHalfHeight){var pos=this.delegate.ConvertCoordsFromCursor(global_mouseEvent.X,global_mouseEvent.Y);var old_click_count=global_mouseEvent.ClickCount; global_mouseEvent.ClickCount=1;var nearPos=this.delegate.Logic_GetNearestPos(pos.X,pos.Y,pos.Page);if(!nearPos)return;this.delegate.DrawingDocument.NeedScrollToTargetFlag=true;var y=nearPos.Y;nearPos.Paragraph.Parent.MoveCursorToNearestPos(nearPos);this.delegate.LogicDocument.Document_UpdateSelectionState();this.delegate.DrawingDocument.NeedScrollToTargetFlag=false;global_mouseEvent.ClickCount=old_click_count};CMobileTouchManagerBase.prototype.onTouchStart=function(e){AscCommon.stopEvent(e);return false}; CMobileTouchManagerBase.prototype.onTouchMove=function(e){AscCommon.stopEvent(e);return false};CMobileTouchManagerBase.prototype.onTouchEnd=function(e){AscCommon.stopEvent(e);return false};CMobileTouchManagerBase.prototype.mainOnTouchStart=function(e){AscCommon.stopEvent(e);return false};CMobileTouchManagerBase.prototype.mainOnTouchMove=function(e){AscCommon.stopEvent(e);return false};CMobileTouchManagerBase.prototype.mainOnTouchEnd=function(e){AscCommon.stopEvent(e);return false};CMobileTouchManagerBase.prototype.checkPointerMultiTouchAdd= function(e){if(!this.checkPointerEvent(e))return;this.pointerTouchesCoords[e["pointerId"]]={X:e.pageX,Y:e.pageY}};CMobileTouchManagerBase.prototype.checkPointerMultiTouchRemove=function(e){if(!this.checkPointerEvent(e))return;this.pointerTouchesCoords={}};CMobileTouchManagerBase.prototype.checkPointerEvent=function(e){var _type=e.type;if(_type.toLowerCase)_type=_type.toLowerCase();if(-1==_type.indexOf("pointer"))return false;if(undefined==e["pointerId"])return false;return true};CMobileTouchManagerBase.prototype.getPointerDistance= function(e){var isPointers=this.checkPointerEvent(e);if(e.touches&&e.touches.length>1&&!isPointers){var _x1=e.touches[0].pageX!==undefined?e.touches[0].pageX:e.touches[0].clientX;var _y1=e.touches[0].pageY!==undefined?e.touches[0].pageY:e.touches[0].clientY;var _x2=e.touches[1].pageX!==undefined?e.touches[1].pageX:e.touches[1].clientX;var _y2=e.touches[1].pageY!==undefined?e.touches[1].pageY:e.touches[1].clientY;return Math.sqrt((_x1-_x2)*(_x1-_x2)+(_y1-_y2)*(_y1-_y2))}else if(isPointers){var _touch1= {X:0,Y:0};var _touch2={X:0,Y:0};var _counter=0;for(var i in this.pointerTouchesCoords){if(_counter==0)_touch1=this.pointerTouchesCoords[i];else _touch2=this.pointerTouchesCoords[i];++_counter;if(_counter>1)break}return Math.sqrt((_touch1.X-_touch2.X)*(_touch1.X-_touch2.X)+(_touch1.Y-_touch2.Y)*(_touch1.Y-_touch2.Y))}return 0};CMobileTouchManagerBase.prototype.getPointerCount=function(e){var _count=0;for(var i in this.pointerTouchesCoords)++_count;return _count};CMobileTouchManagerBase.prototype.showKeyboard= function(){if(AscCommon.g_inputContext)if(this.ContextMenuLastMode==AscCommon.MobileTouchContextMenuType.Target)AscCommon.g_inputContext.HtmlArea.focus()};CMobileTouchManagerBase.prototype.scrollTo=function(x,y){if(this.iScroll){this.iScroll.scrollTo(-x,-y);this.iScroll._execEvent("scroll")}};CMobileTouchManagerBase.prototype.scrollBy=function(x,y){if(this.iScroll){this.iScroll.scrollBy(-x,-y);this.iScroll._execEvent("scroll")}};AscCommon.CMobileDelegateSimple=CMobileDelegateSimple;AscCommon.CMobileTouchManagerBase= CMobileTouchManagerBase;AscCommon.CMobileDelegateEditor=CMobileDelegateEditor})(window);"use strict";(function(window,undefined){var global_MatrixTransformer=AscCommon.global_MatrixTransformer;var g_dKoef_mm_to_pix=AscCommon.g_dKoef_mm_to_pix;var global_mouseEvent=AscCommon.global_mouseEvent;var global_keyboardEvent=AscCommon.global_keyboardEvent;function CMobileTouchManager(_config){this.Name="word";AscCommon.CMobileTouchManagerBase.call(this,_config||{})}CMobileTouchManager.prototype=Object.create(AscCommon.CMobileTouchManagerBase.prototype); CMobileTouchManager.prototype.constructor=CMobileTouchManager;CMobileTouchManager.prototype.Init=function(_api){this.Api=_api;this.delegate=new AscCommon.CMobileDelegateEditor(this);var _element=this.delegate.GetScrollerParent();this.CreateScrollerDiv(_element);this.iScroll=new window.IScrollMobile(_element,{scrollbars:true,mouseWheel:true,interactiveScrollbars:true,shrinkScrollbars:"scale",fadeScrollbars:true,scrollX:true,scroller_id:this.iScrollElement,bounce:false,eventsElement:this.eventsElement, click:false,useLongTap:true});this.delegate.Init();if(this.TableTrackEnabled)this.LoadMobileImages()};CMobileTouchManager.prototype.onTouchStart=function(e){this.IsTouching=true;AscCommon.g_inputContext.enableVirtualKeyboard();this.checkPointerMultiTouchAdd(e);if(this.delegate.IsReader())return this.onTouchStart_renderer(e);global_mouseEvent.KoefPixToMM=5;AscCommon.check_MouseDownEvent(e.touches?e.touches[0]:e,true);global_mouseEvent.KoefPixToMM=1;global_mouseEvent.LockMouse();this.ClearContextMenu(); this.TableCurrentMoveValueMin=null;this.TableCurrentMoveValueMax=null;this.MoveAfterDown=false;this.TimeDown=(new Date).getTime();var bIsKoefPixToMM=false;var _matrix=this.delegate.GetSelectionTransform();if(_matrix&&global_MatrixTransformer.IsIdentity(_matrix))_matrix=null;if(!this.CheckSelectTrack())if(!this.CheckTableTrack())bIsKoefPixToMM=this.CheckObjectTrack();if(e.touches&&2==e.touches.length||2==this.getPointerCount())this.Mode=AscCommon.MobileTouchMode.Zoom;switch(this.Mode){case AscCommon.MobileTouchMode.None:case AscCommon.MobileTouchMode.Scroll:case AscCommon.MobileTouchMode.InlineObj:case AscCommon.MobileTouchMode.FlowObj:case AscCommon.MobileTouchMode.Zoom:case AscCommon.MobileTouchMode.Cursor:case AscCommon.MobileTouchMode.TableMove:{if(global_mouseEvent.ClickCount> 0)global_mouseEvent.ClickCount--;break}default:break}var isPreventDefault=false;switch(this.Mode){case AscCommon.MobileTouchMode.InlineObj:case AscCommon.MobileTouchMode.FlowObj:case AscCommon.MobileTouchMode.Zoom:case AscCommon.MobileTouchMode.TableMove:{isPreventDefault=true;break}case AscCommon.MobileTouchMode.None:case AscCommon.MobileTouchMode.Scroll:{isPreventDefault=this.CheckObjectTrackBefore();break}default:{break}}switch(this.Mode){case AscCommon.MobileTouchMode.None:{this.Mode=AscCommon.MobileTouchMode.Scroll; this.DownPoint=this.delegate.ConvertCoordsFromCursor(global_mouseEvent.X,global_mouseEvent.Y);this.DownPointOriginal.X=global_mouseEvent.X;this.DownPointOriginal.Y=global_mouseEvent.Y;this.iScroll._start(e);break}case AscCommon.MobileTouchMode.Scroll:{this.DownPoint=this.delegate.ConvertCoordsFromCursor(global_mouseEvent.X,global_mouseEvent.Y);this.DownPointOriginal.X=global_mouseEvent.X;this.DownPointOriginal.Y=global_mouseEvent.Y;this.iScroll._start(e);break}case AscCommon.MobileTouchMode.Select:{var _x1= this.RectSelect1.x;var _y1=this.RectSelect1.y+this.RectSelect1.h/2;var _x2=this.RectSelect2.x+this.RectSelect2.w;var _y2=this.RectSelect2.y+this.RectSelect2.h/2;this.delegate.LogicDocument.RemoveSelection();if(1==this.DragSelect){global_mouseEvent.Button=0;if(!_matrix)this.delegate.Logic_OnMouseDown(global_mouseEvent,_x2,_y2,this.PageSelect2);else{var __X=_matrix.TransformPointX(_x2,_y2);var __Y=_matrix.TransformPointY(_x2,_y2);this.delegate.Logic_OnMouseDown(global_mouseEvent,__X,__Y,this.PageSelect2)}var pos1= this.delegate.ConvertCoordsFromCursor(global_mouseEvent.X,global_mouseEvent.Y);this.delegate.Logic_OnMouseMove(global_mouseEvent,pos1.X,pos1.Y,pos1.Page)}else if(2==this.DragSelect){global_mouseEvent.Button=0;if(!_matrix)this.delegate.Logic_OnMouseDown(global_mouseEvent,_x1,_y1,this.PageSelect1);else{var __X=_matrix.TransformPointX(_x1,_y1);var __Y=_matrix.TransformPointY(_x1,_y1);this.delegate.Logic_OnMouseDown(global_mouseEvent,__X,__Y,this.PageSelect1)}var pos4=this.delegate.ConvertCoordsFromCursor(global_mouseEvent.X, global_mouseEvent.Y);this.delegate.Logic_OnMouseMove(global_mouseEvent,pos4.X,pos4.Y,pos4.Page)}break}case AscCommon.MobileTouchMode.InlineObj:{break}case AscCommon.MobileTouchMode.FlowObj:{if(bIsKoefPixToMM)global_mouseEvent.KoefPixToMM=5;this.delegate.Drawing_OnMouseDown(e.touches?e.touches[0]:e);global_mouseEvent.KoefPixToMM=1;break}case AscCommon.MobileTouchMode.Zoom:{this.delegate.HtmlPage.NoneRepaintPages=true;this.ZoomDistance=this.getPointerDistance(e);this.ZoomValue=this.delegate.GetZoom(); break}case AscCommon.MobileTouchMode.Cursor:{this.Mode=AscCommon.MobileTouchMode.Scroll;this.DownPoint=this.delegate.ConvertCoordsFromCursor(global_mouseEvent.X,global_mouseEvent.Y);break}case AscCommon.MobileTouchMode.TableMove:{this.delegate.Drawing_OnMouseDown(e.touches?e.touches[0]:e);break}case AscCommon.MobileTouchMode.TableRuler:{this.delegate.HtmlPage.OnUpdateOverlay();break}}if(AscCommon.AscBrowser.isAndroid&&!AscCommon.AscBrowser.isSailfish)isPreventDefault=false;if(this.Api.isViewMode|| isPreventDefault)AscCommon.stopEvent(e);return false};CMobileTouchManager.prototype.onTouchMove=function(e){this.checkPointerMultiTouchAdd(e);if(this.delegate.IsReader())return this.onTouchMove_renderer(e);if(this.Mode!=AscCommon.MobileTouchMode.FlowObj&&this.Mode!=AscCommon.MobileTouchMode.TableMove)AscCommon.check_MouseMoveEvent(e.touches?e.touches[0]:e);if(!this.MoveAfterDown)if(Math.abs(this.DownPointOriginal.X-global_mouseEvent.X)>this.MoveMinDist||Math.abs(this.DownPointOriginal.Y-global_mouseEvent.Y)> this.MoveMinDist)this.MoveAfterDown=true;switch(this.Mode){case AscCommon.MobileTouchMode.Cursor:{this.MoveCursorToPoint(true);break}case AscCommon.MobileTouchMode.Scroll:{var _newTime=(new Date).getTime();if(_newTime-this.TimeDown>this.ReadingGlassTime&&!this.MoveAfterDown){this.Mode=AscCommon.MobileTouchMode.Cursor;this.MoveCursorToPoint(false)}else{this.iScroll._move(e);AscCommon.stopEvent(e)}break}case AscCommon.MobileTouchMode.Zoom:{var isTouch2=e.touches&&2==e.touches.length||2==this.getPointerCount(); if(!isTouch2){this.Mode=AscCommon.MobileTouchMode.None;return}var zoomCurrentDist=this.getPointerDistance(e);if(zoomCurrentDist==0)zoomCurrentDist=1;var _zoomFix=this.ZoomValue/100;var _zoomCur=_zoomFix*(zoomCurrentDist/this.ZoomDistance);_zoomCur=_zoomCur*100>>0;if(_zoomCurthis.ZoomValueMax)_zoomCur=this.ZoomValueMax;this.delegate.SetZoom(_zoomCur);AscCommon.stopEvent(e);break}case AscCommon.MobileTouchMode.InlineObj:{break}case AscCommon.MobileTouchMode.FlowObj:{this.delegate.Drawing_OnMouseMove(e.touches? e.touches[0]:e);AscCommon.stopEvent(e);break}case AscCommon.MobileTouchMode.Select:{global_mouseEvent.ClickCount=1;var pos=this.delegate.ConvertCoordsFromCursor(global_mouseEvent.X,global_mouseEvent.Y);this.delegate.Logic_OnMouseMove(global_mouseEvent,pos.X,pos.Y,pos.Page);AscCommon.stopEvent(e);break}case AscCommon.MobileTouchMode.TableMove:{this.delegate.Drawing_OnMouseMove(e.touches?e.touches[0]:e);AscCommon.stopEvent(e);break}case AscCommon.MobileTouchMode.TableRuler:{var DrawingDocument=this.delegate.DrawingDocument; var pos=DrawingDocument.ConvertCoordsFromCursorPage(global_mouseEvent.X,global_mouseEvent.Y,DrawingDocument.TableOutlineDr.CurrentPageIndex);var _Transform=null;if(DrawingDocument.TableOutlineDr)_Transform=DrawingDocument.TableOutlineDr.TableMatrix;if(_Transform&&!global_MatrixTransformer.IsIdentity(_Transform)){var _invert=_Transform.CreateDublicate();_invert.Invert();var __x=_invert.TransformPointX(pos.X,pos.Y);var __y=_invert.TransformPointY(pos.X,pos.Y);pos.X=__x;pos.Y=__y}if(this.TableCurrentMoveDir== 0){this.TableCurrentMoveValue=pos.X;if(null!=this.TableCurrentMoveValueMin)if(this.TableCurrentMoveValueMin>this.TableCurrentMoveValue)this.TableCurrentMoveValue=this.TableCurrentMoveValueMin;if(null!=this.TableCurrentMoveValueMax)if(this.TableCurrentMoveValueMaxthis.TableCurrentMoveValue)this.TableCurrentMoveValue= this.TableCurrentMoveValueMin;if(null!=this.TableCurrentMoveValueMax)if(this.TableCurrentMoveValueMaxthis.TableCurrentMoveValue)this.TableCurrentMoveValue= this.TableCurrentMoveValueMin;if(null!=this.TableCurrentMoveValueMax)if(this.TableCurrentMoveValueMaxthis.TableCurrentMoveValue)this.TableCurrentMoveValue=this.TableCurrentMoveValueMin;if(null!=this.TableCurrentMoveValueMax)if(this.TableCurrentMoveValueMax>0;dRes/=100;return""+dRes+"em"}}function GetObjectsForImageDownload(aBuilderImages, bSameDoc){var oMapImages={},aBuilderImagesByUrl=[],aUrls=[];for(var i=0;i0&&this.aChildren[this.aChildren.length- 1].bText)this.aChildren[this.aChildren.length-1].sName+=child.sName;else this.aChildren.push(child)};CopyElement.prototype.wrapChild=function(child){for(var i=0;i0)sRes+=">"+sInner+"";else sRes+="/>";return sRes}};function CopyProcessor(api, onlyBinaryCopy){this.api=api;this.oDocument=api.WordControl.m_oLogicDocument;this.onlyBinaryCopy=onlyBinaryCopy;this.oBinaryFileWriter=new AscCommonWord.BinaryFileWriter(this.oDocument);this.oPresentationWriter=new AscCommon.CBinaryFileWriter;this.oPresentationWriter.Start_UseFullUrl();if(this.api.ThemeLoader)this.oPresentationWriter.Start_UseDocumentOrigin(this.api.ThemeLoader.ThemesUrlAbs);this.aFootnoteReference=[];this.oRoot=new CopyElement("root");this.listNextNumMap=[];this.instructionHyperlinkStart= null}CopyProcessor.prototype={getInnerHtml:function(){return this.oRoot.getInnerHtml()},getInnerText:function(){return this.oRoot.getInnerText()},RGBToCSS:function(rgb,unifill){if(null==rgb&&null!=unifill){unifill.check(this.oDocument.Get_Theme(),this.oDocument.Get_ColorMap());var RGBA=unifill.getRGBAColor();rgb=new CDocumentColor(RGBA.R,RGBA.G,RGBA.B)}var sResult="#";var sR=rgb.r.toString(16);if(sR.length===1)sR="0"+sR;var sG=rgb.g.toString(16);if(sG.length===1)sG="0"+sG;var sB=rgb.b.toString(16); if(sB.length===1)sB="0"+sB;return"#"+sR+sG+sB},Commit_pPr:function(Item,Para,nextElem){var apPr=[];var Def_pPr=this.oDocument.Styles?this.oDocument.Styles.Default.ParaPr:null;var Item_pPr=Item.CompiledPr&&Item.CompiledPr.Pr&&Item.CompiledPr.Pr.ParaPr?Item.CompiledPr.Pr.ParaPr:Item.Pr;if(Item_pPr&&Def_pPr){if(Def_pPr.Ind.Left!==Item_pPr.Ind.Left)apPr.push("margin-left:"+Item_pPr.Ind.Left*g_dKoef_mm_to_pt+"pt");if(Def_pPr.Ind.Right!==Item_pPr.Ind.Right)apPr.push("margin-right:"+Item_pPr.Ind.Right*g_dKoef_mm_to_pt+ "pt");if(Def_pPr.Ind.FirstLine!==Item_pPr.Ind.FirstLine)apPr.push("text-indent:"+Item_pPr.Ind.FirstLine*g_dKoef_mm_to_pt+"pt");if(Def_pPr.Jc!==Item_pPr.Jc)switch(Item_pPr.Jc){case align_Left:apPr.push("text-align:left");break;case align_Center:apPr.push("text-align:center");break;case align_Right:apPr.push("text-align:right");break;case align_Justify:apPr.push("text-align:justify");break}if(Def_pPr.KeepLines!==Item_pPr.KeepLines||Def_pPr.WidowControl!==Item_pPr.WidowControl)if(Def_pPr.KeepLines!== Item_pPr.KeepLines&&Def_pPr.WidowControl!==Item_pPr.WidowControl)apPr.push("mso-pagination:none lines-together");else if(Def_pPr.KeepLines!==Item_pPr.KeepLines)apPr.push("mso-pagination:widow-orphan lines-together");else if(Def_pPr.WidowControl!==Item_pPr.WidowControl)apPr.push("mso-pagination:none");if(Def_pPr.KeepNext!==Item_pPr.KeepNext)apPr.push("page-break-after:avoid");if(Def_pPr.PageBreakBefore!==Item_pPr.PageBreakBefore)apPr.push("page-break-before:always");if(Def_pPr.Spacing.Line!==Item_pPr.Spacing.Line)if(Asc.linerule_AtLeast=== Item_pPr.Spacing.LineRule)apPr.push("line-height:"+Item_pPr.Spacing.Line*g_dKoef_mm_to_pt+"pt");else if(Asc.linerule_Auto===Item_pPr.Spacing.LineRule)if(1===Item_pPr.Spacing.Line)apPr.push("line-height:normal");else apPr.push("line-height:"+parseInt(Item_pPr.Spacing.Line*100)+"%");if(Def_pPr.Spacing.LineRule!==Item_pPr.Spacing.LineRule)if(Asc.linerule_Exact===Item_pPr.Spacing.LineRule)apPr.push("mso-line-height-rule:exactly");apPr.push("margin-top:"+Item_pPr.Spacing.Before*g_dKoef_mm_to_pt+"pt"); apPr.push("margin-bottom:"+Item_pPr.Spacing.After*g_dKoef_mm_to_pt+"pt");if(null!=Item_pPr.Shd&&c_oAscShdNil!==Item_pPr.Shd.Value&&(null!=Item_pPr.Shd.Color||null!=Item_pPr.Shd.Unifill)){var _shdColor=Item_pPr.Shd.GetSimpleColor&&Item_pPr.Shd.GetSimpleColor(this.oDocument.Get_Theme(),this.oDocument.Get_ColorMap());if(_shdColor)_shdColor=this.RGBToCSS(_shdColor);else _shdColor=this.RGBToCSS(Item_pPr.Shd.Color,Item_pPr.Shd.Unifill);apPr.push("background-color:"+_shdColor)}if(Item_pPr.Tabs.Get_Count()> 0){var sTabs="";for(var i=0,length=Item_pPr.Tabs.Get_Count();i0)borderStyle=borderStyle.substring(0,nborderStyleLength-1); apPr.push(borderStyle)}}}if(apPr.length>0)Para.oAttributes["style"]=apPr.join(";")},parse_para_TextPr:function(Value,oTarget){var aProp=[];if(null!=Value.RFonts){var sFontName=null;if(null!=Value.RFonts.Ascii)sFontName=Value.RFonts.Ascii.Name;else if(null!=Value.RFonts.HAnsi)sFontName=Value.RFonts.HAnsi.Name;else if(null!=Value.RFonts.EastAsia)sFontName=Value.RFonts.EastAsia.Name;else if(null!=Value.RFonts.CS)sFontName=Value.RFonts.CS.Name;if(null!=sFontName){var oTheme=this.oDocument&&this.oDocument.Get_Theme&& this.oDocument.Get_Theme();if(oTheme&&oTheme.themeElements&&oTheme.themeElements.fontScheme)sFontName=oTheme.themeElements.fontScheme.checkFont(sFontName);aProp.push("font-family:"+"'"+CopyPasteCorrectString(sFontName)+"'")}}if(null!=Value.FontSize)if(!this.api.DocumentReaderMode)aProp.push("font-size:"+Value.FontSize+"pt");else aProp.push("font-size:"+this.api.DocumentReaderMode.CorrectFontSize(Value.FontSize));if(true==Value.Bold)oTarget.wrapChild(new CopyElement("b"));if(true==Value.Italic)oTarget.wrapChild(new CopyElement("i")); if(true==Value.Underline)oTarget.wrapChild(new CopyElement("u"));if(true==Value.Strikeout)oTarget.wrapChild(new CopyElement("s"));if(true==Value.DStrikeout)oTarget.wrapChild(new CopyElement("s"));if(null!=Value.Shd&&c_oAscShdNil!==Value.Shd.Value&&(null!=Value.Shd.Color||null!=Value.Shd.Unifill))aProp.push("background-color:"+this.RGBToCSS(Value.Shd.Color,Value.Shd.Unifill));else if(null!=Value.HighLight&&highlight_None!==Value.HighLight)aProp.push("background-color:"+this.RGBToCSS(Value.HighLight, null));if(null!=Value.Color||null!=Value.Unifill){var color;if(null!=Value.Unifill)color=this.RGBToCSS(null,Value.Unifill);else color=this.RGBToCSS(Value.Color,Value.Unifill);aProp.push("color:"+color);aProp.push("mso-style-textfill-fill-color:"+color)}if(null!=Value.VertAlign)if(AscCommon.vertalign_SuperScript===Value.VertAlign)aProp.push("vertical-align:super");else if(AscCommon.vertalign_SubScript===Value.VertAlign)aProp.push("vertical-align:sub");if(aProp.length>0)oTarget.oAttributes["style"]= aProp.join(";")},ParseItem:function(ParaItem,oTarget,nextParaItem,lengthContent){var oSpan;switch(ParaItem.Type){case para_Text:var sValue=AscCommon.encodeSurrogateChar(ParaItem.Value);if(sValue)oTarget.addChild(new CopyElement(CopyPasteCorrectString(sValue),true));break;case para_Space:if(nextParaItem&&nextParaItem.Type===para_Space||lengthContent===1)oTarget.addChild(new CopyElement(" ",true));else oTarget.addChild(new CopyElement(" ",true));break;case para_Tab:oSpan=new CopyElement("span"); oSpan.oAttributes["style"]="white-space:pre;";oSpan.oAttributes["style"]="mso-tab-count:1;";oSpan.addChild(new CopyElement(String.fromCharCode(9),true));oTarget.addChild(oSpan);break;case para_NewLine:var oBr=new CopyElement("br");if(break_Page===ParaItem.BreakType){oBr.oAttributes["clear"]="all";oBr.oAttributes["style"]="mso-special-character:line-break;page-break-before:always;"}else oBr.oAttributes["style"]="mso-special-character:line-break;";oTarget.addChild(oBr);oSpan=new CopyElement("span"); oSpan.addChild(new CopyElement(" ",true));oTarget.addChild(oSpan);break;case para_Drawing:var oGraphicObj=ParaItem.GraphicObj;var sSrc=oGraphicObj.getBase64Img();if(sSrc.length>0){var _h,_w;if(oGraphicObj.cachedPixH)_h=oGraphicObj.cachedPixH;else _h=ParaItem.Extent.H*g_dKoef_mm_to_pix;if(oGraphicObj.cachedPixW)_w=oGraphicObj.cachedPixW;else _w=ParaItem.Extent.W*g_dKoef_mm_to_pix;var oImg=new CopyElement("img");oImg.oAttributes["style"]="max-width:100%;";oImg.oAttributes["width"]=Math.round(_w); oImg.oAttributes["height"]=Math.round(_h);oImg.oAttributes["src"]=sSrc;oTarget.addChild(oImg);break}break;case para_PageNum:if(null!=ParaItem.String&&"string"===typeof ParaItem.String)oTarget.addChild(new CopyElement(CopyPasteCorrectString(ParaItem.String),true));break;case para_FootnoteReference:var oLink=new CopyElement("a");var index=this.aFootnoteReference.length+1;var prefix="ftn";oLink.oAttributes["style"]="mso-footnote-id:"+prefix+index;oLink.oAttributes["href"]="#_"+prefix+index;oLink.oAttributes["name"]= "_"+prefix+"ref"+index;oLink.oAttributes["title"]="";oSpan=new CopyElement("span");oSpan.oAttributes["class"]="MsoFootnoteReference";var _oSpan2=new CopyElement("span");if(_oSpan2.oAttributes["style"])_oSpan2.oAttributes["style"]+=";";else _oSpan2.oAttributes["style"]="";_oSpan2.oAttributes["style"]+="mso-special-character:footnote";oSpan.addChild(_oSpan2);this.parse_para_TextPr(ParaItem.Run.Get_CompiledTextPr(),oSpan);oLink.addChild(oSpan);oTarget.addChild(oLink);this.aFootnoteReference.push(ParaItem.Footnote); break;case para_FieldChar:if(ParaItem.ComplexField&&ParaItem.ComplexField.Instruction&&ParaItem.ComplexField.Instruction instanceof CFieldInstructionHYPERLINK)if(fldchartype_Begin===ParaItem.CharType&&ParaItem.ComplexField.Instruction.BookmarkName)this.instructionHyperlinkStart="#"+ParaItem.ComplexField.Instruction.BookmarkName;else if(fldchartype_End===ParaItem.CharType)this.instructionHyperlinkStart=null;break}},CopyRun:function(Item,oTarget){for(var i=0;i0)oImg.oAttributes["width"]=sSrc.w_px;if(sSrc.h_px>0)oImg.oAttributes["height"]=sSrc.h_px;oImg.oAttributes["src"]=sSrc.ImageUrl;oTarget.addChild(oImg)}}else if(para_InlineLevelSdt===item.Type)this.CopyRunContent(item,oTarget);else if(para_Field===item.Type)this.CopyRunContent(item,oTarget);else if(para_Bookmark===item.Type)if(item.Start){bookmarkLevel++; bookmarksStartMap[item.BookmarkId]=1;var oBookmark=new CopyElement("a");var name=item.GetBookmarkName();oBookmark.oAttributes["name"]=CopyPasteCorrectString(name);bookmarkPrviousTargetMap[bookmarkLevel]=oTarget;oTarget=oBookmark}else if(bookmarksStartMap[item.BookmarkId]){bookmarksStartMap[item.BookmarkId]=0;closeBookmarks(bookmarkLevel);bookmarkLevel--}}if(bookmarkLevel>0)while(bookmarkLevel>0){closeBookmarks(bookmarkLevel);bookmarkLevel--}if(this.instructionHyperlinkStart)this.instructionHyperlinkStart= null},CopyParagraph:function(oDomTarget,Item,selectedAll,nextElem){var oDocument=this.oDocument;var Para=null;var styleId=Item.Style_Get();if(styleId){var styleName=oDocument.Styles.Get_Name(styleId).toLowerCase();if(0===styleName.indexOf("heading")){var nLevel=parseInt(styleName.substring("heading".length));if(1<=nLevel&&nLevel<=6)Para=new CopyElement("h"+nLevel)}}if(null==Para)Para=new CopyElement("p");var oNumPr;var bIsNullNumPr=false;if(PasteElementsId.g_bIsDocumentCopyPaste){oNumPr=Item.GetNumPr(); bIsNullNumPr=null==oNumPr||0==oNumPr.NumId}else{oNumPr=Item.PresentationPr.Bullet;bIsNullNumPr=0==oNumPr.m_nType}var bBullet=false;var sListStyle="";if(!bIsNullNumPr)if(PasteElementsId.g_bIsDocumentCopyPaste){var oNum=this.oDocument.GetNumbering().GetNum(oNumPr.NumId);if(oNum){var oNumberingLvl=oNum.GetLvl(oNumPr.Lvl);if(oNumberingLvl)switch(oNumberingLvl.GetFormat()){case Asc.c_oAscNumberingFormat.Decimal:sListStyle="decimal";break;case Asc.c_oAscNumberingFormat.LowerRoman:sListStyle="lower-roman"; break;case Asc.c_oAscNumberingFormat.UpperRoman:sListStyle="upper-roman";break;case Asc.c_oAscNumberingFormat.LowerLetter:sListStyle="lower-alpha";break;case Asc.c_oAscNumberingFormat.UpperLetter:sListStyle="upper-alpha";break;default:sListStyle="disc";bBullet=true;break}}}else{var _presentation_bullet=Item.PresentationPr.Bullet;switch(_presentation_bullet.m_nType){case numbering_presentationnumfrmt_ArabicParenBoth:case numbering_presentationnumfrmt_ArabicParenR:case numbering_presentationnumfrmt_ArabicPeriod:case numbering_presentationnumfrmt_ArabicPlain:{sListStyle= "decimal";break}case numbering_presentationnumfrmt_RomanLcParenBoth:case numbering_presentationnumfrmt_RomanLcParenR:case numbering_presentationnumfrmt_RomanLcPeriod:{sListStyle="lower-roman";break}case numbering_presentationnumfrmt_RomanUcParenBoth:case numbering_presentationnumfrmt_RomanUcParenR:case numbering_presentationnumfrmt_RomanUcPeriod:{sListStyle="upper-roman";break}case numbering_presentationnumfrmt_AlphaLcParenBoth:case numbering_presentationnumfrmt_AlphaLcParenR:case numbering_presentationnumfrmt_AlphaLcPeriod:{sListStyle= "lower-alpha";break}case numbering_presentationnumfrmt_AlphaUcParenR:case numbering_presentationnumfrmt_AlphaUcPeriod:case numbering_presentationnumfrmt_AlphaUcParenBoth:{sListStyle="upper-alpha";break}default:sListStyle="disc";bBullet=true;break}}this.Commit_pPr(Item,Para,nextElem);if(false===selectedAll)this.CopyRunContent(Item,oDomTarget,false);else{this.CopyRunContent(Item,Para,false);if(Para.isEmptyChild())Para.addChild(new CopyElement(" ",true));if(bIsNullNumPr)oDomTarget.addChild(Para); else{var Li=new CopyElement("li");Li.oAttributes["style"]="list-style-type: "+sListStyle;Li.addChild(Para);var oTargetList=null;if(oDomTarget.aChildren.length>0){var oPrevElem=oDomTarget.aChildren[oDomTarget.aChildren.length-1];if(bBullet&&"ul"===oPrevElem.sName||!bBullet&&"ol"===oPrevElem.sName)oTargetList=oPrevElem}if(!bBullet)if(!this.listNextNumMap[oNumPr.NumId])this.listNextNumMap[oNumPr.NumId]=1;else this.listNextNumMap[oNumPr.NumId]++;if(null==oTargetList){if(bBullet)oTargetList=new CopyElement("ul"); else oTargetList=new CopyElement("ol");oTargetList.oAttributes["style"]="padding-left:40px";if(!bBullet&&this.listNextNumMap[oNumPr.NumId]>1)oTargetList.oAttributes["start"]=this.listNextNumMap[oNumPr.NumId];oDomTarget.addChild(oTargetList)}oTargetList.addChild(Li)}}},_BorderToStyle:function(border,name){var res="";if(border_None===border.Value)res+=name+":none;";else{var size=.5;var color=border.Color;var unifill=border.Unifill;if(null!=border.Size)size=border.Size*g_dKoef_mm_to_pt;if(null==color)color= {r:0,g:0,b:0};res+=name+":"+size+"pt solid "+this.RGBToCSS(color,unifill)+";"}return res},_MarginToStyle:function(margins,styleName){var res="";var nMarginLeft=1.9;var nMarginTop=0;var nMarginRight=1.9;var nMarginBottom=0;if(null!=margins.Left&&tblwidth_Mm===margins.Left.Type&&null!=margins.Left.W)nMarginLeft=margins.Left.W;if(null!=margins.Top&&tblwidth_Mm===margins.Top.Type&&null!=margins.Top.W)nMarginTop=margins.Top.W;if(null!=margins.Right&&tblwidth_Mm===margins.Right.Type&&null!=margins.Right.W)nMarginRight= margins.Right.W;if(null!=margins.Bottom&&tblwidth_Mm===margins.Bottom.Type&&null!=margins.Bottom.W)nMarginBottom=margins.Bottom.W;res=styleName+":"+nMarginTop*g_dKoef_mm_to_pt+"pt "+nMarginRight*g_dKoef_mm_to_pt+"pt "+nMarginBottom*g_dKoef_mm_to_pt+"pt "+nMarginLeft*g_dKoef_mm_to_pt+"pt;";return res},_BordersToStyle:function(borders,bUseInner,bUseBetween,mso,alt){var res="";if(null==mso)mso="";if(null==alt)alt="";if(null!=borders.Left)res+=this._BorderToStyle(borders.Left,mso+"border-left"+alt);if(null!= borders.Top)res+=this._BorderToStyle(borders.Top,mso+"border-top"+alt);if(null!=borders.Right)res+=this._BorderToStyle(borders.Right,mso+"border-right"+alt);if(null!=borders.Bottom)res+=this._BorderToStyle(borders.Bottom,mso+"border-bottom"+alt);if(bUseInner){if(null!=borders.InsideV)res+=this._BorderToStyle(borders.InsideV,"mso-border-insidev");if(null!=borders.InsideH)res+=this._BorderToStyle(borders.InsideH,"mso-border-insideh")}if(bUseBetween)if(null!=borders.Between)res+=this._BorderToStyle(borders.Between, "mso-border-between");return res},_MergeProp:function(elem1,elem2){if(!elem1||!elem2)return;var p,v;for(p in elem2)if(elem2.hasOwnProperty(p)&&!elem1.hasOwnProperty(p)){v=elem2[p];if(null!=v)elem1[p]=v}},CopyCell:function(tr,cell,tablePr,width,rowspan){var tc=new CopyElement("td");var tcStyle="";if(width>0){tc.oAttributes["width"]=Math.round(width*g_dKoef_mm_to_pix);tcStyle+="width:"+width*g_dKoef_mm_to_pt+"pt;"}if(rowspan>1)tc.oAttributes["rowspan"]=rowspan;var cellPr=null;var tablePr=null;if(!PasteElementsId.g_bIsDocumentCopyPaste&& editor.WordControl.m_oLogicDocument&&null!=cell.CompiledPr&&null!=cell.CompiledPr.Pr){var presentation=editor.WordControl.m_oLogicDocument;var curSlide=presentation.Slides[presentation.CurPage];if(presentation&&curSlide&&curSlide.Layout&&curSlide.Layout.Master&&curSlide.Layout.Master.Theme)AscFormat.checkTableCellPr(cell.CompiledPr.Pr,curSlide,curSlide.Layout,curSlide.Layout.Master,curSlide.Layout.Master.Theme)}if(null!=cell.CompiledPr&&null!=cell.CompiledPr.Pr){cellPr=cell.CompiledPr.Pr;if(null!= cellPr.GridSpan&&cellPr.GridSpan>1)tc.oAttributes["colspan"]=cellPr.GridSpan}if(null!=cellPr&&null!=cellPr.Shd){if(c_oAscShdNil!==cellPr.Shd.Value&&(null!=cellPr.Shd.Color||null!=cellPr.Shd.Unifill)){var _shdColor=cellPr.Shd.GetSimpleColor(this.oDocument.Get_Theme(),this.oDocument.Get_ColorMap());if(_shdColor)_shdColor=this.RGBToCSS(_shdColor);else _shdColor=this.RGBToCSS(cellPr.Shd.Color,cellPr.Shd.Unifill);tcStyle+="background-color:"+_shdColor+";"}}else if(null!=tablePr&&null!=tablePr.Shd)if(c_oAscShdNil!== tablePr.Shd.Value&&(null!=tablePr.Shd.Color||null!=tablePr.Shd.Unifill))tcStyle+="background-color:"+this.RGBToCSS(tablePr.Shd.Color,tablePr.Shd.Unifill)+";";var oCellMar={};if(null!=cellPr&&null!=cellPr.TableCellMar)this._MergeProp(oCellMar,cellPr.TableCellMar);if(null!=tablePr&&null!=tablePr.TableCellMar)this._MergeProp(oCellMar,tablePr.TableCellMar);tcStyle+=this._MarginToStyle(oCellMar,"padding");var oCellBorder=cell.Get_Borders();tcStyle+=this._BordersToStyle(oCellBorder,false,false);if(""!= tcStyle)tc.oAttributes["style"]=tcStyle;this.CopyDocument2(tc,cell.Content);tr.addChild(tc)},CopyRow:function(oDomTarget,table,nCurRow,elems,nMaxRow){var row=table.Content[nCurRow];if(null==elems)elems={gridStart:0,gridEnd:table.TableGrid.length-1,indexStart:null,indexEnd:null,after:null,before:null,cells:row.Content};var tr=new CopyElement("tr");var gridSum=table.TableSumGrid;var trStyle="";var nGridBefore=0;var rowPr=null;var CompiledPr=row.Get_CompiledPr();if(null!=CompiledPr)rowPr=CompiledPr; if(null!=rowPr){if(null==elems.before&&null!=rowPr.GridBefore&&rowPr.GridBefore>0){elems.before=rowPr.GridBefore;elems.gridStart+=rowPr.GridBefore}if(null==elems.after&&null!=rowPr.GridAfter&&rowPr.GridAfter>0){elems.after=rowPr.GridAfter;elems.gridEnd-=rowPr.GridAfter}if(null!=rowPr.Height&&Asc.linerule_Auto!=rowPr.Height.HRule&&null!=rowPr.Height.Value)trStyle+="height:"+rowPr.Height.Value*g_dKoef_mm_to_pt+"pt;"}if(null!=elems.before)if(elems.before>0){nGridBefore=elems.before;var nWBefore=gridSum[elems.gridStart- 1]-gridSum[elems.gridStart-nGridBefore-1];trStyle+="mso-row-margin-left:"+nWBefore*g_dKoef_mm_to_pt+"pt;";var oNewTd=new CopyElement("td");oNewTd.oAttributes["style"]="mso-cell-special:placeholder;border:none;padding:0cm 0cm 0cm 0cm";oNewTd.oAttributes["width"]=Math.round(nWBefore*g_dKoef_mm_to_pix);if(nGridBefore>1)oNewTd.oAttributes["colspan"]=nGridBefore;var oNewP=new CopyElement("p");oNewP.oAttributes["style"]="margin:0cm";oNewP.addChild(new CopyElement(" ",true));oNewTd.addChild(oNewP); tr.addChild(oNewTd)}var tablePr=null;var compiledTablePr=table.Get_CompiledPr();if(null!=compiledTablePr&&null!=compiledTablePr.TablePr)tablePr=compiledTablePr.TablePr;for(var i in elems.cells){var cell=row.Content[i];if(vmerge_Continue!==cell.GetVMerge()){var StartGridCol=cell.Metrics.StartGridCol;var GridSpan=cell.Get_GridSpan();var width=gridSum[StartGridCol+GridSpan-1]-gridSum[StartGridCol-1];var nRowSpan=table.Internal_GetVertMergeCount(nCurRow,StartGridCol,GridSpan);if(nCurRow+nRowSpan-1>nMaxRow){nRowSpan= nMaxRow-nCurRow+1;if(nRowSpan<=0)nRowSpan=1}this.CopyCell(tr,cell,tablePr,width,nRowSpan)}}if(null!=elems.after)if(elems.after>0){var nGridAfter=elems.after;var nWAfter=gridSum[elems.gridEnd+nGridAfter]-gridSum[elems.gridEnd];trStyle+="mso-row-margin-right:"+nWAfter*g_dKoef_mm_to_pt+"pt;";var oNewTd=new CopyElement("td");oNewTd.oAttributes["style"]="mso-cell-special:placeholder;border:none;padding:0cm 0cm 0cm 0cm";oNewTd.oAttributes["width"]=Math.round(nWAfter*g_dKoef_mm_to_pix);if(nGridAfter>1)oNewTd.oAttributes["colspan"]= nGridAfter;var oNewP=new CopyElement("p");oNewP.oAttributes["style"]="margin:0cm";oNewP.addChild(new CopyElement(" ",true));oNewTd.addChild(oNewP);tr.addChild(oNewTd)}if(""!=trStyle)tr.oAttributes["style"]=trStyle;oDomTarget.addChild(tr)},CopyTable:function(oDomTarget,table,aRowElems){var DomTable=new CopyElement("table");var compiledPr=table.Get_CompiledPr();var Pr=null;if(compiledPr&&null!=compiledPr.TablePr)Pr=compiledPr.TablePr;var tblStyle="";var bBorder=false;if(null!=Pr){var align=""; if(true!=table.Inline&&null!=table.PositionH){var PositionH=table.PositionH;if(true===PositionH.Align)switch(PositionH.Value){case c_oAscXAlign.Outside:case c_oAscXAlign.Right:align="right";break;case c_oAscXAlign.Center:align="center";break}else if(table.TableSumGrid){var TableWidth=table.TableSumGrid[table.TableSumGrid.length-1];var nLeft=PositionH.Value;var nRight=nLeft+TableWidth;var nFromLeft=Math.abs(nLeft-X_Left_Margin);var nFromCenter=Math.abs((Page_Width-X_Right_Margin+X_Left_Margin)/2-(nLeft+ nRight)/2);var nFromRight=Math.abs(Page_Width-nRight-X_Right_Margin);if(nFromRight0){var firstRow=table.Content[0];var rowPr=firstRow.Get_CompiledPr();if(null!=rowPr&&null!=rowPr.TableCellSpacing){bAddSpacing=true;var cellSpacingMM=rowPr.TableCellSpacing;tblStyle+="mso-cellspacing:"+cellSpacingMM*g_dKoef_mm_to_pt+ "pt;";DomTable.oAttributes["cellspacing"]=Math.round(cellSpacingMM*g_dKoef_mm_to_pix)}}if(!bAddSpacing)DomTable.oAttributes["cellspacing"]=0;DomTable.oAttributes["border"]=false==bBorder?0:1;DomTable.oAttributes["cellpadding"]=0;if(""!=tblStyle)DomTable.oAttributes["style"]=tblStyle;table.Recalculate_Grid();if(null==aRowElems)for(var i=0,length=table.Content.length;inMaxRow)nMaxRow=elem.row}for(var i=0,length=aRowElems.length;i>0);oThis.oPresentationWriter.WriteULong(elementsContent.PresentationHeight*1E5>>0);oThis.oPresentationWriter.WriteULong(contentCount);if(elementsContent.DocContent)copyDocContent(); if(elementsContent.Drawings&&elementsContent.Drawings.length)copyDrawings();if(elementsContent.SlideObjects&&elementsContent.SlideObjects.length)copySlideObjects();if(elementsContent.Layouts&&elementsContent.Layouts.length)copyLayouts();if(elementsContent.LayoutsIndexes&&elementsContent.LayoutsIndexes.length){oThis.oPresentationWriter.WriteString2("LayoutsIndexes");copyIndexes(elementsContent.LayoutsIndexes)}if(elementsContent.Masters&&elementsContent.Masters.length)copyMasters();if(elementsContent.MastersIndexes&& elementsContent.MastersIndexes.length){oThis.oPresentationWriter.WriteString2("MastersIndexes");copyIndexes(elementsContent.MastersIndexes)}if(elementsContent.Notes&&elementsContent.Notes.length)if(!(elementsContent.Notes.length===1&&null===elementsContent.Notes[0]))copyNotes();if(elementsContent.NotesMasters&&elementsContent.NotesMasters.length)copyNoteMasters();if(elementsContent.NotesMastersIndexes&&elementsContent.NotesMastersIndexes.length){oThis.oPresentationWriter.WriteString2("NotesMastersIndexes"); copyIndexes(elementsContent.NotesMastersIndexes)}if(elementsContent.NotesThemes&&elementsContent.NotesThemes.length)copyNoteTheme();if(elementsContent.Themes&&elementsContent.Themes.length)copyTheme();if(elementsContent.ThemesIndexes&&elementsContent.ThemesIndexes.length){oThis.oPresentationWriter.WriteString2("ThemeIndexes");copyIndexes(elementsContent.ThemesIndexes)}},getSelectedBinary:function(){var oDocument=this.oDocument;if(PasteElementsId.g_bIsDocumentCopyPaste){var selectedContent=oDocument.GetSelectedContent(); var elementsContent;if(selectedContent&&selectedContent.Elements&&selectedContent.Elements[0]&&selectedContent.Elements[0].Element)elementsContent=selectedContent.Elements;else return false;var drawingUrls=[];if(selectedContent.DrawingObjects&&selectedContent.DrawingObjects.length){var url,correctUrl,graphicObj;for(var i=0;i0)this.oRoot.aChildren[0].oAttributes["class"]=sBase64}if(PasteElementsId.g_bIsDocumentCopyPaste&&PasteElementsId.copyPasteUseBinary&&this.oBinaryFileWriter.copyParams.itemCount>0&&!bFromPresentation){sBase64="docData;"+this.oBinaryFileWriter.GetResult();if(this.oRoot.aChildren&&this.oRoot.aChildren.length==1&&AscBrowser.isSafariMacOs){oElem= this.oRoot.aChildren[0];sStyle=oElem.oAttributes["style"];if(null==sStyle)oElem.oAttributes["style"]="font-weight:normal";else oElem.oAttributes["style"]=sStyle+";font-weight:normal";this.oRoot.wrapChild(new CopyElement("b"))}if(this.oRoot.aChildren&&this.oRoot.aChildren.length>0)this.oRoot.aChildren[0].oAttributes["class"]=sBase64}return sBase64},CopySlide:function(oDomTarget,slide){if(oDomTarget){var sSrc=slide.getBase64Img();var _bounds_cheker=new AscFormat.CSlideBoundsChecker;slide.draw(_bounds_cheker, 0);var oImg=new CopyElement("img");oImg.oAttributes["width"]=Math.round((_bounds_cheker.Bounds.max_x-_bounds_cheker.Bounds.min_x+1)*g_dKoef_mm_to_pix);oImg.oAttributes["height"]=Math.round((_bounds_cheker.Bounds.max_y-_bounds_cheker.Bounds.min_y+1)*g_dKoef_mm_to_pix);oImg.oAttributes["src"]=sSrc;oDomTarget.addChild(oImg)}var presentation=editor.WordControl.m_oLogicDocument;for(var key in presentation.TableStylesIdMap)if(presentation.TableStylesIdMap.hasOwnProperty(key))this.oPresentationWriter.tableStylesGuides[key]= key;this.oPresentationWriter.WriteSlide(slide)},CopyLayout:function(layout){this.oPresentationWriter.WriteSlideLayout(layout)},CopyPresentationTableCells:function(oDomTarget,graphicFrame){var aSelectedRows=[];var oRowElems={};var Item=graphicFrame.graphicObject;if(Item.Selection.Data.length>0)for(var i=0,length=Item.Selection.Data.length;irowElem.indexEnd)rowElem.indexEnd=elem.Cell;if(null==rowElem.indexStart||elem.CellnPrevStartGrid)for(var j=elem.indexStart-1;j>=0;--j){var cellCur= row.Get_Cell(j);if(vmerge_Continue===cellCur.GetVMerge()){var nCurGridCol=cellCur.Metrics.StartGridCol;if(nCurGridCol>=nPrevStartGrid){nCurStartGrid=nCurGridCol;elem.indexStart=j}else break}else break}if(nCurEndGridnCurStartGrid)nMinGrid=nCurStartGrid;if(null==nMaxGrid||nMaxGrid-1)b_style_index= true;this.oPresentationWriter.WriteULong(1);this.oPresentationWriter.WriteBool(false);this.oPresentationWriter.WriteBool(b_style_index);if(b_style_index)this.oPresentationWriter.WriteULong(graphic_frame.graphicObject.styleIndex);var old_style_index=graphic_frame.graphicObject.styleIndex;graphic_frame.graphicObject.styleIndex=-1;this.oPresentationWriter.WriteGrFrame(graphic_frame);graphic_frame.graphicObject.styleIndex=old_style_index;History.TurnOn();this.oBinaryFileWriter.copyParams.itemCount=0}, CopyPresentationTableFull:function(oDomTarget,graphicFrame,isOnlyTable){var aSelectedRows=[];var oRowElems={};var Item=graphicFrame.graphicObject;var b_style_index=false;var presentation=editor.WordControl.m_oLogicDocument;if(Item.TableStyle&&presentation.globalTableStyles.Style[Item.TableStyle])b_style_index=true;for(var key in presentation.TableStylesIdMap)if(presentation.TableStylesIdMap.hasOwnProperty(key))this.oPresentationWriter.tableStylesGuides[key]="{"+AscCommon.GUID()+"}";this.oPresentationWriter.WriteBool(!b_style_index); if(b_style_index){var tableStyle=presentation.globalTableStyles.Style[Item.TableStyle];this.oPresentationWriter.WriteBool(true);this.oPresentationWriter.WriteTableStyle(Item.TableStyle,tableStyle);this.oPresentationWriter.WriteBool(true);this.oPresentationWriter.WriteString2(Item.TableStyle)}History.TurnOff();this.oPresentationWriter.WriteGrFrame(graphicFrame);if(isOnlyTable){this.convertToCompileStylesTable(Item);this.oPresentationWriter.WriteGrFrame(graphicFrame)}History.TurnOn();if(oDomTarget)this.CopyTable(oDomTarget, Item,null)},convertToCompileStylesTable:function(table){var t=this;for(var i=0;i0){var _bounds_cheker=new AscFormat.CSlideBoundsChecker;oGraphicObj.draw(_bounds_cheker, 0);var width,height;if(drawingCopyObject&&drawingCopyObject.ExtX)width=Math.round(drawingCopyObject.ExtX*g_dKoef_mm_to_pix);else width=Math.round((_bounds_cheker.Bounds.max_x-_bounds_cheker.Bounds.min_x+1)*g_dKoef_mm_to_pix);if(drawingCopyObject&&drawingCopyObject.ExtY)height=Math.round(drawingCopyObject.ExtY*g_dKoef_mm_to_pix);else height=Math.round((_bounds_cheker.Bounds.max_y-_bounds_cheker.Bounds.min_y+1)*g_dKoef_mm_to_pix);var oImg=new CopyElement("img");oImg.oAttributes["width"]=width;oImg.oAttributes["height"]= height;oImg.oAttributes["src"]=sSrc;if(this.api.DocumentReaderMode)oImg.oAttributes["style"]="max-width:100%;";oDomTarget.addChild(oImg)}this.oPresentationWriter.WriteSpTreeElem(oGraphicObj)},CopyFootnotes:function(oDomTarget,aFootnotes){if(aFootnotes&&aFootnotes.length){var _mainDiv=new CopyElement("div");_mainDiv.oAttributes["style"]="mso-element:footnote-list";for(var i=0;i/g,">");res=res.replace(/'/g,"'");res=res.replace(/"/g,""");return res}function Editor_Paste_Exec(api,_format,data1,data2,text_data,specialPasteProps,callback){var oPasteProcessor=new PasteProcessor(api,true,true,false,undefined,callback);window["AscCommon"].g_specialPasteHelper.endRecalcDocument= false;if(undefined===specialPasteProps){window["AscCommon"].g_specialPasteHelper.SpecialPasteButton_Hide();window["AscCommon"].g_specialPasteHelper.specialPasteData._format=_format;window["AscCommon"].g_specialPasteHelper.specialPasteData.data1=data1;window["AscCommon"].g_specialPasteHelper.specialPasteData.data2=data2;window["AscCommon"].g_specialPasteHelper.specialPasteData.text_data=text_data}else{window["AscCommon"].g_specialPasteHelper.specialPasteProps=specialPasteProps;_format=window["AscCommon"].g_specialPasteHelper.specialPasteData._format; data1=window["AscCommon"].g_specialPasteHelper.specialPasteData.data1;data2=window["AscCommon"].g_specialPasteHelper.specialPasteData.data2;text_data=window["AscCommon"].g_specialPasteHelper.specialPasteData.text_data;if(specialPasteProps===Asc.c_oSpecialPasteProps.keepTextOnly&&_format!==AscCommon.c_oAscClipboardDataFormat.Text&&text_data){_format=AscCommon.c_oAscClipboardDataFormat.Text;data1=text_data}}switch(_format){case AscCommon.c_oAscClipboardDataFormat.HtmlElement:{oPasteProcessor.Start(data1, data2);break}case AscCommon.c_oAscClipboardDataFormat.Internal:{oPasteProcessor.Start(null,null,null,data1);break}case AscCommon.c_oAscClipboardDataFormat.Text:{oPasteProcessor.Start(null,null,null,null,data1);break}}}function trimString(str){return str.replace(/^\s+|\s+$/g,"")}function sendImgUrls(api,images,callback,bExcel,bNotShowError,token){if(window["NATIVE_EDITOR_ENJINE"]===true&&window["IS_NATIVE_EDITOR"]!==true){var _data=[];for(var i=0;i=0;nIndex--)if(0==images[nIndex].indexOf("file:/"))images[nIndex]=window["AscDesktopEditor"]["GetImageBase64"](images[nIndex]);if(AscCommon.EncryptionWorker&&AscCommon.EncryptionWorker.isCryptoImages())return AscCommon.EncryptionWorker.addCryproImagesFromUrls(images, callback);if(window["IS_NATIVE_EDITOR"]){callback([]);return}var rData={"id":api.documentId,"c":"imgurls","userid":api.documentUserId,"saveindex":g_oDocumentUrls.getMaxIndex(),"tokenDownload":token,"data":images};api.sync_StartAction(Asc.c_oAscAsyncActionType.BlockInteraction,Asc.c_oAscAsyncAction.LoadImage);api.fCurCallback=function(input){api.sync_EndAction(Asc.c_oAscAsyncActionType.BlockInteraction,Asc.c_oAscAsyncAction.LoadImage);var nError=c_oAscError.ID.No;var data;if(null!=input&&"imgurls"== input["type"])if("ok"==input["status"]){data=input["data"]["urls"];nError=AscCommon.mapAscServerErrorToAscError(input["data"]["error"]);var urls={};for(var i=0,length=data.length;i0){this.InsertInPlace(oDocument, this.aContent);if(false===PasteElementsId.g_bIsDocumentCopyPaste){oDocument.Recalculate();if(oDocument.Parent!=null&&oDocument.Parent.txBody!=null)oDocument.Parent.txBody.recalculate()}}var bNeedRecalculate=false===this.bNested&&nInsertLength>0;var bNeedMoveCursor=false;if(bNeedRecalculate)if(History.Is_LastPointNeedRecalc()&&(this.oLogicDocument.DrawingObjects.selectedObjects.length===0||true===this.oLogicDocument.DrawingObjects.isSelectedText()))bNeedMoveCursor=true;if(dNotShowOptions&&!window["AscCommon"].g_specialPasteHelper.specialPasteStart)window["AscCommon"].g_specialPasteHelper.CleanButtonInfo(); else this._specialPasteSetShowOptions();window["AscCommon"].g_specialPasteHelper.Paste_Process_End(true);if(bNeedRecalculate){this.oRecalcDocument.Recalculate();if(bNeedMoveCursor)this.oLogicDocument.MoveCursorRight(false,false,true);this.oLogicDocument.Document_UpdateInterfaceState();this.oLogicDocument.Document_UpdateSelectionState()}},InsertInPlace:function(oDoc,aNewContent){if(!PasteElementsId.g_bIsDocumentCopyPaste)return;var specialPasteHelper=window["AscCommon"].g_specialPasteHelper;var bIsSpecialPaste= specialPasteHelper.specialPasteStart;var paragraph=oDoc.GetCurrentParagraph();var oTable=oDoc.IsInTable()?oDoc.GetParent().GetTable():null;this.pasteTypeContent=null;var oSelectedContent=new CSelectedContent;var tableSpecialPaste=false;if(oTable&&!aNewContent[0].IsTable()&&oTable.IsCellSelection()){var arrSelectedCells=oTable.GetSelectionArray();var nPrevRow=-1;var nElementIndex=-1;for(var nIndex=0,nCount=arrSelectedCells.length;nIndexaNewContent.length-1)nElementIndex=0}if(nElementIndex<0)break;oSelectedContent.Reset();var NewElem=aNewContent[nElementIndex].Copy();var NearPos=oPara.GetCurrentAnchorPosition();if(bIsSpecialPaste){if(Asc.c_oSpecialPasteProps.insertAsNestedTable=== specialPasteHelper.specialPasteProps||Asc.c_oSpecialPasteProps.overwriteCells===specialPasteHelper.specialPasteProps){tableSpecialPaste=true;oSelectedContent.SetInsertOptionForTable(specialPasteHelper.specialPasteProps)}}else oSelectedContent.SetInsertOptionForTable(Asc.c_oSpecialPasteProps.insertAsNestedTable);if(bIsSpecialPaste&&!tableSpecialPaste){var parseItem=this._specialPasteItemConvert(NewElem);if(parseItem&&parseItem.length)for(var j=0;j1)bIsAddTabBefore=true; addTextIntoRun(newParaRun,value,bIsAddTabBefore,true);newParagraph.Internal_Content_Add(newParagraph.Content.length-1,newParaRun,false)}else if(cDocumentContent.Content[n]instanceof CTable){t._convertTableToText(cDocumentContent.Content[n],obj,newParagraph);createNewParagraph=true;previousTableAdd=true}if(!previousTableAdd&&cDocumentContent.Content.length>1&&n!==cDocumentContent.Content.length-1){obj.push(newParagraph);createNewParagraph=true}}}obj.push(newParagraph);newParagraph=null}return obj}, _checkNumberingText:function(paragraph,oNumInfo,oNumPr){if(oNumPr&&oNumInfo){var oNum=this.oLogicDocument.GetNumbering().GetNum(oNumPr.NumId);if(oNum){var sNumberingText=oNum.GetText(oNumPr.Lvl,oNumInfo);var newParaRun=new ParaRun;addTextIntoRun(newParaRun,sNumberingText,false,true,true);paragraph.Internal_Content_Add(0,newParaRun,false)}}},InsertInPlacePresentation:function(aNewContent,isText){var presentation=editor.WordControl.m_oLogicDocument;var presentationSelectedContent=new PresentationSelectedContent; presentationSelectedContent.DocContent=new CSelectedContent;for(var i=0,length=aNewContent.length;i2){var oFindObj=Item.Internal_FindBackward(Item.CurPos.ContentPos,[para_TextPr]);var TextPr=null;if(true===oFindObj.Found&¶_TextPr===oFindObj.Type)TextPr=Item.Content[oFindObj.LetterPos].Copy();else TextPr=new ParaTextPr;var nContentPos=Item.CurPos.ContentPos;for(var i=0;i< nContentLength-2;++i){var oCurInsItem=oInsertPar.Content[i];if(para_Numbering!==oCurInsItem.Type){Item.Internal_Content_Add(nContentPos,oCurInsItem);nContentPos++}}Item.Internal_Content_Add(nContentPos,TextPr)}Item.RecalcInfo.Set_Type_0(pararecalc_0_All);Item.RecalcInfo.Set_Type_0_Spell(pararecalc_0_Spell_All)}else{var LastPos=this.oRecalcDocument.CurPos.ContentPos;var LastPosCurDoc=oDoc.CurPos.ContentPos;var oSourceFirstPar=Item;var oSourceLastPar=new Paragraph(oDoc.DrawingDocument,oDoc);if(true!== oSourceFirstPar.IsCursorAtEnd()||oSourceFirstPar.IsEmpty())oSourceFirstPar.Split(oSourceLastPar);var oInsFirstPar=aNewContent[0];var oInsLastPar=null;if(nNewContentLength>1)oInsLastPar=aNewContent[nNewContentLength-1];var nStartIndex=0;var nEndIndex=nNewContentLength-1;if(type_Paragraph===oInsFirstPar.GetType()){oInsFirstPar.CopyPr_Open(oSourceFirstPar);oSourceFirstPar.Concat(oInsFirstPar);if(AscCommon.isRealObject(oInsFirstPar.bullet))oSourceFirstPar.setPresentationBullet(oInsFirstPar.bullet.createDuplicate()); nStartIndex++}else if(type_Table===oInsFirstPar.GetType())if(oSourceFirstPar.IsEmpty())oSourceFirstPar=null;if(null!=oInsLastPar&&type_Paragraph==oInsLastPar.GetType()&&true!=this.bInBlock){var nNewContentPos=oInsLastPar.Content.length-2;var ind=oInsLastPar.Pr.Ind;if(null!=oInsLastPar)oSourceLastPar.CopyPr(oInsLastPar);if(oInsLastPar.bullet)oInsLastPar.Set_Ind(ind);oInsLastPar.Concat(oSourceLastPar);oInsLastPar.CurPos.ContentPos=nNewContentPos;oSourceLastPar=oInsLastPar;nEndIndex--}for(var i=nStartIndex;i<= nEndIndex;++i){var oElemToAdd=aNewContent[i];LastPosCurDoc++;oDoc.Internal_Content_Add(LastPosCurDoc,oElemToAdd)}if(null!=oSourceLastPar){LastPosCurDoc++;oDoc.Internal_Content_Add(LastPosCurDoc,oSourceLastPar)}if(null==oSourceFirstPar){oDoc.Internal_Content_Remove(LastPosCurDoc,1);LastPosCurDoc--}Item.RecalcInfo.Set_Type_0(pararecalc_0_All);Item.RecalcInfo.Set_Type_0_Spell(pararecalc_0_Spell_All);oDoc.CurPos.ContentPos=LastPosCurDoc}var content=oDoc.Content;for(var i=0;i]+src="([^"]+)[^>]+/g; var res=[];var img;while(true){img=rg_html.exec(sHtml);if(!img)break;res.push(img[1])}return res};function hexToBytes(hex){var res=[];for(var i=0;ir)r=oXfrm.offX+oXfrm.extX;if(b===null)b=oXfrm.offY+oXfrm.extY;else if(oXfrm.offY+oXfrm.extY>b)b=oXfrm.offY+oXfrm.extY}}if(AscFormat.isRealNumber(l)&&AscFormat.isRealNumber(t)&&AscFormat.isRealNumber(r)&& AscFormat.isRealNumber(b)){var fSlideCX=presentation.GetWidthMM()/2;var fSlideCY=presentation.GetHeightMM()/2;var fBoundsCX=(r+l)/2;var fBoundsCY=(t+b)/2;var fDiffX=fBoundsCX-fSlideCX;var fDiffY=fBoundsCY-fSlideCY;if(!AscFormat.fApproxEqual(fDiffX,0)||!AscFormat.fApproxEqual(fDiffY,0))for(var i=0;i0)AscCommon.sendImgUrls(oThis.api,oObjectsForDownload.aUrls,function(data){var oImageMap={};History.TurnOff();ResetNewUrls(data,oObjectsForDownload.aUrls,oObjectsForDownload.aBuilderImagesByUrl,oImageMap);oThis.api.pre_Paste(fonts,oImageMap,paste_callback);History.TurnOn()},null,true);else{var im_arr=[];for(var key in images)im_arr.push(key);this.SetShortImageId(arrImages);this.api.pre_Paste(fonts,im_arr, paste_callback)}}else{var presentationSelectedContent=new PresentationSelectedContent;presentationSelectedContent.DocContent=new CSelectedContent;aContent=AscFormat.ExecuteNoHistory(this._convertExcelBinary,this,[excelContent]);var selectedElement,element,pDrawings=[],drawingCopyObject;for(var i=0;i0)if(window["IS_NATIVE_EDITOR"])oThis.api.pre_Paste(aContent.fonts, aContent.images,fPrepasteCallback);else if(bIsOnlyFromBinary&&window["NativeCorrectImageUrlOnPaste"]){var url;for(var i=0,length=aContent.aPastedImages.length;i0)AscCommon.sendImgUrls(oThis.api,oObjectsForDownload.aUrls,function(data){var oImageMap={};ResetNewUrls(data,oObjectsForDownload.aUrls,oObjectsForDownload.aBuilderImagesByUrl,oImageMap);for(var i=0;i0;var pasteObj=bSlideObjects&&PasteElementsId.g_bIsDocumentCopyPaste?selectedContent2[2]:defaultSelectedContent;var arr_Images,fonts,content=null,font_map={};if(pasteObj){arr_Images=pasteObj.images;fonts=pasteObj.fonts;content=pasteObj.content}if(null===content)return null;if(content&&content.DocContent){var elements=content.DocContent.Elements;var aContent=[];for(var i=0;i1)for(var i=0;i0){var controller=this.oDocument.GetCurrentController();var curTheme=controller?controller.getTheme():null;if(curTheme&&curTheme.name===p_theme)specialOptionsArr.splice(1,1)}var paste_callback=function(){if(false===oThis.bNested){var bPaste=presentation.InsertContent2(aContents, nIndex);presentation.Recalculate();presentation.Check_CursorMoveRight();presentation.Document_UpdateInterfaceState();var bSlideObjects=aContents[nIndex]&&aContents[nIndex].SlideObjects&&aContents[nIndex].SlideObjects.length>0;if(specialOptionsArr.length>=1&&!bSlideObjects&&bPaste){if(presentationSelectedContent&&presentationSelectedContent.DocContent)specialOptionsArr.push(Asc.c_oSpecialPasteProps.keepTextOnly);oThis._setSpecialPasteShowOptionsPresentation(specialOptionsArr)}else window["AscCommon"].g_specialPasteHelper.CleanButtonInfo(); window["AscCommon"].g_specialPasteHelper.Paste_Process_End()}};var oObjectsForDownload=GetObjectsForImageDownload(arr_Images,p_url===this.api.documentId);if(oObjectsForDownload.aUrls.length>0)AscCommon.sendImgUrls(oThis.api,oObjectsForDownload.aUrls,function(data){var oImageMap={};ResetNewUrls(data,oObjectsForDownload.aUrls,oObjectsForDownload.aBuilderImagesByUrl,oImageMap);oThis.api.pre_Paste(fonts,oImageMap,paste_callback)},null,true);else oThis.api.pre_Paste(fonts,{},paste_callback)}else return null}, _readPresentationSelectedContent2:function(base64,bDuplicate){pptx_content_loader.Clear();var _stream=AscFormat.CreateBinaryReader(base64,0,base64.length);var stream=new AscCommon.FileStream(_stream.data,_stream.size);var p_url=stream.GetString2();var p_theme=stream.GetString2();var p_width=stream.GetULong()/1E5;var p_height=stream.GetULong()/1E5;var bIsMultipleContent=stream.GetBool();var selectedContent2=[];if(true===bIsMultipleContent){var multipleParamsCount=stream.GetULong();for(var i=0;i1&&txBobyContent[0].Content)if(txBobyContent[0].Content.length===1||txBobyContent[0].Content.length===2&&txBobyContent[0].Content[0].Content&&txBobyContent[0].Content[0].Content.length===0)shape.txBody.content.Internal_Content_Remove(0,1);w=shape.txBody.getRectWidth(presentation.GetWidthMM()* 2/3);h=shape.txBody.content.GetSummaryHeight();AscFormat.CheckSpPrXfrm(shape);shape.spPr.xfrm.setExtX(w);shape.spPr.xfrm.setExtY(h);shape.spPr.xfrm.setOffX((presentation.GetWidthMM()-w)/2);shape.spPr.xfrm.setOffY((presentation.GetHeightMM()-h)/2);var oBodyPr=shape.getBodyPr().createDuplicate();oBodyPr.rot=0;oBodyPr.spcFirstLastPara=false;oBodyPr.vertOverflow=AscFormat.nOTOwerflow;oBodyPr.horzOverflow=AscFormat.nOTOwerflow;oBodyPr.vert=AscFormat.nVertTThorz;oBodyPr.lIns=2.54;oBodyPr.tIns=1.27;oBodyPr.rIns= 2.54;oBodyPr.bIns=1.27;oBodyPr.numCol=1;oBodyPr.spcCol=0;oBodyPr.rtlCol=0;oBodyPr.fromWordArt=false;oBodyPr.anchor=4;oBodyPr.anchorCtr=false;oBodyPr.forceAA=false;oBodyPr.compatLnSpc=true;oBodyPr.prstTxWarp=AscFormat.ExecuteNoHistory(function(){return AscFormat.CreatePrstTxWarpGeometry("textNoShape")},this,[]);oBodyPr.textFit=new AscFormat.CTextFit;oBodyPr.textFit.type=AscFormat.text_fit_Auto;shape.txBody.setBodyPr(oBodyPr);shape.txBody.content.MoveCursorToEndPos();arrShapes[i]=new DrawingCopyObject(shape, 0,0,w,h)}for(i=0;i-1)base64FromPresentation=onlyBinary.split("pptData;")[1];else if(onlyBinary.indexOf("docData;")>-1)base64FromWord=onlyBinary.split("docData;")[1];else{if(onlyBinary.indexOf("xslData;")>-1)base64FromExcel=onlyBinary.split("xslData;")[1]}else if(node){classNode=searchBinaryClass(node);if(classNode!= null){var cL=classNode.split(" ");for(var i=0;i-1)base64FromExcel=cL[i].split("xslData;")[1];else if(cL[i].indexOf("docData;")>-1)base64FromWord=cL[i].split("docData;")[1];else if(cL[i].indexOf("pptData;")>-1)base64FromPresentation=cL[i].split("pptData;")[1]}}return{base64FromExcel:base64FromExcel,base64FromWord:base64FromWord,base64FromPresentation:base64FromPresentation}},_pasteText:function(text){var oThis=this;var fPasteTextWordCallback=function(){var executePasteWord= function(){if(false===oThis.bNested)oThis.InsertInDocument(!window["AscCommon"].g_specialPasteHelper.specialPasteStart)};oThis.aContent=[];oThis._getContentFromText(text,true);oThis._AddNextPrevToContent(oThis.oDocument);oThis.api.pre_Paste([],[],executePasteWord)};var fPasteTextPresentationCallback=function(){var executePastePresentation=function(){oThis.InsertInPlacePresentation(oThis.aContent,true)};var presentation=editor.WordControl.m_oLogicDocument;if(presentation.Slides.length===0)presentation.addNextSlide(); var shape=new CShape;shape.setParent(presentation.Slides[presentation.CurPage]);shape.setTxBody(AscFormat.CreateTextBodyFromString("",presentation.DrawingDocument,shape));oThis.aContent=shape.txBody.content.Content;text=text.replace(/^(\r|\t)+|(\r|\t)+$/g,"");if(text.length>0){var oContent=shape.txBody.content;oThis.oDocument=oContent;var bAddParagraph=false;var oCurParagraph=oContent.Content[0];var oCurRun=new ParaRun(oCurParagraph,false);var nCharPos=0;oCurParagraph.Internal_Content_Add(0,oCurRun); for(var oIterator=text.getUnicodeIterator();oIterator.check();oIterator.next()){if(bAddParagraph){oCurParagraph=new Paragraph(oContent.DrawingDocument,oContent,oContent.bPresentation===true);oContent.Internal_Content_Add(oContent.Content.length,oCurParagraph);oCurRun=new ParaRun(oCurParagraph,false);oCurParagraph.Internal_Content_Add(0,oCurRun);bAddParagraph=false;nCharPos=0}var nUnicode=oIterator.value();if(null!==nUnicode)if(null!==nUnicode&&13!==nUnicode)if(10===nUnicode||13===nUnicode)bAddParagraph= true;else if(9===nUnicode)oCurRun.AddToContent(nCharPos++,new ParaTab,true);else if(10===nUnicode)oCurRun.AddToContent(nCharPos++,new ParaNewLine(break_Line),true);else if(13===nUnicode)continue;else if(AscCommon.IsSpace(nUnicode))oCurRun.AddToContent(nCharPos++,new ParaSpace(nUnicode),true);else oCurRun.AddToContent(nCharPos++,new ParaText(nUnicode),true)}}var oTextPr=presentation.GetCalculatedTextPr();shape.txBody.content.SetApplyToAll(true);var paraTextPr=new AscCommonWord.ParaTextPr(oTextPr); shape.txBody.content.AddToParagraph(paraTextPr);shape.txBody.content.SetApplyToAll(false);oThis.api.pre_Paste([],[],executePastePresentation)};if(PasteElementsId.g_bIsDocumentCopyPaste)fPasteTextWordCallback();else fPasteTextPresentationCallback()},_getContentFromText:function(text,getStyleCurSelection){var t=this;var Count=text.length;var pasteIntoParagraphPr=this.oDocument.GetDirectParaPr();var pasteIntoParaRunPr=this.oDocument.GetDirectTextPr();var bPresentation=false;var oCurParagraph=this.oDocument.GetCurrentParagraph(); var Parent=t.oDocument;if(oCurParagraph&&!oCurParagraph.bFromDocument){bPresentation=true;Parent=oCurParagraph.Parent}var getNewParagraph=function(){var paragraph=new Paragraph(t.oDocument.DrawingDocument,Parent,bPresentation);var copyParaPr;if(getStyleCurSelection)if(pasteIntoParagraphPr){copyParaPr=pasteIntoParagraphPr.Copy();copyParaPr.NumPr=undefined;paragraph.Set_Pr(copyParaPr);if(paragraph.TextPr&&pasteIntoParaRunPr)paragraph.TextPr.Value=pasteIntoParaRunPr.Copy()}return paragraph};var getNewParaRun= function(){var paraRun=new ParaRun;if(getStyleCurSelection)if(pasteIntoParaRunPr&¶Run.Set_Pr)paraRun.Set_Pr(pasteIntoParaRunPr.Copy());return paraRun};var _addToRun=function(_nUnicode){var Item;if(8201===_nUnicode||9===_nUnicode)Item=new ParaTab;else if(32!==_nUnicode&&160!==_nUnicode)Item=new ParaText(_nUnicode);else Item=new ParaSpace;newParaRun.AddToContent(-1,Item,false)};var newParagraph=getNewParagraph();var partTextCount=0;var newParaRun=getNewParaRun();for(var oIterator=text.getUnicodeIterator();oIterator.check();oIterator.next()){var pos= oIterator.position();var nUnicode=oIterator.value();if(10===nUnicode||pos===Count-1){if(pos===Count-1&&10!==nUnicode)_addToRun(nUnicode);newParagraph.Internal_Content_Add(newParagraph.Content.length-1,newParaRun,false);this.aContent.push(newParagraph);newParagraph=getNewParagraph();newParaRun=getNewParaRun();partTextCount=0}else if(partTextCount===Asc.c_dMaxParaRunContentLength){_addToRun(nUnicode);newParagraph.Internal_Content_Add(newParagraph.Content.length-1,newParaRun,false);newParaRun=getNewParaRun(); partTextCount=0}else if(13===nUnicode)continue;else{partTextCount++;_addToRun(nUnicode)}}if(partTextCount){newParagraph.Internal_Content_Add(newParagraph.Content.length-1,newParaRun,false);this.aContent.push(newParagraph)}},_isParagraphContainsOnlyDrawing:function(par){var res=true;if(par.Content)for(var i=0;i1&&drawings[i].base64){if(!tempParagraph)tempParagraph=new Paragraph(this.oDocument.DrawingDocument,this.oDocument);extX=drawings[i].ExtX;extY=drawings[i].ExtY;imageUrl=drawings[i].base64;graphicObj=AscFormat.DrawingObjectsController.prototype.createImage(imageUrl,0,0,extX,extY);tempParaRun=new ParaRun;tempParaRun.Paragraph=null;tempParaRun.Add_ToContent(0,new ParaDrawing,false);tempParaRun.Content[0].Set_GraphicObject(graphicObj); tempParaRun.Content[0].GraphicObj.setParent(tempParaRun.Content[0]);tempParaRun.Content[0].CheckWH();tempParagraph.Content.splice(tempParagraph.Content.length-1,0,tempParaRun)}else if(isGraphicFrame){drawing.setBDeleted(true);drawing.setWordFlag(false);var copyObj=drawing.graphicObject.Copy();copyObj.Set_Parent(this.oDocument);aContent[aContent.length]=copyObj;drawing.setWordFlag(true);drawing.getAllFonts(font_map)}else{if(!tempParagraph)tempParagraph=new Paragraph(this.oDocument.DrawingDocument, this.oDocument);extX=drawings[i].ExtX;extY=drawings[i].ExtY;drawing.getAllFonts(font_map);graphicObj=drawing.graphicObject?drawing.graphicObject.convertToWord(this.oLogicDocument):drawing.convertToWord(this.oLogicDocument);tempParaRun=new ParaRun;tempParaRun.Paragraph=null;var newParaDrawing=new ParaDrawing;tempParaRun.Add_ToContent(0,newParaDrawing,false);tempParaRun.Content[0].Set_GraphicObject(graphicObj);tempParaRun.Content[0].GraphicObj.setParent2(tempParaRun.Content[0]);var oGraphicObj=tempParaRun.Content[0].GraphicObj; if(oGraphicObj.spPr&&oGraphicObj.spPr.xfrm){oGraphicObj.spPr.xfrm.setOffX(0);oGraphicObj.spPr.xfrm.setOffY(0)}tempParaRun.Content[0].CheckWH();tempParagraph.Content.splice(tempParagraph.Content.length-1,0,tempParaRun)}}fonts=[];for(var i in font_map)fonts.push(new CFont(i,0,"",0));if(tempParagraph)aContent[aContent.length]=tempParagraph}else{if(!this.oDocument.bPresentation){fonts=this._convertTableFromExcel(aContentExcel);if(PasteElementsId.g_bIsDocumentCopyPaste&&this.aContent&&this.aContent.length=== 1&&1===this.aContent[0].Rows&&this.aContent[0].Content[0]){var _content=this.aContent[0].Content[0];if(_content&&_content.Content&&1===_content.Content.length&&_content.Content[0].Content&&_content.Content[0].Content.Content[0])this.aContent[0]=_content.Content[0].Content.Content[0]}}else fonts=this._convertTableFromExcelForChartTitle(aContentExcel);aContent=this.aContent}return{content:aContent,fonts:fonts}},_convertTableFromExcel:function(aContentExcel){var worksheet=aContentExcel.workbook.aWorksheets[0]; var range;var tempActiveRef=aContentExcel.activeRange;var activeRange=AscCommonExcel.g_oRangeCache.getAscRange(tempActiveRef);var t=this;var fonts=[];var charToMM=function(mcw){var maxDigitWidth=7;var px=Asc.floor((256*mcw+Asc.floor(128/maxDigitWidth))/256*maxDigitWidth);return px*g_dKoef_pix_to_mm};var convertBorder=function(border){var res=new CDocumentBorder;if(border.w){res.Value=border_Single;res.Size=border.w*g_dKoef_pix_to_mm}var bc=border.getColorOrDefault();res.Color=new CDocumentColor(bc.getR(), bc.getG(),bc.getB());return res};var addFont=function(fontFamily){if(!t.aContent.fonts)t.aContent.fonts=[];if(!t.oFonts)t.oFonts=[];if(!t.oFonts[fontFamily]){t.oFonts[fontFamily]={Name:fontFamily,Index:-1};fonts.push(new CFont(fontFamily,0,"",0))}};var grid=[];var standardWidth=9;for(var i=activeRange.c1;i<=activeRange.c2;i++)if(worksheet.aCols[i])grid[i-activeRange.c1]=charToMM(worksheet.aCols[i].width);else grid[i-activeRange.c1]=charToMM(standardWidth);var table;if(editor.WordControl.m_oLogicDocument&& editor.WordControl.m_oLogicDocument.Slides){table=this._createNewPresentationTable(grid);table.Set_TableStyle(editor.WordControl.m_oLogicDocument.DefaultTableStyleId)}else table=new CTable(this.oDocument.DrawingDocument,this.oDocument,true,0,0,grid);this.aContent.push(table);var diffRow=activeRange.r2-activeRange.r1;var diffCol=activeRange.c2-activeRange.c1;for(var i=0;i<=diffRow;i++){var row=table.private_AddRow(table.Content.length,0);var heightRowPt=worksheet.getRowHeight(i+activeRange.r1);row.SetHeight(heightRowPt* g_dKoef_pt_to_mm,linerule_AtLeast);for(var j=0;j<=diffCol;j++){if(!table.Selection.Data)table.Selection.Data=[];table.Selection.Data[table.Selection.Data.length]={Cell:j,Row:i};range=worksheet.getCell3(i+activeRange.r1,j+activeRange.c1);var oCurCell=row.Add_Cell(row.Get_CellsCount(),row,null,false);table.CurCell=oCurCell;var isMergedCell=range.hasMerged();var gridSpan=1;var vMerge=1;if(isMergedCell){gridSpan=isMergedCell.c2-isMergedCell.c1+1;vMerge=isMergedCell.r2-isMergedCell.r1+1}var sumWidthGrid= 0;for(var l=0;l0){sImageUrl=oGraphicObj.spPr.Fill.fill.RasterImageId;aPastedImages[aPastedImages.length]=new AscCommon.CBuilderImages(oGraphicObj.spPr.Fill.fill,sImageUrl,null,oGraphicObj.spPr,null);aUrls[aUrls.length]= sImageUrl}if(oGraphicObj.spPr.ln&&oGraphicObj.spPr.ln.Fill&&oGraphicObj.spPr.ln.Fill.fill&&typeof oGraphicObj.spPr.ln.Fill.fill.RasterImageId==="string"&&oGraphicObj.spPr.ln.Fill.fill.RasterImageId.length>0){sImageUrl=oGraphicObj.spPr.ln.Fill.fill.RasterImageId;aPastedImages[aPastedImages.length]=new AscCommon.CBuilderImages(oGraphicObj.spPr.ln.Fill.fill,sImageUrl,null,oGraphicObj.spPr,oGraphicObj.spPr.ln.Fill.fill.RasterImageId);aUrls[aUrls.length]=sImageUrl}}switch(oGraphicObj.getObjectType()){case AscDFH.historyitem_type_ImageShape:{sImageUrl= oGraphicObj.getImageUrl();if(typeof sImageUrl==="string"&&sImageUrl.length>0){aPastedImages[aPastedImages.length]=new AscCommon.CBuilderImages(oGraphicObj.blipFill,sImageUrl,oGraphicObj,null,null);aUrls[aUrls.length]=sImageUrl}break}case AscDFH.historyitem_type_Shape:{break}case AscDFH.historyitem_type_ChartSpace:{break}case AscDFH.historyitem_type_GroupShape:{this._getImagesFromExcelShapes(null,oGraphicObj.spTree,aPastedImages,aUrls);break}}}}},_selectShapesBeforeInsert:function(aNewContent,oDoc){var content, drawingObj,allDrawingObj=[];for(var i=0;i0)AscCommon.sendImgUrls(oThis.api,aImagesToDownload,function(data){var image_map={};for(var i=0,length=Math.min(data.length,aImagesToDownload.length);i=3){if(aParems.length>=4){var oA=AscCommon.valueToMmType(aParems[3]);if(0==oA.val)return null}var oR=AscCommon.valueToMmType(aParems[0]);var oG=AscCommon.valueToMmType(aParems[1]);var oB=AscCommon.valueToMmType(aParems[2]);var r,g,b;if(oR&& "%"===oR.type)r=parseInt(255*oR.val/100);else r=oR.val;if(oG&&"%"===oG.type)g=parseInt(255*oG.val/100);else g=oG.val;if(oB&&"%"===oB.type)b=parseInt(255*oB.val/100);else b=oB.val;return new CDocumentColor(r,g,b)}}}}return null},_isEmptyProperty:function(prop){var bIsEmpty=true;for(var i in prop)if(null!=prop[i]){bIsEmpty=false;break}return bIsEmpty},_set_pPr:function(node,Para,pNoHtmlPr){var t=this;var sNodeName=node.nodeName.toLowerCase();if(node!==this.oRootNode)while(false===this._IsBlockElem(sNodeName))if(this.oRootNode!== node.parentNode){node=node.parentNode;sNodeName=node.nodeName.toLowerCase()}else break;var _applyTextAlign=function(){var text_align=t._getStyle(node,computedStyle,"text-align");if(text_align){var Jc=null;if(-1!==text_align.indexOf("center"))Jc=align_Center;else if(-1!==text_align.indexOf("right"))Jc=align_Right;else if(-1!==text_align.indexOf("justify"))Jc=align_Justify;if(null!=Jc)Para.Set_Align(Jc,false)}};var computedStyle=this._getComputedStyle(node);if("td"===sNodeName||"th"===sNodeName){_applyTextAlign(); var oNewSpacing=new CParaSpacing;oNewSpacing.Set_FromObject({After:0,Before:0,Line:Asc.linerule_Auto});Para.Set_Spacing(oNewSpacing);return}var oDocument=this.oDocument;if(null!=pNoHtmlPr.hLevel&&oDocument.Styles)Para.SetOutlineLvl(pNoHtmlPr.hLevel);var pPr=Para.Pr;var oNewBorder={Left:null,Top:null,Right:null,Bottom:null,Between:null};var sBorder=pNoHtmlPr["mso-border-alt"];if(null!=sBorder){var oNewBrd=this._ExecuteParagraphBorder(sBorder);oNewBorder.Left=oNewBrd;oNewBorder.Top=oNewBrd.Copy();oNewBorder.Right= oNewBrd.Copy();oNewBorder.Bottom=oNewBrd.Copy()}else{sBorder=pNoHtmlPr["mso-border-left-alt"];if(null!=sBorder){var oNewBrd=this._ExecuteParagraphBorder(sBorder);oNewBorder.Left=oNewBrd}sBorder=pNoHtmlPr["mso-border-top-alt"];if(null!=sBorder){var oNewBrd=this._ExecuteParagraphBorder(sBorder);oNewBorder.Top=oNewBrd}sBorder=pNoHtmlPr["mso-border-right-alt"];if(null!=sBorder){var oNewBrd=this._ExecuteParagraphBorder(sBorder);oNewBorder.Right=oNewBrd}sBorder=pNoHtmlPr["mso-border-bottom-alt"];if(null!= sBorder){var oNewBrd=this._ExecuteParagraphBorder(sBorder);oNewBorder.Bottom=oNewBrd}}sBorder=pNoHtmlPr["mso-border-between"];if(null!=sBorder){var oNewBrd=this._ExecuteParagraphBorder(sBorder);oNewBorder.Between=oNewBrd}if(computedStyle){var font_family=CheckDefaultFontFamily(this._getStyle(node,computedStyle,"font-family"),this.apiEditor);if(font_family&&""!=font_family){var oFontItem=this.oFonts[font_family];if(null!=oFontItem&&null!=oFontItem.Name&&Para.TextPr&&Para.TextPr.Value&&Para.TextPr.Value.RFonts){Para.TextPr.Value.RFonts.Ascii= {Name:oFontItem.Name,Index:oFontItem.Index};Para.TextPr.Value.RFonts.HAnsi={Name:oFontItem.Name,Index:oFontItem.Index};Para.TextPr.Value.RFonts.CS={Name:oFontItem.Name,Index:oFontItem.Index};Para.TextPr.Value.RFonts.EastAsia={Name:oFontItem.Name,Index:oFontItem.Index}}}var font_size=node.style?node.style.fontSize:null;if(!font_size)font_size=this._getStyle(node,computedStyle,"font-size");font_size=CheckDefaultFontSize(font_size,this.apiEditor);if(font_size&&Para.TextPr&&Para.TextPr.Value){var obj= AscCommon.valueToMmType(font_size);if(obj&&"%"!==obj.type&&"none"!==obj.type){font_size=obj.val;if("px"===obj.type&&false===this.bIsDoublePx)font_size=Math.round(font_size*g_dKoef_mm_to_pt);else font_size=Math.round(2*font_size*g_dKoef_mm_to_pt)/2;if(font_size>300)font_size=300;else if(font_size===0)font_size=1;Para.TextPr.Value.FontSize=font_size}}var Ind=new CParaInd;var margin_left=this._getStyle(node,computedStyle,"margin-left");var curContent=this.oLogicDocument.Content[this.oLogicDocument.CurPos.ContentPos]; var curIndexColumn=curContent&&curContent.Get_CurrentColumn?curContent.Get_CurrentColumn(this.oLogicDocument.CurPage):null;var curPage=this.oLogicDocument.Pages[this.oLogicDocument.CurPage];var pageColumn=null!==curIndexColumn&&curPage&&curPage.Sections&&curPage.Sections[0]&&curPage.Sections[0].Columns?curPage.Sections[0].Columns[curIndexColumn]:null;if(margin_left&&null!=(margin_left=AscCommon.valueToMm(margin_left)))if(!pageColumn||pageColumn&&pageColumn.X+margin_leftpageColumn.X)Ind.Right=margin_right;if(null!=Ind.Left&&null!=Ind.Right){var dif=Page_Width-X_Left_Margin-X_Right_Margin-Ind.Left-Ind.Right;if(dif<30)Ind.Right=Page_Width-X_Left_Margin-X_Right_Margin-Ind.Left-30}var text_indent=this._getStyle(node,computedStyle,"text-indent");if(text_indent&& null!=(text_indent=AscCommon.valueToMm(text_indent)))Ind.FirstLine=text_indent;if(false===this._isEmptyProperty(Ind)&&!pNoHtmlPr["mso-list"])Para.Set_Ind(Ind);_applyTextAlign();var Spacing=new CParaSpacing;var margin_top=this._getStyle(node,computedStyle,"margin-top");if(margin_top&&null!=(margin_top=AscCommon.valueToMm(margin_top))&&margin_top>=0)Spacing.Before=margin_top;var margin_bottom=this._getStyle(node,computedStyle,"margin-bottom");if(margin_bottom&&null!=(margin_bottom=AscCommon.valueToMm(margin_bottom))&& margin_bottom>=0)Spacing.After=margin_bottom;var line_height=node.style&&node.style.lineHeight?node.style.lineHeight:this._getStyle(node,computedStyle,"line-height");if(line_height){var oLineHeight=AscCommon.valueToMmType(line_height);if(oLineHeight&&"%"===oLineHeight.type)Spacing.Line=oLineHeight.val;else if(line_height&&null!=(line_height=AscCommon.valueToMm(line_height))&&line_height>=0){Spacing.Line=line_height;Spacing.LineRule=Asc.linerule_AtLeast}}if(false===this._isEmptyProperty(Spacing))Para.Set_Spacing(Spacing); var background_color=null;var oTempNode=node;while(true){var tempComputedStyle=this._getComputedStyle(oTempNode);if(null==tempComputedStyle)break;background_color=this._getStyle(oTempNode,tempComputedStyle,"background-color");if(null!=background_color&&(background_color=this._ParseColor(background_color)))break;oTempNode=oTempNode.parentNode;if(this.oRootNode===oTempNode||"body"===oTempNode.nodeName.toLowerCase()||true===this._IsBlockElem(oTempNode.nodeName.toLowerCase()))break}if(PasteElementsId.g_bIsDocumentCopyPaste)if(background_color){var Shd= new CDocumentShd;Shd.Value=c_oAscShdClear;Shd.Color=background_color;Para.Set_Shd(Shd)}if(null==oNewBorder.Left)oNewBorder.Left=this._ExecuteBorder(computedStyle,node,"left","Left",false);if(null==oNewBorder.Top)oNewBorder.Top=this._ExecuteBorder(computedStyle,node,"top","Top",false);if(null==oNewBorder.Right)oNewBorder.Right=this._ExecuteBorder(computedStyle,node,"left","Left",false);if(null==oNewBorder.Bottom)oNewBorder.Bottom=this._ExecuteBorder(computedStyle,node,"bottom","Bottom",false)}if(false=== this._isEmptyProperty(oNewBorder))Para.Set_Borders(oNewBorder);var pagination=pNoHtmlPr["mso-pagination"];if(pagination)if("none"===pagination);else if(-1!==pagination.indexOf("widow-orphan")&&-1!==pagination.indexOf("lines-together"))Para.Set_KeepLines(true);else if(-1!==pagination.indexOf("none")&&-1!==pagination.indexOf("lines-together"))Para.Set_KeepLines(true);if("avoid"===pNoHtmlPr["page-break-after"]);if("always"===pNoHtmlPr["page-break-before"])Para.Set_PageBreakBefore(true);var tab_stops= pNoHtmlPr["tab-stops"];if(tab_stops&&""!=pNoHtmlPr["tab-stops"]){var aTabs=tab_stops.split(" ");var nTabLen=aTabs.length;if(nTabLen>0){var Tabs=new CParaTabs;for(var i=0;i1){var prevElem=this.aContent[this.aContent.length-2];if(null!=prevElem&&type_Paragraph===prevElem.GetType()){var PrevNumPr= prevElem.GetNumPr();if(null!=PrevNumPr&&true===this.oLogicDocument.Numbering.CheckFormat(PrevNumPr.NumId,PrevNumPr.Lvl,num))NumId=PrevNumPr.NumId}}if(null==NumId&&this.pasteInExcel!==true){var oNum=this.oLogicDocument.GetNumbering().CreateNum();NumId=oNum.GetId();if(Asc.c_oAscNumberingFormat.Bullet===num){oNum.CreateDefault(c_oAscMultiLevelNumbering.Bullet);var LvlText=String.fromCharCode(183);var NumTextPr=new CTextPr;NumTextPr.RFonts.SetAll("Symbol",-1);switch(type){case "disc":{NumTextPr.RFonts.SetAll("Symbol", -1);LvlText=String.fromCharCode(183);break}case "circle":{NumTextPr.RFonts.SetAll("Courier New",-1);LvlText="o";break}case "square":{NumTextPr.RFonts.SetAll("Wingdings",-1);LvlText=String.fromCharCode(167);break}}}else oNum.CreateDefault(c_oAscMultiLevelNumbering.Numbered);for(var iLvl=0;iLvl<=8;iLvl++)switch(num){case Asc.c_oAscNumberingFormat.Bullet:oNum.SetLvlByType(iLvl,c_oAscNumberingLevel.Bullet,LvlText,NumTextPr);break;case Asc.c_oAscNumberingFormat.Decimal:oNum.SetLvlByType(iLvl,c_oAscNumberingLevel.DecimalDot_Right); break;case Asc.c_oAscNumberingFormat.LowerRoman:oNum.SetLvlByType(iLvl,c_oAscNumberingLevel.LowerRomanDot_Right);break;case Asc.c_oAscNumberingFormat.UpperRoman:oNum.SetLvlByType(iLvl,c_oAscNumberingLevel.UpperRomanDot_Right);break;case Asc.c_oAscNumberingFormat.LowerLetter:oNum.SetLvlByType(iLvl,c_oAscNumberingLevel.LowerLetterDot_Left);break;case Asc.c_oAscNumberingFormat.UpperLetter:oNum.SetLvlByType(iLvl,c_oAscNumberingLevel.UpperLetterDot_Left);break}setListTextPr(oNum)}if(this.pasteInExcel!== true&&Para.bFromDocument===true)Para.ApplyNumPr(NumId,0)}}else{var numPr=Para.GetNumPr();if(numPr)Para.RemoveNumPr()}else if(true===pNoHtmlPr.bNum){var num=numbering_presentationnumfrmt_Char;if(null!=pNoHtmlPr.numType)num=pNoHtmlPr.numType;var type=pNoHtmlPr["list-style-type"];var oBullet=null;if(type)switch(type){case "disc":{oBullet=AscFormat.fGetPresentationBulletByNumInfo({Type:0,SubType:1});break}case "decimal":{oBullet=AscFormat.fGetPresentationBulletByNumInfo({Type:1,SubType:0});break}case "lower-roman":{oBullet= AscFormat.fGetPresentationBulletByNumInfo({Type:1,SubType:7});break}case "upper-roman":{oBullet=AscFormat.fGetPresentationBulletByNumInfo({Type:1,SubType:3});break}case "lower-alpha":{oBullet=AscFormat.fGetPresentationBulletByNumInfo({Type:1,SubType:6});break}case "upper-alpha":{oBullet=AscFormat.fGetPresentationBulletByNumInfo({Type:1,SubType:4});break}default:{oBullet=AscFormat.fGetPresentationBulletByNumInfo({Type:0,SubType:1});break}}Para.Add_PresentationNumbering(oBullet)}else Para.Remove_PresentationNumbering(); Para.CompiledPr.NeedRecalc=true},_commit_rPr:function(node,bUseOnlyInherit){if(!this.bIsPlainText){var rPr=this._read_rPr(node,bUseOnlyInherit);var tempRpr;var bSaveExcelFormat=window["AscCommon"].g_clipboardBase.bSaveFormat;if(this.pasteInExcel===true&&!bSaveExcelFormat&&this.oDocument&&this.oDocument.Parent&&this.oDocument.Parent.parent&&this.oDocument.Parent.parent.getObjectType()===AscDFH.historyitem_type_Shape){tempRpr=new CTextPr;tempRpr.Underline=rPr.Underline;tempRpr.Bold=rPr.Bold;tempRpr.Italic= rPr.Italic;rPr=tempRpr}if(!this.oCur_rPr.Is_Equal(rPr)){this._Set_Run_Pr(rPr);this.oCur_rPr=rPr}}},_read_rPr:function(node,bUseOnlyInherit){var oDocument=this.oDocument;var rPr=new CTextPr;if(false==PasteElementsId.g_bIsDocumentCopyPaste)rPr.Set_FromObject({Bold:false,Italic:false,Underline:false,Strikeout:false,RFonts:{Ascii:{Name:"Arial",Index:-1},EastAsia:{Name:"Arial",Index:-1},HAnsi:{Name:"Arial",Index:-1},CS:{Name:"Arial",Index:-1}},FontSize:11,Color:{r:0,g:0,b:0},VertAlign:AscCommon.vertalign_Baseline, HighLight:highlight_None});var computedStyle=this._getComputedStyle(node);if(computedStyle){var font_family=CheckDefaultFontFamily(this._getStyle(node,computedStyle,"font-family"),this.apiEditor);if(font_family&&""!=font_family){var oFontItem=this.oFonts[font_family];if(null!=oFontItem&&null!=oFontItem.Name){rPr.RFonts.Ascii={Name:oFontItem.Name,Index:oFontItem.Index};rPr.RFonts.HAnsi={Name:oFontItem.Name,Index:oFontItem.Index};rPr.RFonts.CS={Name:oFontItem.Name,Index:oFontItem.Index};rPr.RFonts.EastAsia= {Name:oFontItem.Name,Index:oFontItem.Index}}}var font_size=node.style?node.style.fontSize:null;if(!font_size)font_size=this._getStyle(node,computedStyle,"font-size");font_size=CheckDefaultFontSize(font_size,this.apiEditor);if(font_size){var obj=AscCommon.valueToMmType(font_size);if(obj&&"%"!==obj.type&&"none"!==obj.type){font_size=obj.val;if("px"===obj.type&&false===this.bIsDoublePx)font_size=Math.round(font_size*g_dKoef_mm_to_pt);else font_size=Math.round(2*font_size*g_dKoef_mm_to_pt)/2;if(font_size> 300)font_size=300;else if(font_size===0)font_size=1;rPr.FontSize=font_size}}var font_weight=this._getStyle(node,computedStyle,"font-weight");if(font_weight)if("bold"===font_weight||"bolder"===font_weight||4001){var prop_name=trimString(aPair[0]);var prop_value=trimString(aPair[1]); if(null!=this.MsoStyles[prop_name])pPr[prop_name]=prop_value}}},_PrepareContent:function(){if(this.aContent.length>0){var last=this.aContent[this.aContent.length-1];if(type_Table===last.GetType())this._Add_NewParagraph()}},_getMsoListSymbol:function(node){var res=null;var nodeList=this._getMsoListIgnore(node);if(nodeList){var value=nodeList.innerText;if(value)for(var pos=value.getUnicodeIterator();pos.check();pos.next()){var nUnicode=pos.value();if(null!==nUnicode)if(32!==nUnicode&&160!==nUnicode&& 8201!==nUnicode){if(!res)res="";res+=value.charAt(pos.position())}}}return res},_getMsoListIgnore:function(node){if(!node||node&&!node.children)return null;for(var i=0;i=0&&pos0){this.oCurRun=new ParaRun(this.oCurPar);this.oCurRunContentPos=0}}, _CommitElemToParagraph:function(elem){if(null!=this.oCurHyperlink){this.oCurHyperlink.Add_ToContent(this.oCurHyperlinkContentPos,elem,false);this.oCurHyperlinkContentPos++}else{this.oCurPar.Internal_Content_Add(this.oCurParContentPos,elem,false);this.oCurParContentPos++}},_AddToParagraph:function(elem){if(null!=this.oCurRun)if(para_Hyperlink===elem.Type){this._CommitRunToParagraph(true);this._CommitElemToParagraph(elem)}else{if(this.oCurRun.Content.length===Asc.c_dMaxParaRunContentLength)if(this.oCurRun&& this.oCurRun.Pr&&this.oCurRun.Pr.Copy)this._Set_Run_Pr(this.oCurRun.Pr.Copy());this.oCurRun.Add_ToContent(this.oCurRunContentPos,elem,false);this.oCurRunContentPos++;if(1===this.oCurRun.Content.length)this._CommitElemToParagraph(this.oCurRun)}},_Add_NewParagraph:function(){var bFromPresentation=false;if(this.pasteInPresentationShape)bFromPresentation=true;this.oCurPar=new Paragraph(this.oDocument.DrawingDocument,this.oDocument,this.oDocument.bPresentation===true);this.oCurParContentPos=this.oCurPar.CurPos.ContentPos; this.oCurRun=new ParaRun(this.oCurPar);this.oCurRunContentPos=0;this.aContent.push(this.oCurPar);this.oCur_rPr=new CTextPr},_Execute_AddParagraph:function(node,pPr){this._Add_NewParagraph();this._set_pPr(node,this.oCurPar,pPr)},_Decide_AddParagraph:function(node,pPr,bParagraphAdded,bCommitBr){if(true==bParagraphAdded){if(false!=bCommitBr)this._Commit_Br(2,node,pPr);this._Execute_AddParagraph(node,pPr)}else if(false!=bCommitBr)this._Commit_Br(0,node,pPr);return false},_Commit_Br:function(nIgnore,node, pPr){for(var i=0,length=this.nBrCount-nIgnore;i0){spans.row--;nCurColWidth+= spans.col;nCurSum+=spans.width;spans=oRowSpans[nCurColWidth]}};var tc,tcName,nCurRowSpan;for(i=0,length=node.childNodes.length;inCurRowSpan){nMinRowSpanCount= nCurRowSpan;minRowSpanIndex=j}if(nCurRowSpan>1)oRowSpans[nCurColWidth]={row:nCurRowSpan-1,col:nColSpan,width:dWidth}}else{nMinRowSpanCount=0;minRowSpanIndex=j}nCurSum+=dWidth;if(null==oRowSums[nCurColWidth+nColSpan])oRowSums[nCurColWidth+nColSpan]=nCurSum;else if(null!=oRowSums[nCurColWidth+nColSpan-1]&&oRowSums[nCurColWidth+nColSpan-1]>=oRowSums[nCurColWidth+nColSpan])oRowSums[nCurColWidth+nColSpan]+=nCurSum;nCurColWidth+=nColSpan}}nAllSum+=nCurSum;fParseSpans();if(nMinRowSpanCount>1)for(j=0,length2= tr.childNodes.length;jnCurColWidth)nMinColCount=nCurColWidth;if(nMaxColCount0&&nMaxColCount>0){var bUseScaleKoef=this.bUseScaleKoef;var dScaleKoef=this.dScaleKoef;if(dMaxSum*dScaleKoef>this.dMaxWidth){dScaleKoef=dScaleKoef*this.dMaxWidth/dMaxSum;bUseScaleKoef=true}var aGrid=[];var nPrevIndex=null;var nPrevVal=0;for(i in oRowSums){var nCurIndex=i-0;var nCurVal=oRowSums[i];var nCurWidth=nCurVal-nPrevVal;if(bUseScaleKoef)nCurWidth*=dScaleKoef;if(null!= nPrevIndex){var nDif=nCurIndex-nPrevIndex;if(1===nDif)if(!nCurWidth&&!nAllSum&&columnSize)aGrid.push(columnSize.W/nMaxColCount);else aGrid.push(nCurWidth);else{var nPartVal=nCurWidth/nDif;for(j=0;j= oTableSpacingMinValue)row.Set_CellSpacing(spacing);if(node.style.height){var height=node.style.height;if(!("auto"===height||"inherit"===height||-1!==height.indexOf("%"))&&null!=(height=AscCommon.valueToMm(height)))row.Set_Height(height,Asc.linerule_AtLeast)}var bBefore=false;var bAfter=false;var style=node.getAttribute("style");if(null!=style){var tcPr={};this._parseCss(style,tcPr);var margin_left=tcPr["mso-row-margin-left"];if(margin_left&&null!=(margin_left=AscCommon.valueToMm(margin_left)))bBefore= true;var margin_right=tcPr["mso-row-margin-right"];if(margin_right&&null!=(margin_right=AscCommon.valueToMm(margin_right)))bAfter=true}var nCellIndex=0;var nCellIndexSpan=0;var fParseSpans=function(){var spans=oRowSpans[nCellIndexSpan];while(null!=spans){var oCurCell=row.Add_Cell(row.Get_CellsCount(),row,null,false);oCurCell.SetVMerge(vmerge_Continue);if(spans.col>1)oCurCell.Set_GridSpan(spans.col);spans.row--;if(spans.row<=0)delete oRowSpans[nCellIndexSpan];nCellIndexSpan+=spans.col;spans=oRowSpans[nCellIndexSpan]}}; var oBeforeCell=null;var oAfterCell=null;if(bBefore||bAfter)for(var i=0,length=node.childNodes.length;i 1)oCurCell.Set_GridSpan(nColSpan);if(Shd)oCurCell.Set_Shd(Shd);var width=aSumGrid[nCellIndexSpan+nColSpan-1]-aSumGrid[nCellIndexSpan-1];oCurCell.Set_W(new CTableMeasurement(tblwidth_Mm,width));var nRowSpan=tc.getAttribute("rowspan");if(null!=nRowSpan)nRowSpan=nRowSpan-0;else nRowSpan=1;if(nRowSpan>1)oRowSpans[nCellIndexSpan]={row:nRowSpan-1,col:nColSpan};this._ExecuteTableCell(tc,oCurCell,bUseScaleKoef,dScaleKoef,spacing,arrShapes,arrImages,arrTables)}nCellIndexSpan+=nColSpan}}fParseSpans()},_ExecuteTableCell:function(node, cell,bUseScaleKoef,dScaleKoef,spacing,arrShapes,arrImages,arrTables){var Pr=cell.Pr;var bAddIfNull=false;if(null!=spacing)bAddIfNull=true;var computedStyle=this._getComputedStyle(node);var background_color=this._getStyle(node,computedStyle,"background-color");if(null!=background_color&&(background_color=this._ParseColor(background_color))){var Shd=new CDocumentShd;Shd.Value=c_oAscShdClear;Shd.Color=background_color;cell.Set_Shd(Shd)}var border=this._ExecuteBorder(computedStyle,node,"left","Left", bAddIfNull);if(null!=border)cell.Set_Border(border,3);border=this._ExecuteBorder(computedStyle,node,"top","Top",bAddIfNull);if(null!=border)cell.Set_Border(border,0);border=this._ExecuteBorder(computedStyle,node,"right","Right",bAddIfNull);if(null!=border)cell.Set_Border(border,1);border=this._ExecuteBorder(computedStyle,node,"bottom","Bottom",bAddIfNull);if(null!=border)cell.Set_Border(border,2);var top=this._getStyle(node,computedStyle,"padding-top");if(null!=top&&null!=(top=AscCommon.valueToMm(top)))cell.Set_Margins({W:top, Type:tblwidth_Mm},0);var right=this._getStyle(node,computedStyle,"padding-right");if(null!=right&&null!=(right=AscCommon.valueToMm(right)))cell.Set_Margins({W:right,Type:tblwidth_Mm},1);var bottom=this._getStyle(node,computedStyle,"padding-bottom");if(null!=bottom&&null!=(bottom=AscCommon.valueToMm(bottom)))cell.Set_Margins({W:bottom,Type:tblwidth_Mm},2);var left=this._getStyle(node,computedStyle,"padding-left");if(null!=left&&null!=(left=AscCommon.valueToMm(left)))cell.Set_Margins({W:left,Type:tblwidth_Mm}, 3);var whiteSpace=this._getStyle(node,computedStyle,"white-space");if("nowrap"===whiteSpace||true===node.noWrap)cell.SetNoWrap(true);var vAlign=this._getStyle(node,computedStyle,"vertical-align");switch(vAlign){case "middle":cell.Set_VAlign(vertalignjc_Center);break;case "bottom":cell.Set_VAlign(vertalignjc_Bottom);break;case "baseline":case "top":cell.Set_VAlign(vertalignjc_Top);break}var i,length;var bPresentation=!PasteElementsId.g_bIsDocumentCopyPaste;if(bPresentation){var arrShapes2=[],arrImages2= [],arrTables2=[];var presentation=editor.WordControl.m_oLogicDocument;var shape=new CShape;shape.setParent(presentation.Slides[presentation.CurPage]);shape.setTxBody(AscFormat.CreateTextBodyFromString("",presentation.DrawingDocument,shape));arrShapes2.push(shape);this._Execute(node,{},true,true,false,arrShapes2,arrImages2,arrTables);if(arrShapes2.length>0){var first_shape=arrShapes2[0];var content=first_shape.txBody.content;for(i=0,length=content.Content.length;i0){if(bPresentation){oThis.oDocument=shape.txBody.content;if(bAddParagraph)shape.txBody.content.AddNewParagraph();if(!oThis.bIsPlainText){var rPr=oThis._read_rPr(node.parentNode);Item=new ParaTextPr(rPr);shape.paragraphAdd(Item,false)}}else{var oTargetNode=node.parentNode;var bUseOnlyInherit=false;if(oThis._IsBlockElem(oTargetNode.nodeName.toLowerCase()))bUseOnlyInherit= true;bAddParagraph=oThis._Decide_AddParagraph(oTargetNode,pPr,bAddParagraph);oThis._commit_rPr(oTargetNode,bUseOnlyInherit)}var ignoreFirstSpaces=false;if(AscCommon.g_clipboardBase.pastedFrom===AscCommon.c_oClipboardPastedFrom.Excel)ignoreFirstSpaces=true;var bIsPreviousSpace=false,clonePr;for(var oIterator=value.getUnicodeIterator();oIterator.check();oIterator.next()){if(oThis.needAddCommentStart){for(var i=0;ioThis.dMaxWidth){dScaleKoef=dScaleKoef*oThis.dMaxWidth/ nWidth;bUseScaleKoef=true}var oTargetDocument=oThis.oDocument;var oDrawingDocument=oThis.oDocument.DrawingDocument;if(oTargetDocument&&oDrawingDocument){if(oThis.oCurHyperlink){oThis._CommitElemToParagraph(oThis.oCurRun);oThis.oCurRun=new ParaRun(oThis.oCurPar);oThis.oCurRun.Pr.Underline=false}var Drawing=CreateImageFromBinary(sSrc,nWidth,nHeight);oThis._AddToParagraph(Drawing);if(oThis.oCurHyperlink)oThis.oCurRun=new ParaRun(oThis.oCurPar)}}}return bAddParagraph}else return false};var parseLineBreak= function(){if(bPresentation){if("br"===sNodeName||"always"===node.style.pageBreakBefore)shape.paragraphAdd(new ParaNewLine(break_Line),false)}else{var bPageBreakBefore="always"===node.style.pageBreakBefore||"left"===node.style.pageBreakBefore||"right"===node.style.pageBreakBefore;if("br"==sNodeName||bPageBreakBefore)if(bPageBreakBefore){bAddParagraph=oThis._Decide_AddParagraph(node.parentNode,pPr,bAddParagraph);bAddParagraph=true;oThis._Commit_Br(0,node,pPr);oThis._AddToParagraph(new ParaNewLine(break_Page))}else if(AscCommon.g_clipboardBase.pastedFrom=== AscCommon.c_oClipboardPastedFrom.Excel){bAddParagraph=oThis._Decide_AddParagraph(node.parentNode,pPr,bAddParagraph);oThis._Commit_Br(0,node,pPr);oThis._AddToParagraph(new ParaNewLine(break_Line))}else{bAddParagraph=oThis._Decide_AddParagraph(node.parentNode,pPr,bAddParagraph,false);oThis.nBrCount++;if("line-break"===pPr["mso-special-character"]||"always"===pPr["mso-column-break-before"])oThis._Commit_Br(0,node,pPr);return bAddParagraph}}return null};var parseTab=function(){var nTabCount;if(bPresentation){nTabCount= parseInt(pPr["mso-tab-count"]||0);if(nTabCount>0){if(!oThis.bIsPlainText){var rPr=oThis._read_rPr(node);var Item=new ParaTextPr(rPr);shape.paragraphAdd(Item,false)}for(var i=0;i0){bAddParagraph=oThis._Decide_AddParagraph(node,pPr,bAddParagraph);oThis._commit_rPr(node);for(var i=0;iAsc.c_nMaxHyperlinkLength)isPasteHyperlink=false;if(isPasteHyperlink){var HyperProps=new Asc.CHyperlinkProperty({Text:text,Value:href,ToolTip:title});oThis.oDocument.Content[Pos].AddHyperlink(HyperProps)}}}if(!child.style&&Node.TEXT_NODE!==child.nodeType)child.style={};if(!isPasteHyperlink)bAddParagraph=oThis._Execute(child,Common_CopyObj(pPr),false,bAddParagraph,bIsBlockChild||bInBlock,arrShapes,arrImages,arrTables); if(bIsBlockChild)bAddParagraph=true}else{sChildNodeName=child.nodeName.toLowerCase();if(!(Node.ELEMENT_NODE===nodeType||Node.TEXT_NODE===nodeType)||sChildNodeName==="style"||sChildNodeName==="#comment"||sChildNodeName==="script"){if(sChildNodeName==="#comment")if(child.nodeValue==="[if !supportAnnotations]")oThis.startMsoAnnotation=true;else if(oThis.startMsoAnnotation&&child.nodeValue==="[endif]")oThis.startMsoAnnotation=false;return}if(oThis.startMsoAnnotation){if(child.id){var idAnchor=child.id.split("_anchor_"); if(idAnchor&&idAnchor[1]&&oThis.msoComments[idAnchor[1]]&&oThis.msoComments[idAnchor[1]].start)if(null!=oThis.oCurRun){if(!oThis.needAddCommentEnd)oThis.needAddCommentEnd=[];oThis.needAddCommentEnd.push(new AscCommon.ParaComment(false,oThis.msoComments[idAnchor[1]].start));delete oThis.msoComments[idAnchor[1]]}}return}var msoCommentReference=pPr["mso-comment-reference"];if(msoCommentReference){var commentId=msoCommentReference.split("_");if(commentId&&undefined!==commentId[1]){var startComment=oThis.msoComments[commentId[1]]; if(startComment&&!startComment.start){var newCCommentId=oThis._addComment({Date:pPr["mso-comment-date"],Text:startComment.text});oThis.msoComments[commentId[1]].start=newCCommentId;if(!oThis.needAddCommentStart)oThis.needAddCommentStart=[];oThis.needAddCommentStart.push(new AscCommon.ParaComment(true,newCCommentId))}}}if("comment"===pPr["mso-special-character"])return;if(Node.TEXT_NODE===child.nodeType){var value=child.nodeValue;if(!value)return;if(child.parentNode&&child.parentNode.nodeName&&"span"=== child.parentNode.nodeName.toLowerCase())value=value.replace(/(\r|\t|\n)/g," ");else value=value.replace(/(\r|\t|\n)/g,"");if(""==value)return}var bIsBlockChild=oThis._IsBlockElem(sChildNodeName);if(bRoot)oThis.bInBlock=false;if(bIsBlockChild){bAddParagraph=true;oThis.bInBlock=true}var oOldHyperlink=null;var oOldHyperlinkContentPos=null;var oHyperlink=null;if("a"===sChildNodeName){var href=child.href;if(null!=href)if(href&&href.length>0){var title=child.getAttribute("title");bAddParagraph=oThis._Decide_AddParagraph(child, pPr,bAddParagraph);oHyperlink=new ParaHyperlink;oHyperlink.SetParagraph(oThis.oCurPar);oHyperlink.Set_Value(href);if(null!=title)oHyperlink.SetToolTip(title);oOldHyperlink=oThis.oCurHyperlink;oOldHyperlinkContentPos=oThis.oCurHyperlinkContentPos;oThis.oCurHyperlink=oHyperlink;oThis.oCurHyperlinkContentPos=0}}if(!child.style&&Node.TEXT_NODE!==child.nodeType)child.style={};bAddParagraph=oThis._Execute(child,Common_CopyObj(pPr),false,bAddParagraph,bIsBlockChild||bInBlock);if(bIsBlockChild)bAddParagraph= true;if("a"===sChildNodeName&&null!=oHyperlink){oThis.oCurHyperlink=oOldHyperlink;oThis.oCurHyperlinkContentPos=oOldHyperlinkContentPos;if(oHyperlink.Content.length>0){if(oThis.pasteInExcel){var TextPr=new CTextPr;TextPr.Unifill=AscFormat.CreateUniFillSchemeColorWidthTint(11,0);TextPr.Underline=true;oHyperlink.Apply_TextPr(TextPr,undefined,true)}if(oHyperlink.Content&&oHyperlink.Content.length&&oHyperlink.Paragraph.bFromDocument)if(oThis.oLogicDocument&&oThis.oLogicDocument.Styles&&oThis.oLogicDocument.Styles.Default&& oThis.oLogicDocument.Styles.Default.Hyperlink&&oThis.oLogicDocument.Styles.Style){var hyperLinkStyle=oThis.oLogicDocument.Styles.Default.Hyperlink;for(var k=0;k1){_w=Math.max(5,__w/dKoef);_h=Math.max(5,__h/dKoef);bIsCorrect= true}else{_w=__w;_h=__h}}w=__w;h=__h}else{w=50;h=50}}else{w=nW;h=nH}var para_drawing=new ParaDrawing(w,h,null,editor.WordControl.m_oLogicDocument.DrawingDocument,editor.WordControl.m_oLogicDocument,null);var word_image=AscFormat.DrawingObjectsController.prototype.createImage(bin,0,0,w,h);para_drawing.Set_GraphicObject(word_image);word_image.setParent(para_drawing);para_drawing.Set_GraphicObject(word_image);return para_drawing}function Check_LoadingDataBeforePrepaste(_api,_fonts,_images,_callback){var aPrepeareFonts= [];for(var font_family in _fonts)aPrepeareFonts.push(new CFont(font_family,0,"",0));AscFonts.FontPickerByCharacter.extendFonts(aPrepeareFonts);var aImagesToDownload=[];for(var image in _images){var src=_images[image];if(undefined!==window["Native"]&&undefined!==window["Native"]["GetImageUrl"])_images[image]=window["Native"]["GetImageUrl"](_images[image]);else if(!g_oDocumentUrls.getImageUrl(src)&&!g_oDocumentUrls.getImageLocal(src))aImagesToDownload.push(src)}if(aImagesToDownload.length>0)AscCommon.sendImgUrls(_api, aImagesToDownload,function(data){var image_map={};for(var i=0,length=Math.min(data.length,aImagesToDownload.length);i-1||childClass.indexOf("docData;")>-1||childClass.indexOf("pptData;")>-1))return childClass;else return searchBinaryClass(node.children[0])}return res}function SpecialPasteShowOptions(){this.options=null;this.cellCoord=null;this.range=null;this.shapeId=null;this.fixPosition=null;this.position=null;this.showPasteSpecial=null;this.containTables= null}SpecialPasteShowOptions.prototype={constructor:SpecialPasteShowOptions,isClean:function(){var res=false;if(null===this.options&&null===this.cellCoord&&null===this.range&&null===this.shapeId&&null===this.fixPosition)res=true;return res},clean:function(){this.options=null;this.cellCoord=null;this.range=null;this.shapeId=null;this.fixPosition=null;this.position=null;this.showPasteSpecial=null;this.containTables=null},setRange:function(val){this.range=val},setShapeId:function(val){this.shapeId=val}, setFixPosition:function(val){this.fixPosition=val},setPosition:function(val){this.position=val},asc_setCellCoord:function(val){this.cellCoord=val},asc_setOptions:function(val){if(val===null)this.options=[];else this.options=val},asc_getCellCoord:function(){return this.cellCoord},asc_getOptions:function(){return this.options},asc_getShowPasteSpecial:function(){return this.showPasteSpecial},asc_setShowPasteSpecial:function(val){this.showPasteSpecial=val},asc_getContainTables:function(){return this.containTables}, asc_setContainTables:function(val){this.containTables=val}};function checkOnlyOneImage(node){var res=false;if(node&&node.childNodes)for(var i=0;ihigh)high=this.records[i].high;return high};Node.prototype.updateHeight=function(){this.height=Math.max(height(this.left),height(this.right))+1};Node.prototype.updateMaxOfParents=function(){if(this===undefined)return;var thisHigh=this.getNodeHigh();if(this.left!==undefined&&this.right!==undefined)this.max= Math.max(Math.max(this.left.max,this.right.max),thisHigh);else if(this.left!==undefined&&this.right===undefined)this.max=Math.max(this.left.max,thisHigh);else if(this.left===undefined&&this.right!==undefined)this.max=Math.max(this.right.max,thisHigh);else this.max=thisHigh;if(this.parent)this.parent.updateMaxOfParents()};Node.prototype._updateMaxAfterRightRotate=function(){var parent=this.parent;var left=parent.left;var thisParentLeftHigh=left.getNodeHigh();if(left.left===undefined&&left.right!== undefined)left.max=Math.max(thisParentLeftHigh,left.right.max);else if(left.left!==undefined&&left.right===undefined)left.max=Math.max(thisParentLeftHigh,left.left.max);else if(left.left===undefined&&left.right===undefined)left.max=thisParentLeftHigh;else left.max=Math.max(Math.max(left.left.max,left.right.max),thisParentLeftHigh);var thisHigh=this.getNodeHigh();if(this.left===undefined&&this.right!==undefined)this.max=Math.max(thisHigh,this.right.max);else if(this.left!==undefined&&this.right=== undefined)this.max=Math.max(thisHigh,this.left.max);else if(this.left===undefined&&this.right===undefined)this.max=thisHigh;else this.max=Math.max(Math.max(this.left.max,this.right.max),thisHigh);parent.max=Math.max(Math.max(parent.left.max,parent.right.max),parent.getNodeHigh())};Node.prototype._updateMaxAfterLeftRotate=function(){var parent=this.parent;var right=parent.right;var thisParentRightHigh=right.getNodeHigh();if(right.left===undefined&&right.right!==undefined)right.max=Math.max(thisParentRightHigh, right.right.max);else if(right.left!==undefined&&right.right===undefined)right.max=Math.max(thisParentRightHigh,right.left.max);else if(right.left===undefined&&right.right===undefined)right.max=thisParentRightHigh;else right.max=Math.max(Math.max(right.left.max,right.right.max),thisParentRightHigh);var thisHigh=this.getNodeHigh();if(this.left===undefined&&this.right!==undefined)this.max=Math.max(thisHigh,this.right.max);else if(this.left!==undefined&&this.right===undefined)this.max=Math.max(thisHigh, this.left.max);else if(this.left===undefined&&this.right===undefined)this.max=thisHigh;else this.max=Math.max(Math.max(this.left.max,this.right.max),thisHigh);parent.max=Math.max(Math.max(parent.left.max,right.max),parent.getNodeHigh())};Node.prototype._leftRotate=function(){var rightChild=this.right;rightChild.parent=this.parent;if(rightChild.parent===undefined)this.intervalTree.root=rightChild;else if(rightChild.parent.left===this)rightChild.parent.left=rightChild;else if(rightChild.parent.right=== this)rightChild.parent.right=rightChild;this.right=rightChild.left;if(this.right!==undefined)this.right.parent=this;rightChild.left=this;this.parent=rightChild;this.updateHeight();rightChild.updateHeight()};Node.prototype._rightRotate=function(){var leftChild=this.left;leftChild.parent=this.parent;if(leftChild.parent===undefined)this.intervalTree.root=leftChild;else if(leftChild.parent.left===this)leftChild.parent.left=leftChild;else if(leftChild.parent.right===this)leftChild.parent.right=leftChild; this.left=leftChild.right;if(this.left!==undefined)this.left.parent=this;leftChild.right=this;this.parent=leftChild;this.updateHeight();leftChild.updateHeight()};Node.prototype._rebalance=function(){if(height(this.left)>=2+height(this.right)){var left=this.left;if(height(left.left)>=height(left.right)){this._rightRotate();this._updateMaxAfterRightRotate()}else{left._leftRotate();this._rightRotate();this._updateMaxAfterRightRotate()}}else if(height(this.right)>=2+height(this.left)){var right=this.right; if(height(right.right)>=height(right.left)){this._leftRotate();this._updateMaxAfterLeftRotate()}else{right._rightRotate();this._leftRotate();this._updateMaxAfterLeftRotate()}}};Node.prototype.insert=function(record){if(record.low=low)output.push(currentNode.records[i])};Node.prototype.search=function(low,high,output){if(this===undefined)return;if(low>this.max)return;if(this.left!==undefined&&this.left.max>=low)this.left.search(low,high,output);this._getOverlappingRecords(this, low,high,output);if(highthis.max)return;if(this.key<=high)for(var i=0;i=low)return this.records[i];if(this.left!==undefined&&this.left.max>=low)return this.left.searchAny(low,high);else if(this.right!==undefined&&this.key<=high)return this.right.searchAny(low,high)};Node.prototype.searchExisting= function(low){if(this===undefined)return undefined;if(this.key===low)return this;else if(lowthis.key)if(this.right!==undefined)return this.right.remove(node);else return undefined;else if(this.left!==undefined&&this.right!==undefined){var minValue=this.right._minValue();this.key=minValue.key;this.records=minValue.records;return this.right.remove(this)}else if(parent.left===this){if(this.right!==undefined){parent.left=this.right;this.right.parent=parent}else{parent.left=this.left;if(this.left!==undefined)this.left.parent=parent}parent.updateMaxOfParents();parent.updateHeight(); parent._rebalance();return this}else if(parent.right===this){if(this.right!==undefined){parent.right=this.right;this.right.parent=parent}else{parent.right=this.left;if(this.left!==undefined)this.left.parent=parent}parent.updateMaxOfParents();parent.updateHeight();parent._rebalance();return this}};return Node}();var IntervalTree=function(){function IntervalTree(){this.count=0}IntervalTree.prototype.insert=function(record){if(record.low>record.high)throw new Error("`low` value must be lower or equal to `high` value"); if(this.root===undefined){this.root=new Node(this,record);this.count++;return true}else{var node=this.root.searchExisting(record.low);if(node!==undefined){for(var i=0;inode.max){node.max=record.high;if(node.parent)node.parent.updateMaxOfParents()}this.count++;return true}else{this.root.insert(record);this.count++;return true}}};IntervalTree.prototype.search=function(low,high,opt_output){if(!opt_output)opt_output= [];if(this.root!==undefined)this.root.search(low,high,opt_output);return opt_output};IntervalTree.prototype.searchExisting=function(low,high){if(this.root){var node=this.root.searchExisting(low);if(node)for(var i=0;i1){var removedRecord=void 0;for(var i=0;i=0&&fromIndex<=s.length?fromIndex:s.length;for(var i=end-1;i>=0;--i){var j=s.slice(i,end).search(regExp);if(j>=0)return i+j}return-1}function search(arr,fn){for(var i=0;i=0?.5:-.5);return y|y}function floor(x){var y=x|x;y-=x<0&&y>x?1:0;return y+(x-y>kLeftLim1?1:0)}function ceil(x){var y=x|x;y+=x>0&&ykLeftLim1?1:0)}function incDecFonSize(bIncrease,oValue){var aSizes=[8,9,10,11,12,14,16,18,20,22,24,26,28,36,48,72];var nLength=aSizes.length;var i;if(true===bIncrease){if(oValue>=aSizes[nLength-1])return null;for(i=0;ioValue)break}else{if(oValue<= aSizes[0])return null;for(i=nLength-1;i>=0;--i)if(aSizes[i]>0;return value}function convertPxToPt(value){value=value*sizePxinPt;value=Asc.ceil(value/AscBrowser.retinaPixelRatio*100)/100;return value}function profileTime(fn){var start,end,arg=[],i;if(arguments.length){if(arguments.length>1){for(i= 1;iborder2.w)return border1;else if(border1.wBrightness_1_2)return border2;var Brightness_2_1=Brightness_1_1-r1;var Brightness_2_2=Brightness_1_2-r2;if(Brightness_2_1Brightness_2_2)return border2;var Brightness_3_1=g1;var Brightness_3_2=g2;if(Brightness_3_1Brightness_3_2)return border2; return border1}function WordSplitting(str){var trueLetter=false;var index=0;var wordsArray=[];var wordsIndexArray=[];for(var i=0;i>0));else if(fill.patternFill){oUniFill=new AscFormat.CUniFill;oUniFill.fill=new AscFormat.CPattFill;oUniFill.fill.ftype=fill.patternFill.getHatchOffset();oUniFill.fill.fgClr=AscFormat.CreateUniColorRGB2(fill.patternFill.fgColor||AscCommonExcel.createRgbColor(0,0,0));oUniFill.fill.bgClr=AscFormat.CreateUniColorRGB2(fill.patternFill.bgColor||AscCommonExcel.createRgbColor(255,255,255))}else if(fill.gradientFill){oUniFill= new AscFormat.CUniFill;oUniFill.fill=new AscFormat.CGradFill;if(fill.gradientFill.type===Asc.c_oAscFillGradType.GRAD_LINEAR){oUniFill.fill.lin=new AscFormat.GradLin;oUniFill.fill.lin.angle=fill.gradientFill.degree*6E4}else oUniFill.fill.path=new AscFormat.GradPath;for(var i=0;ithis.c2){tmp=this.c1; this.c1=this.c2;this.c2=tmp}if(this.r1>this.r2){tmp=this.r1;this.r1=this.r2;this.r2=tmp}return this};Range.prototype.isEqual=function(range){return range&&this.c1===range.c1&&this.r1===range.r1&&this.c2===range.c2&&this.r2===range.r2};Range.prototype.isEqualCols=function(range){return range&&this.c1===range.c1&&this.c2===range.c2};Range.prototype.isEqualRows=function(range){return range&&this.r1===range.r1&&this.r2===range.r2};Range.prototype.isNeighbor=function(range){if(this.isEqualCols(range)){if(this.r2=== range.r1-1||range.r2===this.r1-1)return true}else if(this.isEqualRows(range))if(this.c2===range.c1-1||range.c2===this.c1-1)return true;return false};Range.prototype.isEqualAll=function(range){return this.isEqual(range)&&this.refType1===range.refType1&&this.refType2===range.refType2};Range.prototype.isEqualWithOffsetRow=function(range,offsetRow){return this.c1===range.c1&&this.c2===range.c2&&this.isAbsC1()===range.isAbsC1()&&this.isAbsC2()===range.isAbsC2()&&this.isAbsR1()===range.isAbsR1()&&this.isAbsR2()=== range.isAbsR2()&&((this.isAbsR1()?this.r1===range.r1:this.r1+offsetRow===range.r1)&&(this.isAbsR2()?this.r2===range.r2:this.r2+offsetRow===range.r2)||this.r1===0&&this.r2===gc_nMaxRow0&&this.r1===range.r1&&this.r2===range.r2)};Range.prototype.contains=function(c,r){return this.c1<=c&&c<=this.c2&&this.r1<=r&&r<=this.r2};Range.prototype.contains2=function(cell){return this.contains(cell.col,cell.row)};Range.prototype.containsCol=function(c){return this.c1<=c&&c<=this.c2};Range.prototype.containsRow= function(r){return this.r1<=r&&r<=this.r2};Range.prototype.containsRange=function(range){return this.contains(range.c1,range.r1)&&this.contains(range.c2,range.r2)};Range.prototype.containsFirstLineRange=function(range){return this.contains(range.c1,range.r1)&&this.contains(range.c2,range.r1)};Range.prototype.intersection=function(range){var s1=this.clone(true),s2=range instanceof Range?range.clone(true):new Range(range.c1,range.r1,range.c2,range.r2,true);if(s2.c1>s1.c2||s2.c2s1.r2|| s2.r2=s1.c1&&s2.c1<=s1.c2?s2.c1:s1.c1,s2.r1>=s1.r1&&s2.r1<=s1.r2?s2.r1:s1.r1,Math.min(s1.c2,s2.c2),Math.min(s1.r2,s2.r2))};Range.prototype.intersectionSimple=function(range){var oRes=null;var r1=Math.max(this.r1,range.r1);var c1=Math.max(this.c1,range.c1);var r2=Math.min(this.r2,range.r2);var c2=Math.min(this.c2,range.c2);if(r1<=r2&&c1<=c2)oRes=new Range(c1,r1,c2,r2);return oRes};Range.prototype.isIntersect=function(range){var bRes=true;if(range.r20){intersect=(new Range(0,0,gc_nMaxCol0,this.r1-1)).intersectionSimple(range);if(intersect)res.push(intersect)}if(this.c1>0){intersect=(new Range(0,this.r1,this.c1-1,this.r2)).intersectionSimple(range); if(intersect)res.push(intersect)}if(this.c2gc_nMaxRow0)if(opt_circle)this.r1-=gc_nMaxRow0+1;else{this.r1=gc_nMaxRow0;return false}}if(!isAbsCol1){this.c1+=col;if(this.c1<0)if(opt_circle)this.c1+=gc_nMaxCol0+1;else{this.c1=0;if(!opt_canResize)return false}if(this.c1>gc_nMaxCol0)if(opt_circle)this.c1-=gc_nMaxCol0+1;else{this.c1=gc_nMaxCol0;return false}}if(!isAbsRow2){this.r2+=row;if(this.r2<0)if(opt_circle)this.r2+=gc_nMaxRow0+1;else{this.r2=0;return false}if(this.r2>gc_nMaxRow0)if(opt_circle)this.r2-= gc_nMaxRow0+1;else{this.r2=gc_nMaxRow0;if(!opt_canResize)return false}}if(!isAbsCol2){this.c2+=col;if(this.c2<0)if(opt_circle)this.c2+=gc_nMaxCol0+1;else{this.c2=0;return false}if(this.c2>gc_nMaxCol0)if(opt_circle)this.c2-=gc_nMaxCol0+1;else{this.c2=gc_nMaxCol0;if(!opt_canResize)return false}}if(this.r1>this.r2){temp=this.r1;this.r1=this.r2;this.r2=temp;if(!isAbsRow1&&isAbsRow2){isAbsRow1=!isAbsRow1;isAbsRow2=!isAbsRow2;this.setAbs(isAbsRow1,isAbsCol1,isAbsRow2,isAbsCol2)}}if(this.c1>this.c2){temp= this.c1;this.c1=this.c2;this.c2=temp;if(!isAbsCol1&&isAbsCol2){isAbsCol1=!isAbsCol1;isAbsCol2=!isAbsCol2;this.setAbs(isAbsRow1,isAbsCol1,isAbsRow2,isAbsCol2)}}return true};Range.prototype.setOffset=function(offset){if(this.r1==0&&this.r2==gc_nMaxRow0&&offset.row!=0||this.c1==0&&this.c2==gc_nMaxCol0&&offset.col!=0)return;this.setOffsetFirst(offset);this.setOffsetLast(offset)};Range.prototype.setOffsetFirst=function(offset){this.c1+=offset.col;if(this.c1<0)this.c1=0;if(this.c1>gc_nMaxCol0)this.c1=gc_nMaxCol0; this.r1+=offset.row;if(this.r1<0)this.r1=0;if(this.r1>gc_nMaxRow0)this.r1=gc_nMaxRow0};Range.prototype.setOffsetLast=function(offset){this.c2+=offset.col;if(this.c2<0)this.c2=0;if(this.c2>gc_nMaxCol0)this.c2=gc_nMaxCol0;this.r2+=offset.row;if(this.r2<0)this.r2=0;if(this.r2>gc_nMaxRow0)this.r2=gc_nMaxRow0};Range.prototype._getName=function(val,isCol,abs){var isR1C1Mode=AscCommonExcel.g_R1C1Mode;val+=1;if(isCol&&!isR1C1Mode)val=g_oCellAddressUtils.colnumToColstr(val);return(isR1C1Mode?isCol?"C":"R": "")+(abs?isR1C1Mode?val:"$"+val:isR1C1Mode?0!==(val=val-(isCol?AscCommonExcel.g_ActiveCell.c1:AscCommonExcel.g_ActiveCell.r1)-1)?"["+val+"]":"":val)};Range.prototype.getName=function(refType){var isR1C1Mode=AscCommonExcel.g_R1C1Mode;var c,r,type=this.getType();var sRes="";var c1Abs,c2Abs,r1Abs,r2Abs;if(referenceType.A===refType)c1Abs=c2Abs=r1Abs=r2Abs=true;else if(referenceType.R===refType)c1Abs=c2Abs=r1Abs=r2Abs=false;else{c1Abs=this.isAbsCol(this.refType1);c2Abs=this.isAbsCol(this.refType2);r1Abs= this.isAbsRow(this.refType1);r2Abs=this.isAbsRow(this.refType2)}if((c_oAscSelectionType.RangeMax===type||c_oAscSelectionType.RangeRow===type)&&c1Abs===c2Abs){sRes=this._getName(this.r1,false,r1Abs);if(this.r1!==this.r2||r1Abs!==r2Abs||!isR1C1Mode)sRes+=":"+this._getName(this.r2,false,r2Abs)}else if((c_oAscSelectionType.RangeMax===type||c_oAscSelectionType.RangeCol===type)&&r1Abs===r2Abs){sRes=this._getName(this.c1,true,c1Abs);if(this.c1!==this.c2||c1Abs!==c2Abs||!isR1C1Mode)sRes+=":"+this._getName(this.c2, true,c2Abs)}else{r=this._getName(this.r1,false,r1Abs);c=this._getName(this.c1,true,c1Abs);sRes=isR1C1Mode?r+c:c+r;if(!this.isOneCell()||r1Abs!==r2Abs||c1Abs!==c2Abs){r=this._getName(this.r2,false,r2Abs);c=this._getName(this.c2,true,c2Abs);sRes+=":"+(isR1C1Mode?r+c:c+r)}}return sRes};Range.prototype.getAbsName=function(){return this.getName(referenceType.A)};Range.prototype.getType=function(){var bRow=0===this.c1&&gc_nMaxCol0===this.c2;var bCol=0===this.r1&&gc_nMaxRow0===this.r2;var res;if(bCol&&bRow)res= c_oAscSelectionType.RangeMax;else if(bCol)res=c_oAscSelectionType.RangeCol;else if(bRow)res=c_oAscSelectionType.RangeRow;else res=c_oAscSelectionType.RangeCells;return res};Range.prototype.getSharedRange=function(sharedRef,c,r){var isAbsR1=this.isAbsR1();var isAbsC1=this.isAbsC1();var isAbsR2=this.isAbsR2();var isAbsC2=this.isAbsC2();if(this.r1===0&&this.r2===gc_nMaxRow0)isAbsR1=isAbsR2=true;if(this.c1===0&&this.c2===gc_nMaxCol0)isAbsC1=isAbsC2=true;var r1=isAbsR2?sharedRef.r1:Math.max(sharedRef.r2+ (r-this.r2),sharedRef.r1);var c1=isAbsC2?sharedRef.c1:Math.max(sharedRef.c2+(c-this.c2),sharedRef.c1);var r2=isAbsR1?sharedRef.r2:Math.min(sharedRef.r1+(r-this.r1),sharedRef.r2);var c2=isAbsC1?sharedRef.c2:Math.min(sharedRef.c1+(c-this.c1),sharedRef.c2);return new Range(c1,r1,c2,r2)};Range.prototype.getSharedRangeBbox=function(ref,base){var res=this.clone();var shiftBase;var offset=new AscCommon.CellBase(ref.r1-base.nRow,ref.c1-base.nCol);if(!offset.isEmpty()){shiftBase=this.clone();shiftBase.setOffsetWithAbs(offset, false,false)}offset.row=ref.r2-base.nRow;offset.col=ref.c2-base.nCol;res.setOffsetWithAbs(offset,false,false);res.union2(shiftBase?shiftBase:this);return res};Range.prototype.getSharedIntersect=function(sharedRef,bbox){var leftTop=this.getSharedRange(sharedRef,bbox.c1,bbox.r1);var rightBottom=this.getSharedRange(sharedRef,bbox.c2,bbox.r2);return leftTop.union(rightBottom)};Range.prototype.setAbs=function(absRow1,absCol1,absRow2,absCol2){this.refType1=(absRow1?0:2)+(absCol1?0:1);this.refType2=(absRow2? 0:2)+(absCol2?0:1)};Range.prototype.isAbsCol=function(refType){return refType===referenceType.A||refType===referenceType.RRAC};Range.prototype.isAbsRow=function(refType){return refType===referenceType.A||refType===referenceType.ARRC};Range.prototype.isAbsR1=function(){return this.isAbsRow(this.refType1)};Range.prototype.isAbsC1=function(){return this.isAbsCol(this.refType1)};Range.prototype.isAbsR2=function(){return this.isAbsRow(this.refType2)};Range.prototype.isAbsC2=function(){return this.isAbsCol(this.refType2)}; Range.prototype.isAbsAll=function(){return this.isAbsR1()&&this.isAbsC1()&&this.isAbsR2()&&this.isAbsC2()};Range.prototype.switchReference=function(){this.refType1=(this.refType1+1)%4;this.refType2=(this.refType2+1)%4};Range.prototype.getWidth=function(){return this.c2-this.c1+1};Range.prototype.getHeight=function(){return this.r2-this.r1+1};Range.prototype.transpose=function(startCol,startRow){if(startCol===undefined)startCol=this.c1;if(startRow===undefined)startRow=this.r1;var row0=this.c1-startCol+ startRow;var col0=this.r1-startRow+startCol;return new Range(col0,row0,col0+(this.r2-this.r1),row0+(this.c2-this.c1))};function Range3D(){this.sheet="";this.sheet2="";if(3==arguments.length){var range=arguments[0];Range.call(this,range.c1,range.r1,range.c2,range.r2);this.refType1=range.refType1;this.refType2=range.refType2;this.sheet=arguments[1];this.sheet2=arguments[2]}else if(arguments.length>1)Range.apply(this,arguments);else Range.call(this,0,0,0,0)}Range3D.prototype=Object.create(Range.prototype); Range3D.prototype.constructor=Range3D;Range3D.prototype.isIntersect=function(){var oRes=true;if(2==arguments.length)oRes=this.sheet===arguments[1];return oRes&&Range.prototype.isIntersect.apply(this,arguments)};Range3D.prototype.clone=function(){return new Range3D(Range.prototype.clone.apply(this,arguments),this.sheet,this.sheet2)};Range3D.prototype.setSheet=function(sheet,sheet2){this.sheet=sheet;this.sheet2=sheet2?sheet2:sheet};Range3D.prototype.getName=function(){return AscCommon.parserHelp.get3DRef(this.sheet, Range.prototype.getName.apply(this))};function SelectionRange(ws){this.ranges=[new Range(0,0,0,0)];this.activeCell=new AscCommon.CellBase(0,0);this.activeCellId=0;this.worksheet=ws}SelectionRange.prototype.clean=function(){this.ranges=[new Range(0,0,0,0)];this.activeCellId=0;this.activeCell.clean()};SelectionRange.prototype.contains=function(c,r){return this.ranges.some(function(item){return item.contains(c,r)})};SelectionRange.prototype.contains2=function(cell){return this.contains(cell.col,cell.row)}; SelectionRange.prototype.containsCol=function(c){return this.ranges.some(function(item){return item.containsCol(c)})};SelectionRange.prototype.containsRow=function(r){return this.ranges.some(function(item){return item.containsRow(r)})};SelectionRange.prototype.inContains=function(ranges){return this.ranges.every(function(item1){return ranges.some(function(item2){return item2.containsRange(item1)})})};SelectionRange.prototype.containsRange=function(range){return this.ranges.some(function(item){return item.containsRange(range)})}; SelectionRange.prototype.clone=function(worksheet){var res=new SelectionRange;res.ranges=this.ranges.map(function(range){return range.clone()});res.activeCell=this.activeCell.clone();res.activeCellId=this.activeCellId;res.worksheet=worksheet||this.worksheet;return res};SelectionRange.prototype.isEqual=function(range){if(this.activeCellId!==range.activeCellId||!this.activeCell.isEqual(range.activeCell)||this.ranges.length!==range.ranges.length)return false;for(var i=0;ithis.activeCellId?this.activeCellId:0;curRange=this.ranges[this.activeCellId];this.activeCell.row=curRange.r1;this.activeCell.col=curRange.c1}else{this.activeCellId-=1;this.activeCellId=0<=this.activeCellId?this.activeCellId:this.ranges.length-1;curRange=this.ranges[this.activeCellId];this.activeCell.row= curRange.r2;this.activeCell.col=curRange.c2}}}mc=this.worksheet.getMergedByCell(this.activeCell.row,this.activeCell.col);if(mc){incompleate=!curRange.containsRange(mc);if(dc>0&&(incompleate||this.activeCell.col>mc.c1||this.activeCell.row!==mc.r1)){this.activeCell.col=mc.c2+1;done=false}else if(dc<0&&(incompleate||this.activeCell.col0&&(incompleate||this.activeCell.row>mc.r1||this.activeCell.col!==mc.c1)){this.activeCell.row= mc.r2+1;done=false}else if(dr<0&&(incompleate||this.activeCell.row=curRange.c1&&this.activeCell.col<=curRange.c2&&fCheckSize(-1,this.activeCell.col)){this.activeCell.col+=dc||(dr>0?+1:-1);done=false}if(!done)continue;while(this.activeCell.row>=curRange.r1&&this.activeCell.row<=curRange.r2&&fCheckSize(this.activeCell.row,-1)){this.activeCell.row+=dr||(dc>0?+1:-1);done=false}if(!done)continue; break}return lastRow!==this.activeCell.row||lastCol!==this.activeCell.col?1:-1};SelectionRange.prototype.setActiveCell=function(r,c){this.activeCell.row=r;this.activeCell.col=c;this.update()};SelectionRange.prototype.validActiveCell=function(){var res=true;var mc=this.worksheet.getMergedByCell(this.activeCell.row,this.activeCell.col);if(mc){var curRange=this.ranges[this.activeCellId];if(!curRange.containsRange(mc))if(-1===this.offsetCell(1,0,false,function(){return false})){res=false;this.activeCell.row= mc.r1;this.activeCell.col=mc.c1}}return res};SelectionRange.prototype.getLast=function(){return this.ranges[this.ranges.length-1]};SelectionRange.prototype.isSingleRange=function(){return 1===this.ranges.length};SelectionRange.prototype.update=function(){var range=this.ranges[this.activeCellId];if(!range||!range.contains(this.activeCell.col,this.activeCell.row)){range=this.getLast();this.activeCell.col=range.c1;this.activeCell.row=range.r1;this.activeCellId=this.ranges.length-1}};SelectionRange.prototype.WriteToBinary= function(w){w.WriteLong(this.ranges.length);for(var i=0;i 0)this.ranges=rangesNew;this.activeCell.row=r.GetLong();this.activeCell.col=r.GetLong();this.activeCellId=r.GetLong();this.update()};SelectionRange.prototype.Select=function(){this.worksheet.selectionRange=this.clone();this.worksheet.workbook.handlers.trigger("updateSelection")};function ActiveRange(){if(1==arguments.length){var range=arguments[0];Range.call(this,range.c1,range.r1,range.c2,range.r2);this.refType1=range.refType1;this.refType2=range.refType2}else if(arguments.length>1)Range.apply(this, arguments);else Range.call(this,0,0,0,0);this.startCol=0;this.startRow=0;this._updateAdditionalData()}ActiveRange.prototype=Object.create(Range.prototype);ActiveRange.prototype.constructor=ActiveRange;ActiveRange.prototype.assign=function(){Range.prototype.assign.apply(this,arguments);this._updateAdditionalData();return this};ActiveRange.prototype.assign2=function(){Range.prototype.assign2.apply(this,arguments);this._updateAdditionalData();return this};ActiveRange.prototype.clone=function(){var oRes= new ActiveRange(Range.prototype.clone.apply(this,arguments));oRes.startCol=this.startCol;oRes.startRow=this.startRow;return oRes};ActiveRange.prototype.normalize=function(){Range.prototype.normalize.apply(this,arguments);this._updateAdditionalData();return this};ActiveRange.prototype.isEqualAll=function(){var bRes=Range.prototype.isEqual.apply(this,arguments);if(bRes&&arguments.length>0){var range=arguments[0];bRes=this.startCol==range.startCol&&this.startRow==range.startRow}return bRes};ActiveRange.prototype.contains= function(){return Range.prototype.contains.apply(this,arguments)};ActiveRange.prototype.containsRange=function(){return Range.prototype.containsRange.apply(this,arguments)};ActiveRange.prototype.containsFirstLineRange=function(){return Range.prototype.containsFirstLineRange.apply(this,arguments)};ActiveRange.prototype.intersection=function(){var oRes=Range.prototype.intersection.apply(this,arguments);if(null!=oRes){oRes=new ActiveRange(oRes);oRes._updateAdditionalData()}return oRes};ActiveRange.prototype.intersectionSimple= function(){var oRes=Range.prototype.intersectionSimple.apply(this,arguments);if(null!=oRes){oRes=new ActiveRange(oRes);oRes._updateAdditionalData()}return oRes};ActiveRange.prototype.union=function(){var oRes=new ActiveRange(Range.prototype.union.apply(this,arguments));oRes._updateAdditionalData();return oRes};ActiveRange.prototype.union2=function(){Range.prototype.union2.apply(this,arguments);this._updateAdditionalData();return this};ActiveRange.prototype.union3=function(){Range.prototype.union3.apply(this, arguments);this._updateAdditionalData();return this};ActiveRange.prototype.setOffset=function(offset){this.setOffsetFirst(offset);this.setOffsetLast(offset)};ActiveRange.prototype.setOffsetFirst=function(offset){Range.prototype.setOffsetFirst.apply(this,arguments);this._updateAdditionalData();return this};ActiveRange.prototype.setOffsetLast=function(offset){Range.prototype.setOffsetLast.apply(this,arguments);this._updateAdditionalData();return this};ActiveRange.prototype._updateAdditionalData=function(){if(!this.contains(this.startCol, this.startRow)){this.startCol=this.c1;this.startRow=this.r1}};function FormulaRange(){if(1==arguments.length){var range=arguments[0];Range.call(this,range.c1,range.r1,range.c2,range.r2)}else if(arguments.length>1)Range.apply(this,arguments);else Range.call(this,0,0,0,0);this.refType1=referenceType.R;this.refType2=referenceType.R}FormulaRange.prototype=Object.create(Range.prototype);FormulaRange.prototype.constructor=FormulaRange;FormulaRange.prototype.clone=function(){var oRes=new FormulaRange(Range.prototype.clone.apply(this, arguments));oRes.refType1=this.refType1;oRes.refType2=this.refType2;return oRes};FormulaRange.prototype.intersection=function(){var oRes=Range.prototype.intersection.apply(this,arguments);if(null!=oRes)oRes=new FormulaRange(oRes);return oRes};FormulaRange.prototype.intersectionSimple=function(){var oRes=Range.prototype.intersectionSimple.apply(this,arguments);if(null!=oRes)oRes=new FormulaRange(oRes);return oRes};FormulaRange.prototype.union=function(){return new FormulaRange(Range.prototype.union.apply(this, arguments))};FormulaRange.prototype.getName=function(){var sRes="";var c1Abs=this.isAbsCol(this.refType1),c2Abs=this.isAbsCol(this.refType2);var r1Abs=this.isAbsRow(this.refType1),r2Abs=this.isAbsRow(this.refType2);if(0==this.c1&&gc_nMaxCol0==this.c2){if(r1Abs)sRes+="$";sRes+=this.r1+1+":";if(r2Abs)sRes+="$";sRes+=this.r2+1}else if(0==this.r1&&gc_nMaxRow0==this.r2){if(c1Abs)sRes+="$";sRes+=g_oCellAddressUtils.colnumToColstr(this.c1+1)+":";if(c2Abs)sRes+="$";sRes+=g_oCellAddressUtils.colnumToColstr(this.c2+ 1)}else{if(c1Abs)sRes+="$";sRes+=g_oCellAddressUtils.colnumToColstr(this.c1+1);if(r1Abs)sRes+="$";sRes+=this.r1+1;if(!this.isOneCell()){sRes+=":";if(c2Abs)sRes+="$";sRes+=g_oCellAddressUtils.colnumToColstr(this.c2+1);if(r2Abs)sRes+="$";sRes+=this.r2+1}}return sRes};function MultiplyRange(ranges){this.ranges=ranges}MultiplyRange.prototype.clone=function(){return new MultiplyRange(this.ranges.slice())};MultiplyRange.prototype.union2=function(multiplyRange){this.ranges=this.ranges.concat(multiplyRange.ranges)}; MultiplyRange.prototype.isIntersect=function(range){for(var i=0;ir2){var temp=r1;r1=r2;r2=temp;temp=r1Abs;r1Abs=r2Abs;r2Abs=temp}if(c1>c2){var temp=c1;c1=c2;c2=temp;temp=c1Abs;c1Abs=c2Abs;c2Abs=temp}if(1==type){if(null==oCacheVal.ascRange){var oAscRange= new Range(c1,r1,c2,r2);oAscRange.setAbs(r1Abs,c1Abs,r2Abs,c2Abs);oCacheVal.ascRange=oAscRange}oRes=oCacheVal.ascRange}else if(2==type){if(null==oCacheVal.activeRange){var oActiveRange=new ActiveRange(c1,r1,c2,r2);oActiveRange.setAbs(r1Abs,c1Abs,r2Abs,c2Abs);oActiveRange.startCol=oActiveRange.c1;oActiveRange.startRow=oActiveRange.r1;oCacheVal.activeRange=oActiveRange}oRes=oCacheVal.activeRange}else{if(null==oCacheVal.formulaRange){var oFormulaRange=new FormulaRange(c1,r1,c2,r2);oFormulaRange.setAbs(r1Abs, c1Abs,r2Abs,c2Abs);oCacheVal.formulaRange=oFormulaRange}oRes=oCacheVal.formulaRange}}return oRes};var g_oRangeCache=new RangeCache;function HandlersList(handlers){if(!(this instanceof HandlersList))return new HandlersList(handlers);this.handlers=handlers||{};return this}HandlersList.prototype={constructor:HandlersList,trigger:function(eventName){var h=this.handlers[eventName],t=typeOf(h),a=Array.prototype.slice.call(arguments,1),i;if(t===kFunctionL)return h.apply(this,a);if(t===kArrayL){for(i=0;i< h.length;i+=1)if(typeOf(h[i])===kFunctionL)h[i].apply(this,a);return true}return false},add:function(eventName,eventHandler,replaceOldHandler){var th=this.handlers,h,old,t;if(replaceOldHandler||!th.hasOwnProperty(eventName))th[eventName]=eventHandler;else{old=h=th[eventName];t=typeOf(old);if(t!==kArrayL){h=th[eventName]=[];if(t===kFunctionL)h.push(old)}h.push(eventHandler)}},remove:function(eventName,eventHandler){var th=this.handlers,h=th[eventName],i;if(th.hasOwnProperty(eventName)){if(typeOf(h)!== kArrayL||typeOf(eventHandler)!==kFunctionL){delete th[eventName];return true}for(i=h.length-1;i>=0;i-=1)if(h[i]===eventHandler){delete h[i];return true}}return false}};function outputDebugStr(channel){var c=window.console;if(Asc.g_debug_mode&&c&&c[channel]&&c[channel].apply)c[channel].apply(this,Array.prototype.slice.call(arguments,1))}function trim(val){if(!String.prototype.trim)return val.trim();else return val.replace(/^\s+|\s+$/g,"")}function isNumberInfinity(val){var valTrim=trim(val);var valInt= valTrim-0;return valInt==valTrim&&valTrim.length>0&&MIN_EXCEL_INT=0)return f;var pos=s.indexOf(AscCommon.g_oDefaultCultureInfo.NumberDecimalSeparator); if(-1!==pos){f=[f[0].clone()];f[0].text=s.slice(0,pos)}return f}function getFragmentsText(f){return f.reduce(function(pv,cv){return pv+cv.text},"")}function getFragmentsLength(f){return f.length>0?f.reduce(function(pv,cv){return pv+cv.text.length},0):0}function executeInR1C1Mode(mode,runFunction){var oldMode=AscCommonExcel.g_R1C1Mode;AscCommonExcel.g_R1C1Mode=mode;runFunction();AscCommonExcel.g_R1C1Mode=oldMode}function checkFilteringMode(f,oThis,args){if(!window["AscCommonExcel"].filteringMode)AscCommon.History.LocalChange= true;var ret=f.apply(oThis,args);if(!window["AscCommonExcel"].filteringMode)AscCommon.History.LocalChange=false;return ret}function getEndValueRange(dx,v1,v2,coord1,coord2){var leftDir={x1:v2,x2:v1},rightDir={x1:v1,x2:v2},res;if(0!==dx)if(coord1>v1&&coord2dx)res=coord1===coord2?leftDir:rightDir;else res=coord1===coord2?rightDir:leftDir;else if(coord1===v1&&coord2===v2)if(0>dx)res=leftDir;else res=rightDir;else if(coord1>v1&&coord2===v2)res=leftDir;else{if(coord1===v1&&coord20){var isStroke=false;var isNewColor=!AscCommonExcel.g_oColorManager.isEqual(bc,b.getColorOrDefault());var isNewStyle=bs!==b.s;if(isNotFirst&& (isNewColor||isNewStyle)){ctx.stroke();isStroke=true}if(isNewColor){bc=b.getColorOrDefault();ctx.setStrokeStyle(bc)}if(isNewStyle){bs=b.s;ctx.setLineWidth(b.w);ctx.setLineDash(b.getDashSegments())}if(isStroke||false===isNotFirst){isNotFirst=true;ctx.beginPath()}switch(type){case AscCommon.c_oAscBorderType.Hor:ctx.lineHor(x1,y1,x2);break;case AscCommon.c_oAscBorderType.Ver:ctx.lineVer(x1,y1,y2);break;case AscCommon.c_oAscBorderType.Diag:ctx.lineDiag(x1,y1,x2,y2);break}}}if(oStyle.ApplyBorder){var oBorders= oStyle.getBorder();drawBorder(AscCommon.c_oAscBorderType.Ver,oBorders.l,0,0,0,height);drawBorder(AscCommon.c_oAscBorderType.Hor,oBorders.b,0,height-1,width,height-1);drawBorder(AscCommon.c_oAscBorderType.Ver,oBorders.r,width-1,height,width-1,0);drawBorder(AscCommon.c_oAscBorderType.Hor,oBorders.t,width,0,0,0);if(isNotFirst)ctx.stroke()}var format=oStyle.getFont().clone();var nSize=format.getSize();if(160)rectW=rectW*_realPercentWidth;else{rectX=rectW-rectW*Math.abs(_realPercentWidth)+1;rectW=rectW*Math.abs(_realPercentWidth)+1}AscCommonExcel.drawFillCell(ctx,graphics,fill,new AscCommon.asc_CRect(rectX,rectY,rectW,rectH));if(_colorBorderIn)ctx.setLineWidth(1).setStrokeStyle(_colorBorderIn).strokeRect(rectX,rectY,rectW-1,rectH-1);if(_colorBorderOut)ctx.setLineWidth(1).setStrokeStyle(_colorBorderOut).strokeRect(0, 0,w-1,h-1)}function drawIconSetPreview(id,wb,iconImgs){if(!iconImgs||!iconImgs.length)return null;var canvas=createAndPutCanvas(id);if(!canvas)return;var ctx=new Asc.DrawingContext({canvas:canvas,units:0,fmgrGraphics:wb.fmgrGraphics,font:wb.m_oFont});var graphics=getGraphics(ctx);var shapeDrawer=new AscCommon.CShapeDrawer;shapeDrawer.Graphics=graphics;AscFormat.ExecuteNoHistory(function(){for(var i=0;i>0;this.currentKeys2= Object.keys(this.values[this.currentKey1]).sort(AscCommon.fSortAscending);this.currentKeyIndex2=this.forward?0:this.currentKeys2.length-1}this.currentKey2=this.currentKeys2[this.currentKeyIndex2]>>0;return true};findResults.prototype._findKey=function(key,arrayKeys){var i=this.forward?0:arrayKeys.length-1;var step=this.forward?+1:-1;var _key;while(_key=arrayKeys[i]){_key=step*((_key>>0)-key);if(_key>=0)return 0===_key?i:i-step;i+=step}return-2};function CSpellcheckState(){this.lastSpellInfo=null; this.lastIndex=0;this.lockSpell=false;this.startCell=null;this.currentCell=null;this.iteration=false;this.ignoreWords={};this.changeWords={};this.cellsChange=[];this.newWord=null;this.cellText=null;this.newCellText=null;this.isStart=false;this.afterReplace=false;this.isIgnoreUppercase=false;this.isIgnoreNumbers=false}CSpellcheckState.prototype.clean=function(){this.isStart=false;this.lastSpellInfo=null;this.lastIndex=0;this.lockSpell=false;this.startCell=null;this.currentCell=null;this.iteration= false;this.ignoreWords={};this.changeWords={};this.cellsChange=[];this.newWord=null;this.cellText=null;this.newCellText=null;this.afterReplace=false};CSpellcheckState.prototype.nextRow=function(){this.lastSpellInfo=null;this.lastIndex=0;this.currentCell.row+=1;this.currentCell.col=0};function asc_CCompleteMenu(name,type){this.name=name;this.type=type}asc_CCompleteMenu.prototype.asc_getName=function(){return this.name};asc_CCompleteMenu.prototype.asc_getType=function(){return this.type};function CCacheMeasureEmpty2(){this.cache= {}}CCacheMeasureEmpty2.prototype.getKey=function(elem){return elem.getName()+(elem.getBold()?"B":"N")+(elem.getItalic()?"I":"N")};CCacheMeasureEmpty2.prototype.add=function(elem,val){this.cache[this.getKey(elem)]=val};CCacheMeasureEmpty2.prototype.get=function(elem){return this.cache[this.getKey(elem)]};var g_oCacheMeasureEmpty2=new CCacheMeasureEmpty2;function CCacheMeasureEmpty(){this.cache={}}CCacheMeasureEmpty.prototype.add=function(elem,val){var fn=elem.getName();var font=this.cache[fn]||(this.cache[fn]= {});font[elem.getSize()]=val};CCacheMeasureEmpty.prototype.get=function(elem){var font=this.cache[elem.getName()];return font?font[elem.getSize()]:null};var g_oCacheMeasureEmpty=new CCacheMeasureEmpty;function asc_CFormatCellsInfo(){this.type=Asc.c_oAscNumFormatType.General;this.decimalPlaces=2;this.separator=false;this.symbol=null}asc_CFormatCellsInfo.prototype.asc_setType=function(val){this.type=val};asc_CFormatCellsInfo.prototype.asc_setDecimalPlaces=function(val){this.decimalPlaces=val};asc_CFormatCellsInfo.prototype.asc_setSeparator= function(val){this.separator=val};asc_CFormatCellsInfo.prototype.asc_setSymbol=function(val){this.symbol=val};asc_CFormatCellsInfo.prototype.asc_getType=function(){return this.type};asc_CFormatCellsInfo.prototype.asc_getDecimalPlaces=function(){return this.decimalPlaces};asc_CFormatCellsInfo.prototype.asc_getSeparator=function(){return this.separator};asc_CFormatCellsInfo.prototype.asc_getSymbol=function(){return this.symbol};function asc_CAutoCorrectOptions(){this.type=null;this.options=[];this.cellCoord= null}asc_CAutoCorrectOptions.prototype.asc_setType=function(val){this.type=val};asc_CAutoCorrectOptions.prototype.asc_setOptions=function(val){this.options=val};asc_CAutoCorrectOptions.prototype.asc_setCellCoord=function(val){this.cellCoord=val};asc_CAutoCorrectOptions.prototype.asc_getType=function(){return this.type};asc_CAutoCorrectOptions.prototype.asc_getOptions=function(){return this.options};asc_CAutoCorrectOptions.prototype.asc_getCellCoord=function(){return this.cellCoord};function CEditorEnterOptions(){this.cursorPos= null;this.eventPos=null;this.focus=false;this.newText=null;this.hideCursor=false;this.quickInput=false}function cDate(){var bind=Function.bind;var unbind=bind.bind(bind);var date=new (unbind(Date,null).apply(null,arguments));date.__proto__=cDate.prototype;return date}cDate.prototype=Object.create(Date.prototype);cDate.prototype.constructor=cDate;cDate.prototype.excelNullDate1900=Date.UTC(1899,11,30,0,0,0);cDate.prototype.excelNullDate1904=Date.UTC(1904,0,1,0,0,0);cDate.prototype.getExcelNullDate= function(){return AscCommon.bDate1904?cDate.prototype.excelNullDate1904:cDate.prototype.excelNullDate1900};cDate.prototype.isLeapYear=function(){var y=this.getUTCFullYear();return y%4===0&&y%100!==0||y%400===0};cDate.prototype.getDaysInMonth=function(){return this.isLeapYear()?this.getDaysInMonth.L[this.getUTCMonth()]:this.getDaysInMonth.R[this.getUTCMonth()]};cDate.prototype.getDaysInMonth.R=[31,28,31,30,31,30,31,31,30,31,30,31];cDate.prototype.getDaysInMonth.L=[31,29,31,30,31,30,31,31,30,31,30, 31];cDate.prototype.getDayOfYear=function(){var start=new Date(this.getFullYear(),0,0);var diff=this-start+(start.getTimezoneOffset()-this.getTimezoneOffset())*60*1E3;var oneDay=1E3*60*60*24;return Math.floor(diff/oneDay)};cDate.prototype.truncate=function(){this.setUTCHours(0,0,0,0);return this};cDate.prototype.getExcelDate=function(){return Math.floor(this.getExcelDateWithTime())};cDate.prototype.getExcelDateWithTime=function(){var year=this.getUTCFullYear(),month=this.getUTCMonth(),date=this.getUTCDate(), res;if(1900===year&&0===month&&0===date)res=0;else if(19000)nRes=b.to.r1-a.to.r1;else nRes=a.to.r1-b.to.r1;if(0==nRes&& 0!=offset.col)if(offset.col>0)nRes=b.to.c1-a.to.c1;else nRes=a.to.c1-b.to.c1}return nRes}function createRgbColor(r,g,b){return new RgbColor((r<<16)+(g<<8)+b)}function FromXml_ST_DynamicFilterType(val){var res=-1;if("null"===val)res=Asc.c_oAscDynamicAutoFilter.nullType;else if("aboveAverage"===val)res=Asc.c_oAscDynamicAutoFilter.aboveAverage;else if("belowAverage"===val)res=Asc.c_oAscDynamicAutoFilter.belowAverage;else if("tomorrow"===val)res=Asc.c_oAscDynamicAutoFilter.tomorrow;else if("today"=== val)res=Asc.c_oAscDynamicAutoFilter.today;else if("yesterday"===val)res=Asc.c_oAscDynamicAutoFilter.yesterday;else if("nextWeek"===val)res=Asc.c_oAscDynamicAutoFilter.nextWeek;else if("thisWeek"===val)res=Asc.c_oAscDynamicAutoFilter.thisWeek;else if("lastWeek"===val)res=Asc.c_oAscDynamicAutoFilter.lastWeek;else if("nextMonth"===val)res=Asc.c_oAscDynamicAutoFilter.nextMonth;else if("thisMonth"===val)res=Asc.c_oAscDynamicAutoFilter.thisMonth;else if("lastMonth"===val)res=Asc.c_oAscDynamicAutoFilter.lastMonth; else if("nextQuarter"===val)res=Asc.c_oAscDynamicAutoFilter.nextQuarter;else if("thisQuarter"===val)res=Asc.c_oAscDynamicAutoFilter.thisQuarter;else if("lastQuarter"===val)res=Asc.c_oAscDynamicAutoFilter.lastQuarter;else if("nextYear"===val)res=Asc.c_oAscDynamicAutoFilter.nextYear;else if("thisYear"===val)res=Asc.c_oAscDynamicAutoFilter.thisYear;else if("lastYear"===val)res=Asc.c_oAscDynamicAutoFilter.lastYear;else if("yearToDate"===val)res=Asc.c_oAscDynamicAutoFilter.yearToDate;else if("Q1"===val)res= Asc.c_oAscDynamicAutoFilter.q1;else if("Q2"===val)res=Asc.c_oAscDynamicAutoFilter.q2;else if("Q3"===val)res=Asc.c_oAscDynamicAutoFilter.q3;else if("Q4"===val)res=Asc.c_oAscDynamicAutoFilter.q4;else if("M1"===val)res=Asc.c_oAscDynamicAutoFilter.m1;else if("M2"===val)res=Asc.c_oAscDynamicAutoFilter.m2;else if("M3"===val)res=Asc.c_oAscDynamicAutoFilter.m3;else if("M4"===val)res=Asc.c_oAscDynamicAutoFilter.m4;else if("M5"===val)res=Asc.c_oAscDynamicAutoFilter.m5;else if("M6"===val)res=Asc.c_oAscDynamicAutoFilter.m6; else if("M7"===val)res=Asc.c_oAscDynamicAutoFilter.m7;else if("M8"===val)res=Asc.c_oAscDynamicAutoFilter.m8;else if("M9"===val)res=Asc.c_oAscDynamicAutoFilter.m9;else if("M10"===val)res=Asc.c_oAscDynamicAutoFilter.m10;else if("M11"===val)res=Asc.c_oAscDynamicAutoFilter.m11;else if("M12"===val)res=Asc.c_oAscDynamicAutoFilter.m12;return res}function ToXml_ST_DynamicFilterType(val){var res="";if(Asc.c_oAscDynamicAutoFilter.nullType===val)res="null";else if(Asc.c_oAscDynamicAutoFilter.aboveAverage=== val)res="aboveAverage";else if(Asc.c_oAscDynamicAutoFilter.belowAverage===val)res="belowAverage";else if(Asc.c_oAscDynamicAutoFilter.tomorrow===val)res="tomorrow";else if(Asc.c_oAscDynamicAutoFilter.today===val)res="today";else if(Asc.c_oAscDynamicAutoFilter.yesterday===val)res="yesterday";else if(Asc.c_oAscDynamicAutoFilter.nextWeek===val)res="nextWeek";else if(Asc.c_oAscDynamicAutoFilter.thisWeek===val)res="thisWeek";else if(Asc.c_oAscDynamicAutoFilter.lastWeek===val)res="lastWeek";else if(Asc.c_oAscDynamicAutoFilter.nextMonth=== val)res="nextMonth";else if(Asc.c_oAscDynamicAutoFilter.thisMonth===val)res="thisMonth";else if(Asc.c_oAscDynamicAutoFilter.lastMonth===val)res="lastMonth";else if(Asc.c_oAscDynamicAutoFilter.nextQuarter===val)res="nextQuarter";else if(Asc.c_oAscDynamicAutoFilter.thisQuarter===val)res="thisQuarter";else if(Asc.c_oAscDynamicAutoFilter.lastQuarter===val)res="lastQuarter";else if(Asc.c_oAscDynamicAutoFilter.nextYear===val)res="nextYear";else if(Asc.c_oAscDynamicAutoFilter.thisYear===val)res="thisYear"; else if(Asc.c_oAscDynamicAutoFilter.lastYear===val)res="lastYear";else if(Asc.c_oAscDynamicAutoFilter.yearToDate===val)res="yearToDate";else if(Asc.c_oAscDynamicAutoFilter.q1===val)res="Q1";else if(Asc.c_oAscDynamicAutoFilter.q2===val)res="Q2";else if(Asc.c_oAscDynamicAutoFilter.q3===val)res="Q3";else if(Asc.c_oAscDynamicAutoFilter.q4===val)res="Q4";else if(Asc.c_oAscDynamicAutoFilter.m1===val)res="M1";else if(Asc.c_oAscDynamicAutoFilter.m2===val)res="M2";else if(Asc.c_oAscDynamicAutoFilter.m3=== val)res="M3";else if(Asc.c_oAscDynamicAutoFilter.m4===val)res="M4";else if(Asc.c_oAscDynamicAutoFilter.m5===val)res="M5";else if(Asc.c_oAscDynamicAutoFilter.m6===val)res="M6";else if(Asc.c_oAscDynamicAutoFilter.m7===val)res="M7";else if(Asc.c_oAscDynamicAutoFilter.m8===val)res="M8";else if(Asc.c_oAscDynamicAutoFilter.m9===val)res="M9";else if(Asc.c_oAscDynamicAutoFilter.m10===val)res="M10";else if(Asc.c_oAscDynamicAutoFilter.m11===val)res="M11";else if(Asc.c_oAscDynamicAutoFilter.m12===val)res="M12"; return res}function FromXml_ST_FilterOperator(val){var res=-1;if("equal"===val)res=Asc.c_oAscCustomAutoFilter.equals;else if("lessThan"===val)res=Asc.c_oAscCustomAutoFilter.isLessThan;else if("lessThanOrEqual"===val)res=Asc.c_oAscCustomAutoFilter.isLessThanOrEqualTo;else if("notEqual"===val)res=Asc.c_oAscCustomAutoFilter.doesNotEqual;else if("greaterThanOrEqual"===val)res=Asc.c_oAscCustomAutoFilter.isGreaterThanOrEqualTo;else if("greaterThan"===val)res=Asc.c_oAscCustomAutoFilter.isGreaterThan;return res} function ToXml_ST_FilterOperator(val){var res="";if(Asc.c_oAscCustomAutoFilter.equals===val)res="equal";else if(Asc.c_oAscCustomAutoFilter.isLessThan===val)res="lessThan";else if(Asc.c_oAscCustomAutoFilter.isLessThanOrEqualTo===val)res="lessThanOrEqual";else if(Asc.c_oAscCustomAutoFilter.doesNotEqual===val)res="notEqual";else if(Asc.c_oAscCustomAutoFilter.isGreaterThanOrEqualTo===val)res="greaterThanOrEqual";else if(Asc.c_oAscCustomAutoFilter.isGreaterThan===val)res="greaterThan";return res}function FromXml_ST_DateTimeGrouping(val){var res= -1;if("year"===val)res=Asc.EDateTimeGroup.datetimegroupYear;else if("month"===val)res=Asc.EDateTimeGroup.datetimegroupMonth;else if("day"===val)res=Asc.EDateTimeGroup.datetimegroupDay;else if("hour"===val)res=Asc.EDateTimeGroup.datetimegroupHour;else if("minute"===val)res=Asc.EDateTimeGroup.datetimegroupMinute;else if("second"===val)res=Asc.EDateTimeGroup.datetimegroupSecond;return res}function ToXml_ST_DateTimeGrouping(val){var res="";if(Asc.EDateTimeGroup.datetimegroupYear===val)res="year";else if(Asc.EDateTimeGroup.datetimegroupMonth=== val)res="month";else if(Asc.EDateTimeGroup.datetimegroupDay===val)res="day";else if(Asc.EDateTimeGroup.datetimegroupHour===val)res="hour";else if(Asc.EDateTimeGroup.datetimegroupMinute===val)res="minute";else if(Asc.EDateTimeGroup.datetimegroupSecond===val)res="second";return res}var g_oRgbColorProperties={rgb:0};function RgbColor(rgb){this.rgb=rgb;this._hash}RgbColor.prototype={Properties:g_oRgbColorProperties,getHash:function(){if(!this._hash)this._hash=this.rgb;return this._hash},clone:function(){return new RgbColor(this.rgb)}, getType:function(){return UndoRedoDataTypes.RgbColor},getProperties:function(){return this.Properties},isEqual:function(oColor){if(!oColor||!(oColor instanceof RgbColor))return false;if(this.rgb!==oColor.rgb)return false;return true},getProperty:function(nType){switch(nType){case this.Properties.rgb:return this.rgb;break}},setProperty:function(nType,value){switch(nType){case this.Properties.rgb:this.rgb=value;break}},Write_ToBinary2:function(oBinaryWriter){oBinaryWriter.WriteLong(this.rgb)},Read_FromBinary2:function(oBinaryReader){this.rgb= oBinaryReader.GetULongLE()},getRgb:function(){return this.rgb},getR:function(){return this.rgb>>16&255},getG:function(){return this.rgb>>8&255},getB:function(){return this.rgb&255},getA:function(){return 1}};var g_oThemeColorProperties={rgb:0,theme:1,tint:2};function ThemeColor(){this.rgb=null;this.theme=null;this.tint=null;this._hash}ThemeColor.prototype={Properties:g_oThemeColorProperties,getHash:function(){if(!this._hash)this._hash=this.theme+";"+this.tint;return this._hash},clone:function(){return this}, getType:function(){return UndoRedoDataTypes.ThemeColor},getProperties:function(){return this.Properties},getProperty:function(nType){switch(nType){case this.Properties.rgb:return this.rgb;break;case this.Properties.theme:return this.theme;break;case this.Properties.tint:return this.tint;break}},setProperty:function(nType,value){switch(nType){case this.Properties.rgb:this.rgb=value;break;case this.Properties.theme:this.theme=value;break;case this.Properties.tint:this.tint=value;break}},isEqual:function(oColor){if(!oColor)return false; if(this.theme!==oColor.theme)return false;if(!AscFormat.fApproxEqual(this.tint,oColor.tint))return false;return true},Write_ToBinary2:function(oBinaryWriter){oBinaryWriter.WriteByte(this.theme);if(null!=this.tint){oBinaryWriter.WriteByte(true);oBinaryWriter.WriteDouble2(this.tint)}else oBinaryWriter.WriteBool(false)},Read_FromBinary2AndReplace:function(oBinaryReader){this.theme=oBinaryReader.GetUChar();var bTint=oBinaryReader.GetBool();if(bTint)this.tint=oBinaryReader.GetDoubleLE();return g_oColorManager.getThemeColor(this.theme, this.tint)},getRgb:function(){return this.rgb},getR:function(){return this.rgb>>16&255},getG:function(){return this.rgb>>8&255},getB:function(){return this.rgb&255},getA:function(){return 1},rebuild:function(theme){var nRes=0;var r=0;var g=0;var b=0;if(null!=this.theme&&null!=theme){var oUniColor=theme.themeElements.clrScheme.colors[map_themeExcel_to_themePresentation[this.theme]];if(null!=oUniColor){var rgba=oUniColor.color.RGBA;if(null!=rgba){r=rgba.R;g=rgba.G;b=rgba.B}}if(null!=this.tint&&0!=this.tint){var oCColorModifiers= new AscFormat.CColorModifiers;var HSL={H:0,S:0,L:0};oCColorModifiers.RGB2HSL(r,g,b,HSL);if(this.tint<0)HSL.L=HSL.L*(1+this.tint);else HSL.L=HSL.L*(1-this.tint)+(g_nHSLMaxValue-g_nHSLMaxValue*(1-this.tint));HSL.L>>=0;var RGB={R:0,G:0,B:0};oCColorModifiers.HSL2RGB(HSL,RGB);r=RGB.R;g=RGB.G;b=RGB.B}nRes|=b;nRes|=g<<8;nRes|=r<<16}this.rgb=nRes}};function CorrectAscColor(asc_color){if(null==asc_color||asc_color.asc_getAuto())return null;var ret=null;var _type=asc_color.asc_getType();switch(_type){case Asc.c_oAscColor.COLOR_TYPE_SCHEME:{var _index= asc_color.asc_getValue()>>0;var _id=_index/6>>0;var _pos=_index-_id*6;var basecolor=g_oColorManager.getThemeColor(_id);var aTints=g_oThemeColorsDefaultModsSpreadsheet[AscCommon.GetDefaultColorModsIndex(basecolor.getR(),basecolor.getG(),basecolor.getB())];var tint=aTints[_pos];ret=g_oColorManager.getThemeColor(_id,tint);break}default:{ret=createRgbColor(asc_color.asc_getR(),asc_color.asc_getG(),asc_color.asc_getB())}}return ret}function ColorManager(){this.theme=null;this.aColors=new Array(12)}ColorManager.prototype= {isEqual:function(color1,color2,byRgb){var bRes=false;if(null==color1&&null==color2)bRes=true;else if(null!=color1&&null!=color2)if(color1 instanceof ThemeColor&&color2 instanceof ThemeColor||color1 instanceof RgbColor&&color2 instanceof RgbColor||byRgb)bRes=color1.getRgb()==color2.getRgb();return bRes},setTheme:function(theme){this.theme=theme;this.rebuildColors()},getThemeColor:function(theme,tint){if(null==tint)tint=null;var oColorObj=this.aColors[theme];if(null==oColorObj){oColorObj={};this.aColors[theme]= oColorObj}var oThemeColor=oColorObj[tint];if(null==oThemeColor){oThemeColor=new ThemeColor;oThemeColor.theme=theme;oThemeColor.tint=tint;if(null!=this.theme)oThemeColor.rebuild(this.theme);oColorObj[tint]=oThemeColor}return oThemeColor},rebuildColors:function(){if(null!=this.theme)for(var i=0,length=this.aColors.length;i=20)this.fs=dyHeight/20;var grbit=stream.GetUShortLE();if(0!==(grbit&2))this.i=true;if(0!==(grbit&8))this.s=true;var bls=stream.GetUShortLE();if(700==bls)this.b=true;var sss=stream.GetUShortLE();if(sss>0)switch(sss){case 1:this.va=AscCommon.vertalign_SuperScript;break;case 2:this.va=AscCommon.vertalign_SubScript;break}var uls=stream.GetUChar();if(uls>0)switch(uls){case 1:this.u= Asc.EUnderline.underlineSingle;break;case 2:this.u=Asc.EUnderline.underlineDouble;break;case 33:this.u=Asc.EUnderline.underlineSingleAccounting;break;case 34:this.u=Asc.EUnderline.underlineDoubleAccounting;break}stream.Skip2(3);var xColorType=stream.GetUChar();var index=stream.GetUChar();var nTintAndShade=stream.GetShortLE();var rgba=stream.GetULongLE();var isActualRgb=0!==(xColorType&1);xColorType&=254;var tint=null;if(0!=nTintAndShade)tint=nTintAndShade/32767;var theme=null;if(6==xColorType){theme= 1;switch(index){case 1:theme=0;break;case 0:theme=1;break;case 3:theme=2;break;case 2:theme=3;break;default:theme=index;break}this.c=AscCommonExcel.g_oColorManager.getThemeColor(theme,tint)}else if(isActualRgb)this.c=AscCommonExcel.createRgbColor(rgba&255,(rgba&65280)>>8,(rgba&16711680)>>16);var bFontScheme=stream.GetUChar();if(bFontScheme>0)switch(bFontScheme){case 1:this.scheme=Asc.EFontScheme.fontschemeMajor;break;case 2:this.scheme=Asc.EFontScheme.fontschemeMinor;break}this.fn=stream.GetString()}; var c_oAscPatternType={DarkDown:0,DarkGray:1,DarkGrid:2,DarkHorizontal:3,DarkTrellis:4,DarkUp:5,DarkVertical:6,Gray0625:7,Gray125:8,LightDown:9,LightGray:10,LightGrid:11,LightHorizontal:12,LightTrellis:13,LightUp:14,LightVertical:15,MediumGray:16,None:17,Solid:18};function hatchFromExcelToWord(val){switch(val){case c_oAscPatternType.DarkDown:return"dkDnDiag";case c_oAscPatternType.DarkGray:return"pct70";case c_oAscPatternType.DarkGrid:return"smCheck";case c_oAscPatternType.DarkHorizontal:return"dkHorz"; case c_oAscPatternType.DarkTrellis:return"trellis";case c_oAscPatternType.DarkUp:return"dkUpDiag";case c_oAscPatternType.DarkVertical:return"dkVert";case c_oAscPatternType.Gray0625:return"pct10";case c_oAscPatternType.Gray125:return"pct20";case c_oAscPatternType.LightDown:return"ltDnDiag";case c_oAscPatternType.LightGray:return"pct25";case c_oAscPatternType.LightGrid:return"smGrid";case c_oAscPatternType.LightHorizontal:return"ltHorz";case c_oAscPatternType.LightTrellis:return"pct30";case c_oAscPatternType.LightUp:return"ltUpDiag"; case c_oAscPatternType.LightVertical:return"ltVert";case c_oAscPatternType.MediumGray:default:return"pct50"}}function FromXml_ST_GradientType(val){var res=-1;if("linear"===val)res=Asc.c_oAscFillGradType.GRAD_LINEAR;else if("path"===val)res=Asc.c_oAscFillGradType.GRAD_PATH;return res}function FromXml_ST_PatternType(val){var res=-1;if("none"===val)res=c_oAscPatternType.None;else if("solid"===val)res=c_oAscPatternType.Solid;else if("mediumGray"===val)res=c_oAscPatternType.MediumGray;else if("darkGray"=== val)res=c_oAscPatternType.DarkGray;else if("lightGray"===val)res=c_oAscPatternType.LightGray;else if("darkHorizontal"===val)res=c_oAscPatternType.DarkHorizontal;else if("darkVertical"===val)res=c_oAscPatternType.DarkVertical;else if("darkDown"===val)res=c_oAscPatternType.DarkDown;else if("darkUp"===val)res=c_oAscPatternType.DarkUp;else if("darkGrid"===val)res=c_oAscPatternType.DarkGrid;else if("darkTrellis"===val)res=c_oAscPatternType.DarkTrellis;else if("lightHorizontal"===val)res=c_oAscPatternType.LightHorizontal; else if("lightVertical"===val)res=c_oAscPatternType.LightVertical;else if("lightDown"===val)res=c_oAscPatternType.LightDown;else if("lightUp"===val)res=c_oAscPatternType.LightUp;else if("lightGrid"===val)res=c_oAscPatternType.LightGrid;else if("lightTrellis"===val)res=c_oAscPatternType.LightTrellis;else if("gray125"===val)res=c_oAscPatternType.Gray125;else if("gray0625"===val)res=c_oAscPatternType.Gray0625;return res}function GradientFill(){this.type=Asc.c_oAscFillGradType.GRAD_LINEAR;this.degree= 0;this.left=0;this.right=0;this.top=0;this.bottom=0;this.stop=[];this._hash=null}GradientFill.prototype.Properties={type:0,degree:1,left:2,right:3,top:4,bottom:5,stop:6};GradientFill.prototype.getType=function(){return UndoRedoDataTypes.StyleGradientFill};GradientFill.prototype.getProperties=function(){return this.Properties};GradientFill.prototype.getProperty=function(nType){switch(nType){case this.Properties.type:return this.type;break;case this.Properties.degree:return this.degree;break;case this.Properties.left:return this.left; break;case this.Properties.right:return this.right;break;case this.Properties.top:return this.top;break;case this.Properties.bottom:return this.bottom;break;case this.Properties.stop:return this.stop;break}};GradientFill.prototype.setProperty=function(nType,value){switch(nType){case this.Properties.type:this.type=value;break;case this.Properties.degree:this.degree=value;break;case this.Properties.left:this.left=value;break;case this.Properties.right:this.right=value;break;case this.Properties.top:this.top= value;break;case this.Properties.bottom:this.bottom=value;break;case this.Properties.stop:this.stop=value;break}};GradientFill.prototype.getHash=function(){if(!this._hash){this._hash=this.type+";"+this.degree+";"+this.left+";"+this.right+";"+this.top+";"+this.bottom+";"+this.stop.length;for(var i=0;i=0;--i){var style=this.stylesTablePivot[i];if(style.range.isIntersect(range))this.stylesTablePivot.splice(i,1)}};SheetMergedStyles.prototype.setConditionalStyle=function(multiplyRange,formula){this.stylesConditional.push({multiplyRange:multiplyRange,formula:formula})};SheetMergedStyles.prototype.clearConditionalStyle= function(multiplyRange){for(var i=this.stylesConditional.length-1;i>=0;--i){var style=this.stylesConditional[i];if(style.multiplyRange.isIntersect(multiplyRange))this.stylesConditional.splice(i,1)}};SheetMergedStyles.prototype.getStyle=function(hiddenManager,row,col,opt_ws){var res={table:[],conditional:[]};if(opt_ws)opt_ws._updateConditionalFormatting();for(var i=0;i=0){if(borderIndex>0){if(!style.borders)style.borders={};var xfModified=style.borders[borderIndex];if(!xfModified){xfModified=xf.clone();var borderModified=xfModified.border.clone();if(0!==(1&borderIndex))borderModified.l=borderModified.iv; if(0!==(2&borderIndex))borderModified.t=borderModified.ih;if(0!==(4&borderIndex))borderModified.r=borderModified.iv;if(0!==(8&borderIndex))borderModified.b=borderModified.ih;if(0!==(16&borderIndex)){borderModified.du=false;borderModified.dd=false}xfModified.border=g_StyleCache.addBorder(borderModified);xfModified=g_StyleCache.addXf(xfModified);style.borders[borderIndex]=xfModified}xf=xfModified}res.table.push(xf)}}return res};SheetMergedStyles.prototype._getBorderIndex=function(hiddenManager,bbox, stripe,row,col,xf){var borderIndex=0;var hidden;if(stripe)if(stripe.row){hidden=hiddenManager.getHiddenRowsCount(bbox.r1,row);var rowIndex=(row-bbox.r1-hidden)%(stripe.size+stripe.offset);if(rowIndexthis.dDefaultColWidth)this.dDefaultColWidth=null};function Col(worksheet,index){this.ws=worksheet;this.index=index;this.BestFit=null;this.hd=null;this.CustomWidth=null;this.width=null;this.xfs=null;this.outlineLevel=0;this.collapsed=false;this.widthPx=null;this.charCount=null}Col.prototype.fixOnOpening=function(){if(null==this.width){this.width=0;this.hd=true}else if(this.width<0)this.width=0;else if(this.width>Asc.c_oAscMaxColumnWidth)this.width=Asc.c_oAscMaxColumnWidth; if(AscCommon.CurFileVersion<2)this.CustomWidth=1};Col.prototype.moveHor=function(nDif){this.index+=nDif};Col.prototype.isEqual=function(obj){var bRes=this.BestFit==obj.BestFit&&this.hd==obj.hd&&this.width==obj.width&&this.CustomWidth==obj.CustomWidth&&this.outlineLevel==obj.outlineLevel&&this.collapsed==obj.collapsed;if(bRes)if(null!=this.xfs&&null!=obj.xfs)bRes=this.xfs.isEqual(obj.xfs);else if(null!=this.xfs||null!=obj.xfs)bRes=false;return bRes};Col.prototype.isEmpty=function(){return null==this.BestFit&& null==this.hd&&null==this.width&&null==this.xfs&&null==this.CustomWidth&&0===this.outlineLevel&&false==this.collapsed};Col.prototype.clone=function(oNewWs){if(!oNewWs)oNewWs=this.ws;var oNewCol=new Col(oNewWs,this.index);this.cloneTo(oNewCol);return oNewCol};Col.prototype.cloneTo=function(oNewCol){if(null!=this.BestFit)oNewCol.BestFit=this.BestFit;if(null!=this.hd)oNewCol.hd=this.hd;if(null!=this.width)oNewCol.width=this.width;if(null!=this.CustomWidth)oNewCol.CustomWidth=this.CustomWidth;if(null!= this.xfs)oNewCol.xfs=this.xfs;oNewCol.outlineLevel=this.outlineLevel;oNewCol.collapsed=this.collapsed;if(null!=this.widthPx)oNewCol.widthPx=this.widthPx;if(null!=this.charCount)oNewCol.charCount=this.charCount};Col.prototype.getWidthProp=function(){return new AscCommonExcel.UndoRedoData_ColProp(this)};Col.prototype.setWidthProp=function(prop){if(null!=prop){if(null!=prop.width)this.width=prop.width;else this.width=null;this.setHidden(prop.hd);if(null!=prop.CustomWidth)this.CustomWidth=prop.CustomWidth; else this.CustomWidth=null;if(null!=prop.BestFit)this.BestFit=prop.BestFit;else this.BestFit=null;if(null!=prop.OutlineLevel)this.outlineLevel=prop.OutlineLevel}};Col.prototype.getStyle=function(){return this.xfs};Col.prototype._getUpdateRange=function(){if(AscCommonExcel.g_nAllColIndex==this.index)return new Asc.Range(0,0,gc_nMaxCol0,gc_nMaxRow0);else return new Asc.Range(this.index,0,this.index,gc_nMaxRow0)};Col.prototype.setStyle=function(xfs){var oldVal=this.xfs;this.setStyleInternal(xfs);if(History.Is_On()&& oldVal!==this.xfs)History.Add(AscCommonExcel.g_oUndoRedoCol,AscCH.historyitem_RowCol_SetStyle,this.ws.getId(),this._getUpdateRange(),new UndoRedoData_IndexSimpleProp(this.index,false,oldVal,this.xfs))};Col.prototype.setStyleInternal=function(xfs){this.xfs=g_StyleCache.addXf(xfs)};Col.prototype.setCellStyle=function(val){var newVal=this.ws.workbook.CellStyles._prepareCellStyle(val);var oRes=this.ws.workbook.oStyleManager.setCellStyle(this,newVal);if(History.Is_On()&&oRes.oldVal!=oRes.newVal){var oldStyleName= this.ws.workbook.CellStyles.getStyleNameByXfId(oRes.oldVal);History.Add(AscCommonExcel.g_oUndoRedoCol,AscCH.historyitem_RowCol_SetCellStyle,this.ws.getId(),this._getUpdateRange(),new UndoRedoData_IndexSimpleProp(this.index,false,oldStyleName,val));var oStyle=this.ws.workbook.CellStyles.getStyleByXfId(oRes.newVal);if(oStyle.ApplyFont)this.setFont(oStyle.getFont());if(oStyle.ApplyFill)this.setFill(oStyle.getFill());if(oStyle.ApplyBorder)this.setBorder(oStyle.getBorder());if(oStyle.ApplyNumberFormat)this.setNumFormat(oStyle.getNumFormatStr())}}; Col.prototype.setNumFormat=function(val){var oRes=this.ws.workbook.oStyleManager.setNum(this,new Num({f:val}));if(History.Is_On()&&oRes.oldVal!=oRes.newVal)History.Add(AscCommonExcel.g_oUndoRedoCol,AscCH.historyitem_RowCol_Num,this.ws.getId(),this._getUpdateRange(),new UndoRedoData_IndexSimpleProp(this.index,false,oRes.oldVal,oRes.newVal))};Col.prototype.setNum=function(val){var oRes=this.ws.workbook.oStyleManager.setNum(this,val);if(History.Is_On()&&oRes.oldVal!=oRes.newVal)History.Add(AscCommonExcel.g_oUndoRedoCol, AscCH.historyitem_RowCol_Num,this.ws.getId(),this._getUpdateRange(),new UndoRedoData_IndexSimpleProp(this.index,false,oRes.oldVal,oRes.newVal))};Col.prototype.setFont=function(val){var oRes=this.ws.workbook.oStyleManager.setFont(this,val);if(History.Is_On()&&oRes.oldVal!=oRes.newVal){var oldVal=null;if(null!=oRes.oldVal)oldVal=oRes.oldVal.clone();var newVal=null;if(null!=oRes.newVal)newVal=oRes.newVal.clone();History.Add(AscCommonExcel.g_oUndoRedoCol,AscCH.historyitem_RowCol_SetFont,this.ws.getId(), this._getUpdateRange(),new UndoRedoData_IndexSimpleProp(this.index,false,oldVal,newVal))}};Col.prototype.setFontname=function(val){var oRes=this.ws.workbook.oStyleManager.setFontname(this,val);if(History.Is_On()&&oRes.oldVal!=oRes.newVal)History.Add(AscCommonExcel.g_oUndoRedoCol,AscCH.historyitem_RowCol_Fontname,this.ws.getId(),this._getUpdateRange(),new UndoRedoData_IndexSimpleProp(this.index,false,oRes.oldVal,oRes.newVal))};Col.prototype.setFontsize=function(val){var oRes=this.ws.workbook.oStyleManager.setFontsize(this, val);if(History.Is_On()&&oRes.oldVal!=oRes.newVal)History.Add(AscCommonExcel.g_oUndoRedoCol,AscCH.historyitem_RowCol_Fontsize,this.ws.getId(),this._getUpdateRange(),new UndoRedoData_IndexSimpleProp(this.index,false,oRes.oldVal,oRes.newVal))};Col.prototype.setFontcolor=function(val){var oRes=this.ws.workbook.oStyleManager.setFontcolor(this,val);if(History.Is_On()&&oRes.oldVal!=oRes.newVal)History.Add(AscCommonExcel.g_oUndoRedoCol,AscCH.historyitem_RowCol_Fontcolor,this.ws.getId(),this._getUpdateRange(), new UndoRedoData_IndexSimpleProp(this.index,false,oRes.oldVal,oRes.newVal))};Col.prototype.setBold=function(val){var oRes=this.ws.workbook.oStyleManager.setBold(this,val);if(History.Is_On()&&oRes.oldVal!=oRes.newVal)History.Add(AscCommonExcel.g_oUndoRedoCol,AscCH.historyitem_RowCol_Bold,this.ws.getId(),this._getUpdateRange(),new UndoRedoData_IndexSimpleProp(this.index,false,oRes.oldVal,oRes.newVal))};Col.prototype.setItalic=function(val){var oRes=this.ws.workbook.oStyleManager.setItalic(this,val); if(History.Is_On()&&oRes.oldVal!=oRes.newVal)History.Add(AscCommonExcel.g_oUndoRedoCol,AscCH.historyitem_RowCol_Italic,this.ws.getId(),this._getUpdateRange(),new UndoRedoData_IndexSimpleProp(this.index,false,oRes.oldVal,oRes.newVal))};Col.prototype.setUnderline=function(val){var oRes=this.ws.workbook.oStyleManager.setUnderline(this,val);if(History.Is_On()&&oRes.oldVal!=oRes.newVal)History.Add(AscCommonExcel.g_oUndoRedoCol,AscCH.historyitem_RowCol_Underline,this.ws.getId(),this._getUpdateRange(),new UndoRedoData_IndexSimpleProp(this.index, false,oRes.oldVal,oRes.newVal))};Col.prototype.setStrikeout=function(val){var oRes=this.ws.workbook.oStyleManager.setStrikeout(this,val);if(History.Is_On()&&oRes.oldVal!=oRes.newVal)History.Add(AscCommonExcel.g_oUndoRedoCol,AscCH.historyitem_RowCol_Strikeout,this.ws.getId(),this._getUpdateRange(),new UndoRedoData_IndexSimpleProp(this.index,false,oRes.oldVal,oRes.newVal))};Col.prototype.setFontAlign=function(val){var oRes=this.ws.workbook.oStyleManager.setFontAlign(this,val);if(History.Is_On()&&oRes.oldVal!= oRes.newVal)History.Add(AscCommonExcel.g_oUndoRedoCol,AscCH.historyitem_RowCol_FontAlign,this.ws.getId(),this._getUpdateRange(),new UndoRedoData_IndexSimpleProp(this.index,false,oRes.oldVal,oRes.newVal))};Col.prototype.setAlignVertical=function(val){var oRes=this.ws.workbook.oStyleManager.setAlignVertical(this,val);if(History.Is_On()&&oRes.oldVal!=oRes.newVal)History.Add(AscCommonExcel.g_oUndoRedoCol,AscCH.historyitem_RowCol_AlignVertical,this.ws.getId(),this._getUpdateRange(),new UndoRedoData_IndexSimpleProp(this.index, false,oRes.oldVal,oRes.newVal))};Col.prototype.setAlignHorizontal=function(val){var oRes=this.ws.workbook.oStyleManager.setAlignHorizontal(this,val);if(History.Is_On()&&oRes.oldVal!=oRes.newVal)History.Add(AscCommonExcel.g_oUndoRedoCol,AscCH.historyitem_RowCol_AlignHorizontal,this.ws.getId(),this._getUpdateRange(),new UndoRedoData_IndexSimpleProp(this.index,false,oRes.oldVal,oRes.newVal))};Col.prototype.setFill=function(val){var oRes=this.ws.workbook.oStyleManager.setFill(this,val);if(History.Is_On()&& oRes.oldVal!=oRes.newVal)History.Add(AscCommonExcel.g_oUndoRedoCol,AscCH.historyitem_RowCol_Fill,this.ws.getId(),this._getUpdateRange(),new UndoRedoData_IndexSimpleProp(this.index,false,oRes.oldVal,oRes.newVal))};Col.prototype.setBorder=function(val){var oRes=this.ws.workbook.oStyleManager.setBorder(this,val);if(History.Is_On()&&oRes.oldVal!=oRes.newVal){var oldVal=null;if(null!=oRes.oldVal)oldVal=oRes.oldVal.clone();var newVal=null;if(null!=oRes.newVal)newVal=oRes.newVal.clone();History.Add(AscCommonExcel.g_oUndoRedoCol, AscCH.historyitem_RowCol_Border,this.ws.getId(),this._getUpdateRange(),new UndoRedoData_IndexSimpleProp(this.index,false,oldVal,newVal))}};Col.prototype.setShrinkToFit=function(val){var oRes=this.ws.workbook.oStyleManager.setShrinkToFit(this,val);if(History.Is_On()&&oRes.oldVal!=oRes.newVal)History.Add(AscCommonExcel.g_oUndoRedoCol,AscCH.historyitem_RowCol_ShrinkToFit,this.ws.getId(),this._getUpdateRange(),new UndoRedoData_IndexSimpleProp(this.index,false,oRes.oldVal,oRes.newVal))};Col.prototype.setWrap= function(val){var oRes=this.ws.workbook.oStyleManager.setWrap(this,val);if(History.Is_On()&&oRes.oldVal!=oRes.newVal)History.Add(AscCommonExcel.g_oUndoRedoCol,AscCH.historyitem_RowCol_Wrap,this.ws.getId(),this._getUpdateRange(),new UndoRedoData_IndexSimpleProp(this.index,false,oRes.oldVal,oRes.newVal))};Col.prototype.setAngle=function(val){var oRes=this.ws.workbook.oStyleManager.setAngle(this,val);if(History.Is_On()&&oRes.oldVal!=oRes.newVal)History.Add(AscCommonExcel.g_oUndoRedoCol,AscCH.historyitem_RowCol_Angle, this.ws.getId(),this._getUpdateRange(),new UndoRedoData_IndexSimpleProp(this.index,false,oRes.oldVal,oRes.newVal))};Col.prototype.setIndent=function(val){var oRes=this.ws.workbook.oStyleManager.setIndent(this,val);if(History.Is_On()&&oRes.oldVal!=oRes.newVal)History.Add(AscCommonExcel.g_oUndoRedoCol,AscCH.historyitem_RowCol_Indent,this.ws.getId(),this._getUpdateRange(),new UndoRedoData_IndexSimpleProp(this.index,false,oRes.oldVal,oRes.newVal))};Col.prototype.setHidden=function(val){if(this.index>= 0&&!this.hd!==!val)this.ws.hiddenManager.addHidden(false,this.index);this.hd=val};Col.prototype.getHidden=function(){return true===this.hd};Col.prototype.setIndex=function(val){this.index=val};Col.prototype.getIndex=function(){return this.index};Col.prototype.setOutlineLevel=function(val,bDel,notAddHistory){var oldVal=this.outlineLevel;if(null!==val)this.outlineLevel=val;else{if(!this.outlineLevel)this.outlineLevel=0;this.outlineLevel=bDel?this.outlineLevel-1:this.outlineLevel+1}if(this.outlineLevel< 0)this.outlineLevel=0;else if(this.outlineLevel>c_maxOutlineLevel)this.outlineLevel=c_maxOutlineLevel;else;if(!notAddHistory&&History.Is_On()&&oldVal!=this.outlineLevel)History.Add(AscCommonExcel.g_oUndoRedoWorksheet,AscCH.historyitem_Worksheet_GroupCol,this.ws.getId(),this._getUpdateRange(),new UndoRedoData_IndexSimpleProp(this.index,false,oldVal,this.outlineLevel))};Col.prototype.getOutlineLevel=function(){return this.outlineLevel};Col.prototype.setCollapsed=function(val){this.collapsed=val};Col.prototype.getCollapsed= function(){return this.collapsed};var g_nRowOffsetFlag=0;var g_nRowOffsetXf=g_nRowOffsetFlag+1;var g_nRowOutlineLevel=g_nRowOffsetXf+4;var g_nRowOffsetHeight=g_nRowOutlineLevel+1;var g_nRowStructSize=g_nRowOffsetHeight+8;var g_nRowFlag_empty=0;var g_nRowFlag_init=1;var g_nRowFlag_hd=2;var g_nRowFlag_CustomHeight=4;var g_nRowFlag_CalcHeight=8;var g_nRowFlag_NullHeight=16;var g_nRowFlag_Collapsed=32;var g_nRowFlag_hdView=64;function Row(worksheet){this.ws=worksheet;this.index=null;this.xfs=null;this.h= null;this.outlineLevel=0;this.flags=g_nRowFlag_init;this._hasChanged=false}Row.prototype.clear=function(){this.index=null;this.xfs=null;this.h=null;this.outlineLevel=0;this.flags=g_nRowFlag_init;this._hasChanged=false};Row.prototype.saveContent=function(opt_inCaseOfChange){if(this.index>=0&&(!opt_inCaseOfChange||this._hasChanged)){this._hasChanged=false;var sheetMemory=this.ws.rowsData;sheetMemory.checkSize(this.index);var xfSave=this.xfs?this.xfs.getIndexNumber():0;var flagToSave=this.flags;var heightToSave= this.h;if(null===heightToSave){flagToSave|=g_nRowFlag_NullHeight;heightToSave=0}sheetMemory.setUint8(this.index,g_nRowOffsetFlag,flagToSave);sheetMemory.setUint32(this.index,g_nRowOffsetXf,xfSave);sheetMemory.setUint8(this.index,g_nRowOutlineLevel,this.outlineLevel);sheetMemory.setFloat64(this.index,g_nRowOffsetHeight,heightToSave)}};Row.prototype.loadContent=function(index){var res=false;this.clear();this.index=index;var sheetMemory=this.ws.rowsData;if(sheetMemory.hasSize(this.index)){this.flags= sheetMemory.getUint8(this.index,g_nRowOffsetFlag);if(0!=(g_nRowFlag_init&this.flags)){this.xfs=g_StyleCache.getXf(sheetMemory.getUint32(this.index,g_nRowOffsetXf));this.outlineLevel=sheetMemory.getUint8(this.index,g_nRowOutlineLevel);if(0!==(g_nRowFlag_NullHeight&this.flags)){this.flags&=~g_nRowFlag_NullHeight;this.h=null}else this.h=sheetMemory.getFloat64(this.index,g_nRowOffsetHeight);res=true}}return res};Row.prototype.setChanged=function(val){this._hasChanged=val};Row.prototype.isEmpty=function(){return this.isEmptyProp()}; Row.prototype.isEmptyProp=function(){return null==this.xfs&&null==this.h&&g_nRowFlag_init==this.flags&&0===this.outlineLevel};Row.prototype.clone=function(oNewWs,renameParams){if(!oNewWs)oNewWs=this.ws;var oNewRow=new Row(oNewWs);oNewRow.index=this.index;oNewRow.flags=this.flags;if(null!=this.xfs)oNewRow.xfs=this.xfs;if(null!=this.h)oNewRow.h=this.h;if(0!==this.outlineLevel)oNewRow.outlineLevel=this.outlineLevel;return oNewRow};Row.prototype.copyFrom=function(row){this.flags=row.flags;if(null!=row.xfs)this.xfs= row.xfs;if(null!=row.h)this.h=row.h;if(0!==this.outlineLevel)this.outlineLevel=row.outlineLevel;this._hasChanged=true};Row.prototype.getDefaultXfs=function(){var oRes=null;if(null!=this.ws.oAllCol&&null!=this.ws.oAllCol.xfs)oRes=this.ws.oAllCol.xfs.clone();return oRes};Row.prototype.getHeightProp=function(){return new AscCommonExcel.UndoRedoData_RowProp(this)};Row.prototype.setHeightProp=function(prop){if(null!=prop){if(null!=prop.h)this.h=prop.h;else this.h=null;this.setHidden(prop.hd);this.setCustomHeight(prop.CustomHeight); this.setOutlineLevel(prop.OutlineLevel,null,true)}};Row.prototype.getStyle=function(){return this.xfs};Row.prototype._getUpdateRange=function(){if(AscCommonExcel.g_nAllRowIndex==this.index)return new Asc.Range(0,0,gc_nMaxCol0,gc_nMaxRow0);else return new Asc.Range(0,this.index,gc_nMaxCol0,this.index)};Row.prototype.setStyle=function(xfs){var oldVal=this.xfs;this.setStyleInternal(xfs);if(History.Is_On()&&oldVal!==this.xfs)History.Add(AscCommonExcel.g_oUndoRedoRow,AscCH.historyitem_RowCol_SetStyle, this.ws.getId(),this._getUpdateRange(),new UndoRedoData_IndexSimpleProp(this.index,true,oldVal,this.xfs))};Row.prototype.setStyleInternal=function(xfs){this.xfs=g_StyleCache.addXf(xfs);this._hasChanged=true};Row.prototype.setCellStyle=function(val){var newVal=this.ws.workbook.CellStyles._prepareCellStyle(val);var oRes=this.ws.workbook.oStyleManager.setCellStyle(this,newVal);if(History.Is_On()&&oRes.oldVal!=oRes.newVal){var oldStyleName=this.ws.workbook.CellStyles.getStyleNameByXfId(oRes.oldVal);History.Add(AscCommonExcel.g_oUndoRedoRow, AscCH.historyitem_RowCol_SetCellStyle,this.ws.getId(),this._getUpdateRange(),new UndoRedoData_IndexSimpleProp(this.index,true,oldStyleName,val));var oStyle=this.ws.workbook.CellStyles.getStyleByXfId(oRes.newVal);if(oStyle.ApplyFont)this.setFont(oStyle.getFont());if(oStyle.ApplyFill)this.setFill(oStyle.getFill());if(oStyle.ApplyBorder)this.setBorder(oStyle.getBorder());if(oStyle.ApplyNumberFormat)this.setNumFormat(oStyle.getNumFormatStr())}};Row.prototype.setNumFormat=function(val){var oRes=this.ws.workbook.oStyleManager.setNum(this, new Num({f:val}));if(History.Is_On()&&oRes.oldVal!=oRes.newVal)History.Add(AscCommonExcel.g_oUndoRedoRow,AscCH.historyitem_RowCol_Num,this.ws.getId(),this._getUpdateRange(),new UndoRedoData_IndexSimpleProp(this.index,true,oRes.oldVal,oRes.newVal))};Row.prototype.setNum=function(val){var oRes=this.ws.workbook.oStyleManager.setNum(this,val);if(History.Is_On()&&oRes.oldVal!=oRes.newVal)History.Add(AscCommonExcel.g_oUndoRedoRow,AscCH.historyitem_RowCol_Num,this.ws.getId(),this._getUpdateRange(),new UndoRedoData_IndexSimpleProp(this.index, true,oRes.oldVal,oRes.newVal))};Row.prototype.setFont=function(val){var oRes=this.ws.workbook.oStyleManager.setFont(this,val);if(History.Is_On()&&oRes.oldVal!=oRes.newVal){var oldVal=null;if(null!=oRes.oldVal)oldVal=oRes.oldVal.clone();var newVal=null;if(null!=oRes.newVal)newVal=oRes.newVal.clone();History.Add(AscCommonExcel.g_oUndoRedoRow,AscCH.historyitem_RowCol_SetFont,this.ws.getId(),this._getUpdateRange(),new UndoRedoData_IndexSimpleProp(this.index,true,oldVal,newVal))}};Row.prototype.setFontname= function(val){var oRes=this.ws.workbook.oStyleManager.setFontname(this,val);if(History.Is_On()&&oRes.oldVal!=oRes.newVal)History.Add(AscCommonExcel.g_oUndoRedoRow,AscCH.historyitem_RowCol_Fontname,this.ws.getId(),this._getUpdateRange(),new UndoRedoData_IndexSimpleProp(this.index,true,oRes.oldVal,oRes.newVal))};Row.prototype.setFontsize=function(val){var oRes=this.ws.workbook.oStyleManager.setFontsize(this,val);if(History.Is_On()&&oRes.oldVal!=oRes.newVal)History.Add(AscCommonExcel.g_oUndoRedoRow, AscCH.historyitem_RowCol_Fontsize,this.ws.getId(),this._getUpdateRange(),new UndoRedoData_IndexSimpleProp(this.index,true,oRes.oldVal,oRes.newVal))};Row.prototype.setFontcolor=function(val){var oRes=this.ws.workbook.oStyleManager.setFontcolor(this,val);if(History.Is_On()&&oRes.oldVal!=oRes.newVal)History.Add(AscCommonExcel.g_oUndoRedoRow,AscCH.historyitem_RowCol_Fontcolor,this.ws.getId(),this._getUpdateRange(),new UndoRedoData_IndexSimpleProp(this.index,true,oRes.oldVal,oRes.newVal))};Row.prototype.setBold= function(val){var oRes=this.ws.workbook.oStyleManager.setBold(this,val);if(History.Is_On()&&oRes.oldVal!=oRes.newVal)History.Add(AscCommonExcel.g_oUndoRedoRow,AscCH.historyitem_RowCol_Bold,this.ws.getId(),this._getUpdateRange(),new UndoRedoData_IndexSimpleProp(this.index,true,oRes.oldVal,oRes.newVal))};Row.prototype.setItalic=function(val){var oRes=this.ws.workbook.oStyleManager.setItalic(this,val);if(History.Is_On()&&oRes.oldVal!=oRes.newVal)History.Add(AscCommonExcel.g_oUndoRedoRow,AscCH.historyitem_RowCol_Italic, this.ws.getId(),this._getUpdateRange(),new UndoRedoData_IndexSimpleProp(this.index,true,oRes.oldVal,oRes.newVal))};Row.prototype.setUnderline=function(val){var oRes=this.ws.workbook.oStyleManager.setUnderline(this,val);if(History.Is_On()&&oRes.oldVal!=oRes.newVal)History.Add(AscCommonExcel.g_oUndoRedoRow,AscCH.historyitem_RowCol_Underline,this.ws.getId(),this._getUpdateRange(),new UndoRedoData_IndexSimpleProp(this.index,true,oRes.oldVal,oRes.newVal))};Row.prototype.setStrikeout=function(val){var oRes= this.ws.workbook.oStyleManager.setStrikeout(this,val);if(History.Is_On()&&oRes.oldVal!=oRes.newVal)History.Add(AscCommonExcel.g_oUndoRedoRow,AscCH.historyitem_RowCol_Strikeout,this.ws.getId(),this._getUpdateRange(),new UndoRedoData_IndexSimpleProp(this.index,true,oRes.oldVal,oRes.newVal))};Row.prototype.setFontAlign=function(val){var oRes=this.ws.workbook.oStyleManager.setFontAlign(this,val);if(History.Is_On()&&oRes.oldVal!=oRes.newVal)History.Add(AscCommonExcel.g_oUndoRedoRow,AscCH.historyitem_RowCol_FontAlign, this.ws.getId(),this._getUpdateRange(),new UndoRedoData_IndexSimpleProp(this.index,true,oRes.oldVal,oRes.newVal))};Row.prototype.setAlignVertical=function(val){var oRes=this.ws.workbook.oStyleManager.setAlignVertical(this,val);if(History.Is_On()&&oRes.oldVal!=oRes.newVal)History.Add(AscCommonExcel.g_oUndoRedoRow,AscCH.historyitem_RowCol_AlignVertical,this.ws.getId(),this._getUpdateRange(),new UndoRedoData_IndexSimpleProp(this.index,true,oRes.oldVal,oRes.newVal))};Row.prototype.setAlignHorizontal= function(val){var oRes=this.ws.workbook.oStyleManager.setAlignHorizontal(this,val);if(History.Is_On()&&oRes.oldVal!=oRes.newVal)History.Add(AscCommonExcel.g_oUndoRedoRow,AscCH.historyitem_RowCol_AlignHorizontal,this.ws.getId(),this._getUpdateRange(),new UndoRedoData_IndexSimpleProp(this.index,true,oRes.oldVal,oRes.newVal))};Row.prototype.setFill=function(val){var oRes=this.ws.workbook.oStyleManager.setFill(this,val);if(History.Is_On()&&oRes.oldVal!=oRes.newVal)History.Add(AscCommonExcel.g_oUndoRedoRow, AscCH.historyitem_RowCol_Fill,this.ws.getId(),this._getUpdateRange(),new UndoRedoData_IndexSimpleProp(this.index,true,oRes.oldVal,oRes.newVal))};Row.prototype.setBorder=function(val){var oRes=this.ws.workbook.oStyleManager.setBorder(this,val);if(History.Is_On()&&oRes.oldVal!=oRes.newVal){var oldVal=null;if(null!=oRes.oldVal)oldVal=oRes.oldVal.clone();var newVal=null;if(null!=oRes.newVal)newVal=oRes.newVal.clone();History.Add(AscCommonExcel.g_oUndoRedoRow,AscCH.historyitem_RowCol_Border,this.ws.getId(), this._getUpdateRange(),new UndoRedoData_IndexSimpleProp(this.index,true,oldVal,newVal))}};Row.prototype.setShrinkToFit=function(val){var oRes=this.ws.workbook.oStyleManager.setShrinkToFit(this,val);if(History.Is_On()&&oRes.oldVal!=oRes.newVal)History.Add(AscCommonExcel.g_oUndoRedoRow,AscCH.historyitem_RowCol_ShrinkToFit,this.ws.getId(),this._getUpdateRange(),new UndoRedoData_IndexSimpleProp(this.index,true,oRes.oldVal,oRes.newVal))};Row.prototype.setWrap=function(val){var oRes=this.ws.workbook.oStyleManager.setWrap(this, val);if(History.Is_On()&&oRes.oldVal!=oRes.newVal)History.Add(AscCommonExcel.g_oUndoRedoRow,AscCH.historyitem_RowCol_Wrap,this.ws.getId(),this._getUpdateRange(),new UndoRedoData_IndexSimpleProp(this.index,true,oRes.oldVal,oRes.newVal))};Row.prototype.setAngle=function(val){var oRes=this.ws.workbook.oStyleManager.setAngle(this,val);if(History.Is_On()&&oRes.oldVal!=oRes.newVal)History.Add(AscCommonExcel.g_oUndoRedoRow,AscCH.historyitem_RowCol_Angle,this.ws.getId(),this._getUpdateRange(),new UndoRedoData_IndexSimpleProp(this.index, true,oRes.oldVal,oRes.newVal))};Row.prototype.setIndent=function(val){var oRes=this.ws.workbook.oStyleManager.setIndent(this,val);if(History.Is_On()&&oRes.oldVal!=oRes.newVal)History.Add(AscCommonExcel.g_oUndoRedoRow,AscCH.historyitem_RowCol_Indent,this.ws.getId(),this._getUpdateRange(),new UndoRedoData_IndexSimpleProp(this.index,true,oRes.oldVal,oRes.newVal))};Row.prototype.setHidden=function(val,bViewLocalChange){var inViewAndFilter=this.ws.getActiveNamedSheetViewId()!==null&&this.ws.autoFilters&& this.ws.autoFilters.containInFilter(this.index);if(!bViewLocalChange){var bCollaborativeChanges=!(this.ws.autoFilters&&this.ws.autoFilters.useViewLocalChange)&&this.ws.workbook.bCollaborativeChanges;bViewLocalChange=!bCollaborativeChanges&&inViewAndFilter}if(this.index>=0&&!this.getHidden()!==!val&&!(inViewAndFilter&&!bViewLocalChange))this.ws.hiddenManager.addHidden(true,this.index);var _rowFlag_hd=!bViewLocalChange?g_nRowFlag_hd:g_nRowFlag_hdView;if(true===val)this.flags|=_rowFlag_hd;else this.flags&= ~_rowFlag_hd;this._hasChanged=true};Row.prototype.setOutlineLevel=function(val,bDel,notAddHistory){var oldProps=this.outlineLevel;if(null!==val)this.outlineLevel=val;else{if(!this.outlineLevel)this.outlineLevel=0;this.outlineLevel=bDel?this.outlineLevel-1:this.outlineLevel+1}if(this.outlineLevel<0)this.outlineLevel=0;else if(this.outlineLevel>c_maxOutlineLevel)this.outlineLevel=c_maxOutlineLevel;else this._hasChanged=true;if(!notAddHistory&&History.Is_On()&&oldProps!=this.outlineLevel)History.Add(AscCommonExcel.g_oUndoRedoWorksheet, AscCH.historyitem_Worksheet_GroupRow,this.ws.getId(),this._getUpdateRange(),new UndoRedoData_IndexSimpleProp(this.index,true,oldProps,this.outlineLevel))};Row.prototype.getOutlineLevel=function(){return this.outlineLevel};Row.prototype.getHidden=function(bViewLocalChange){if(undefined===bViewLocalChange){var bCollaborativeChanges=!(this.ws.autoFilters&&this.ws.autoFilters.useViewLocalChange)&&this.ws.workbook.bCollaborativeChanges;bViewLocalChange=!bCollaborativeChanges&&this.ws.getActiveNamedSheetViewId()!== null&&this.ws.autoFilters.containInFilter(this.index)}var _rowFlag_hd=bViewLocalChange?g_nRowFlag_hdView:g_nRowFlag_hd;return 0!==(_rowFlag_hd&this.flags)};Row.prototype.setCustomHeight=function(val){if(true===val)this.flags|=g_nRowFlag_CustomHeight;else this.flags&=~g_nRowFlag_CustomHeight;this._hasChanged=true};Row.prototype.getCustomHeight=function(){return 0!=(g_nRowFlag_CustomHeight&this.flags)};Row.prototype.setCalcHeight=function(val){if(true===val)this.flags|=g_nRowFlag_CalcHeight;else this.flags&= ~g_nRowFlag_CalcHeight;this._hasChanged=true};Row.prototype.getCalcHeight=function(){return 0!=(g_nRowFlag_CalcHeight&this.flags)};Row.prototype.setCollapsed=function(val){if(true===val)this.flags|=g_nRowFlag_Collapsed;else this.flags&=~g_nRowFlag_Collapsed;this._hasChanged=true};Row.prototype.getCollapsed=function(){return 0!=(g_nRowFlag_Collapsed&this.flags)};Row.prototype.setIndex=function(val){this.index=val};Row.prototype.getIndex=function(){return this.index};Row.prototype.setHeight=function(val){if(val< 0)val=0;else if(val>Asc.c_oAscMaxRowHeight)val=Asc.c_oAscMaxRowHeight;this.h=val;this._hasChanged=true};Row.prototype.getHeight=function(){return this.h};Row.prototype.fromXLSB=function(stream,aCellXfs){var end=stream.XlsbReadRecordLength()+stream.GetCurPos();this.setIndex(stream.GetULongLE()&1048575);var style=stream.GetULongLE();var ht=stream.GetUShortLE();stream.Skip2(1);var byteExtra2=stream.GetUChar();this.setOutlineLevel(byteExtra2&7,null,true);if(0!==(byteExtra2&8))this.setCollapsed(true); if(0!==(byteExtra2&16))this.setHidden(true);if(0!==(byteExtra2&32))this.setCustomHeight(true);if(ht>0||this.getCustomHeight())this.setHeight(ht/20);if(0!==(byteExtra2&64)){var xf=aCellXfs[style];if(xf)this.setStyle(xf)}stream.Seek2(end)};Row.prototype.toXLSB=function(stream,offsetIndex,stylesForWrite){stream.XlsbStartRecord(AscCommonExcel.XLSB.rt_ROW_HDR,17);stream.WriteULong(this.index+offsetIndex&1048575);var nS=0;if(this.xfs)nS=stylesForWrite.add(this.xfs);stream.WriteULong(nS);var nHt=0;if(null!= this.h)nHt=this.h*20&8191;stream.WriteUShort(nHt);stream.WriteByte(0);var byteExtra2=0;if(this.outlineLevel>0)byteExtra2|=this.outlineLevel&7;if(this.getCollapsed())byteExtra2|=8;if(this.getHidden())byteExtra2|=16;if(this.getCustomHeight())byteExtra2|=32;if(this.xfs)byteExtra2|=64;stream.WriteByte(byteExtra2);stream.WriteByte(0);stream.WriteULong(0);stream.XlsbEndRecord()};function getStringFromMultiText(multiText){var sRes="";if(multiText)for(var i=0,length=multiText.length;i0||offset.col>0;var bHor=0!=offset.col?true:false;if(elems.inner.length>0){var bboxAsc=new Asc.Range(bbox.c1,bbox.r1,bbox.c2,bbox.r2);for(var i=0,length=elems.inner.length;i0)for(var i=0,length=elems.outer.length;i=intersectionRanges.c1&&i<=intersectionRanges.c2){var tableIndex=i-this.Ref.c1;tableColumn=this.TableColumns[tableIndex]}else{tableColumn=new TableColumn;var cell=autoFilters.worksheet.getCell3(headerRow,i);if(!cell.isNullText())tableColumn.Name=autoFilters.checkTableColumnName(newTableColumns.concat(this.TableColumns), cell.getValueWithoutFormat())}newTableColumns.push(tableColumn)}for(var j=0;j=this.Ref.c1&&activeRange.c2this.Ref.c2&&activeRange.c1>this.Ref.c1){diff=this.Ref.c2-activeRange.c1+1;startCol=activeRange.c1-this.Ref.c1}else if(activeRange.c1>=this.Ref.c1&&activeRange.c2<=this.Ref.c2){diff=activeRange.c2-activeRange.c1+1;startCol=activeRange.c1-this.Ref.c1}if(diff!==null){var deleted=this.TableColumns.splice(startCol,diff);this.removeDependencies(deleted);var deletedMap={};for(var i=0;i=curCol)newTableColumns[newTableColumns.length]=new TableColumn;else{newTableColumns[newTableColumns.length]=this.TableColumns[j]; j++}num++}for(var j=0;j1)this.TableColumns[0].generateTotalsRowLabel();this.TableColumns[this.TableColumns.length-1].generateTotalsRowFunction(ws,this)};TablePart.prototype.changeDisplayName=function(newName){this.DisplayName=newName};TablePart.prototype.getRangeWithoutHeaderFooter=function(){var startRow=this.HeaderRowCount===null?this.Ref.r1+1:this.Ref.r1;var endRow=this.TotalsRowCount?this.Ref.r2-1:this.Ref.r2; return Asc.Range(this.Ref.c1,startRow,this.Ref.c2,endRow)};TablePart.prototype.getColumnRange=function(index,withoutHeader,withoutFooter,opt_range){var tableRange=opt_range?opt_range:this.Ref;var startRow=tableRange.r1;if(withoutHeader&&this.isHeaderRow())startRow++;var endRow=tableRange.r2;if(withoutFooter&&this.isTotalsRow())endRow--;return Asc.Range(tableRange.c1+index,startRow,tableRange.c1+index,endRow)};TablePart.prototype.checkTotalRowFormula=function(ws){for(var i=0;i0};TablePart.prototype.isTotalsRow= function(){return this.TotalsRowCount>0};TablePart.prototype.getTotalsRowRange=function(){var res=null;if(this.TotalsRowCount>0)res=new Asc.Range(this.Ref.c1,this.Ref.r2,this.Ref.c2,this.Ref.r2);return res};TablePart.prototype.generateSortState=function(){this.SortState=new AscCommonExcel.SortState;this.SortState.SortConditions=[];this.SortState.SortConditions[0]=new AscCommonExcel.SortCondition};TablePart.prototype.generateAutoFilterRef=function(){var res=null;if(this.Ref)if(this.isTotalsRow())res= new Asc.Range(this.Ref.c1,this.Ref.r1,this.Ref.c2,this.Ref.r2-1);else res=new Asc.Range(this.Ref.c1,this.Ref.r1,this.Ref.c2,this.Ref.r2);return res};TablePart.prototype.syncTotalLabels=function(ws){if(this.Ref)if(this.isTotalsRow())for(var i=0;i0||offset.col> 0;var bHor=0!=offset.col;var nTemp1,nTemp2;if(bHor)if(from.c1=from.c1&&range.c2<=from.c2&&range.r1<=from.r1&&from.r2<=range.r2&&!bAdd){to=from.clone();nTemp1=range.c2-from.c1+1;nTemp2=range.c2- range.c1+1;to.setOffsetFirst(new AscCommon.CellBase(0,Math.min(nTemp1,nTemp2)))}}else if(from.r1=from.r1&&range.r2<=from.r2&&range.c1<=from.c1&&from.c2<=range.c2&&!bAdd){to=from.clone(); nTemp1=range.r2-from.r1+1;nTemp2=range.r2-range.r1+1;to.setOffsetFirst(new AscCommon.CellBase(Math.min(nTemp1,nTemp2),0))}if(null!=to){this.Ref=to;if(this.SortConditions){var deleteIndexes=[];for(var i=0;i=array[k].start&&val=array[i].start&&val");else if(trimVal!==trimFilterVal)result= true;break}case c_oAscCustomAutoFilter.isGreaterThan:{if(!isDigitValue)result=matchingValues(trimFilterVal,trimVal,">");else if(val>filterVal)result=true;break}case c_oAscCustomAutoFilter.isGreaterThanOrEqualTo:{if(!isDigitValue)result=matchingValues(trimFilterVal,trimVal,">=");else if(val>=filterVal)result=true;break}case c_oAscCustomAutoFilter.isLessThan:{if(!isDigitValue)result=matchingValues(trimFilterVal,trimVal,"<");else if(val");else result=true;break}case c_oAscCustomAutoFilter.endsWith:{if(!isDigitValue)result=matchingValues("*"+trimFilterVal,trimVal);break}case c_oAscCustomAutoFilter.doesNotEndWith:{if(!isDigitValue)result= matchingValues("*"+trimFilterVal,trimVal,"<>");else result=true;break}case c_oAscCustomAutoFilter.contains:{if(!isDigitValue)result=matchingValues("*"+trimFilterVal+"*",trimVal);break}case c_oAscCustomAutoFilter.doesNotContain:{if(!isDigitValue)result=matchingValues("*"+trimFilterVal+"*",trimVal,"<>");else result=true;break}}}return!result};CustomFilter.prototype.asc_getOperator=function(){return this.Operator};CustomFilter.prototype.asc_getVal=function(){return this.Val};CustomFilter.prototype.asc_setOperator= function(val){this.Operator=val};CustomFilter.prototype.asc_setVal=function(val){this.Val=val};CustomFilter.prototype.check=function(){if(c_oAscCustomAutoFilter.doesNotEqual===this.Operator)if(""===this.Val.replace(/ /g,""))this.Val=" ";if(c_oAscCustomAutoFilter.beginsWith===this.Operator){this.Operator=c_oAscCustomAutoFilter.equals;this.Val=this.Val+"*"}else if(c_oAscCustomAutoFilter.doesNotBeginWith===this.Operator){this.Operator=c_oAscCustomAutoFilter.doesNotEqual;this.Val=this.Val+"*"}else if(c_oAscCustomAutoFilter.endsWith=== this.Operator){this.Operator=c_oAscCustomAutoFilter.equals;this.Val="*"+this.Val}else if(c_oAscCustomAutoFilter.doesNotEndWith===this.Operator){this.Operator=c_oAscCustomAutoFilter.doesNotEqual;this.Val="*"+this.Val}else if(c_oAscCustomAutoFilter.contains===this.Operator){this.Operator=c_oAscCustomAutoFilter.equals;this.Val="*"+this.Val+"*"}else if(c_oAscCustomAutoFilter.doesNotContain===this.Operator){this.Operator=c_oAscCustomAutoFilter.doesNotEqual;this.Val="*"+this.Val+"*"}};CustomFilter.prototype._generateEmptyValueFilter= function(){this.Operator=c_oAscCustomAutoFilter.doesNotEqual;this.Val=" "};CustomFilter.prototype.readAttributes=function(attr,uq){if(attr()){var vals=attr();var val;val=vals["operator"];if(undefined!==val){val=FromXml_ST_FilterOperator(val);if(-1!==val)this.Operator=val}val=vals["val"];if(undefined!==val)this.Val=AscCommon.unleakString(uq(val))}};CustomFilter.prototype.toXml=function(writer,name){writer.WriteXmlNodeStart(name);if(null!==this.Operator)writer.WriteXmlAttributeStringEncode("operator", ToXml_ST_FilterOperator(this.Operator));if(null!==this.Val)writer.WriteXmlAttributeStringEncode("val",this.Val);writer.WriteXmlNodeEnd(name,true,true)};CustomFilter.prototype.Write_ToBinary2=function(writer){if(null!=this.Operator){writer.WriteBool(true);writer.WriteLong(this.Operator)}else writer.WriteBool(false);if(null!=this.Val){writer.WriteBool(true);writer.WriteString2(this.Val)}else writer.WriteBool(false)};CustomFilter.prototype.Read_FromBinary2=function(reader){if(reader.GetBool())this.Operator= reader.GetLong();if(reader.GetBool())this.Val=reader.GetString2()};CustomFilter.prototype.changeForInterface=function(){if(!this.Val||this.Val.length<=1)return;var isStartSpecSymbol=this.Val&&this.Val.length>1&&this.Val[0]==="*";var isEndSpecSymbol;if(!isStartSpecSymbol||isStartSpecSymbol&&this.Val.length>=2)isEndSpecSymbol=this.Val&&this.Val[this.Val.length-1]==="*";if(isStartSpecSymbol&&isEndSpecSymbol&&this.Val.length<=2)return;if(isStartSpecSymbol||isEndSpecSymbol){this.Val=this.Val.substring(isStartSpecSymbol? 1:0,isEndSpecSymbol?this.Val.length-1:this.Val.length);if(c_oAscCustomAutoFilter.doesNotEqual===this.Operator)if(isStartSpecSymbol&&isEndSpecSymbol)this.Operator=c_oAscCustomAutoFilter.doesNotContain;else if(isStartSpecSymbol)this.Operator=c_oAscCustomAutoFilter.doesNotEndWith;else this.Operator=c_oAscCustomAutoFilter.doesNotBeginWith;else if(isStartSpecSymbol&&isEndSpecSymbol)this.Operator=c_oAscCustomAutoFilter.contains;else if(isStartSpecSymbol)this.Operator=c_oAscCustomAutoFilter.endsWith;else this.Operator= c_oAscCustomAutoFilter.beginsWith}};var g_oDynamicFilter={Type:0,Val:1,MaxVal:2};function DynamicFilter(){this.Properties=g_oDynamicFilter;this.Type=null;this.Val=null;this.MaxVal=null}DynamicFilter.prototype.getType=function(){return UndoRedoDataTypes.DynamicFilter};DynamicFilter.prototype.getProperties=function(){return this.Properties};DynamicFilter.prototype.getProperty=function(nType){switch(nType){case this.Properties.Type:return this.Type;break;case this.Properties.Val:return this.Val;break; case this.Properties.MaxVal:return this.MaxVal;break}return null};DynamicFilter.prototype.setProperty=function(nType,value){switch(nType){case this.Properties.Type:this.Type=value;break;case this.Properties.Val:this.Val=value;break;case this.Properties.MaxVal:this.MaxVal=value;break}};DynamicFilter.prototype.clone=function(){var res=new DynamicFilter;res.Type=this.Type;res.Val=this.Val;res.MaxVal=this.MaxVal;return res};DynamicFilter.prototype.init=function(range){var res=null;switch(this.Type){case Asc.c_oAscDynamicAutoFilter.aboveAverage:case Asc.c_oAscDynamicAutoFilter.belowAverage:{var summ= 0;var counter=0;range._foreachNoEmpty(function(cell){var val=parseFloat(cell.getValueWithoutFormat());if(!isNaN(val)){summ+=parseFloat(val);counter++}});res=summ/counter;break}}this.Val=res};DynamicFilter.prototype.isHideValue=function(val){var res=false;switch(this.Type){case Asc.c_oAscDynamicAutoFilter.aboveAverage:{res=val>this.Val?false:true;break}case Asc.c_oAscDynamicAutoFilter.belowAverage:{res=valthis.FilterVal)res=true;return res};Top10.prototype.init=function(range,reWrite){var t=this;if(null===this.FilterVal||true===reWrite)if(range){var arr=[];var alreadyAddValues={};var count=0;range._setPropertyNoEmpty(null,null,function(cell){var val=parseFloat(cell.getValueWithoutFormat());if(!isNaN(val)&&!alreadyAddValues[val]){arr.push(val);alreadyAddValues[val]=1;count++}});this.initByArray(arr)}};Top10.prototype.initByArray= function(arr,isSum){var res=null;var t=this;if(arr&&arr.length){arr.sort(function(a,b){var res;if(t.Top)res=b-a;else res=a-b;return res});if(this.Percent){var num=parseInt(arr.length*(this.Val/100));if(0===num)num=1;res=arr[num-1]}else if(isSum){var index=0;var sum=res=arr[index++];while(index=ref.c1)bIsDeleteCurSortCondition=true;else{if(activeRange.c10||offset.col>0;var bHor=0!=offset.col;var nTemp1,nTemp2;var diff=bHor?range.c1+offset.col-1:range.r1+offset.row; if(bHor&&bColumnSort){if(from.c1=maxCount)break;this.sortList.push(this.getNameColumnByIndex(j-selection.c1,selection))}else for(j=selection.r1;j<=selection.r2;j++){if(j-selection.r1>= maxCount)break;this.sortList.push(this.getNameColumnByIndex(j-selection.r1,selection))}}if(this.levels)for(var i=0;i=maxCount)break;elem=new window["AscCommonExcel"].AutoFiltersOptionsElements;elem.asc_setVisible(true);elem.asc_setVal(this.getNameColumnByIndex(j- selection.c1));this.columnList.push(elem)}}};CRemoveDuplicatesProps.prototype.getNameColumnByIndex=function(index){var t=this;var _generateName=function(index){var base=AscCommon.translateManager.getValue("Column");var text=t._ws._getColumnTitle(index);text=base+" "+text;return text};var row=this._newSelection.r1;var col=index+this._newSelection.c1;if(!this.hasHeaders)return _generateName(col);else{var cell=t._ws.model.getCell3(row-1,col);var value=cell.getValueWithFormat();return value!==""?value: _generateName(col)}};CRemoveDuplicatesProps.prototype.setDuplicateValues=function(val){this.duplicateValues=val};CRemoveDuplicatesProps.prototype.setUniqueValues=function(val){this.uniqueValues=val};CRemoveDuplicatesProps.prototype.asc_getDuplicateValues=function(val){return this.duplicateValues};CRemoveDuplicatesProps.prototype.asc_getUniqueValues=function(val){return this.uniqueValues};function CFunctionInfo(name){this.name=null;this.argumentsMin=null;this.argumentsMax=null;this.argumentsValue= null;this.argumentsType=null;this.argumentsResult=null;this.formulaResult=null;this.functionResult=null;this._init(name);return this}CFunctionInfo.prototype._init=function(name){var f=AscCommonExcel.cFormulaFunctionLocalized?AscCommonExcel.cFormulaFunctionLocalized[name]:AscCommonExcel.cFormulaFunction[name];if(f){this.name=name;this.argumentsMin=f.prototype.argumentsMin;this.argumentsMax=f.prototype.argumentsMax;this.argumentsType=f.prototype.argumentsType}};CFunctionInfo.prototype.asc_getArgumentMin= function(){return this.argumentsMin};CFunctionInfo.prototype.asc_getArgumentMax=function(){return this.argumentsMax};CFunctionInfo.prototype.asc_getArgumentsValue=function(){return this.argumentsValue};CFunctionInfo.prototype.asc_getArgumentsType=function(){return this.argumentsType};CFunctionInfo.prototype.asc_getArgumentsResult=function(){return this.argumentsResult};CFunctionInfo.prototype.asc_getFormulaResult=function(){return this.formulaResult};CFunctionInfo.prototype.asc_getFunctionResult= function(){return this.functionResult};CFunctionInfo.prototype.asc_getName=function(){return this.name};var prot;window["Asc"]=window["Asc"]||{};window["AscCommonExcel"]=window["AscCommonExcel"]||{};window["AscCommonExcel"].g_oColorManager=g_oColorManager;window["AscCommonExcel"].g_oDefaultFormat=g_oDefaultFormat;window["AscCommonExcel"].g_nColorTextDefault=g_nColorTextDefault;window["AscCommonExcel"].g_nColorHyperlink=g_nColorHyperlink;window["AscCommonExcel"].c_maxOutlineLevel=c_maxOutlineLevel; window["AscCommonExcel"].g_oThemeColorsDefaultModsSpreadsheet=g_oThemeColorsDefaultModsSpreadsheet;window["AscCommonExcel"].g_StyleCache=g_StyleCache;window["AscCommonExcel"].map_themeExcel_to_themePresentation=map_themeExcel_to_themePresentation;window["AscCommonExcel"].g_nRowStructSize=g_nRowStructSize;window["AscCommonExcel"].shiftGetBBox=shiftGetBBox;window["AscCommonExcel"].getStringFromMultiText=getStringFromMultiText;window["AscCommonExcel"].getStringFromMultiTextSkipToSpace=getStringFromMultiTextSkipToSpace; window["AscCommonExcel"].isEqualMultiText=isEqualMultiText;window["AscCommonExcel"].RgbColor=RgbColor;window["AscCommonExcel"].createRgbColor=createRgbColor;window["AscCommonExcel"].ThemeColor=ThemeColor;window["AscCommonExcel"].CorrectAscColor=CorrectAscColor;window["AscCommonExcel"].Fragment=Fragment;window["AscCommonExcel"].Font=Font;window["Asc"]["c_oAscPatternType"]=c_oAscPatternType;prot=c_oAscPatternType;prot["DarkDown"]=prot.DarkDown;prot["DarkGray"]=prot.DarkGray;prot["DarkGrid"]=prot.DarkGrid; prot["DarkHorizontal"]=prot.DarkHorizontal;prot["DarkTrellis"]=prot.DarkTrellis;prot["DarkUp"]=prot.DarkUp;prot["DarkVertical"]=prot.DarkVertical;prot["Gray0625"]=prot.Gray0625;prot["Gray125"]=prot.Gray125;prot["LightDown"]=prot.LightDown;prot["LightGray"]=prot.LightGray;prot["LightGrid"]=prot.LightGrid;prot["LightHorizontal"]=prot.LightHorizontal;prot["LightTrellis"]=prot.LightTrellis;prot["LightUp"]=prot.LightUp;prot["LightVertical"]=prot.LightVertical;prot["MediumGray"]=prot.MediumGray;prot["None"]= prot.None;prot["Solid"]=prot.Solid;window["Asc"]["asc_CGradientFill"]=window["AscCommonExcel"].GradientFill=GradientFill;prot=GradientFill.prototype;prot["asc_getType"]=prot.asc_getType;prot["asc_setType"]=prot.asc_setType;prot["asc_getDegree"]=prot.asc_getDegree;prot["asc_setDegree"]=prot.asc_setDegree;prot["asc_getLeft"]=prot.asc_getLeft;prot["asc_setLeft"]=prot.asc_setLeft;prot["asc_getRight"]=prot.asc_getRight;prot["asc_setRight"]=prot.asc_setRight;prot["asc_getTop"]=prot.asc_getTop;prot["asc_setTop"]= prot.asc_setTop;prot["asc_getBottom"]=prot.asc_getBottom;prot["asc_setBottom"]=prot.asc_setBottom;prot["asc_getGradientStops"]=prot.asc_getGradientStops;prot["asc_putGradientStops"]=prot.asc_putGradientStops;window["Asc"]["asc_CGradientStop"]=window["AscCommonExcel"].GradientStop=GradientStop;prot=GradientStop.prototype;prot["asc_getPosition"]=prot.asc_getPosition;prot["asc_setPosition"]=prot.asc_setPosition;prot["asc_getColor"]=prot.asc_getColor;prot["asc_setColor"]=prot.asc_setColor;window["Asc"]["asc_CPatternFill"]= window["AscCommonExcel"].PatternFill=PatternFill;prot=PatternFill.prototype;prot["asc_getType"]=prot.asc_getType;prot["asc_setType"]=prot.asc_setType;prot["asc_getFgColor"]=prot.asc_getFgColor;prot["asc_setFgColor"]=prot.asc_setFgColor;prot["asc_getBgColor"]=prot.asc_getBgColor;prot["asc_setBgColor"]=prot.asc_setBgColor;window["Asc"]["asc_CFill2"]=window["AscCommonExcel"].Fill=Fill;prot=Fill.prototype;prot["asc_getPatternFill"]=prot.asc_getPatternFill;prot["asc_setPatternFill"]=prot.asc_setPatternFill; prot["asc_getGradientFill"]=prot.asc_getGradientFill;prot["asc_setGradientFill"]=prot.asc_setGradientFill;window["AscCommonExcel"].BorderProp=BorderProp;window["AscCommonExcel"].Border=Border;window["AscCommonExcel"].Num=Num;window["Asc"]["asc_CellXfs"]=window["AscCommonExcel"].CellXfs=CellXfs;prot=CellXfs.prototype;prot["asc_getFillColor"]=prot.asc_getFillColor;prot["asc_getFill"]=prot.asc_getFill;prot["asc_getFontName"]=prot.asc_getFontName;prot["asc_getFontSize"]=prot.asc_getFontSize;prot["asc_getFontColor"]= prot.asc_getFontColor;prot["asc_getFontBold"]=prot.asc_getFontBold;prot["asc_getFontItalic"]=prot.asc_getFontItalic;prot["asc_getFontUnderline"]=prot.asc_getFontUnderline;prot["asc_getFontStrikeout"]=prot.asc_getFontStrikeout;prot["asc_getFontSubscript"]=prot.asc_getFontSubscript;prot["asc_getFontSuperscript"]=prot.asc_getFontSuperscript;prot["asc_getNumFormat"]=prot.asc_getNumFormat;prot["asc_getNumFormatInfo"]=prot.asc_getNumFormatInfo;prot["asc_getHorAlign"]=prot.asc_getHorAlign;prot["asc_getVertAlign"]= prot.asc_getVertAlign;prot["asc_getAngle"]=prot.asc_getAngle;prot["asc_getIndent"]=prot.asc_getIndent;prot["asc_getWrapText"]=prot.asc_getWrapText;prot["asc_getShrinkToFit"]=prot.asc_getShrinkToFit;prot["asc_getPreview"]=prot.asc_getPreview;prot["asc_setFillColor"]=prot.asc_setFillColor;prot["asc_setFill"]=prot.asc_setFill;prot["asc_setFontName"]=prot.asc_setFontName;prot["asc_setFontSize"]=prot.asc_setFontSize;prot["asc_setFontColor"]=prot.asc_setFontColor;prot["asc_setFontBold"]=prot.asc_setFontBold; prot["asc_setFontItalic"]=prot.asc_setFontItalic;prot["asc_setFontUnderline"]=prot.asc_setFontUnderline;prot["asc_setFontStrikeout"]=prot.asc_setFontStrikeout;prot["asc_setFontSubscript"]=prot.asc_setFontSubscript;prot["asc_setFontSuperscript"]=prot.asc_setFontSuperscript;prot["asc_setBorder"]=prot.asc_setBorder;prot["asc_setNumFormatInfo"]=prot.asc_setNumFormatInfo;window["AscCommonExcel"].Align=Align;window["AscCommonExcel"].CCellStyles=CCellStyles;window["AscCommonExcel"].CCellStyle=CCellStyle; window["AscCommonExcel"].StyleManager=StyleManager;window["AscCommonExcel"].SheetMergedStyles=SheetMergedStyles;window["AscCommonExcel"].Hyperlink=Hyperlink;window["AscCommonExcel"].SheetFormatPr=SheetFormatPr;window["AscCommonExcel"].Col=Col;window["AscCommonExcel"].Row=Row;window["AscCommonExcel"].CMultiTextElem=CMultiTextElem;window["AscCommonExcel"].CCellValue=CCellValue;window["AscCommonExcel"].RangeDataManager=RangeDataManager;window["AscCommonExcel"].CSharedStrings=CSharedStrings;window["AscCommonExcel"].CWorkbookFormulas= CWorkbookFormulas;window["Asc"]["sparklineGroup"]=window["AscCommonExcel"].sparklineGroup=sparklineGroup;prot=sparklineGroup.prototype;prot["asc_getId"]=prot.asc_getId;prot["asc_getType"]=prot.asc_getType;prot["asc_getLineWeight"]=prot.asc_getLineWeight;prot["asc_getDisplayEmpty"]=prot.asc_getDisplayEmpty;prot["asc_getMarkersPoint"]=prot.asc_getMarkersPoint;prot["asc_getHighPoint"]=prot.asc_getHighPoint;prot["asc_getLowPoint"]=prot.asc_getLowPoint;prot["asc_getFirstPoint"]=prot.asc_getFirstPoint; prot["asc_getLastPoint"]=prot.asc_getLastPoint;prot["asc_getNegativePoint"]=prot.asc_getNegativePoint;prot["asc_getDisplayXAxis"]=prot.asc_getDisplayXAxis;prot["asc_getDisplayHidden"]=prot.asc_getDisplayHidden;prot["asc_getMinAxisType"]=prot.asc_getMinAxisType;prot["asc_getMaxAxisType"]=prot.asc_getMaxAxisType;prot["asc_getRightToLeft"]=prot.asc_getRightToLeft;prot["asc_getManualMax"]=prot.asc_getManualMax;prot["asc_getManualMin"]=prot.asc_getManualMin;prot["asc_getColorSeries"]=prot.asc_getColorSeries; prot["asc_getColorNegative"]=prot.asc_getColorNegative;prot["asc_getColorAxis"]=prot.asc_getColorAxis;prot["asc_getColorMarkers"]=prot.asc_getColorMarkers;prot["asc_getColorFirst"]=prot.asc_getColorFirst;prot["asc_getColorLast"]=prot.asc_getColorLast;prot["asc_getColorHigh"]=prot.asc_getColorHigh;prot["asc_getColorLow"]=prot.asc_getColorLow;prot["asc_getDataRanges"]=prot.asc_getDataRanges;prot["asc_setType"]=prot.asc_setType;prot["asc_setLineWeight"]=prot.asc_setLineWeight;prot["asc_setDisplayEmpty"]= prot.asc_setDisplayEmpty;prot["asc_setMarkersPoint"]=prot.asc_setMarkersPoint;prot["asc_setHighPoint"]=prot.asc_setHighPoint;prot["asc_setLowPoint"]=prot.asc_setLowPoint;prot["asc_setFirstPoint"]=prot.asc_setFirstPoint;prot["asc_setLastPoint"]=prot.asc_setLastPoint;prot["asc_setNegativePoint"]=prot.asc_setNegativePoint;prot["asc_setDisplayXAxis"]=prot.asc_setDisplayXAxis;prot["asc_setDisplayHidden"]=prot.asc_setDisplayHidden;prot["asc_setMinAxisType"]=prot.asc_setMinAxisType;prot["asc_setMaxAxisType"]= prot.asc_setMaxAxisType;prot["asc_setRightToLeft"]=prot.asc_setRightToLeft;prot["asc_setManualMax"]=prot.asc_setManualMax;prot["asc_setManualMin"]=prot.asc_setManualMin;prot["asc_setColorSeries"]=prot.asc_setColorSeries;prot["asc_setColorNegative"]=prot.asc_setColorNegative;prot["asc_setColorAxis"]=prot.asc_setColorAxis;prot["asc_setColorMarkers"]=prot.asc_setColorMarkers;prot["asc_setColorFirst"]=prot.asc_setColorFirst;prot["asc_setColorLast"]=prot.asc_setColorLast;prot["asc_setColorHigh"]=prot.asc_setColorHigh; prot["asc_setColorLow"]=prot.asc_setColorLow;prot["asc_getStyles"]=prot.asc_getStyles;prot["asc_setStyle"]=prot.asc_setStyle;window["AscCommonExcel"].sparkline=sparkline;window["AscCommonExcel"].TablePart=TablePart;window["AscCommonExcel"].AutoFilter=AutoFilter;window["AscCommonExcel"].SortState=SortState;window["AscCommonExcel"].TableColumn=TableColumn;window["AscCommonExcel"].TableStyleInfo=TableStyleInfo;window["AscCommonExcel"].FilterColumn=FilterColumn;window["AscCommonExcel"].Filters=Filters; window["AscCommonExcel"].Filter=Filter;window["AscCommonExcel"].DateGroupItem=DateGroupItem;window["AscCommonExcel"].SortCondition=SortCondition;window["AscCommonExcel"].AutoFilterDateElem=AutoFilterDateElem;window["AscCommonExcel"].c_oAscPatternType=c_oAscPatternType;window["Asc"]["CustomFilters"]=window["Asc"].CustomFilters=CustomFilters;prot=CustomFilters.prototype;prot["asc_getAnd"]=prot.asc_getAnd;prot["asc_getCustomFilters"]=prot.asc_getCustomFilters;prot["asc_setAnd"]=prot.asc_setAnd;prot["asc_setCustomFilters"]= prot.asc_setCustomFilters;window["Asc"]["CustomFilter"]=window["Asc"].CustomFilter=CustomFilter;prot=CustomFilter.prototype;prot["asc_getOperator"]=prot.asc_getOperator;prot["asc_getVal"]=prot.asc_getVal;prot["asc_setOperator"]=prot.asc_setOperator;prot["asc_setVal"]=prot.asc_setVal;window["Asc"]["DynamicFilter"]=window["Asc"].DynamicFilter=DynamicFilter;prot=DynamicFilter.prototype;prot["asc_getType"]=prot.asc_getType;prot["asc_getVal"]=prot.asc_getVal;prot["asc_getMaxVal"]=prot.asc_getMaxVal;prot["asc_setType"]= prot.asc_setType;prot["asc_setVal"]=prot.asc_setVal;prot["asc_setMaxVal"]=prot.asc_setMaxVal;window["Asc"]["ColorFilter"]=window["Asc"].ColorFilter=ColorFilter;prot=ColorFilter.prototype;prot["asc_getCellColor"]=prot.asc_getCellColor;prot["asc_getCColor"]=prot.asc_getCColor;prot["asc_getDxf"]=prot.asc_getDxf;prot["asc_setCellColor"]=prot.asc_setCellColor;prot["asc_setDxf"]=prot.asc_setDxf;prot["asc_setCColor"]=prot.asc_setCColor;window["Asc"]["Top10"]=window["Asc"].Top10=Top10;prot=Top10.prototype; prot["asc_getFilterVal"]=prot.asc_getFilterVal;prot["asc_getPercent"]=prot.asc_getPercent;prot["asc_getTop"]=prot.asc_getTop;prot["asc_getVal"]=prot.asc_getVal;prot["asc_setFilterVal"]=prot.asc_setFilterVal;prot["asc_setPercent"]=prot.asc_setPercent;prot["asc_setTop"]=prot.asc_setTop;prot["asc_setVal"]=prot.asc_setVal;window["Asc"]["asc_CPageMargins"]=window["Asc"].asc_CPageMargins=asc_CPageMargins;prot=asc_CPageMargins.prototype;prot["asc_getLeft"]=prot.asc_getLeft;prot["asc_getRight"]=prot.asc_getRight; prot["asc_getTop"]=prot.asc_getTop;prot["asc_getBottom"]=prot.asc_getBottom;prot["asc_setLeft"]=prot.asc_setLeft;prot["asc_setRight"]=prot.asc_setRight;prot["asc_setTop"]=prot.asc_setTop;prot["asc_setBottom"]=prot.asc_setBottom;prot["asc_setHeader"]=prot.asc_setHeader;prot["asc_setFooter"]=prot.asc_setFooter;window["Asc"]["asc_CPageSetup"]=window["Asc"].asc_CPageSetup=asc_CPageSetup;prot=asc_CPageSetup.prototype;prot["asc_getOrientation"]=prot.asc_getOrientation;prot["asc_getWidth"]=prot.asc_getWidth; prot["asc_getHeight"]=prot.asc_getHeight;prot["asc_setOrientation"]=prot.asc_setOrientation;prot["asc_setWidth"]=prot.asc_setWidth;prot["asc_setHeight"]=prot.asc_setHeight;prot["asc_getFitToWidth"]=prot.asc_getFitToWidth;prot["asc_getFitToHeight"]=prot.asc_getFitToHeight;prot["asc_setFitToWidth"]=prot.asc_setFitToWidth;prot["asc_setFitToHeight"]=prot.asc_setFitToHeight;prot["asc_getScale"]=prot.asc_getScale;prot["asc_setScale"]=prot.asc_setScale;window["Asc"]["asc_CPageOptions"]=window["Asc"].asc_CPageOptions= asc_CPageOptions;prot=asc_CPageOptions.prototype;prot["asc_getPageMargins"]=prot.asc_getPageMargins;prot["asc_getPageSetup"]=prot.asc_getPageSetup;prot["asc_getGridLines"]=prot.asc_getGridLines;prot["asc_getHeadings"]=prot.asc_getHeadings;prot["asc_setPageMargins"]=prot.asc_setPageMargins;prot["asc_setPageSetup"]=prot.asc_setPageSetup;prot["asc_setGridLines"]=prot.asc_setGridLines;prot["asc_setHeadings"]=prot.asc_setHeadings;prot["asc_setPrintTitlesWidth"]=prot.asc_setPrintTitlesWidth;prot["asc_setPrintTitlesHeight"]= prot.asc_setPrintTitlesHeight;prot["asc_getPrintTitlesWidth"]=prot.asc_getPrintTitlesWidth;prot["asc_getPrintTitlesHeight"]=prot.asc_getPrintTitlesHeight;window["Asc"]["CHeaderFooter"]=window["Asc"].CHeaderFooter=CHeaderFooter;window["Asc"]["CHeaderFooterData"]=window["Asc"].CHeaderFooterData=CHeaderFooterData;window["Asc"]["CSortProperties"]=window["Asc"].CSortProperties=CSortProperties;prot=CSortProperties.prototype;prot["asc_getHasHeaders"]=prot.asc_getHasHeaders;prot["asc_getColumnSort"]=prot.asc_getColumnSort; prot["asc_getLevels"]=prot.asc_getLevels;prot["asc_getSortList"]=prot.asc_getSortList;prot["asc_updateSortList"]=prot.asc_updateSortList;prot["asc_setHasHeaders"]=prot.asc_setHasHeaders;prot["asc_setColumnSort"]=prot.asc_setColumnSort;prot["asc_getLevelProps"]=prot.asc_getLevelProps;prot["asc_setLevels"]=prot.asc_setLevels;prot["asc_getLockChangeHeaders"]=prot.asc_getLockChangeHeaders;prot["asc_getLockChangeOrientation"]=prot.asc_getLockChangeOrientation;prot["asc_getCaseSensitive"]=prot.asc_getCaseSensitive; prot["asc_setCaseSensitive"]=prot.asc_setCaseSensitive;prot["asc_addBySortList"]=prot.asc_addBySortList;prot["asc_getRangeStr"]=prot.asc_getRangeStr;prot["asc_getSelection"]=prot.asc_getSelection;prot["asc_setSelection"]=prot.asc_setSelection;window["Asc"]["CSortPropertiesLevel"]=window["Asc"].CSortPropertiesLevel=CSortPropertiesLevel;prot=CSortPropertiesLevel.prototype;prot["asc_getIndex"]=prot.asc_getIndex;prot["asc_getName"]=prot.asc_getName;prot["asc_getSortBy"]=prot.asc_getSortBy;prot["asc_getDescending"]= prot.asc_getDescending;prot["asc_getColor"]=prot.asc_getColor;prot["asc_setIndex"]=prot.asc_setIndex;prot["asc_setName"]=prot.asc_setName;prot["asc_setSortBy"]=prot.asc_setSortBy;prot["asc_setDescending"]=prot.asc_setDescending;prot["asc_setColor"]=prot.asc_setColor;window["Asc"]["CSortLevelInfo"]=window["Asc"].CSortLevelInfo=CSortLevelInfo;prot=CSortLevelInfo.prototype;prot["asc_getColorsFill"]=prot.asc_getColorsFill;prot["asc_getColorsFont"]=prot.asc_getColorsFont;prot["asc_getIsTextData"]=prot.asc_getIsTextData; window["Asc"]["CRemoveDuplicatesProps"]=window["Asc"].CRemoveDuplicatesProps=CRemoveDuplicatesProps;prot=CRemoveDuplicatesProps.prototype;prot["asc_getHasHeaders"]=prot.asc_getHasHeaders;prot["asc_getColumnList"]=prot.asc_getColumnList;prot["asc_updateColumnList"]=prot.asc_updateColumnList;prot["asc_setHasHeaders"]=prot.asc_setHasHeaders;prot["asc_getDuplicateValues"]=prot.asc_getDuplicateValues;prot["asc_getUniqueValues"]=prot.asc_getUniqueValues;window["AscCommonExcel"].CFunctionInfo=CFunctionInfo; prot=CFunctionInfo.prototype;prot["asc_getArgumentMin"]=prot.asc_getArgumentMin;prot["asc_getArgumentMax"]=prot.asc_getArgumentMax;prot["asc_getArgumentsValue"]=prot.asc_getArgumentsValue;prot["asc_getArgumentsType"]=prot.asc_getArgumentsType;prot["asc_getArgumentsResult"]=prot.asc_getArgumentsResult;prot["asc_getFormulaResult"]=prot.asc_getFormulaResult;prot["asc_getFunctionResult"]=prot.asc_getFunctionResult;prot["asc_getName"]=prot.asc_getName})(window);"use strict";(function(window,undefined){var g_memory= AscFonts.g_memory;var CellValueType=AscCommon.CellValueType;var c_oAscBorderStyles=AscCommon.c_oAscBorderStyles;var fSortAscending=AscCommon.fSortAscending;var parserHelp=AscCommon.parserHelp;var oNumFormatCache=AscCommon.oNumFormatCache;var gc_nMaxRow0=AscCommon.gc_nMaxRow0;var gc_nMaxCol0=AscCommon.gc_nMaxCol0;var g_oCellAddressUtils=AscCommon.g_oCellAddressUtils;var CellAddress=AscCommon.CellAddress;var isRealObject=AscCommon.isRealObject;var History=AscCommon.History;var cBoolLocal=AscCommon.cBoolLocal; var cErrorLocal=AscCommon.cErrorLocal;var cErrorOrigin=AscCommon.cErrorOrigin;var c_oAscNumFormatType=Asc.c_oAscNumFormatType;var UndoRedoItemSerializable=AscCommonExcel.UndoRedoItemSerializable;var UndoRedoData_CellSimpleData=AscCommonExcel.UndoRedoData_CellSimpleData;var UndoRedoData_CellValueData=AscCommonExcel.UndoRedoData_CellValueData;var UndoRedoData_FromToRowCol=AscCommonExcel.UndoRedoData_FromToRowCol;var UndoRedoData_FromTo=AscCommonExcel.UndoRedoData_FromTo;var UndoRedoData_IndexSimpleProp= AscCommonExcel.UndoRedoData_IndexSimpleProp;var UndoRedoData_BBox=AscCommonExcel.UndoRedoData_BBox;var UndoRedoData_SheetAdd=AscCommonExcel.UndoRedoData_SheetAdd;var UndoRedoData_DefinedNames=AscCommonExcel.UndoRedoData_DefinedNames;var g_oDefaultFormat=AscCommonExcel.g_oDefaultFormat;var g_StyleCache=AscCommonExcel.g_StyleCache;var Border=AscCommonExcel.Border;var RangeDataManager=AscCommonExcel.RangeDataManager;var cElementType=AscCommonExcel.cElementType;var parserFormula=AscCommonExcel.parserFormula; var c_oAscError=Asc.c_oAscError;var c_oAscInsertOptions=Asc.c_oAscInsertOptions;var c_oAscDeleteOptions=Asc.c_oAscDeleteOptions;var c_oAscGetDefinedNamesList=Asc.c_oAscGetDefinedNamesList;var c_oAscDefinedNameReason=Asc.c_oAscDefinedNameReason;var c_oNotifyType=AscCommon.c_oNotifyType;var g_cCalcRecursion=AscCommonExcel.g_cCalcRecursion;var g_nVerticalTextAngle=255;var oDefaultMetrics={ColWidthChars:0,RowHeight:0};var g_sNewSheetNamePattern="Sheet";var g_nSheetNameMaxLength=31;var g_nDefNameMaxLength= 255;var g_nAllColIndex=-1;var g_nAllRowIndex=-1;var aStandartNumFormats=[];var aStandartNumFormatsId={};var oFormulaLocaleInfo={Parse:true,DigitSep:true};(function(){aStandartNumFormats[0]="General";aStandartNumFormats[1]="0";aStandartNumFormats[2]="0.00";aStandartNumFormats[3]="#,##0";aStandartNumFormats[4]="#,##0.00";aStandartNumFormats[9]="0%";aStandartNumFormats[10]="0.00%";aStandartNumFormats[11]="0.00E+00";aStandartNumFormats[12]="# ?/?";aStandartNumFormats[13]="# ??/??";aStandartNumFormats[14]= "m/d/yyyy";aStandartNumFormats[15]="d-mmm-yy";aStandartNumFormats[16]="d-mmm";aStandartNumFormats[17]="mmm-yy";aStandartNumFormats[18]="h:mm AM/PM";aStandartNumFormats[19]="h:mm:ss AM/PM";aStandartNumFormats[20]="h:mm";aStandartNumFormats[21]="h:mm:ss";aStandartNumFormats[22]="m/d/yyyy h:mm";aStandartNumFormats[37]="#,##0_);(#,##0)";aStandartNumFormats[38]="#,##0_);[Red](#,##0)";aStandartNumFormats[39]="#,##0.00_);(#,##0.00)";aStandartNumFormats[40]="#,##0.00_);[Red](#,##0.00)";aStandartNumFormats[45]= "mm:ss";aStandartNumFormats[46]="[h]:mm:ss";aStandartNumFormats[47]="mm:ss.0";aStandartNumFormats[48]="##0.0E+0";aStandartNumFormats[49]="@";for(var i in aStandartNumFormats)aStandartNumFormatsId[aStandartNumFormats[i]]=i-0})();var c_oRangeType={Range:0,Col:1,Row:2,All:3};var c_oSharedShiftType={Processed:1,NeedTransform:2,PreProcessed:3};var emptyStyleComponents={table:[],conditional:[]};function getRangeType(oBBox){if(null==oBBox)oBBox=this.bbox;if(oBBox.c1==0&&gc_nMaxCol0==oBBox.c2&&oBBox.r1== 0&&gc_nMaxRow0==oBBox.r2)return c_oRangeType.All;if(oBBox.c1==0&&gc_nMaxCol0==oBBox.c2)return c_oRangeType.Row;else if(oBBox.r1==0&&gc_nMaxRow0==oBBox.r2)return c_oRangeType.Col;else return c_oRangeType.Range}function getCompiledStyleFromArray(xf,xfs){for(var i=0;i0},unlockRecal:function(){if(0=this.lockCounter)this.calcTree()},lockRecalExecute:function(callback){this.lockRecal(); callback();this.unlockRecal()},getDefNameByName:function(name,sheetId,opt_exact){var res=null;var nameIndex=getDefNameIndex(name);if(sheetId){var sheetContainer=this.defNames.sheet[sheetId];if(sheetContainer)res=sheetContainer[nameIndex]}if(!res&&!(opt_exact&&sheetId))res=this.defNames.wb[nameIndex];return res},getDefNameByNodeId:function(nodeId){getFromDefNameId(nodeId);return this.getDefNameByName(g_FDNI.name,g_FDNI.sheetId,true)},getDefNameByRef:function(ref,sheetId,bLocale){var getByRef=function(defName){if(!defName.hidden&& defName.ref==ref)return defName.name};var res=this._foreachDefNameSheet(sheetId,getByRef);if(res&&bLocale)res=AscCommon.translateManager.getValue(res);if(!res)res=this._foreachDefNameBook(getByRef);return res},getDefinedNamesWB:function(type,bLocale,excludeErrorRefNames){var names=[],activeWS;function getNames(defName){if(defName.ref&&!defName.hidden&&defName.name.indexOf("_xlnm")<0){if(excludeErrorRefNames&&defName.parsedRef&&defName.parsedRef.outStack){var _stack=defName.parsedRef.outStack;for(var i= 0;i<_stack.length;i++)if(_stack[i]&&cElementType.error===_stack[i].type)return}names.push(defName.getAscCDefName(bLocale))}}function sort(a,b){if(a.name>b.name)return 1;else if(a.nameg_nDefNameMaxLength)return res;if(oldUndoName)res=this.getDefNameByName(oldUndoName.name,oldUndoName.sheetId);else res=this.addDefName(newUndoName.name,newUndoName.ref,newUndoName.sheetId,false,newUndoName.type, newUndoName.isXLNM);History.Create_NewPoint();if(res&&oldUndoName)if(oldUndoName.name!=newUndoName.name){this.buildDependency();res=this._delDefName(res.name,res.sheetId);res.setUndoDefName(newUndoName,isSlicer);this._addDefName(res);var notifyData={type:c_oNotifyType.ChangeDefName,from:oldUndoName,to:newUndoName};this._broadcastDefName(oldUndoName.name,notifyData);this.addToChangedDefName(res)}else res.setUndoDefName(newUndoName);History.Add(AscCommonExcel.g_oUndoRedoWorkbook,AscCH.historyitem_Workbook_DefinedNamesChange, null,null,new UndoRedoData_FromTo(oldUndoName,newUndoName));return res},checkDefName:function(name,sheetIndex){var res=new Asc.asc_CCheckDefName;var range=AscCommonExcel.g_oRangeCache.getRange3D(name)||AscCommonExcel.g_oRangeCache.getAscRange(name);if(!range)AscCommonExcel.executeInR1C1Mode(!AscCommonExcel.g_R1C1Mode,function(){range=AscCommonExcel.g_oRangeCache.getRange3D(name)||AscCommonExcel.g_oRangeCache.getAscRange(name)});if(range||!AscCommon.rx_defName.test(name.toLowerCase())||name.length> g_nDefNameMaxLength){res.status=false;res.reason=c_oAscDefinedNameReason.WrongName;return res}var sheetId=this.wb.getSheetIdByIndex(sheetIndex);var defName=this.getDefNameByName(name,sheetId,true);if(defName){res.status=false;if(defName.isLock)res.reason=c_oAscDefinedNameReason.IsLocked;else res.reason=c_oAscDefinedNameReason.Existed}else if(this.isListeningDefName(name)){res.status=false;res.reason=c_oAscDefinedNameReason.NameReserved}else{res.status=true;res.reason=c_oAscDefinedNameReason.OK}return res}, copyDefNameByWorksheet:function(wsFrom,wsTo,renameParams,opt_sheet){var sheetContainerFrom;var opt_df=opt_sheet&&opt_sheet.workbook&&opt_sheet.workbook.dependencyFormulas?opt_sheet.workbook.dependencyFormulas:null;if(opt_df&&opt_df.defNames&&opt_df.defNames.sheet&&opt_df.defNames.sheet[wsFrom.getId()])sheetContainerFrom=opt_df.defNames.sheet[wsFrom.getId()];else sheetContainerFrom=this.defNames.sheet[wsFrom.getId()];if(sheetContainerFrom)for(var name in sheetContainerFrom){var defNameOld=sheetContainerFrom[name]; if(defNameOld.type!==Asc.c_oAscDefNameType.table&&defNameOld.parsedRef){var parsedRefNew=defNameOld.parsedRef.clone();parsedRefNew.renameSheetCopy(renameParams);var refNew=parsedRefNew.assemble(true);this.addDefName(defNameOld.name,refNew,wsTo.getId(),defNameOld.hidden,defNameOld.type)}}},copyDefNameByWorkbook:function(wsFrom,wsTo,renameParams,opt_sheet){var t=this;var opt_wb=opt_sheet&&opt_sheet.workbook;var opt_df=opt_wb&&opt_wb.dependencyFormulas;var doCopy=function(_sheetContainerFrom){if(_sheetContainerFrom)for(var name in _sheetContainerFrom){var defNameOld= _sheetContainerFrom[name];if(defNameOld.type!==Asc.c_oAscDefNameType.table&&defNameOld.parsedRef){var parsedRefNew=defNameOld.parsedRef.clone();parsedRefNew.renameSheetCopy(renameParams);var refNew=parsedRefNew.assemble(true);var _newDefName=new Asc.asc_CDefName(defNameOld.name,refNew,null,defNameOld.type,defNameOld.hidden);t.wb.editDefinesNames(null,_newDefName)}}};if(opt_df)doCopy(opt_df.defNames.wb)},saveDefName:function(isCopySheet){var list=[];var t=this;this._foreachDefName(function(defName){if(defName.type!== Asc.c_oAscDefNameType.table&&defName.ref)if(!isCopySheet||t._checkDefNamesCopySheet(defName))list.push(defName.getAscCDefName())});return list},_checkDefNamesCopySheet:function(defName){var res=true;var ws=this.wb.getActiveWs();if(defName.sheetId&&defName.sheetId!==ws.Id)return false;if(defName.type===Asc.c_oAscDefNameType.slicer)return false;var parsedRef=defName.parsedRef;if(parsedRef)for(var i=0;i0)return;this.buildDependency();this.addToChangedHiddenRows();if(!(this.changedCell||this.changedRange||this.changedDefName))return;var notifyData={type:c_oNotifyType.Dirty,areaData:undefined};this._broadscastVolatile(notifyData);this._broadcastCellsStart();while(this.changedCellRepeated|| this.changedRangeRepeated||this.changedDefNameRepeated){this._broadcastDefNames(notifyData);this._broadcastCells(notifyData);this._broadcastRanges(notifyData)}this._broadcastCellsEnd();this._calculateDirty();this.updateSharedFormulas();var tmpCellCache=this.cleanCellCache;this.cleanCellCache={};for(var i in tmpCellCache)this.wb.handlers.trigger("cleanCellCache",i,[tmpCellCache[i]],true);AscCommonExcel.g_oVLOOKUPCache.clean();AscCommonExcel.g_oHLOOKUPCache.clean();AscCommonExcel.g_oMatchCache.clean(); AscCommonExcel.g_oSUMIFSCache.clean()},initOpen:function(){this._foreachDefName(function(defName){defName.setRef(defName.ref,true,true,true)})},getSnapshot:function(wb){var res=new DependencyGraph(wb);this._foreachDefName(function(defName){res._addDefName(defName.clone(wb))});res.tableNameIndex=this.tableNameIndex;return res},getAllFormulas:function(formulas){this._foreachDefName(function(defName){if(defName.parsedRef)formulas.push(defName.parsedRef)})},updateSharedFormulas:function(){var newRef; for(var indexNumber in this.changedShared){var parsed=this.changedShared[indexNumber];var shared=parsed.getShared();if(shared){var ws=parsed.getWs();var ref=shared.ref;var r1=gc_nMaxRow0;var c1=gc_nMaxCol0;var r2=0;var c2=0;ws.getRange3(ref.r1,ref.c1,ref.r2,ref.c2)._foreachNoEmpty(function(cell){if(parsed===cell.getFormulaParsed()){r1=Math.min(r1,cell.nRow);c1=Math.min(c1,cell.nCol);r2=Math.max(r2,cell.nRow);c2=Math.max(c2,cell.nCol)}});newRef=undefined;if(r1<=r2&&c1<=c2)newRef=new Asc.Range(c1,r1, c2,r2);parsed.setSharedRef(newRef)}}this.changedShared={}},_addDefName:function(defName){var nameIndex=getDefNameIndex(defName.name);var container;var sheetId=defName.sheetId;if(sheetId){container=this.defNames.sheet[sheetId];if(!container){container={};this.defNames.sheet[sheetId]=container}}else container=this.defNames.wb;var cur=container[nameIndex];if(cur)cur.removeDependencies();container[nameIndex]=defName},_removeDefName:function(sheetId,name,historyType){var defName=this._delDefName(name, sheetId);if(defName){if(null!=historyType){History.Create_NewPoint();History.Add(AscCommonExcel.g_oUndoRedoWorkbook,historyType,null,null,new UndoRedoData_FromTo(defName.getUndoDefName(),null))}defName.removeDependencies();this.addToChangedDefName(defName)}},_delDefName:function(name,sheetId){var res=null;var nameIndex=getDefNameIndex(name);var sheetContainer;if(sheetId)sheetContainer=this.defNames.sheet[sheetId];else sheetContainer=this.defNames.wb;if(sheetContainer){res=sheetContainer[nameIndex]; delete sheetContainer[nameIndex]}return res},_foreachDefName:function(action){var containerSheet;var sheetId;var name;var res;for(sheetId in this.defNames.sheet){containerSheet=this.defNames.sheet[sheetId];for(name in containerSheet){res=action(containerSheet[name],containerSheet);if(res)break}}if(!res)res=this._foreachDefNameBook(action);return res},_foreachDefNameSheet:function(sheetId,action){var name;var res;var containerSheet=this.defNames.sheet[sheetId];if(containerSheet)for(name in containerSheet){res= action(containerSheet[name],containerSheet);if(res)break}return res},_foreachDefNameBook:function(action){var containerSheet;var name;var res;for(name in this.defNames.wb){res=action(this.defNames.wb[name],this.defNames.wb);if(res)break}return res},_broadscastVolatile:function(notifyData){for(var i in this.volatileListeners)this.volatileListeners[i].notify(notifyData)},_broadcastDefName:function(name,notifyData){var nameIndex=getDefNameIndex(name);var container=this.defNameListeners[nameIndex];if(container)for(var listenerId in container.listeners)container.listeners[listenerId].notify(notifyData)}, _broadcastDefNames:function(notifyData){if(this.changedDefNameRepeated){var changedDefName=this.changedDefNameRepeated;this.changedDefNameRepeated=null;for(var nodeId in changedDefName){getFromDefNameId(nodeId);this._broadcastDefName(g_FDNI.name,notifyData)}}},_broadcastCells:function(notifyData){if(this.changedCellRepeated){var changedCell=this.changedCellRepeated;this.changedCellRepeated=null;for(var sheetId in changedCell){var changedSheet=changedCell[sheetId];var sheetContainer=this.sheetListeners[sheetId]; if(sheetContainer){var cells=[];for(var cellIndex in changedSheet)cells.push(changedSheet[cellIndex]);cells.sort(AscCommon.fSortAscending);this._broadcastCellsByCells(sheetContainer,cells,notifyData);this._broadcastRangesByCells(sheetContainer,cells,notifyData)}}}},_broadcastRanges:function(notifyData){if(this.changedRangeRepeated){var changedRange=this.changedRangeRepeated;this.changedRangeRepeated=null;for(var sheetId in changedRange){var changedSheet=changedRange[sheetId];var sheetContainer=this.sheetListeners[sheetId]; if(sheetContainer)if(sheetContainer){var rangesTop=[];var rangesBottom=[];for(var name in changedSheet){var range=changedSheet[name];rangesTop.push(range);rangesBottom.push(range)}rangesTop.sort(Asc.Range.prototype.compareByLeftTop);rangesBottom.sort(Asc.Range.prototype.compareByRightBottom);this._broadcastCellsByRanges(sheetContainer,rangesTop,rangesBottom,notifyData);this._broadcastRangesByRanges(sheetContainer,rangesTop,rangesBottom,notifyData)}}}},_broadcastCellsStart:function(){this.isInCalc= true;this.changedCellRepeated=this.changedCell;this.changedRangeRepeated=this.changedRange;this.changedDefNameRepeated=this.changedDefName;for(var sheetId in this.sheetListeners){var sheetContainer=this.sheetListeners[sheetId];if(!sheetContainer.cells){sheetContainer.cells=[];for(var cellIndex in sheetContainer.cellMap)sheetContainer.cells.push(sheetContainer.cellMap[cellIndex]);sheetContainer.cells.sort(function(a,b){return a.cellIndex-b.cellIndex})}if(!sheetContainer.rangesTop||!sheetContainer.rangesBottom){sheetContainer.rangesTop= [];sheetContainer.rangesBottom=[];for(var name in sheetContainer.areaMap){var elem=sheetContainer.areaMap[name];sheetContainer.rangesTop.push(elem);sheetContainer.rangesBottom.push(elem)}sheetContainer.rangesTop.sort(function(a,b){return Asc.Range.prototype.compareByLeftTop(a.bbox,b.bbox)});sheetContainer.rangesBottom.sort(function(a,b){return Asc.Range.prototype.compareByRightBottom(a.bbox,b.bbox)})}}},_broadcastCellsEnd:function(){this.isInCalc=false;this.changedDefName=null;for(var i=0;i 0){indexCellChanged++;if(indexCellChanged=this.maxSharedRecursion)sharedBroadcast.changedBBox=elem.bbox.clone();output.push(elem)}if(sharedBroadcast.changedBBox)sharedBroadcast.changedBBox.union3(col,row);else sharedBroadcast.changedBBox=new Asc.Range(col, row,col,row);if(sharedBroadcast.changedBBox.isEqual(elem.bbox)){elem.isActive=false;tree.remove(elem.bbox.c1,elem.bbox.c2,elem)}}}},_broadcastRangesByRangesIntersect:function(bbox,tree,output){var intervals=tree.searchNodes(bbox.c1,bbox.c2);for(var i=0;i=this.maxSharedRecursion)sharedBroadcast.changedBBox=elem.bbox.clone();output.push(elem)}if(sharedBroadcast.changedBBox)sharedBroadcast.changedBBox.union2(intersect);else sharedBroadcast.changedBBox=intersect;if(sharedBroadcast.changedBBox.isEqual(elem.bbox)){elem.isActive= false;tree.remove(elem.bbox.c1,elem.bbox.c2,elem)}}}}},_broadcastNotifyRanges:function(affected,notifyData){var areaData={bbox:null,changedBBox:null};for(var i=0;i=this.aWorksheets.length)this.nActive=this.aWorksheets.length-1;var self=this;this.wsHandlers=new AscCommonExcel.asc_CHandlersList({"changeRefTablePart":function(table){self.dependencyFormulas.changeTableRef(table)},"changeColumnTablePart":function(tableName){self.dependencyFormulas.renameTableColumn(tableName)},"deleteColumnTablePart":function(tableName, deleted){self.dependencyFormulas.delColumnTable(tableName,deleted);var wsActive=self.getActiveWs();if(wsActive)wsActive.deleteSlicersByTableCol(tableName,deleted)},"onFilterInfo":function(){self.handlers.trigger("asc_onFilterInfo")}});for(var i=0,length=tableCustomFunc.length;i=0&&index=0&&index=0&&indexBefore=0&&index=0&&insertBefore=0&&index0&&index=0&&indexFrom=0&&indexTo=0;--i){ws=this.getWorksheet(i);if(false===ws.getHidden()){oRes=ws;break}}return oRes};Workbook.prototype.removeWorksheet=function(nIndex,outputParams){var bEmpty=true;for(var i=0,length=this.aWorksheets.length;ig_nSheetNameMaxLength){name=name.substring(0,g_nSheetNameMaxLength-sPosfix.length);sNewName=name+sPosfix}var bUniqueName=true;for(var i=0;i0)aPointChangesBase64.push(nLen+";"+oMemory.GetBase64Memory2(nPosStart,nLen))}};Workbook.prototype.SerializeHistory=function(){var aRes=[];var t,j,length2;AscCommon.CollaborativeEditing.Refresh_DCChanges();var aActions=this.aCollaborativeActions.concat(History.GetSerializeArray());if(aActions.length>0){var oMemory=new AscCommon.CMemory;for(var i=0,length=aActions.length;i0)for(i=0;i0&&changesModify.length>0){var wbSnapshotCur=wbSnapshot._getSnapshot();var formulas=[];for(i=0;i 0){this._forwardTransformationFormula(wbSnapshotCur._getSnapshot(),formulas,changesMasterSelected,res);formulas=[]}elem.oClass.Redo(elem.nActionType,elem.oData,elem.nSheetId,wbSnapshotCur)}if(renameRes)this._forwardTransformationRenameEnd(renameRes,res.renameSheet,getRes,elem)}this._forwardTransformationFormula(wbSnapshotCur,formulas,changesMasterSelected,res)}return res};Workbook.prototype._forwardTransformationRenameStart=function(wbSnapshot,changes,getRes){var res={newName:null};for(var i=0;i< changes.length;++i){var elem=changes[i];elem.oClass.Redo(elem.nActionType,elem.oData,elem.nSheetId,wbSnapshot)}if(-1!=wbSnapshot.checkUniqueSheetName(getRes.name))res.newName=wbSnapshot.getUniqueSheetNameFrom(getRes.name,true);return res};Workbook.prototype._forwardTransformationRenameEnd=function(renameRes,renameSheet,getRes,elemCur){var isChange=false;if(getRes.from){var renameCur=renameSheet[getRes.from];if(renameCur){delete renameSheet[getRes.from];getRes.from=renameCur;isChange=true}}if(renameRes&& renameRes.newName){renameSheet[getRes.name]=renameRes.newName;getRes.name=renameRes.newName;isChange=true}if(isChange&&elemCur.oClass.forwardTransformationSet)elemCur.oClass.forwardTransformationSet(elemCur.nActionType,elemCur.oData,elemCur.nSheetId,getRes)};Workbook.prototype._forwardTransformationFormula=function(wbSnapshot,formulas,changes,res){if(formulas.length>0){var i,elem,ftFormula,ws;for(i=0;i0){this.bCollaborativeChanges=true;var dstLen=0;var aIndexes=[],i,length=aChanges.length,sChange;for(i=0;i=start;i+=inc){ws=this.getWorksheet(i);if(ws.getHidden())continue; result2=ws.findCellText(options);if(result2)break}if(!result2){if(options.scanForward){i=0;end=active}else{i=end-1;start=active+1}inc*=-1;for(;i=start;i+=inc){ws=this.getWorksheet(i);if(ws.getHidden())continue;result2=ws.findCellText(options);if(result2)break}}if(result2){this.handlers.trigger("undoRedoHideSheet",i);key=result2.col+"-"+result2.row}}if(key){this.lastFindOptions=options.clone();this.lastFindCells[key]=true}}if(!result2&&!result)this.cleanFindResults();return result2||result}; Workbook.prototype.getComment=function(id){if(id){var sheet;for(var i=0;i0)if(Asc&&Asc.editor)Asc.editor.checkObjectsLock(aId,fCallback);else fCallback(true,true)};Workbook.prototype.handleChartsOnWorksheetsRemove=function(aWorksheets){if(!History.CanAddChanges())return;var aRefsToChange=[];var aId=[];var aRanges=[];var aNames=[];var oWorksheet;for(var nWS=0;nWSnPrevLength)aId.push(oDrawing.Get_Id())}});this.checkObjectsLock(aId,function(bNoLock){if(bNoLock){for(var nRef=0;nRefnPrevLength){aCharts.push(oDrawing);aId.push(oDrawing.Get_Id())}}});return{refs:aRefsToChange,ids:aId,charts:aCharts}};Workbook.prototype.getChartSheetRenameData= function(oWorksheet,sOldName){var sOldSheetName=oWorksheet.sName;oWorksheet.sName=sOldName;var oData=this.getChartsWithSheetData(oWorksheet);oWorksheet.sName=sOldSheetName;return oData};Workbook.prototype.changeSheetNameInRefs=function(aRefsToChange,sOldName,sNewName){if(aRefsToChange.length>0){var sNewNameEscaped=parserHelp.getEscapeSheetName(sNewName);var sOldNameEscaped=parserHelp.getEscapeSheetName(sOldName);for(var nRef=0;nRefnPrevLength)aId.push(oDrawing.Get_Id())}});this.checkObjectsLock(aId,function(bNoLock){if(bNoLock){for(var nRef=0;nRef=0)range=sheet.TableParts[thisTableIndex].Ref;else sheet=null}break;case Asc.c_oAscSelectionForCFType.pivot:sheet=this.getActiveWs();var _activeCell=sheet.selectionRange.activeCell; var _pivot=sheet.getPivotTable(_activeCell.col,_activeCell.row);if(_pivot)range=_pivot.location&&_pivot.location.ref;if(!range)sheet=null;break}if(sheet){var aRules=sheet.aConditionalFormattingRules.sort(function(v1,v2){return v1.priority-v2.priority});rules=[];if(range){var putRange=function(_range,_rule){multiplyRange=new AscCommonExcel.MultiplyRange(_range);if(multiplyRange.isIntersect(range)){if(needClone){var _id=_rule.id;var isLocked=_rule.isLock;_rule=_rule.clone();_rule.id=_id;_rule.isLock= isLocked}rules.push(_rule)}};var oRule,ranges,multiplyRange,i,mapChangedRules=[];for(i=0;i>0,index+1),this.maxIndex+1);if(newAllocatedCount>allocatedCount){var oldData=this.data;this.data=new Uint8Array(newAllocatedCount*this.structSize);if(oldData)this.data.set(oldData)}}this.count=Math.min(Math.max(this.count, index+1),this.maxIndex+1)};SheetMemory.prototype.hasSize=function(index){return index+1<=this.count};SheetMemory.prototype.getSize=function(){return this.count};SheetMemory.prototype.clone=function(){var sheetMemory=new SheetMemory(this.structSize,this.maxIndex);sheetMemory.data=this.data?new Uint8Array(this.data):null;sheetMemory.count=this.count;return sheetMemory};SheetMemory.prototype.deleteRange=function(start,deleteCount){if(start0){var startOffsetFrom= startFrom*this.structSize;var endOffsetFrom=(startFrom+countCopied)*this.structSize;var startOffsetTo=startTo*this.structSize;this.data.set(sheetMemory.data.subarray(startOffsetFrom,endOffsetFrom),startOffsetTo)}}var countErase=Math.min(count-countCopied,this.count-(startTo+countCopied));if(countErase>0){var startOffsetErase=(startTo+countCopied)*this.structSize;var endOffsetErase=(startTo+countCopied+countErase)*this.structSize;this.data.fill(0,startOffsetErase,endOffsetErase)}};SheetMemory.prototype.copyRangeByChunk= function(from,fromCount,to,toCount){if(from>>8&255};SheetMemory.prototype.getUint32=function(index,offset){offset+=index*this.structSize;return AscFonts.FT_Common.IntToUInt(this.data[offset]|this.data[offset+1]<<8|this.data[offset+2]<<16|this.data[offset+3]<<24)};SheetMemory.prototype.setUint32=function(index,offset,val){offset+=index*this.structSize;this.data[offset]=val&255;this.data[offset+1]=val>>>8&255;this.data[offset+2]=val>>>16&255;this.data[offset+3]=val>>>24&255};SheetMemory.prototype.getFloat64=function(index,offset){offset+= index*this.structSize;tempHelpUnit[0]=this.data[offset];tempHelpUnit[1]=this.data[offset+1];tempHelpUnit[2]=this.data[offset+2];tempHelpUnit[3]=this.data[offset+3];tempHelpUnit[4]=this.data[offset+4];tempHelpUnit[5]=this.data[offset+5];tempHelpUnit[6]=this.data[offset+6];tempHelpUnit[7]=this.data[offset+7];return tempHelpFloat[0]};SheetMemory.prototype.setFloat64=function(index,offset,val){offset+=index*this.structSize;tempHelpFloat[0]=val;this.data[offset]=tempHelpUnit[0];this.data[offset+1]=tempHelpUnit[1]; this.data[offset+2]=tempHelpUnit[2];this.data[offset+3]=tempHelpUnit[3];this.data[offset+4]=tempHelpUnit[4];this.data[offset+5]=tempHelpUnit[5];this.data[offset+6]=tempHelpUnit[6];this.data[offset+7]=tempHelpUnit[7]};function Worksheet(wb,_index,sId){this.workbook=wb;this.sName=this.workbook.getUniqueSheetNameFrom(g_sNewSheetNamePattern,false);this.bHidden=false;this.oSheetFormatPr=new AscCommonExcel.SheetFormatPr;this.index=_index;this.Id=null!=sId?sId:AscCommon.g_oIdCounter.Get_NewId();this.nRowsCount= 0;this.nColsCount=0;this.rowsData=new SheetMemory(AscCommonExcel.g_nRowStructSize,gc_nMaxRow0);this.cellsByCol=[];this.cellsByColRowsCount=0;this.aCols=[];this.hiddenManager=new HiddenManager(this);this.Drawings=[];this.TableParts=[];this.AutoFilter=null;this.oAllCol=null;this.aComments=[];var oThis=this;this.bExcludeHiddenRows=false;this.bIgnoreWriteFormulas=false;this.mergeManager=new RangeDataManager(function(data,from,to){if(History.Is_On()&&(null!=from||null!=to)){if(null!=from)from=from.clone(); if(null!=to)to=to.clone();var oHistoryRange=from;if(null==oHistoryRange)oHistoryRange=to;History.Add(AscCommonExcel.g_oUndoRedoWorksheet,AscCH.historyitem_Worksheet_ChangeMerge,oThis.getId(),oHistoryRange,new UndoRedoData_FromTo(new UndoRedoData_BBox(from),new UndoRedoData_BBox(to)))}if(null!=to){var maxRow=gc_nMaxRow0!==to.r2?to.r2:to.r1;var maxCol=gc_nMaxCol0!==to.c2?to.c2:to.c1;if(maxRow>=oThis.nRowsCount)oThis.nRowsCount=maxRow+1;if(maxCol>=oThis.nColsCount)oThis.nColsCount=maxCol+1}});this.mergeManager.worksheet= this;this.hyperlinkManager=new RangeDataManager(function(data,from,to,oChangeParam){if(History.Is_On()&&(null!=from||null!=to)){if(null!=from)from=from.clone();if(null!=to)to=to.clone();var oHistoryRange=from;if(null==oHistoryRange)oHistoryRange=to;var oHistoryData=null;if(null==from||null==to)oHistoryData=data.clone();History.Add(AscCommonExcel.g_oUndoRedoWorksheet,AscCH.historyitem_Worksheet_ChangeHyperlink,oThis.getId(),oHistoryRange,new AscCommonExcel.UndoRedoData_FromToHyperlink(from,to,oHistoryData))}if(null!= to)data.Ref=oThis.getRange3(to.r1,to.c1,to.r2,to.c2);else if(oChangeParam&&oChangeParam.removeStyle&&null!=data.Ref)data.Ref.cleanFormat();if(null!=to){var maxRow=gc_nMaxRow0!==to.r2?to.r2:to.r1;var maxCol=gc_nMaxCol0!==to.c2?to.c2:to.c1;if(maxRow>=oThis.nRowsCount)oThis.nRowsCount=maxRow+1;if(maxCol>=oThis.nColsCount)oThis.nColsCount=maxCol+1}});this.hyperlinkManager.setDependenceManager(this.mergeManager);this.sheetViews=[];this.aConditionalFormattingRules=[];this.updateConditionalFormattingRange= null;this.dataValidations=null;this.sheetPr=null;this.aFormulaExt=null;this.autoFilters=AscCommonExcel.AutoFilters!==undefined?new AscCommonExcel.AutoFilters(this):null;this.sortState=null;this.contentChanges=new AscCommon.CContentChanges;this.aSparklineGroups=[];this.selectionRange=new AscCommonExcel.SelectionRange(this);this.copySelection=null;this.sheetMergedStyles=new AscCommonExcel.SheetMergedStyles;this.pivotTables=[];this.headerFooter=new Asc.CHeaderFooter(this);this.rowBreaks=null;this.colBreaks= null;this.legacyDrawingHF=null;this.picture=null;this.PagePrintOptions=new Asc.asc_CPageOptions(this);this.formulaArrayLink=null;this.lastFindOptions=null;this.bExcludeCollapsed=false;this.oNumFmtsOpen={};this.handlers=null;this.aSlicers=[];this.aNamedSheetViews=[];this.activeNamedSheetViewId=null;this.defaultViewHiddenRows=null}Worksheet.prototype.getCompiledStyle=function(row,col,opt_cell,opt_styleComponents){return getCompiledStyle(this.sheetMergedStyles,this.hiddenManager,row,col,opt_cell,this, opt_styleComponents)};Worksheet.prototype.getCompiledStyleCustom=function(row,col,needTable,needCell,needConditional,opt_cell){var res;var styleComponents=this.sheetMergedStyles.getStyle(this.hiddenManager,row,col,this);var ws=this;if(!needTable)styleComponents.table=[];if(!needConditional)styleComponents.conditional=[];if(!needCell)res=getCompiledStyle(undefined,undefined,row,col,undefined,undefined,styleComponents);else if(opt_cell)res=getCompiledStyle(undefined,undefined,row,col,opt_cell,ws,styleComponents); else this._getCellNoEmpty(row,col,function(cell){res=getCompiledStyle(undefined,undefined,row,col,cell,ws,styleComponents)});return res};Worksheet.prototype.getColData=function(index){var sheetMemory=this.cellsByCol[index];if(!sheetMemory){sheetMemory=new SheetMemory(g_nCellStructSize,gc_nMaxRow0);this.cellsByCol[index]=sheetMemory}return sheetMemory};Worksheet.prototype.getColDataNoEmpty=function(index){return this.cellsByCol[index]};Worksheet.prototype.getColDataLength=function(){return this.cellsByCol.length}; Worksheet.prototype.getMinimalRange=function(){var oRange=null;this._forEachCell(function(oCell){if(!oCell.isEmpty())if(oRange===null)oRange=new Asc.Range(oCell.nCol,oCell.nRow,oCell.nCol,oCell.nRow);else oRange.union3(oCell.nCol,oCell.nRow)});return oRange};Worksheet.prototype.getSnapshot=function(wb){var ws=new Worksheet(wb,this.index,this.Id);ws.sName=this.sName;for(var i=0;i0){var drawingObjects=new AscFormat.DrawingObjects;oNewWs.Drawings=[];for(i=0;i=gradient.max)color=gradient.getMaxColor();else if(val<=oGradient1.min)color=oGradient1.getMinColor();else{gradient=oGradient2&&val>oGradient1.max?oGradient2:oGradient1;color=gradient.calculateColor(val)}dxf.fill=new AscCommonExcel.Fill;dxf.fill.fromColor(color);dxf=g_StyleCache.addXf(dxf,true)}return dxf}}(oGradient1,oGradient2)}}else if(Asc.ECfType.dataBar=== oRule.type)continue;else if(Asc.ECfType.top10===oRule.type){if(oRule.rank>0&&oRule.dxf){nc=0;values=this._getValuesForConditionalFormatting(ranges,false);o=oRule.bottom?Number.MAX_VALUE:-Number.MAX_VALUE;for(cell=0;cell=nc?values[nc-1].v:o;compareFunction=function(rule,threshold){return function(row,col){var val;t._getCellNoEmpty(row,col,function(cell){val=cell?cell.getNumberValue():null});return null!==val&&(rule.bottom?val<=threshold:val>=threshold)?rule.dxf:null}}(oRule,threshold)}}else if(Asc.ECfType.aboveAverage===oRule.type){if(!oRule.dxf)continue;values=this._getValuesForConditionalFormatting(ranges,false);sum=0;nc=0;for(cell=0;cell0?condition===obj[val]:false)?rule.dxf:null}}(oRule,o,oRule.type===Asc.ECfType.duplicateValues); break;case Asc.ECfType.containsText:case Asc.ECfType.notContainsText:case Asc.ECfType.beginsWith:case Asc.ECfType.endsWith:var operator;switch(oRule.type){case Asc.ECfType.containsText:operator=AscCommonExcel.ECfOperator.Operator_containsText;break;case Asc.ECfType.notContainsText:operator=AscCommonExcel.ECfOperator.Operator_notContains;break;case Asc.ECfType.beginsWith:operator=AscCommonExcel.ECfOperator.Operator_beginsWith;break;case Asc.ECfType.endsWith:operator=AscCommonExcel.ECfOperator.Operator_endsWith; break}formulaParent=new AscCommonExcel.CConditionalFormattingFormulaParent(this,oRule,true);oRuleElement=oRule.getFormulaCellIs();parsed1=oRuleElement&&oRuleElement.getFormula&&oRuleElement.getFormula(this,formulaParent);if(parsed1&&parsed1.hasRelativeRefs()){bboxCf=oRule.getBBox();compareFunction=getCacheFunction(oRule,function(rule,operator,formulaParent,rowLT,colLT){return function(row,col){var offset=new AscCommon.CellBase(row-rowLT,col-colLT);var bboxCell=new Asc.Range(col,row,col,row);var v1= rule.getValueCellIs(t,formulaParent,bboxCell,offset,false);var res;t._getCellNoEmpty(row,col,function(cell){res=rule.cellIs(operator,cell,v1)?rule.dxf:null});return res}}(oRule,operator,new AscCommonExcel.CConditionalFormattingFormulaParent(this,oRule,true),bboxCf?bboxCf.r1:0,bboxCf?bboxCf.c1:0))}else compareFunction=function(rule,operator,v1){return function(row,col){var res;t._getCellNoEmpty(row,col,function(cell){res=rule.cellIs(operator,cell,v1)?rule.dxf:null});return res}}(oRule,operator,oRule.getValueCellIs(this)); break;case Asc.ECfType.containsErrors:compareFunction=function(rule){return function(row,col){var val;t._getCellNoEmpty(row,col,function(cell){val=cell?CellValueType.Error===cell.getType():false});return val?rule.dxf:null}}(oRule);break;case Asc.ECfType.notContainsErrors:compareFunction=function(rule){return function(row,col){var val;t._getCellNoEmpty(row,col,function(cell){val=cell?CellValueType.Error!==cell.getType():true});return val?rule.dxf:null}}(oRule);break;case Asc.ECfType.containsBlanks:compareFunction= function(rule){return function(row,col){var val;t._getCellNoEmpty(row,col,function(cell){if(cell)val=""===cell.getValueWithoutFormat().replace(/^ +| +$/g,"");else val=true});return val?rule.dxf:null}}(oRule);break;case Asc.ECfType.notContainsBlanks:compareFunction=function(rule){return function(row,col){var val;t._getCellNoEmpty(row,col,function(cell){if(cell)val=""!==cell.getValueWithoutFormat().replace(/^ +| +$/g,"");else val=false});return val?rule.dxf:null}}(oRule);break;case Asc.ECfType.timePeriod:if(oRule.timePeriod)compareFunction= function(rule,period){return function(row,col){var val;t._getCellNoEmpty(row,col,function(cell){val=cell?cell.getValueWithoutFormat():""});var n=parseFloat(val);return period.start<=n&&n0?this.sName:""};Worksheet.prototype.setName=function(name){if(name.length<=g_nSheetNameMaxLength){var lastName=this.sName;History.Create_NewPoint();var prepared=this.workbook.dependencyFormulas.prepareChangeSheet(this.getId(),{rename:{from:lastName,to:name}});this.sName=name;this.workbook.dependencyFormulas.changeSheet(prepared);History.Add(AscCommonExcel.g_oUndoRedoWorksheet,AscCH.historyitem_Worksheet_Rename,this.getId(),null,new UndoRedoData_FromTo(lastName, name));this.workbook.dependencyFormulas.calcTree()}else console.log(new Error("The sheet name must be less than 31 characters."))};Worksheet.prototype.getTabColor=function(){return this.sheetPr&&this.sheetPr.TabColor?Asc.colorObjToAscColor(this.sheetPr.TabColor):null};Worksheet.prototype.setTabColor=function(color){if(!this.sheetPr)this.sheetPr=new AscCommonExcel.asc_CSheetPr;History.Create_NewPoint();History.Add(AscCommonExcel.g_oUndoRedoWorksheet,AscCH.historyitem_Worksheet_SetTabColor,this.getId(), null,new UndoRedoData_FromTo(this.sheetPr.TabColor?this.sheetPr.TabColor.clone():null,color?color.clone():null));this.sheetPr.TabColor=color;if(!this.workbook.bUndoChanges&&!this.workbook.bRedoChanges)this.workbook.handlers.trigger("asc_onUpdateTabColor",this.getIndex())};Worksheet.prototype.rebuildTabColor=function(){if(this.sheetPr&&this.sheetPr.TabColor)this.workbook.handlers.trigger("asc_onUpdateTabColor",this.getIndex())};Worksheet.prototype.getHidden=function(){return true===this.bHidden};Worksheet.prototype.setHidden= function(hidden){var bOldHidden=this.bHidden,wb=this.workbook,wsActive=wb.getActiveWs(),oVisibleWs=null;this.bHidden=hidden;if(bOldHidden!=hidden){if(true==this.bHidden&&this.getIndex()==wsActive.getIndex())oVisibleWs=wb.findSheetNoHidden(this.getIndex());else if(false==this.bHidden&&this.getIndex()!==wsActive.getIndex())oVisibleWs=this;if(null!=oVisibleWs){var nNewIndex=oVisibleWs.getIndex();wb.setActive(nNewIndex);if(!wb.bUndoChanges&&!wb.bRedoChanges)wb.handlers.trigger("undoRedoHideSheet",nNewIndex)}History.Create_NewPoint(); History.Add(AscCommonExcel.g_oUndoRedoWorksheet,AscCH.historyitem_Worksheet_Hide,this.getId(),null,new UndoRedoData_FromTo(bOldHidden,hidden));if(null!=oVisibleWs){History.SetSheetUndo(wsActive.getId());History.SetSheetRedo(oVisibleWs.getId())}}};Worksheet.prototype.getSheetView=function(){return this.sheetViews[0]};Worksheet.prototype.getSheetViewSettings=function(){return this.sheetViews[0].clone()};Worksheet.prototype.setDisplayGridlines=function(value){var view=this.sheetViews[0];if(value!==view.showGridLines){History.Create_NewPoint(); History.Add(AscCommonExcel.g_oUndoRedoWorksheet,AscCH.historyitem_Worksheet_SetDisplayGridlines,this.getId(),null,new UndoRedoData_FromTo(view.showGridLines,value));view.showGridLines=value;this.workbook.handlers.trigger("changeSheetViewSettings",this.getId(),AscCH.historyitem_Worksheet_SetDisplayGridlines);if(!this.workbook.bUndoChanges&&!this.workbook.bRedoChanges)this.workbook.handlers.trigger("asc_onUpdateSheetViewSettings")}};Worksheet.prototype.setDisplayHeadings=function(value){var view=this.sheetViews[0]; if(value!==view.showRowColHeaders){History.Create_NewPoint();History.Add(AscCommonExcel.g_oUndoRedoWorksheet,AscCH.historyitem_Worksheet_SetDisplayHeadings,this.getId(),null,new UndoRedoData_FromTo(view.showRowColHeaders,value));view.showRowColHeaders=value;this.workbook.handlers.trigger("changeSheetViewSettings",this.getId(),AscCH.historyitem_Worksheet_SetDisplayHeadings);if(!this.workbook.bUndoChanges&&!this.workbook.bRedoChanges)this.workbook.handlers.trigger("asc_onUpdateSheetViewSettings")}}; Worksheet.prototype.setShowZeros=function(value){var view=this.sheetViews[0];if(value!==view.showZeros){History.Create_NewPoint();History.Add(AscCommonExcel.g_oUndoRedoWorksheet,AscCH.historyitem_Worksheet_SetShowZeros,this.getId(),null,new UndoRedoData_FromTo(view.showZeros,value));view.showZeros=value;this.workbook.handlers.trigger("changeSheetViewSettings",this.getId(),AscCH.historyitem_Worksheet_SetDisplayHeadings);if(!this.workbook.bUndoChanges&&!this.workbook.bRedoChanges)this.workbook.handlers.trigger("asc_onUpdateSheetViewSettings")}}; Worksheet.prototype.getRowsCount=function(){var result=this.nRowsCount;var pane=this.sheetViews.length&&this.sheetViews[0].pane;if(pane&&pane.topLeftFrozenCell)result=Math.max(result,pane.topLeftFrozenCell.getRow0());return result};Worksheet.prototype.removeRows=function(start,stop,bExcludeHiddenRows){var removeRowsArr=bExcludeHiddenRows?this._getNoHiddenRowsArr(start,stop):[{start:start,stop:stop}];for(var i=removeRowsArr.length-1;i>=0;i--){var oRange=this.getRange(new CellAddress(removeRowsArr[i].start, 0,0),new CellAddress(removeRowsArr[i].stop,gc_nMaxCol0,0));oRange.deleteCellsShiftUp()}};Worksheet.prototype._getNoHiddenRowsArr=function(start,stop){var res=[];var elem=null;for(var i=start;i<=stop;i++)if(this.getRowHidden(i)){if(elem){res.push(elem);elem=null}}else{if(!elem){elem={};elem.start=i;elem.stop=i}else elem.stop++;if(i===stop)res.push(elem)}return res};Worksheet.prototype._updateFormulasParents=function(r1,c1,r2,c2,bbox,offset,shiftedShared){var t=this;var cellWithFormula;var shiftedArrayFormula= {};this.getRange3(r1,c1,r2,c2)._foreachNoEmpty(function(cell){var newNRow=cell.nRow+offset.row;var newNCol=cell.nCol+offset.col;var bHor=0!==offset.col;var toDelete=offset.col<0||offset.row<0;if(cell.isFormula()){var processed=c_oSharedShiftType.NeedTransform;var parsed=cell.getFormulaParsed();var shared=parsed.getShared();var arrayFormula=parsed.getArrayFormulaRef();var formulaRefObj=null;if(shared){processed=shiftedShared[parsed.getListenerId()];var isPreProcessed=c_oSharedShiftType.PreProcessed=== processed;if(!processed||isPreProcessed){if(!processed){var bboxShift=AscCommonExcel.shiftGetBBox(bbox,bHor);if(bboxShift.containsRange(shared.ref)&&(!toDelete||!bbox.isIntersect(shared.ref)))processed=c_oSharedShiftType.Processed;else processed=c_oSharedShiftType.NeedTransform}else if(isPreProcessed)processed=c_oSharedShiftType.Processed;if(c_oSharedShiftType.Processed===processed){var newRef=shared.ref.clone();newRef.forShift(bbox,offset,t.workbook.bUndoChanges);parsed.setSharedRef(newRef,!isPreProcessed); t.workbook.dependencyFormulas.addToChangedRange2(t.getId(),newRef)}shiftedShared[parsed.getListenerId()]=processed}}else if(arrayFormula)if(!shiftedArrayFormula[parsed.getListenerId()]&&parsed.checkFirstCellArray(cell)){shiftedArrayFormula[parsed.getListenerId()]=1;var newArrayRef=arrayFormula.clone();newArrayRef.setOffset(offset);parsed.setArrayFormulaRef(newArrayRef)}else processed=c_oSharedShiftType.Processed;if(c_oSharedShiftType.NeedTransform===processed){var isTransform=cell.transformSharedFormula(); parsed=cell.getFormulaParsed();if(isTransform)parsed.buildDependencies();cellWithFormula=parsed.getParent();cellWithFormula.nRow=newNRow;cellWithFormula.nCol=newNCol;t.workbook.dependencyFormulas.addToChangedCell(cellWithFormula)}}t.cellsByColRowsCount=Math.max(t.cellsByColRowsCount,newNRow+1);t.nRowsCount=Math.max(t.nRowsCount,t.cellsByColRowsCount);t.nColsCount=Math.max(t.nColsCount,newNCol+1)})};Worksheet.prototype._removeRows=function(start,stop){var t=this;this.workbook.dependencyFormulas.lockRecal(); History.Create_NewPoint();var nDif=-(stop-start+1);var oActualRange=new Asc.Range(0,start,gc_nMaxCol0,stop);var offset=new AscCommon.CellBase(nDif,0);var renameRes=this.renameDependencyNodes(offset,oActualRange);var redrawTablesArr=this.autoFilters.insertRows("delCell",oActualRange,c_oAscDeleteOptions.DeleteRows);if(false==this.workbook.bUndoChanges&&false==this.workbook.bRedoChanges)this.updatePivotOffset(oActualRange,offset);if(false==this.workbook.bUndoChanges&&(false==this.workbook.bRedoChanges|| this.workbook.bCollaborativeChanges)){History.LocalChange=true;this.updateSortStateOffset(oActualRange,offset);this.updateSparklineGroupOffset(oActualRange,offset);this.updateConditionalFormattingOffset(oActualRange,offset);History.LocalChange=false}var collapsedInfo=null,lastRowIndex;var oDefRowPr=new AscCommonExcel.UndoRedoData_RowProp;this.getRange3(start,0,stop,gc_nMaxCol0)._foreachRowNoEmpty(function(row){var oOldProps=row.getHeightProp();lastRowIndex=row.index;if(false===oOldProps.isEqual(oDefRowPr))History.Add(AscCommonExcel.g_oUndoRedoWorksheet, AscCH.historyitem_Worksheet_RowProp,t.getId(),row._getUpdateRange(),new UndoRedoData_IndexSimpleProp(row.getIndex(),true,oOldProps,oDefRowPr));row.setStyle(null);if(!t.workbook.bRedoChanges){if(collapsedInfo!==null&&collapsedInfo0?-1:0;var offsetCol=!bRow&&bbox.c1>0?-1:0;var r2=bRow?bbox.r1:bbox.r2;var c2=!bRow?bbox.c1:bbox.c2;if(0!==offsetRow||0!==offsetCol)this.getRange3(bbox.r1, bbox.c1,r2,c2)._foreachNoEmpty(function(cell){if(cell.xfs&&cell.xfs.border)t._getCellNoEmpty(cell.nRow+offsetRow,cell.nCol+offsetCol,function(neighbor){if(neighbor&&neighbor.xfs&&neighbor.xfs.border){var newBorder=neighbor.xfs.border.clone();newBorder.intersect(cell.xfs.border,g_oDefaultFormat.BorderAbs,true);borders[bRow?cell.nCol:cell.nRow]=newBorder}})});return borders};Worksheet.prototype._insertRowsBefore=function(index,count){var t=this;this.workbook.dependencyFormulas.lockRecal();var oActualRange= new Asc.Range(0,index,gc_nMaxCol0,index+count-1);History.Create_NewPoint();var offset=new AscCommon.CellBase(count,0);var renameRes=this.renameDependencyNodes(offset,oActualRange);var redrawTablesArr=this.autoFilters.insertRows("insCell",oActualRange,c_oAscInsertOptions.InsertColumns);if(false==this.workbook.bUndoChanges&&false==this.workbook.bRedoChanges)this.updatePivotOffset(oActualRange,offset);if(false==this.workbook.bUndoChanges&&(false==this.workbook.bRedoChanges||this.workbook.bCollaborativeChanges)){History.LocalChange= true;this.updateSortStateOffset(oActualRange,offset);this.updateSparklineGroupOffset(oActualRange,offset);this.updateConditionalFormattingOffset(oActualRange,offset);History.LocalChange=false}this._updateFormulasParents(index,0,gc_nMaxRow0,gc_nMaxCol0,oActualRange,offset,renameRes.shiftedShared);var borders;if(index>0&&!this.workbook.bUndoChanges)borders=this._getBordersForInsert(oActualRange,true);this.rowsData.insertRange(index,count);this.nRowsCount=Math.max(this.nRowsCount,this.rowsData.getSize()); this._forEachColData(function(sheetMemory){sheetMemory.insertRange(index,count);t.cellsByColRowsCount=Math.max(t.cellsByColRowsCount,sheetMemory.getSize())});this.nRowsCount=Math.max(this.nRowsCount,this.cellsByColRowsCount);if(index>0&&!this.workbook.bUndoChanges){this.rowsData.copyRangeByChunk(index-1,1,index,count);this.nRowsCount=Math.max(this.nRowsCount,this.rowsData.getSize());this._forEachColData(function(sheetMemory){sheetMemory.copyRangeByChunk(index-1,1,index,count);t.cellsByColRowsCount= Math.max(t.cellsByColRowsCount,sheetMemory.getSize())});this.nRowsCount=Math.max(this.nRowsCount,this.cellsByColRowsCount);this.getRange3(index,0,index+count-1,gc_nMaxCol0)._foreachRowNoEmpty(function(row){row.setHidden(false)},function(cell){cell.clearDataKeepXf(borders[cell.nCol])})}this.workbook.dependencyFormulas.notifyChanged(renameRes.changed);History.Add(AscCommonExcel.g_oUndoRedoWorksheet,AscCH.historyitem_Worksheet_AddRows,this.getId(),new Asc.Range(0,index,gc_nMaxCol0,gc_nMaxRow0),new UndoRedoData_FromToRowCol(true, index,index+count-1));this.autoFilters.redrawStylesTables(redrawTablesArr);this.workbook.dependencyFormulas.unlockRecal();return true};Worksheet.prototype.insertRowsAfter=function(index,count){return this.insertRowsBefore(index+1,count)};Worksheet.prototype.getColsCount=function(){var result=this.nColsCount;var pane=this.sheetViews.length&&this.sheetViews[0].pane;if(pane&&pane.topLeftFrozenCell)result=Math.max(result,pane.topLeftFrozenCell.getCol0());return result};Worksheet.prototype.removeCols= function(start,stop){var oRange=this.getRange(new CellAddress(0,start,0),new CellAddress(gc_nMaxRow0,stop,0));oRange.deleteCellsShiftLeft()};Worksheet.prototype._removeCols=function(start,stop){var t=this;this.workbook.dependencyFormulas.lockRecal();History.Create_NewPoint();var nDif=-(stop-start+1),i,j,length;var oActualRange=new Asc.Range(start,0,stop,gc_nMaxRow0);var offset=new AscCommon.CellBase(0,nDif);var renameRes=this.renameDependencyNodes(offset,oActualRange);var redrawTablesArr=this.autoFilters.insertColumn(oActualRange, nDif);if(false==this.workbook.bUndoChanges&&false==this.workbook.bRedoChanges)this.updatePivotOffset(oActualRange,offset);if(false==this.workbook.bUndoChanges&&(false==this.workbook.bRedoChanges||this.workbook.bCollaborativeChanges)){History.LocalChange=true;this.updateSortStateOffset(oActualRange,offset);this.updateSparklineGroupOffset(oActualRange,offset);this.updateConditionalFormattingOffset(oActualRange,offset);History.LocalChange=false}var collapsedInfo=null,lastRowIndex;var oDefColPr=new AscCommonExcel.UndoRedoData_ColProp; this.getRange3(0,start,gc_nMaxRow0,stop)._foreachColNoEmpty(function(col){var nIndex=col.getIndex();var oOldProps=col.getWidthProp();if(false===oOldProps.isEqual(oDefColPr))History.Add(AscCommonExcel.g_oUndoRedoWorksheet,AscCH.historyitem_Worksheet_ColProp,t.getId(),new Asc.Range(nIndex,0,nIndex,gc_nMaxRow0),new UndoRedoData_IndexSimpleProp(nIndex,false,oOldProps,oDefColPr));col.setStyle(null);lastRowIndex=col.index;if(!t.workbook.bRedoChanges){if(collapsedInfo!==null&&collapsedInfo0&&!this.workbook.bUndoChanges)borders=this._getBordersForInsert(oActualRange, false);this.cellsByCol.splice(gc_nMaxCol0-count+1,count);for(var i=this.cellsByCol.length-1;i>=index;--i){this.cellsByCol[i+count]=this.cellsByCol[i];this.cellsByCol[i]=undefined}this.nColsCount=Math.max(this.nColsCount,this.getColDataLength());this.aCols.splice(gc_nMaxCol0-count+1,count);for(var i=this.aCols.length-1;i>=index;--i){this.aCols[i+count]=this.aCols[i];this.aCols[i]=undefined;if(this.aCols[i+count])this.aCols[i+count].moveHor(count)}this.nColsCount=Math.max(this.nColsCount,this.aCols.length); if(!this.workbook.bUndoChanges){var oPrevCol=null;if(index>0)oPrevCol=this.aCols[index-1];if(null==oPrevCol&&null!=this.oAllCol)oPrevCol=this.oAllCol;if(null!=oPrevCol){History.LocalChange=true;for(var i=index;i0?this.cellsByCol[index-1]:null;if(prevCellsByCol){for(var i=index;i0)prevCol=this._getCol(start-1);for(var i=start;i<=stop;i++){var col=this._getCol(i);fProcessCol(col)}if(_summaryRight&&!bNotAddCollapsed&&prevCol){col=this._getCol(stop+1);if(col.getCollapsed())this.setCollapsedCol(false,null,col)}}};Worksheet.prototype.getColHidden=function(index){var col=this._getColNoEmptyWithAll(index);return col?col.getHidden():false};Worksheet.prototype.setColHidden=function(bHidden,start,stop){if(null==start)return;if(null==stop)stop=start;History.Create_NewPoint(); var oThis=this,outlineLevel;var bNotAddCollapsed=true==this.workbook.bUndoChanges||true==this.workbook.bRedoChanges||this.bExcludeCollapsed;var _summaryRight=this.sheetPr?this.sheetPr.SummaryRight:true;var fProcessCol=function(col){if(col&&!bNotAddCollapsed&&outlineLevel!==undefined&&outlineLevel!==col.getOutlineLevel())if(!_summaryRight)oThis.setCollapsedCol(bHidden,col.index-1);else oThis.setCollapsedCol(bHidden,null,col);outlineLevel=col?col.getOutlineLevel():null;if(col.getHidden()!=bHidden){var oOldProps= col.getWidthProp();if(bHidden){col.setHidden(bHidden);if(null==col.width||true!=col.CustomWidth)col.width=0;col.CustomWidth=true;col.BestFit=null}else{col.setHidden(null);if(0>=col.width)col.width=null}var oNewProps=col.getWidthProp();if(false==oOldProps.isEqual(oNewProps))History.Add(AscCommonExcel.g_oUndoRedoWorksheet,AscCH.historyitem_Worksheet_ColProp,oThis.getId(),col._getUpdateRange(),new UndoRedoData_IndexSimpleProp(col.index,false,oOldProps,oNewProps))}};if(!bNotAddCollapsed&&!_summaryRight&& start>0){col=this._getCol(start-1);outlineLevel=col.getOutlineLevel()}if(0===start&&gc_nMaxCol0===stop){var col=null;if(false==bHidden)col=this.oAllCol;else col=this.getAllCol();if(null!=col)fProcessCol(col);for(var i in this.aCols){var col=this.aCols[i];if(null!=col)fProcessCol(col)}}else for(var i=start;i<=stop;i++){var col=null;if(false==bHidden)col=this._getColNoEmpty(i);else col=this._getCol(i);if(null!=col)fProcessCol(col)}if(!bNotAddCollapsed&&outlineLevel&&_summaryRight){col=this._getCol(stop+ 1);if(col&&outlineLevel!==col.getOutlineLevel())oThis.setCollapsedCol(bHidden,null,col)}};Worksheet.prototype.setCollapsedCol=function(bCollapse,colIndex,curCol){var oThis=this;var fProcessCol=function(col){var oOldProps=col.getCollapsed();col.setCollapsed(bCollapse);var oNewProps=col.getCollapsed();if(oOldProps!==oNewProps)History.Add(AscCommonExcel.g_oUndoRedoWorksheet,AscCH.historyitem_Worksheet_CollapsedCol,oThis.getId(),col._getUpdateRange(),new UndoRedoData_IndexSimpleProp(col.index,true,oOldProps, oNewProps))};if(curCol)fProcessCol(curCol);else this.getRange3(0,colIndex,0,colIndex)._foreachCol(fProcessCol)};Worksheet.prototype.setSummaryRight=function(val){if(!this.sheetPr)this.sheetPr=new AscCommonExcel.asc_CSheetPr;History.Create_NewPoint();History.Add(AscCommonExcel.g_oUndoRedoWorksheet,AscCH.historyitem_Worksheet_SetSummaryRight,this.getId(),null,new UndoRedoData_FromTo(this.sheetPr.SummaryRight,val));this.sheetPr.SummaryRight=val};Worksheet.prototype.setSummaryBelow=function(val){if(!this.sheetPr)this.sheetPr= new AscCommonExcel.asc_CSheetPr;History.Create_NewPoint();History.Add(AscCommonExcel.g_oUndoRedoWorksheet,AscCH.historyitem_Worksheet_SetSummaryBelow,this.getId(),null,new UndoRedoData_FromTo(this.sheetPr.SummaryBelow,val));this.sheetPr.SummaryBelow=val};Worksheet.prototype.setFitToPage=function(val){if(this.sheetPr&&val!==this.sheetPr.FitToPage||!this.sheetPr&&val){if(!this.sheetPr)this.sheetPr=new AscCommonExcel.asc_CSheetPr;History.Create_NewPoint();History.Add(AscCommonExcel.g_oUndoRedoWorksheet, AscCH.historyitem_Worksheet_SetFitToPage,this.getId(),null,new UndoRedoData_FromTo(this.sheetPr.FitToPage,val));this.sheetPr.FitToPage=val}};Worksheet.prototype.setGroupCol=function(bDel,start,stop){var oThis=this;var fProcessCol=function(col){col.setOutlineLevel(null,bDel)};this.getRange3(0,start,0,stop)._foreachCol(fProcessCol)};Worksheet.prototype.setOutlineCol=function(val,start,stop){var oThis=this;var fProcessCol=function(col){col.setOutlineLevel(val)};this.getRange3(0,start,0,stop)._foreachCol(fProcessCol)}; Worksheet.prototype.getColCustomWidth=function(index){var isBestFit;var column=this._getColNoEmptyWithAll(index);if(!column)isBestFit=true;else if(column.getHidden())isBestFit=false;else isBestFit=!!(column.BestFit||null===column.BestFit&&null===column.CustomWidth);return!isBestFit};Worksheet.prototype.setColBestFit=function(bBestFit,width,start,stop){if(null==start)return;if(null==stop)stop=start;History.Create_NewPoint();var oThis=this;var fProcessCol=function(col){var oOldProps=col.getWidthProp(); if(bBestFit){col.BestFit=bBestFit;col.setHidden(null)}else col.BestFit=null;col.width=width;oThis.initColumn(col);var oNewProps=col.getWidthProp();if(false==oOldProps.isEqual(oNewProps))History.Add(AscCommonExcel.g_oUndoRedoWorksheet,AscCH.historyitem_Worksheet_ColProp,oThis.getId(),col._getUpdateRange(),new UndoRedoData_IndexSimpleProp(col.index,false,oOldProps,oNewProps))};if(0===start&&gc_nMaxCol0===stop){var col=null;if(bBestFit&&oDefaultMetrics.ColWidthChars==width)col=this.oAllCol;else col= this.getAllCol();if(null!=col)fProcessCol(col);for(var i in this.aCols){var col=this.aCols[i];if(null!=col)fProcessCol(col)}}else for(var i=start;i<=stop;i++){var col=null;if(bBestFit&&oDefaultMetrics.ColWidthChars==width)col=this._getColNoEmpty(i);else col=this._getCol(i);if(null!=col)fProcessCol(col)}};Worksheet.prototype.isDefaultHeightHidden=function(){return null!=this.oSheetFormatPr.oAllRow&&this.oSheetFormatPr.oAllRow.getHidden()};Worksheet.prototype.isDefaultWidthHidden=function(){return null!= this.oAllCol&&this.oAllCol.getHidden()};Worksheet.prototype.setDefaultHeight=function(h){if(this.oSheetFormatPr.oAllRow&&!this.oSheetFormatPr.oAllRow.getCustomHeight())this.oSheetFormatPr.oAllRow.h=h};Worksheet.prototype.getDefaultHeight=function(){var dRes=null;if(null!=this.oSheetFormatPr.oAllRow&&this.oSheetFormatPr.oAllRow.getCustomHeight())dRes=this.oSheetFormatPr.oAllRow.h;return dRes};Worksheet.prototype.getRowHeight=function(index){var res;this._getRowNoEmptyWithAll(index,function(row){res= row?row.getHeight():-1});return res};Worksheet.prototype.setRowHeight=function(height,start,stop,isCustom){if(0==height)return this.setRowHidden(true,start,stop);if(null==start)return;if(null==stop)stop=start;History.Create_NewPoint();var oThis=this,i;var oSelection=History.GetSelection();if(null!=oSelection){oSelection=oSelection.clone();oSelection.assign(0,start,gc_nMaxCol0,stop);History.SetSelection(oSelection);History.SetSelectionRedo(oSelection)}var prevRow;var bNotAddCollapsed=true==this.workbook.bUndoChanges|| true==this.workbook.bRedoChanges||this.bExcludeCollapsed;var _summaryBelow=this.sheetPr?this.sheetPr.SummaryBelow:true;var fProcessRow=function(row){if(row){if(_summaryBelow&&!bNotAddCollapsed&&row.getCollapsed())oThis.setCollapsedRow(false,null,row);else if(!_summaryBelow&&!bNotAddCollapsed&&prevRow&&prevRow.getCollapsed())oThis.setCollapsedRow(false,null,prevRow);prevRow=row;var oOldProps=row.getHeightProp();row.setHeight(height);if(isCustom)row.setCustomHeight(true);row.setCalcHeight(true);row.setHidden(false); var oNewProps=row.getHeightProp();if(false===oOldProps.isEqual(oNewProps))History.Add(AscCommonExcel.g_oUndoRedoWorksheet,AscCH.historyitem_Worksheet_RowProp,oThis.getId(),row._getUpdateRange(),new UndoRedoData_IndexSimpleProp(row.index,true,oOldProps,oNewProps))}};if(0==start&&gc_nMaxRow0==stop){fProcessRow(this.getAllRow());this._forEachRow(fProcessRow)}else{if(!_summaryBelow)if(!bNotAddCollapsed&&start>0)this._getRow(start-1,function(row){prevRow=row});this.getRange3(start,0,stop,0)._foreachRow(fProcessRow); if(_summaryBelow)if(!bNotAddCollapsed&&prevRow)this._getRow(stop+1,function(row){if(row.getCollapsed())oThis.setCollapsedRow(false,null,row)})}if(this.needRecalFormulas(start,stop))this.workbook.dependencyFormulas.calcTree()};Worksheet.prototype.getRowHidden=function(index){var res;this._getRowNoEmptyWithAll(index,function(row){res=row?row.getHidden():false});return res};Worksheet.prototype.setRowHidden=function(bHidden,start,stop){if(null==start)return;if(null==stop)stop=start;var oThis=this;var doHide= function(_start,_stop,localChange){var i;var startIndex=null,endIndex=null,updateRange,outlineLevel;var bNotAddCollapsed=true==oThis.workbook.bUndoChanges||true==oThis.workbook.bRedoChanges||oThis.bExcludeCollapsed;var _summaryBelow=oThis.sheetPr?oThis.sheetPr.SummaryBelow:true;var fProcessRow=function(row){if(row&&!bNotAddCollapsed&&outlineLevel!==undefined&&outlineLevel!==row.getOutlineLevel())if(!_summaryBelow)oThis.setCollapsedRow(bHidden,row.index-1);else oThis.setCollapsedRow(bHidden,null,row); outlineLevel=row?row.getOutlineLevel():null;if(row&&bHidden!=row.getHidden()){row.setHidden(bHidden,localChange);if(row.index===endIndex+1&&startIndex!==null)endIndex++;else{if(startIndex!==null){updateRange=new Asc.Range(0,startIndex,gc_nMaxCol0,endIndex);History.Add(AscCommonExcel.g_oUndoRedoWorksheet,AscCH.historyitem_Worksheet_RowHide,oThis.getId(),updateRange,new UndoRedoData_FromToRowCol(bHidden,startIndex,endIndex))}startIndex=row.index;endIndex=row.index}}};if(0==_start&&gc_nMaxRow0==_stop); else{if(!_summaryBelow&&_start>0&&!bNotAddCollapsed)oThis._getRow(_start-1,function(row){if(row)outlineLevel=row.getOutlineLevel()});for(i=_start;i<=_stop;++i)false==bHidden?oThis._getRowNoEmpty(i,fProcessRow):oThis._getRow(i,fProcessRow);if(_summaryBelow&&outlineLevel&&!bNotAddCollapsed)oThis._getRow(_stop+1,function(row){if(row&&outlineLevel!==row.getOutlineLevel())oThis.setCollapsedRow(bHidden,null,row)});if(startIndex!==null){updateRange=new Asc.Range(0,startIndex,gc_nMaxCol0,endIndex);History.Add(AscCommonExcel.g_oUndoRedoWorksheet, AscCH.historyitem_Worksheet_RowHide,oThis.getId(),updateRange,new UndoRedoData_FromToRowCol(bHidden,startIndex,endIndex))}}};var bCollaborativeChanges=!this.autoFilters.useViewLocalChange&&this.workbook.bCollaborativeChanges;if(!bCollaborativeChanges&&null!==this.getActiveNamedSheetViewId()){var rowsArr=this.autoFilters.splitRangeByFilters(start,stop);if(rowsArr){var j;History.Create_NewPoint();if(rowsArr[0]&&rowsArr[0].length){var oldLocalChange=History.LocalChange;History.LocalChange=true;for(j= 0;j-1)sCellAdd=sCellAdd.replace(/\$/g,"");return this.getRange2(sCellAdd)};Worksheet.prototype.getCell3=function(r1,c1){return this.getRange3(r1,c1,r1,c1)};Worksheet.prototype.getRange=function(cellAdd1,cellAdd2){var nRow1=cellAdd1.getRow0();var nCol1=cellAdd1.getCol0();var nRow2=cellAdd2.getRow0();var nCol2=cellAdd2.getCol0();return this.getRange3(nRow1,nCol1,nRow2,nCol2)};Worksheet.prototype.getRange2=function(sRange){var bbox= AscCommonExcel.g_oRangeCache.getAscRange(sRange);if(null!=bbox)return Range.prototype.createFromBBox(this,bbox);return null};Worksheet.prototype.getRange3=function(r1,c1,r2,c2){var nRowMin=r1;var nRowMax=r2;var nColMin=c1;var nColMax=c2;if(r1>r2){nRowMax=r1;nRowMin=r2}if(c1>c2){nColMax=c1;nColMin=c2}return new Range(this,nRowMin,nColMin,nRowMax,nColMax)};Worksheet.prototype.getRange4=function(r,c){return new Range(this,r,c,r,c)};Worksheet.prototype.getRowIterator=function(r1,c1,c2,callback){var it= new RowIterator;it.init(this,r1,c1,c2);callback(it);it.release()};Worksheet.prototype.getCellForValidation=function(row,col,array,formula,callback,isCopyPaste,byRef){var cell=new Cell(this);cell.setRowCol(row,col);cell.setValueForValidation(array,formula,callback,isCopyPaste,byRef);return cell};Worksheet.prototype._removeCell=function(nRow,nCol,cell){var t=this;var processCell=function(cell){if(null!=cell){var sheetId=t.getId();if(false==cell.isEmpty()){var oUndoRedoData_CellData=new AscCommonExcel.UndoRedoData_CellData(cell.getValueData(), null);if(null!=cell.xfs)oUndoRedoData_CellData.style=cell.xfs.clone();cell.setFormulaInternal(null);History.Add(AscCommonExcel.g_oUndoRedoWorksheet,AscCH.historyitem_Worksheet_RemoveCell,sheetId,new Asc.Range(nCol,nRow,nCol,nRow),new UndoRedoData_CellSimpleData(nRow,nCol,oUndoRedoData_CellData,null))}t.workbook.dependencyFormulas.addToChangedCell(cell);cell.clearData();cell.saveContent(true)}};if(null!=cell){nRow=cell.nRow;nCol=cell.nCol;processCell(cell)}else this._getCellNoEmpty(nRow,nCol,processCell)}; Worksheet.prototype._getCell=function(row,col,fAction){var wb=this.workbook;var targetCell=null;for(var k=0;k=this.nRowsCount?index+1:this.nRowsCount};Worksheet.prototype._initCell=function(cell,nRow,nCol){var t=this;cell.setChanged(true);this._getRowNoEmpty(nRow,function(row){var oCol=t._getColNoEmptyWithAll(nCol);var xfs=null;if(row&&null!=row.xfs)xfs=row.xfs.clone();else if(null!=oCol&&null!=oCol.xfs)xfs=oCol.xfs.clone();cell.setStyleInternal(xfs);t.cellsByColRowsCount= Math.max(t.cellsByColRowsCount,nRow+1);t.nRowsCount=Math.max(t.nRowsCount,t.cellsByColRowsCount);if(nCol>=t.nColsCount)t.nColsCount=nCol+1});var sheetMemory=this.getColData(nCol);sheetMemory.checkSize(nRow)};Worksheet.prototype._getCellNoEmpty=function(row,col,fAction){var wb=this.workbook;var targetCell=null;for(var k=0;k=this.nColsCount?index+1:this.nColsCount}}return oCurCol};Worksheet.prototype._prepareMoveRangeGetCleanRanges=function(oBBoxFrom,oBBoxTo,wsTo){var intersection=oBBoxFrom.intersectionSimple(oBBoxTo);var aRangesToCheck=[];if(null!=intersection&&this===wsTo){var oThis=this; var fAddToRangesToCheck=function(aRangesToCheck,r1,c1,r2,c2){if(r1<=r2&&c1<=c2)aRangesToCheck.push(oThis.getRange3(r1,c1,r2,c2))};if(intersection.r1==oBBoxTo.r1&&intersection.c1==oBBoxTo.c1){fAddToRangesToCheck(aRangesToCheck,oBBoxTo.r1,intersection.c2+1,intersection.r2,oBBoxTo.c2);fAddToRangesToCheck(aRangesToCheck,intersection.r2+1,oBBoxTo.c1,oBBoxTo.r2,oBBoxTo.c2)}else if(intersection.r2==oBBoxTo.r2&&intersection.c1==oBBoxTo.c1){fAddToRangesToCheck(aRangesToCheck,oBBoxTo.r1,oBBoxTo.c1,intersection.r1- 1,oBBoxTo.c2);fAddToRangesToCheck(aRangesToCheck,intersection.r1,intersection.c2+1,oBBoxTo.r2,oBBoxTo.c2)}else if(intersection.r1==oBBoxTo.r1&&intersection.c2==oBBoxTo.c2){fAddToRangesToCheck(aRangesToCheck,oBBoxTo.r1,oBBoxTo.c1,intersection.r2,intersection.c1-1);fAddToRangesToCheck(aRangesToCheck,intersection.r2+1,oBBoxTo.c1,oBBoxTo.r2,oBBoxTo.c2)}else if(intersection.r2==oBBoxTo.r2&&intersection.c2==oBBoxTo.c2){fAddToRangesToCheck(aRangesToCheck,oBBoxTo.r1,oBBoxTo.c1,intersection.r1-1,oBBoxTo.c2); fAddToRangesToCheck(aRangesToCheck,intersection.r1,oBBoxTo.c1,oBBoxTo.r2,intersection.c1-1)}}else aRangesToCheck.push(wsTo.getRange3(oBBoxTo.r1,oBBoxTo.c1,oBBoxTo.r2,oBBoxTo.c2));return aRangesToCheck};Worksheet.prototype._prepareMoveRange=function(oBBoxFrom,oBBoxTo,wsTo){var res=0;if(!wsTo)wsTo=this;if(oBBoxFrom.isEqual(oBBoxTo)&&this===wsTo)return res;var range=wsTo.getRange3(oBBoxTo.r1,oBBoxTo.c1,oBBoxTo.r2,oBBoxTo.c2);var aMerged=wsTo.mergeManager.get(range.getBBox0());if(aMerged.outer.length> 0)return-2;var aRangesToCheck=this._prepareMoveRangeGetCleanRanges(oBBoxFrom,oBBoxTo,wsTo);for(var i=0,length=aRangesToCheck.length;i0&&!this.workbook.bUndoChanges)borders=this._getBordersForInsert(oBBox, false);var cellsByColLength=this.getColDataLength();for(var i=cellsByColLength-1;i>=nLeft;--i){var sheetMemoryFrom=this.getColDataNoEmpty(i);if(sheetMemoryFrom){if(i+dif<=gc_nMaxCol0)this.getColData(i+dif).copyRange(sheetMemoryFrom,oBBox.r1,oBBox.r1,oBBox.r2-oBBox.r1+1);sheetMemoryFrom.clear(oBBox.r1,oBBox.r2+1)}}this.nColsCount=Math.max(this.nColsCount,this.getColDataLength());if(nLeft>0&&!this.workbook.bUndoChanges){var prevSheetMemory=this.getColDataNoEmpty(nLeft-1);if(prevSheetMemory){for(var i= nLeft;i<=nRight;++i)this.getColData(i).copyRange(prevSheetMemory,oBBox.r1,oBBox.r1,oBBox.r2-oBBox.r1+1);this.nColsCount=Math.max(this.nColsCount,this.getColDataLength());this.getRange3(oBBox.r1,oBBox.c1,oBBox.r2,oBBox.c2)._foreachNoEmpty(function(cell){cell.clearDataKeepXf(borders[cell.nRow])})}}this.workbook.dependencyFormulas.notifyChanged(renameRes.changed);History.Add(AscCommonExcel.g_oUndoRedoWorksheet,AscCH.historyitem_Worksheet_ShiftCellsRight,this.getId(),oActualRange,new UndoRedoData_BBox(oBBox)); this.autoFilters.redrawStylesTables(redrawTablesArr)};Worksheet.prototype._shiftCellsBottom=function(oBBox,displayNameFormatTable){var t=this;var nTop=oBBox.r1;var nBottom=oBBox.r2;var dif=nBottom-nTop+1;var oActualRange=new Asc.Range(oBBox.c1,oBBox.r1,oBBox.c2,gc_nMaxRow0);var offset=new AscCommon.CellBase(dif,0);var renameRes=this.renameDependencyNodes(offset,oBBox);var redrawTablesArr;if(!this.workbook.bUndoChanges&&undefined===displayNameFormatTable)redrawTablesArr=this.autoFilters.insertRows("insCell", oBBox,c_oAscInsertOptions.InsertCellsAndShiftDown,displayNameFormatTable);if(false==this.workbook.bUndoChanges&&false==this.workbook.bRedoChanges)this.updatePivotOffset(oBBox,offset);this._updateFormulasParents(oActualRange.r1,oActualRange.c1,oActualRange.r2,oActualRange.c2,oBBox,offset,renameRes.shiftedShared);if(false==this.workbook.bUndoChanges&&(false==this.workbook.bRedoChanges||this.workbook.bCollaborativeChanges)){History.LocalChange=true;this.updateSortStateOffset(oBBox,offset);this.updateSparklineGroupOffset(oBBox, offset);this.updateConditionalFormattingOffset(oBBox,offset);History.LocalChange=false}var borders;if(nTop>0&&!this.workbook.bUndoChanges)borders=this._getBordersForInsert(oBBox,true);for(var i=oBBox.c1;i<=oBBox.c2;++i){var sheetMemory=this.getColDataNoEmpty(i);if(sheetMemory){sheetMemory.insertRange(nTop,dif);t.cellsByColRowsCount=Math.max(t.cellsByColRowsCount,sheetMemory.getSize())}}this.nRowsCount=Math.max(this.nRowsCount,this.cellsByColRowsCount);if(nTop>0&&!this.workbook.bUndoChanges){for(var i= oBBox.c1;i<=oBBox.c2;++i){var sheetMemory=this.getColDataNoEmpty(i);if(sheetMemory){sheetMemory.copyRangeByChunk(nTop-1,1,nTop,dif);t.cellsByColRowsCount=Math.max(t.cellsByColRowsCount,sheetMemory.getSize())}}this.nRowsCount=Math.max(this.nRowsCount,this.cellsByColRowsCount);this.getRange3(oBBox.r1,oBBox.c1,oBBox.r2,oBBox.c2)._foreachNoEmpty(function(cell){cell.clearDataKeepXf(borders[cell.nCol])})}this.workbook.dependencyFormulas.notifyChanged(renameRes.changed);History.Add(AscCommonExcel.g_oUndoRedoWorksheet, AscCH.historyitem_Worksheet_ShiftCellsBottom,this.getId(),oActualRange,new UndoRedoData_BBox(oBBox));if(!this.workbook.bUndoChanges&&undefined!==displayNameFormatTable)redrawTablesArr=this.autoFilters.insertRows("insCell",oBBox,c_oAscInsertOptions.InsertCellsAndShiftDown,displayNameFormatTable);if(!this.workbook.bUndoChanges)this.autoFilters.redrawStylesTables(redrawTablesArr)};Worksheet.prototype._setIndex=function(ind){this.index=ind};Worksheet.prototype._BuildDependencies=function(cellRange){var ca; for(var i in cellRange){if(null===cellRange[i]){cellRange[i]=i;continue}ca=g_oCellAddressUtils.getCellAddress(i);this._getCellNoEmpty(ca.getRow0(),ca.getCol0(),function(c){if(c)c._BuildDependencies(true)})}};Worksheet.prototype._setHandlersTablePart=function(){if(!this.TableParts)return;for(var i=0;i0)for(var i=0;i< this.TableParts.length;i++)if(this.TableParts[i].isTotalsRow()){var ref=this.TableParts[i].Ref;if(ref.r2===row&&col>=ref.c1&&col<=ref.c2)return{index:i,colIndex:col-ref.c1}}return null};Worksheet.prototype.isApplyFilterBySheet=function(){var res=false;if(this.AutoFilter&&this.AutoFilter.isApplyAutoFilter())res=true;if(false===res&&this.TableParts)for(var i=0;i1){this._expandRangeByMergedAddToOuter(aOuter,range,this.mergeManager.get(new Asc.Range(range.c1+1,range.r1,range.c2-1,range.r1)));if(range.r1!=range.r2)this._expandRangeByMergedAddToOuter(aOuter,range,this.mergeManager.get(new Asc.Range(range.c1+1,range.r2,range.c2-1,range.r2)))}}return aOuter};Worksheet.prototype.expandRangeByMerged= function(range){if(null!=range){var aOuter=this._expandRangeByMergedGetOuter(range);if(aOuter.length>0){range=range.clone();while(aOuter.length>0){for(var i=0,length=aOuter.length;i-1;--i)if(this.aSparklineGroups[i].remove(range)){History.Add(new AscDFH.CChangesDrawingsSparklinesRemove(this.aSparklineGroups[i])); this.aSparklineGroups.splice(i,1)}};Worksheet.prototype.removeSparklineGroups=function(range){for(var i=this.aSparklineGroups.length-1;i>-1;--i)if(-1!==this.aSparklineGroups[i].intersectionSimple(range)){History.Add(new AscDFH.CChangesDrawingsSparklinesRemove(this.aSparklineGroups[i]));this.aSparklineGroups.splice(i,1)}};Worksheet.prototype.addSparklineGroups=function(sparklineGroups){if(sparklineGroups){History.Add(new AscDFH.CChangesDrawingsSparklinesRemove(sparklineGroups,true));this.insertSparklineGroup(sparklineGroups)}}; Worksheet.prototype.insertSparklineGroup=function(sparklineGroup){this.aSparklineGroups.push(sparklineGroup)};Worksheet.prototype.removeSparklineGroup=function(id){for(var i=0;i0)return c_oAscError.ID.PastInMergeAreaError}return c_oAscError.ID.No};Worksheet.prototype.checkPivotReportLocationForConfirm=function(ranges,changed){var t=this;if(changed&&changed.oldRanges&&changed.data)changed.oldRanges.forEach(function(range){t.getRange3(range.r1,range.c1,range.r2,range.c2).cleanAll()});for(var i=0;i0)return c_oAscError.ID.PivotOverlap;var warning=c_oAscError.ID.No;this.getRange3(range.r1,range.c1,range.r2,range.c2)._foreachNoEmptyByCol(function(cell){if(!cell.isNullTextString())warning=c_oAscError.ID.PivotOverlap});if(c_oAscError.ID.No!==warning)return warning}return c_oAscError.ID.No};Worksheet.prototype.getSlicerCachesByPivotTable=function(sheetId,pivotName){var res=[];for(var i=0;i=0)res.push(cache)}return res};Worksheet.prototype.getSlicerCachesByPivotCacheId=function(pivotCacheId){var res=[];for(var i=0;i=0)res.push(this.aSlicers[i])}return res};Worksheet.prototype.initPivotTables=function(){for(var i=0;i0){if(rowFieldsOffset)cells=this.getRange4(pivotRange.r1+location.firstDataRow,pivotRange.c1+location.firstDataCol-1);else cells=this.getRange4(pivotRange.r1+location.firstDataRow-1,pivotRange.c1+location.firstDataCol);oCellValue=new AscCommonExcel.CCellValue;oCellValue.type=AscCommon.CellValueType.String;oCellValue.text= AscCommon.translateManager.getValue(AscCommonExcel.ToName_ST_ItemType(Asc.c_oAscItemType.Default));cells.setValueData(new AscCommonExcel.UndoRedoData_CellValueData(null,oCellValue))}if(rowFieldsOffset&&false===pivotTable.showHeaders&&false===pivotTable.gridDropZones&&pivotTable.getDataFieldsCount()>0){cells=this.getRange4(pivotRange.r1+location.firstDataRow,pivotRange.c1+location.firstDataCol-1);this._updatePivotTableSetCellValue(cells,pivotTable.getDataFieldName(0))}return}var pivotFields=pivotTable.asc_getPivotFields(); var totalTitleRange=[];for(i=0;ivaluesIndex){fieldIndex=fields[r+j].asc_getIndex();field=pivotFields[fieldIndex];if(AscCommonExcel.st_VALUES!==fieldIndex)if(field.subtotalCaption)oCellValue.text=field.subtotalCaption;else{oCellValue.text=totalTitleRange[r+j].getValueWithFormatSkipToSpace();oCellValue.text+=" "+AscCommon.translateManager.getValue(AscCommonExcel.ToName_ST_ItemType(item.t))}}else{oCellValue.text=totalTitleRange[r+j].getValueWithFormatSkipToSpace();oCellValue.text+= " "+pivotTable.getDataFieldName(item.i)}}if(null!==fieldIndex){var num=pivotTable.getPivotFieldNum(fieldIndex);if(num)cells.setNum(num)}if(hasLeftAlignInRowLables)cells.setAlignHorizontal(AscCommon.align_Left);if(outline>0)cells.setIndent(outline);cells.setValueData(new AscCommonExcel.UndoRedoData_CellValueData(null,oCellValue))}}};Worksheet.prototype._updatePivotTableCellsRowHeaderLabels=function(pivotTable){var rowFieldsOffset=[0];var rowFields=pivotTable.asc_getRowFields();if(!rowFields)return rowFieldsOffset; var cells,index,field;var pivotFields=pivotTable.asc_getPivotFields();var pivotRange=pivotTable.getRange();var location=pivotTable.location;var c1=pivotRange.c1;var r1=pivotRange.r1+location.firstDataRow-1;if(pivotTable.showHeaders)if(pivotTable.compact||location.firstDataCol!==rowFields.length)if(1===rowFields.length&&AscCommonExcel.st_VALUES===rowFields[0].asc_getIndex())this._updatePivotTableSetCellValue(this.getRange4(r1,c1),pivotTable.dataCaption||AscCommon.translateManager.getValue(AscCommonExcel.DATA_CAPTION)); else this._updatePivotTableSetCellValue(this.getRange4(r1,c1),pivotTable.rowHeaderCaption||AscCommon.translateManager.getValue(AscCommonExcel.ROW_HEADER_CAPTION));else{cells=this.getRange4(r1,c1);index=rowFields[0].asc_getIndex();if(AscCommonExcel.st_VALUES!==index)this._updatePivotTableSetCellValue(cells,pivotTable.getPivotFieldName(index));else this._updatePivotTableSetCellValue(cells,pivotTable.dataCaption||AscCommon.translateManager.getValue(AscCommonExcel.DATA_CAPTION))}for(var i=1;ivaluesIndex){dataByColIndex=[curDataRow];for(var colItemsIndex=0;colItemsIndex=0;--i){var pivotTable=this.pivotTables[i];if(pivotTable.intersection(range))this._deletePivotTable(this.pivotTables,pivotTable,i,withoutCells)}return true};Worksheet.prototype.deletePivotTablesOnMove=function(from,to){for(var i=this.pivotTables.length-1;i>=0;--i){var pivotTable=this.pivotTables[i];if(pivotTable.isInRange(to)&&!pivotTable.isInRange(from))this._deletePivotTable(this.pivotTables, pivotTable,i)}return true};Worksheet.prototype.getPivotTable=function(col,row){var res=null;for(var i=0;iformulaRange.r1&&range.r1<=formulaRange.r2)return false;if(range.r2>=formulaRange.r1&&range.r2formulaRange.c1&&range.c1<=formulaRange.c2)return false}else{if(range.c1>formulaRange.c1&&range.c1<=formulaRange.c2)return false;if(range.c2>=formulaRange.c1&& range.c2formulaRange.r1&&range.r1<=formulaRange.r2)return false}return true};var alreadyCheckFormulas=[];var r2=range.r2,c2=range.c2;if(isHor)c2=gc_nMaxCol0;else r2=gc_nMaxRow0;this.getRange3(range.r1,range.c1,r2,c2)._foreachNoEmpty(function(cell){if(res&&cell.isFormula()){var formulaParsed=cell.getFormulaParsed();var arrayFormulaRef=formulaParsed.getArrayFormulaRef();if(arrayFormulaRef&&!alreadyCheckFormulas[formulaParsed._index]){if(!checkRange(arrayFormulaRef))res= false;alreadyCheckFormulas[formulaParsed._index]=1}}});return res};Worksheet.prototype.setRowsCount=function(val){if(val>gc_nMaxRow0||val<0)return;this.nRowsCount=val};Worksheet.prototype.fromXLSB=function(stream,type,tmp,aCellXfs,aSharedStrings,fInitCellAfterRead){stream.XlsbSkipRecord();var oldPos=-1;while(oldPos!==stream.GetCurPos()){oldPos=stream.GetCurPos();type=stream.XlsbReadRecordType();if(AscCommonExcel.XLSB.rt_CELL_BLANK<=type&&type<=AscCommonExcel.XLSB.rt_FMLA_ERROR){tmp.cell.clear();tmp.formula.clean(); tmp.cell.fromXLSB(stream,type,tmp.row.index,aCellXfs,aSharedStrings,tmp);fInitCellAfterRead(tmp)}else if(AscCommonExcel.XLSB.rt_ROW_HDR===type){tmp.row.clear();tmp.row.fromXLSB(stream,aCellXfs);tmp.row.saveContent();tmp.ws.cellsByColRowsCount=Math.max(tmp.ws.cellsByColRowsCount,tmp.row.index+1);tmp.ws.nRowsCount=Math.max(tmp.ws.nRowsCount,tmp.ws.cellsByColRowsCount)}else if(AscCommonExcel.XLSB.rt_END_SHEET_DATA===type){stream.XlsbSkipRecord();break}else stream.XlsbSkipRecord()}};Worksheet.prototype.needRecalFormulas= function(start,stop){var res=false;if(this.AutoFilter&&this.AutoFilter.isApplyAutoFilter())return true;var tableParts=this.TableParts;var tablePart;for(var i=0;i=tablePart.Ref.r1&&stop<=tablePart.Ref.r2){res=true;break}}return res};Worksheet.prototype.getRowColColors=function(columnRange,byRow,notCheckOneColor){var ws=this;var res={text:true,colors:[],fontColors:[]};var alreadyAddColors={},alreadyAddFontColors={};var getAscColor= function(color){var ascColor=new Asc.asc_CColor;ascColor.asc_putR(color.getR());ascColor.asc_putG(color.getG());ascColor.asc_putB(color.getB());ascColor.asc_putA(color.getA());return ascColor};var addFontColorsToArray=function(fontColor){var rgb=fontColor&&null!==fontColor?fontColor.getRgb():null;if(rgb===0)rgb=null;var isDefaultFontColor=null===rgb;if(true!==alreadyAddFontColors[rgb])if(isDefaultFontColor){res.fontColors.push(null);alreadyAddFontColors[null]=true}else{var ascFontColor=getAscColor(fontColor); res.fontColors.push(ascFontColor);alreadyAddFontColors[rgb]=true}};var addCellColorsToArray=function(color){var rgb=null!==color&&color.fill&&color.fill.bg()?color.fill.bg().getRgb():null;var isDefaultCellColor=null===rgb;if(true!==alreadyAddColors[rgb])if(isDefaultCellColor){res.colors.push(null);alreadyAddColors[null]=true}else{var ascColor=getAscColor(color.fill.bg());res.colors.push(ascColor);alreadyAddColors[rgb]=true}};var tempText=0,tempDigit=0;var r1=byRow?columnRange.r1:columnRange.r1;var r2= byRow?columnRange.r1:columnRange.r2;var c1=byRow?columnRange.c1:columnRange.c1;var c2=byRow?columnRange.c2:columnRange.c1;ws.getRange3(r1,c1,r2,c2)._foreachNoEmpty(function(cell){if(!cell){if(true!==alreadyAddColors[null]){alreadyAddColors[null]=true;res.colors.push(null)}return}if(false===cell.isNullText()){var type=cell.getType();if(type===0)tempDigit++;else tempText++}var multiText=cell.getValueMultiText();var fontColor=null;var xfs=cell.getCompiledStyleCustom(false,true,true);if(null!==multiText)for(var j= 0;j>>1;this.isDirty=0!=(flags&g_nCellFlag_isDirtyMask);this.isCalc=0!= (flags&g_nCellFlag_isCalcMask);return(flags&g_nCellFlag_valueMask)>>>3};Cell.prototype.processFormula=function(callback){if(this.formulaParsed){var shared=this.formulaParsed.getShared();var offsetRow,offsetCol;if(shared){offsetRow=this.nRow-shared.base.nRow;offsetCol=this.nCol-shared.base.nCol;if(0!==offsetRow||0!==offsetCol){var oldRow=this.formulaParsed.parent.nRow;var oldCol=this.formulaParsed.parent.nCol;var old=AscCommonExcel.g_ProcessShared;AscCommonExcel.g_ProcessShared=true;var offsetShared= new AscCommon.CellBase(offsetRow,offsetCol);this.formulaParsed.changeOffset(offsetShared,false);this.formulaParsed.parent.nRow=this.nRow;this.formulaParsed.parent.nCol=this.nCol;callback(this.formulaParsed);offsetShared.row=-offsetRow;offsetShared.col=-offsetCol;this.formulaParsed.changeOffset(offsetShared,false);this.formulaParsed.parent.nRow=oldRow;this.formulaParsed.parent.nCol=oldCol;AscCommonExcel.g_ProcessShared=old}else callback(this.formulaParsed)}else callback(this.formulaParsed)}};Cell.prototype.setChanged= function(val){this._hasChanged=val};Cell.prototype.getStyle=function(){return this.xfs};Cell.prototype.getCompiledStyle=function(opt_styleComponents){return this.ws.getCompiledStyle(this.nRow,this.nCol,this,opt_styleComponents)};Cell.prototype.getCompiledStyleCustom=function(needTable,needCell,needConditional){return this.ws.getCompiledStyleCustom(this.nRow,this.nCol,needTable,needCell,needConditional,this)};Cell.prototype.getTableStyle=function(){var hiddenManager=this.ws.hiddenManager;var sheetMergedStyles= this.ws.sheetMergedStyles;var styleComponents=sheetMergedStyles.getStyle(hiddenManager,this.nRow,this.nCol,this.ws);return getCompiledStyleFromArray(null,styleComponents.table)};Cell.prototype.duplicate=function(){var t=this;var oNewCell=new Cell(this.ws);oNewCell.nRow=this.nRow;oNewCell.nCol=this.nCol;oNewCell.xfs=this.xfs;oNewCell.type=this.type;oNewCell.number=this.number;oNewCell.text=this.text;oNewCell.multiText=this.multiText;this.processFormula(function(parsed){var newFormula=new parserFormula(parsed.getFormula(), oNewCell,t.ws);AscCommonExcel.executeInR1C1Mode(false,function(){newFormula.parse()});var arrayFormulaRef=parsed.getArrayFormulaRef();if(arrayFormulaRef)newFormula.setArrayFormulaRef(arrayFormulaRef);oNewCell.setFormulaInternal(newFormula)});return oNewCell};Cell.prototype.clone=function(oNewWs,renameParams){if(!oNewWs)oNewWs=this.ws;var oNewCell=new Cell(oNewWs);oNewCell.nRow=this.nRow;oNewCell.nCol=this.nCol;if(null!=this.xfs)oNewCell.xfs=this.xfs;oNewCell.type=this.type;oNewCell.number=this.number; oNewCell.text=this.text;oNewCell.multiText=this.multiText;this.processFormula(function(parsed){var newFormula;if(oNewWs!=this.ws&&renameParams){var formula=parsed.clone(null,null,this.ws);formula.renameSheetCopy(renameParams);newFormula=formula.assemble(true)}else newFormula=parsed.getFormula();oNewCell.setFormulaInternal(new parserFormula(newFormula,oNewCell,oNewWs));oNewWs.workbook.dependencyFormulas.addToBuildDependencyCell(oNewCell)});return oNewCell};Cell.prototype.setRowCol=function(nRow,nCol){this.nRow= nRow;this.nCol=nCol};Cell.prototype.hasRowCol=function(){return this.nRow>=0&&this.nCol>=0};Cell.prototype.isEqual=function(options){var cellText;cellText=options.lookIn===Asc.c_oAscFindLookIn.Formulas?this.getValueForEdit():this.getValue();if(true!==options.isMatchCase)cellText=cellText.toLowerCase();var isWordEnter=cellText.indexOf(options.findWhat);if(options.findWhat instanceof RegExp&&options.isWholeWord)isWordEnter=cellText.search(options.findWhat);return 0<=isWordEnter&&(true!==options.isWholeCell|| options.findWhat.length===cellText.length)};Cell.prototype.isNullText=function(){return this.isNullTextString()&&!this.formulaParsed};Cell.prototype.isEmptyTextString=function(){this._checkDirty();if(null!=this.number||null!=this.text&&""!=this.text)return false;if(null!=this.multiText&&""!=AscCommonExcel.getStringFromMultiText(this.multiText))return false;return true};Cell.prototype.isNullTextString=function(){this._checkDirty();return null===this.number&&null===this.text&&null===this.multiText}; Cell.prototype.isEmpty=function(){if(false==this.isNullText())return false;if(null!=this.xfs)return false;return true};Cell.prototype.isFormula=function(){return this.formulaParsed?true:false};Cell.prototype.getName=function(){return g_oCellAddressUtils.getCellId(this.nRow,this.nCol)};Cell.prototype.setTypeInternal=function(val){this.type=val;this._hasChanged=true};Cell.prototype.correctValueByType=function(){switch(this.type){case CellValueType.Number:if(null!==this.text)this.setValueNumberInternal(parseInt(this.text)|| 0);else if(null!==this.multiText)this.setValueNumberInternal(0);break;case CellValueType.Bool:if(null!==this.text||null!==this.multiText)this.setValueNumberInternal(0);break;case CellValueType.String:if(null!==this.number)this.setValueTextInternal(this.number.toString());break;case CellValueType.Error:if(null!==this.number)this.setValueTextInternal(cErrorOrigin["nil"]);break}};Cell.prototype.setValueNumberInternal=function(val){this.number=val;this.text=null;this.multiText=null;this.textIndex=null; this._hasChanged=true};Cell.prototype.setValueTextInternal=function(val){this.number=null;this.text=val;this.multiText=null;this.textIndex=null;this._hasChanged=true};Cell.prototype.setValueMultiTextInternal=function(val){this.number=null;this.text=null;this.multiText=val;this.textIndex=null;this._hasChanged=true};Cell.prototype.setValue=function(val,callback,isCopyPaste,byRef,ignoreHyperlink){var ws=this.ws;var wb=ws.workbook;var DataOld=null;if(History.Is_On())DataOld=this.getValueData();var isFirstArrayFormulaCell= byRef&&this.nCol===byRef.c1&&this.nRow===byRef.r1;var newFP=this.setValueGetParsed(val,callback,isCopyPaste,byRef);if(undefined===newFP)return;this.cleanText();this.setFormulaInternal(null);if(newFP){this.setFormulaInternal(newFP);if(byRef){if(isFirstArrayFormulaCell)wb.dependencyFormulas.addToBuildDependencyArray(newFP)}else wb.dependencyFormulas.addToBuildDependencyCell(this)}else if(val){this._setValue(val,ignoreHyperlink);if(!ignoreHyperlink&&window["AscCommonExcel"].g_AutoCorrectHyperlinks)this._autoformatHyperlink(val); wb.dependencyFormulas.addToChangedCell(this)}else wb.dependencyFormulas.addToChangedCell(this);var DataNew=null;if(History.Is_On())DataNew=this.getValueData();if(History.Is_On()&&false==DataOld.isEqual(DataNew))History.Add(AscCommonExcel.g_oUndoRedoCell,AscCH.historyitem_Cell_ChangeValue,this.ws.getId(),new Asc.Range(this.nCol,this.nRow,this.nCol,this.nRow),new UndoRedoData_CellSimpleData(this.nRow,this.nCol,DataOld,DataNew));this.ws.workbook.sortDependency();if(!this.ws.workbook.dependencyFormulas.isLockRecal())this._adjustCellFormat(); if(this.isNullTextString()){var cell=this.ws.getCell3(this.nRow,this.nCol);cell.removeHyperlink()}};Cell.prototype.setValueGetParsed=function(val,callback,isCopyPaste,byRef){var ws=this.ws;var wb=ws.workbook;var bIsTextFormat=false;if(!isCopyPaste){var sNumFormat;if(null!=this.xfs&&null!=this.xfs.num)sNumFormat=this.xfs.num.getFormat();else sNumFormat=g_oDefaultFormat.Num.getFormat();var numFormat=oNumFormatCache.get(sNumFormat);bIsTextFormat=numFormat.isTextFormat()}var isFirstArrayFormulaCell=byRef&& this.nCol===byRef.c1&&this.nRow===byRef.r1;var newFP=null;if(false==bIsTextFormat)if(null!=val&&val[0]=="="&&val.length>1)if(byRef&&!isFirstArrayFormulaCell){newFP=this.ws.formulaArrayLink;if(newFP===null)return;if(this.nCol===byRef.c2&&this.nRow===byRef.r2)this.ws.formulaArrayLink=null}else{var cellWithFormula=new CCellWithFormula(this.ws,this.nRow,this.nCol);newFP=new parserFormula(val.substring(1),cellWithFormula,this.ws);var formulaLocaleParse=isCopyPaste===true?false:oFormulaLocaleInfo.Parse; var formulaLocaleDigetSep=isCopyPaste===true?false:oFormulaLocaleInfo.DigitSep;var parseResult=new AscCommonExcel.ParseResult;if(!newFP.parse(formulaLocaleParse,formulaLocaleDigetSep,parseResult))switch(parseResult.error){case c_oAscError.ID.FrmlWrongFunctionName:break;case c_oAscError.ID.FrmlParenthesesCorrectCount:return this.setValueGetParsed("="+newFP.getFormula(),callback,isCopyPaste,byRef);default:{var _pasteHelper=window["AscCommon"].g_specialPasteHelper;var isPaste=_pasteHelper&&_pasteHelper.pasteStart; if(isPaste){if(!_pasteHelper._formulaError){_pasteHelper._formulaError=true;wb.handlers.trigger("asc_onError",parseResult.error,c_oAscError.Level.NoCritical)}}else wb.handlers.trigger("asc_onError",parseResult.error,c_oAscError.Level.NoCritical);if(callback)callback(false);return}}else{newFP.setFormulaString(newFP.assemble());if(byRef){newFP.ref=byRef;this.ws.formulaArrayLink=newFP}}}return newFP};Cell.prototype.setValue2=function(array){var DataOld=null;if(History.Is_On())DataOld=this.getValueData(); this.setFormulaInternal(null);this.cleanText();this._setValue2(array);this.ws.workbook.dependencyFormulas.addToChangedCell(this);this.ws.workbook.sortDependency();var DataNew=null;if(History.Is_On())DataNew=this.getValueData();if(History.Is_On()&&false==DataOld.isEqual(DataNew))History.Add(AscCommonExcel.g_oUndoRedoCell,AscCH.historyitem_Cell_ChangeValue,this.ws.getId(),new Asc.Range(this.nCol,this.nRow,this.nCol,this.nRow),new UndoRedoData_CellSimpleData(this.nRow,this.nCol,DataOld,DataNew));if(this.isNullTextString()){var cell= this.ws.getCell3(this.nRow,this.nCol);cell.removeHyperlink()}};Cell.prototype.setValueForValidation=function(array,formula,callback,isCopyPaste,byRef){this.setFormulaInternal(null,true);this.cleanText();if(formula){var newFP=this.setValueGetParsed(formula,callback,isCopyPaste,byRef);this.ws.formulaArrayLink=null;if(newFP){this.setFormulaInternal(newFP,true);newFP.calculate();this._updateCellValue()}else if(undefined!==newFP)this._setValue(formula)}else this._setValue2(array,true)};Cell.prototype.setFormulaTemplate= function(bHistoryUndo,action){var DataOld=null;var DataNew=null;if(History.Is_On())DataOld=this.getValueData();this.cleanText();action(this);if(History.Is_On()){DataNew=this.getValueData();if(false==DataOld.isEqual(DataNew)){var typeHistory=bHistoryUndo?AscCH.historyitem_Cell_ChangeValueUndo:AscCH.historyitem_Cell_ChangeValue;History.Add(AscCommonExcel.g_oUndoRedoCell,typeHistory,this.ws.getId(),new Asc.Range(this.nCol,this.nRow,this.nCol,this.nRow),new UndoRedoData_CellSimpleData(this.nRow,this.nCol, DataOld,DataNew),bHistoryUndo)}}};Cell.prototype.setFormula=function(formula,bHistoryUndo,formulaRef){var cellWithFormula=new CCellWithFormula(this.ws,this.nRow,this.nCol);var parser=new parserFormula(formula,cellWithFormula,this.ws);if(formulaRef){parser.setArrayFormulaRef(formulaRef);this.ws.getRange3(formulaRef.r1,formulaRef.c1,formulaRef.r2,formulaRef.c2)._foreachNoEmpty(function(cell){cell.setFormulaParsed(parser,bHistoryUndo)})}else this.setFormulaParsed(parser,bHistoryUndo)};Cell.prototype.setFormulaParsed= function(parsed,bHistoryUndo){this.setFormulaTemplate(bHistoryUndo,function(cell){cell.setFormulaInternal(parsed);cell.ws.workbook.dependencyFormulas.addToBuildDependencyCell(cell)})};Cell.prototype.setFormulaInternal=function(formula,dontTouchPrev){if(!dontTouchPrev&&this.formulaParsed){var shared=this.formulaParsed.getShared();var arrayFormula=this.formulaParsed.getArrayFormulaRef();if(shared){if(shared.ref.isOnTheEdge(this.nCol,this.nRow))this.ws.workbook.dependencyFormulas.addToChangedShared(this.formulaParsed); var index=this.ws.workbook.workbookFormulas.add(this.formulaParsed).getIndexNumber();History.Add(AscCommonExcel.g_oUndoRedoCell,AscCH.historyitem_Cell_RemoveSharedFormula,this.ws.getId(),new Asc.Range(this.nCol,this.nRow,this.nCol,this.nRow),new UndoRedoData_CellSimpleData(this.nRow,this.nCol,index,null),true)}else if(arrayFormula&&this.formulaParsed.checkFirstCellArray(this)){var fText="="+this.formulaParsed.getFormula();History.Add(AscCommonExcel.g_oUndoRedoArrayFormula,AscCH.historyitem_ArrayFromula_DeleteFormula, this.ws.getId(),new Asc.Range(this.nCol,this.nRow,this.nCol,this.nRow),new AscCommonExcel.UndoRedoData_ArrayFormula(arrayFormula,fText),true)}else this.formulaParsed.removeDependencies()}this.formulaParsed=formula;this._hasChanged=true};Cell.prototype.transformSharedFormula=function(){var res=false;var parsed=this.formulaParsed;if(parsed){var shared=parsed.getShared();if(shared){var offsetShared=new AscCommon.CellBase(this.nRow-shared.base.nRow,this.nCol-shared.base.nCol);var cellWithFormula=new AscCommonExcel.CCellWithFormula(this.ws, this.nRow,this.nCol);var newFormula=parsed.clone(undefined,cellWithFormula);newFormula.removeShared();newFormula.changeOffset(offsetShared,false);newFormula.setFormulaString(newFormula.assemble(true));this.setFormulaInternal(newFormula);res=true}}return res};Cell.prototype.changeOffset=function(offset,canResize,bHistoryUndo,notOffset3d){this.setFormulaTemplate(bHistoryUndo,function(cell){cell.transformSharedFormula();var parsed=cell.getFormulaParsed();parsed.removeDependencies();parsed.changeOffset(offset, canResize,null,notOffset3d);parsed.setFormulaString(parsed.assemble(true));parsed.buildDependencies()})};Cell.prototype.setType=function(type){if(type!=this.type){var DataOld=this.getValueData();this.setTypeInternal(type);this.correctValueByType();this._hasChanged=true;var DataNew=this.getValueData();History.Add(AscCommonExcel.g_oUndoRedoCell,AscCH.historyitem_Cell_ChangeValue,this.ws.getId(),new Asc.Range(this.nCol,this.nRow,this.nCol,this.nRow),new UndoRedoData_CellSimpleData(this.nRow,this.nCol, DataOld,DataNew))}return type};Cell.prototype.getType=function(){this._checkDirty();return this.type};Cell.prototype.setCellStyle=function(val){var newVal=this.ws.workbook.CellStyles._prepareCellStyle(val);var oRes=this.ws.workbook.oStyleManager.setCellStyle(this,newVal);if(History.Is_On()){var oldStyleName=this.ws.workbook.CellStyles.getStyleNameByXfId(oRes.oldVal);History.Add(AscCommonExcel.g_oUndoRedoCell,AscCH.historyitem_Cell_Style,this.ws.getId(),new Asc.Range(this.nCol,this.nRow,this.nCol, this.nRow),new UndoRedoData_CellSimpleData(this.nRow,this.nCol,oldStyleName,val));var oStyle=this.ws.workbook.CellStyles.getStyleByXfId(oRes.newVal);if(oStyle.ApplyFont)this.setFont(oStyle.getFont());if(oStyle.ApplyFill)this.setFill(oStyle.getFill());if(oStyle.ApplyBorder)this.setBorder(oStyle.getBorder());if(oStyle.ApplyNumberFormat)this.setNumFormat(oStyle.getNumFormatStr())}};Cell.prototype.setNumFormat=function(val){this.setNum(new AscCommonExcel.Num({f:val}))};Cell.prototype.setNum=function(val){var oRes= this.ws.workbook.oStyleManager.setNum(this,val);if(History.Is_On()&&oRes.oldVal!=oRes.newVal)History.Add(AscCommonExcel.g_oUndoRedoCell,AscCH.historyitem_Cell_Num,this.ws.getId(),new Asc.Range(this.nCol,this.nRow,this.nCol,this.nRow),new UndoRedoData_CellSimpleData(this.nRow,this.nCol,oRes.oldVal,oRes.newVal))};Cell.prototype.shiftNumFormat=function(nShift,dDigitsCount){var bRes=false;var sNumFormat;if(null!=this.xfs&&null!=this.xfs.num)sNumFormat=this.xfs.num.getFormat();else sNumFormat=g_oDefaultFormat.Num.getFormat(); var type=this.getType();var oCurNumFormat=oNumFormatCache.get(sNumFormat);if(null!=oCurNumFormat&&false==oCurNumFormat.isGeneralFormat()){var output={};bRes=oCurNumFormat.shiftFormat(output,nShift);if(true==bRes)this.setNumFormat(output.format)}else if(CellValueType.Number==type){var sGeneral=AscCommon.DecodeGeneralFormat(this.number,type,dDigitsCount);var oGeneral=oNumFormatCache.get(sGeneral);if(null!=oGeneral&&false==oGeneral.isGeneralFormat()){var output={};bRes=oGeneral.shiftFormat(output,nShift); if(true==bRes)this.setNumFormat(output.format)}}return bRes};Cell.prototype.setFont=function(val,bModifyValue){if(false!=bModifyValue)if(null!=this.multiText&&false==this.ws.workbook.bUndoChanges&&false==this.ws.workbook.bRedoChanges){var oldVal=null;if(History.Is_On())oldVal=this.getValueData();this.setValueTextInternal(AscCommonExcel.getStringFromMultiText(this.multiText));if(History.Is_On()){var newVal=this.getValueData();History.Add(AscCommonExcel.g_oUndoRedoCell,AscCH.historyitem_Cell_ChangeValue, this.ws.getId(),new Asc.Range(this.nCol,this.nRow,this.nCol,this.nRow),new UndoRedoData_CellSimpleData(this.nRow,this.nCol,oldVal,newVal))}}var oRes=this.ws.workbook.oStyleManager.setFont(this,val);if(History.Is_On()&&oRes.oldVal!=oRes.newVal){var oldVal=null;if(null!=oRes.oldVal)oldVal=oRes.oldVal.clone();var newVal=null;if(null!=oRes.newVal)newVal=oRes.newVal.clone();History.Add(AscCommonExcel.g_oUndoRedoCell,AscCH.historyitem_Cell_SetFont,this.ws.getId(),new Asc.Range(this.nCol,this.nRow,this.nCol, this.nRow),new UndoRedoData_CellSimpleData(this.nRow,this.nCol,oldVal,newVal))}};Cell.prototype.setFontname=function(val){var oRes=this.ws.workbook.oStyleManager.setFontname(this,val);this._setFontProp(function(format){return val!=format.getName()},function(format){format.setName(val)});if(History.Is_On()&&oRes.oldVal!=oRes.newVal)History.Add(AscCommonExcel.g_oUndoRedoCell,AscCH.historyitem_Cell_Fontname,this.ws.getId(),new Asc.Range(this.nCol,this.nRow,this.nCol,this.nRow),new UndoRedoData_CellSimpleData(this.nRow, this.nCol,oRes.oldVal,oRes.newVal))};Cell.prototype.setFontsize=function(val){var oRes=this.ws.workbook.oStyleManager.setFontsize(this,val);this._setFontProp(function(format){return val!=format.getSize()},function(format){format.setSize(val)});if(History.Is_On()&&oRes.oldVal!=oRes.newVal)History.Add(AscCommonExcel.g_oUndoRedoCell,AscCH.historyitem_Cell_Fontsize,this.ws.getId(),new Asc.Range(this.nCol,this.nRow,this.nCol,this.nRow),new UndoRedoData_CellSimpleData(this.nRow,this.nCol,oRes.oldVal,oRes.newVal))}; Cell.prototype.setFontcolor=function(val){var oRes=this.ws.workbook.oStyleManager.setFontcolor(this,val);this._setFontProp(function(format){return val!=format.getColor()},function(format){format.setColor(val)});if(History.Is_On()&&oRes.oldVal!=oRes.newVal)History.Add(AscCommonExcel.g_oUndoRedoCell,AscCH.historyitem_Cell_Fontcolor,this.ws.getId(),new Asc.Range(this.nCol,this.nRow,this.nCol,this.nRow),new UndoRedoData_CellSimpleData(this.nRow,this.nCol,oRes.oldVal,oRes.newVal))};Cell.prototype.setBold= function(val){var oRes=this.ws.workbook.oStyleManager.setBold(this,val);this._setFontProp(function(format){return val!=format.getBold()},function(format){format.setBold(val)});if(History.Is_On()&&oRes.oldVal!=oRes.newVal)History.Add(AscCommonExcel.g_oUndoRedoCell,AscCH.historyitem_Cell_Bold,this.ws.getId(),new Asc.Range(this.nCol,this.nRow,this.nCol,this.nRow),new UndoRedoData_CellSimpleData(this.nRow,this.nCol,oRes.oldVal,oRes.newVal))};Cell.prototype.setItalic=function(val){var oRes=this.ws.workbook.oStyleManager.setItalic(this, val);this._setFontProp(function(format){return val!=format.getItalic()},function(format){format.setItalic(val)});if(History.Is_On()&&oRes.oldVal!=oRes.newVal)History.Add(AscCommonExcel.g_oUndoRedoCell,AscCH.historyitem_Cell_Italic,this.ws.getId(),new Asc.Range(this.nCol,this.nRow,this.nCol,this.nRow),new UndoRedoData_CellSimpleData(this.nRow,this.nCol,oRes.oldVal,oRes.newVal))};Cell.prototype.setUnderline=function(val){var oRes=this.ws.workbook.oStyleManager.setUnderline(this,val);this._setFontProp(function(format){return val!= format.getUnderline()},function(format){format.setUnderline(val)});if(History.Is_On()&&oRes.oldVal!=oRes.newVal)History.Add(AscCommonExcel.g_oUndoRedoCell,AscCH.historyitem_Cell_Underline,this.ws.getId(),new Asc.Range(this.nCol,this.nRow,this.nCol,this.nRow),new UndoRedoData_CellSimpleData(this.nRow,this.nCol,oRes.oldVal,oRes.newVal))};Cell.prototype.setStrikeout=function(val){var oRes=this.ws.workbook.oStyleManager.setStrikeout(this,val);this._setFontProp(function(format){return val!=format.getStrikeout()}, function(format){format.setStrikeout(val)});if(History.Is_On()&&oRes.oldVal!=oRes.newVal)History.Add(AscCommonExcel.g_oUndoRedoCell,AscCH.historyitem_Cell_Strikeout,this.ws.getId(),new Asc.Range(this.nCol,this.nRow,this.nCol,this.nRow),new UndoRedoData_CellSimpleData(this.nRow,this.nCol,oRes.oldVal,oRes.newVal))};Cell.prototype.setFontAlign=function(val){var oRes=this.ws.workbook.oStyleManager.setFontAlign(this,val);this._setFontProp(function(format){return val!=format.getVerticalAlign()},function(format){format.setVerticalAlign(val)}); if(History.Is_On()&&oRes.oldVal!=oRes.newVal)History.Add(AscCommonExcel.g_oUndoRedoCell,AscCH.historyitem_Cell_FontAlign,this.ws.getId(),new Asc.Range(this.nCol,this.nRow,this.nCol,this.nRow),new UndoRedoData_CellSimpleData(this.nRow,this.nCol,oRes.oldVal,oRes.newVal))};Cell.prototype.setAlignVertical=function(val){var oRes=this.ws.workbook.oStyleManager.setAlignVertical(this,val);if(History.Is_On()&&oRes.oldVal!=oRes.newVal)History.Add(AscCommonExcel.g_oUndoRedoCell,AscCH.historyitem_Cell_AlignVertical, this.ws.getId(),new Asc.Range(this.nCol,this.nRow,this.nCol,this.nRow),new UndoRedoData_CellSimpleData(this.nRow,this.nCol,oRes.oldVal,oRes.newVal))};Cell.prototype.setAlignHorizontal=function(val){var oRes=this.ws.workbook.oStyleManager.setAlignHorizontal(this,val);if(History.Is_On()&&oRes.oldVal!=oRes.newVal)History.Add(AscCommonExcel.g_oUndoRedoCell,AscCH.historyitem_Cell_AlignHorizontal,this.ws.getId(),new Asc.Range(this.nCol,this.nRow,this.nCol,this.nRow),new UndoRedoData_CellSimpleData(this.nRow, this.nCol,oRes.oldVal,oRes.newVal))};Cell.prototype.setFill=function(val){var oRes=this.ws.workbook.oStyleManager.setFill(this,val);if(History.Is_On()&&oRes.oldVal!=oRes.newVal)History.Add(AscCommonExcel.g_oUndoRedoCell,AscCH.historyitem_Cell_Fill,this.ws.getId(),new Asc.Range(this.nCol,this.nRow,this.nCol,this.nRow),new UndoRedoData_CellSimpleData(this.nRow,this.nCol,oRes.oldVal,oRes.newVal))};Cell.prototype.setFillColor=function(val){var fill=new AscCommonExcel.Fill;fill.fromColor(val);return this.setFill(fill)}; Cell.prototype.setBorder=function(val){var oRes=this.ws.workbook.oStyleManager.setBorder(this,val);if(History.Is_On()&&oRes.oldVal!=oRes.newVal){var oldVal=null;if(null!=oRes.oldVal)oldVal=oRes.oldVal.clone();var newVal=null;if(null!=oRes.newVal)newVal=oRes.newVal.clone();History.Add(AscCommonExcel.g_oUndoRedoCell,AscCH.historyitem_Cell_Border,this.ws.getId(),new Asc.Range(this.nCol,this.nRow,this.nCol,this.nRow),new UndoRedoData_CellSimpleData(this.nRow,this.nCol,oldVal,newVal))}};Cell.prototype.setShrinkToFit= function(val){var oRes=this.ws.workbook.oStyleManager.setShrinkToFit(this,val);if(History.Is_On()&&oRes.oldVal!=oRes.newVal)History.Add(AscCommonExcel.g_oUndoRedoCell,AscCH.historyitem_Cell_ShrinkToFit,this.ws.getId(),new Asc.Range(this.nCol,this.nRow,this.nCol,this.nRow),new UndoRedoData_CellSimpleData(this.nRow,this.nCol,oRes.oldVal,oRes.newVal))};Cell.prototype.setWrap=function(val){var oRes=this.ws.workbook.oStyleManager.setWrap(this,val);if(History.Is_On()&&oRes.oldVal!=oRes.newVal)History.Add(AscCommonExcel.g_oUndoRedoCell, AscCH.historyitem_Cell_Wrap,this.ws.getId(),new Asc.Range(this.nCol,this.nRow,this.nCol,this.nRow),new UndoRedoData_CellSimpleData(this.nRow,this.nCol,oRes.oldVal,oRes.newVal))};Cell.prototype.setAngle=function(val){var oRes=this.ws.workbook.oStyleManager.setAngle(this,val);if(History.Is_On()&&oRes.oldVal!=oRes.newVal)History.Add(AscCommonExcel.g_oUndoRedoCell,AscCH.historyitem_Cell_Angle,this.ws.getId(),new Asc.Range(this.nCol,this.nRow,this.nCol,this.nRow),new UndoRedoData_CellSimpleData(this.nRow, this.nCol,oRes.oldVal,oRes.newVal))};Cell.prototype.setIndent=function(val){var oRes=this.ws.workbook.oStyleManager.setIndent(this,val);if(History.Is_On()&&oRes.oldVal!=oRes.newVal)History.Add(AscCommonExcel.g_oUndoRedoCell,AscCH.historyitem_Cell_Indent,this.ws.getId(),new Asc.Range(this.nCol,this.nRow,this.nCol,this.nRow),new UndoRedoData_CellSimpleData(this.nRow,this.nCol,oRes.oldVal,oRes.newVal))};Cell.prototype.setQuotePrefix=function(val){var oRes=this.ws.workbook.oStyleManager.setQuotePrefix(this, val);if(History.Is_On()&&oRes.oldVal!=oRes.newVal)History.Add(AscCommonExcel.g_oUndoRedoCell,AscCH.historyitem_Cell_SetQuotePrefix,this.ws.getId(),new Asc.Range(this.nCol,this.nRow,this.nCol,this.nRow),new UndoRedoData_CellSimpleData(this.nRow,this.nCol,oRes.oldVal,oRes.newVal))};Cell.prototype.setPivotButton=function(val){var oRes=this.ws.workbook.oStyleManager.setPivotButton(this,val);if(History.Is_On()&&oRes.oldVal!=oRes.newVal)History.Add(AscCommonExcel.g_oUndoRedoCell,AscCH.historyitem_Cell_SetPivotButton, this.ws.getId(),new Asc.Range(this.nCol,this.nRow,this.nCol,this.nRow),new UndoRedoData_CellSimpleData(this.nRow,this.nCol,oRes.oldVal,oRes.newVal))};Cell.prototype.setStyle=function(xfs){var oldVal=this.xfs;this.setStyleInternal(xfs);if(History.Is_On()&&oldVal!=this.xfs)History.Add(AscCommonExcel.g_oUndoRedoCell,AscCH.historyitem_Cell_SetStyle,this.ws.getId(),new Asc.Range(this.nCol,this.nRow,this.nCol,this.nRow),new UndoRedoData_CellSimpleData(this.nRow,this.nCol,oldVal,this.xfs))};Cell.prototype.setStyleInternal= function(xfs){this.xfs=g_StyleCache.addXf(xfs);this._hasChanged=true};Cell.prototype.getFormula=function(){var res="";this.processFormula(function(parsed){res=parsed.getFormula()});return res};Cell.prototype.getFormulaParsed=function(){return this.formulaParsed};Cell.prototype.getValueForEdit=function(checkFormulaArray){this._checkDirty();var res=AscCommonExcel.getStringFromMultiText(this.getValueForEdit2());return this.formulaParsed&&this.formulaParsed.ref&&checkFormulaArray?"{"+res+"}":res};Cell.prototype.getValueForEdit2= function(){this._checkDirty();var cultureInfo=AscCommon.g_oDefaultCultureInfo;var oValueText=null;var oValueArray=null;var xfs=this.getCompiledStyle();if(this.isFormula())this.processFormula(function(parsed){oValueText="="+parsed.assembleLocale(AscCommonExcel.cFormulaFunctionToLocale,true)});else if(null!=this.text||null!=this.number)if(CellValueType.Bool===this.type&&null!=this.number)oValueText=this.number==1?cBoolLocal.t:cBoolLocal.f;else{if(null!=this.text)oValueText=this.text;if(CellValueType.Number=== this.type||CellValueType.String===this.type){var oNumFormat;if(null!=xfs&&null!=xfs.num)oNumFormat=oNumFormatCache.get(xfs.num.getFormat());else oNumFormat=oNumFormatCache.get(g_oDefaultFormat.Num.getFormat());if(CellValueType.String!=this.type&&null!=oNumFormat&&null!=this.number){var nValue=this.number;var oTargetFormat=oNumFormat.getFormatByValue(nValue);if(oTargetFormat)if(1==oTargetFormat.nPercent)oValueText=AscCommon.oGeneralEditFormatCache.format(nValue*100)+"%";else if(oTargetFormat.bDateTime)if(false== oTargetFormat.isInvalidDateValue(nValue)){var bDate=oTargetFormat.bDate;var bTime=oTargetFormat.bTime;if(false==bDate&&nValue>=1)bDate=true;if(false==bTime&&Math.floor(nValue)!=nValue)bTime=true;var sDateFormat="";if(bDate)sDateFormat=AscCommon.getShortDateFormat(cultureInfo);var sTimeFormat="h:mm:ss";if(cultureInfo.AMDesignator.length>0&&cultureInfo.PMDesignator.length>0)sTimeFormat+=" AM/PM";if(bDate&&bTime)oNumFormat=oNumFormatCache.get(sDateFormat+" "+sTimeFormat);else if(bTime)oNumFormat=oNumFormatCache.get(sTimeFormat); else oNumFormat=oNumFormatCache.get(sDateFormat);var aFormatedValue=oNumFormat.format(nValue,CellValueType.Number,AscCommon.gc_nMaxDigCount);oValueText="";for(var i=0,length=aFormatedValue.length;i=1){var sGeneral=AscCommon.DecodeGeneralFormat(sOriginText,this.type,nTempDigCount);if(null!=sGeneral)oNumFormat=oNumFormatCache.get(sGeneral);if(null!=oNumFormat){sText=null;isMultyText=false;aText=oNumFormat.format(sOriginText,this.type,dDigitsCount,false,opt_cultureInfo);if(true==oNumFormat.isTextFormat())break;else{aRes=this._getValue2Result(sText,aText,isMultyText);if(true==fIsFitMeasurer(aRes)){bFindResult=true;break}aRes=null}}nTempDigCount--}if(false==bFindResult){aRes= null;sText=null;isMultyText=false;var font=new AscCommonExcel.Font;if(dDigitsCount>1){font.setRepeat(true);aText=[{text:"#",format:font}]}else aText=[{text:"",format:font}]}}}else if(CellValueType.Bool===this.type){if(null!=this.number)sText=0!=this.number?cBoolLocal.t:cBoolLocal.f}else if(CellValueType.Error===this.type)if(null!=this.text)sText=this._getValueTypeError(this.text);if(bNeedMeasure){aRes=this._getValue2Result(sText,aText,isMultyText);if(false==fIsFitMeasurer(aRes)){aRes=null;sText=null; isMultyText=false;var font=new AscCommonExcel.Font;font.setRepeat(true);aText=[{text:"#",format:font}]}}if(null==aRes)aRes=this._getValue2Result(sText,aText,isMultyText);return aRes};Cell.prototype._setValue=function(val){this.cleanText();function checkCellValueTypeError(sUpText){switch(sUpText){case cErrorLocal["nil"]:return cErrorOrigin["nil"];break;case cErrorLocal["div"]:return cErrorOrigin["div"];break;case cErrorLocal["value"]:return cErrorOrigin["value"];break;case cErrorLocal["ref"]:return cErrorOrigin["ref"]; break;case cErrorLocal["name"]:case cErrorLocal["name"].replace("\\",""):return cErrorOrigin["name"];break;case cErrorLocal["num"]:return cErrorOrigin["num"];break;case cErrorLocal["na"]:return cErrorOrigin["na"];break;case cErrorLocal["getdata"]:return cErrorOrigin["getdata"];break;case cErrorLocal["uf"]:return cErrorOrigin["uf"];break}return false}if(""==val)return;var oNumFormat;var xfs=this.getCompiledStyle();if(null!=xfs&&null!=xfs.num)oNumFormat=oNumFormatCache.get(xfs.num.getFormat());else oNumFormat= oNumFormatCache.get(g_oDefaultFormat.Num.getFormat());if(oNumFormat.isTextFormat()){this.setTypeInternal(CellValueType.String);this.setValueTextInternal(val)}else if(AscCommon.g_oFormatParser.isLocaleNumber(val)){this.setTypeInternal(CellValueType.Number);this.setValueNumberInternal(AscCommon.g_oFormatParser.parseLocaleNumber(val))}else{var sUpText=val.toUpperCase();if(cBoolLocal.t===sUpText||cBoolLocal.f===sUpText){this.setTypeInternal(CellValueType.Bool);this.setValueNumberInternal(cBoolLocal.t=== sUpText?1:0)}else if(checkCellValueTypeError(sUpText)){this.setTypeInternal(CellValueType.Error);this.setValueTextInternal(checkCellValueTypeError(sUpText))}else{var res=AscCommon.g_oFormatParser.parse(val);if(null!=res){var nFormatType=oNumFormat.getType();if(!(c_oAscNumFormatType.Percent==nFormatType&&res.bPercent||c_oAscNumFormatType.Currency==nFormatType&&res.bCurrency||c_oAscNumFormatType.Date==nFormatType&&res.bDate||c_oAscNumFormatType.Time==nFormatType&&res.bTime)&&res.format!=oNumFormat.sFormat)this.setNumFormat(res.format); this.setTypeInternal(CellValueType.Number);this.setValueNumberInternal(res.value)}else{this.setTypeInternal(CellValueType.String);if(val.length>0&&"'"==val[0]){this.setQuotePrefix(true);val=val.substring(1)}this.setValueTextInternal(val)}}}};Cell.prototype._autoformatHyperlink=function(val){if(/(^(((http|https|ftp):\/\/)|(mailto:)|(www.)))|@/i.test(val)){val=val.replace(/\s+$/,"");var typeHyp=AscCommon.getUrlType(val);if(AscCommon.c_oAscUrlType.Invalid!=typeHyp){val=AscCommon.prepareUrl(val,typeHyp); var oNewHyperlink=new AscCommonExcel.Hyperlink;oNewHyperlink.Ref=this.ws.getCell3(this.nRow,this.nCol);oNewHyperlink.Hyperlink=val;oNewHyperlink.Ref.setHyperlink(oNewHyperlink)}}};Cell.prototype._setValue2=function(aVal,ignoreHyperlink){var sSimpleText="";for(var i=0,length=aVal.length;i0){this.multiText=[];for(var i=0,length=aVal.length;i 0&&"'"==this.text[0]){this.setQuotePrefix(true);this.setValueTextInternal(this.text.substring(1))}}else if(null!=this.multiText)if(this.multiText.length>0){var oFirstItem=this.multiText[0];if(null!=oFirstItem.text&&oFirstItem.text.length>0&&"'"==oFirstItem.text[0]){this.setQuotePrefix(true);if(1!=oFirstItem.text.length)oFirstItem.text=oFirstItem.text.substring(1);else{this.multiText.shift();if(0==this.multiText.length)this.setValueTextInternal("")}}}}};Cell.prototype._setFontProp=function(fCheck, fAction){var bRes=false;if(null!=this.multiText){var bChange=false;for(var i=0,length=this.multiText.length;i0){var cellFont=this.getFont();var oIntersectFont=null;for(var i=0,length=this.multiText.length;i0){var typeRun=stream.GetUChar();var run;if(1===typeRun){run=new AscCommonExcel.CMultiTextElem; run.text="";if(stream.GetBool()){hasFormat=true;run.format=new AscCommonExcel.Font;run.format.fromXLSB(stream);run.format.checkSchemeFont(this.ws.workbook.theme)}var textCount=stream.GetULongLE();while(textCount-- >0)run.text+=stream.GetString();richText.push(run)}else if(2===typeRun){run=new AscCommonExcel.CMultiTextElem;run.text=stream.GetString();richText.push(run)}}return hasFormat};Cell.prototype.toXLSB=function(stream,nXfsId,formulaToWrite,oSharedStrings){var len=4+4+2;var type=AscCommonExcel.XLSB.rt_CELL_BLANK; if(formulaToWrite)len+=this.getXLSBSizeFormula(formulaToWrite);var textToWrite;var isBlankFormula=false;if(formulaToWrite)if(!this.isNullTextString())switch(this.type){case CellValueType.Number:type=AscCommonExcel.XLSB.rt_FMLA_NUM;len+=8;break;case CellValueType.String:type=AscCommonExcel.XLSB.rt_FMLA_STRING;textToWrite=this.text?this.text:AscCommonExcel.getStringFromMultiText(this.multiText);len+=4+2*textToWrite.length;break;case CellValueType.Error:type=AscCommonExcel.XLSB.rt_FMLA_ERROR;len+=1; break;case CellValueType.Bool:type=AscCommonExcel.XLSB.rt_FMLA_BOOL;len+=1;break}else{type=AscCommonExcel.XLSB.rt_FMLA_STRING;textToWrite="";len+=4+2*textToWrite.length;isBlankFormula=true}else if(!this.isNullTextString())switch(this.type){case CellValueType.Number:type=AscCommonExcel.XLSB.rt_CELL_REAL;len+=8;break;case CellValueType.String:type=AscCommonExcel.XLSB.rt_CELL_ISST;len+=4;break;case CellValueType.Error:type=AscCommonExcel.XLSB.rt_CELL_ERROR;len+=1;break;case CellValueType.Bool:type=AscCommonExcel.XLSB.rt_CELL_BOOL; len+=1;break}stream.XlsbStartRecord(type,len);stream.WriteULong(this.nCol&16383);var nStyle=0;if(null!==nXfsId)nStyle=nXfsId;stream.WriteULong(nStyle);switch(type){case AscCommonExcel.XLSB.rt_CELL_REAL:case AscCommonExcel.XLSB.rt_FMLA_NUM:stream.WriteDouble2(this.number);break;case AscCommonExcel.XLSB.rt_CELL_ISST:var index;var textIndex=this.getTextIndex();if(null!==textIndex){index=oSharedStrings.strings[textIndex];if(undefined===index){index=oSharedStrings.index++;oSharedStrings.strings[textIndex]= index}}stream.WriteULong(index);break;case AscCommonExcel.XLSB.rt_CELL_ST:case AscCommonExcel.XLSB.rt_FMLA_STRING:stream.WriteString4(textToWrite);break;case AscCommonExcel.XLSB.rt_CELL_ERROR:case AscCommonExcel.XLSB.rt_FMLA_ERROR:if("#NULL!"==this.text)stream.WriteByte(0);else if("#DIV/0!"==this.text)stream.WriteByte(7);else if("#VALUE!"==this.text)stream.WriteByte(15);else if("#REF!"==this.text)stream.WriteByte(23);else if("#NAME?"==this.text)stream.WriteByte(29);else if("#NUM!"==this.text)stream.WriteByte(36); else if("#N/A"==this.text)stream.WriteByte(42);else stream.WriteByte(43);break;case AscCommonExcel.XLSB.rt_CELL_BOOL:case AscCommonExcel.XLSB.rt_FMLA_BOOL:stream.WriteByte(this.number);break}var flags=0;if(formulaToWrite)flags=this.toXLSBFormula(stream,formulaToWrite,isBlankFormula);stream.WriteUShort(flags);if(formulaToWrite)flags=this.toXLSBFormulaExt(stream,formulaToWrite);stream.XlsbEndRecord()};Cell.prototype.getXLSBSizeFormula=function(formulaToWrite){var len=2+4+4;if(formulaToWrite.formula)len+= 4+2*formulaToWrite.formula.length;else len+=4;if(undefined!==formulaToWrite.ref)len+=4+2*formulaToWrite.ref.getName().length;if(undefined!==formulaToWrite.si)len+=4;return len};Cell.prototype.toXLSBFormula=function(stream,formulaToWrite,isBlankFormula){var flags=0;if(formulaToWrite.ca)flags|=2;stream.WriteUShort(flags);stream.WriteULong(0);stream.WriteULong(0);var flagsExt=0;if(undefined!==formulaToWrite.type)flagsExt|=formulaToWrite.type;else flagsExt|=Asc.ECellFormulaType.cellformulatypeNormal; flagsExt|=4;if(undefined!==formulaToWrite.ref)flagsExt|=2048;if(undefined!==formulaToWrite.si)flagsExt|=4096;if(isBlankFormula)flagsExt|=16384;return flagsExt};Cell.prototype.toXLSBFormulaExt=function(stream,formulaToWrite){if(undefined!==formulaToWrite.formula)stream.WriteString4(formulaToWrite.formula);else stream.WriteString4("");if(undefined!==formulaToWrite.ref)stream.WriteString4(formulaToWrite.ref.getName());if(undefined!==formulaToWrite.si)stream.WriteULong(formulaToWrite.si)};function CCellWithFormula(ws, row,col){this.ws=ws;this.nRow=row;this.nCol=col}CCellWithFormula.prototype.onFormulaEvent=function(type,eventData){if(AscCommon.c_oNotifyParentType.GetRangeCell===type)return new Asc.Range(this.nCol,this.nRow,this.nCol,this.nRow);else if(AscCommon.c_oNotifyParentType.Change===type)this._onChange(eventData);else if(AscCommon.c_oNotifyParentType.ChangeFormula===type)this._onChangeFormula(eventData);else if(AscCommon.c_oNotifyParentType.EndCalculate===type)this.ws._getCell(this.nRow,this.nCol,function(cell){cell._updateCellValue()}); else if(AscCommon.c_oNotifyParentType.Shared===type)return this._onShared(eventData)};CCellWithFormula.prototype._onChange=function(eventData){var areaData=eventData.notifyData.areaData;var shared=eventData.formula.getShared();var arrayF=eventData.formula.getArrayFormulaRef();var dependencyFormulas=this.ws.workbook.dependencyFormulas;if(shared)if(areaData){var bbox=areaData.bbox;var changedRange=bbox.getSharedIntersect(shared.ref,areaData.changedBBox);dependencyFormulas.addToChangedRange2(this.ws.getId(), changedRange)}else dependencyFormulas.addToChangedRange2(this.ws.getId(),shared.ref);else if(arrayF)dependencyFormulas.addToChangedRange2(this.ws.getId(),arrayF);else this.ws.workbook.dependencyFormulas.addToChangedCell(this)};CCellWithFormula.prototype._onChangeFormula=function(eventData){var t=this;var wb=this.ws.workbook;var parsed=eventData.formula;var shared=parsed.getShared();if(shared){var index=wb.workbookFormulas.add(parsed).getIndexNumber();History.Add(AscCommonExcel.g_oUndoRedoSharedFormula, AscCH.historyitem_SharedFormula_ChangeFormula,null,null,new UndoRedoData_IndexSimpleProp(index,false,parsed.getFormulaRaw(),eventData.assemble),true);wb.dependencyFormulas.addToChangedRange2(this.ws.getId(),shared.ref)}else this.ws._getCell(this.nRow,this.nCol,function(cell){if(parsed===cell.formulaParsed)cell.setFormulaTemplate(true,function(cell){cell.formulaParsed.setFormulaString(eventData.assemble);wb.dependencyFormulas.addToChangedCell(cell)})})};CCellWithFormula.prototype._onShared=function(eventData){var res= false;var data=eventData.notifyData;var parsed=eventData.formula;var forceTransform=false;var sharedShift;var ranges;var i;var shared=parsed.getShared();if(shared){if(c_oNotifyType.Shift===data.type){var bHor=0!==data.offset.col;var toDelete=data.offset.col<0||data.offset.row<0;var bboxShift=AscCommonExcel.shiftGetBBox(data.bbox,bHor);sharedShift=parsed.getSharedIntersect(data.sheetId,bboxShift);if(sharedShift){var sharedIntersect;if(parsed.canShiftShared(bHor)&&(sharedIntersect=bboxShift.intersectionSimple(shared.ref))){ranges= sharedIntersect.difference(sharedShift);ranges=ranges.concat(sharedShift.difference(sharedIntersect));var cantBeShared;var diff=bboxShift.difference(new Asc.Range(0,0,gc_nMaxCol0,gc_nMaxRow0));if(toDelete)diff.push(data.bbox);for(i=0;icurSecond.col)indexSecond++;else{if(curFirst.type!=curSecond.type){res=true;break}indexFirst++;indexSecond++}}}worksheet.bExcludeHiddenRows=oldExcludeVal;return res}function Range(worksheet,r1,c1,r2,c2){this.worksheet=worksheet;this.bbox=new Asc.Range(c1,r1,c2,r2)}Range.prototype.createFromBBox= function(worksheet,bbox){var oRes=new Range(worksheet,bbox.r1,bbox.c1,bbox.r2,bbox.c2);oRes.bbox=bbox.clone();return oRes};Range.prototype.clone=function(oNewWs){if(!oNewWs)oNewWs=this.worksheet;return this.createFromBBox(oNewWs,this.bbox)};Range.prototype.isIntersect=function(oRange){if(this.worksheet===oRange.worksheet)return this.bbox.isIntersect(oRange.bbox);return false};Range.prototype.containsRange=function(oRange){if(this.worksheet===oRange.worksheet)return this.bbox.containsRange(oRange.bbox); return false};Range.prototype._foreach=function(action){if(null!=action){var wb=this.worksheet.workbook;var tempCell=new Cell(this.worksheet);wb.loadCells.push(tempCell);var oBBox=this.bbox;for(var i=oBBox.r1;i<=oBBox.r2;i++){if(this.worksheet.bExcludeHiddenRows&&this.worksheet.getRowHidden(i))continue;for(var j=oBBox.c1;j<=oBBox.c2;j++){var targetCell=null;for(var k=0;k=this.bbox.r1&&cellAddress.getCol0()>=this.bbox.c1&&cellAddress.getRow0()<=this.bbox.r2&&cellAddress.getCol0()<=this.bbox.c2};Range.prototype.containCell2=function(cell){return cell.nRow>=this.bbox.r1&&cell.nCol>=this.bbox.c1&&cell.nRow<=this.bbox.r2&&cell.nCol<=this.bbox.c2};Range.prototype.cross= function(bbox){if(bbox.r1>=this.bbox.r1&&bbox.r1<=this.bbox.r2&&this.bbox.c1==this.bbox.c2)return{r:bbox.r1};if(bbox.c1>=this.bbox.c1&&bbox.c1<=this.bbox.c2&&this.bbox.r1==this.bbox.r2)return{c:bbox.c1};return undefined};Range.prototype.getWorksheet=function(){return this.worksheet};Range.prototype.isFormula=function(){var nRow=this.bbox.r1;var nCol=this.bbox.c1;var isFormula;this.worksheet._getCellNoEmpty(nRow,nCol,function(cell){isFormula=cell.isFormula()});return isFormula};Range.prototype.isOneCell= function(){var oBBox=this.bbox;return oBBox.r1==oBBox.r2&&oBBox.c1==oBBox.c2};Range.prototype.getBBox0=function(){return this.bbox};Range.prototype.getName=function(){return this.bbox.getName()};Range.prototype.getMinimalCellsRange=function(){var nType=this._getRangeType();var oMinRange;if(nType===c_oRangeType.Range)return this;else{oMinRange=this.worksheet.getMinimalRange();if(!oMinRange)return null;var oBB=this.bbox;var r1=oBB.r1,c1=oBB.c1,r2=oBB.r2,c2=oBB.c2;if(nType===c_oRangeType.Col){r1=oMinRange.r1; r2=oMinRange.r2}else if(nType===c_oRangeType.Row){c1=oMinRange.c1;c2=oMinRange.c2}else{r1=oMinRange.r1;r2=oMinRange.r2;c1=oMinRange.c1;c2=oMinRange.c2}return new Range(this.worksheet,r1,c1,r2,c2)}};Range.prototype.setValue=function(val,callback,isCopyPaste,byRef,ignoreHyperlink){History.Create_NewPoint();History.StartTransaction();var _formula,t=this,activeCell;if(byRef===null){_formula=new AscCommonExcel.parserFormula(val.substr(1),null,this.worksheet);if(!_formula.parse(true))_formula=null;else{var _selection= this.worksheet.getSelection();activeCell=_selection.activeCell}}this._foreach(function(cell){var _val=val;if(_formula){_formula.isParsed=false;_formula.outStack=[];_formula.parse(true);var offset=new AscCommon.CellBase(cell.nRow-activeCell.row,cell.nCol-activeCell.col);_val="="+_formula.changeOffset(offset,null,true).assemble(true)}cell.setValue(_val,callback,isCopyPaste,byRef,ignoreHyperlink)});History.EndTransaction()};Range.prototype.setValue2=function(array){History.Create_NewPoint();History.StartTransaction(); this._foreach(function(cell){cell.setValue2(array)});History.EndTransaction()};Range.prototype.setValueData=function(val){History.Create_NewPoint();History.StartTransaction();this._foreach(function(cell){cell.setValueData(val)});History.EndTransaction()};Range.prototype.setCellStyle=function(val){History.Create_NewPoint();this.createCellOnRowColCross();var fSetProperty=this._setProperty;var nRangeType=this._getRangeType();if(c_oRangeType.All==nRangeType){this.worksheet.getAllCol().setCellStyle(val); fSetProperty=this._setPropertyNoEmpty}fSetProperty.call(this,function(row){if(c_oRangeType.All==nRangeType&&null==row.xfs)return;row.setCellStyle(val)},function(col){col.setCellStyle(val)},function(cell){cell.setCellStyle(val)})};Range.prototype.setStyle=function(val){History.Create_NewPoint();this.createCellOnRowColCross();var fSetProperty=this._setProperty;var nRangeType=this._getRangeType();if(c_oRangeType.All==nRangeType){this.worksheet.getAllCol().setStyle(val);fSetProperty=this._setPropertyNoEmpty}fSetProperty.call(this, function(row){if(c_oRangeType.All==nRangeType&&null==row.xfs)return;row.setStyle(val)},function(col){col.setStyle(val)},function(cell){cell.setStyle(val)})};Range.prototype.clearTableStyle=function(){this.worksheet.sheetMergedStyles.clearTablePivotStyle(this.bbox)};Range.prototype.setTableStyle=function(xf,stripe){if(xf)this.worksheet.sheetMergedStyles.setTablePivotStyle(this.bbox,xf,stripe)};Range.prototype.setNumFormat=function(val){this.setNum(new AscCommonExcel.Num({f:val}))};Range.prototype.setNum= function(val){History.Create_NewPoint();this.createCellOnRowColCross();var fSetProperty=this._setProperty;var nRangeType=this._getRangeType();if(c_oRangeType.All==nRangeType){this.worksheet.getAllCol().setNum(val);fSetProperty=this._setPropertyNoEmpty}fSetProperty.call(this,function(row){if(c_oRangeType.All==nRangeType&&null==row.xfs)return;row.setNum(val)},function(col){col.setNum(val)},function(cell){cell.setNum(val)})};Range.prototype.shiftNumFormat=function(nShift,aDigitsCount){History.Create_NewPoint(); var bRes=false;this._setPropertyNoEmpty(null,null,function(cell,nRow0,nCol0,nRowStart,nColStart){bRes|=cell.shiftNumFormat(nShift,aDigitsCount[nCol0-nColStart])});return bRes};Range.prototype.setFont=function(val){History.Create_NewPoint();this.createCellOnRowColCross();var fSetProperty=this._setProperty;var nRangeType=this._getRangeType();if(c_oRangeType.All==nRangeType){this.worksheet.getAllCol().setFont(val);fSetProperty=this._setPropertyNoEmpty}fSetProperty.call(this,function(row){if(c_oRangeType.All== nRangeType&&null==row.xfs)return;row.setFont(val)},function(col){col.setFont(val)},function(cell){cell.setFont(val)})};Range.prototype.setFontname=function(val){History.Create_NewPoint();this.createCellOnRowColCross();var fSetProperty=this._setProperty;var nRangeType=this._getRangeType();if(c_oRangeType.All==nRangeType){this.worksheet.getAllCol().setFontname(val);fSetProperty=this._setPropertyNoEmpty}fSetProperty.call(this,function(row){if(c_oRangeType.All==nRangeType&&null==row.xfs)return;row.setFontname(val)}, function(col){col.setFontname(val)},function(cell){cell.setFontname(val)})};Range.prototype.setFontsize=function(val){History.Create_NewPoint();this.createCellOnRowColCross();var fSetProperty=this._setProperty;var nRangeType=this._getRangeType();if(c_oRangeType.All==nRangeType){this.worksheet.getAllCol().setFontsize(val);fSetProperty=this._setPropertyNoEmpty}fSetProperty.call(this,function(row){if(c_oRangeType.All==nRangeType&&null==row.xfs)return;row.setFontsize(val)},function(col){col.setFontsize(val)}, function(cell){cell.setFontsize(val)})};Range.prototype.setFontcolor=function(val){History.Create_NewPoint();this.createCellOnRowColCross();var fSetProperty=this._setProperty;var nRangeType=this._getRangeType();if(c_oRangeType.All==nRangeType){this.worksheet.getAllCol().setFontcolor(val);fSetProperty=this._setPropertyNoEmpty}fSetProperty.call(this,function(row){if(c_oRangeType.All==nRangeType&&null==row.xfs)return;row.setFontcolor(val)},function(col){col.setFontcolor(val)},function(cell){cell.setFontcolor(val)})}; Range.prototype.setBold=function(val){History.Create_NewPoint();this.createCellOnRowColCross();var fSetProperty=this._setProperty;var nRangeType=this._getRangeType();if(c_oRangeType.All==nRangeType){this.worksheet.getAllCol().setBold(val);fSetProperty=this._setPropertyNoEmpty}fSetProperty.call(this,function(row){if(c_oRangeType.All==nRangeType&&null==row.xfs)return;row.setBold(val)},function(col){col.setBold(val)},function(cell){cell.setBold(val)})};Range.prototype.setItalic=function(val){History.Create_NewPoint(); this.createCellOnRowColCross();var fSetProperty=this._setProperty;var nRangeType=this._getRangeType();if(c_oRangeType.All==nRangeType){this.worksheet.getAllCol().setItalic(val);fSetProperty=this._setPropertyNoEmpty}fSetProperty.call(this,function(row){if(c_oRangeType.All==nRangeType&&null==row.xfs)return;row.setItalic(val)},function(col){col.setItalic(val)},function(cell){cell.setItalic(val)})};Range.prototype.setUnderline=function(val){History.Create_NewPoint();this.createCellOnRowColCross();var fSetProperty= this._setProperty;var nRangeType=this._getRangeType();if(c_oRangeType.All==nRangeType){this.worksheet.getAllCol().setUnderline(val);fSetProperty=this._setPropertyNoEmpty}fSetProperty.call(this,function(row){if(c_oRangeType.All==nRangeType&&null==row.xfs)return;row.setUnderline(val)},function(col){col.setUnderline(val)},function(cell){cell.setUnderline(val)})};Range.prototype.setStrikeout=function(val){History.Create_NewPoint();this.createCellOnRowColCross();var fSetProperty=this._setProperty;var nRangeType= this._getRangeType();if(c_oRangeType.All==nRangeType){this.worksheet.getAllCol().setStrikeout(val);fSetProperty=this._setPropertyNoEmpty}fSetProperty.call(this,function(row){if(c_oRangeType.All==nRangeType&&null==row.xfs)return;row.setStrikeout(val)},function(col){col.setStrikeout(val)},function(cell){cell.setStrikeout(val)})};Range.prototype.setFontAlign=function(val){History.Create_NewPoint();this.createCellOnRowColCross();var fSetProperty=this._setProperty;var nRangeType=this._getRangeType();if(c_oRangeType.All== nRangeType){this.worksheet.getAllCol().setFontAlign(val);fSetProperty=this._setPropertyNoEmpty}fSetProperty.call(this,function(row){if(c_oRangeType.All==nRangeType&&null==row.xfs)return;row.setFontAlign(val)},function(col){col.setFontAlign(val)},function(cell){cell.setFontAlign(val)})};Range.prototype.setAlignVertical=function(val){History.Create_NewPoint();this.createCellOnRowColCross();var fSetProperty=this._setProperty;var nRangeType=this._getRangeType();if(c_oRangeType.All==nRangeType){this.worksheet.getAllCol().setAlignVertical(val); fSetProperty=this._setPropertyNoEmpty}fSetProperty.call(this,function(row){if(c_oRangeType.All==nRangeType&&null==row.xfs)return;row.setAlignVertical(val)},function(col){col.setAlignVertical(val)},function(cell){cell.setAlignVertical(val)})};Range.prototype.setAlignHorizontal=function(val){History.Create_NewPoint();this.createCellOnRowColCross();var fSetProperty=this._setProperty;var nRangeType=this._getRangeType();if(c_oRangeType.All==nRangeType){this.worksheet.getAllCol().setAlignHorizontal(val); fSetProperty=this._setPropertyNoEmpty}fSetProperty.call(this,function(row){if(c_oRangeType.All==nRangeType&&null==row.xfs)return;row.setAlignHorizontal(val)},function(col){col.setAlignHorizontal(val)},function(cell){cell.setAlignHorizontal(val)})};Range.prototype.setFill=function(val){History.Create_NewPoint();this.createCellOnRowColCross();var fSetProperty=this._setProperty;var nRangeType=this._getRangeType();if(c_oRangeType.All==nRangeType){this.worksheet.getAllCol().setFill(val);fSetProperty=this._setPropertyNoEmpty}fSetProperty.call(this, function(row){if(c_oRangeType.All==nRangeType&&null==row.xfs)return;row.setFill(val)},function(col){col.setFill(val)},function(cell){cell.setFill(val)})};Range.prototype.setFillColor=function(val){var fill=new AscCommonExcel.Fill;fill.fromColor(val);return this.setFill(fill)};Range.prototype.setBorderSrc=function(border){History.Create_NewPoint();History.StartTransaction();if(null==border)border=new Border;this.createCellOnRowColCross();var fSetProperty=this._setProperty;var nRangeType=this._getRangeType(); if(c_oRangeType.All==nRangeType){this.worksheet.getAllCol().setBorder(border.clone());fSetProperty=this._setPropertyNoEmpty}fSetProperty.call(this,function(row){if(c_oRangeType.All==nRangeType&&null==row.xfs)return;row.setBorder(border.clone())},function(col){col.setBorder(border.clone())},function(cell){cell.setBorder(border.clone())});History.EndTransaction()};Range.prototype._setBorderMerge=function(bLeft,bTop,bRight,bBottom,oNewBorder,oCurBorder){var oTargetBorder=new Border;if(bLeft)oTargetBorder.l= oNewBorder.l;else oTargetBorder.l=oNewBorder.iv;if(bTop)oTargetBorder.t=oNewBorder.t;else oTargetBorder.t=oNewBorder.ih;if(bRight)oTargetBorder.r=oNewBorder.r;else oTargetBorder.r=oNewBorder.iv;if(bBottom)oTargetBorder.b=oNewBorder.b;else oTargetBorder.b=oNewBorder.ih;oTargetBorder.d=oNewBorder.d;oTargetBorder.dd=oNewBorder.dd;oTargetBorder.du=oNewBorder.du;var oRes=null;if(null!=oCurBorder){oCurBorder.mergeInner(oTargetBorder);oRes=oCurBorder}else oRes=oTargetBorder;return oRes};Range.prototype._setCellBorder= function(bbox,cell,oNewBorder){if(null==oNewBorder)cell.setBorder(oNewBorder);else{var oCurBorder=null;if(null!=cell.xfs&&null!=cell.xfs.border)oCurBorder=cell.xfs.border.clone();else oCurBorder=g_oDefaultFormat.Border.clone();var nRow=cell.nRow;var nCol=cell.nCol;cell.setBorder(this._setBorderMerge(nCol==bbox.c1,nRow==bbox.r1,nCol==bbox.c2,nRow==bbox.r2,oNewBorder,oCurBorder))}};Range.prototype._setRowColBorder=function(bbox,rowcol,bRow,oNewBorder){if(null==oNewBorder)rowcol.setBorder(oNewBorder); else{var oCurBorder=null;if(null!=rowcol.xfs&&null!=rowcol.xfs.border)oCurBorder=rowcol.xfs.border.clone();var bLeft,bTop,bRight,bBottom=false;if(bRow){bTop=rowcol.index==bbox.r1;bBottom=rowcol.index==bbox.r2}else{bLeft=rowcol.index==bbox.c1;bRight=rowcol.index==bbox.c2}rowcol.setBorder(this._setBorderMerge(bLeft,bTop,bRight,bBottom,oNewBorder,oCurBorder))}};Range.prototype._setBorderEdge=function(bbox,oItemWithXfs,nRow,nCol,oNewBorder){var oCurBorder=null;if(null!=oItemWithXfs.xfs&&null!=oItemWithXfs.xfs.border)oCurBorder= oItemWithXfs.xfs.border;if(null!=oCurBorder){var oCurBorderProp=null;if(nCol==bbox.c1-1)oCurBorderProp=oCurBorder.r;else if(nRow==bbox.r1-1)oCurBorderProp=oCurBorder.b;else if(nCol==bbox.c2+1)oCurBorderProp=oCurBorder.l;else if(nRow==bbox.r2+1)oCurBorderProp=oCurBorder.t;var oNewBorderProp=null;if(null==oNewBorder)oNewBorderProp=new AscCommonExcel.BorderProp;else if(nCol==bbox.c1-1)oNewBorderProp=oNewBorder.l;else if(nRow==bbox.r1-1)oNewBorderProp=oNewBorder.t;else if(nCol==bbox.c2+1)oNewBorderProp= oNewBorder.r;else if(nRow==bbox.r2+1)oNewBorderProp=oNewBorder.b;if(null!=oNewBorderProp&&null!=oCurBorderProp&&c_oAscBorderStyles.None!=oCurBorderProp.s&&(null==oNewBorder||c_oAscBorderStyles.None!=oNewBorderProp.s)&&(oNewBorderProp.s!=oCurBorderProp.s||oNewBorderProp.getRgbOrNull()!=oCurBorderProp.getRgbOrNull())){var oTargetBorder=oCurBorder.clone();if(nCol==bbox.c1-1)oTargetBorder.r=new AscCommonExcel.BorderProp;else if(nRow==bbox.r1-1)oTargetBorder.b=new AscCommonExcel.BorderProp;else if(nCol== bbox.c2+1)oTargetBorder.l=new AscCommonExcel.BorderProp;else if(nRow==bbox.r2+1)oTargetBorder.t=new AscCommonExcel.BorderProp;oItemWithXfs.setBorder(oTargetBorder)}}};Range.prototype.setBorder=function(border){History.Create_NewPoint();var _this=this;var oBBox=this.bbox;this.createCellOnRowColCross();var fSetProperty=this._setProperty;var nRangeType=this._getRangeType();if(c_oRangeType.All==nRangeType){var oAllCol=this.worksheet.getAllCol();_this._setRowColBorder(oBBox,oAllCol,false,border);fSetProperty= this._setPropertyNoEmpty}fSetProperty.call(this,function(row){if(c_oRangeType.All==nRangeType&&null==row.xfs)return;_this._setRowColBorder(oBBox,row,true,border)},function(col){_this._setRowColBorder(oBBox,col,false,border)},function(cell){_this._setCellBorder(oBBox,cell,border)});var aEdgeBorders=[];if(oBBox.c1>0&&(null==border||!border.l.isEmpty()))aEdgeBorders.push(this.worksheet.getRange3(oBBox.r1,oBBox.c1-1,oBBox.r2,oBBox.c1-1));if(oBBox.r1>0&&(null==border||!border.t.isEmpty()))aEdgeBorders.push(this.worksheet.getRange3(oBBox.r1- 1,oBBox.c1,oBBox.r1-1,oBBox.c2));if(oBBox.c21){var left=this.getBorder(nRow,nCol-1);if(c_oAscBorderStyles.None!==left.r.s)borders.l=left.r}if(c_oAscBorderStyles.None===borders.t.s)if(nRow>1){var top=this.getBorder(nRow-1,nCol);if(c_oAscBorderStyles.None!==top.b.s)borders.t=top.b}if(c_oAscBorderStyles.None===borders.r.s){var right=this.getBorder(nRow,nCol+1);if(c_oAscBorderStyles.None!==right.l.s)borders.r=right.l}if(c_oAscBorderStyles.None===borders.b.s){var bottom=this.getBorder(nRow+1,nCol);if(c_oAscBorderStyles.None!== bottom.t.s)borders.b=bottom.t}return borders};Range.prototype.getAlign=function(){var t=this;var nRow=this.bbox.r1;var nCol=this.bbox.c1;var align=g_oDefaultFormat.Align;this.worksheet._getCellNoEmpty(nRow,nCol,function(cell){var xfs=cell?cell.getCompiledStyle():t.worksheet.getCompiledStyle(nRow,nCol);if(null!=xfs&&null!=xfs.align)align=xfs.align});return align};Range.prototype.hasMerged=function(){var res=this.worksheet.mergeManager.getAny(this.bbox);return res?res.bbox:null};Range.prototype.mergeOpen= function(){this.worksheet.mergeManager.add(this.bbox,1)};Range.prototype.merge=function(type){if(null==type)type=Asc.c_oAscMergeOptions.Merge;var oBBox=this.bbox;History.Create_NewPoint();History.StartTransaction();if(oBBox.r1==oBBox.r2&&oBBox.c1==oBBox.c2){if(type==Asc.c_oAscMergeOptions.MergeCenter)this.setAlignHorizontal(AscCommon.align_Center);History.EndTransaction();return}if(this.hasMerged()){this.unmerge();if(type==Asc.c_oAscMergeOptions.MergeCenter){this.setAlignHorizontal(null);History.EndTransaction(); return}}var oLeftBorder=null;var oTopBorder=null;var oRightBorder=null;var oBottomBorder=null;var nRangeType=this._getRangeType(oBBox);if(c_oRangeType.Range==nRangeType){var oThis=this;var fGetBorder=function(bRow,v1,v2,v3,type){var oRes=null;for(var i=v1;i<=v2;++i){var bNeedDelete=true;oThis.worksheet._getCellNoEmpty(bRow?v3:i,bRow?i:v3,function(cell){if(null!=cell&&null!=cell.xfs&&null!=cell.xfs.border){var border=cell.xfs.border;var oBorderProp;switch(type){case 1:oBorderProp=border.l;break;case 2:oBorderProp= border.t;break;case 3:oBorderProp=border.r;break;case 4:oBorderProp=border.b;break}if(false==oBorderProp.isEmpty())if(null==oRes){oRes=oBorderProp;bNeedDelete=false}else if(true==oRes.isEqual(oBorderProp))bNeedDelete=false}});if(bNeedDelete){oRes=null;break}}return oRes};oLeftBorder=fGetBorder(false,oBBox.r1,oBBox.r2,oBBox.c1,1);oTopBorder=fGetBorder(true,oBBox.c1,oBBox.c2,oBBox.r1,2);oRightBorder=fGetBorder(false,oBBox.r1,oBBox.r2,oBBox.c2,3);oBottomBorder=fGetBorder(true,oBBox.c1,oBBox.c2,oBBox.r2, 4)}else if(c_oRangeType.Row==nRangeType){this.worksheet._getRowNoEmpty(oBBox.r1,function(row){if(row&&null!=row.xfs&&null!=row.xfs.border&&false==row.xfs.border.t.isEmpty())oTopBorder=row.xfs.border.t});if(oBBox.r1!=oBBox.r2)this.worksheet._getRowNoEmpty(oBBox.r2,function(row){if(row&&null!=row.xfs&&null!=row.xfs.border&&false==row.xfs.border.b.isEmpty())oBottomBorder=row.xfs.border.b})}else{var oLeftCol=this.worksheet._getColNoEmptyWithAll(oBBox.c1);if(null!=oLeftCol&&null!=oLeftCol.xfs&&null!=oLeftCol.xfs.border&& false==oLeftCol.xfs.border.l.isEmpty())oLeftBorder=oLeftCol.xfs.border.l;if(oBBox.c1!=oBBox.c2){var oRightCol=this.worksheet._getColNoEmptyWithAll(oBBox.c2);if(null!=oRightCol&&null!=oRightCol.xfs&&null!=oRightCol.xfs.border&&false==oRightCol.xfs.border.r.isEmpty())oRightBorder=oRightCol.xfs.border.r}}var bFirst=true;var oLeftTopCellStyle=null;var oFirstCellStyle=null;var oFirstCellValue=null;var oFirstCellRow=null;var oFirstCellCol=null;var oFirstCellHyperlink=null;this._setPropertyNoEmpty(null, null,function(cell,nRow0,nCol0,nRowStart,nColStart){if(bFirst&&false==cell.isNullText()){bFirst=false;oFirstCellStyle=cell.getStyle();oFirstCellValue=cell.getValueData();oFirstCellRow=cell.nRow;oFirstCellCol=cell.nCol}if(nRow0==nRowStart&&nCol0==nColStart)oLeftTopCellStyle=cell.getStyle()});var aHyperlinks=this.worksheet.hyperlinkManager.get(oBBox);var aHyperlinksToRestore=[];for(var i=0,length=aHyperlinks.inner.length;i0)return aHyperlinks[0].hyperlink;return null}; Range.prototype.getHyperlinks=function(){return this._getHyperlinks()};Range.prototype.setHyperlinkOpen=function(val){if(null!=val&&false==val.isValid())return;this.worksheet.hyperlinkManager.add(val.Ref.getBBox0(),val)};Range.prototype.setHyperlink=function(val,bWithoutStyle){if(null!=val&&false==val.isValid())return;var i,length,hyp;var bExist=false;var aHyperlinks=this.worksheet.hyperlinkManager.get(this.bbox);for(i=0,length=aHyperlinks.all.length;i0)return null;var aHyperlink=this.worksheet.hyperlinkManager.get(rangeEdge.bbox);if(aHyperlink.all.length>0)return null;var bError=rangeEdge._setPropertyNoEmpty(null,function(col){if(null!=col){if(null!=col&& null!=col.xfs&&null!=col.xfs.fill&&col.xfs.fill.notEmpty())return true;aColsToDelete.push(col)}},function(cell){if(null!=cell){if(null!=cell.xfs&&null!=cell.xfs.fill&&cell.xfs.fill.notEmpty())return true;if(!cell.isNullText())return true;aCellsToDelete.push(cell.nRow,cell.nCol)}});if(bError)return null}return{aColsToDelete:aColsToDelete,aCellsToDelete:aCellsToDelete}};Range.prototype._shiftLeftRight=function(bLeft,preDeleteAction,displayNameFormatTable){var canShiftRes=this._canShiftLeftRight(bLeft); if(null===canShiftRes)return false;if(preDeleteAction)preDeleteAction();var i,length,colIndex;for(i=0,length=canShiftRes.aColsToDelete.length;i0){var bChanged=false;for(i=0,length=aMerged.outer.length;i0)return null;var aHyperlink=this.worksheet.hyperlinkManager.get(rangeEdge.bbox);if(aHyperlink.all.length> 0)return null;var bError=rangeEdge._setPropertyNoEmpty(function(row){if(null!=row){if(null!=row.xfs&&null!=row.xfs.fill&&row.xfs.fill.notEmpty())return true;aRowsToDelete.push(row.index)}},null,function(cell){if(null!=cell){if(null!=cell.xfs&&null!=cell.xfs.fill&&cell.xfs.fill.notEmpty())return true;if(!cell.isNullText())return true;aCellsToDelete.push(cell.nRow,cell.nCol)}});if(bError)return null}return{aRowsToDelete:aRowsToDelete,aCellsToDelete:aCellsToDelete}};Range.prototype._shiftUpDown=function(bUp, preDeleteAction,displayNameFormatTable){var canShiftRes=this._canShiftUpDown(bUp);if(null===canShiftRes)return false;if(preDeleteAction)preDeleteAction();var i,length,rowIndex;for(i=0,length=canShiftRes.aRowsToDelete.length;i 0){var bChanged=false;for(i=0,length=aMerged.outer.length;i0||aMerged.inner.length>0&&null==_isSameSizeMerged(bbox,aMerged.inner,true))return null;var nMergedWidth=1;var nMergedHeight=1;if(aMerged.inner.length>0){var merged=aMerged.inner[0];if(opt_by_row){nMergedWidth=merged.bbox.c2-merged.bbox.c1+1;nStartRowCol= merged.bbox.r1}else{nMergedHeight=merged.bbox.r2-merged.bbox.r1+1;nStartRowCol=merged.bbox.c1}}this.worksheet.workbook.dependencyFormulas.lockRecal();var oRes=null;var oThis=this;var bAscent=false;if(nOption==Asc.c_oAscSortOptions.Ascending)bAscent=true;var elemObj=this._getSortElems(bbox,nStartRowCol,nOption,sortColor,opt_by_row,opt_custom_sort);var aSortElems=elemObj.aSortElems;var nColFirst0=elemObj.nColFirst0;var nRowFirst0=elemObj.nRowFirst0;var nLastRow0=elemObj.nLastRow0;var nLastCol0=elemObj.nLastCol0; var aSortData=[];var nHiddenCount=0;var oFromArray={};var nNewIndex,oNewElem,i,length;var nColMax=0,nRowMax=0;var nColMin=gc_nMaxCol0,nRowMin=gc_nMaxRow0;var nToMax=0;for(i=0,length=aSortElems.length;iitem.col)nColMin=item.col;if(nColMin>nNewIndex)nColMin=nNewIndex}else{nNewIndex=i*nMergedHeight+nRowFirst0+nHiddenCount;while(false!=oThis.worksheet.getRowHidden(nNewIndex)){nHiddenCount++;nNewIndex=i*nMergedHeight+nRowFirst0+nHiddenCount}oNewElem=new UndoRedoData_FromToRowCol(true,item.row,nNewIndex);oFromArray[item.row]=1;if(nRowMax item.row)nRowMin=item.row;if(nRowMin>nNewIndex)nRowMin=nNewIndex}if(nToMax0){var nRowColMin=opt_by_row?nColMin:nRowMin;var nRowColMax=opt_by_row?nColMax:nRowMax;var hiddenFunc=opt_by_row?oThis.worksheet.getColHidden:oThis.worksheet.getRowHidden;for(i=nRowColMin;i<=nRowColMax;++i)if(null==oFromArray[i]&&false==hiddenFunc.apply(oThis.worksheet,[i])){var nFrom=i;var nTo=++nToMax;while(false!=hiddenFunc.apply(oThis.worksheet, [nTo]))nTo=++nToMax;if(nFrom!=nTo){oNewElem=new UndoRedoData_FromToRowCol(false,nFrom,nTo);aSortData.push(oNewElem)}}History.Create_NewPoint();var oSelection=History.GetSelection();if(null!=oSelection){oSelection=oSelection.clone();oSelection.assign(nColFirst0,nRowFirst0,nLastCol0,nLastRow0);History.SetSelection(oSelection);History.SetSelectionRedo(oSelection)}var oUndoRedoBBox=new UndoRedoData_BBox({r1:nRowFirst0,c1:nColFirst0,r2:nLastRow0,c2:nLastCol0});oRes=new AscCommonExcel.UndoRedoData_SortData(oUndoRedoBBox, aSortData,opt_by_row);this._sortByArray(oUndoRedoBBox,aSortData,null,opt_by_row);var range=opt_by_row?new Asc.Range(nColFirst0,0,nLastCol0,gc_nMaxRow0):new Asc.Range(0,nRowFirst0,gc_nMaxCol0,nLastRow0);History.Add(AscCommonExcel.g_oUndoRedoWorksheet,AscCH.historyitem_Worksheet_Sort,this.worksheet.getId(),range,oRes)}this.worksheet.workbook.dependencyFormulas.unlockRecal();return oRes};Range.prototype._getSortElems=function(bbox,nStartRowCol,nOption,sortColor,opt_by_row,opt_custom_sort){var oThis= this;var bAscent=false;if(nOption==Asc.c_oAscSortOptions.Ascending)bAscent=true;var colorFill=nOption===Asc.c_oAscSortOptions.ByColorFill;var colorText=nOption===Asc.c_oAscSortOptions.ByColorFont;var isSortColor=colorFill||colorText;var nRowFirst0=bbox.r1;var nRowLast0=bbox.r2;var nColFirst0=bbox.c1;var nColLast0=bbox.c2;var bWholeCol=false;var bWholeRow=false;if(0==nRowFirst0&&gc_nMaxRow0==nRowLast0)bWholeCol=true;if(0==nColFirst0&&gc_nMaxCol0==nColLast0)bWholeRow=true;var sortConditions,caseSensitive; if(opt_custom_sort&&opt_custom_sort.SortConditions){sortConditions=opt_custom_sort.SortConditions;nStartRowCol=opt_by_row?sortConditions[0].Ref.r1:sortConditions[0].Ref.c1;bAscent=!sortConditions[0].ConditionDescending}if(opt_custom_sort);var nLastRow0,nLastCol0;if(opt_by_row){var oRangeRow=this.worksheet.getRange(new CellAddress(nStartRowCol,nColFirst0,0),new CellAddress(nStartRowCol,nColLast0,0));nLastRow0=nRowLast0;nLastCol0=0;if(true==bWholeCol){nLastRow0=0;this._foreachColNoEmpty(null,function(cell){var nCurRow0= cell.nRow;if(nCurRow0>nLastRow0)nLastRow0=nCurRow0})}}else{var oRangeCol=this.worksheet.getRange(new CellAddress(nRowFirst0,nStartRowCol,0),new CellAddress(nRowLast0,nStartRowCol,0));nLastRow0=0;nLastCol0=nColLast0;if(true==bWholeRow){nLastCol0=0;this._foreachRowNoEmpty(null,function(cell){var nCurCol0=cell.nCol;if(nCurCol0>nLastCol0)nLastCol0=nCurCol0})}}var aMerged=this.worksheet.mergeManager.get(this.bbox);var checkMerged=function(_cell){var res=null;if(aMerged&&aMerged.inner&&aMerged.inner.length> 0)for(var i=0;istr2?1:-1}var colorFillCmp=function(color1,color2,_customCellColor){var res=false;if(colorFill||_customCellColor===true)res=color1!==null&&color2!==null&&color1.rgb===color2.rgb||color1===color2;else if((colorText||_customCellColor===false)&&color1&&color1.length)for(var n=0;n0)for(i=0,length=aSortedHyperlinks.length;i< length;i++){hyp=aSortedHyperlinks[i];this.worksheet.hyperlinkManager.add(hyp.Ref.getBBox0(),hyp)}History.LocalChange=false}};function _isSameSizeMerged(bbox,aMerged,checkProportion){var oRes=null;var nWidth=null;var nHeight=null;for(var i=0,length=aMerged.length;i=0&&nIndex=0&& nIndex0)oRes=null;else{var oMergedFrom=wsFrom.mergeManager.get(from);oRes.oMergedFrom=oMergedFrom;if(oMergedTo.inner.length>0){oRes.oMergedTo=oMergedTo;if(bIsPromote)if(oMergedFrom.inner.length>0){var oSizeFrom=_isSameSizeMerged(from,oMergedFrom.inner);var oSizeTo=_isSameSizeMerged(to,oMergedTo.inner);if(!(null!=oSizeFrom&&null!=oSizeTo&&oSizeTo.width==oSizeFrom.width&&oSizeTo.height==oSizeFrom.height))oRes=null}else oRes= null}}}return oRes}function preparePromoteFromTo(from,to){var bSuccess=true;if(to.isOneCell())to.setOffsetLast(new AscCommon.CellBase(from.r2-from.r1-(to.r2-to.r1),from.c2-from.c1-(to.c2-to.c1)));if(!from.isIntersect(to)){var bFromWholeCol=0==from.c1&&gc_nMaxCol0==from.c2;var bFromWholeRow=0==from.r1&&gc_nMaxRow0==from.r2;var bToWholeCol=0==to.c1&&gc_nMaxCol0==to.c2;var bToWholeRow=0==to.r1&&gc_nMaxRow0==to.r2;bSuccess=bFromWholeCol===bToWholeCol&&bFromWholeRow===bToWholeRow}else bSuccess=false;return bSuccess} function promoteFromTo(from,wsFrom,to,wsTo){var bVertical=true;var nIndex=1;var oCanPromote=_canPromote(from,wsFrom,to,wsTo,false,1,1,bVertical,nIndex);if(null!=oCanPromote){History.Create_NewPoint();var oSelection=History.GetSelection();if(null!=oSelection){oSelection=oSelection.clone();oSelection.assign(from.c1,from.r1,from.c2,from.r2);History.SetSelection(oSelection)}var oSelectionRedo=History.GetSelectionRedo();if(null!=oSelectionRedo){oSelectionRedo=oSelectionRedo.clone();oSelectionRedo.assign(to.c1, to.r1,to.c2,to.r2);History.SetSelectionRedo(oSelectionRedo)}wsTo.mergeManager.remove(to,true);_promoteFromTo(from,wsFrom,to,wsTo,false,oCanPromote,false,bVertical,nIndex)}}Range.prototype.canPromote=function(bCtrl,bVertical,nIndex){var oBBox=this.bbox;var nWidth=oBBox.c2-oBBox.c1+1;var nHeight=oBBox.r2-oBBox.r1+1;var bWholeCol=false;var bWholeRow=false;if(0==oBBox.r1&&gc_nMaxRow0==oBBox.r2)bWholeCol=true;if(0==oBBox.c1&&gc_nMaxCol0==oBBox.c2)bWholeRow=true;if(bWholeCol&&bWholeRow||true==bVertical&& bWholeCol||false==bVertical&&bWholeRow)return null;var oPromoteAscRange=null;if(0==nIndex)oPromoteAscRange=new Asc.Range(oBBox.c1,oBBox.r1,oBBox.c2,oBBox.r2);else if(bVertical)if(nIndex>0)if(nIndex>=nHeight)oPromoteAscRange=new Asc.Range(oBBox.c1,oBBox.r2+1,oBBox.c2,oBBox.r1+nIndex);else oPromoteAscRange=new Asc.Range(oBBox.c1,oBBox.r1+nIndex,oBBox.c2,oBBox.r2);else oPromoteAscRange=new Asc.Range(oBBox.c1,oBBox.r1+nIndex,oBBox.c2,oBBox.r1-1);else if(nIndex>0)if(nIndex>=nWidth)oPromoteAscRange=new Asc.Range(oBBox.c2+ 1,oBBox.r1,oBBox.c1+nIndex,oBBox.r2);else oPromoteAscRange=new Asc.Range(oBBox.c1+nIndex,oBBox.r1,oBBox.c2,oBBox.r2);else oPromoteAscRange=new Asc.Range(oBBox.c1+nIndex,oBBox.r1,oBBox.c1-1,oBBox.r2);return _canPromote(oBBox,this.worksheet,oPromoteAscRange,this.worksheet,true,nWidth,nHeight,bVertical,nIndex)};Range.prototype.promote=function(bCtrl,bVertical,nIndex,oCanPromote){if(!oCanPromote)oCanPromote=this.canPromote(bCtrl,bVertical,nIndex);var oBBox=this.bbox;var nWidth=oBBox.c2-oBBox.c1+1;var nHeight= oBBox.r2-oBBox.r1+1;History.Create_NewPoint();var oSelection=History.GetSelection();if(null!=oSelection){oSelection=oSelection.clone();oSelection.assign(oBBox.c1,oBBox.r1,oBBox.c2,oBBox.r2);History.SetSelection(oSelection)}var oSelectionRedo=History.GetSelectionRedo();if(null!=oSelectionRedo){oSelectionRedo=oSelectionRedo.clone();if(0==nIndex)oSelectionRedo.assign(oBBox.c1,oBBox.r1,oBBox.c2,oBBox.r2);else if(bVertical)if(nIndex>0)if(nIndex>=nHeight)oSelectionRedo.assign(oBBox.c1,oBBox.r1,oBBox.c2, oBBox.r1+nIndex);else oSelectionRedo.assign(oBBox.c1,oBBox.r1,oBBox.c2,oBBox.r1+nIndex-1);else oSelectionRedo.assign(oBBox.c1,oBBox.r1+nIndex,oBBox.c2,oBBox.r2);else if(nIndex>0)if(nIndex>=nWidth)oSelectionRedo.assign(oBBox.c1,oBBox.r1,oBBox.c1+nIndex,oBBox.r2);else oSelectionRedo.assign(oBBox.c1,oBBox.r1,oBBox.c1+nIndex-1,oBBox.r2);else oSelectionRedo.assign(oBBox.c1+nIndex,oBBox.r1,oBBox.c2,oBBox.r2);History.SetSelectionRedo(oSelectionRedo)}_promoteFromTo(oBBox,this.worksheet,oCanPromote.to,this.worksheet, true,oCanPromote,bCtrl,bVertical,nIndex)};function _promoteFromTo(from,wsFrom,to,wsTo,bIsPromote,oCanPromote,bCtrl,bVertical,nIndex){var wb=wsFrom.workbook;wb.dependencyFormulas.lockRecal();History.StartTransaction();var oldExcludeHiddenRows=wsFrom.bExcludeHiddenRows;if(wsFrom.autoFilters.bIsExcludeHiddenRows(from,wsFrom.selectionRange.activeCell))wsFrom.excludeHiddenRows(true);var toRange=wsTo.getRange3(to.r1,to.c1,to.r2,to.c2);var fromRange=wsFrom.getRange3(from.r1,from.c1,from.r2,from.c2);var bChangeRowColProp= false;var nLastCol=from.c2;if(0==from.c1&&gc_nMaxCol0==from.c2){var aRowProperties=[];nLastCol=0;fromRange._foreachRowNoEmpty(function(row){if(!row.isEmptyProp())aRowProperties.push({index:row.index-from.r1,prop:row.getHeightProp(),style:row.getStyle()})},function(cell){var nCurCol0=cell.nCol;if(nCurCol0>nLastCol)nLastCol=nCurCol0});if(aRowProperties.length>0){bChangeRowColProp=true;var nCurCount=0;var nCurIndex=0;while(true){for(var i=0,length=aRowProperties.length;ito.r2)break;else wsTo._getRow(nCurIndex,function(row){if(null!=propElem.style)row.setStyle(propElem.style);if(null!=propElem.prop){var oNewProps=propElem.prop;var oOldProps=row.getHeightProp();if(false===oOldProps.isEqual(oNewProps)){row.setHeightProp(oNewProps);History.Add(AscCommonExcel.g_oUndoRedoWorksheet,AscCH.historyitem_Worksheet_RowProp,wsTo.getId(),row._getUpdateRange(),new UndoRedoData_IndexSimpleProp(nCurIndex,true, oOldProps,oNewProps))}}})}nCurCount++;if(nCurIndex>to.r2)break}}}var nLastRow=from.r2;if(0==from.r1&&gc_nMaxRow0==from.r2){var aColProperties=[];nLastRow=0;fromRange._foreachColNoEmpty(function(col){if(!col.isEmpty())aColProperties.push({index:col.index-from.c1,prop:col.getWidthProp(),style:col.getStyle()})},function(cell){var nCurRow0=cell.nRow;if(nCurRow0>nLastRow)nLastRow=nCurRow0});if(aColProperties.length>0){bChangeRowColProp=true;var nCurCount=0;var nCurIndex=0;while(true){for(var i=0,length= aColProperties.length;ito.c2)break;else{var col=wsTo._getCol(nCurIndex);if(null!=propElem.style)col.setStyle(propElem.style);if(null!=propElem.prop){var oNewProps=propElem.prop;var oOldProps=col.getWidthProp();if(false==oOldProps.isEqual(oNewProps)){col.setWidthProp(oNewProps);wsTo.initColumn(col);History.Add(AscCommonExcel.g_oUndoRedoWorksheet,AscCH.historyitem_Worksheet_ColProp, wsTo.getId(),new Asc.Range(nCurIndex,0,nCurIndex,gc_nMaxRow0),new UndoRedoData_IndexSimpleProp(nCurIndex,false,oOldProps,oNewProps))}}}}nCurCount++;if(nCurIndex>to.c2)break}}}if(bChangeRowColProp)wb.handlers.trigger("changeWorksheetUpdate",wsTo.getId());if(nLastCol!=from.c2||nLastRow!=from.r2){var offset=new AscCommon.CellBase(nLastRow-from.r2,nLastCol-from.c2);toRange.setOffsetLast(offset);to=toRange.getBBox0();fromRange.setOffsetLast(offset);from=fromRange.getBBox0()}var nWidth=from.c2-from.c1+ 1;var nHeight=from.r2-from.r1+1;if(bIsPromote&&nIndex>=0&&(true==bVertical&&nHeight>nIndex||false==bVertical&&nWidth>nIndex))toRange.cleanText();else{if(bIsPromote)toRange.cleanAll();else toRange.cleanFormat();var bReverse=false;if(nIndex<0)bReverse=true;var oPromoteHelper=new PromoteHelper(bVertical,bReverse,from);fromRange._foreachNoEmpty(function(oCell,nRow0,nCol0,nRowStart0,nColStart0){if(null!=oCell){var nVal=null;var bDelimiter=false;var sPrefix=null;var padding=0;var bDate=false;if(bIsPromote)if(!oCell.isFormula()){var sValue= oCell.getValueWithoutFormat();if(""!=sValue){bDelimiter=true;var nType=oCell.getType();if(CellValueType.Number==nType||CellValueType.String==nType)if(CellValueType.Number==nType)nVal=sValue-0;else{var nEndIndex=sValue.length;for(var k=sValue.length-1;k>=0;--k){var sCurChart=sValue[k];if("0"<=sCurChart&&sCurChart<="9")nEndIndex--;else break}if(sValue.length!=nEndIndex){sPrefix=sValue.substring(0,nEndIndex);var sNumber=sValue.substring(nEndIndex);nVal=sNumber-0;padding=sNumber[0]==="0"?sNumber.length: 0}}if(null!=oCell.xfs&&null!=oCell.xfs.num&&null!=oCell.xfs.num.getFormat()){var numFormat=oNumFormatCache.get(oCell.xfs.num.getFormat());if(numFormat.isDateTimeFormat())bDate=true}if(null!=nVal)bDelimiter=false}}else bDelimiter=true;oPromoteHelper.add(nRow0-nRowStart0,nCol0-nColStart0,nVal,bDelimiter,sPrefix,padding,bDate,oCell.duplicate())}});var bCopy=false;if(bCtrl)bCopy=true;if(1==nWidth&&1==nHeight&&oPromoteHelper.isOnlyIntegerSequence())bCopy=!bCopy;oPromoteHelper.finishAdd(bCopy);var nStartRow, nEndRow,nStartCol,nEndCol,nColDx,bRowFirst;if(bVertical){nStartRow=to.c1;nEndRow=to.c2;bRowFirst=false;if(bReverse){nStartCol=to.r2;nEndCol=to.r1;nColDx=-1}else{nStartCol=to.r1;nEndCol=to.r2;nColDx=1}}else{nStartRow=to.r1;nEndRow=to.r2;bRowFirst=true;if(bReverse){nStartCol=to.c2;nEndCol=to.c1;nColDx=-1}else{nStartCol=to.c1;nEndCol=to.c2;nColDx=1}}var addedFormulasArray=[];var isAddFormulaArray=function(arrayRef){var res=false;for(var n=0;n 0)this.bs.WriteItem(c_oSer_CustomFilters.CustomFilters,function(){oThis.WriteCustomFiltersItems(customFilters.CustomFilters)})};this.WriteCustomFiltersItems=function(aCustomFilters){var oThis=this;for(var i=0,length=aCustomFilters.length;i0)this.bs.WriteItem(c_oSerStylesTypes.Dxfs,function(){oThis.WriteDxfs(oThis.aDxfs)});var aExtDxfs=[];var slicerStyles=this.PrepareSlicerStyles(wb.SlicerStyles,aExtDxfs);if(aExtDxfs.length>0)this.bs.WriteItem(c_oSerStylesTypes.ExtDxfs,function(){oThis.WriteDxfs(aExtDxfs)});this.bs.WriteItem(c_oSerStylesTypes.SlicerStyles, function(){oThis.WriteSlicerStyles(slicerStyles)});this.bs.WriteItem(c_oSerStylesTypes.NumFmts,function(){oThis.WriteNumFmts()})};this.WriteBorders=function(){var oThis=this;var elems=this.stylesForWrite.oBorderMap.elems;for(var i=0;i0)this.bs.WriteItem(c_oSerWorkbookTypes.PivotCaches,function(){oThis.WritePivotCaches(pivotCaches)});if(!this.oBinaryWorksheetsTableWriter.isCopyPaste)this.PrepareTableIds();this.PrepareSheetIds();var slicerCacheIndex=0;var slicerCaches={};var slicerCacheExtIndex=0;var slicerCachesExt={};this.oBinaryWorksheetsTableWriter.wb.forEach(function(ws){for(var i=0;i0)this.bs.WriteItem(c_oSerWorkbookTypes.SlicerCaches,function(){oThis.WriteSlicerCaches(slicerCaches,oThis.tableIds,oThis.sheetIds)});if(slicerCacheExtIndex>0)this.bs.WriteItem(c_oSerWorkbookTypes.SlicerCachesExt,function(){oThis.WriteSlicerCaches(slicerCachesExt, oThis.tableIds,oThis.sheetIds)});if(!this.isCopyPaste&&this.wb.externalReferences.length>0)this.bs.WriteItem(c_oSerWorkbookTypes.ExternalReferences,function(){oThis.WriteExternalReferences()});if(!this.isCopyPaste){var macros=this.wb.oApi.macros.GetData();if(macros)this.bs.WriteItem(c_oSerWorkbookTypes.JsaProject,function(){oThis.memory.WriteXmlString(macros)});if(this.wb.aComments.length>0)this.bs.WriteItem(c_oSerWorkbookTypes.Comments,function(){oThis.WriteComments(oThis.wb.aComments)});if(this.wb.connections)this.bs.WriteItem(c_oSerWorkbookTypes.Connections, function(){oThis.memory.WriteBuffer(oThis.wb.connections,0,oThis.wb.connections.length)})}};this.WriteWorkbookPr=function(){var oWorkbookPr=this.wb.WorkbookPr;if(null!=oWorkbookPr)if(null!=oWorkbookPr.Date1904){this.memory.WriteByte(c_oSerWorkbookPrTypes.Date1904);this.memory.WriteByte(c_oSerPropLenType.Byte);this.memory.WriteBool(oWorkbookPr.Date1904)}else if(null!=oWorkbookPr.DateCompatibility){this.memory.WriteByte(c_oSerWorkbookPrTypes.DateCompatibility);this.memory.WriteByte(c_oSerPropLenType.Byte); this.memory.WriteBool(oWorkbookPr.DateCompatibility)}else if(null!=oWorkbookPr.HidePivotFieldList){this.memory.WriteByte(c_oSerWorkbookPrTypes.HidePivotFieldList);this.memory.WriteByte(c_oSerPropLenType.Byte);this.memory.WriteBool(oWorkbookPr.HidePivotFieldList)}else if(null!=oWorkbookPr.ShowPivotChartFilter){this.memory.WriteByte(c_oSerWorkbookPrTypes.ShowPivotChartFilter);this.memory.WriteByte(c_oSerPropLenType.Byte);this.memory.WriteBool(oWorkbookPr.ShowPivotChartFilter)}};this.WriteBookViews= function(){var oThis=this;this.bs.WriteItem(c_oSerWorkbookTypes.WorkbookView,function(){oThis.WriteWorkbookView()})};this.WriteWorkbookView=function(){if(null!=this.wb.nActive){this.memory.WriteByte(c_oSerWorkbookViewTypes.ActiveTab);this.memory.WriteByte(c_oSerPropLenType.Long);this.memory.WriteLong(this.wb.nActive)}};this.WriteDefinedNames=function(){var oThis=this;var defNameList=this.wb.dependencyFormulas.saveDefName(this.isCopyPaste===false);var filterDefName="_xlnm._FilterDatabase";var tempMap= {};var printAreaDefName="Print_Area";var prefix="_xlnm.";if(null!=defNameList)for(var i=0;i0)this.bs.WriteItem(c_oSer_ExternalLinkTypes.SheetNames,function(){oThis.WriteExternalSheetNames(externalReference.SheetNames)});if(externalReference.DefinedNames.length>0)this.bs.WriteItem(c_oSer_ExternalLinkTypes.DefinedNames, function(){oThis.WriteExternalDefinedNames(externalReference.DefinedNames)});if(externalReference.SheetDataSet.length>0)this.bs.WriteItem(c_oSer_ExternalLinkTypes.SheetDataSet,function(){oThis.WriteExternalSheetDataSet(externalReference.SheetDataSet)})};this.WriteExternalSheetNames=function(sheetNames){for(var i=0;i0)for(var i=0;i0)for(var i=0;i0||null!=ws.oAllCol)this.bs.WriteItem(c_oSerWorksheetsTypes.Cols,function(){oThis.WriteWorksheetCols(ws)});this.bs.WriteItem(c_oSerWorksheetsTypes.SheetViews,function(){oThis.WriteSheetViews(ws)});if(null!==ws.sheetPr)this.bs.WriteItem(c_oSerWorksheetsTypes.SheetPr,function(){oThis.WriteSheetPr(ws.sheetPr)});this.bs.WriteItem(c_oSerWorksheetsTypes.SheetFormatPr, function(){oThis.WriteSheetFormatPr(ws)});if(null!=ws.PagePrintOptions){this.bs.WriteItem(c_oSerWorksheetsTypes.PageMargins,function(){oThis.WritePageMargins(ws.PagePrintOptions.asc_getPageMargins())});this.bs.WriteItem(c_oSerWorksheetsTypes.PageSetup,function(){oThis.WritePageSetup(ws.PagePrintOptions.asc_getPageSetup())});this.bs.WriteItem(c_oSerWorksheetsTypes.PrintOptions,function(){oThis.WritePrintOptions(ws.PagePrintOptions)})}this.bs.WriteItem(c_oSerWorksheetsTypes.SheetData,function(){oThis.bs.WriteItem(c_oSerWorksheetsTypes.XlsbPos, function(){oThis.memory.WriteULong(oThis.memory.GetCurPosition()+4);oThis.WriteSheetDataXLSB(ws)})});this.bs.WriteItem(c_oSerWorksheetsTypes.Hyperlinks,function(){oThis.WriteHyperlinks(ws)});this.bs.WriteItem(c_oSerWorksheetsTypes.MergeCells,function(){oThis.WriteMergeCells(ws)});if(ws.Drawings&&ws.Drawings.length)this.bs.WriteItem(c_oSerWorksheetsTypes.Drawings,function(){oThis.WriteDrawings(ws.Drawings)});if(ws.aComments.length>0)this.bs.WriteItem(c_oSerWorksheetsTypes.Comments,function(){oThis.WriteComments(ws.aComments, ws)});var oBinaryTableWriter;if(null!=ws.AutoFilter&&!this.isCopyPaste){oBinaryTableWriter=new BinaryTableWriter(this.memory,this.aDxfs,false,{});this.bs.WriteItem(c_oSerWorksheetsTypes.Autofilter,function(){oBinaryTableWriter.WriteAutoFilter(ws.AutoFilter)})}if(null!=ws.sortState&&!this.isCopyPaste){oBinaryTableWriter=new BinaryTableWriter(this.memory,this.aDxfs,false,{});this.bs.WriteItem(c_oSerWorksheetsTypes.SortState,function(){oBinaryTableWriter.WriteSortState(ws.sortState)})}if(null!=ws.TableParts&& ws.TableParts.length>0){oBinaryTableWriter=new BinaryTableWriter(this.memory,this.aDxfs,this.isCopyPaste,this.tableIds);this.bs.WriteItem(c_oSerWorksheetsTypes.TableParts,function(){oBinaryTableWriter.Write(ws.TableParts,ws)})}if(ws.aSparklineGroups.length>0)this.bs.WriteItem(c_oSerWorksheetsTypes.SparklineGroups,function(){oThis.WriteSparklineGroups(ws.aSparklineGroups)});for(i=0;i 0)this.bs.WriteItem(c_oSerWorksheetsTypes.Slicers,function(){oThis.WriteSlicers(slicers)});if(slicerExt.slicer.length>0)this.bs.WriteItem(c_oSerWorksheetsTypes.SlicersExt,function(){oThis.WriteSlicers(slicerExt)});if(null!==ws.headerFooter)this.bs.WriteItem(c_oSerWorksheetsTypes.HeaderFooter,function(){oThis.WriteHeaderFooter(ws.headerFooter)});if(null!==ws.rowBreaks)this.bs.WriteItem(c_oSerWorksheetsTypes.RowBreaks,function(){oThis.WriteRowColBreaks(ws.rowBreaks)});if(null!==ws.colBreaks)this.bs.WriteItem(c_oSerWorksheetsTypes.ColBreaks, function(){oThis.WriteRowColBreaks(ws.colBreaks)});if(null!==ws.legacyDrawingHF)this.bs.WriteItem(c_oSerWorksheetsTypes.LegacyDrawingHF,function(){oThis.WriteLegacyDrawingHF(ws.legacyDrawingHF)});if(null!==ws.picture){this.memory.WriteByte(c_oSerWorksheetsTypes.Picture);this.memory.WriteString2(ws.picture)}if(null!==ws.dataValidations)this.bs.WriteItem(c_oSerWorksheetsTypes.DataValidations,function(){oThis.WriteDataValidations(ws.dataValidations)});if(ws.aNamedSheetViews.length>0)this.bs.WriteItem(c_oSerWorksheetsTypes.NamedSheetView, function(){var namedSheetViews=new Asc.CT_NamedSheetViews;namedSheetViews.namedSheetView=ws.aNamedSheetViews;var old=new AscCommon.CMemory(true);pptx_content_writer.BinaryFileWriter.ExportToMemory(old);pptx_content_writer.BinaryFileWriter.ImportFromMemory(oThis.memory);pptx_content_writer.BinaryFileWriter.StartRecord(0);namedSheetViews.toStream(pptx_content_writer.BinaryFileWriter,oThis.tableIds);pptx_content_writer.BinaryFileWriter.EndRecord();pptx_content_writer.BinaryFileWriter.ExportToMemory(oThis.memory); pptx_content_writer.BinaryFileWriter.ImportFromMemory(old)})};this.WriteDataValidations=function(dataValidations){var oThis=this;if(null!=dataValidations.disablePrompts)this.bs.WriteItem(c_oSer_DataValidation.DisablePrompts,function(){oThis.memory.WriteBool(dataValidations.disablePrompts)});if(null!=dataValidations.xWindow)this.bs.WriteItem(c_oSer_DataValidation.XWindow,function(){oThis.memory.WriteLong(dataValidations.xWindow)});if(null!=dataValidations.yWindow)this.bs.WriteItem(c_oSer_DataValidation.YWindow, function(){oThis.memory.WriteLong(dataValidations.yWindow)});if(dataValidations.elems.length>0)this.bs.WriteItem(c_oSer_DataValidation.DataValidations,function(){for(var i=0;i0){oAllCol.Min=1;oAllCol.Max=nIndex;this.bs.WriteItem(c_oSerWorksheetsTypes.Col,function(){oThis.WriteWorksheetCol(oAllCol)})}if(null!=nPrevIndex&&(nPrevIndex+1!=nIndex||false==oPrevCol.isEqual(col))){var oColToWrite= fInitCol(oPrevCol,nPrevIndexStart+1,nPrevIndex+1);this.bs.WriteItem(c_oSerWorksheetsTypes.Col,function(){oThis.WriteWorksheetCol(oColToWrite)});nPrevIndexStart=null;if(null!=oAllCol&&nPrevIndex+1!=nIndex){oAllCol.Min=nPrevIndex+2;oAllCol.Max=nIndex;this.bs.WriteItem(c_oSerWorksheetsTypes.Col,function(){oThis.WriteWorksheetCol(oAllCol)})}}oPrevCol=col;nPrevIndex=nIndex;if(null==nPrevIndexStart)nPrevIndexStart=nPrevIndex}}if(null!=nPrevIndexStart&&null!=nPrevIndex&&null!=oPrevCol){var oColToWrite=fInitCol(oPrevCol, nPrevIndexStart+1,nPrevIndex+1);this.bs.WriteItem(c_oSerWorksheetsTypes.Col,function(){oThis.WriteWorksheetCol(oColToWrite)})}if(null!=oAllCol)if(null==nPrevIndex){oAllCol.Min=1;oAllCol.Max=gc_nMaxCol0+1;this.bs.WriteItem(c_oSerWorksheetsTypes.Col,function(){oThis.WriteWorksheetCol(oAllCol)})}else if(gc_nMaxCol0!=nPrevIndex){oAllCol.Min=nPrevIndex+2;oAllCol.Max=gc_nMaxCol0+1;this.bs.WriteItem(c_oSerWorksheetsTypes.Col,function(){oThis.WriteWorksheetCol(oAllCol)})}};this.WriteWorksheetCol=function(oTmpCol){var oCol= oTmpCol.col;if(null!=oCol.BestFit){this.memory.WriteByte(c_oSerWorksheetColTypes.BestFit);this.memory.WriteByte(c_oSerPropLenType.Byte);this.memory.WriteBool(oCol.BestFit)}if(oCol.hd){this.memory.WriteByte(c_oSerWorksheetColTypes.Hidden);this.memory.WriteByte(c_oSerPropLenType.Byte);this.memory.WriteBool(oCol.hd)}if(null!=oTmpCol.Max){this.memory.WriteByte(c_oSerWorksheetColTypes.Max);this.memory.WriteByte(c_oSerPropLenType.Long);this.memory.WriteLong(oTmpCol.Max)}if(null!=oTmpCol.Min){this.memory.WriteByte(c_oSerWorksheetColTypes.Min); this.memory.WriteByte(c_oSerPropLenType.Long);this.memory.WriteLong(oTmpCol.Min)}if(null!=oTmpCol.xfsid){this.memory.WriteByte(c_oSerWorksheetColTypes.Style);this.memory.WriteByte(c_oSerPropLenType.Long);this.memory.WriteLong(oTmpCol.xfsid)}if(null!=oTmpCol.width){this.memory.WriteByte(c_oSerWorksheetColTypes.Width);this.memory.WriteByte(c_oSerPropLenType.Double);this.memory.WriteDouble2(oTmpCol.width)}if(null!=oCol.CustomWidth){this.memory.WriteByte(c_oSerWorksheetColTypes.CustomWidth);this.memory.WriteByte(c_oSerPropLenType.Byte); this.memory.WriteBool(oCol.CustomWidth)}if(oCol.outlineLevel>0){this.memory.WriteByte(c_oSerWorksheetColTypes.OutLevel);this.memory.WriteByte(c_oSerPropLenType.Long);this.memory.WriteLong(oCol.outlineLevel)}if(oCol.collapsed){this.memory.WriteByte(c_oSerWorksheetColTypes.Collapsed);this.memory.WriteByte(c_oSerPropLenType.Byte);this.memory.WriteBool(true)}};this.WriteSheetViews=function(ws){var oThis=this;for(var i=0,length=ws.sheetViews.length;i0){this.memory.WriteByte(c_oSerSheetFormatPrTypes.OutlineLevelCol); this.memory.WriteByte(c_oSerPropLenType.Long);this.memory.WriteLong(ws.oSheetFormatPr.nOutlineLevelCol)}if(null!==ws.oSheetFormatPr.oAllRow){var oAllRow=ws.oSheetFormatPr.oAllRow;if(oAllRow.h){this.memory.WriteByte(c_oSerSheetFormatPrTypes.DefaultRowHeight);this.memory.WriteByte(c_oSerPropLenType.Double);this.memory.WriteDouble2(oAllRow.h)}if(oAllRow.getCustomHeight()){this.memory.WriteByte(c_oSerSheetFormatPrTypes.CustomHeight);this.memory.WriteByte(c_oSerPropLenType.Byte);this.memory.WriteBool(true)}if(oAllRow.getHidden()){this.memory.WriteByte(c_oSerSheetFormatPrTypes.ZeroHeight); this.memory.WriteByte(c_oSerPropLenType.Byte);this.memory.WriteBool(true)}if(oAllRow.getOutlineLevel()>0){this.memory.WriteByte(c_oSerSheetFormatPrTypes.OutlineLevelRow);this.memory.WriteByte(c_oSerPropLenType.Long);this.memory.WriteLong(oAllRow.getOutlineLevel())}}};this.WritePageMargins=function(oMargins){var dLeft=oMargins.asc_getLeft();if(null!=dLeft){this.memory.WriteByte(c_oSer_PageMargins.Left);this.memory.WriteByte(c_oSerPropLenType.Double);this.memory.WriteDouble2(dLeft)}var dTop=oMargins.asc_getTop(); if(null!=dTop){this.memory.WriteByte(c_oSer_PageMargins.Top);this.memory.WriteByte(c_oSerPropLenType.Double);this.memory.WriteDouble2(dTop)}var dRight=oMargins.asc_getRight();if(null!=dRight){this.memory.WriteByte(c_oSer_PageMargins.Right);this.memory.WriteByte(c_oSerPropLenType.Double);this.memory.WriteDouble2(dRight)}var dBottom=oMargins.asc_getBottom();if(null!=dBottom){this.memory.WriteByte(c_oSer_PageMargins.Bottom);this.memory.WriteByte(c_oSerPropLenType.Double);this.memory.WriteDouble2(dBottom)}var dHeader= oMargins.asc_getHeader();if(null!=dHeader){this.memory.WriteByte(c_oSer_PageMargins.Header);this.memory.WriteByte(c_oSerPropLenType.Double);this.memory.WriteDouble2(dHeader)}var dFooter=oMargins.asc_getFooter();if(null!=dFooter){this.memory.WriteByte(c_oSer_PageMargins.Footer);this.memory.WriteByte(c_oSerPropLenType.Double);this.memory.WriteDouble2(dFooter)}};this.WritePageSetup=function(oPageSetup){var dWidth=oPageSetup.asc_getWidth();var dHeight=oPageSetup.asc_getHeight();if(null!=dWidth&&null!= dHeight){var item=DocumentPageSize.getSizeByWH(dWidth,dHeight);this.memory.WriteByte(c_oSer_PageSetup.PaperSize);this.memory.WriteByte(c_oSerPropLenType.Byte);this.memory.WriteByte(item.id)}if(null!=oPageSetup.blackAndWhite){this.memory.WriteByte(c_oSer_PageSetup.BlackAndWhite);this.memory.WriteByte(c_oSerPropLenType.Byte);this.memory.WriteBool(oPageSetup.blackAndWhite)}if(null!=oPageSetup.cellComments){this.memory.WriteByte(c_oSer_PageSetup.CellComments);this.memory.WriteByte(c_oSerPropLenType.Byte); this.memory.WriteByte(oPageSetup.cellComments)}if(null!=oPageSetup.copies){this.memory.WriteByte(c_oSer_PageSetup.Copies);this.memory.WriteByte(c_oSerPropLenType.Long);this.memory.WriteLong(oPageSetup.copies)}if(null!=oPageSetup.draft){this.memory.WriteByte(c_oSer_PageSetup.Draft);this.memory.WriteByte(c_oSerPropLenType.Byte);this.memory.WriteBool(oPageSetup.draft)}if(null!=oPageSetup.errors){this.memory.WriteByte(c_oSer_PageSetup.Errors);this.memory.WriteByte(c_oSerPropLenType.Byte);this.memory.WriteByte(oPageSetup.errors)}if(null!= oPageSetup.firstPageNumber){this.memory.WriteByte(c_oSer_PageSetup.FirstPageNumber);this.memory.WriteByte(c_oSerPropLenType.Long);this.memory.WriteLong(oPageSetup.firstPageNumber)}if(null!=oPageSetup.fitToHeight){this.memory.WriteByte(c_oSer_PageSetup.FitToHeight);this.memory.WriteByte(c_oSerPropLenType.Long);this.memory.WriteLong(oPageSetup.fitToHeight)}if(null!=oPageSetup.fitToWidth){this.memory.WriteByte(c_oSer_PageSetup.FitToWidth);this.memory.WriteByte(c_oSerPropLenType.Long);this.memory.WriteLong(oPageSetup.fitToWidth)}if(null!= oPageSetup.horizontalDpi){this.memory.WriteByte(c_oSer_PageSetup.HorizontalDpi);this.memory.WriteByte(c_oSerPropLenType.Long);this.memory.WriteLong(oPageSetup.horizontalDpi)}var byteOrientation=oPageSetup.asc_getOrientation();if(null!=byteOrientation){var byteFormatOrientation=null;switch(byteOrientation){case c_oAscPageOrientation.PagePortrait:byteFormatOrientation=EPageOrientation.pageorientPortrait;break;case c_oAscPageOrientation.PageLandscape:byteFormatOrientation=EPageOrientation.pageorientLandscape; break}if(null!=byteFormatOrientation){this.memory.WriteByte(c_oSer_PageSetup.Orientation);this.memory.WriteByte(c_oSerPropLenType.Byte);this.memory.WriteByte(byteFormatOrientation)}}if(null!=oPageSetup.pageOrder){this.memory.WriteByte(c_oSer_PageSetup.PageOrder);this.memory.WriteByte(c_oSerPropLenType.Byte);this.memory.WriteByte(oPageSetup.pageOrder)}if(null!=oPageSetup.scale){this.memory.WriteByte(c_oSer_PageSetup.Scale);this.memory.WriteByte(c_oSerPropLenType.Long);this.memory.WriteLong(oPageSetup.scale)}if(null!= oPageSetup.useFirstPageNumber){this.memory.WriteByte(c_oSer_PageSetup.UseFirstPageNumber);this.memory.WriteByte(c_oSerPropLenType.Byte);this.memory.WriteBool(oPageSetup.useFirstPageNumber)}if(null!=oPageSetup.usePrinterDefaults){this.memory.WriteByte(c_oSer_PageSetup.UsePrinterDefaults);this.memory.WriteByte(c_oSerPropLenType.Byte);this.memory.WriteBool(oPageSetup.usePrinterDefaults)}if(null!=oPageSetup.verticalDpi){this.memory.WriteByte(c_oSer_PageSetup.VerticalDpi);this.memory.WriteByte(c_oSerPropLenType.Long); this.memory.WriteLong(oPageSetup.verticalDpi)}};this.WritePrintOptions=function(oPrintOptions){var bGridLines=oPrintOptions.asc_getGridLines();if(null!=bGridLines){this.memory.WriteByte(c_oSer_PrintOptions.GridLines);this.memory.WriteByte(c_oSerPropLenType.Byte);this.memory.WriteBool(bGridLines)}var bHeadings=oPrintOptions.asc_getHeadings();if(null!=bHeadings){this.memory.WriteByte(c_oSer_PrintOptions.Headings);this.memory.WriteByte(c_oSerPropLenType.Byte);this.memory.WriteBool(bHeadings)}};this.WriteHyperlinks= function(ws){var oThis=this;var oHyperlinks=ws.hyperlinkManager.getAll();for(var i in oHyperlinks){var elem=oHyperlinks[i];if(!this.isCopyPaste||this.isCopyPaste&&elem&&elem.bbox&&this.isCopyPaste.containsRange(elem.bbox))this.bs.WriteItem(c_oSerWorksheetsTypes.Hyperlink,function(){oThis.WriteHyperlink(elem.data)})}};this.WriteHyperlink=function(oHyperlink){if(null!=oHyperlink.Ref){this.memory.WriteByte(c_oSerHyperlinkTypes.Ref);this.memory.WriteString2(oHyperlink.Ref.getName())}if(null!=oHyperlink.Hyperlink){var sHyperlink= oHyperlink.Hyperlink.length>Asc.c_nMaxHyperlinkLength?this.Hyperlink.substring(0,Asc.c_nMaxHyperlinkLength):oHyperlink.Hyperlink;this.memory.WriteByte(c_oSerHyperlinkTypes.Hyperlink);this.memory.WriteString2(sHyperlink)}if(null!==oHyperlink.getLocation()){this.memory.WriteByte(c_oSerHyperlinkTypes.Location);this.memory.WriteString2(oHyperlink.getLocation())}if(null!=oHyperlink.Tooltip){this.memory.WriteByte(c_oSerHyperlinkTypes.Tooltip);this.memory.WriteString2(oHyperlink.Tooltip)}};this.WriteMergeCells= function(ws){var i,names,bboxes;if(!this.isCopyPaste&&ws.mergeManager.initData){names=ws.mergeManager.initData;for(i=0;i0)this.bs.WriteItem(c_oSer_CommentData.Replies,function(){oThis.WriteReplies(aReplies)})};this.WriteReplies=function(aReplies){var oThis=this;for(var i=0,length=aReplies.length;i0)for(i=0;i0)this.WriteTable(c_oSerTableTypes.PersonList, new BinaryPersonTableWriter(this.Memory,personList));if(!this.isCopyPaste)this.WriteTable(c_oSerTableTypes.Other,new BinaryOtherTableWriter(this.Memory,this.wb));this.WriteReserved(new BinarySharedStringsTableWriter(this.Memory,this.wb,oSharedStrings,oBinaryStylesTableWriter),nSharedStringsPos);this.WriteReserved(oBinaryStylesTableWriter,nStylesTablePos);this.Memory.Seek(nStart);this.Memory.WriteByte(this.nRealTableCount);this.Memory.Seek(this.nLastFilePos)};this.WriteTable=function(type,oTableSer){this.Memory.WriteByte(type); this.Memory.WriteLong(this.nLastFilePos);var nCurPos=this.Memory.GetCurPosition();this.Memory.Seek(this.nLastFilePos);oTableSer.Write();this.nLastFilePos=this.Memory.GetCurPosition();this.Memory.Seek(nCurPos);this.nRealTableCount++};this.ReserveTable=function(type){var res=0;this.Memory.WriteByte(type);res=this.Memory.GetCurPosition();this.Memory.WriteLong(this.nLastFilePos);return res};this.WriteReserved=function(oTableSer,nPos){this.Memory.Seek(nPos);this.Memory.WriteLong(this.nLastFilePos);var nCurPos= this.Memory.GetCurPosition();this.Memory.Seek(this.nLastFilePos);oTableSer.Write();this.nLastFilePos=this.Memory.GetCurPosition();this.Memory.Seek(nCurPos);this.nRealTableCount++}}function Binary_TableReader(stream,oReadResult,ws,Dxfs){this.stream=stream;this.ws=ws;this.Dxfs=Dxfs;this.bcr=new Binary_CommonReader(this.stream);this.oReadResult=oReadResult;this.Read=function(length,aTables){var res=c_oSerConstants.ReadOk;var oThis=this;res=this.bcr.Read1(length,function(t,l){return oThis.ReadTables(t, l,aTables)});return res};this.ReadTables=function(type,length,aTables){var res=c_oSerConstants.ReadOk;var oThis=this;if(c_oSer_TablePart.Table==type){var oNewTable=this.ws.createTablePart();res=this.bcr.Read1(length,function(t,l){return oThis.ReadTable(t,l,oNewTable)});if(null!=oNewTable.Ref&&null!=oNewTable.DisplayName)this.ws.workbook.dependencyFormulas.addTableName(this.ws,oNewTable,true);aTables.push(oNewTable)}else res=c_oSerConstants.ReadUnknown;return res};this.ReadTable=function(type,length, oTable){var res=c_oSerConstants.ReadOk;var oThis=this;if(c_oSer_TablePart.Ref==type)oTable.Ref=AscCommonExcel.g_oRangeCache.getAscRange(this.stream.GetString2LE(length));else if(c_oSer_TablePart.HeaderRowCount==type)oTable.HeaderRowCount=this.stream.GetULongLE();else if(c_oSer_TablePart.TotalsRowCount==type)oTable.TotalsRowCount=this.stream.GetULongLE();else if(c_oSer_TablePart.DisplayName==type)oTable.DisplayName=this.stream.GetString2LE(length);else if(c_oSer_TablePart.AutoFilter==type){oTable.AutoFilter= new AscCommonExcel.AutoFilter;res=this.bcr.Read1(length,function(t,l){return oThis.ReadAutoFilter(t,l,oTable.AutoFilter)});if(!oTable.AutoFilter.Ref)oTable.AutoFilter.Ref=oTable.generateAutoFilterRef()}else if(c_oSer_TablePart.SortState==type){oTable.SortState=new AscCommonExcel.SortState;res=this.bcr.Read1(length,function(t,l){return oThis.ReadSortState(t,l,oTable.SortState)})}else if(c_oSer_TablePart.TableColumns==type){oTable.TableColumns=[];res=this.bcr.Read1(length,function(t,l){return oThis.ReadTableColumns(t, l,oTable.TableColumns)})}else if(c_oSer_TablePart.TableStyleInfo==type){oTable.TableStyleInfo=new AscCommonExcel.TableStyleInfo;res=this.bcr.Read2Spreadsheet(length,function(t,l){return oThis.ReadTableStyleInfo(t,l,oTable.TableStyleInfo)})}else if(c_oSer_TablePart.AltTextTable==type)res=this.bcr.Read1(length,function(t,l){return oThis.ReadAltTextTable(t,l,oTable)});else if(c_oSer_TablePart.Id==type)this.oReadResult.tableIds[this.stream.GetULongLE()]=oTable;else res=c_oSerConstants.ReadUnknown;return res}; this.ReadAltTextTable=function(type,length,oTable){var res=c_oSerConstants.ReadOk;var oThis=this;if(c_oSer_AltTextTable.AltText==type)oTable.altText=this.stream.GetString2LE(length);else if(c_oSer_AltTextTable.AltTextSummary==type)oTable.altTextSummary=this.stream.GetString2LE(length);else res=c_oSerConstants.ReadUnknown;return res};this.ReadAutoFilter=function(type,length,oAutoFilter){var res=c_oSerConstants.ReadOk;var oThis=this;if(c_oSer_AutoFilter.Ref==type)oAutoFilter.setStringRef(this.stream.GetString2LE(length)); else if(c_oSer_AutoFilter.FilterColumns==type){oAutoFilter.FilterColumns=[];res=this.bcr.Read1(length,function(t,l){return oThis.ReadFilterColumns(t,l,oAutoFilter.FilterColumns)})}else if(c_oSer_AutoFilter.SortState==type){oAutoFilter.SortState=new AscCommonExcel.SortState;res=this.bcr.Read1(length,function(t,l){return oThis.ReadSortState(t,l,oAutoFilter.SortState)})}else res=c_oSerConstants.ReadUnknown;return res};this.ReadFilterColumns=function(type,length,aFilterColumns){var res=c_oSerConstants.ReadOk; var oThis=this;if(c_oSer_AutoFilter.FilterColumn==type){var oFilterColumn=new AscCommonExcel.FilterColumn;res=this.bcr.Read1(length,function(t,l){return oThis.ReadFilterColumn(t,l,oFilterColumn)});aFilterColumns.push(oFilterColumn)}else res=c_oSerConstants.ReadUnknown;return res};this.ReadFilterColumn=function(type,length,oFilterColumn){var res=c_oSerConstants.ReadOk;var oThis=this;if(c_oSer_FilterColumn.ColId==type)oFilterColumn.ColId=this.stream.GetULongLE();else if(c_oSer_FilterColumn.Filters== type){oFilterColumn.Filters=new AscCommonExcel.Filters;res=this.bcr.Read1(length,function(t,l){return oThis.ReadFilters(t,l,oFilterColumn.Filters)});oFilterColumn.Filters.sortDate()}else if(c_oSer_FilterColumn.CustomFilters==type){oFilterColumn.CustomFiltersObj=new Asc.CustomFilters;res=this.bcr.Read1(length,function(t,l){return oThis.ReadCustomFilters(t,l,oFilterColumn.CustomFiltersObj)})}else if(c_oSer_FilterColumn.DynamicFilter==type){oFilterColumn.DynamicFilter=new Asc.DynamicFilter;res=this.bcr.Read2Spreadsheet(length, function(t,l){return oThis.ReadDynamicFilter(t,l,oFilterColumn.DynamicFilter)})}else if(c_oSer_FilterColumn.ColorFilter==type){oFilterColumn.ColorFilter=new Asc.ColorFilter;res=this.bcr.Read2Spreadsheet(length,function(t,l){return oThis.ReadColorFilter(t,l,oFilterColumn.ColorFilter)})}else if(c_oSer_FilterColumn.Top10==type){oFilterColumn.Top10=new Asc.Top10;res=this.bcr.Read2Spreadsheet(length,function(t,l){return oThis.ReadTop10(t,l,oFilterColumn.Top10)})}else if(c_oSer_FilterColumn.HiddenButton== type)oFilterColumn.ShowButton=!this.stream.GetBool();else if(c_oSer_FilterColumn.ShowButton==type)oFilterColumn.ShowButton=this.stream.GetBool();else res=c_oSerConstants.ReadUnknown;return res};this.ReadFilterColumnExternal=function(){var oThis=this;var oFilterColumn=new AscCommonExcel.FilterColumn;var length=this.stream.GetULongLE();var res=this.bcr.Read1(length,function(t,l){return oThis.ReadFilterColumn(t,l,oFilterColumn)});return oFilterColumn};this.ReadFilters=function(type,length,oFilters){var res= c_oSerConstants.ReadOk;var oThis=this;if(c_oSer_FilterColumn.Filter==type){var oFilterVal=new AscCommonExcel.Filter;res=this.bcr.Read1(length,function(t,l){return oThis.ReadFilter(t,l,oFilterVal)});if(null!=oFilterVal.Val)oFilters.Values[oFilterVal.Val]=1}else if(c_oSer_FilterColumn.DateGroupItem==type){var oDateGroupItem=new AscCommonExcel.DateGroupItem;res=this.bcr.Read2Spreadsheet(length,function(t,l){return oThis.ReadDateGroupItem(t,l,oDateGroupItem)});var autoFilterDateElem=new AscCommonExcel.AutoFilterDateElem; autoFilterDateElem.convertDateGroupItemToRange(oDateGroupItem);oFilters.Dates.push(autoFilterDateElem)}else if(c_oSer_FilterColumn.FiltersBlank==type)oFilters.Blank=this.stream.GetBool();else res=c_oSerConstants.ReadUnknown;return res};this.ReadFilter=function(type,length,oFilter){var res=c_oSerConstants.ReadOk;if(c_oSer_Filter.Val==type)oFilter.Val=this.stream.GetString2LE(length);else res=c_oSerConstants.ReadUnknown;return res};this.ReadDateGroupItem=function(type,length,oDateGroupItem){var res= c_oSerConstants.ReadOk;if(c_oSer_DateGroupItem.DateTimeGrouping==type)oDateGroupItem.DateTimeGrouping=this.stream.GetUChar();else if(c_oSer_DateGroupItem.Day==type)oDateGroupItem.Day=this.stream.GetULongLE();else if(c_oSer_DateGroupItem.Hour==type)oDateGroupItem.Hour=this.stream.GetULongLE();else if(c_oSer_DateGroupItem.Minute==type)oDateGroupItem.Minute=this.stream.GetULongLE();else if(c_oSer_DateGroupItem.Month==type)oDateGroupItem.Month=this.stream.GetULongLE();else if(c_oSer_DateGroupItem.Second== type)oDateGroupItem.Second=this.stream.GetULongLE();else if(c_oSer_DateGroupItem.Year==type)oDateGroupItem.Year=this.stream.GetULongLE();else res=c_oSerConstants.ReadUnknown;return res};this.ReadCustomFilters=function(type,length,oCustomFilters){var res=c_oSerConstants.ReadOk;var oThis=this;if(c_oSer_CustomFilters.And==type)oCustomFilters.And=this.stream.GetBool();else if(c_oSer_CustomFilters.CustomFilters==type){oCustomFilters.CustomFilters=[];res=this.bcr.Read1(length,function(t,l){return oThis.ReadCustomFiltersItems(t, l,oCustomFilters.CustomFilters)})}else res=c_oSerConstants.ReadUnknown;return res};this.ReadCustomFiltersItems=function(type,length,aCustomFilters){var res=c_oSerConstants.ReadOk;var oThis=this;if(c_oSer_CustomFilters.CustomFilter==type){var oCustomFiltersItem=new Asc.CustomFilter;res=this.bcr.Read2Spreadsheet(length,function(t,l){return oThis.ReadCustomFiltersItem(t,l,oCustomFiltersItem)});aCustomFilters.push(oCustomFiltersItem)}else res=c_oSerConstants.ReadUnknown;return res};this.ReadCustomFiltersItem= function(type,length,oCustomFiltersItem){var res=c_oSerConstants.ReadOk;if(c_oSer_CustomFilters.Operator==type)oCustomFiltersItem.Operator=this.stream.GetUChar();else if(c_oSer_CustomFilters.Val==type)oCustomFiltersItem.Val=this.stream.GetString2LE(length);else res=c_oSerConstants.ReadUnknown;return res};this.ReadDynamicFilter=function(type,length,oDynamicFilter){var res=c_oSerConstants.ReadOk;if(c_oSer_DynamicFilter.Type==type)oDynamicFilter.Type=this.stream.GetUChar();else if(c_oSer_DynamicFilter.Val== type)oDynamicFilter.Val=this.stream.GetDoubleLE();else if(c_oSer_DynamicFilter.MaxVal==type)oDynamicFilter.MaxVal=this.stream.GetDoubleLE();else res=c_oSerConstants.ReadUnknown;return res};this.ReadColorFilter=function(type,length,oColorFilter){var res=c_oSerConstants.ReadOk;if(c_oSer_ColorFilter.CellColor==type)oColorFilter.CellColor=this.stream.GetBool();else if(c_oSer_ColorFilter.DxfId==type){var DxfId=this.stream.GetULongLE();oColorFilter.dxf=this.Dxfs[DxfId]}else res=c_oSerConstants.ReadUnknown; return res};this.ReadTop10=function(type,length,oTop10){var res=c_oSerConstants.ReadOk;if(c_oSer_Top10.FilterVal==type)oTop10.FilterVal=this.stream.GetDoubleLE();else if(c_oSer_Top10.Percent==type)oTop10.Percent=this.stream.GetBool();else if(c_oSer_Top10.Top==type)oTop10.Top=this.stream.GetBool();else if(c_oSer_Top10.Val==type)oTop10.Val=this.stream.GetDoubleLE();else res=c_oSerConstants.ReadUnknown;return res};this.ReadSortConditionContent=function(type,length,oSortCondition){var res=c_oSerConstants.ReadOk; if(c_oSer_SortState.ConditionRef==type)oSortCondition.Ref=AscCommonExcel.g_oRangeCache.getAscRange(this.stream.GetString2LE(length));else if(c_oSer_SortState.ConditionSortBy==type)oSortCondition.ConditionSortBy=this.stream.GetUChar();else if(c_oSer_SortState.ConditionDescending==type)oSortCondition.ConditionDescending=this.stream.GetBool();else if(c_oSer_SortState.ConditionDxfId==type){var DxfId=this.stream.GetULongLE();oSortCondition.dxf=this.Dxfs[DxfId]}else res=c_oSerConstants.ReadUnknown;return res}; this.ReadSortCondition=function(type,length,aSortConditions){var res=c_oSerConstants.ReadOk;var oThis=this;if(c_oSer_SortState.SortCondition==type){var oSortCondition=new AscCommonExcel.SortCondition;res=this.bcr.Read2Spreadsheet(length,function(t,l){return oThis.ReadSortConditionContent(t,l,oSortCondition)});aSortConditions.push(oSortCondition)}else res=c_oSerConstants.ReadUnknown;return res};this.ReadSortConditionExternal=function(){var oThis=this;var oSortCondition=new AscCommonExcel.SortCondition; var length=this.stream.GetULongLE();var res=this.bcr.Read2Spreadsheet(length,function(t,l){return oThis.ReadSortConditionContent(t,l,oSortCondition)});return oSortCondition};this.ReadSortState=function(type,length,oSortState){var res=c_oSerConstants.ReadOk;var oThis=this;if(c_oSer_SortState.Ref==type)oSortState.Ref=AscCommonExcel.g_oRangeCache.getAscRange(this.stream.GetString2LE(length));else if(c_oSer_SortState.CaseSensitive==type)oSortState.CaseSensitive=this.stream.GetBool();else if(c_oSer_SortState.ColumnSort== type)oSortState.ColumnSort=this.stream.GetBool();else if(c_oSer_SortState.SortMethod==type)oSortState.SortMethod=this.stream.GetUChar();else if(c_oSer_SortState.SortConditions==type){oSortState.SortConditions=[];res=this.bcr.Read1(length,function(t,l){return oThis.ReadSortCondition(t,l,oSortState.SortConditions)})}else res=c_oSerConstants.ReadUnknown;return res};this.ReadTableColumn=function(type,length,oTableColumn){var res=c_oSerConstants.ReadOk;if(c_oSer_TableColumns.Name==type)oTableColumn.Name= this.stream.GetString2LE(length);else if(c_oSer_TableColumns.TotalsRowLabel==type)oTableColumn.TotalsRowLabel=this.stream.GetString2LE(length);else if(c_oSer_TableColumns.TotalsRowFunction==type)oTableColumn.TotalsRowFunction=this.stream.GetUChar();else if(c_oSer_TableColumns.TotalsRowFormula==type){var formula=this.stream.GetString2LE(length);this.oReadResult.tableCustomFunc.push({formula:formula,column:oTableColumn,ws:this.ws})}else if(c_oSer_TableColumns.DataDxfId==type){var DxfId=this.stream.GetULongLE(); oTableColumn.dxf=this.Dxfs[DxfId]}else res=c_oSerConstants.ReadUnknown;return res};this.ReadTableColumns=function(type,length,aTableColumns){var res=c_oSerConstants.ReadOk;var oThis=this;if(c_oSer_TableColumns.TableColumn==type){var oTableColumn=new AscCommonExcel.TableColumn;res=this.bcr.Read1(length,function(t,l){return oThis.ReadTableColumn(t,l,oTableColumn)});aTableColumns.push(oTableColumn)}else res=c_oSerConstants.ReadUnknown;return res};this.ReadTableStyleInfo=function(type,length,oTableStyleInfo){var res= c_oSerConstants.ReadOk;if(c_oSer_TableStyleInfo.Name==type)oTableStyleInfo.Name=this.stream.GetString2LE(length);else if(c_oSer_TableStyleInfo.ShowColumnStripes==type)oTableStyleInfo.ShowColumnStripes=this.stream.GetBool();else if(c_oSer_TableStyleInfo.ShowRowStripes==type)oTableStyleInfo.ShowRowStripes=this.stream.GetBool();else if(c_oSer_TableStyleInfo.ShowFirstColumn==type)oTableStyleInfo.ShowFirstColumn=this.stream.GetBool();else if(c_oSer_TableStyleInfo.ShowLastColumn==type)oTableStyleInfo.ShowLastColumn= this.stream.GetBool();else res=c_oSerConstants.ReadUnknown;return res}}function Binary_SharedStringTableReader(stream,wb,aSharedStrings){this.stream=stream;this.wb=wb;this.aSharedStrings=aSharedStrings;this.bcr=new Binary_CommonReader(this.stream);this.Read=function(){var oThis=this;var tempValue={text:null,multiText:null};return this.bcr.ReadTable(function(t,l){return oThis.ReadSharedStringContent(t,l,tempValue)})};this.ReadSharedStringContent=function(type,length,tempValue){var res=c_oSerConstants.ReadOk; if(c_oSerSharedStringTypes.Si===type){var oThis=this;tempValue.text=null;tempValue.multiText=null;res=this.bcr.Read1(length,function(t,l){return oThis.ReadSharedString(t,l,tempValue)});if(null!=this.aSharedStrings)if(null!=tempValue.text)this.aSharedStrings.push(tempValue.text);else if(null!=tempValue.multiText)this.aSharedStrings.push(tempValue.multiText);else this.aSharedStrings.push("")}else res=c_oSerConstants.ReadUnknown;return res};this.ReadSharedString=function(type,length,tempValue){var res= c_oSerConstants.ReadOk;if(c_oSerSharedStringTypes.Run==type){var oThis=this;var oRun=new AscCommonExcel.CMultiTextElem;res=this.bcr.Read1(length,function(t,l){return oThis.ReadRun(t,l,oRun)});if(null==tempValue.multiText)tempValue.multiText=[];tempValue.multiText.push(oRun)}else if(c_oSerSharedStringTypes.Text==type){if(null==tempValue.text)tempValue.text="";tempValue.text+=this.stream.GetString2LE(length)}else res=c_oSerConstants.ReadUnknown;return res};this.ReadRun=function(type,length,oRun){var oThis= this;var res=c_oSerConstants.ReadOk;if(c_oSerSharedStringTypes.RPr==type){if(null==oRun.format)oRun.format=new AscCommonExcel.Font;res=this.bcr.Read2Spreadsheet(length,function(t,l){return oThis.ReadRPr(t,l,oRun.format)});oRun.format.checkSchemeFont(this.wb.theme)}else if(c_oSerSharedStringTypes.Text==type){if(null==oRun.text)oRun.text="";oRun.text+=this.stream.GetString2LE(length)}else res=c_oSerConstants.ReadUnknown;return res};this.ReadRPr=function(type,length,rPr){var res=c_oSerConstants.ReadOk; var oThis=this;if(c_oSerFontTypes.Bold==type)rPr.b=this.stream.GetBool();else if(c_oSerFontTypes.Color==type){var color=ReadColorSpreadsheet2(this.bcr,length);if(color)rPr.c=color}else if(c_oSerFontTypes.Italic==type)rPr.i=this.stream.GetBool();else if(c_oSerFontTypes.RFont==type)rPr.fn=this.stream.GetString2LE(length);else if(c_oSerFontTypes.Strike==type)rPr.s=this.stream.GetBool();else if(c_oSerFontTypes.Sz==type)rPr.fs=this.stream.GetDoubleLE();else if(c_oSerFontTypes.Underline==type)rPr.u=this.stream.GetUChar(); else if(c_oSerFontTypes.VertAlign==type){rPr.va=this.stream.GetUChar();if(rPr.va===AscCommon.vertalign_SubScript)rPr.va=AscCommon.vertalign_SuperScript;else if(rPr.va===AscCommon.vertalign_SuperScript)rPr.va=AscCommon.vertalign_SubScript}else if(c_oSerFontTypes.Scheme==type)rPr.scheme=this.stream.GetUChar();else res=c_oSerConstants.ReadUnknown;return res}}function Binary_StylesTableReader(stream,wb,aCellXfs,isCopyPaste,useNumId){this.stream=stream;this.wb=wb;this.aCellXfs=aCellXfs;this.bcr=new Binary_CommonReader(this.stream); this.bssr=new Binary_SharedStringTableReader(this.stream,wb);this.isCopyPaste=isCopyPaste;this.useNumId=useNumId;this.Read=function(){var oThis=this;var oStyleObject={aBorders:[],aFills:[],aFonts:[],oNumFmts:{},aCellStyleXfs:[],aCellXfs:[],aDxfs:[],aExtDxfs:[],aCellStyles:[],oCustomTableStyles:{},oCustomSlicerStyles:null};var res=this.bcr.ReadTable(function(t,l){return oThis.ReadStylesContent(t,l,oStyleObject)});return oStyleObject};this.InitStyleManager=function(oStyleObject){var i,xf,firstFont, firstFill,secondFill,firstBorder,firstXf,newXf,oCellStyle;if(0===oStyleObject.aFonts.length){oStyleObject.aFonts[0]=new AscCommonExcel.Font;oStyleObject.aFonts[0].initDefault(this.wb)}if(0===oStyleObject.aCellXfs.length){xf=new OpenXf;xf.fontid=xf.fillid=xf.borderid=xf.numid=xf.XfId=0;oStyleObject.aCellXfs[0]=xf}if(0===oStyleObject.aCellStyleXfs.length){xf=new OpenXf;xf.fontid=xf.fillid=xf.borderid=xf.numid=0;oStyleObject.aCellStyleXfs[0]=xf}var hasNormalStyle=false;for(i=0;i0){var oLast=aTempCols[aTempCols.length-1];if(AscCommon.gc_nMaxCol==oLast.Max){oAllCol=oWorksheet.getAllCol();oLast.col.cloneTo(oAllCol)}}for(var i=0;i=oWorksheet.nColsCount)oWorksheet.nColsCount=elem.Max;if(null!=oAllCol&&oAllCol.isEqual(elem.col))continue;for(var j=elem.Min;j<=elem.Max;j++){var oNewCol=new AscCommonExcel.Col(oWorksheet,j-1);elem.col.cloneTo(oNewCol); oWorksheet.aCols[oNewCol.index]=oNewCol}}}else if(c_oSerWorksheetsTypes.SheetFormatPr==type)res=this.bcr.Read2Spreadsheet(length,function(t,l){return oThis.ReadSheetFormatPr(t,l,oWorksheet)});else if(c_oSerWorksheetsTypes.PageMargins==type)res=this.bcr.Read2Spreadsheet(length,function(t,l){return oThis.ReadPageMargins(t,l,oWorksheet.PagePrintOptions.pageMargins)});else if(c_oSerWorksheetsTypes.PageSetup==type)res=this.bcr.Read2Spreadsheet(length,function(t,l){return oThis.ReadPageSetup(t,l,oWorksheet.PagePrintOptions.pageSetup)}); else if(c_oSerWorksheetsTypes.PrintOptions==type)res=this.bcr.Read2Spreadsheet(length,function(t,l){return oThis.ReadPrintOptions(t,l,oWorksheet.PagePrintOptions)});else if(c_oSerWorksheetsTypes.Hyperlinks==type)res=this.bcr.Read1(length,function(t,l){return oThis.ReadHyperlinks(t,l,oWorksheet)});else if(c_oSerWorksheetsTypes.MergeCells==type)res=this.bcr.Read1(length,function(t,l){return oThis.ReadMergeCells(t,l,oWorksheet)});else if(c_oSerWorksheetsTypes.SheetData==type){this.oReadResult.sheetData.push({ws:oWorksheet, pos:this.stream.GetCurPos(),len:length});res=c_oSerConstants.ReadUnknown}else if(c_oSerWorksheetsTypes.Drawings==type)res=this.bcr.Read1(length,function(t,l){return oThis.ReadDrawings(t,l,oWorksheet.Drawings,oWorksheet)});else if(c_oSerWorksheetsTypes.Autofilter==type){oBinary_TableReader=new Binary_TableReader(this.stream,this.oReadResult,oWorksheet,this.Dxfs);oWorksheet.AutoFilter=new AscCommonExcel.AutoFilter;res=this.bcr.Read1(length,function(t,l){return oBinary_TableReader.ReadAutoFilter(t,l, oWorksheet.AutoFilter)})}else if(c_oSerWorksheetsTypes.SortState===type){oBinary_TableReader=new Binary_TableReader(this.stream,this.oReadResult,oWorksheet,this.Dxfs);oWorksheet.sortState=new AscCommonExcel.SortState;res=this.bcr.Read1(length,function(t,l){return oBinary_TableReader.ReadSortState(t,l,oWorksheet.sortState)})}else if(c_oSerWorksheetsTypes.TableParts==type){oBinary_TableReader=new Binary_TableReader(this.stream,this.oReadResult,oWorksheet,this.Dxfs);oBinary_TableReader.Read(length,oWorksheet.TableParts)}else if(c_oSerWorksheetsTypes.Comments== type&&!(typeof editor!=="undefined"&&editor.WordControl&&editor.WordControl.m_oLogicDocument&&Array.isArray(editor.WordControl.m_oLogicDocument.Slides)))res=this.bcr.Read1(length,function(t,l){return oThis.ReadComments(t,l,oWorksheet)});else if(c_oSerWorksheetsTypes.ConditionalFormatting===type&&typeof AscCommonExcel.CConditionalFormatting!="undefined"){oConditionalFormatting=new AscCommonExcel.CConditionalFormatting;res=this.bcr.Read1(length,function(t,l){return oThis.ReadConditionalFormatting(t, l,oConditionalFormatting)});if(oConditionalFormatting.isValid()){oConditionalFormatting.initRules();oWorksheet.aConditionalFormattingRules=oWorksheet.aConditionalFormattingRules.concat(oConditionalFormatting.aRules)}}else if(c_oSerWorksheetsTypes.SheetViews===type)res=this.bcr.Read1(length,function(t,l){return oThis.ReadSheetViews(t,l,oWorksheet.sheetViews)});else if(c_oSerWorksheetsTypes.SheetPr===type){oWorksheet.sheetPr=new AscCommonExcel.asc_CSheetPr;res=this.bcr.Read1(length,function(t,l){return oThis.ReadSheetPr(t, l,oWorksheet.sheetPr)})}else if(c_oSerWorksheetsTypes.SparklineGroups===type)res=this.bcr.Read1(length,function(t,l){return oThis.ReadSparklineGroups(t,l,oWorksheet)});else if(c_oSerWorksheetsTypes.HeaderFooter===type)res=this.bcr.Read1(length,function(t,l){return oThis.ReadHeaderFooter(t,l,oWorksheet.headerFooter)});else if(c_oSerWorksheetsTypes.DataValidations===type&&typeof AscCommonExcel.CDataValidations!="undefined"){oWorksheet.dataValidations=new AscCommonExcel.CDataValidations;res=this.bcr.Read1(length, function(t,l){return oThis.ReadDataValidations(t,l,oWorksheet.dataValidations)})}else if(c_oSerWorksheetsTypes.PivotTable===type&&typeof Asc.CT_pivotTableDefinition!="undefined"){var data={table:null,cacheId:null};res=this.bcr.Read1(length,function(t,l){return oThis.ReadPivotCopyPaste(t,l,data)});var cacheDefinition=this.oReadResult.pivotCacheDefinitions[data.cacheId];if(data.table&&cacheDefinition){data.table.cacheDefinition=cacheDefinition;oWorksheet.insertPivotTable(data.table)}}else if(c_oSerWorksheetsTypes.Slicers=== type||c_oSerWorksheetsTypes.SlicersExt===type)res=this.bcr.Read1(length,function(t,l){return oThis.ReadSlicers(t,l,oWorksheet)});else if(c_oSerWorksheetsTypes.NamedSheetView===type){var fileStream=this.stream.ToFileStream();fileStream.GetUChar();var namedSheetViews=new Asc.CT_NamedSheetViews;namedSheetViews.fromStream(fileStream,this.wb);oWorksheet.aNamedSheetViews=namedSheetViews.namedSheetView;this.stream.FromFileStream(fileStream)}else res=c_oSerConstants.ReadUnknown;return res};this.ReadPivotCopyPaste= function(type,length,data){var res=c_oSerConstants.ReadOk;var oThis=this;if(c_oSer_PivotTypes.cacheId==type)data.cacheId=this.stream.GetLong();else if(c_oSer_PivotTypes.table==type){data.table=new Asc.CT_pivotTableDefinition(true);(new openXml.SaxParserBase).parse(AscCommon.GetStringUtf8(this.stream,length),data.table)}else res=c_oSerConstants.ReadUnknown;return res};this.ReadSlicers=function(type,length,oWorksheet){var res=c_oSerConstants.ReadOk;var oThis=this;if(c_oSerWorksheetsTypes.Slicer===type){if(typeof Asc.CT_slicers== "undefined"){if(this.copyPasteObj.isCopyPaste)oWorksheet.aSlicers.push(null);return c_oSerConstants.ReadUnknown}var slicers=new Asc.CT_slicers;slicers.slicer=oWorksheet.aSlicers;var fileStream=this.stream.ToFileStream();fileStream.GetUChar();slicers.fromStream(fileStream,oWorksheet,oThis.oReadResult.slicerCaches);this.stream.FromFileStream(fileStream)}else res=c_oSerConstants.ReadUnknown;return res};this.ReadDataValidations=function(type,length,dataValidations){var res=c_oSerConstants.ReadOk;var oThis= this;if(c_oSer_DataValidation.DataValidations==type)res=this.bcr.Read1(length,function(t,l){return oThis.ReadDataValidationsContent(t,l,dataValidations)});else if(c_oSer_DataValidation.DisablePrompts==type)dataValidations.disablePrompts=this.stream.GetBool();else if(c_oSer_DataValidation.XWindow==type)dataValidations.xWindow=this.stream.GetLong();else if(c_oSer_DataValidation.YWindow==type)dataValidations.yWindow=this.stream.GetLong();else res=c_oSerConstants.ReadUnknown;return res};this.ReadDataValidationsContent= function(type,length,dataValidations){var res=c_oSerConstants.ReadOk;var oThis=this;if(c_oSer_DataValidation.DataValidation==type){var dataValidation=new AscCommonExcel.CDataValidation;res=this.bcr.Read2(length,function(t,l){return oThis.ReadDataValidation(t,l,dataValidation)});if(dataValidation&&dataValidation.ranges)dataValidations.elems.push(dataValidation)}else res=c_oSerConstants.ReadUnknown;return res};this.ReadDataValidation=function(type,length,dataValidation){var res=c_oSerConstants.ReadOk; if(c_oSer_DataValidation.AllowBlank==type)dataValidation.allowBlank=this.stream.GetBool();else if(c_oSer_DataValidation.Type==type)dataValidation.type=this.stream.GetUChar();else if(c_oSer_DataValidation.Error==type)dataValidation.error=this.stream.GetString2LE(length);else if(c_oSer_DataValidation.ErrorTitle==type)dataValidation.errorTitle=this.stream.GetString2LE(length);else if(c_oSer_DataValidation.ErrorStyle==type)dataValidation.errorStyle=this.stream.GetUChar();else if(c_oSer_DataValidation.ImeMode== type)dataValidation.imeMode=this.stream.GetUChar();else if(c_oSer_DataValidation.Operator==type)dataValidation.operator=this.stream.GetUChar();else if(c_oSer_DataValidation.Prompt==type)dataValidation.prompt=this.stream.GetString2LE(length);else if(c_oSer_DataValidation.PromptTitle==type)dataValidation.promptTitle=this.stream.GetString2LE(length);else if(c_oSer_DataValidation.ShowDropDown==type)dataValidation.showDropDown=this.stream.GetBool();else if(c_oSer_DataValidation.ShowErrorMessage==type)dataValidation.showErrorMessage= this.stream.GetBool();else if(c_oSer_DataValidation.ShowInputMessage==type)dataValidation.showInputMessage=this.stream.GetBool();else if(c_oSer_DataValidation.SqRef==type)dataValidation.setSqRef(this.stream.GetString2LE(length));else if(c_oSer_DataValidation.Formula1==type)dataValidation.formula1=new Asc.CDataFormula(this.stream.GetString2LE(length));else if(c_oSer_DataValidation.Formula2==type)dataValidation.formula2=new Asc.CDataFormula(this.stream.GetString2LE(length));else res=c_oSerConstants.ReadUnknown; return res};this.ReadWorksheetProp=function(type,length,oWorksheet){var res=c_oSerConstants.ReadOk;if(c_oSerWorksheetPropTypes.Name==type){oWorksheet.sName=this.stream.GetString2LE(length);AscFonts.FontPickerByCharacter.getFontsByString(oWorksheet.sName)}else if(c_oSerWorksheetPropTypes.SheetId==type)this.oReadResult.sheetIds[this.stream.GetULongLE()]=oWorksheet;else if(c_oSerWorksheetPropTypes.State==type)switch(this.stream.GetUChar()){case EVisibleType.visibleHidden:oWorksheet.bHidden=true;break; case EVisibleType.visibleVeryHidden:oWorksheet.bHidden=true;break;case EVisibleType.visibleVisible:oWorksheet.bHidden=false;break}else if(this.copyPasteObj.isCopyPaste&&c_oSerWorksheetPropTypes.Ref==type)this.copyPasteObj.activeRange=this.stream.GetString2LE(length);else res=c_oSerConstants.ReadUnknown;return res};this.ReadWorksheetCols=function(type,length,aTempCols,oWorksheet,aCellXfs){var res=c_oSerConstants.ReadOk;var oThis=this;if(c_oSerWorksheetsTypes.Col==type){var oTempCol={Max:null,Min:null, col:new AscCommonExcel.Col(oWorksheet,0)};res=this.bcr.Read2Spreadsheet(length,function(t,l){return oThis.ReadWorksheetCol(t,l,oTempCol,aCellXfs)});oTempCol.col.fixOnOpening();aTempCols.push(oTempCol)}else res=c_oSerConstants.ReadUnknown;return res};this.ReadWorksheetCol=function(type,length,oTempCol,aCellXfs){var res=c_oSerConstants.ReadOk;if(c_oSerWorksheetColTypes.BestFit==type)oTempCol.col.BestFit=this.stream.GetBool();else if(c_oSerWorksheetColTypes.Hidden==type)oTempCol.col.setHidden(this.stream.GetBool()); else if(c_oSerWorksheetColTypes.Max==type)oTempCol.Max=this.stream.GetULongLE();else if(c_oSerWorksheetColTypes.Min==type)oTempCol.Min=this.stream.GetULongLE();else if(c_oSerWorksheetColTypes.Style==type){var xfs=aCellXfs[this.stream.GetULongLE()];if(xfs)oTempCol.col.setStyle(xfs)}else if(c_oSerWorksheetColTypes.Width==type)oTempCol.col.width=this.stream.GetDoubleLE();else if(c_oSerWorksheetColTypes.CustomWidth==type)oTempCol.col.CustomWidth=this.stream.GetBool();else if(c_oSerWorksheetColTypes.OutLevel== type)oTempCol.col.outlineLevel=this.stream.GetULongLE();else if(c_oSerWorksheetColTypes.Collapsed==type)oTempCol.col.collapsed=this.stream.GetBool();else res=c_oSerConstants.ReadUnknown;return res};this.ReadSheetFormatPr=function(type,length,oWorksheet){var res=c_oSerConstants.ReadOk;if(c_oSerSheetFormatPrTypes.DefaultColWidth==type)oWorksheet.oSheetFormatPr.dDefaultColWidth=this.stream.GetDoubleLE();else if(c_oSerSheetFormatPrTypes.BaseColWidth===type)oWorksheet.oSheetFormatPr.nBaseColWidth=this.stream.GetULongLE(); else if(c_oSerSheetFormatPrTypes.DefaultRowHeight==type){var oAllRow=oWorksheet.getAllRow();oAllRow.setHeight(this.stream.GetDoubleLE())}else if(c_oSerSheetFormatPrTypes.CustomHeight==type){var oAllRow=oWorksheet.getAllRow();var CustomHeight=this.stream.GetBool();if(CustomHeight)oAllRow.setCustomHeight(true)}else if(c_oSerSheetFormatPrTypes.ZeroHeight==type){var oAllRow=oWorksheet.getAllRow();var hd=this.stream.GetBool();if(hd)oAllRow.setHidden(true)}else if(c_oSerSheetFormatPrTypes.OutlineLevelCol== type)oWorksheet.oSheetFormatPr.nOutlineLevelCol=this.stream.GetULongLE();else if(c_oSerSheetFormatPrTypes.OutlineLevelRow==type){var oAllRow=oWorksheet.getAllRow();oAllRow.setOutlineLevel(this.stream.GetULongLE())}else res=c_oSerConstants.ReadUnknown;return res};this.ReadPageMargins=function(type,length,oPageMargins){var res=c_oSerConstants.ReadOk;if(c_oSer_PageMargins.Left==type)oPageMargins.asc_setLeft(this.stream.GetDoubleLE());else if(c_oSer_PageMargins.Top==type)oPageMargins.asc_setTop(this.stream.GetDoubleLE()); else if(c_oSer_PageMargins.Right==type)oPageMargins.asc_setRight(this.stream.GetDoubleLE());else if(c_oSer_PageMargins.Bottom==type)oPageMargins.asc_setBottom(this.stream.GetDoubleLE());else if(c_oSer_PageMargins.Header==type)oPageMargins.asc_setHeader(this.stream.GetDoubleLE());else if(c_oSer_PageMargins.Footer==type)oPageMargins.asc_setFooter(this.stream.GetDoubleLE());else res=c_oSerConstants.ReadUnknown;return res};this.ReadPageSetup=function(type,length,oPageSetup){var res=c_oSerConstants.ReadOk; if(c_oSer_PageSetup.BlackAndWhite===type)oPageSetup.blackAndWhite=this.stream.GetBool();else if(c_oSer_PageSetup.CellComments==type)oPageSetup.cellComments=this.stream.GetUChar();else if(c_oSer_PageSetup.Copies==type)oPageSetup.copies=this.stream.GetULongLE();else if(c_oSer_PageSetup.Draft==type)oPageSetup.draft=this.stream.GetBool();else if(c_oSer_PageSetup.Errors==type)oPageSetup.errors=this.stream.GetUChar();else if(c_oSer_PageSetup.FirstPageNumber==type)oPageSetup.firstPageNumber=this.stream.GetULongLE(); else if(c_oSer_PageSetup.FitToHeight==type)oPageSetup.fitToHeight=this.stream.GetULongLE();else if(c_oSer_PageSetup.FitToWidth==type)oPageSetup.fitToWidth=this.stream.GetULongLE();else if(c_oSer_PageSetup.HorizontalDpi==type)oPageSetup.horizontalDpi=this.stream.GetULongLE();else if(c_oSer_PageSetup.Orientation==type){var byteFormatOrientation=this.stream.GetUChar();var byteOrientation=null;switch(byteFormatOrientation){case EPageOrientation.pageorientPortrait:byteOrientation=c_oAscPageOrientation.PagePortrait; break;case EPageOrientation.pageorientLandscape:byteOrientation=c_oAscPageOrientation.PageLandscape;break}if(null!=byteOrientation)oPageSetup.asc_setOrientation(byteOrientation)}else if(c_oSer_PageSetup.PageOrder==type)oPageSetup.pageOrder=this.stream.GetUChar();else if(c_oSer_PageSetup.PaperSize==type){var bytePaperSize=this.stream.GetUChar();var item=DocumentPageSize.getSizeById(bytePaperSize);oPageSetup.asc_setWidth(item.w_mm);oPageSetup.asc_setHeight(item.h_mm)}else if(c_oSer_PageSetup.Scale== type)oPageSetup.scale=this.stream.GetULongLE();else if(c_oSer_PageSetup.UseFirstPageNumber==type)oPageSetup.useFirstPageNumber=this.stream.GetBool();else if(c_oSer_PageSetup.UsePrinterDefaults==type)oPageSetup.usePrinterDefaults=this.stream.GetBool();else if(c_oSer_PageSetup.VerticalDpi==type)oPageSetup.verticalDpi=this.stream.GetULongLE();else res=c_oSerConstants.ReadUnknown;return res};this.ReadPrintOptions=function(type,length,oPrintOptions){var res=c_oSerConstants.ReadOk;if(c_oSer_PrintOptions.GridLines== type)oPrintOptions.asc_setGridLines(this.stream.GetBool());else if(c_oSer_PrintOptions.Headings==type)oPrintOptions.asc_setHeadings(this.stream.GetBool());else res=c_oSerConstants.ReadUnknown;return res};this.ReadHyperlinks=function(type,length,ws){var res=c_oSerConstants.ReadOk;var oThis=this;if(c_oSerWorksheetsTypes.Hyperlink==type){var oNewHyperlink=new AscCommonExcel.Hyperlink;res=this.bcr.Read1(length,function(t,l){return oThis.ReadHyperlink(t,l,ws,oNewHyperlink)});this.aHyperlinks.push(oNewHyperlink)}else res= c_oSerConstants.ReadUnknown;return res};this.ReadHyperlink=function(type,length,ws,oHyperlink){var res=c_oSerConstants.ReadOk;if(c_oSerHyperlinkTypes.Ref==type)oHyperlink.Ref=ws.getRange2(this.stream.GetString2LE(length));else if(c_oSerHyperlinkTypes.Hyperlink==type)oHyperlink.Hyperlink=this.stream.GetString2LE(length);else if(c_oSerHyperlinkTypes.Location==type)oHyperlink.setLocation(this.stream.GetString2LE(length));else if(c_oSerHyperlinkTypes.Tooltip==type)oHyperlink.Tooltip=this.stream.GetString2LE(length); else res=c_oSerConstants.ReadUnknown;return res};this.ReadMergeCells=function(type,length){var res=c_oSerConstants.ReadOk;if(c_oSerWorksheetsTypes.MergeCell==type)this.aMerged.push(this.stream.GetString2LE(length));else res=c_oSerConstants.ReadUnknown;return res};this.ReadSheetData=function(type,length,tmp){var res=c_oSerConstants.ReadOk;var oThis=this;if(c_oSerWorksheetsTypes.XlsbPos===type){var oldPos=this.stream.GetCurPos();this.stream.Seek2(this.stream.GetULongLE());tmp.ws.fromXLSB(this.stream, this.stream.XlsbReadRecordType(),tmp,this.aCellXfs,this.aSharedStrings,function(tmp){oThis.initCellAfterRead(tmp)});this.stream.Seek2(oldPos);res=c_oSerConstants.ReadUnknown}else if(c_oSerWorksheetsTypes.Row===type){tmp.pos=null;tmp.len=null;tmp.row.clear();res=this.bcr.Read2Spreadsheet(length,function(t,l){return oThis.ReadRow(t,l,tmp)});if(null===tmp.row.index)tmp.row.index=tmp.prevRow+1;tmp.row.saveContent();tmp.ws.cellsByColRowsCount=Math.max(tmp.ws.cellsByColRowsCount,tmp.row.index+1);tmp.ws.nRowsCount= Math.max(tmp.ws.nRowsCount,tmp.ws.cellsByColRowsCount);tmp.prevRow=tmp.row.index;tmp.prevCol=-1;if(null!==tmp.pos&&null!==tmp.len){var nOldPos=this.stream.GetCurPos();this.stream.Seek2(tmp.pos);res=this.bcr.Read1(tmp.len,function(t,l){return oThis.ReadCells(t,l,tmp)});this.stream.Seek2(nOldPos)}}else res=c_oSerConstants.ReadUnknown;return res};this.ReadRow=function(type,length,tmp){var res=c_oSerConstants.ReadOk;var oThis=this;if(c_oSerRowTypes.Row==type){var index=this.stream.GetULongLE()-1;tmp.row.setIndex(index)}else if(c_oSerRowTypes.Style== type){var xfs=this.aCellXfs[this.stream.GetULongLE()];if(xfs)tmp.row.setStyle(xfs)}else if(c_oSerRowTypes.Height==type){var h=this.stream.GetDoubleLE();tmp.row.setHeight(h);if(AscCommon.CurFileVersion<2)tmp.row.setCustomHeight(true)}else if(c_oSerRowTypes.CustomHeight==type){var CustomHeight=this.stream.GetBool();if(CustomHeight)tmp.row.setCustomHeight(true)}else if(c_oSerRowTypes.Hidden==type){var hd=this.stream.GetBool();if(hd)tmp.row.setHidden(true)}else if(c_oSerRowTypes.OutLevel==type)tmp.row.setOutlineLevel(this.stream.GetULongLE()); else if(c_oSerRowTypes.Collapsed==type)tmp.row.setCollapsed(this.stream.GetBool());else if(c_oSerRowTypes.Cells==type){tmp.pos=this.stream.GetCurPos();tmp.len=length;res=c_oSerConstants.ReadUnknown}else res=c_oSerConstants.ReadUnknown;return res};this.ReadCells=function(type,length,tmp){var res=c_oSerConstants.ReadOk;var oThis=this;if(c_oSerRowTypes.Cell===type){tmp.cell.clear();tmp.formula.clean();res=this.bcr.Read1(length,function(t,l){return oThis.ReadCell(t,l,tmp,tmp.cell,tmp.prevRow)});if(tmp.cell.isNullTextString())tmp.cell.setTypeInternal(CellValueType.Number); if(tmp.cell.hasRowCol())tmp.prevCol=tmp.cell.nCol;else{tmp.prevCol++;tmp.cell.setRowCol(tmp.prevRow,tmp.prevCol)}this.initCellAfterRead(tmp)}else res=c_oSerConstants.ReadUnknown;return res};this.initCellAfterRead=function(tmp){if(!(this.copyPasteObj&&this.copyPasteObj.isCopyPaste&&typeof editor!="undefined"&&editor))this.setFormulaOpen(tmp);tmp.cell.saveContent();if(tmp.cell.nCol>=tmp.ws.nColsCount)tmp.ws.nColsCount=tmp.cell.nCol+1};this.setFormulaOpen=function(tmp){var cell=tmp.cell;var formula= tmp.formula;var curFormula;var prevFormula=tmp.prevFormulas[cell.nCol];if(null!==formula.si&&(curFormula=tmp.sharedFormulas[formula.si])){curFormula.parsed.getShared().ref.union3(cell.nCol,cell.nRow);if(prevFormula!==curFormula){if(prevFormula&&!tmp.bNoBuildDep&&!tmp.siFormulas[prevFormula.parsed.getListenerId()])prevFormula.parsed.buildDependencies();tmp.prevFormulas[cell.nCol]=curFormula}}else if(formula.v&&formula.v.length<=AscCommon.c_oAscMaxFormulaLength){if(formula.v.startsWith("_xludf."))formula.v= formula.v.replace("_xludf.","");var offsetRow;var shared;var sharedRef;if(prevFormula&&(shared=prevFormula.parsed.getShared()))offsetRow=cell.nRow-shared.ref.r1;else offsetRow=1;if(prevFormula&&formula.t!==ECellFormulaType.cellformulatypeArray&&prevFormula.t!==ECellFormulaType.cellformulatypeArray&&prevFormula.nRow+offsetRow===cell.nRow&&AscCommonExcel.compareFormula(prevFormula.formula,prevFormula.refPos,formula.v,offsetRow)){if(!(shared&&shared.ref)){sharedRef=new Asc.Range(cell.nCol,prevFormula.nRow, cell.nCol,cell.nRow);prevFormula.parsed.setShared(sharedRef,prevFormula.base)}else shared.ref.union3(cell.nCol,cell.nRow);curFormula=prevFormula}else{if(prevFormula&&!tmp.bNoBuildDep&&!tmp.siFormulas[prevFormula.parsed.getListenerId()])prevFormula.parsed.buildDependencies();var parseResult=new AscCommonExcel.ParseResult([]);var newFormulaParent=new AscCommonExcel.CCellWithFormula(cell.ws,cell.nRow,cell.nCol);var parsed=new AscCommonExcel.parserFormula(formula.v,newFormulaParent,cell.ws);parsed.ca= formula.ca;parsed.parse(undefined,undefined,parseResult);if(parseResult.error===Asc.c_oAscError.ID.FrmlMaxReference){tmp.ws.workbook.openErrors.push(cell.getName());return}if(null!==formula.ref)if(formula.t===ECellFormulaType.cellformulatypeShared){sharedRef=AscCommonExcel.g_oRangeCache.getAscRange(formula.ref).clone();parsed.setShared(sharedRef,newFormulaParent)}else if(formula.t===ECellFormulaType.cellformulatypeArray)if(AscCommonExcel.bIsSupportArrayFormula){parsed.setArrayFormulaRef(AscCommonExcel.g_oRangeCache.getAscRange(formula.ref).clone()); tmp.formulaArray.push(parsed)}curFormula=new OpenColumnFormula(cell.nRow,formula.v,parsed,parseResult.refPos,newFormulaParent);tmp.prevFormulas[cell.nCol]=curFormula}if(null!==formula.si&&curFormula.parsed.getShared()){tmp.sharedFormulas[formula.si]=curFormula;tmp.siFormulas[curFormula.parsed.getListenerId()]=curFormula.parsed}}else if(formula.v&&!(this.copyPasteObj&&this.copyPasteObj.isCopyPaste))tmp.ws.workbook.openErrors.push(cell.getName());if(curFormula){cell.setFormulaInternal(curFormula.parsed); if(curFormula.parsed.ca||cell.isNullTextString())tmp.ws.workbook.dependencyFormulas.addToChangedCell(cell)}};this.ReadCell=function(type,length,tmp,oCell,nRowIndex){var res=c_oSerConstants.ReadOk;var oThis=this;if(c_oSerCellTypes.Ref===type){var oCellAddress=AscCommon.g_oCellAddressUtils.getCellAddress(this.stream.GetString2LE(length));oCell.setRowCol(nRowIndex,oCellAddress.getCol0())}else if(c_oSerCellTypes.RefRowCol===type){var nRow=this.stream.GetULongLE();oCell.setRowCol(nRowIndex,this.stream.GetULongLE())}else if(c_oSerCellTypes.Style=== type){var nStyleIndex=this.stream.GetULongLE();if(0!=nStyleIndex){var xfs=this.aCellXfs[nStyleIndex];if(null!=xfs)oCell.setStyle(xfs)}}else if(c_oSerCellTypes.Type===type)switch(this.stream.GetUChar()){case ECellTypeType.celltypeBool:oCell.setTypeInternal(CellValueType.Bool);break;case ECellTypeType.celltypeError:oCell.setTypeInternal(CellValueType.Error);break;case ECellTypeType.celltypeNumber:oCell.setTypeInternal(CellValueType.Number);break;case ECellTypeType.celltypeSharedString:oCell.setTypeInternal(CellValueType.String); break}else if(c_oSerCellTypes.Formula===type)res=this.bcr.Read2Spreadsheet(length,function(t,l){return oThis.ReadFormula(t,l,tmp.formula)});else if(c_oSerCellTypes.Value===type){var val=this.stream.GetDoubleLE();if(CellValueType.String===oCell.getType()||CellValueType.Error===oCell.getType()){var ss=this.aSharedStrings[val];if(undefined!==ss)if(typeof ss==="string")oCell.setValueTextInternal(ss);else oCell.setValueMultiTextInternal(ss)}else oCell.setValueNumberInternal(val)}else res=c_oSerConstants.ReadUnknown; return res};this.ReadFormula=function(type,length,oFormula){var res=c_oSerConstants.ReadOk;if(c_oSerFormulaTypes.Aca===type)oFormula.aca=this.stream.GetBool();else if(c_oSerFormulaTypes.Bx===type)oFormula.bx=this.stream.GetBool();else if(c_oSerFormulaTypes.Ca===type)oFormula.ca=this.stream.GetBool();else if(c_oSerFormulaTypes.Del1===type)oFormula.del1=this.stream.GetBool();else if(c_oSerFormulaTypes.Del2===type)oFormula.del2=this.stream.GetBool();else if(c_oSerFormulaTypes.Dt2D===type)oFormula.dt2d= this.stream.GetBool();else if(c_oSerFormulaTypes.Dtr===type)oFormula.dtr=this.stream.GetBool();else if(c_oSerFormulaTypes.R1===type)oFormula.r1=this.stream.GetString2LE(length);else if(c_oSerFormulaTypes.R2===type)oFormula.r2=this.stream.GetString2LE(length);else if(c_oSerFormulaTypes.Ref===type)oFormula.ref=this.stream.GetString2LE(length);else if(c_oSerFormulaTypes.Si===type)oFormula.si=this.stream.GetULongLE();else if(c_oSerFormulaTypes.T===type)oFormula.t=this.stream.GetUChar();else if(c_oSerFormulaTypes.Text=== type)oFormula.v=this.stream.GetString2LE(length);else res=c_oSerConstants.ReadUnknown;return res};this.ReadDrawings=function(type,length,aDrawings,ws){var res=c_oSerConstants.ReadOk;var oThis=this;if(c_oSerWorksheetsTypes.Drawing==type){var objectRender=new AscFormat.DrawingObjects;var oFlags={from:false,to:false,pos:false,ext:false,editAs:c_oAscCellAnchorType.cellanchorTwoCell};var oNewDrawing=objectRender.createDrawingObject();res=this.bcr.Read1(length,function(t,l){return oThis.ReadDrawing(t,l, oNewDrawing,oFlags)});if(null!=oNewDrawing.graphicObject){if(false!=oFlags.from&&false!=oFlags.to){oNewDrawing.Type=c_oAscCellAnchorType.cellanchorTwoCell;oNewDrawing.editAs=oFlags.editAs}else if(false!=oFlags.from&&false!=oFlags.ext)oNewDrawing.Type=c_oAscCellAnchorType.cellanchorOneCell;else if(false!=oFlags.pos&&false!=oFlags.ext)oNewDrawing.Type=c_oAscCellAnchorType.cellanchorAbsolute;if(oNewDrawing.graphicObject)if(typeof oNewDrawing.graphicObject.setWorksheet!="undefined")oNewDrawing.graphicObject.setWorksheet(ws); if(!oNewDrawing.graphicObject.spPr){oNewDrawing.graphicObject.setSpPr(new AscFormat.CSpPr);oNewDrawing.graphicObject.spPr.setParent(oNewDrawing.graphicObject)}if(!oNewDrawing.graphicObject.spPr.xfrm){oNewDrawing.graphicObject.spPr.setXfrm(new AscFormat.CXfrm);oNewDrawing.graphicObject.spPr.xfrm.setParent(oNewDrawing.graphicObject.spPr);oNewDrawing.graphicObject.spPr.xfrm.setOffX(0);oNewDrawing.graphicObject.spPr.xfrm.setOffY(0);oNewDrawing.graphicObject.spPr.xfrm.setExtX(0);oNewDrawing.graphicObject.spPr.xfrm.setExtY(0)}aDrawings.push(oNewDrawing)}}else res= c_oSerConstants.ReadUnknown;return res};this.ReadDrawing=function(type,length,oDrawing,oFlags){var res=c_oSerConstants.ReadOk;var oThis=this;if(c_oSer_DrawingType.Type==type)oDrawing.Type=this.stream.GetUChar();else if(c_oSer_DrawingType.EditAs==type)oFlags.editAs=this.stream.GetUChar();else if(c_oSer_DrawingType.From==type){oFlags.from=true;res=this.bcr.Read2Spreadsheet(length,function(t,l){return oThis.ReadFromTo(t,l,oDrawing.from)})}else if(c_oSer_DrawingType.To==type){oFlags.to=true;res=this.bcr.Read2Spreadsheet(length, function(t,l){return oThis.ReadFromTo(t,l,oDrawing.to)})}else if(c_oSer_DrawingType.Pos==type){oFlags.pos=true;if(null==oDrawing.Pos)oDrawing.Pos={};res=this.bcr.Read2Spreadsheet(length,function(t,l){return oThis.ReadPos(t,l,oDrawing.Pos)})}else if(c_oSer_DrawingType.Ext==type){oFlags.ext=true;res=this.bcr.Read2Spreadsheet(length,function(t,l){return oThis.ReadExt(t,l,oDrawing.ext)})}else if(c_oSer_DrawingType.Pic==type){oDrawing.image=new Image;res=this.bcr.Read1(length,function(t,l){return oThis.ReadPic(t, l,oDrawing)})}else if(c_oSer_DrawingType.GraphicFrame==type)res=this.bcr.Read1(length,function(t,l){return oThis.ReadGraphicFrame(t,l,oDrawing)});else if(c_oSer_DrawingType.pptxDrawing==type){var graphicObject=this.ReadPptxDrawing();if(graphicObject){oDrawing.graphicObject=graphicObject;if(typeof graphicObject.setDrawingBase!="undefined")graphicObject.setDrawingBase(oDrawing)}}else res=c_oSerConstants.ReadUnknown;return res};this.ReadPptxDrawing=function(){var graphicObject;var oGraphicObject=pptx_content_loader.ReadGraphicObject(this.stream, this.curWorksheet,this.curWorksheet.getDrawingDocument());if(null!=oGraphicObject&&!((oGraphicObject.getObjectType()===AscDFH.historyitem_type_Shape||oGraphicObject.getObjectType()===AscDFH.historyitem_type_ImageShape)&&!oGraphicObject.spPr)&&!AscCommon.IsHiddenObj(oGraphicObject))graphicObject=oGraphicObject;return graphicObject};this.ReadGraphicFrame=function(type,length,oDrawing){var res=c_oSerConstants.ReadOk;if(c_oSer_DrawingType.Chart2==type){var oNewChartSpace=new AscFormat.CChartSpace;var oBinaryChartReader= new AscCommon.BinaryChartReader(this.stream);res=oBinaryChartReader.ExternalReadCT_ChartSpace(length,oNewChartSpace,this.curWorksheet);oDrawing.graphicObject=oNewChartSpace;oNewChartSpace.setBDeleted(false);if(oNewChartSpace.setDrawingBase)oNewChartSpace.setDrawingBase(oDrawing)}else res=c_oSerConstants.ReadUnknown;return res};this.ReadFromTo=function(type,length,oFromTo){var res=c_oSerConstants.ReadOk;if(c_oSer_DrawingFromToType.Col===type){oFromTo.col=this.stream.GetULongLE();if(oFromTo.col<0)oFromTo.col= 0}else if(c_oSer_DrawingFromToType.ColOff===type)oFromTo.colOff=this.stream.GetDoubleLE();else if(c_oSer_DrawingFromToType.Row===type){oFromTo.row=this.stream.GetULongLE();if(oFromTo.row<0)oFromTo.row=0}else if(c_oSer_DrawingFromToType.RowOff===type)oFromTo.rowOff=this.stream.GetDoubleLE();else res=c_oSerConstants.ReadUnknown;return res};this.ReadPos=function(type,length,oPos){var res=c_oSerConstants.ReadOk;if(c_oSer_DrawingPosType.X==type)oPos.X=this.stream.GetDoubleLE();else if(c_oSer_DrawingPosType.Y== type)oPos.Y=this.stream.GetDoubleLE();else res=c_oSerConstants.ReadUnknown;return res};this.ReadExt=function(type,length,oExt){var res=c_oSerConstants.ReadOk;if(c_oSer_DrawingExtType.Cx==type)oExt.cx=this.stream.GetDoubleLE();else if(c_oSer_DrawingExtType.Cy==type)oExt.cy=this.stream.GetDoubleLE();else res=c_oSerConstants.ReadUnknown;return res};this.ReadPic=function(type,length,oDrawing){var res=c_oSerConstants.ReadOk;if(c_oSer_DrawingType.PicSrc==type){var nIndex=this.stream.GetULongLE();var src= this.oMediaArray[nIndex];if(null!=src)oDrawing.image.src=src}else res=c_oSerConstants.ReadUnknown;return res};this.ReadComments=function(type,length,oWorksheet){var res=c_oSerConstants.ReadOk;var oThis=this;if(c_oSerWorksheetsTypes.Comment==type&&AscCommonExcel.asc_CCommentCoords){var oCommentCoords=new AscCommonExcel.asc_CCommentCoords;var aCommentData=[];var oAdditionalData={isThreadedComment:false};res=this.bcr.Read2Spreadsheet(length,function(t,l){return oThis.ReadComment(t,l,oCommentCoords,aCommentData, oAdditionalData)});if(oCommentCoords.isValid()){var i;for(i=0,length=aCommentData.length;i0){oAdditionalData.isThreadedComment=true;var commentData=aCommentData[0];commentData.asc_putSolved(false);commentData.aReplies=[];res=this.bcr.Read1(length,function(t,l){return oThis.ReadThreadedComment(t,l,commentData)})}else res=c_oSerConstants.ReadUnknown;else res=c_oSerConstants.ReadUnknown;return res};this.ReadCommentDatas=function(type,length,aCommentData){var res=c_oSerConstants.ReadOk; var oThis=this;if(c_oSer_Comments.CommentData===type){var oCommentData=new Asc.asc_CCommentData;oCommentData.asc_putDocumentFlag(false);res=this.bcr.Read1(length,function(t,l){return oThis.ReadCommentData(t,l,oCommentData)});if(oCommentData.asc_getDocumentFlag())oCommentData.nId="doc_"+(this.wb.aComments.length+1);else{oCommentData.wsId=this.curWorksheet.Id;oCommentData.nId="sheet"+oCommentData.wsId+"_"+(this.curWorksheet.aComments.length+1)}aCommentData.push(oCommentData)}else res=c_oSerConstants.ReadUnknown; return res};this.ReadCommentData=function(type,length,oCommentData){var res=c_oSerConstants.ReadOk;var oThis=this;if(c_oSer_CommentData.Text==type)oCommentData.asc_putText(this.stream.GetString2LE(length));else if(c_oSer_CommentData.Time==type){var dateMs=AscCommon.getTimeISO8601(this.stream.GetString2LE(length));if(!isNaN(dateMs))oCommentData.asc_putTime(dateMs+"")}else if(c_oSer_CommentData.OOTime==type){var dateMs=AscCommon.getTimeISO8601(this.stream.GetString2LE(length));if(!isNaN(dateMs))oCommentData.asc_putOnlyOfficeTime(dateMs+ "")}else if(c_oSer_CommentData.UserId==type)oCommentData.asc_putUserId(this.stream.GetString2LE(length));else if(c_oSer_CommentData.UserName==type)oCommentData.asc_putUserName(this.stream.GetString2LE(length));else if(c_oSer_CommentData.UserData==type)oCommentData.asc_putUserData(this.stream.GetString2LE(length));else if(c_oSer_CommentData.QuoteText==type)oCommentData.asc_putQuoteText(this.stream.GetString2LE(length));else if(c_oSer_CommentData.Replies==type)res=this.bcr.Read1(length,function(t,l){return oThis.ReadReplies(t, l,oCommentData)});else if(c_oSer_CommentData.Solved==type)oCommentData.asc_putSolved(this.stream.GetBool());else if(c_oSer_CommentData.Document==type)oCommentData.asc_putDocumentFlag(this.stream.GetBool());else if(c_oSer_CommentData.Guid==type)oCommentData.asc_putGuid(this.stream.GetString2LE(length));else res=c_oSerConstants.ReadUnknown;return res};this.ReadConditionalFormatting=function(type,length,oConditionalFormatting){var res=c_oSerConstants.ReadOk;var oThis=this;var oConditionalFormattingRule= null;if(c_oSer_ConditionalFormatting.Pivot===type)oConditionalFormatting.pivot=this.stream.GetBool();else if(c_oSer_ConditionalFormatting.SqRef===type)oConditionalFormatting.setSqRef(this.stream.GetString2LE(length));else if(c_oSer_ConditionalFormatting.ConditionalFormattingRule===type){oConditionalFormattingRule=new AscCommonExcel.CConditionalFormattingRule;var ext={isExt:false};res=this.bcr.Read1(length,function(t,l){return oThis.ReadConditionalFormattingRule(t,l,oConditionalFormattingRule,ext)}); oConditionalFormatting.aRules.push(oConditionalFormattingRule)}else res=c_oSerConstants.ReadUnknown;return res};this.ReadConditionalFormattingRule=function(type,length,oConditionalFormattingRule,ext){var res=c_oSerConstants.ReadOk;var oThis=this;var oConditionalFormattingRuleElement=null;if(c_oSer_ConditionalFormattingRule.AboveAverage===type)oConditionalFormattingRule.aboveAverage=this.stream.GetBool();else if(c_oSer_ConditionalFormattingRule.Bottom===type)oConditionalFormattingRule.bottom=this.stream.GetBool(); else if(c_oSer_ConditionalFormattingRule.DxfId===type){var DxfId=this.stream.GetULongLE();oConditionalFormattingRule.dxf=this.Dxfs[DxfId]}else if(c_oSer_ConditionalFormattingRule.Dxf===type){var oDxf=new AscCommonExcel.CellXfs;res=this.bcr.Read1(length,function(t,l){return oThis.oReadResult.stylesTableReader.ReadDxf(t,l,oDxf)});oConditionalFormattingRule.dxf=oDxf}else if(c_oSer_ConditionalFormattingRule.EqualAverage===type)oConditionalFormattingRule.equalAverage=this.stream.GetBool();else if(c_oSer_ConditionalFormattingRule.Operator=== type)oConditionalFormattingRule.operator=this.stream.GetUChar();else if(c_oSer_ConditionalFormattingRule.Percent===type)oConditionalFormattingRule.percent=this.stream.GetBool();else if(c_oSer_ConditionalFormattingRule.Priority===type)oConditionalFormattingRule.priority=this.stream.GetULongLE();else if(c_oSer_ConditionalFormattingRule.Rank===type)oConditionalFormattingRule.rank=this.stream.GetULongLE();else if(c_oSer_ConditionalFormattingRule.StdDev===type)oConditionalFormattingRule.stdDev=this.stream.GetULongLE(); else if(c_oSer_ConditionalFormattingRule.StopIfTrue===type)oConditionalFormattingRule.stopIfTrue=this.stream.GetBool();else if(c_oSer_ConditionalFormattingRule.Text===type)oConditionalFormattingRule.text=this.stream.GetString2LE(length);else if(c_oSer_ConditionalFormattingRule.TimePeriod===type)oConditionalFormattingRule.timePeriod=this.stream.GetString2LE(length);else if(c_oSer_ConditionalFormattingRule.Type===type)oConditionalFormattingRule.type=this.stream.GetUChar();else if(c_oSer_ConditionalFormattingRule.ColorScale=== type){oConditionalFormattingRuleElement=new AscCommonExcel.CColorScale;res=this.bcr.Read1(length,function(t,l){return oThis.ReadColorScale(t,l,oConditionalFormattingRuleElement)});oConditionalFormattingRule.aRuleElements.push(oConditionalFormattingRuleElement)}else if(c_oSer_ConditionalFormattingRule.DataBar===type){oConditionalFormattingRuleElement=new AscCommonExcel.CDataBar;res=this.bcr.Read1(length,function(t,l){return oThis.ReadDataBar(t,l,oConditionalFormattingRuleElement)});oConditionalFormattingRule.aRuleElements.push(oConditionalFormattingRuleElement)}else if(c_oSer_ConditionalFormattingRule.FormulaCF=== type){oConditionalFormattingRuleElement=new AscCommonExcel.CFormulaCF;oConditionalFormattingRuleElement.Text=this.stream.GetString2LE(length);oConditionalFormattingRule.aRuleElements.push(oConditionalFormattingRuleElement)}else if(c_oSer_ConditionalFormattingRule.IconSet===type){oConditionalFormattingRuleElement=new AscCommonExcel.CIconSet;res=this.bcr.Read1(length,function(t,l){return oThis.ReadIconSet(t,l,oConditionalFormattingRuleElement)});oConditionalFormattingRule.aRuleElements.push(oConditionalFormattingRuleElement)}else if(c_oSer_ConditionalFormattingRule.isExt=== type)ext.isExt=this.stream.GetBool();else res=c_oSerConstants.ReadUnknown;return res};this.ReadColorScale=function(type,length,oColorScale){var res=c_oSerConstants.ReadOk;var oThis=this;var oObject=null;if(c_oSer_ConditionalFormattingRuleColorScale.CFVO===type){oObject=new AscCommonExcel.CConditionalFormatValueObject;res=this.bcr.Read1(length,function(t,l){return oThis.ReadCFVO(t,l,oObject)});oColorScale.aCFVOs.push(oObject)}else if(c_oSer_ConditionalFormattingRuleColorScale.Color===type){var color= ReadColorSpreadsheet2(this.bcr,length);if(null!=color)oColorScale.aColors.push(color)}else res=c_oSerConstants.ReadUnknown;return res};this.ReadDataBar=function(type,length,oDataBar){var res=c_oSerConstants.ReadOk;var oThis=this;var oObject=null;if(c_oSer_ConditionalFormattingDataBar.MaxLength===type)oDataBar.MaxLength=this.stream.GetULongLE();else if(c_oSer_ConditionalFormattingDataBar.MinLength===type)oDataBar.MinLength=this.stream.GetULongLE();else if(c_oSer_ConditionalFormattingDataBar.ShowValue=== type)oDataBar.ShowValue=this.stream.GetBool();else if(c_oSer_ConditionalFormattingDataBar.Color===type){var color=ReadColorSpreadsheet2(this.bcr,length);if(color)oDataBar.Color=color}else if(c_oSer_ConditionalFormattingDataBar.NegativeColor===type){var color=ReadColorSpreadsheet2(this.bcr,length);if(color)oDataBar.NegativeColor=color}else if(c_oSer_ConditionalFormattingDataBar.BorderColor===type){var color=ReadColorSpreadsheet2(this.bcr,length);if(color)oDataBar.BorderColor=color}else if(c_oSer_ConditionalFormattingDataBar.AxisColor=== type){var color=ReadColorSpreadsheet2(this.bcr,length);if(color)oDataBar.AxisColor=color;else oDataBar.AxisColor=new AscCommonExcel.RgbColor(0)}else if(c_oSer_ConditionalFormattingDataBar.NegativeBorderColor===type){var color=ReadColorSpreadsheet2(this.bcr,length);if(color)oDataBar.NegativeBorderColor=color}else if(c_oSer_ConditionalFormattingDataBar.AxisPosition===type)oDataBar.AxisPosition=this.stream.GetULongLE();else if(c_oSer_ConditionalFormattingDataBar.Direction===type)oDataBar.Direction=this.stream.GetULongLE(); else if(c_oSer_ConditionalFormattingDataBar.GradientEnabled===type)oDataBar.Gradient=this.stream.GetBool();else if(c_oSer_ConditionalFormattingDataBar.NegativeBarColorSameAsPositive===type)oDataBar.NegativeBarColorSameAsPositive=this.stream.GetBool();else if(c_oSer_ConditionalFormattingDataBar.NegativeBarBorderColorSameAsPositive===type)oDataBar.NegativeBarBorderColorSameAsPositive=this.stream.GetBool();else if(c_oSer_ConditionalFormattingDataBar.CFVO===type){oObject=new AscCommonExcel.CConditionalFormatValueObject; res=this.bcr.Read1(length,function(t,l){return oThis.ReadCFVO(t,l,oObject)});oDataBar.aCFVOs.push(oObject)}else res=c_oSerConstants.ReadUnknown;return res};this.ReadIconSet=function(type,length,oIconSet){var res=c_oSerConstants.ReadOk;var oThis=this;var oObject=null;if(c_oSer_ConditionalFormattingIconSet.IconSet===type)oIconSet.IconSet=this.stream.GetUChar();else if(c_oSer_ConditionalFormattingIconSet.Percent===type)oIconSet.Percent=this.stream.GetBool();else if(c_oSer_ConditionalFormattingIconSet.Reverse=== type)oIconSet.Reverse=this.stream.GetBool();else if(c_oSer_ConditionalFormattingIconSet.ShowValue===type)oIconSet.ShowValue=this.stream.GetBool();else if(c_oSer_ConditionalFormattingIconSet.CFVO===type){oObject=new AscCommonExcel.CConditionalFormatValueObject;res=this.bcr.Read1(length,function(t,l){return oThis.ReadCFVO(t,l,oObject)});oIconSet.aCFVOs.push(oObject)}else if(c_oSer_ConditionalFormattingIconSet.CFIcon===type){oObject=new AscCommonExcel.CConditionalFormatIconSet;res=this.bcr.Read1(length, function(t,l){return oThis.ReadCFIS(t,l,oObject)});oIconSet.aIconSets.push(oObject)}else res=c_oSerConstants.ReadUnknown;return res};this.ReadCFVO=function(type,length,oCFVO){var res=c_oSerConstants.ReadOk;if(c_oSer_ConditionalFormattingValueObject.Gte===type)oCFVO.Gte=this.stream.GetBool();else if(c_oSer_ConditionalFormattingValueObject.Type===type)oCFVO.Type=this.stream.GetUChar();else if(c_oSer_ConditionalFormattingValueObject.Val===type||c_oSer_ConditionalFormattingValueObject.Formula===type)oCFVO.Val= this.stream.GetString2LE(length);else res=c_oSerConstants.ReadUnknown;return res};this.ReadCFIS=function(type,length,oCFVO){var res=c_oSerConstants.ReadOk;if(c_oSer_ConditionalFormattingIcon.iconSet===type)oCFVO.IconSet=this.stream.GetLong();else if(c_oSer_ConditionalFormattingIcon.iconId===type)oCFVO.IconId=this.stream.GetLong();else res=c_oSerConstants.ReadUnknown;return res};this.ReadSheetViews=function(type,length,aSheetViews){var res=c_oSerConstants.ReadOk;var oThis=this;var oSheetView=null; if(c_oSerWorksheetsTypes.SheetView===type&&0==aSheetViews.length){oSheetView=new AscCommonExcel.asc_CSheetViewSettings;res=this.bcr.Read1(length,function(t,l){return oThis.ReadSheetView(t,l,oSheetView)});aSheetViews.push(oSheetView)}else res=c_oSerConstants.ReadUnknown;return res};this.ReadSheetView=function(type,length,oSheetView){var oThis=this;var res=c_oSerConstants.ReadOk;if(c_oSer_SheetView.ColorId===type)this.stream.GetLong();else if(c_oSer_SheetView.DefaultGridColor===type)this.stream.GetBool(); else if(c_oSer_SheetView.RightToLeft===type)this.stream.GetBool();else if(c_oSer_SheetView.ShowFormulas===type)this.stream.GetBool();else if(c_oSer_SheetView.ShowGridLines===type)oSheetView.showGridLines=this.stream.GetBool();else if(c_oSer_SheetView.ShowOutlineSymbols===type)this.stream.GetBool();else if(c_oSer_SheetView.ShowRowColHeaders===type)oSheetView.showRowColHeaders=this.stream.GetBool();else if(c_oSer_SheetView.ShowRuler===type)this.stream.GetBool();else if(c_oSer_SheetView.ShowWhiteSpace=== type)this.stream.GetBool();else if(c_oSer_SheetView.ShowZeros===type)oSheetView.showZeros=this.stream.GetBool();else if(c_oSer_SheetView.TabSelected===type)this.stream.GetBool();else if(c_oSer_SheetView.TopLeftCell===type)this.stream.GetString2LE(length);else if(c_oSer_SheetView.View===type)this.stream.GetUChar();else if(c_oSer_SheetView.WindowProtection===type)this.stream.GetBool();else if(c_oSer_SheetView.WorkbookViewId===type)this.stream.GetLong();else if(c_oSer_SheetView.ZoomScale===type)oSheetView.asc_setZoomScale(this.stream.GetLong()); else if(c_oSer_SheetView.ZoomScaleNormal===type)this.stream.GetLong();else if(c_oSer_SheetView.ZoomScalePageLayoutView===type)this.stream.GetLong();else if(c_oSer_SheetView.ZoomScaleSheetLayoutView===type)this.stream.GetLong();else if(c_oSer_SheetView.Pane===type){oSheetView.pane=new AscCommonExcel.asc_CPane;res=this.bcr.Read1(length,function(t,l){return oThis.ReadPane(t,l,oSheetView.pane)});oSheetView.pane.init()}else if(c_oSer_SheetView.Selection===type){this.curWorksheet.selectionRange.clean(); res=this.bcr.Read1(length,function(t,l){return oThis.ReadSelection(t,l,oThis.curWorksheet.selectionRange)});this.curWorksheet.selectionRange.update()}else res=c_oSerConstants.ReadUnknown;return res};this.ReadPane=function(type,length,oPane){var res=c_oSerConstants.ReadOk;if(c_oSer_Pane.ActivePane===type)this.stream.GetUChar();else if(c_oSer_Pane.State===type)oPane.state=this.stream.GetString2LE(length);else if(c_oSer_Pane.TopLeftCell===type)oPane.topLeftCell=this.stream.GetString2LE(length);else if(c_oSer_Pane.XSplit=== type)oPane.xSplit=this.stream.GetDoubleLE();else if(c_oSer_Pane.YSplit===type)oPane.ySplit=this.stream.GetDoubleLE();else res=c_oSerConstants.ReadUnknown;return res};this.ReadSelection=function(type,length,selectionRange){var res=c_oSerConstants.ReadOk;if(c_oSer_Selection.ActiveCell===type){var activeCell=AscCommonExcel.g_oRangeCache.getAscRange(this.stream.GetString2LE(length));if(activeCell)selectionRange.activeCell=new AscCommon.CellBase(activeCell.r1,activeCell.c1)}else if(c_oSer_Selection.ActiveCellId=== type)selectionRange.activeCellId=this.stream.GetLong();else if(c_oSer_Selection.Sqref===type){var sqRef=this.stream.GetString2LE(length);var selectionNew=AscCommonExcel.g_oRangeCache.getRangesFromSqRef(sqRef);if(selectionNew.length>0)selectionRange.ranges=selectionNew}else if(c_oSer_Selection.Pane===type)this.stream.GetUChar();else res=c_oSerConstants.ReadUnknown;return res};this.ReadSheetPr=function(type,length,oSheetPr){var oThis=this;var res=c_oSerConstants.ReadOk;if(c_oSer_SheetPr.CodeName=== type)oSheetPr.CodeName=this.stream.GetString2LE(length);else if(c_oSer_SheetPr.EnableFormatConditionsCalculation===type)oSheetPr.EnableFormatConditionsCalculation=this.stream.GetBool();else if(c_oSer_SheetPr.FilterMode===type)oSheetPr.FilterMode=this.stream.GetBool();else if(c_oSer_SheetPr.Published===type)oSheetPr.Published=this.stream.GetBool();else if(c_oSer_SheetPr.SyncHorizontal===type)oSheetPr.SyncHorizontal=this.stream.GetBool();else if(c_oSer_SheetPr.SyncRef===type)oSheetPr.SyncRef=this.stream.GetString2LE(length); else if(c_oSer_SheetPr.SyncVertical===type)oSheetPr.SyncVertical=this.stream.GetBool();else if(c_oSer_SheetPr.TransitionEntry===type)oSheetPr.TransitionEntry=this.stream.GetBool();else if(c_oSer_SheetPr.TransitionEvaluation===type)oSheetPr.TransitionEvaluation=this.stream.GetBool();else if(c_oSer_SheetPr.TabColor===type){var color=ReadColorSpreadsheet2(this.bcr,length);if(color)oSheetPr.TabColor=color}else if(c_oSer_SheetPr.PageSetUpPr===type)res=this.bcr.Read1(length,function(t,l){return oThis.ReadPageSetUpPr(t, l,oSheetPr)});else if(c_oSer_SheetPr.OutlinePr===type)res=this.bcr.Read1(length,function(t,l){return oThis.ReadOutlinePr(t,l,oSheetPr)});else res=c_oSerConstants.ReadUnknown;return res};this.ReadOutlinePr=function(type,length,oSheetPr){var oThis=this;var res=c_oSerConstants.ReadOk;if(c_oSer_SheetPr.ApplyStyles===type)oSheetPr.ApplyStyles=this.stream.GetBool();else if(c_oSer_SheetPr.ShowOutlineSymbols===type)oSheetPr.ShowOutlineSymbols=this.stream.GetBool();else if(c_oSer_SheetPr.SummaryBelow===type)oSheetPr.SummaryBelow= this.stream.GetBool();else if(c_oSer_SheetPr.SummaryRight===type)oSheetPr.SummaryRight=this.stream.GetBool();else res=c_oSerConstants.ReadUnknown;return res};this.ReadPageSetUpPr=function(type,length,oSheetPr){var oThis=this;var res=c_oSerConstants.ReadOk;if(c_oSer_SheetPr.AutoPageBreaks===type)oSheetPr.AutoPageBreaks=this.stream.GetBool();else if(c_oSer_SheetPr.FitToPage===type)oSheetPr.FitToPage=this.stream.GetBool();else res=c_oSerConstants.ReadUnknown;return res};this.ReadSparklineGroups=function(type, length,oWorksheet){var oThis=this;var res=c_oSerConstants.ReadOk;if(c_oSer_Sparkline.SparklineGroup===type){var newSparklineGroup=new AscCommonExcel.sparklineGroup(true);newSparklineGroup.setWorksheet(oWorksheet);res=this.bcr.Read1(length,function(t,l){return oThis.ReadSparklineGroup(t,l,newSparklineGroup)});oWorksheet.aSparklineGroups.push(newSparklineGroup)}else res=c_oSerConstants.ReadUnknown;return res};this.ReadHeaderFooter=function(type,length,headerFooter){var res=c_oSerConstants.ReadOk;var sVal; if(c_oSer_HeaderFooter.AlignWithMargins===type)headerFooter.setAlignWithMargins(this.stream.GetBool());else if(c_oSer_HeaderFooter.DifferentFirst===type)headerFooter.setDifferentFirst(this.stream.GetBool());else if(c_oSer_HeaderFooter.DifferentOddEven===type)headerFooter.setDifferentOddEven(this.stream.GetBool());else if(c_oSer_HeaderFooter.ScaleWithDoc===type)headerFooter.setScaleWithDoc(this.stream.GetBool());else if(c_oSer_HeaderFooter.EvenFooter===type){sVal=this.stream.GetString2LE(length);if(sVal)headerFooter.setEvenFooter(sVal)}else if(c_oSer_HeaderFooter.EvenHeader=== type){sVal=this.stream.GetString2LE(length);if(sVal)headerFooter.setEvenHeader(sVal)}else if(c_oSer_HeaderFooter.FirstFooter===type){sVal=this.stream.GetString2LE(length);if(sVal)headerFooter.setFirstFooter(sVal)}else if(c_oSer_HeaderFooter.FirstHeader===type){sVal=this.stream.GetString2LE(length);if(sVal)headerFooter.setFirstHeader(sVal)}else if(c_oSer_HeaderFooter.OddFooter===type){sVal=this.stream.GetString2LE(length);if(sVal)headerFooter.setOddFooter(sVal)}else if(c_oSer_HeaderFooter.OddHeader=== type){sVal=this.stream.GetString2LE(length);if(sVal)headerFooter.setOddHeader(sVal)}else res=c_oSerConstants.ReadUnknown;return res};this.ReadRowColBreaks=function(type,length,breaks){var oThis=this;var res=c_oSerConstants.ReadOk;if(c_oSer_RowColBreaks.Count===type)breaks.count=this.stream.GetLong();else if(c_oSer_RowColBreaks.ManualBreakCount===type)breaks.manualBreakCount=this.stream.GetLong();else if(c_oSer_RowColBreaks.Break===type){var brk={id:null,man:null,max:null,min:null,pt:null};res=this.bcr.Read1(length, function(t,l){return oThis.ReadRowColBreak(t,l,brk)});breaks.breaks.push(brk)}else res=c_oSerConstants.ReadUnknown;return res};this.ReadRowColBreak=function(type,length,brk){var res=c_oSerConstants.ReadOk;if(c_oSer_RowColBreaks.Id===type)brk.id=this.stream.GetLong();else if(c_oSer_RowColBreaks.Man===type)brk.man=this.stream.GetBool();else if(c_oSer_RowColBreaks.Max===type)brk.max=this.stream.GetLong();else if(c_oSer_RowColBreaks.Min===type)brk.min=this.stream.GetLong();else if(c_oSer_RowColBreaks.Pt=== type)brk.pt=this.stream.GetBool();else res=c_oSerConstants.ReadUnknown;return res};this.ReadLegacyDrawingHF=function(type,length,legacyDrawingHF){var oThis=this;var res=c_oSerConstants.ReadOk;if(c_oSer_LegacyDrawingHF.Drawings===type)res=this.bcr.Read1(length,function(t,l){return oThis.ReadLegacyDrawingHFDrawings(t,l,legacyDrawingHF.drawings)});else if(c_oSer_LegacyDrawingHF.Cfe===type)legacyDrawingHF.cfe=this.stream.GetBool();else if(c_oSer_LegacyDrawingHF.Cff===type)legacyDrawingHF.cff=this.stream.GetBool(); else if(c_oSer_LegacyDrawingHF.Cfo===type)legacyDrawingHF.cfo=this.stream.GetBool();else if(c_oSer_LegacyDrawingHF.Che===type)legacyDrawingHF.che=this.stream.GetBool();else if(c_oSer_LegacyDrawingHF.Chf===type)legacyDrawingHF.chf=this.stream.GetBool();else if(c_oSer_LegacyDrawingHF.Cho===type)legacyDrawingHF.cho=this.stream.GetBool();else if(c_oSer_LegacyDrawingHF.Lfe===type)legacyDrawingHF.lfe=this.stream.GetBool();else if(c_oSer_LegacyDrawingHF.Lff===type)legacyDrawingHF.lff=this.stream.GetBool(); else if(c_oSer_LegacyDrawingHF.Lfo===type)legacyDrawingHF.lfo=this.stream.GetBool();else if(c_oSer_LegacyDrawingHF.Lhe===type)legacyDrawingHF.lhe=this.stream.GetBool();else if(c_oSer_LegacyDrawingHF.Lhf===type)legacyDrawingHF.lhf=this.stream.GetBool();else if(c_oSer_LegacyDrawingHF.Lho===type)legacyDrawingHF.lho=this.stream.GetBool();else if(c_oSer_LegacyDrawingHF.Rfe===type)legacyDrawingHF.rfe=this.stream.GetBool();else if(c_oSer_LegacyDrawingHF.Rff===type)legacyDrawingHF.rff=this.stream.GetBool(); else if(c_oSer_LegacyDrawingHF.Rfo===type)legacyDrawingHF.rfo=this.stream.GetBool();else if(c_oSer_LegacyDrawingHF.Rhe===type)legacyDrawingHF.rhe=this.stream.GetBool();else if(c_oSer_LegacyDrawingHF.Rhf===type)legacyDrawingHF.rhf=this.stream.GetBool();else if(c_oSer_LegacyDrawingHF.Rho===type)legacyDrawingHF.rho=this.stream.GetBool();else res=c_oSerConstants.ReadUnknown;return res};this.ReadLegacyDrawingHFDrawings=function(type,length,drawings){var oThis=this;var res=c_oSerConstants.ReadOk;if(c_oSer_LegacyDrawingHF.Drawing=== type){var drawing={id:null,graphicObject:null};res=this.bcr.Read1(length,function(t,l){return oThis.ReadLegacyDrawingHFDrawing(t,l,drawing)});if(null!==drawing.id&&null!==drawing.graphicObject)drawings.push(drawing)}else res=c_oSerConstants.ReadUnknown;return res};this.ReadLegacyDrawingHFDrawing=function(type,length,drawing){var oThis=this;var res=c_oSerConstants.ReadOk;if(c_oSer_LegacyDrawingHF.DrawingId===type)drawing.id=this.stream.GetString2LE(length);else if(c_oSer_LegacyDrawingHF.DrawingShape=== type){var graphicObject=this.ReadPptxDrawing();if(graphicObject)drawing.graphicObject=graphicObject}else res=c_oSerConstants.ReadUnknown;return res};this.ReadSparklineGroup=function(type,length,oSparklineGroup){var oThis=this;var res=c_oSerConstants.ReadOk;if(c_oSer_Sparkline.ManualMax===type)oSparklineGroup.manualMax=this.stream.GetDoubleLE();else if(c_oSer_Sparkline.ManualMin===type)oSparklineGroup.manualMin=this.stream.GetDoubleLE();else if(c_oSer_Sparkline.LineWeight===type)oSparklineGroup.lineWeight= this.stream.GetDoubleLE();else if(c_oSer_Sparkline.Type===type)oSparklineGroup.type=this.stream.GetUChar();else if(c_oSer_Sparkline.DateAxis===type)oSparklineGroup.dateAxis=this.stream.GetBool();else if(c_oSer_Sparkline.DisplayEmptyCellsAs===type)oSparklineGroup.displayEmptyCellsAs=this.stream.GetUChar();else if(c_oSer_Sparkline.Markers===type)oSparklineGroup.markers=this.stream.GetBool();else if(c_oSer_Sparkline.High===type)oSparklineGroup.high=this.stream.GetBool();else if(c_oSer_Sparkline.Low=== type)oSparklineGroup.low=this.stream.GetBool();else if(c_oSer_Sparkline.First===type)oSparklineGroup.first=this.stream.GetBool();else if(c_oSer_Sparkline.Last===type)oSparklineGroup.last=this.stream.GetBool();else if(c_oSer_Sparkline.Negative===type)oSparklineGroup.negative=this.stream.GetBool();else if(c_oSer_Sparkline.DisplayXAxis===type)oSparklineGroup.displayXAxis=this.stream.GetBool();else if(c_oSer_Sparkline.DisplayHidden===type)oSparklineGroup.displayHidden=this.stream.GetBool();else if(c_oSer_Sparkline.MinAxisType=== type)oSparklineGroup.minAxisType=this.stream.GetUChar();else if(c_oSer_Sparkline.MaxAxisType===type)oSparklineGroup.maxAxisType=this.stream.GetUChar();else if(c_oSer_Sparkline.RightToLeft===type)oSparklineGroup.rightToLeft=this.stream.GetBool();else if(c_oSer_Sparkline.ColorSeries===type)oSparklineGroup.colorSeries=ReadColorSpreadsheet2(this.bcr,length);else if(c_oSer_Sparkline.ColorNegative===type)oSparklineGroup.colorNegative=ReadColorSpreadsheet2(this.bcr,length);else if(c_oSer_Sparkline.ColorAxis=== type)oSparklineGroup.colorAxis=ReadColorSpreadsheet2(this.bcr,length);else if(c_oSer_Sparkline.ColorMarkers===type)oSparklineGroup.colorMarkers=ReadColorSpreadsheet2(this.bcr,length);else if(c_oSer_Sparkline.ColorFirst===type)oSparklineGroup.colorFirst=ReadColorSpreadsheet2(this.bcr,length);else if(c_oSer_Sparkline.ColorLast===type)oSparklineGroup.colorLast=ReadColorSpreadsheet2(this.bcr,length);else if(c_oSer_Sparkline.ColorHigh===type)oSparklineGroup.colorHigh=ReadColorSpreadsheet2(this.bcr,length); else if(c_oSer_Sparkline.ColorLow===type)oSparklineGroup.colorLow=ReadColorSpreadsheet2(this.bcr,length);else if(c_oSer_Sparkline.Ref===type)oSparklineGroup.f=this.stream.GetString2LE(length);else if(c_oSer_Sparkline.Sparklines===type)res=this.bcr.Read1(length,function(t,l){return oThis.ReadSparklines(t,l,oSparklineGroup)});else res=c_oSerConstants.ReadUnknown;return res};this.ReadSparklines=function(type,length,oSparklineGroup){var oThis=this;var res=c_oSerConstants.ReadOk;if(c_oSer_Sparkline.Sparkline=== type){var newSparkline=new AscCommonExcel.sparkline;res=this.bcr.Read1(length,function(t,l){return oThis.ReadSparkline(t,l,newSparkline)});oSparklineGroup.arrSparklines.push(newSparkline)}else res=c_oSerConstants.ReadUnknown;return res};this.ReadSparkline=function(type,length,oSparkline){var res=c_oSerConstants.ReadOk;if(c_oSer_Sparkline.SparklineRef===type)oSparkline.setF(this.stream.GetString2LE(length));else if(c_oSer_Sparkline.SparklineSqRef===type)oSparkline.setSqRef(this.stream.GetString2LE(length)); else res=c_oSerConstants.ReadUnknown;return res};this.ReadReplies=function(type,length,oCommentData){var res=c_oSerConstants.ReadOk;var oThis=this;if(c_oSer_CommentData.Reply===type){var oReplyData=new Asc.asc_CCommentData;res=this.bcr.Read1(length,function(t,l){return oThis.ReadCommentData(t,l,oReplyData)});oCommentData.asc_addReply(oReplyData)}else res=c_oSerConstants.ReadUnknown;return res};this.ReadThreadedComment=function(type,length,oCommentData){var res=c_oSerConstants.ReadOk;var oThis=this; if(c_oSer_ThreadedComment.dT===type){oCommentData.asc_putTime("");var dateMs=AscCommon.getTimeISO8601(this.stream.GetString2LE(length));if(!isNaN(dateMs))oCommentData.asc_putOnlyOfficeTime(dateMs+"")}else if(c_oSer_ThreadedComment.personId===type){var person=this.personList[this.stream.GetString2LE(length)];if(person){oCommentData.asc_putUserName(person.displayName);oCommentData.asc_putUserId(person.userId);oCommentData.asc_putProviderId(person.providerId)}}else if(c_oSer_ThreadedComment.id===type)oCommentData.asc_putGuid(this.stream.GetString2LE(length)); else if(c_oSer_ThreadedComment.done===type)oCommentData.asc_putSolved(this.stream.GetBool());else if(c_oSer_ThreadedComment.text===type)oCommentData.asc_putText(this.stream.GetString2LE(length));else if(c_oSer_ThreadedComment.reply===type){var reply=new Asc.asc_CCommentData;res=this.bcr.Read1(length,function(t,l){return oThis.ReadThreadedComment(t,l,reply)});oCommentData.asc_addReply(reply)}else res=c_oSerConstants.ReadUnknown;return res};this.ReadThreadedCommentMention=function(type,length,mention){var res= c_oSerConstants.ReadOk;if(c_oSer_ThreadedComment.mentionpersonId===type)mention.mentionpersonId=this.stream.GetString2LE(length);else if(c_oSer_ThreadedComment.mentionId===type)mention.mentionId=this.stream.GetString2LE(length);else if(c_oSer_ThreadedComment.startIndex===type)mention.startIndex=this.stream.GetULong();else if(c_oSer_ThreadedComment.length===type)mention.length=this.stream.GetULong();else res=c_oSerConstants.ReadUnknown;return res}}function Binary_CalcChainTableReader(stream,aCalcChain){this.stream= stream;this.aCalcChain=aCalcChain;this.bcr=new Binary_CommonReader(this.stream);this.Read=function(){var oThis=this;return this.bcr.ReadTable(function(t,l){return oThis.ReadCalcChainContent(t,l)})};this.ReadCalcChainContent=function(type,length){var res=c_oSerConstants.ReadOk;var oThis=this;if(c_oSer_CalcChainType.CalcChainItem===type){var oNewCalcChain={};res=this.bcr.Read2Spreadsheet(length,function(t,l){return oThis.ReadCalcChain(t,l,oNewCalcChain)});this.aCalcChain.push(oNewCalcChain)}else res= c_oSerConstants.ReadUnknown;return res};this.ReadCalcChain=function(type,length,oCalcChain){var res=c_oSerConstants.ReadOk;if(c_oSer_CalcChainType.Array==type)oCalcChain.Array=this.stream.GetBool();else if(c_oSer_CalcChainType.SheetId==type)oCalcChain.SheetId=this.stream.GetULongLE();else if(c_oSer_CalcChainType.DependencyLevel==type)oCalcChain.DependencyLevel=this.stream.GetBool();else if(c_oSer_CalcChainType.Ref==type)oCalcChain.Ref=this.stream.GetString2LE(length);else if(c_oSer_CalcChainType.ChildChain== type)oCalcChain.ChildChain=this.stream.GetBool();else if(c_oSer_CalcChainType.NewThread==type)oCalcChain.NewThread=this.stream.GetBool();else res=c_oSerConstants.ReadUnknown;return res}}function Binary_OtherTableReader(stream,oMedia,wb){this.stream=stream;this.oMedia=oMedia;this.wb=wb;this.bcr=new Binary_CommonReader(this.stream);this.Read=function(){var oThis=this;var oRes=this.bcr.ReadTable(function(t,l){return oThis.ReadOtherContent(t,l)});return oRes};this.ReadOtherContent=function(type,length){var res= c_oSerConstants.ReadOk;var oThis=this;if(c_oSer_OtherType.Media===type)res=this.bcr.Read1(length,function(t,l){return oThis.ReadMediaContent(t,l)});else if(c_oSer_OtherType.Theme===type)this.wb.theme=pptx_content_loader.ReadTheme(this,this.stream);else res=c_oSerConstants.ReadUnknown;return res};this.ReadMediaContent=function(type,length){var res=c_oSerConstants.ReadOk;var oThis=this;if(c_oSer_OtherType.MediaItem===type){var oNewMedia={};res=this.bcr.Read1(length,function(t,l){return oThis.ReadMediaItem(t, l,oNewMedia)});if(null!=oNewMedia.id&&null!=oNewMedia.src)this.oMedia[oNewMedia.id]=oNewMedia.src}else res=c_oSerConstants.ReadUnknown;return res};this.ReadMediaItem=function(type,length,oNewMedia){var res=c_oSerConstants.ReadOk;if(c_oSer_OtherType.MediaSrc===type){var src=this.stream.GetString2LE(length);if(0!=src.indexOf("http:")&&0!=src.indexOf("data:")&&0!=src.indexOf("https:")&&0!=src.indexOf("ftp:")&&0!=src.indexOf("file:"))oNewMedia.src=AscCommon.g_oDocumentUrls.getImageUrl(src);else oNewMedia.src= src}else if(c_oSer_OtherType.MediaId===type)oNewMedia.id=this.stream.GetULongLE();else res=c_oSerConstants.ReadUnknown;return res}}function getBinaryOtherTableGVar(wb){AscCommonExcel.g_oColorManager.setTheme(wb.theme);var sMinorFont=null;if(null!=wb.theme.themeElements&&null!=wb.theme.themeElements.fontScheme&&null!=wb.theme.themeElements.fontScheme.minorFont)sMinorFont=wb.theme.themeElements.fontScheme.minorFont.latin;var sDefFont="Calibri";if(null!=sMinorFont&&""!=sMinorFont)sDefFont=sMinorFont; g_oDefaultFormat.Font=new AscCommonExcel.Font;g_oDefaultFormat.Font.assignFromObject({fn:sDefFont,scheme:EFontScheme.fontschemeMinor,fs:11,c:AscCommonExcel.g_oColorManager.getThemeColor(AscCommonExcel.g_nColorTextDefault)});g_oDefaultFormat.Fill=g_oDefaultFormat.FillAbs=new AscCommonExcel.Fill;g_oDefaultFormat.Border=g_oDefaultFormat.BorderAbs=new AscCommonExcel.Border({l:new AscCommonExcel.BorderProp,t:new AscCommonExcel.BorderProp,r:new AscCommonExcel.BorderProp,b:new AscCommonExcel.BorderProp, d:new AscCommonExcel.BorderProp,ih:new AscCommonExcel.BorderProp,iv:new AscCommonExcel.BorderProp,dd:false,du:false});g_oDefaultFormat.Num=g_oDefaultFormat.NumAbs=new AscCommonExcel.Num({f:"General"});g_oDefaultFormat.Align=g_oDefaultFormat.AlignAbs=new AscCommonExcel.Align({hor:null,indent:0,RelativeIndent:0,shrink:false,angle:0,ver:Asc.c_oAscVAlign.Bottom,wrap:false})}function BinaryPersonReader(stream,personList){this.stream=stream;this.personList=personList;this.bcr=new Binary_CommonReader(this.stream); this.Read=function(){var oThis=this;var oRes=this.bcr.ReadTable(function(t,l){return oThis.ReadPersonList(t,l)});return oRes};this.ReadPersonList=function(type,length,persons){var res=c_oSerConstants.ReadOk;var oThis=this;if(c_oSer_Person.person===type){var person={providerId:"",userId:"",displayName:""};res=this.bcr.Read1(length,function(t,l){return oThis.ReadPerson(t,l,person)})}else res=c_oSerConstants.ReadUnknown;return res};this.ReadPerson=function(type,length,person){var res=c_oSerConstants.ReadOk; var oThis=this;if(c_oSer_Person.id===type)this.personList[this.stream.GetString2LE(length)]=person;else if(c_oSer_Person.providerId===type)person.providerId=this.stream.GetString2LE(length);else if(c_oSer_Person.userId===type)person.userId=this.stream.GetString2LE(length);else if(c_oSer_Person.displayName===type)person.displayName=this.stream.GetString2LE(length);else res=c_oSerConstants.ReadUnknown;return res}}function BinaryFileReader(isCopyPaste){this.stream=null;this.copyPasteObj={isCopyPaste:isCopyPaste, activeRange:null,selectAllSheet:null};this.oReadResult={tableCustomFunc:[],sheetData:[],stylesTableReader:null,pivotCacheDefinitions:{},macros:null,slicerCaches:{},tableIds:{},defNames:[],sheetIds:{}};this.getbase64DecodedData=function(szSrc){var isBase64=typeof szSrc==="string";var srcLen=szSrc.length;var nWritten=0;var nType=0;var index=AscCommon.c_oSerFormat.Signature.length;var version="";var dst_len="";while(true){index++;var _c=isBase64?szSrc.charCodeAt(index):szSrc[index];if(_c==";".charCodeAt(0))if(0== nType){nType=1;continue}else{index++;break}if(0==nType)version+=String.fromCharCode(_c);else dst_len+=String.fromCharCode(_c)}var nVersion=0;if(version.length>1){var nTempVersion=version.substring(1)-0;if(nTempVersion)AscCommon.CurFileVersion=nVersion=nTempVersion}var stream;if(Asc.c_nVersionNoBase64!==nVersion){var dstLen=parseInt(dst_len);var pointer=g_memory.Alloc(dstLen);stream=new AscCommon.FT_Stream2(pointer.data,dstLen);stream.obj=pointer.obj;var dstPx=stream.data;if(window.chrome)while(index< srcLen){var dwCurr=0;var i;var nBits=0;for(i=0;i<4;i++){if(index>=srcLen)break;var nCh=DecodeBase64Char(isBase64?szSrc.charCodeAt(index++):szSrc[index++]);if(nCh==-1){i--;continue}dwCurr<<=6;dwCurr|=nCh;nBits+=6}dwCurr<<=24-nBits;for(i=0;i>>16;dwCurr<<=8}}else{var p=b64_decode;while(index=srcLen)break;var nCh=p[isBase64?szSrc.charCodeAt(index++):szSrc[index++]];if(nCh==undefined){i--; continue}dwCurr<<=6;dwCurr|=nCh;nBits+=6}dwCurr<<=24-nBits;for(i=0;i>>16;dwCurr<<=8}}}}else{stream=new AscCommon.FT_Stream2(szSrc,szSrc.length);stream.EnterFrame(index);stream.Seek(index)}return stream};this.getbase64DecodedData2=function(szSrc,szSrcOffset,stream,streamOffset){var srcLen=szSrc.length;var nWritten=streamOffset;var dstPx=stream.data;var index=szSrcOffset;if(window.chrome)while(index= srcLen)break;var nCh=DecodeBase64Char(szSrc.charCodeAt(index++));if(nCh==-1){i--;continue}dwCurr<<=6;dwCurr|=nCh;nBits+=6}dwCurr<<=24-nBits;var nLen=nBits/8|0;for(i=0;i>>16;dwCurr<<=8}}else{var p=b64_decode;while(index=srcLen)break;var nCh=p[szSrc.charCodeAt(index++)];if(nCh==undefined){i--;continue}dwCurr<<=6;dwCurr|=nCh;nBits+=6}dwCurr<<=24-nBits;var nLen=nBits/8|0;for(i=0;i>>16;dwCurr<<=8}}}return nWritten};this.Read=function(data,wb){var t=this;pptx_content_loader.Clear();var pasteBinaryFromExcel=false;if(this.copyPasteObj&&this.copyPasteObj.isCopyPaste&&typeof editor!="undefined"&&editor)pasteBinaryFromExcel=true;this.stream=this.getbase64DecodedData(data);if(!pasteBinaryFromExcel)History.TurnOff();AscCommonExcel.executeInR1C1Mode(false,function(){t.ReadMainTable(wb)});if(!this.copyPasteObj.isCopyPaste){ReadDefCellStyles(wb,wb.CellStyles.DefaultStyles); ReadDefSlicerStyles(wb,wb.CellStyles.DefaultStyles);wb.SlicerStyles.concatStyles()}if(pptx_content_loader.Reader)pptx_content_loader.Reader.AssignConnectedObjects();if(!pasteBinaryFromExcel)History.TurnOn();pptx_content_loader.Clear(true)};this.ReadMainTable=function(wb){var res=c_oSerConstants.ReadOk;res=this.stream.EnterFrame(1);if(c_oSerConstants.ReadOk!=res)return res;var mtLen=this.stream.GetUChar();var aSeekTable=[];var nOtherTableOffset=null;var nSharedStringTableOffset=null;var nStyleTableOffset= null;var nWorkbookTableOffset=null;var nPersonListTableOffset=null;var fileStream;for(var i=0;i0){bboxTmp=new Asc.Range(bbox.c1,bbox.r1,bbox.c2,bbox.r1);sheetMergedStyles.setTablePivotStyle(bboxTmp,this.headerRow.dxf)}if(this.totalRow&&totalsRowCount>0){bboxTmp=new Asc.Range(bbox.c1,bbox.r2,bbox.c2,bbox.r2);sheetMergedStyles.setTablePivotStyle(bboxTmp,this.totalRow.dxf)}if(this.firstHeaderCell&&headerRowCount>0){bboxTmp= new Asc.Range(bbox.c1,bbox.r1,bbox.c1,bbox.r1);sheetMergedStyles.setTablePivotStyle(bboxTmp,this.firstHeaderCell.dxf)}if(this.lastHeaderCell&&headerRowCount>0){bboxTmp=new Asc.Range(bbox.c2,bbox.r1,bbox.c2,bbox.r1);sheetMergedStyles.setTablePivotStyle(bboxTmp,this.lastHeaderCell.dxf)}if(this.firstTotalCell&&totalsRowCount>0){bboxTmp=new Asc.Range(bbox.c1,bbox.r2,bbox.c1,bbox.r2);sheetMergedStyles.setTablePivotStyle(bboxTmp,this.firstTotalCell.dxf)}if(this.lastTotalCell&&totalsRowCount>0){bboxTmp= new Asc.Range(bbox.c2,bbox.r2,bbox.c2,bbox.r2);sheetMergedStyles.setTablePivotStyle(bboxTmp,this.lastTotalCell.dxf)}};CTableStyle.prototype.readAttributes=function(attr,uq){if(attr()){var vals=attr();var val;val=vals["name"];if(undefined!==val){this.name=AscCommon.unleakString(uq(val));this.displayName=this.name}val=vals["displayName"];if(undefined!==val)this.displayName=AscCommon.unleakString(uq(val));val=vals["pivot"];if(undefined!==val)this.pivot=AscCommon.getBoolFromXml(val);val=vals["table"]; if(undefined!==val)this.table=AscCommon.getBoolFromXml(val)}};CTableStyle.prototype.onStartNode=function(elem,attr,uq){var newContext=this;if("tableStyleElement"===elem){newContext=new CTableStyleElement;if(newContext.readAttributes)newContext.readAttributes(attr,uq)}else newContext=null;return newContext};function CTableStyleElement(){this.size=1;this.dxf=null}CTableStyleElement.prototype.readAttributes=function(attr,uq){if(attr()){var vals=attr();var val;val=vals["type"];if(undefined!==val){var tableStyle= openXml.SaxParserDataTransfer.curTableStyle;if("wholeTable"===val)tableStyle.wholeTable=this;else if("headerRow"===val)tableStyle.headerRow=this;else if("totalRow"===val)tableStyle.totalRow=this;else if("firstColumn"===val)tableStyle.firstColumn=this;else if("lastColumn"===val)tableStyle.lastColumn=this;else if("firstRowStripe"===val)tableStyle.firstRowStripe=this;else if("secondRowStripe"===val)tableStyle.secondRowStripe=this;else if("firstColumnStripe"===val)tableStyle.firstColumnStripe=this;else if("secondColumnStripe"=== val)tableStyle.secondColumnStripe=this;else if("firstHeaderCell"===val)tableStyle.firstHeaderCell=this;else if("lastHeaderCell"===val)tableStyle.lastHeaderCell=this;else if("firstTotalCell"===val)tableStyle.firstTotalCell=this;else if("lastTotalCell"===val)tableStyle.lastTotalCell=this;else if("firstSubtotalColumn"===val)tableStyle.firstSubtotalColumn=this;else if("secondSubtotalColumn"===val)tableStyle.secondSubtotalColumn=this;else if("thirdSubtotalColumn"===val)tableStyle.thirdSubtotalColumn=this; else if("firstSubtotalRow"===val)tableStyle.firstSubtotalRow=this;else if("secondSubtotalRow"===val)tableStyle.secondSubtotalRow=this;else if("thirdSubtotalRow"===val)tableStyle.thirdSubtotalRow=this;else if("blankRow"===val)tableStyle.blankRow=this;else if("firstColumnSubheading"===val)tableStyle.firstColumnSubheading=this;else if("secondColumnSubheading"===val)tableStyle.secondColumnSubheading=this;else if("thirdColumnSubheading"===val)tableStyle.thirdColumnSubheading=this;else if("firstRowSubheading"=== val)tableStyle.firstRowSubheading=this;else if("secondRowSubheading"===val)tableStyle.secondRowSubheading=this;else if("thirdRowSubheading"===val)tableStyle.thirdRowSubheading=this;else if("pageFieldLabels"===val)tableStyle.pageFieldLabels=this;else if("pageFieldValues"===val)tableStyle.pageFieldValues=this}val=vals["size"];if(undefined!==val)this.size=val-0;val=vals["dxfId"];if(undefined!==val)this.dxf=openXml.SaxParserDataTransfer.dxfs[tableStyle.pivot?val-0:val-1]||null}};function ReadDefTableStyles(wb){var stylesZip= "UEsDBBQAAAAIALZ9okpdRKh71y8AAPdGCAAVAAAAcHJlc2V0VGFibGVTdHlsZXMueG1s7FZRjpswEP2v1DtY/u8SCCRGCt2PVStVaququxcgwQRLxkZmyG56tX70SL1CDVliDK3CtkIVq40UyR783psxM+j9/P5jc/2Qc3SgqmRSRNi9WmBExU4mTOwjXEH6huDrt69fbQpFSwp38ZbTWzhyWuogQhsT+EQTVuUeaeL6SfKQlmgnKwERXuMm2sbbTb1NGedmX0eKGIAq8V4/QI/ru2NBI1xKzpKWyRDsbySXCkFGc30oxAhYrbm4CkL9W5Jw5YXEXfgkwE4fvP1r8Mbp5NktyDEVNVtd70vxvy1eCrBZtz2VXTc9Fzu2koY/a6UaLFVClU0AskAlHLmG583IWU0xkAgHr04TWKInkRlc5Tjm6UdrrYeDuCtCSOgvXd/3LozWRfD40brUHJym0HYHZExc6A2T1lKntQ4CErih5+u/O0irprZDiu2zqdQa7kHjTyNmJsJcLYDMJ1I7kdvBA1XAdjGfSLKlt8OZVOybFDCZrBEY9cFp12W7AeM2WifhYpTQNK54x4pEuO9CwvOpL+wg4fGUWX+su8tdtaVaUkjEdaFDY4NRoQnq0rHxNShhZcHj42cDQieaEwx5xKhYOu84zakABM036D6TnDZwjPQVfEhqcmcMMqNxQtVXeX8GrsYBQULMu7hgHC5lqoQbyatcnKH+OCiPB8jlE0R1sregWGHuyHtyyj2CbtNuHIM/9yP0Ha8z7Iw/WOH1f7bC5F/cIJm5FZ5X8bM0qHOzwuTFCv9it45tAABhIAZuhX//yZiAhqAPgYzgwtKdWStCYd1JYVkpLCeFZaWw/BRWDoX1LYXZpDBN4ccpzILCI5nCRDRIcQrXii8J1GoUpil8Zq0IhbmTwlgpjJPCWCmMn8LkUJhvKTzZrYMaAGIYBoKgLjZ/aIegn6Zy6jQQ9rHScJPCHAo3pzAXFEYxhZnRIM0p7BVvCVQ3CnMofGatDIV5J4UppTCVFKaUwtRTmDUU5rMUxiaFMRRuTmEsKBzFFEZGgzCnsFe8JVDdKIyh8Jm1MhTGnRSGlMJQUhhSCkNPYdRQGM9SODYpHEPh5hSOBYW/YgpHRoNhTmGveEugulE4hsI/e/eOw0AIAwH0RJEwOHzukz5V7p9NpCgNyBIyLHjnABSMNfCo0KpWP4V5TQrzVArzTArzVArzfArzORTmy1I4dFI4gMLGKRwaFPYnU9j9uno7ysql5OhjjMmlcE9FuLOE1TtgeLftb4nU3ThM4LB6uYg/puXELvHdR09CuYTVJ4J4gHr1aTvAr6OQOlKixrnpO7npwU3j3PQNbtJC3FziSvi2G9tXkYub7AsZ6Csg/CKpCO5+PF/HUbSyu83M6T+Mhvfkd5Asvv6RrP22Uw3KADGpk5gEYhonJjWI6UBMENMKprKYWEYqtVRATMtzAjFBTDViuk5iOhDTODFdnZhUQEwQ0wqmkphYQiq1VEBMy3MCMUFMLWJS6SMmFRDTNjGpNIiZQUwQ0wqmophYRCq1VEBMy3MCMUFMNWLmTmLixyzrxMwNYiYQ883euVs3DANBsCWKxIeox6H7z+0cgqCHo3QfTgEIsJfMJLsgZhSYytPELPQD3CQVENPKnUBMEPMyxKyLiMkSVXTErAPELCAmiBkFptI0sUQqz1IBMSPfCcQEMS9DzLKImCw8RUfMMkDMDGKCmFFgap4YqTxNBcSMfKd7Iaa7OijLIEwl1HcBPi8CPLtU0QE+DwBee5eqSfrom/Myfl+ft40/1EGRinoqc2/5R5Sf39eMst1KW7SKsN4/hzVrufwCkt2K9rndCqlHbB/0iC22R6RFj2DUK7pHpIFHaI96nRKUPp17hK/P2+YROr9IRT0VPML8LfCI7gISjzjxiIAecSx6BIto0T3iGHiE9iJalaB0de4Rvj5vm0codiMV9VTwCPO3wCO6C0g8ouIRAT1iX/QIpu6ie8Q+8AjtqbsiQeni3CN8fd42j9DeRyrqqeAR5m+BR3QXkHhEwSMCesRj0SPYM4zuEY+BR2jvGWYJSmfnHuHr87Z5hIpGUlFPBY8wfws8oruAxCMyHhHQI7ZFj2C0MrpHDEYrtTcrk4Skk3ON8PV52zhCDSepqKeCRpi/BRrRXUCiEQmNiKcRi7ukzJIGl4jBKqmlUdIjtXaWvZRSt3rkOmnxmL32YBHevm+bR+haJRX1VPAI87fAI8x3fmMS6iaxOD/L+mxwkxiMz1Y7pa8WGuf+2Lub3LZhIAzDV+kRTIm/52m7bLvo/YGiCoomyKSqx57h8NOXdQyKkGk+q3eOc83NqzRyfhdCr/ScQQXjUoQM06T1mBUgn919jNFK6SWNLaex6ccI6Fc7nzBgsNjJ6IFnrCbr/xyQ+kWxhwo0nS05dhbclk22ZY0TAo1QITvONTePI77VbNkvZcswnVJnW3ZXW3ZPW3ZXW/YZtuxXtWXV2ZLzZsFtWWVbljhxyAhlquNcc/M44lvNlu1StgzTrnS2ZXO1ZfO0ZXO1ZZthy3ZVWxadLTkKFdyWRbZljhMMjFArOs41N48jvtVsWS9lyzA9Q2dbVldbVk9bVldb1hm2rFe1ZdbZkuMxwW2ZZVvucSJyEQo2x7nm5nHEt5oty6VsGaZx52zL4mrL4mnL4mrLMsOW5aq2VM5M5MhEcFvusi23OGWxCFmT41xz8zjiW82W+VK2DBM+c7ZldrVl9rRldrVlnmHLfFVbKufocYweuC0/mqIXqDgVInVxnGxuH0l9q/kyXcqXYYJYzr40QOTzpWjAQTvzYcMu6WDHuWbgsHs31uz4bm2JASAGgICptRrq/jcAFGeDby/2b8ePzckeo4UZn1D0Mcj2GLR5VErTv0p9AHIYBiAHqP9eLvR7/Xd86tNG/8H67w/0RP/dGOlhpAdYZdN5tFSkx8d/Hc9/3SCtY9DPMYjk2PivG/qvQ/vvpvMf55GC++8m+i8NhnQY0gFW2XQeLRXS8fFfw/NfM8jfGDRuDEI2Nv5rhv5ryP5LQ+W/xFGS2P5LQ/ZfZ+yGsRtglU3n0VKxGx//VTz/VYNEjUGHxiA2Y+O/aui/Cu2/rvMfBwCC+6/L/msM0jBIA6yy6TxaKkjj47+C579ikJExaMUYBGFs/FcM/Veg/dd0/uOQPnD/Ndl/ldEYRmOAVTadR0tFY3z8l/H8lw1SLwY9F4Noi43/sqH/MrT/qs5/HKQH7r8q+68w7MKwCw0YyoDpAgZMeAZkqeW5BkwfGpANmH8bsOgMyIF34AYssgGzZMB0ExDo10uQT97iT/R4rQHnedYE3nRpLZWT8W4EjvNoEmQjkPWZt/JcX3BZENw4F1zWCm5oBdeVgmt6wVW14IpGcPfK8efXzz++f3n/8f1RAG73rG9FyCwTUpxrNywF2cMJskcTZA8myMBtE8SVEII03oLs59klSEGyX4MmyF0nyJ2CpCBNBbnLgtzcBdnCCbJFE2QLJsjAdRTElRCSNt6CbOfhJkhBsoCDJshNJ8iNgqQgTQW5yYJM7oKs4QRZowmyBhNk4L4K4koIURxvQdbz9BOkINnQQRNk0gkyUZAUpKkgkyzIm7sgSzhBlmiCLMEEGbjQgrgSQlbHW5DlPB4FKUhWeNAEedMJ8kZBUpCmgpTHqQx3QOZwgMzRAJmDATJw4gVxJYQujzcg83l9ChKQzPiAAXKo/DjIR/LRko9D1GN312MKp8cUTY8pmB4Dx2EQV0Io+njr8TxclSD1yAAQmB67So+deqQeLfXYRT3OnuQyHolZj8VL3mtt/j4+jFeVyS2P0Vr6/df62IUrlc/w8gxA7aVnbtw/8iJvf833zEbO33/WDTrhnBPsxmETbVQn26g/woO+uI3W2vx9V2MP4JKFn2H9qlCfaqNuYqM13zPrL6/uO5WNOAME20ZVtFGZbKP2CA/a4jZaa/P3XY0tgEsWfob1ezltqo2aiY3WfM/smry671Q2+sXeueRWEQNRdCsRK+iPv3PEiBkrSOAJIkJAkLB+yEuCWjw/HFfTct3qm3Hccbn8OSfqdrE2hm02KpfGcJ3ZKKzBgwDORljBtx2NQQGXAPcB/yaY0JWNwiZshJln3tixOO9EbOTIRqbZqFzzYe7MRn4NHnhwNsIKvu1o9Aq4BLgP+Hec+K5s5DdhI8w88y6KxXknYqOZbGSajcrVDKbObOTW4IEDZyOs4NuORqeAS4D7gH99h+vKRm4TNsLMM69ZWJx3IjaayEam2ejMPf2d2WhYbCmjyzknF90QnZ/CVPlyudYagY7Qwoe8NUDT/QTQV0r8J24ZN+EWzTnjZ/yLXxbRyUg6MU0nJ3fAv778/nkc9Xwp5nPOeU45TDmNg0uVW50rjRHYBCt4SF7ofnRruzmp601JuX43BNi61faFp0YoOR40rVDy0OhiJJSYhZLjrChDyaDnNeT2czmAQwlW8JCoQCjRBCUvqGANtm61fT6gFkoGEZQMhBLTUDKUoCTrecWl/Vh24EyCFTwkKZBJNDFJfVajrVttr6ZpZZIsQZJMIrFMJLkEJEnReyWzyzmFKYQQhzj7WPk/b6U1xP+A0cKHRAVCiSYoqb8uxTfCrGJJkmBJIpZYxpJUwhI1ZRnKb9CX13a9LcLGhhS67opOqkbyBbWavhw3/X+zyVCs1mS2KBdCChfFsaQ5fHjEPpL4F2sVkihqW09iXRGaUsjSeCuUoeFFeXE+Hp9hxtpyfaXY1ZYo0BbWTLGtLbGkLWoqpghwJWFrC1Louk9bVSNJbbGaQmpLNYlybUnUlv4JpLZ0T0GqrxS72hIE2sJyRra1JZS0RU0xIwGuRGxtQQpd92mraiSpLVZTSG2pJlGuLZHa0j+B1JbuKYj1lWJXW7xAW1hpzLa2+JK2qKkzJsCVgK0tSKHrPm1VjSS1xWoKqS3VJMq1JVBb+ieQ2tI9BaG+UuxqixNoC4sA2tYWV9IWNSUABbjisbUFKXTdp62qkaS2WE0htaWaRLm2eGpL/wRSW7qnwNdXil1tmQXawvqctrVlLmmLmuqcAlxx2NqCFLru01bVSFJbrKaQ2lJNolxbHLWlfwKpLd1T4Oorxa62TAJtYelc29oylbSld2m68fm0aqSVZVNIacEJXPtJq2YcKSw2E0hdeWkK2+56rTemsFBYdiMsi4XgXM7Zu+n3z+xj8ul8duqNDX/CL6l3yRrctjXnqdrlcVYt5t5ULOUwDq9W79j1+0w7XOgpLuSUWcgJ6S/teursOnjuTmZGWUMfXsTpd5+ub5VRusqJ3VCHra3xevH6efh+d/3+8mZNSp+fUUiqcn04pcJXF8dfWhrEOCwV4rnVk0I8truYxGVXstQiktAiosAi2sTlx+H919sPpzLgW5oXbcA19P3d/dVJ7HNLD0oPmBpt6P7qIXHXtx9PhKbyhG+XHw9vrg83H95eXh1ufvxpPrT7UEF9ykoUN1aipGZvTmugI+mGDgxRgVUirKmz6+C5O5kZZQ19QFUilRO7XYkSlaiLEkWpEkUqEZUIRIniGSUKGytRVLM3xzXQEXVDB4aowCoR1tTZdfDcncyMsoY+oCqRyondrkSRStRFiYJUiQKViEoEokThjBL5jZUoqNmbwxroCLqhA0NUYJUIa+rsOnjuTmZGWUMfUJVI5cRuV6JAJeqiRF6qRJ5KRCUCUSJ/Roncxkrk1ezNfg10eN3QgSEqsEqENXV2HTx3JzOjrKEPqEqkcmK3K5GnEnVRIidVIkclohKBKJE7o0Tzxkrk1OzNbg10ON3QgSEqsEqENXV2HTx3JzOjrKEPqEqkcmK3K5GjEnVRolmqRDOV6Bd7d7MbRQzDAfxduEMnmSR2HoBX4M4BCSQQEhIXnp62EmVVMqRxpp44+SNxqbSbzafj367GSImMpET7QUrkXyElKj7zsVDoQfVo3jpqjmxDF+CxkaWYzYcsLZyFu45jaYohHuAjWE2DhlzTTc9ar78aedDr5UFemgd55EHIg4zkQf4gD3LFPGg/yIPq1RvqZ4mr1G4QhBwnDTmL93LgNGiAOxQ6230vFDweWufKuPZztSvFsJrnc885U4wcXfbh/r8rVskqFG56pdYe37t+eMsbq1ceuv4x+QM/51qy0MrrX7LQ5K2VFxpmX1Trq386Sltxnhg1e5Wxh516V9iqd2WsuMNAWx9oh6IPKwXDgjT2tTgzQroSQu4vQEhxxTznpQrpnJAh3dZVvy731q9jASU+41Dq1MjUq5GxWyNDk+jevkWbqT5u9x8H7+BFJCoW1Q8fv/78dK6oHtUy3CCq6/YSyIjOqokqD5SturXLcpxyt2dVUWVNUWWzomqjTIZgoaklkWxYVG3MfttWbBTVeWIUoA+iOtdAO9SMWikYikSVFxXVTSqqG0QVogpR1RfVrSyqLkNU1+0lkBGdVRNVGihbdWtX9Trlbk+qokqaokpmRdVGlS3BQlNLIsmwqNqY/bat2Ciq88QoQB9Eda6Bdig5uVIwFIkqrSmqLgtF1WWIKkQVoqouqi4fiCpDVNftJZARnVUT1TRQturWLgp6yt0+qYpq0hTVZFZUbRTpFCw0tSQyGRZVG7PfthUbRXWeGAXog6jONdAOFatXCoYiUU2LiipLRZUhqhBViKq+qPKBqBJEdd1eAhnRWTVRjQNlq27tmuKn3O2jqqhGTVGNZkXVRo1vwUJTSyKjYVG1MfttW7FRVOeJUYA+iOpcA126deE4nDYYikQ1LiqqJBVVgqhCVCGq+qJKB6KaIKrr9hLIiM6qiWoYKFvVvtuHHlENY4pqUBXVoCmqwayohp4kMoyZRAbVJDIYFlUbs9+2FRtFdZ4YBeiDqM410KVbF47DaYOhSFTDoqKapKKaIKoQVYiqvqimA1GNENV1ewlkRGfVRHX708232zsfciZyD/+I8z47qNa7fjuu0tf2X+xlk7mHnDn5lBJttEfKopu9vDkJqMpbG1tUbz+6e3aaVDL52qsHWW21PVBfa/LGRhdVK7Nf2I2i+SjtxWmCFKAPojrXQF937Qrvcua8O47eJd7Dtr9/W0HV+usHCYiFo1oQEuXNiWVV3uTMtBqltBpBq6BV0Ko+rcYDWg1FWvVv1NKB3PONYj7vG8XbAxidN2aT/7aEWcOsFQZe8IPR6otHn7UXXOa/PQaD/192c//PJE5rr0lT+5trI5z+9k5XnP5kLiv8NFnQmtA3BfYn+7BC/JO3Vl43t3/8/P3Hl1/350Ml0ZU3+reBMb70PWWOpb4rPxzkwts/1ANBZK7H5k7jEoQN8cJQZUtrqhRKquRfoEpBrEpOrEqbUJVyFypxLypRPyqlTlSKvagUulFpb/gI05JQOCCh/WoS4p78mo2TkK3OAxcwa1PMWjsJMUiIlUmIdUmIlUmIbZEQq5IQWyIhViUhvoKEeHUSYl0SYpDQ01DUY/OVJMQgodNIaJeS0A4SAgmBhBpJaD8gIX81CVFPfk3GSchW54ELmLUpZq2dhAgkRMokRLokRMokRLZIiFRJiCyREKmSEF1BQrQ6CZEuCRFI6Gko6rH5ShIikNBpJOSlJORBQiAhkFAjCfkDEnIvIaGFyqU/npjoPHABszbvrLWTUAIJJWUSSroklJRJKNkioaRKQskSCSVVEkpXkFBanYSSLgklkNDTUNRj85UklEBCp5GQk5KQAwmBhEBCjSTkDkhoOyChVcvfL137/zd795IjRQyDAfgqiBN0VdlxsmbDNRCwQEJCQsD5QTwahAKhHeNH4gPUeCpOp/N/M5ITF7JrO3TtcRLCJCFUJiHUJSFUJiGMRUKoSkIYiYRQlYTQgoRwdxJCXRLCJKH7Uoy/my1JCJOExEjoxiWhW5JQklCS0IMkdOuTUPuDCO06vnvr2eVpC9m1Hbr2uAhBihAoixDoihAoixDEEiFQFSGIJEKgKkJgIUKwuwiBrghBitB9KcbfzZYiBClCUiLUmCDU0oPSg9KDHvOg1ueg+gcO2nf28OajlxMXsm+b9K1zfet3bfys954xSUh+oL5YOXkQuklHPj8j43m9l58dLVXQIQoJ7B6RYnwS4tfcQoSO/3EIHD+d7bcdvhv7DFai9708flQBihitTSd6zIkq04lqOlE6UTrRY05U+05EXSe6nspeqBhTufk3Kn61bz/cx3zb1dZm8cnwne6zWvJfroeOroPD8cb9to0fNmrbeD+tMyn631bK0Sz2QGa5njVvfrIorKXSf4y1aRyWKeaOBpsmDTYDGmxL0+Crdx+/hKYYM+fVD1P2n9PGz/IvaSvsaMYOZrw28346fu9gxEg9YrzGxEhsYjzZxHgwifG4TRljYxgjGymff33tZ6/fvu0QJc8Xy6wv4uMLcPfBREpRpKQ+UhZ1pKyqEFdDIeXCayM+PncGKatXpKyrI2WdoYTqFSn/tp/WmV0uslKJlImUO5ws6yBl1UTKGggpqyZSVgOkrOakY42UdVOkrBNIWR0jpf2ONkHKuitSFiZSlkTKRMpESm2kLH2kRHWkJFWIo1BIufDaiA90nkFK8oqUtDpS0gwlkFek/Nt+WmeavshKJVImUu5wsqyDlKSJlBQIKUkTKckAKcmcdKyRkjZFSppASnKMlPY72gQpaVekRCZSYiJlImUipTZSYh8pQR0piyrElVBIufDaiI8Yn0HK4hUpy+pIWWYooXhFymKBlCUiUpZEykTKHU6WdZCyaCJlCYSURRMpiwFSFnPSsUbKsilSlgmkLI6R0n5HmyBl2RUpgYmUkEiZSJlIqY2U0EfKSx0pURXiMBRSLrw24kPvZ5ASvSIlro6UOEMJ6BUp0QIpMSJSYiJlIuUOJ8s6SImaSImBkBI1kRINkBLNSccaKXFTpMQJpETHSGm/o02QEndFyouJlFciZSJlIqU2Ul59pDzVkRJUIQ5CIeXCayN9jYIZpASvSAmrIyXMUAJ4RUqwQEqIiJSQSJlIucPJsg5SgiZSQiCkBE2kBAOkBHPSsUZK2BQpYQIpwTFS2u9oE6SEXZHyZCLlmUiZSJlIqY2UZx8pD02kHIcr1uWOX84fUy69Osun/PsOCNUVX/fjX1/+gtZqOUspdKMLqQ2aOng6clMH11NGVceU+dffOi0zLXOh42UdzTx+RuHfNhoDM9m13Fnm4Fdl3Oc4tdjfMPySm0DmnxdgacccvHbvFB0/aq6Y5ruZsXv93xL9KubBVMwjFTMVMxVTWzGPu2L++pE/a1cxb0+5527789+yhhfsrClZ00gW28y/QDapf4HMl98tg/24RXn+qEnWFG1y6/XS2+IKCWkLspdEYKnJ+1EbMJHw7uM3eYw2n16///Dm5Yu3Mz/328+IHei+XwV7ge72l0D39bEnZ+UGusbNc5UZ5+jhONKJQpwgiLNBEBhJ7rc3uCbD4DkbBg9mhOJnoE7Y6WUgEs5AdeLykDUHNSNkoDoTA2rwDOTs5TMD+fqoSdYUbXLt9dLb4gploBpkL4lkoCqfgap4BqryJ0n9TxmoLpyBiJmBKDNQZqAQGYj6GagIZyCauDxkzUHNCBmIZmIABc9Azl4+M5Cvj5pkTdEmU6+X3hZXKANRkL0kNB1ffga+eAYi+ZOE/lMGooUzUGFmoJIZKDNQiAxU+hkIhTNQmbg8ZM1BzQgZ6DN7Z5MaSQxD4bv0Capc/qvjzGIgAxkC2QzM6RO6Fw1BhbtkuVuyXpZZlCM//+h9AT9lwcqui4cH0rXVJMcUFTlTWmqbXKsZ6fmFHigPiNgV90B5QNztIA+UJ/ZAiemBEjwQPJAJD5RoDxSFPVDqaB4wZmNMCx5IWW6j6+LhgXRtNckxRUVOlJbaJtdqBGt6oQdKAxL8xD1QGpCmN8gDpYk9UGR6oAgPBA9kwgNF2gNtwh4odjQPGLMxpgUPpCwWynXx8EC6tprkmKIiR0pLbZNrNeEtvtADxQEBQeIeKA4I6xnkgeLEHmhjeqANHggeyIQH2mgPFBgeiPu6LN0yYCTeSPxLkvVcN/8C5Q93/TjCNJQYPHXlw+L5ONF+CKr1rXGBug2vr2a1LpMUZj2OSAPJH3BiZxmYzjLAWcJZmnCWgXaWdG7iesEjzX0vnh6GxRuII4Qk6Owx0+o9FPlQs7rXuGfHG87LF8ab7ch92ifKDAa0+Zj6c+SR2mhziCuBd/OqBms+tVXUWOlFM2Sy3dpGM+uFGU+3MAnL3oVJai8mKf2YJHdiksTEJAiXE0U9B+FyywHqwVv0fQ87W0Y9kAQAAjOtHvWQ79GrCx1w7nZnLx+ox7P6pnGAjTbn3JUA1GNJW0WNlV7UszBRzwLUA9TjEvUsJOpZ9wPUg8iNvvfrLaMeSAIAgZlWj3rI2A112SrO3e7s5QP1eFbfNA6w0eacuxKAeixpq6ixUot61p2HetYdqAeoxyPqWXca9dQD1INkob6YDsuoB5IAQGCm1aMeMl1IXYSUc7c7e/lAPZ7VN40DbLQ5564EoB5L2ipqrPSinspEPRWoB6jHJeqpNOopB6gHAWp9aUSWUQ8kAYDATKtHPWSImrqkPOdud/bygXo8q28aB9hoc85dCUA9lrRV1FjpRT2FiXoKUA9Qj0vUU2jUkw9QD3Ii+0LXLKMeSAIAgZlWj3rIrEh1gaDO3e7s5QP1eFbfNA6w0eacuxKAeixpq6ix0ot6MhP1ZKAeoB6XqCfTqCcdoB6/7UvjWJZIMUbQjRNVZsIQmGqdxMdKHCxONDAiMCKob58jqJvNxjXSf127wkRW5NXUkOklRYlJihJIEUiRS1KUaFIUSVIULvNZMsRBPnSdiFs+fg/TnivSDLv4U7ENTW1D7ipK+/fPVvcc9rousSYO/eGPJnIYyMKBXR4B7LTRnz1Gn6UFf+nQMgmNRiuIPdjQXXjH6LjOHljaf6++VPCg4X+UXqiMb7bX45mP6v5fDiQeLPH9l28fn3/+f8/9r/ceE3H/isQCostpgPzWUmKVze/+7wPYp3GRonGhTePiQzTu39vH++9rFXec8n06KAZ5Pwha7WKAhckAzQG82wduJTAh3m2bfh5/JHSzxJXNEiVpXqRp3gaah8RP3TSv2qF5FTQP27B/FT2VJNSLKZpX5TFRFWdBdYBMKrV4Js2rp2ke9uAgmlcd0Lw6AvXUAainjkA91QPNg8QT0bz6cppXvdK8jUnzNtA80DzQPAbN22iaF0DzEOqqm+YVOzSvgOZhG/avoqeShHIxRfOKPCYq4iyoDJBJpRbPpHnlNM3DHhxE84oDmldGoJ4yAPWUEaineKB5kHgimldeTvOKV5oXmDQvgOaB5oHmMWheoGneCpqH3N4v9u5lx4kYiALoryC+IO72cw1CLFizHyBCiCAhXt+PAEEgsmL6uu12ue7sMx677LTvmZZqbM3zcjTPU/N4DOt3UVdJ8I9FaZ7fn4n87hbkG5RpyFr01Dy/WfN4Bhtpnlegeb4F9fgG1ONbUI/XoHks8USa5w/XPK9V8wyoeYaaR82j5gGaZ/Kad6LmsTXz2Jrn5Gieo+bxGNbvoq6S4B6L0rwGTLS/BTUo05i16Kl5brPm8Qw20jynQPNcC+pxDajHtaAep0HzWOKJNM8drnlOq+adQM07UfOoedQ8QPNOWc1LxDw23x4b86wczLPEPB7D+l3UFRLsY1GYZ/dXIrs7BdkGZRqyFj0xz27GPJ7BRphnFWCebSE9toH02BbSYzVgHks8EebZwzHPKsW8hFleIuWR8kh52ykvZSUvZiXPUPIU90cfzvKENuXn9t5hew+zkbJHCR9uxPakf/+99kfVnF2WZVldiA5rPIEPh9gMPhpSe3y4EZtZFPYqUHt8uHztee6byZy5ZtCbL2sFZFeYPAA92GiAAOGDITSEj6aBBbmNBthGkujRtAfG8l18ZmGMOWE0RWGMsDCeUGFMIDBGHBhDFTD6WmB0lcBoa4Fx3fALprfBmLXBULDB/aGnwV08jcdZIma58YaVxoAwhXPa2f1SzZtxqeWbcbhtpK5vHKWebxylBm8cwaOVL+ffzp++vHv9cGk05O9fD1yawWHLd2ae43/OsZK9/rv6s/wzqPgPn03bgtcpoMBctIMAJSl9QytgfhLm9BPFb1nd4YsV4AvMUD4+vD0/e3e+vHnx8Op8+bwRUK4ff/lw+Xr+vCOehCye+O54Ehs05h8PT0TMcuPTPoqAhhnntPM9OdaErjgmnsSueBJ74knsGihjfzyJx+BJlI4nMs7xtHudeHJvW/A6BRSYi3YQnkSleOIxPPHEE+KJIjzxWTxxGJ5obHI/3yw3Pu2DCGiYcU4735NDTegKY+JJ6IonoSeehK6BMvTHk3AMngTpeCLjHE+714kn97YFr1NAgbloB+FJUIonDsMTRzwhnijCE5fFE4vhicae4vPNcuPT3ouAhhnntPM92deELj8mnrCH/xA9/CE88cfgiZeOJzLO8bR7nXhyb1vwOgUUmIt2EJ54pXhiMTyxxBPiiSI8sVk8WTE80djCeb5ZbnzaOxHQMOOcVLb2Z8t0gS3TITxxx+CJk44nMs7xtHudeHJvW/A6BRSYi3a7SGwx3xRPVgxPVuIJ8UQRnqxZPFkwPNHYMne+WZYaLYqAhRnmoLJVOltQC2xBDeGIPQZHrHQckXGOp93rxJF724LXJaDAXLTbRWLL7qY4smA4shBHiCOKcGTJ4ohpgCPt27Zdxxqm9x/XBbhRbPnLRCiHqskq7e3NDsZCOxgXYAccE5cdfFwRtCPlPE+848k79zYGr2/yQEjNMrMpc09DMpghGRoSDUmRIZlbQ3r68On9ErOGtDzu2FXy+rW12JRCMD9+Qkxr5sqAfLZ8mWjzPD1lvvg5EtIST8T02nVbXVNKwbnoTFqsSdkABn24fDI4+T+T5zdi/fGqSxgffl4gC7fgXJQYx1WGqu11xTNRC1h0IFP1eVg0rWi5bpXVqVfQvHTKjn6/bq+56LfciX4/PvVoiXD0M2j0Mycw+6XN6S0XG8uhB8qN149XB8fnP5fsyflyyeRGLHfa2ty5VufOpT53GjB34sHx9pBlg2M4OjjGikdplHtN4ki37cAYHDN7G8xOUXh24uT1fSOqCI5D1VZucIzjBMdYrhuDY6vgGLDgGBgcGRwZHP8zOIZscPRHB8dQ8SgNcq9JHOm2FRKDY2Zvg9kpCM9OnLy+b0QVwXGo2soNjmGc4BjKdWNwbBUcPRYcPYPjd/bOJTduGAiid8kJJP55keyzyC6rALl/FjYwwKANikWT6hbrADJn2KS634MxRXAkOF4ExySCY7wbHNNAK012xySu9B4DQ3AUzjbITsk4O/HL7/dG3AIcVdXWLjgmPeCY2nUjOM4Cx4iBYyQ4EhwJjhfBMYrgGO4GxzjQSqPdMYkrvUdgEByFsw2yUzTOTvzy+70RtwBHVbW1C45RDzjGdt0IjrPAMWDgGAiOBEeC40VwDCI4+rvBMQy00mB3TOJK7/EABEfhbIPsFIyzE7/8fm/ELcBRVW3tgmPQA46hXTeC4yxw9Bg4eoIjwZHgeBEcvQiO7kZwbP/8tfxGbj+qfUgyutKEzBrkJ8JN7OzEmIsQaq0xOOecj7nEItyUjqctwNTmX3/Ll+QWJKmosnY5EugWC95UHRVtP0v4nAWfDoNPR/gkfBI+L8KnE+Hzq1hYDfO7yZWe/jvwHeG4HWlcQCRDY6zRd8iefCqABFWg8ECAKrYakJ+KLybRkaEbtFXdob3huTHYdM82/BuwN4/dle0SXkyAvJyu2QR5pmvOTNd86YTpOC5/hxcNE8nf4FtC8oNIrr4PqvqF/flIXqwOhsxdGEOzshTNykokL51oZegGbVV3aG94bgw2XTXwyV1hdo4VJD8wJD+I5ETyDZH8kJD8rERy9X1QVXbBfCTPVgdDJlqMoVleimZ5JZLnTrQydIO2qju0Nzw3BpuuGvjkrjCVyAiSnxVC8rMSyYnk+yH5WUUkL0Ry9X1QVSrEfCRPVgdDZoWMoVlaimZpJZKnTrQydIO2qju0Nzw3BpuuGvjkrjDvyQqSFwzJC5GcSL4hkhcRyTORXH0fVJW3MR/Jo9XBkCksY2gWl6JZXInksROtDN2greoO7Q3PjcGmqwY+uStM0rKC5BlD8kwkJ5JviORZRPJEJFffB1UlmcxH8mB1MGS+zRiahaVoFlYieehEK0M3aKu6Q3vDc2Ow6aqBT+4KM8qsIHnCkDwRyYnkGyJ5EpE8EskN9EFbkTDC7If1UHz2wz9wO1DGh1pLcimlfGQfc1U9rTK9CKBFoO4ALgLLAZ4AXE0CPkt36JtqL3sroPL4Yuo8waPPjfpZQAkTc1fsptBpy8tUqxgiphgiFQMVw4aKIYqKIYiKwf9oDCjCONXKHAVxQp6jJyzWGIfGV1s6RY9/XGmMZiFsBbMvGWTkdJ1Ya62+1ORqOY9QojDHgA+vz0iugBKbgoDjn1e8a5t8WN6eC7eHWX6fQwdzDlX+I0zjoAN+C15tO731uRcd/2bYfHRLIWZ2H7X0R2FQEHYOeLi9d6oIjOT9vcBny4AGyYD6pgENsAF1qAE9T1CBnkefenuXoHVUgpae9cW/kAcdaAI+wcs/9pjYj4no79d/JAybVD9uUh1kUmER+/PXn3+/v1PEBlHEeopYI+2AIlZtIShiX5lquEoqekVsMSZiiyURWyhiVd4eJrgy3VahiC1LRWyhiH2CQOQ+PkDElhERWyhiSd4PE7EeE7GeIpYiliL2LhHrRRHrKGKNtAOKWLWFoIh9JWniKinrFbHZmIjNlkRspohVeXuY281Mc4UiNi8VsZki9gkCkfv4ABGbR0RspogleT9MxDpMxDqKWIpYiti7RKwTRexJEWukHVDEqi0ERez/9u5gNW4YCAPwu/ReWK9nRtLj9BBooVBIb336JiUkpchrPKrlf6R/z3GkzMia0RcvfhvPWijJcCHWgkGsRYJYI8RC3j1nY6N1xUYLBbFzxeYQxFpXiDVC7AiAyDgOALHWArFGiOXJezCIXXwQuxBiCbGE2KsgdqlC7I0QG6QcEGJhE0GIfRtPWyhJcSFWg0GsRoJYJcRC3j1nY6N2xUYNBbFzxeYQxGpXiFVC7AiAyDgOALHaArFKiOXJezCIvfkg9kaIJcQSYq+C2FsNYgsdNkg1oMPCJoIO+zaetEiS4Drs5a+vP3inSSSHFTos5N1ztjVKV2uUUA47V2wOOax0dVihw47gh4zjAA4rLQ4rdFievMdy2OJi2EKFpcJSYS9S2FJD2EyEDVIKiLCwiSDCvh9n3mL++dj5Yv/a/gRbn9nyz1paEA32QSjhCPbBXKcSWKhb5xxjrE9YpJSicn/5rJqyZhcy+ofDE9jZolMxWNd+4SFY/2AU2ChyyDgOILAPm7BK6A5cTYPlwTugwWaXwWYaLA2WBnuRweaawaaqwd4+PSzNQC1N+Siula23Upgd17aW5a8/nr/9eonDl+873b9zbh+/f9gTANP8d5oxICo0eZWWhyrKiQ9V+HWi7DzO5uAJ72jI/+SohNr19zueje7get7p+lnPP5pf9TrtDPWFXd8Z9i+eEJygyjYjeVID5N9C6/vkCG0VSnNz5BsV+xfj9MuVwvIgs9G5LdW47bbHbcnLbcWrbdmJbanN2qyZytRHZfSp/+hTqeZTFtynckPdzsBwkS+vsFDtGdNMnzphQTl9KkP6VO7qU3lyn8qxfCp39akc2Kdyi09l+hRs2WYkwXwqb+yTI7RVKM3NcZ/KyD6V5/Qpc/mU0afoU3F8ymo+pcF9KjXU7QQMF+nyCgvVnjHN9KkTFpTTpxKkT6WuPpUm96kUy6dSV59KgX0qtfhUok/Blm1GEsyn0sY+OUJbhdLcHPephOxTaU6fUpdPKX2KPhXHp7TmUxLcp6yhbhswXNjlFRaqPWOa6VMnLCinTxmkT1lXn7LJfcpi+ZR19SkL7FPW4lNGn4It24wkmE/Zxj45QluF0twc9ylD9imb06fE5VNCn6JPxfEpqfnUGtyntKFuKzBc6OUVFqo9Y5rpUycsKKdPKaRPaVef0sl9SmP5lHb1KQ3sU9riU0qfgi3bjCSYT+nGPjlCW4XS3Bz3KUX2KZ3Tp1aXT630KfpUHJ9aaz51D+5T0lC3BRgu5PIKC9WeMc30qQlfOn/Ip6SrT8nkPiWxfEq6+pQE9ilp8SmhT8GWbUYSzKdkY58coa1CaW6O+5Qg+5TM6VN3l0/d6VP0qTg+da/51BLcp/bfnLr/SmI8tnifGqRaMMfj53hcmYryMu5dm9qa1iqlZLubWbqlVVNx4ZR/uBl06mEAAHlqZ9k6fMo/HDpQHcnta3IOXD0hrAAVb8YRiqduG/vkAK0VTINzl1JSWl4/KZd1e6nsX3t5w/ywqAyMU4sLpxbiFHEqDk69OtTLlvL89PPpz9318bO/AVBLAQI/ABQAAAAIALZ9okpdRKh71y8AAPdGCAAVACQAAAAAAAAAIAAAAAAAAABwcmVzZXRUYWJsZVN0eWxlcy54bWwKACAAAAAAAAEAGADPPQEDQsPSAR0n5PQhw9IBLa7JYPup0gFQSwUGAAAAAAEAAQBnAAAACjAAAAAA"; var jsZipWrapper=new AscCommon.JSZipWrapper;return jsZipWrapper.loadAsync(stylesZip,{"base64":true}).then(function(zip){return zip.files["presetTableStyles.xml"].async("string")}).then(function(content){jsZipWrapper.close();var stylesXml=new CT_PresetTableStyles(wb.TableStyles.DefaultStyles,wb.TableStyles.DefaultStylesPivot);(new openXml.SaxParserBase).parse(content,stylesXml);wb.TableStyles.concatStyles()})}function ReadDefCellStyles(wb,oOutput){var Types={Style:0,BuiltinId:1,Hidden:2,CellStyle:3, Xfs:4,Font:5,Fill:6,Border:7,NumFmts:8};var sStyles="XLSY;;11499;5ywAAACHAAAAAQQAAAAAAAAAAyMAAAAABAAAAAAAAAAEDAAAAE4AbwByAG0AYQBsAAUEAAAAAAAAAAQYAAAABgQAAAAABwQAAAAACAQAAAAACQQAAAAABSoAAAABBgMAAAACAQEEBg4AAABDAGEAbABpAGIAcgBpAAkBAQYFAAAAAAAAJkAGAAAAAAcAAAAAAJwAAAABBAAAABwAAAADHAAAAAQOAAAATgBlAHUAdAByAGEAbAAFBAAAAAEAAAAEIQAAAAABAAEBAAQBAAYEAAAAAAcEAgAAAAgEAQAAAAkEAAAAAAUtAAAAAQYGAAAAAAQAZZz/BAYOAAAAQwBhAGwAaQBiAHIAaQAJAQEGBQAAAAAAACZABhAAAAAACwAAAAEGAAAAAASc6///BwAAAAAAlAAAAAEEAAAAGwAAAAMUAAAABAYAAABCAGEAZAAFBAAAAAEAAAAEIQAAAAABAAEBAAQBAAYEAAAAAAcEAgAAAAgEAQAAAAkEAAAAAAUtAAAAAQYGAAAAAAQGAJz/BAYOAAAAQwBhAGwAaQBiAHIAaQAJAQEGBQAAAAAAACZABhAAAAAACwAAAAEGAAAAAATOx///BwAAAAAAlgAAAAEEAAAAGgAAAAMWAAAABAgAAABHAG8AbwBkAAUEAAAAAQAAAAQhAAAAAAEAAQEABAEABgQAAAAABwQCAAAACAQBAAAACQQAAAAABS0AAAABBgYAAAAABABhAP8EBg4AAABDAGEAbABpAGIAcgBpAAkBAQYFAAAAAAAAJkAGEAAAAAALAAAAAQYAAAAABM7vxv8HAAAAAADlAAAAAQQAAAAUAAAAAxgAAAAECgAAAEkAbgBwAHUAdAAFBAAAAAEAAAAEHgAAAAABAAQBAAYEAQAAAAcEAgAAAAgEAQAAAAkEAAAAAAUtAAAAAQYGAAAAAAR2Pz//BAYOAAAAQwBhAGwAaQBiAHIAaQAJAQEGBQAAAAAAACZABhAAAAAACwAAAAEGAAAAAASZzP//B1AAAAAADwAAAAAGBgAAAAAEf39//wEBDQIPAAAAAAYGAAAAAAR/f3//AQENBA8AAAAABgYAAAAABH9/f/8BAQ0FDwAAAAAGBgAAAAAEf39//wEBDQDqAAAAAQQAAAAVAAAAAxoAAAAEDAAAAE8AdQB0AHAAdQB0AAUEAAAAAQAAAAQeAAAAAAEABAEABgQBAAAABwQCAAAACAQBAAAACQQAAAAABTAAAAAAAQEBBgYAAAAABD8/P/8EBg4AAABDAGEAbABpAGIAcgBpAAkBAQYFAAAAAAAAJkAGEAAAAAALAAAAAQYAAAAABPLy8v8HUAAAAAAPAAAAAAYGAAAAAAQ/Pz//AQENAg8AAAAABgYAAAAABD8/P/8BAQ0EDwAAAAAGBgAAAAAEPz8//wEBDQUPAAAAAAYGAAAAAAQ/Pz//AQENAPQAAAABBAAAABYAAAADJAAAAAQWAAAAQwBhAGwAYwB1AGwAYQB0AGkAbwBuAAUEAAAAAQAAAAQeAAAAAAEABAEABgQBAAAABwQCAAAACAQBAAAACQQAAAAABTAAAAAAAQEBBgYAAAAABAB9+v8EBg4AAABDAGEAbABpAGIAcgBpAAkBAQYFAAAAAAAAJkAGEAAAAAALAAAAAQYAAAAABPLy8v8HUAAAAAAPAAAAAAYGAAAAAAR/f3//AQENAg8AAAAABgYAAAAABH9/f/8BAQ0EDwAAAAAGBgAAAAAEf39//wEBDQUPAAAAAAYGAAAAAAR/f3//AQENAO8AAAABBAAAABcAAAADIgAAAAQUAAAAQwBoAGUAYwBrACAAQwBlAGwAbAAFBAAAAAEAAAAEHgAAAAABAAQBAAYEAQAAAAcEAgAAAAgEAQAAAAkEAAAAAAUtAAAAAAEBAQYDAAAAAgEABAYOAAAAQwBhAGwAaQBiAHIAaQAJAQEGBQAAAAAAACZABhAAAAAACwAAAAEGAAAAAASlpaX/B1AAAAAADwAAAAAGBgAAAAAEPz8//wEBBAIPAAAAAAYGAAAAAAQ/Pz//AQEEBA8AAAAABgYAAAAABD8/P/8BAQQFDwAAAAAGBgAAAAAEPz8//wEBBACkAAAAAQQAAAA1AAAAAy4AAAAEIAAAAEUAeABwAGwAYQBuAGEAdABvAHIAeQAgAFQAZQB4AHQABQQAAAABAAAABCQAAAAAAQABAQACAQAEAQAGBAAAAAAHBAAAAAAIBAEAAAAJBAAAAAAFMAAAAAEGBgAAAAAEf39//wMBAQQGDgAAAEMAYQBsAGkAYgByAGkACQEBBgUAAAAAAAAmQAYAAAAABwAAAAAA4wAAAAEEAAAACgAAAAMWAAAABAgAAABOAG8AdABlAAUEAAAAAQAAAAQhAAAAAAEAAwEABAEABgQBAAAABwQCAAAACAQBAAAACQQAAAAABSoAAAABBgMAAAACAQEEBg4AAABDAGEAbABpAGIAcgBpAAkBAQYFAAAAAAAAJkAGEAAAAAALAAAAAQYAAAAABMz///8HUAAAAAAPAAAAAAYGAAAAAASysrL/AQENAg8AAAAABgYAAAAABLKysv8BAQ0EDwAAAAAGBgAAAAAEsrKy/wEBDQUPAAAAAAYGAAAAAASysrL/AQENAKgAAAABBAAAABgAAAADJAAAAAQWAAAATABpAG4AawBlAGQAIABDAGUAbABsAAUEAAAAAQAAAAQhAAAAAAEAAgEABAEABgQBAAAABwQAAAAACAQBAAAACQQAAAAABS0AAAABBgYAAAAABAB9+v8EBg4AAABDAGEAbABpAGIAcgBpAAkBAQYFAAAAAAAAJkAGAAAAAAcUAAAAAA8AAAAABgYAAAAABAGA//8BAQQAmQAAAAEEAAAACwAAAAMmAAAABBgAAABXAGEAcgBuAGkAbgBnACAAVABlAHgAdAAFBAAAAAEAAAAEJAAAAAABAAEBAAIBAAQBAAYEAAAAAAcEAAAAAAgEAQAAAAkEAAAAAAUtAAAAAQYGAAAAAAQAAP//BAYOAAAAQwBhAGwAaQBiAHIAaQAJAQEGBQAAAAAAACZABgAAAAAHAAAAAAChAAAAAQQAAAAQAAAAAyAAAAAEEgAAAEgAZQBhAGQAaQBuAGcAIAAxAAUEAAAAAQAAAAQhAAAAAAEAAgEABAEABgQBAAAABwQAAAAACAQBAAAACQQAAAAABS0AAAAAAQEBBgMAAAACAQMEBg4AAABDAGEAbABpAGIAcgBpAAkBAQYFAAAAAAAALkAGAAAAAAcRAAAAAAwAAAAABgMAAAACAQQBAQwAqwAAAAEEAAAAEQAAAAMgAAAABBIAAABIAGUAYQBkAGkAbgBnACAAMgAFBAAAAAEAAAAEIQAAAAABAAIBAAQBAAYEAQAAAAcEAAAAAAgEAQAAAAkEAAAAAAUtAAAAAAEBAQYDAAAAAgEDBAYOAAAAQwBhAGwAaQBiAHIAaQAJAQEGBQAAAAAAACpABgAAAAAHGwAAAAAWAAAAAAYNAAAAAgEEAwUA/3//v//fPwEBDACrAAAAAQQAAAASAAAAAyAAAAAEEgAAAEgAZQBhAGQAaQBuAGcAIAAzAAUEAAAAAQAAAAQhAAAAAAEAAgEABAEABgQBAAAABwQAAAAACAQBAAAACQQAAAAABS0AAAAAAQEBBgMAAAACAQMEBg4AAABDAGEAbABpAGIAcgBpAAkBAQYFAAAAAAAAJkAGAAAAAAcbAAAAABYAAAAABg0AAAACAQQDBc1kZjIzmdk/AQEGAJMAAAABBAAAABMAAAADIAAAAAQSAAAASABlAGEAZABpAG4AZwAgADQABQQAAAABAAAABCQAAAAAAQABAQACAQAEAQAGBAAAAAAHBAAAAAAIBAEAAAAJBAAAAAAFLQAAAAABAQEGAwAAAAIBAwQGDgAAAEMAYQBsAGkAYgByAGkACQEBBgUAAAAAAAAmQAYAAAAABwAAAAAAqgAAAAEEAAAAGQAAAAMYAAAABAoAAABUAG8AdABhAGwABQQAAAABAAAABCEAAAAAAQACAQAEAQAGBAEAAAAHBAAAAAAIBAEAAAAJBAAAAAAFLQAAAAABAQEGAwAAAAIBAQQGDgAAAEMAYQBsAGkAYgByAGkACQEBBgUAAAAAAAAmQAYAAAAAByIAAAAADAAAAAAGAwAAAAIBBAEBBAUMAAAAAAYDAAAAAgEEAQENAIsAAAABBAAAAA8AAAADGAAAAAQKAAAAVABpAHQAbABlAAUEAAAAAQAAAAQkAAAAAAEAAQEAAgEABAEABgQAAAAABwQAAAAACAQBAAAACQQAAAAABS0AAAAAAQEBBgMAAAACAQMEBg4AAABDAGEAbABpAGIAcgBpAAkBAAYFAAAAAAAAMkAGAAAAAAcAAAAAAKwAAAABBAAAAB4AAAADKAAAAAQaAAAAMgAwACUAIAAtACAAQQBjAGMAZQBuAHQAMQAFBAAAAAEAAAAEIQAAAAABAAEBAAQBAAYEAAAAAAcEAgAAAAgEAQAAAAkEAAAAAAUqAAAAAQYDAAAAAgEBBAYOAAAAQwBhAGwAaQBiAHIAaQAJAQEGBQAAAAAAACZABhcAAAAAEgAAAAENAAAAAgEEAwXNZeYyc5npPwcAAAAAAKwAAAABBAAAACIAAAADKAAAAAQaAAAAMgAwACUAIAAtACAAQQBjAGMAZQBuAHQAMgAFBAAAAAEAAAAEIQAAAAABAAEBAAQBAAYEAAAAAAcEAgAAAAgEAQAAAAkEAAAAAAUqAAAAAQYDAAAAAgEBBAYOAAAAQwBhAGwAaQBiAHIAaQAJAQEGBQAAAAAAACZABhcAAAAAEgAAAAENAAAAAgEFAwXNZeYyc5npPwcAAAAAAKwAAAABBAAAACYAAAADKAAAAAQaAAAAMgAwACUAIAAtACAAQQBjAGMAZQBuAHQAMwAFBAAAAAEAAAAEIQAAAAABAAEBAAQBAAYEAAAAAAcEAgAAAAgEAQAAAAkEAAAAAAUqAAAAAQYDAAAAAgEBBAYOAAAAQwBhAGwAaQBiAHIAaQAJAQEGBQAAAAAAACZABhcAAAAAEgAAAAENAAAAAgEGAwXNZeYyc5npPwcAAAAAAKwAAAABBAAAACoAAAADKAAAAAQaAAAAMgAwACUAIAAtACAAQQBjAGMAZQBuAHQANAAFBAAAAAEAAAAEIQAAAAABAAEBAAQBAAYEAAAAAAcEAgAAAAgEAQAAAAkEAAAAAAUqAAAAAQYDAAAAAgEBBAYOAAAAQwBhAGwAaQBiAHIAaQAJAQEGBQAAAAAAACZABhcAAAAAEgAAAAENAAAAAgEHAwXNZeYyc5npPwcAAAAAAKwAAAABBAAAAC4AAAADKAAAAAQaAAAAMgAwACUAIAAtACAAQQBjAGMAZQBuAHQANQAFBAAAAAEAAAAEIQAAAAABAAEBAAQBAAYEAAAAAAcEAgAAAAgEAQAAAAkEAAAAAAUqAAAAAQYDAAAAAgEBBAYOAAAAQwBhAGwAaQBiAHIAaQAJAQEGBQAAAAAAACZABhcAAAAAEgAAAAENAAAAAgEIAwXNZeYyc5npPwcAAAAAAKwAAAABBAAAADIAAAADKAAAAAQaAAAAMgAwACUAIAAtACAAQQBjAGMAZQBuAHQANgAFBAAAAAEAAAAEIQAAAAABAAEBAAQBAAYEAAAAAAcEAgAAAAgEAQAAAAkEAAAAAAUqAAAAAQYDAAAAAgEBBAYOAAAAQwBhAGwAaQBiAHIAaQAJAQEGBQAAAAAAACZABhcAAAAAEgAAAAENAAAAAgEJAwXNZeYyc5npPwcAAAAAAKwAAAABBAAAAB8AAAADKAAAAAQaAAAANAAwACUAIAAtACAAQQBjAGMAZQBuAHQAMQAFBAAAAAEAAAAEIQAAAAABAAEBAAQBAAYEAAAAAAcEAgAAAAgEAQAAAAkEAAAAAAUqAAAAAQYDAAAAAgEBBAYOAAAAQwBhAGwAaQBiAHIAaQAJAQEGBQAAAAAAACZABhcAAAAAEgAAAAENAAAAAgEEAwWazExmJjPjPwcAAAAAAKwAAAABBAAAACMAAAADKAAAAAQaAAAANAAwACUAIAAtACAAQQBjAGMAZQBuAHQAMgAFBAAAAAEAAAAEIQAAAAABAAEBAAQBAAYEAAAAAAcEAgAAAAgEAQAAAAkEAAAAAAUqAAAAAQYDAAAAAgEBBAYOAAAAQwBhAGwAaQBiAHIAaQAJAQEGBQAAAAAAACZABhcAAAAAEgAAAAENAAAAAgEFAwWazExmJjPjPwcAAAAAAKwAAAABBAAAACcAAAADKAAAAAQaAAAANAAwACUAIAAtACAAQQBjAGMAZQBuAHQAMwAFBAAAAAEAAAAEIQAAAAABAAEBAAQBAAYEAAAAAAcEAgAAAAgEAQAAAAkEAAAAAAUqAAAAAQYDAAAAAgEBBAYOAAAAQwBhAGwAaQBiAHIAaQAJAQEGBQAAAAAAACZABhcAAAAAEgAAAAENAAAAAgEGAwWazExmJjPjPwcAAAAAAKwAAAABBAAAACsAAAADKAAAAAQaAAAANAAwACUAIAAtACAAQQBjAGMAZQBuAHQANAAFBAAAAAEAAAAEIQAAAAABAAEBAAQBAAYEAAAAAAcEAgAAAAgEAQAAAAkEAAAAAAUqAAAAAQYDAAAAAgEBBAYOAAAAQwBhAGwAaQBiAHIAaQAJAQEGBQAAAAAAACZABhcAAAAAEgAAAAENAAAAAgEHAwWazExmJjPjPwcAAAAAAKwAAAABBAAAAC8AAAADKAAAAAQaAAAANAAwACUAIAAtACAAQQBjAGMAZQBuAHQANQAFBAAAAAEAAAAEIQAAAAABAAEBAAQBAAYEAAAAAAcEAgAAAAgEAQAAAAkEAAAAAAUqAAAAAQYDAAAAAgEBBAYOAAAAQwBhAGwAaQBiAHIAaQAJAQEGBQAAAAAAACZABhcAAAAAEgAAAAENAAAAAgEIAwWazExmJjPjPwcAAAAAAKwAAAABBAAAADMAAAADKAAAAAQaAAAANAAwACUAIAAtACAAQQBjAGMAZQBuAHQANgAFBAAAAAEAAAAEIQAAAAABAAEBAAQBAAYEAAAAAAcEAgAAAAgEAQAAAAkEAAAAAAUqAAAAAQYDAAAAAgEBBAYOAAAAQwBhAGwAaQBiAHIAaQAJAQEGBQAAAAAAACZABhcAAAAAEgAAAAENAAAAAgEJAwWazExmJjPjPwcAAAAAAKwAAAABBAAAACAAAAADKAAAAAQaAAAANgAwACUAIAAtACAAQQBjAGMAZQBuAHQAMQAFBAAAAAEAAAAEIQAAAAABAAEBAAQBAAYEAAAAAAcEAgAAAAgEAQAAAAkEAAAAAAUqAAAAAQYDAAAAAgEABAYOAAAAQwBhAGwAaQBiAHIAaQAJAQEGBQAAAAAAACZABhcAAAAAEgAAAAENAAAAAgEEAwXNZGYyM5nZPwcAAAAAAKwAAAABBAAAACQAAAADKAAAAAQaAAAANgAwACUAIAAtACAAQQBjAGMAZQBuAHQAMgAFBAAAAAEAAAAEIQAAAAABAAEBAAQBAAYEAAAAAAcEAgAAAAgEAQAAAAkEAAAAAAUqAAAAAQYDAAAAAgEABAYOAAAAQwBhAGwAaQBiAHIAaQAJAQEGBQAAAAAAACZABhcAAAAAEgAAAAENAAAAAgEFAwXNZGYyM5nZPwcAAAAAAKwAAAABBAAAACgAAAADKAAAAAQaAAAANgAwACUAIAAtACAAQQBjAGMAZQBuAHQAMwAFBAAAAAEAAAAEIQAAAAABAAEBAAQBAAYEAAAAAAcEAgAAAAgEAQAAAAkEAAAAAAUqAAAAAQYDAAAAAgEABAYOAAAAQwBhAGwAaQBiAHIAaQAJAQEGBQAAAAAAACZABhcAAAAAEgAAAAENAAAAAgEGAwXNZGYyM5nZPwcAAAAAAKwAAAABBAAAACwAAAADKAAAAAQaAAAANgAwACUAIAAtACAAQQBjAGMAZQBuAHQANAAFBAAAAAEAAAAEIQAAAAABAAEBAAQBAAYEAAAAAAcEAgAAAAgEAQAAAAkEAAAAAAUqAAAAAQYDAAAAAgEABAYOAAAAQwBhAGwAaQBiAHIAaQAJAQEGBQAAAAAAACZABhcAAAAAEgAAAAENAAAAAgEHAwXNZGYyM5nZPwcAAAAAAKwAAAABBAAAADAAAAADKAAAAAQaAAAANgAwACUAIAAtACAAQQBjAGMAZQBuAHQANQAFBAAAAAEAAAAEIQAAAAABAAEBAAQBAAYEAAAAAAcEAgAAAAgEAQAAAAkEAAAAAAUqAAAAAQYDAAAAAgEABAYOAAAAQwBhAGwAaQBiAHIAaQAJAQEGBQAAAAAAACZABhcAAAAAEgAAAAENAAAAAgEIAwXNZGYyM5nZPwcAAAAAAKwAAAABBAAAADQAAAADKAAAAAQaAAAANgAwACUAIAAtACAAQQBjAGMAZQBuAHQANgAFBAAAAAEAAAAEIQAAAAABAAEBAAQBAAYEAAAAAAcEAgAAAAgEAQAAAAkEAAAAAAUqAAAAAQYDAAAAAgEABAYOAAAAQwBhAGwAaQBiAHIAaQAJAQEGBQAAAAAAACZABhcAAAAAEgAAAAENAAAAAgEJAwXNZGYyM5nZPwcAAAAAAJYAAAABBAAAAB0AAAADHAAAAAQOAAAAQQBjAGMAZQBuAHQAMQAFBAAAAAEAAAAEIQAAAAABAAEBAAQBAAYEAAAAAAcEAgAAAAgEAQAAAAkEAAAAAAUqAAAAAQYDAAAAAgEABAYOAAAAQwBhAGwAaQBiAHIAaQAJAQEGBQAAAAAAACZABg0AAAAACAAAAAEDAAAAAgEEBwAAAAAAlgAAAAEEAAAAIQAAAAMcAAAABA4AAABBAGMAYwBlAG4AdAAyAAUEAAAAAQAAAAQhAAAAAAEAAQEABAEABgQAAAAABwQCAAAACAQBAAAACQQAAAAABSoAAAABBgMAAAACAQAEBg4AAABDAGEAbABpAGIAcgBpAAkBAQYFAAAAAAAAJkAGDQAAAAAIAAAAAQMAAAACAQUHAAAAAACNAAAAAxwAAAAEDgAAAEEAYwBjAGUAbgB0ADMABQQAAAABAAAABCEAAAAAAQABAQAEAQAGBAAAAAAHBAIAAAAIBAEAAAAJBAAAAAAFKgAAAAEGAwAAAAIBAAQGDgAAAEMAYQBsAGkAYgByAGkACQEBBgUAAAAAAAAmQAYNAAAAAAgAAAABAwAAAAIBBgcAAAAAAJYAAAABBAAAACkAAAADHAAAAAQOAAAAQQBjAGMAZQBuAHQANAAFBAAAAAEAAAAEIQAAAAABAAEBAAQBAAYEAAAAAAcEAgAAAAgEAQAAAAkEAAAAAAUqAAAAAQYDAAAAAgEABAYOAAAAQwBhAGwAaQBiAHIAaQAJAQEGBQAAAAAAACZABg0AAAAACAAAAAEDAAAAAgEHBwAAAAAAlgAAAAEEAAAALQAAAAMcAAAABA4AAABBAGMAYwBlAG4AdAA1AAUEAAAAAQAAAAQhAAAAAAEAAQEABAEABgQAAAAABwQCAAAACAQBAAAACQQAAAAABSoAAAABBgMAAAACAQAEBg4AAABDAGEAbABpAGIAcgBpAAkBAQYFAAAAAAAAJkAGDQAAAAAIAAAAAQMAAAACAQgHAAAAAACWAAAAAQQAAAAxAAAAAxwAAAAEDgAAAEEAYwBjAGUAbgB0ADYABQQAAAABAAAABCEAAAAAAQABAQAEAQAGBAAAAAAHBAIAAAAIBAEAAAAJBAAAAAAFKgAAAAEGAwAAAAIBAAQGDgAAAEMAYQBsAGkAYgByAGkACQEBBgUAAAAAAAAmQAYNAAAAAAgAAAABAwAAAAIBCQcAAAAAACEBAAABBAAAAAQAAAADJwAAAAAEAAAABAAAAAQQAAAAQwB1AHIAcgBlAG4AYwB5AAUEAAAAAQAAAAQkAAAAAAEAAQEAAgEAAwEABgQAAAAABwQAAAAACAQBAAAACQQsAAAABSoAAAABBgMAAAACAQEEBg4AAABDAGEAbABpAGIAcgBpAAkBAQYFAAAAAAAAJkAGAAAAAAcAAAAACIUAAAAJgAAAAAAGdAAAAF8AKAAiACQAIgAqACAAIwAsACMAIwAwAC4AMAAwAF8AKQA7AF8AKAAiACQAIgAqACAAXAAoACMALAAjACMAMAAuADAAMABcACkAOwBfACgAIgAkACIAKgAgACIALQAiAD8APwBfACkAOwBfACgAQABfACkAAQQsAAAAABkBAAABBAAAAAcAAAADLwAAAAAEAAAABwAAAAQYAAAAQwB1AHIAcgBlAG4AYwB5ACAAWwAwAF0ABQQAAAABAAAABCQAAAAAAQABAQACAQADAQAGBAAAAAAHBAAAAAAIBAEAAAAJBCoAAAAFKgAAAAEGAwAAAAIBAQQGDgAAAEMAYQBsAGkAYgByAGkACQEBBgUAAAAAAAAmQAYAAAAABwAAAAAIdQAAAAlwAAAAAAZkAAAAXwAoACIAJAAiACoAIAAjACwAIwAjADAAXwApADsAXwAoACIAJAAiACoAIABcACgAIwAsACMAIwAwAFwAKQA7AF8AKAAiACQAIgAqACAAIgAtACIAXwApADsAXwAoAEAAXwApAAEEKgAAAACVAAAAAQQAAAAFAAAAAyUAAAAABAAAAAUAAAAEDgAAAFAAZQByAGMAZQBuAHQABQQAAAABAAAABCQAAAAAAQABAQACAQADAQAGBAAAAAAHBAAAAAAIBAEAAAAJBAkAAAAFKgAAAAEGAwAAAAIBAQQGDgAAAEMAYQBsAGkAYgByAGkACQEBBgUAAAAAAAAmQAYAAAAABwAAAAAACQEAAAEEAAAAAwAAAAMhAAAAAAQAAAADAAAABAoAAABDAG8AbQBtAGEABQQAAAABAAAABCQAAAAAAQABAQACAQADAQAGBAAAAAAHBAAAAAAIBAEAAAAJBCsAAAAFKgAAAAEGAwAAAAIBAQQGDgAAAEMAYQBsAGkAYgByAGkACQEBBgUAAAAAAAAmQAYAAAAABwAAAAAIcwAAAAluAAAAAAZiAAAAXwAoACoAIAAjACwAIwAjADAALgAwADAAXwApADsAXwAoACoAIABcACgAIwAsACMAIwAwAC4AMAAwAFwAKQA7AF8AKAAqACAAIgAtACIAPwA/AF8AKQA7AF8AKABAAF8AKQABBCsAAAAAAQEAAAEEAAAABgAAAAMpAAAAAAQAAAAGAAAABBIAAABDAG8AbQBtAGEAIABbADAAXQAFBAAAAAEAAAAEJAAAAAABAAEBAAIBAAMBAAYEAAAAAAcEAAAAAAgEAQAAAAkEKQAAAAUqAAAAAQYDAAAAAgEBBAYOAAAAQwBhAGwAaQBiAHIAaQAJAQEGBQAAAAAAACZABgAAAAAHAAAAAAhjAAAACV4AAAAABlIAAABfACgAKgAgACMALAAjACMAMABfACkAOwBfACgAKgAgAFwAKAAjACwAIwAjADAAXAApADsAXwAoACoAIAAiAC0AIgBfACkAOwBfACgAQABfACkAAQQpAAAAAK0AAAABBAAAAAEAAAACAQAAAAEDNAAAAAAEAAAAAQAAAAMEAAAAAAAAAAQUAAAAUgBvAHcATABlAHYAZQBsAF8AMQAFBAAAAAEAAAAEJAAAAAABAAEBAAIBAAQBAAYEAAAAAAcEAAAAAAgEAQAAAAkEAAAAAAUtAAAAAAEBAQYDAAAAAgEBBAYOAAAAQwBhAGwAaQBiAHIAaQAJAQEGBQAAAAAAACZABgAAAAAHAAAAAACtAAAAAQQAAAABAAAAAgEAAAABAzQAAAAABAAAAAEAAAADBAAAAAEAAAAEFAAAAFIAbwB3AEwAZQB2AGUAbABfADIABQQAAAABAAAABCQAAAAAAQABAQACAQAEAQAGBAAAAAAHBAAAAAAIBAEAAAAJBAAAAAAFLQAAAAEGAwAAAAIBAQMBAQQGDgAAAEMAYQBsAGkAYgByAGkACQEBBgUAAAAAAAAmQAYAAAAABwAAAAAAqgAAAAEEAAAAAQAAAAIBAAAAAQM0AAAAAAQAAAABAAAAAwQAAAACAAAABBQAAABSAG8AdwBMAGUAdgBlAGwAXwAzAAUEAAAAAQAAAAQkAAAAAAEAAQEAAgEABAEABgQAAAAABwQAAAAACAQBAAAACQQAAAAABSoAAAABBgMAAAACAQEEBg4AAABDAGEAbABpAGIAcgBpAAkBAQYFAAAAAAAAJkAGAAAAAAcAAAAAAKoAAAABBAAAAAEAAAACAQAAAAEDNAAAAAAEAAAAAQAAAAMEAAAAAwAAAAQUAAAAUgBvAHcATABlAHYAZQBsAF8ANAAFBAAAAAEAAAAEJAAAAAABAAEBAAIBAAQBAAYEAAAAAAcEAAAAAAgEAQAAAAkEAAAAAAUqAAAAAQYDAAAAAgEBBAYOAAAAQwBhAGwAaQBiAHIAaQAJAQEGBQAAAAAAACZABgAAAAAHAAAAAACqAAAAAQQAAAABAAAAAgEAAAABAzQAAAAABAAAAAEAAAADBAAAAAQAAAAEFAAAAFIAbwB3AEwAZQB2AGUAbABfADUABQQAAAABAAAABCQAAAAAAQABAQACAQAEAQAGBAAAAAAHBAAAAAAIBAEAAAAJBAAAAAAFKgAAAAEGAwAAAAIBAQQGDgAAAEMAYQBsAGkAYgByAGkACQEBBgUAAAAAAAAmQAYAAAAABwAAAAAAqgAAAAEEAAAAAQAAAAIBAAAAAQM0AAAAAAQAAAABAAAAAwQAAAAFAAAABBQAAABSAG8AdwBMAGUAdgBlAGwAXwA2AAUEAAAAAQAAAAQkAAAAAAEAAQEAAgEABAEABgQAAAAABwQAAAAACAQBAAAACQQAAAAABSoAAAABBgMAAAACAQEEBg4AAABDAGEAbABpAGIAcgBpAAkBAQYFAAAAAAAAJkAGAAAAAAcAAAAAAKoAAAABBAAAAAEAAAACAQAAAAEDNAAAAAAEAAAAAQAAAAMEAAAABgAAAAQUAAAAUgBvAHcATABlAHYAZQBsAF8ANwAFBAAAAAEAAAAEJAAAAAABAAEBAAIBAAQBAAYEAAAAAAcEAAAAAAgEAQAAAAkEAAAAAAUqAAAAAQYDAAAAAgEBBAYOAAAAQwBhAGwAaQBiAHIAaQAJAQEGBQAAAAAAACZABgAAAAAHAAAAAACtAAAAAQQAAAACAAAAAgEAAAABAzQAAAAABAAAAAIAAAADBAAAAAAAAAAEFAAAAEMAbwBsAEwAZQB2AGUAbABfADEABQQAAAABAAAABCQAAAAAAQABAQACAQAEAQAGBAAAAAAHBAAAAAAIBAEAAAAJBAAAAAAFLQAAAAABAQEGAwAAAAIBAQQGDgAAAEMAYQBsAGkAYgByAGkACQEBBgUAAAAAAAAmQAYAAAAABwAAAAAArQAAAAEEAAAAAgAAAAIBAAAAAQM0AAAAAAQAAAACAAAAAwQAAAABAAAABBQAAABDAG8AbABMAGUAdgBlAGwAXwAyAAUEAAAAAQAAAAQkAAAAAAEAAQEAAgEABAEABgQAAAAABwQAAAAACAQBAAAACQQAAAAABS0AAAABBgMAAAACAQEDAQEEBg4AAABDAGEAbABpAGIAcgBpAAkBAQYFAAAAAAAAJkAGAAAAAAcAAAAAAKoAAAABBAAAAAIAAAACAQAAAAEDNAAAAAAEAAAAAgAAAAMEAAAAAgAAAAQUAAAAQwBvAGwATABlAHYAZQBsAF8AMwAFBAAAAAEAAAAEJAAAAAABAAEBAAIBAAQBAAYEAAAAAAcEAAAAAAgEAQAAAAkEAAAAAAUqAAAAAQYDAAAAAgEBBAYOAAAAQwBhAGwAaQBiAHIAaQAJAQEGBQAAAAAAACZABgAAAAAHAAAAAACqAAAAAQQAAAACAAAAAgEAAAABAzQAAAAABAAAAAIAAAADBAAAAAMAAAAEFAAAAEMAbwBsAEwAZQB2AGUAbABfADQABQQAAAABAAAABCQAAAAAAQABAQACAQAEAQAGBAAAAAAHBAAAAAAIBAEAAAAJBAAAAAAFKgAAAAEGAwAAAAIBAQQGDgAAAEMAYQBsAGkAYgByAGkACQEBBgUAAAAAAAAmQAYAAAAABwAAAAAAqgAAAAEEAAAAAgAAAAIBAAAAAQM0AAAAAAQAAAACAAAAAwQAAAAEAAAABBQAAABDAG8AbABMAGUAdgBlAGwAXwA1AAUEAAAAAQAAAAQkAAAAAAEAAQEAAgEABAEABgQAAAAABwQAAAAACAQBAAAACQQAAAAABSoAAAABBgMAAAACAQEEBg4AAABDAGEAbABpAGIAcgBpAAkBAQYFAAAAAAAAJkAGAAAAAAcAAAAAAKoAAAABBAAAAAIAAAACAQAAAAEDNAAAAAAEAAAAAgAAAAMEAAAABQAAAAQUAAAAQwBvAGwATABlAHYAZQBsAF8ANgAFBAAAAAEAAAAEJAAAAAABAAEBAAIBAAQBAAYEAAAAAAcEAAAAAAgEAQAAAAkEAAAAAAUqAAAAAQYDAAAAAgEBBAYOAAAAQwBhAGwAaQBiAHIAaQAJAQEGBQAAAAAAACZABgAAAAAHAAAAAACqAAAAAQQAAAACAAAAAgEAAAABAzQAAAAABAAAAAIAAAADBAAAAAYAAAAEFAAAAEMAbwBsAEwAZQB2AGUAbABfADcABQQAAAABAAAABCQAAAAAAQABAQACAQAEAQAGBAAAAAAHBAAAAAAIBAEAAAAJBAAAAAAFKgAAAAEGAwAAAAIBAQQGDgAAAEMAYQBsAGkAYgByAGkACQEBBgUAAAAAAAAmQAYAAAAABwAAAAAAqAAAAAEEAAAACAAAAAIBAAAAAQMpAAAAAAQAAAAIAAAABBIAAABIAHkAcABlAHIAbABpAG4AawAFBAAAAAEAAAAELQAAAAABAAEBAAIBAAQBAAYEAAAAAAcEAAAAAAgEAQAAAAkEAAAAAA0GAwAAAAcBBAUqAAAAAQYDAAAAAgEKBAYOAAAAQwBhAGwAaQBiAHIAaQAGBQAAAAAAACZABwEDBgAAAAAHAAAAAAC6AAAAAQQAAAAJAAAAAgEAAAABAzsAAAAABAAAAAkAAAAEJAAAAEYAbwBsAGwAbwB3AGUAZAAgAEgAeQBwAGUAcgBsAGkAbgBrAAUEAAAAAQAAAAQtAAAAAAEAAQEAAgEABAEABgQAAAAABwQAAAAACAQBAAAACQQAAAAADQYDAAAABwEEBSoAAAABBgMAAAACAQsEBg4AAABDAGEAbABpAGIAcgBpAAYFAAAAAAAAJkAHAQMGAAAAAAcAAAAA"; var oBinaryFileReader=new BinaryFileReader;var stream=oBinaryFileReader.getbase64DecodedData(sStyles);var bcr=new Binary_CommonReader(stream);var oBinary_StylesTableReader=new Binary_StylesTableReader(stream,wb,[],undefined,true);var length=stream.GetULongLE();var fReadStyle=function(type,length,oCellStyle,oStyleObject){var res=c_oSerConstants.ReadOk;if(Types.BuiltinId===type)oCellStyle.BuiltinId=stream.GetULongLE();else if(Types.Hidden===type)oCellStyle.Hidden=stream.GetBool();else if(Types.CellStyle=== type)res=bcr.Read1(length,function(t,l){return oBinary_StylesTableReader.ReadCellStyle(t,l,oCellStyle)});else if(Types.Xfs===type){oStyleObject.xfs=new OpenXf;res=bcr.Read2Spreadsheet(length,function(t,l){return oBinary_StylesTableReader.ReadXfs(t,l,oStyleObject.xfs)})}else if(Types.Font===type){oStyleObject.font=new AscCommonExcel.Font;res=bcr.Read2Spreadsheet(length,function(t,l){return oBinary_StylesTableReader.bssr.ReadRPr(t,l,oStyleObject.font)});oStyleObject.font.checkSchemeFont(wb.theme)}else if(Types.Fill=== type){oStyleObject.fill=new AscCommonExcel.Fill;res=bcr.Read1(length,function(t,l){return oBinary_StylesTableReader.ReadFill(t,l,oStyleObject.fill)})}else if(Types.Border===type){oStyleObject.border=new AscCommonExcel.Border;res=bcr.Read1(length,function(t,l){return oBinary_StylesTableReader.ReadBorder(t,l,oStyleObject.border)})}else if(Types.NumFmts===type)res=bcr.Read1(length,function(t,l){return oBinary_StylesTableReader.ReadNumFmts(t,l,oStyleObject.oNumFmts)});else res=c_oSerConstants.ReadUnknown; return res};var fReadStyles=function(type,length,oOutput){var res=c_oSerConstants.ReadOk;var oStyleObject={font:null,fill:null,border:null,oNumFmts:{},xfs:null};if(Types.Style===type){var oCellStyle=new AscCommonExcel.CCellStyle;res=bcr.Read1(length,function(t,l){return fReadStyle(t,l,oCellStyle,oStyleObject)});var newXf=new AscCommonExcel.CellXfs;if(null!==oStyleObject.border)newXf.border=g_StyleCache.addBorder(oStyleObject.border);if(null!==oStyleObject.fill)newXf.fill=g_StyleCache.addFill(oStyleObject.fill); if(null!==oStyleObject.font)newXf.font=g_StyleCache.addFont(oStyleObject.font);if(null!==oStyleObject.xfs.numid){var oCurNum=oStyleObject.oNumFmts[oStyleObject.xfs.numid];if(null!=oCurNum)newXf.num=g_StyleCache.addNum(oCurNum);else newXf.num=g_StyleCache.addNum(oBinary_StylesTableReader.ParseNum({id:oStyleObject.xfs.numid,f:null},oStyleObject.oNumFmts))}if(null!=oStyleObject.xfs.QuotePrefix)newXf.QuotePrefix=oStyleObject.xfs.QuotePrefix;if(null!=oStyleObject.xfs.PivotButton)newXf.PivotButton=oStyleObject.xfs.PivotButton; if(null!=oStyleObject.xfs.align)newXf.align=g_StyleCache.addAlign(oStyleObject.xfs.align);if(null!==oStyleObject.xfs.XfId)newXf.XfId=oStyleObject.xfs.XfId;if(null!==oStyleObject.xfs.ApplyBorder)oCellStyle.ApplyBorder=oStyleObject.xfs.ApplyBorder;if(null!==oStyleObject.xfs.ApplyFill)oCellStyle.ApplyFill=oStyleObject.xfs.ApplyFill;if(null!==oStyleObject.xfs.ApplyFont)oCellStyle.ApplyFont=oStyleObject.xfs.ApplyFont;if(null!==oStyleObject.xfs.ApplyNumberFormat)oCellStyle.ApplyNumberFormat=oStyleObject.xfs.ApplyNumberFormat; oCellStyle.xfs=g_StyleCache.addXf(newXf);oOutput.push(oCellStyle)}else res=c_oSerConstants.ReadUnknown;return res};var res=bcr.Read1(length,function(t,l){return fReadStyles(t,l,oOutput)});if(0===wb.CellStyles.CustomStyles.length&&0=this.extX|| T>=this.extY||R<=0||B<=0){ret2.push({x:0,y:0});ret2.push({x:this.extX,y:0});ret2.push({x:this.extX,y:this.extY});ret2.push({x:0,y:this.extY});ret2.push({x:0,y:0})}else{ret2.push({x:L,y:T});ret2.push({x:R,y:T});ret2.push({x:R,y:B});ret2.push({x:L,y:B});ret2.push({x:L,y:T})}ret.push(ret2)}else if(this.spPr&&this.spPr.geometry)ret=this.spPr.geometry.getArrayPolygons();else ret=[];var tr=this.localTransform;for(var i=0;i0)){this.recalcInfo.recalculateTxBoxContent=true;this.recalcInfo.recalculateTransformText=true;this.recalculateText()}}if(Array.isArray(this.spTree))for(var i=0;i0&&x_t0&&y_tdMaxHeight){extY=dMaxHeight;extX=oSize.asc_getImageWidth()*(extY/oSize.asc_getImageHeight())}}else{extX=oSize.asc_getImageWidth()* dScale;extY=oSize.asc_getImageHeight()*dScale}oDrawing=this.createImage(oProps.get_ImageUrl(),0,0,extX,extY,null,null)}else{var oTextPropMenu=oProps.get_TextPr();oDrawing=new AscFormat.CShape;oDrawing.setWordShape(true);oDrawing.setBDeleted(false);oDrawing.createTextBoxContent();var oSpPr=new AscFormat.CSpPr;var oXfrm=new AscFormat.CXfrm;oXfrm.setOffX(0);oXfrm.setOffY(0);oXfrm.setExtX(5);oXfrm.setExtY(5);if(oProps.get_IsDiagonal()!==false)oXfrm.setRot(7*Math.PI/4);oSpPr.setXfrm(oXfrm);oXfrm.setParent(oSpPr); oSpPr.setFill(AscFormat.CreateNoFillUniFill());oSpPr.setLn(AscFormat.CreateNoFillLine());oSpPr.setGeometry(AscFormat.CreateGeometry("rect"));oDrawing.setSpPr(oSpPr);oSpPr.setParent(oDrawing);var oContent=oDrawing.getDocContent();AscFormat.AddToContentFromString(oContent,oProps.get_Text());var oTextPr=new CTextPr;oTextPr.FontSize=oTextPropMenu.get_FontSize()>0?oTextPropMenu.get_FontSize():20;oTextPr.RFonts.SetAll(oTextPropMenu.get_FontFamily().get_Name(),-1);oTextPr.Bold=oTextPropMenu.get_Bold();oTextPr.Italic= oTextPropMenu.get_Italic();oTextPr.Underline=oTextPropMenu.get_Underline();oTextPr.Strikeout=oTextPropMenu.get_Strikeout();oTextPr.TextFill=AscFormat.CreateUnifillFromAscColor(oTextPropMenu.get_Color(),1);oTextPr.TextFill.transparent=oProps.get_Opacity()<255?127.5:null;if(null!==oTextPropMenu.get_Lang())oTextPr.SetLang(oTextPropMenu.get_Lang());oContent.SetApplyToAll(true);oContent.AddToParagraph(new ParaTextPr(oTextPr));oContent.SetParagraphAlign(AscCommon.align_Center);oContent.SetParagraphSpacing({Before:0, After:0,LineRule:Asc.linerule_Auto,Line:1});oContent.SetParagraphIndent({FirstLine:0,Left:0,Right:0});oContent.SetApplyToAll(false);var oBodyPr=oDrawing.getBodyPr().createDuplicate();oBodyPr.rot=0;oBodyPr.spcFirstLastPara=false;oBodyPr.vertOverflow=AscFormat.nOTOwerflow;oBodyPr.horzOverflow=AscFormat.nOTOwerflow;oBodyPr.vert=AscFormat.nVertTThorz;oBodyPr.lIns=0;oBodyPr.tIns=0;oBodyPr.rIns=0;oBodyPr.bIns=0;oBodyPr.numCol=1;oBodyPr.spcCol=0;oBodyPr.rtlCol=0;oBodyPr.fromWordArt=false;oBodyPr.anchor= 1;oBodyPr.anchorCtr=false;oBodyPr.forceAA=false;oBodyPr.compatLnSpc=true;oBodyPr.prstTxWarp=null;oDrawing.setBodyPr(oBodyPr);var oContentSize=AscFormat.GetContentOneStringSizes(oContent);oXfrm.setExtX(oContentSize.w+1);oXfrm.setExtY(oContentSize.h);if(oTextPropMenu.get_FontSize()<0){if(oProps.get_IsDiagonal())extX=Math.SQRT2*Math.min(dMaxWidth,dMaxHeight)/(oContentSize.h/oContentSize.w+1);else extX=dMaxWidth;oTextPr.FontSize*=extX/oContentSize.w;oContent.SetApplyToAll(true);oContent.AddToParagraph(new ParaTextPr(oTextPr)); oContent.SetApplyToAll(false);oContentSize=AscFormat.GetContentOneStringSizes(oContent);oXfrm.setExtX(extX+1);oXfrm.setExtY(oContentSize.h)}}var oParaDrawing=null;if(oDrawing){oParaDrawing=new ParaDrawing(oDrawing.spPr.xfrm.extX,oDrawing.spPr.xfrm.extY,oDrawing,this.document.DrawingDocument,this.document,null);oDrawing.setParent(oParaDrawing);oParaDrawing.Set_GraphicObject(oDrawing);oParaDrawing.setExtent(oDrawing.spPr.xfrm.extX,oDrawing.spPr.xfrm.extY);oParaDrawing.Set_DrawingType(drawing_Anchor); oParaDrawing.Set_WrappingType(WRAPPING_TYPE_NONE);oParaDrawing.Set_BehindDoc(true);oParaDrawing.Set_Distance(3.2,0,3.2,0);oParaDrawing.Set_PositionH(Asc.c_oAscRelativeFromH.Margin,true,Asc.c_oAscAlignH.Center,false);oParaDrawing.Set_PositionV(Asc.c_oAscRelativeFromV.Margin,true,Asc.c_oAscAlignV.Center,false)}if(false!==bTrackRevisions)this.document.SetLocalTrackRevisions(bTrackRevisions);return oParaDrawing},getTrialImage:function(sImageUrl){return AscFormat.ExecuteNoHistory(function(){var oParaDrawing= new ParaDrawing;oParaDrawing.Set_PositionH(Asc.c_oAscRelativeFromH.Page,true,c_oAscAlignH.Center,undefined);oParaDrawing.Set_PositionV(Asc.c_oAscRelativeFromV.Page,true,c_oAscAlignV.Center,undefined);oParaDrawing.Set_WrappingType(WRAPPING_TYPE_NONE);oParaDrawing.Set_BehindDoc(false);oParaDrawing.Set_Distance(3.2,0,3.2,0);oParaDrawing.Set_DrawingType(drawing_Anchor);var oShape=this.createWatermarkImage(sImageUrl);oParaDrawing.Extent.W=oShape.spPr.xfrm.extX;oParaDrawing.Extent.H=oShape.spPr.xfrm.extY; oShape.setParent(oParaDrawing);oParaDrawing.Set_GraphicObject(oShape);return oParaDrawing},this,[])},recalculate_:function(data){if(data.All){for(var i=0;i0){for(var i=0;i-1;--i)this.drawingObjects[i].CheckGroupSizes()}, checkUseDrawings:function(aDrawings){for(var i=aDrawings.length-1;i>-1;--i)if(!aDrawings[i].Is_UseInDocument())aDrawings.splice(i,1)},bringToFront:function(){if(false===this.document.Document_Is_SelectionLocked(changestype_Drawing_Props)){this.document.StartAction(AscDFH.historydescription_Document_GrObjectsBringToFront);if(this.selection.groupSelection)this.selection.groupSelection.bringToFront();else{var aSelectedObjectsCopy=[],i;for(i=0;i aDrawings.length||nPos<0)return;var i,j,nBetweenMin,nBetweenMax,nTempInterval,aTempDrawingsArray,nDelta;if(nPos===aDrawings.length)for(i=0;i0)nBetweenMin=aDrawings[nPos-1].RelativeHeight;else nBetweenMin=-1;nBetweenMax=aDrawings[nPos].RelativeHeight;if(aToInsert.length>0;this.checkZIndexMap(aToInsert[i],oDrawingMap,nBetweenMin);aDrawings.splice(nPos+i,aToInsert[i])}else{nDelta=nBetweenMax-nBetweenMin-aToInsert.length+1;for(i=nPos;i-1;--i)if(aDrawings[i].GraphicObj.selected){if(nIndexLastNoSelect!==-1){for(j=i;j>-1;--j)if(aDrawings[j].GraphicObj.selected){aSelect.splice(0,0,aDrawings.splice(j,1)[0]);--nIndexLastNoSelect}else break;this.insertBetween(aSelect,aDrawings,nIndexLastNoSelect+1,oDrawingsMap);aSelect.length=0;nIndexLastNoSelect=-1;i=j+1}}else nIndexLastNoSelect=i;var oCheckObject=this.checkDrawingsMap(oDrawingsMap);if(false===this.document.Document_Is_SelectionLocked(AscCommon.changestype_None, {Type:changestype_2_ElementsArray_and_Type,CheckType:changestype_Drawing_Props,Elements:oCheckObject.aDrawings})){this.document.StartAction(AscDFH.historydescription_Document_GrObjectsBringForward);this.applyZIndex(oCheckObject);this.document.Recalculate();this.document.UpdateUndoRedo();this.document.FinalizeAction()}}},sendToBack:function(){if(this.selection.groupSelection){if(false===this.document.Document_Is_SelectionLocked(changestype_Drawing_Props)){this.document.StartAction(AscDFH.historydescription_Document_GrObjectsSendToBackGroup); this.selection.groupSelection.sendToBack();this.document.Recalculate();this.document.UpdateUndoRedo();this.document.FinalizeAction()}}else{var aDrawings=[].concat(this.drawingObjects),i,aSelect=[],oDrawingsMap={};this.checkUseDrawings(aDrawings);aDrawings.sort(ComparisonByZIndexSimple);for(i=0;i-1;--i)if(parent_group.spTree[i]===aSelectedCharts[0]){parent_group.removeFromSpTreeByPos(i);chart_space.setGroup(parent_group);chart_space.spPr.xfrm.setOffX(aSelectedCharts[0].spPr.xfrm.offX);chart_space.spPr.xfrm.setOffY(aSelectedCharts[0].spPr.xfrm.offY); parent_group.addToSpTree(i,chart_space);major_group.updateCoordinatesAfterInternalResize();major_group.parent.CheckWH();if(this.selection.groupSelection){select_start_page=this.selection.groupSelection.selectedObjects[0].selectStartPage;this.selection.groupSelection.resetSelection();this.selection.groupSelection.selectObject(chart_space,select_start_page)}this.document.Recalculate();this.document.Document_UpdateInterfaceState();return}}else{chart_space.spPr.xfrm.setOffX(0);chart_space.spPr.xfrm.setOffY(0); select_start_page=aSelectedCharts[0].selectStartPage;chart_space.setParent(aSelectedCharts[0].parent);aSelectedCharts[0].parent.Set_GraphicObject(chart_space);aSelectedCharts[0].parent.docPr.setTitle(chart["cTitle"]);aSelectedCharts[0].parent.docPr.setDescr(chart["cDescription"]);this.resetSelection();this.selectObject(chart_space,select_start_page);aSelectedCharts[0].parent.CheckWH();this.document.Recalculate();this.document.Document_UpdateInterfaceState()}},getCompatibilityMode:function(){var ret= 255;if(this.document&&this.document.GetCompatibilityMode)ret=this.document.GetCompatibilityMode();return ret},mergeDrawings:function(pageIndex,HeaderDrawings,HeaderTables,FooterDrawings,FooterTables){var nCompatibilityMode=this.getCompatibilityMode();if(!this.graphicPages[pageIndex])this.graphicPages[pageIndex]=new CGraphicPage(pageIndex,this);var drawings=[],tables=[],i,hdr_ftr_page=this.graphicPages[pageIndex].hdrFtrPage;if(HeaderDrawings)drawings=drawings.concat(HeaderDrawings);if(FooterDrawings)drawings= drawings.concat(FooterDrawings);var getFloatObjects=function(arrObjects){var ret=[];for(var i=0;i0){this.resetSelection2();this.document.AddInlineImage(W,H,Img,Chart,bFlow)}}else if(this.selectedObjects.length>0){this.resetSelection2();this.document.AddInlineImage(W,H,Img,Chart,bFlow)}},addSignatureLine:function(oSignatureDrawing){var content=this.getTargetDocContent();if(content)if(!content.bPresentation)content.AddSignatureLine(oSignatureDrawing);else{if(this.selectedObjects.length> 0){this.resetSelection2();this.document.AddSignatureLine(oSignatureDrawing)}}else if(this.selectedObjects[0]&&this.selectedObjects[0].parent&&this.selectedObjects[0].parent.Is_Inline()){this.resetInternalSelection();this.document.Remove(1,true);this.document.AddSignatureLine(oSignatureDrawing)}else if(this.selectedObjects.length>0){this.resetSelection2();this.document.AddSignatureLine(oSignatureDrawing)}},getDrawingArray:function(){var ret=[];var arrDrawings=[].concat(this.drawingObjects);this.checkUseDrawings(arrDrawings); for(var i=0;i0){this.resetSelection2();this.document.AddOleObject(W,H,nWidthPix,nHeightPix,Img,Data,sApplicationId)}}else if(this.selectedObjects[0]&&this.selectedObjects[0].parent&&this.selectedObjects[0].parent.Is_Inline()){this.resetInternalSelection();this.document.Remove(1,true);this.document.AddOleObject(W,H,nWidthPix,nHeightPix,Img,Data,sApplicationId)}else if(this.selectedObjects.length>0){this.resetSelection2();this.document.AddOleObject(W, H,nWidthPix,nHeightPix,Img,Data,sApplicationId)}},addInlineTable:function(nCols,nRows,nMode){var content=this.getTargetDocContent();if(content)return content.AddInlineTable(nCols,nRows,nMode);return null},addImages:function(aImages){var content=this.getTargetDocContent();if(content&&!content.bPresentation)content.AddImages(aImages);else{this.resetSelection2();this.document.AddImages(aImages)}},canAddComment:function(){var content=this.getTargetDocContent();return content&&content.CanAddComment()}, addComment:function(commentData){var content=this.getTargetDocContent();return content&&content.AddComment(commentData,true,true)},hyperlinkCheck:DrawingObjectsController.prototype.hyperlinkCheck,hyperlinkCanAdd:DrawingObjectsController.prototype.hyperlinkCanAdd,hyperlinkRemove:DrawingObjectsController.prototype.hyperlinkRemove,hyperlinkModify:DrawingObjectsController.prototype.hyperlinkModify,hyperlinkAdd:DrawingObjectsController.prototype.hyperlinkAdd,isCurrentElementParagraph:function(){var content= this.getTargetDocContent();return content&&content.Is_CurrentElementParagraph()},isCurrentElementTable:function(){var content=this.getTargetDocContent();return content&&content.Is_CurrentElementTable()},GetSelectedContent:function(SelectedContent){var content=this.getTargetDocContent();if(content)content.GetSelectedContent(SelectedContent);else{var para=new Paragraph(this.document.DrawingDocument,this.document);var selectedObjects,run,drawing,i;var aDrawings=[];if(this.selection.groupSelection){selectedObjects= this.selection.groupSelection.selectedObjects;var groupParaDrawing=this.selection.groupSelection.parent;for(i=0;i 0)return selection_arr[0].selectStartPage;return 0},createGraphicPage:function(pageIndex){if(!isRealObject(this.graphicPages[pageIndex]))this.graphicPages[pageIndex]=new CGraphicPage(pageIndex,this)},resetDrawingArrays:function(pageIndex,docContent){var hdr_ftr=docContent.IsHdrFtr(true);if(!hdr_ftr)if(isRealObject(this.graphicPages[pageIndex]))this.graphicPages[pageIndex].resetDrawingArrays(docContent)},mergeHdrFtrPages:function(page1,page2,pageIndex){if(!isRealObject(this.graphicPages[pageIndex]))this.graphicPages[pageIndex]= new CGraphicPage(pageIndex,this);this.graphicPages[pageIndex].hdrFtrPage.clear();this.graphicPages[pageIndex].hdrFtrPage.mergePages(page1,page2)},onEndRecalculateDocument:function(pagesCount){for(var i=0;ipagesCount)for(i=pagesCount;i0?this.selectedObjects[0].parent:null},documentUpdateRulersState:function(){var content=this.getTargetDocContent();if(content&&content.Parent&&content.Parent.getObjectType&&content.Parent.getObjectType()===AscDFH.historyitem_type_Shape)content.Parent.documentUpdateRulersState()},updateTextPr:function(){var TextPr= this.getParagraphTextPr();if(TextPr){var theme=this.document.Get_Theme();if(theme&&theme.themeElements&&theme.themeElements.fontScheme)TextPr.ReplaceThemeFonts(theme.themeElements.fontScheme);editor.UpdateTextPr(TextPr)}},updateParentParagraphParaPr:function(){var majorParaDrawing=this.getMajorParaDrawing();if(majorParaDrawing){var parent_para=this.selectedObjects[0].parent.Get_ParentParagraph(),ParaPr;if(parent_para){ParaPr=parent_para.Get_CompiledPr2(true).ParaPr;if(ParaPr){var NumType=-1;var NumSubType= -1;var oNumPr=parent_para.GetNumPr();if(oNumPr&&oNumPr.IsValid()){var oNum=this.document.GetNumbering().GetNum(oNumPr.NumId);if(oNum&&oNum.GetLvl(oNumPr.Lvl)){var oInfo=oNum.GetLvl(oNumPr.Lvl).GetPresetType();NumType=oInfo.Type;NumSubType=oInfo.SubType}}ParaPr.ListType={Type:NumType,SubType:NumSubType};editor.sync_ParaSpacingLine(ParaPr.Spacing);editor.Update_ParaInd(ParaPr.Ind);editor.sync_PrAlignCallBack(ParaPr.Jc);editor.sync_ParaStyleName(ParaPr.StyleName);editor.sync_ListType(ParaPr.ListType)}}}}, documentUpdateInterfaceState:function(){if(this.selection.textSelection)this.selection.textSelection.getDocContent().Document_UpdateInterfaceState();else if(this.selection.groupSelection)this.selection.groupSelection.documentUpdateInterfaceState();else{var para_pr=DrawingObjectsController.prototype.getParagraphParaPr.call(this);if(!para_pr);if(para_pr){var TextPr=this.getParagraphTextPr();var theme=this.document.Get_Theme();if(theme&&theme.themeElements&&theme.themeElements.fontScheme)TextPr.ReplaceThemeFonts(theme.themeElements.fontScheme); editor.UpdateParagraphProp(para_pr);editor.UpdateTextPr(TextPr)}}},resetInterfaceTextPr:function(){editor.Update_ParaTab(AscCommonWord.Default_Tab_Stop,new CParaTabs);editor.sync_ParaSpacingLine(new CParaSpacing);editor.Update_ParaInd(new CParaInd);editor.sync_PrAlignCallBack(null);editor.sync_ParaStyleName(null);editor.sync_ListType({Type:-1,SubType:-1})},isNeedUpdateRulers:function(){if(this.selectedObjects.length===1&&this.selectedObjects[0].getDocContent&&this.selectedObjects[0].getDocContent())return true; return false},documentCreateFontCharMap:function(FontCharMap){return},documentCreateFontMap:function(FontCharMap){return},tableCheckSplit:function(){var content=this.getTargetDocContent();return content&&content.CanSplitTableCells()},tableCheckMerge:function(){var content=this.getTargetDocContent();return content&&content.CanMergeTableCells()},tableSelect:function(Type){var content=this.getTargetDocContent();return content&&content.SelectTable(Type)},tableRemoveTable:function(){var content=this.getTargetDocContent(); return content&&content.RemoveTable()},tableSplitCell:function(Cols,Rows){var content=this.getTargetDocContent();return content&&content.SplitTableCells(Cols,Rows)},tableMergeCells:function(){var content=this.getTargetDocContent();return content&&content.MergeTableCells()},tableRemoveCol:function(){var content=this.getTargetDocContent();return content&&content.RemoveTableColumn()},tableAddCol:function(bBefore,nCount){var content=this.getTargetDocContent();return content&&content.AddTableColumn(bBefore, nCount)},tableRemoveRow:function(){var content=this.getTargetDocContent();return content&&content.RemoveTableRow()},tableRemoveCells:function(){var content=this.getTargetDocContent();return content&&content.RemoveTableCells()},tableAddRow:function(bBefore,nCount){var content=this.getTargetDocContent();return content&&content.AddTableRow(bBefore,nCount)},distributeTableCells:function(isHorizontally){var content=this.getTargetDocContent();return content&&content.DistributeTableCells(isHorizontally)}, documentSearch:function(CurPage,String,search_Common){if(this.graphicPages[CurPage]){this.graphicPages[CurPage].documentSearch(String,search_Common);CGraphicPage.prototype.documentSearch.call(this.getHdrFtrObjectsByPageIndex(CurPage),String,search_Common)}},getSelectedElementsInfo:function(Info){if(this.selectedObjects.length===0)Info.SetDrawing(-1);var content=this.getTargetDocContent();if(content){Info.SetDrawing(selected_DrawingObjectText);content.GetSelectedElementsInfo(Info)}else Info.SetDrawing(selected_DrawingObject); return Info},getAllObjectsOnPage:function(pageIndex,bHdrFtr){var graphic_page;if(bHdrFtr)graphic_page=this.getHdrFtrObjectsByPageIndex(pageIndex);else graphic_page=this.graphicPages[pageIndex];return graphic_page?graphic_page.behindDocObjects.concat(graphic_page.inlineObjects.concat(graphic_page.beforeTextObjects)):[]},selectNextObject:DrawingObjectsController.prototype.selectNextObject,getCurrentParagraph:function(bIgnoreSelection,arrSelectedParagraphs,oPr){var content=this.getTargetDocContent(oPr&& oPr.CheckDocContent,undefined);if(content)return content.GetCurrentParagraph(bIgnoreSelection,arrSelectedParagraphs,oPr);else{var ParaDrawing=this.getMajorParaDrawing();if(ParaDrawing&&ParaDrawing.Parent instanceof Paragraph)return ParaDrawing.Parent;return null}},getCurrentTablesStack:function(arrTables){var oContent=this.getTargetDocContent(false,undefined);if(oContent)return oContent.GetCurrentTablesStack(arrTables);return arrTables?arrTables:[]},GetSelectedText:DrawingObjectsController.prototype.GetSelectedText, getCurPosXY:function(){var content=this.getTargetDocContent();if(content)return content.GetCurPosXY();else{if(this.selectedObjects.length===1)return{X:this.selectedObjects[0].parent.X,Y:this.selectedObjects[0].parent.Y};return{X:0,Y:0}}},isTextSelectionUse:function(){var content=this.getTargetDocContent();if(content)return content.IsTextSelectionUse();else return false},isSelectionUse:function(){var content=this.getTargetDocContent();if(content)return content.IsTextSelectionUse();else return this.selectedObjects.length> 0},paragraphFormatPaste:function(CopyTextPr,CopyParaPr,Bool){var content=this.getTargetDocContent();content&&content.PasteFormatting(CopyTextPr,CopyParaPr,Bool)},getHdrFtrObjectsByPageIndex:function(pageIndex){if(this.graphicPages[pageIndex])return this.graphicPages[pageIndex].hdrFtrPage;return null},getNearestPos:function(x,y,pageIndex,drawing){if(drawing&&drawing.GraphicObj)if(drawing.GraphicObj.getObjectType()!==AscDFH.historyitem_type_ImageShape&&drawing.GraphicObj.getObjectType()!==AscDFH.historyitem_type_OleObject&& drawing.GraphicObj.getObjectType()!==AscDFH.historyitem_type_ChartSpace)return null;this.handleEventMode=HANDLE_EVENT_MODE_CURSOR;var cursor_type=this.nullState.onMouseDown(global_mouseEvent,x,y,pageIndex);this.handleEventMode=HANDLE_EVENT_MODE_HANDLE;var object;if(cursor_type){object=g_oTableId.Get_ById(cursor_type.objectId);if(object)if(cursor_type.cursorType==="text"){if(object.getNearestPos)return object.getNearestPos(x,y,pageIndex)}else if((object.getObjectType()===AscDFH.historyitem_type_ImageShape|| object.getObjectType()===AscDFH.historyitem_type_OleObject)&&object.parent){var oShape=object.parent.isShapeChild(true);if(oShape)return oShape.getNearestPos(x,y,pageIndex)}else if(object.getObjectType()===AscDFH.historyitem_type_Shape)if(object.hitInTextRect(x,y))return object.getNearestPos(x,y,pageIndex)}return null},selectionCheck:function(X,Y,Page_Abs,NearPos){var text_object=AscFormat.getTargetTextObject(this);if(text_object)return text_object.selectionCheck(X,Y,Page_Abs,NearPos);return false}, checkTextObject:function(x,y,pageIndex){var text_object=AscFormat.getTargetTextObject(this);if(text_object&&text_object.hitInTextRect)if(text_object.selectStartPage===pageIndex)if(text_object.hitInTextRect(x,y))return true;return false},getParagraphParaPrCopy:function(){return this.getParagraphParaPr()},getParagraphTextPrCopy:function(){return this.getParagraphTextPr()},getParagraphParaPr:function(){var ret=DrawingObjectsController.prototype.getParagraphParaPr.call(this);if(ret&&ret.Shd&&ret.Shd.Unifill)ret.Shd.Unifill.check(this.document.theme, this.document.Get_ColorMap());return ret?ret:new CParaPr},getColorMap:function(){return this.document.Get_ColorMap()},GetStyleFromFormatting:function(){var oContent=this.getTargetDocContent();if(oContent){var oStyleFormatting=oContent.GetStyleFromFormatting();var oTextPr=oStyleFormatting.TextPr;if(oTextPr.TextFill)oTextPr.TextFill=undefined;if(oTextPr.TextOutline)oTextPr.TextOutline=undefined;return oStyleFormatting}return null},getParagraphTextPr:function(){var ret=DrawingObjectsController.prototype.getParagraphTextPr.call(this); if(ret){var ret_;if(ret.Unifill&&ret.Unifill.canConvertPPTXModsToWord()){ret_=ret.Copy();ret_.Unifill.convertToWordMods()}else ret_=ret;if(ret_.Unifill)ret_.Unifill.check(this.document.theme,this.document.Get_ColorMap());return ret_}else return new CTextPr},isSelectedText:function(){return isRealObject(this.getTargetDocContent())},selectAll:DrawingObjectsController.prototype.selectAll,startEditTextCurrentShape:DrawingObjectsController.prototype.startEditTextCurrentShape,drawSelect:function(pageIndex){DrawingObjectsController.prototype.drawSelect.call(this, pageIndex,this.drawingDocument)},drawBehindDoc:function(pageIndex,graphics){if(this.graphicPages[pageIndex]){graphics.shapePageIndex=pageIndex;this.graphicPages[pageIndex].drawBehindDoc(graphics);graphics.shapePageIndex=null}},drawBehindObjectsByContent:function(pageIndex,graphics,content){var page;if(content.IsHdrFtr())page=this.getHdrFtrObjectsByPageIndex(pageIndex);else page=this.graphicPages[pageIndex];page&&page.drawBehindObjectsByContent(graphics,content)},drawBeforeObjectsByContent:function(pageIndex, graphics,content){var page;if(content.IsHdrFtr())page=this.getHdrFtrObjectsByPageIndex(pageIndex);else page=this.graphicPages[pageIndex];page&&page.drawBeforeObjectsByContent(graphics,content)},endTrackShape:function(){},drawBeforeObjects:function(pageIndex,graphics){if(this.graphicPages[pageIndex]){graphics.shapePageIndex=pageIndex;this.graphicPages[pageIndex].drawBeforeObjects(graphics);graphics.shapePageIndex=null}},drawBehindDocHdrFtr:function(pageIndex,graphics){graphics.shapePageIndex=pageIndex; var hdr_footer_objects=this.getHdrFtrObjectsByPageIndex(pageIndex);if(hdr_footer_objects!=null){var behind_doc=hdr_footer_objects.behindDocObjects;for(var i=0;i0||this.curState.InlinePos},changeCurrentState:function(state){this.curState=state},handleDblClickEmptyShape:function(oShape){if(!oShape.getDocContent()&&!AscFormat.CheckLinePresetForParagraphAdd(oShape.getPresetGeom())){if(false===this.document.Document_Is_SelectionLocked(changestype_Drawing_Props)){this.document.StartAction(AscDFH.historydescription_Document_GrObjectsBringBackward); if(!oShape.bWordShape)oShape.createTextBody();else oShape.createTextBoxContent();this.document.Recalculate();var oContent=oShape.getDocContent();oContent.Set_CurrentElement(0,true);oContent.MoveCursorToStartPos(false);this.updateSelectionState();this.document.FinalizeAction()}this.clearTrackObjects();this.clearPreTrackObjects();this.changeCurrentState(new AscFormat.NullState(this))}},canGroup:function(bGetArray){var selection_array=this.selectedObjects;if(selection_array.length<2)return bGetArray? []:false;if(!selection_array[0].canGroup())return bGetArray?[]:false;var first_page_index=selection_array[0].parent.pageIndex;for(var index=1;index0},getGroup:DrawingObjectsController.prototype.getGroup,addObjectOnPage:function(pageIndex,object){var hdr_ftr=object.parent.DocumentContent.IsHdrFtr(true);if(!hdr_ftr){if(!this.graphicPages[pageIndex]){this.graphicPages[pageIndex]= new CGraphicPage(pageIndex,this);for(var z=0;z0){this.resetSelection();var i,j,nearest_pos,cur_group,sp_tree,sp,parent_paragraph,page_num;var arrCenterPos=[],aPos;for(i=0;i0){var top_obj=sel_arr[0];for(var i=1;i0)if(this.selection.groupSelection)if(this.selection.groupSelection.selection.chartSelection){this.selection.groupSelection.selection.chartSelection.remove();this.document.Recalculate()}else{var group_map={},group_arr=[],i,cur_group,sp,xc,yc,hc,vc,rel_xc,rel_yc,j; for(i=0;i-1},isPointInDrawingObjects3:function(x,y,pageIndex,bSelected,bText){if(bText){var ret;this.handleEventMode=HANDLE_EVENT_MODE_CURSOR;ret=this.curState.onMouseDown(global_mouseEvent, x,y,pageIndex);this.handleEventMode=HANDLE_EVENT_MODE_HANDLE;if(isRealObject(ret))if(ret.cursorType==="text")return true;return false}var oOldState=this.curState;this.changeCurrentState(new AscFormat.NullState(this));var bRet=this.isPointInDrawingObjects(x,y,pageIndex,bSelected,true)>-1;this.changeCurrentState(oOldState);return bRet},pointInObjInDocContent:function(docContent,X,Y,pageIndex){var ret;this.handleEventMode=HANDLE_EVENT_MODE_CURSOR;ret=this.curState.onMouseDown(global_mouseEvent,X,Y,pageIndex); this.handleEventMode=HANDLE_EVENT_MODE_HANDLE;if(ret){var object=g_oTableId.Get_ById(ret.objectId);if(object){var parent_drawing;if(!object.group&&object.parent)parent_drawing=object;else if(object.group){parent_drawing=object.group;while(parent_drawing.group)parent_drawing=parent_drawing.group}if(parent_drawing&&parent_drawing.parent)return docContent===parent_drawing.parent.DocumentContent.Is_TopDocument(true)}}return false},pointInSelectedObject:function(x,y,pageIndex){var ret;this.handleEventMode= HANDLE_EVENT_MODE_CURSOR;ret=this.curState.onMouseDown(global_mouseEvent,x,y,pageIndex);this.handleEventMode=HANDLE_EVENT_MODE_HANDLE;if(ret){var object=g_oTableId.Get_ById(ret.objectId);if(object&&object.selected)return true}return false},checkTargetSelection:function(){return false},getSelectedDrawingObjectsCount:function(){if(this.selection.groupSelection)return this.selection.groupSelection.selectedObjects.length;return this.selectedObjects.length},putShapesAlign:function(type,alignType){var Bounds; if(this.selectedObjects.length<1)return;if(!this.selection.groupSelection)if(alignType===Asc.c_oAscObjectsAlignType.Page||alignType===Asc.c_oAscObjectsAlignType.Margin||this.selectedObjects.length<2){var oApi=this.getEditorApi();if(!oApi)return;var oImageProperties=new Asc.asc_CImgProperty;var oPosition;if(alignType===Asc.c_oAscObjectsAlignType.Page)if(type===c_oAscAlignShapeType.ALIGN_LEFT||type===c_oAscAlignShapeType.ALIGN_RIGHT||type===c_oAscAlignShapeType.ALIGN_CENTER){oPosition=new Asc.CImagePositionH; oImageProperties.asc_putPositionH(oPosition);oPosition.put_UseAlign(true);oPosition.put_RelativeFrom(Asc.c_oAscRelativeFromH.Page)}else{oPosition=new Asc.CImagePositionV;oImageProperties.asc_putPositionV(oPosition);oPosition.put_UseAlign(true);oPosition.put_RelativeFrom(Asc.c_oAscRelativeFromV.Page)}else if(type===c_oAscAlignShapeType.ALIGN_LEFT||type===c_oAscAlignShapeType.ALIGN_RIGHT||type===c_oAscAlignShapeType.ALIGN_CENTER){oPosition=new Asc.CImagePositionH;oImageProperties.asc_putPositionH(oPosition); oPosition.put_UseAlign(true);oPosition.put_RelativeFrom(Asc.c_oAscRelativeFromH.Margin)}else{oPosition=new Asc.CImagePositionV;oImageProperties.asc_putPositionV(oPosition);oPosition.put_UseAlign(true);oPosition.put_RelativeFrom(Asc.c_oAscRelativeFromV.Margin)}switch(type){case c_oAscAlignShapeType.ALIGN_LEFT:{oPosition.put_Align(c_oAscAlignH.Left);break}case c_oAscAlignShapeType.ALIGN_RIGHT:{oPosition.put_Align(c_oAscAlignH.Right);break}case c_oAscAlignShapeType.ALIGN_TOP:{oPosition.put_Align(c_oAscAlignV.Top); break}case c_oAscAlignShapeType.ALIGN_BOTTOM:{oPosition.put_Align(c_oAscAlignV.Bottom);break}case c_oAscAlignShapeType.ALIGN_CENTER:{oPosition.put_Align(c_oAscAlignH.Center);break}case c_oAscAlignShapeType.ALIGN_MIDDLE:{oPosition.put_Align(c_oAscAlignV.Center);break}default:break}oApi.ImgApply(oImageProperties)}else{Bounds=AscFormat.getAbsoluteRectBoundsArr(this.selectedObjects);switch(type){case c_oAscAlignShapeType.ALIGN_LEFT:{this.alignLeft(Bounds.minX,Bounds.arrBounds);break}case c_oAscAlignShapeType.ALIGN_RIGHT:{this.alignRight(Bounds.maxX, Bounds.arrBounds);break}case c_oAscAlignShapeType.ALIGN_TOP:{this.alignTop(Bounds.minY,Bounds.arrBounds);break}case c_oAscAlignShapeType.ALIGN_BOTTOM:{this.alignBottom(Bounds.maxY,Bounds.arrBounds);break}case c_oAscAlignShapeType.ALIGN_CENTER:{this.alignCenter((Bounds.maxX+Bounds.minX)/2,Bounds.arrBounds);break}case c_oAscAlignShapeType.ALIGN_MIDDLE:{this.alignMiddle((Bounds.maxY+Bounds.minY)/2,Bounds.arrBounds);break}default:break}}else{var selectedObjects=this.selection.groupSelection.selectedObjects; if(selectedObjects.length<1)return;Bounds=AscFormat.getAbsoluteRectBoundsArr(selectedObjects);if(alignType===Asc.c_oAscObjectsAlignType.Page||alignType===Asc.c_oAscObjectsAlignType.Margin||selectedObjects.length<2){var oFirstDrawing=selectedObjects[0];while(oFirstDrawing.group)oFirstDrawing=oFirstDrawing.group;if(!oFirstDrawing.parent)return;var oParentParagraph=oFirstDrawing.parent.Get_ParentParagraph();var oSectPr=oParentParagraph.Get_SectPr();if(!oSectPr)return;if(alignType===Asc.c_oAscObjectsAlignType.Page)switch(type){case c_oAscAlignShapeType.ALIGN_LEFT:{this.alignLeft(0, Bounds.arrBounds);break}case c_oAscAlignShapeType.ALIGN_RIGHT:{this.alignRight(oSectPr.GetPageWidth(),Bounds.arrBounds);break}case c_oAscAlignShapeType.ALIGN_TOP:{this.alignTop(0,Bounds.arrBounds);break}case c_oAscAlignShapeType.ALIGN_BOTTOM:{this.alignBottom(oSectPr.GetPageHeight(),Bounds.arrBounds);break}case c_oAscAlignShapeType.ALIGN_CENTER:{this.alignCenter(oSectPr.GetPageWidth()/2,Bounds.arrBounds);break}case c_oAscAlignShapeType.ALIGN_MIDDLE:{this.alignMiddle(oSectPr.GetPageHeight()/2,Bounds.arrBounds); break}default:break}else{var oFrame=oSectPr.GetContentFrame(this.selection.groupSelection.parent.PageNum);switch(type){case c_oAscAlignShapeType.ALIGN_LEFT:{this.alignLeft(oFrame.Left,Bounds.arrBounds);break}case c_oAscAlignShapeType.ALIGN_RIGHT:{this.alignRight(oFrame.Right,Bounds.arrBounds);break}case c_oAscAlignShapeType.ALIGN_TOP:{this.alignTop(oFrame.Top,Bounds.arrBounds);break}case c_oAscAlignShapeType.ALIGN_BOTTOM:{this.alignBottom(oFrame.Bottom,Bounds.arrBounds);break}case c_oAscAlignShapeType.ALIGN_CENTER:{this.alignCenter((oFrame.Left+ oFrame.Right)/2,Bounds.arrBounds);break}case c_oAscAlignShapeType.ALIGN_MIDDLE:{this.alignMiddle((oFrame.Top+oFrame.Bottom)/2,Bounds.arrBounds);break}default:break}}}else switch(type){case c_oAscAlignShapeType.ALIGN_LEFT:{this.alignLeft(Bounds.minX,Bounds.arrBounds);break}case c_oAscAlignShapeType.ALIGN_RIGHT:{this.alignRight(Bounds.maxX,Bounds.arrBounds);break}case c_oAscAlignShapeType.ALIGN_TOP:{this.alignTop(Bounds.minY,Bounds.arrBounds);break}case c_oAscAlignShapeType.ALIGN_BOTTOM:{this.alignBottom(Bounds.maxY, Bounds.arrBounds);break}case c_oAscAlignShapeType.ALIGN_CENTER:{this.alignCenter((Bounds.maxX+Bounds.minX)/2,Bounds.arrBounds);break}case c_oAscAlignShapeType.ALIGN_MIDDLE:{this.alignMiddle((Bounds.maxY+Bounds.minY)/2,Bounds.arrBounds);break}default:break}}},alignLeft:function(Pos,arrBounds){var selected_objects=this.selection.groupSelection?this.selection.groupSelection.selectedObjects:this.selectedObjects,i,boundsObject,leftPos;if(selected_objects.length>0){this.checkSelectedObjectsForMove(this.selection.groupSelection? this.selection.groupSelection:null);this.swapTrackObjects();var move_state;if(!this.selection.groupSelection)move_state=new AscFormat.MoveState(this,this.selectedObjects[0],0,0);else move_state=new AscFormat.MoveInGroupState(this,this.selection.groupSelection.selectedObjects[0],this.selection.groupSelection,0,0);for(i=0;i0){this.checkSelectedObjectsForMove(this.selection.groupSelection?this.selection.groupSelection:null);this.swapTrackObjects();var move_state;if(!this.selection.groupSelection)move_state=new AscFormat.MoveState(this,this.selectedObjects[0],0,0);else move_state=new AscFormat.MoveInGroupState(this, this.selection.groupSelection.selectedObjects[0],this.selection.groupSelection,0,0);for(i=0;i0){this.checkSelectedObjectsForMove(this.selection.groupSelection? this.selection.groupSelection:null);this.swapTrackObjects();var move_state;if(!this.selection.groupSelection)move_state=new AscFormat.MoveState(this,this.selectedObjects[0],0,0);else move_state=new AscFormat.MoveInGroupState(this,this.selection.groupSelection.selectedObjects[0],this.selection.groupSelection,0,0);for(i=0;i0){this.checkSelectedObjectsForMove(this.selection.groupSelection?this.selection.groupSelection:null);this.swapTrackObjects();var move_state;if(!this.selection.groupSelection)move_state=new AscFormat.MoveState(this,this.selectedObjects[0],0,0);else move_state=new AscFormat.MoveInGroupState(this, this.selection.groupSelection.selectedObjects[0],this.selection.groupSelection,0,0);for(i=0;i0){this.checkSelectedObjectsForMove(this.selection.groupSelection? this.selection.groupSelection:null);this.swapTrackObjects();var move_state;if(!this.selection.groupSelection)move_state=new AscFormat.MoveState(this,this.selectedObjects[0],0,0);else move_state=new AscFormat.MoveInGroupState(this,this.selection.groupSelection.selectedObjects[0],this.selection.groupSelection,0,0);for(i=0;i0){this.checkSelectedObjectsForMove(this.selection.groupSelection?this.selection.groupSelection:null);this.swapTrackObjects();var move_state;if(!this.selection.groupSelection)move_state=new AscFormat.MoveState(this,this.selectedObjects[0],0,0);else move_state= new AscFormat.MoveInGroupState(this,this.selection.groupSelection.selectedObjects[0],this.selection.groupSelection,0,0);for(i=0;i0){boundsObject=AscFormat.getAbsoluteRectBoundsArr(selected_objects);arrBounds=boundsObject.arrBounds;this.checkSelectedObjectsForMove(this.selection.groupSelection?this.selection.groupSelection:null);this.swapTrackObjects();sortObjects=[];for(i=0;i2){pos1=sortObjects[0].boundsObject.minX;pos2=sortObjects[sortObjects.length-1].boundsObject.maxX}else{var oFirstDrawing=selected_objects[0];while(oFirstDrawing.group)oFirstDrawing=oFirstDrawing.group;if(!oFirstDrawing.parent)return;var oParentParagraph=oFirstDrawing.parent.Get_ParentParagraph();var oSectPr=oParentParagraph.Get_SectPr();if(!oSectPr)return; if(alignType===Asc.c_oAscObjectsAlignType.Page){pos1=0;pos2=oSectPr.GetPageWidth()}else{var oFrame=oSectPr.GetContentFrame(sortObjects[0].trackObject.originalObject.selectStartPage);pos1=oFrame.Left;pos2=oFrame.Right}}var summ_width=boundsObject.summWidth;gap=(pos2-pos1-summ_width)/(sortObjects.length-1);var move_state;if(!this.selection.groupSelection)move_state=new AscFormat.MoveState(this,this.selectedObjects[0],0,0);else move_state=new AscFormat.MoveInGroupState(this,this.selection.groupSelection.selectedObjects[0], this.selection.groupSelection,0,0);lastPos=pos1;for(i=0;i0){boundsObject=AscFormat.getAbsoluteRectBoundsArr(selected_objects);arrBounds=boundsObject.arrBounds;this.checkSelectedObjectsForMove(this.selection.groupSelection?this.selection.groupSelection:null);this.swapTrackObjects();sortObjects=[];for(i=0;i2){pos1=sortObjects[0].boundsObject.minY;pos2=sortObjects[sortObjects.length-1].boundsObject.maxY}else{var oFirstDrawing=selected_objects[0];while(oFirstDrawing.group)oFirstDrawing=oFirstDrawing.group;if(!oFirstDrawing.parent)return;var oParentParagraph=oFirstDrawing.parent.Get_ParentParagraph();var oSectPr=oParentParagraph.Get_SectPr();if(!oSectPr)return; if(alignType===Asc.c_oAscObjectsAlignType.Page){pos1=0;pos2=oSectPr.GetPageHeight()}else{var oFrame=oSectPr.GetContentFrame(sortObjects[0].trackObject.originalObject.selectStartPage);pos1=oFrame.Top;pos2=oFrame.Bottom}}var summ_height=boundsObject.summHeight;gap=(pos2-pos1-summ_height)/(sortObjects.length-1);var move_state;if(!this.selection.groupSelection)move_state=new AscFormat.MoveState(this,this.selectedObjects[0],0,0);else move_state=new AscFormat.MoveInGroupState(this,this.selection.groupSelection.selectedObjects[0], this.selection.groupSelection,0,0);lastPos=pos1;for(i=0;i0){var oRes=this.getLeftTopSelectedObjectByPage(pageIndex);if(oRes.bSelected===true)return oRes;var aSelectedObjectsCopy=[].concat(this.selectedObjects);aSelectedObjectsCopy.sort(function(a,b){return a.selectStartPage- b.selectStartPage});return this.getLeftTopSelectedObjectByPage(aSelectedObjectsCopy[0].selectStartPage)}return{X:0,Y:0,PageIndex:pageIndex}},getLeftTopSelectedObject2:function(){if(this.selectedObjects.length>0){var aSelectedObjectsCopy=[].concat(this.selectedObjects);aSelectedObjectsCopy.sort(function(a,b){return a.selectStartPage-b.selectStartPage});return this.getLeftTopSelectedObjectByPage(aSelectedObjectsCopy[0].selectStartPage)}return{X:0,Y:0,PageIndex:0}},getLeftTopSelectedObjectByPage:function(pageIndex){var oDrawingPage, oRes;if(this.document.GetDocPosType()===docpostype_HdrFtr){if(this.graphicPages[pageIndex])oDrawingPage=this.graphicPages[pageIndex].hdrFtrPage}else if(this.graphicPages[pageIndex])oDrawingPage=this.graphicPages[pageIndex];if(oDrawingPage){oRes=this.getLeftTopSelectedFromArray(oDrawingPage.beforeTextObjects,pageIndex);if(oRes.bSelected)return oRes;oRes=this.getLeftTopSelectedFromArray(oDrawingPage.inlineObjects,pageIndex);if(oRes.bSelected)return oRes;oRes=this.getLeftTopSelectedFromArray(oDrawingPage.behindDocObjects, pageIndex);if(oRes.bSelected)return oRes}return{X:0,Y:0,PageIndex:pageIndex}},CheckRange:function(X0,Y0,X1,Y1,Y0Sp,Y1Sp,LeftField,RightField,PageNum,HdrFtrRanges,docContent,bMathWrap){if(isRealObject(this.graphicPages[PageNum])){var Ranges=this.graphicPages[PageNum].CheckRange(X0,Y0,X1,Y1,Y0Sp,Y1Sp,LeftField,RightField,HdrFtrRanges,docContent,bMathWrap);var ResultRanges=[];var Count=Ranges.length;for(var Index=0;IndexX0&&Range.X0-1;--index)if(this.flowTables[index].IsPointIn(x,y)&&this.flowTables[index].CheckDocumentContent(documentContent))return this.flowTables[index];return null},delObjectById:function(id){var oDrawing=AscCommon.g_oTableId.Get_ById(id);if(oDrawing){var drawing_array;var Type=oDrawing.getDrawingArrayType();if(Type===DRAWING_ARRAY_TYPE_INLINE)drawing_array=this.inlineObjects;else if(Type===DRAWING_ARRAY_TYPE_BEHIND)drawing_array=this.behindDocObjects; else drawing_array=this.beforeTextObjects;for(var index=0;index-1;--i)if(!drawingArray[i].parent||drawingArray[i].parent.DocumentContent===docContent|| b_is_top_doc&&drawingArray[i].parent.DocumentContent.Is_TopDocument(true)===docContent)drawingArray.splice(i,1)}function findTableInArrayAndRemove(drawingArray,docContent,document){if(docContent===document){drawingArray.length=0;return}for(var i=drawingArray.length-1;i>-1;--i)if(drawingArray[i].Table.Parent.GetDocumentContentForRecalcInfo()===docContent)drawingArray.splice(i,1)}function findInArrayAndRemoveFromDrawingPage(drawingPage,docContent,document){if(!drawingPage)return;if(Array.isArray(drawingPage.inlineObjects)){findInArrayAndRemove(drawingPage.inlineObjects, docContent,document);findInArrayAndRemove(drawingPage.behindDocObjects,docContent,document);findInArrayAndRemove(drawingPage.beforeTextObjects,docContent,document);findTableInArrayAndRemove(drawingPage.flowTables,docContent,document)}}if(!AscCommon.isRealObject(docContent))docContent=this.graphicObjects.document;findInArrayAndRemoveFromDrawingPage(this,docContent,editor.WordControl.m_oLogicDocument)},draw:function(graphics){for(var _object_index=0;_object_indexy&&point1.y>y||point0.y max_x)max_x=cur_max_x;if(cur_min_xy&&point1.y>y||point0.y max_x)max_x=cur_max_x;if(cur_min_x0&&RightField-this.right>this.left-LeftField)ret2.push({X0:LeftField,X1:this.right,Y1:this.bottom});else if(this.left-LeftField>0&&this.left-LeftField>RightField-this.right)ret2.push({X0:this.left, X1:RightField,Y1:this.bottom});break}case WRAP_TEXT_SIDE_LEFT:{if(this.left>LeftField)ret2.push({X0:this.left,X1:RightField,Y1:this.bottom});break}case WRAP_TEXT_SIDE_RIGHT:{if(this.rightRightField)return ret;ret2.push({X0:x0,X1:x1,Y1:this.bottom});break}case WRAPPING_TYPE_THROUGH:case WRAPPING_TYPE_TIGHT:{var intersection_top=this.getIntersection(y0); var intersection_bottom=this.getIntersection(y1);var max_x=null;var min_x=null;if(intersection_top.max!==null)max_x=intersection_top.max;if(intersection_top.min!==null)min_x=intersection_top.min;if(intersection_bottom.max!==null)if(max_x===null)max_x=intersection_bottom.max;else if(intersection_bottom.max>max_x)max_x=intersection_bottom.max;if(intersection_bottom.min!==null)if(min_x===null)min_x=intersection_bottom.min;else if(intersection_bottom.miny0&&cur_point.ycur_point.x)min_x=cur_point.x}}if(max_x!==null&&min_x!==null){var oDistance=this.wordGraphicObject.Get_Distance();max_x+=oDistance.R;min_x-=oDistance.L; switch(nWrapSide){case WRAP_TEXT_SIDE_BOTH_SIDES:{ret2.push({X0:min_x,X1:max_x,Y1:y1});break}case WRAP_TEXT_SIDE_LARGEST:{if(RightField-max_x>0&&RightField-max_x>min_x-LeftField)ret2.push({X0:LeftField,X1:max_x,Y1:y1});else if(min_x-LeftField>0&&min_x-LeftField>RightField-max_x)ret2.push({X0:min_x,X1:RightField,Y1:y1});break}case WRAP_TEXT_SIDE_LEFT:{ret2.push({X0:Math.max(min_x,LeftField),X1:RightField,Y1:y1});break}case WRAP_TEXT_SIDE_RIGHT:{ret2.push({X0:LeftField,X1:Math.min(max_x,RightField), Y1:y1});break}}}break}}ret2.sort(function(a,b){return a.X0-b.X0});if(ret2.length>0&&(nWrapType===WRAPPING_TYPE_SQUARE||nWrapType===WRAPPING_TYPE_TIGHT||nWrapType===WRAPPING_TYPE_THROUGH)){var dx=nWrapType===WRAPPING_TYPE_SQUARE?6.35:3.175;if(ret2[0].X0RightField-dx)ret2[ret2.length-1].X1=x1}for(var s=0;s=AscFormat.APPROXIMATE_EPSILON2)break}var left_path_arr=[];var right_path_arr=[];var cur_start_index=0;var cur_x_min,cur_x_max;var cur_y;var x_min=null,x_max=null;var edgesCount= arrEdges.length;for(point_index=0;point_index=cur_y){cur_start_index=edge_index;break}for(edge_index=cur_start_index;edge_indexcur_x_max)cur_x_max=inter[0]}else{if(inter[0]cur_x_max)cur_x_max=inter[1]}}if(cur_x_max<=cur_x_min){var t_min,t_max;t_min=Math.min(cur_x_min,cur_x_max)-2;t_max=Math.max(cur_x_min,cur_x_max)+2;cur_x_max=t_max;cur_x_min=t_min}left_path_arr.push({x:cur_x_min,y:cur_y});right_path_arr.push({x:cur_x_max,y:cur_y});if(x_max===null)x_max=cur_x_max;else if(cur_x_max>x_max)x_max=cur_x_max;if(x_min===null)x_min=cur_x_min;else if(cur_x_min< x_min)x_min=cur_x_min}for(point_index=1;point_index0;--point_index)aPoints.push(left_path_arr[point_index]);return this.calculateAbsToRel(drawing,aPoints)},calculateRelToAbs:function(transform,drawing){var bounds=drawing.bounds,oDistance=drawing.parent.Get_Distance(),oEffectExtent=drawing.parent.EffectExtent;var nWrappingType=drawing.parent.wrappingType; if(this.relativeArrPoints.length===0||!(nWrappingType===WRAPPING_TYPE_THROUGH||nWrappingType===WRAPPING_TYPE_TIGHT)){var W,H;if(AscFormat.isRealNumber(drawing.rot))if(AscFormat.checkNormalRotate(drawing.rot)){W=drawing.extX;H=drawing.extY}else{W=drawing.extY;H=drawing.extX}else{W=drawing.parent.extX;H=drawing.parent.extY}var xc=drawing.localTransform.TransformPointX(drawing.extX/2,drawing.extY/2);var yc=drawing.localTransform.TransformPointY(drawing.extX/2,drawing.extY/2);this.arrPoints.length=0; this.localLeft=-AscFormat.getValOrDefault(oEffectExtent.L,0)+(xc-W/2)-oDistance.L;this.localRight=AscFormat.getValOrDefault(oEffectExtent.R,0)+(xc+W/2)+oDistance.R;this.localTop=-AscFormat.getValOrDefault(oEffectExtent.T,0)+(yc-H/2)-oDistance.T;this.localBottom=AscFormat.getValOrDefault(oEffectExtent.B,0)+(yc+H/2)+oDistance.B;return}var relArr=this.relativeArrPoints;var absArr=this.arrPoints;absArr.length=0;for(var point_index=0;point_indexabsPoint.x)min_x=absPoint.x;if(max_xabsPoint.y)min_y= absPoint.y;if(max_ymax_x)this.localRight=bounds.r+oDistance.R+AscFormat.getValOrDefault(oEffectExtent.R,0);else this.localRight=max_x+oDistance.R+AscFormat.getValOrDefault(oEffectExtent.R,0);if(bounds.tmax_y)this.localBottom=bounds.b+oDistance.B+AscFormat.getValOrDefault(oEffectExtent.B,0);else this.localBottom=max_y+oDistance.B+AscFormat.getValOrDefault(oEffectExtent.B,0)},calculateAbsToRel:function(drawing,aPoints){var relArr=[];if(aPoints.length===0)return relArr;var transform=drawing.localTransform;var invert_transform=AscCommon.global_MatrixTransformer.Invert(transform);for(var point_index=0;point_index< aPoints.length;++point_index){var abs_point=aPoints[point_index];var tr_x=invert_transform.TransformPointX(abs_point.x,abs_point.y)*(21600/drawing.extX)>>0;var tr_y=invert_transform.TransformPointY(abs_point.x,abs_point.y)*(21600/drawing.extY)>>0;relArr[point_index]={x:tr_x,y:tr_y}}var min_x,max_x,min_y,max_y;min_x=aPoints[0].x;max_x=min_x;min_y=aPoints[0].y;max_y=min_y;for(point_index=0;point_indexabsPoint.x)min_x=absPoint.x; if(max_xabsPoint.y)min_y=absPoint.y;if(max_y0&&dcur_interval.X1){cur_interval.X1=cur_interval2.X1;cur_interval.Y1=Math.min(cur_interval.Y1,cur_interval2.Y1)}arr_intervals.splice(interval_index2,1);--interval_index2}else break}}return arr_intervals}};function TrackNewPointWrapPolygon(originalObject,point1){this.originalObject=originalObject;this.point1=point1;this.pageIndex= originalObject.selectStartPage;this.arrPoints=[];for(var i=0;i>0);Writer.WriteLong(this[i].y>>0)}};ArrayWrapPoint.prototype.Read_FromBinary=function(Reader){var nLength=Reader.GetLong();var x,y;for(var i=0;i0){arrPos.splice(0,0,{Class:oParent,Position:this.GetIndex()});arrPos=oParent.GetDocumentPositionFromObject(arrPos)}else{arrPos=oParent.GetDocumentPositionFromObject(arrPos); arrPos.push({Class:oParent,Position:this.GetIndex()})}return arrPos};CDocumentContentElementBase.prototype.Get_Index=function(){return this.GetIndex()};CDocumentContentElementBase.prototype.GetOutlineParagraphs=function(arrOutline,oPr){};CDocumentContentElementBase.prototype.Get_StartPage_Absolute=function(){return this.Get_AbsolutePage(0)};CDocumentContentElementBase.prototype.Get_StartPage_Relative=function(){return this.PageNum};CDocumentContentElementBase.prototype.Get_StartColumn=function(){return this.ColumnNum}; CDocumentContentElementBase.prototype.Get_ColumnsCount=function(){return this.ColumnsCount};CDocumentContentElementBase.prototype.GetStartColumn=function(){return this.ColumnNum};CDocumentContentElementBase.prototype.GetColumnsCount=function(){return this.ColumnsCount};CDocumentContentElementBase.prototype.private_GetRelativePageIndex=function(CurPage){if(!this.ColumnsCount||0===this.ColumnsCount)return this.PageNum+CurPage;return this.PageNum+((this.ColumnNum+CurPage)/this.ColumnsCount|0)};CDocumentContentElementBase.prototype.private_GetAbsolutePageIndex= function(CurPage){return this.Parent.Get_AbsolutePage(this.private_GetRelativePageIndex(CurPage))};CDocumentContentElementBase.prototype.Get_AbsolutePage=function(CurPage){return this.private_GetAbsolutePageIndex(CurPage)};CDocumentContentElementBase.prototype.Get_AbsoluteColumn=function(CurPage){if(this.Parent instanceof CDocument)return this.private_GetColumnIndex(CurPage);return this.Parent.Get_AbsoluteColumn(this.private_GetRelativePageIndex(CurPage))};CDocumentContentElementBase.prototype.private_GetColumnIndex= function(CurPage){return this.ColumnNum+CurPage-((this.ColumnNum+CurPage)/this.ColumnsCount|0)*this.ColumnsCount};CDocumentContentElementBase.prototype.Get_CurrentPage_Absolute=function(){return this.private_GetAbsolutePageIndex(0)};CDocumentContentElementBase.prototype.Get_CurrentPage_Relative=function(){return this.private_GetRelativePageIndex(0)};CDocumentContentElementBase.prototype.GetCurrentPageAbsolute=function(){return this.Get_CurrentPage_Absolute()};CDocumentContentElementBase.prototype.GetAbsolutePage= function(CurPage){return this.private_GetAbsolutePageIndex(CurPage)};CDocumentContentElementBase.prototype.GetAbsoluteColumn=function(CurPage){return this.Get_AbsoluteColumn(CurPage)};CDocumentContentElementBase.prototype.GetStartPageRelative=function(){return this.PageNum};CDocumentContentElementBase.prototype.GetRelativePage=function(nCurPage){return this.private_GetRelativePageIndex(nCurPage)};CDocumentContentElementBase.prototype.GetStartPageAbsolute=function(){return this.private_GetAbsolutePageIndex(0)}; CDocumentContentElementBase.prototype.GetPagesCount=function(){return this.Get_PagesCount()};CDocumentContentElementBase.prototype.GetIndex=function(){if(!this.Parent)return-1;this.Parent.Update_ContentIndexing();if(this!==this.Parent.GetElement(this.Index))this.Index=-1;return this.Index};CDocumentContentElementBase.prototype.GetPageBounds=function(CurPage){return this.Get_PageBounds(CurPage)};CDocumentContentElementBase.prototype.GetNearestPos=function(CurPage,X,Y,bAnchor,Drawing){return this.Get_NearestPos(CurPage, X,Y,bAnchor,Drawing)};CDocumentContentElementBase.prototype.CreateFontMap=function(oFontMap){return this.Document_CreateFontMap(oFontMap)};CDocumentContentElementBase.prototype.CreateFontCharMap=function(oFontCharMap){return this.Document_CreateFontCharMap(oFontCharMap)};CDocumentContentElementBase.prototype.GetAllFontNames=function(FontNames){return this.Document_Get_AllFontNames(FontNames)};CDocumentContentElementBase.prototype.GetSelectionState2=function(){return this.Get_SelectionState2()};CDocumentContentElementBase.prototype.SetSelectionState2= function(State){return this.Set_SelectionState2(State)};CDocumentContentElementBase.prototype.GetReviewInfo=function(){return new CReviewInfo};CDocumentContentElementBase.prototype.SetReviewTypeWithInfo=function(nType,oInfo){};CDocumentContentElementBase.prototype.IsEmpty=function(oProps){return this.Is_Empty(oProps)};CDocumentContentElementBase.prototype.AddToParagraph=function(oItem){return this.Add(oItem)};CDocumentContentElementBase.prototype.GetAllDrawingObjects=function(AllDrawingObjects){}; CDocumentContentElementBase.prototype.GetAllComments=function(AllComments){};CDocumentContentElementBase.prototype.GetAllMaths=function(AllMaths){};CDocumentContentElementBase.prototype.GetAllSeqFieldsByType=function(sType,aFields){};CDocumentContentElementBase.prototype.UpdateBookmarks=function(oManager){};CDocumentContentElementBase.prototype.GetTableOfContents=function(isUnique,isCheckFields){return null};CDocumentContentElementBase.prototype.GetTablesOfFigures=function(arrComplexFields){};CDocumentContentElementBase.prototype.IsSelectedSingleElement= function(){if(this.Parent)return this.Parent.IsSelectedSingleElement();return false};CDocumentContentElementBase.prototype.GetLastParagraph=function(){return null};CDocumentContentElementBase.prototype.GetFirstParagraph=function(){return this.Get_FirstParagraph()};CDocumentContentElementBase.prototype.GetNextParagraph=function(){var oNextElement=this.Get_DocumentNext();if(oNextElement)if(type_Paragraph===oNextElement.GetType())return oNextElement;else return oNextElement.GetFirstParagraph();if(this.Parent&& this.Parent.GetNextParagraph)return this.Parent.GetNextParagraph();return null};CDocumentContentElementBase.prototype.GetPrevParagraph=function(){var oPrevElement=this.Get_DocumentPrev();if(oPrevElement)if(type_Paragraph===oPrevElement.GetType())return oPrevElement;else return oPrevElement.GetLastParagraph();if(this.Parent&&this.Parent.GetPrevParagraph)return this.Parent.GetPrevParagraph();return null};CDocumentContentElementBase.prototype.GetOutlineParagraphs=function(arrOutline,oPr){};CDocumentContentElementBase.prototype.GetSimilarNumbering= function(oContinueEngine){return null};CDocumentContentElementBase.prototype.GotoFootnoteRef=function(isNext,isCurrent,isStepFootnote,isStepEndnote){return false};CDocumentContentElementBase.prototype.SetIsRecalculated=function(isRecalculated){this.Recalculated=isRecalculated};CDocumentContentElementBase.prototype.IsRecalculated=function(){return this.Recalculated};CDocumentContentElementBase.prototype.GetPlaceHolderObject=function(){return null};CDocumentContentElementBase.prototype.GetAllFields= function(isUseSelection,arrFields){return arrFields?arrFields:[]};CDocumentContentElementBase.prototype.GetTopElement=function(){if(!this.Parent)return null;if(this.Parent===this.Parent.Is_TopDocument(true))return this;return this.Parent.GetTopElement()};CDocumentContentElementBase.prototype.GetLock=function(){return this.Lock};CDocumentContentElementBase.prototype.GetHdrFtr=function(){if(this.Parent)return this.Parent.IsHdrFtr(true);return null};CDocumentContentElementBase.prototype.IsUseInDocument= function(sId){return this.Is_UseInDocument(sId)};CDocumentContentElementBase.prototype.Is_UseInDocument=function(sId){return false};CDocumentContentElementBase.prototype.CheckRunContent=function(fCheck){return false};CDocumentContentElementBase.prototype.GetStartPageForRecalculate=function(nPageAbs){return nPageAbs};CDocumentContentElementBase.prototype.GetPresentationField=function(){return null};CDocumentContentElementBase.prototype.GetAllTablesOnPage=function(nPageAbs,arrTables){return arrTables? arrTables:[]};CDocumentContentElementBase.prototype.ProcessComplexFields=function(){};CDocumentContentElementBase.prototype.RecalculateEndInfo=function(){};CDocumentContentElementBase.prototype.GetLogicDocument=function(){return this.LogicDocument};CDocumentContentElementBase.prototype.GetFramePr=function(){return null};CDocumentContentElementBase.prototype.GetMaxTableGridWidth=function(){return{GapLeft:0,GapRight:0,GridWidth:-1}};CDocumentContentElementBase.prototype.UpdateLineNumbersInfo=function(){}; CDocumentContentElementBase.prototype.CalculateTextToTable=function(oEngine){};window["AscCommonWord"]=window["AscCommonWord"]||{};window["AscCommonWord"].CDocumentContentElementBase=CDocumentContentElementBase;window["AscCommonWord"].type_Unknown=type_Unknown;"use strict";var c_oAscRevisionsChangeType=Asc.c_oAscRevisionsChangeType;function CParagraphContentBase(){this.Type=para_Unknown;this.Paragraph=null;this.Parent=null;this.StartLine=-1;this.StartRange=-1;this.Lines=[];this.LinesLength=0}CParagraphContentBase.prototype.GetType= function(){return this.Type};CParagraphContentBase.prototype.Get_Type=function(){return this.Type};CParagraphContentBase.prototype.CanSplit=function(){return false};CParagraphContentBase.prototype.IsParagraphContentElement=function(){return true};CParagraphContentBase.prototype.IsStopCursorOnEntryExit=function(){return false};CParagraphContentBase.prototype.PreDelete=function(){};CParagraphContentBase.prototype.SetParagraph=function(oParagraph){this.Paragraph=oParagraph};CParagraphContentBase.prototype.SetParent= function(oParent){this.Parent=oParent};CParagraphContentBase.prototype.GetParagraph=function(){return this.Paragraph};CParagraphContentBase.prototype.Is_Empty=function(){return true};CParagraphContentBase.prototype.IsEmpty=function(){return this.Is_Empty()};CParagraphContentBase.prototype.Is_CheckingNearestPos=function(){return false};CParagraphContentBase.prototype.Get_CompiledTextPr=function(){return null};CParagraphContentBase.prototype.Clear_TextPr=function(){};CParagraphContentBase.prototype.Remove= function(){return false};CParagraphContentBase.prototype.Get_DrawingObjectRun=function(Id){return null};CParagraphContentBase.prototype.Get_DrawingObjectContentPos=function(Id,ContentPos,Depth){return false};CParagraphContentBase.prototype.GetRunByElement=function(oRunElement){return null};CParagraphContentBase.prototype.Get_Layout=function(DrawingLayout,UseContentPos,ContentPos,Depth){};CParagraphContentBase.prototype.GetNextRunElements=function(oRunElements,isUseContentPos,nDepth){};CParagraphContentBase.prototype.GetPrevRunElements= function(oRunElements,isUseContentPos,nDepth){};CParagraphContentBase.prototype.CollectDocumentStatistics=function(ParaStats){};CParagraphContentBase.prototype.Create_FontMap=function(Map){};CParagraphContentBase.prototype.Get_AllFontNames=function(AllFonts){};CParagraphContentBase.prototype.GetSelectedText=function(bAll,bClearText,oPr){return""};CParagraphContentBase.prototype.GetSelectDirection=function(){return 1};CParagraphContentBase.prototype.Clear_TextFormatting=function(DefHyper){};CParagraphContentBase.prototype.CanAddDropCap= function(){return null};CParagraphContentBase.prototype.CheckSelectionForDropCap=function(isUsePos,oEndPos,nDepth){return true};CParagraphContentBase.prototype.Get_TextForDropCap=function(DropCapText,UseContentPos,ContentPos,Depth){};CParagraphContentBase.prototype.Get_StartTabsCount=function(TabsCounter){return true};CParagraphContentBase.prototype.Remove_StartTabs=function(TabsCounter){return true};CParagraphContentBase.prototype.Copy=function(Selected,oPr,isCopyReviewPr){return new this.constructor}; CParagraphContentBase.prototype.GetSelectedContent=function(oSelectedContent){return this.Copy()};CParagraphContentBase.prototype.CopyContent=function(Selected){return[]};CParagraphContentBase.prototype.Split=function(){return new ParaRun};CParagraphContentBase.prototype.SplitNoDuplicate=function(oContentPos,nDepth,oNewParagraph){};CParagraphContentBase.prototype.Get_Text=function(Text){};CParagraphContentBase.prototype.Apply_TextPr=function(oTextPr,isIncFontSize,isApplyToAll){};CParagraphContentBase.prototype.Get_ParaPosByContentPos= function(ContentPos,Depth){return new CParaPos(this.StartRange,this.StartLine,0,0)};CParagraphContentBase.prototype.UpdateBookmarks=function(oManager){};CParagraphContentBase.prototype.CheckSpelling=function(oSpellCheckerEngine,nDepth){};CParagraphContentBase.prototype.GetParent=function(){if(this.Parent)return this.Parent;if(!this.Paragraph)return null;var oContentPos=this.Paragraph.Get_PosByElement(this);if(!oContentPos||oContentPos.Get_Depth()<0)return null;oContentPos.Decrease_Depth(1);return this.Paragraph.Get_ElementByPos(oContentPos)}; CParagraphContentBase.prototype.GetPosInParent=function(_oParent){var oParent=_oParent?_oParent:this.GetParent();if(!oParent||!oParent.Content)return-1;for(var nPos=0,nCount=oParent.Content.length;nPos=oParent.GetElementsCount()-1){if(this.SetThisElementCurrent)this.SetThisElementCurrent();this.MoveCursorToEndPos()}else{var oElement=oParent.GetElement(nPosInParent+1);if(oElement.IsCursorPlaceable()){if(oElement.SetThisElementCurrent)oElement.SetThisElementCurrent();oElement.MoveCursorToStartPos()}else{if(this.SetThisElementCurrent)this.SetThisElementCurrent(); this.MoveCursorToEndPos()}}};CParagraphContentBase.prototype.Set_SelectionContentPos=function(StartContentPos,EndContentPos,Depth,StartFlag,EndFlag){};CParagraphContentBase.prototype.RemoveSelection=function(){};CParagraphContentBase.prototype.SelectAll=function(Direction){};CParagraphContentBase.prototype.Selection_DrawRange=function(_CurLine,_CurRange,SelectionDraw){};CParagraphContentBase.prototype.IsSelectionEmpty=function(CheckEnd){return true};CParagraphContentBase.prototype.Selection_CheckParaEnd= function(){return false};CParagraphContentBase.prototype.IsSelectedAll=function(Props){return true};CParagraphContentBase.prototype.IsSelectedFromStart=function(){return true};CParagraphContentBase.prototype.IsSelectedToEnd=function(){return true};CParagraphContentBase.prototype.SkipAnchorsAtSelectionStart=function(nDirection){return true};CParagraphContentBase.prototype.Selection_CheckParaContentPos=function(ContentPos){return true};CParagraphContentBase.prototype.GetCurrentParaPos=function(){return new CParaPos(this.StartRange, this.StartLine,0,0)};CParagraphContentBase.prototype.Get_TextPr=function(ContentPos,Depth){return new CTextPr};CParagraphContentBase.prototype.Get_FirstTextPr=function(bByPos){return new CTextPr};CParagraphContentBase.prototype.SetReviewType=function(ReviewType,RemovePrChange){};CParagraphContentBase.prototype.SetReviewTypeWithInfo=function(ReviewType,ReviewInfo){};CParagraphContentBase.prototype.CheckRevisionsChanges=function(Checker,ContentPos,Depth){};CParagraphContentBase.prototype.AcceptRevisionChanges= function(Type,bAll){};CParagraphContentBase.prototype.RejectRevisionChanges=function(Type,bAll){};CParagraphContentBase.prototype.GetTextPr=function(ContentPos,Depth){return this.Get_TextPr(ContentPos,Depth)};CParagraphContentBase.prototype.ApplyTextPr=function(oTextPr,isIncFontSize,isApplyToAll){return this.Apply_TextPr(oTextPr,isIncFontSize,isApplyToAll)};CParagraphContentBase.prototype.Search=function(oParaSearch){};CParagraphContentBase.prototype.AddSearchResult=function(oSearchResult,isStart, oContentPos,nDepth){};CParagraphContentBase.prototype.ClearSearchResults=function(){};CParagraphContentBase.prototype.RemoveSearchResult=function(oSearchResult){};CParagraphContentBase.prototype.GetSearchElementId=function(bNext,bUseContentPos,ContentPos,Depth){return null};CParagraphContentBase.prototype.Check_NearestPos=function(ParaNearPos,Depth){};CParagraphContentBase.prototype.Restart_CheckSpelling=function(){};CParagraphContentBase.prototype.GetDirectTextPr=function(){return null};CParagraphContentBase.prototype.GetAllFields= function(isUseSelection,arrFields){return arrFields?arrFields:[]};CParagraphContentBase.prototype.GetAllSeqFieldsByType=function(sType,aFields){};CParagraphContentBase.prototype.CanAddComment=function(){return true};CParagraphContentBase.prototype.GetDocumentPositionFromObject=function(arrPos){if(!arrPos)arrPos=[];var oParagraph=this.GetParagraph();if(oParagraph)if(arrPos.length>0){var oParaContentPos=oParagraph.Get_PosByElement(this);if(oParaContentPos){var nDepth=oParaContentPos.GetDepth();while(nDepth> 0){var Pos=oParaContentPos.Get(nDepth);oParaContentPos.SetDepth(nDepth-1);var Class=oParagraph.Get_ElementByPos(oParaContentPos);nDepth--;arrPos.splice(0,0,{Class:Class,Position:Pos})}arrPos.splice(0,0,{Class:this.Paragraph,Position:oParaContentPos.Get(0)})}this.Paragraph.GetDocumentPositionFromObject(arrPos)}else{this.Paragraph.GetDocumentPositionFromObject(arrPos);var oParaContentPos=this.Paragraph.Get_PosByElement(this);if(oParaContentPos){arrPos.push({Class:this.Paragraph,Position:oParaContentPos.Get(0)}); var nDepth=oParaContentPos.GetDepth();var nCurDepth=1;while(nCurDepth<=nDepth){var Pos=oParaContentPos.Get(nCurDepth);oParaContentPos.SetDepth(nCurDepth-1);var Class=this.Paragraph.Get_ElementByPos(oParaContentPos);++nCurDepth;arrPos.push({Class:Class,Position:Pos})}}}return arrPos};CParagraphContentBase.prototype.GetParentContentControls=function(){var oDocPos=this.GetDocumentPositionFromObject();oDocPos.push({Class:this,Pos:0});var arrContentControls=[];for(var nIndex=0,nCount=oDocPos.length;nIndex< nCount;++nIndex)if(oDocPos[nIndex].Class instanceof CInlineLevelSdt)arrContentControls.push(oDocPos[nIndex].Class);else if(oDocPos[nIndex].Class instanceof CDocumentContent&&oDocPos[nIndex].Class.Parent instanceof CBlockLevelSdt)arrContentControls.push(oDocPos[nIndex].Class.Parent);return arrContentControls};CParagraphContentBase.prototype.IsSelectionUse=function(){return false};CParagraphContentBase.prototype.IsStartFromNewLine=function(){return false};CParagraphContentBase.prototype.CheckRunContent= function(fCheck){return false};CParagraphContentBase.prototype.ProcessComplexFields=function(oComplexFields){};CParagraphContentBase.prototype.GetSelectedElementsInfo=function(oInfo,oContentPos,nDepth){};CParagraphContentBase.prototype.IsSolid=function(){return true};CParagraphContentBase.prototype.CorrectContentPos=function(){};CParagraphContentBase.prototype.GetFirstRun=function(){return null};CParagraphContentBase.prototype.MakeSingleRunElement=function(){return null};CParagraphContentBase.prototype.ClearContent= function(){};CParagraphContentBase.prototype.GetFirstRunElementPos=function(nType,oStartPos,oEndPos,nDepth){return false};CParagraphContentBase.prototype.SetIsRecalculated=function(isRecalculated){};CParagraphContentBase.prototype.SetThisElementCurrentInParagraph=function(){var oParagraph=this.GetParagraph();if(!this.IsCursorPlaceable()||!oParagraph)return;var oContentPos=this.Paragraph.Get_PosByElement(this);if(!oContentPos)return;this.Paragraph.Set_ParaContentPos(oContentPos,true,-1,-1,false)}; CParagraphContentBase.prototype.CalculateTextToTable=function(oEngine){};function CParagraphContentWithContentBase(){CParagraphContentBase.call(this);this.Lines=[0];this.StartLine=-1;this.StartRange=-1}CParagraphContentWithContentBase.prototype=Object.create(CParagraphContentBase.prototype);CParagraphContentWithContentBase.prototype.constructor=CParagraphContentWithContentBase;CParagraphContentWithContentBase.prototype.Recalculate_Reset=function(StartRange,StartLine){this.StartLine=StartLine;this.StartRange= StartRange;this.protected_ClearLines()};CParagraphContentWithContentBase.prototype.protected_ClearLines=function(){this.Lines=[0]};CParagraphContentWithContentBase.prototype.protected_GetRangeOffset=function(LineIndex,RangeIndex){return 1+this.Lines[0]+this.Lines[1+LineIndex]+RangeIndex*2};CParagraphContentWithContentBase.prototype.protected_GetRangeStartPos=function(LineIndex,RangeIndex){return this.Lines[this.protected_GetRangeOffset(LineIndex,RangeIndex)]};CParagraphContentWithContentBase.prototype.protected_GetRangeEndPos= function(LineIndex,RangeIndex){return this.Lines[this.protected_GetRangeOffset(LineIndex,RangeIndex)+1]};CParagraphContentWithContentBase.prototype.protected_GetLinesCount=function(){return this.Lines[0]};CParagraphContentWithContentBase.prototype.protected_GetRangesCount=function(LineIndex){if(LineIndex===this.Lines[0]-1)return(this.Lines.length-this.Lines[1+LineIndex]-(this.Lines[0]+1))/2;else return(this.Lines[1+LineIndex+1]-this.Lines[1+LineIndex])/2};CParagraphContentWithContentBase.prototype.protected_AddRange= function(LineIndex,RangeIndex){if(this.Lines[0]>=LineIndex+1){var RangeOffset=this.protected_GetRangeOffset(LineIndex,0)+RangeIndex*2;this.Lines.splice(RangeOffset,this.Lines.length-RangeOffset);if(this.Lines[0]!==LineIndex+1&&0===RangeIndex)this.Lines.splice(LineIndex+1,this.Lines[0]-LineIndex);else if(this.Lines[0]!==LineIndex+1&&0!==RangeIndex){this.Lines.splice(LineIndex+2,this.Lines[0]-LineIndex-1);this.Lines[0]=LineIndex+1}}if(0===RangeIndex)if(this.Lines[0]!==LineIndex+1){var OffsetValue=this.Lines.length- LineIndex-1;this.Lines.splice(LineIndex+1,0,OffsetValue);this.Lines[0]=LineIndex+1}var RangeOffset=1+this.Lines[0]+this.Lines[LineIndex+1]+RangeIndex*2;this.Lines[RangeOffset+0]=0;this.Lines[RangeOffset+1]=0;if(0!==LineIndex||0!==RangeIndex)return this.Lines[RangeOffset-1];else return 0};CParagraphContentWithContentBase.prototype.protected_FillRange=function(LineIndex,RangeIndex,StartPos,EndPos){var RangeOffset=this.protected_GetRangeOffset(LineIndex,RangeIndex);this.Lines[RangeOffset+0]=StartPos; this.Lines[RangeOffset+1]=EndPos};CParagraphContentWithContentBase.prototype.protected_FillRangeEndPos=function(LineIndex,RangeIndex,EndPos){var RangeOffset=this.protected_GetRangeOffset(LineIndex,RangeIndex);this.Lines[RangeOffset+1]=EndPos};CParagraphContentWithContentBase.prototype.private_UpdateSpellChecking=function(){if(this.Paragraph&&this.Paragraph.SpellChecker){this.Paragraph.SpellChecker.ClearPausedEngine();this.Paragraph.RecalcInfo.Set_Type_0_Spell(pararecalc_0_Spell_All)}};CParagraphContentWithContentBase.prototype.Is_UseInDocument= function(Id){if(this.Paragraph){for(var i=0;iEndPos){StartPos=this.State.Selection.EndPos;EndPos=this.State.Selection.StartPos}}for(var CurPos= StartPos;CurPos<=EndPos;CurPos++){var Item=this.Content[CurPos];if(StartPos===CurPos||EndPos===CurPos)NewElement.Add_ToContent(CurPos-StartPos,Item.Copy(Selected,oPr));else NewElement.Add_ToContent(CurPos-StartPos,Item.Copy(false,oPr))}return NewElement};CParagraphContentWithParagraphLikeContent.prototype.GetSelectedContent=function(oSelectedContent){var oNewElement=new this.constructor;var nStartPos=this.State.Selection.StartPos;var nEndPos=this.State.Selection.EndPos;if(nStartPos>nEndPos){nStartPos= this.State.Selection.EndPos;nEndPos=this.State.Selection.StartPos}var nItemPos=0;for(var nPos=nStartPos,nItemPos=0;nPos<=nEndPos;++nPos){var oNewItem=this.Content[nPos].GetSelectedContent(oSelectedContent);if(oNewItem){oNewElement.AddToContent(nItemPos,oNewItem);nItemPos++}}if(0===nItemPos)return null;return oNewElement};CParagraphContentWithParagraphLikeContent.prototype.CopyContent=function(Selected){var CopyContent=[];var StartPos=0;var EndPos=this.Content.length-1;if(true===Selected&&true===this.State.Selection.Use){StartPos= this.State.Selection.StartPos;EndPos=this.State.Selection.EndPos;if(StartPos>EndPos){StartPos=this.State.Selection.EndPos;EndPos=this.State.Selection.StartPos}}for(var CurPos=StartPos;CurPos<=EndPos;CurPos++){var Item=this.Content[CurPos];if((StartPos===CurPos||EndPos===CurPos)&&true!==Item.IsSelectedAll()){var Content=Item.CopyContent(Selected);for(var ContentPos=0,ContentLen=Content.length;ContentPos0};CParagraphContentWithParagraphLikeContent.prototype.IsStartFromNewLine=function(){if(this.Content.length<0)return false;return this.Content[0].IsStartFromNewLine()};CParagraphContentWithParagraphLikeContent.prototype.GetSelectedElementsInfo=function(oInfo,oContentPos, nDepth){if(oContentPos){var nPos=oContentPos.Get(nDepth);if(this.Content[nPos].GetSelectedElementsInfo)this.Content[nPos].GetSelectedElementsInfo(oInfo,oContentPos,nDepth+1)}else if(true===this.Selection.Use&&(oInfo.IsCheckAllSelection()||this.Selection.StartPos===this.Selection.EndPos)){var nStartPos=this.Selection.StartPosthis.Selection.EndPos)return-1;return this.Content[this.Selection.StartPos].GetSelectDirection()};CParagraphContentWithParagraphLikeContent.prototype.Get_TextPr=function(_ContentPos,Depth){if(undefined===_ContentPos)return this.Content[0].Get_TextPr();else return this.Content[_ContentPos.Get(Depth)].Get_TextPr(_ContentPos,Depth+1)};CParagraphContentWithParagraphLikeContent.prototype.Get_FirstTextPr= function(bByPos){var oElement=null;if(this.Content.length>0)if(true===bByPos)if(true===this.Selection.Use)if(this.Selection.StartPos>this.Selection.EndPos)oElement=this.Content[this.Selection.EndPos];else oElement=this.Content[this.Selection.StartPos];else oElement=this.Content[this.State.ContentPos];else for(var nPos=0,nCount=this.Content.length;nPosEndPos){StartPos=this.State.Selection.EndPos;EndPos=this.State.Selection.StartPos}TextPr=this.Content[StartPos].Get_CompiledTextPr(Copy);while(null===TextPr&&StartPos=0&&CurPos=Pos)this.State.ContentPos++;if(this.State.Selection.StartPos>=Pos)this.State.Selection.StartPos++;if(this.State.Selection.EndPos>=Pos)this.State.Selection.EndPos++;this.State.Selection.StartPos=Math.max(0,Math.min(this.Content.length-1,this.State.Selection.StartPos)); this.State.Selection.EndPos=Math.max(0,Math.min(this.Content.length-1,this.State.Selection.EndPos));this.State.ContentPos=Math.max(0,Math.min(this.Content.length-1,this.State.ContentPos));var LinesCount=this.protected_GetLinesCount();for(var CurLine=0;CurLinePos)StartPos++;if(EndPos>Pos)EndPos++;this.protected_FillRange(CurLine,CurRange,StartPos,EndPos)}if(Pos===this.Content.length-1&&LinesCount-1===CurLine)this.protected_FillRangeEndPos(CurLine,RangesCount-1,this.protected_GetRangeEndPos(CurLine,RangesCount-1)+1)}}var NearPosLen=this.NearPosArray.length;for(var Index=0;Index= Pos)ContentPos.Data[Depth]++}var SearchMarksCount=this.SearchMarks.length;for(var Index=0;Index=Pos)ContentPos.Data[Depth]++}if(Item.SetParent)Item.SetParent(this);if(Item.SetParagraph)Item.SetParagraph(this.GetParagraph())};CParagraphContentWithParagraphLikeContent.prototype.Remove_FromContent=function(Pos, Count,UpdatePosition){for(var nIndex=Pos;nIndexPos+Count)this.State.ContentPos-=Count;else if(this.State.ContentPos>Pos)this.State.ContentPos=Pos;if(this.State.Selection.StartPos<=this.State.Selection.EndPos){if(this.State.Selection.StartPos> Pos+Count)this.State.Selection.StartPos-=Count;else if(this.State.Selection.StartPos>Pos)this.State.Selection.StartPos=Pos;if(this.State.Selection.EndPos>=Pos+Count)this.State.Selection.EndPos-=Count;else if(this.State.Selection.EndPos>=Pos)this.State.Selection.EndPos=Math.max(0,Pos-1)}else{if(this.State.Selection.StartPos>=Pos+Count)this.State.Selection.StartPos-=Count;else if(this.State.Selection.StartPos>=Pos)this.State.Selection.StartPos=Math.max(0,Pos-1);if(this.State.Selection.EndPos>Pos+Count)this.State.Selection.EndPos-= Count;else if(this.State.Selection.EndPos>Pos)this.State.Selection.EndPos=Pos}this.Selection.StartPos=Math.max(0,Math.min(this.Content.length-1,this.Selection.StartPos));this.Selection.EndPos=Math.max(0,Math.min(this.Content.length-1,this.Selection.EndPos));this.State.ContentPos=Math.max(0,Math.min(this.Content.length-1,this.State.ContentPos));var LinesCount=this.protected_GetLinesCount();for(var CurLine=0;CurLinePos+Count)StartPos-=Count;else if(StartPos>Pos)StartPos=Math.max(0,Pos);if(EndPos>=Pos+Count)EndPos-=Count;else if(EndPos>=Pos)EndPos=Math.max(0,Pos);this.protected_FillRange(CurLine,CurRange,StartPos,EndPos)}}}var NearPosLen=this.NearPosArray.length;for(var Index=0;IndexPos+Count)ContentPos.Data[Depth]-=Count;else if(ContentPos.Data[Depth]>Pos)ContentPos.Data[Depth]=Math.max(0,Pos)}var SearchMarksCount=this.SearchMarks.length;for(var Index=0;IndexPos+Count)ContentPos.Data[Depth]-= Count;else if(ContentPos.Data[Depth]>Pos)ContentPos.Data[Depth]=Math.max(0,Pos)}};CParagraphContentWithParagraphLikeContent.prototype.Remove=function(Direction,bOnAddText){var Selection=this.State.Selection;if(true===Selection.Use){var StartPos=Selection.StartPos;var EndPos=Selection.EndPos;if(StartPos>EndPos){StartPos=Selection.EndPos;EndPos=Selection.StartPos}var oTextPr=this.IsSelectedAll()?this.GetDirectTextPr():null;if(StartPos===EndPos)if(this.Content[StartPos].IsSolid())this.RemoveFromContent(StartPos, 1,true);else{this.Content[StartPos].Remove(Direction,bOnAddText);if(StartPos!==this.Content.length-1&&true===this.Content[StartPos].Is_Empty()&&true!==bOnAddText)this.Remove_FromContent(StartPos,1,true)}else{if(this.Content[EndPos].IsSolid())this.RemoveFromContent(EndPos,1,true);else{this.Content[EndPos].Remove(Direction,bOnAddText);if(EndPos!==this.Content.length-1&&true===this.Content[EndPos].Is_Empty()&&true!==bOnAddText)this.Remove_FromContent(EndPos,1,true)}if(this.Paragraph&&this.Paragraph.LogicDocument&& true===this.Paragraph.LogicDocument.IsTrackRevisions())for(var nCurPos=EndPos-1;nCurPos>StartPos;--nCurPos)if(para_Run===this.Content[nCurPos].Type)if(para_Run==this.Content[nCurPos].Type&&this.Content[nCurPos].CanDeleteInReviewMode())this.RemoveFromContent(nCurPos,1);else this.Content[nCurPos].SetReviewType(reviewtype_Remove,true);else{this.Content[nCurPos].Remove(Direction,bOnAddText);if(this.Content[nCurPos].IsEmpty())this.RemoveFromContent(nCurPos,1)}else for(var CurPos=EndPos-1;CurPos>StartPos;CurPos--)this.Remove_FromContent(CurPos, 1,true);if(this.Content[StartPos].IsSolid())this.RemoveFromContent(StartPos,1,true);else{this.Content[StartPos].Remove(Direction,bOnAddText);if(true===this.Content[StartPos].Is_Empty())this.Remove_FromContent(StartPos,1,true)}}this.RemoveSelection();if(this.Content.length<=0){this.AddToContent(0,new ParaRun(this.GetParagraph(),false));this.State.ContentPos=0;if(oTextPr)this.Content[0].SetPr(oTextPr)}else this.State.ContentPos=StartPos}else{var ContentPos=this.State.ContentPos;if((true===this.Cursor_Is_Start()|| true===this.Cursor_Is_End())&&(!(this instanceof CInlineLevelSdt)||!(this.IsTextForm()||this.IsComboBox()))){this.SelectAll();this.SelectThisElement(1)}else{while(false===this.Content[ContentPos].Remove(Direction,bOnAddText)){if(Direction<0)ContentPos--;else ContentPos++;if(ContentPos<0||ContentPos>=this.Content.length)break;if(Direction<0)this.Content[ContentPos].MoveCursorToEndPos(false);else this.Content[ContentPos].MoveCursorToStartPos()}if(ContentPos<0||ContentPos>=this.Content.length)return false; else{if(ContentPos!==this.Content.length-1&&true===this.Content[ContentPos].Is_Empty()&&true!==bOnAddText)this.Remove_FromContent(ContentPos,1,true);this.State.ContentPos=ContentPos}}}return true};CParagraphContentWithParagraphLikeContent.prototype.GetCurrentParaPos=function(){var CurPos=this.State.ContentPos;if(CurPos>=0&&CurPosEndPos){var Temp=StartPos;StartPos=EndPos;EndPos=Temp;Direction=-1}for(var CurPos=StartPos+1;CurPos=0){if(oRunElements.IsEnoughElements())return;oRunElements.UpdatePos(nCurPos,nDepth);this.Content[nCurPos].GetPrevRunElements(oRunElements,false,nDepth+1);nCurPos--}};CParagraphContentWithParagraphLikeContent.prototype.CollectDocumentStatistics=function(ParaStats){var Count=this.Content.length;for(var Index=0;Index0))return}}; CParagraphContentWithParagraphLikeContent.prototype.Get_StartTabsCount=function(TabsCounter){var ContentLen=this.Content.length;for(var Pos=0;PosEndPos){StartPos=this.Selection.EndPos;EndPos=this.Selection.StartPos}for(var CurPos=StartPos;CurPos<=EndPos;CurPos++){var Element=this.Content[CurPos];if(true!==Element.IsSelectionEmpty()&&Element.Document_UpdateInterfaceState)Element.Document_UpdateInterfaceState()}}else{var Element=this.Content[this.State.ContentPos]; if(Element.Document_UpdateInterfaceState)Element.Document_UpdateInterfaceState()}};CParagraphContentWithParagraphLikeContent.prototype.Split=function(ContentPos,Depth){var Element=new this.constructor;var CurPos=ContentPos.Get(Depth);var TextPr=this.Get_TextPr(ContentPos,Depth);var NewElement=this.Content[CurPos].Split(ContentPos,Depth+1);if(null===NewElement){NewElement=new ParaRun;NewElement.Set_Pr(TextPr.Copy())}var NewContent=this.Content.slice(CurPos+1);this.Remove_FromContent(CurPos+1,this.Content.length- CurPos-1,false);var Count=NewContent.length;for(var Pos=0;Pos=ContentLen)RangeEndPos=Pos-1;this.protected_FillRange(CurLine,CurRange,RangeStartPos,RangeEndPos)};CParagraphContentWithParagraphLikeContent.prototype.Recalculate_Set_RangeEndPos=function(PRS,PRP,Depth){var CurLine=PRS.Line-this.StartLine;var CurRange=0===CurLine?PRS.Range-this.StartRange:PRS.Range;var CurPos= PRP.Get(Depth);this.protected_FillRangeEndPos(CurLine,CurRange,CurPos);this.Content[CurPos].Recalculate_Set_RangeEndPos(PRS,PRP,Depth+1)};CParagraphContentWithParagraphLikeContent.prototype.Recalculate_LineMetrics=function(PRS,ParaPr,_CurLine,_CurRange){var CurLine=_CurLine-this.StartLine;var CurRange=0===CurLine?_CurRange-this.StartRange:_CurRange;var StartPos=this.protected_GetRangeStartPos(CurLine,CurRange);var EndPos=this.protected_GetRangeEndPos(CurLine,CurRange);for(var CurPos=StartPos;CurPos<= EndPos;CurPos++)this.Content[CurPos].Recalculate_LineMetrics(PRS,ParaPr,_CurLine,_CurRange)};CParagraphContentWithParagraphLikeContent.prototype.Recalculate_Range_Width=function(PRSC,_CurLine,_CurRange){var CurLine=_CurLine-this.StartLine;var CurRange=0===CurLine?_CurRange-this.StartRange:_CurRange;var StartPos=this.protected_GetRangeStartPos(CurLine,CurRange);var EndPos=this.protected_GetRangeEndPos(CurLine,CurRange);for(var CurPos=StartPos;CurPos<=EndPos;CurPos++)this.Content[CurPos].Recalculate_Range_Width(PRSC, _CurLine,_CurRange)};CParagraphContentWithParagraphLikeContent.prototype.Recalculate_Range_Spaces=function(PRSA,_CurLine,_CurRange,_CurPage){var CurLine=_CurLine-this.StartLine;var CurRange=0===CurLine?_CurRange-this.StartRange:_CurRange;var StartPos=this.protected_GetRangeStartPos(CurLine,CurRange);var EndPos=this.protected_GetRangeEndPos(CurLine,CurRange);for(var CurPos=StartPos;CurPos<=EndPos;CurPos++)this.Content[CurPos].Recalculate_Range_Spaces(PRSA,_CurLine,_CurRange,_CurPage)};CParagraphContentWithParagraphLikeContent.prototype.Recalculate_PageEndInfo= function(PRSI,_CurLine,_CurRange){var CurLine=_CurLine-this.StartLine;var CurRange=0===CurLine?_CurRange-this.StartRange:_CurRange;var StartPos=this.protected_GetRangeStartPos(CurLine,CurRange);var EndPos=this.protected_GetRangeEndPos(CurLine,CurRange);for(var CurPos=StartPos;CurPos<=EndPos;CurPos++)this.Content[CurPos].Recalculate_PageEndInfo(PRSI,_CurLine,_CurRange)};CParagraphContentWithParagraphLikeContent.prototype.RecalculateEndInfo=function(oPRSI){for(var nCurPos=0,nCount=this.Content.length;nCurPos< nCount;++nCurPos)this.Content[nCurPos].RecalculateEndInfo(oPRSI)};CParagraphContentWithParagraphLikeContent.prototype.SaveRecalculateObject=function(Copy){var RecalcObj=new CRunRecalculateObject(this.StartLine,this.StartRange);RecalcObj.Save_Lines(this,Copy);RecalcObj.Save_Content(this,Copy);return RecalcObj};CParagraphContentWithParagraphLikeContent.prototype.LoadRecalculateObject=function(RecalcObj){RecalcObj.Load_Lines(this);RecalcObj.Load_Content(this)};CParagraphContentWithParagraphLikeContent.prototype.PrepareRecalculateObject= function(){this.protected_ClearLines();var Count=this.Content.length;for(var Index=0;Index=0;--nCurPos){this.Content[nCurPos].ProcessNotInlineObjectCheck(oChecker);if(oChecker.IsStop())break}if(!oChecker.GetResult())return false;if(!oChecker.IsStop()&&oParent&&!oParent.CheckNotInlineObject(this.GetPosInParent(oParent),-1))return false}if(undefined===nDirection||1===nDirection){oChecker.SetDirection(1);for(var nCurPos=nMathPos+1,nCount=this.Content.length;nCurPosthis.State.ContentPos&&CurPos>0)if(true===this.Content[CurPos].Is_Empty())CurPos--;else return false;return this.Content[CurPos].Cursor_Is_End()};CParagraphContentWithParagraphLikeContent.prototype.MoveCursorToStartPos=function(){this.State.ContentPos=0;if(this.Content.length>0)this.Content[0].MoveCursorToStartPos()};CParagraphContentWithParagraphLikeContent.prototype.MoveCursorToEndPos= function(SelectFromEnd){var ContentLen=this.Content.length;if(ContentLen>0){this.State.ContentPos=ContentLen-1;this.Content[ContentLen-1].MoveCursorToEndPos(SelectFromEnd)}};CParagraphContentWithParagraphLikeContent.prototype.Get_ParaContentPosByXY=function(SearchPos,Depth,_CurLine,_CurRange,StepEnd){var Result=false;var CurLine=_CurLine-this.StartLine;var CurRange=0===CurLine?_CurRange-this.StartRange:_CurRange;var StartPos=this.protected_GetRangeStartPos(CurLine,CurRange);var EndPos=this.protected_GetRangeEndPos(CurLine, CurRange);for(var CurPos=StartPos;CurPos<=EndPos;CurPos++){var Item=this.Content[CurPos];if(false===SearchPos.InText)SearchPos.InTextPos.Update2(CurPos,Depth);if(true===Item.Get_ParaContentPosByXY(SearchPos,Depth+1,_CurLine,_CurRange,StepEnd)){SearchPos.Pos.Update2(CurPos,Depth);Result=true}}return Result};CParagraphContentWithParagraphLikeContent.prototype.Get_ParaContentPos=function(bSelection,bStart,ContentPos,bUseCorrection){var Pos=true===bSelection?true===bStart?this.State.Selection.StartPos: this.State.Selection.EndPos:this.State.ContentPos;ContentPos.Add(Pos);if(Pos<0||Pos>=this.Content.length)return;this.Content[Pos].Get_ParaContentPos(bSelection,bStart,ContentPos,bUseCorrection)};CParagraphContentWithParagraphLikeContent.prototype.Set_ParaContentPos=function(ContentPos,Depth){var Pos=ContentPos.Get(Depth);if(Pos>=this.Content.length)Pos=this.Content.length-1;if(Pos<0)Pos=0;this.State.ContentPos=Pos;this.Content[Pos].Set_ParaContentPos(ContentPos,Depth+1)};CParagraphContentWithParagraphLikeContent.prototype.Get_PosByElement= function(Class,ContentPos,Depth,UseRange,Range,Line){if(this===Class)return true;if(this.Content.length<=0)return false;var StartPos=0;var EndPos=this.Content.length-1;if(true===UseRange){var CurLine=Line-this.StartLine;var CurRange=0===CurLine?Range-this.StartRange:Range;if(CurLine>=0&&CurLine=0&&CurRange=ContentPos.Depth)return this;var CurPos=ContentPos.Get(Depth);if(!this.Content[CurPos])return null;return this.Content[CurPos].Get_ElementByPos(ContentPos, Depth+1)};CParagraphContentWithParagraphLikeContent.prototype.ConvertParaContentPosToRangePos=function(oContentPos,nDepth){var nRangePos=0;var nCurPos=oContentPos?Math.max(0,Math.min(this.Content.length-1,oContentPos.Get(nDepth))):this.Content.length-1;for(var nPos=0;nPos=0&&this.Content[CurPos+ 1].IsStopCursorOnEntryExit()){this.Content[CurPos].Get_EndPos(false,SearchPos.Pos,Depth+1);SearchPos.Pos.Update(CurPos,Depth);SearchPos.Found=true;return true}while(CurPos>=0){this.Content[CurPos].Get_LeftPos(SearchPos,ContentPos,Depth+1,false);SearchPos.Pos.Update(CurPos,Depth);if(true===SearchPos.Found)return true;CurPos--}return false};CParagraphContentWithParagraphLikeContent.prototype.Get_RightPos=function(SearchPos,ContentPos,Depth,UseContentPos,StepEnd){if(this.Content.length<=0)return false; var CurPos=true===UseContentPos?ContentPos.Get(Depth):0;this.Content[CurPos].Get_RightPos(SearchPos,ContentPos,Depth+1,UseContentPos,StepEnd);SearchPos.Pos.Update(CurPos,Depth);if(true===SearchPos.Found)return true;CurPos++;var Count=this.Content.length;if(CurPos=0&&this.Content[CurPos].IsStopCursorOnEntryExit()){SearchPos.Found=true;return}if(CurPos>=0&&this.Content[CurPos+1].IsStopCursorOnEntryExit()){this.Content[CurPos].Get_EndPos(false,SearchPos.Pos,Depth+1);SearchPos.Pos.Update(CurPos,Depth);SearchPos.Found=true;return}while(CurPos>=0){var OldUpdatePos=SearchPos.UpdatePos;this.Content[CurPos].Get_WordStartPos(SearchPos,ContentPos,Depth+1,false);if(true===SearchPos.UpdatePos)SearchPos.Pos.Update(CurPos,Depth);else SearchPos.UpdatePos= OldUpdatePos;if(true===SearchPos.Found)return;CurPos--;if(SearchPos.Shift&&CurPos>=0&&this.Content[CurPos].IsStopCursorOnEntryExit()){SearchPos.Found=true;return}if(CurPos>=0&&this.Content[CurPos+1].IsStopCursorOnEntryExit()){this.Content[CurPos].Get_EndPos(false,SearchPos.Pos,Depth+1);SearchPos.Pos.Update(CurPos,Depth);SearchPos.Found=true;return}}};CParagraphContentWithParagraphLikeContent.prototype.Get_WordEndPos=function(SearchPos,ContentPos,Depth,UseContentPos,StepEnd){var CurPos=true===UseContentPos? ContentPos.Get(Depth):0;this.Content[CurPos].Get_WordEndPos(SearchPos,ContentPos,Depth+1,UseContentPos,StepEnd);if(true===SearchPos.UpdatePos)SearchPos.Pos.Update(CurPos,Depth);if(true===SearchPos.Found)return;CurPos++;var Count=this.Content.length;if(SearchPos.Shift&&CurPos=nStartPos;--nPos)if(this.Content[nPos].Get_EndRangePos(nCurLine,nCurRange,oSearchPos,nDepth+1)){oSearchPos.Pos.Update(nPos,nDepth);bResult=true;break}return bResult};CParagraphContentWithParagraphLikeContent.prototype.Get_StartRangePos=function(nCurLine,nCurRange,oSearchPos,nDepth){var _nCurLine=nCurLine-this.StartLine;var _nCurRange=0===_nCurLine?nCurRange-this.StartRange:nCurRange;var nStartPos=Math.max(0,Math.min(this.Content.length-1, this.protected_GetRangeStartPos(_nCurLine,_nCurRange)));var nEndPos=Math.min(this.Content.length-1,Math.max(0,this.protected_GetRangeEndPos(_nCurLine,_nCurRange)));var bResult=false;for(var nPos=nStartPos;nPos<=nEndPos;++nPos)if(this.Content[nPos].Get_StartRangePos(nCurLine,nCurRange,oSearchPos,nDepth+1)){oSearchPos.Pos.Update(nPos,nDepth);bResult=true;break}return bResult};CParagraphContentWithParagraphLikeContent.prototype.Get_StartRangePos2=function(_CurLine,_CurRange,ContentPos,Depth){var CurLine= _CurLine-this.StartLine;var CurRange=0===CurLine?_CurRange-this.StartRange:_CurRange;var Pos=this.protected_GetRangeStartPos(CurLine,CurRange);ContentPos.Update(Pos,Depth);this.Content[Pos].Get_StartRangePos2(_CurLine,_CurRange,ContentPos,Depth+1)};CParagraphContentWithParagraphLikeContent.prototype.Get_EndRangePos2=function(_CurLine,_CurRange,ContentPos,Depth){var CurLine=_CurLine-this.StartLine;var CurRange=0===CurLine?_CurRange-this.StartRange:_CurRange;var Pos=this.protected_GetRangeEndPos(CurLine, CurRange);ContentPos.Update(Pos,Depth);this.Content[Pos].Get_EndRangePos2(_CurLine,_CurRange,ContentPos,Depth+1)};CParagraphContentWithParagraphLikeContent.prototype.Get_StartPos=function(ContentPos,Depth){if(this.Content.length>0){ContentPos.Update(0,Depth);this.Content[0].Get_StartPos(ContentPos,Depth+1)}};CParagraphContentWithParagraphLikeContent.prototype.Get_EndPos=function(BehindEnd,ContentPos,Depth){var ContentLen=this.Content.length;if(ContentLen>0){ContentPos.Update(ContentLen-1,Depth);this.Content[ContentLen- 1].Get_EndPos(BehindEnd,ContentPos,Depth+1)}};CParagraphContentWithParagraphLikeContent.prototype.Set_SelectionContentPos=function(StartContentPos,EndContentPos,Depth,StartFlag,EndFlag){if(this.Content.length<=0)return;var Selection=this.Selection;var OldStartPos=Selection.StartPos;var OldEndPos=Selection.EndPos;if(OldStartPos>OldEndPos){OldStartPos=Selection.EndPos;OldEndPos=Selection.StartPos}var StartPos=0;switch(StartFlag){case 1:StartPos=0;break;case -1:StartPos=this.Content.length-1;break;case 0:StartPos= StartContentPos.Get(Depth);break}var EndPos=0;switch(EndFlag){case 1:EndPos=0;break;case -1:EndPos=this.Content.length-1;break;case 0:EndPos=EndContentPos.Get(Depth);break}if(OldStartPosStartPos&&OldEndPos>EndPos){var TempBegin=Math.max(0,Math.max(StartPos,EndPos)+ 1);var TempEnd=Math.min(OldEndPos,this.Content.length-1);for(var CurPos=TempBegin;CurPos<=TempEnd;++CurPos)this.Content[CurPos].RemoveSelection()}Selection.Use=true;Selection.StartPos=StartPos;Selection.EndPos=EndPos;if(StartPos!=EndPos){this.Content[StartPos].Set_SelectionContentPos(StartContentPos,null,Depth+1,StartFlag,StartPos>EndPos?1:-1);this.Content[EndPos].Set_SelectionContentPos(null,EndContentPos,Depth+1,StartPos>EndPos?-1:1,EndFlag);var _StartPos=StartPos;var _EndPos=EndPos;var Direction= 1;if(_StartPos>_EndPos){_StartPos=EndPos;_EndPos=StartPos;Direction=-1}for(var CurPos=_StartPos+1;CurPos<_EndPos;CurPos++)this.Content[CurPos].SelectAll(Direction)}else this.Content[StartPos].Set_SelectionContentPos(StartContentPos,EndContentPos,Depth+1,StartFlag,EndFlag)};CParagraphContentWithParagraphLikeContent.prototype.SetContentSelection=function(StartDocPos,EndDocPos,Depth,StartFlag,EndFlag){if(this.Content.length<=0)return;if(0===StartFlag&&(!StartDocPos[Depth]||this!==StartDocPos[Depth].Class)|| 0===EndFlag&&(!EndDocPos[Depth]||this!==EndDocPos[Depth].Class))return;var StartPos=0,EndPos=0;switch(StartFlag){case 0:StartPos=StartDocPos[Depth].Position;break;case 1:StartPos=0;break;case -1:StartPos=this.Content.length-1;break}switch(EndFlag){case 0:EndPos=EndDocPos[Depth].Position;break;case 1:EndPos=0;break;case -1:EndPos=this.Content.length-1;break}var _StartDocPos=StartDocPos,_StartFlag=StartFlag;if(null!==StartDocPos&&true===StartDocPos[Depth].Deleted)if(StartPos0){StartPos--;_StartDocPos=null;_StartFlag=-1}else return;var _EndDocPos=EndDocPos,_EndFlag=EndFlag;if(null!==EndDocPos&&true===EndDocPos[Depth].Deleted)if(EndPos0){EndPos--;_EndDocPos=null;_EndFlag=-1}else return;this.Selection.Use=true;this.Selection.StartPos=Math.max(0,Math.min(this.Content.length-1,StartPos));this.Selection.EndPos=Math.max(0,Math.min(this.Content.length-1,EndPos));if(StartPos!== EndPos){if(this.Content[StartPos]&&this.Content[StartPos].SetContentSelection)this.Content[StartPos].SetContentSelection(_StartDocPos,null,Depth+1,_StartFlag,StartPos>EndPos?1:-1);if(this.Content[EndPos]&&this.Content[EndPos].SetContentSelection)this.Content[EndPos].SetContentSelection(null,_EndDocPos,Depth+1,StartPos>EndPos?-1:1,_EndFlag);var _StartPos=StartPos;var _EndPos=EndPos;var Direction=1;if(_StartPos>_EndPos){_StartPos=EndPos;_EndPos=StartPos;Direction=-1}for(var CurPos=_StartPos+1;CurPos< _EndPos;CurPos++)this.Content[CurPos].SelectAll(Direction)}else if(this.Content[StartPos]&&this.Content[StartPos].SetContentSelection)this.Content[StartPos].SetContentSelection(_StartDocPos,_EndDocPos,Depth+1,_StartFlag,_EndFlag)};CParagraphContentWithParagraphLikeContent.prototype.SetContentPosition=function(DocPos,Depth,Flag){if(this.Content.length<=0)return;if(0===Flag&&(!DocPos[Depth]||this!==DocPos[Depth].Class))return;var Pos=0;switch(Flag){case 0:Pos=DocPos[Depth].Position;break;case 1:Pos= 0;break;case -1:Pos=this.Content.length-1;break}var _DocPos=DocPos,_Flag=Flag;if(null!==DocPos&&true===DocPos[Depth].Deleted)if(Pos0){Pos--;_DocPos=null;_Flag=-1}else return;this.State.ContentPos=Math.max(0,Math.min(this.Content.length-1,Pos));if(this.CurPos)this.CurPos=this.State.ContentPos;if(this.Content[Pos]&&this.Content[Pos].SetContentPosition)this.Content[Pos].SetContentPosition(_DocPos,Depth+1,_Flag);else this.Content[Pos].MoveCursorToStartPos()}; CParagraphContentWithParagraphLikeContent.prototype.RemoveSelection=function(){var Selection=this.Selection;if(true===Selection.Use){var StartPos=Selection.StartPos;var EndPos=Selection.EndPos;if(StartPos>EndPos){StartPos=Selection.EndPos;EndPos=Selection.StartPos}StartPos=Math.max(0,StartPos);EndPos=Math.min(this.Content.length-1,EndPos);for(var CurPos=StartPos;CurPos<=EndPos;CurPos++)this.Content[CurPos].RemoveSelection()}Selection.Use=false;Selection.StartPos=0;Selection.EndPos=0};CParagraphContentWithParagraphLikeContent.prototype.SelectAll= function(Direction){var ContentLen=this.Content.length;var Selection=this.Selection;Selection.Use=true;if(-1===Direction){Selection.StartPos=ContentLen-1;Selection.EndPos=0}else{Selection.StartPos=0;Selection.EndPos=ContentLen-1}for(var CurPos=0;CurPosEndPos){StartPos= this.State.Selection.EndPos;EndPos=this.State.Selection.StartPos}for(var CurPos=StartPos;CurPos<=EndPos;CurPos++)if(false===this.Content[CurPos].IsSelectionEmpty(CheckEnd))return false;return true};CParagraphContentWithParagraphLikeContent.prototype.Selection_CheckParaEnd=function(){return false};CParagraphContentWithParagraphLikeContent.prototype.Selection_CheckParaContentPos=function(ContentPos,Depth,bStart,bEnd){var CurPos=ContentPos.Get(Depth);if(this.Selection.StartPos<=CurPos&&CurPos<=this.Selection.EndPos)return this.Content[CurPos].Selection_CheckParaContentPos(ContentPos, Depth+1,bStart&&this.Selection.StartPos===CurPos,bEnd&&CurPos===this.Selection.EndPos);else if(this.Selection.EndPos<=CurPos&&CurPos<=this.Selection.StartPos)return this.Content[CurPos].Selection_CheckParaContentPos(ContentPos,Depth+1,bStart&&this.Selection.EndPos===CurPos,bEnd&&CurPos===this.Selection.StartPos);return false};CParagraphContentWithParagraphLikeContent.prototype.IsSelectedAll=function(Props){var Selection=this.State.Selection;if(false===Selection.Use&&true!==this.Is_Empty(Props))return false; var StartPos=Selection.StartPos;var EndPos=Selection.EndPos;if(EndPos=0;CurPos--){var ElementId=this.Content[CurPos].GetSearchElementId(false,bUseContentPos&&CurPos===StartPos?true:false,ContentPos,Depth+1);if(null!==ElementId)return ElementId}}return null};CParagraphContentWithParagraphLikeContent.prototype.SetReviewType=function(ReviewType,RemovePrChange){for(var Index=0,Count=this.Content.length;Index< Count;Index++){var Element=this.Content[Index];if(para_Run===Element.Type){Element.SetReviewType(ReviewType);if(true===RemovePrChange)Element.RemovePrChange()}else if(Element.SetReviewType)Element.SetReviewType(ReviewType)}};CParagraphContentWithParagraphLikeContent.prototype.SetReviewTypeWithInfo=function(ReviewType,ReviewInfo){for(var Index=0,Count=this.Content.length;IndexEndPos){StartPos=this.Selection.EndPos;EndPos=this.Selection.StartPos}if(true===bAll){StartPos=0;EndPos=this.Content.length-1}if(this.Content[EndPos].AcceptRevisionChanges)this.Content[EndPos].AcceptRevisionChanges(Type,bAll);if(StartPosStartPos;CurPos--){var Element=this.Content[CurPos];var ReviewType=Element.GetReviewType?Element.GetReviewType():reviewtype_Common;var isGoInside=false;if(reviewtype_Add===ReviewType){if(undefined===Type||c_oAscRevisionsChangeType.TextAdd=== Type)Element.SetReviewType(reviewtype_Common);isGoInside=true}else if(reviewtype_Remove===ReviewType){if(undefined===Type||c_oAscRevisionsChangeType.TextRem===Type)this.Remove_FromContent(CurPos,1,true)}else if(reviewtype_Common===ReviewType)isGoInside=true;if(true===isGoInside&&Element.AcceptRevisionChanges)Element.AcceptRevisionChanges(Type,true)}if(this.Content[StartPos].AcceptRevisionChanges)this.Content[StartPos].AcceptRevisionChanges(Type,bAll)}this.Correct_Content()}};CParagraphContentWithParagraphLikeContent.prototype.RejectRevisionChanges= function(Type,bAll){if(true===this.Selection.Use||true===bAll){var StartPos=this.Selection.StartPos;var EndPos=this.Selection.EndPos;if(StartPos>EndPos){StartPos=this.Selection.EndPos;EndPos=this.Selection.StartPos}if(true===bAll){StartPos=0;EndPos=this.Content.length-1}if(this.Content[EndPos].RejectRevisionChanges)this.Content[EndPos].RejectRevisionChanges(Type,bAll);if(StartPosStartPos;CurPos--){var Element=this.Content[CurPos];var ReviewType=Element.GetReviewType? Element.GetReviewType():reviewtype_Common;var isGoInside=false;if(reviewtype_Remove===ReviewType){if(undefined===Type||c_oAscRevisionsChangeType.TextRem===Type)Element.SetReviewType(reviewtype_Common);isGoInside=true}else if(reviewtype_Add===ReviewType){if(undefined===Type||c_oAscRevisionsChangeType.TextAdd===Type)this.Remove_FromContent(CurPos,1,true)}else if(reviewtype_Common===ReviewType)isGoInside=true;if(true===isGoInside&&Element.RejectRevisionChanges)Element.RejectRevisionChanges(Type,true)}if(this.Content[StartPos].RejectRevisionChanges)this.Content[StartPos].RejectRevisionChanges(Type, bAll)}this.Correct_Content()}};CParagraphContentWithParagraphLikeContent.prototype.private_UpdateTrackRevisions=function(){if(this.Paragraph&&this.Paragraph.LogicDocument&&this.Paragraph.LogicDocument.GetTrackRevisionsManager){var RevisionsManager=this.Paragraph.LogicDocument.GetTrackRevisionsManager();RevisionsManager.CheckElement(this.Paragraph)}};CParagraphContentWithParagraphLikeContent.prototype.private_CheckUpdateBookmarks=function(Items){if(!Items)return;for(var nIndex=0,nCount=Items.length;nIndex< nCount;++nIndex){var oItem=Items[nIndex];if(oItem&¶_Bookmark===oItem.Type){var oLogicDocument=this.Paragraph&&this.Paragraph.LogicDocument?this.Paragraph.LogicDocument:editor.WordControl.m_oLogicDocument;oLogicDocument.GetBookmarksManager().SetNeedUpdate(true);return}}};CParagraphContentWithParagraphLikeContent.prototype.GetFootnotesList=function(oEngine){for(var nIndex=0,nCount=this.Content.length;nIndex0)isStepOver=true;else if(-1===nRes)return true}else for(var nIndex=nPos;nIndex>=0;--nIndex){var nRes=this.Content[nIndex].GotoFootnoteRef?this.Content[nIndex].GotoFootnoteRef(true,true===isCurrent&&nPos===nIndex,isStepOver,isStepFootnote,isStepEndnote):0;if(nRes>0)isStepOver=true;else if(-1===nRes)return true}return false};CParagraphContentWithParagraphLikeContent.prototype.GetFootnoteRefsInRange= function(arrFootnotes,_CurLine,_CurRange){var CurLine=_CurLine-this.StartLine;var CurRange=0===CurLine?_CurRange-this.StartRange:_CurRange;var StartPos=this.protected_GetRangeStartPos(CurLine,CurRange);var EndPos=this.protected_GetRangeEndPos(CurLine,CurRange);for(var CurPos=StartPos;CurPos<=EndPos;CurPos++)if(this.Content[CurPos].GetFootnoteRefsInRange)this.Content[CurPos].GetFootnoteRefsInRange(arrFootnotes,_CurLine,_CurRange)};CParagraphContentWithParagraphLikeContent.prototype.GetAllContentControls= function(arrContentControls){if(!arrContentControls)arrContentControls=[];for(var nIndex=0,nCount=this.Content.length;nIndex0){this.Get_StartPos(StartPos,StartPos.Get_Depth()+1);this.Get_EndPos(true,EndPos,EndPos.Get_Depth()+ 1)}else{this.Get_StartPos(EndPos,EndPos.Get_Depth()+1);this.Get_EndPos(true,StartPos,StartPos.Get_Depth()+1)}this.Paragraph.Selection.Use=true;this.Paragraph.Selection.Start=false;this.Paragraph.Set_ParaContentPos(StartPos,true,-1,-1);this.Paragraph.Set_SelectionContentPos(StartPos,EndPos,false);this.Paragraph.Document_SetThisElementCurrent(false);return true};CParagraphContentWithParagraphLikeContent.prototype.SetThisElementCurrent=function(){var ContentPos=this.Paragraph.Get_PosByElement(this); if(!ContentPos)return;var StartPos=ContentPos.Copy();this.Get_StartPos(StartPos,StartPos.Get_Depth()+1);this.Paragraph.Set_ParaContentPos(StartPos,true,-1,-1,false);this.Paragraph.Document_SetThisElementCurrent(false)};CParagraphContentWithParagraphLikeContent.prototype.GetSelectedContentControls=function(arrContentControls){if(true===this.Selection.Use){var StartPos=this.Selection.StartPos;var EndPos=this.Selection.EndPos;if(StartPos>EndPos){StartPos=this.Selection.EndPos;EndPos=this.Selection.StartPos}for(var Index= StartPos;Index<=EndPos;++Index)if(this.Content[Index].GetSelectedContentControls)this.Content[Index].GetSelectedContentControls(arrContentControls)}else if(this.Content[this.State.ContentPos].GetSelectedContentControls)this.Content[this.State.ContentPos].GetSelectedContentControls(arrContentControls)};CParagraphContentWithParagraphLikeContent.prototype.CreateRunWithText=function(sValue){var oRun=new ParaRun;oRun.AddText(sValue);oRun.Set_Pr(this.Get_FirstTextPr());return oRun};CParagraphContentWithParagraphLikeContent.prototype.ReplaceAllWithText= function(sValue){var oRun=this.CreateRunWithText(sValue);oRun.Apply_TextPr(this.Get_TextPr(),undefined,true);this.Remove_FromContent(0,this.Content.length);this.Add_ToContent(0,oRun);this.MoveCursorToStartPos()};CParagraphContentWithParagraphLikeContent.prototype.FindNextFillingForm=function(isNext,isCurrent,isStart){var nCurPos=this.Selection.Use===true?this.Selection.EndPos:this.State.ContentPos;var nStartPos=0,nEndPos=0;if(isCurrent)if(isStart){nStartPos=nCurPos;nEndPos=isNext?this.Content.length- 1:0}else{nStartPos=isNext?0:this.Content.length-1;nEndPos=nCurPos}else if(isNext){nStartPos=0;nEndPos=this.Content.length-1}else{nStartPos=this.Content.length-1;nEndPos=0}if(isNext)for(var nIndex=nStartPos;nIndex<=nEndPos;++nIndex){if(this.Content[nIndex].FindNextFillingForm){var oRes=this.Content[nIndex].FindNextFillingForm(true,isCurrent&&nIndex===nCurPos,isStart);if(oRes)return oRes}}else for(var nIndex=nStartPos;nIndex>=nEndPos;--nIndex)if(this.Content[nIndex].FindNextFillingForm){var oRes=this.Content[nIndex].FindNextFillingForm(false, isCurrent&&nIndex===nCurPos,isStart);if(oRes)return oRes}return null};CParagraphContentWithParagraphLikeContent.prototype.IsEmpty=function(oPr){return this.Is_Empty(oPr)};CParagraphContentWithParagraphLikeContent.prototype.AddContentControl=function(){if(true===this.IsSelectionUse())if(this.Selection.StartPos===this.Selection.EndPos&¶_Run!==this.Content[this.Selection.StartPos].Type){if(this.Content[this.Selection.StartPos].AddContentControl)return this.Content[this.Selection.StartPos].AddContentControl(); return null}else{var nStartPos=this.Selection.StartPos;var nEndPos=this.Selection.EndPos;if(nEndPos=nStartPos+1;--nIndex){oContentControl.Add_ToContent(0,this.Content[nIndex]);this.Remove_FromContent(nIndex,1)}if(oContentControl.IsEmpty())oContentControl.ReplaceContentWithPlaceHolder(); this.Add_ToContent(nStartPos+1,oContentControl);this.Selection.StartPos=nStartPos+1;this.Selection.EndPos=nStartPos+1;oContentControl.SelectAll(1);return oContentControl}else{var oContentControl=new CInlineLevelSdt;oContentControl.SetDefaultTextPr(this.GetDirectTextPr());oContentControl.SetPlaceholder(c_oAscDefaultPlaceholderName.Text);oContentControl.ReplaceContentWithPlaceHolder(false);this.Add(oContentControl);return oContentControl}};CParagraphContentWithParagraphLikeContent.prototype.GetElement= function(nPos){if(nPos<0||nPos>=this.Content.length)return null;return this.Content[nPos]};CParagraphContentWithParagraphLikeContent.prototype.GetElementsCount=function(){return this.Content.length};CParagraphContentWithParagraphLikeContent.prototype.PreDelete=function(){for(var nIndex=0,nCount=this.Content.length;nIndexEndPos){StartPos=this.Selection.EndPos;EndPos=this.Selection.StartPos}while(true===this.Content[StartPos].IsSelectionEmpty()&&StartPos0&&!this.Content[nCurPos].IsCursorPlaceable()){nCurPos--;this.Content[nCurPos].MoveCursorToEndPos()}while(nCurPos0&¶_Run!==this.Content[nCurPos].Type&¶_Math!==this.Content[nCurPos].Type&¶_Field!==this.Content[nCurPos].Type&¶_InlineLevelSdt!==this.Content[nCurPos].Type&&true===this.Content[nCurPos].Cursor_Is_Start()){if(!this.Content[nCurPos-1].IsCursorPlaceable())break;nCurPos--;this.Content[nCurPos].MoveCursorToEndPos()}while(nCurPos0){oRun.SetPr(_oRun.GetDirectTextPr().Copy());isFirst=false}});oRun.State.ContentPos=nNewCurPos}if(this.Content.length> 0)this.RemoveFromContent(0,this.Content.length,true);this.AddToContent(0,oRun,true)}var oRun=this.Content[0];if(false!==isClearRun)oRun.ClearContent();return oRun};CParagraphContentWithParagraphLikeContent.prototype.ClearContent=function(){if(this.Content.length<=0)return;this.RemoveFromContent(0,this.Content.length,true)};CParagraphContentWithParagraphLikeContent.prototype.GetFirstRunElementPos=function(nType,oStartPos,oEndPos,nDepth){for(var nPos=0,nCount=this.Content.length;nPos=this.m_aReplies.length)return null;return this.m_aReplies[Index]};this.Read_FromAscCommentData=function(AscCommentData){this.m_sText=AscCommentData.asc_getText();this.m_sTime=AscCommentData.asc_getTime(); this.m_sOOTime=AscCommentData.asc_getOnlyOfficeTime();this.m_sUserId=AscCommentData.asc_getUserId();this.m_sProviderId=AscCommentData.asc_getProviderId();this.m_sQuoteText=AscCommentData.asc_getQuoteText();this.m_bSolved=AscCommentData.asc_getSolved();this.m_sUserName=AscCommentData.asc_getUserName();this.m_sInitials=AscCommentData.asc_getInitials();this.m_nDurableId=AscCommentData.asc_getDurableId();this.m_sUserData=AscCommentData.asc_getUserData();var RepliesCount=AscCommentData.asc_getRepliesCount(); for(var Index=0;Index=DrawingRect.X&&_X<=DrawingRect.X+ DrawingRect.W&&_Y>=DrawingRect.Y&&_Y<=DrawingRect.Y+DrawingRect.H){var arrComments=[];for(var nCommentIndex=0,nCommentsCount=DrawingRect.CommentId.length;nCommentIndexnX2){var nTemp=nX2;nX2=nX1;nX1=nTemp}if(nY1>nY2){var nTemp=nY2;nY2=nY1;nY1=nTemp}if(Math.max(nX1,oDrawingRect.X)=this.Bookmarks.length)return"";return this.Bookmarks[nIndex][0].GetBookmarkName()}; CBookmarksManager.prototype.GetId=function(nIndex){this.Update();if(nIndex<0||this.Index>=this.Bookmarks.length)return"";return this.Bookmarks[nIndex][0].GetBookmarkId()};CBookmarksManager.prototype.RemoveBookmark=function(sName){this.Update();if(!this.GetBookmarkByName(sName))return;this.LogicDocument.RemoveBookmark(sName)};CBookmarksManager.prototype.AddBookmark=function(sName){this.Update();if(this.GetBookmarkByName(sName)){if(this.IsHiddenBookmark(sName))return;var sTempName="_temp_"+sName;this.LogicDocument.AddBookmark(sTempName); this.LogicDocument.RemoveBookmark(sName);this.NeedUpdate=true;var oBookmark=this.GetBookmarkByName(sTempName);if(oBookmark){this.NeedUpdate=true;oBookmark[0].ChangeBookmarkName(sName);oBookmark[1].ChangeBookmarkName(sName)}}else this.LogicDocument.AddBookmark(sName)};CBookmarksManager.prototype.GoToBookmark=function(sName){this.Update();var oBookmark=this.GetBookmarkByName(sName);if(oBookmark)oBookmark[0].GoToBookmark()};CBookmarksManager.prototype.IsHiddenBookmark=function(sName){return sName&&"_"=== sName.charAt(0)};CBookmarksManager.prototype.IsInternalUseBookmark=function(sName){return sName==="_GoBack"};CBookmarksManager.prototype.CheckNewBookmarkName=function(sName){if(!sName)return false;return sName===XRegExp.match(sName,new XRegExp("(\\pL)(\\pL|_|\\pN){0,39}"))};CBookmarksManager.prototype.GetNameForHeadingBookmark=function(oParagraph){if(!oParagraph)return"";var sText=oParagraph.GetText();var nStartPos=0;while(nStartPos.001)return false;if(Math.abs(this.Space-Border.Space)>.001)return false;if(this.Value!=Border.Value)return false;return true},Is_Equal:function(Border){return this.IsEqual(Border)},Get_Color:function(Paragraph){if(undefined!==this.Unifill){this.Unifill.check(Paragraph.Get_Theme(),Paragraph.Get_ColorMap());var RGBA=this.Unifill.getRGBAColor();return new CDocumentColor(RGBA.R,RGBA.G,RGBA.B,false)}else return this.Color},Get_Color2:function(Theme,ColorMap){if(undefined!== this.Unifill){this.Unifill.check(Theme,ColorMap);var RGBA=this.Unifill.getRGBAColor();return new CDocumentColor(RGBA.R,RGBA.G,RGBA.B,false)}else return this.Color},Check_PresentationPr:function(Theme){if(this.LineRef&&Theme){var pen=Theme.getLnStyle(this.LineRef.idx,this.LineRef.Color);this.Unifill=pen.Fill;this.LineRef=undefined;this.Size=AscFormat.isRealNumber(pen.w)?pen.w/36E3:12700/36E3}if(!this.Unifill||!this.Unifill.isVisible())this.Value=border_None},Set_FromObject:function(Border){this.Space= Border.Space;this.Size=Border.Size;this.Value=Border.Value;if(undefined!=Border.Color)this.Color=new CDocumentColor(Border.Color.r,Border.Color.g,Border.Color.b);else this.Color=undefined;if(undefined!=Border.Unifill)this.Unifill=Border.Unifill.createDuplicate();if(undefined!=Border.LineRef)this.LineRef=Border.LineRef.createDuplicate()},Check_Null:function(){if(undefined===this.Space||undefined===this.Size||undefined===this.Value||undefined===this.Color||undefined===this.Unifill||undefined===this.LineRef)return false; return true},Write_ToBinary:function(Writer){Writer.WriteDouble(this.Size);Writer.WriteLong(this.Space);Writer.WriteByte(this.Value);this.Color.Write_ToBinary(Writer);if(this.Unifill){Writer.WriteBool(true);this.Unifill.Write_ToBinary(Writer)}else Writer.WriteBool(false);if(this.LineRef){Writer.WriteBool(true);this.LineRef.Write_ToBinary(Writer)}else Writer.WriteBool(false)},Read_FromBinary:function(Reader){this.Size=Reader.GetDouble();this.Space=Reader.GetLong();this.Value=Reader.GetByte();this.Color.Read_FromBinary(Reader); if(Reader.GetBool()){this.Unifill=new AscFormat.CUniFill;this.Unifill.Read_FromBinary(Reader)}if(Reader.GetBool()){this.LineRef=new AscFormat.StyleRef;this.LineRef.Read_FromBinary(Reader)}}};CDocumentBorder.prototype.IsNone=function(){return this.Value===border_None};CDocumentBorder.prototype.GetWidth=function(){if(border_None===this.Value)return 0;return this.Size};CDocumentBorder.prototype.SetSimpleColor=function(r,g,b){this.Color=new CDocumentColor(r,g,b);this.Unifill=undefined;this.LineRef=undefined}; CDocumentBorder.prototype.GetColor=function(oParagraph){return this.Get_Color(oParagraph)};CDocumentBorder.prototype.IsEqual=function(oBorder){if(!oBorder||this.Value!==oBorder.Value)return false;if(this.IsNone())return true;return IsEqualStyleObjects(this.Color,oBorder.Color)&&IsEqualStyleObjects(this.Unifill,oBorder.Unifill)&&this.Space!==oBorder.Space&&this.Size!==oBorder.Size};CDocumentBorder.prototype.WriteToBinary=function(oWriter){return this.Write_ToBinary(oWriter)};CDocumentBorder.prototype.ReadFromBinary= function(oReader){return this.Read_FromBinary(oReader)};function CTableMeasurement(Type,W){this.Type=Type;this.W=W}CTableMeasurement.prototype={Copy:function(){return new CTableMeasurement(this.Type,this.W)},Is_Equal:function(Other){if(this.Type!==Other.Type||this.W!==Other.W)return false;return true},Write_ToBinary:function(Writer){this.WriteToBinary(Writer)},Read_FromBinary:function(Reader){return this.ReadFromBinary(Reader)},Set_FromObject:function(Obj){this.W=Obj.W;this.Type=Obj.Type}};CTableMeasurement.prototype.IsMM= function(){return tblwidth_Mm===this.Type};CTableMeasurement.prototype.IsPercent=function(){return tblwidth_Pct===this.Type};CTableMeasurement.prototype.IsAuto=function(){return tblwidth_Auto===this.Type};CTableMeasurement.prototype.GetValue=function(){return this.W};CTableMeasurement.prototype.SetValue=function(nValue){this.W=nValue};CTableMeasurement.prototype.GetCalculatedValue=function(nFullWidth){if(this.IsMM())return this.W;else if(this.IsPercent())return this.W*nFullWidth/100;return 0};CTableMeasurement.prototype.ReadFromBinary= function(oReader){this.W=oReader.GetDouble();this.Type=oReader.GetLong()};CTableMeasurement.prototype.WriteToBinary=function(oWriter){oWriter.WriteDouble(this.W);oWriter.WriteLong(this.Type)};function CTablePr(){this.TableStyleColBandSize=undefined;this.TableStyleRowBandSize=undefined;this.Jc=undefined;this.Shd=undefined;this.TableBorders={Bottom:undefined,Left:undefined,Right:undefined,Top:undefined,InsideH:undefined,InsideV:undefined};this.TableCellMar={Bottom:undefined,Left:undefined,Right:undefined, Top:undefined};this.TableCellSpacing=undefined;this.TableInd=undefined;this.TableW=undefined;this.TableLayout=undefined;this.TableDescription=undefined;this.TableCaption=undefined;this.PrChange=undefined;this.ReviewInfo=undefined}CTablePr.prototype.Copy=function(bCopyPrChange){var TablePr=new CTablePr;TablePr.TableStyleColBandSize=this.TableStyleColBandSize;TablePr.TableStyleRowBandSize=this.TableStyleRowBandSize;TablePr.Jc=this.Jc;if(undefined!=this.Shd)TablePr.Shd=this.Shd.Copy();if(undefined!= this.TableBorders.Bottom)TablePr.TableBorders.Bottom=this.TableBorders.Bottom.Copy();if(undefined!=this.TableBorders.Left)TablePr.TableBorders.Left=this.TableBorders.Left.Copy();if(undefined!=this.TableBorders.Right)TablePr.TableBorders.Right=this.TableBorders.Right.Copy();if(undefined!=this.TableBorders.Top)TablePr.TableBorders.Top=this.TableBorders.Top.Copy();if(undefined!=this.TableBorders.InsideH)TablePr.TableBorders.InsideH=this.TableBorders.InsideH.Copy();if(undefined!=this.TableBorders.InsideV)TablePr.TableBorders.InsideV= this.TableBorders.InsideV.Copy();if(undefined!=this.TableCellMar.Bottom)TablePr.TableCellMar.Bottom=this.TableCellMar.Bottom.Copy();if(undefined!=this.TableCellMar.Left)TablePr.TableCellMar.Left=this.TableCellMar.Left.Copy();if(undefined!=this.TableCellMar.Right)TablePr.TableCellMar.Right=this.TableCellMar.Right.Copy();if(undefined!=this.TableCellMar.Top)TablePr.TableCellMar.Top=this.TableCellMar.Top.Copy();TablePr.TableCellSpacing=this.TableCellSpacing;TablePr.TableInd=this.TableInd;if(undefined!= this.TableW)TablePr.TableW=this.TableW.Copy();TablePr.TableLayout=this.TableLayout;TablePr.TableDescription=this.TableDescription;TablePr.TableCaption=this.TableCaption;if(true===bCopyPrChange&&undefined!==this.PrChange){TablePr.PrChange=this.PrChange.Copy();TablePr.ReviewInfo=this.ReviewInfo.Copy()}return TablePr};CTablePr.prototype.Merge=function(TablePr){if(undefined!=TablePr.TableStyleColBandSize)this.TableStyleColBandSize=TablePr.TableStyleColBandSize;if(undefined!=TablePr.TableStyleRowBandSize)this.TableStyleRowBandSize= TablePr.TableStyleRowBandSize;if(undefined!=TablePr.Jc)this.Jc=TablePr.Jc;if(undefined!=TablePr.Shd)this.Shd=TablePr.Shd.Copy();if(undefined!=TablePr.TableBorders.Bottom)this.TableBorders.Bottom=TablePr.TableBorders.Bottom.Copy();if(undefined!=TablePr.TableBorders.Left)this.TableBorders.Left=TablePr.TableBorders.Left.Copy();if(undefined!=TablePr.TableBorders.Right)this.TableBorders.Right=TablePr.TableBorders.Right.Copy();if(undefined!=TablePr.TableBorders.Top)this.TableBorders.Top=TablePr.TableBorders.Top.Copy(); if(undefined!=TablePr.TableBorders.InsideH)this.TableBorders.InsideH=TablePr.TableBorders.InsideH.Copy();if(undefined!=TablePr.TableBorders.InsideV)this.TableBorders.InsideV=TablePr.TableBorders.InsideV.Copy();if(undefined!=TablePr.TableCellMar.Bottom)this.TableCellMar.Bottom=TablePr.TableCellMar.Bottom.Copy();if(undefined!=TablePr.TableCellMar.Left)this.TableCellMar.Left=TablePr.TableCellMar.Left.Copy();if(undefined!=TablePr.TableCellMar.Right)this.TableCellMar.Right=TablePr.TableCellMar.Right.Copy(); if(undefined!=TablePr.TableCellMar.Top)this.TableCellMar.Top=TablePr.TableCellMar.Top.Copy();if(undefined!=TablePr.TableCellSpacing)this.TableCellSpacing=TablePr.TableCellSpacing;if(undefined!=TablePr.TableInd)this.TableInd=TablePr.TableInd;if(undefined!=TablePr.TableW)this.TableW=TablePr.TableW.Copy();if(undefined!=TablePr.TableLayout)this.TableLayout=TablePr.TableLayout;if(undefined!==TablePr.TableDescription)this.TableDescription=TablePr.TableDescription;if(undefined!==TablePr.TableCaption)this.TableCaption= TablePr.TableCaption};CTablePr.prototype.Is_Equal=function(TablePr){if(this.TableStyleColBandSize!==TablePr.TableStyleColBandSize||this.TableStyleRowBandSize!==TablePr.TableStyleRowBandSize||this.Jc!==TablePr.Jc||true!==IsEqualStyleObjects(this.TableBorders.Bottom,TablePr.TableBorders.Bottom)||true!==IsEqualStyleObjects(this.TableBorders.Left,TablePr.TableBorders.Left)||true!==IsEqualStyleObjects(this.TableBorders.Right,TablePr.TableBorders.Right)||true!==IsEqualStyleObjects(this.TableBorders.Top, TablePr.TableBorders.Top)||true!==IsEqualStyleObjects(this.TableBorders.InsideH,TablePr.TableBorders.InsideH)||true!==IsEqualStyleObjects(this.TableBorders.InsideV,TablePr.TableBorders.InsideV)||true!==IsEqualStyleObjects(this.TableCellMar.Bottom,TablePr.TableCellMar.Bottom)||true!==IsEqualStyleObjects(this.TableCellMar.Left,TablePr.TableCellMar.Left)||true!==IsEqualStyleObjects(this.TableCellMar.Right,TablePr.TableCellMar.Right)||true!==IsEqualStyleObjects(this.TableCellMar.Top,TablePr.TableCellMar.Top)|| this.TableCellSpacing!==TablePr.TableCellSpacing||this.TableInd!==TablePr.TableInd||true!==IsEqualStyleObjects(this.TableW,TablePr.TableW)||this.TableLayout!==TablePr.TableLayout)return false;return true};CTablePr.prototype.InitDefault=function(nCompatibilityMode){if(undefined===nCompatibilityMode)nCompatibilityMode=AscCommon.document_compatibility_mode_Word12;this.TableStyleColBandSize=1;this.TableStyleRowBandSize=1;this.Jc=align_Left;this.Shd=new CDocumentShd;this.TableBorders.Bottom=new CDocumentBorder; this.TableBorders.Left=new CDocumentBorder;this.TableBorders.Right=new CDocumentBorder;this.TableBorders.Top=new CDocumentBorder;this.TableBorders.InsideH=new CDocumentBorder;this.TableBorders.InsideV=new CDocumentBorder;this.TableCellMar.Bottom=new CTableMeasurement(tblwidth_Mm,0);this.TableCellMar.Left=nCompatibilityMode<=AscCommon.document_compatibility_mode_Word12?new CTableMeasurement(tblwidth_Mm,.5*g_dKoef_pt_to_mm):new CTableMeasurement(tblwidth_Mm,1.9);this.TableCellMar.Right=nCompatibilityMode<= AscCommon.document_compatibility_mode_Word12?new CTableMeasurement(tblwidth_Mm,.5*g_dKoef_pt_to_mm):new CTableMeasurement(tblwidth_Mm,1.9);this.TableCellMar.Top=new CTableMeasurement(tblwidth_Mm,0);this.TableCellSpacing=null;this.TableInd=0;this.TableW=new CTableMeasurement(tblwidth_Auto,0);this.TableLayout=tbllayout_AutoFit;this.TableDescription="";this.TableCaption="";this.PrChange=undefined;this.ReviewInfo=undefined};CTablePr.prototype.Set_FromObject=function(TablePr){this.TableStyleColBandSize= TablePr.TableStyleColBandSize;this.TableStyleRowBandSize=TablePr.TableStyleRowBandSize;this.Jc=TablePr.Jc;if(undefined!=TablePr.Shd){this.Shd=new CDocumentShd;this.Shd.Set_FromObject(TablePr.Shd)}else this.Shd=undefined;if(undefined!=TablePr.TableBorders){if(undefined!=TablePr.TableBorders.Bottom){this.TableBorders.Bottom=new CDocumentBorder;this.TableBorders.Bottom.Set_FromObject(TablePr.TableBorders.Bottom)}else this.TableBorders.Bottom=undefined;if(undefined!=TablePr.TableBorders.Left){this.TableBorders.Left= new CDocumentBorder;this.TableBorders.Left.Set_FromObject(TablePr.TableBorders.Left)}else this.TableBorders.Left=undefined;if(undefined!=TablePr.TableBorders.Right){this.TableBorders.Right=new CDocumentBorder;this.TableBorders.Right.Set_FromObject(TablePr.TableBorders.Right)}else this.TableBorders.Right=undefined;if(undefined!=TablePr.TableBorders.Top){this.TableBorders.Top=new CDocumentBorder;this.TableBorders.Top.Set_FromObject(TablePr.TableBorders.Top)}else this.TableBorders.Top=undefined;if(undefined!= TablePr.TableBorders.InsideH){this.TableBorders.InsideH=new CDocumentBorder;this.TableBorders.InsideH.Set_FromObject(TablePr.TableBorders.InsideH)}else this.TableBorders.InsideH=undefined;if(undefined!=TablePr.TableBorders.InsideV){this.TableBorders.InsideV=new CDocumentBorder;this.TableBorders.InsideV.Set_FromObject(TablePr.TableBorders.InsideV)}else this.TableBorders.InsideV=undefined}else{this.TableBorders.Bottom=undefined;this.TableBorders.Left=undefined;this.TableBorders.Right=undefined;this.TableBorders.Top= undefined;this.TableBorders.InsideH=undefined;this.TableBorders.InsideV=undefined}if(undefined!=TablePr.TableCellMar){if(undefined!=TablePr.TableCellMar.Bottom)this.TableCellMar.Bottom=new CTableMeasurement(TablePr.TableCellMar.Bottom.Type,TablePr.TableCellMar.Bottom.W);else this.TableCellMar.Bottom=undefined;if(undefined!=TablePr.TableCellMar.Left)this.TableCellMar.Left=new CTableMeasurement(TablePr.TableCellMar.Left.Type,TablePr.TableCellMar.Left.W);else this.TableCellMar.Left=undefined;if(undefined!= TablePr.TableCellMar.Right)this.TableCellMar.Right=new CTableMeasurement(TablePr.TableCellMar.Right.Type,TablePr.TableCellMar.Right.W);else this.TableCellMar.Right=undefined;if(undefined!=TablePr.TableCellMar.Top)this.TableCellMar.Top=new CTableMeasurement(TablePr.TableCellMar.Top.Type,TablePr.TableCellMar.Top.W);else this.TableCellMar.Top=undefined}else{this.TableCellMar.Bottom=undefined;this.TableCellMar.Left=undefined;this.TableCellMar.Right=undefined;this.TableCellMar.Top=undefined}this.TableCellSpacing= TablePr.TableCellSpacing;this.TableInd=TablePr.TableInd;if(undefined!=TablePr.TableW)this.TableW=new CTableMeasurement(TablePr.TableW.Type,TablePr.TableW.W);else this.TableW=undefined;this.TableLayout=TablePr.TableLayout;this.TableDescription=TablePr.TableDescription;this.TableCaption=TablePr.TableCaption};CTablePr.prototype.Check_PresentationPr=function(Theme){if(this.Shd)this.Shd.Check_PresentationPr(Theme);if(this.TableBorders.Bottom)this.TableBorders.Bottom.Check_PresentationPr(Theme);if(this.TableBorders.Left)this.TableBorders.Left.Check_PresentationPr(Theme); if(this.TableBorders.Right)this.TableBorders.Right.Check_PresentationPr(Theme);if(this.TableBorders.Top)this.TableBorders.Top.Check_PresentationPr(Theme);if(this.TableBorders.InsideH)this.TableBorders.InsideH.Check_PresentationPr(Theme);if(this.TableBorders.InsideV)this.TableBorders.InsideV.Check_PresentationPr(Theme)};CTablePr.prototype.Write_ToBinary=function(Writer){var StartPos=Writer.GetCurPosition();Writer.Skip(4);var Flags=0;if(undefined!=this.TableStyleColBandSize){Writer.WriteLong(this.TableStyleColBandSize); Flags|=1}if(undefined!=this.TableStyleRowBandSize){Writer.WriteLong(this.TableStyleRowBandSize);Flags|=2}if(undefined!=this.Jc){Writer.WriteLong(this.Jc);Flags|=4}if(undefined!=this.Shd){this.Shd.Write_ToBinary(Writer);Flags|=8}if(undefined!=this.TableBorders.Bottom){this.TableBorders.Bottom.Write_ToBinary(Writer);Flags|=16}if(undefined!=this.TableBorders.Left){this.TableBorders.Left.Write_ToBinary(Writer);Flags|=32}if(undefined!=this.TableBorders.Right){this.TableBorders.Right.Write_ToBinary(Writer); Flags|=64}if(undefined!=this.TableBorders.Top){this.TableBorders.Top.Write_ToBinary(Writer);Flags|=128}if(undefined!=this.TableBorders.InsideH){this.TableBorders.InsideH.Write_ToBinary(Writer);Flags|=256}if(undefined!=this.TableBorders.InsideV){this.TableBorders.InsideV.Write_ToBinary(Writer);Flags|=512}if(undefined!=this.TableCellMar.Bottom){this.TableCellMar.Bottom.Write_ToBinary(Writer);Flags|=1024}if(undefined!=this.TableCellMar.Left){this.TableCellMar.Left.Write_ToBinary(Writer);Flags|=2048}if(undefined!= this.TableCellMar.Right){this.TableCellMar.Right.Write_ToBinary(Writer);Flags|=4096}if(undefined!=this.TableCellMar.Top){this.TableCellMar.Top.Write_ToBinary(Writer);Flags|=8192}if(undefined!=this.TableCellSpacing){if(null===this.TableCellSpacing)Writer.WriteBool(true);else{Writer.WriteBool(false);Writer.WriteDouble(this.TableCellSpacing)}Flags|=16384}if(undefined!=this.TableInd){Writer.WriteDouble(this.TableInd);Flags|=32768}if(undefined!=this.TableW){this.TableW.Write_ToBinary(Writer);Flags|=65536}if(undefined!= this.TableLayout){Writer.WriteLong(this.TableLayout);Flags|=131072}if(undefined!==this.TableDescription){Writer.WriteString2(this.TableDescription);Flags|=262144}if(undefined!==this.TableCaption){Writer.WriteString2(this.TableCaption);Flags|=524288}if(undefined!==this.PrChange&&undefined!==this.ReviewInfo){this.PrChange.WriteToBinary(Writer);this.ReviewInfo.WriteToBinary(Writer);Flags|=1048576}var EndPos=Writer.GetCurPosition();Writer.Seek(StartPos);Writer.WriteLong(Flags);Writer.Seek(EndPos)};CTablePr.prototype.Read_FromBinary= function(Reader){var Flags=Reader.GetLong();if(1&Flags)this.TableStyleColBandSize=Reader.GetLong();if(2&Flags)this.TableStyleRowBandSize=Reader.GetLong();if(4&Flags)this.Jc=Reader.GetLong();if(8&Flags){this.Shd=new CDocumentShd;this.Shd.Read_FromBinary(Reader)}if(16&Flags){this.TableBorders.Bottom=new CDocumentBorder;this.TableBorders.Bottom.Read_FromBinary(Reader)}if(32&Flags){this.TableBorders.Left=new CDocumentBorder;this.TableBorders.Left.Read_FromBinary(Reader)}if(64&Flags){this.TableBorders.Right= new CDocumentBorder;this.TableBorders.Right.Read_FromBinary(Reader)}if(128&Flags){this.TableBorders.Top=new CDocumentBorder;this.TableBorders.Top.Read_FromBinary(Reader)}if(256&Flags){this.TableBorders.InsideH=new CDocumentBorder;this.TableBorders.InsideH.Read_FromBinary(Reader)}if(512&Flags){this.TableBorders.InsideV=new CDocumentBorder;this.TableBorders.InsideV.Read_FromBinary(Reader)}if(1024&Flags){this.TableCellMar.Bottom=new CTableMeasurement(tblwidth_Auto,0);this.TableCellMar.Bottom.Read_FromBinary(Reader)}if(2048& Flags){this.TableCellMar.Left=new CTableMeasurement(tblwidth_Auto,0);this.TableCellMar.Left.Read_FromBinary(Reader)}if(4096&Flags){this.TableCellMar.Right=new CTableMeasurement(tblwidth_Auto,0);this.TableCellMar.Right.Read_FromBinary(Reader)}if(8192&Flags){this.TableCellMar.Top=new CTableMeasurement(tblwidth_Auto,0);this.TableCellMar.Top.Read_FromBinary(Reader)}if(16384&Flags)if(true===Reader.GetBool())this.TableCellSpacing=null;else this.TableCellSpacing=Reader.GetDouble();if(32768&Flags)this.TableInd= Reader.GetDouble();if(65536&Flags){this.TableW=new CTableMeasurement(tblwidth_Auto,0);this.TableW.Read_FromBinary(Reader)}if(131072&Flags)this.TableLayout=Reader.GetLong();if(262144&Flags)this.TableDescription=Reader.GetString2();if(524288&Flags)this.TableCaption=Reader.GetString2();if(1048576&Flags){this.PrChange=new CTablePr;this.ReviewInfo=new CReviewInfo;this.PrChange.ReadFromBinary(Reader);this.ReviewInfo.ReadFromBinary(Reader)}};CTablePr.prototype.WriteToBinary=function(oWriter){this.Write_ToBinary(oWriter)}; CTablePr.prototype.ReadFromBinary=function(oReader){this.Read_FromBinary(oReader)};CTablePr.prototype.HavePrChange=function(){if(undefined===this.PrChange||null===this.PrChange)return false;return true};CTablePr.prototype.AddPrChange=function(){this.PrChange=this.Copy(false);this.ReviewInfo=new CReviewInfo;this.ReviewInfo.Update()};CTablePr.prototype.SetPrChange=function(oPrChange,oReviewInfo){this.PrChange=oPrChange;this.ReviewInfo=oReviewInfo};CTablePr.prototype.RemovePrChange=function(){delete this.PrChange; delete this.ReviewInfo};function CTableRowHeight(Value,HRule){this.Value=Value;this.HRule=HRule}CTableRowHeight.prototype={Copy:function(){return new CTableRowHeight(this.Value,this.HRule)},Is_Equal:function(Other){if(this.Value!==Other.Value||this.HRule!==Other.HRule)return false;return true},Write_ToBinary:function(Writer){Writer.WriteDouble(this.Value);Writer.WriteLong(this.HRule)},Read_FromBinary:function(Reader){this.Value=Reader.GetDouble();this.HRule=Reader.GetLong()}};CTableRowHeight.prototype.IsAuto= function(){return this.HRule===Asc.linerule_Auto?true:false};CTableRowHeight.prototype.GetValue=function(){return this.Value};CTableRowHeight.prototype.GetRule=function(){return this.HRule};function CTableRowPr(){this.CantSplit=undefined;this.GridAfter=undefined;this.GridBefore=undefined;this.Jc=undefined;this.TableCellSpacing=undefined;this.Height=undefined;this.WAfter=undefined;this.WBefore=undefined;this.TableHeader=undefined;this.PrChange=undefined;this.ReviewInfo=undefined}CTableRowPr.prototype.Copy= function(bCopyPrChange){var RowPr=new CTableRowPr;RowPr.CantSplit=this.CantSplit;RowPr.GridAfter=this.GridAfter;RowPr.GridBefore=this.GridBefore;RowPr.Jc=this.Jc;RowPr.TableCellSpacing=this.TableCellSpacing;if(undefined!=this.Height)RowPr.Height=this.Height.Copy();if(undefined!=this.WAfter)RowPr.WAfter=this.WAfter.Copy();if(undefined!=this.WBefore)RowPr.WBefore=this.WBefore.Copy();RowPr.TableHeader=this.TableHeader;if(true===bCopyPrChange&&undefined!==this.PrChange){RowPr.PrChange=this.PrChange.Copy(); RowPr.ReviewInfo=this.ReviewInfo.Copy()}return RowPr};CTableRowPr.prototype.Merge=function(RowPr){if(undefined!==RowPr.CantSplit)this.CantSplit=RowPr.CantSplit;if(undefined!==RowPr.GridAfter)this.GridAfter=RowPr.GridAfter;if(undefined!==RowPr.GridBefore)this.GridBefore=RowPr.GridBefore;if(undefined!==RowPr.Jc)this.Jc=RowPr.Jc;if(undefined!==RowPr.TableCellSpacing)this.TableCellSpacing=RowPr.TableCellSpacing;if(undefined!==RowPr.Height)this.Height=RowPr.Height.Copy();if(undefined!==RowPr.WAfter)this.WAfter= RowPr.WAfter.Copy();if(undefined!==RowPr.WBefore)this.WBefore=RowPr.WBefore.Copy();if(undefined!==RowPr.TableHeader)this.TableHeader=RowPr.TableHeader};CTableRowPr.prototype.Is_Equal=function(RowPr){if(this.CantSplit!==RowPr.CantSplit||this.GridAfter!==RowPr.GridAfter||this.GridBefore!==RowPr.GridBefore||this.Jc!==RowPr.Jc||this.TableCellSpacing!==RowPr.TableCellSpacing||true!==IsEqualStyleObjects(this.Height,RowPr.Height)||true!==IsEqualStyleObjects(this.WAfter,RowPr.WAfter)||true!==IsEqualStyleObjects(this.WBefore, RowPr.WBefore)||this.TableHeader!==RowPr.TableHeader)return false;return true};CTableRowPr.prototype.InitDefault=function(nCompatibilityMode){this.CantSplit=false;this.GridAfter=0;this.GridBefore=0;this.Jc=align_Left;this.TableCellSpacing=null;this.Height=new CTableRowHeight(0,Asc.linerule_Auto);this.WAfter=new CTableMeasurement(tblwidth_Auto,0);this.WBefore=new CTableMeasurement(tblwidth_Auto,0);this.TableHeader=false;this.PrChange=undefined;this.ReviewInfo=undefined};CTableRowPr.prototype.Set_FromObject= function(RowPr){this.CantSplit=RowPr.CantSplit;this.GridAfter=RowPr.GridAfter;this.GridBefore=RowPr.GridBefore;this.Jc=RowPr.Jc;this.TableCellSpacing=RowPr.TableCellSpacing;if(undefined!=RowPr.Height)this.Height=new CTableRowHeight(RowPr.Height.Value,RowPr.Height.HRule);else this.Height=undefined;if(undefined!=RowPr.WAfter)this.WAfter=new CTableMeasurement(RowPr.WAfter.Type,RowPr.WAfter.W);else this.WAfter=undefined;if(undefined!=RowPr.WBefore)this.WBefore=new CTableMeasurement(RowPr.WBefore.Type, RowPr.WBefore.W);else this.WBefore=undefined;this.TableHeader=RowPr.TableHeader};CTableRowPr.prototype.Write_ToBinary=function(Writer){var StartPos=Writer.GetCurPosition();Writer.Skip(4);var Flags=0;if(undefined!=this.CantSplit){Writer.WriteBool(this.CantSplit);Flags|=1}if(undefined!=this.GridAfter){Writer.WriteLong(this.GridAfter);Flags|=2}if(undefined!=this.GridBefore){Writer.WriteLong(this.GridBefore);Flags|=4}if(undefined!=this.Jc){Writer.WriteLong(this.Jc);Flags|=8}if(undefined!=this.TableCellSpacing){if(null=== this.TableCellSpacing)Writer.WriteBool(true);else{Writer.WriteBool(false);Writer.WriteDouble(this.TableCellSpacing)}Flags|=16}if(undefined!=this.Height){this.Height.Write_ToBinary(Writer);Flags|=32}if(undefined!=this.WAfter){this.WAfter.Write_ToBinary(Writer);Flags|=64}if(undefined!=this.WBefore){this.WBefore.Write_ToBinary(Writer);Flags|=128}if(undefined!=this.TableHeader){Writer.WriteBool(this.TableHeader);Flags|=256}if(undefined!==this.PrChange&&undefined!==this.ReviewInfo){this.PrChange.WriteToBinary(Writer); this.ReviewInfo.WriteToBinary(Writer);Flags|=512}var EndPos=Writer.GetCurPosition();Writer.Seek(StartPos);Writer.WriteLong(Flags);Writer.Seek(EndPos)};CTableRowPr.prototype.Read_FromBinary=function(Reader){var Flags=Reader.GetLong();if(1&Flags)this.CantSplit=Reader.GetBool();if(2&Flags)this.GridAfter=Reader.GetLong();if(4&Flags)this.GridBefore=Reader.GetLong();if(8&Flags)this.Jc=Reader.GetLong();if(16&Flags)if(true===Reader.GetBool())this.TableCellSpacing=Reader.GetLong();else this.TableCellSpacing= Reader.GetDouble();if(32&Flags){this.Height=new CTableRowHeight(0,Asc.linerule_Auto);this.Height.Read_FromBinary(Reader)}if(64&Flags){this.WAfter=new CTableMeasurement(tblwidth_Auto,0);this.WAfter.Read_FromBinary(Reader)}if(128&Flags){this.WBefore=new CTableMeasurement(tblwidth_Auto,0);this.WBefore.Read_FromBinary(Reader)}if(256&Flags)this.TableHeader=Reader.GetBool();if(512&Flags){this.PrChange=new CTableRowPr;this.ReviewInfo=new CReviewInfo;this.PrChange.ReadFromBinary(Reader);this.ReviewInfo.ReadFromBinary(Reader)}}; CTableRowPr.prototype.WriteToBinary=function(oWriter){this.Write_ToBinary(oWriter)};CTableRowPr.prototype.ReadFromBinary=function(oReader){this.Read_FromBinary(oReader)};CTableRowPr.prototype.HavePrChange=function(){if(undefined===this.PrChange||null===this.PrChange)return false;return true};CTableRowPr.prototype.AddPrChange=function(){this.PrChange=this.Copy(false);this.ReviewInfo=new CReviewInfo;this.ReviewInfo.Update()};CTableRowPr.prototype.SetPrChange=function(oPrChange,oReviewInfo){this.PrChange= oPrChange;this.ReviewInfo=oReviewInfo};CTableRowPr.prototype.RemovePrChange=function(){delete this.PrChange;delete this.ReviewInfo};function CTableCellPr(){this.GridSpan=undefined;this.Shd=undefined;this.TableCellMar=undefined;this.TableCellBorders={Bottom:undefined,Left:undefined,Right:undefined,Top:undefined};this.TableCellW=undefined;this.VAlign=undefined;this.VMerge=undefined;this.TextDirection=undefined;this.NoWrap=undefined;this.HMerge=undefined;this.PrChange=undefined;this.ReviewInfo=undefined} CTableCellPr.prototype.Copy=function(bCopyPrChange){var CellPr=new CTableCellPr;CellPr.GridSpan=this.GridSpan;if(undefined!=this.Shd)CellPr.Shd=this.Shd.Copy();if(undefined===this.TableCellMar)CellPr.TableCellMar=undefined;else if(null===this.TableCellMar)CellPr.TableCellMar=null;else{CellPr.TableCellMar={};CellPr.TableCellMar.Bottom=undefined!=this.TableCellMar.Bottom?this.TableCellMar.Bottom.Copy():undefined;CellPr.TableCellMar.Left=undefined!=this.TableCellMar.Left?this.TableCellMar.Left.Copy(): undefined;CellPr.TableCellMar.Right=undefined!=this.TableCellMar.Right?this.TableCellMar.Right.Copy():undefined;CellPr.TableCellMar.Top=undefined!=this.TableCellMar.Top?this.TableCellMar.Top.Copy():undefined}if(undefined!=this.TableCellBorders.Bottom)CellPr.TableCellBorders.Bottom=this.TableCellBorders.Bottom.Copy();if(undefined!=this.TableCellBorders.Left)CellPr.TableCellBorders.Left=this.TableCellBorders.Left.Copy();if(undefined!=this.TableCellBorders.Right)CellPr.TableCellBorders.Right=this.TableCellBorders.Right.Copy(); if(undefined!=this.TableCellBorders.Top)CellPr.TableCellBorders.Top=this.TableCellBorders.Top.Copy();if(undefined!=this.TableCellW)CellPr.TableCellW=this.TableCellW.Copy();CellPr.VAlign=this.VAlign;CellPr.VMerge=this.VMerge;CellPr.TextDirection=this.TextDirection;CellPr.NoWrap=this.NoWrap;CellPr.HMerge=this.HMerge;if(true===bCopyPrChange&&undefined!==this.PrChange){CellPr.PrChange=this.PrChange.Copy();CellPr.ReviewInfo=this.ReviewInfo.Copy()}return CellPr};CTableCellPr.prototype.Merge=function(CellPr){if(undefined!= CellPr.GridSpan)this.GridSpan=CellPr.GridSpan;if(undefined!=CellPr.Shd)this.Shd=CellPr.Shd.Copy();if(undefined===CellPr.TableCellMar);else if(null===CellPr.TableCellMar)this.TableCellMar=null;else{this.TableCellMar={};this.TableCellMar.Bottom=undefined!=CellPr.TableCellMar.Bottom?CellPr.TableCellMar.Bottom.Copy():undefined;this.TableCellMar.Left=undefined!=CellPr.TableCellMar.Left?CellPr.TableCellMar.Left.Copy():undefined;this.TableCellMar.Right=undefined!=CellPr.TableCellMar.Right?CellPr.TableCellMar.Right.Copy(): undefined;this.TableCellMar.Top=undefined!=CellPr.TableCellMar.Top?CellPr.TableCellMar.Top.Copy():undefined}if(undefined!=CellPr.TableCellBorders.Bottom)this.TableCellBorders.Bottom=CellPr.TableCellBorders.Bottom.Copy();if(undefined!=CellPr.TableCellBorders.Left)this.TableCellBorders.Left=CellPr.TableCellBorders.Left.Copy();if(undefined!=CellPr.TableCellBorders.Right)this.TableCellBorders.Right=CellPr.TableCellBorders.Right.Copy();if(undefined!=CellPr.TableCellBorders.Top)this.TableCellBorders.Top= CellPr.TableCellBorders.Top.Copy();if(undefined!=CellPr.TableCellW)this.TableCellW=CellPr.TableCellW.Copy();if(undefined!=CellPr.VAlign)this.VAlign=CellPr.VAlign;if(undefined!=CellPr.VMerge)this.VMerge=CellPr.VMerge;if(undefined!=CellPr.TextDirection)this.TextDirection=CellPr.TextDirection;if(undefined!==CellPr.NoWrap)this.NoWrap=CellPr.NoWrap;if(undefined!=CellPr.HMerge)this.HMerge=CellPr.HMerge};CTableCellPr.prototype.Is_Equal=function(CellPr){if(this.GridSpan!==CellPr.GridSpan||true!==IsEqualStyleObjects(this.Shd, CellPr.Shd)||this.TableCellMar!==undefined&&CellPr.TableCellMar===undefined||CellPr.TableCellMar!==undefined&&this.TableCellMar===undefined||this.TableCellMar!==null&&CellPr.TableCellMar===null||CellPr.TableCellMar!==null&&this.TableCellMar===null||this.TableCellMar!==undefined&&this.TableCellMar!==null&&(true!==IsEqualStyleObjects(this.TableCellMar.Top,CellPr.TableCellMar.Top)||true!==IsEqualStyleObjects(this.TableCellMar.Left,CellPr.TableCellMar.Left)||true!==IsEqualStyleObjects(this.TableCellMar.Right, CellPr.TableCellMar.Right)||true!==IsEqualStyleObjects(this.TableCellMar.Bottom,CellPr.TableCellMar.Bottom))||true!==IsEqualStyleObjects(this.TableCellBorders.Bottom,CellPr.TableCellBorders.Bottom)||true!==IsEqualStyleObjects(this.TableCellBorders.Left,CellPr.TableCellBorders.Left)||true!==IsEqualStyleObjects(this.TableCellBorders.Right,CellPr.TableCellBorders.Right)||true!==IsEqualStyleObjects(this.TableCellBorders.Top,CellPr.TableCellBorders.Top)||true!==IsEqualStyleObjects(this.TableCellW,CellPr.TableCellW)|| this.VAlign!==CellPr.VAlign||this.VMerge!==CellPr.VMerge||this.TextDirection!==CellPr.TextDirection||this.NoWrap!==CellPr.NoWrap||this.HMerge!==CellPr.HMerge)return false;return true};CTableCellPr.prototype.InitDefault=function(nCompatibilityMode){this.GridSpan=1;this.Shd=new CDocumentShd;this.TableCellMar=null;this.TableCellBorders.Bottom=undefined;this.TableCellBorders.Left=undefined;this.TableCellBorders.Right=undefined;this.TableCellBorders.Top=undefined;this.TableCellW=new CTableMeasurement(tblwidth_Auto, 0);this.VAlign=vertalignjc_Top;this.VMerge=vmerge_Restart;this.TextDirection=textdirection_LRTB;this.NoWrap=false;this.HMerge=vmerge_Restart;this.PrChange=undefined;this.ReviewInfo=undefined};CTableCellPr.prototype.Set_FromObject=function(CellPr){this.GridSpan=CellPr.GridSpan;if(undefined!=CellPr.Shd){this.Shd=new CDocumentShd;this.Shd.Set_FromObject(CellPr.Shd)}else this.Shd=undefined;if(undefined===CellPr.TableCellMar)this.TableCellMar=undefined;else if(null===CellPr.TableCellMar)this.TableCellMar= null;else{this.TableCellMar={};if(undefined!=CellPr.TableCellMar.Bottom)this.TableCellMar.Bottom=new CTableMeasurement(CellPr.TableCellMar.Bottom.Type,CellPr.TableCellMar.Bottom.W);else this.TableCellMar.Bottom=undefined;if(undefined!=CellPr.TableCellMar.Left)this.TableCellMar.Left=new CTableMeasurement(CellPr.TableCellMar.Left.Type,CellPr.TableCellMar.Left.W);else this.TableCellMar.Left=undefined;if(undefined!=CellPr.TableCellMar.Right)this.TableCellMar.Right=new CTableMeasurement(CellPr.TableCellMar.Right.Type, CellPr.TableCellMar.Right.W);else this.TableCellMar.Right=undefined;if(undefined!=CellPr.TableCellMar.Top)this.TableCellMar.Top=new CTableMeasurement(CellPr.TableCellMar.Top.Type,CellPr.TableCellMar.Top.W);else this.TableCellMar.Top=undefined}if(undefined!=CellPr.TableCellBorders){if(undefined!=CellPr.TableCellBorders.Bottom){this.TableCellBorders.Bottom=new CDocumentBorder;this.TableCellBorders.Bottom.Set_FromObject(CellPr.TableCellBorders.Bottom)}else this.TableCellBorders.Bottom=undefined;if(undefined!= CellPr.TableCellBorders.Left){this.TableCellBorders.Left=new CDocumentBorder;this.TableCellBorders.Left.Set_FromObject(CellPr.TableCellBorders.Left)}else this.TableCellBorders.Left=undefined;if(undefined!=CellPr.TableCellBorders.Right){this.TableCellBorders.Right=new CDocumentBorder;this.TableCellBorders.Right.Set_FromObject(CellPr.TableCellBorders.Right)}else this.TableCellBorders.Right=undefined;if(undefined!=CellPr.TableCellBorders.Top){this.TableCellBorders.Top=new CDocumentBorder;this.TableCellBorders.Top.Set_FromObject(CellPr.TableCellBorders.Top)}else this.TableCellBorders.Top= undefined}else{this.TableCellBorders.Bottom=undefined;this.TableCellBorders.Left=undefined;this.TableCellBorders.Right=undefined;this.TableCellBorders.Top=undefined}if(undefined!=CellPr.TableCellW)this.TableCellW=new CTableMeasurement(CellPr.TableCellW.Type,CellPr.TableCellW.W);else this.TableCellW=undefined;this.VAlign=CellPr.VAlign;this.VMerge=CellPr.VMerge;this.TextDirection=CellPr.TextDirection;this.NoWrap=CellPr.NoWrap;this.HMerge=CellPr.HMerge};CTableCellPr.prototype.Check_PresentationPr=function(Theme){if(this.Shd)this.Shd.Check_PresentationPr(Theme); if(this.TableCellBorders.Bottom)this.TableCellBorders.Bottom.Check_PresentationPr(Theme);if(this.TableCellBorders.Left)this.TableCellBorders.Left.Check_PresentationPr(Theme);if(this.TableCellBorders.Right)this.TableCellBorders.Right.Check_PresentationPr(Theme);if(this.TableCellBorders.Top)this.TableCellBorders.Top.Check_PresentationPr(Theme)};CTableCellPr.prototype.Write_ToBinary=function(Writer){var StartPos=Writer.GetCurPosition();Writer.Skip(4);var Flags=0;if(undefined!=this.GridSpan){Writer.WriteLong(this.GridSpan); Flags|=1}if(undefined!=this.Shd){this.Shd.Write_ToBinary(Writer);Flags|=2}if(undefined!=this.TableCellMar)if(null===this.TableCellMar)Flags|=4;else{if(undefined!=this.TableCellMar.Bottom){this.TableCellMar.Bottom.Write_ToBinary(Writer);Flags|=8}if(undefined!=this.TableCellMar.Left){this.TableCellMar.Left.Write_ToBinary(Writer);Flags|=16}if(undefined!=this.TableCellMar.Right){this.TableCellMar.Right.Write_ToBinary(Writer);Flags|=32}if(undefined!=this.TableCellMar.Top){this.TableCellMar.Top.Write_ToBinary(Writer); Flags|=64}Flags|=128}if(undefined!=this.TableCellBorders.Bottom){this.TableCellBorders.Bottom.Write_ToBinary(Writer);Flags|=256}if(undefined!=this.TableCellBorders.Left){this.TableCellBorders.Left.Write_ToBinary(Writer);Flags|=512}if(undefined!=this.TableCellBorders.Right){this.TableCellBorders.Right.Write_ToBinary(Writer);Flags|=1024}if(undefined!=this.TableCellBorders.Top){this.TableCellBorders.Top.Write_ToBinary(Writer);Flags|=2048}if(undefined!=this.TableCellW){this.TableCellW.Write_ToBinary(Writer); Flags|=4096}if(undefined!=this.VAlign){Writer.WriteLong(this.VAlign);Flags|=8192}if(undefined!=this.VMerge){Writer.WriteLong(this.VMerge);Flags|=16384}if(undefined!==this.TextDirection){Writer.WriteLong(this.TextDirection);Flags|=32768}if(undefined!==this.NoWrap){Writer.WriteBool(this.NoWrap);Flags|=65536}if(undefined!==this.HMerge){Writer.WriteLong(this.HMerge);Flags|=131072}if(undefined!==this.PrChange&&undefined!==this.ReviewInfo){this.PrChange.WriteToBinary(Writer);this.ReviewInfo.WriteToBinary(Writer); Flags|=262144}var EndPos=Writer.GetCurPosition();Writer.Seek(StartPos);Writer.WriteLong(Flags);Writer.Seek(EndPos)};CTableCellPr.prototype.Read_FromBinary=function(Reader){var Flags=Reader.GetLong();if(1&Flags)this.GridSpan=Reader.GetLong();if(2&Flags){this.Shd=new CDocumentShd;this.Shd.Read_FromBinary(Reader)}if(4&Flags)this.TableCellMar=null;else if(128&Flags){this.TableCellMar={};if(8&Flags){this.TableCellMar.Bottom=new CTableMeasurement(tblwidth_Auto,0);this.TableCellMar.Bottom.Read_FromBinary(Reader)}if(16& Flags){this.TableCellMar.Left=new CTableMeasurement(tblwidth_Auto,0);this.TableCellMar.Left.Read_FromBinary(Reader)}if(32&Flags){this.TableCellMar.Right=new CTableMeasurement(tblwidth_Auto,0);this.TableCellMar.Right.Read_FromBinary(Reader)}if(64&Flags){this.TableCellMar.Top=new CTableMeasurement(tblwidth_Auto,0);this.TableCellMar.Top.Read_FromBinary(Reader)}}if(256&Flags){this.TableCellBorders.Bottom=new CDocumentBorder;this.TableCellBorders.Bottom.Read_FromBinary(Reader)}if(512&Flags){this.TableCellBorders.Left= new CDocumentBorder;this.TableCellBorders.Left.Read_FromBinary(Reader)}if(1024&Flags){this.TableCellBorders.Right=new CDocumentBorder;this.TableCellBorders.Right.Read_FromBinary(Reader)}if(2048&Flags){this.TableCellBorders.Top=new CDocumentBorder;this.TableCellBorders.Top.Read_FromBinary(Reader)}if(4096&Flags){this.TableCellW=new CTableMeasurement(tblwidth_Auto,0);this.TableCellW.Read_FromBinary(Reader)}if(8192&Flags)this.VAlign=Reader.GetLong();if(16384&Flags)this.VMerge=Reader.GetLong();if(32768& Flags)this.TextDirection=Reader.GetLong();if(65536&Flags)this.NoWrap=Reader.GetBool();if(131072&Flags)this.HMerge=Reader.GetLong();if(262144&Flags){this.PrChange=new CTableCellPr;this.ReviewInfo=new CReviewInfo;this.PrChange.ReadFromBinary(Reader);this.ReviewInfo.ReadFromBinary(Reader)}};CTableCellPr.prototype.WriteToBinary=function(oWriter){this.Write_ToBinary(oWriter)};CTableCellPr.prototype.ReadFromBinary=function(oReader){this.Read_FromBinary(oReader)};CTableCellPr.prototype.Is_Empty=function(){if(undefined!== this.GridSpan||undefined!==this.Shd||undefined!==this.TableCellMar||undefined!==this.TableCellBorders.Bottom||undefined!==this.TableCellBorders.Left||undefined!==this.TableCellBorders.Right||undefined!==this.TableCellBorders.Top||undefined!==this.TableCellW||undefined!==this.VAlign||undefined!==this.VMerge||undefined!==this.TextDirection||undefined!==this.NoWrap||undefined!==this.HMerge)return false;return true};CTableCellPr.prototype.HavePrChange=function(){if(undefined===this.PrChange||null===this.PrChange)return false; return true};CTableCellPr.prototype.AddPrChange=function(){this.PrChange=this.Copy(false);this.ReviewInfo=new CReviewInfo;this.ReviewInfo.Update()};CTableCellPr.prototype.SetPrChange=function(oPrChange,oReviewInfo){this.PrChange=oPrChange;this.ReviewInfo=oReviewInfo};CTableCellPr.prototype.RemovePrChange=function(){delete this.PrChange;delete this.ReviewInfo};function CRFonts(){this.Ascii=undefined;this.EastAsia=undefined;this.HAnsi=undefined;this.CS=undefined;this.Hint=undefined;this.AsciiTheme= undefined;this.EastAsiaTheme=undefined;this.HAnsiTheme=undefined;this.CSTheme=undefined}CRFonts.prototype.Is_Empty=function(){return undefined===this.Ascii&&undefined===this.EastAsia&&undefined===this.HAnsi&&undefined===this.CS&&undefined===this.Hint&&undefined===this.AsciiTheme&&undefined===this.EastAsiaTheme&&undefined===this.HAnsiTheme&&undefined===this.CSTheme};CRFonts.prototype.Copy=function(){var oRFonts=new CRFonts;if(undefined!==this.Ascii)oRFonts.Ascii={Name:this.Ascii.Name,Index:this.Ascii.Index}; if(undefined!==this.EastAsia)oRFonts.EastAsia={Name:this.EastAsia.Name,Index:this.EastAsia.Index};if(undefined!==this.HAnsi)oRFonts.HAnsi={Name:this.HAnsi.Name,Index:this.HAnsi.Index};if(undefined!==this.CS)oRFonts.CS={Name:this.CS.Name,Index:this.CS.Index};oRFonts.Hint=this.Hint;oRFonts.AsciiTheme=this.AsciiTheme;oRFonts.EastAsiaTheme=this.EastAsiaTheme;oRFonts.HAnsiTheme=this.HAnsiTheme;oRFonts.CSTheme=this.CSTheme;return oRFonts};CRFonts.prototype.Merge=function(oRFonts){if(oRFonts.AsciiTheme){this.AsciiTheme= oRFonts.AsciiTheme;this.Ascii=undefined}else if(oRFonts.Ascii){this.Ascii=oRFonts.Ascii;this.AsciiTheme=undefined}if(oRFonts.EastAsiaTheme){this.EastAsiaTheme=oRFonts.EastAsiaTheme;this.EastAsia=undefined}else if(oRFonts.EastAsia){this.EastAsia=oRFonts.EastAsia;this.EastAsiaTheme=undefined}if(oRFonts.HAnsiTheme){this.HAnsiTheme=oRFonts.HAnsiTheme;this.HAnsi=undefined}else if(oRFonts.HAnsi){this.HAnsi=oRFonts.HAnsi;this.HAnsiTheme=undefined}if(oRFonts.CSTheme){this.CSTheme=oRFonts.CSTheme;this.CS= undefined}else if(oRFonts.CS){this.CS=oRFonts.CS;this.CSTheme=undefined}if(oRFonts.Hint)this.Hint=oRFonts.Hint};CRFonts.prototype.InitDefault=function(){this.Ascii={Name:"Times New Roman",Index:-1};this.EastAsia={Name:"Times New Roman",Index:-1};this.HAnsi={Name:"Times New Roman",Index:-1};this.CS={Name:"Times New Roman",Index:-1};this.Hint=fonthint_Default;this.AsciiTheme=undefined;this.EastAsiaTheme=undefined;this.HAnsiTheme=undefined;this.CSTheme=undefined};CRFonts.prototype.Set_FromObject=function(oRFonts, isUndefinedToNull){if(undefined!==oRFonts.Ascii)this.Ascii={Name:oRFonts.Ascii.Name,Index:oRFonts.Ascii.Index};else this.Ascii=isUndefinedToNull?null:undefined;if(undefined!==oRFonts.EastAsia)this.EastAsia={Name:oRFonts.EastAsia.Name,Index:oRFonts.EastAsia.Index};else this.EastAsia=isUndefinedToNull?null:undefined;if(undefined!==oRFonts.HAnsi)this.HAnsi={Name:oRFonts.HAnsi.Name,Index:oRFonts.HAnsi.Index};else this.HAnsi=isUndefinedToNull?null:undefined;if(undefined!==oRFonts.CS)this.CS={Name:oRFonts.CS.Name, Index:oRFonts.CS.Index};else this.CS=isUndefinedToNull?null:undefined;this.Hint=CheckUndefinedToNull(isUndefinedToNull,oRFonts.Hint);this.AsciiTheme=CheckUndefinedToNull(isUndefinedToNull,oRFonts.AsciiTheme);this.EastAsiaTheme=CheckUndefinedToNull(isUndefinedToNull,oRFonts.EastAsiaTheme);this.HAnsiTheme=CheckUndefinedToNull(isUndefinedToNull,oRFonts.HAnsiTheme);this.CSTheme=CheckUndefinedToNull(isUndefinedToNull,oRFonts.CSTheme)};CRFonts.prototype.SetAll=function(sFontName,nFontIndex){if(undefined=== nFontIndex)nFontIndex=-1;this.Ascii={Name:sFontName,Index:nFontIndex};this.EastAsia={Name:sFontName,Index:nFontIndex};this.HAnsi={Name:sFontName,Index:nFontIndex};this.CS={Name:sFontName,Index:nFontIndex};this.Hint=fonthint_Default;this.AsciiTheme=undefined;this.EastAsiaTheme=undefined;this.HAnsiTheme=undefined;this.CSTheme=undefined};CRFonts.prototype.SetFontStyle=function(nFontStyleIdx){var sFirstPart;if(nFontStyleIdx===AscFormat.fntStyleInd_major)sFirstPart="+mj-";else sFirstPart="+mn-";var oRFonts= {};oRFonts.Ascii={Name:sFirstPart+"lt",Index:-1};oRFonts.EastAsia={Name:sFirstPart+"ea",Index:-1};oRFonts.CS={Name:sFirstPart+"cs",Index:-1};oRFonts.HAnsi={Name:sFirstPart+"lt",Index:-1};this.Set_FromObject(oRFonts,false)};CRFonts.prototype.IsEqual=function(oRFonts){return this.private_IsEqual(this.Ascii,oRFonts.Ascii)&&this.private_IsEqual(this.EastAsia,oRFonts.EastAsia)&&this.private_IsEqual(this.HAnsi,oRFonts.HAnsi)&&this.private_IsEqual(this.CS,oRFonts.CS)&&this.Hint===oRFonts.Hint&&this.AsciiTheme=== oRFonts.AsciiTheme&&this.EastAsiaTheme===oRFonts.EastAsiaTheme&&this.HAnsiTheme===oRFonts.HAnsiTheme&&this.CSTheme===oRFonts.CSTheme};CRFonts.prototype.private_IsEqual=function(oFont1,oFont2){return undefined===oFont1&&undefined===oFont2||undefined!==oFont1&&undefined!==oFont2&&oFont1.Name===oFont2.Name};CRFonts.prototype.Is_Equal=function(oRFonts){return this.IsEqual(oRFonts)};CRFonts.prototype.Compare=function(oRFonts){return this.IsEqual(oRFonts)};CRFonts.prototype.Write_ToBinary=function(oWriter){var nStartPos= oWriter.GetCurPosition();oWriter.Skip(4);var nFlags=0;if(undefined!==this.Ascii){oWriter.WriteString2(this.Ascii.Name);nFlags|=1}if(undefined!==this.EastAsia){oWriter.WriteString2(this.EastAsia.Name);nFlags|=2}if(undefined!==this.HAnsi){oWriter.WriteString2(this.HAnsi.Name);nFlags|=4}if(undefined!==this.CS){oWriter.WriteString2(this.CS.Name);nFlags|=8}if(undefined!==this.Hint){oWriter.WriteLong(this.Hint);nFlags|=16}if(undefined!==this.AsciiTheme){oWriter.WriteString2(this.AsciiTheme);nFlags|=32}if(undefined!== this.EastAsiaTheme){oWriter.WriteString2(this.EastAsiaTheme);nFlags|=64}if(undefined!==this.HAnsiTheme){oWriter.WriteString2(this.HAnsiTheme);nFlags|=128}if(undefined!==this.CSTheme){oWriter.WriteString2(this.CSTheme);nFlags|=256}var nEndPos=oWriter.GetCurPosition();oWriter.Seek(nStartPos);oWriter.WriteLong(nFlags);oWriter.Seek(nEndPos)};CRFonts.prototype.Read_FromBinary=function(oReader){var nFlags=oReader.GetLong();if(nFlags&1)this.Ascii={Name:oReader.GetString2(),Index:-1};if(nFlags&2)this.EastAsia= {Name:oReader.GetString2(),Index:-1};if(nFlags&4)this.HAnsi={Name:oReader.GetString2(),Index:-1};if(nFlags&8)this.CS={Name:oReader.GetString2(),Index:-1};if(nFlags&16)this.Hint=oReader.GetLong();if(nFlags&32)this.AsciiTheme=oReader.GetString2();if(nFlags&64)this.EastAsiaTheme=oReader.GetString2();if(nFlags&128)this.HAnsiTheme=oReader.GetString2();if(nFlags&256)this.CSTheme=oReader.GetString2()};function CLang(){this.Bidi=undefined;this.EastAsia=undefined;this.Val=undefined}CLang.prototype={Copy:function(){var Lang= new CLang;Lang.Bidi=this.Bidi;Lang.EastAsia=this.EastAsia;Lang.Val=this.Val;return Lang},Merge:function(Lang){if(undefined!==Lang.Bidi)this.Bidi=Lang.Bidi;if(undefined!==Lang.EastAsia)this.EastAsia=Lang.EastAsia;if(undefined!==Lang.Val)this.Val=Lang.Val},InitDefault:function(){this.Bidi=lcid_arSA;this.EastAsia=lcid_zhCN;this.Val=lcid_enUS},Set_FromObject:function(Lang,isUndefinedToNull){this.Bidi=CheckUndefinedToNull(isUndefinedToNull,Lang.Bidi);this.EastAsia=CheckUndefinedToNull(isUndefinedToNull, Lang.EastAsia);this.Val=CheckUndefinedToNull(isUndefinedToNull,Lang.Val)},Compare:function(Lang){if(undefined!==this.Bidi&&this.Bidi!==Lang.Bidi)this.Bidi=undefined;if(undefined!==this.EastAsia&&this.EastAsia!==Lang.EastAsia)this.EastAsia=undefined;if(undefined!==this.Val&&this.Val!==Lang.Val)this.Val=undefined},Write_ToBinary:function(Writer){var StartPos=Writer.GetCurPosition();Writer.Skip(4);var Flags=0;if(undefined!=this.Bidi){Writer.WriteLong(this.Bidi);Flags|=1}if(undefined!=this.EastAsia){Writer.WriteLong(this.EastAsia); Flags|=2}if(undefined!=this.Val){Writer.WriteLong(this.Val);Flags|=4}var EndPos=Writer.GetCurPosition();Writer.Seek(StartPos);Writer.WriteLong(Flags);Writer.Seek(EndPos)},Read_FromBinary:function(Reader){var Flags=Reader.GetLong();if(Flags&1)this.Bidi=Reader.GetLong();if(Flags&2)this.EastAsia=Reader.GetLong();if(Flags&4)this.Val=Reader.GetLong()}};CLang.prototype.Is_Empty=function(){if(undefined!==this.Bidi||undefined!==this.EastAsia||undefined!==this.Val)return false;return true};CLang.prototype.IsEqual= function(oLang){return this.Bidi===oLang.Bidi&&this.EastAsia===oLang.EastAsia&&this.Val===oLang.Val};CLang.prototype.Is_Equal=function(Lang){return this.IsEqual(Lang)};function CTextPr(){this.Bold=undefined;this.Italic=undefined;this.Strikeout=undefined;this.Underline=undefined;this.FontFamily=undefined;this.FontSize=undefined;this.Color=undefined;this.VertAlign=undefined;this.HighLight=undefined;this.RStyle=undefined;this.Spacing=undefined;this.DStrikeout=undefined;this.Caps=undefined;this.SmallCaps= undefined;this.Position=undefined;this.RFonts=new CRFonts;this.BoldCS=undefined;this.ItalicCS=undefined;this.FontSizeCS=undefined;this.CS=undefined;this.RTL=undefined;this.Lang=new CLang;this.Unifill=undefined;this.FontRef=undefined;this.Shd=undefined;this.Vanish=undefined;this.TextOutline=undefined;this.TextFill=undefined;this.HighlightColor=undefined;this.FontScale=undefined;this.FontSizeOrig=undefined;this.FontSizeCSOrig=undefined;this.PrChange=undefined;this.ReviewInfo=undefined}CTextPr.prototype.Clear= function(){this.Bold=undefined;this.Italic=undefined;this.Strikeout=undefined;this.Underline=undefined;this.FontFamily=undefined;this.FontSize=undefined;this.Color=undefined;this.VertAlign=undefined;this.HighLight=undefined;this.RStyle=undefined;this.Spacing=undefined;this.DStrikeout=undefined;this.Caps=undefined;this.SmallCaps=undefined;this.Position=undefined;this.RFonts=new CRFonts;this.BoldCS=undefined;this.ItalicCS=undefined;this.FontSizeCS=undefined;this.CS=undefined;this.RTL=undefined;this.Lang= new CLang;this.Unifill=undefined;this.FontRef=undefined;this.Shd=undefined;this.Vanish=undefined;this.TextOutline=undefined;this.TextFill=undefined;this.HighlightColor=undefined;this.AscFill=undefined;this.AscUnifill=undefined;this.AscLine=undefined;this.FontScale=undefined;this.FontSizeOrig=undefined;this.FontSizeCSOrig=undefined;this.PrChange=undefined;this.ReviewInfo=undefined};CTextPr.prototype.Copy=function(bCopyPrChange,oPr){var TextPr=new CTextPr;TextPr.Bold=this.Bold;TextPr.Italic=this.Italic; TextPr.Strikeout=this.Strikeout;TextPr.Underline=this.Underline;if(undefined!=this.FontFamily){TextPr.FontFamily={};TextPr.FontFamily.Name=this.FontFamily.Name;TextPr.FontFamily.Index=this.FontFamily.Index}TextPr.FontSize=this.FontSize;if(undefined!=this.Color)TextPr.Color=new CDocumentColor(this.Color.r,this.Color.g,this.Color.b,this.Color.Auto);TextPr.VertAlign=this.VertAlign;TextPr.HighLight=this.Copy_HighLight();TextPr.RStyle=this.RStyle;if(oPr&&oPr.Comparison&&TextPr.RStyle)TextPr.RStyle=oPr.Comparison.copyStyleById(TextPr.RStyle); TextPr.Spacing=this.Spacing;TextPr.DStrikeout=this.DStrikeout;TextPr.Caps=this.Caps;TextPr.SmallCaps=this.SmallCaps;TextPr.Position=this.Position;TextPr.RFonts=this.RFonts.Copy();TextPr.BoldCS=this.BoldCS;TextPr.ItalicCS=this.ItalicCS;TextPr.FontSizeCS=this.FontSizeCS;TextPr.CS=this.CS;TextPr.RTL=this.RTL;TextPr.Lang=this.Lang.Copy();if(undefined!=this.Unifill)TextPr.Unifill=this.Unifill.createDuplicate();if(undefined!=this.FontRef)TextPr.FontRef=this.FontRef.createDuplicate();if(undefined!==this.Shd)TextPr.Shd= this.Shd.Copy();if(undefined!==this.FontScale)TextPr.FontScale=this.FontScale;TextPr.Vanish=this.Vanish;if(true===bCopyPrChange&&undefined!==this.PrChange){TextPr.PrChange=this.PrChange.Copy();TextPr.ReviewInfo=this.ReviewInfo.Copy()}if(undefined!=this.TextOutline)TextPr.TextOutline=this.TextOutline.createDuplicate();if(undefined!=this.TextFill)TextPr.TextFill=this.TextFill.createDuplicate();if(undefined!==this.HighlightColor)TextPr.HighlightColor=this.HighlightColor.createDuplicate();return TextPr}; CTextPr.prototype.Copy_HighLight=function(){if(undefined===this.HighLight)return undefined;else if(highlight_None===this.HighLight)return highlight_None;else return this.HighLight.Copy();return undefined};CTextPr.prototype.Merge=function(TextPr){if(undefined!=TextPr.Bold)this.Bold=TextPr.Bold;if(undefined!=TextPr.Italic)this.Italic=TextPr.Italic;if(undefined!=TextPr.Strikeout)this.Strikeout=TextPr.Strikeout;if(undefined!=TextPr.Underline)this.Underline=TextPr.Underline;if(undefined!=TextPr.FontFamily){this.FontFamily= {};this.FontFamily.Name=TextPr.FontFamily.Name;this.FontFamily.Index=TextPr.FontFamily.Index}if(undefined!=TextPr.FontSize)this.FontSize=TextPr.FontSize;if(undefined!=TextPr.Color)this.Color=TextPr.Color.Copy();if(undefined!=TextPr.VertAlign)this.VertAlign=TextPr.VertAlign;if(undefined===TextPr.HighLight||null===TextPr.HighLight);else if(highlight_None===TextPr.HighLight)this.HighLight=highlight_None;else this.HighLight=TextPr.HighLight.Copy();if(undefined!=TextPr.RStyle)this.RStyle=TextPr.RStyle; if(undefined!=TextPr.Spacing)this.Spacing=TextPr.Spacing;if(undefined!=TextPr.DStrikeout)this.DStrikeout=TextPr.DStrikeout;if(undefined!=TextPr.SmallCaps)this.SmallCaps=TextPr.SmallCaps;if(undefined!=TextPr.Caps)this.Caps=TextPr.Caps;if(undefined!=TextPr.Position)this.Position=TextPr.Position;this.RFonts.Merge(TextPr.RFonts);if(undefined!=TextPr.BoldCS)this.BoldCS=TextPr.BoldCS;if(undefined!=TextPr.ItalicCS)this.ItalicCS=TextPr.ItalicCS;if(undefined!=TextPr.FontSizeCS)this.FontSizeCS=TextPr.FontSizeCS; if(undefined!=TextPr.CS)this.CS=TextPr.CS;if(undefined!=TextPr.RTL)this.RTL=TextPr.RTL;if(TextPr.Lang)this.Lang.Merge(TextPr.Lang);if(TextPr.Unifill){this.Unifill=TextPr.Unifill.createDuplicate();this.TextFill=undefined}else if(undefined!=TextPr.Color)this.Unifill=undefined;if(undefined!=TextPr.FontRef)this.FontRef=TextPr.FontRef.createDuplicate();if(TextPr.Shd)this.Shd=TextPr.Shd.Copy();if(undefined!==TextPr.Vanish)this.Vanish=TextPr.Vanish;if(TextPr.TextOutline)this.TextOutline=TextPr.TextOutline.createDuplicate(); if(TextPr.TextFill){this.TextFill=TextPr.TextFill.createDuplicate();this.Unifill=undefined}if(TextPr.HighlightColor)this.HighlightColor=TextPr.HighlightColor.createDuplicate();if(undefined!==TextPr.FontScale)this.FontScale=TextPr.FontScale};CTextPr.prototype.InitDefault=function(nCompatibilityMode){this.Bold=false;this.Italic=false;this.Underline=false;this.Strikeout=false;this.FontFamily={Name:"Times New Roman",Index:-1};this.FontSize=10;this.Color=new CDocumentColor(0,0,0,true);this.VertAlign=AscCommon.vertalign_Baseline; this.HighLight=highlight_None;this.RStyle=undefined;this.Spacing=0;this.DStrikeout=false;this.SmallCaps=false;this.Caps=false;this.Position=0;this.RFonts.InitDefault();this.BoldCS=false;this.ItalicCS=false;this.FontSizeCS=10;this.CS=false;this.RTL=false;this.Lang.InitDefault();this.Unifill=undefined;this.FontRef=undefined;this.Shd=undefined;this.Vanish=false;this.TextOutline=undefined;this.TextFill=undefined;this.HighlightColor=undefined;this.FontScale=undefined;this.FontSizeOrig=undefined;this.FontSizeCSOrig= undefined;this.PrChange=undefined;this.ReviewInfo=undefined};CTextPr.prototype.Set_FromObject=function(TextPr,isUndefinedToNull){this.Bold=CheckUndefinedToNull(isUndefinedToNull,TextPr.Bold);this.Italic=CheckUndefinedToNull(isUndefinedToNull,TextPr.Italic);this.Strikeout=CheckUndefinedToNull(isUndefinedToNull,TextPr.Strikeout);this.Underline=CheckUndefinedToNull(isUndefinedToNull,TextPr.Underline);if(undefined!==TextPr.FontFamily){this.FontFamily={};this.FontFamily.Name=TextPr.FontFamily.Name;this.FontFamily.Index= TextPr.FontFamily.Index}else if(isUndefinedToNull)this.FontFamily=null;else this.FontFamily=undefined;this.FontSize=CheckUndefinedToNull(isUndefinedToNull,TextPr.FontSize);if(null===TextPr.Color||undefined===TextPr.Color)this.Color=CheckUndefinedToNull(isUndefinedToNull,TextPr.Color);else this.Color=new CDocumentColor(TextPr.Color.r,TextPr.Color.g,TextPr.Color.b,TextPr.Color.Auto);this.VertAlign=CheckUndefinedToNull(isUndefinedToNull,TextPr.VertAlign);if(undefined===TextPr.HighLight||null===TextPr.HighLight)this.HighLight= CheckUndefinedToNull(isUndefinedToNull,undefined);else if(highlight_None===TextPr.HighLight)this.HighLight=highlight_None;else this.HighLight=new CDocumentColor(TextPr.HighLight.r,TextPr.HighLight.g,TextPr.HighLight.b);this.RStyle=CheckUndefinedToNull(isUndefinedToNull,TextPr.RStyle);this.Spacing=CheckUndefinedToNull(isUndefinedToNull,TextPr.Spacing);this.DStrikeout=CheckUndefinedToNull(isUndefinedToNull,TextPr.DStrikeout);this.Caps=CheckUndefinedToNull(isUndefinedToNull,TextPr.Caps);this.SmallCaps= CheckUndefinedToNull(isUndefinedToNull,TextPr.SmallCaps);this.Position=CheckUndefinedToNull(isUndefinedToNull,TextPr.Position);if(undefined!==TextPr.RFonts)this.RFonts.Set_FromObject(TextPr.RFonts,isUndefinedToNull);this.BoldCS=CheckUndefinedToNull(isUndefinedToNull,TextPr.BoldCS);this.ItalicCS=CheckUndefinedToNull(isUndefinedToNull,TextPr.ItalicCS);this.FontSizeCS=CheckUndefinedToNull(isUndefinedToNull,TextPr.FontSizeCS);this.CS=CheckUndefinedToNull(isUndefinedToNull,TextPr.CS);this.RTL=CheckUndefinedToNull(isUndefinedToNull, TextPr.RTL);if(undefined!==TextPr.Lang)this.Lang.Set_FromObject(TextPr.Lang,isUndefinedToNull);if(undefined!==TextPr.Shd){this.Shd=new CDocumentShd;this.Shd.Set_FromObject(TextPr.Shd)}else this.Shd=isUndefinedToNull?null:undefined;this.Vanish=CheckUndefinedToNull(isUndefinedToNull,TextPr.Vanish);this.Unifill=CheckUndefinedToNull(isUndefinedToNull,TextPr.Unifill);this.FontRef=CheckUndefinedToNull(isUndefinedToNull,TextPr.FontRef);this.TextFill=CheckUndefinedToNull(isUndefinedToNull,TextPr.TextFill); this.HighlightColor=CheckUndefinedToNull(isUndefinedToNull,TextPr.HighlightColor);this.TextOutline=CheckUndefinedToNull(isUndefinedToNull,TextPr.TextOutline);this.AscFill=CheckUndefinedToNull(isUndefinedToNull,TextPr.AscFill);this.AscUnifill=CheckUndefinedToNull(isUndefinedToNull,TextPr.AscUnifill);this.AscLine=CheckUndefinedToNull(isUndefinedToNull,TextPr.AscLine);this.FontScale=CheckUndefinedToNull(isUndefinedToNull,TextPr.FontScale)};CTextPr.prototype.Check_PresentationPr=function(){if(this.FontRef&& !this.Unifill){this.RFonts.SetFontStyle(this.FontRef.idx);if(this.FontRef.Color&&!this.Unifill)this.Unifill=AscFormat.CreateUniFillByUniColorCopy(this.FontRef.Color)}};CTextPr.prototype.Compare=function(TextPr){if(undefined!==this.Bold&&this.Bold!==TextPr.Bold)this.Bold=undefined;if(undefined!==this.Italic&&this.Italic!==TextPr.Italic)this.Italic=undefined;if(undefined!==this.Strikeout&&this.Strikeout!==TextPr.Strikeout)this.Strikeout=undefined;if(undefined!==this.Underline&&this.Underline!==TextPr.Underline)this.Underline= undefined;if(undefined!==this.FontFamily&&(undefined===TextPr.FontFamily||this.FontFamily.Name!==TextPr.FontFamily.Name))this.FontFamily=undefined;if(undefined!==this.FontSize&&(undefined===TextPr.FontSize||Math.abs(this.FontSize-TextPr.FontSize)>=.001))this.FontSize=undefined;if(undefined!==this.Color&&(undefined===TextPr.Color||true!==this.Color.Compare(TextPr.Color)))this.Color=undefined;if(undefined!==this.VertAlign&&this.VertAlign!==TextPr.VertAlign)this.VertAlign=undefined;if(undefined!==this.HighLight&& (undefined===TextPr.HighLight||highlight_None===this.HighLight&&highlight_None!==TextPr.HighLight||highlight_None!==this.HighLight&&highlight_None===TextPr.HighLight||highlight_None!==this.HighLight&&highlight_None!==TextPr.HighLight&&true!==this.HighLight.Compare(TextPr.HighLight)))this.HighLight=undefined;if(undefined!==this.RStyle&&(undefined===TextPr.RStyle||this.RStyle!==TextPr.RStyle))this.RStyle=undefined;if(undefined!==this.Spacing&&(undefined===TextPr.Spacing||Math.abs(this.Spacing-TextPr.Spacing)>= .001))this.Spacing=undefined;if(undefined!==this.DStrikeout&&(undefined===TextPr.DStrikeout||this.DStrikeout!==TextPr.DStrikeout))this.DStrikeout=undefined;if(undefined!==this.Caps&&(undefined===TextPr.Caps||this.Caps!==TextPr.Caps))this.Caps=undefined;if(undefined!==this.SmallCaps&&(undefined===TextPr.SmallCaps||this.SmallCaps!==TextPr.SmallCaps))this.SmallCaps=undefined;if(undefined!==this.Position&&(undefined===TextPr.Position||Math.abs(this.Position-TextPr.Position)>=.001))this.Position=undefined; this.RFonts.Compare(TextPr.RFonts);if(undefined!==this.BoldCS&&this.BoldCS!==TextPr.BoldCS)this.BoldCS=undefined;if(undefined!==this.ItalicCS&&this.ItalicCS!==TextPr.ItalicCS)this.ItalicCS=undefined;if(undefined!==this.FontSizeCS&&(undefined===TextPr.FontSizeCS||Math.abs(this.FontSizeCS-TextPr.FontSizeCS)>=.001))this.FontSizeCS=undefined;if(undefined!==this.CS&&this.CS!==TextPr.CS)this.CS=undefined;if(undefined!==this.RTL&&this.RTL!==TextPr.RTL)this.RTL=undefined;this.Lang.Compare(TextPr.Lang);if(undefined!== this.Vanish&&this.Vanish!==TextPr.Vanish)this.Vanish=undefined;if(undefined!==this.FontScale&&this.FontScale!==TextPr.FontScale)this.FontScale=undefined;if(undefined!==this.Unifill&&!this.Unifill.IsIdentical(TextPr.Unifill)){this.Unifill=AscFormat.CompareUniFill(this.Unifill,TextPr.Unifill);if(null===this.Unifill)this.Unifill=undefined;this.Color=undefined;this.TextFill=undefined}if(undefined!==this.TextFill&&!this.TextFill.IsIdentical(TextPr.TextFill)){this.Unifill=undefined;this.Color=undefined; this.TextFill=AscFormat.CompareUniFill(this.TextFill,TextPr.TextFill);if(null===this.TextFill)this.TextFill=undefined}if(undefined!==this.HighlightColor&&!this.HighlightColor.IsIdentical(TextPr.HighlightColor)){this.HighlightColor=this.HighlightColor.compare(TextPr.HighlightColor);if(null===this.HighlightColor)this.HighlightColor=undefined}if(undefined!==this.TextOutline&&!this.TextOutline.IsIdentical(TextPr.TextOutline))if(TextPr.TextOutline!==undefined)this.TextOutline=this.TextOutline.compare(TextPr.TextOutline); else this.TextOutline=undefined;return this};CTextPr.prototype.ReplaceThemeFonts=function(oFontScheme){if(this.RFonts&&oFontScheme){if(this.RFonts.AsciiTheme){this.RFonts.Ascii={Name:oFontScheme.checkFont(this.RFonts.AsciiTheme),Index:-1};this.RFonts.AsciiTheme=undefined}else if(this.RFonts.Ascii){this.RFonts.Ascii.Name=oFontScheme.checkFont(this.RFonts.Ascii.Name);this.RFonts.Ascii.Index=-1}if(this.RFonts.EastAsiaTheme){this.RFonts.EastAsia={Name:oFontScheme.checkFont(this.RFonts.EastAsiaTheme), Index:-1};this.RFonts.EastAsiaTheme=undefined}else if(this.RFonts.EastAsia){this.RFonts.EastAsia.Name=oFontScheme.checkFont(this.RFonts.EastAsia.Name);this.RFonts.EastAsia.Index=-1}if(this.RFonts.HAnsiTheme){this.RFonts.HAnsi={Name:oFontScheme.checkFont(this.RFonts.HAnsiTheme),Index:-1};this.RFonts.HAnsiTheme=undefined}else if(this.RFonts.HAnsi){this.RFonts.HAnsi.Name=oFontScheme.checkFont(this.RFonts.HAnsi.Name);this.RFonts.HAnsi.Index=-1}if(this.RFonts.CSTheme){this.RFonts.CS={Name:oFontScheme.checkFont(this.RFonts.CSTheme), Index:-1};this.RFonts.CSTheme=undefined}else if(this.RFonts.CS){this.RFonts.CS.Name=oFontScheme.checkFont(this.RFonts.CS.Name);this.RFonts.CS.Index=-1}}if(this.FontFamily){this.FontFamily.Name=oFontScheme.checkFont(this.FontFamily.Name);this.FontFamily.Index=-1}};CTextPr.prototype.GetIncDecFontSize=function(IncFontSize){var FontSize=this.FontSize;if(this.FontScale!==null&&this.FontScale!==undefined&&this.FontSizeOrig!==null&&this.FontSizeOrig!==undefined)FontSize=this.FontSizeOrig;return FontSize_IncreaseDecreaseValue(IncFontSize, FontSize)};CTextPr.prototype.GetIncDecFontSizeCS=function(IncFontSize){var FontSize=this.FontSizeCS;if(this.FontScale!==null&&this.FontScale!==undefined&&this.FontSizeCSOrig!==null&&this.FontSizeCSOrig!==undefined)FontSize=this.FontSizeCSOrig;return FontSize_IncreaseDecreaseValue(IncFontSize,FontSize)};CTextPr.prototype.GetSimpleTextColor=function(oTheme,oColorMap){if(this.Unifill){if(oTheme&&oColorMap)this.Unifill.check(oTheme,oColorMap);var oRGBA=this.Unifill.getRGBAColor();return new CDocumentColor(oRGBA.R, oRGBA.G,oRGBA.B)}else if(this.Color)return this.Color;return new CDocumentColor};CTextPr.prototype.GetIncDecFontSize=function(IncFontSize){var FontSize=this.FontSize;if(this.FontScale!==null&&this.FontScale!==undefined&&this.FontSizeOrig!==null&&this.FontSizeOrig!==undefined)FontSize=this.FontSizeOrig;return FontSize_IncreaseDecreaseValue(IncFontSize,FontSize)};CTextPr.prototype.GetIncDecFontSizeCS=function(IncFontSize){var FontSize=this.FontSizeCS;if(this.FontScale!==null&&this.FontScale!==undefined&& this.FontSizeCSOrig!==null&&this.FontSizeCSOrig!==undefined)FontSize=this.FontSizeCSOrig;return FontSize_IncreaseDecreaseValue(IncFontSize,FontSize)};CTextPr.prototype.CheckFontScale=function(){if(this.FontScale!==null&&this.FontScale!==undefined){this.FontSizeOrig=this.FontSize;this.FontSizeCSOrig=this.FontSizeCS;this.FontSize*=this.FontScale;this.FontSize=this.FontSize+.5>>0;this.FontSize=Math.max(1,this.FontSize);this.FontSizeCS*=this.FontScale;this.FontSizeCS=this.FontSizeCS+.5>>0;this.FontSizeCS= Math.max(1,this.FontSizeCS)}};CTextPr.prototype.Write_ToBinary=function(Writer){var StartPos=Writer.GetCurPosition();Writer.Skip(4);var Flags=0;if(undefined!=this.Bold){Writer.WriteBool(this.Bold);Flags|=1}if(undefined!=this.Italic){Writer.WriteBool(this.Italic);Flags|=2}if(undefined!=this.Underline){Writer.WriteBool(this.Underline);Flags|=4}if(undefined!=this.Strikeout){Writer.WriteBool(this.Strikeout);Flags|=8}if(undefined!=this.FontFamily){Writer.WriteString2(this.FontFamily.Name);Flags|=16}if(undefined!= this.FontSize){Writer.WriteDouble(this.FontSize);Flags|=32}if(undefined!=this.Color){this.Color.Write_ToBinary(Writer);Flags|=64}if(undefined!=this.VertAlign){Writer.WriteLong(this.VertAlign);Flags|=128}if(undefined!=this.HighLight){if(highlight_None===this.HighLight)Writer.WriteLong(highlight_None);else{Writer.WriteLong(0);this.HighLight.Write_ToBinary(Writer)}Flags|=256}if(undefined!=this.RStyle){Writer.WriteString2(this.RStyle);Flags|=512}if(undefined!=this.Spacing){Writer.WriteDouble(this.Spacing); Flags|=1024}if(undefined!=this.DStrikeout){Writer.WriteBool(this.DStrikeout);Flags|=2048}if(undefined!=this.Caps){Writer.WriteBool(this.Caps);Flags|=4096}if(undefined!=this.SmallCaps){Writer.WriteBool(this.SmallCaps);Flags|=8192}if(undefined!=this.Position){Writer.WriteDouble(this.Position);Flags|=16384}if(undefined!=this.RFonts){this.RFonts.Write_ToBinary(Writer);Flags|=32768}if(undefined!=this.BoldCS){Writer.WriteBool(this.BoldCS);Flags|=65536}if(undefined!=this.ItalicCS){Writer.WriteBool(this.ItalicCS); Flags|=131072}if(undefined!=this.FontSizeCS){Writer.WriteDouble(this.FontSizeCS);Flags|=262144}if(undefined!=this.CS){Writer.WriteBool(this.CS);Flags|=524288}if(undefined!=this.RTL){Writer.WriteBool(this.RTL);Flags|=1048576}if(undefined!=this.Lang){this.Lang.Write_ToBinary(Writer);Flags|=2097152}if(undefined!=this.Unifill){this.Unifill.Write_ToBinary(Writer);Flags|=4194304}if(undefined!==this.Shd){this.Shd.Write_ToBinary(Writer);Flags|=8388608}if(undefined!==this.Vanish){Writer.WriteBool(this.Vanish); Flags|=16777216}if(undefined!==this.FontRef){this.FontRef.Write_ToBinary(Writer);Flags|=33554432}if(undefined!==this.PrChange){this.PrChange.Write_ToBinary(Writer);Flags|=67108864}if(undefined!==this.TextOutline){this.TextOutline.Write_ToBinary(Writer);Flags|=134217728}if(undefined!==this.TextFill){this.TextFill.Write_ToBinary(Writer);Flags|=268435456}if(undefined!==this.PrChange){this.PrChange.WriteToBinary(Writer);this.ReviewInfo.WriteToBinary(Writer);Flags|=536870912}if(undefined!=this.HighlightColor){this.HighlightColor.Write_ToBinary(Writer); Flags|=1073741824}var EndPos=Writer.GetCurPosition();Writer.Seek(StartPos);Writer.WriteLong(Flags);Writer.Seek(EndPos)};CTextPr.prototype.Read_FromBinary=function(Reader){var Flags=Reader.GetLong();if(Flags&1)this.Bold=Reader.GetBool();if(Flags&2)this.Italic=Reader.GetBool();if(Flags&4)this.Underline=Reader.GetBool();if(Flags&8)this.Strikeout=Reader.GetBool();if(Flags&16)this.FontFamily={Name:Reader.GetString2(),Index:-1};if(Flags&32)this.FontSize=Reader.GetDouble();if(Flags&64){this.Color=new CDocumentColor(0, 0,0);this.Color.Read_FromBinary(Reader)}if(Flags&128)this.VertAlign=Reader.GetLong();if(Flags&256){var HL_type=Reader.GetLong();if(highlight_None==HL_type)this.HighLight=highlight_None;else{this.HighLight=new CDocumentColor(0,0,0);this.HighLight.Read_FromBinary(Reader)}}if(Flags&512)this.RStyle=Reader.GetString2();if(Flags&1024)this.Spacing=Reader.GetDouble();if(Flags&2048)this.DStrikeout=Reader.GetBool();if(Flags&4096)this.Caps=Reader.GetBool();if(Flags&8192)this.SmallCaps=Reader.GetBool();if(Flags& 16384)this.Position=Reader.GetDouble();if(Flags&32768)this.RFonts.Read_FromBinary(Reader);if(Flags&65536)this.BoldCS=Reader.GetBool();if(Flags&131072)this.ItalicCS=Reader.GetBool();if(Flags&262144)this.FontSizeCS=Reader.GetDouble();if(Flags&524288)this.CS=Reader.GetBool();if(Flags&1048576)this.RTL=Reader.GetBool();if(Flags&2097152)this.Lang.Read_FromBinary(Reader);if(Flags&4194304){this.Unifill=new AscFormat.CUniFill;this.Unifill.Read_FromBinary(Reader)}if(Flags&8388608){this.Shd=new CDocumentShd; this.Shd.Read_FromBinary(Reader)}if(Flags&16777216)this.Vanish=Reader.GetBool();if(Flags&33554432){this.FontRef=new AscFormat.FontRef;this.FontRef.Read_FromBinary(Reader)}if(Flags&67108864){this.PrChange=new CTextPr;this.PrChange.Read_FromBinary(Reader)}if(Flags&134217728){this.TextOutline=new AscFormat.CLn;this.TextOutline.Read_FromBinary(Reader)}if(Flags&268435456){this.TextFill=new AscFormat.CUniFill;this.TextFill.Read_FromBinary(Reader)}if(Flags&536870912){this.PrChange=new CTextPr;this.ReviewInfo= new CReviewInfo;this.PrChange.ReadFromBinary(Reader);this.ReviewInfo.ReadFromBinary(Reader)}if(Flags&1073741824){this.HighlightColor=new AscFormat.CUniColor;this.HighlightColor.Read_FromBinary(Reader)}};CTextPr.prototype.Check_NeedRecalc=function(){return true;if(undefined!=this.Bold)return true;if(undefined!=this.Italic)return true;if(undefined!=this.FontFamily)return true;if(undefined!=this.FontSize)return true;if(undefined!=this.VertAlign)return true;if(undefined!=this.Spacing)return true;if(undefined!= this.Caps)return true;if(undefined!=this.SmallCaps)return true;if(undefined!=this.Position)return true;if(undefined!=this.RFonts.Ascii)return true;if(undefined!=this.RFonts.EastAsia)return true;if(undefined!=this.RFonts.HAnsi)return true;if(undefined!=this.RFonts.CS)return true;if(undefined!=this.RTL||undefined!=this.CS||undefined!=this.BoldCS||undefined!=this.ItalicCS||undefined!=this.FontSizeCS)return true;if(undefined!=this.Lang.Val)return true;if(undefined!=this.Color)return true;if(undefined!= this.HighLight)return true;if(undefined!=this.Shd)return true;return false};CTextPr.prototype.Get_FontKoef=function(){var dFontKoef=1;switch(this.VertAlign){case AscCommon.vertalign_Baseline:{dFontKoef=1;break}case AscCommon.vertalign_SubScript:case AscCommon.vertalign_SuperScript:{dFontKoef=AscCommon.vaKSize;break}}return dFontKoef};CTextPr.prototype.Document_Get_AllFontNames=function(AllFonts){if(undefined!=this.RFonts.Ascii)AllFonts[this.RFonts.Ascii.Name]=true;if(undefined!=this.RFonts.HAnsi)AllFonts[this.RFonts.HAnsi.Name]= true;if(undefined!=this.RFonts.EastAsia)AllFonts[this.RFonts.EastAsia.Name]=true;if(undefined!=this.RFonts.CS)AllFonts[this.RFonts.CS.Name]=true};CTextPr.prototype.Document_CreateFontMap=function(FontMap,FontScheme){var Style=(true===this.Bold?1:0)+(true===this.Italic?2:0);var StyleCS=(true===this.BoldCS?1:0)+(true===this.ItalicCS?2:0);var Size=this.FontSize;var SizeCS=this.FontSizeCS;var RFonts=this.RFonts;var CheckedName;if(undefined!=RFonts.Ascii){CheckedName=FontScheme.checkFont(RFonts.Ascii.Name); var Key=""+CheckedName+"_"+Style+"_"+Size;FontMap[Key]={Name:CheckedName,Style:Style,Size:Size}}if(undefined!=RFonts.EastAsia){CheckedName=FontScheme.checkFont(RFonts.EastAsia.Name);var Key=""+CheckedName+"_"+Style+"_"+Size;FontMap[Key]={Name:CheckedName,Style:Style,Size:Size}}if(undefined!=RFonts.HAnsi){CheckedName=FontScheme.checkFont(RFonts.HAnsi.Name);var Key=""+CheckedName+"_"+Style+"_"+Size;FontMap[Key]={Name:CheckedName,Style:Style,Size:Size}}if(undefined!=RFonts.CS){CheckedName=FontScheme.checkFont(RFonts.CS.Name); var Key=""+CheckedName+"_"+StyleCS+"_"+SizeCS;FontMap[Key]={Name:CheckedName,Style:StyleCS,Size:SizeCS}}};CTextPr.prototype.isEqual=function(TextPrOld,TextPrNew){if(TextPrOld==undefined||TextPrNew==undefined)return false;for(var TextPr in TextPrOld)if(typeof TextPrOld[TextPr]=="object")this.isEqual(TextPrOld[TextPr],TextPrNew[TextPr]);else if(typeof TextPrOld[TextPr]=="number"&&typeof TextPrNew[TextPr]=="number"){if(Math.abs(TextPrOld[TextPr]-TextPrNew[TextPr])>.001)return false}else if(TextPrOld[TextPr]!= TextPrNew[TextPr])return false;return true};CTextPr.prototype.Is_Equal=function(TextPr){if(!TextPr)return false;if(this.Bold!==TextPr.Bold)return false;if(this.Italic!==TextPr.Italic)return false;if(this.Strikeout!==TextPr.Strikeout)return false;if(this.Underline!==TextPr.Underline)return false;if(undefined===this.FontFamily&&undefined!==TextPr.FontFamily||undefined!==this.FontFamily&&(undefined===TextPr.FontFamily||this.FontFamily.Name!==TextPr.FontFamily.Name))return false;if(undefined===this.FontSize&& undefined!==TextPr.FontSize||undefined!==this.FontSize&&(undefined===TextPr.FontSize||Math.abs(this.FontSize-TextPr.FontSize)>=.001))return false;if(undefined===this.Color&&undefined!==TextPr.Color||undefined!==this.Color&&(undefined===TextPr.Color||true!==this.Color.Compare(TextPr.Color)))return false;if(this.VertAlign!==TextPr.VertAlign)return false;if(undefined===this.HighLight&&undefined!==TextPr.HighLight||undefined!==this.HighLight&&(undefined===TextPr.HighLight||highlight_None===this.HighLight&& highlight_None!==TextPr.HighLight||highlight_None!==this.HighLight&&highlight_None===TextPr.HighLight||highlight_None!==this.HighLight&&highlight_None!==TextPr.HighLight&&true!==this.HighLight.Compare(TextPr.HighLight)))return false;if(this.RStyle!==TextPr.RStyle)return false;if(undefined===this.Spacing&&undefined!==TextPr.Spacing||undefined!==this.Spacing&&(undefined===TextPr.Spacing||Math.abs(this.Spacing-TextPr.Spacing)>=.001))return false;if(this.DStrikeout!==TextPr.DStrikeout)return false;if(this.Caps!== TextPr.Caps)return false;if(this.SmallCaps!==TextPr.SmallCaps)return false;if(undefined===this.Position&&undefined!==TextPr.Position||undefined!==this.Position&&(undefined===TextPr.Position||Math.abs(this.Position-TextPr.Position)>=.001))return false;if(true!==this.RFonts.Is_Equal(TextPr.RFonts))return false;if(this.BoldCS!==TextPr.BoldCS)return false;if(this.ItalicCS!==TextPr.ItalicCS)return false;if(undefined===this.FontSizeCS&&undefined!==TextPr.FontSizeCS||undefined!==this.FontSizeCS&&(undefined=== TextPr.FontSizeCS||Math.abs(this.FontSizeCS-TextPr.FontSizeCS)>=.001))return false;if(this.CS!==TextPr.CS)return false;if(this.RTL!==TextPr.RTL)return false;if(true!==this.Lang.Is_Equal(TextPr.Lang))return false;if(undefined===this.Unifill&&undefined!==TextPr.Unifill||undefined!==this.Unifill&&(undefined===TextPr.Unifill||true!==this.Unifill.IsIdentical(TextPr.Unifill)))return false;if(undefined===this.TextOutline&&undefined!==TextPr.TextOutline||undefined!==this.TextOutline&&(undefined===TextPr.TextOutline|| true!==this.TextOutline.IsIdentical(TextPr.TextOutline)))return false;if(undefined===this.TextFill&&undefined!==TextPr.TextFill||undefined!==this.TextFill&&(undefined===TextPr.TextFill||true!==this.TextFill.IsIdentical(TextPr.TextFill)))return false;if(undefined===this.HighlightColor&&undefined!==TextPr.HighlightColor||undefined!==this.HighlightColor&&(undefined===TextPr.HighlightColor||true!==this.HighlightColor.IsIdentical(TextPr.HighlightColor)))return false;if(this.Vanish!==TextPr.Vanish)return false; if(!IsEqualStyleObjects(this.Shd,TextPr.Shd))return false;if(undefined!=TextPr.AscLine)return false;if(undefined!=TextPr.AscUnifill)return false;if(undefined!=TextPr.AscFill)return false;return true};CTextPr.prototype.IsEqual=function(oTextPr){return this.Is_Equal(oTextPr)};CTextPr.prototype.Is_Empty=function(){if(undefined!==this.Bold||undefined!==this.Italic||undefined!==this.Strikeout||undefined!==this.Underline||undefined!==this.FontFamily||undefined!==this.FontSize||undefined!==this.Color||undefined!== this.VertAlign||undefined!==this.HighLight||undefined!==this.RStyle||undefined!==this.Spacing||undefined!==this.DStrikeout||undefined!==this.Caps||undefined!==this.SmallCaps||undefined!==this.Position||true!==this.RFonts.Is_Empty()||undefined!==this.BoldCS||undefined!==this.ItalicCS||undefined!==this.FontSizeCS||undefined!==this.CS||undefined!==this.RTL||true!==this.Lang.Is_Empty()||undefined!==this.Unifill||undefined!==this.FontRef||undefined!==this.Shd||undefined!==this.Vanish||undefined!==this.TextOutline|| undefined!==this.TextFill||undefined!==this.HighlightColor)return false;return true};CTextPr.prototype.GetDiff=function(oTextPr){var oResultTextPr=new CTextPr;if(this.Bold!==oTextPr.Bold)oResultTextPr.Bold=this.Bold;if(this.Italic!==oTextPr.Italic)oResultTextPr.Italic=this.Italic;if(this.Strikeout!==oTextPr.Strikeout)oResultTextPr.Strikeout=this.Strikeout;if(this.Underline!==oTextPr.Underline)oResultTextPr.Underline=this.Underline;if(undefined!==this.FontSize&&!IsEqualNullableFloatNumbers(this.FontSize, oTextPr.FontSize))oResultTextPr.FontSize=this.FontSize;if(undefined!==this.Color&&!this.Color.IsEqual(oTextPr.Color))oResultTextPr.Color=this.Color.Copy();if(this.VertAlign!==oTextPr.VertAlign)oResultTextPr.VertAlign=this.VertAlign;if(undefined===this.HighLight)oResultTextPr.HighLight=undefined;else if(highlight_None===this.HighLight){if(highlight_None!==oTextPr.HighLight)oResultTextPr.HighLight=highlight_None}else if(!this.HighLight.IsEqual(oTextPr.HighLight))oResultTextPr.HighLight=this.HighLight.Copy(); if(this.RStyle!==oTextPr.RStyle)oResultTextPr.RStyle=this.RStyle;if(undefined!==this.Spacing&&!IsEqualNullableFloatNumbers(this.Spacing,oTextPr.Spacing))oResultTextPr.Spacing=this.Spacing;if(this.DStrikeout!==oTextPr.DStrikeout)oResultTextPr.DStrikeout=this.DStrikeout;if(this.Caps!==oTextPr.Caps)oResultTextPr.Caps=this.Caps;if(this.SmallCaps!==oTextPr.SmallCaps)oResultTextPr.SmallCaps=this.SmallCaps;if(undefined!==this.Position&&!IsEqualNullableFloatNumbers(this.Position,oTextPr.Position))oResultTextPr.Position= this.Position;if(!this.RFonts.IsEqual(oTextPr.RFonts))oResultTextPr.RFonts=this.RFonts.Copy();if(this.BoldCS!==oTextPr.BoldCS)oResultTextPr.BoldCS=this.BoldCS;if(this.ItalicCS!==oTextPr.ItalicCS)oResultTextPr.ItalicCS=this.ItalicCS;if(undefined!==this.FontSizeCS&&!IsEqualNullableFloatNumbers(this.FontSizeCS,oTextPr.FontSizeCS))oResultTextPr.FontSizeCS=this.FontSizeCS;if(this.CS!==oTextPr.CS)oResultTextPr.CS=this.CS;if(this.RTL!==oTextPr.RTL)oResultTextPr.RTL=this.RTL;if(!this.Lang.IsEqual(oTextPr.Lang))oResultTextPr.Lang= this.Lang.Copy();if(this.Unifill&&!this.Unifill.IsIdentical(oTextPr.Unifill))oResultTextPr.Unifill=this.Unifill.createDuplicate();if(this.TextOutline&&!this.TextOutline.IsIdentical(oTextPr.TextOutline))oResultTextPr.TextOutline=this.TextOutline.createDuplicate();if(this.TextFill&&!this.TextFill.IsIdentical(oTextPr.TextFill))oResultTextPr.TextFill=this.TextFill.createDuplicate();if(this.HighlightColor&&!this.HighlightColor.IsIdentical(oTextPr.HighlightColor))oResultTextPr.HighlightColor=this.HighlightColor.createDuplicate(); if(this.Vanish!==oTextPr.Vanish)oResultTextPr.Vanish=this.Vanish;if(this.Shd&&!this.Shd.IsEqual(oTextPr.Shd))oResultTextPr.Shd=this.Shd.Copy();return oResultTextPr};CTextPr.prototype.GetBold=function(){return this.Bold};CTextPr.prototype.SetBold=function(isBold){this.Bold=isBold};CTextPr.prototype.GetItalic=function(){return this.Italic};CTextPr.prototype.SetItalic=function(isItalic){this.Italic=isItalic};CTextPr.prototype.GetStrikeout=function(){return this.Strikeout};CTextPr.prototype.SetStrikeout= function(isStrikeout){this.Strikeout=isStrikeout};CTextPr.prototype.GetUnderline=function(){return this.Underline};CTextPr.prototype.SetUnderline=function(isUnderling){this.Underline=isUnderling};CTextPr.prototype.GetColor=function(){return this.Color};CTextPr.prototype.SetColor=function(nR,nG,nB,isAuto){if(undefined===nR)this.Color=undefined;else this.Color=new CDocumentColor(nR,nG,nB,isAuto)};CTextPr.prototype.GetAscColor=function(){if(this.Unifill&&this.Unifill.fill&&this.Unifill.fill.type===Asc.c_oAscFill.FILL_TYPE_SOLID&& this.Unifill.fill.color)return AscCommon.CreateAscColor(this.Unifill.fill.color);else if(this.Color)return AscCommon.CreateAscColorCustom(this.Color.r,this.Color.g,this.Color.b,this.Color.Auto);return undefined};CTextPr.prototype.SetAscColor=function(oAscColor){if(!oAscColor){this.Color=undefined;this.Unifill=undefined}else if(true===oAscColor.Auto){this.Color=new CDocumentColor(0,0,0,true);this.Unifill=undefined}else{this.Color=undefined;this.Unifill=new AscFormat.CUniFill;this.Unifill.fill=new AscFormat.CSolidFill; this.Unifill.fill.color=AscFormat.CorrectUniColor(oAscColor,this.Unifill.fill.color,1);var oLogicDocument=editor&&editor.private_GetLogicDocument()?editor.private_GetLogicDocument():null;if(oLogicDocument)this.Unifill.check(oLogicDocument.GetTheme(),oLogicDocument.GetColorMap())}};CTextPr.prototype.SetUnifill=function(oUnifill){this.Unifill=oUnifill};CTextPr.prototype.FillFromExcelFont=function(oFont){if(!oFont)return;var nSchemeFont=oFont.getScheme();switch(nSchemeFont){case Asc.EFontScheme.fontschemeMajor:{this.RFonts.SetFontStyle(AscFormat.fntStyleInd_major); break}case Asc.EFontScheme.fontschemeMinor:{this.RFonts.SetFontStyle(AscFormat.fntStyleInd_minor);break}case Asc.EFontScheme.fontschemeNone:{this.RFonts.SetAll(oFont.getName(),-1);break}}this.SetFontSize(oFont.getSize());this.SetBold(oFont.getBold());this.SetItalic(oFont.getItalic());this.SetUnderline(oFont.getUnderline());var oColor=oFont.getColor();this.SetUnifill(AscFormat.CreateSolidFillRGBA(oColor.getR(),oColor.getG(),oColor.getB(),255))};CTextPr.prototype.GetVertAlign=function(){return this.VertAlign}; CTextPr.prototype.SetVertAlign=function(nVertAlign){this.VertAlign=nVertAlign};CTextPr.prototype.GetHighlight=function(){return this.HighLight};CTextPr.prototype.SetHighlight=function(nHighlight){this.HighLight=nHighlight};CTextPr.prototype.GetSpacing=function(){return this.Spacing};CTextPr.prototype.SetSpacing=function(nSpacing){this.Spacing=nSpacing};CTextPr.prototype.GetDStrikeout=function(){return this.DStrikeout};CTextPr.prototype.SetDStrikeout=function(isDStrikeout){this.DStrikeout=isDStrikeout}; CTextPr.prototype.GetCaps=function(){return this.Caps};CTextPr.prototype.SetCaps=function(isCaps){this.Caps=isCaps};CTextPr.prototype.GetSmallCaps=function(){return this.SmallCaps};CTextPr.prototype.SetSmallCaps=function(isSmallCaps){this.SmallCaps=isSmallCaps};CTextPr.prototype.GetPosition=function(){return this.Position};CTextPr.prototype.SetPosition=function(nPosition){this.Position=nPosition};CTextPr.prototype.GetFontFamily=function(){if(this.RFonts&&this.RFonts.Ascii&&this.RFonts.Ascii.Name)return this.RFonts.Ascii.Name; return undefined};CTextPr.prototype.SetFontFamily=function(sFontName){if(!this.RFonts)this.RFonts=new CRFonts;this.RFonts.SetAll(sFontName)};CTextPr.prototype.GetFontSize=function(){return this.FontSize};CTextPr.prototype.SetFontSize=function(nFontSize){this.FontSize=nFontSize};CTextPr.prototype.GetLang=function(){if(this.Lang)return this.Lang.Val;return undefined};CTextPr.prototype.SetLang=function(nLang){if(!this.Lang)this.Lang=new CLang;this.Lang.Val=nLang};CTextPr.prototype.GetShd=function(){return this.Shd}; CTextPr.prototype.SetShd=function(nType,nR,nG,nB){if(!this.Shd)this.Shd=new CDocumentShd;this.Shd.Value=nType;if(Asc.c_oAscShdNil===nType)return;this.Shd.Color.Set(nR,nG,nB)};CTextPr.prototype.WriteToBinary=function(oWriter){return this.Write_ToBinary(oWriter)};CTextPr.prototype.ReadFromBinary=function(oReader){return this.Read_FromBinary(oReader)};CTextPr.prototype.GetAllFontNames=function(arrAllFonts){return this.Document_Get_AllFontNames(arrAllFonts)};CTextPr.prototype.HavePrChange=function(){if(undefined=== this.PrChange||null===this.PrChange)return false;return true};CTextPr.prototype.AddPrChange=function(){this.PrChange=this.Copy();this.ReviewInfo=new CReviewInfo;this.ReviewInfo.Update()};CTextPr.prototype.SetPrChange=function(PrChange,ReviewInfo){this.PrChange=PrChange;this.ReviewInfo=ReviewInfo};CTextPr.prototype.RemovePrChange=function(){delete this.PrChange;delete this.ReviewInfo};CTextPr.prototype.GetDiffPrChange=function(){var TextPr=new CTextPr;if(false===this.HavePrChange())return TextPr;var PrChange= this.PrChange;if(this.Bold!==PrChange.Bold)TextPr.Bold=this.Bold;if(this.Italic!==PrChange.Italic)TextPr.Italic=this.Italic;if(this.Strikeout!==PrChange.Strikeout)TextPr.Strikeout=this.Strikeout;if(this.Underline!==PrChange.Underline)TextPr.Underline=this.Underline;if(undefined!==this.FontFamily&&(undefined===PrChange.FontFamily||this.FontFamily.Name!==PrChange.FontFamily.Name))TextPr.FontFamily={Name:this.FontFamily.Name,Index:-1};if(undefined!==this.FontSize&&(undefined===PrChange.FontSize||Math.abs(this.FontSize- PrChange.FontSize)>=.001))TextPr.FontSize=this.FontSize;if(undefined!==this.Color&&(undefined===PrChange.Color||true!==this.Color.Compare(PrChange.Color)))TextPr.Color=this.Color.Copy();if(this.VertAlign!==PrChange.VertAlign)TextPr.VertAlign=this.VertAlign;if(highlight_None===this.HighLight){if(highlight_None!==PrChange.HighLight)TextPr.HighLight=highlight_None}else if(undefined!==this.HighLight)if(undefined===PrChange.HighLight||highlight_None===PrChange.HighLight||true!==this.HighLight.Compare(PrChange.HighLight))TextPr.HighLight= this.HighLight.Copy();if(this.RStyle!==PrChange.RStyle)TextPr.RStyle=this.RStyle;if(undefined!==this.Spacing&&(undefined===PrChange.Spacing||Math.abs(this.Spacing-PrChange.Spacing)>=.001))TextPr.Spacing=this.Spacing;if(this.DStrikeout!==PrChange.DStrikeout)TextPr.DStrikeout=this.DStrikeout;if(this.Caps!==PrChange.Caps)TextPr.Caps=this.Caps;if(this.SmallCaps!==PrChange.SmallCaps)TextPr.SmallCaps=this.SmallCaps;if(undefined!==this.Position&&(undefined===PrChange.Position||Math.abs(this.Position-PrChange.Position)>= .001))TextPr.Position=this.Position;if(undefined!==this.RFonts&&(undefined===PrChange.RFonts||true!==this.RFonts.Is_Equal(TextPr.RFonts)))TextPr.RFonts=this.RFonts.Copy();if(this.BoldCS!==PrChange.BoldCS)TextPr.BoldCS=this.BoldCS;if(this.ItalicCS!==PrChange.ItalicCS)TextPr.ItalicCS=this.ItalicCS;if(undefined!==this.FontSizeCS&&(undefined===PrChange.FontSizeCS||Math.abs(this.FontSizeCS-PrChange.FontSizeCS)>=.001))TextPr.FontSizeCS=this.FontSizeCS;if(this.CS!==PrChange.CS)TextPr.CS=this.CS;if(this.RTL!== PrChange.RTL)TextPr.RTL=this.RTL;if(undefined!==this.Lang&&(undefined===PrChange.Lang||true!==this.Lang.Is_Equal(PrChange.Lang)))TextPr.Lang=this.Lang.Copy();if(undefined!==this.Unifill&&(undefined===PrChange.Unifill||true!==this.Unifill.IsIdentical(PrChange.Unifill)))TextPr.Unifill=this.Unifill.createDuplicate();if(undefined!==this.TextOutline&&(undefined===PrChange.TextOutline||true!==this.TextOutline.IsIdentical(PrChange.TextOutline)))TextPr.TextOutline=this.TextOutline.createDuplicate();if(undefined!== this.TextFill&&(undefined===PrChange.TextFill||true!==this.TextFill.IsIdentical(PrChange.TextFill)))TextPr.TextFill=this.TextFill.createDuplicate();if(undefined!==this.HighlightColor&&(undefined===PrChange.HighlightColor||true!==this.HighlightColor.IsIdentical(PrChange.HighlightColor)))TextPr.HighlightColor=this.HighlightColor.createDuplicate();if(this.Vanish!==PrChange.Vanish)TextPr.Vanish=this.Vanish;return TextPr};CTextPr.prototype.GetDescription=function(){var Description="Text formatting: "; if(undefined!==this.Bold)Description+=this.Bold?"Bold; ":"No Bold; ";if(undefined!==this.Italic)Description+=this.Italic?"Italic; ":"No Italic; ";if(undefined!==this.Strikeout)Description+=this.Strikeout?"Strikeout; ":"No Strikeout; ";if(undefined!==this.DStrikeout)Description+=this.DStrikeout?"Double Strikeout; ":"No Double Strikeout; ";if(undefined!==this.FontSize)Description+=this.FontSize+"FontSize; ";return Description};CTextPr.prototype["get_Bold"]=CTextPr.prototype.get_Bold=CTextPr.prototype["Get_Bold"]= CTextPr.prototype.GetBold;CTextPr.prototype["put_Bold"]=CTextPr.prototype.put_Bold=CTextPr.prototype.SetBold;CTextPr.prototype["get_Italic"]=CTextPr.prototype.get_Italic=CTextPr.prototype["Get_Italic"]=CTextPr.prototype.GetItalic;CTextPr.prototype["put_Italic"]=CTextPr.prototype.put_Italic=CTextPr.prototype.SetItalic;CTextPr.prototype["get_Strikeout"]=CTextPr.prototype.get_Strikeout=CTextPr.prototype["Get_Strikeout"]=CTextPr.prototype.GetStrikeout;CTextPr.prototype["put_Strikeout"]=CTextPr.prototype.put_Strikeout= CTextPr.prototype.SetStrikeout;CTextPr.prototype["get_Underline"]=CTextPr.prototype.get_Underline=CTextPr.prototype["Get_Underline"]=CTextPr.prototype.GetUnderline;CTextPr.prototype["put_Underline"]=CTextPr.prototype.put_Underline=CTextPr.prototype.SetUnderline;CTextPr.prototype["get_Color"]=CTextPr.prototype.get_Color=CTextPr.prototype["Get_Color"]=CTextPr.prototype.GetAscColor;CTextPr.prototype["put_Color"]=CTextPr.prototype.put_Color=CTextPr.prototype.SetAscColor;CTextPr.prototype["get_VertAlign"]= CTextPr.prototype.get_VertAlign=CTextPr.prototype["Get_VertAlign"]=CTextPr.prototype.GetVertAlign;CTextPr.prototype["put_VertAlign"]=CTextPr.prototype.put_VertAlign=CTextPr.prototype.SetVertAlign;CTextPr.prototype["get_Highlight"]=CTextPr.prototype.get_Highlight=CTextPr.prototype["Get_Highlight"]=CTextPr.prototype.GetHighlight;CTextPr.prototype["put_Highlight"]=CTextPr.prototype.put_Highlight=CTextPr.prototype.SetHighlight;CTextPr.prototype["get_Spacing"]=CTextPr.prototype.get_Spacing=CTextPr.prototype["Get_Spacing"]= CTextPr.prototype.GetSpacing;CTextPr.prototype["put_Spacing"]=CTextPr.prototype.put_Spacing=CTextPr.prototype.SetSpacing;CTextPr.prototype["get_DStrikeout"]=CTextPr.prototype.get_DStrikeout=CTextPr.prototype["Get_DStrikeout"]=CTextPr.prototype.GetDStrikeout;CTextPr.prototype["put_DStrikeout"]=CTextPr.prototype.put_DStrikeout=CTextPr.prototype.SetDStrikeout;CTextPr.prototype["get_Caps"]=CTextPr.prototype.get_Caps=CTextPr.prototype["Get_Caps"]=CTextPr.prototype.GetCaps;CTextPr.prototype["put_Caps"]= CTextPr.prototype.put_Caps=CTextPr.prototype.SetCaps;CTextPr.prototype["get_SmallCaps"]=CTextPr.prototype.get_SmallCaps=CTextPr.prototype["Get_SmallCaps"]=CTextPr.prototype.GetSmallCaps;CTextPr.prototype["put_SmallCaps"]=CTextPr.prototype.put_SmallCaps=CTextPr.prototype.SetSmallCaps;CTextPr.prototype["get_Position"]=CTextPr.prototype.get_Position=CTextPr.prototype["Get_Position"]=CTextPr.prototype.GetPosition;CTextPr.prototype["put_Position"]=CTextPr.prototype.put_Position=CTextPr.prototype.SetPosition; CTextPr.prototype["get_FontFamily"]=CTextPr.prototype.get_FontFamily=CTextPr.prototype["Get_FontFamily"]=CTextPr.prototype.GetFontFamily;CTextPr.prototype["put_FontFamily"]=CTextPr.prototype.put_FontFamily=CTextPr.prototype.SetFontFamily;CTextPr.prototype["get_FontSize"]=CTextPr.prototype.get_FontSize=CTextPr.prototype["Get_FontSize"]=CTextPr.prototype.GetFontSize;CTextPr.prototype["put_FontSize"]=CTextPr.prototype.put_FontSize=CTextPr.prototype.SetFontSize;CTextPr.prototype["get_Lang"]=CTextPr.prototype.get_Lang= CTextPr.prototype["Get_Lang"]=CTextPr.prototype.GetLang;CTextPr.prototype["put_Lang"]=CTextPr.prototype.put_Lang=CTextPr.prototype.SetLang;CTextPr.prototype["get_Shd"]=CTextPr.prototype.get_Shd=CTextPr.prototype["Get_Shd"]=CTextPr.prototype.GetShd;CTextPr.prototype["put_Shd"]=CTextPr.prototype.put_Shd=CTextPr.prototype.SetShd;function CParaTab(Value,Pos,Leader){this.Value=Value;this.Pos=Pos;this.Leader=undefined!==Leader?Leader:Asc.c_oAscTabLeader.None}CParaTab.prototype.Copy=function(){return new CParaTab(this.Value, this.Pos,this.Leader)};CParaTab.prototype.Is_Equal=function(Tab){return this.IsEqual(Tab)};CParaTab.prototype.IsEqual=function(Tab){if(this.Value!==Tab.Value||this.Pos!==Tab.Pos)return false;return true};CParaTab.prototype.IsRightTab=function(){return this.Value===tab_Right};CParaTab.prototype.IsLeftTab=function(){return this.Value===tab_Left};CParaTab.prototype.IsCenterTab=function(){return this.Value===tab_Center};CParaTab.prototype.GetLeader=function(){return this.Leader};function CParaTabs(){this.Tabs= []}CParaTabs.prototype.Add=function(_Tab){var Index=0;for(Index=0;Index_Tab.Pos)break}if(-1!=Index)this.Tabs.splice(Index,0,_Tab)};CParaTabs.prototype.Merge=function(Tabs){var _Tabs=Tabs.Tabs;for(var Index=0;Index<_Tabs.length;Index++){var _Tab=_Tabs[Index];var Index2=0;var Flag=0;for(Index2=0;Index2_Tab.Pos)break}if(-2===Flag)this.Tabs.splice(Index2,1);else if(-3===Flag)this.Tabs.splice(Index2,1,_Tab);else if(-1!=Flag)this.Tabs.splice(Index2,0,_Tab)}};CParaTabs.prototype.IsEqual=function(Tabs){if(this.Tabs.length!==Tabs.Tabs.length)return false;for(var CurTab=0,TabsCount=this.Tabs.length;CurTab8)this.NumPr=undefined}if(undefined!= ParaPr.PStyle)this.PStyle=ParaPr.PStyle;if(null!==ParaPr.FramePr&&undefined!==ParaPr.FramePr)if(!this.FramePr)this.FramePr=ParaPr.FramePr.Copy();else this.FramePr.Merge(ParaPr.FramePr);if(undefined!=ParaPr.DefaultRunPr){if(undefined==this.DefaultRunPr)this.DefaultRunPr=new CTextPr;this.DefaultRunPr.Merge(ParaPr.DefaultRunPr)}if(undefined!=ParaPr.Bullet)if(ParaPr.Bullet.isBullet()){if(!this.Bullet)this.Bullet=new AscFormat.CBullet;var PrBullet=ParaPr.Bullet;if(PrBullet.bulletColor)this.Bullet.bulletColor= PrBullet.bulletColor.createDuplicate();if(PrBullet.bulletSize)this.Bullet.bulletSize=PrBullet.bulletSize.createDuplicate();if(PrBullet.bulletTypeface)this.Bullet.bulletTypeface=PrBullet.bulletTypeface.createDuplicate();if(PrBullet.bulletType)this.Bullet.bulletType=PrBullet.bulletType.createDuplicate();this.Bullet.Bullet=PrBullet.Bullet}else if(this.Bullet&&this.Bullet.isBullet()){if(ParaPr.Bullet.bulletColor)this.Bullet.bulletColor=ParaPr.Bullet.bulletColor.createDuplicate();if(ParaPr.Bullet.bulletSize)this.Bullet.bulletSize= ParaPr.Bullet.bulletSize.createDuplicate();if(ParaPr.Bullet.bulletTypeface)this.Bullet.bulletTypeface=ParaPr.Bullet.bulletTypeface.createDuplicate()}if(undefined!=ParaPr.Lvl)this.Lvl=ParaPr.Lvl;if(undefined!=ParaPr.DefaultTab)this.DefaultTab=ParaPr.DefaultTab;if(undefined!=ParaPr.LnSpcReduction)this.LnSpcReduction=ParaPr.LnSpcReduction;if(undefined!==ParaPr.OutlineLvl)this.OutlineLvl=ParaPr.OutlineLvl;if(undefined!==ParaPr.SuppressLineNumbers)this.SuppressLineNumbers=ParaPr.SuppressLineNumbers};CParaPr.prototype.InitDefault= function(nCompatibilityMode){this.ContextualSpacing=false;this.Ind=new CParaInd;this.Ind.Left=0;this.Ind.Right=0;this.Ind.FirstLine=0;this.Jc=align_Left;this.KeepLines=false;this.KeepNext=false;this.PageBreakBefore=false;this.Spacing=new CParaSpacing;this.Spacing.Line=1;this.Spacing.LineRule=linerule_Auto;this.Spacing.Before=0;this.Spacing.BeforeAutoSpacing=false;this.Spacing.After=0;this.Spacing.AfterAutoSpacing=false;this.Shd=new CDocumentShd;this.Brd.First=true;this.Brd.Last=true;this.Brd.Between= new CDocumentBorder;this.Brd.Bottom=new CDocumentBorder;this.Brd.Left=new CDocumentBorder;this.Brd.Right=new CDocumentBorder;this.Brd.Top=new CDocumentBorder;this.WidowControl=true;this.Tabs=new CParaTabs;this.NumPr=undefined;this.PStyle=undefined;this.FramePr=undefined;this.OutlineLvl=undefined;this.SuppressLineNumbers=false;this.DefaultRunPr=undefined;this.Bullet=undefined;this.DefaultTab=undefined;this.LnSpcReduction=undefined;this.PrChange=undefined;this.ReviewInfo=undefined};CParaPr.prototype.Set_FromObject= function(ParaPr){this.ContextualSpacing=ParaPr.ContextualSpacing;this.Ind=new CParaInd;if(undefined!=ParaPr.Ind)this.Ind.Set_FromObject(ParaPr.Ind);this.Jc=ParaPr.Jc;this.KeepLines=ParaPr.KeepLines;this.KeepNext=ParaPr.KeepNext;this.PageBreakBefore=ParaPr.PageBreakBefore;this.Spacing=new CParaSpacing;if(undefined!=ParaPr.Spacing)this.Spacing.Set_FromObject(ParaPr.Spacing);if(undefined!=ParaPr.Shd){this.Shd=new CDocumentShd;this.Shd.Set_FromObject(ParaPr.Shd)}else this.Shd=undefined;if(undefined!= ParaPr.Brd){if(undefined!=ParaPr.Brd.Between){this.Brd.Between=new CDocumentBorder;this.Brd.Between.Set_FromObject(ParaPr.Brd.Between)}else this.Brd.Between=undefined;if(undefined!=ParaPr.Brd.Bottom){this.Brd.Bottom=new CDocumentBorder;this.Brd.Bottom.Set_FromObject(ParaPr.Brd.Bottom)}else this.Brd.Bottom=undefined;if(undefined!=ParaPr.Brd.Left){this.Brd.Left=new CDocumentBorder;this.Brd.Left.Set_FromObject(ParaPr.Brd.Left)}else this.Brd.Left=undefined;if(undefined!=ParaPr.Brd.Right){this.Brd.Right= new CDocumentBorder;this.Brd.Right.Set_FromObject(ParaPr.Brd.Right)}else this.Brd.Right=undefined;if(undefined!=ParaPr.Brd.Top){this.Brd.Top=new CDocumentBorder;this.Brd.Top.Set_FromObject(ParaPr.Brd.Top)}else this.Brd.Top=undefined}else{this.Brd.Between=undefined;this.Brd.Bottom=undefined;this.Brd.Left=undefined;this.Brd.Right=undefined;this.Brd.Top=undefined}this.WidowControl=ParaPr.WidowControl;if(undefined!=ParaPr.Tabs){this.Tabs=new CParaTabs;this.Tabs.Set_FromObject(ParaPr.Tabs.Tabs)}else this.Tabs= undefined;if(undefined!=ParaPr.NumPr){this.NumPr=new CNumPr;this.NumPr.Set_FromObject(ParaPr.NumPr)}else this.NumPr=undefined;if(undefined!=ParaPr.FramePr){this.FramePr=new CFramePr;this.FramePr.Set_FromObject(ParaPr.FramePr)}else this.FramePr=undefined;if(undefined!=ParaPr.DefaultRunPr){this.DefaultRunPr=new CTextPr;this.DefaultRunPr.Set_FromObject(ParaPr.DefaultRunPr)}if(undefined!=ParaPr.Bullet){this.Bullet=new AscFormat.CBullet;this.Bullet.Set_FromObject(ParaPr.Bullet)}if(undefined!=ParaPr.DefaultTab)this.DefaultTab= ParaPr.DefaultTab;if(undefined!==ParaPr.OutlineLvl)this.OutlineLvl=ParaPr.OutlineLvl;if(undefined!==ParaPr.SuppressLineNumbers)this.SuppressLineNumbers=ParaPr.SuppressLineNumbers};CParaPr.prototype.Compare=function(ParaPr){var Result_ParaPr=new CParaPr;Result_ParaPr.Locked=false;if(ParaPr.ContextualSpacing===this.ContextualSpacing)Result_ParaPr.ContextualSpacing=ParaPr.ContextualSpacing;Result_ParaPr.Ind=new CParaInd;if(undefined!=ParaPr.Ind&&undefined!=this.Ind){if(undefined!=ParaPr.Ind.Left&&undefined!= this.Ind.Left&&Math.abs(ParaPr.Ind.Left-this.Ind.Left)<.001)Result_ParaPr.Ind.Left=ParaPr.Ind.Left;if(undefined!=ParaPr.Ind.Right&&undefined!=this.Ind.Right&&Math.abs(ParaPr.Ind.Right-this.Ind.Right)<.001)Result_ParaPr.Ind.Right=ParaPr.Ind.Right;if(undefined!=ParaPr.Ind.FirstLine&&undefined!=this.Ind.FirstLine&&Math.abs(ParaPr.Ind.FirstLine-this.Ind.FirstLine)<.001)Result_ParaPr.Ind.FirstLine=ParaPr.Ind.FirstLine}if(ParaPr.Jc===this.Jc)Result_ParaPr.Jc=ParaPr.Jc;if(ParaPr.KeepLines===this.KeepLines)Result_ParaPr.KeepLines= ParaPr.KeepLines;if(ParaPr.KeepNext===this.KeepNext)Result_ParaPr.KeepNext=ParaPr.KeepNext;if(ParaPr.PageBreakBefore===this.PageBreakBefore)Result_ParaPr.PageBreakBefore=ParaPr.PageBreakBefore;Result_ParaPr.Spacing=new CParaSpacing;if(undefined!=this.Spacing&&undefined!=ParaPr.Spacing){if(undefined!=this.Spacing.After&&undefined!=ParaPr.Spacing.After&&Math.abs(this.Spacing.After-ParaPr.Spacing.After)<.001)Result_ParaPr.Spacing.After=ParaPr.Spacing.After;if(this.Spacing.AfterAutoSpacing===ParaPr.Spacing.AfterAutoSpacing)Result_ParaPr.Spacing.AfterAutoSpacing= ParaPr.Spacing.AfterAutoSpacing;if(undefined!=this.Spacing.Before&&undefined!=ParaPr.Spacing.Before&&Math.abs(this.Spacing.Before-ParaPr.Spacing.Before)<.001)Result_ParaPr.Spacing.Before=ParaPr.Spacing.Before;if(this.Spacing.BeforeAutoSpacing===ParaPr.Spacing.BeforeAutoSpacing)Result_ParaPr.Spacing.BeforeAutoSpacing=ParaPr.Spacing.BeforeAutoSpacing;if(undefined!=this.Spacing.Line&&undefined!=ParaPr.Spacing.Line&&Math.abs(this.Spacing.Line-ParaPr.Spacing.Line)<.001)Result_ParaPr.Spacing.Line=ParaPr.Spacing.Line; if(this.Spacing.LineRule===ParaPr.Spacing.LineRule)Result_ParaPr.Spacing.LineRule=ParaPr.Spacing.LineRule}if(undefined!=this.Shd&&undefined!=ParaPr.Shd&&true===this.Shd.Compare(ParaPr.Shd))Result_ParaPr.Shd=ParaPr.Shd.Copy();if(undefined!=this.Brd.Between&&undefined!=ParaPr.Brd.Between&&true===this.Brd.Between.Compare(ParaPr.Brd.Between))Result_ParaPr.Brd.Between=ParaPr.Brd.Between.Copy();if(undefined!=this.Brd.Bottom&&undefined!=ParaPr.Brd.Bottom&&true===this.Brd.Bottom.Compare(ParaPr.Brd.Bottom))Result_ParaPr.Brd.Bottom= ParaPr.Brd.Bottom.Copy();if(undefined!=this.Brd.Left&&undefined!=ParaPr.Brd.Left&&true===this.Brd.Left.Compare(ParaPr.Brd.Left))Result_ParaPr.Brd.Left=ParaPr.Brd.Left.Copy();if(undefined!=this.Brd.Right&&undefined!=ParaPr.Brd.Right&&true===this.Brd.Right.Compare(ParaPr.Brd.Right))Result_ParaPr.Brd.Right=ParaPr.Brd.Right.Copy();if(undefined!=this.Brd.Top&&undefined!=ParaPr.Brd.Top&&true===this.Brd.Top.Compare(ParaPr.Brd.Top))Result_ParaPr.Brd.Top=ParaPr.Brd.Top.Copy();if(ParaPr.WidowControl===this.WidowControl)Result_ParaPr.WidowControl= ParaPr.WidowControl;if(undefined!=this.PStyle&&undefined!=ParaPr.PStyle&&this.PStyle===ParaPr.PStyle)Result_ParaPr.PStyle=ParaPr.PStyle;if(undefined!=this.NumPr&&undefined!=ParaPr.NumPr&&this.NumPr.NumId===ParaPr.NumPr.NumId){Result_ParaPr.NumPr=new CParaPr;Result_ParaPr.NumPr.NumId=ParaPr.NumPr.NumId;Result_ParaPr.NumPr.Lvl=Math.max(this.NumPr.Lvl,ParaPr.NumPr.Lvl)}if(undefined!=this.Locked&&undefined!=ParaPr.Locked)if(this.Locked!=ParaPr.Locked)Result_ParaPr.Locked=true;else Result_ParaPr.Locked= ParaPr.Locked;if(undefined!=this.FramePr&&undefined!=ParaPr.FramePr&&true===this.FramePr.Compare(ParaPr.FramePr))Result_ParaPr.FramePr=this.FramePr;if(undefined!=this.Bullet&&undefined!=ParaPr.Bullet)Result_ParaPr.Bullet=AscFormat.CompareBullets(ParaPr.Bullet,this.Bullet);if(undefined!=this.DefaultRunPr&&undefined!=ParaPr.DefaultRunPr)Result_ParaPr.DefaultRunPr=this.DefaultRunPr.Compare(ParaPr.DefaultRunPr);if(undefined!=this.Lvl&&undefined!=ParaPr.Lvl&&ParaPr.Lvl===this.Lvl)Result_ParaPr.Lvl=this.Lvl; if(undefined!=this.DefaultTab&&undefined!=ParaPr.DefaultTab&&ParaPr.DefaultTab===this.DefaultTab)Result_ParaPr.DefaultTab=this.DefaultTab;if(undefined!==this.Tabs&&undefined!==ParaPr.Tabs&&this.Tabs.Is_Equal(ParaPr.Tabs))Result_ParaPr.Tabs=this.Tabs.Copy();if(this.OutlineLvl===ParaPr.OutlineLvl)Result_ParaPr.OutlineLvl=this.OutlineLvl;if(this.OutlineLvlStyle||ParaPr.OutlineLvlStyle)Result_ParaPr.OutlineLvlStyle=true;if(this.SuppressLineNumbers===ParaPr.SuppressLineNumbers)Result_ParaPr.SuppressLineNumbers= this.SuppressLineNumbers;return Result_ParaPr};CParaPr.prototype.Write_ToBinary=function(Writer){var StartPos=Writer.GetCurPosition();Writer.Skip(4);var Flags=0;if(undefined!=this.ContextualSpacing){Writer.WriteBool(this.ContextualSpacing);Flags|=1}if(undefined!=this.Ind){this.Ind.Write_ToBinary(Writer);Flags|=2}if(undefined!=this.Jc){Writer.WriteByte(this.Jc);Flags|=4}if(undefined!=this.KeepLines){Writer.WriteBool(this.KeepLines);Flags|=8}if(undefined!=this.KeepNext){Writer.WriteBool(this.KeepNext); Flags|=16}if(undefined!=this.PageBreakBefore){Writer.WriteBool(this.PageBreakBefore);Flags|=32}if(undefined!=this.Spacing){this.Spacing.Write_ToBinary(Writer);Flags|=64}if(undefined!=this.Shd){this.Shd.Write_ToBinary(Writer);Flags|=128}if(undefined!=this.Brd.Between){this.Brd.Between.Write_ToBinary(Writer);Flags|=256}if(undefined!=this.Brd.Bottom){this.Brd.Bottom.Write_ToBinary(Writer);Flags|=512}if(undefined!=this.Brd.Left){this.Brd.Left.Write_ToBinary(Writer);Flags|=1024}if(undefined!=this.Brd.Right){this.Brd.Right.Write_ToBinary(Writer); Flags|=2048}if(undefined!=this.Brd.Top){this.Brd.Top.Write_ToBinary(Writer);Flags|=4096}if(undefined!=this.WidowControl){Writer.WriteBool(this.WidowControl);Flags|=8192}if(undefined!=this.Tabs){this.Tabs.Write_ToBinary(Writer);Flags|=16384}if(undefined!=this.NumPr){this.NumPr.Write_ToBinary(Writer);Flags|=32768}if(undefined!=this.PStyle){Writer.WriteString2(this.PStyle);Flags|=65536}if(undefined!=this.FramePr){this.FramePr.Write_ToBinary(Writer);Flags|=131072}if(undefined!=this.DefaultRunPr){this.DefaultRunPr.Write_ToBinary(Writer); Flags|=262144}if(undefined!=this.Bullet){this.Bullet.Write_ToBinary(Writer);Flags|=524288}if(undefined!=this.Lvl){Writer.WriteByte(this.Lvl);Flags|=1048576}if(undefined!=this.DefaultTab){Writer.WriteDouble(this.DefaultTab);Flags|=2097152}if(undefined!==this.OutlineLvl){Writer.WriteByte(this.OutlineLvl);Flags|=4194304}if(undefined!==this.PrChange){this.PrChange.WriteToBinary(Writer);this.ReviewInfo.WriteToBinary(Writer);Flags|=8388608}if(undefined!==this.SuppressLineNumbers){Writer.WriteBool(this.SuppressLineNumbers); Flags|=16777216}var EndPos=Writer.GetCurPosition();Writer.Seek(StartPos);Writer.WriteLong(Flags);Writer.Seek(EndPos)};CParaPr.prototype.Read_FromBinary=function(Reader){var Flags=Reader.GetLong();if(Flags&1)this.ContextualSpacing=Reader.GetBool();if(Flags&2){this.Ind=new CParaInd;this.Ind.Read_FromBinary(Reader)}if(Flags&4)this.Jc=Reader.GetByte();if(Flags&8)this.KeepLines=Reader.GetBool();if(Flags&16)this.KeepNext=Reader.GetBool();if(Flags&32)this.PageBreakBefore=Reader.GetBool();if(Flags&64){this.Spacing= new CParaSpacing;this.Spacing.Read_FromBinary(Reader)}if(Flags&128){this.Shd=new CDocumentShd;this.Shd.Read_FromBinary(Reader)}if(Flags&256){this.Brd.Between=new CDocumentBorder;this.Brd.Between.Read_FromBinary(Reader)}if(Flags&512){this.Brd.Bottom=new CDocumentBorder;this.Brd.Bottom.Read_FromBinary(Reader)}if(Flags&1024){this.Brd.Left=new CDocumentBorder;this.Brd.Left.Read_FromBinary(Reader)}if(Flags&2048){this.Brd.Right=new CDocumentBorder;this.Brd.Right.Read_FromBinary(Reader)}if(Flags&4096){this.Brd.Top= new CDocumentBorder;this.Brd.Top.Read_FromBinary(Reader)}if(Flags&8192)this.WidowControl=Reader.GetBool();if(Flags&16384){this.Tabs=new CParaTabs;this.Tabs.Read_FromBinary(Reader)}if(Flags&32768){this.NumPr=new CNumPr;this.NumPr.Read_FromBinary(Reader)}if(Flags&65536)this.PStyle=Reader.GetString2();if(Flags&131072){this.FramePr=new CFramePr;this.FramePr.Read_FromBinary(Reader)}if(Flags&262144){this.DefaultRunPr=new CTextPr;this.DefaultRunPr.Read_FromBinary(Reader)}if(Flags&524288){this.Bullet=new AscFormat.CBullet; this.Bullet.Read_FromBinary(Reader)}if(Flags&1048576)this.Lvl=Reader.GetByte();if(Flags&2097152)this.DefaultTab=Reader.GetDouble();if(Flags&4194304)this.OutlineLvl=Reader.GetByte();if(Flags&8388608){this.PrChange=new CParaPr;this.ReviewInfo=new CReviewInfo;this.PrChange.ReadFromBinary(Reader);this.ReviewInfo.ReadFromBinary(Reader)}if(Flags&16777216)this.SuppressLineNumbers=Reader.GetBool()};CParaPr.prototype.isEqual=function(ParaPrUOld,ParaPrNew){if(ParaPrUOld==undefined||ParaPrNew==undefined)return false; for(var pPr in ParaPrUOld)if(typeof ParaPrUOld[pPr]=="object"){if(!this.isEqual(ParaPrUOld[pPr],ParaPrNew[pPr]))return false}else if(typeof ParaPrUOld[pPr]=="number"&&typeof ParaPrNew[pPr]=="number"){if(Math.abs(ParaPrUOld[pPr]-ParaPrNew[pPr])>.001)return false}else if(ParaPrUOld[pPr]!=ParaPrNew[pPr])return false;return true};CParaPr.prototype.Is_Equal=function(ParaPr){return!(this.ContextualSpacing!==ParaPr.ContextualSpacing||true!==IsEqualStyleObjects(this.Ind,ParaPr.Ind)||this.Jc!==ParaPr.Jc|| this.KeepLines!==ParaPr.KeepLines||this.KeepNext!==ParaPr.KeepNext||this.PageBreakBefore!==ParaPr.PageBreakBefore||true!==IsEqualStyleObjects(this.Spacing,ParaPr.Spacing)||true!==IsEqualStyleObjects(this.Shd,ParaPr.Shd)||true!==IsEqualStyleObjects(this.Brd.Between,ParaPr.Brd.Between)||true!==IsEqualStyleObjects(this.Brd.Bottom,ParaPr.Brd.Bottom)||true!==IsEqualStyleObjects(this.Brd.Left,ParaPr.Brd.Left)||true!==IsEqualStyleObjects(this.Brd.Right,ParaPr.Brd.Right)||true!==IsEqualStyleObjects(this.Brd.Top, ParaPr.Brd.Top)||this.WidowControl!==ParaPr.WidowControl||true!==IsEqualStyleObjects(this.Tabs,ParaPr.Tabs)||true!==IsEqualStyleObjects(this.NumPr,ParaPr.NumPr)||this.PStyle!==ParaPr.PStyle||true!==IsEqualStyleObjects(this.FramePr,ParaPr.FramePr)||this.OutlineLvl!==ParaPr.OutlineLvl||this.SuppressLineNumbers!==ParaPr.SuppressLineNumbers)};CParaPr.prototype.GetDiff=function(oParaPr){var oResultParaPr=new CParaPr;if(this.ContextualSpacing!==oParaPr.ContextualSpacing)oResultParaPr.ContextualSpacing= this.ContextualSpacing;if(!this.Ind.IsEqual(oParaPr.Ind))oResultParaPr.Ind=this.Ind.Copy();if(this.Jc!==oParaPr.Jc)oResultParaPr.Jc=this.Jc;if(this.KeepLines!==oParaPr.KeepLines)oResultParaPr.KeepLines=this.KeepLines;if(this.KeepNext!==oParaPr.KeepNext)oResultParaPr.KeepNext=this.KeepNext;if(this.PageBreakBefore!==oParaPr.PageBreakBefore)oResultParaPr.PageBreakBefore=this.PageBreakBefore;if(!this.Spacing.IsEqual(oParaPr.Spacing))oResultParaPr.Spacing=this.Spacing.Copy();if(this.Shd&&!this.Shd.IsEqual(oParaPr.Shd))oResultParaPr.Shd= this.Shd.Copy();if(this.Brd.Between&&!this.Brd.Between.IsEqual(oParaPr.Brd.Between))oResultParaPr.Brd.Between=this.Brd.Between.Copy();if(this.Brd.Bottom&&!this.Brd.Between.IsEqual(oParaPr.Brd.Bottom))oResultParaPr.Brd.Bottom=this.Brd.Bottom.Copy();if(this.Brd.Left&&!this.Brd.Between.IsEqual(oParaPr.Brd.Left))oResultParaPr.Brd.Left=this.Brd.Left.Copy();if(this.Brd.Right&&!this.Brd.Between.IsEqual(oParaPr.Brd.Right))oResultParaPr.Brd.Right=this.Brd.Right.Copy();if(this.Brd.Top&&!this.Brd.Between.IsEqual(oParaPr.Brd.Top))oResultParaPr.Brd.Top= this.Brd.Top.Copy();if(this.WidowControl!==oParaPr.WidowControl)oResultParaPr.WidowControl=this.WidowControl;if(this.Tabs&&!this.Tabs.IsEqual(oParaPr.Tabs))oResultParaPr.Tabs=this.Tabs.Copy();if(this.NumPr&&!this.NumPr.IsEqual(oParaPr.NumPr))oResultParaPr.NumPr=this.NumPr.Copy();if(this.PStyle!==oParaPr.PStyle)oResultParaPr.PStyle=this.PStyle;if(this.FramePr&&!this.FramePr.IsEqual(oParaPr.FramePr))oResultParaPr.FramePr=this.FramePr.Copy();if(this.OutlineLvl!==oParaPr.OutlineLvl)oResultParaPr.OutlineLvl= this.OutlineLvl;if(this.DefaultRunPr&&!this.DefaultRunPr.IsEqual(oParaPr.DefaultRunPr))oResultParaPr.DefaultRunPr=this.DefaultRunPr.Copy();if(this.SuppressLineNumbers!==oParaPr.SuppressLineNumbers)oResultParaPr.SuppressLineNumbers=this.SuppressLineNumbers;return oResultParaPr};CParaPr.prototype.Get_PresentationBullet=function(theme,colorMap){var Bullet=new CPresentationBullet;if(this.Bullet&&this.Bullet.isBullet()){switch(this.Bullet.bulletType.type){case AscFormat.BULLET_TYPE_BULLET_CHAR:{Bullet.m_nType= numbering_presentationnumfrmt_Char;if(typeof this.Bullet.bulletType.Char==="string"&&this.Bullet.bulletType.Char.length>0)Bullet.m_sChar=this.Bullet.bulletType.Char.substring(0,1);else Bullet.m_sChar="\u2022";break}case AscFormat.BULLET_TYPE_BULLET_AUTONUM:{Bullet.m_nType=this.Bullet.bulletType.AutoNumType;if(this.Bullet.bulletType.startAt===null)Bullet.m_nStartAt=1;else Bullet.m_nStartAt=this.Bullet.bulletType.startAt;break}case AscFormat.BULLET_TYPE_BULLET_NONE:{break}case AscFormat.BULLET_TYPE_BULLET_BLIP:{Bullet.m_nType= numbering_presentationnumfrmt_Char;Bullet.m_sChar="\u2022";break}}if(this.Bullet.bulletColor){if(this.Bullet.bulletColor.type===AscFormat.BULLET_TYPE_COLOR_NONE){Bullet.m_bColorTx=false;Bullet.m_oColor.a=0}if(this.Bullet.bulletColor.type===AscFormat.BULLET_TYPE_COLOR_CLR)if(this.Bullet.bulletColor.UniColor&&this.Bullet.bulletColor.UniColor.color&&theme&&colorMap){Bullet.m_bColorTx=false;Bullet.Unifill=AscFormat.CreateUniFillByUniColorCopy(this.Bullet.bulletColor.UniColor)}}if(this.Bullet.bulletTypeface)if(this.Bullet.bulletTypeface.type=== AscFormat.BULLET_TYPE_TYPEFACE_BUFONT&&this.Bullet.bulletType.type===AscFormat.BULLET_TYPE_BULLET_CHAR){Bullet.m_bFontTx=false;Bullet.m_sFont=this.Bullet.bulletTypeface.typeface}if(this.Bullet.bulletSize)switch(this.Bullet.bulletSize.type){case AscFormat.BULLET_TYPE_SIZE_TX:{Bullet.m_bSizeTx=true;break}case AscFormat.BULLET_TYPE_SIZE_PCT:{Bullet.m_bSizeTx=false;Bullet.m_bSizePct=true;Bullet.m_dSize=this.Bullet.bulletSize.val/1E5;break}case AscFormat.BULLET_TYPE_SIZE_PTS:{Bullet.m_bSizeTx=false;Bullet.m_bSizePct= false;Bullet.m_dSize=this.Bullet.bulletSize.val/100;break}}}return Bullet};CParaPr.prototype.Is_Empty=function(){return!(undefined!==this.ContextualSpacing||true!==this.Ind.Is_Empty()||undefined!==this.Jc||undefined!==this.KeepLines||undefined!==this.KeepNext||undefined!==this.PageBreakBefore||true!==this.Spacing.Is_Empty()||undefined!==this.Shd||undefined!==this.Brd.First||undefined!==this.Brd.Last||undefined!==this.Brd.Between||undefined!==this.Brd.Bottom||undefined!==this.Brd.Left||undefined!== this.Brd.Right||undefined!==this.Brd.Top||undefined!==this.WidowControl||undefined!==this.Tabs||undefined!==this.NumPr||undefined!==this.PStyle||undefined!==this.OutlineLvl||undefined!==this.SuppressLineNumbers)};CParaPr.prototype.GetDiffPrChange=function(){var ParaPr=new CParaPr;if(false===this.HavePrChange())return ParaPr;var PrChange=this.PrChange;if(this.ContextualSpacing!==PrChange.ContextualSpacing)ParaPr.ContextualSpacing=this.ContextualSpacing;ParaPr.Ind=this.Ind.Get_Diff(PrChange.Ind);if(this.Jc!== PrChange.Jc)ParaPr.Jc=this.Jc;if(this.KeepLines!==PrChange.KeepLines)ParaPr.KeepLines=this.KeepLines;if(this.KeepNext!==PrChange.KeepNext)ParaPr.KeepNext=this.KeepNext;if(this.PageBreakBefore!==PrChange.PageBreakBefore)ParaPr.PageBreakBefore=this.PageBreakBefore;ParaPr.Spacing=this.Spacing.Get_Diff(PrChange.Spacing);if(this.WidowControl!==PrChange.WidowControl)ParaPr.WidowControl=this.WidowControl;if(this.Tabs!==PrChange.Tabs)ParaPr.Tabs=this.Tabs;if(this.NumPr!==PrChange.NumPr)ParaPr.NumPr=this.NumPr; if(this.PStyle!==PrChange.PStyle)ParaPr.PStyle=this.PStyle;return ParaPr};CParaPr.prototype.HavePrChange=function(){if(undefined===this.PrChange||null===this.PrChange)return false;return true};CParaPr.prototype.GetPrChangeNumPr=function(){if(!this.HavePrChange()||!this.PrChange.NumPr)return null;return this.PrChange.NumPr};CParaPr.prototype.AddPrChange=function(){this.PrChange=this.Copy();this.ReviewInfo=new CReviewInfo;this.ReviewInfo.Update()};CParaPr.prototype.SetPrChange=function(PrChange,ReviewInfo){this.PrChange= PrChange;this.ReviewInfo=ReviewInfo};CParaPr.prototype.RemovePrChange=function(){delete this.PrChange;delete this.ReviewInfo};CParaPr.prototype.GetContextualSpacing=function(){return this.ContextualSpacing};CParaPr.prototype.SetContextualSpacing=function(isContextualSpacing){this.ContextualSpacing=isContextualSpacing};CParaPr.prototype.GetIndLeft=function(){return this.Ind.Left};CParaPr.prototype.GetIndRight=function(){return this.Ind.Right};CParaPr.prototype.GetIndFirstLine=function(){return this.Ind.FirstLine}; CParaPr.prototype.SetInd=function(nFirst,nLeft,nRight){if(undefined!==nFirst)this.Ind.FirstLine=nFirst;if(undefined!==nLeft)this.Ind.Left=nLeft;if(undefined!==nRight)this.Ind.Right=nRight};CParaPr.prototype.GetJc=function(){return this.Jc};CParaPr.prototype.SetJc=function(nAlign){this.Jc=nAlign};CParaPr.prototype.GetKeepLines=function(){return this.KeepLines};CParaPr.prototype.SetKeepLines=function(isKeepLines){this.KeepLines=isKeepLines};CParaPr.prototype.GetKeepNext=function(){return this.KeepNext}; CParaPr.prototype.SetKeepNext=function(isKeepNext){this.KeepNext=isKeepNext};CParaPr.prototype.GetPageBreakBefore=function(){return this.PageBreakBefore};CParaPr.prototype.SetPageBreakBefore=function(isPageBreakBefore){this.PageBreakBefore=isPageBreakBefore};CParaPr.prototype.GetSpacingLine=function(){return this.Spacing.Line};CParaPr.prototype.GetSpacingLineRule=function(){return this.Spacing.LineRule};CParaPr.prototype.GetSpacingBefore=function(){return this.Spacing.Before};CParaPr.prototype.GetSpacingBeforeAutoSpacing= function(){return this.Spacing.BeforeAutoSpacing};CParaPr.prototype.GetSpacingAfter=function(){return this.Spacing.After};CParaPr.prototype.GetSpacingAfterAutoSpacing=function(){return this.Spacing.AfterAutoSpacing};CParaPr.prototype.SetSpacing=function(nLine,nLineRule,nBefore,nAfter,isBeforeAuto,isAfterAuto){if(undefined!==nLine)this.Spacing.Line=nLine;if(undefined!==nLineRule)this.Spacing.LineRule=nLineRule;if(undefined!==nBefore)this.Spacing.Before=nBefore;if(undefined!==nAfter)this.Spacing.After= nAfter;if(undefined!==isBeforeAuto)this.Spacing.BeforeAutoSpacing=isBeforeAuto;if(undefined!==isAfterAuto)this.Spacing.AfterAutoSpacing=isAfterAuto};CParaPr.prototype.GetWidowControl=function(){return this.WidowControl};CParaPr.prototype.SetWidowControl=function(isWidowControl){this.WidowControl=isWidowControl};CParaPr.prototype.GetTabs=function(){return this.Tabs};CParaPr.prototype.GetNumPr=function(){return this.NumPr};CParaPr.prototype.SetNumPr=function(sNumId,nLvl){if(undefined===sNumId)this.NumPr= undefined;else this.NumPr=new CNumPr(sNumId,nLvl)};CParaPr.prototype.GetPStyle=function(){return this.PStyle};CParaPr.prototype.SetPStyle=function(sPStyle){this.PStyle=sPStyle};CParaPr.prototype.GetOutlineLvl=function(){return this.OutlineLvl};CParaPr.prototype.SetOutlineLvl=function(nOutlineLvl){this.OutlineLvl=nOutlineLvl};CParaPr.prototype.GetSuppressLineNumbers=function(){return this.SuppressLineNumbers};CParaPr.prototype.SetSuppressLineNumbers=function(isSuppress){this.SuppressLineNumbers=isSuppress}; CParaPr.prototype.WriteToBinary=function(oWriter){return this.Write_ToBinary(oWriter)};CParaPr.prototype.ReadFromBinary=function(oReader){return this.Read_FromBinary(oReader)};CParaPr.prototype.private_CorrectBorderSpace=function(nValue){var dKoef=32*25.4/72;return nValue-Math.floor(nValue/dKoef)*dKoef};CParaPr.prototype.CheckBorderSpaces=function(){if(this.Brd.Top)this.Brd.Top.Space=this.private_CorrectBorderSpace(this.Brd.Top.Space);if(this.Brd.Bottom)this.Brd.Bottom.Space=this.private_CorrectBorderSpace(this.Brd.Bottom.Space); if(this.Brd.Left)this.Brd.Left.Space=this.private_CorrectBorderSpace(this.Brd.Left.Space);if(this.Brd.Right)this.Brd.Right.Space=this.private_CorrectBorderSpace(this.Brd.Right.Space);if(this.Brd.Between)this.Brd.Between.Space=this.private_CorrectBorderSpace(this.Brd.Between.Space)};CParaPr.prototype["get_ContextualSpacing"]=CParaPr.prototype.get_ContextualSpacing=CParaPr.prototype["Get_ContextualSpacing"]=CParaPr.prototype.GetContextualSpacing;CParaPr.prototype["put_ContextualSpacing"]=CParaPr.prototype.put_ContextualSpacing= CParaPr.prototype.SetContextualSpacing;CParaPr.prototype["get_IndLeft"]=CParaPr.prototype.get_IndLeft=CParaPr.prototype["Get_IndLeft"]=CParaPr.prototype.GetIndLeft;CParaPr.prototype["get_IndRight"]=CParaPr.prototype.get_IndRight=CParaPr.prototype["Get_IndRight"]=CParaPr.prototype.GetIndRight;CParaPr.prototype["get_IndFirstLine"]=CParaPr.prototype.get_IndFirstLine=CParaPr.prototype["Get_IndFirstLine"]=CParaPr.prototype.GetIndFirstLine;CParaPr.prototype["put_Ind"]=CParaPr.prototype.put_Ind=CParaPr.prototype.SetInd; CParaPr.prototype["get_Jc"]=CParaPr.prototype.get_Jc=CParaPr.prototype["Get_Jc"]=CParaPr.prototype.GetJc;CParaPr.prototype["put_Jc"]=CParaPr.prototype.put_Jc=CParaPr.prototype.SetJc;CParaPr.prototype["get_KeepLines"]=CParaPr.prototype.get_KeepLines=CParaPr.prototype["Get_KeepLines"]=CParaPr.prototype.GetKeepLines;CParaPr.prototype["put_KeepLines"]=CParaPr.prototype.put_KeepLines=CParaPr.prototype.SetKeepLines;CParaPr.prototype["get_KeepNext"]=CParaPr.prototype.get_KeepNext=CParaPr.prototype["Get_KeepNext"]= CParaPr.prototype.GetKeepNext;CParaPr.prototype["put_KeepNext"]=CParaPr.prototype.put_KeepNext=CParaPr.prototype.SetKeepNext;CParaPr.prototype["get_PageBreakBefore"]=CParaPr.prototype.get_PageBreakBefore=CParaPr.prototype["Get_PageBreakBefore"]=CParaPr.prototype.GetPageBreakBefore;CParaPr.prototype["put_PageBreakBefore"]=CParaPr.prototype.put_PageBreakBefore=CParaPr.prototype.SetPageBreakBefore;CParaPr.prototype["get_SpacingLine"]=CParaPr.prototype.get_SpacingLine=CParaPr.prototype["Get_SpacingLine"]= CParaPr.prototype.GetSpacingLine;CParaPr.prototype["get_SpacingLineRule"]=CParaPr.prototype.get_SpacingLineRule=CParaPr.prototype["Get_SpacingLineRule"]=CParaPr.prototype.GetSpacingLineRule;CParaPr.prototype["get_SpacingBefore"]=CParaPr.prototype.get_SpacingBefore=CParaPr.prototype["Get_SpacingBefore"]=CParaPr.prototype.GetSpacingBefore;CParaPr.prototype["get_SpacingBeforeAutoSpacing"]=CParaPr.prototype.get_SpacingBeforeAutoSpacing=CParaPr.prototype["Get_SpacingBeforeAutoSpacing"]=CParaPr.prototype.GetSpacingBeforeAutoSpacing; CParaPr.prototype["get_SpacingAfter"]=CParaPr.prototype.get_SpacingAfter=CParaPr.prototype["Get_SpacingAfter"]=CParaPr.prototype.GetSpacingAfter;CParaPr.prototype["get_SpacingAfterAutoSpacing"]=CParaPr.prototype.get_SpacingAfterAutoSpacing=CParaPr.prototype["Get_SpacingAfterAutoSpacing"]=CParaPr.prototype.GetSpacingAfterAutoSpacing;CParaPr.prototype["put_Spacing"]=CParaPr.prototype.put_Spacing=CParaPr.prototype.SetSpacing;CParaPr.prototype["get_WidowControl"]=CParaPr.prototype.get_WidowControl=CParaPr.prototype["Get_WidowControl"]= CParaPr.prototype.GetWidowControl;CParaPr.prototype["put_WidowControl"]=CParaPr.prototype.put_WidowControl=CParaPr.prototype.SetWidowControl;CParaPr.prototype["get_Tabs"]=CParaPr.prototype.get_Tabs=CParaPr.prototype["Get_Tabs"]=CParaPr.prototype.GetTabs;CParaPr.prototype["get_NumPr"]=CParaPr.prototype.get_NumPr=CParaPr.prototype["Get_NumPr"]=CParaPr.prototype.GetNumPr;CParaPr.prototype["put_NumPr"]=CParaPr.prototype.put_NumPr=CParaPr.prototype.SetNumPr;CParaPr.prototype["get_PStyle"]=CParaPr.prototype.get_PStyle= CParaPr.prototype["Get_PStyle"]=CParaPr.prototype.GetPStyle;CParaPr.prototype["put_PStyle"]=CParaPr.prototype.put_PStyle=CParaPr.prototype.SetPStyle;CParaPr.prototype["get_OutlineLvl"]=CParaPr.prototype.get_OutlineLvl=CParaPr.prototype["Get_OutlineLvl"]=CParaPr.prototype.GetOutlineLvl;CParaPr.prototype["put_OutlineLvl"]=CParaPr.prototype.put_OutlineLvl=CParaPr.prototype.SetOutlineLvl;CParaPr.prototype["get_SuppressLineNumbers"]=CParaPr.prototype.get_SuppressLineNumbers=CParaPr.prototype["Get_SuppressLineNumbers"]= CParaPr.prototype.GetSuppressLineNumbers;CParaPr.prototype["pet_SuppressLineNumbers"]=CParaPr.prototype.put_SuppressLineNumbers=CParaPr.prototype.SetSuppressLineNumbers;function Copy_Bounds(Bounds){if(undefined===Bounds)return{};var Bounds_new={};Bounds_new.Bottom=Bounds.Bottom;Bounds_new.Left=Bounds.Left;Bounds_new.Right=Bounds.Right;Bounds_new.Top=Bounds.Top;return Bounds_new}function asc_CStyle(){this.Name="";this.BasedOn="";this.Next="";this.Link="";this.Type=styletype_Paragraph;this.TextPr=new CTextPr; this.ParaPr=new CParaPr}asc_CStyle.prototype.get_Name=function(){return this.Name};asc_CStyle.prototype.put_Name=function(sName){this.Name=sName};asc_CStyle.prototype.put_BasedOn=function(Name){this.BasedOn=Name};asc_CStyle.prototype.get_BasedOn=function(){return this.BasedOn};asc_CStyle.prototype.put_Next=function(Name){this.Next=Name};asc_CStyle.prototype.get_Next=function(){return this.Next};asc_CStyle.prototype.put_Type=function(Type){this.Type=Type};asc_CStyle.prototype.get_Type=function(){return this.Type}; asc_CStyle.prototype.put_Link=function(LinkStyle){this.Link=LinkStyle};asc_CStyle.prototype.get_Link=function(){return this.Link};asc_CStyle.prototype.fill_ParaPr=function(oPr){this.ParaPr=oPr.Copy()};asc_CStyle.prototype.get_ParaPr=function(){return this.ParaPr};asc_CStyle.prototype.fill_TextPr=function(oPr){this.TextPr=oPr.Copy()};asc_CStyle.prototype.get_TextPr=function(){return this.TextPr};window["Asc"]=window["Asc"]||{};window["AscCommonWord"]=window["AscCommonWord"]||{};window["Asc"]["asc_CStyle"]= window["Asc"].asc_CStyle=asc_CStyle;asc_CStyle.prototype["get_Name"]=asc_CStyle.prototype.get_Name;asc_CStyle.prototype["put_Name"]=asc_CStyle.prototype.put_Name;asc_CStyle.prototype["get_BasedOn"]=asc_CStyle.prototype.get_BasedOn;asc_CStyle.prototype["put_BasedOn"]=asc_CStyle.prototype.put_BasedOn;asc_CStyle.prototype["get_Next"]=asc_CStyle.prototype.get_Next;asc_CStyle.prototype["put_Next"]=asc_CStyle.prototype.put_Next;asc_CStyle.prototype["get_Type"]=asc_CStyle.prototype.get_Type;asc_CStyle.prototype["put_Type"]= asc_CStyle.prototype.put_Type;asc_CStyle.prototype["get_Link"]=asc_CStyle.prototype.get_Link;asc_CStyle.prototype["put_Link"]=asc_CStyle.prototype.put_Link;window["AscCommonWord"].CDocumentColor=CDocumentColor;window["AscCommonWord"].CStyle=CStyle;window["AscCommonWord"].CTextPr=CTextPr;window["AscCommonWord"].CParaPr=CParaPr;window["AscCommonWord"].CParaTabs=CParaTabs;window["AscCommonWord"].CDocumentShd=CDocumentShd;window["AscCommonWord"].g_dKoef_pt_to_mm=g_dKoef_pt_to_mm;window["AscCommonWord"].g_dKoef_pc_to_mm= g_dKoef_pc_to_mm;window["AscCommonWord"].g_dKoef_in_to_mm=g_dKoef_in_to_mm;window["AscCommonWord"].g_dKoef_mm_to_twips=g_dKoef_mm_to_twips;window["AscCommonWord"].g_dKoef_mm_to_pt=g_dKoef_mm_to_pt;window["AscCommonWord"].g_dKoef_mm_to_emu=g_dKoef_mm_to_emu;window["AscCommonWord"].border_Single=border_Single;window["AscCommonWord"].Default_Tab_Stop=Default_Tab_Stop;window["AscCommonWord"].highlight_None=highlight_None;window["AscCommonWord"].spacing_Auto=spacing_Auto;window["AscCommonWord"].wrap_NotBeside= wrap_NotBeside;window["AscCommonWord"].wrap_Around=wrap_Around;var g_oDocumentDefaultTextPr=new CTextPr;var g_oDocumentDefaultParaPr=new CParaPr;var g_oDocumentDefaultTablePr=new CTablePr;var g_oDocumentDefaultTableCellPr=new CTableCellPr;var g_oDocumentDefaultTableRowPr=new CTableRowPr;var g_oDocumentDefaultTableStylePr=new CTableStylePr;g_oDocumentDefaultTextPr.InitDefault();g_oDocumentDefaultParaPr.InitDefault();g_oDocumentDefaultTablePr.InitDefault();g_oDocumentDefaultTableCellPr.InitDefault(); g_oDocumentDefaultTableRowPr.InitDefault();g_oDocumentDefaultTableStylePr.InitDefault();var g_oDocumentDefaultFillColor=new CDocumentColor(255,255,255,false);var g_oDocumentDefaultStrokeColor=new CDocumentColor(0,0,0,false);"use strict";AscDFH.changesFactory[AscDFH.historyitem_Style_TextPr]=CChangesStyleTextPr;AscDFH.changesFactory[AscDFH.historyitem_Style_ParaPr]=CChangesStyleParaPr;AscDFH.changesFactory[AscDFH.historyitem_Style_TablePr]=CChangesStyleTablePr;AscDFH.changesFactory[AscDFH.historyitem_Style_TableRowPr]= CChangesStyleTableRowPr;AscDFH.changesFactory[AscDFH.historyitem_Style_TableCellPr]=CChangesStyleTableCellPr;AscDFH.changesFactory[AscDFH.historyitem_Style_TableBand1Horz]=CChangesStyleTableBand1Horz;AscDFH.changesFactory[AscDFH.historyitem_Style_TableBand1Vert]=CChangesStyleTableBand1Vert;AscDFH.changesFactory[AscDFH.historyitem_Style_TableBand2Horz]=CChangesStyleTableBand2Horz;AscDFH.changesFactory[AscDFH.historyitem_Style_TableBand2Vert]=CChangesStyleTableBand2Vert;AscDFH.changesFactory[AscDFH.historyitem_Style_TableFirstCol]= CChangesStyleTableFirstCol;AscDFH.changesFactory[AscDFH.historyitem_Style_TableFirstRow]=CChangesStyleTableFirstRow;AscDFH.changesFactory[AscDFH.historyitem_Style_TableLastCol]=CChangesStyleTableLastCol;AscDFH.changesFactory[AscDFH.historyitem_Style_TableLastRow]=CChangesStyleTableLastRow;AscDFH.changesFactory[AscDFH.historyitem_Style_TableTLCell]=CChangesStyleTableTLCell;AscDFH.changesFactory[AscDFH.historyitem_Style_TableTRCell]=CChangesStyleTableTRCell;AscDFH.changesFactory[AscDFH.historyitem_Style_TableBLCell]= CChangesStyleTableBLCell;AscDFH.changesFactory[AscDFH.historyitem_Style_TableBRCell]=CChangesStyleTableBRCell;AscDFH.changesFactory[AscDFH.historyitem_Style_TableWholeTable]=CChangesStyleTableWholeTable;AscDFH.changesFactory[AscDFH.historyitem_Style_Name]=CChangesStyleName;AscDFH.changesFactory[AscDFH.historyitem_Style_BasedOn]=CChangesStyleBasedOn;AscDFH.changesFactory[AscDFH.historyitem_Style_Next]=CChangesStyleNext;AscDFH.changesFactory[AscDFH.historyitem_Style_Type]=CChangesStyleType;AscDFH.changesFactory[AscDFH.historyitem_Style_QFormat]= CChangesStyleQFormat;AscDFH.changesFactory[AscDFH.historyitem_Style_UiPriority]=CChangesStyleUiPriority;AscDFH.changesFactory[AscDFH.historyitem_Style_Hidden]=CChangesStyleHidden;AscDFH.changesFactory[AscDFH.historyitem_Style_SemiHidden]=CChangesStyleSemiHidden;AscDFH.changesFactory[AscDFH.historyitem_Style_UnhideWhenUsed]=CChangesStyleUnhideWhenUsed;AscDFH.changesFactory[AscDFH.historyitem_Style_Link]=CChangesStyleLink;AscDFH.changesFactory[AscDFH.historyitem_Style_Custom]=CChangesStyleCustom;AscDFH.changesFactory[AscDFH.historyitem_Styles_Add]= CChangesStylesAdd;AscDFH.changesFactory[AscDFH.historyitem_Styles_Remove]=CChangesStylesRemove;AscDFH.changesFactory[AscDFH.historyitem_Styles_ChangeDefaultTextPr]=CChangesStylesChangeDefaultTextPr;AscDFH.changesFactory[AscDFH.historyitem_Styles_ChangeDefaultParaPr]=CChangesStylesChangeDefaultParaPr;AscDFH.changesFactory[AscDFH.historyitem_Styles_ChangeDefaultParagraphId]=CChangesStylesChangeDefaultParagraphId;AscDFH.changesFactory[AscDFH.historyitem_Styles_ChangeDefaultCharacterId]=CChangesStylesChangeDefaultCharacterId; AscDFH.changesFactory[AscDFH.historyitem_Styles_ChangeDefaultNumberingId]=CChangesStylesChangeDefaultNumberingId;AscDFH.changesFactory[AscDFH.historyitem_Styles_ChangeDefaultTableId]=CChangesStylesChangeDefaultTableId;AscDFH.changesFactory[AscDFH.historyitem_Styles_ChangeDefaultTableGridId]=CChangesStylesChangeDefaultTableGridId;AscDFH.changesFactory[AscDFH.historyitem_Styles_ChangeDefaultHeadingsId]=CChangesStylesChangeDefaultHeadingsId;AscDFH.changesFactory[AscDFH.historyitem_Styles_ChangeDefaultParaListId]= CChangesStylesChangeDefaultParaListId;AscDFH.changesFactory[AscDFH.historyitem_Styles_ChangeDefaultHeaderId]=CChangesStylesChangeDefaultHeaderId;AscDFH.changesFactory[AscDFH.historyitem_Styles_ChangeDefaultFooterId]=CChangesStylesChangeDefaultFooterId;AscDFH.changesFactory[AscDFH.historyitem_Styles_ChangeDefaultHyperlinkId]=CChangesStylesChangeDefaultHyperlinkId;AscDFH.changesFactory[AscDFH.historyitem_Styles_ChangeDefaultFootnoteTextId]=CChangesStylesChangeDefaultFootnoteTextId;AscDFH.changesFactory[AscDFH.historyitem_Styles_ChangeDefaultFootnoteTextCharId]= CChangesStylesChangeDefaultFootnoteTextCharId;AscDFH.changesFactory[AscDFH.historyitem_Styles_ChangeDefaultFootnoteReferenceId]=CChangesStylesChangeDefaultFootnoteReferenceId;AscDFH.changesFactory[AscDFH.historyitem_Styles_ChangeDefaultNoSpacingId]=CChangesStylesChangeDefaultNoSpacingId;AscDFH.changesFactory[AscDFH.historyitem_Styles_ChangeDefaultTitleId]=CChangesStylesChangeDefaultTitleId;AscDFH.changesFactory[AscDFH.historyitem_Styles_ChangeDefaultSubtitleId]=CChangesStylesChangeDefaultSubtitleId; AscDFH.changesFactory[AscDFH.historyitem_Styles_ChangeDefaultQuoteId]=CChangesStylesChangeDefaultQuoteId;AscDFH.changesFactory[AscDFH.historyitem_Styles_ChangeDefaultIntenseQuoteId]=CChangesStylesChangeDefaultIntenseQuoteId;AscDFH.changesFactory[AscDFH.historyitem_Styles_ChangeDefaultCaption]=CChangesStylesChangeDefaultCaption;AscDFH.changesFactory[AscDFH.historyitem_Styles_ChangeDefaultEndnoteTextId]=CChangesStylesChangeDefaultEndnoteTextId;AscDFH.changesFactory[AscDFH.historyitem_Styles_ChangeDefaultEndnoteTextCharId]= CChangesStylesChangeDefaultEndnoteTextCharId;AscDFH.changesFactory[AscDFH.historyitem_Styles_ChangeDefaultEndnoteReferenceId]=CChangesStylesChangeDefaultEndnoteReferenceId;AscDFH.changesRelationMap[AscDFH.historyitem_Style_TextPr]=[AscDFH.historyitem_Style_TextPr];AscDFH.changesRelationMap[AscDFH.historyitem_Style_ParaPr]=[AscDFH.historyitem_Style_ParaPr];AscDFH.changesRelationMap[AscDFH.historyitem_Style_TablePr]=[AscDFH.historyitem_Style_TablePr];AscDFH.changesRelationMap[AscDFH.historyitem_Style_TableRowPr]= [AscDFH.historyitem_Style_TableRowPr];AscDFH.changesRelationMap[AscDFH.historyitem_Style_TableCellPr]=[AscDFH.historyitem_Style_TableCellPr];AscDFH.changesRelationMap[AscDFH.historyitem_Style_TableBand1Horz]=[AscDFH.historyitem_Style_TableBand1Horz];AscDFH.changesRelationMap[AscDFH.historyitem_Style_TableBand1Vert]=[AscDFH.historyitem_Style_TableBand1Vert];AscDFH.changesRelationMap[AscDFH.historyitem_Style_TableBand2Horz]=[AscDFH.historyitem_Style_TableBand2Horz];AscDFH.changesRelationMap[AscDFH.historyitem_Style_TableBand2Vert]= [AscDFH.historyitem_Style_TableBand2Vert];AscDFH.changesRelationMap[AscDFH.historyitem_Style_TableFirstCol]=[AscDFH.historyitem_Style_TableFirstCol];AscDFH.changesRelationMap[AscDFH.historyitem_Style_TableFirstRow]=[AscDFH.historyitem_Style_TableFirstRow];AscDFH.changesRelationMap[AscDFH.historyitem_Style_TableLastCol]=[AscDFH.historyitem_Style_TableLastCol];AscDFH.changesRelationMap[AscDFH.historyitem_Style_TableLastRow]=[AscDFH.historyitem_Style_TableLastRow];AscDFH.changesRelationMap[AscDFH.historyitem_Style_TableTLCell]= [AscDFH.historyitem_Style_TableTLCell];AscDFH.changesRelationMap[AscDFH.historyitem_Style_TableTRCell]=[AscDFH.historyitem_Style_TableTRCell];AscDFH.changesRelationMap[AscDFH.historyitem_Style_TableBLCell]=[AscDFH.historyitem_Style_TableBLCell];AscDFH.changesRelationMap[AscDFH.historyitem_Style_TableBRCell]=[AscDFH.historyitem_Style_TableBRCell];AscDFH.changesRelationMap[AscDFH.historyitem_Style_TableWholeTable]=[AscDFH.historyitem_Style_TableWholeTable];AscDFH.changesRelationMap[AscDFH.historyitem_Style_Name]= [AscDFH.historyitem_Style_Name];AscDFH.changesRelationMap[AscDFH.historyitem_Style_BasedOn]=[AscDFH.historyitem_Style_BasedOn];AscDFH.changesRelationMap[AscDFH.historyitem_Style_Next]=[AscDFH.historyitem_Style_Next];AscDFH.changesRelationMap[AscDFH.historyitem_Style_Type]=[AscDFH.historyitem_Style_Type];AscDFH.changesRelationMap[AscDFH.historyitem_Style_QFormat]=[AscDFH.historyitem_Style_QFormat];AscDFH.changesRelationMap[AscDFH.historyitem_Style_UiPriority]=[AscDFH.historyitem_Style_UiPriority]; AscDFH.changesRelationMap[AscDFH.historyitem_Style_Hidden]=[AscDFH.historyitem_Style_Hidden];AscDFH.changesRelationMap[AscDFH.historyitem_Style_SemiHidden]=[AscDFH.historyitem_Style_SemiHidden];AscDFH.changesRelationMap[AscDFH.historyitem_Style_UnhideWhenUsed]=[AscDFH.historyitem_Style_UnhideWhenUsed];AscDFH.changesRelationMap[AscDFH.historyitem_Style_Link]=[AscDFH.historyitem_Style_Link];AscDFH.changesRelationMap[AscDFH.historyitem_Styles_Add]=[AscDFH.historyitem_Styles_Add,AscDFH.historyitem_Styles_Remove]; AscDFH.changesRelationMap[AscDFH.historyitem_Styles_Remove]=[AscDFH.historyitem_Styles_Add,AscDFH.historyitem_Styles_Remove];AscDFH.changesRelationMap[AscDFH.historyitem_Styles_ChangeDefaultTextPr]=[AscDFH.historyitem_Styles_ChangeDefaultTextPr];AscDFH.changesRelationMap[AscDFH.historyitem_Styles_ChangeDefaultParaPr]=[AscDFH.historyitem_Styles_ChangeDefaultParaPr];AscDFH.changesRelationMap[AscDFH.historyitem_Styles_ChangeDefaultParagraphId]=[AscDFH.historyitem_Styles_ChangeDefaultParagraphId];AscDFH.changesRelationMap[AscDFH.historyitem_Styles_ChangeDefaultCharacterId]= [AscDFH.historyitem_Styles_ChangeDefaultCharacterId];AscDFH.changesRelationMap[AscDFH.historyitem_Styles_ChangeDefaultNumberingId]=[AscDFH.historyitem_Styles_ChangeDefaultNumberingId];AscDFH.changesRelationMap[AscDFH.historyitem_Styles_ChangeDefaultTableId]=[AscDFH.historyitem_Styles_ChangeDefaultTableId];AscDFH.changesRelationMap[AscDFH.historyitem_Styles_ChangeDefaultTableGridId]=[AscDFH.historyitem_Styles_ChangeDefaultTableGridId];AscDFH.changesRelationMap[AscDFH.historyitem_Styles_ChangeDefaultHeadingsId]= [AscDFH.historyitem_Styles_ChangeDefaultHeadingsId];AscDFH.changesRelationMap[AscDFH.historyitem_Styles_ChangeDefaultParaListId]=[AscDFH.historyitem_Styles_ChangeDefaultParaListId];AscDFH.changesRelationMap[AscDFH.historyitem_Styles_ChangeDefaultHeaderId]=[AscDFH.historyitem_Styles_ChangeDefaultHeaderId];AscDFH.changesRelationMap[AscDFH.historyitem_Styles_ChangeDefaultFooterId]=[AscDFH.historyitem_Styles_ChangeDefaultFooterId];AscDFH.changesRelationMap[AscDFH.historyitem_Styles_ChangeDefaultHyperlinkId]= [AscDFH.historyitem_Styles_ChangeDefaultHyperlinkId];AscDFH.changesRelationMap[AscDFH.historyitem_Styles_ChangeDefaultFootnoteTextId]=[AscDFH.historyitem_Styles_ChangeDefaultFootnoteTextId];AscDFH.changesRelationMap[AscDFH.historyitem_Styles_ChangeDefaultFootnoteTextCharId]=[AscDFH.historyitem_Styles_ChangeDefaultFootnoteTextCharId];AscDFH.changesRelationMap[AscDFH.historyitem_Styles_ChangeDefaultFootnoteReferenceId]=[AscDFH.historyitem_Styles_ChangeDefaultFootnoteReferenceId];AscDFH.changesRelationMap[AscDFH.historyitem_Styles_ChangeDefaultNoSpacingId]= [AscDFH.historyitem_Styles_ChangeDefaultNoSpacingId];AscDFH.changesRelationMap[AscDFH.historyitem_Styles_ChangeDefaultTitleId]=[AscDFH.historyitem_Styles_ChangeDefaultTitleId];AscDFH.changesRelationMap[AscDFH.historyitem_Styles_ChangeDefaultSubtitleId]=[AscDFH.historyitem_Styles_ChangeDefaultSubtitleId];AscDFH.changesRelationMap[AscDFH.historyitem_Styles_ChangeDefaultQuoteId]=[AscDFH.historyitem_Styles_ChangeDefaultQuoteId];AscDFH.changesRelationMap[AscDFH.historyitem_Styles_ChangeDefaultIntenseQuoteId]= [AscDFH.historyitem_Styles_ChangeDefaultIntenseQuoteId];AscDFH.changesRelationMap[AscDFH.historyitem_Styles_ChangeDefaultCaption]=[AscDFH.historyitem_Styles_ChangeDefaultCaption];AscDFH.changesRelationMap[AscDFH.historyitem_Styles_ChangeDefaultEndnoteTextId]=[AscDFH.historyitem_Styles_ChangeDefaultEndnoteTextId];AscDFH.changesRelationMap[AscDFH.historyitem_Styles_ChangeDefaultEndnoteTextCharId]=[AscDFH.historyitem_Styles_ChangeDefaultEndnoteTextCharId];AscDFH.changesRelationMap[AscDFH.historyitem_Styles_ChangeDefaultEndnoteReferenceId]= [AscDFH.historyitem_Styles_ChangeDefaultEndnoteReferenceId];function CChangesStyleBaseObjectProperty(Class,Old,New){AscDFH.CChangesBaseObjectValue.call(this,Class,Old,New)}CChangesStyleBaseObjectProperty.prototype=Object.create(AscDFH.CChangesBaseObjectValue.prototype);CChangesStyleBaseObjectProperty.prototype.constructor=CChangesStyleBaseObjectProperty;CChangesStyleBaseObjectProperty.prototype.Load=function(){this.Redo();AscCommon.CollaborativeEditing.Add_LinkData(this.Class,{StyleUpdate:true})}; function CChangesStyleBaseStringProperty(Class,Old,New){AscDFH.CChangesBaseProperty.call(this,Class,Old,New)}CChangesStyleBaseStringProperty.prototype=Object.create(AscDFH.CChangesBaseProperty.prototype);CChangesStyleBaseStringProperty.prototype.constructor=CChangesStyleBaseStringProperty;CChangesStyleBaseStringProperty.prototype.WriteToBinary=function(Writer){var nFlags=0;if(undefined===this.New)nFlags|=1;else if(null===this.New)nFlags|=2;if(undefined===this.Old)nFlags|=4;else if(null===this.Old)nFlags|= 8;Writer.WriteLong(nFlags);if(undefined!==this.New&&null!==this.New)Writer.WriteString2(this.New);if(undefined!==this.Old&&null!==this.Old)Writer.WriteString2(this.Old)};CChangesStyleBaseStringProperty.prototype.ReadFromBinary=function(Reader){var nFlags=Reader.GetLong();if(nFlags&1)this.New=undefined;else if(nFlags&2)this.New=null;else this.New=Reader.GetString2();if(nFlags&4)this.Old=undefined;else if(nFlags&8)this.Old=null;else this.Old=Reader.GetString2()};CChangesStyleBaseStringProperty.prototype.Load= function(){this.Redo();AscCommon.CollaborativeEditing.Add_LinkData(this.Class,{StyleUpdate:true})};function CChangesStyleBaseBoolProperty(Class,Old,New){AscDFH.CChangesBaseProperty.call(this,Class,Old,New)}CChangesStyleBaseBoolProperty.prototype=Object.create(AscDFH.CChangesBaseProperty.prototype);CChangesStyleBaseBoolProperty.prototype.constructor=CChangesStyleBaseBoolProperty;CChangesStyleBaseBoolProperty.prototype.WriteToBinary=function(Writer){var nFlags=0;if(undefined===this.New)nFlags|=1;else if(null=== this.New)nFlags|=2;if(undefined===this.Old)nFlags|=4;else if(null===this.Old)nFlags|=8;Writer.WriteLong(nFlags);if(undefined!==this.New&&null!==this.New)Writer.WriteBool(this.New);if(undefined!==this.Old&&null!==this.Old)Writer.WriteBool(this.Old)};CChangesStyleBaseBoolProperty.prototype.ReadFromBinary=function(Reader){var nFlags=Reader.GetLong();if(nFlags&1)this.New=undefined;else if(nFlags&2)this.New=null;else this.New=Reader.GetBool();if(nFlags&4)this.Old=undefined;else if(nFlags&8)this.Old=null; else this.Old=Reader.GetBool()};CChangesStyleBaseBoolProperty.prototype.Load=function(){this.Redo();AscCommon.CollaborativeEditing.Add_LinkData(this.Class,{StyleUpdate:true})};function CChangesStyleBaseLongProperty(Class,Old,New){AscDFH.CChangesBaseProperty.call(this,Class,Old,New)}CChangesStyleBaseLongProperty.prototype=Object.create(AscDFH.CChangesBaseProperty.prototype);CChangesStyleBaseLongProperty.prototype.constructor=CChangesStyleBaseLongProperty;CChangesStyleBaseLongProperty.prototype.WriteToBinary= function(Writer){var nFlags=0;if(undefined===this.New)nFlags|=1;else if(null===this.New)nFlags|=2;if(undefined===this.Old)nFlags|=4;else if(null===this.Old)nFlags|=8;Writer.WriteLong(nFlags);if(undefined!==this.New&&null!==this.New)Writer.WriteLong(this.New);if(undefined!==this.Old&&null!==this.Old)Writer.WriteLong(this.Old)};CChangesStyleBaseLongProperty.prototype.ReadFromBinary=function(Reader){var nFlags=Reader.GetLong();if(nFlags&1)this.New=undefined;else if(nFlags&2)this.New=null;else this.New= Reader.GetLong();if(nFlags&4)this.Old=undefined;else if(nFlags&8)this.Old=null;else this.Old=Reader.GetLong()};CChangesStyleBaseLongProperty.prototype.Load=function(){this.Redo();AscCommon.CollaborativeEditing.Add_LinkData(this.Class,{StyleUpdate:true})};function CChangesStyleTextPr(Class,Old,New,Color){CChangesStyleBaseObjectProperty.call(this,Class,Old,New,Color)}CChangesStyleTextPr.prototype=Object.create(AscDFH.CChangesBaseObjectValue.prototype);CChangesStyleTextPr.prototype.constructor=CChangesStyleTextPr; CChangesStyleTextPr.prototype.Type=AscDFH.historyitem_Style_TextPr;CChangesStyleTextPr.prototype.private_CreateObject=function(){return new CTextPr};CChangesStyleTextPr.prototype.private_SetValue=function(Value){this.Class.TextPr=Value};function CChangesStyleParaPr(Class,Old,New,Color){CChangesStyleBaseObjectProperty.call(this,Class,Old,New,Color)}CChangesStyleParaPr.prototype=Object.create(AscDFH.CChangesBaseObjectValue.prototype);CChangesStyleParaPr.prototype.constructor=CChangesStyleParaPr;CChangesStyleParaPr.prototype.Type= AscDFH.historyitem_Style_ParaPr;CChangesStyleParaPr.prototype.private_CreateObject=function(){return new CParaPr};CChangesStyleParaPr.prototype.private_SetValue=function(Value){this.Class.ParaPr=Value};function CChangesStyleTablePr(Class,Old,New,Color){CChangesStyleBaseObjectProperty.call(this,Class,Old,New,Color)}CChangesStyleTablePr.prototype=Object.create(AscDFH.CChangesBaseObjectValue.prototype);CChangesStyleTablePr.prototype.constructor=CChangesStyleTablePr;CChangesStyleTablePr.prototype.Type= AscDFH.historyitem_Style_TablePr;CChangesStyleTablePr.prototype.private_CreateObject=function(){return new CTablePr};CChangesStyleTablePr.prototype.private_SetValue=function(Value){this.Class.TablePr=Value};function CChangesStyleTableRowPr(Class,Old,New,Color){CChangesStyleBaseObjectProperty.call(this,Class,Old,New,Color)}CChangesStyleTableRowPr.prototype=Object.create(AscDFH.CChangesBaseObjectValue.prototype);CChangesStyleTableRowPr.prototype.constructor=CChangesStyleTableRowPr;CChangesStyleTableRowPr.prototype.Type= AscDFH.historyitem_Style_TableRowPr;CChangesStyleTableRowPr.prototype.private_CreateObject=function(){return new CTableRowPr};CChangesStyleTableRowPr.prototype.private_SetValue=function(Value){this.Class.TableRowPr=Value};function CChangesStyleTableCellPr(Class,Old,New,Color){CChangesStyleBaseObjectProperty.call(this,Class,Old,New,Color)}CChangesStyleTableCellPr.prototype=Object.create(AscDFH.CChangesBaseObjectValue.prototype);CChangesStyleTableCellPr.prototype.constructor=CChangesStyleTableCellPr; CChangesStyleTableCellPr.prototype.Type=AscDFH.historyitem_Style_TableCellPr;CChangesStyleTableCellPr.prototype.private_CreateObject=function(){return new CTableCellPr};CChangesStyleTableCellPr.prototype.private_SetValue=function(Value){this.Class.TableCellPr=Value};function CChangesStyleTableBand1Horz(Class,Old,New,Color){CChangesStyleBaseObjectProperty.call(this,Class,Old,New,Color)}CChangesStyleTableBand1Horz.prototype=Object.create(AscDFH.CChangesBaseObjectValue.prototype);CChangesStyleTableBand1Horz.prototype.constructor= CChangesStyleTableBand1Horz;CChangesStyleTableBand1Horz.prototype.Type=AscDFH.historyitem_Style_TableBand1Horz;CChangesStyleTableBand1Horz.prototype.private_CreateObject=function(){return new CTableStylePr};CChangesStyleTableBand1Horz.prototype.private_SetValue=function(Value){this.Class.TableBand1Horz=Value};function CChangesStyleTableBand1Vert(Class,Old,New,Color){CChangesStyleBaseObjectProperty.call(this,Class,Old,New,Color)}CChangesStyleTableBand1Vert.prototype=Object.create(AscDFH.CChangesBaseObjectValue.prototype); CChangesStyleTableBand1Vert.prototype.constructor=CChangesStyleTableBand1Vert;CChangesStyleTableBand1Vert.prototype.Type=AscDFH.historyitem_Style_TableBand1Vert;CChangesStyleTableBand1Vert.prototype.private_CreateObject=function(){return new CTableStylePr};CChangesStyleTableBand1Vert.prototype.private_SetValue=function(Value){this.Class.TableBand1Vert=Value};function CChangesStyleTableBand2Horz(Class,Old,New,Color){CChangesStyleBaseObjectProperty.call(this,Class,Old,New,Color)}CChangesStyleTableBand2Horz.prototype= Object.create(AscDFH.CChangesBaseObjectValue.prototype);CChangesStyleTableBand2Horz.prototype.constructor=CChangesStyleTableBand2Horz;CChangesStyleTableBand2Horz.prototype.Type=AscDFH.historyitem_Style_TableBand2Horz;CChangesStyleTableBand2Horz.prototype.private_CreateObject=function(){return new CTableStylePr};CChangesStyleTableBand2Horz.prototype.private_SetValue=function(Value){this.Class.TableBand2Horz=Value};function CChangesStyleTableBand2Vert(Class,Old,New,Color){CChangesStyleBaseObjectProperty.call(this, Class,Old,New,Color)}CChangesStyleTableBand2Vert.prototype=Object.create(AscDFH.CChangesBaseObjectValue.prototype);CChangesStyleTableBand2Vert.prototype.constructor=CChangesStyleTableBand2Vert;CChangesStyleTableBand2Vert.prototype.Type=AscDFH.historyitem_Style_TableBand2Vert;CChangesStyleTableBand2Vert.prototype.private_CreateObject=function(){return new CTableStylePr};CChangesStyleTableBand2Vert.prototype.private_SetValue=function(Value){this.Class.TableBand2Vert=Value};function CChangesStyleTableFirstCol(Class, Old,New,Color){CChangesStyleBaseObjectProperty.call(this,Class,Old,New,Color)}CChangesStyleTableFirstCol.prototype=Object.create(AscDFH.CChangesBaseObjectValue.prototype);CChangesStyleTableFirstCol.prototype.constructor=CChangesStyleTableFirstCol;CChangesStyleTableFirstCol.prototype.Type=AscDFH.historyitem_Style_TableFirstCol;CChangesStyleTableFirstCol.prototype.private_CreateObject=function(){return new CTableStylePr};CChangesStyleTableFirstCol.prototype.private_SetValue=function(Value){this.Class.TableFirstCol= Value};function CChangesStyleTableFirstRow(Class,Old,New,Color){CChangesStyleBaseObjectProperty.call(this,Class,Old,New,Color)}CChangesStyleTableFirstRow.prototype=Object.create(AscDFH.CChangesBaseObjectValue.prototype);CChangesStyleTableFirstRow.prototype.constructor=CChangesStyleTableFirstRow;CChangesStyleTableFirstRow.prototype.Type=AscDFH.historyitem_Style_TableFirstRow;CChangesStyleTableFirstRow.prototype.private_CreateObject=function(){return new CTableStylePr};CChangesStyleTableFirstRow.prototype.private_SetValue= function(Value){this.Class.TableFirstRow=Value};function CChangesStyleTableLastCol(Class,Old,New,Color){CChangesStyleBaseObjectProperty.call(this,Class,Old,New,Color)}CChangesStyleTableLastCol.prototype=Object.create(AscDFH.CChangesBaseObjectValue.prototype);CChangesStyleTableLastCol.prototype.constructor=CChangesStyleTableLastCol;CChangesStyleTableLastCol.prototype.Type=AscDFH.historyitem_Style_TableLastCol;CChangesStyleTableLastCol.prototype.private_CreateObject=function(){return new CTableStylePr}; CChangesStyleTableLastCol.prototype.private_SetValue=function(Value){this.Class.TableLastCol=Value};function CChangesStyleTableLastRow(Class,Old,New,Color){CChangesStyleBaseObjectProperty.call(this,Class,Old,New,Color)}CChangesStyleTableLastRow.prototype=Object.create(AscDFH.CChangesBaseObjectValue.prototype);CChangesStyleTableLastRow.prototype.constructor=CChangesStyleTableLastRow;CChangesStyleTableLastRow.prototype.Type=AscDFH.historyitem_Style_TableLastRow;CChangesStyleTableLastRow.prototype.private_CreateObject= function(){return new CTableStylePr};CChangesStyleTableLastRow.prototype.private_SetValue=function(Value){this.Class.TableLastRow=Value};function CChangesStyleTableTLCell(Class,Old,New,Color){CChangesStyleBaseObjectProperty.call(this,Class,Old,New,Color)}CChangesStyleTableTLCell.prototype=Object.create(AscDFH.CChangesBaseObjectValue.prototype);CChangesStyleTableTLCell.prototype.constructor=CChangesStyleTableTLCell;CChangesStyleTableTLCell.prototype.Type=AscDFH.historyitem_Style_TableTLCell;CChangesStyleTableTLCell.prototype.private_CreateObject= function(){return new CTableStylePr};CChangesStyleTableTLCell.prototype.private_SetValue=function(Value){this.Class.TableTLCell=Value};function CChangesStyleTableTRCell(Class,Old,New,Color){CChangesStyleBaseObjectProperty.call(this,Class,Old,New,Color)}CChangesStyleTableTRCell.prototype=Object.create(AscDFH.CChangesBaseObjectValue.prototype);CChangesStyleTableTRCell.prototype.constructor=CChangesStyleTableTRCell;CChangesStyleTableTRCell.prototype.Type=AscDFH.historyitem_Style_TableTRCell;CChangesStyleTableTRCell.prototype.private_CreateObject= function(){return new CTableStylePr};CChangesStyleTableTRCell.prototype.private_SetValue=function(Value){this.Class.TableTRCell=Value};function CChangesStyleTableBLCell(Class,Old,New,Color){CChangesStyleBaseObjectProperty.call(this,Class,Old,New,Color)}CChangesStyleTableBLCell.prototype=Object.create(AscDFH.CChangesBaseObjectValue.prototype);CChangesStyleTableBLCell.prototype.constructor=CChangesStyleTableBLCell;CChangesStyleTableBLCell.prototype.Type=AscDFH.historyitem_Style_TableBLCell;CChangesStyleTableBLCell.prototype.private_CreateObject= function(){return new CTableStylePr};CChangesStyleTableBLCell.prototype.private_SetValue=function(Value){this.Class.TableBLCell=Value};function CChangesStyleTableBRCell(Class,Old,New,Color){CChangesStyleBaseObjectProperty.call(this,Class,Old,New,Color)}CChangesStyleTableBRCell.prototype=Object.create(AscDFH.CChangesBaseObjectValue.prototype);CChangesStyleTableBRCell.prototype.constructor=CChangesStyleTableBRCell;CChangesStyleTableBRCell.prototype.Type=AscDFH.historyitem_Style_TableBRCell;CChangesStyleTableBRCell.prototype.private_CreateObject= function(){return new CTableStylePr};CChangesStyleTableBRCell.prototype.private_SetValue=function(Value){this.Class.TableBRCell=Value};function CChangesStyleTableWholeTable(Class,Old,New,Color){CChangesStyleBaseObjectProperty.call(this,Class,Old,New,Color)}CChangesStyleTableWholeTable.prototype=Object.create(AscDFH.CChangesBaseObjectValue.prototype);CChangesStyleTableWholeTable.prototype.constructor=CChangesStyleTableWholeTable;CChangesStyleTableWholeTable.prototype.Type=AscDFH.historyitem_Style_TableWholeTable; CChangesStyleTableWholeTable.prototype.private_CreateObject=function(){return new CTableStylePr};CChangesStyleTableWholeTable.prototype.private_SetValue=function(Value){this.Class.TableWholeTable=Value};function CChangesStyleName(Class,Old,New){CChangesStyleBaseStringProperty.call(this,Class,Old,New)}CChangesStyleName.prototype=Object.create(CChangesStyleBaseStringProperty.prototype);CChangesStyleName.prototype.constructor=CChangesStyleName;CChangesStyleName.prototype.Type=AscDFH.historyitem_Style_Name; CChangesStyleName.prototype.private_SetValue=function(Value){this.Class.Name=Value};function CChangesStyleBasedOn(Class,Old,New){CChangesStyleBaseStringProperty.call(this,Class,Old,New)}CChangesStyleBasedOn.prototype=Object.create(CChangesStyleBaseStringProperty.prototype);CChangesStyleBasedOn.prototype.constructor=CChangesStyleBasedOn;CChangesStyleBasedOn.prototype.Type=AscDFH.historyitem_Style_BasedOn;CChangesStyleBasedOn.prototype.private_SetValue=function(Value){this.Class.BasedOn=Value};function CChangesStyleNext(Class, Old,New){CChangesStyleBaseStringProperty.call(this,Class,Old,New)}CChangesStyleNext.prototype=Object.create(CChangesStyleBaseStringProperty.prototype);CChangesStyleNext.prototype.constructor=CChangesStyleNext;CChangesStyleNext.prototype.Type=AscDFH.historyitem_Style_Next;CChangesStyleNext.prototype.private_SetValue=function(Value){this.Class.Next=Value};function CChangesStyleType(Class,Old,New){AscDFH.CChangesBaseLongValue.call(this,Class,Old,New)}CChangesStyleType.prototype=Object.create(AscDFH.CChangesBaseLongValue.prototype); CChangesStyleType.prototype.constructor=CChangesStyleType;CChangesStyleType.prototype.Type=AscDFH.historyitem_Style_Type;CChangesStyleType.prototype.private_SetValue=function(Value){this.Class.Type=Value};CChangesStyleType.prototype.Load=function(){this.Redo();AscCommon.CollaborativeEditing.Add_LinkData(this.Class,{StyleUpdate:true})};function CChangesStyleQFormat(Class,Old,New){CChangesStyleBaseBoolProperty.call(this,Class,Old,New)}CChangesStyleQFormat.prototype=Object.create(CChangesStyleBaseBoolProperty.prototype); CChangesStyleQFormat.prototype.constructor=CChangesStyleQFormat;CChangesStyleQFormat.prototype.Type=AscDFH.historyitem_Style_QFormat;CChangesStyleQFormat.prototype.private_SetValue=function(Value){this.Class.qFormat=Value};function CChangesStyleUiPriority(Class,Old,New){CChangesStyleBaseLongProperty.call(this,Class,Old,New)}CChangesStyleUiPriority.prototype=Object.create(CChangesStyleBaseLongProperty.prototype);CChangesStyleUiPriority.prototype.constructor=CChangesStyleUiPriority;CChangesStyleUiPriority.prototype.Type= AscDFH.historyitem_Style_UiPriority;CChangesStyleUiPriority.prototype.private_SetValue=function(Value){this.Class.uiPriority=Value};function CChangesStyleHidden(Class,Old,New){CChangesStyleBaseBoolProperty.call(this,Class,Old,New)}CChangesStyleHidden.prototype=Object.create(CChangesStyleBaseBoolProperty.prototype);CChangesStyleHidden.prototype.constructor=CChangesStyleHidden;CChangesStyleHidden.prototype.Type=AscDFH.historyitem_Style_Hidden;CChangesStyleHidden.prototype.private_SetValue=function(Value){this.Class.hidden= Value};function CChangesStyleSemiHidden(Class,Old,New){CChangesStyleBaseBoolProperty.call(this,Class,Old,New)}CChangesStyleSemiHidden.prototype=Object.create(CChangesStyleBaseBoolProperty.prototype);CChangesStyleSemiHidden.prototype.constructor=CChangesStyleSemiHidden;CChangesStyleSemiHidden.prototype.Type=AscDFH.historyitem_Style_SemiHidden;CChangesStyleSemiHidden.prototype.private_SetValue=function(Value){this.Class.semiHidden=Value};function CChangesStyleUnhideWhenUsed(Class,Old,New){CChangesStyleBaseBoolProperty.call(this, Class,Old,New)}CChangesStyleUnhideWhenUsed.prototype=Object.create(CChangesStyleBaseBoolProperty.prototype);CChangesStyleUnhideWhenUsed.prototype.constructor=CChangesStyleUnhideWhenUsed;CChangesStyleUnhideWhenUsed.prototype.Type=AscDFH.historyitem_Style_UnhideWhenUsed;CChangesStyleUnhideWhenUsed.prototype.private_SetValue=function(Value){this.Class.unhideWhenUsed=Value};function CChangesStyleLink(Class,Old,New){CChangesStyleBaseStringProperty.call(this,Class,Old,New)}CChangesStyleLink.prototype=Object.create(CChangesStyleBaseStringProperty.prototype); CChangesStyleLink.prototype.constructor=CChangesStyleLink;CChangesStyleLink.prototype.Type=AscDFH.historyitem_Style_Link;CChangesStyleLink.prototype.private_SetValue=function(Value){this.Class.Link=Value};function CChangesStyleCustom(Class,Old,New){CChangesStyleBaseBoolProperty.call(this,Class,Old,New)}CChangesStyleCustom.prototype=Object.create(CChangesStyleBaseBoolProperty.prototype);CChangesStyleCustom.prototype.constructor=CChangesStyleCustom;CChangesStyleCustom.prototype.Type=AscDFH.historyitem_Style_Custom; CChangesStyleCustom.prototype.private_SetValue=function(Value){this.Class.Custom=Value};function CChangesStylesAdd(Class,Id,Style){AscDFH.CChangesBase.call(this,Class);this.Id=Id;this.Style=Style}CChangesStylesAdd.prototype=Object.create(AscDFH.CChangesBase.prototype);CChangesStylesAdd.prototype.constructor=CChangesStylesAdd;CChangesStylesAdd.prototype.Type=AscDFH.historyitem_Styles_Add;CChangesStylesAdd.prototype.Undo=function(){delete this.Class.Style[this.Id];this.Class.Update_Interface(this.Id)}; CChangesStylesAdd.prototype.Redo=function(){this.Class.Style[this.Id]=this.Style;this.Class.Update_Interface(this.Id)};CChangesStylesAdd.prototype.WriteToBinary=function(Writer){Writer.WriteString2(this.Id)};CChangesStylesAdd.prototype.ReadFromBinary=function(Reader){this.Id=Reader.GetString2();this.Style=AscCommon.g_oTableId.Get_ById(this.Id)};CChangesStylesAdd.prototype.Load=function(){this.Redo();AscCommon.CollaborativeEditing.Add_LinkData(this.Class,{UpdateStyleId:this.Id})};CChangesStylesAdd.prototype.CreateReverseChange= function(){return new CChangesStylesRemove(this.Class,this.Id,this.Style)};CChangesStylesAdd.prototype.Merge=function(oChange){if(this.Class!==oChange.Class)return true;if((AscDFH.historyitem_Styles_Add===oChange.Type||AscDFH.historyitem_Styles_Remove===oChange.Type)&&this.Id===oChange.Id)return false;return true};function CChangesStylesRemove(Class,Id,Style){AscDFH.CChangesBase.call(this,Class);this.Id=Id;this.Style=Style}CChangesStylesRemove.prototype=Object.create(AscDFH.CChangesBase.prototype); CChangesStylesRemove.prototype.constructor=CChangesStylesRemove;CChangesStylesRemove.prototype.Type=AscDFH.historyitem_Styles_Remove;CChangesStylesRemove.prototype.Undo=function(){this.Class.Style[this.Id]=this.Style;this.Class.Update_Interface(this.Id)};CChangesStylesRemove.prototype.Redo=function(){delete this.Class.Style[this.Id];this.Class.Update_Interface(this.Id)};CChangesStylesRemove.prototype.WriteToBinary=function(Writer){Writer.WriteString2(this.Id)};CChangesStylesRemove.prototype.ReadFromBinary= function(Reader){this.Id=Reader.GetString2();this.Style=AscCommon.g_oTableId.Get_ById(this.Id)};CChangesStylesRemove.prototype.Load=function(){this.Redo();AscCommon.CollaborativeEditing.Add_LinkData(this.Class,{UpdateStyleId:this.Id})};CChangesStylesRemove.prototype.CreateReverseChange=function(){return new CChangesStylesAdd(this.Class,this.Id,this.Style)};CChangesStylesRemove.prototype.Merge=function(oChange){if(this.Class!==oChange.Class)return true;if((AscDFH.historyitem_Styles_Add===oChange.Type|| AscDFH.historyitem_Styles_Remove===oChange.Type)&&this.Id===oChange.Id)return false;return true};function CChangesStylesChangeDefaultTextPr(Class,Old,New){AscDFH.CChangesBaseObjectValue.call(this,Class,Old,New)}CChangesStylesChangeDefaultTextPr.prototype=Object.create(AscDFH.CChangesBaseObjectValue.prototype);CChangesStylesChangeDefaultTextPr.prototype.constructor=CChangesStylesChangeDefaultTextPr;CChangesStylesChangeDefaultTextPr.prototype.Type=AscDFH.historyitem_Styles_ChangeDefaultTextPr;CChangesStylesChangeDefaultTextPr.prototype.private_CreateObject= function(){return new CTextPr};CChangesStylesChangeDefaultTextPr.prototype.private_SetValue=function(Value){this.Class.Default.TextPr=Value};function CChangesStylesChangeDefaultParaPr(Class,Old,New){AscDFH.CChangesBaseObjectValue.call(this,Class,Old,New)}CChangesStylesChangeDefaultParaPr.prototype=Object.create(AscDFH.CChangesBaseObjectValue.prototype);CChangesStylesChangeDefaultParaPr.prototype.constructor=CChangesStylesChangeDefaultParaPr;CChangesStylesChangeDefaultParaPr.prototype.Type=AscDFH.historyitem_Styles_ChangeDefaultParaPr; CChangesStylesChangeDefaultParaPr.prototype.private_CreateObject=function(){return new CParaPr};CChangesStylesChangeDefaultParaPr.prototype.private_SetValue=function(Value){this.Class.Default.ParaPr=Value};function CChangesStylesChangeDefaultParagraphId(Class,Old,New){CChangesStyleBaseStringProperty.call(this,Class,Old,New)}CChangesStylesChangeDefaultParagraphId.prototype=Object.create(CChangesStyleBaseStringProperty.prototype);CChangesStylesChangeDefaultParagraphId.prototype.constructor=CChangesStylesChangeDefaultParagraphId; CChangesStylesChangeDefaultParagraphId.prototype.Type=AscDFH.historyitem_Styles_ChangeDefaultParagraphId;CChangesStylesChangeDefaultParagraphId.prototype.private_SetValue=function(Value){this.Class.Default.Paragraph=Value};function CChangesStylesChangeDefaultCharacterId(Class,Old,New){CChangesStyleBaseStringProperty.call(this,Class,Old,New)}CChangesStylesChangeDefaultCharacterId.prototype=Object.create(CChangesStyleBaseStringProperty.prototype);CChangesStylesChangeDefaultCharacterId.prototype.constructor= CChangesStylesChangeDefaultCharacterId;CChangesStylesChangeDefaultCharacterId.prototype.Type=AscDFH.historyitem_Styles_ChangeDefaultCharacterId;CChangesStylesChangeDefaultCharacterId.prototype.private_SetValue=function(Value){this.Class.Default.Character=Value};function CChangesStylesChangeDefaultNumberingId(Class,Old,New){CChangesStyleBaseStringProperty.call(this,Class,Old,New)}CChangesStylesChangeDefaultNumberingId.prototype=Object.create(CChangesStyleBaseStringProperty.prototype);CChangesStylesChangeDefaultNumberingId.prototype.constructor= CChangesStylesChangeDefaultNumberingId;CChangesStylesChangeDefaultNumberingId.prototype.Type=AscDFH.historyitem_Styles_ChangeDefaultNumberingId;CChangesStylesChangeDefaultNumberingId.prototype.private_SetValue=function(Value){this.Class.Default.Numbering=Value};function CChangesStylesChangeDefaultTableId(Class,Old,New){CChangesStyleBaseStringProperty.call(this,Class,Old,New)}CChangesStylesChangeDefaultTableId.prototype=Object.create(CChangesStyleBaseStringProperty.prototype);CChangesStylesChangeDefaultTableId.prototype.constructor= CChangesStylesChangeDefaultTableId;CChangesStylesChangeDefaultTableId.prototype.Type=AscDFH.historyitem_Styles_ChangeDefaultTableId;CChangesStylesChangeDefaultTableId.prototype.private_SetValue=function(Value){this.Class.Default.Table=Value};function CChangesStylesChangeDefaultTableGridId(Class,Old,New){CChangesStyleBaseStringProperty.call(this,Class,Old,New)}CChangesStylesChangeDefaultTableGridId.prototype=Object.create(CChangesStyleBaseStringProperty.prototype);CChangesStylesChangeDefaultTableGridId.prototype.constructor= CChangesStylesChangeDefaultTableGridId;CChangesStylesChangeDefaultTableGridId.prototype.Type=AscDFH.historyitem_Styles_ChangeDefaultTableGridId;CChangesStylesChangeDefaultTableGridId.prototype.private_SetValue=function(Value){this.Class.Default.TableGrid=Value};function CChangesStylesChangeDefaultHeadingsId(Class,Old,New,Lvl){AscDFH.CChangesBaseProperty.call(this,Class,Old,New);this.Lvl=Lvl}CChangesStylesChangeDefaultHeadingsId.prototype=Object.create(AscDFH.CChangesBaseProperty.prototype);CChangesStylesChangeDefaultHeadingsId.prototype.constructor= CChangesStylesChangeDefaultHeadingsId;CChangesStylesChangeDefaultHeadingsId.prototype.Type=AscDFH.historyitem_Styles_ChangeDefaultHeadingsId;CChangesStylesChangeDefaultHeadingsId.prototype.private_SetValue=function(Value){this.Class.Default.Headings[this.Lvl]=Value};CChangesStylesChangeDefaultHeadingsId.prototype.WriteToBinary=function(Writer){Writer.WriteLong(this.Lvl);var nFlags=0;if(undefined===this.New)nFlags|=1;else if(null===this.New)nFlags|=2;if(undefined===this.Old)nFlags|=4;else if(null=== this.Old)nFlags|=8;Writer.WriteLong(nFlags);if(undefined!==this.New&&null!==this.New)Writer.WriteString2(this.New);if(undefined!==this.Old&&null!==this.Old)Writer.WriteString2(this.Old)};CChangesStylesChangeDefaultHeadingsId.prototype.ReadFromBinary=function(Reader){this.Lvl=Reader.GetLong();var nFlags=Reader.GetLong();if(nFlags&1)this.New=undefined;else if(nFlags&2)this.New=null;else this.New=Reader.GetString2();if(nFlags&4)this.Old=undefined;else if(nFlags&8)this.Old=null;else this.Old=Reader.GetString2()}; function CChangesStylesChangeDefaultParaListId(Class,Old,New){CChangesStyleBaseStringProperty.call(this,Class,Old,New)}CChangesStylesChangeDefaultParaListId.prototype=Object.create(CChangesStyleBaseStringProperty.prototype);CChangesStylesChangeDefaultParaListId.prototype.constructor=CChangesStylesChangeDefaultParaListId;CChangesStylesChangeDefaultParaListId.prototype.Type=AscDFH.historyitem_Styles_ChangeDefaultParaListId;CChangesStylesChangeDefaultParaListId.prototype.private_SetValue=function(Value){this.Class.Default.ParaList= Value};function CChangesStylesChangeDefaultHeaderId(Class,Old,New){CChangesStyleBaseStringProperty.call(this,Class,Old,New)}CChangesStylesChangeDefaultHeaderId.prototype=Object.create(CChangesStyleBaseStringProperty.prototype);CChangesStylesChangeDefaultHeaderId.prototype.constructor=CChangesStylesChangeDefaultHeaderId;CChangesStylesChangeDefaultHeaderId.prototype.Type=AscDFH.historyitem_Styles_ChangeDefaultHeaderId;CChangesStylesChangeDefaultHeaderId.prototype.private_SetValue=function(Value){this.Class.Default.Header= Value};function CChangesStylesChangeDefaultFooterId(Class,Old,New){CChangesStyleBaseStringProperty.call(this,Class,Old,New)}CChangesStylesChangeDefaultFooterId.prototype=Object.create(CChangesStyleBaseStringProperty.prototype);CChangesStylesChangeDefaultFooterId.prototype.constructor=CChangesStylesChangeDefaultFooterId;CChangesStylesChangeDefaultFooterId.prototype.Type=AscDFH.historyitem_Styles_ChangeDefaultFooterId;CChangesStylesChangeDefaultFooterId.prototype.private_SetValue=function(Value){this.Class.Default.Footer= Value};function CChangesStylesChangeDefaultHyperlinkId(Class,Old,New){CChangesStyleBaseStringProperty.call(this,Class,Old,New)}CChangesStylesChangeDefaultHyperlinkId.prototype=Object.create(CChangesStyleBaseStringProperty.prototype);CChangesStylesChangeDefaultHyperlinkId.prototype.constructor=CChangesStylesChangeDefaultHyperlinkId;CChangesStylesChangeDefaultHyperlinkId.prototype.Type=AscDFH.historyitem_Styles_ChangeDefaultHyperlinkId;CChangesStylesChangeDefaultHyperlinkId.prototype.private_SetValue= function(Value){this.Class.Default.Header=Value};function CChangesStylesChangeDefaultFootnoteTextId(Class,Old,New){CChangesStyleBaseStringProperty.call(this,Class,Old,New)}CChangesStylesChangeDefaultFootnoteTextId.prototype=Object.create(CChangesStyleBaseStringProperty.prototype);CChangesStylesChangeDefaultFootnoteTextId.prototype.constructor=CChangesStylesChangeDefaultFootnoteTextId;CChangesStylesChangeDefaultFootnoteTextId.prototype.Type=AscDFH.historyitem_Styles_ChangeDefaultFootnoteTextId;CChangesStylesChangeDefaultFootnoteTextId.prototype.private_SetValue= function(Value){this.Class.Default.FootnoteText=Value};function CChangesStylesChangeDefaultFootnoteTextCharId(Class,Old,New){CChangesStyleBaseStringProperty.call(this,Class,Old,New)}CChangesStylesChangeDefaultFootnoteTextCharId.prototype=Object.create(CChangesStyleBaseStringProperty.prototype);CChangesStylesChangeDefaultFootnoteTextCharId.prototype.constructor=CChangesStylesChangeDefaultFootnoteTextCharId;CChangesStylesChangeDefaultFootnoteTextCharId.prototype.Type=AscDFH.historyitem_Styles_ChangeDefaultFootnoteTextCharId; CChangesStylesChangeDefaultFootnoteTextCharId.prototype.private_SetValue=function(Value){this.Class.Default.FootnoteTextChar=Value};function CChangesStylesChangeDefaultFootnoteReferenceId(Class,Old,New){CChangesStyleBaseStringProperty.call(this,Class,Old,New)}CChangesStylesChangeDefaultFootnoteReferenceId.prototype=Object.create(CChangesStyleBaseStringProperty.prototype);CChangesStylesChangeDefaultFootnoteReferenceId.prototype.constructor=CChangesStylesChangeDefaultFootnoteReferenceId;CChangesStylesChangeDefaultFootnoteReferenceId.prototype.Type= AscDFH.historyitem_Styles_ChangeDefaultFootnoteReferenceId;CChangesStylesChangeDefaultFootnoteReferenceId.prototype.private_SetValue=function(Value){this.Class.Default.FootnoteReference=Value};function CChangesStylesChangeDefaultNoSpacingId(Class,Old,New){CChangesStyleBaseStringProperty.call(this,Class,Old,New)}CChangesStylesChangeDefaultNoSpacingId.prototype=Object.create(CChangesStyleBaseStringProperty.prototype);CChangesStylesChangeDefaultNoSpacingId.prototype.constructor=CChangesStylesChangeDefaultNoSpacingId; CChangesStylesChangeDefaultNoSpacingId.prototype.Type=AscDFH.historyitem_Styles_ChangeDefaultNoSpacingId;CChangesStylesChangeDefaultNoSpacingId.prototype.private_SetValue=function(Value){this.Class.Default.NoSpacing=Value};function CChangesStylesChangeDefaultTitleId(Class,Old,New){CChangesStyleBaseStringProperty.call(this,Class,Old,New)}CChangesStylesChangeDefaultTitleId.prototype=Object.create(CChangesStyleBaseStringProperty.prototype);CChangesStylesChangeDefaultTitleId.prototype.constructor=CChangesStylesChangeDefaultTitleId; CChangesStylesChangeDefaultTitleId.prototype.Type=AscDFH.historyitem_Styles_ChangeDefaultTitleId;CChangesStylesChangeDefaultTitleId.prototype.private_SetValue=function(Value){this.Class.Default.Title=Value};function CChangesStylesChangeDefaultSubtitleId(Class,Old,New){CChangesStyleBaseStringProperty.call(this,Class,Old,New)}CChangesStylesChangeDefaultSubtitleId.prototype=Object.create(CChangesStyleBaseStringProperty.prototype);CChangesStylesChangeDefaultSubtitleId.prototype.constructor=CChangesStylesChangeDefaultSubtitleId; CChangesStylesChangeDefaultSubtitleId.prototype.Type=AscDFH.historyitem_Styles_ChangeDefaultSubtitleId;CChangesStylesChangeDefaultSubtitleId.prototype.private_SetValue=function(Value){this.Class.Default.Subtitle=Value};function CChangesStylesChangeDefaultQuoteId(Class,Old,New){CChangesStyleBaseStringProperty.call(this,Class,Old,New)}CChangesStylesChangeDefaultQuoteId.prototype=Object.create(CChangesStyleBaseStringProperty.prototype);CChangesStylesChangeDefaultQuoteId.prototype.constructor=CChangesStylesChangeDefaultQuoteId; CChangesStylesChangeDefaultQuoteId.prototype.Type=AscDFH.historyitem_Styles_ChangeDefaultQuoteId;CChangesStylesChangeDefaultQuoteId.prototype.private_SetValue=function(Value){this.Class.Default.Quote=Value};function CChangesStylesChangeDefaultIntenseQuoteId(Class,Old,New){CChangesStyleBaseStringProperty.call(this,Class,Old,New)}CChangesStylesChangeDefaultIntenseQuoteId.prototype=Object.create(CChangesStyleBaseStringProperty.prototype);CChangesStylesChangeDefaultIntenseQuoteId.prototype.constructor= CChangesStylesChangeDefaultIntenseQuoteId;CChangesStylesChangeDefaultIntenseQuoteId.prototype.Type=AscDFH.historyitem_Styles_ChangeDefaultIntenseQuoteId;CChangesStylesChangeDefaultIntenseQuoteId.prototype.private_SetValue=function(Value){this.Class.Default.IntenseQuote=Value};function CChangesStylesChangeDefaultCaption(Class,Old,New){CChangesStyleBaseStringProperty.call(this,Class,Old,New)}CChangesStylesChangeDefaultCaption.prototype=Object.create(CChangesStyleBaseStringProperty.prototype);CChangesStylesChangeDefaultCaption.prototype.constructor= CChangesStylesChangeDefaultIntenseQuoteId;CChangesStylesChangeDefaultCaption.prototype.Type=AscDFH.historyitem_Styles_ChangeDefaultCaption;CChangesStylesChangeDefaultCaption.prototype.private_SetValue=function(Value){this.Class.Default.Caption=Value};function CChangesStylesChangeDefaultEndnoteTextId(Class,Old,New){CChangesStyleBaseStringProperty.call(this,Class,Old,New)}CChangesStylesChangeDefaultEndnoteTextId.prototype=Object.create(CChangesStyleBaseStringProperty.prototype);CChangesStylesChangeDefaultEndnoteTextId.prototype.constructor= CChangesStylesChangeDefaultEndnoteTextId;CChangesStylesChangeDefaultEndnoteTextId.prototype.Type=AscDFH.historyitem_Styles_ChangeDefaultEndnoteTextId;CChangesStylesChangeDefaultEndnoteTextId.prototype.private_SetValue=function(Value){this.Class.Default.EndnoteText=Value};function CChangesStylesChangeDefaultEndnoteTextCharId(Class,Old,New){CChangesStyleBaseStringProperty.call(this,Class,Old,New)}CChangesStylesChangeDefaultEndnoteTextCharId.prototype=Object.create(CChangesStyleBaseStringProperty.prototype); CChangesStylesChangeDefaultEndnoteTextCharId.prototype.constructor=CChangesStylesChangeDefaultEndnoteTextCharId;CChangesStylesChangeDefaultEndnoteTextCharId.prototype.Type=AscDFH.historyitem_Styles_ChangeDefaultEndnoteTextCharId;CChangesStylesChangeDefaultEndnoteTextCharId.prototype.private_SetValue=function(Value){this.Class.Default.EndnoteTextChar=Value};function CChangesStylesChangeDefaultEndnoteReferenceId(Class,Old,New){CChangesStyleBaseStringProperty.call(this,Class,Old,New)}CChangesStylesChangeDefaultEndnoteReferenceId.prototype= Object.create(CChangesStyleBaseStringProperty.prototype);CChangesStylesChangeDefaultEndnoteReferenceId.prototype.constructor=CChangesStylesChangeDefaultEndnoteReferenceId;CChangesStylesChangeDefaultEndnoteReferenceId.prototype.Type=AscDFH.historyitem_Styles_ChangeDefaultEndnoteReferenceId;CChangesStylesChangeDefaultEndnoteReferenceId.prototype.private_SetValue=function(Value){this.Class.Default.EndnoteReference=Value};"use strict";var c_oAscRevisionsChangeType=Asc.c_oAscRevisionsChangeType;function CRevisionsChange(){this.Type= c_oAscRevisionsChangeType.Unknown;this.X=0;this.Y=0;this.Value="";this.MoveType=Asc.c_oAscRevisionsMove.NoMove;this.MoveId="";this.MoveDown=false;this.UserName="";this.UserId="";this.DateTime="";this.UserColor=new AscCommon.CColor(0,0,0,255);this.Element=null;this.StartPos=null;this.EndPos=null;this._X=0;this._Y=0;this._PageNum=0;this._PosChanged=false;this.SimpleChanges=[]}CRevisionsChange.prototype.get_UserId=function(){return this.UserId};CRevisionsChange.prototype.put_UserId=function(UserId){this.UserId= UserId;this.private_UpdateUserColor()};CRevisionsChange.prototype.get_UserName=function(){return this.UserName};CRevisionsChange.prototype.put_UserName=function(UserName){this.UserName=UserName;this.private_UpdateUserColor()};CRevisionsChange.prototype.get_DateTime=function(){return this.DateTime};CRevisionsChange.prototype.put_DateTime=function(DateTime){this.DateTime=DateTime};CRevisionsChange.prototype.get_UserColor=function(){return this.UserColor};CRevisionsChange.prototype.get_StartPos=function(){return this.StartPos}; CRevisionsChange.prototype.put_StartPos=function(StartPos){this.StartPos=StartPos};CRevisionsChange.prototype.get_EndPos=function(){return this.EndPos};CRevisionsChange.prototype.put_EndPos=function(EndPos){this.EndPos=EndPos};CRevisionsChange.prototype.get_Type=function(){return this.Type};CRevisionsChange.prototype.get_X=function(){return this.X};CRevisionsChange.prototype.get_Y=function(){return this.Y};CRevisionsChange.prototype.get_Value=function(){return this.Value};CRevisionsChange.prototype.put_Type= function(Type){this.Type=Type};CRevisionsChange.prototype.put_XY=function(X,Y){this.X=X;this.Y=Y};CRevisionsChange.prototype.put_Value=function(Value){this.Value=Value};CRevisionsChange.prototype.put_Paragraph=function(Para){this.Element=Para};CRevisionsChange.prototype.get_Paragraph=function(){return this.Element};CRevisionsChange.prototype.get_LockUserId=function(){if(this.Paragraph){var Lock=this.Paragraph.GetLock();var LockType=Lock.Get_Type();if(AscCommon.locktype_Mine!==LockType&&AscCommon.locktype_None!== LockType)return Lock.Get_UserId()}return null};CRevisionsChange.prototype.put_InternalPos=function(x,y,pageNum){if(this._PageNum!==pageNum||Math.abs(this._X-x)>.001||Math.abs(this._Y-y)>.001){this._X=x;this._Y=y;this._PageNum=pageNum;this._PosChanged=true}else this._PosChanged=false};CRevisionsChange.prototype.get_InternalPosX=function(){return this._X};CRevisionsChange.prototype.get_InternalPosY=function(){return this._Y};CRevisionsChange.prototype.get_InternalPosPageNum=function(){return this._PageNum}; CRevisionsChange.prototype.ComparePrevPosition=function(){if(true===this._PosChanged)return false;return true};CRevisionsChange.prototype.private_UpdateUserColor=function(){this.UserColor=AscCommon.getUserColorById(this.UserId,this.UserName,true,false)};CRevisionsChange.prototype.IsMove=function(){return(c_oAscRevisionsChangeType.TextAdd===this.Type||c_oAscRevisionsChangeType.TextRem===this.Type||c_oAscRevisionsChangeType.ParaAdd===this.Type||c_oAscRevisionsChangeType.ParaRem===this.Type)&&Asc.c_oAscRevisionsMove.NoMove!== this.MoveType||Asc.c_oAscRevisionsChangeType.MoveMark===this.Type};CRevisionsChange.prototype.IsMoveFrom=function(){return this.MoveType===Asc.c_oAscRevisionsMove.MoveFrom};CRevisionsChange.prototype.SetType=function(nType){this.Type=nType};CRevisionsChange.prototype.GetType=function(){return this.Type};CRevisionsChange.prototype.SetElement=function(oElement){this.Element=oElement};CRevisionsChange.prototype.GetElement=function(){return this.Element};CRevisionsChange.prototype.SetValue=function(oValue){this.Value= oValue};CRevisionsChange.prototype.GetValue=function(){return this.Value};CRevisionsChange.prototype.SetUserId=function(sUserId){this.UserId=sUserId;this.private_UpdateUserColor()};CRevisionsChange.prototype.GetUserId=function(){return this.UserId};CRevisionsChange.prototype.SetUserName=function(sUserName){this.UserName=sUserName;this.private_UpdateUserColor()};CRevisionsChange.prototype.GetUserName=function(){return this.UserName};CRevisionsChange.prototype.SetDateTime=function(sDateTime){this.DateTime= sDateTime};CRevisionsChange.prototype.GetDateTime=function(){return this.DateTime};CRevisionsChange.prototype.SetMoveType=function(nMoveType){this.MoveType=nMoveType};CRevisionsChange.prototype.GetMoveType=function(){return this.MoveType};CRevisionsChange.prototype.IsComplexChange=function(){return this.SimpleChanges.length!==0};CRevisionsChange.prototype.SetSimpleChanges=function(arrChanges){this.SimpleChanges=arrChanges};CRevisionsChange.prototype.GetSimpleChanges=function(){return this.SimpleChanges}; CRevisionsChange.prototype.SetMoveId=function(sMoveId){this.MoveId=sMoveId};CRevisionsChange.prototype.GetMoveId=function(){return this.MoveId};CRevisionsChange.prototype.IsMovedDown=function(){return this.MoveDown};CRevisionsChange.prototype.SetMovedDown=function(isMovedDown){this.MoveDown=isMovedDown};CRevisionsChange.prototype.GetX=function(){return this.X};CRevisionsChange.prototype.GetY=function(){return this.Y};CRevisionsChange.prototype.SetXY=function(X,Y){this.X=X;this.Y=Y};CRevisionsChange.prototype.SetInternalPos= function(dX,dY,nPageNum){if(this._PageNum!==nPageNum||Math.abs(this._X-dX)>.001||Math.abs(this._Y-dY)>.001){this._X=dX;this._Y=dY;this._PageNum=nPageNum;this._PosChanged=true}else this._PosChanged=false};CRevisionsChange.prototype.GetInternalPosX=function(){return this._X};CRevisionsChange.prototype.GetInternalPosY=function(){return this._Y};CRevisionsChange.prototype.GetInternalPosPageNum=function(){return this._PageNum};CRevisionsChange.prototype.GetStartPos=function(){return this.StartPos};CRevisionsChange.prototype.SetStartPos= function(oStartPos){this.StartPos=oStartPos};CRevisionsChange.prototype.GetEndPos=function(){return this.EndPos};CRevisionsChange.prototype.SetEndPos=function(oEndPos){this.EndPos=oEndPos};CRevisionsChange.prototype["get_UserId"]=CRevisionsChange.prototype.GetUserId;CRevisionsChange.prototype["put_UserId"]=CRevisionsChange.prototype.SetUserId;CRevisionsChange.prototype["get_UserName"]=CRevisionsChange.prototype.GetUserName;CRevisionsChange.prototype["put_UserName"]=CRevisionsChange.prototype.SetUserName; CRevisionsChange.prototype["get_DateTime"]=CRevisionsChange.prototype.GetDateTime;CRevisionsChange.prototype["put_DateTime"]=CRevisionsChange.prototype.SetDateTime;CRevisionsChange.prototype["get_UserColor"]=CRevisionsChange.prototype.get_UserColor;CRevisionsChange.prototype["get_StartPos"]=CRevisionsChange.prototype.GetStartPos;CRevisionsChange.prototype["put_StartPos"]=CRevisionsChange.prototype.SetStartPos;CRevisionsChange.prototype["get_EndPos"]=CRevisionsChange.prototype.GetEndPos;CRevisionsChange.prototype["put_EndPos"]= CRevisionsChange.prototype.SetEndPos;CRevisionsChange.prototype["get_Type"]=CRevisionsChange.prototype.GetType;CRevisionsChange.prototype["get_X"]=CRevisionsChange.prototype.GetX;CRevisionsChange.prototype["get_Y"]=CRevisionsChange.prototype.GetY;CRevisionsChange.prototype["get_Value"]=CRevisionsChange.prototype.GetValue;CRevisionsChange.prototype["put_Type"]=CRevisionsChange.prototype.SetType;CRevisionsChange.prototype["put_XY"]=CRevisionsChange.prototype.SetXY;CRevisionsChange.prototype["put_Value"]= CRevisionsChange.prototype.SetValue;CRevisionsChange.prototype["get_LockUserId"]=CRevisionsChange.prototype.get_LockUserId;CRevisionsChange.prototype["put_MoveType"]=CRevisionsChange.prototype.SetMoveType;CRevisionsChange.prototype["get_MoveType"]=CRevisionsChange.prototype.GetMoveType;CRevisionsChange.prototype["get_MoveId"]=CRevisionsChange.prototype.GetMoveId;CRevisionsChange.prototype["is_MovedDown"]=CRevisionsChange.prototype.IsMovedDown;"use strict";function Sort_Ranges_X0(A,B){if(!A.X0||!B.X0)return 0; if(A.X0B.X0)return 1;return 0}function FlowObjects_CheckInjection(Range1,Range2){for(var Index=0;Index=R2.X0&&R1.X0<=R2.X1&&R1.X1>=R2.X0&&R1.X1<=R2.X1)bInject=true}if(!bInject)return false}return true}function FlowObjects_CompareRanges(Range1,Range2){if(Range1.lengthRange2.length)return-1; for(var Index=0;Index.001||Math.abs(Range1[Index].X1-Range2[Index].X1))return-1;return 0}function CFlowBase(){}CFlowBase.prototype.IsPointIn=function(X,Y){return X<=this.X+this.W&&X>=this.X&&Y>=this.Y&&Y<=this.Y+this.H};CFlowBase.prototype.UpdateCursorType=function(X,Y,PageIndex){};CFlowBase.prototype.Get_Distance=function(){var oDist=this.Distance;return new AscFormat.CDistance(AscFormat.getValOrDefault(oDist.L,AscFormat.DISTANCE_TO_TEXT_LEFTRIGHT), AscFormat.getValOrDefault(oDist.T,0),AscFormat.getValOrDefault(oDist.R,AscFormat.DISTANCE_TO_TEXT_LEFTRIGHT),AscFormat.getValOrDefault(oDist.B,0))};CFlowBase.prototype.getArrayWrapIntervals=function(x0,y0,x1,y1,Y0Sp,Y1Sp,LeftField,RightField,ret,bMathWrap){if(this.WrappingType===WRAPPING_TYPE_THROUGH||this.WrappingType===WRAPPING_TYPE_TIGHT){y0=Y0Sp;y1=Y1Sp}var top=this.Y-AscFormat.getValOrDefault(this.Distance.T,0);var bottom=this.Y+this.H+AscFormat.getValOrDefault(this.Distance.B,0);if(y1bottom)return ret;var b_check=false,X0,X1,Y1,WrapType=bMathWrap===true?WRAPPING_TYPE_SQUARE:this.WrappingType;switch(WrapType){case WRAPPING_TYPE_NONE:{return ret}case WRAPPING_TYPE_SQUARE:case WRAPPING_TYPE_THROUGH:case WRAPPING_TYPE_TIGHT:{X0=this.X-AscFormat.getValOrDefault(this.Distance.L,AscFormat.DISTANCE_TO_TEXT_LEFTRIGHT);X1=this.X+this.W+AscFormat.getValOrDefault(this.Distance.R,AscFormat.DISTANCE_TO_TEXT_LEFTRIGHT);Y1=bottom;b_check=true;break}case WRAPPING_TYPE_TOP_AND_BOTTOM:{var L= this.X-AscFormat.getValOrDefault(this.Distance.L,AscFormat.DISTANCE_TO_TEXT_LEFTRIGHT);var R=this.X+this.W+AscFormat.getValOrDefault(this.Distance.R,AscFormat.DISTANCE_TO_TEXT_LEFTRIGHT);if(RRightField)return ret;X0=x0;X1=x1;Y1=bottom;break}}if(b_check){var dx=this.WrappingType===WRAPPING_TYPE_SQUARE?6.35:3.175;if(X0RightField-dx)X1=x1}ret.push({X0:X0,X1:X1,Y1:Y1,typeLeft:this.WrappingType,typeRight:this.WrappingType,bFlowObject:true});return ret};CFlowBase.prototype.GetElement= function(){return this.Table};CFlowBase.prototype.GetPage=function(){return this.PageNum};CFlowBase.prototype.IsFlowTable=function(){return false};CFlowBase.prototype.CheckDocumentContent=function(oDocContent){if(!this.Table.Parent)return false;return oDocContent===this.Table.Parent||oDocContent.GetDocumentContentForRecalcInfo()===this.Table.Parent.GetDocumentContentForRecalcInfo()};function CFlowTable(Table,PageIndex){CFlowBase.call(this);this.Table=Table;this.Id=Table.Get_Id();this.PageNum=Table.Get_StartPage_Absolute(); this.PageController=PageIndex-Table.PageNum;this.Distance=Table.Distance;this.WrappingType=WRAPPING_TYPE_SQUARE;var oBounds=this.Table.GetPageBounds(this.PageController);this.X=oBounds.Left;this.Y=AscCommon.CorrectMMToTwips(oBounds.Top)+AscCommon.TwipsToMM(1);this.W=oBounds.Right-oBounds.Left;this.H=AscCommon.CorrectMMToTwips(oBounds.Bottom-oBounds.Top)}CFlowTable.prototype=Object.create(CFlowBase.prototype);CFlowTable.prototype.constructor=CFlowTable;CFlowTable.prototype.IsFlowTable=function(){return true}; function CFlowParagraph(Paragraph,X,Y,W,H,Dx,Dy,StartIndex,FlowCount,Wrap){CFlowBase.call(this);this.Table=Paragraph;this.Paragraph=Paragraph;this.Id=Paragraph.Get_Id();this.PageNum=Paragraph.PageNum+Paragraph.GetPagesCount()-1;this.PageController=0;this.StartIndex=StartIndex;this.FlowCount=FlowCount;this.Distance={T:Dy,B:Dy,L:Dx,R:Dx};this.X=X;this.Y=Y;this.W=W;this.H=H;this.WrappingType=WRAPPING_TYPE_SQUARE;switch(Wrap){case undefined:case wrap_Around:case wrap_Auto:this.WrappingType=WRAPPING_TYPE_SQUARE; break;case wrap_None:this.WrappingType=WRAPPING_TYPE_NONE;break;case wrap_NotBeside:this.WrappingType=WRAPPING_TYPE_TOP_AND_BOTTOM;break;case wrap_Through:this.WrappingType=WRAPPING_TYPE_THROUGH;break;case wrap_Tight:this.WrappingType=WRAPPING_TYPE_TIGHT;break}}CFlowParagraph.prototype=Object.create(CFlowBase.prototype);CFlowParagraph.prototype.constructor=CFlowParagraph;"use strict";var g_fontApplication=AscFonts.g_fontApplication;var g_oTableId=AscCommon.g_oTableId;var g_oTextMeasurer=AscCommon.g_oTextMeasurer; var isRealObject=AscCommon.isRealObject;var History=AscCommon.History;var HitInLine=AscFormat.HitInLine;var MOVE_DELTA=AscFormat.MOVE_DELTA;var c_oAscRelativeFromH=Asc.c_oAscRelativeFromH;var c_oAscRelativeFromV=Asc.c_oAscRelativeFromV;var c_oAscSectionBreakType=Asc.c_oAscSectionBreakType;var para_Unknown=-1;var para_RunBase=0;var para_Text=1;var para_Space=2;var para_TextPr=3;var para_End=4;var para_NewLine=16;var para_NewLineRendered=17;var para_InlineBreak=18;var para_PageBreakRendered=19;var para_Numbering= 20;var para_Tab=21;var para_Drawing=22;var para_PageNum=23;var para_FlowObjectAnchor=24;var para_HyperlinkStart=25;var para_HyperlinkEnd=32;var para_CollaborativeChangesStart=33;var para_CollaborativeChangesEnd=34;var para_CommentStart=35;var para_CommentEnd=36;var para_PresentationNumbering=37;var para_Math=38;var para_Run=39;var para_Sym=40;var para_Comment=41;var para_Hyperlink=48;var para_Math_Run=49;var para_Math_Placeholder=50;var para_Math_Composition=51;var para_Math_Text=52;var para_Math_Ampersand= 53;var para_Field=54;var para_Math_BreakOperator=55;var para_Math_Content=56;var para_FootnoteReference=57;var para_FootnoteRef=64;var para_Separator=65;var para_ContinuationSeparator=66;var para_PageCount=67;var para_InlineLevelSdt=68;var para_FieldChar=69;var para_InstrText=70;var para_Bookmark=71;var para_RevisionMove=72;var para_EndnoteReference=73;var para_EndnoteRef=74;var break_Line=1;var break_Page=2;var break_Column=3;var nbsp_charcode=160;var nbsp_string=String.fromCharCode(160);var sp_string= String.fromCharCode(50);var g_aNumber=[];g_aNumber[48]=1;g_aNumber[49]=1;g_aNumber[50]=1;g_aNumber[51]=1;g_aNumber[52]=1;g_aNumber[53]=1;g_aNumber[54]=1;g_aNumber[55]=1;g_aNumber[56]=1;g_aNumber[57]=1;var g_oSRCFPSC=[];g_oSRCFPSC[para_Text]=1;g_oSRCFPSC[para_Space]=1;g_oSRCFPSC[para_End]=1;g_oSRCFPSC[para_Tab]=1;g_oSRCFPSC[para_Sym]=1;g_oSRCFPSC[para_PageCount]=1;g_oSRCFPSC[para_FieldChar]=1;g_oSRCFPSC[para_InstrText]=1;g_oSRCFPSC[para_Bookmark]=1;var g_aSpecialSymbols=[];g_aSpecialSymbols[174]=1; var g_aCCNBAEL=[];var PARATEXT_FLAGS_MASK=4294967295;var PARATEXT_FLAGS_FONTKOEF_SCRIPT=1;var PARATEXT_FLAGS_FONTKOEF_SMALLCAPS=2;var PARATEXT_FLAGS_SPACEAFTER=65536;var PARATEXT_FLAGS_CAPITALS=131072;var PARATEXT_FLAGS_NON_FONTKOEF_SCRIPT=PARATEXT_FLAGS_MASK^PARATEXT_FLAGS_FONTKOEF_SCRIPT;var PARATEXT_FLAGS_NON_FONTKOEF_SMALLCAPS=PARATEXT_FLAGS_MASK^PARATEXT_FLAGS_FONTKOEF_SMALLCAPS;var PARATEXT_FLAGS_NON_SPACEAFTER=PARATEXT_FLAGS_MASK^PARATEXT_FLAGS_SPACEAFTER;var PARATEXT_FLAGS_NON_CAPITALS=PARATEXT_FLAGS_MASK^ PARATEXT_FLAGS_CAPITALS;var TEXTWIDTH_DIVIDER=16384;var AUTOCORRECT_FLAGS_NONE=0;var AUTOCORRECT_FLAGS_ALL=4294967295;var AUTOCORRECT_FLAGS_FRENCH_PUNCTUATION=1;var AUTOCORRECT_FLAGS_SMART_QUOTES=2;var AUTOCORRECT_FLAGS_HYPHEN_WITH_DASH=4;var AUTOCORRECT_FLAGS_HYPERLINK=8;var AUTOCORRECT_FLAGS_FIRST_LETTER_SENTENCE=16;var AUTOCORRECT_FLAGS_NUMBERING=32;function CRunElementBase(){this.Width=0|0;this.WidthVisible=0|0}CRunElementBase.prototype.Type=para_RunBase;CRunElementBase.prototype.Get_Type=function(){return this.Type}; CRunElementBase.prototype.Draw=function(X,Y,Context,PDSE){};CRunElementBase.prototype.Measure=function(Context,TextPr){this.Width=0|0;this.WidthVisible=0|0};CRunElementBase.prototype.Get_Width=function(){return this.Width/TEXTWIDTH_DIVIDER};CRunElementBase.prototype.Get_WidthVisible=function(){return this.WidthVisible/TEXTWIDTH_DIVIDER};CRunElementBase.prototype.Set_WidthVisible=function(WidthVisible){this.WidthVisible=WidthVisible*TEXTWIDTH_DIVIDER|0};CRunElementBase.prototype.Set_Width=function(Width){this.Width= Width*TEXTWIDTH_DIVIDER|0};CRunElementBase.prototype.Is_RealContent=function(){return true};CRunElementBase.prototype.Can_AddNumbering=function(){return true};CRunElementBase.prototype.Copy=function(){return new CRunElementBase};CRunElementBase.prototype.Write_ToBinary=function(Writer){Writer.WriteLong(this.Type)};CRunElementBase.prototype.Read_FromBinary=function(Reader){};CRunElementBase.prototype.GetType=function(){return this.Type};CRunElementBase.prototype.IsDiacriticalSymbol=function(){return false}; CRunElementBase.prototype.CanBeAtBeginOfLine=function(){return true};CRunElementBase.prototype.CanBeAtEndOfLine=function(){return true};CRunElementBase.prototype.GetAutoCorrectFlags=function(){return AUTOCORRECT_FLAGS_NONE};CRunElementBase.prototype.IsPunctuation=function(){return false};CRunElementBase.prototype.IsDot=function(){return false};CRunElementBase.prototype.IsExclamationMark=function(){return false};CRunElementBase.prototype.IsQuestionMark=function(){return false};CRunElementBase.prototype.IsHyphen= function(){return false};CRunElementBase.prototype.IsEqual=function(oElement){return this.Type===oElement.Type};CRunElementBase.prototype.IsSpaceAfter=function(){return false};CRunElementBase.prototype.IsNeedSaveRecalculateObject=function(){return false};function ParaText(nCharCode){CRunElementBase.call(this);this.Value=undefined!==nCharCode?nCharCode:0;this.Width=0|0;this.WidthVisible=0|0;this.Flags=0|0;this.Set_SpaceAfter(this.private_IsSpaceAfter());if(AscFonts.IsCheckSymbols)AscFonts.FontPickerByCharacter.getFontBySymbol(this.Value)} ParaText.prototype=Object.create(CRunElementBase.prototype);ParaText.prototype.constructor=ParaText;ParaText.prototype.Type=para_Text;ParaText.prototype.Set_CharCode=function(CharCode){this.Value=CharCode;this.Set_SpaceAfter(this.private_IsSpaceAfter());if(AscFonts.IsCheckSymbols)AscFonts.FontPickerByCharacter.getFontBySymbol(this.Value)};ParaText.prototype.GetCharCode=function(){return this.Value};ParaText.prototype.Draw=function(X,Y,Context,PDSE,oTextPr){if(undefined!==this.LGap){this.private_DrawGapsBackground(X, Y,Context,PDSE,oTextPr);X+=this.LGap}var CharCode=this.Value;var FontKoef=1;if(this.Flags&PARATEXT_FLAGS_FONTKOEF_SCRIPT&&this.Flags&PARATEXT_FLAGS_FONTKOEF_SMALLCAPS)FontKoef=smallcaps_and_script_koef;else if(this.Flags&PARATEXT_FLAGS_FONTKOEF_SCRIPT)FontKoef=AscCommon.vaKSize;else if(this.Flags&PARATEXT_FLAGS_FONTKOEF_SMALLCAPS)FontKoef=smallcaps_Koef;Context.SetFontSlot(this.Flags>>8&255,FontKoef);var ResultCharCode=this.Flags&PARATEXT_FLAGS_CAPITALS?String.fromCharCode(CharCode).toUpperCase().charCodeAt(0): CharCode;if(true!==this.Is_NBSP())Context.FillTextCode(X,Y,ResultCharCode);else if(editor&&editor.ShowParaMarks)Context.FillText(X,Y,String.fromCharCode(176))};ParaText.prototype.Measure=function(Context,TextPr){var bCapitals=false;var CharCode=this.Value;var ResultCharCode=CharCode;if(true===TextPr.Caps||true===TextPr.SmallCaps){this.Flags|=PARATEXT_FLAGS_CAPITALS;ResultCharCode=String.fromCharCode(CharCode).toUpperCase().charCodeAt(0);bCapitals=ResultCharCode===CharCode?true:false}else{this.Flags&= PARATEXT_FLAGS_NON_CAPITALS;bCapitals=false}if(TextPr.VertAlign!==AscCommon.vertalign_Baseline)this.Flags|=PARATEXT_FLAGS_FONTKOEF_SCRIPT;else this.Flags&=PARATEXT_FLAGS_NON_FONTKOEF_SCRIPT;if(true!=TextPr.Caps&&true===TextPr.SmallCaps&&false===bCapitals)this.Flags|=PARATEXT_FLAGS_FONTKOEF_SMALLCAPS;else this.Flags&=PARATEXT_FLAGS_NON_FONTKOEF_SMALLCAPS;var Hint=TextPr.RFonts.Hint;var bCS=TextPr.CS;var bRTL=TextPr.RTL;var lcid=TextPr.Lang.EastAsia;var FontSlot=g_font_detector.Get_FontClass(ResultCharCode, Hint,lcid,bCS,bRTL);var Flags_0Byte=this.Flags>>0&255;var Flags_2Byte=this.Flags>>16&255;this.Flags=Flags_0Byte|(FontSlot&255)<<8|Flags_2Byte<<16;var FontKoef=1;if(this.Flags&PARATEXT_FLAGS_FONTKOEF_SCRIPT&&this.Flags&PARATEXT_FLAGS_FONTKOEF_SMALLCAPS)FontKoef=smallcaps_and_script_koef;else if(this.Flags&PARATEXT_FLAGS_FONTKOEF_SCRIPT)FontKoef=AscCommon.vaKSize;else if(this.Flags&PARATEXT_FLAGS_FONTKOEF_SMALLCAPS)FontKoef=smallcaps_Koef;var FontSize=TextPr.FontSize;if(1!==FontKoef)FontKoef=(FontSize* FontKoef*2+.5|0)/2/FontSize;Context.SetFontSlot(FontSlot,FontKoef);var Temp=Context.MeasureCode(ResultCharCode);var ResultWidth=Math.max(Temp.Width+TextPr.Spacing,0)*TEXTWIDTH_DIVIDER|0;this.Width=ResultWidth;this.WidthVisible=ResultWidth;if(this.LGap||this.RGap){delete this.LGap;delete this.RGap}};ParaText.prototype.Is_RealContent=function(){return true};ParaText.prototype.Can_AddNumbering=function(){return true};ParaText.prototype.Copy=function(){return new ParaText(this.Value)};ParaText.prototype.IsEqual= function(oElement){return oElement.Type===this.Type&&this.Value===oElement.Value};ParaText.prototype.Is_NBSP=function(){return this.Value===nbsp_charcode};ParaText.prototype.IsNBSP=function(){return this.Value===nbsp_charcode};ParaText.prototype.IsPunctuation=function(){return!!(undefined!==AscCommon.g_aPunctuation[this.Value])};ParaText.prototype.Is_Number=function(){if(1===g_aNumber[this.Value])return true;return false};ParaText.prototype.Is_SpecialSymbol=function(){if(1===g_aSpecialSymbols[this.Value])return true; return false};ParaText.prototype.IsSpaceAfter=function(){return this.Flags&PARATEXT_FLAGS_SPACEAFTER?true:false};ParaText.prototype.GetCharForSpellCheck=function(bCaps){if(8217===this.Value)return String.fromCharCode(39);else if(true===bCaps)return String.fromCharCode(this.Value).toUpperCase();else return String.fromCharCode(this.Value)};ParaText.prototype.Set_SpaceAfter=function(bSpaceAfter){if(bSpaceAfter)this.Flags|=PARATEXT_FLAGS_SPACEAFTER;else this.Flags&=PARATEXT_FLAGS_NON_SPACEAFTER};ParaText.prototype.IsNoBreakHyphen= function(){return false===this.IsSpaceAfter()&&this.Value===45};ParaText.prototype.Write_ToBinary=function(Writer){Writer.WriteLong(para_Text);Writer.WriteLong(this.Value)};ParaText.prototype.Read_FromBinary=function(Reader){this.Set_CharCode(Reader.GetLong())};ParaText.prototype.private_IsSpaceAfter=function(){if(45===this.Value||8212===this.Value)return true;if(AscCommon.isEastAsianScript(this.Value)&&this.CanBeAtEndOfLine())return true;return false};ParaText.prototype.CanBeAtBeginOfLine=function(){if(this.Is_NBSP())return false; return!(AscCommon.g_aPunctuation[this.Value]&AscCommon.PUNCTUATION_FLAG_CANT_BE_AT_BEGIN)};ParaText.prototype.CanBeAtEndOfLine=function(){if(this.Is_NBSP())return false;return!(AscCommon.g_aPunctuation[this.Value]&AscCommon.PUNCTUATION_FLAG_CANT_BE_AT_END)};ParaText.prototype.GetAutoCorrectFlags=function(){if(33===this.Value||34===this.Value||39===this.Value||45===this.Value||58===this.Value||59===this.Value||63===this.Value)return AUTOCORRECT_FLAGS_ALL;if((this.IsPunctuation()||this.Is_Number())&& 92!==this.Value&&47!==this.Value)return AUTOCORRECT_FLAGS_FIRST_LETTER_SENTENCE};ParaText.prototype.IsDiacriticalSymbol=function(){return!!(768<=this.Value&&this.Value<=879)};ParaText.prototype.IsDot=function(){return this.Value===46};ParaText.prototype.IsExclamationMark=function(){return this.Value===33};ParaText.prototype.IsQuestionMark=function(){return this.Value===63};ParaText.prototype.IsHyphen=function(){return this.Value===45};ParaText.prototype.SetGaps=function(nLeftGap,nRightGap){this.LGap= nLeftGap;this.RGap=nRightGap;this.Width+=(nLeftGap+nRightGap)*TEXTWIDTH_DIVIDER|0;this.WidthVisible+=(nLeftGap+nRightGap)*TEXTWIDTH_DIVIDER|0};ParaText.prototype.ResetGapBackground=function(){this.RGapCount=undefined;this.RGapCharCode=undefined;this.RGapCharWidth=undefined;this.RGapShift=undefined;this.RGapFontSlot=undefined;this.RGapFont=undefined};ParaText.prototype.SetGapBackground=function(nCount,nCharCode,nCombWidth,oContext,sFont,oTextPr,oTheme,nCombBorderW){this.RGapCount=nCount;this.RGapCharCode= nCharCode;this.RGapFontSlot=g_font_detector.Get_FontClass(nCharCode,oTextPr.RFonts.Hint,oTextPr.Lang.EastAsia,oTextPr.CS,oTextPr.RTL);if(sFont){this.RGapFont=sFont;var oCurTextPr=oTextPr.Copy();oCurTextPr.SetFontFamily(sFont);oContext.SetTextPr(oCurTextPr,oTheme);oContext.SetFontSlot(this.RGapFontSlot,oTextPr.Get_FontKoef())}this.RGapCharWidth=!nCharCode?nCombBorderW:Math.max(oContext.MeasureCode(nCharCode).Width+oTextPr.Spacing+nCombBorderW,nCombBorderW);this.RGapShift=Math.max(nCombWidth,this.RGapCharWidth); if(sFont)oContext.SetTextPr(oTextPr,oTheme)};ParaText.prototype.private_DrawGapsBackground=function(X,Y,oContext,PDSE,oTextPr){if(!this.RGapCharCode)return;if(this.RGapFont){var oCurTextPr=oTextPr.Copy();oCurTextPr.SetFontFamily(this.RGapFont);oContext.SetTextPr(oCurTextPr,PDSE.Theme);oContext.SetFontSlot(this.RGapFontSlot,oTextPr.Get_FontKoef())}if(this.RGap&&this.RGapCount){X+=this.Width/TEXTWIDTH_DIVIDER;var nShift=(this.RGapShift-this.RGapCharWidth)/2;for(var nIndex=0;nIndex=nStrWidth){this.SectionEnd.ColonsCount= parseInt((nWidth-nStrWidth)/(2*nSymWidth));this.SectionEnd.String=oPr.String;var nAdd=0;var nResultWidth=2*nSymWidth*this.SectionEnd.ColonsCount+nStrWidth;if(nResultWidth0)this.SectionEnd.ColonWidth+=(nWidth-nResultWidth)/this.SectionEnd.ColonsCount}this.WidthVisible=nWidth*TEXTWIDTH_DIVIDER|0};ParaEnd.prototype.ClearSectionEnd=function(){this.SectionEnd=null};ParaEnd.prototype.private_DrawSectionEnd=function(X,Y,Context){Context.b_color1(0,0,0,255);Context.p_color(0,0,0,255);Context.SetFont({FontFamily:{Name:"Courier New",Index:-1},FontSize:8,Italic:false,Bold:false});for(var nPos=0,nCount=this.SectionEnd.ColonsCount;nPos< nCount;++nPos){Context.FillTextCode(X,Y,this.SectionEnd.ColonSymbol);X+=this.SectionEnd.ColonWidth}if(this.SectionEnd.String){for(var nPos=0,nCount=this.SectionEnd.String.length;nPos=nStrWidth){var Count=parseInt((W-nStrWidth)/(2*nSymWidth));var strResult=strBreakPage;for(var Index=0;Index1)AddW=(W-ResultW)/(Count-1);for(var Index=0;Index.01){var sChar=null,nCharWidth=0;switch(this.Leader){case Asc.c_oAscTabLeader.Dot:sChar=".";nCharWidth=this.DotWidth;break;case Asc.c_oAscTabLeader.Heavy:case Asc.c_oAscTabLeader.Underscore:sChar="_";nCharWidth= this.UnderscoreWidth;break;case Asc.c_oAscTabLeader.Hyphen:sChar="-";nCharWidth=this.HyphenWidth;break;case Asc.c_oAscTabLeader.MiddleDot:sChar="\u00b7";nCharWidth=this.MiddleDotWidth;break}if(null!==sChar&&nCharWidth>.001){Context.SetFontSlot(fontslot_ASCII,1);var nCharsCount=Math.floor(this.WidthVisible/nCharWidth);var _X=X+(this.WidthVisible-nCharsCount*nCharWidth)/2;for(var nIndex=0;nIndex0)Context.FillText2(X+X0,Y,String.fromCharCode(tab_Symbol),0,this.Width);else Context.FillText2(X,Y,String.fromCharCode(tab_Symbol),this.RealWidth-this.Width,this.Width)}};ParaTab.prototype.Measure=function(Context){this.DotWidth=Context.Measure(".").Width;this.UnderscoreWidth=Context.Measure("_").Width;this.HyphenWidth=Context.Measure("-").Width* 1.5;this.MiddleDotWidth=Context.Measure("\u00b7").Width;Context.SetFont({FontFamily:{Name:"ASCW3",Index:-1},FontSize:10,Italic:false,Bold:false});this.RealWidth=Context.Measure(String.fromCharCode(tab_Symbol)).Width};ParaTab.prototype.SetLeader=function(nLeaderType){this.Leader=nLeaderType};ParaTab.prototype.Get_Width=function(){return this.Width};ParaTab.prototype.Get_WidthVisible=function(){return this.WidthVisible};ParaTab.prototype.Set_WidthVisible=function(WidthVisible){this.WidthVisible=WidthVisible}; ParaTab.prototype.Copy=function(){return new ParaTab};ParaTab.prototype.IsNeedSaveRecalculateObject=function(){return true};ParaTab.prototype.SaveRecalculateObject=function(){return{Width:this.Width,WidthVisible:this.WidthVisible}};ParaTab.prototype.LoadRecalculateObject=function(RecalcObj){this.Width=RecalcObj.Width;this.WidthVisible=RecalcObj.WidthVisible};ParaTab.prototype.PrepareRecalculateObject=function(){};function ParaPageNum(){CRunElementBase.call(this);this.FontKoef=1;this.NumWidths=[]; this.Widths=[];this.String=[];this.Width=0;this.WidthVisible=0;this.Parent=null}ParaPageNum.prototype=Object.create(CRunElementBase.prototype);ParaPageNum.prototype.constructor=ParaPageNum;ParaPageNum.prototype.Type=para_PageNum;ParaPageNum.prototype.Draw=function(X,Y,Context){var Len=this.String.length;var _X=X;var _Y=Y;Context.SetFontSlot(fontslot_ASCII,this.FontKoef);for(var Index=0;Index0)AscCommon.CollaborativeEditing.Add_NewImage(Unifill.fill.RasterImageId)};CChangesParaTextPrUnifill.prototype.Merge=private_ParaTextPrChangesOnMergeValue;function CChangesParaTextPrFontSizeCS(Class,Old,New,Color){AscDFH.CChangesBaseDoubleProperty.call(this,Class,Old,New,Color)}CChangesParaTextPrFontSizeCS.prototype=Object.create(AscDFH.CChangesBaseDoubleProperty.prototype); CChangesParaTextPrFontSizeCS.prototype.constructor=CChangesParaTextPrFontSizeCS;CChangesParaTextPrFontSizeCS.prototype.Type=AscDFH.historyitem_TextPr_FontSizeCS;CChangesParaTextPrFontSizeCS.prototype.private_SetValue=function(Value){this.Class.Value.FontSizeCS=Value};CChangesParaTextPrFontSizeCS.prototype.Merge=private_ParaTextPrChangesOnMergeValue;function CChangesParaTextPrTextOutline(Class,Old,New,Color){AscDFH.CChangesBaseObjectProperty.call(this,Class,Old,New,Color)}CChangesParaTextPrTextOutline.prototype= Object.create(AscDFH.CChangesBaseObjectProperty.prototype);CChangesParaTextPrTextOutline.prototype.constructor=CChangesParaTextPrTextOutline;CChangesParaTextPrTextOutline.prototype.Type=AscDFH.historyitem_TextPr_Outline;CChangesParaTextPrTextOutline.prototype.private_SetValue=function(Value){this.Class.Value.TextOutline=Value};CChangesParaTextPrTextOutline.prototype.private_CreateObject=function(){return new AscFormat.CLn};CChangesParaTextPrTextOutline.prototype.Merge=private_ParaTextPrChangesOnMergeValue; function CChangesParaTextPrTextFill(Class,Old,New,Color){AscDFH.CChangesBaseObjectProperty.call(this,Class,Old,New,Color)}CChangesParaTextPrTextFill.prototype=Object.create(AscDFH.CChangesBaseObjectProperty.prototype);CChangesParaTextPrTextFill.prototype.constructor=CChangesParaTextPrTextFill;CChangesParaTextPrTextFill.prototype.Type=AscDFH.historyitem_TextPr_Fill;CChangesParaTextPrTextFill.prototype.private_SetValue=function(Value){this.Class.Value.TextFill=Value};CChangesParaTextPrTextFill.prototype.private_CreateObject= function(){return new AscFormat.CUniFill};CChangesParaTextPrTextFill.prototype.Merge=private_ParaTextPrChangesOnMergeValue;"use strict";var drawing_Inline=1;var drawing_Anchor=2;var WRAPPING_TYPE_NONE=0;var WRAPPING_TYPE_SQUARE=1;var WRAPPING_TYPE_THROUGH=2;var WRAPPING_TYPE_TIGHT=3;var WRAPPING_TYPE_TOP_AND_BOTTOM=4;var WRAP_HIT_TYPE_POINT=0;var WRAP_HIT_TYPE_SECTION=1;var c_oAscAlignH=Asc.c_oAscAlignH;var c_oAscAlignV=Asc.c_oAscAlignV;function ParaDrawing(W,H,GraphicObj,DrawingDocument,DocumentContent, Parent){CRunElementBase.call(this);this.Id=AscCommon.g_oIdCounter.Get_NewId();this.DrawingType=drawing_Inline;this.GraphicObj=GraphicObj;this.Form=false;this.X=0;this.Y=0;this.Width=0;this.Height=0;this.OrigX=0;this.OrigY=0;this.ShiftX=0;this.ShiftY=0;this.PageNum=0;this.LineNum=0;this.YOffset=0;this.DocumentContent=DocumentContent;this.DrawingDocument=DrawingDocument;this.Parent=Parent;this.LogicDocument=DrawingDocument?DrawingDocument.m_oLogicDocument:null;this.Distance={T:0,B:0,L:0,R:0};this.LayoutInCell= true;this.RelativeHeight=undefined;this.SimplePos={Use:false,X:0,Y:0};this.Extent={W:W,H:H};this.EffectExtent={L:0,T:0,R:0,B:0};this.docPr=new AscFormat.CNvPr;this.SizeRelH=undefined;this.SizeRelV=undefined;this.AllowOverlap=true;this.Locked=null;this.Hidden=null;this.PositionH={RelativeFrom:c_oAscRelativeFromH.Column,Align:false,Value:0,Percent:false};this.PositionV={RelativeFrom:c_oAscRelativeFromV.Paragraph,Align:false,Value:0,Percent:false};this.PositionH_Old=undefined;this.PositionV_Old=undefined; this.Internal_Position=new CAnchorPosition;this.wrappingType=WRAPPING_TYPE_THROUGH;this.useWrap=true;if(typeof CWrapPolygon!=="undefined")this.wrappingPolygon=new CWrapPolygon(this);this.document=editor.WordControl.m_oLogicDocument;this.drawingDocument=DrawingDocument;this.graphicObjects=editor.WordControl.m_oLogicDocument.DrawingObjects;this.selected=false;this.behindDoc=false;this.bNoNeedToAdd=false;this.pageIndex=-1;this.Lock=new AscCommon.CLock;this.ParaMath=null;this.SkipOnRecalculate=false; this.LineTop=null;this.LineBottom=null;g_oTableId.Add(this,this.Id);if(this.graphicObjects){this.Set_RelativeHeight(this.graphicObjects.getZIndex());if(History.Is_On()&&!g_oTableId.m_bTurnOff)this.graphicObjects.addGraphicObject(this)}}ParaDrawing.prototype=Object.create(CRunElementBase.prototype);ParaDrawing.prototype.constructor=ParaDrawing;ParaDrawing.prototype.Type=para_Drawing;ParaDrawing.prototype.Get_Type=function(){return this.Type};ParaDrawing.prototype.Get_Width=function(){return this.Width}; ParaDrawing.prototype.Get_WidthVisible=function(){return this.WidthVisible};ParaDrawing.prototype.Set_WidthVisible=function(WidthVisible){this.WidthVisible=WidthVisible};ParaDrawing.prototype.GetSelectedContent=function(SelectedContent){if(this.GraphicObj&&this.GraphicObj.GetSelectedContent)this.GraphicObj.GetSelectedContent(SelectedContent)};ParaDrawing.prototype.GetSearchElementId=function(bNext,bCurrent){if(AscCommon.isRealObject(this.GraphicObj)&&typeof this.GraphicObj.GetSearchElementId==="function")return this.GraphicObj.GetSearchElementId(bNext, bCurrent);return null};ParaDrawing.prototype.FindNextFillingForm=function(isNext,isCurrent){if(AscCommon.isRealObject(this.GraphicObj)&&typeof this.GraphicObj.FindNextFillingForm==="function")return this.GraphicObj.FindNextFillingForm(isNext,isCurrent);return null};ParaDrawing.prototype.CheckCorrect=function(){if(!this.GraphicObj)return false;if(this.GraphicObj&&this.GraphicObj.checkCorrect)return this.GraphicObj.checkCorrect();return true};ParaDrawing.prototype.GetAllDrawingObjects=function(DrawingObjects){if(null== DrawingObjects)DrawingObjects=[];if(this.GraphicObj.GetAllDrawingObjects)this.GraphicObj.GetAllDrawingObjects(DrawingObjects)};ParaDrawing.prototype.canRotate=function(){return AscCommon.isRealObject(this.GraphicObj)&&typeof this.GraphicObj.canRotate=="function"&&this.GraphicObj.canRotate()};ParaDrawing.prototype.GetParagraph=function(){return this.Get_ParentParagraph()};ParaDrawing.prototype.GetRun=function(){return this.Get_Run()};ParaDrawing.prototype.Get_Run=function(){var oParagraph=this.Get_ParentParagraph(); if(oParagraph)return oParagraph.Get_DrawingObjectRun(this.Id);return null};ParaDrawing.prototype.Get_Props=function(OtherProps){var Props={};Props.Width=this.GraphicObj.extX;Props.Height=this.GraphicObj.extY;if(drawing_Inline===this.DrawingType)Props.WrappingStyle=c_oAscWrapStyle2.Inline;else if(WRAPPING_TYPE_NONE===this.wrappingType)Props.WrappingStyle=this.behindDoc===true?c_oAscWrapStyle2.Behind:c_oAscWrapStyle2.InFront;else switch(this.wrappingType){case WRAPPING_TYPE_SQUARE:Props.WrappingStyle= c_oAscWrapStyle2.Square;break;case WRAPPING_TYPE_TIGHT:Props.WrappingStyle=c_oAscWrapStyle2.Tight;break;case WRAPPING_TYPE_THROUGH:Props.WrappingStyle=c_oAscWrapStyle2.Through;break;case WRAPPING_TYPE_TOP_AND_BOTTOM:Props.WrappingStyle=c_oAscWrapStyle2.TopAndBottom;break;default:Props.WrappingStyle=c_oAscWrapStyle2.Inline;break}if(drawing_Inline===this.DrawingType)Props.Paddings={Left:AscFormat.DISTANCE_TO_TEXT_LEFTRIGHT,Right:AscFormat.DISTANCE_TO_TEXT_LEFTRIGHT,Top:0,Bottom:0};else{var oDistance= this.Get_Distance();Props.Paddings={Left:oDistance.L,Right:oDistance.R,Top:oDistance.T,Bottom:oDistance.B}}Props.AllowOverlap=this.AllowOverlap;Props.Position={X:this.X,Y:this.Y};Props.PositionH={RelativeFrom:this.PositionH.RelativeFrom,UseAlign:this.PositionH.Align,Align:true===this.PositionH.Align?this.PositionH.Value:undefined,Value:true===this.PositionH.Align?0:this.PositionH.Value,Percent:this.PositionH.Percent};Props.PositionV={RelativeFrom:this.PositionV.RelativeFrom,UseAlign:this.PositionV.Align, Align:true===this.PositionV.Align?this.PositionV.Value:undefined,Value:true===this.PositionV.Align?0:this.PositionV.Value,Percent:this.PositionV.Percent};if(this.SizeRelH&&this.SizeRelH.Percent>0)Props.SizeRelH={RelativeFrom:AscFormat.ConvertRelSizeHToRelPosition(this.SizeRelH.RelativeFrom),Value:this.SizeRelH.Percent*100>>0};if(this.SizeRelV&&this.SizeRelV.Percent>0)Props.SizeRelV={RelativeFrom:AscFormat.ConvertRelSizeVToRelPosition(this.SizeRelV.RelativeFrom),Value:this.SizeRelV.Percent*100>>0}; Props.Internal_Position=this.Internal_Position;Props.Locked=this.Lock.Is_Locked();var ParentParagraph=this.Get_ParentParagraph();if(ParentParagraph&&undefined!==ParentParagraph.Parent){var DocContent=ParentParagraph.Parent;if(true===DocContent.Is_DrawingShape()||DocContent.GetTopDocumentContent()instanceof CFootEndnote)Props.CanBeFlow=false}Props.title=this.docPr.title!==null?this.docPr.title:undefined;Props.description=this.docPr.descr!==null?this.docPr.descr:undefined;if(null!=OtherProps&&undefined!= OtherProps){if(undefined===OtherProps.Width||.001>Math.abs(Props.Width-OtherProps.Width))Props.Width=undefined;if(undefined===OtherProps.Height||.001>Math.abs(Props.Height-OtherProps.Height))Props.Height=undefined;if(undefined===OtherProps.WrappingStyle||Props.WrappingStyle!=OtherProps.WrappingStyle)Props.WrappingStyle=undefined;if(undefined===OtherProps.ImageUrl||Props.ImageUrl!=OtherProps.ImageUrl)Props.ImageUrl=undefined;if(undefined===OtherProps.Paddings.Left||.001>Math.abs(Props.Paddings.Left- OtherProps.Paddings.Left))Props.Paddings.Left=undefined;if(undefined===OtherProps.Paddings.Right||.001>Math.abs(Props.Paddings.Right-OtherProps.Paddings.Right))Props.Paddings.Right=undefined;if(undefined===OtherProps.Paddings.Top||.001>Math.abs(Props.Paddings.Top-OtherProps.Paddings.Top))Props.Paddings.Top=undefined;if(undefined===OtherProps.Paddings.Bottom||.001>Math.abs(Props.Paddings.Bottom-OtherProps.Paddings.Bottom))Props.Paddings.Bottom=undefined;if(undefined===OtherProps.AllowOverlap||Props.AllowOverlap!= OtherProps.AllowOverlap)Props.AllowOverlap=undefined;if(undefined===OtherProps.Position.X||.001>Math.abs(Props.Position.X-OtherProps.Position.X))Props.Position.X=undefined;if(undefined===OtherProps.Position.Y||.001>Math.abs(Props.Position.Y-OtherProps.Position.Y))Props.Position.Y=undefined;if(undefined===OtherProps.PositionH.RelativeFrom||Props.PositionH.RelativeFrom!=OtherProps.PositionH.RelativeFrom)Props.PositionH.RelativeFrom=undefined;if(undefined===OtherProps.PositionH.UseAlign||Props.PositionH.UseAlign!= OtherProps.PositionH.UseAlign)Props.PositionH.UseAlign=undefined;if(Props.PositionH.RelativeFrom===OtherProps.PositionH.RelativeFrom&&Props.PositionH.UseAlign===OtherProps.PositionH.UseAlign){if(true!=Props.PositionH.UseAlign&&.001>Math.abs(Props.PositionH.Value-OtherProps.PositionH.Value))Props.PositionH.Value=undefined;if(true===Props.PositionH.UseAlign&&Props.PositionH.Align!=OtherProps.PositionH.Align)Props.PositionH.Align=undefined}if(undefined===OtherProps.PositionV.RelativeFrom||Props.PositionV.RelativeFrom!= OtherProps.PositionV.RelativeFrom)Props.PositionV.RelativeFrom=undefined;if(undefined===OtherProps.PositionV.UseAlign||Props.PositionV.UseAlign!=OtherProps.PositionV.UseAlign)Props.PositionV.UseAlign=undefined;if(Props.PositionV.RelativeFrom===OtherProps.PositionV.RelativeFrom&&Props.PositionV.UseAlign===OtherProps.PositionV.UseAlign){if(true!=Props.PositionV.UseAlign&&.001>Math.abs(Props.PositionV.Value-OtherProps.PositionV.Value))Props.PositionV.Value=undefined;if(true===Props.PositionV.UseAlign&& Props.PositionV.Align!=OtherProps.PositionV.Align)Props.PositionV.Align=undefined}if(false===OtherProps.Locked)Props.Locked=false;if(false===OtherProps.CanBeFlow||false===Props.CanBeFlow)Props.CanBeFlow=false;else Props.CanBeFlow=true;if(undefined===OtherProps.title||Props.title!==OtherProps.title)Props.title=undefined;if(undefined===OtherProps.description||Props.description!==OtherProps.description)Props.description=undefined}return Props};ParaDrawing.prototype.Is_UseInDocument=function(){if(this.Parent){var Run= this.Parent.Get_DrawingObjectRun(this.Id);if(Run)return Run.Is_UseInDocument(this.Get_Id())}return false};ParaDrawing.prototype.IsUseInDocument=function(){return this.Is_UseInDocument()};ParaDrawing.prototype.CheckGroupSizes=function(){if(this.GraphicObj&&this.GraphicObj.CheckGroupSizes)this.GraphicObj.CheckGroupSizes()};ParaDrawing.prototype.Set_DrawingType=function(DrawingType){History.Add(new CChangesParaDrawingDrawingType(this,this.DrawingType,DrawingType));this.DrawingType=DrawingType};ParaDrawing.prototype.Set_WrappingType= function(WrapType){History.Add(new CChangesParaDrawingWrappingType(this,this.wrappingType,WrapType));this.wrappingType=WrapType};ParaDrawing.prototype.Set_Distance=function(L,T,R,B){var oDistance=this.Get_Distance();if(!AscFormat.isRealNumber(L))L=oDistance.L;if(!AscFormat.isRealNumber(T))T=oDistance.T;if(!AscFormat.isRealNumber(R))R=oDistance.R;if(!AscFormat.isRealNumber(B))B=oDistance.B;History.Add(new CChangesParaDrawingDistance(this,{Left:this.Distance.L,Top:this.Distance.T,Right:this.Distance.R, Bottom:this.Distance.B},{Left:L,Top:T,Right:R,Bottom:B}));this.Distance.L=L;this.Distance.R=R;this.Distance.T=T;this.Distance.B=B};ParaDrawing.prototype.Set_AllowOverlap=function(AllowOverlap){History.Add(new CChangesParaDrawingAllowOverlap(this,this.AllowOverlap,AllowOverlap));this.AllowOverlap=AllowOverlap};ParaDrawing.prototype.Set_PositionH=function(RelativeFrom,Align,Value,Percent){var _Value,_Percent;if(AscFormat.isRealNumber(Value)&&AscFormat.fApproxEqual(Value,0)&&true===Percent){_Value=0; _Percent=false}else{_Value=Value;_Percent=Percent}History.Add(new CChangesParaDrawingPositionH(this,{RelativeFrom:this.PositionH.RelativeFrom,Align:this.PositionH.Align,Value:this.PositionH.Value,Percent:this.PositionH.Percent},{RelativeFrom:RelativeFrom,Align:Align,Value:_Value,Percent:_Percent}));this.PositionH.RelativeFrom=RelativeFrom;this.PositionH.Align=Align;this.PositionH.Value=_Value;this.PositionH.Percent=_Percent};ParaDrawing.prototype.Set_PositionV=function(RelativeFrom,Align,Value,Percent){var _Value, _Percent;if(AscFormat.isRealNumber(Value)&&AscFormat.fApproxEqual(Value,0)&&true===Percent){_Value=0;_Percent=false}else{_Value=Value;_Percent=Percent}History.Add(new CChangesParaDrawingPositionV(this,{RelativeFrom:this.PositionV.RelativeFrom,Align:this.PositionV.Align,Value:this.PositionV.Value,Percent:this.PositionV.Percent},{RelativeFrom:RelativeFrom,Align:Align,Value:_Value,Percent:_Percent}));this.PositionV.RelativeFrom=RelativeFrom;this.PositionV.Align=Align;this.PositionV.Value=_Value;this.PositionV.Percent= _Percent};ParaDrawing.prototype.GetPositionH=function(){return{RelativeFrom:this.PositionH.RelativeFrom,Align:this.PositionH.Align,Value:this.PositionH.Value,Percent:this.PositionH.Percent}};ParaDrawing.prototype.GetPositionV=function(){return{RelativeFrom:this.PositionV.RelativeFrom,Align:this.PositionV.Align,Value:this.PositionV.Value,Percent:this.PositionV.Percent}};ParaDrawing.prototype.Set_BehindDoc=function(BehindDoc){History.Add(new CChangesParaDrawingBehindDoc(this,this.behindDoc,BehindDoc)); this.behindDoc=BehindDoc};ParaDrawing.prototype.Set_GraphicObject=function(graphicObject){var oldId=AscCommon.isRealObject(this.GraphicObj)?this.GraphicObj.Get_Id():null;var newId=AscCommon.isRealObject(graphicObject)?graphicObject.Get_Id():null;History.Add(new CChangesParaDrawingGraphicObject(this,oldId,newId));if(graphicObject)graphicObject.handleUpdateExtents();this.GraphicObj=graphicObject};ParaDrawing.prototype.setSimplePos=function(use,x,y){History.Add(new CChangesParaDrawingSimplePos(this, {Use:this.SimplePos.Use,X:this.SimplePos.X,Y:this.SimplePos.Y},{Use:use,X:x,Y:y}));this.SimplePos.Use=use;this.SimplePos.X=x;this.SimplePos.Y=y};ParaDrawing.prototype.setExtent=function(extX,extY){History.Add(new CChangesParaDrawingExtent(this,{W:this.Extent.W,H:this.Extent.H},{W:extX,H:extY}));this.Extent.W=extX;this.Extent.H=extY};ParaDrawing.prototype.addWrapPolygon=function(wrapPolygon){History.Add(new CChangesParaDrawingWrapPolygon(this,this.wrappingPolygon,wrapPolygon));this.wrappingPolygon= wrapPolygon};ParaDrawing.prototype.Set_Locked=function(bLocked){History.Add(new CChangesParaDrawingLocked(this,this.Locked,bLocked));this.Locked=bLocked};ParaDrawing.prototype.Set_RelativeHeight=function(nRelativeHeight){History.Add(new CChangesParaDrawingRelativeHeight(this,this.RelativeHeight,nRelativeHeight));this.Set_RelativeHeight2(nRelativeHeight)};ParaDrawing.prototype.Set_RelativeHeight2=function(nRelativeHeight){this.RelativeHeight=nRelativeHeight;if(this.graphicObjects&&AscFormat.isRealNumber(nRelativeHeight)&& nRelativeHeight>this.graphicObjects.maximalGraphicObjectZIndex)this.graphicObjects.maximalGraphicObjectZIndex=nRelativeHeight};ParaDrawing.prototype.setEffectExtent=function(L,T,R,B){var oEE=this.EffectExtent;History.Add(new CChangesParaDrawingEffectExtent(this,{L:oEE.L,T:oEE.T,R:oEE.R,B:oEE.B},{L:L,T:T,R:R,B:B}));this.EffectExtent.L=L;this.EffectExtent.T=T;this.EffectExtent.R=R;this.EffectExtent.B=B};ParaDrawing.prototype.Set_Parent=function(oParent){History.Add(new CChangesParaDrawingParent(this, this.Parent,oParent));this.Parent=oParent};ParaDrawing.prototype.IsWatermark=function(){if(!this.GraphicObj)return false;if(this.GraphicObj.getObjectType()!==AscDFH.historyitem_type_Shape&&this.GraphicObj.getObjectType()!==AscDFH.historyitem_type_ImageShape)return false;if(this.Is_Inline())return false;var oParagraph=this.GetParagraph();if(!(oParagraph instanceof Paragraph))return false;var oContent=oParagraph.Parent;if(!oContent||oContent.Is_DrawingShape(false))return false;var oHdrFtr=oContent.IsHdrFtr(true); if(!oHdrFtr)return false;var oRun=this.Get_Run();if(!oRun)return false;var arrDocPos=oRun.GetDocumentPositionFromObject();for(var nIndex=0,nCount=arrDocPos.length;nIndexstartX)l=startX;if(rstartY)t=startY;if(b0||EE.T>0||EE.R>0||EE.B>0)c.setEffectExtent(EE.L,EE.T,EE.R,EE.B);c.docPr.setFromOther(this.docPr);if(this.ParaMath)c.Set_ParaMath(this.ParaMath.Copy());c.SetForm(this.Form);return c};ParaDrawing.prototype.IsEqual=function(oElement){return false};ParaDrawing.prototype.Get_Id=function(){return this.Id};ParaDrawing.prototype.GetId=function(){return this.Id};ParaDrawing.prototype.setParagraphTabs=function(tabs){if(AscCommon.isRealObject(this.GraphicObj)&&typeof this.GraphicObj.setParagraphTabs=== "function")this.GraphicObj.setParagraphTabs(tabs)};ParaDrawing.prototype.IsMovingTableBorder=function(){if(AscCommon.isRealObject(this.GraphicObj)&&typeof this.GraphicObj.IsMovingTableBorder==="function")return this.GraphicObj.IsMovingTableBorder();return false};ParaDrawing.prototype.SetVerticalClip=function(Top,Bottom){this.LineTop=Top;this.LineBottom=Bottom};ParaDrawing.prototype.Update_Position=function(Paragraph,ParaLayout,PageLimits,PageLimitsOrigin,LineNum){if(undefined!=this.PositionH_Old){this.PositionH.RelativeFrom= this.PositionH_Old.RelativeFrom2;this.PositionH.Align=this.PositionH_Old.Align2;this.PositionH.Value=this.PositionH_Old.Value2;this.PositionH.Percent=this.PositionH_Old.Percent2}if(undefined!=this.PositionV_Old){this.PositionV.RelativeFrom=this.PositionV_Old.RelativeFrom2;this.PositionV.Align=this.PositionV_Old.Align2;this.PositionV.Value=this.PositionV_Old.Value2;this.PositionV.Percent=this.PositionV_Old.Percent2}var oDocumentContent=this.Parent&&this.Parent.Parent;if(oDocumentContent&&oDocumentContent.IsBlockLevelSdtContent())oDocumentContent= oDocumentContent.Parent.Parent;this.Parent=Paragraph;this.DocumentContent=oDocumentContent;var PageNum=ParaLayout.PageNum;var OtherFlowObjects=editor.WordControl.m_oLogicDocument.DrawingObjects.getAllFloatObjectsOnPage(PageNum,this.Parent.Parent);var bInline=this.Is_Inline();this.Internal_Position.Set(this.GraphicObj.extX,this.GraphicObj.extY,this.getXfrmRot(),this.EffectExtent,this.YOffset,ParaLayout,PageLimits);this.Internal_Position.Calculate_X(bInline,this.PositionH.RelativeFrom,this.PositionH.Align, this.PositionH.Value,this.PositionH.Percent);this.Internal_Position.Calculate_Y(bInline,this.PositionV.RelativeFrom,this.PositionV.Align,this.PositionV.Value,this.PositionV.Percent);var bCorrect=false;if(oDocumentContent&&oDocumentContent.IsTableCellContent&&oDocumentContent.IsTableCellContent(false))bCorrect=true;if(this.PositionH.RelativeFrom!==c_oAscRelativeFromH.Page||this.PositionV.RelativeFrom!==c_oAscRelativeFromV.Page)bCorrect=true;this.Internal_Position.Correct_Values(bInline,PageLimits, this.AllowOverlap,this.Use_TextWrap(),OtherFlowObjects,bCorrect);this.GraphicObj.bounds.l=this.GraphicObj.bounds.x+this.Internal_Position.CalcX;this.GraphicObj.bounds.r=this.GraphicObj.bounds.x+this.GraphicObj.bounds.w+this.Internal_Position.CalcX;this.GraphicObj.bounds.t=this.GraphicObj.bounds.y+this.Internal_Position.CalcY;this.GraphicObj.bounds.b=this.GraphicObj.bounds.y+this.GraphicObj.bounds.h+this.Internal_Position.CalcY;var OldPageNum=this.PageNum;this.PageNum=PageNum;this.LineNum=LineNum; this.X=this.Internal_Position.CalcX;this.Y=this.Internal_Position.CalcY;if(undefined!=this.PositionH_Old){this.PositionH.RelativeFrom=this.PositionH_Old.RelativeFrom;this.PositionH.Align=this.PositionH_Old.Align;this.PositionH.Value=this.PositionH_Old.Value;this.PositionH.Percent=this.PositionH_Old.Percent;var Value=this.Internal_Position.Calculate_X_Value(this.PositionH_Old.RelativeFrom);this.Set_PositionH(this.PositionH_Old.RelativeFrom,false,Value,false);this.X=this.Internal_Position.Calculate_X(bInline, this.PositionH.RelativeFrom,this.PositionH.Align,this.PositionH.Value,this.PositionH.Percent)}if(undefined!=this.PositionV_Old){this.PositionV.RelativeFrom=this.PositionV_Old.RelativeFrom;this.PositionV.Align=this.PositionV_Old.Align;this.PositionV.Value=this.PositionV_Old.Value;this.PositionV.Percent=this.PositionV_Old.Percent;var Value=this.Internal_Position.Calculate_Y_Value(this.PositionV_Old.RelativeFrom);this.Set_PositionV(this.PositionV_Old.RelativeFrom,false,Value,false);this.Y=this.Internal_Position.Calculate_Y(bInline, this.PositionV.RelativeFrom,this.PositionV.Align,this.PositionV.Value,this.PositionV.Percent)}this.OrigX=this.X;this.OrigY=this.Y;this.ShiftX=0;this.ShiftY=0;this.updatePosition3(this.PageNum,this.X,this.Y,OldPageNum);this.useWrap=this.Use_TextWrap()};ParaDrawing.prototype.GetClipRect=function(){if(this.Is_Inline()||this.Use_TextWrap()){var oCell;if(this.DocumentContent&&(oCell=this.DocumentContent.IsTableCellContent(true))){var arrPages=oCell.GetCurPageByAbsolutePage(this.PageNum);for(var nIndex= 0,nCount=arrPages.length;nIndex=AscCommon.document_compatibility_mode_Word15)return true;return this.LayoutInCell};ParaDrawing.prototype.Get_Distance=function(){var oDist=this.Distance;return new AscFormat.CDistance(AscFormat.getValOrDefault(oDist.L,AscFormat.DISTANCE_TO_TEXT_LEFTRIGHT),AscFormat.getValOrDefault(oDist.T, 0),AscFormat.getValOrDefault(oDist.R,AscFormat.DISTANCE_TO_TEXT_LEFTRIGHT),AscFormat.getValOrDefault(oDist.B,0))};ParaDrawing.prototype.Set_XYForAdd=function(X,Y,NearPos,PageNum){if(null!==NearPos){var Layout=NearPos.Paragraph.Get_Layout(NearPos.ContentPos,this);this.private_SetXYByLayout(X,Y,PageNum,Layout,true,true);var nRecalcIndex=null;var oLogicDocument=this.document;if(oLogicDocument){nRecalcIndex=oLogicDocument.Get_History().GetRecalculateIndex();this.SetSkipOnRecalculate(true);oLogicDocument.TurnOff_InterfaceEvents(); oLogicDocument.Recalculate();oLogicDocument.TurnOn_InterfaceEvents(false);this.SetSkipOnRecalculate(false)}if(null!==nRecalcIndex)oLogicDocument.Get_History().SetRecalculateIndex(nRecalcIndex);Layout=NearPos.Paragraph.Get_Layout(NearPos.ContentPos,this);this.private_SetXYByLayout(X,Y,PageNum,Layout,true,true)}};ParaDrawing.prototype.SetSkipOnRecalculate=function(isSkip){this.SkipOnRecalculate=isSkip};ParaDrawing.prototype.IsSkipOnRecalculate=function(){return this.SkipOnRecalculate};ParaDrawing.prototype.Set_XY= function(X,Y,Paragraph,PageNum,bResetAlign){if(Paragraph){var PageNumOld=this.PageNum;var ContentPos=Paragraph.Get_DrawingObjectContentPos(this.Get_Id());if(null===ContentPos)return;var Layout=Paragraph.Get_Layout(ContentPos,this);this.private_SetXYByLayout(X,Y,PageNum,Layout,bResetAlign||true!==this.PositionH.Align?true:false,bResetAlign||true!==this.PositionV.Align?true:false);var nRecalcIndex=null;var oLogicDocument=this.document;if(oLogicDocument){nRecalcIndex=oLogicDocument.Get_History().GetRecalculateIndex(); this.SetSkipOnRecalculate(true);oLogicDocument.Recalculate();this.SetSkipOnRecalculate(false)}if(null!==nRecalcIndex)oLogicDocument.Get_History().SetRecalculateIndex(nRecalcIndex);if(!this.LogicDocument||null===this.LogicDocument.FullRecalc.Id||PageNum=0;--nIndex)if(arrContentControls[nIndex].IsPicture()){oPictureCC=arrContentControls[nIndex];break}}var oDstRun=null;var arrClasses=NearPos.Paragraph.GetClassesByPos(NearPos.ContentPos);for(var nIndex=arrClasses.length-1;nIndex>=0;--nIndex)if(arrClasses[nIndex]instanceof ParaRun){oDstRun=arrClasses[nIndex];break}if(!oDstRun||oPictureCC&&oDstRun===oRun||oDstRun.GetParentForm()){NearPos.Paragraph.Clear_NearestPosArray();return}var NewParaDrawing=this.Copy();var RunPr=this.Remove_FromDocument(false);this.DocumentContent.Select_DrawingObject(NewParaDrawing.GetId());NewParaDrawing.Add_ToDocument(NearPos,true,RunPr,undefined,oPictureCC)};ParaDrawing.prototype.Get_ParentTextTransform=function(){if(this.Parent)return this.Parent.Get_ParentTextTransform();return null};ParaDrawing.prototype.GoTo_Text= function(bBefore,bUpdateStates){var Paragraph=this.Get_ParentParagraph();if(Paragraph){Paragraph.MoveCursorToDrawing(this.Id,bBefore);Paragraph.Document_SetThisElementCurrent(undefined===bUpdateStates?true:bUpdateStates)}};ParaDrawing.prototype.Remove_FromDocument=function(bRecalculate){var oResult=null;if(!this.Parent)return oResult;var oRun=this.Parent.Get_DrawingObjectRun(this.Id);if(oRun){var oGrObject=this.GraphicObj;if(oGrObject&&oGrObject.getObjectType()===AscDFH.historyitem_type_Shape)if(oGrObject.signatureLine)oGrObject.setSignature(oGrObject.signatureLine); var oPictureCC=null;var arrContentControls=oRun.GetParentContentControls();for(var nIndex=arrContentControls.length-1;nIndex>=0;--nIndex)if(arrContentControls[nIndex].IsPicture()){oPictureCC=arrContentControls[nIndex];break}if(oPictureCC)oPictureCC.RemoveContentControlWrapper();oRun.Remove_DrawingObject(this.Id);if(oRun.IsInHyperlink())oResult=new CTextPr;else oResult=oRun.GetTextPr();if(oGrObject&&oGrObject.getObjectType()===AscDFH.historyitem_type_Shape)if(oGrObject.signatureLine){editor.sendEvent("asc_onRemoveSignature", oGrObject.signatureLine.id);oGrObject.setSignature(oGrObject.signatureLine)}}if(false!=bRecalculate)editor.WordControl.m_oLogicDocument.Recalculate();return oResult};ParaDrawing.prototype.Get_ParentParagraph=function(){if(this.Parent instanceof Paragraph)return this.Parent;if(this.Parent instanceof ParaRun)return this.Parent.Paragraph;if(this.Parent&&this.Parent.GetParagraph())return this.Parent.GetParagraph();return null};ParaDrawing.prototype.SelectAsText=function(){var oParagraph=this.GetParagraph(); var oRun=this.GetRun();if(!oParagraph||!oRun)return;var oDocument=oParagraph.GetLogicDocument();if(!oDocument)return;oDocument.RemoveSelection();oRun.Make_ThisElementCurrent(false);oRun.SetCursorPosition(oRun.GetElementPosition(this));var oStartPos=oDocument.GetContentPosition(false);oRun.SetCursorPosition(oRun.GetElementPosition(this)+1);var oEndPos=oDocument.GetContentPosition(false);oDocument.RemoveSelection();oDocument.SetSelectionByContentPositions(oStartPos,oEndPos)};ParaDrawing.prototype.Add_ToDocument= function(NearPos,bRecalculate,RunPr,Run,oPictureCC){NearPos.Paragraph.Check_NearestPos(NearPos);var LogicDocument=this.DrawingDocument.m_oLogicDocument;var Para=new Paragraph(this.DrawingDocument,LogicDocument);var DrawingRun=new ParaRun(Para);DrawingRun.Add_ToContent(0,this);if(RunPr)DrawingRun.Set_Pr(RunPr.Copy());if(Run)DrawingRun.SetReviewTypeWithInfo(Run.GetReviewType(),Run.GetReviewInfo());if(oPictureCC){var oSdt=new CInlineLevelSdt;oSdt.SetPicturePr(true);oSdt.ReplacePlaceHolderWithContent(); oSdt.AddToContent(0,DrawingRun);Para.Add_ToContent(0,oSdt);var oFormPr=oPictureCC.GetFormPr();if(oFormPr)oSdt.SetFormPr(oFormPr.Copy())}else Para.Add_ToContent(0,DrawingRun);var SelectedElement=new CSelectedElement(Para,false);var SelectedContent=new CSelectedContent;SelectedContent.Add(SelectedElement);SelectedContent.SetMoveDrawing(true);SelectedContent.DrawingObjects.push(this);NearPos.Paragraph.Parent.InsertContent(SelectedContent,NearPos);NearPos.Paragraph.Clear_NearestPosArray();NearPos.Paragraph.Correct_Content(); this.Set_Parent(NearPos.Paragraph);if(false!=bRecalculate)LogicDocument.Recalculate()};ParaDrawing.prototype.Add_ToDocument2=function(Paragraph){var DrawingRun=new ParaRun(Paragraph);DrawingRun.Add_ToContent(0,this);Paragraph.Add_ToContent(0,DrawingRun);this.Set_Parent(Paragraph)};ParaDrawing.prototype.UpdateCursorType=function(X,Y,PageIndex){this.DrawingDocument.SetCursorType("move",new AscCommon.CMouseMoveData);if(null!=this.Parent){var Lock=this.Parent.Lock;if(true===Lock.Is_Locked()){var PNum= Math.max(0,Math.min(PageIndex-this.Parent.PageNum,this.Parent.Pages.length-1));var _X=this.Parent.Pages[PNum].X;var _Y=this.Parent.Pages[PNum].Y;var MMData=new AscCommon.CMouseMoveData;var Coords=this.DrawingDocument.ConvertCoordsToCursorWR(_X,_Y,this.Parent.Get_StartPage_Absolute()+(PageIndex-this.Parent.PageNum));MMData.X_abs=Coords.X-5;MMData.Y_abs=Coords.Y;MMData.Type=Asc.c_oAscMouseMoveDataTypes.LockedObject;MMData.UserId=Lock.Get_UserId();MMData.HaveChanges=Lock.Have_Changes();MMData.LockedObjectType= c_oAscMouseMoveLockedObjectType.Common;editor.sync_MouseMoveCallback(MMData)}}};ParaDrawing.prototype.Get_AnchorPos=function(){if(!this.Parent)return null;return this.Parent.Get_AnchorPos(this)};ParaDrawing.prototype.CheckRecalcAutoFit=function(oSectPr){if(this.GraphicObj&&this.GraphicObj.CheckNeedRecalcAutoFit)if(this.GraphicObj.CheckNeedRecalcAutoFit(oSectPr)){if(this.GraphicObj)this.GraphicObj.recalcWrapPolygon&&this.GraphicObj.recalcWrapPolygon();this.Measure()}};ParaDrawing.prototype.Get_ParentObject_or_DocumentPos= function(){if(this.Parent!=null)return this.Parent.Get_ParentObject_or_DocumentPos()};ParaDrawing.prototype.Refresh_RecalcData=function(Data){var oRun=this.GetRun();if(oRun){if(AscCommon.isRealObject(Data))switch(Data.Type){case AscDFH.historyitem_Drawing_Distance:{if(this.GraphicObj){this.GraphicObj.recalcWrapPolygon&&this.GraphicObj.recalcWrapPolygon();this.GraphicObj.addToRecalculate()}break}case AscDFH.historyitem_Drawing_SetExtent:{oRun.RecalcInfo.Measure=true;break}case AscDFH.historyitem_Drawing_SetSizeRelH:case AscDFH.historyitem_Drawing_SetSizeRelV:case AscDFH.historyitem_Drawing_SetGraphicObject:{if(this.GraphicObj){this.GraphicObj.handleUpdateExtents&& this.GraphicObj.handleUpdateExtents();this.GraphicObj.addToRecalculate()}oRun.RecalcInfo.Measure=true;break}case AscDFH.historyitem_Drawing_WrappingType:{if(this.GraphicObj){this.GraphicObj.recalcWrapPolygon&&this.GraphicObj.recalcWrapPolygon();this.GraphicObj.addToRecalculate()}break}}return oRun.Refresh_RecalcData2()}};ParaDrawing.prototype.Refresh_RecalcData2=function(Data){var oRun=this.GetRun();if(oRun)return oRun.Refresh_RecalcData2()};ParaDrawing.prototype.hyperlinkCheck=function(bCheck){if(AscCommon.isRealObject(this.GraphicObj)&& typeof this.GraphicObj.hyperlinkCheck==="function")return this.GraphicObj.hyperlinkCheck(bCheck);return null};ParaDrawing.prototype.hyperlinkCanAdd=function(bCheckInHyperlink){if(AscCommon.isRealObject(this.GraphicObj)&&typeof this.GraphicObj.hyperlinkCanAdd==="function")return this.GraphicObj.hyperlinkCanAdd(bCheckInHyperlink);return false};ParaDrawing.prototype.hyperlinkRemove=function(){if(AscCommon.isRealObject(this.GraphicObj)&&typeof this.GraphicObj.hyperlinkCanAdd==="function")return this.GraphicObj.hyperlinkRemove(); return false};ParaDrawing.prototype.hyperlinkModify=function(HyperProps){if(AscCommon.isRealObject(this.GraphicObj)&&typeof this.GraphicObj.hyperlinkModify==="function")return this.GraphicObj.hyperlinkModify(HyperProps)};ParaDrawing.prototype.hyperlinkAdd=function(HyperProps){if(AscCommon.isRealObject(this.GraphicObj)&&typeof this.GraphicObj.hyperlinkAdd==="function")return this.GraphicObj.hyperlinkAdd(HyperProps)};ParaDrawing.prototype.documentStatistics=function(stat){if(AscCommon.isRealObject(this.GraphicObj)&& typeof this.GraphicObj.documentStatistics==="function")this.GraphicObj.documentStatistics(stat)};ParaDrawing.prototype.documentCreateFontCharMap=function(fontMap){if(AscCommon.isRealObject(this.GraphicObj)&&typeof this.GraphicObj.documentCreateFontCharMap==="function")this.GraphicObj.documentCreateFontCharMap(fontMap)};ParaDrawing.prototype.documentCreateFontMap=function(fontMap){if(AscCommon.isRealObject(this.GraphicObj)&&typeof this.GraphicObj.documentCreateFontMap==="function")this.GraphicObj.documentCreateFontMap(fontMap)}; ParaDrawing.prototype.tableCheckSplit=function(){if(AscCommon.isRealObject(this.GraphicObj)&&typeof this.GraphicObj.tableCheckSplit==="function")return this.GraphicObj.tableCheckSplit();return false};ParaDrawing.prototype.tableCheckMerge=function(){if(AscCommon.isRealObject(this.GraphicObj)&&typeof this.GraphicObj.tableCheckMerge==="function")return this.GraphicObj.tableCheckMerge();return false};ParaDrawing.prototype.tableSelect=function(Type){if(AscCommon.isRealObject(this.GraphicObj)&&typeof this.GraphicObj.tableSelect=== "function")return this.GraphicObj.tableSelect(Type)};ParaDrawing.prototype.tableRemoveTable=function(){if(AscCommon.isRealObject(this.GraphicObj)&&typeof this.GraphicObj.tableRemoveTable==="function")return this.GraphicObj.tableRemoveTable()};ParaDrawing.prototype.tableSplitCell=function(Cols,Rows){if(AscCommon.isRealObject(this.GraphicObj)&&typeof this.GraphicObj.tableSplitCell==="function")return this.GraphicObj.tableSplitCell(Cols,Rows)};ParaDrawing.prototype.tableMergeCells=function(Cols,Rows){if(AscCommon.isRealObject(this.GraphicObj)&& typeof this.GraphicObj.tableMergeCells==="function")return this.GraphicObj.tableMergeCells(Cols,Rows)};ParaDrawing.prototype.tableRemoveCol=function(){if(AscCommon.isRealObject(this.GraphicObj)&&typeof this.GraphicObj.tableRemoveCol==="function")return this.GraphicObj.tableRemoveCol()};ParaDrawing.prototype.tableAddCol=function(bBefore,nCount){if(AscCommon.isRealObject(this.GraphicObj)&&typeof this.GraphicObj.tableAddCol==="function")return this.GraphicObj.tableAddCol(bBefore,nCount)};ParaDrawing.prototype.tableRemoveRow= function(){if(AscCommon.isRealObject(this.GraphicObj)&&typeof this.GraphicObj.tableRemoveRow==="function")return this.GraphicObj.tableRemoveRow()};ParaDrawing.prototype.tableAddRow=function(bBefore,nCount){if(AscCommon.isRealObject(this.GraphicObj)&&typeof this.GraphicObj.tableAddRow==="function")return this.GraphicObj.tableAddRow(bBefore,nCount)};ParaDrawing.prototype.getCurrentParagraph=function(bIgnoreSelection,arrSelectedParagraphs){if(AscCommon.isRealObject(this.GraphicObj)&&typeof this.GraphicObj.getCurrentParagraph=== "function")return this.GraphicObj.getCurrentParagraph(bIgnoreSelection,arrSelectedParagraphs);if(this.Parent instanceof Paragraph)return this.Parent};ParaDrawing.prototype.GetSelectedText=function(bClearText,oPr){if(AscCommon.isRealObject(this.GraphicObj)&&typeof this.GraphicObj.GetSelectedText==="function")return this.GraphicObj.GetSelectedText(bClearText,oPr);return""};ParaDrawing.prototype.getCurPosXY=function(){if(AscCommon.isRealObject(this.GraphicObj)&&typeof this.GraphicObj.getCurPosXY==="function")return this.GraphicObj.getCurPosXY(); return{X:0,Y:0}};ParaDrawing.prototype.setParagraphKeepLines=function(Value){if(AscCommon.isRealObject(this.GraphicObj)&&typeof this.GraphicObj.setParagraphKeepLines==="function")return this.GraphicObj.setParagraphKeepLines(Value)};ParaDrawing.prototype.setParagraphKeepNext=function(Value){if(AscCommon.isRealObject(this.GraphicObj)&&typeof this.GraphicObj.setParagraphKeepNext==="function")return this.GraphicObj.setParagraphKeepNext(Value)};ParaDrawing.prototype.setParagraphWidowControl=function(Value){if(AscCommon.isRealObject(this.GraphicObj)&& typeof this.GraphicObj.setParagraphWidowControl==="function")return this.GraphicObj.setParagraphWidowControl(Value)};ParaDrawing.prototype.setParagraphPageBreakBefore=function(Value){if(AscCommon.isRealObject(this.GraphicObj)&&typeof this.GraphicObj.setParagraphPageBreakBefore==="function")return this.GraphicObj.setParagraphPageBreakBefore(Value)};ParaDrawing.prototype.isTextSelectionUse=function(){if(AscCommon.isRealObject(this.GraphicObj)&&typeof this.GraphicObj.isTextSelectionUse==="function")return this.GraphicObj.isTextSelectionUse(); return false};ParaDrawing.prototype.paragraphFormatPaste=function(CopyTextPr,CopyParaPr,Bool){if(AscCommon.isRealObject(this.GraphicObj)&&typeof this.GraphicObj.isTextSelectionUse==="function")return this.GraphicObj.paragraphFormatPaste(CopyTextPr,CopyParaPr,Bool)};ParaDrawing.prototype.getNearestPos=function(x,y,pageIndex){if(AscCommon.isRealObject(this.GraphicObj)&&typeof this.GraphicObj.getNearestPos==="function")return this.GraphicObj.getNearestPos(x,y,pageIndex);return null};ParaDrawing.prototype.Write_ToBinary= function(Writer){Writer.WriteLong(this.Type);Writer.WriteString2(this.Id)};ParaDrawing.prototype.Write_ToBinary2=function(Writer){Writer.WriteLong(AscDFH.historyitem_type_Drawing);Writer.WriteString2(this.Id);AscFormat.writeDouble(Writer,this.Extent.W);AscFormat.writeDouble(Writer,this.Extent.H);AscFormat.writeObject(Writer,this.GraphicObj);AscFormat.writeObject(Writer,this.DocumentContent);AscFormat.writeObject(Writer,this.Parent);AscFormat.writeObject(Writer,this.wrappingPolygon);AscFormat.writeLong(Writer, this.RelativeHeight);AscFormat.writeObject(Writer,this.docPr)};ParaDrawing.prototype.Read_FromBinary2=function(Reader){this.Id=Reader.GetString2();this.DrawingDocument=editor.WordControl.m_oLogicDocument.DrawingDocument;this.LogicDocument=this.DrawingDocument?this.DrawingDocument.m_oLogicDocument:null;this.Extent.W=AscFormat.readDouble(Reader);this.Extent.H=AscFormat.readDouble(Reader);this.GraphicObj=AscFormat.readObject(Reader);this.DocumentContent=AscFormat.readObject(Reader);this.Parent=AscFormat.readObject(Reader); this.wrappingPolygon=AscFormat.readObject(Reader);this.RelativeHeight=AscFormat.readLong(Reader);this.docPr=AscFormat.readObject(Reader);if(this.wrappingPolygon)this.wrappingPolygon.wordGraphicObject=this;this.drawingDocument=editor.WordControl.m_oLogicDocument.DrawingDocument;this.document=editor.WordControl.m_oLogicDocument;this.graphicObjects=editor.WordControl.m_oLogicDocument.DrawingObjects;this.graphicObjects.addGraphicObject(this);g_oTableId.Add(this,this.Id)};ParaDrawing.prototype.Load_LinkData= function(){};ParaDrawing.prototype.draw=function(graphics,PDSE){if(AscCommon.isRealObject(this.GraphicObj)&&typeof this.GraphicObj.draw==="function"){graphics.SaveGrState();var bInline=this.Is_Inline();if(bInline&&AscCommon.isRealObject(PDSE)&&AscFormat.isRealNumber(this.LineTop)&&AscFormat.isRealNumber(this.LineBottom)&&AscCommon.isRealObject(this.GraphicObj.bounds)){var x,y,w,h;var oEffectExtent=this.EffectExtent;x=PDSE.X;y=this.LineTop;w=this.GraphicObj.bounds.r-this.GraphicObj.bounds.l+AscFormat.getValOrDefault(oEffectExtent.R, 0)+AscFormat.getValOrDefault(oEffectExtent.L,0);h=this.LineBottom-this.LineTop;graphics.AddClipRect(x,y,w,h)}this.GraphicObj.draw(graphics);graphics.RestoreGrState()}};ParaDrawing.prototype.drawAdjustments=function(){if(AscCommon.isRealObject(this.GraphicObj)&&typeof this.GraphicObj.drawAdjustments==="function")this.GraphicObj.drawAdjustments()};ParaDrawing.prototype.getTransformMatrix=function(){if(AscCommon.isRealObject(this.GraphicObj)&&typeof this.GraphicObj.getTransformMatrix==="function")return this.GraphicObj.getTransformMatrix(); return null};ParaDrawing.prototype.getExtensions=function(){if(AscCommon.isRealObject(this.GraphicObj)&&typeof this.GraphicObj.getExtensions==="function")return this.GraphicObj.getExtensions();return null};ParaDrawing.prototype.isGroup=function(){if(AscCommon.isRealObject(this.GraphicObj)&&typeof this.GraphicObj.isGroup==="function")return this.GraphicObj.isGroup();return false};ParaDrawing.prototype.isShapeChild=function(bRetShape){if(!this.Is_Inline()||!this.DocumentContent)return bRetShape?null: false;var cur_doc_content=this.DocumentContent;var oCell;while(oCell=cur_doc_content.IsTableCellContent(true))cur_doc_content=oCell.Row.Table.Parent;if(AscCommon.isRealObject(cur_doc_content.Parent)&&typeof cur_doc_content.Parent.getObjectType==="function"&&cur_doc_content.Parent.getObjectType()===AscDFH.historyitem_type_Shape)return bRetShape?cur_doc_content.Parent:true;return bRetShape?null:false};ParaDrawing.prototype.checkShapeChildAndGetTopParagraph=function(paragraph){var parent_paragraph=!paragraph? this.Get_ParentParagraph():paragraph;var parent_doc_content=parent_paragraph.Parent;if(parent_doc_content.Parent instanceof AscFormat.CShape)if(!parent_doc_content.Parent.group)return parent_doc_content.Parent.parent.Get_ParentParagraph();else{var top_group=parent_doc_content.Parent.group;while(top_group.group)top_group=top_group.group;return top_group.parent.Get_ParentParagraph()}else if(parent_doc_content.IsTableCellContent()){var top_doc_content=parent_doc_content;var oCell;while(oCell=top_doc_content.IsTableCellContent(true))top_doc_content= oCell.Row.Table.Parent;if(top_doc_content.Parent instanceof AscFormat.CShape)if(!top_doc_content.Parent.group)return top_doc_content.Parent.parent.Get_ParentParagraph();else{var top_group=top_doc_content.Parent.group;while(top_group.group)top_group=top_group.group;return top_group.parent.Get_ParentParagraph()}else return parent_paragraph}return parent_paragraph};ParaDrawing.prototype.hit=function(x,y){if(AscCommon.isRealObject(this.GraphicObj)&&typeof this.GraphicObj.hit==="function")return this.GraphicObj.hit(x, y);return false};ParaDrawing.prototype.hitToTextRect=function(x,y){if(AscCommon.isRealObject(this.GraphicObj)&&typeof this.GraphicObj.hitToTextRect==="function")return this.GraphicObj.hitToTextRect(x,y);return false};ParaDrawing.prototype.cursorGetPos=function(){if(AscCommon.isRealObject(this.GraphicObj)&&typeof this.GraphicObj.cursorGetPos==="function")return this.GraphicObj.cursorGetPos();return{X:0,Y:0}};ParaDrawing.prototype.getResizeCoefficients=function(handleNum,x,y){if(AscCommon.isRealObject(this.GraphicObj)&& typeof this.GraphicObj.getResizeCoefficients==="function")return this.GraphicObj.getResizeCoefficients(handleNum,x,y);return{kd1:1,kd2:1}};ParaDrawing.prototype.getParagraphParaPr=function(){if(AscCommon.isRealObject(this.GraphicObj)&&typeof this.GraphicObj.getParagraphParaPr==="function")return this.GraphicObj.getParagraphParaPr();return null};ParaDrawing.prototype.getParagraphTextPr=function(){if(AscCommon.isRealObject(this.GraphicObj)&&typeof this.GraphicObj.getParagraphTextPr==="function")return this.GraphicObj.getParagraphTextPr(); return null};ParaDrawing.prototype.getAngle=function(x,y){if(AscCommon.isRealObject(this.GraphicObj)&&typeof this.GraphicObj.getAngle==="function")return this.GraphicObj.getAngle(x,y);return 0};ParaDrawing.prototype.calculateSnapArrays=function(){this.GraphicObj.snapArrayX.length=0;this.GraphicObj.snapArrayY.length=0;if(this.GraphicObj)this.GraphicObj.recalculateSnapArrays()};ParaDrawing.prototype.recalculateCurPos=function(){if(AscCommon.isRealObject(this.GraphicObj)&&typeof this.GraphicObj.recalculateCurPos=== "function")this.GraphicObj.recalculateCurPos()};ParaDrawing.prototype.setPageIndex=function(newPageIndex){this.pageIndex=newPageIndex;this.PageNum=newPageIndex};ParaDrawing.prototype.Get_PageNum=function(){return this.PageNum};ParaDrawing.prototype.GetAllParagraphs=function(Props,ParaArray){if(AscCommon.isRealObject(this.GraphicObj)&&typeof this.GraphicObj.GetAllParagraphs==="function")this.GraphicObj.GetAllParagraphs(Props,ParaArray)};ParaDrawing.prototype.GetAllTables=function(oProps,arrTables){if(AscCommon.isRealObject(this.GraphicObj)&& typeof this.GraphicObj.GetAllTables==="function")this.GraphicObj.GetAllTables(oProps,arrTables)};ParaDrawing.prototype.GetAllDocContents=function(aDocContents){var _ret=Array.isArray(aDocContents)?aDocContents:[];if(this.GraphicObj)this.GraphicObj.getAllDocContents(_ret);return _ret};ParaDrawing.prototype.getTableProps=function(){if(AscCommon.isRealObject(this.GraphicObj)&&typeof this.GraphicObj.getTableProps==="function")return this.GraphicObj.getTableProps();return null};ParaDrawing.prototype.canGroup= function(){if(AscCommon.isRealObject(this.GraphicObj)&&typeof this.GraphicObj.canGroup==="function")return this.GraphicObj.canGroup();return false};ParaDrawing.prototype.canUnGroup=function(){if(AscCommon.isRealObject(this.GraphicObj)&&typeof this.GraphicObj.canGroup==="function")return this.GraphicObj.canUnGroup();return false};ParaDrawing.prototype.select=function(pageIndex){this.selected=true;if(AscCommon.isRealObject(this.GraphicObj)&&typeof this.GraphicObj.select==="function")this.GraphicObj.select(pageIndex)}; ParaDrawing.prototype.paragraphClearFormatting=function(isClearParaPr,isClearTextPr){if(AscCommon.isRealObject(this.GraphicObj)&&typeof this.GraphicObj.paragraphAdd==="function")this.GraphicObj.paragraphClearFormatting(isClearParaPr,isClearTextPr)};ParaDrawing.prototype.paragraphAdd=function(paraItem,bRecalculate){if(AscCommon.isRealObject(this.GraphicObj)&&typeof this.GraphicObj.paragraphAdd==="function")this.GraphicObj.paragraphAdd(paraItem,bRecalculate)};ParaDrawing.prototype.setParagraphShd=function(Shd){if(AscCommon.isRealObject(this.GraphicObj)&& typeof this.GraphicObj.setParagraphShd==="function")this.GraphicObj.setParagraphShd(Shd)};ParaDrawing.prototype.getArrayWrapPolygons=function(){if(AscCommon.isRealObject(this.GraphicObj)&&typeof this.GraphicObj.getArrayWrapPolygons==="function")return this.GraphicObj.getArrayWrapPolygons();return[]};ParaDrawing.prototype.getArrayWrapIntervals=function(x0,y0,x1,y1,Y0Sp,Y1Sp,LeftField,RightField,arr_intervals,bMathWrap){if(this.wrappingType===WRAPPING_TYPE_THROUGH||this.wrappingType===WRAPPING_TYPE_TIGHT){y0= Y0Sp;y1=Y1Sp}this.wrappingPolygon.wordGraphicObject=this;return this.wrappingPolygon.getArrayWrapIntervals(x0,y0,x1,y1,LeftField,RightField,arr_intervals,bMathWrap)};ParaDrawing.prototype.setAllParagraphNumbering=function(numInfo){if(AscCommon.isRealObject(this.GraphicObj)&&typeof this.GraphicObj.setAllParagraphNumbering==="function")this.GraphicObj.setAllParagraphNumbering(numInfo)};ParaDrawing.prototype.addNewParagraph=function(bRecalculate){if(AscCommon.isRealObject(this.GraphicObj)&&typeof this.GraphicObj.addNewParagraph=== "function")this.GraphicObj.addNewParagraph(bRecalculate)};ParaDrawing.prototype.addInlineTable=function(nCols,nRows,nMode){if(AscCommon.isRealObject(this.GraphicObj)&&typeof this.GraphicObj.addInlineTable==="function")return this.GraphicObj.addInlineTable(nCols,nRows,nMode);return null};ParaDrawing.prototype.applyTextPr=function(paraItem,bRecalculate){if(AscCommon.isRealObject(this.GraphicObj)&&typeof this.GraphicObj.applyTextPr==="function")this.GraphicObj.applyTextPr(paraItem,bRecalculate)};ParaDrawing.prototype.allIncreaseDecFontSize= function(bIncrease){if(AscCommon.isRealObject(this.GraphicObj)&&typeof this.GraphicObj.allIncreaseDecFontSize==="function")this.GraphicObj.allIncreaseDecFontSize(bIncrease)};ParaDrawing.prototype.setParagraphNumbering=function(NumInfo){if(AscCommon.isRealObject(this.GraphicObj)&&typeof this.GraphicObj.setParagraphNumbering==="function")this.GraphicObj.setParagraphNumbering(NumInfo)};ParaDrawing.prototype.allIncreaseDecIndent=function(bIncrease){if(AscCommon.isRealObject(this.GraphicObj)&&typeof this.GraphicObj.allIncreaseDecIndent=== "function")this.GraphicObj.allIncreaseDecIndent(bIncrease)};ParaDrawing.prototype.allSetParagraphAlign=function(align){if(AscCommon.isRealObject(this.GraphicObj)&&typeof this.GraphicObj.allSetParagraphAlign==="function")this.GraphicObj.allSetParagraphAlign(align)};ParaDrawing.prototype.paragraphIncreaseDecFontSize=function(bIncrease){if(AscCommon.isRealObject(this.GraphicObj)&&typeof this.GraphicObj.paragraphIncreaseDecFontSize==="function")this.GraphicObj.paragraphIncreaseDecFontSize(bIncrease)}; ParaDrawing.prototype.paragraphIncreaseDecIndent=function(bIncrease){if(AscCommon.isRealObject(this.GraphicObj)&&typeof this.GraphicObj.paragraphIncreaseDecIndent==="function")this.GraphicObj.paragraphIncreaseDecIndent(bIncrease)};ParaDrawing.prototype.setParagraphAlign=function(align){if(AscCommon.isRealObject(this.GraphicObj)&&typeof this.GraphicObj.setParagraphAlign==="function")this.GraphicObj.setParagraphAlign(align)};ParaDrawing.prototype.setParagraphSpacing=function(Spacing){if(AscCommon.isRealObject(this.GraphicObj)&& typeof this.GraphicObj.setParagraphSpacing==="function")this.GraphicObj.setParagraphSpacing(Spacing)};ParaDrawing.prototype.updatePosition=function(x,y){if(AscCommon.isRealObject(this.GraphicObj)&&typeof this.GraphicObj.updatePosition==="function")this.GraphicObj.updatePosition(x,y)};ParaDrawing.prototype.updatePosition2=function(x,y){if(AscCommon.isRealObject(this.GraphicObj)&&typeof this.GraphicObj.updatePosition==="function")this.GraphicObj.updatePosition2(x,y)};ParaDrawing.prototype.addInlineImage= function(W,H,Img,chart,bFlow){if(AscCommon.isRealObject(this.GraphicObj)&&typeof this.GraphicObj.addInlineImage==="function")this.GraphicObj.addInlineImage(W,H,Img,chart,bFlow)};ParaDrawing.prototype.addSignatureLine=function(oSignatureDrawing){if(AscCommon.isRealObject(this.GraphicObj)&&typeof this.GraphicObj.addSignatureLine==="function")this.GraphicObj.addSignatureLine(oSignatureDrawing)};ParaDrawing.prototype.canAddComment=function(){if(AscCommon.isRealObject(this.GraphicObj)&&typeof this.GraphicObj.canAddComment=== "function")return this.GraphicObj.canAddComment();return false};ParaDrawing.prototype.addComment=function(commentData){if(AscCommon.isRealObject(this.GraphicObj)&&typeof this.GraphicObj.addComment==="function")return this.GraphicObj.addComment(commentData)};ParaDrawing.prototype.selectionSetStart=function(x,y,event,pageIndex){if(AscCommon.isRealObject(this.GraphicObj)&&typeof this.GraphicObj.selectionSetStart==="function")this.GraphicObj.selectionSetStart(x,y,event,pageIndex)};ParaDrawing.prototype.selectionSetEnd= function(x,y,event,pageIndex){if(AscCommon.isRealObject(this.GraphicObj)&&typeof this.GraphicObj.selectionSetEnd==="function")this.GraphicObj.selectionSetEnd(x,y,event,pageIndex)};ParaDrawing.prototype.selectionRemove=function(){if(AscCommon.isRealObject(this.GraphicObj)&&typeof this.GraphicObj.selectionRemove==="function")this.GraphicObj.selectionRemove()};ParaDrawing.prototype.updateSelectionState=function(){if(AscCommon.isRealObject(this.GraphicObj)&&typeof this.GraphicObj.updateSelectionState=== "function")this.GraphicObj.updateSelectionState()};ParaDrawing.prototype.cursorMoveLeft=function(AddToSelect,Word){if(AscCommon.isRealObject(this.GraphicObj)&&typeof this.GraphicObj.cursorMoveLeft==="function")this.GraphicObj.cursorMoveLeft(AddToSelect,Word)};ParaDrawing.prototype.cursorMoveRight=function(AddToSelect,Word){if(AscCommon.isRealObject(this.GraphicObj)&&typeof this.GraphicObj.cursorMoveRight==="function")this.GraphicObj.cursorMoveRight(AddToSelect,Word)};ParaDrawing.prototype.cursorMoveUp= function(AddToSelect){if(AscCommon.isRealObject(this.GraphicObj)&&typeof this.GraphicObj.cursorMoveUp==="function")this.GraphicObj.cursorMoveUp(AddToSelect)};ParaDrawing.prototype.cursorMoveDown=function(AddToSelect){if(AscCommon.isRealObject(this.GraphicObj)&&typeof this.GraphicObj.cursorMoveDown==="function")this.GraphicObj.cursorMoveDown(AddToSelect)};ParaDrawing.prototype.cursorMoveEndOfLine=function(AddToSelect){if(AscCommon.isRealObject(this.GraphicObj)&&typeof this.GraphicObj.cursorMoveEndOfLine=== "function")this.GraphicObj.cursorMoveEndOfLine(AddToSelect)};ParaDrawing.prototype.cursorMoveStartOfLine=function(AddToSelect){if(AscCommon.isRealObject(this.GraphicObj)&&typeof this.GraphicObj.cursorMoveStartOfLine==="function")this.GraphicObj.cursorMoveStartOfLine(AddToSelect)};ParaDrawing.prototype.remove=function(Count,isRemoveWholeElement,bRemoveOnlySelection,bOnTextAdd){if(AscCommon.isRealObject(this.GraphicObj)&&typeof this.GraphicObj.remove==="function")this.GraphicObj.remove(Count,isRemoveWholeElement, bRemoveOnlySelection,bOnTextAdd)};ParaDrawing.prototype.hitToWrapPolygonPoint=function(x,y){if(this.wrappingPolygon&&this.wrappingPolygon.arrPoints.length>0){var radius=this.drawingDocument.GetMMPerDot(AscCommon.TRACK_CIRCLE_RADIUS);var arr_point=this.wrappingPolygon.calculatedPoints;var point_count=arr_point.length;var dx,dy;var previous_point;for(var i=0;i0||Math.abs(vy)>0)if(HitInLine(this.drawingDocument.CanvasHitContext,x,y,previous_point.x,previous_point.y,cur_point.x,cur_point.y))return{hit:true,hitType:WRAP_HIT_TYPE_SECTION,pointNum1:arr_point.length-1,pointNum2:0};for(var point_index=1;point_index0||Math.abs(vy)>0)if(HitInLine(this.drawingDocument.CanvasHitContext,x,y,previous_point.x,previous_point.y,cur_point.x,cur_point.y))return{hit:true,hitType:WRAP_HIT_TYPE_SECTION,pointNum1:point_index-1,pointNum2:point_index}}}return{hit:false}};ParaDrawing.prototype.documentGetAllFontNames=function(AllFonts){if(AscCommon.isRealObject(this.GraphicObj)&&typeof this.GraphicObj.documentGetAllFontNames==="function")this.GraphicObj.documentGetAllFontNames(AllFonts)}; ParaDrawing.prototype.isCurrentElementParagraph=function(){if(AscCommon.isRealObject(this.GraphicObj)&&typeof this.GraphicObj.isCurrentElementParagraph==="function")return this.GraphicObj.isCurrentElementParagraph();return false};ParaDrawing.prototype.isCurrentElementTable=function(){if(AscCommon.isRealObject(this.GraphicObj)&&typeof this.GraphicObj.isCurrentElementTable==="function")return this.GraphicObj.isCurrentElementTable();return false};ParaDrawing.prototype.canChangeWrapPolygon=function(){if(this.Is_Inline())return false; if(AscCommon.isRealObject(this.GraphicObj)&&typeof this.GraphicObj.canChangeWrapPolygon==="function")return this.GraphicObj.canChangeWrapPolygon();return false};ParaDrawing.prototype.init=function(){};ParaDrawing.prototype.calculateAfterOpen=function(){};ParaDrawing.prototype.getBounds=function(){return this.GraphicObj.bounds};ParaDrawing.prototype.getWrapContour=function(){if(AscCommon.isRealObject(this.wrappingPolygon)){var kw=1/36E3;var kh=1/36E3;var rel_points=this.wrappingPolygon.relativeArrPoints; var ret=[];for(var i=0;i.001)this.CalcY=this.Margin_V+Shift;else this.CalcY=_Y+this.Bottom_Margin*Value/100+Shift;else this.CalcY=_Y+Value;break}case c_oAscRelativeFromV.Line:{var _Y=this.LineTop;if(true===bAlign)switch(Value){case c_oAscAlignV.Bottom:case c_oAscAlignV.Outside:{this.CalcY=_Y-this.EffectExtentB- Height+Shift;break}case c_oAscAlignV.Center:{this.CalcY=_Y-Height/2+Shift;break}case c_oAscAlignV.Inside:case c_oAscAlignV.Top:{this.CalcY=_Y+Shift;break}}else this.CalcY=_Y+Value;break}case c_oAscRelativeFromV.Margin:{var Y_s=this.Top_Margin;var Y_e=this.Page_H-this.Bottom_Margin;if(true===bAlign)switch(Value){case c_oAscAlignV.Bottom:case c_oAscAlignV.Outside:{this.CalcY=Y_e-Height+Shift;break}case c_oAscAlignV.Center:{this.CalcY=(Y_s+Y_e-Height)/2+Shift;break}case c_oAscAlignV.Inside:case c_oAscAlignV.Top:{this.CalcY= Y_s+Shift;break}}else if(true===bPercent)if(Math.abs(this.Page_Y)>.001)this.CalcY=this.Margin_V+Shift;else this.CalcY=Y_s+(Y_e-Y_s)*Value/100+Shift;else this.CalcY=this.Margin_V+Value;break}case c_oAscRelativeFromV.Page:{if(true===bAlign)switch(Value){case c_oAscAlignV.Bottom:case c_oAscAlignV.Outside:{this.CalcY=this.Page_H-Height+Shift;break}case c_oAscAlignV.Center:{this.CalcY=(this.Page_H-Height)/2+Shift;break}case c_oAscAlignV.Inside:case c_oAscAlignV.Top:{this.CalcY=Shift;break}}else if(true=== bPercent)if(Math.abs(this.Page_Y)>.001)this.CalcY=this.Margin_V+Shift;else this.CalcY=this.Page_H*Value/100+Shift;else this.CalcY=Value+this.Page_Y;break}case c_oAscRelativeFromV.Paragraph:{var _Y=this.ParagraphTop;if(true===bAlign)this.CalcY=_Y+Shift;else this.CalcY=_Y+Value;break}case c_oAscRelativeFromV.TopMargin:{var Y_s=0;var Y_e=this.Top_Margin;if(true===bAlign)switch(Value){case c_oAscAlignV.Bottom:case c_oAscAlignV.Outside:{this.CalcY=Y_e-Height+Shift;break}case c_oAscAlignV.Center:{this.CalcY= (Y_s+Y_e-Height)/2+Shift;break}case c_oAscAlignV.Inside:case c_oAscAlignV.Top:{this.CalcY=Y_s+Shift;break}}else if(true===bPercent)if(Math.abs(this.Page_Y)>.001)this.CalcY=this.Margin_V+Shift;else this.CalcY=this.Top_Margin*Value/100+Shift;else this.CalcY=Y_s+Value;break}}return this.CalcY};CAnchorPosition.prototype.Update_PositionYHeaderFooter=function(TopMarginY,BottomMarginY){var TopY=Math.max(this.Page_Y,Math.min(TopMarginY,this.Page_H));var BottomY=Math.max(this.Page_Y,Math.min(BottomMarginY, this.Page_H));this.Margin_V=TopY;this.Top_Margin=TopY;this.Bottom_Margin=this.Page_H-BottomY};CAnchorPosition.prototype.Correct_Values=function(bInline,PageLimits,AllowOverlap,UseTextWrap,OtherFlowObjects,bCorrect){if(true!=bInline){var X_min=PageLimits.X;var Y_min=PageLimits.Y;var X_max=PageLimits.XLimit;var Y_max=PageLimits.YLimit;var W=this.W;var H=this.H;var CurX=this.CalcX;var CurY=this.CalcY;var bBreak=false;while(true!=bBreak){bBreak=true;for(var Index=0;Index=Drawing.X&&CurY<=Drawing.Y+Drawing.H&&CurY+H>=Drawing.Y)){if(Drawing.X+Drawing.WX_max)CurX-=Right-X_max;var Left=CurX+this.W/2-_W/2-this.EffectExtentR;if(LeftY_max)CurY-=Bottom-Y_max;var Top=CurY+this.H/2-_H/2-this.EffectExtentT;if(Top=nCount?1:parseInt(arrValues[nIndex+1]);if(isNaN(nLvl))nLvl=undefined;else nIndex++;arrStyles.push({Name:sName,Lvl:nLvl})}this.SetStylesArray(arrStyles)}; CFieldInstructionTOC.prototype.SetStylesArray=function(arrStyles){this.Styles=arrStyles};CFieldInstructionTOC.prototype.GetStylesArray=function(){return this.Styles};CFieldInstructionTOC.prototype.SetPageRefSkippedLvls=function(isSkip,nSkipStart,nSkipEnd){this.SkipPageRef=isSkip;if(true===isSkip&&null!==nSkipStart&&undefined!==nSkipStart&&null!==nSkipEnd&&undefined!==nSkipEnd){this.SkipPageRefStart=nSkipStart;this.SkipPageRefEnd=nSkipEnd}else{this.SkipPageRefStart=-1;this.SkipPageRefEnd=-1}};CFieldInstructionTOC.prototype.IsSkipPageRefLvl= function(nLvl){if(undefined===nLvl)return this.SkipPageRef;if(false===this.SkipPageRef)return false;if(-1===this.SkipPageRefStart||-1===this.SkipPageRefEnd)return true;return nLvl>=this.SkipPageRefStart-1&&nLvl<=this.SkipPageRefEnd-1};CFieldInstructionTOC.prototype.SetCaption=function(sCaption){this.Caption=sCaption};CFieldInstructionTOC.prototype.GetCaption=function(){return this.Caption};CFieldInstructionTOC.prototype.SetCaptionOnlyText=function(sVal){this.CaptionOnlyText=sVal};CFieldInstructionTOC.prototype.GetCaptionOnlyText= function(){return this.CaptionOnlyText};CFieldInstructionTOC.prototype.SetPr=function(oPr){if(!(oPr instanceof Asc.CTableOfContentsPr))return;this.SetStylesArray(oPr.get_Styles());this.SetHeadingRange(oPr.get_OutlineStart(),oPr.get_OutlineEnd());this.SetHyperlinks(oPr.get_Hyperlink());if(oPr.PageNumbers)this.SetPageRefSkippedLvls(false);else this.SetPageRefSkippedLvls(true);if(oPr.RightTab)this.SetSeparator("");else this.SetSeparator(" ");this.ForceTabLeader=oPr.TabLeader;var sCaption=oPr.get_CaptionForInstruction(); if(sCaption!==undefined)if(sCaption||this.Styles.length>0){if(oPr.IsIncludeLabelAndNumber){this.SetCaption(sCaption);this.SetCaptionOnlyText(undefined)}else{this.SetCaptionOnlyText(sCaption);this.SetCaption(undefined)}this.SetHeadingRange(-1,-1)}};CFieldInstructionTOC.prototype.GetForceTabLeader=function(){var nTabLeader=this.ForceTabLeader;this.ForceTabLeader=undefined;return nTabLeader};CFieldInstructionTOC.prototype.ToString=function(){var oLogicDocument=editor.WordControl.m_oLogicDocument;var sListSeparator= oLogicDocument.GetListSeparator();var sInstr="TOC ";if(this.HeadingS>=1&&this.HeadingS<=9&&this.HeadingE>=this.HeadingS&&this.HeadingE<=9)sInstr+="\\o "+'"'+this.HeadingS+"-"+this.HeadingE+'" ';if(this.SkipPageRef){sInstr+="\\n ";if(this.SkipPageRefStart>=1&&this.SkipPageRefStart<=9&&this.SkipPageRefEnd>=this.SkipPageRefStart&&this.SkipPageRefEnd<=9)sInstr+='"'+this.SkipPageRefStart+"-"+this.SkipPageRefEnd+'" '}if(this.Hyperlinks)sInstr+="\\h ";if(!this.RemoveBreaks)sInstr+="\\x ";if(this.PreserveTabs)sInstr+= "\\w ";if(this.Separator)sInstr+='\\p "'+this.Separator+'"';if(this.Styles.length>0){sInstr+='\\t "';for(var nIndex=0,nCount=this.Styles.length;nIndex0)sInstr+= '"'+this.Caption+'"'}if(this.CaptionOnlyText!==undefined){sInstr+="\\a ";if(typeof this.CaptionOnlyText==="string"&&this.CaptionOnlyText.length>0)sInstr+='"'+this.CaptionOnlyText+'"'}return sInstr};CFieldInstructionTOC.prototype.IsTableOfFigures=function(){if(this.Caption!==undefined||this.CaptionOnlyText!==undefined)return true;return false};CFieldInstructionTOC.prototype.IsTableOfContents=function(){return!this.IsTableOfFigures()};function CFieldInstructionASK(){CFieldInstructionBase.call(this); this.BookmarkName="";this.PromptText=""}CFieldInstructionASK.prototype=Object.create(CFieldInstructionBase.prototype);CFieldInstructionASK.prototype.constructor=CFieldInstructionASK;CFieldInstructionASK.prototype.Type=fieldtype_ASK;CFieldInstructionASK.prototype.SetBookmarkName=function(sBookmarkName){this.BookmarkName=sBookmarkName};CFieldInstructionASK.prototype.GetBookmarkName=function(){return this.BookmarkName};CFieldInstructionASK.prototype.SetPromptText=function(sText){this.PromptText=sText}; CFieldInstructionASK.prototype.GetPromptText=function(){if(!this.PromptText)return this.BookmarkName;return this.PromptText};function CFieldInstructionREF(){CFieldInstructionBase.call(this);this.GeneralSwitches=[];this.BookmarkName="";this.Hyperlink=false;this.bIsNumberNoContext=false;this.bIsNumberFullContext=false;this.bIsNumber=false;this.bIsPosition=false;this.Delimiter=null}CFieldInstructionREF.prototype=Object.create(CFieldInstructionBase.prototype);CFieldInstructionREF.prototype.constructor= CFieldInstructionREF;CFieldInstructionREF.prototype.Type=fieldtype_REF;CFieldInstructionREF.prototype.SetGeneralSwitches=function(aSwitches){this.GeneralSwitches=aSwitches};CFieldInstructionREF.prototype.SetBookmarkName=function(sBookmarkName){this.BookmarkName=sBookmarkName};CFieldInstructionREF.prototype.GetBookmarkName=function(){return this.BookmarkName};CFieldInstructionREF.prototype.SetHyperlink=function(bIsHyperlink){this.Hyperlink=bIsHyperlink};CFieldInstructionREF.prototype.GetHyperlink= function(){return this.Hyperlink};CFieldInstructionREF.prototype.SetIsNumberNoContext=function(bVal){this.bIsNumberNoContext=bVal};CFieldInstructionREF.prototype.IsNumberNoContext=function(){return this.bIsNumberNoContext};CFieldInstructionREF.prototype.SetIsNumberFullContext=function(bVal){this.bIsNumberFullContext=bVal};CFieldInstructionREF.prototype.IsNumberFullContext=function(){return this.bIsNumberFullContext};CFieldInstructionREF.prototype.HaveNumberFlag=function(){return this.IsNumber()|| this.IsNumberFullContext()||this.IsNumberNoContext()};CFieldInstructionREF.prototype.SetIsNumber=function(bVal){this.bIsNumber=bVal};CFieldInstructionREF.prototype.IsNumber=function(){return this.bIsNumber};CFieldInstructionREF.prototype.SetIsPosition=function(bVal){this.bIsPosition=bVal};CFieldInstructionREF.prototype.IsPosition=function(){return this.bIsPosition};CFieldInstructionREF.prototype.SetDelimiter=function(bVal){this.Delimiter=bVal};CFieldInstructionREF.prototype.GetDelimiter=function(){return this.Delimiter}; CFieldInstructionREF.prototype.ToString=function(){var sInstruction=" REF ";sInstruction+=this.BookmarkName;for(var nSwitch=0;i 0)sInstruction+=" \\d "+this.Delimiter;return sInstruction};CFieldInstructionREF.prototype.GetAnchor=function(){var sBookmarkName=this.GetBookmarkName();var sAnchor=sBookmarkName;if(this.ComplexField){var oLogicDoc=this.ComplexField.LogicDocument;if(oLogicDoc){var oBookmarksManager=oLogicDoc.GetBookmarksManager();if(oBookmarksManager){var oBookmark=oBookmarksManager.GetBookmarkByName(sBookmarkName);if(!oBookmark)sAnchor="_top"}}}return sAnchor};CFieldInstructionREF.prototype.GetValue=function(){return""}; CFieldInstructionREF.prototype.SetVisited=function(isVisited){};CFieldInstructionREF.prototype.IsTopOfDocument=function(){return this.GetAnchor()==="_top"};CFieldInstructionREF.prototype.SetToolTip=function(sToolTip){};CFieldInstructionREF.prototype.GetToolTip=function(){var sTooltip=this.BookmarkName;if(!sTooltip||"_"===sTooltip.charAt(0))sTooltip=AscCommon.translateManager.getValue("Current Document");return sTooltip};function CFieldInstructionNUMPAGES(){CFieldInstructionBase.call(this)}CFieldInstructionNUMPAGES.prototype= Object.create(CFieldInstructionBase.prototype);CFieldInstructionNUMPAGES.prototype.constructor=CFieldInstructionNUMPAGES;CFieldInstructionNUMPAGES.prototype.Type=fieldtype_NUMPAGES;function CFieldInstructionHYPERLINK(){CFieldInstructionBase.call(this);this.ToolTip="";this.Link="";this.BookmarkName=""}CFieldInstructionHYPERLINK.prototype=Object.create(CFieldInstructionBase.prototype);CFieldInstructionHYPERLINK.prototype.constructor=CFieldInstructionHYPERLINK;CFieldInstructionHYPERLINK.prototype.Type= fieldtype_HYPERLINK;CFieldInstructionHYPERLINK.prototype.SetToolTip=function(sToolTip){this.ToolTip=sToolTip};CFieldInstructionHYPERLINK.prototype.GetToolTip=function(){if(""===this.ToolTip){if(this.Link)return this.BookmarkName?this.Link+"#"+this.BookmarkName:this.Link;else if(this.BookmarkName)return AscCommon.translateManager.getValue("Current Document");return""}return this.ToolTip};CFieldInstructionHYPERLINK.prototype.SetLink=function(sLink){this.Link=sLink};CFieldInstructionHYPERLINK.prototype.GetLink= function(){return this.Link};CFieldInstructionHYPERLINK.prototype.SetBookmarkName=function(sBookmarkName){this.BookmarkName=sBookmarkName};CFieldInstructionHYPERLINK.prototype.GetBookmarkName=function(){return this.BookmarkName};CFieldInstructionHYPERLINK.prototype.ToString=function(){var sInstr="HYPERLINK ";if(this.Link)sInstr+='"'+this.Link+'"';if(this.ToolTip)sInstr+='\\o "'+this.ToolTip+'"';if(this.BookmarkName)sInstr+="\\l "+this.BookmarkName;return sInstr};CFieldInstructionHYPERLINK.prototype.GetAnchor= function(){return this.GetBookmarkName()};CFieldInstructionHYPERLINK.prototype.GetValue=function(){return this.GetLink()};CFieldInstructionHYPERLINK.prototype.SetVisited=function(isVisited){};CFieldInstructionHYPERLINK.prototype.IsTopOfDocument=function(){return this.GetBookmarkName()==="_top"};function CFieldInstructionTIME(){CFieldInstructionBase.call(this);this.Format=""}CFieldInstructionTIME.prototype=Object.create(CFieldInstructionBase.prototype);CFieldInstructionTIME.prototype.constructor=CFieldInstructionTIME; CFieldInstructionTIME.prototype.Type=fieldtype_TIME;CFieldInstructionTIME.prototype.ToString=function(){return'TIME \\@ "'+this.sFormat+'"'};CFieldInstructionTIME.prototype.SetFormat=function(sFormat){this.Format=sFormat};CFieldInstructionTIME.prototype.GetFormat=function(){return this.Format};function CFieldInstructionDATE(){CFieldInstructionBase.call(this);this.Format=""}CFieldInstructionDATE.prototype=Object.create(CFieldInstructionBase.prototype);CFieldInstructionDATE.prototype.constructor=CFieldInstructionDATE; CFieldInstructionDATE.prototype.Type=fieldtype_DATE;CFieldInstructionDATE.prototype.ToString=function(){return'TIME \\@ "'+this.sFormat+'"'};CFieldInstructionDATE.prototype.SetFormat=function(sFormat){this.Format=sFormat};CFieldInstructionDATE.prototype.GetFormat=function(){return this.Format};function CFieldInstructionSEQ(){CFieldInstructionBase.call(this);this.Id=null;this.C=false;this.H=false;this.N=false;this.R=null;this.S=null;this.NumFormat=Asc.c_oAscNumberingFormat.Decimal;this.GeneralSwitches= [];this.ParentContent=null}CFieldInstructionSEQ.prototype=Object.create(CFieldInstructionBase.prototype);CFieldInstructionSEQ.prototype.constructor=CFieldInstructionSEQ;CFieldInstructionSEQ.prototype.Type=fieldtype_SEQ;CFieldInstructionSEQ.prototype.ToString=function(){var sInstruction=" SEQ ";if(this.Id)sInstruction+=this.Id;for(var i=0;i 0){var aTest=/[0-9]+/.exec(this.R);var nResult;if(Array.isArray(aTest)&&aTest.length>0){nResult=parseInt(aTest[0]);if(!isNaN(nResult))return nResult}}return null};CFieldInstructionSEQ.prototype.GetText=function(){if(!this.ParentContent)return"";var oTopDocument=this.ParentContent.Is_TopDocument(true);var aFields,oField,i,nIndex,nLvl,nCounter;if(!oTopDocument)return"";if(oTopDocument.IsHdrFtr(false)||oTopDocument.IsFootnote(false))return AscCommon.translateManager.getValue("Error! Main Document Only."); if(this.H)if(this.GeneralSwitches.length===0)return"";nIndex=this.GetRestartNum();if(nIndex===null){aFields=[];oTopDocument.GetAllSeqFieldsByType(this.Id,aFields);nIndex=-1;if(this.S){nLvl=parseInt(this.S);if(!isNaN(nLvl)){--nLvl;for(i=aFields.length-1;i>-1;--i){oField=aFields[i];if(AscCommon.isRealObject(oField)&&this.ComplexField===oField)break}if(i>-1){nCounter=i;for(i=i-1;i>-1;--i){oField=aFields[i];if(AscFormat.isRealNumber(oField)&&oField>=nLvl){aFields=aFields.splice(i+1,nCounter-i);break}}}}}nCounter= 1;for(i=0;i-1)return AscCommon.IntToNumberFormat(nIndex,this.NumFormat);return AscCommon.translateManager.getValue("Error! Main Document Only.")};CFieldInstructionSEQ.prototype.SetId=function(sVal){this.Id=sVal};CFieldInstructionSEQ.prototype.SetC=function(sVal){this.C=sVal};CFieldInstructionSEQ.prototype.SetH= function(sVal){this.H=sVal};CFieldInstructionSEQ.prototype.SetN=function(sVal){this.N=sVal};CFieldInstructionSEQ.prototype.SetR=function(sVal){this.R=sVal};CFieldInstructionSEQ.prototype.SetS=function(sVal){this.S=sVal};CFieldInstructionSEQ.prototype.SetGeneralSwitches=function(aSwitches){this.GeneralSwitches=aSwitches;for(var i=0;i0)this.Buffer=this.Buffer.substring(0,this.Buffer.length-1);this.Buffer+=this.Line.charAt(this.Pos); this.Pos++}return bWord}else{this.Buffer+=this.Line.charAt(this.Pos);bWord=true}this.Pos++}if(bWord)return true;return false};CFieldInstructionParser.prototype.private_ReadArguments=function(){var arrArguments=[];var sArgument=this.private_ReadArgument();while(null!==sArgument){arrArguments.push(sArgument);sArgument=this.private_ReadArgument()}return arrArguments};CFieldInstructionParser.prototype.private_ReadArgument=function(){this.private_SaveState();if(!this.private_ReadNext())return null;if(this.private_IsSwitch()){this.private_RestoreState(); return null}this.private_RemoveLastState();return this.Buffer};CFieldInstructionParser.prototype.private_IsSwitch=function(){return this.Buffer.charAt(0)==="\\"};CFieldInstructionParser.prototype.private_GetSwitchLetter=function(){return this.Buffer.charAt(1)};CFieldInstructionParser.prototype.private_SaveState=function(){this.SavedStates.push(this.Pos)};CFieldInstructionParser.prototype.private_RestoreState=function(){if(this.SavedStates.length>0)this.Pos=this.SavedStates[this.SavedStates.length- 1];this.private_RemoveLastState()};CFieldInstructionParser.prototype.private_RemoveLastState=function(){if(this.SavedStates.length>0)this.SavedStates.splice(this.SavedStates.length-1,1)};CFieldInstructionParser.prototype.private_ReadGeneralFormatSwitch=function(){if(!this.private_IsSwitch()||this.Buffer.charAt(1)!=="*")return;if(!this.private_ReadNext()||this.private_IsSwitch())return};CFieldInstructionParser.prototype.private_ReadPAGE=function(){this.Result=new CFieldInstructionPAGE;while(this.private_ReadNext())if(this.private_IsSwitch())this.private_ReadGeneralFormatSwitch()}; CFieldInstructionParser.prototype.private_ReadFORMULA=function(){this.Result=new CFieldInstructionFORMULA;var sFormula=this.Buffer.slice(1,this.Buffer.length);var sFormat=null;var bFormat=false;var bNumFormat=false;while(this.private_ReadNext())if(this.private_IsSwitch()){bFormat=true;if("#"===this.Buffer.charAt(1))bNumFormat=true}else{if(bFormat){if(bNumFormat)sFormat=this.Buffer}else sFormula+=this.Buffer;bFormat=false;bNumFormat=false}sFormula=sFormula.toUpperCase();var oFormat;if(null!==sFormat){oFormat= AscCommon.oNumFormatCache.get(sFormat,AscCommon.NumFormatType.WordFieldNumeric);this.Result.SetFormat(oFormat)}this.Result.SetFormula(sFormula)};CFieldInstructionParser.prototype.private_ReadPAGEREF=function(){var sBookmarkName=null;var isHyperlink=false,isPageRel=false;var isSwitch=false,isBookmark=false;while(this.private_ReadNext())if(this.private_IsSwitch()){isSwitch=true;if("p"===this.Buffer.charAt(1))isPageRel=true;else if("h"===this.Buffer.charAt(1))isHyperlink=true}else if(!isSwitch&&!isBookmark){sBookmarkName= this.Buffer;isBookmark=true}this.Result=new CFieldInstructionPAGEREF(sBookmarkName,isHyperlink,isPageRel)};CFieldInstructionParser.prototype.private_ReadTOC=function(){this.Result=new CFieldInstructionTOC;var arrArguments;var isOutline=false,isStyles=false;while(this.private_ReadNext())if(this.private_IsSwitch()){var sType=this.private_GetSwitchLetter();if("w"===sType)this.Result.SetPreserveTabs(true);else if("x"===sType)this.Result.SetRemoveBreaks(false);else if("h"===sType)this.Result.SetHyperlinks(true); else if("p"===sType){arrArguments=this.private_ReadArguments();if(arrArguments.length>0)this.Result.SetSeparator(arrArguments[0])}else if("o"===sType){arrArguments=this.private_ReadArguments();if(arrArguments.length>0){var arrRange=this.private_ParseIntegerRange(arrArguments[0]);if(null!==arrRange)this.Result.SetHeadingRange(arrRange[0],arrRange[1])}else this.Result.SetHeadingRange(1,9);isOutline=true}else if("t"===sType){arrArguments=this.private_ReadArguments();if(arrArguments.length>0){this.Result.SetStylesArrayRaw(arrArguments[0]); isStyles=true}}else if("n"===sType){arrArguments=this.private_ReadArguments();if(arrArguments.length>0){var arrRange=this.private_ParseIntegerRange(arrArguments[0]);if(null!==arrRange)this.Result.SetPageRefSkippedLvls(true,arrRange[0],arrRange[1]);else this.Result.SetPageRefSkippedLvls(true,-1,-1)}else this.Result.SetPageRefSkippedLvls(true,-1,-1)}else if("c"===sType){arrArguments=this.private_ReadArguments();if(arrArguments.length>0){var sCaption=arrArguments[0];if(typeof sCaption==="string"&&sCaption.length> 0)this.Result.SetCaption(sCaption);else this.Result.SetCaption(null)}else this.Result.SetCaption(null)}else if("a"===sType){arrArguments=this.private_ReadArguments();if(arrArguments.length>0){var sCaptionOnlyText=arrArguments[0];if(typeof sCaptionOnlyText==="string"&&sCaptionOnlyText.length>0)this.Result.SetCaptionOnlyText(sCaptionOnlyText);else this.Result.SetCaptionOnlyText(null)}else this.Result.SetCaptionOnlyText(null)}}if(!isOutline&&!isStyles)this.Result.SetHeadingRange(1,9)};CFieldInstructionParser.prototype.private_ReadASK= function(){this.Result=new CFieldInstructionASK;var arrArguments=this.private_ReadArguments();if(arrArguments.length>=2)this.Result.SetPromptText(arrArguments[1]);if(arrArguments.length>=1)this.Result.SetBookmarkName(arrArguments[0])};CFieldInstructionParser.prototype.private_ReadREF=function(sBookmarkName){this.Result=new CFieldInstructionREF;if(undefined!==sBookmarkName)this.Result.SetBookmarkName(sBookmarkName);else{var arrArguments=this.private_ReadArguments();if(arrArguments.length>0)this.Result.SetBookmarkName(arrArguments[0])}while(this.private_ReadNext())if(this.private_IsSwitch()){var sType= this.private_GetSwitchLetter();if("*"===sType){arrArguments=this.private_ReadArguments();if(arrArguments.length>0)this.Result.SetGeneralSwitches(arrArguments)}else if("d"===sType){arrArguments=this.private_ReadArguments();if(arrArguments.length>0)if(typeof arrArguments[0]==="string"&&arrArguments[0].length>0)this.Result.SetDelimiter(arrArguments[0])}else if("h"===sType)this.Result.SetHyperlink(true);else if("n"===sType)this.Result.SetIsNumberNoContext(true);else if("w"===sType)this.Result.SetIsNumberFullContext(true); else if("r"===sType)this.Result.SetIsNumber(true);else if("p"===sType)this.Result.SetIsPosition(true)}};CFieldInstructionParser.prototype.private_ReadNOTEREF=function(){this.Result=new CFieldInstructionNOTEREF;var arrArguments=this.private_ReadArguments();if(arrArguments.length>0)this.Result.SetBookmarkName(arrArguments[0]);while(this.private_ReadNext())if(this.private_IsSwitch()){var sType=this.private_GetSwitchLetter();if("*"===sType){arrArguments=this.private_ReadArguments();if(arrArguments.length> 0)this.Result.SetGeneralSwitches(arrArguments)}else if("h"===sType)this.Result.SetHyperlink(true);else if("f"===sType)this.Result.SetIsFormatting(true);else if("p"===sType)this.Result.SetIsPosition(true)}};CFieldInstructionParser.prototype.private_ReadNUMPAGES=function(){this.Result=new CFieldInstructionNUMPAGES};CFieldInstructionParser.prototype.private_ReadHYPERLINK=function(){this.Result=new CFieldInstructionHYPERLINK;var arrArguments=this.private_ReadArguments();if(arrArguments.length>0)this.Result.SetLink(arrArguments[0]); while(this.private_ReadNext())if(this.private_IsSwitch()){var sType=this.private_GetSwitchLetter();if("o"===sType){arrArguments=this.private_ReadArguments();if(arrArguments.length>0)this.Result.SetToolTip(arrArguments[0])}else if("l"===sType){arrArguments=this.private_ReadArguments();if(arrArguments.length>0)this.Result.SetBookmarkName(arrArguments[0])}}};CFieldInstructionParser.prototype.private_ParseIntegerRange=function(sValue){var nSepPos=sValue.indexOf("-");if(-1===nSepPos)return null;var nValue1= parseInt(sValue.substr(0,nSepPos));var nValue2=parseInt(sValue.substr(nSepPos+1));if(isNaN(nValue1)||isNaN(nValue2))return null;return[nValue1,nValue2]};CFieldInstructionParser.prototype.private_ParseSEQ=function(){this.Result=new CFieldInstructionSEQ;var arrArguments=this.private_ReadArguments();if(arrArguments.length>0)this.Result.SetId(arrArguments[0]);while(this.private_ReadNext())if(this.private_IsSwitch()){var sType=this.private_GetSwitchLetter();if("*"===sType){arrArguments=this.private_ReadArguments(); if(arrArguments.length>0)this.Result.SetGeneralSwitches(arrArguments)}else if("c"===sType)this.Result.SetC(true);else if("h"===sType)this.Result.SetH(true);else if("n"===sType)this.Result.SetN(true);else if("r"===sType){arrArguments=this.private_ReadArguments();if(arrArguments.length>0)this.Result.SetR(arrArguments[0])}else if("s"===sType){arrArguments=this.private_ReadArguments();if(arrArguments.length>0)this.Result.SetS(arrArguments[0])}}};CFieldInstructionParser.prototype.private_ParseSTYLEREF= function(){this.Result=new CFieldInstructionSTYLEREF;var arrArguments=this.private_ReadArguments();if(arrArguments.length>0)this.Result.SetStyleName(arrArguments[0]);while(this.private_ReadNext())if(this.private_IsSwitch()){var sType=this.private_GetSwitchLetter();if("*"===sType){arrArguments=this.private_ReadArguments();if(arrArguments.length>0)this.Result.SetGeneralSwitches(arrArguments)}else if("l"===sType)this.Result.SetL(true);else if("n"===sType)this.Result.SetN(true);else if("p"===sType)this.Result.SetP(true); else if("r"===sType)this.Result.SetR(true);else if("t"===sType)this.Result.SetT(true);else if("w"===sType)this.Result.SetW(true);else if("s"===sType)this.Result.SetS(true)}};CFieldInstructionParser.prototype.private_ReadTIME=function(){this.Result=new CFieldInstructionTIME;while(this.private_ReadNext())if(this.private_IsSwitch())if("@"===this.Buffer.charAt(1)){var arrArguments=this.private_ReadArguments();if(arrArguments.length>0)this.Result.SetFormat(arrArguments[0])}};CFieldInstructionParser.prototype.private_ReadDATE= function(){this.Result=new CFieldInstructionDATE;while(this.private_ReadNext())if(this.private_IsSwitch())if("@"===this.Buffer.charAt(1)){var arrArguments=this.private_ReadArguments();if(arrArguments.length>0)this.Result.SetFormat(arrArguments[0])}};"use strict";var fldchartype_Begin=0;var fldchartype_Separate=1;var fldchartype_End=2;function ParaFieldChar(Type,LogicDocument){CRunElementBase.call(this);this.LogicDocument=LogicDocument;this.Use=true;this.CharType=undefined===Type?fldchartype_Begin: Type;this.ComplexField=this.CharType===fldchartype_Begin?new CComplexField(LogicDocument):null;this.Run=null;this.X=0;this.Y=0;this.PageAbs=0;this.FontKoef=1;this.NumWidths=[];this.Widths=[];this.String="";this.NumValue=null}ParaFieldChar.prototype=Object.create(CRunElementBase.prototype);ParaFieldChar.prototype.constructor=ParaFieldChar;ParaFieldChar.prototype.Type=para_FieldChar;ParaFieldChar.prototype.Copy=function(){return new ParaFieldChar(this.CharType,this.LogicDocument)};ParaFieldChar.prototype.Measure= function(Context,TextPr){if(this.IsSeparate()){this.FontKoef=TextPr.Get_FontKoef();Context.SetFontSlot(fontslot_ASCII,this.FontKoef);for(var Index=0;Index<10;Index++)this.NumWidths[Index]=Context.Measure(""+Index).Width;this.private_UpdateWidth()}};ParaFieldChar.prototype.Draw=function(X,Y,Context){if(this.IsSeparate()&&null!==this.NumValue){var Len=this.String.length;var _X=X;var _Y=Y;Context.SetFontSlot(fontslot_ASCII,this.FontKoef);for(var Index=0;Index1)nTabPos=Math.max(0,Math.min(oSectPr.GetColumnWidth(0),oSectPr.GetPageWidth(),oSectPr.GetContentFrameWidth()));else nTabPos=Math.max(0,Math.min(oSectPr.GetPageWidth(),oSectPr.GetContentFrameWidth())); var oStyles=this.LogicDocument.Get_Styles();var arrOutline;var sCaption=this.Instruction.GetCaption();var sCaptionOnlyText=this.Instruction.GetCaptionOnlyText();var sResultCaption=sCaption;var oBookmarksManager=this.LogicDocument.GetBookmarksManager();if(typeof sCaptionOnlyText==="string"&&sCaptionOnlyText.length>0)sResultCaption=sCaptionOnlyText;var oOutlinePr={OutlineStart:this.Instruction.GetHeadingRangeStart(),OutlineEnd:this.Instruction.GetHeadingRangeEnd(),Styles:this.Instruction.GetStylesArray()}; var bTOF=false;var bSkipCaptionLbl=false;if(sCaption!==undefined||sCaptionOnlyText!==undefined){bTOF=true;var aStyles=this.Instruction.GetStylesArray();if(aStyles.length>0)arrOutline=this.LogicDocument.GetOutlineParagraphs(null,oOutlinePr);else{arrOutline=[];if(sCaptionOnlyText!==undefined)bSkipCaptionLbl=true;if(typeof sResultCaption==="string"&&sResultCaption.length>0){var aParagraphs=this.LogicDocument.GetAllCaptionParagraphs(sResultCaption);var oCurPara;for(var nParagraph=0;nParagraph0){var arrSelectedParagraphs=this.LogicDocument.GetCurrentParagraph(false,true);if(arrSelectedParagraphs.length>0){oPara=arrSelectedParagraphs[0];oTabs=oPara.GetParagraphTabs();if(oTabs.Tabs.length>0)oTab=oTabs.Tabs[oTabs.Tabs.length-1]}}if(arrOutline.length>0)for(var nIndex=0,nCount=arrOutline.length;nIndex0)sValue+=sDelimiter}}else if(this.Instruction.IsNumberNoContext())sValue= oNumbering.GetText(oNumPr.NumId,oNumPr.Lvl,oNumInfo,true);if(sPosition.length>0){sValue+=" ";sValue+=sPosition}return this.private_GetMessageContent(sValue,null)}else if(this.Instruction.IsPosition()&&sPosition.length>0)return this.private_GetMessageContent(sPosition,null);else return this.private_GetBookmarkContent(sBookmarkName)};CComplexField.prototype.private_GetNOTEREFContent=function(){var sValue=AscCommon.translateManager.getValue("Error! Bookmark not defined.");if(!this.Instruction||this.Instruction.Type!== fieldtype_NOTEREF)return this.private_GetErrorContent(sValue);var oBookmarksManager=this.LogicDocument.GetBookmarksManager();var sBookmarkName=this.Instruction.GetBookmarkName();var oBookmark=oBookmarksManager.GetBookmarkByName(sBookmarkName);if(!oBookmark)return this.private_GetErrorContent(sValue);this.LogicDocument.TurnOff_InterfaceEvents();oBookmarksManager.SelectBookmark(sBookmarkName);this.LogicDocument.TurnOn_InterfaceEvents(false);var oSelectionInfo=this.LogicDocument.GetSelectedElementsInfo({CheckAllSelection:true}); var aFootEndNotes=oSelectionInfo.GetFootEndNoteRefs();if(aFootEndNotes.length===0)return this.private_GetErrorContent(sValue);var oFootEndNote=aFootEndNotes[0];var oStartBookmark=oBookmark[0];var oSrcParagraph=oStartBookmark.Paragraph;var oRun=this.BeginChar.GetRun();var oParagraph=oRun.GetParagraph();if(!oSrcParagraph||!oParagraph)return this.private_GetErrorContent(sValue);var oSelectedContent=new CSelectedContent;var oTextPr;var oPara=new Paragraph(this.LogicDocument.GetDrawingDocument(),this.LogicDocument, false);var oParent=oParagraph.GetParent();var oSrcParent=oSrcParagraph.GetParent();if(!oParent||!oSrcParent)return this.private_GetErrorContent(sValue);if(this.Instruction.IsPosition()&&oParent.IsHdrFtr()===oSrcParent.IsHdrFtr()){sValue=this.private_GetREFPosValue();if(typeof sValue==="string"&&sValue.length>0){oRun=new ParaRun(oPara,false);oRun.AddText(sValue);oPara.AddToContent(0,oRun)}}else{oRun=new ParaRun(oPara,false);if(this.Instruction.IsFormatting()){oTextPr=new CTextPr;oTextPr.Set_FromObject({VertAlign:AscCommon.vertalign_SuperScript}); oRun.Apply_Pr(oTextPr)}oRun.AddText(oFootEndNote.private_GetString());oPara.AddToContent(0,oRun)}oSelectedContent.Add(new CSelectedElement(oPara,false));oSelectedContent.DoNotAddEmptyPara=true;return oSelectedContent};CComplexField.prototype.private_UpdateNOTEREF=function(){this.private_InsertContent(this.private_GetNOTEREFContent())};CComplexField.prototype.private_CalculateNOTEREF=function(){var oSelectedContent=this.private_GetNOTEREFContent();return oSelectedContent.GetText(null)};CComplexField.prototype.SelectFieldValue= function(){var oDocument=this.GetTopDocumentContent();if(!oDocument)return;oDocument.RemoveSelection();var oRun=this.SeparateChar.GetRun();oRun.Make_ThisElementCurrent(false);oRun.SetCursorPosition(oRun.GetElementPosition(this.SeparateChar)+1);var oStartPos=oDocument.GetContentPosition(false);oRun=this.EndChar.GetRun();oRun.Make_ThisElementCurrent(false);oRun.SetCursorPosition(oRun.GetElementPosition(this.EndChar));var oEndPos=oDocument.GetContentPosition(false);oDocument.SetSelectionByContentPositions(oStartPos, oEndPos)};CComplexField.prototype.SelectFieldCode=function(){var oDocument=this.GetTopDocumentContent();if(!oDocument)return;oDocument.RemoveSelection();var oRun=this.BeginChar.GetRun();oRun.Make_ThisElementCurrent(false);oRun.SetCursorPosition(oRun.GetElementPosition(this.BeginChar)+1);var oStartPos=oDocument.GetContentPosition(false);oRun=this.SeparateChar.GetRun();oRun.Make_ThisElementCurrent(false);oRun.SetCursorPosition(oRun.GetElementPosition(this.SeparateChar));var oEndPos=oDocument.GetContentPosition(false); oDocument.SetSelectionByContentPositions(oStartPos,oEndPos)};CComplexField.prototype.SelectField=function(){var oDocument=this.GetTopDocumentContent();if(!oDocument)return;oDocument.RemoveSelection();var oRun=this.BeginChar.GetRun();oRun.Make_ThisElementCurrent(false);oRun.SetCursorPosition(oRun.GetElementPosition(this.BeginChar));var oStartPos=oDocument.GetContentPosition(false);oRun=this.EndChar.GetRun();oRun.Make_ThisElementCurrent(false);oRun.SetCursorPosition(oRun.GetElementPosition(this.EndChar)+ 1);var oEndPos=oDocument.GetContentPosition(false);oDocument.RemoveSelection();oDocument.SetSelectionByContentPositions(oStartPos,oEndPos)};CComplexField.prototype.GetFieldValueText=function(){var oDocument=this.GetTopDocumentContent();if(!oDocument)return;oDocument.RemoveSelection();var oRun=this.SeparateChar.GetRun();oRun.Make_ThisElementCurrent(false);oRun.SetCursorPosition(oRun.GetElementPosition(this.SeparateChar)+1);var oStartPos=oDocument.GetContentPosition(false);oRun=this.EndChar.GetRun(); oRun.Make_ThisElementCurrent(false);oRun.SetCursorPosition(oRun.GetElementPosition(this.EndChar));var oEndPos=oDocument.GetContentPosition(false);oDocument.SetSelectionByContentPositions(oStartPos,oEndPos);return oDocument.GetSelectedText()};CComplexField.prototype.GetTopDocumentContent=function(){if(!this.BeginChar||!this.SeparateChar||!this.EndChar)return null;var oTopDocument=this.BeginChar.GetTopDocumentContent();if(oTopDocument!==this.EndChar.GetTopDocumentContent()||oTopDocument!==this.SeparateChar.GetTopDocumentContent())return null; return oTopDocument};CComplexField.prototype.IsUse=function(){if(!this.BeginChar)return false;return this.BeginChar.IsUse()};CComplexField.prototype.GetStartDocumentPosition=function(){if(!this.BeginChar)return null;var oDocument=this.LogicDocument;var oState=oDocument.SaveDocumentState();var oRun=this.BeginChar.GetRun();oRun.Make_ThisElementCurrent(false);oRun.SetCursorPosition(oRun.GetElementPosition(this.BeginChar));var oDocPos=oDocument.GetContentPosition(false);oDocument.LoadDocumentState(oState); return oDocPos};CComplexField.prototype.GetEndDocumentPosition=function(){if(!this.EndChar)return null;var oDocument=this.LogicDocument;var oState=oDocument.SaveDocumentState();var oRun=this.EndChar.GetRun();oRun.Make_ThisElementCurrent(false);oRun.SetCursorPosition(oRun.GetElementPosition(this.EndChar)+1);var oDocPos=oDocument.GetContentPosition(false);oDocument.LoadDocumentState(oState);return oDocPos};CComplexField.prototype.IsValid=function(){return this.IsUse()&&this.BeginChar&&this.SeparateChar&& this.EndChar};CComplexField.prototype.GetInstruction=function(){this.private_UpdateInstruction();return this.Instruction};CComplexField.prototype.private_UpdateInstruction=function(){if(this.InstructionLine&&(!this.Instruction||!this.Instruction.CheckInstructionLine(this.InstructionLine))){var oParser=new CFieldInstructionParser;this.Instruction=oParser.GetInstructionClass(this.InstructionLine);this.Instruction.SetComplexField(this);this.Instruction.SetInstructionLine(this.InstructionLine)}};CComplexField.prototype.private_CheckNestedComplexFields= function(){var nCount=this.InstructionCF.length;if(nCount>0){this.Instruction=null;this.InstructionLine=this.InstructionLineSrc;for(var nIndex=0;nIndex63)this.setError(ERROR_TYPE_LARGE_NUMBER,null)};CFormulaNode.prototype.checkRoundNumber= function(number){return fRoundNumber(number,2)};CFormulaNode.prototype.checkBraces=function(_result){return _result};CFormulaNode.prototype.formatResult=function(){var sResult=null;if(AscFormat.isRealNumber(this.result)){var _result=this.result;if(_result===Infinity)_result=1;if(_result===-Infinity)_result=-1;if(this.parseQueue.format)return this.parseQueue.format.formatToWord(_result,14);sResult="";if(_result<0)_result=-_result;_result=this.checkRoundNumber(_result);var i;var sRes=_result.toExponential(13); var aDigits=sRes.split("e");var nPow=parseInt(aDigits[1]);var sNum=aDigits[0];var t=sNum.split(".");if(nPow<0){for(i=t[1].length-1;i>-1;--i)if(t[1][i]!=="0")break;if(i>-1)sResult+=t[1].slice(0,i+1);sResult=t[0]+sResult;nPow=-nPow-1;for(i=0;i=nPow;--i)if(t[1][i]!=="0")break;var sStr=""; for(;i>=nPow;--i)sStr=t[1][i]+sStr;if(sStr!=="")sResult+=this.digitSeparator+sStr}}this.checkSizeFormated(sResult);if(this.result<0)sResult="-"+sResult;sResult=this.checkBraces(sResult)}return sResult};CFormulaNode.prototype.calculate=function(){this.error=null;this.result=null;if(!this.parseQueue){this.setError(ERROR_TYPE_ERROR,null);return}var aArgs=[];for(var i=0;i-1;--i){oArg=aArgs[i];if(oArg.error){this.error=oArg.error;return}}if(this.isOperator());this._calculate(aArgs)};CFormulaNode.prototype._calculate=function(aArgs){this.setError(ERROR_TYPE_ERROR,null)};CFormulaNode.prototype.isFunction=function(){return false};CFormulaNode.prototype.isOperator=function(){return false};CFormulaNode.prototype.setError=function(Type,Data){this.error=new CError(Type,Data)};CFormulaNode.prototype.setParseQueue= function(oQueue){this.parseQueue=oQueue};CFormulaNode.prototype.argumentsCount=0;function CNumberNode(parseQueue){CFormulaNode.call(this,parseQueue);this.value=null}CNumberNode.prototype=Object.create(CFormulaNode.prototype);CNumberNode.prototype.precedence=15;CNumberNode.prototype.checkBraces=function(_result){var sFormula=this.parseQueue.formula;if(sFormula[0]==="("&&sFormula[sFormula.length-1]===")")return"("+_result+")";return _result};CNumberNode.prototype.checkSizeFormated=function(_result){var sFormula= this.parseQueue.formula;if(sFormula[0]==="("&&sFormula[sFormula.length-1]===")")CFormulaNode.prototype.checkSizeFormated.call(this,_result)};CNumberNode.prototype.checkRoundNumber=function(number){return number};CNumberNode.prototype._calculate=function(){if(AscFormat.isRealNumber(this.value))this.result=this.value;else this.setError(ERROR_TYPE_ERROR,null);return this.error};function CListSeparatorNode(parseQueue){CFormulaNode.call(this,parseQueue)}CListSeparatorNode.prototype=Object.create(CFormulaNode.prototype); CListSeparatorNode.prototype.precedence=15;function COperatorNode(parseQueue){CFormulaNode.call(this,parseQueue)}COperatorNode.prototype=Object.create(CFormulaNode.prototype);COperatorNode.prototype.precedence=0;COperatorNode.prototype.argumentsCount=2;COperatorNode.prototype.isOperator=function(){return true};COperatorNode.prototype.checkCellInFunction=function(aArgs){var i,oArg;if(this.parent&&this.parent.isFunction()&&this.parent.listSupport())for(i=aArgs.length-1;i>-1;--i){oArg=aArgs[i];if(oArg.isCell()){this.setError(ERROR_TYPE_SYNTAX_ERROR, oArg.getOwnCellName());return}}};function CUnaryMinusOperatorNode(parseQueue){COperatorNode.call(this,parseQueue)}CUnaryMinusOperatorNode.prototype=Object.create(COperatorNode.prototype);CUnaryMinusOperatorNode.prototype.precedence=13;CUnaryMinusOperatorNode.prototype.argumentsCount=1;CUnaryMinusOperatorNode.prototype._calculate=function(aArgs){this.checkCellInFunction(aArgs);if(this.error)return;this.result=-aArgs[0].result};function CPowersAndRootsOperatorNode(parseQueue){COperatorNode.call(this, parseQueue)}CPowersAndRootsOperatorNode.prototype=Object.create(COperatorNode.prototype);CPowersAndRootsOperatorNode.prototype.precedence=12;CPowersAndRootsOperatorNode.prototype._calculate=function(aArgs){this.checkCellInFunction(aArgs);if(this.error)return;this.result=Math.pow(aArgs[1].result,aArgs[0].result)};function CMultiplicationOperatorNode(parseQueue){COperatorNode.call(this,parseQueue)}CMultiplicationOperatorNode.prototype=Object.create(COperatorNode.prototype);CMultiplicationOperatorNode.prototype.precedence= 11;CMultiplicationOperatorNode.prototype._calculate=function(aArgs){this.checkCellInFunction(aArgs);if(this.error)return;this.result=aArgs[0].result*aArgs[1].result};function CDivisionOperatorNode(parseQueue){COperatorNode.call(this,parseQueue)}CDivisionOperatorNode.prototype=Object.create(COperatorNode.prototype);CDivisionOperatorNode.prototype.precedence=11;CDivisionOperatorNode.prototype._calculate=function(aArgs){this.checkCellInFunction(aArgs);if(this.error)return;if(AscFormat.fApproxEqual(0, aArgs[0].result)){this.setError(ERROR_TYPE_ZERO_DIVIDE,null);return}this.result=aArgs[1].result/aArgs[0].result};function CPercentageOperatorNode(parseQueue){COperatorNode.call(this,parseQueue)}CPercentageOperatorNode.prototype=Object.create(COperatorNode.prototype);CPercentageOperatorNode.prototype.precedence=8;CPercentageOperatorNode.prototype.argumentsCount=1;CPercentageOperatorNode.prototype._calculate=function(aArgs){this.checkCellInFunction(aArgs);if(this.error)return;if(aArgs[0].error){this.setError(ERROR_TYPE_SYNTAX_ERROR, "%");return}this.result=aArgs[0].result/100};CPercentageOperatorNode.prototype.supportErrorArgs=function(){return true};function CAdditionOperatorNode(parseQueue){COperatorNode.call(this,parseQueue)}CAdditionOperatorNode.prototype=Object.create(COperatorNode.prototype);CAdditionOperatorNode.prototype.precedence=7;CAdditionOperatorNode.prototype._calculate=function(aArgs){this.checkCellInFunction(aArgs);if(this.error)return;this.result=aArgs[1].result+aArgs[0].result};function CSubtractionOperatorNode(parseQueue){COperatorNode.call(this, parseQueue)}CSubtractionOperatorNode.prototype=Object.create(COperatorNode.prototype);CSubtractionOperatorNode.prototype.precedence=7;CSubtractionOperatorNode.prototype._calculate=function(aArgs){this.checkCellInFunction(aArgs);if(this.error)return;this.result=aArgs[1].result-aArgs[0].result};function CEqualToOperatorNode(parseQueue){COperatorNode.call(this,parseQueue)}CEqualToOperatorNode.prototype=Object.create(COperatorNode.prototype);CEqualToOperatorNode.prototype.precedence=6;CEqualToOperatorNode.prototype._calculate= function(aArgs){this.checkCellInFunction(aArgs);if(this.error)return;this.result=AscFormat.fApproxEqual(aArgs[1].result,aArgs[0].result)?1:0};function CNotEqualToOperatorNode(parseQueue){COperatorNode.call(this,parseQueue)}CNotEqualToOperatorNode.prototype=Object.create(COperatorNode.prototype);CNotEqualToOperatorNode.prototype.precedence=5;CNotEqualToOperatorNode.prototype._calculate=function(aArgs){this.checkCellInFunction(aArgs);if(this.error)return;this.result=AscFormat.fApproxEqual(aArgs[1].result, aArgs[0].result)?0:1};function CLessThanOperatorNode(parseQueue){COperatorNode.call(this,parseQueue)}CLessThanOperatorNode.prototype=Object.create(COperatorNode.prototype);CLessThanOperatorNode.prototype.precedence=4;CLessThanOperatorNode.prototype._calculate=function(aArgs){this.checkCellInFunction(aArgs);if(this.error)return;this.result=aArgs[1].resultaArgs[0].result?1:0};function CGreaterThanOrEqualOperatorNode(parseQueue){COperatorNode.call(this,parseQueue)}CGreaterThanOrEqualOperatorNode.prototype=Object.create(COperatorNode.prototype);CGreaterThanOrEqualOperatorNode.prototype.precedence=1;CGreaterThanOrEqualOperatorNode.prototype._calculate=function(aArgs){this.checkCellInFunction(aArgs);if(this.error)return;this.result=aArgs[1].result>=aArgs[0].result? 1:0};function CLeftParenOperatorNode(parseQueue){CFormulaNode.call(this,parseQueue)}CLeftParenOperatorNode.prototype=Object.create(CFormulaNode.prototype);CLeftParenOperatorNode.prototype.precedence=1;function CRightParenOperatorNode(parseQueue){CFormulaNode.call(this,parseQueue)}CRightParenOperatorNode.prototype=Object.create(CFormulaNode.prototype);CRightParenOperatorNode.prototype.precedence=1;function CLineSeparatorOperatorNode(parseQueue){CFormulaNode.call(this,parseQueue)}CLineSeparatorOperatorNode.prototype= Object.create(CFormulaNode.prototype);CLineSeparatorOperatorNode.prototype.precedence=1;var oOperatorsMap={};oOperatorsMap["-"]=CUnaryMinusOperatorNode;oOperatorsMap["^"]=CPowersAndRootsOperatorNode;oOperatorsMap["*"]=CMultiplicationOperatorNode;oOperatorsMap["/"]=CDivisionOperatorNode;oOperatorsMap["%"]=CPercentageOperatorNode;oOperatorsMap["+"]=CAdditionOperatorNode;oOperatorsMap["-"]=CSubtractionOperatorNode;oOperatorsMap["="]=CEqualToOperatorNode;oOperatorsMap["<>"]=CNotEqualToOperatorNode;oOperatorsMap["<"]= CLessThanOperatorNode;oOperatorsMap["<="]=CLessThanOrEqualToOperatorNode;oOperatorsMap[">"]=CGreaterThanOperatorNode;oOperatorsMap[">="]=CGreaterThanOrEqualOperatorNode;oOperatorsMap["("]=CLeftParenOperatorNode;oOperatorsMap[")"]=CRightParenOperatorNode;var LEFT=0;var RIGHT=1;var ABOVE=2;var BELOW=3;var sLetters="ZABCDEFGHIJKLMNOPQRSTUVWXY";var sDigits="0123456789";function CCellRangeNode(parseQueue){CFormulaNode.call(this,parseQueue);this.bookmarkName=null;this.c1=null;this.r1=null;this.c2=null; this.r2=null;this.dir=null}CCellRangeNode.prototype=Object.create(CFormulaNode.prototype);CCellRangeNode.prototype.argumentsCount=0;CCellRangeNode.prototype.getCellName=function(c,r){var _c=c+1;var _r=r+1;var sColName=sLetters[_c%26];_c=_c/26>>0;while(_c!==0){sColName=sLetters[_c%26]+sColName;_c=_c/26>>0}var sRowName=sDigits[_r%10];_r=_r/10>>0;while(_r!==0){sRowName=sDigits[_r%10]+sRowName;_r=_r/10>>0}return sColName+sRowName};CCellRangeNode.prototype.getOwnCellName=function(c,r){return this.getCellName(this.c1, this.r1)};CCellRangeNode.prototype.parseText=function(sText){var oParser=new CTextParser(",",this.digitSeparator);oParser.setFlag(PARSER_MASK_CLEAN,true);oParser.parse(Asc.trim(sText));if(oParser.parseQueue){oParser.parseQueue.flags=oParser.flags;oParser.parseQueue.calculate(false);if(!AscFormat.isRealNumber(oParser.parseQueue.result)||oParser.parseQueue.pos>0){var aQueue=oParser.parseQueue.queue;var fSumm=0;if(aQueue.length>0){for(var i=0;i63&&oFunction.listSupport())this.setError(ERROR_TYPE_INDEX_TOO_LARGE,null);else this.setError(this.getCellName(this.c1,this.r1)+" "+AscCommon.translateManager.getValue(ERROR_TYPE_IS_NOT_IN_TABLE),null);return}oContent=oCell.GetContent();if(!oContent){this.result=0;return}var oRes=this.getContentValue(oContent);if(oRes&&!AscFormat.isRealNumber(oRes.result))this.result=0;else this.result=oRes.result};CCellRangeNode.prototype._parseCellVal=function(oCurCell,oRes){if(oCurCell){var res= this.getContentValue(oCurCell.GetContent());if(!res||!(res.flags&PARSER_MASK_CLEAN))if(oRes.bClean===true&&this.result.length>0)oRes.bBreak=true;else{oRes.bClean=false;if(res&&res.result!==null)this.result.push(res.result)}else if(res.result!==null)this.result.push(res.result)}};CCellRangeNode.prototype._calculate=function(){var oTable,oCell,oContent,oRow,i,oCurCell,oCurRow,nCellCount;if(this.isCell()){oTable=this.parseQueue.getParentTable();if(!oTable){this.result=0;return}this.calculateCell(oTable)}else if(this.isDir()){oTable= this.parseQueue.getParentTable();if(!oTable){this.setError(ERROR_TYPE_FORMULA_NOT_IN_TABLE,null);return}oCell=this.parseQueue.getParentCell();if(!oCell){this.setError(ERROR_TYPE_FORMULA_NOT_IN_TABLE,null);return}oRow=oCell.GetRow();if(!oRow){this.setError(ERROR_TYPE_FORMULA_NOT_IN_TABLE,null);return}var oResult={bClean:true,bBreak:false};if(this.dir===LEFT){if(oCell.Index===0){this.setError(ERROR_TYPE_INDEX_ZERO,null);return}this.result=[];for(i=oCell.Index-1;i>-1;--i){oCurCell=oRow.Get_Cell(i);this._parseCellVal(oCurCell, oResult);if(oResult.bBreak)break}}else if(this.dir===ABOVE){if(oRow.Index===0){this.setError(ERROR_TYPE_INDEX_ZERO,null);return}this.result=[];for(i=oRow.Index-1;i>-1;--i){oCurRow=oTable.Get_Row(i);oCurCell=oCurRow.Get_Cell(oCell.Index);this._parseCellVal(oCurCell,oResult);if(oResult.bBreak)break}}else if(this.dir===RIGHT){this.result=[];nCellCount=oRow.Get_CellsCount();for(i=oCell.Index+1;i>0};function CIFFunctionNode(parseQueue){CFunctionNode.call(this,parseQueue)}CIFFunctionNode.prototype=Object.create(CFunctionNode.prototype);CIFFunctionNode.prototype.minArgumentsCount= 3;CIFFunctionNode.prototype.maxArgumentsCount=3;CIFFunctionNode.prototype._calculate=function(aArgs){this.result=aArgs[2].result!==0?aArgs[1].result:aArgs[0].result};function CMAXFunctionNode(parseQueue){CFunctionNode.call(this,parseQueue)}CMAXFunctionNode.prototype=Object.create(CFunctionNode.prototype);CMAXFunctionNode.prototype.minArgumentsCount=2;CMAXFunctionNode.prototype.maxArgumentsCount=+Infinity;CMAXFunctionNode.prototype.listSupport=function(){return true};CMAXFunctionNode.prototype._calculate= function(aArgs){var ret=null;for(var i=0;i>0)};function CSIGNFunctionNode(parseQueue){CFunctionNode.call(this,parseQueue)}CSIGNFunctionNode.prototype=Object.create(CFunctionNode.prototype);CSIGNFunctionNode.prototype.minArgumentsCount=1;CSIGNFunctionNode.prototype.maxArgumentsCount=1;CSIGNFunctionNode.prototype._calculate=function(aArgs){if(aArgs[0].result<0)this.result=-1;else if(aArgs[0].result>0)this.result=1;else this.result=0};function CSUMFunctionNode(parseQueue){CFunctionNode.call(this,parseQueue)}CSUMFunctionNode.prototype= Object.create(CFunctionNode.prototype);CSUMFunctionNode.prototype.minArgumentsCount=2;CSUMFunctionNode.prototype.maxArgumentsCount=+Infinity;CSUMFunctionNode.prototype.listSupport=function(){return true};CSUMFunctionNode.prototype._calculate=function(aArgs){if(aArgs.length===0)return 0;var ret=null;for(var i=0;i-1)return this.queue[--this.pos];return null};CParseQueue.prototype.getParentTable=function(){var oCell=this.getParentCell();if(oCell){var oRow=oCell.Row;if(oRow)return oRow.Table}return null};CParseQueue.prototype.getParentCell=function(){var oCell=this.ParentContent&&this.ParentContent.IsTableCellContent(true);if(oCell)return oCell;return null};CParseQueue.prototype.setError=function(Type,Data){this.error=new CError(Type,Data)};CParseQueue.prototype.calculate= function(bFormat){this.pos=this.queue.length-1;this.error=null;this.result=null;if(this.pos<0){this.setError(ERROR_TYPE_ERROR,null);return this.error}var oLastToken=this.queue[this.pos];oLastToken.calculate();if(bFormat!==false)this.resultS=oLastToken.formatResult();this.error=oLastToken.error;this.result=oLastToken.result;return this.error};function CError(Type,Data){this.Type=AscCommon.translateManager.getValue(Type);this.Data=Data}var oFuncMap={};oFuncMap["ABS"]=CABSFunctionNode;oFuncMap["AND"]= CANDFunctionNode;oFuncMap["AVERAGE"]=CAVERAGEFunctionNode;oFuncMap["COUNT"]=CCOUNTFunctionNode;oFuncMap["DEFINED"]=CDEFINEDFunctionNode;oFuncMap["FALSE"]=CFALSEFunctionNode;oFuncMap["IF"]=CIFFunctionNode;oFuncMap["INT"]=CINTFunctionNode;oFuncMap["MAX"]=CMAXFunctionNode;oFuncMap["MIN"]=CMINFunctionNode;oFuncMap["MOD"]=CMODFunctionNode;oFuncMap["NOT"]=CNOTFunctionNode;oFuncMap["OR"]=CORFunctionNode;oFuncMap["PRODUCT"]=CPRODUCTFunctionNode;oFuncMap["ROUND"]=CROUNDFunctionNode;oFuncMap["SIGN"]=CSIGNFunctionNode; oFuncMap["SUM"]=CSUMFunctionNode;oFuncMap["TRUE"]=CTRUEFunctionNode;var PARSER_MASK_LEFT_PAREN=1;var PARSER_MASK_RIGHT_PAREN=2;var PARSER_MASK_LIST_SEPARATOR=4;var PARSER_MASK_BINARY_OPERATOR=8;var PARSER_MASK_UNARY_OPERATOR=16;var PARSER_MASK_NUMBER=32;var PARSER_MASK_FUNCTION=64;var PARSER_MASK_CELL_NAME=128;var PARSER_MASK_CELL_RANGE=256;var PARSER_MASK_BOOKMARK=512;var PARSER_MASK_BOOKMARK_CELL_REF=1024;var PARSER_MASK_CLEAN=2048;var ERROR_TYPE_SYNTAX_ERROR="Syntax Error";var ERROR_TYPE_MISSING_OPERATOR= "Missing Operator";var ERROR_TYPE_MISSING_ARGUMENT="Missing Argument";var ERROR_TYPE_LARGE_NUMBER="Number Too Large To Format";var ERROR_TYPE_ZERO_DIVIDE="Zero Divide";var ERROR_TYPE_IS_NOT_IN_TABLE="Is Not In Table";var ERROR_TYPE_INDEX_TOO_LARGE="Index Too Large";var ERROR_TYPE_FORMULA_NOT_IN_TABLE="The Formula Not In Table";var ERROR_TYPE_INDEX_ZERO="Table Index Cannot be Zero";var ERROR_TYPE_UNDEFINED_BOOKMARK="Undefined Bookmark";var ERROR_TYPE_UNEXPECTED_END="Unexpected End of Formula";var ERROR_TYPE_ERROR= "ERROR";function CFormulaParser(sListSeparator,sDigitSeparator){this.listSeparator=sListSeparator;this.digitSeparator=sDigitSeparator;this.formula=null;this.pos=0;this.parseQueue=null;this.error=null;this.flags=0}CFormulaParser.prototype.setFlag=function(nMask,bVal){if(bVal)this.flags|=nMask;else this.flags&=~nMask};CFormulaParser.prototype.checkExpression=function(oRegExp,fCallback){oRegExp.lastIndex=this.pos;var oRes=oRegExp.exec(this.formula);if(oRes&&oRes.index===this.pos){var ret=fCallback.call(this, this.pos,oRegExp.lastIndex);this.pos=oRegExp.lastIndex;return ret}return null};CFormulaParser.prototype.parseNumber=function(nStartPos,nEndPos){var sNum=this.formula.slice(nStartPos,nEndPos);sNum=sNum.replace(sComma,"");var number=parseFloat(sNum);if(AscFormat.isRealNumber(number)){var ret=new CNumberNode(this.parseQueue);ret.value=number;return ret}return null};CFormulaParser.prototype.parseCoord=function(nStartPos,nEndPos,oMap,nBase){var nRet=0;var nMultiplicator=1;for(var i=nEndPos-1;i>=nStartPos;--i){nRet+= oMap[this.formula[i]]*nMultiplicator;nMultiplicator*=nBase}return nRet};CFormulaParser.prototype.parseCol=function(nStartPos,nEndPos){return this.parseCoord(nStartPos,nEndPos,oLettersMap,26)-1};CFormulaParser.prototype.parseRow=function(nStartPos,nEndPos){return this.parseCoord(nStartPos,nEndPos,oDigitMap,10)-1};CFormulaParser.prototype.parseCellName=function(){var c,r;c=this.checkExpression(oColumnNameRegExp,this.parseCol);if(c===null)return null;r=this.checkExpression(oRowNameRegExp,this.parseRow); if(r===null)return null;var oRet=new CCellRangeNode(this.parseQueue);oRet.c1=c;oRet.r1=r;return oRet};CFormulaParser.prototype.parseCellCellRange=function(nStart,nEndPos){var oFirstCell,oSecondCell;oFirstCell=this.checkExpression(oCellNameRegExp,this.parseCellName);if(oFirstCell===null)return null;while(this.formula[this.pos]===" ")++this.pos;++this.pos;while(this.formula[this.pos]===" ")++this.pos;oSecondCell=this.checkExpression(oCellNameRegExp,this.parseCellName);if(oSecondCell===null)return null; var r1,r2,c1,c2;r1=Math.min(oFirstCell.r1,oSecondCell.r1);r2=Math.max(oFirstCell.r1,oSecondCell.r1);c1=Math.min(oFirstCell.c1,oSecondCell.c1);c2=Math.max(oFirstCell.c1,oSecondCell.c1);oFirstCell.r1=r1;oFirstCell.r2=r2;oFirstCell.c1=c1;oFirstCell.c2=c2;return oFirstCell};CFormulaParser.prototype.parseRowRange=function(nStartPos,nEndPos){var r1,r2;r1=this.checkExpression(oRowNameRegExp,this.parseRow);if(r1===null)return null;while(this.formula[this.pos]===" ")++this.pos;++this.pos;while(this.formula[this.pos]=== " ")++this.pos;r2=this.checkExpression(oRowNameRegExp,this.parseRow);if(r2===null)return null;var oRet=new CCellRangeNode(this.parseQueue);oRet.r1=Math.min(r1,r2);oRet.r2=Math.max(r1,r2);return oRet};CFormulaParser.prototype.parseColRange=function(nStartPos,nEndPos){var c1,c2;c1=this.checkExpression(oColumnNameRegExp,this.parseCol);if(c1===null)return null;while(this.formula[this.pos]===" ")++this.pos;++this.pos;while(this.formula[this.pos]===" ")++this.pos;c2=this.checkExpression(oColumnNameRegExp, this.parseCol);if(c2===null)return null;var oRet=new CCellRangeNode(this.parseQueue);oRet.c1=Math.min(c1,c2);oRet.c2=Math.max(c1,c2);return oRet};CFormulaParser.prototype.parseCellRange=function(nStartPos,nEndPos){var oRet;oRet=this.checkExpression(oCellCellRangeRegExp,this.parseCellCellRange);if(oRet)return oRet;oRet=this.checkExpression(oRowRangeRegExp,this.parseRowRange);if(oRet)return oRet;oRet=this.checkExpression(oColRangeRegExp,this.parseColRange);if(oRet)return oRet;return null};CFormulaParser.prototype.parseCellRef= function(nStartPos,nEndPos){var oRet;oRet=this.checkExpression(oCellRangeRegExp,this.parseCellRange);if(oRet)return oRet;oRet=this.checkExpression(oCellNameRegExp,this.parseCellName);if(oRet)return oRet;return null};CFormulaParser.prototype.parseBookmark=function(nStartPos,nEndPos){var oRet=new CCellRangeNode(this.parseQueue);oRet.bookmarkName=this.formula.slice(nStartPos,nEndPos);return oRet};CFormulaParser.prototype.parseBookmarkCellRef=function(nStartPos,nEndPos){var oResult=this.checkExpression(oBookmarkNameRegExp, this.parseBookmark);if(oResult===null)return null;if(this.pos=this.formula.length)return null;if(this.formula[this.pos]==="("){++this.pos;return new CLeftParenOperatorNode(this.parseQueue)}if(this.formula[this.pos]===")"){++this.pos;return new CRightParenOperatorNode(this.parseQueue)}if(this.formula[this.pos]=== this.listSeparator){++this.pos;return new CListSeparatorNode(this.parseQueue)}var oRet;oRet=this.checkExpression(oOperatorRegExp,this.parseOperator);if(oRet)return oRet;oRet=this.checkExpression(oFunctionsRegExp,this.parseFunction);if(oRet)return oRet;if(this.formula.indexOf("LEFT",this.pos)===this.pos){this.pos+="LEFT".length;oRet=new CCellRangeNode(this.parseQueue);oRet.dir=LEFT;return oRet}if(this.formula.indexOf("ABOVE",this.pos)===this.pos){this.pos+="ABOVE".length;oRet=new CCellRangeNode(this.parseQueue); oRet.dir=ABOVE;return oRet}if(this.formula.indexOf("BELOW",this.pos)===this.pos){this.pos+="BELOW".length;oRet=new CCellRangeNode(this.parseQueue);oRet.dir=BELOW;return oRet}if(this.formula.indexOf("RIGHT",this.pos)===this.pos){this.pos+="RIGHT".length;oRet=new CCellRangeNode(this.parseQueue);oRet.dir=RIGHT;return oRet}var oRes=this.checkExpression(oCellReferenceRegExp,this.parseCellRef);if(oRes)return oRes;oRet=this.checkExpression(oConstantRegExp,this.parseNumber);if(oRet)return oRet;oRet=this.checkExpression(oBookmarkCellRefRegExp, this.parseBookmarkCellRef);if(oRet)return oRet;return null};CFormulaParser.prototype.setError=function(Type,Data){this.parseQueue=null;this.error=new CError(Type,Data)};CFormulaParser.prototype.getErrorString=function(startPos,endPos){var nStartPos=startPos;while(nStartPos0);this.setFlag(PARSER_MASK_CELL_NAME,false);this.setFlag(PARSER_MASK_CELL_RANGE,false);this.setFlag(PARSER_MASK_BOOKMARK,true);this.setFlag(PARSER_MASK_BOOKMARK_CELL_REF,false)}else{this.setError(ERROR_TYPE_SYNTAX_ERROR,this.getErrorString(nStartPos,this.pos));return}}else if(oCurToken instanceof CCellRangeNode){if((oCurToken.isDir()||oCurToken.isCellRange())&&!(this.flags&PARSER_MASK_CELL_RANGE)){this.setError(ERROR_TYPE_SYNTAX_ERROR, ":");return}if(oCurToken.isBookmarkCellRange()&&!(this.flags&PARSER_MASK_BOOKMARK_CELL_REF)){this.setError(ERROR_TYPE_SYNTAX_ERROR,":");return}if((oCurToken.isCell()||oCurToken.isBookmark())&&this.checkSingularToken(oLastToken)){if(oLastToken instanceof CPercentageOperatorNode)this.setError(ERROR_TYPE_SYNTAX_ERROR,this.getErrorString(nStartPos,this.pos));else this.setError(ERROR_TYPE_MISSING_OPERATOR,null);return}this.parseQueue.add(oCurToken);if(aFunctionsStack.length===0){oCurToken.calculate(); if(oCurToken.error){this.error=oCurToken.error;return}}else;this.setFlag(PARSER_MASK_NUMBER,true);this.setFlag(PARSER_MASK_UNARY_OPERATOR,false);this.setFlag(PARSER_MASK_LEFT_PAREN,false);this.setFlag(PARSER_MASK_RIGHT_PAREN,true);this.setFlag(PARSER_MASK_BINARY_OPERATOR,oCurToken.isCell()||oCurToken.isBookmark());this.setFlag(PARSER_MASK_FUNCTION,false);this.setFlag(PARSER_MASK_LIST_SEPARATOR,aFunctionsStack.length>0);this.setFlag(PARSER_MASK_CELL_NAME,false);this.setFlag(PARSER_MASK_CELL_RANGE, false);this.setFlag(PARSER_MASK_BOOKMARK,false);this.setFlag(PARSER_MASK_BOOKMARK_CELL_REF,false)}else if(oCurToken.isFunction())if(this.flags&PARSER_MASK_FUNCTION){aStack.push(oCurToken);this.setFlag(PARSER_MASK_RIGHT_PAREN,false);if(oCurToken.maxArgumentsCount<1)this.setFlag(PARSER_MASK_LEFT_PAREN,false);else{this.setFlag(PARSER_MASK_LEFT_PAREN,true);this.setFlag(PARSER_MASK_RIGHT_PAREN,false);this.setFlag(PARSER_MASK_LIST_SEPARATOR,false);this.setFlag(PARSER_MASK_BINARY_OPERATOR,false);this.setFlag(PARSER_MASK_UNARY_OPERATOR, false);this.setFlag(PARSER_MASK_NUMBER,false);this.setFlag(PARSER_MASK_FUNCTION,false);this.setFlag(PARSER_MASK_CELL_NAME,false);this.setFlag(PARSER_MASK_CELL_RANGE,false);this.setFlag(PARSER_MASK_BOOKMARK,false);this.setFlag(PARSER_MASK_BOOKMARK_CELL_REF,false)}}else{this.setError(ERROR_TYPE_SYNTAX_ERROR,this.getErrorString(nStartPos,this.pos));return}else if(oCurToken instanceof CListSeparatorNode)if(!(this.flags&PARSER_MASK_LIST_SEPARATOR)){this.setError(ERROR_TYPE_SYNTAX_ERROR,this.getErrorString(nStartPos, this.pos));return}else{if(aFunctionsStack.length>0){while(aStack.length>0&&!(aStack[aStack.length-1]instanceof CLeftParenOperatorNode)){oToken=aStack.pop();this.parseQueue.add(oToken);oToken.calculate();if(oToken.error){this.error=oToken.error;return}}if(aStack.length===0){this.setError(ERROR_TYPE_SYNTAX_ERROR,this.getErrorString(nStartPos,this.pos));return}aFunctionsStack[aFunctionsStack.length-1].operands.push(this.parseQueue.last());if(aFunctionsStack[aFunctionsStack.length-1].operands.length>= aFunctionsStack[aFunctionsStack.length-1].maxArgumentsCount){this.setError(ERROR_TYPE_SYNTAX_ERROR,this.getErrorString(nStartPos,this.pos));return}}else{this.setError(ERROR_TYPE_SYNTAX_ERROR,this.getErrorString(nStartPos,this.pos));return}this.setFlag(PARSER_MASK_LEFT_PAREN,true);this.setFlag(PARSER_MASK_RIGHT_PAREN,false);this.setFlag(PARSER_MASK_LIST_SEPARATOR,false);this.setFlag(PARSER_MASK_BINARY_OPERATOR,false);this.setFlag(PARSER_MASK_UNARY_OPERATOR,true);this.setFlag(PARSER_MASK_NUMBER,true); this.setFlag(PARSER_MASK_FUNCTION,true);this.setFlag(PARSER_MASK_CELL_NAME,true);this.setFlag(PARSER_MASK_CELL_RANGE,aFunctionsStack.length>0&&aFunctionsStack[aFunctionsStack.length-1].listSupport());this.setFlag(PARSER_MASK_BOOKMARK,true);this.setFlag(PARSER_MASK_BOOKMARK_CELL_REF,aFunctionsStack.length>0&&aFunctionsStack[aFunctionsStack.length-1].listSupport())}else if(oCurToken instanceof CLeftParenOperatorNode){if(this.flags&&PARSER_MASK_LEFT_PAREN){if(oLastToken&&oLastToken.isFunction(oLastToken))aFunctionsStack.push(oLastToken); this.setFlag(PARSER_MASK_LEFT_PAREN,true);this.setFlag(PARSER_MASK_RIGHT_PAREN,true);this.setFlag(PARSER_MASK_LIST_SEPARATOR,false);this.setFlag(PARSER_MASK_BINARY_OPERATOR,false);this.setFlag(PARSER_MASK_UNARY_OPERATOR,true);this.setFlag(PARSER_MASK_NUMBER,true);this.setFlag(PARSER_MASK_FUNCTION,true);this.setFlag(PARSER_MASK_CELL_NAME,true);this.setFlag(PARSER_MASK_CELL_RANGE,aFunctionsStack.length>0&&aFunctionsStack[aFunctionsStack.length-1].listSupport());this.setFlag(PARSER_MASK_BOOKMARK,false); this.setFlag(PARSER_MASK_BOOKMARK_CELL_REF,aFunctionsStack.length>0&&aFunctionsStack[aFunctionsStack.length-1].listSupport())}else{this.setError(ERROR_TYPE_SYNTAX_ERROR,this.getErrorString(nStartPos,this.pos));return}aStack.push(oCurToken)}else if(oCurToken instanceof CRightParenOperatorNode){while(aStack.length>0&&!(aStack[aStack.length-1]instanceof CLeftParenOperatorNode)){oToken=aStack.pop();this.parseQueue.add(oToken);oToken.calculate();if(oToken.error){this.error=oToken.error;return}}if(aStack.length=== 0){this.setError(ERROR_TYPE_SYNTAX_ERROR,this.getErrorString(nStartPos,this.pos));return}aStack.pop();if(aStack[aStack.length-1]&&aStack[aStack.length-1].isFunction()){aFunctionsStack.pop();aStack[aStack.length-1].operands.push(this.parseQueue.last());oLastFunction=aStack[aStack.length-1];if(oLastFunction.operands.length>oLastFunction.maxArgumentsCount){this.setError(ERROR_TYPE_SYNTAX_ERROR,this.getErrorString(nStartPos,this.pos));return}if(oLastFunction.operands.length0);this.setFlag(PARSER_MASK_CELL_NAME,false);this.setFlag(PARSER_MASK_CELL_RANGE,false);this.setFlag(PARSER_MASK_BOOKMARK, false);this.setFlag(PARSER_MASK_BOOKMARK_CELL_REF,false)}else if(oCurToken.isOperator()){if(oCurToken instanceof CUnaryMinusOperatorNode){if(!(this.flags&PARSER_MASK_UNARY_OPERATOR)){this.setError(ERROR_TYPE_SYNTAX_ERROR,this.getErrorString(nStartPos,this.pos));return}this.setFlag(PARSER_MASK_UNARY_OPERATOR,false)}else{if(!(this.flags&PARSER_MASK_BINARY_OPERATOR)){this.setError(ERROR_TYPE_SYNTAX_ERROR,this.getErrorString(nStartPos,this.pos));return}this.setFlag(PARSER_MASK_UNARY_OPERATOR,true)}while(aStack.length> 0&&(!(aStack[aStack.length-1]instanceof CLeftParenOperatorNode)&&aStack[aStack.length-1].precedence>=oCurToken.precedence)){oToken=aStack.pop();this.parseQueue.add(oToken);oToken.calculate();if(oToken.error){this.error=oToken.error;return}}if(oCurToken instanceof CPercentageOperatorNode){this.parseQueue.add(oCurToken);oCurToken.calculate();if(oCurToken.error){this.error=oCurToken.error;return}this.setFlag(PARSER_MASK_NUMBER,true);this.setFlag(PARSER_MASK_UNARY_OPERATOR,false);this.setFlag(PARSER_MASK_LEFT_PAREN, false);this.setFlag(PARSER_MASK_RIGHT_PAREN,true);this.setFlag(PARSER_MASK_BINARY_OPERATOR,true);this.setFlag(PARSER_MASK_FUNCTION,false);this.setFlag(PARSER_MASK_LIST_SEPARATOR,aFunctionsStack.length>0);this.setFlag(PARSER_MASK_CELL_NAME,false);this.setFlag(PARSER_MASK_CELL_RANGE,false);this.setFlag(PARSER_MASK_BOOKMARK,true);this.setFlag(PARSER_MASK_BOOKMARK_CELL_REF,false)}else{this.setFlag(PARSER_MASK_NUMBER,true);this.setFlag(PARSER_MASK_LEFT_PAREN,true);this.setFlag(PARSER_MASK_RIGHT_PAREN, false);this.setFlag(PARSER_MASK_BINARY_OPERATOR,false);this.setFlag(PARSER_MASK_FUNCTION,true);this.setFlag(PARSER_MASK_LIST_SEPARATOR,false);this.setFlag(PARSER_MASK_CELL_NAME,true);this.setFlag(PARSER_MASK_CELL_RANGE,false);this.setFlag(PARSER_MASK_BOOKMARK,true);this.setFlag(PARSER_MASK_BOOKMARK_CELL_REF,false);aStack.push(oCurToken)}}if(!(oCurToken instanceof CLineSeparatorOperatorNode))oLastToken=oCurToken;nStartPos=this.pos}if(this.pos0){oCurToken=aStack.pop();if(oCurToken instanceof CLeftParenOperatorNode){this.setError(ERROR_TYPE_UNEXPECTED_END,null);return}else if(oCurToken instanceof CRightParenOperatorNode){this.setError(ERROR_TYPE_SYNTAX_ERROR,"");return}this.parseQueue.add(oCurToken);oCurToken.calculate();if(oCurToken.error){this.error=oCurToken.error;return}}};window["AscCommonWord"]=window["AscCommonWord"]||{};window["AscCommonWord"].CFormulaParser= CFormulaParser;function CTextParser(sListSeparator,sDigitSeparator){CFormulaParser.call(this,sListSeparator,sDigitSeparator);this.clean=true}CTextParser.prototype=Object.create(CFormulaParser.prototype);CTextParser.prototype.checkSingularToken=function(oToken){return false};CTextParser.prototype.parseCurrent=function(){while(this.formula[this.pos]===" "){++this.pos;this.setFlag(PARSER_MASK_CLEAN,false)}if(this.pos>=this.formula.length)return null;if(this.formula[this.pos]==="("){++this.pos;this.setFlag(PARSER_MASK_CLEAN, false);return new CLeftParenOperatorNode(this.parseQueue)}if(this.formula[this.pos]===")"){++this.pos;this.setFlag(PARSER_MASK_CLEAN,false);return new CRightParenOperatorNode(this.parseQueue)}if(this.formula[this.pos]==="\n"||this.formula[this.pos]==="\t"||this.formula[this.pos]==="\r"){++this.pos;this.setFlag(PARSER_MASK_CLEAN,false);return new CLineSeparatorOperatorNode(this.parseQueue)}var oRet;oRet=this.checkExpression(oOperatorRegExp,this.parseOperator);if(oRet){if(!(oRet instanceof CUnaryMinusOperatorNode))this.setFlag(PARSER_MASK_CLEAN, false);return oRet}oRet=this.checkExpression(oBookmarkCellRefRegExp,this.parseBookmarkCellRef);if(oRet){this.setFlag(PARSER_MASK_CLEAN,false);return new CLineSeparatorOperatorNode(this.parseQueue)}oRet=this.checkExpression(oConstantRegExp,this.parseNumber);var oRes;if(oRet)return oRet;return null}})();"use strict";function CParaRevisionMove(isStart,isFrom,sName,oInfo){CParagraphContentBase.call(this);this.Id=AscCommon.g_oIdCounter.Get_NewId();this.Start=isStart;this.From=isFrom;this.Name=sName;this.Type= para_RevisionMove;this.ReviewInfo=null;if(oInfo)this.ReviewInfo=oInfo;else{this.ReviewInfo=new CReviewInfo;this.ReviewInfo.Update()}g_oTableId.Add(this,this.Id)}CParaRevisionMove.prototype=Object.create(CParagraphContentBase.prototype);CParaRevisionMove.prototype.constructor=CParaRevisionMove;CParaRevisionMove.prototype.Get_Id=function(){return this.Id};CParaRevisionMove.prototype.GetId=function(){return this.Get_Id()};CParaRevisionMove.prototype.Copy=function(Selected){return new CParaRevisionMove(this.Start, this.From,this.Name)};CParaRevisionMove.prototype.Refresh_RecalcData=function(){};CParaRevisionMove.prototype.Write_ToBinary2=function(oWriter){oWriter.WriteLong(AscDFH.historyitem_type_ParaRevisionMove);oWriter.WriteString2(""+this.Id);oWriter.WriteBool(this.Start);oWriter.WriteBool(this.From);oWriter.WriteString2(""+this.Name);this.ReviewInfo.WriteToBinary(oWriter)};CParaRevisionMove.prototype.Read_FromBinary2=function(oReader){this.Id=oReader.GetString2();this.Start=oReader.GetBool();this.From= oReader.GetBool();this.Name=oReader.GetString2();this.ReviewInfo=new CReviewInfo;this.ReviewInfo.ReadFromBinary(oReader)};CParaRevisionMove.prototype.SetParagraph=function(oParagraph){if(!editor||!editor.WordControl||!editor.WordControl.m_oLogicDocument||!editor.WordControl.m_oLogicDocument.GetTrackRevisionsManager())return;var oManager=editor.WordControl.m_oLogicDocument.GetTrackRevisionsManager();if(oParagraph){this.Paragraph=oParagraph;oManager.RegisterMoveMark(this)}else{this.Paragraph=null;oManager.UnregisterMoveMark(this)}}; CParaRevisionMove.prototype.GetMarkId=function(){return this.Name};CParaRevisionMove.prototype.IsFrom=function(){return this.From};CParaRevisionMove.prototype.IsStart=function(){return this.Start};CParaRevisionMove.prototype.CheckRevisionsChanges=function(oChecker,oContentPos,nDepth){oChecker.FlushAddRemoveChange();oChecker.FlushTextPrChange();oChecker.AddReviewMoveMark(this,oContentPos.Copy())};CParaRevisionMove.prototype.GetReviewInfo=function(){return this.ReviewInfo};CParaRevisionMove.prototype.PreDelete= function(){var oParagraph=this.GetParagraph();if(oParagraph&&oParagraph.LogicDocument)oParagraph.LogicDocument.RemoveTrackMoveMarks(this.GetMarkId())};CParaRevisionMove.prototype.IsUseInDocument=function(){var oParagraph=this.GetParagraph();if(!oParagraph||!this.Paragraph.Get_PosByElement(this))return false;return oParagraph.Is_UseInDocument()};CParaRevisionMove.prototype.GetReviewChange=function(){var oParagraph=this.GetParagraph();var oLogicDocument=oParagraph?oParagraph.LogicDocument:null;if(oLogicDocument){var oTrackManager= oLogicDocument.GetTrackRevisionsManager();return oTrackManager.GetMoveMarkChange(this.GetMarkId(),this.IsFrom(),this.IsStart())}return null};CParaRevisionMove.prototype.Is_Empty=function(){return false};CParaRevisionMove.prototype.RemoveThisMarkFromDocument=function(){var oParagraph=this.GetParagraph();if(oParagraph)oParagraph.RemoveElement(this)};CParaRevisionMove.prototype.GetSelectedElementsInfo=function(oInfo){if(oInfo&&oInfo.IsCheckAllSelection())oInfo.RegisterTrackMoveMark(this)};function CRunRevisionMove(isStart, isFrom,sName,oInfo){CRunElementBase.call(this);this.Start=isStart;this.From=isFrom;this.Name=sName;this.Run=null;this.ReviewInfo=null;if(oInfo)this.ReviewInfo=oInfo;else{this.ReviewInfo=new CReviewInfo;this.ReviewInfo.Update()}}CRunRevisionMove.prototype=Object.create(CRunElementBase.prototype);CRunRevisionMove.prototype.constructor=CRunRevisionMove;CRunRevisionMove.prototype.Type=para_RevisionMove;CRunRevisionMove.prototype.Copy=function(){return new CRunRevisionMove(this.Start,this.From,this.Name)}; CRunRevisionMove.prototype.Write_ToBinary=function(oWriter){oWriter.WriteLong(this.Type);oWriter.WriteBool(this.Start);oWriter.WriteBool(this.From);oWriter.WriteString2(""+this.Name);this.ReviewInfo.WriteToBinary(oWriter)};CRunRevisionMove.prototype.Read_FromBinary=function(oReader){this.Start=oReader.GetBool();this.From=oReader.GetBool();this.Name=oReader.GetString2();this.ReviewInfo=new CReviewInfo;this.ReviewInfo.ReadFromBinary(oReader)};CRunRevisionMove.prototype.SetParent=function(oParent){if(!editor|| !editor.WordControl||!editor.WordControl.m_oLogicDocument||!editor.WordControl.m_oLogicDocument.GetTrackRevisionsManager())return;var oManager=editor.WordControl.m_oLogicDocument.GetTrackRevisionsManager();if(oParent){this.Run=oParent;oManager.RegisterMoveMark(this)}else{this.Run=null;oManager.UnregisterMoveMark(this)}};CRunRevisionMove.prototype.GetMarkId=function(){return this.Name};CRunRevisionMove.prototype.IsFrom=function(){return this.From};CRunRevisionMove.prototype.IsStart=function(){return this.Start}; CRunRevisionMove.prototype.GetRun=function(){return this.Run};CRunRevisionMove.prototype.GetReviewInfo=function(){return this.ReviewInfo};CRunRevisionMove.prototype.PreDelete=function(){var oRun=this.GetRun();var oParagraph=oRun?oRun.GetParagraph():null;var oLogicDocument=oParagraph?oParagraph.LogicDocument:null;if(oLogicDocument)oLogicDocument.RemoveTrackMoveMarks(this.GetMarkId())};CRunRevisionMove.prototype.IsUseInDocument=function(){var oRun=this.GetRun();return oRun&&-1!==oRun.GetElementPosition(this)&& oRun.Is_UseInDocument()};CRunRevisionMove.prototype.GetReviewChange=function(){var oRun=this.GetRun();var oParagraph=oRun?oRun.GetParagraph():null;var oLogicDocument=oParagraph?oParagraph.LogicDocument:null;if(oLogicDocument){var oTrackManager=oLogicDocument.GetTrackRevisionsManager();return oTrackManager.GetMoveMarkChange(this.GetMarkId(),this.IsFrom(),this.IsStart())}return null};CRunRevisionMove.prototype.RemoveThisMarkFromDocument=function(){var oRun=this.GetRun();if(oRun)oRun.RemoveElement(this)}; window["AscCommon"]=window["AscCommon"]||{};window["AscCommon"].CParaRevisionMove=CParaRevisionMove;window["AscCommon"].CRunRevisionMove=CRunRevisionMove;"use strict";var History=AscCommon.History;function ParaHyperlink(){CParagraphContentWithParagraphLikeContent.call(this);this.Id=AscCommon.g_oIdCounter.Get_NewId();this.Type=para_Hyperlink;this.Value="";this.Visited=false;this.ToolTip="";this.Anchor="";AscCommon.g_oTableId.Add(this,this.Id)}ParaHyperlink.prototype=Object.create(CParagraphContentWithParagraphLikeContent.prototype); ParaHyperlink.prototype.constructor=ParaHyperlink;ParaHyperlink.prototype.Get_Id=function(){return this.Id};ParaHyperlink.prototype.Get_FirstTextPr2=function(){for(var i=0;i0){var CurPos=this.State.ContentPos;var CurItem=this.Content[CurPos];var CurContentPos=new CParagraphContentPos;CurItem.Get_ParaContentPos(false,false,CurContentPos);var NewItem=CurItem.Split(CurContentPos,0);for(var Index=0;Index0){var CurPos=this.State.ContentPos;var CurItem=this.Content[CurPos];var CurContentPos=new CParagraphContentPos;CurItem.Get_ParaContentPos(false,false,CurContentPos);var NewItem=CurItem.Split(CurContentPos,0);for(var Index=0;Index.001&&(true===PDSH.DrawMMFields||fieldtype_FORMTEXT===this.Get_FieldType()))PDSH.MMFields.Add(Y0,Y1,X0,X1,0,0,0,0)};ParaField.prototype.Is_UseInDocument=function(){return this.Paragraph&&true===this.Paragraph.Is_UseInDocument()&&true===this.Is_UseInParagraph()?true:false};ParaField.prototype.Is_UseInParagraph=function(){if(!this.Paragraph)return false;var ContentPos=this.Paragraph.Get_PosByElement(this);if(!ContentPos)return false;return true};ParaField.prototype.Get_LeftPos= function(SearchPos,ContentPos,Depth,UseContentPos){if(false===UseContentPos&&this.Content.length>0){var CurPos=this.Content.length-1;this.Content[CurPos].Get_EndPos(false,SearchPos.Pos,Depth+1);SearchPos.Pos.Update(CurPos,Depth);SearchPos.Found=true;return true}CParagraphContentWithParagraphLikeContent.prototype.Get_LeftPos.call(this,SearchPos,ContentPos,Depth,UseContentPos)};ParaField.prototype.Get_RightPos=function(SearchPos,ContentPos,Depth,UseContentPos,StepEnd){if(false===UseContentPos&&this.Content.length> 0){this.Content[0].Get_StartPos(SearchPos.Pos,Depth+1);SearchPos.Pos.Update(0,Depth);SearchPos.Found=true;return true}CParagraphContentWithParagraphLikeContent.prototype.Get_RightPos.call(this,SearchPos,ContentPos,Depth,UseContentPos,StepEnd)};ParaField.prototype.Remove=function(nDirection,bOnAddText){CParagraphContentWithParagraphLikeContent.prototype.Remove.call(this,nDirection,bOnAddText);if(this.Is_Empty()&&!bOnAddText&&fieldtype_FORMTEXT===this.Get_FieldType()&&this.Paragraph&&this.Paragraph.LogicDocument&& true===this.Paragraph.LogicDocument.IsFillingFormMode()){var sDefaultText=this.FormFieldDefaultText==""?" ":this.FormFieldDefaultText;this.SetValue(sDefaultText)}};ParaField.prototype.Shift_Range=function(Dx,Dy,_CurLine,_CurRange,_CurPage){CParagraphContentWithParagraphLikeContent.prototype.Shift_Range.call(this,Dx,Dy,_CurLine,_CurRange,_CurPage);var CurLine=_CurLine-this.StartLine;var CurRange=0===CurLine?_CurRange-this.StartRange:_CurRange;var oRangeBounds=this.Bounds[CurLine<<16&4294901760| CurRange&65535];if(oRangeBounds){oRangeBounds.X0+=Dx;oRangeBounds.X1+=Dx;oRangeBounds.Y0+=Dy;oRangeBounds.Y1+=Dy}};ParaField.prototype.Get_LeftPos=function(SearchPos,ContentPos,Depth,UseContentPos){var bResult=CParagraphContentWithParagraphLikeContent.prototype.Get_LeftPos.call(this,SearchPos,ContentPos,Depth,UseContentPos);if(true!==bResult&&this.Paragraph&&this.Paragraph.LogicDocument&&true===this.Paragraph.LogicDocument.IsFillingFormMode()){this.Get_StartPos(SearchPos.Pos,Depth);SearchPos.Found= true;return true}return bResult};ParaField.prototype.Get_RightPos=function(SearchPos,ContentPos,Depth,UseContentPos,StepEnd){var bResult=CParagraphContentWithParagraphLikeContent.prototype.Get_RightPos.call(this,SearchPos,ContentPos,Depth,UseContentPos,StepEnd);if(true!==bResult&&this.Paragraph&&this.Paragraph.LogicDocument&&true===this.Paragraph.LogicDocument.IsFillingFormMode()){this.Get_EndPos(false,SearchPos.Pos,Depth);SearchPos.Found=true;return true}return bResult};ParaField.prototype.Get_WordStartPos= function(SearchPos,ContentPos,Depth,UseContentPos){CParagraphContentWithParagraphLikeContent.prototype.Get_WordStartPos.call(this,SearchPos,ContentPos,Depth,UseContentPos);if(true!==SearchPos.Found&&this.Paragraph&&this.Paragraph.LogicDocument&&true===this.Paragraph.LogicDocument.IsFillingFormMode()){this.Get_StartPos(SearchPos.Pos,Depth);SearchPos.UpdatePos=true;SearchPos.Found=true}};ParaField.prototype.Get_WordEndPos=function(SearchPos,ContentPos,Depth,UseContentPos,StepEnd){CParagraphContentWithParagraphLikeContent.prototype.Get_WordEndPos.call(this, SearchPos,ContentPos,Depth,UseContentPos,StepEnd);if(true!==SearchPos.Found&&this.Paragraph&&this.Paragraph.LogicDocument&&true===this.Paragraph.LogicDocument.IsFillingFormMode()){this.Get_EndPos(false,SearchPos.Pos,Depth);SearchPos.UpdatePos=true;SearchPos.Found=true}};ParaField.prototype.GetAllFields=function(isUseSelection,arrFields){arrFields.push(this);return CParagraphContentWithParagraphLikeContent.prototype.GetAllFields.apply(this,arguments)};ParaField.prototype.GetAllSeqFieldsByType=function(sType, aFields){if(this.FieldType===fieldtype_SEQ)if(this.Arguments[0]===sType)aFields.push(this)};ParaField.prototype.Get_Argument=function(Index){return this.Arguments[Index]};ParaField.prototype.Get_FieldType=function(){return this.FieldType};ParaField.prototype.Map_MailMerge=function(_Value){var Value=_Value;if(undefined===Value||null===Value)Value="";History.TurnOff();var oRun=this.private_GetMappedRun(Value);this.Content=[];this.Content[0]=oRun;this.MoveCursorToStartPos();History.TurnOn()};ParaField.prototype.Restore_StandardTemplate= function(){this.Restore_Template();if(fieldtype_MERGEFIELD===this.FieldType&&true===AscCommon.CollaborativeEditing.Is_SingleUser()&&1===this.Arguments.length){var oRun=this.private_GetMappedRun("\u00ab"+this.Arguments[0]+"\u00bb");this.Remove_FromContent(0,this.Content.length);this.Add_ToContent(0,oRun);this.MoveCursorToStartPos();this.TemplateContent=this.Content}};ParaField.prototype.Restore_Template=function(){this.Content=this.TemplateContent;this.MoveCursorToStartPos()};ParaField.prototype.Is_NeedRestoreTemplate= function(){if(1!==this.TemplateContent.length)return true;var oRun=this.TemplateContent[0];if(fieldtype_MERGEFIELD===this.FieldType){var sStandardText="\u00ab"+this.Arguments[0]+"\u00bb";var oRunText=new CParagraphGetText;oRun.Get_Text(oRunText);if(sStandardText===oRunText.Text)return false;return true}return false};ParaField.prototype.Replace_MailMerge=function(_Value){var Value=_Value;if(undefined===Value||null===Value)Value="";var Paragraph=this.Paragraph;if(!Paragraph)return false;var oRun=this.private_GetMappedRun(Value); var ParaContentPos=Paragraph.Get_PosByElement(this);if(null===ParaContentPos)return false;var Depth=ParaContentPos.Get_Depth();var FieldPos=ParaContentPos.Get(Depth);if(Depth<0)return false;ParaContentPos.Decrease_Depth(1);var FieldContainer=Paragraph.Get_ElementByPos(ParaContentPos);if(!FieldContainer||!FieldContainer.Content||FieldContainer.Content[FieldPos]!==this)return false;FieldContainer.Remove_FromContent(FieldPos,1);FieldContainer.Add_ToContent(FieldPos,oRun);return true};ParaField.prototype.private_GetMappedRun= function(sValue){return this.CreateRunWithText(sValue)};ParaField.prototype.SetFormFieldName=function(sName){History.Add(new CChangesParaFieldFormFieldName(this,this.FormFieldName,sName));this.FormFieldName=sName};ParaField.prototype.GetFormFieldName=function(){return this.FormFieldName};ParaField.prototype.SetFormFieldDefaultText=function(sText){History.Add(new CChangesParaFieldFormFieldDefaultText(this,this.FormFieldDefaultText,sText));this.FormFieldDefaultText=sText};ParaField.prototype.GetValue= function(){var oText=new CParagraphGetText;oText.SetBreakOnNonText(false);oText.SetParaEndToSpace(true);this.Get_Text(oText);return oText.Text};ParaField.prototype.SetValue=function(sValue){this.ReplaceAllWithText(sValue)};ParaField.prototype.IsFillingForm=function(){if(fieldtype_FORMTEXT===this.Get_FieldType())return true;return false};ParaField.prototype.FindNextFillingForm=function(isNext,isCurrent,isStart){if(!this.IsFillingForm())return CParagraphContentWithParagraphLikeContent.prototype.FindNextFillingForm.apply(this, arguments);if(isCurrent&&true===this.IsSelectedAll()){if(isNext)return CParagraphContentWithParagraphLikeContent.prototype.FindNextFillingForm.apply(this,arguments);return null}if(!isCurrent&&isNext)return this;var oRes=CParagraphContentWithParagraphLikeContent.prototype.FindNextFillingForm.apply(this,arguments);if(!oRes&&!isNext)return this;return null};ParaField.prototype.Update=function(isCreateHistoryPoint,isRecalculate){if(!this.Paragraph&&!this.Paragraph.Parent)return;var sReplaceString=null; if(this.FieldType===fieldtype_SEQ){var oInstruction=new CFieldInstructionSEQ;oInstruction.ComplexField=this;oInstruction.ParentContent=this.Paragraph.Parent;oInstruction.Id=this.Arguments[0];sReplaceString=oInstruction.GetText()}else if(this.FieldType===fieldtype_STYLEREF){var oInstruction=new CFieldInstructionSTYLEREF;oInstruction.ComplexField=this;oInstruction.ParentContent=this.Paragraph.Parent;oInstruction.ParentParagraph=this.Paragraph;oInstruction.StyleName=this.Arguments[0];sReplaceString= oInstruction.GetText()}if(sReplaceString){var oRun=this.private_GetMappedRun(sReplaceString);this.Remove_FromContent(0,this.Content.length);this.Add_ToContent(0,oRun)}};ParaField.prototype.Write_ToBinary2=function(Writer){Writer.WriteLong(AscDFH.historyitem_type_Field);Writer.WriteString2(this.Id);Writer.WriteLong(this.FieldType);var ArgsCount=this.Arguments.length;Writer.WriteLong(ArgsCount);for(var Index=0;IndexEndPos){StartPos=this.State.Selection.EndPos;EndPos=this.State.Selection.StartPos}}else if(true===Selected&&true!==this.State.Selection.Use)EndPos=-1;var CurPos,AddedPos,Item;if(oPr&&oPr.Comparison){var aCopyContent=[];for(CurPos=StartPos;CurPos0)return false;else return true;else{for(var nCurPos=0;nCurPos0)return true;return false};ParaRun.prototype.IsStartFromNewLine=function(){if(this.protected_GetLinesCount()<2||0!==this.protected_GetRangeStartPos(1,0))return false;return true};ParaRun.prototype.Add=function(oItem){var oRun=this.CheckRunBeforeAdd(oItem);if(!oRun)oRun=this;oRun.private_AddItemToRun(oRun.State.ContentPos, oItem);var nFlags=0;if(para_Run===oRun.Type&&(nFlags=oItem.GetAutoCorrectFlags()))oRun.ProcessAutoCorrect(oRun.State.ContentPos-1,nFlags)};ParaRun.prototype.private_CheckTrackRevisionsBeforeAdd=function(oNewRun){var TrackRevisions=false;if(this.Paragraph&&this.Paragraph.LogicDocument)TrackRevisions=this.Paragraph.LogicDocument.IsTrackRevisions();var ReviewType=this.GetReviewType();if(true===TrackRevisions&&(reviewtype_Add!==ReviewType||true!==this.ReviewInfo.IsCurrentUser())||false===TrackRevisions&& reviewtype_Common!==ReviewType){var DstReviewType=true===TrackRevisions?reviewtype_Add:reviewtype_Common;if(oNewRun){oNewRun.SetReviewType(DstReviewType);return oNewRun}var Parent=this.Get_Parent();if(null===Parent)return null;var RunPos=this.private_GetPosInParent(Parent);if(-1===RunPos)return null;var CurPos=this.State.ContentPos;if(0===CurPos&&RunPos>0){var PrevElement=Parent.Content[RunPos-1];if(para_Run===PrevElement.Type&&DstReviewType===PrevElement.GetReviewType()&&true===this.Pr.Is_Equal(PrevElement.Pr)&& PrevElement.ReviewInfo&&true===PrevElement.ReviewInfo.IsCurrentUser()){PrevElement.State.ContentPos=PrevElement.Content.length;return PrevElement}}if(this.Content.length===CurPos&&(RunPos0&&this.Content[nCurPos-1]&&(para_FootnoteRef===this.Content[nCurPos-1].Type||para_FootnoteReference===this.Content[nCurPos- 1].Type)||nCurPos0&&this.Content[nCurPos-1]&&(para_EndnoteRef===this.Content[nCurPos-1].Type||para_EndnoteReference===this.Content[nCurPos-1].Type)||nCurPos0&¶_Drawing===this.Content[CurPos-1].Type&&false===this.Content[CurPos-1].Is_Inline())CurPos--;if(CurPos<=0)return false;this.State.ContentPos--}else{if(CurPos>= this.Content.length||para_End===this.Content[CurPos].Type)return false;this.State.ContentPos++}this.Make_ThisElementCurrent()}else;else if(true===Selection.Use){var StartPos=Selection.StartPos;var EndPos=Selection.EndPos;if(StartPos>EndPos){StartPos=Selection.EndPos;EndPos=Selection.StartPos}var Parent=this.Get_Parent();var RunPos=this.private_GetPosInParent(Parent);if(-1!==RunPos){var DeletedRun=null;if(StartPos<=0&&EndPos>=this.Content.length)DeletedRun=this;else if(StartPos<=0){this.Split2(EndPos, Parent,RunPos);DeletedRun=this}else if(EndPos>=this.Content.length)DeletedRun=this.Split2(StartPos,Parent,RunPos);else{this.Split2(EndPos,Parent,RunPos);DeletedRun=this.Split2(StartPos,Parent,RunPos)}DeletedRun.SetReviewType(reviewtype_Remove,true)}}else{var Parent=this.Get_Parent();var RunPos=this.private_GetPosInParent(Parent);var CurPos=this.State.ContentPos;if(Direction<0){while(CurPos>0&¶_Drawing===this.Content[CurPos-1].Type&&false===this.Content[CurPos-1].Is_Inline())CurPos--;if(CurPos<= 0)return false;if(para_Drawing==this.Content[CurPos-1].Type&&true===this.Content[CurPos-1].Is_Inline())return this.Paragraph.Parent.Select_DrawingObject(this.Content[CurPos-1].Get_Id());if(1===CurPos&&1===this.Content.length){this.SetReviewType(reviewtype_Remove,true);this.State.ContentPos=CurPos-1;this.Make_ThisElementCurrent();return true}else if(1===CurPos&&Parent&&RunPos>0){var PrevElement=Parent.Content[RunPos-1];if(para_Run===PrevElement.Type&&reviewtype_Remove===PrevElement.GetReviewType()&& true===this.Pr.Is_Equal(PrevElement.Pr)){var Item=this.Content[CurPos-1];this.Remove_FromContent(CurPos-1,1,true);PrevElement.Add_ToContent(PrevElement.Content.length,Item);PrevElement.State.ContentPos=PrevElement.Content.length-1;PrevElement.Make_ThisElementCurrent();return true}}else if(CurPos===this.Content.length&&Parent&&RunPos=this.Content.length||para_End===this.Content[CurPos].Type)return false;if(para_Drawing==this.Content[CurPos].Type&&true=== this.Content[CurPos].Is_Inline())return this.Paragraph.Parent.Select_DrawingObject(this.Content[CurPos].Get_Id());if(CurPos===this.Content.length-1&&0===CurPos){this.SetReviewType(reviewtype_Remove,true);this.State.ContentPos=1;this.Make_ThisElementCurrent();return true}else if(0===CurPos&&Parent&&RunPos>0){var PrevElement=Parent.Content[RunPos-1];if(para_Run===PrevElement.Type&&reviewtype_Remove===PrevElement.GetReviewType()&&true===this.Pr.Is_Equal(PrevElement.Pr)){var Item=this.Content[CurPos]; this.Remove_FromContent(CurPos,1,true);PrevElement.Add_ToContent(PrevElement.Content.length,Item);this.State.ContentPos=CurPos;this.Make_ThisElementCurrent();return true}}else if(CurPos===this.Content.length-1&&Parent&&RunPosEndPos){var Temp=StartPos;StartPos=EndPos;EndPos=Temp}if(true===this.Selection_CheckParaEnd())for(var CurPos=EndPos-1;CurPos>= StartPos;CurPos--){if(para_End!==this.Content[CurPos].Type)this.Remove_FromContent(CurPos,1,true)}else this.Remove_FromContent(StartPos,EndPos-StartPos,true);this.RemoveSelection();this.State.ContentPos=StartPos}else{var CurPos=this.State.ContentPos;if(Direction<0){while(CurPos>0&¶_Drawing===this.Content[CurPos-1].Type&&false===this.Content[CurPos-1].Is_Inline())CurPos--;if(CurPos<=0)return false;if(para_Drawing==this.Content[CurPos-1].Type&&true===this.Content[CurPos-1].Is_Inline())return this.Paragraph.Parent.Select_DrawingObject(this.Content[CurPos- 1].Get_Id());else if(para_FieldChar===this.Content[CurPos-1].Type){var oComplexField=this.Content[CurPos-1].GetComplexField();if(oComplexField){oComplexField.SelectField();var oLogicDocument=this.Paragraph&&this.Paragraph.bFromDocument?this.Paragraph.LogicDocument:null;if(oLogicDocument){oLogicDocument.Document_UpdateInterfaceState();oLogicDocument.Document_UpdateSelectionState()}}return true}var oStyles=this.Paragraph&&this.Paragraph.bFromDocument?this.Paragraph.LogicDocument.GetStyles():null;if(oStyles&& 1===this.Content.length&&(para_FootnoteReference===this.Content[0].Type&&this.GetRStyle()===oStyles.GetDefaultFootnoteReference()||para_EndnoteReference===this.Content[0].Type&&this.GetRStyle()===oStyles.GetDefaultEndnoteReference()))this.SetRStyle(undefined);this.RemoveFromContent(CurPos-1,1,true);this.State.ContentPos=CurPos-1}else{while(CurPos=this.Content.length||para_End=== this.Content[CurPos].Type)return false;if(para_Drawing==this.Content[CurPos].Type&&true===this.Content[CurPos].Is_Inline())return this.Paragraph.Parent.Select_DrawingObject(this.Content[CurPos].Get_Id());else if(para_FieldChar===this.Content[CurPos].Type){var oComplexField=this.Content[CurPos].GetComplexField();if(oComplexField){oComplexField.SelectField();var oLogicDocument=this.Paragraph&&this.Paragraph.bFromDocument?this.Paragraph.LogicDocument:null;if(oLogicDocument){oLogicDocument.Document_UpdateInterfaceState(); oLogicDocument.Document_UpdateSelectionState()}}return true}var oStyles=this.Paragraph&&this.Paragraph.bFromDocument?this.Paragraph.LogicDocument.GetStyles():null;if(oStyles&&1===this.Content.length&&(para_FootnoteReference===this.Content[0].Type&&this.GetRStyle()===oStyles.GetDefaultFootnoteReference()||para_EndnoteReference===this.Content[0].Type&&this.GetRStyle()===oStyles.GetDefaultEndnoteReference()))this.SetRStyle(undefined);this.RemoveFromContent(CurPos,1,true);this.State.ContentPos=CurPos}}return true}; ParaRun.prototype.Remove_ParaEnd=function(){var Pos=-1;var ContentLen=this.Content.length;for(var CurPos=0;CurPos=Pos)this.State.ContentPos++;if(true===this.State.Selection.Use){if(this.State.Selection.StartPos>=Pos)this.State.Selection.StartPos++;if(this.State.Selection.EndPos>= Pos)this.State.Selection.EndPos++}var LinesCount=this.protected_GetLinesCount();for(var CurLine=0;CurLinePos)StartPos++;if(EndPos>Pos)EndPos++;this.protected_FillRange(CurLine,CurRange,StartPos,EndPos)}if(Pos===this.Content.length-1&&LinesCount- 1===CurLine)this.protected_FillRangeEndPos(CurLine,RangesCount-1,this.protected_GetRangeEndPos(CurLine,RangesCount-1)+1)}};ParaRun.prototype.private_UpdatePositionsOnRemove=function(Pos,Count){if(this.State.ContentPos>Pos+Count)this.State.ContentPos-=Count;else if(this.State.ContentPos>Pos)this.State.ContentPos=Pos;if(true===this.State.Selection.Use)if(this.State.Selection.StartPos<=this.State.Selection.EndPos){if(this.State.Selection.StartPos>Pos+Count)this.State.Selection.StartPos-=Count;else if(this.State.Selection.StartPos> Pos)this.State.Selection.StartPos=Pos;if(this.State.Selection.EndPos>=Pos+Count)this.State.Selection.EndPos-=Count;else if(this.State.Selection.EndPos>Pos)this.State.Selection.EndPos=Math.max(0,Pos-1)}else{if(this.State.Selection.StartPos>=Pos+Count)this.State.Selection.StartPos-=Count;else if(this.State.Selection.StartPos>Pos)this.State.Selection.StartPos=Math.max(0,Pos-1);if(this.State.Selection.EndPos>Pos+Count)this.State.Selection.EndPos-=Count;else if(this.State.Selection.EndPos>Pos)this.State.Selection.EndPos= Pos}var LinesCount=this.protected_GetLinesCount();for(var CurLine=0;CurLinePos+Count)StartPos-=Count;else if(StartPos>Pos)StartPos=Math.max(0,Pos);if(EndPos>=Pos+Count)EndPos-=Count;else if(EndPos>=Pos)EndPos=Math.max(0,Pos);this.protected_FillRange(CurLine, CurRange,StartPos,EndPos)}}};ParaRun.prototype.private_UpdateCompositeInputPositionsOnAdd=function(Pos){if(null!==this.CompositeInput)if(Pos<=this.CompositeInput.Pos)this.CompositeInput.Pos++;else if(Pos=this.Content.length){Pos=this.Content.length;this.Content.push(Item)}else this.Content.splice(Pos, 0,Item);if(true===UpdatePosition)this.private_UpdatePositionsOnAdd(Pos);var NearPosLen=this.NearPosArray.length;for(var Index=0;Index=Pos)ContentPos.Data[Depth]++}var SearchMarksCount=this.SearchMarks.length;for(var Index=0;IndexPos||ContentPos.Data[Depth]===Pos&&true===Mark.Start)ContentPos.Data[Depth]++}var SpellingMarksCount=this.SpellingMarks.length;for(var Index=0;Index=Pos)ContentPos.Data[Depth]++}this.private_UpdateSpellChecking();this.private_UpdateDocumentOutline(); this.private_UpdateTrackRevisionOnChangeContent(true);this.CollaborativeMarks.Update_OnAdd(Pos);this.RecalcInfo.OnAdd(Pos)};ParaRun.prototype.Remove_FromContent=function(Pos,Count,UpdatePosition){if(this.GetTextForm()&&this.GetTextForm().IsComb())this.RecalcInfo.Measure=true;this.CheckParentFormKey();for(var nIndex=Pos,nCount=Math.min(Pos+Count,this.Content.length);nIndexPos+Count)ContentPos.Data[Depth]-=Count;else if(ContentPos.Data[Depth]>Pos)ContentPos.Data[Depth]= Math.max(0,Pos)}var SearchMarksCount=this.SearchMarks.length;for(var Index=0;IndexPos+Count)ContentPos.Data[Depth]-=Count;else if(ContentPos.Data[Depth]>Pos)ContentPos.Data[Depth]=Math.max(0,Pos)}var SpellingMarksCount=this.SpellingMarks.length;for(var Index=0;IndexPos+Count)ContentPos.Data[Depth]-=Count;else if(ContentPos.Data[Depth]>Pos)ContentPos.Data[Depth]=Math.max(0,Pos)}this.private_UpdateSpellChecking();this.private_UpdateDocumentOutline();this.private_UpdateTrackRevisionOnChangeContent(true);this.CollaborativeMarks.Update_OnRemove(Pos,Count);this.RecalcInfo.OnRemove(Pos,Count)};ParaRun.prototype.ConcatToContent=function(arrNewItems){this.CheckParentFormKey(); for(var nIndex=0,nCount=arrNewItems.length;nIndex0){var nMaxLetters=nMax-nPos;var arrLetters=[],nLettersCount=0;for(var oIterator=sString.getUnicodeIterator();oIterator.check();oIterator.next()){if(nLettersCount>=nMaxLetters)break;var nCharCode= oIterator.value();if(9===nCharCode)continue;else if(10===nCharCode)continue;else if(13===nCharCode)continue;else if(AscCommon.IsSpace(nCharCode)){nLettersCount++;arrLetters.push(new ParaSpace(nCharCode))}else{nLettersCount++;arrLetters.push(new ParaText(nCharCode))}}for(var nIndex=0;nIndexnMax)this.RemoveFromContent(nMax,this.Content.length-nMax,true)}else for(var oIterator=sString.getUnicodeIterator();oIterator.check();oIterator.next()){var nCharCode= oIterator.value();if(9===nCharCode)this.AddToContent(nCharPos++,new ParaTab,true);else if(10===nCharCode)this.AddToContent(nCharPos++,new ParaNewLine(break_Line),true);else if(13===nCharCode)continue;else if(AscCommon.IsSpace(nCharCode))this.AddToContent(nCharPos++,new ParaSpace(nCharCode),true);else this.AddToContent(nCharPos++,new ParaText(nCharCode),true)}};ParaRun.prototype.AddInstrText=function(sString,nPos){var nCharPos=undefined!==nPos&&null!==nPos&&-1!==nPos?nPos:this.Content.length;for(var oIterator= sString.getUnicodeIterator();oIterator.check();oIterator.next())this.AddToContent(nCharPos++,new ParaInstrText(oIterator.value()))};ParaRun.prototype.GetCurrentParaPos=function(){var Pos=this.State.ContentPos;if(-1===this.StartLine)return new CParaPos(-1,-1,-1,-1);var CurLine=0;var CurRange=0;var LinesCount=this.protected_GetLinesCount();for(;CurLine=StartPos)return new CParaPos(CurLine===0?CurRange+this.StartRange:CurRange,CurLine+this.StartLine,0,0)}}if(this.Type==para_Math_Run&&LinesCount>1){var Line=LinesCount-1,Range=this.protected_GetRangesCount(LinesCount-1)-1;StartPos=this.protected_GetRangeStartPos(Line,Range);EndPos=this.protected_GetRangeEndPos(Line,Range);while(StartPos==EndPos&&Line>0&&this.Content.length!==0){Line--;StartPos=this.protected_GetRangeStartPos(Line, Range);EndPos=this.protected_GetRangeEndPos(Line,Range)}return new CParaPos(this.protected_GetRangesCount(Line)-1,Line+this.StartLine,0,0)}return new CParaPos(LinesCount<=1?this.protected_GetRangesCount(0)-1+this.StartRange:this.protected_GetRangesCount(LinesCount-1)-1,LinesCount-1+this.StartLine,0,0)};ParaRun.prototype.Get_ParaPosByContentPos=function(ContentPos,Depth){if(this.StartRange<0||this.StartLine<0)return new CParaPos(0,0,0,0);var Pos=ContentPos.Get(Depth);var CurLine=0;var CurRange=0;var LinesCount= this.protected_GetLinesCount();if(LinesCount<=0)return new CParaPos(0,0,0,0);for(;CurLine=StartPos||bUpdateMathRun)return new CParaPos(CurLine=== 0?CurRange+this.StartRange:CurRange,CurLine+this.StartLine,0,0)}}return new CParaPos(LinesCount===1?this.protected_GetRangesCount(0)-1+this.StartRange:this.protected_GetRangesCount(0)-1,LinesCount-1+this.StartLine,0,0)};ParaRun.prototype.Recalculate_CurPos=function(X,Y,CurrentRun,_CurRange,_CurLine,CurPage,UpdateCurPos,UpdateTarget,ReturnTarget){var Para=this.Paragraph;var CurLine=_CurLine-this.StartLine;var CurRange=0===CurLine?_CurRange-this.StartRange:_CurRange;var StartPos=this.protected_GetRangeStartPos(CurLine, CurRange);var EndPos=this.protected_GetRangeEndPos(CurLine,CurRange);var Pos=StartPos;var _EndPos=true===CurrentRun?Math.min(EndPos,this.State.ContentPos):EndPos;if(this.Type==para_Math_Run){var Lng=this.Content.length;Pos=_EndPos;var LocParaMath=this.ParaMath.GetLinePosition(_CurLine,_CurRange);X=LocParaMath.x;Y=LocParaMath.y;var MATH_Y=Y;var loc;if(Lng==0){X+=this.pos.x;Y+=this.pos.y}else if(Pos0)if(Pos===this.Content.length){var Item=this.Content[Pos-1];if(Item.RGap)if(Item.RGapCount)X-=Item.RGapCount*Item.RGapShift-(Item.RGapShift-Item.RGapCharWidth)/2; else X-=Item.RGap}else if(this.Content[Pos].LGap)X+=this.Content[Pos].LGap}var bNearFootnoteReference=this.IsCurPosNearFootEndnoteReference();if(true===CurrentRun&&Pos===this.State.ContentPos){if(true===UpdateCurPos){Para.CurPos.X=X;Para.CurPos.Y=Y;Para.CurPos.PagesPos=CurPage;if(true===UpdateTarget){var CurTextPr=this.Get_CompiledPr(false);var dFontKoef=bNearFootnoteReference?1:CurTextPr.Get_FontKoef();g_oTextMeasurer.SetTextPr(CurTextPr,this.Paragraph.Get_Theme());g_oTextMeasurer.SetFontSlot(fontslot_ASCII, dFontKoef);var Height=g_oTextMeasurer.GetHeight();var Descender=Math.abs(g_oTextMeasurer.GetDescender());var Ascender=Height-Descender;Para.DrawingDocument.SetTargetSize(Height,Ascender);var RGBA;Para.DrawingDocument.UpdateTargetTransform(Para.Get_ParentTextTransform());if(CurTextPr.TextFill){CurTextPr.TextFill.check(Para.Get_Theme(),Para.Get_ColorMap());var oColor=CurTextPr.TextFill.getRGBAColor();Para.DrawingDocument.SetTargetColor(oColor.R,oColor.G,oColor.B)}else if(CurTextPr.Unifill){CurTextPr.Unifill.check(Para.Get_Theme(), Para.Get_ColorMap());RGBA=CurTextPr.Unifill.getRGBAColor();Para.DrawingDocument.SetTargetColor(RGBA.R,RGBA.G,RGBA.B)}else if(true===CurTextPr.Color.Auto){var Pr=Para.Get_CompiledPr();var BgColor=undefined;if(undefined!==Pr.ParaPr.Shd&&c_oAscShdNil!==Pr.ParaPr.Shd.Value)if(Pr.ParaPr.Shd.Unifill){Pr.ParaPr.Shd.Unifill.check(this.Paragraph.Get_Theme(),this.Paragraph.Get_ColorMap());var RGBA=Pr.ParaPr.Shd.Unifill.getRGBAColor();BgColor=new CDocumentColor(RGBA.R,RGBA.G,RGBA.B,false)}else BgColor=Pr.ParaPr.Shd.Color; else{BgColor=Para.Parent.Get_TextBackGroundColor();if(undefined!==CurTextPr.Shd&&c_oAscShdNil!==CurTextPr.Shd.Value&&!(CurTextPr.FontRef&&CurTextPr.FontRef.Color))BgColor=CurTextPr.Shd.Get_Color(this.Paragraph)}var AutoColor=undefined!=BgColor&&false===BgColor.Check_BlackAutoColor()?new CDocumentColor(255,255,255,false):new CDocumentColor(0,0,0,false);var RGBA,Theme=Para.Get_Theme(),ColorMap=Para.Get_ColorMap();if(CurTextPr.FontRef&&CurTextPr.FontRef.Color){CurTextPr.FontRef.Color.check(Theme,ColorMap); RGBA=CurTextPr.FontRef.Color.RGBA;AutoColor=new CDocumentColor(RGBA.R,RGBA.G,RGBA.B,RGBA.A)}Para.DrawingDocument.SetTargetColor(AutoColor.r,AutoColor.g,AutoColor.b)}else Para.DrawingDocument.SetTargetColor(CurTextPr.Color.r,CurTextPr.Color.g,CurTextPr.Color.b);var TargetY=Y-Ascender-CurTextPr.Position;if(!bNearFootnoteReference)switch(CurTextPr.VertAlign){case AscCommon.vertalign_SubScript:{TargetY-=CurTextPr.FontSize*g_dKoef_pt_to_mm*AscCommon.vaKSub;break}case AscCommon.vertalign_SuperScript:{TargetY-= CurTextPr.FontSize*g_dKoef_pt_to_mm*AscCommon.vaKSuper;break}}var PageAbs=Para.Get_AbsolutePage(CurPage);if(para_Math_Run===this.Type&&null!==this.Parent&&true!==this.Parent.bRoot&&this.Parent.bMath_OneLine){var oBounds=this.Parent.Get_Bounds();var __Y0=TargetY,__Y1=TargetY+Height;var YY=this.Parent.pos.y-this.Parent.size.ascent,XX=this.Parent.pos.x;var ___Y0=MATH_Y+YY-.2*oBounds.H;var ___Y1=MATH_Y+YY+1.4*oBounds.H;__Y0=Math.max(__Y0,___Y0);__Y1=Math.min(__Y1,___Y1);Para.DrawingDocument.SetTargetSize(__Y1- __Y0,Ascender);Para.DrawingDocument.UpdateTarget(X,__Y0,PageAbs)}else if(undefined!=Para.Get_FramePr()){var __Y0=TargetY,__Y1=TargetY+Height;var ___Y0=Para.Pages[CurPage].Y+Para.Lines[CurLine].Top;var ___Y1=Para.Pages[CurPage].Y+Para.Lines[CurLine].Bottom;__Y0=Math.max(__Y0,___Y0);__Y1=Math.min(__Y1,___Y1);Para.DrawingDocument.SetTargetSize(__Y1-__Y0,Ascender);Para.DrawingDocument.UpdateTarget(X,__Y0,PageAbs)}else Para.DrawingDocument.UpdateTarget(X,TargetY,PageAbs)}}if(true===ReturnTarget){var CurTextPr= this.Get_CompiledPr(false);var dFontKoef=bNearFootnoteReference?1:CurTextPr.Get_FontKoef();g_oTextMeasurer.SetTextPr(CurTextPr,this.Paragraph.Get_Theme());g_oTextMeasurer.SetFontSlot(fontslot_ASCII,dFontKoef);var Height=g_oTextMeasurer.GetHeight();var Descender=Math.abs(g_oTextMeasurer.GetDescender());var Ascender=Height-Descender;var TargetY=Y-Ascender-CurTextPr.Position;if(!bNearFootnoteReference)switch(CurTextPr.VertAlign){case AscCommon.vertalign_SubScript:{TargetY-=CurTextPr.FontSize*g_dKoef_pt_to_mm* AscCommon.vaKSub;break}case AscCommon.vertalign_SuperScript:{TargetY-=CurTextPr.FontSize*g_dKoef_pt_to_mm*AscCommon.vaKSuper;break}}return{X:X,Y:TargetY,Height:Height,PageNum:Para.Get_AbsolutePage(CurPage),Internal:{Line:CurLine,Page:CurPage,Range:CurRange}}}else return{X:X,Y:Y,PageNum:Para.Get_AbsolutePage(CurPage),Internal:{Line:CurLine,Page:CurPage,Range:CurRange}}}return{X:X,Y:Y,PageNum:Para.Get_AbsolutePage(CurPage),Internal:{Line:CurLine,Page:CurPage,Range:CurRange}}};ParaRun.prototype.GetSimpleChangesRange= function(arrChanges,nStart,nEnd){if(this.IsMathRun())return null;var oParaPos=null;var _nStart=undefined!==nStart?nStart:0;var _nEnd=undefined!==nEnd?nEnd:arrChanges.length-1;var nChangeCount=0;for(var nIndex=_nStart;nIndex<=_nEnd;++nIndex){var oChange=arrChanges[nIndex];if(oChange.IsDescriptionChange())continue;if(!oChange||!oChange.IsContentChange()||1!==oChange.GetItemsCount())return null;var nType=oChange.GetType();if(AscDFH.historyitem_ParaRun_AddItem!==nType&&AscDFH.historyitem_ParaRun_RemoveItem!== nType)return null;var nItemsCount=oChange.GetItemsCount();if(AscDFH.historyitem_ParaRun_AddItem===nType)nChangeCount+=nItemsCount;else nChangeCount-=nItemsCount;for(var nItemIndex=0;nItemIndex=RangeStartPos||AscDFH.historyitem_ParaRun_RemoveItem===Type&&Pos=RangeStartPos||AscDFH.historyitem_ParaRun_RemoveItem=== Type&&Pos>=RangeEndPos&&CurLine===LinesCount-1&&CurRange===RangesCount-1){if(RangeStartPos===RangeEndPos)return null;return new CParaPos(CurLine===0?CurRange+this.StartRange:CurRange,CurLine+this.StartLine,0,0)}}}if(this.protected_GetRangeStartPos(0,0)===this.protected_GetRangeEndPos(0,0))return null;return new CParaPos(this.StartRange,this.StartLine,0,0)};ParaRun.prototype.Split=function(ContentPos,Depth){var CurPos=ContentPos.Get(Depth);return this.Split2(CurPos)};ParaRun.prototype.Split2=function(CurPos, Parent,ParentPos){History.Add(new CChangesRunOnStartSplit(this,CurPos));AscCommon.CollaborativeEditing.OnStart_SplitRun(this,CurPos);var UpdateParent=undefined!==Parent&&undefined!==ParentPos&&this===Parent.Content[ParentPos]?true:false;var UpdateSelection=true===UpdateParent&&true===Parent.IsSelectionUse()&&true===this.IsSelectionUse()?true:false;var bMathRun=this.Type==para_Math_Run;var NewRun=new ParaRun(this.Paragraph,bMathRun);NewRun.SetPr(this.Pr.Copy(true));if((0===CurPos||this.Content.length=== CurPos)&&this.Paragraph&&this.Paragraph.LogicDocument&&this.Paragraph.bFromDocument){var oStyles=this.Paragraph.LogicDocument.GetStyles();if(this.GetRStyle()===oStyles.GetDefaultFootnoteReference()||this.GetRStyle()===oStyles.GetDefaultEndnoteReference())if(0===CurPos){this.SetRStyle(undefined);this.SetVertAlign(undefined)}else{NewRun.SetRStyle(undefined);NewRun.SetVertAlign(undefined)}}NewRun.SetReviewTypeWithInfo(this.ReviewType,this.ReviewInfo?this.ReviewInfo.Copy():undefined);NewRun.CollPrChangeMine= this.CollPrChangeMine;NewRun.CollPrChangeOther=this.CollPrChangeOther;if(bMathRun)NewRun.Set_MathPr(this.MathPrp.Copy());var CheckEndPos=-1;var CheckEndPos2=Math.min(CurPos,this.Content.length);for(var Pos=0;Pos=CurPos){ContentPos.Update2(Pos-CurPos,Depth);ContentPos.Update2(ParentPos+1,Depth-1); this.NearPosArray.splice(Index,1);Count--;Index--;NewRun.NearPosArray.push(RunNearPos);if(this.Paragraph)for(var ParaIndex=0,ParaCount=this.Paragraph.NearPosArray.length;ParaIndexCurPos||oContentPos.Get(nDepth)===CurPos&&oMark.Start){this.SearchMarks.splice(nIndex,1);NewRun.SearchMarks.splice(NewRun.SearchMarks.length,0,oMark);oContentPos.Data[nDepth]-=CurPos;oContentPos.Data[nDepth-1]++;if(oMark.Start)oMark.SearchResult.ClassesS[oMark.SearchResult.ClassesS.length-1]=NewRun;else oMark.SearchResult.ClassesE[oMark.SearchResult.ClassesE.length-1]= NewRun;nSearchMarksCount--;nIndex--}}}NewRun.ConcatToContent(this.Content.slice(CurPos));this.Remove_FromContent(CurPos,this.Content.length-CurPos,true);var SpellingMarksCount=this.SpellingMarks.length;for(var Index=0;Index=CurPos){var MarkElement=Mark.Element;if(true===Mark.Start)MarkElement.StartPos.Data[Mark.Depth]-=CurPos; else MarkElement.EndPos.Data[Mark.Depth]-=CurPos;NewRun.SpellingMarks.push(Mark);this.SpellingMarks.splice(Index,1);SpellingMarksCount--;Index--}}if(true===UpdateSelection){if(ParentOldSelectionStartPos<=ParentPos&&ParentPos<=ParentOldSelectionEndPos)Parent.Selection.EndPos=ParentOldSelectionEndPos+1;else if(ParentOldSelectionEndPos<=ParentPos&&ParentPos<=ParentOldSelectionStartPos)Parent.Selection.StartPos=ParentOldSelectionStartPos+1;if(OldSelectionStartPos<=CurPos&&CurPos<=OldSelectionEndPos){this.Selection.EndPos= this.Content.length;NewRun.Selection.Use=true;NewRun.Selection.StartPos=0;NewRun.Selection.EndPos=OldSelectionEndPos-CurPos}else if(OldSelectionEndPos<=CurPos&&CurPos<=OldSelectionStartPos){this.Selection.StartPos=this.Content.length;NewRun.Selection.Use=true;NewRun.Selection.EndPos=0;NewRun.Selection.StartPos=OldSelectionStartPos-CurPos}}History.Add(new CChangesRunOnEndSplit(this,NewRun));AscCommon.CollaborativeEditing.OnEnd_SplitRun(NewRun);return NewRun};ParaRun.prototype.SplitNoDuplicate=function(oContentPos, nDepth,oNewParagraph){if(this.IsSolid())return;var oNewRun=this.Split(oContentPos,nDepth);if(!oNewRun)return;var oLogicDocument=this.GetLogicDocument();if(oLogicDocument&&oNewRun.GetRStyle()===oLogicDocument.GetStyles().GetDefaultHyperlink())oNewRun.SetRStyle(null);oNewParagraph.AddToContent(oNewParagraph.Content.length,oNewRun,false)};ParaRun.prototype.Check_NearestPos=function(ParaNearPos,Depth){var RunNearPos=new CParagraphElementNearPos;RunNearPos.NearPos=ParaNearPos.NearPos;RunNearPos.Depth= Depth;this.NearPosArray.push(RunNearPos);ParaNearPos.Classes.push(this)};ParaRun.prototype.Get_DrawingObjectRun=function(Id){var ContentLen=this.Content.length;for(var CurPos=0;CurPos=this.Content.length)DeletedRun=this;else if(StartPos<=0){this.Split2(EndPos,Parent,RunPos);DeletedRun=this}else if(EndPos>=this.Content.length)DeletedRun=this.Split2(StartPos,Parent,RunPos);else{this.Split2(EndPos,Parent,RunPos);DeletedRun=this.Split2(StartPos,Parent,RunPos)}DeletedRun.SetReviewType(reviewtype_Remove)}}else if(reviewtype_Add=== ReviewType)this.Remove_FromContent(CurPos,1,true);else if(reviewtype_Remove===ReviewType);}else this.Remove_FromContent(CurPos,1,true);return}}};ParaRun.prototype.Get_Layout=function(DrawingLayout,UseContentPos,ContentPos,Depth){var CurLine=DrawingLayout.Line-this.StartLine;var CurRange=0===CurLine?DrawingLayout.Range-this.StartRange:DrawingLayout.Range;var StartPos=this.protected_GetRangeStartPos(CurLine,CurRange);var EndPos=this.protected_GetRangeEndPos(CurLine,CurRange);var CurContentPos=true=== UseContentPos?ContentPos.Get(Depth):-1;var CurPos=StartPos;for(;CurPos=0;--nCurPos){if(oRunElements.IsEnoughElements())return;oRunElements.UpdatePos(nCurPos,nDepth);oRunElements.Add(this.Content[nCurPos],this)}};ParaRun.prototype.CollectDocumentStatistics=function(ParaStats){var Count=this.Content.length;for(var Index=0;Index< Count;Index++){var Item=this.Content[Index];var ItemType=Item.Type;var bSymbol=false;var bSpace=false;var bNewWord=false;if(para_Text===ItemType&&false===Item.Is_NBSP()||(para_PageNum===ItemType||para_PageCount===ItemType)){if(false===ParaStats.Word)bNewWord=true;bSymbol=true;bSpace=false;ParaStats.Word=true;ParaStats.EmptyParagraph=false}else if(para_Text===ItemType&&true===Item.Is_NBSP()||para_Space===ItemType||para_Tab===ItemType){bSymbol=true;bSpace=true;ParaStats.Word=false}if(true===bSymbol)ParaStats.Stats.Add_Symbol(bSpace); if(true===bNewWord)ParaStats.Stats.Add_Word()}};ParaRun.prototype.Create_FontMap=function(Map){if(undefined!==this.Paragraph&&null!==this.Paragraph){var TextPr;var FontSize,FontSizeCS;if(this.Type===para_Math_Run){TextPr=this.Get_CompiledPr(false);FontSize=TextPr.FontSize;FontSizeCS=TextPr.FontSizeCS;if(null!==this.Parent&&undefined!==this.Parent&&null!==this.Parent.ParaMath&&undefined!==this.Parent.ParaMath){TextPr.FontSize=this.Math_GetRealFontSize(TextPr.FontSize);TextPr.FontSizeCS=this.Math_GetRealFontSize(TextPr.FontSizeCS)}}else TextPr= this.Get_CompiledPr(false);TextPr.Document_CreateFontMap(Map,this.Paragraph.Get_Theme().themeElements.fontScheme);var Count=this.Content.length;for(var Index=0;IndexEndPos){var Temp=EndPos;EndPos=StartPos;StartPos=Temp}}var Str="";for(var Pos=StartPos;Pos0)nCombWidth=oBounds.W/ nMaxComb}}if(nCombWidth&&nMaxComb>0){var oCombBorder=oTextForm.GetCombBorder();var nCombBorderW=oCombBorder?oCombBorder.GetWidth():0;for(var nPos=0,nCount=this.Content.length;nPosTemp.Ascent-Temp.Height)TDescent=Temp.Ascent-Temp.Height}}Metrics.Ascent=TAscent;Metrics.Descent=TDescent};ParaRun.prototype.Recalculate_Range=function(PRS,ParaPr,Depth){if(this.Paragraph!==PRS.Paragraph){this.Paragraph=PRS.Paragraph;this.RecalcInfo.TextPr=true;this.RecalcInfo.Measure=true;this.private_UpdateSpellChecking()}this.Recalculate_MeasureContent();var CurLine=PRS.Line-this.StartLine;var CurRange=0===CurLine?PRS.Range-this.StartRange:PRS.Range;if(0=== CurRange&&0===CurLine){var PrevRecalcInfo=PRS.RunRecalcInfoLast;if(null===PrevRecalcInfo)this.RecalcInfo.NumberingAdd=true;else this.RecalcInfo.NumberingAdd=PrevRecalcInfo.NumberingAdd;this.RecalcInfo.NumberingUse=false;this.RecalcInfo.NumberingItem=null}PRS.RunRecalcInfoLast=this.RecalcInfo;var RangeStartPos=this.protected_AddRange(CurLine,CurRange);var RangeEndPos=0;var Para=PRS.Paragraph;var MoveToLBP=PRS.MoveToLBP;var NewRange=PRS.NewRange;var ForceNewPage=PRS.ForceNewPage;var NewPage=PRS.NewPage; var End=PRS.End;var Word=PRS.Word;var StartWord=PRS.StartWord;var FirstItemOnLine=PRS.FirstItemOnLine;var EmptyLine=PRS.EmptyLine;var TextOnLine=PRS.TextOnLine;var RangesCount=PRS.RangesCount;var SpaceLen=PRS.SpaceLen;var WordLen=PRS.WordLen;var X=PRS.X;var XEnd=this.Paragraph.IsUseXLimit()?PRS.XEnd:MEASUREMENT_MAX_MM_VALUE*10;var ParaLine=PRS.Line;var ParaRange=PRS.Range;var bMathWordLarge=PRS.bMathWordLarge;var OperGapRight=PRS.OperGapRight;var OperGapLeft=PRS.OperGapLeft;var bInsideOper=PRS.bInsideOper; var bContainCompareOper=PRS.bContainCompareOper;var bEndRunToContent=PRS.bEndRunToContent;var bNoOneBreakOperator=PRS.bNoOneBreakOperator;var bForcedBreak=PRS.bForcedBreak;var Pos=RangeStartPos;var ContentLen=this.Content.length;var XRange=PRS.XRange;var oSectionPr=undefined;var isHiddenCFPart=PRS.ComplexFields.IsComplexFieldCode();PRS.CheckUpdateLBP(Pos,Depth);if(false===StartWord&&true===FirstItemOnLine&&XEnd-X<.001&&RangesCount>0){NewRange=true;RangeEndPos=Pos}else for(;PosXEnd)if(para_Text===ItemType&&!Item.CanBeAtBeginOfLine()&&!PRS.LineBreakFirst){MoveToLBP=true;NewRange=true}else{NewRange=true;RangeEndPos=Pos}if(true!==NewRange){if(PRS.LineBreakFirst&&!Item.CanBeAtBeginOfLine()){FirstItemOnLine=true;LetterLen=LetterLen+SpaceLen; SpaceLen=0}else if(Item.CanBeAtBeginOfLine())PRS.Set_LineBreakPos(Pos,FirstItemOnLine);if(Item.IsSpaceAfter()){X+=SpaceLen+LetterLen;Word=false;FirstItemOnLine=false;EmptyLine=false;TextOnLine=true;SpaceLen=0;WordLen=0}else{Word=true;WordLen=LetterLen}}}else{if(X+SpaceLen+WordLen+LetterLen>XEnd)if(true===FirstItemOnLine)if(false===Para.Internal_Check_Ranges(ParaLine,ParaRange)){MoveToLBP=true;NewRange=true}else{EmptyLine=false;TextOnLine=true;X+=WordLen;NewRange=true;RangeEndPos=Pos}else if(!PRS.TryCondenseSpaces(SpaceLen+ WordLen+LetterLen,WordLen+LetterLen,X,XEnd)){MoveToLBP=true;NewRange=true}if(true!==NewRange){WordLen+=LetterLen;if(Item.Flags&PARATEXT_FLAGS_SPACEAFTER){X+=SpaceLen+WordLen;Word=false;FirstItemOnLine=false;EmptyLine=false;TextOnLine=true;SpaceLen=0;WordLen=0}}}break}case para_Math_Text:case para_Math_Ampersand:case para_Math_Placeholder:{StartWord=true;var LetterLen=Item.Get_Width2()/TEXTWIDTH_DIVIDER;if(true!==Word){if(true!==FirstItemOnLine)if(X+SpaceLen+LetterLen>XEnd){NewRange=true;RangeEndPos= Pos}else if(bForcedBreak==true){MoveToLBP=true;NewRange=true;PRS.Set_LineBreakPos(Pos,FirstItemOnLine)}if(true!==NewRange){if(this.Parent.bRoot==true)PRS.Set_LineBreakPos(Pos,FirstItemOnLine);WordLen+=LetterLen;Word=true}}else{if(X+SpaceLen+WordLen+LetterLen>XEnd)if(true===FirstItemOnLine)bMathWordLarge=true;else{MoveToLBP=true;NewRange=true}if(true!==NewRange)WordLen+=LetterLen}break}case para_Space:{if(PRS.IsCondensedSpaces())PRS.AddCondensedSpaceToRange(Item);else Item.ResetCondensedWidth();if(Word&& PRS.LastItem&¶_Text===PRS.LastItem.Type&&!PRS.LastItem.CanBeAtEndOfLine()){WordLen+=Item.Width/TEXTWIDTH_DIVIDER;break}FirstItemOnLine=false;if(true===Word){X+=SpaceLen+WordLen;Word=false;EmptyLine=false;TextOnLine=true;SpaceLen=0;WordLen=0}SpaceLen+=Item.Width/TEXTWIDTH_DIVIDER;break}case para_Math_BreakOperator:{var BrkLen=Item.Get_Width2()/TEXTWIDTH_DIVIDER;var bCompareOper=Item.Is_CompareOperator();var bOperBefore=this.ParaMath.Is_BrkBinBefore()==true;var bOperInEndContent=bOperBefore===false&& bEndRunToContent===true&&Pos==ContentLen-1&&Word==true,bLowPriority=bCompareOper==false&&bContainCompareOper==false;if(Pos==0&&true===this.IsForcedBreak())if(FirstItemOnLine===true&&Word==false&&bNoOneBreakOperator==true)WordLen+=BrkLen;else if(bOperBefore){X+=SpaceLen+WordLen;WordLen=0;SpaceLen=0;NewRange=true;RangeEndPos=Pos}else if(FirstItemOnLine==false&&X+SpaceLen+WordLen+BrkLen>XEnd){MoveToLBP=true;NewRange=true}else{X+=SpaceLen+WordLen;Word=false;MoveToLBP=true;NewRange=true;PRS.Set_LineBreakPos(1, FirstItemOnLine)}else if(bOperInEndContent||bLowPriority)if(X+SpaceLen+WordLen+BrkLen>XEnd)if(FirstItemOnLine==true)bMathWordLarge=true;else{MoveToLBP=true;NewRange=true}else WordLen+=BrkLen;else{var WorLenCompareOper=WordLen+X-XRange+(bOperBefore?SpaceLen:BrkLen);var bOverXEnd,bOverXEndMWordLarge;var bNotUpdBreakOper=false;var bCompareWrapIndent=PRS.bFirstLine==true?WorLenCompareOper>PRS.WrapIndent:true;if(PRS.bPriorityOper==true&&bCompareOper==true&&bContainCompareOper==true&&bCompareWrapIndent== true&&!(Word==false&&FirstItemOnLine===true))bContainCompareOper=false;if(bOperBefore){bOverXEnd=X+WordLen+SpaceLen+BrkLen>XEnd;bOverXEndMWordLarge=X+WordLen+SpaceLen>XEnd;if(bOverXEnd&&(true!==FirstItemOnLine||true===Word))if(FirstItemOnLine===false){MoveToLBP=true;NewRange=true}else{if(Word==true&&bOverXEndMWordLarge==true)bMathWordLarge=true;X+=SpaceLen+WordLen;if(PRS.bBreakPosInLWord==true)PRS.Set_LineBreakPos(Pos,FirstItemOnLine);else bNotUpdBreakOper=true;RangeEndPos=Pos;SpaceLen=0;WordLen= 0;NewRange=true;EmptyLine=false;TextOnLine=true}else{if(FirstItemOnLine===false)bInsideOper=true;if(Word==false&&FirstItemOnLine==true)SpaceLen+=BrkLen;else{X+=SpaceLen+WordLen;PRS.Set_LineBreakPos(Pos,FirstItemOnLine);EmptyLine=false;TextOnLine=true;WordLen=BrkLen;SpaceLen=0}if(bNoOneBreakOperator==false||Word==true)FirstItemOnLine=false}}else{bOverXEnd=X+WordLen+BrkLen-Item.GapRight>XEnd;bOverXEndMWordLarge=bOverXEnd;if(bOverXEnd&&FirstItemOnLine===false){MoveToLBP=true;NewRange=true;if(Word==false)PRS.Set_LineBreakPos(Pos, FirstItemOnLine)}else{bInsideOper=true;OperGapRight=Item.GapRight;if(bOverXEndMWordLarge==true)bMathWordLarge=true;X+=BrkLen+WordLen;EmptyLine=false;TextOnLine=true;SpaceLen=0;WordLen=0;var bNotUpdate=bOverXEnd==true&&PRS.bBreakPosInLWord==false;if(bNotUpdate==false)PRS.Set_LineBreakPos(Pos+1,FirstItemOnLine);else bNotUpdBreakOper=true;FirstItemOnLine=false;Word=false}}}if(bNotUpdBreakOper==false)bNoOneBreakOperator=false;break}case para_Drawing:{if(oSectionPr===undefined)oSectionPr=Para.Get_SectPr(); Item.CheckRecalcAutoFit(oSectionPr);if(true===Item.Is_Inline()||true===Para.Parent.Is_DrawingShape()){if(true===StartWord)FirstItemOnLine=false;Item.YOffset=this.YOffset;if(true===Word||WordLen>0){X+=SpaceLen+WordLen;Word=false;EmptyLine=false;TextOnLine=true;SpaceLen=0;WordLen=0}var DrawingWidth=Item.Get_Width();if(X+SpaceLen+DrawingWidth>XEnd&&(false===FirstItemOnLine||false===Para.Internal_Check_Ranges(ParaLine,ParaRange))){NewRange=true;RangeEndPos=Pos}else{X+=SpaceLen+DrawingWidth;FirstItemOnLine= false;EmptyLine=false}SpaceLen=0}else if(!Item.IsSkipOnRecalculate()){var LogicDocument=Para.Parent;var LDRecalcInfo=LogicDocument.RecalcInfo;var DrawingObjects=LogicDocument.DrawingObjects;var CurPage=PRS.Page;if(true===LDRecalcInfo.Check_FlowObject(Item)&&true===LDRecalcInfo.Is_PageBreakBefore()){LDRecalcInfo.Reset();if(null!=Para.Get_DocumentPrev()&&true!=Para.Parent.IsTableCellContent()&&0===CurPage){Para.Recalculate_Drawing_AddPageBreak(0,0,true);PRS.RecalcResult=recalcresult_NextPage|recalcresultflags_Page; PRS.NewRange=true;return}else if(ParaLine!=Para.Pages[CurPage].FirstLine){Para.Recalculate_Drawing_AddPageBreak(ParaLine,CurPage,false);PRS.RecalcResult=recalcresult_NextPage|recalcresultflags_Page;PRS.NewRange=true;return}else{RangeEndPos=Pos;NewRange=true;ForceNewPage=true}if(true===Word||WordLen>0){X+=SpaceLen+WordLen;Word=false;SpaceLen=0;WordLen=0}}}break}case para_PageCount:case para_PageNum:{if(para_PageCount===ItemType){var oHdrFtr=Para.Parent.IsHdrFtr(true);if(oHdrFtr)oHdrFtr.Add_PageCountElement(Item)}else if(para_PageNum=== ItemType){var LogicDocument=Para.LogicDocument;var SectionPage=LogicDocument.Get_SectionPageNumInfo2(Para.Get_AbsolutePage(PRS.Page)).CurPage;Item.Set_Page(SectionPage)}if(true===Word||WordLen>0){X+=SpaceLen+WordLen;Word=false;EmptyLine=false;TextOnLine=true;SpaceLen=0;WordLen=0}if(true===StartWord)FirstItemOnLine=false;var PageNumWidth=Item.Get_Width();if(X+SpaceLen+PageNumWidth>XEnd&&(false===FirstItemOnLine||false===Para.Internal_Check_Ranges(ParaLine,ParaRange))){NewRange=true;RangeEndPos=Pos}else{X+= SpaceLen+PageNumWidth;FirstItemOnLine=false;EmptyLine=false;TextOnLine=true}SpaceLen=0;break}case para_Tab:{var isLastTabToRightEdge=PRS.LastTab&&-1!==PRS.LastTab.Value?PRS.LastTab.TabRightEdge:false;X=this.private_RecalculateLastTab(PRS.LastTab,X,XEnd,Word,WordLen,SpaceLen);X+=SpaceLen+WordLen;Word=false;SpaceLen=0;WordLen=0;var TabPos=Para.private_RecalculateGetTabPos(X,ParaPr,PRS.Page,false);var NewX=TabPos.NewX;var TabValue=TabPos.TabValue;Item.SetLeader(TabPos.TabLeader);PRS.LastTab.TabPos=NewX; PRS.LastTab.Value=TabValue;PRS.LastTab.X=X;PRS.LastTab.Item=Item;PRS.LastTab.TabRightEdge=TabPos.TabRightEdge;var oLogicDocument=PRS.Paragraph.LogicDocument;var nCompatibilityMode=oLogicDocument&&oLogicDocument.GetCompatibilityMode?oLogicDocument.GetCompatibilityMode():AscCommon.document_compatibility_mode_Current;if(tab_Left!==TabValue){Item.Width=0;Item.WidthVisible=0;if(AscCommon.MMToTwips(TabPos.NewX)>AscCommon.MMToTwips(XEnd)&&nCompatibilityMode<=AscCommon.document_compatibility_mode_Word14){Para.Lines[PRS.Line].Ranges[PRS.Range].XEnd= 558.7;XEnd=558.7;PRS.BadLeftTab=true}}else{var twX=AscCommon.MMToTwips(X);var twXEnd=AscCommon.MMToTwips(XEnd);var twNewX=AscCommon.MMToTwips(NewX);if(nCompatibilityMode<=AscCommon.document_compatibility_mode_Word14&&!isLastTabToRightEdge&&true!==TabPos.DefaultTab&&(twNewX>=twXEnd&&XEnd<558.7&&PRS.Range>=PRS.RangesCount-1)){Para.Lines[PRS.Line].Ranges[PRS.Range].XEnd=558.7;XEnd=558.7;PRS.BadLeftTab=true;twXEnd=AscCommon.MMToTwips(XEnd)}if(!PRS.BadLeftTab&&(false===FirstItemOnLine||false===Para.Internal_Check_Ranges(ParaLine, ParaRange))&&((TabPos.DefaultTab||PRS.RangetwXEnd||!TabPos.DefaultTab&&twNewX>AscCommon.MMToTwips(TabPos.PageXLimit))){WordLen=NewX-X;RangeEndPos=Pos;NewRange=true}else{Item.Width=NewX-X;Item.WidthVisible=NewX-X;X=NewX}}PRS.Set_LineBreakPos(Pos,FirstItemOnLine);if(RangesCount===CurRange)if(true===StartWord){FirstItemOnLine=false;EmptyLine=false;TextOnLine=true}StartWord=true;Word=true;break}case para_NewLine:{X=this.private_RecalculateLastTab(PRS.LastTab,X,XEnd,Word,WordLen, SpaceLen);X+=WordLen;if(true===Word){EmptyLine=false;TextOnLine=true;Word=false;X+=SpaceLen;SpaceLen=0}if(break_Page===Item.BreakType||break_Column===Item.BreakType){PRS.BreakPageLine=true;if(break_Page===Item.BreakType)PRS.BreakRealPageLine=true;var oParent=Para.Parent;while(oParent instanceof CDocumentContent&&oParent.IsBlockLevelSdtContent())oParent=oParent.GetParent().GetParent();if(!(oParent instanceof CDocument)||true!==Para.Is_Inline()){Item.Flags.Use=false;continue}if(break_Page===Item.BreakType&& !Para.CheckSplitPageOnPageBreak(Item))continue;Item.Flags.NewLine=true;NewPage=true;NewRange=true}else{PRS.BreakLine=true;NewRange=true;EmptyLine=false;TextOnLine=true;if(true===PRS.MathNotInline)PRS.ForceNewLine=true}RangeEndPos=Pos+1;break}case para_End:{if(true===Word){FirstItemOnLine=false;EmptyLine=false;TextOnLine=true}X+=WordLen;if(true===Word){X+=SpaceLen;SpaceLen=0;WordLen=0}X=this.private_RecalculateLastTab(PRS.LastTab,X,XEnd,Word,WordLen,SpaceLen);NewRange=true;End=true;RangeEndPos=Pos+ 1;break}case para_FieldChar:{if(PRS.IsFastRecalculate())break;Item.SetXY(X+SpaceLen+WordLen,PRS.Y);Item.SetPage(Para.Get_AbsolutePage(CurPage));Item.SetRun(this);PRS.ComplexFields.ProcessFieldChar(Item);isHiddenCFPart=PRS.ComplexFields.IsComplexFieldCode();if(Item.IsSeparate()&&!isHiddenCFPart){var oComplexField=Item.GetComplexField();var oHdrFtr=Para.Parent.IsHdrFtr(true);if(oHdrFtr&&!oComplexField&&this.Paragraph){this.Paragraph.ProcessComplexFields();oComplexField=Item.GetComplexField()}if(oHdrFtr&& oComplexField){var oParent=this.GetParent();var nRunPos=this.private_GetPosInParent(oParent);if(Pos>=ContentLen-1&&oParent&&oParent.Content[nRunPos+1]instanceof ParaRun){var oNumValuePr=oParent.Content[nRunPos+1].Get_CompiledPr(false);g_oTextMeasurer.SetTextPr(oNumValuePr,this.Paragraph.Get_Theme());Item.Measure(g_oTextMeasurer,oNumValuePr)}var oInstruction=oComplexField.GetInstruction();if(oInstruction&&(fieldtype_NUMPAGES===oInstruction.GetType()||fieldtype_PAGE===oInstruction.GetType()||fieldtype_FORMULA=== oInstruction.GetType()))if(fieldtype_NUMPAGES===oInstruction.GetType()){oHdrFtr.Add_PageCountElement(Item);if(!Item.IsNumValue()&&Para.LogicDocument&&Para.LogicDocument.IsDocumentEditor())Item.SetNumValue(Para.LogicDocument.Pages.length)}else if(fieldtype_PAGE===oInstruction.GetType()){var LogicDocument=Para.LogicDocument;var SectionPage=LogicDocument.Get_SectionPageNumInfo2(Para.Get_AbsolutePage(PRS.Page)).CurPage;Item.SetNumValue(SectionPage)}else{var sValue=oComplexField.CalculateValue();var nValue= parseInt(sValue);if(isNaN(nValue))nValue=0;Item.SetNumValue(nValue)}if(true===Word||WordLen>0){X+=SpaceLen+WordLen;Word=false;EmptyLine=false;TextOnLine=true;SpaceLen=0;WordLen=0}if(true===StartWord)FirstItemOnLine=false;var PageNumWidth=Item.Get_Width();if(X+SpaceLen+PageNumWidth>XEnd&&(false===FirstItemOnLine||false===Para.Internal_Check_Ranges(ParaLine,ParaRange))){NewRange=true;RangeEndPos=Pos}else{X+=SpaceLen+PageNumWidth;FirstItemOnLine=false;EmptyLine=false;TextOnLine=true}SpaceLen=0}else Item.SetNumValue(null)}break}}if(para_Space!== ItemType)PRS.LastItem=Item;if(true===NewRange)break}PRS.MoveToLBP=MoveToLBP;PRS.NewRange=NewRange;PRS.ForceNewPage=ForceNewPage;PRS.NewPage=NewPage;PRS.End=End;PRS.Word=Word;PRS.StartWord=StartWord;PRS.FirstItemOnLine=FirstItemOnLine;PRS.EmptyLine=EmptyLine;PRS.TextOnLine=TextOnLine;PRS.SpaceLen=SpaceLen;PRS.WordLen=WordLen;PRS.bMathWordLarge=bMathWordLarge;PRS.OperGapRight=OperGapRight;PRS.OperGapLeft=OperGapLeft;PRS.X=X;PRS.XEnd=XEnd;PRS.bInsideOper=bInsideOper;PRS.bContainCompareOper=bContainCompareOper; PRS.bEndRunToContent=bEndRunToContent;PRS.bNoOneBreakOperator=bNoOneBreakOperator;PRS.bForcedBreak=bForcedBreak;if(this.Type==para_Math_Run)if(true===NewRange){var WidthLine=X-XRange;if(this.ParaMath.Is_BrkBinBefore()==false)WidthLine+=SpaceLen;this.ParaMath.UpdateWidthLine(PRS,WidthLine)}else{if(this.Content.length==0)if(PRS.bForcedBreak==true){PRS.MoveToLBP=true;PRS.NewRange=true;PRS.Set_LineBreakPos(0,PRS.FirstItemOnLine)}else if(this.ParaMath.Is_BrkBinBefore()==false&&Word==false&&PRS.bBreakBox== true){PRS.Set_LineBreakPos(Pos,PRS.FirstItemOnLine);PRS.X+=SpaceLen;PRS.SpaceLen=0}PRS.PosEndRun.Set(PRS.CurPos);PRS.PosEndRun.Update2(this.Content.length,Depth)}if(Pos>=ContentLen)RangeEndPos=Pos;this.protected_FillRange(CurLine,CurRange,RangeStartPos,RangeEndPos);this.RecalcInfo.Recalc=false};ParaRun.prototype.Recalculate_Set_RangeEndPos=function(PRS,PRP,Depth){var CurLine=PRS.Line-this.StartLine;var CurRange=0===CurLine?PRS.Range-this.StartRange:PRS.Range;var CurPos=PRP.Get(Depth);this.protected_FillRangeEndPos(CurLine, CurRange,CurPos)};ParaRun.prototype.Recalculate_LineMetrics=function(PRS,ParaPr,_CurLine,_CurRange,ContentMetrics){var Para=PRS.Paragraph;var CurLine=_CurLine-this.StartLine;var CurRange=0===CurLine?_CurRange-this.StartRange:_CurRange;var StartPos=this.protected_GetRangeStartPos(CurLine,CurRange);var EndPos=this.protected_GetRangeEndPos(CurLine,CurRange);var UpdateLineMetricsText=false;var LineRule=ParaPr.Spacing.LineRule;for(var CurPos=StartPos;CurPos1)PRSC.Spaces+=PRSC.SpacesCount;else PRSC.SpacesSkip+=PRSC.SpacesCount;PRSC.SpacesCount=0;if(Item.Flags&PARATEXT_FLAGS_SPACEAFTER)PRSC.Word=false;break}case para_Math_Text:case para_Math_Placeholder:case para_Math_Ampersand:case para_Math_BreakOperator:{PRSC.Letters++;PRSC.Range.W+=Item.Get_Width()/TEXTWIDTH_DIVIDER;break}case para_Space:{if(true===PRSC.Word){PRSC.Word=false;PRSC.SpacesCount= 1;PRSC.SpaceLen=Item.Width/TEXTWIDTH_DIVIDER}else{PRSC.SpacesCount++;PRSC.SpaceLen+=Item.Width/TEXTWIDTH_DIVIDER}break}case para_Drawing:{PRSC.Words++;PRSC.Range.W+=PRSC.SpaceLen;if(PRSC.Words>1)PRSC.Spaces+=PRSC.SpacesCount;else PRSC.SpacesSkip+=PRSC.SpacesCount;PRSC.Word=false;PRSC.SpacesCount=0;PRSC.SpaceLen=0;if(true===Item.Is_Inline()||true===PRSC.Paragraph.Parent.Is_DrawingShape())PRSC.Range.W+=Item.Get_Width();break}case para_PageNum:case para_PageCount:{PRSC.Words++;PRSC.Range.W+=PRSC.SpaceLen; if(PRSC.Words>1)PRSC.Spaces+=PRSC.SpacesCount;else PRSC.SpacesSkip+=PRSC.SpacesCount;PRSC.Word=false;PRSC.SpacesCount=0;PRSC.SpaceLen=0;PRSC.Range.W+=Item.Get_Width();break}case para_Tab:{PRSC.Range.W+=Item.Get_Width();PRSC.Range.W+=PRSC.SpaceLen;PRSC.LettersSkip+=PRSC.Letters;PRSC.SpacesSkip+=PRSC.Spaces;PRSC.Words=0;PRSC.Spaces=0;PRSC.Letters=0;PRSC.SpaceLen=0;PRSC.SpacesCount=0;PRSC.Word=false;break}case para_NewLine:{if(true===PRSC.Word&&PRSC.Words>1)PRSC.Spaces+=PRSC.SpacesCount;PRSC.SpacesCount= 0;PRSC.Word=false;PRSC.Range.WBreak=Item.Get_WidthVisible();break}case para_End:{if(true===PRSC.Word)PRSC.Spaces+=PRSC.SpacesCount;PRSC.Range.WEnd=Item.Get_WidthVisible();break}case para_FieldChar:{if(reviewtype_Remove===this.GetReviewType())break;if(this.Paragraph&&this.Paragraph.m_oPRSW.IsFastRecalculate())PRSC.ComplexFields.ProcessFieldChar(Item);else PRSC.ComplexFields.ProcessFieldCharAndCollectComplexField(Item);isHiddenCFPart=PRSC.ComplexFields.IsComplexFieldCode();if(Item.IsNumValue()){PRSC.Words++; PRSC.Range.W+=PRSC.SpaceLen;if(PRSC.Words>1)PRSC.Spaces+=PRSC.SpacesCount;else PRSC.SpacesSkip+=PRSC.SpacesCount;PRSC.Word=false;PRSC.SpacesCount=0;PRSC.SpaceLen=0;PRSC.Range.W+=Item.Get_Width()}break}case para_InstrText:{if(this.Paragraph&&this.Paragraph.m_oPRSW.IsFastRecalculate())break;if(reviewtype_Remove===this.GetReviewType())break;PRSC.ComplexFields.ProcessInstruction(Item);break}}}};ParaRun.prototype.Recalculate_Range_Spaces=function(PRSA,_CurLine,_CurRange,CurPage){var CurLine=_CurLine-this.StartLine; var CurRange=0===CurLine?_CurRange-this.StartRange:_CurRange;var StartPos=this.protected_GetRangeStartPos(CurLine,CurRange);var EndPos=this.protected_GetRangeEndPos(CurLine,CurRange);var isHiddenCFPart=PRSA.ComplexFields.IsComplexFieldCode();for(var Pos=StartPos;PosColumnAbs)_CurPage=CurPage-ColumnAbs;var ColumnStartX,ColumnEndX;if(0===CurPage){if(Para.Parent.RecalcInfo.Can_RecalcObject()&&0===CurLine)Para.private_RecalculateColumnLimits();ColumnStartX=Para.X_ColumnStart;ColumnEndX=Para.X_ColumnEnd}else{ColumnStartX=Para.Pages[_CurPage].X;ColumnEndX=Para.Pages[_CurPage].XLimit}var Top_Margin=Y_Top_Margin;var Bottom_Margin=Y_Bottom_Margin; var Page_H=Page_Height;if(isTableCellContent&&isUseWrap){Top_Margin=0;Bottom_Margin=0;Page_H=0}var PageLimitsOrigin=Para.Parent.Get_PageLimits(PageRel);if(isTableCellContent&&!isLayoutInCell){PageLimitsOrigin=LogicDocument.Get_PageLimits(PageAbs);var PageFieldsOrigin=LogicDocument.Get_PageFields(PageAbs);ColumnStartX=PageFieldsOrigin.X;ColumnEndX=PageFieldsOrigin.XLimit}if(!isUseWrap){PageFields.X=X_Left_Field;PageFields.Y=Y_Top_Field;PageFields.XLimit=X_Right_Field;PageFields.YLimit=Y_Bottom_Field; if(!isTableCellContent||!isLayoutInCell){PageLimits.X=0;PageLimits.Y=0;PageLimits.XLimit=Page_Width;PageLimits.YLimit=Page_Height}}if(true===Item.Is_Inline()||true===Para.Parent.Is_DrawingShape()){if(linerule_Exact===Para.Get_CompiledPr2(false).ParaPr.Spacing.LineRule){var LineTop=Para.Pages[CurPage].Y+Para.Lines[CurLine].Y-Para.Lines[CurLine].Metrics.Ascent;var LineBottom=Para.Pages[CurPage].Y+Para.Lines[CurLine].Y-Para.Lines[CurLine].Metrics.Descent;Item.SetVerticalClip(LineTop,LineBottom)}else Item.SetVerticalClip(null, null);Item.Update_Position(PRSA.Paragraph,new CParagraphLayout(PRSA.X,PRSA.Y,PageAbs,PRSA.LastW,ColumnStartX,ColumnEndX,X_Left_Margin,X_Right_Margin,Page_Width,Top_Margin,Bottom_Margin,Page_H,PageFields.X,PageFields.Y,Para.Pages[CurPage].Y+Para.Lines[CurLine].Y-Para.Lines[CurLine].Metrics.Ascent,Para.Pages[CurPage].Y),PageLimits,PageLimitsOrigin,_CurLine);Item.Reset_SavedPosition();PRSA.X+=Item.WidthVisible;PRSA.LastW=Item.WidthVisible}else if(!Item.IsSkipOnRecalculate()){Para.Pages[CurPage].Add_Drawing(Item); if(true===PRSA.RecalcFast)break;if(true===PRSA.RecalcFast2){var oRecalcObj=Item.SaveRecalculateObject();Item.Update_Position(PRSA.Paragraph,new CParagraphLayout(PRSA.X,PRSA.Y,PageAbs,PRSA.LastW,ColumnStartX,ColumnEndX,X_Left_Margin,X_Right_Margin,Page_Width,Top_Margin,Bottom_Margin,Page_H,PageFields.X,PageFields.Y,Para.Pages[CurPage].Y+Para.Lines[CurLine].Y-Para.Lines[CurLine].Metrics.Ascent,Para.Pages[_CurPage].Y),PageLimits,PageLimitsOrigin,_CurLine);if(Math.abs(Item.X-oRecalcObj.X)>.001||Math.abs(Item.Y- oRecalcObj.Y)>.001||Item.PageNum!==oRecalcObj.PageNum){PRSA.RecalcResult=recalcresult_CurPage|recalcresultflags_Page;return}break}if(isUseWrap){var LogicDocument=Para.Parent;var LDRecalcInfo=Para.Parent.RecalcInfo;if(true===LDRecalcInfo.Can_RecalcObject()){Item.Update_Position(PRSA.Paragraph,new CParagraphLayout(PRSA.X,PRSA.Y,PageAbs,PRSA.LastW,ColumnStartX,ColumnEndX,X_Left_Margin,X_Right_Margin,Page_Width,Top_Margin,Bottom_Margin,Page_H,PageFields.X,PageFields.Y,Para.Pages[CurPage].Y+Para.Lines[CurLine].Y- Para.Lines[CurLine].Metrics.Ascent,Para.Pages[_CurPage].Y),PageLimits,PageLimitsOrigin,_CurLine);LDRecalcInfo.Set_FlowObject(Item,0,recalcresult_NextElement,-1);if(0===PRSA.CurPage&&Item.wrappingPolygon.top>PRSA.PageY+.001&&Item.wrappingPolygon.left>PRSA.PageX+.001)PRSA.RecalcResult=recalcresult_CurPagePara;else PRSA.RecalcResult=recalcresult_CurPage|recalcresultflags_Page;return}else if(true===LDRecalcInfo.Check_FlowObject(Item))if(Item.PageNum===PageAbs){LDRecalcInfo.Reset();Item.Reset_SavedPosition()}else if(isTableCellContent){Item.Update_Position(PRSA.Paragraph, new CParagraphLayout(PRSA.X,PRSA.Y,PageAbs,PRSA.LastW,ColumnStartX,ColumnEndX,X_Left_Margin,X_Right_Margin,Page_Width,Top_Margin,Bottom_Margin,Page_H,PageFields.X,PageFields.Y,Para.Pages[CurPage].Y+Para.Lines[CurLine].Y-Para.Lines[CurLine].Metrics.Ascent,Para.Pages[_CurPage].Y),PageLimits,PageLimitsOrigin,_CurLine);LDRecalcInfo.Set_FlowObject(Item,0,recalcresult_NextElement,-1);LDRecalcInfo.Set_PageBreakBefore(false);PRSA.RecalcResult=recalcresult_CurPage|recalcresultflags_Page;return}else{LDRecalcInfo.Set_PageBreakBefore(true); DrawingObjects.removeById(Item.PageNum,Item.Get_Id());PRSA.RecalcResult=recalcresult_PrevPage|recalcresultflags_Page;return}else;continue}else{var nPageStartLine=Para.Pages[_CurPage].StartLine;var nParaTop=Para.Pages[_CurPage].Y+Para.Lines[nPageStartLine].Top;var nLineTop=Para.Pages[CurPage].Y+Para.Lines[CurLine].Y-Para.Lines[CurLine].Metrics.Ascent;var _nColumnStartX=ColumnStartX;if(Para.Lines[nPageStartLine].Ranges.length>1){var arrTempRanges=Para.Lines[nPageStartLine].Ranges;for(var nTempCurRange= 0,nTempRangesCount=arrTempRanges.length;nTempCurRange.001||arrTempRanges[nTempCurRange].WEnd>.001){_nColumnStartX=arrTempRanges[nTempCurRange].X;break}}Item.Update_Position(PRSA.Paragraph,new CParagraphLayout(PRSA.X,PRSA.Y,PageAbs,PRSA.LastW,_nColumnStartX,ColumnEndX,X_Left_Margin,X_Right_Margin,Page_Width,Top_Margin,Bottom_Margin,Page_H,PageFields.X,PageFields.Y,nLineTop,nParaTop),PageLimits,PageLimitsOrigin,_CurLine);Item.Reset_SavedPosition()}}break}case para_PageNum:case para_PageCount:{PRSA.X+= Item.WidthVisible;PRSA.LastW=Item.WidthVisible;break}case para_Tab:{PRSA.X+=Item.WidthVisible;break}case para_End:{var SectPr=PRSA.Paragraph.Get_SectionPr();if(!PRSA.Paragraph.LogicDocument||PRSA.Paragraph.LogicDocument!==PRSA.Paragraph.Parent||!PRSA.Paragraph.bFromDocument)SectPr=undefined;if(undefined!==SectPr){var LogicDocument=PRSA.Paragraph.LogicDocument;var NextSectPr=LogicDocument.SectionsInfo.Get_SectPr(PRSA.Paragraph.Index+1).SectPr;Item.UpdateSectionEnd(NextSectPr.Type,PRSA.XEnd-PRSA.X, LogicDocument)}else Item.ClearSectionEnd();PRSA.X+=Item.Get_Width();break}case para_NewLine:{if(break_Page===Item.BreakType||break_Column===Item.BreakType)Item.Update_String(PRSA.XEnd-PRSA.X);PRSA.X+=Item.WidthVisible;break}case para_FieldChar:{PRSA.ComplexFields.ProcessFieldChar(Item);isHiddenCFPart=PRSA.ComplexFields.IsComplexFieldCode();if(Item.IsNumValue()){PRSA.X+=Item.Get_WidthVisible();PRSA.LastW=Item.Get_WidthVisible()}break}}}};ParaRun.prototype.Recalculate_PageEndInfo=function(PRSI,_CurLine, _CurRange){var CurLine=_CurLine-this.StartLine;var CurRange=0===CurLine?_CurRange-this.StartRange:_CurRange;var StartPos=this.protected_GetRangeStartPos(CurLine,CurRange);var EndPos=this.protected_GetRangeEndPos(CurLine,CurRange);for(var Pos=StartPos;Pos0)TempXPos+=SpaceLen+WordLen;var TabItem=LastTab.Item;var TabStartX=LastTab.X;var TabRangeW=TempXPos-TabStartX;var TabValue=LastTab.Value;var TabPos=LastTab.TabPos;var oLogicDocument=this.Paragraph?this.Paragraph.LogicDocument:null;var nCompatibilityMode=oLogicDocument&& oLogicDocument.GetCompatibilityMode?oLogicDocument.GetCompatibilityMode():AscCommon.document_compatibility_mode_Current;if(AscCommon.MMToTwips(TabPos)>AscCommon.MMToTwips(XEnd)&&nCompatibilityMode>=AscCommon.document_compatibility_mode_Word15){TabValue=tab_Right;TabPos=XEnd}var TabCalcW=0;if(tab_Right===TabValue)TabCalcW=Math.max(TabPos-(TabStartX+TabRangeW),0);else if(tab_Center===TabValue)TabCalcW=Math.max(TabPos-(TabStartX+TabRangeW/2),0);if(X+TabCalcW>LastTab.PageXLimit)TabCalcW=LastTab.PageXLimit- X;TabItem.Width=TabCalcW;TabItem.WidthVisible=TabCalcW;LastTab.Reset();return X+TabCalcW}return X};ParaRun.prototype.private_CheckInstrText=function(oItem){if(!oItem)return oItem;if(para_InstrText!==oItem.Type)return oItem;var oReplacement=oItem.GetReplacementItem();return oReplacement?oReplacement:oItem};ParaRun.prototype.Refresh_RecalcData=function(oData){var oPara=this.Paragraph;if(this.Type==para_Math_Run){if(this.Parent!==null&&this.Parent!==undefined)this.Parent.Refresh_RecalcData()}else if(-1!== this.StartLine&&oPara){var nCurLine=this.StartLine;if(oData instanceof CChangesRunAddItem||oData instanceof CChangesRunRemoveItem){nCurLine=-1;var nChangePos=oData.GetMinPos();for(var nLine=0,nLinesCount=this.protected_GetLinesCount();nLine0?this.Content[0]:this.Content[Count-1];var ItemType=Item.Type;if(para_End===ItemType||para_NewLine===ItemType){oChecker.Result=true;oChecker.Found=true}else{oChecker.Result=false;oChecker.Found=true}};ParaRun.prototype.Check_PageBreak=function(){var Count=this.Content.length;for(var Pos=0;Pos0){nCurMaxWidth+=nSpaceLen;nSpaceLen=0}nCurMaxWidth+=ItemWidth;bCheckTextHeight=true;if(Item.IsSpaceAfter()){if(nMinWidthnMinWidth)nMinWidth=Item.Width;else if(true===Item.Use_TextWrap()){var DrawingW=Item.getXfrmExtX();if(DrawingW>nMinWidth)nMinWidth=DrawingW}if((true===Item.Is_Inline()||true===this.Paragraph.Parent.Is_DrawingShape())&&Item.Height>nMaxHeight)nMaxHeight=Item.Height;else if(true===Item.Use_TextWrap()){var DrawingH=Item.getXfrmExtY();if(DrawingH>nMaxHeight)nMaxHeight=DrawingH}if(nSpaceLen>0){nCurMaxWidth+= nSpaceLen;nSpaceLen=0}if(true===Item.Is_Inline()||true===this.Paragraph.Parent.Is_DrawingShape())nCurMaxWidth+=Item.Width;break}case para_PageNum:case para_PageCount:{if(true===bWord){if(nMinWidthnMinWidth)nMinWidth=Item.Get_Width();if(nSpaceLen>0){nCurMaxWidth+=nSpaceLen;nSpaceLen=0}nCurMaxWidth+=Item.Get_Width();bCheckTextHeight=true;break}case para_Tab:{nWordLen+=Item.Width;if(nMinWidth0){nCurMaxWidth+=nSpaceLen;nSpaceLen=0}nCurMaxWidth+=Item.Width;bCheckTextHeight=true;break}case para_NewLine:{if(nMinWidthnMaxWidth)nMaxWidth=nCurMaxWidth;nCurMaxWidth=0;bCheckTextHeight=true;break}case para_End:{if(nMinWidthnMaxWidth)nMaxWidth=nCurMaxWidth;if(nMaxHeight<.001)bCheckTextHeight=true;break}}}if(true===bCheckTextHeight&&nMaxHeight 0&&true===bDrawFind?true:false;var DrawColl=this.CollaborativeMarks.Check(Pos);if(true===bDrawShd)aShd.Add(Y0,Y1,X,X+ItemWidthVisible,0,ShdColor.r,ShdColor.g,ShdColor.b,undefined,oShd);if(PDSH.ComplexFields.IsComplexField()&&!PDSH.ComplexFields.IsComplexFieldCode()&&PDSH.ComplexFields.IsCurrentComplexField()&&!PDSH.ComplexFields.IsHyperlinkField())PDSH.CFields.Add(Y0,Y1,X,X+ItemWidthVisible,0,0,0,0);switch(ItemType){case para_PageNum:case para_PageCount:case para_Drawing:case para_Tab:case para_Text:case para_Math_Text:case para_Math_Placeholder:case para_Math_BreakOperator:case para_Math_Ampersand:case para_Sym:case para_FootnoteReference:case para_FootnoteRef:case para_Separator:case para_ContinuationSeparator:case para_EndnoteReference:case para_EndnoteRef:{if(para_Drawing=== ItemType&&!Item.Is_Inline())break;if(CommentsFlag!=AscCommon.comments_NoComment)aComm.Add(Y0,Y1,X,X+ItemWidthVisible,0,0,0,0,{Active:CommentsFlag===AscCommon.comments_ActiveComment?true:false,CommentId:arrComments});else if(highlight_None!=HighLight)aHigh.Add(Y0,Y1,X,X+ItemWidthVisible,0,HighLight.r,HighLight.g,HighLight.b,undefined,HighLight);if(true===DrawSearch)aFind.Add(Y0,Y1,X,X+ItemWidthVisible,0,0,0,0);else if(null!==DrawColl)aColl.Add(Y0,Y1,X,X+ItemWidthVisible,0,DrawColl.r,DrawColl.g,DrawColl.b); if(para_Drawing!=ItemType||Item.Is_Inline())X+=ItemWidthVisible;break}case para_Space:{if(PDSH.Spaces>0){if(CommentsFlag!=AscCommon.comments_NoComment)aComm.Add(Y0,Y1,X,X+ItemWidthVisible,0,0,0,0,{Active:CommentsFlag===AscCommon.comments_ActiveComment?true:false,CommentId:arrComments});else if(highlight_None!=HighLight)aHigh.Add(Y0,Y1,X,X+ItemWidthVisible,0,HighLight.r,HighLight.g,HighLight.b,undefined,HighLight);PDSH.Spaces--}if(true===DrawSearch)aFind.Add(Y0,Y1,X,X+ItemWidthVisible,0,0,0,0);else if(null!== DrawColl)aColl.Add(Y0,Y1,X,X+ItemWidthVisible,0,DrawColl.r,DrawColl.g,DrawColl.b);X+=ItemWidthVisible;break}case para_End:{if(null!==DrawColl)aColl.Add(Y0,Y1,X,X+ItemWidthVisible,0,DrawColl.r,DrawColl.g,DrawColl.b);X+=Item.Get_Width();break}case para_NewLine:{X+=ItemWidthVisible;break}case para_FieldChar:{PDSH.ComplexFields.ProcessFieldChar(Item);isHiddenCFPart=PDSH.ComplexFields.IsComplexFieldCode();if(Item.IsNumValue()){if(CommentsFlag!=AscCommon.comments_NoComment)aComm.Add(Y0,Y1,X,X+ItemWidthVisible, 0,0,0,0,{Active:CommentsFlag===AscCommon.comments_ActiveComment?true:false,CommentId:arrComments});else if(highlight_None!=HighLight)aHigh.Add(Y0,Y1,X,X+ItemWidthVisible,0,HighLight.r,HighLight.g,HighLight.b,undefined,HighLight);if(true===DrawSearch)aFind.Add(Y0,Y1,X,X+ItemWidthVisible,0,0,0,0);else if(null!==DrawColl)aColl.Add(Y0,Y1,X,X+ItemWidthVisible,0,DrawColl.r,DrawColl.g,DrawColl.b);X+=ItemWidthVisible}break}}if(PDSH.Hyperlink)PDSH.HyperCF.Add(Y0,Y1,X-ItemWidthVisible,X,0,0,0,0,{HyperlinkCF:PDSH.Hyperlink}); else if(PDSH.ComplexFields.IsComplexField()&&!PDSH.ComplexFields.IsComplexFieldCode()&&PDSH.Graphics.AddHyperlink){var oCF=PDSH.ComplexFields.GetREForHYPERLINK();if(oCF)PDSH.HyperCF.Add(Y0,Y1,X-ItemWidthVisible,X,0,0,0,0,{HyperlinkCF:oCF.GetInstruction()})}for(var SPos=0;SPos=this.Content.length-1&&oParent&&oParent.Content[nRunPos+1]instanceof ParaRun){var oNumPr=oParent.Content[nRunPos+1].Get_CompiledPr(false);pGraphics.SetTextPr(oNumPr,PDSE.Theme);if(oNumPr.Unifill){oNumPr.Unifill.check(PDSE.Theme,PDSE.ColorMap);RGBA=oNumPr.Unifill.getRGBAColor();pGraphics.b_color1(RGBA.R,RGBA.G,RGBA.B,RGBA.A)}else if(true===oNumPr.Color.Auto)pGraphics.b_color1(AutoColor.r,AutoColor.g,AutoColor.b,255);else pGraphics.b_color1(oNumPr.Color.r,oNumPr.Color.g,oNumPr.Color.b,255)}Item.Draw(X, Y-this.YOffset,pGraphics,PDSE);X+=Item.Get_WidthVisible()}break}}Y=TempY}PDSE.X=X};ParaRun.prototype.Draw_Lines=function(PDSL){var CurLine=PDSL.Line-this.StartLine;var CurRange=0===CurLine?PDSL.Range-this.StartRange:PDSL.Range;var StartPos=this.protected_GetRangeStartPos(CurLine,CurRange);var EndPos=this.protected_GetRangeEndPos(CurLine,CurRange);var X=PDSL.X;var Y=PDSL.Baseline;var UndOff=PDSL.UnderlineOffset;var Para=PDSL.Paragraph;var aStrikeout=PDSL.Strikeout;var aDStrikeout=PDSL.DStrikeout;var aUnderline= PDSL.Underline;var aSpelling=PDSL.Spelling;var aDUnderline=PDSL.DUnderline;var aFormBorder=PDSL.FormBorder;var oForm=this.GetParentForm();var oFormBorder=null;var nCombMax=-1;if(oForm){if(oForm.IsFormRequired()&&PDSL.GetLogicDocument().IsHighlightRequiredFields())oFormBorder=PDSL.GetLogicDocument().GetRequiredFieldsBorder();else if(oForm.GetFormPr().GetBorder())oFormBorder=oForm.GetFormPr().GetBorder();if(oForm.IsTextForm()&&oForm.GetTextFormPr().IsComb())nCombMax=oForm.GetTextFormPr().GetMaxCharacters()}var CurTextPr= this.Get_CompiledPr(false);var StrikeoutY=Y-this.YOffset;var fontCoeff=1;if(this.Type==para_Math_Run){var ArgSize=this.Parent.Compiled_ArgSz;fontCoeff=MatGetKoeffArgSize(CurTextPr.FontSize,ArgSize.value)}var UnderlineY=Y+UndOff-this.YOffset;var LineW=CurTextPr.FontSize/18*g_dKoef_pt_to_mm;switch(CurTextPr.VertAlign){case AscCommon.vertalign_Baseline:{StrikeoutY+=-CurTextPr.FontSize*fontCoeff*g_dKoef_pt_to_mm*.27;break}case AscCommon.vertalign_SubScript:{StrikeoutY+=-CurTextPr.FontSize*fontCoeff*AscCommon.vaKSize* g_dKoef_pt_to_mm*.27-AscCommon.vaKSub*CurTextPr.FontSize*fontCoeff*g_dKoef_pt_to_mm;UnderlineY-=AscCommon.vaKSub*CurTextPr.FontSize*fontCoeff*g_dKoef_pt_to_mm;break}case AscCommon.vertalign_SuperScript:{StrikeoutY+=-CurTextPr.FontSize*fontCoeff*AscCommon.vaKSize*g_dKoef_pt_to_mm*.27-AscCommon.vaKSuper*CurTextPr.FontSize*fontCoeff*g_dKoef_pt_to_mm;break}}var BgColor=PDSL.BgColor;if(undefined!==CurTextPr.Shd&&c_oAscShdNil!==CurTextPr.Shd.Value&&!(CurTextPr.FontRef&&CurTextPr.FontRef.Color))BgColor= CurTextPr.Shd.Get_Color(Para);var CurColor,RGBA,Theme=this.Paragraph.Get_Theme(),ColorMap=this.Paragraph.Get_ColorMap();var AutoColor=undefined!=BgColor&&false===BgColor.Check_BlackAutoColor()?new CDocumentColor(255,255,255,false):new CDocumentColor(0,0,0,false);if(CurTextPr.FontRef&&CurTextPr.FontRef.Color){CurTextPr.FontRef.Color.check(Theme,ColorMap);RGBA=CurTextPr.FontRef.Color.RGBA;AutoColor=new CDocumentColor(RGBA.R,RGBA.G,RGBA.B,RGBA.A)}var ReviewType=this.GetReviewType();var bAddReview=reviewtype_Add=== ReviewType?true:false;var bRemReview=reviewtype_Remove===ReviewType?true:false;var ReviewColor=this.GetReviewColor();var oReviewInfo=this.GetReviewInfo();var oRemAddInfo=oReviewInfo.GetPrevAdded();var isRemAdd=!!oRemAddInfo;var oRemAddColor=oRemAddInfo?oRemAddInfo.GetColor():REVIEW_COLOR;var bPresentation=this.Paragraph&&!this.Paragraph.bFromDocument;if(true===PDSL.VisitedHyperlink){AscFormat.G_O_VISITED_HLINK_COLOR.check(Theme,ColorMap);RGBA=AscFormat.G_O_VISITED_HLINK_COLOR.getRGBAColor();CurColor= new CDocumentColor(RGBA.R,RGBA.G,RGBA.B,RGBA.A)}else if(true===CurTextPr.Color.Auto&&!CurTextPr.Unifill)CurColor=new CDocumentColor(AutoColor.r,AutoColor.g,AutoColor.b);else if(bPresentation&&PDSL.Hyperlink){AscFormat.G_O_HLINK_COLOR.check(Theme,ColorMap);RGBA=AscFormat.G_O_HLINK_COLOR.getRGBAColor();CurColor=new CDocumentColor(RGBA.R,RGBA.G,RGBA.B,RGBA.A)}else if(CurTextPr.Unifill){CurTextPr.Unifill.check(Theme,ColorMap);RGBA=CurTextPr.Unifill.getRGBAColor();CurColor=new CDocumentColor(RGBA.R,RGBA.G, RGBA.B)}else CurColor=new CDocumentColor(CurTextPr.Color.r,CurTextPr.Color.g,CurTextPr.Color.b);PDSL.CurPos.Update(StartPos,PDSL.CurDepth);var nSpellingErrorsCounter=PDSL.GetSpellingErrorsCounter();var SpellingMarksCount=this.SpellingMarks.length;var SpellDataLen=EndPos+1;var SpellData=g_oSpellCheckerMarks.Check(SpellDataLen);var Mark=null,MarkIndex=0;for(var SPos=0;SPos.001){var nFormBorderW=oFormBorder.GetWidth();var oFormBorderColor=oFormBorder.GetColor();var oFormBounds=oForm.GetRangeBounds(PDSL.Line,PDSL.Range);if(Item.RGapCount){var nGapEnd=X+ItemWidthVisible;aFormBorder.Add(Y,Y,X,nGapEnd-Item.RGapCount*Item.RGapShift,nFormBorderW,oFormBorderColor.r,oFormBorderColor.g,oFormBorderColor.b,{Comb:nCombMax,Y:oFormBounds.Y,H:oFormBounds.H});for(var nGapIndex=0;nGapIndex=this.CompositeInput.Pos&& Pos0)aSpelling.Add(UnderlineY,UnderlineY,X,X+ItemWidthVisible,LineW,0,0,0);X+=ItemWidthVisible}break}case para_Space:{if(PDSL.Spaces> 0){if(true===bRemReview){if(oReviewInfo.IsMovedFrom())aDStrikeout.Add(StrikeoutY,StrikeoutY,X,X+ItemWidthVisible,LineW,ReviewColor.r,ReviewColor.g,ReviewColor.b);else aStrikeout.Add(StrikeoutY,StrikeoutY,X,X+ItemWidthVisible,LineW,ReviewColor.r,ReviewColor.g,ReviewColor.b);if(isRemAdd)aUnderline.Add(UnderlineY,UnderlineY,X,X+ItemWidthVisible,LineW,oRemAddColor.r,oRemAddColor.g,oRemAddColor.b)}else if(true===CurTextPr.DStrikeout)aDStrikeout.Add(StrikeoutY,StrikeoutY,X,X+ItemWidthVisible,LineW,CurColor.r, CurColor.g,CurColor.b,undefined,CurTextPr);else if(true===CurTextPr.Strikeout)aStrikeout.Add(StrikeoutY,StrikeoutY,X,X+ItemWidthVisible,LineW,CurColor.r,CurColor.g,CurColor.b,undefined,CurTextPr);if(true===bAddReview)if(oReviewInfo.IsMovedTo())aDUnderline.Add(UnderlineY,UnderlineY,X,X+ItemWidthVisible,LineW,ReviewColor.r,ReviewColor.g,ReviewColor.b);else aUnderline.Add(UnderlineY,UnderlineY,X,X+ItemWidthVisible,LineW,ReviewColor.r,ReviewColor.g,ReviewColor.b);else if(true===CurTextPr.Underline)aUnderline.Add(UnderlineY, UnderlineY,X,X+ItemWidthVisible,LineW,CurColor.r,CurColor.g,CurColor.b,undefined,CurTextPr);PDSL.Spaces--}X+=ItemWidthVisible;break}case para_Math_Text:case para_Math_BreakOperator:case para_Math_Ampersand:{if(true===bRemReview){if(oReviewInfo.IsMovedFrom())aDStrikeout.Add(StrikeoutY,StrikeoutY,X,X+ItemWidthVisible,LineW,ReviewColor.r,ReviewColor.g,ReviewColor.b,undefined,CurTextPr);else aStrikeout.Add(StrikeoutY,StrikeoutY,X,X+ItemWidthVisible,LineW,ReviewColor.r,ReviewColor.g,ReviewColor.b,undefined, CurTextPr);if(isRemAdd)aUnderline.Add(UnderlineY,UnderlineY,X,X+ItemWidthVisible,LineW,oRemAddColor.r,oRemAddColor.g,oRemAddColor.b)}else if(true===CurTextPr.DStrikeout)aDStrikeout.Add(StrikeoutY,StrikeoutY,X,X+ItemWidthVisible,LineW,CurColor.r,CurColor.g,CurColor.b,undefined,CurTextPr);else if(true===CurTextPr.Strikeout)aStrikeout.Add(StrikeoutY,StrikeoutY,X,X+ItemWidthVisible,LineW,CurColor.r,CurColor.g,CurColor.b,undefined,CurTextPr);if(true===bAddReview)if(oReviewInfo.IsMovedTo())aDUnderline.Add(UnderlineY, UnderlineY,X,X+ItemWidthVisible,LineW,ReviewColor.r,ReviewColor.g,ReviewColor.b);else aUnderline.Add(UnderlineY,UnderlineY,X,X+ItemWidthVisible,LineW,ReviewColor.r,ReviewColor.g,ReviewColor.b);X+=ItemWidthVisible;break}case para_Math_Placeholder:{var ctrPrp=this.Parent.GetCtrPrp();if(true===bRemReview){if(oReviewInfo.IsMovedFrom())aDStrikeout.Add(StrikeoutY,StrikeoutY,X,X+ItemWidthVisible,LineW,ReviewColor.r,ReviewColor.g,ReviewColor.b,undefined,CurTextPr);else aStrikeout.Add(StrikeoutY,StrikeoutY, X,X+ItemWidthVisible,LineW,ReviewColor.r,ReviewColor.g,ReviewColor.b,undefined,CurTextPr);if(isRemAdd)aUnderline.Add(UnderlineY,UnderlineY,X,X+ItemWidthVisible,LineW,oRemAddColor.r,oRemAddColor.g,oRemAddColor.b)}else if(true===ctrPrp.DStrikeout)aDStrikeout.Add(StrikeoutY,StrikeoutY,X,X+ItemWidthVisible,LineW,CurColor.r,CurColor.g,CurColor.b,undefined,CurTextPr);else if(true===ctrPrp.Strikeout)aStrikeout.Add(StrikeoutY,StrikeoutY,X,X+ItemWidthVisible,LineW,CurColor.r,CurColor.g,CurColor.b,undefined, CurTextPr);if(true===bAddReview)if(oReviewInfo.IsMovedTo())aDUnderline.Add(UnderlineY,UnderlineY,X,X+ItemWidthVisible,LineW,ReviewColor.r,ReviewColor.g,ReviewColor.b);else aUnderline.Add(UnderlineY,UnderlineY,X,X+ItemWidthVisible,LineW,ReviewColor.r,ReviewColor.g,ReviewColor.b);X+=ItemWidthVisible;break}case para_FieldChar:{PDSL.ComplexFields.ProcessFieldChar(Item);isHiddenCFPart=PDSL.ComplexFields.IsComplexFieldCode();if(Item.IsNumValue()){if(true===bRemReview){if(oReviewInfo.IsMovedFrom())aDStrikeout.Add(StrikeoutY, StrikeoutY,X,X+ItemWidthVisible,LineW,ReviewColor.r,ReviewColor.g,ReviewColor.b);else aStrikeout.Add(StrikeoutY,StrikeoutY,X,X+ItemWidthVisible,LineW,ReviewColor.r,ReviewColor.g,ReviewColor.b);if(isRemAdd)aUnderline.Add(UnderlineY,UnderlineY,X,X+ItemWidthVisible,LineW,oRemAddColor.r,oRemAddColor.g,oRemAddColor.b)}else if(true===CurTextPr.DStrikeout)aDStrikeout.Add(StrikeoutY,StrikeoutY,X,X+ItemWidthVisible,LineW,CurColor.r,CurColor.g,CurColor.b,undefined,CurTextPr);else if(true===CurTextPr.Strikeout)aStrikeout.Add(StrikeoutY, StrikeoutY,X,X+ItemWidthVisible,LineW,CurColor.r,CurColor.g,CurColor.b,undefined,CurTextPr);if(true===bAddReview)if(oReviewInfo.IsMovedTo())aDUnderline.Add(UnderlineY,UnderlineY,X,X+ItemWidthVisible,LineW,ReviewColor.r,ReviewColor.g,ReviewColor.b);else aUnderline.Add(UnderlineY,UnderlineY,X,X+ItemWidthVisible,LineW,ReviewColor.r,ReviewColor.g,ReviewColor.b);else if(true===CurTextPr.Underline)aUnderline.Add(UnderlineY,UnderlineY,X,X+ItemWidthVisible,LineW,CurColor.r,CurColor.g,CurColor.b,undefined, CurTextPr);if(nSpellingErrorsCounter>0)aSpelling.Add(UnderlineY,UnderlineY,X,X+ItemWidthVisible,LineW,0,0,0);X+=ItemWidthVisible}break}}}if(true===this.Pr.HavePrChange()&¶_Math_Run!==this.Type){var ReviewColor=this.GetPrReviewColor();PDSL.RunReview.Add(0,0,PDSL.X,X,0,ReviewColor.r,ReviewColor.g,ReviewColor.b,{RunPr:this.Pr})}var CollPrChangeColor=this.private_GetCollPrChangeOther();if(false!==CollPrChangeColor)PDSL.CollChange.Add(0,0,PDSL.X,X,0,CollPrChangeColor.r,CollPrChangeColor.g,CollPrChangeColor.b, {RunPr:this.Pr});PDSL.X=X};ParaRun.prototype.SkipDraw=function(PDS){var CurLine=PDS.Line-this.StartLine;var CurRange=0===CurLine?PDS.Range-this.StartRange:PDS.Range;var StartPos=this.protected_GetRangeStartPos(CurLine,CurRange);var EndPos=this.protected_GetRangeEndPos(CurLine,CurRange);var X=PDS.X;for(var Pos=StartPos;Pos=this.Content.length)return true;return false}; ParaRun.prototype.IsCursorAtBegin=function(){return this.Cursor_Is_Start()};ParaRun.prototype.IsCursorAtEnd=function(){return this.Cursor_Is_End()};ParaRun.prototype.MoveCursorToStartPos=function(){this.State.ContentPos=0};ParaRun.prototype.MoveCursorToEndPos=function(SelectFromEnd){if(true===SelectFromEnd){var Selection=this.State.Selection;Selection.Use=true;Selection.StartPos=this.Content.length;Selection.EndPos=this.Content.length}else{var CurPos=this.Content.length;while(CurPos>0)if(para_End=== this.Content[CurPos-1].Type)CurPos--;else break;this.State.ContentPos=CurPos}};ParaRun.prototype.Get_ParaContentPosByXY=function(SearchPos,Depth,_CurLine,_CurRange,StepEnd){var Result=false;var CurLine=_CurLine-this.StartLine;var CurRange=0===CurLine?_CurRange-this.StartRange:_CurRange;var StartPos=this.protected_GetRangeStartPos(CurLine,CurRange);var EndPos=this.protected_GetRangeEndPos(CurLine,CurRange);var CurPos=StartPos;var InMathText=this.Type==para_Math_Run?SearchPos.InText==true:false;if(CurPos>= EndPos){var Diff=SearchPos.X-SearchPos.CurX;if((Diff<=0&&Math.abs(Diff)0&&DiffSearchPos.CurX)&&InMathText==false){SearchPos.DiffX=Math.abs(Diff);SearchPos.Pos.Update(CurPos,Depth);Result=true}}else for(;CurPos0&&DiffSearchPos.CurX)&&InMathText==false){SearchPos.DiffX=Math.abs(Diff);SearchPos.Pos.Update(CurPos,Depth);Result=true;if(Diff>=-.001&&Diff<=TempDx+.001){SearchPos.InTextPos.Update(CurPos,Depth); SearchPos.InText=true}}if(Item.RGap)TempDx-=Item.RGap;SearchPos.CurX+=TempDx;Diff=SearchPos.X-SearchPos.CurX;if(Math.abs(Diff)SearchPos.CurX)&&InMathText==false){if(Item.RGap)Diff=Math.min(Diff,Diff-Item.RGap);if(para_End===ItemType){SearchPos.End=true;if(true===StepEnd){SearchPos.DiffX=Math.abs(Diff);SearchPos.Pos.Update(this.Content.length,Depth);Result=true}}else if(CurPos===EndPos-1&¶_NewLine!=ItemType){SearchPos.DiffX=Math.abs(Diff); SearchPos.Pos.Update(EndPos,Depth);Result=true}}if(Item.RGap)SearchPos.CurX+=Item.RGap}if(SearchPos.DiffX>1E6-1){SearchPos.DiffX=SearchPos.X-SearchPos.CurX;SearchPos.Pos.Update(StartPos,Depth);Result=true}if(this.Type==para_Math_Run){var bEmpty=this.Is_Empty();var PosLine=this.ParaMath.GetLinePosition(_CurLine,_CurRange);if(bEmpty)SearchPos.CurX=PosLine.x+this.pos.x;Diff=SearchPos.X-SearchPos.CurX;if(SearchPos.InText==false&&(bEmpty||StartPos!==EndPos)&&(Math.abs(Diff)SearchPos.CurX))){SearchPos.DiffX=Math.abs(Diff);SearchPos.Pos.Update(CurPos,Depth);Result=true}}return Result};ParaRun.prototype.Get_ParaContentPos=function(bSelection,bStart,ContentPos,bUseCorrection){var Pos=true!==bSelection?this.State.ContentPos:false!==bStart?this.State.Selection.StartPos:this.State.Selection.EndPos;if(Pos<0)Pos=0;if(Pos>this.Content.length)Pos=this.Content.length;ContentPos.Add(Pos)};ParaRun.prototype.Set_ParaContentPos=function(ContentPos,Depth){var Pos=ContentPos.Get(Depth); var Count=this.Content.length;if(Pos>Count)Pos=Count;for(var TempPos=0;TempPos=this.Content.length||CurPos<0)return null;return this.Content[CurPos]}else if(this.Content.length>0)return this.Content[0];else return null};ParaRun.prototype.Get_LastRunInRange=function(_CurLine,_CurRange){var CurLine=_CurLine-this.StartLine;var CurRange=0===CurLine?_CurRange-this.StartRange:_CurRange; return this};ParaRun.prototype.Get_LeftPos=function(SearchPos,ContentPos,Depth,UseContentPos){var CurPos=true===UseContentPos?ContentPos.Get(Depth):this.Content.length;var isFieldCode=SearchPos.IsComplexFieldCode();var isFieldValue=SearchPos.IsComplexFieldValue();var isHiddenCF=SearchPos.IsHiddenComplexField();while(true){CurPos--;var Item=this.private_CheckInstrText(this.Content[CurPos]);if(CurPos>=0&¶_FieldChar===Item.Type){SearchPos.ProcessComplexFieldChar(-1,Item);isFieldCode=SearchPos.IsComplexFieldCode(); isFieldValue=SearchPos.IsComplexFieldValue();isHiddenCF=SearchPos.IsHiddenComplexField()}if(CurPos>=0&&(isFieldCode||isHiddenCF||Item.IsDiacriticalSymbol&&Item.IsDiacriticalSymbol()))continue;if(CurPos<0||!(para_Drawing===Item.Type&&false===Item.Is_Inline()&&false===SearchPos.IsCheckAnchors())&&!((para_FootnoteReference===Item.Type||para_EndnoteReference===Item.Type)&&true===Item.IsCustomMarkFollows()))break}if(CurPos>=0){SearchPos.Found=true;SearchPos.Pos.Update(CurPos,Depth)}};ParaRun.prototype.Get_RightPos= function(SearchPos,ContentPos,Depth,UseContentPos,StepEnd){var CurPos=true===UseContentPos?ContentPos.Get(Depth):0;var isFieldCode=SearchPos.IsComplexFieldCode();var isFieldValue=SearchPos.IsComplexFieldValue();var isHiddenCF=SearchPos.IsHiddenComplexField();var Count=this.Content.length;while(true){CurPos++;if(Count===CurPos){if(CurPos===0)return;var PrevItem=this.private_CheckInstrText(this.Content[CurPos-1]);var PrevItemType=PrevItem.Type;if(para_FieldChar===PrevItem.Type){SearchPos.ProcessComplexFieldChar(1, PrevItem);isFieldCode=SearchPos.IsComplexFieldCode();isFieldValue=SearchPos.IsComplexFieldValue();isHiddenCF=SearchPos.IsHiddenComplexField()}if(isFieldCode||isHiddenCF)return;if(true!==StepEnd&¶_End===PrevItemType||para_Drawing===PrevItemType&&false===PrevItem.Is_Inline()&&false===SearchPos.IsCheckAnchors()||(para_FootnoteReference===PrevItemType||para_EndnoteReference===PrevItemType)&&true===PrevItem.IsCustomMarkFollows())return;break}if(CurPos>Count)break;if(this.Content[CurPos]&&this.Content[CurPos].IsDiacriticalSymbol&& this.Content[CurPos].IsDiacriticalSymbol())continue;var Item=this.private_CheckInstrText(this.Content[CurPos-1]);var ItemType=Item.Type;if(para_FieldChar===Item.Type){SearchPos.ProcessComplexFieldChar(1,Item);isFieldCode=SearchPos.IsComplexFieldCode();isFieldValue=SearchPos.IsComplexFieldValue();isHiddenCF=SearchPos.IsHiddenComplexField()}if(isFieldCode||isHiddenCF)continue;if(!(true!==StepEnd&¶_End===ItemType)&&!(para_Drawing===Item.Type&&false===Item.Is_Inline())&&!((para_FootnoteReference=== Item.Type||para_EndnoteReference===Item.Type)&&true===Item.IsCustomMarkFollows()))break}if(CurPos<=Count){SearchPos.Found=true;SearchPos.Pos.Update(CurPos,Depth)}};ParaRun.prototype.Get_WordStartPos=function(SearchPos,ContentPos,Depth,UseContentPos){var CurPos=true===UseContentPos?ContentPos.Get(Depth)-1:this.Content.length-1;SearchPos.UpdatePos=false;if(CurPos<0||this.Content.length<=0)return;SearchPos.Shift=true;var isFieldCode=SearchPos.IsComplexFieldCode();var isFieldValue=SearchPos.IsComplexFieldValue(); var isHiddenCF=SearchPos.IsHiddenComplexField();if(0===SearchPos.Stage)while(true){var Item=this.private_CheckInstrText(this.Content[CurPos]);var Type=Item.Type;var bSpace=false;if(para_FieldChar===Type){SearchPos.ProcessComplexFieldChar(-1,Item);isFieldCode=SearchPos.IsComplexFieldCode();isFieldValue=SearchPos.IsComplexFieldValue();isHiddenCF=SearchPos.IsHiddenComplexField()}if(para_Space===Type||para_Tab===Type||para_Text===Type&&true===Item.Is_NBSP()||para_Drawing===Type&&true!==Item.Is_Inline())bSpace= true;if(true===bSpace||isFieldCode||isHiddenCF){CurPos--;if(CurPos<0){SearchPos.Pos.Update(0,Depth);SearchPos.UpdatePos=true;return}}else{if(para_Text!==this.Content[CurPos].Type&¶_Math_Text!==this.Content[CurPos].Type){SearchPos.Pos.Update(CurPos,Depth);SearchPos.Found=true;SearchPos.UpdatePos=true;return}SearchPos.Pos.Update(CurPos,Depth);SearchPos.Stage=1;SearchPos.Punctuation=this.Content[CurPos].IsPunctuation();SearchPos.UpdatePos=true;break}}else CurPos=true===UseContentPos?ContentPos.Get(Depth): this.Content.length;while(CurPos>0){CurPos--;var Item=this.private_CheckInstrText(this.Content[CurPos]);var TempType=Item.Type;if(para_FieldChar===Item.Type){SearchPos.ProcessComplexFieldChar(-1,Item);isFieldCode=SearchPos.IsComplexFieldCode();isFieldValue=SearchPos.IsComplexFieldValue();isHiddenCF=SearchPos.IsHiddenComplexField()}if(isFieldCode||isHiddenCF)continue;if(para_Text!==TempType&¶_Math_Text!==TempType||true===Item.Is_NBSP()||true===SearchPos.Punctuation&&true!==Item.IsPunctuation()|| false===SearchPos.Punctuation&&false!==Item.IsPunctuation()){SearchPos.Found=true;break}else{SearchPos.Pos.Update(CurPos,Depth);SearchPos.UpdatePos=true}}};ParaRun.prototype.Get_WordEndPos=function(SearchPos,ContentPos,Depth,UseContentPos,StepEnd){var CurPos=true===UseContentPos?ContentPos.Get(Depth):0;SearchPos.UpdatePos=false;var ContentLen=this.Content.length;if(CurPos>=ContentLen||ContentLen<=0)return;var isFieldCode=SearchPos.IsComplexFieldCode();var isFieldValue=SearchPos.IsComplexFieldValue(); var isHiddenCF=SearchPos.IsHiddenComplexField();if(0===SearchPos.Stage)while(true){var Item=this.private_CheckInstrText(this.Content[CurPos]);var Type=Item.Type;var bText=false;if(para_FieldChar===Type){SearchPos.ProcessComplexFieldChar(1,Item);isFieldCode=SearchPos.IsComplexFieldCode();isFieldValue=SearchPos.IsComplexFieldValue();isHiddenCF=SearchPos.IsHiddenComplexField()}if((para_Text===Type||para_Math_Text===Type)&&true!=Item.Is_NBSP()&&(true===SearchPos.First||SearchPos.Punctuation===Item.IsPunctuation()))bText= true;if(true===bText||isFieldCode||isHiddenCF){if(!isFieldCode&&!isHiddenCF){if(true===SearchPos.First){SearchPos.First=false;SearchPos.Punctuation=Item.IsPunctuation()}SearchPos.Shift=true}CurPos++;if(CurPos>=ContentLen){SearchPos.Pos.Update(CurPos,Depth);SearchPos.UpdatePos=true;return}}else{SearchPos.Stage=1;if(true===SearchPos.First){if(para_End===Type){if(true===StepEnd){SearchPos.Pos.Update(CurPos+1,Depth);SearchPos.Found=true;SearchPos.UpdatePos=true}return}CurPos++;SearchPos.Shift=true}if(SearchPos.IsTrimSpaces()){SearchPos.Pos.Update(CurPos, Depth);SearchPos.Found=true;SearchPos.UpdatePos=true;return}break}}if(CurPos>=ContentLen){SearchPos.Pos.Update(CurPos,Depth);SearchPos.UpdatePos=true;return}if(!(para_Space===this.Content[CurPos].Type||para_Text===this.Content[CurPos].Type&&true===this.Content[CurPos].Is_NBSP())){SearchPos.Pos.Update(CurPos,Depth);SearchPos.Found=true;SearchPos.UpdatePos=true}else{while(CurPos=StartPos;CurPos--){var Item=this.Content[CurPos];if(!(para_Drawing===Item.Type&&true!==Item.Is_Inline()))FirstPos=CurPos}if(-1!== FirstPos){SearchPos.Pos.Update(FirstPos,Depth);return true}else return false};ParaRun.prototype.Get_StartRangePos2=function(_CurLine,_CurRange,ContentPos,Depth){var CurLine=_CurLine-this.StartLine;var CurRange=0===CurLine?_CurRange-this.StartRange:_CurRange;var Pos=this.protected_GetRangeStartPos(CurLine,CurRange);ContentPos.Update(Pos,Depth)};ParaRun.prototype.Get_EndRangePos2=function(_CurLine,_CurRange,ContentPos,Depth){var CurLine=_CurLine-this.StartLine;var CurRange=0===CurLine?_CurRange-this.StartRange: _CurRange;var Pos=this.protected_GetRangeEndPos(CurLine,CurRange);ContentPos.Update(Pos,Depth)};ParaRun.prototype.Get_StartPos=function(ContentPos,Depth){ContentPos.Update(0,Depth)};ParaRun.prototype.Get_EndPos=function(BehindEnd,ContentPos,Depth){var ContentLen=this.Content.length;if(true===BehindEnd)ContentPos.Update(ContentLen,Depth);else{for(var CurPos=0;CurPos0&&Pos>=nLen&¶_End===this.Content[nLen-1].Type)Pos=nLen-1;this.State.ContentPos=Pos};ParaRun.prototype.Set_SelectionAtEndPos=function(){this.Set_SelectionContentPos(null,null,0,-1,-1)};ParaRun.prototype.Set_SelectionAtStartPos=function(){this.Set_SelectionContentPos(null,null,0,1,1)};ParaRun.prototype.IsSelectionUse=function(){return this.State.Selection.Use}; ParaRun.prototype.IsSelectedAll=function(Props){var Selection=this.State.Selection;if(false===Selection.Use&&true!==this.Is_Empty(Props))return false;var SkipAnchor=Props?Props.SkipAnchor:false;var SkipEnd=Props?Props.SkipEnd:false;var StartPos=Selection.StartPos;var EndPos=Selection.EndPos;if(EndPosSelectionEndPos){SelectionStartPos=Selection.EndPos;SelectionEndPos=Selection.StartPos}var FindStart=SelectionDraw.FindStart;for(var CurPos=StartPos;CurPos=SelectionStartPos&&CurPos=SelectionStartPos&&CurPosEndPos){StartPos=Selection.EndPos;EndPos=Selection.StartPos}if(true===CheckEnd)return EndPos>StartPos?false:true;else if(this.Type==para_Math_Run&&this.Is_Empty())return false;else for(var CurPos=StartPos;CurPosEndPos){StartPos=Selection.EndPos;EndPos=Selection.StartPos}for(var CurPos=StartPos;CurPosthis.Selection.EndPos&&this.Selection.EndPos<=CurPos&&CurPos<=this.Selection.StartPos)if(true!==bEnd||true===bEnd&&CurPos!==this.Selection.StartPos)return true;return false};ParaRun.prototype.Clear_TextFormatting= function(DefHyper){this.Set_Bold(undefined);this.Set_Italic(undefined);this.Set_Strikeout(undefined);this.Set_Underline(undefined);this.Set_FontSize(undefined);this.Set_Color(undefined);this.Set_Unifill(undefined);this.Set_VertAlign(undefined);this.Set_Spacing(undefined);this.Set_DStrikeout(undefined);this.Set_Caps(undefined);this.Set_SmallCaps(undefined);this.Set_Position(undefined);this.Set_RFonts2(undefined);this.Set_RStyle(undefined);this.Set_Shd(undefined);this.Set_TextFill(undefined);this.Set_TextOutline(undefined); this.Recalc_CompiledPr(true)};ParaRun.prototype.Get_TextPr=function(){return this.Pr.Copy()};ParaRun.prototype.GetTextPr=function(){return this.Pr.Copy()};ParaRun.prototype.Get_FirstTextPr=function(){return this.Pr};ParaRun.prototype.Get_CompiledTextPr=function(Copy){if(true===this.State.Selection.Use&&true===this.Selection_CheckParaEnd()){var oRunTextPr=this.Get_CompiledPr(true);var oEndTextPr=this.Paragraph.GetParaEndCompiledPr();oRunTextPr=oRunTextPr.Compare(oEndTextPr);return oRunTextPr}else return this.Get_CompiledPr(Copy)}; ParaRun.prototype.GetDirectTextPr=function(){return this.Pr};ParaRun.prototype.Recalc_CompiledPr=function(RecalcMeasure){this.RecalcInfo.TextPr=true;if(true===RecalcMeasure)this.RecalcInfo.Measure=true;this.private_RecalcCtrPrp()};ParaRun.prototype.Recalc_RunsCompiledPr=function(){this.Recalc_CompiledPr(true)};ParaRun.prototype.Get_CompiledPr=function(bCopy){if(this.IsStyleHyperlink()&&this.IsInHyperlinkInTOC())this.RecalcInfo.TextPr=true;if(true===this.RecalcInfo.TextPr){this.RecalcInfo.TextPr=false; this.CompiledPr=this.Internal_Compile_Pr()}if(false===bCopy)return this.CompiledPr;else return this.CompiledPr.Copy()};ParaRun.prototype.Internal_Compile_Pr=function(){if(undefined===this.Paragraph||null===this.Paragraph){var TextPr=new CTextPr;TextPr.InitDefault();this.RecalcInfo.TextPr=true;return TextPr}var TextPr=this.Paragraph.Get_CompiledPr2(false).TextPr.Copy();if(undefined!==this.Pr.RStyle)if(!this.IsStyleHyperlink()||!this.IsInHyperlinkInTOC()){var Styles=this.Paragraph.Parent.Get_Styles(); var StyleTextPr=Styles.Get_Pr(this.Pr.RStyle,styletype_Character).TextPr;TextPr.Merge(StyleTextPr)}if(this.Type==para_Math_Run){if(undefined===this.Parent||null===this.Parent){var TextPr=new CTextPr;TextPr.InitDefault();this.RecalcInfo.TextPr=true;return TextPr}if(!this.IsNormalText()){var Styles=this.Paragraph.Parent.Get_Styles();var StyleId=this.Paragraph.Style_Get();var MathFont={Name:"Cambria Math",Index:-1};var oShapeStyle=null,oShapeTextPr=null;if(Styles&&typeof Styles.lastId==="string"){StyleId= Styles.lastId;Styles=Styles.styles;oShapeStyle=Styles.Get(StyleId);oShapeTextPr=oShapeStyle.TextPr.Copy();oShapeStyle.TextPr.RFonts.Merge({Ascii:MathFont})}var StyleDefaultTextPr=Styles.Default.TextPr.Copy();Styles.Default.TextPr.RFonts.Merge({Ascii:MathFont});var Pr=Styles.Get_Pr(StyleId,styletype_Paragraph,null,null);TextPr.RFonts.Set_FromObject(Pr.TextPr.RFonts);Styles.Default.TextPr=StyleDefaultTextPr;if(oShapeStyle&&oShapeTextPr)oShapeStyle.TextPr=oShapeTextPr}if(this.IsPlaceholder()){TextPr.Merge(this.Parent.GetCtrPrp()); TextPr.Merge(this.Pr)}else{TextPr.Merge(this.Pr);if(!this.IsNormalText()){var MPrp=this.MathPrp.GetTxtPrp();TextPr.Merge(MPrp)}}}else{var FontScale=TextPr.FontScale;TextPr.Merge(this.Pr);TextPr.FontScale=FontScale;if(this.Pr.Color&&!this.Pr.Unifill)TextPr.Unifill=undefined}var oTheme=this.Paragraph.Get_Theme();var oColorMap=this.Paragraph.Get_ColorMap();if(oTheme&&oColorMap){if(TextPr.TextFill)TextPr.TextFill.check(oTheme,oColorMap);else if(TextPr.Unifill)TextPr.Unifill.check(oTheme,oColorMap);TextPr.ReplaceThemeFonts(oTheme.themeElements.fontScheme)}TextPr.CheckFontScale(); TextPr.FontFamily.Name=TextPr.RFonts.Ascii.Name;TextPr.FontFamily.Index=TextPr.RFonts.Ascii.Index;if(this.Paragraph.IsInFixedForm())TextPr.Position=0;return TextPr};ParaRun.prototype.IsStyleHyperlink=function(){if(!this.Paragraph||!this.Paragraph.bFromDocument||!this.Paragraph.LogicDocument||!this.Paragraph.LogicDocument.Get_Styles()||!this.Paragraph.LogicDocument.Get_Styles().GetDefaultHyperlink)return false;return this.Pr.RStyle===this.Paragraph.LogicDocument.Get_Styles().GetDefaultHyperlink()? true:false};ParaRun.prototype.IsInHyperlinkInTOC=function(){var oParagraph=this.GetParagraph();if(!oParagraph||!oParagraph.bFromDocument)return false;var oPos=oParagraph.Get_PosByElement(this);if(!oPos)return false;var isHyperlink=false;var arrClasses=oParagraph.Get_ClassesByPos(oPos);for(var nIndex=0,nCount=arrClasses.length;nIndexEndPos){var Temp=StartPos;StartPos=EndPos;EndPos=Temp;Direction=-1}if(EndPos0){CRun=LRun.Split_Run(StartPos);CRun.SetReviewType(ReviewType);if(IsPrChange)CRun.AddPrChange()}else{CRun=LRun;LRun=null}if(null!==LRun){LRun.Selection.Use=true;LRun.Selection.StartPos=LRun.Content.length;LRun.Selection.EndPos=LRun.Content.length}CRun.SelectAll(Direction); if(true===bReview&&true!==CRun.HavePrChange())CRun.AddPrChange();if(undefined===IncFontSize)CRun.Apply_Pr(TextPr);else{var _TextPr=new CTextPr;var CurTextPr=this.Get_CompiledPr(false);CRun.private_AddCollPrChangeMine();CRun.Set_FontSize(CurTextPr.GetIncDecFontSize(IncFontSize))}if(null!==RRun){RRun.Selection.Use=true;RRun.Selection.StartPos=0;RRun.Selection.EndPos=0}if(true===this.Selection_CheckParaEnd())if(undefined===IncFontSize)if(!TextPr.AscFill&&!TextPr.AscLine&&!TextPr.AscUnifill)this.Paragraph.TextPr.Apply_TextPr(TextPr); else{var oEndTextPr=this.Paragraph.GetParaEndCompiledPr();if(TextPr.AscFill)this.Paragraph.TextPr.Set_TextFill(AscFormat.CorrectUniFill(TextPr.AscFill,oEndTextPr.TextFill,1));if(TextPr.AscUnifill)this.Paragraph.TextPr.Set_Unifill(AscFormat.CorrectUniFill(TextPr.AscUnifill,oEndTextPr.Unifill,0));if(TextPr.AscLine)this.Paragraph.TextPr.Set_TextOutline(AscFormat.CorrectUniStroke(TextPr.AscLine,oEndTextPr.TextOutline,0))}else{var oEndTextPr=this.Paragraph.GetParaEndCompiledPr();this.Paragraph.TextPr.Set_FontSize(oEndTextPr.GetIncDecFontSize(IncFontSize))}}}else{var CurPos= this.State.ContentPos;if(CurPos0){CRun=LRun.Split_Run(CurPos);CRun.SetReviewType(ReviewType);if(IsPrChange)CRun.AddPrChange()}else{CRun=LRun;LRun=null}if(null!==LRun)LRun.RemoveSelection();CRun.RemoveSelection();CRun.MoveCursorToStartPos();if(true===bReview&&true!==CRun.HavePrChange())CRun.AddPrChange();if(undefined===IncFontSize)CRun.Apply_Pr(TextPr);else{var _TextPr=new CTextPr; var CurTextPr=this.Get_CompiledPr(false);CRun.private_AddCollPrChangeMine();CRun.Set_FontSize(CurTextPr.GetIncDecFontSize(IncFontSize))}if(null!==RRun)RRun.RemoveSelection()}Result.push(LRun);Result.push(CRun);Result.push(RRun);return Result}};ParaRun.prototype.Split_Run=function(Pos){History.Add(new CChangesRunOnStartSplit(this,Pos));AscCommon.CollaborativeEditing.OnStart_SplitRun(this,Pos);var bMathRun=this.Type==para_Math_Run;var NewRun=new ParaRun(this.Paragraph,bMathRun);NewRun.Set_Pr(this.Pr.Copy(true)); if(bMathRun)NewRun.Set_MathPr(this.MathPrp.Copy());var OldCrPos=this.State.ContentPos;var OldSSPos=this.State.Selection.StartPos;var OldSEPos=this.State.Selection.EndPos;NewRun.ConcatToContent(this.Content.slice(Pos));this.Remove_FromContent(Pos,this.Content.length-Pos,true);if(OldCrPos>=Pos){NewRun.State.ContentPos=OldCrPos-Pos;this.State.ContentPos=this.Content.length}else NewRun.State.ContentPos=0;if(OldSSPos>=Pos){NewRun.State.Selection.StartPos=OldSSPos-Pos;this.State.Selection.StartPos=this.Content.length}else NewRun.State.Selection.StartPos= 0;if(OldSEPos>=Pos){NewRun.State.Selection.EndPos=OldSEPos-Pos;this.State.Selection.EndPos=this.Content.length}else NewRun.State.Selection.EndPos=0;var SpellingMarksCount=this.SpellingMarks.length;for(var Index=0;Index=Pos){var MarkElement=Mark.Element;if(true===Mark.Start)MarkElement.StartPos.Data[Mark.Depth]-=Pos;else MarkElement.EndPos.Data[Mark.Depth]-= Pos;NewRun.SpellingMarks.push(Mark);this.SpellingMarks.splice(Index,1);SpellingMarksCount--;Index--}}History.Add(new CChangesRunOnEndSplit(this,NewRun));AscCommon.CollaborativeEditing.OnEnd_SplitRun(NewRun);return NewRun};ParaRun.prototype.Clear_TextPr=function(){var NewTextPr=new CTextPr;NewTextPr.Lang=this.Pr.Lang.Copy();NewTextPr.HighLight=this.Pr.Copy_HighLight();this.Set_Pr(NewTextPr)};ParaRun.prototype.Apply_Pr=function(TextPr){this.private_AddCollPrChangeMine();if(this.Type==para_Math_Run&& false===this.IsNormalText())if(null===TextPr.Bold&&null===TextPr.Italic)this.Math_Apply_Style(undefined);else{if(undefined!=TextPr.Bold)if(TextPr.Bold==true)if(this.MathPrp.sty==STY_ITALIC||this.MathPrp.sty==undefined)this.Math_Apply_Style(STY_BI);else{if(this.MathPrp.sty==STY_PLAIN)this.Math_Apply_Style(STY_BOLD)}else if(TextPr.Bold==false||TextPr.Bold==null)if(this.MathPrp.sty==STY_BI||this.MathPrp.sty==undefined)this.Math_Apply_Style(STY_ITALIC);else if(this.MathPrp.sty==STY_BOLD)this.Math_Apply_Style(STY_PLAIN); if(undefined!=TextPr.Italic)if(TextPr.Italic==true)if(this.MathPrp.sty==STY_BOLD)this.Math_Apply_Style(STY_BI);else{if(this.MathPrp.sty==STY_PLAIN||this.MathPrp.sty==undefined)this.Math_Apply_Style(STY_ITALIC)}else if(TextPr.Italic==false||TextPr.Italic==null)if(this.MathPrp.sty==STY_BI)this.Math_Apply_Style(STY_BOLD);else if(this.MathPrp.sty==STY_ITALIC||this.MathPrp.sty==undefined)this.Math_Apply_Style(STY_PLAIN)}else{if(undefined!==TextPr.Bold)this.Set_Bold(null===TextPr.Bold?undefined:TextPr.Bold); if(undefined!==TextPr.Italic)this.Set_Italic(null===TextPr.Italic?undefined:TextPr.Italic)}if(undefined!==TextPr.Strikeout)this.Set_Strikeout(null===TextPr.Strikeout?undefined:TextPr.Strikeout);if(undefined!==TextPr.Underline)this.Set_Underline(null===TextPr.Underline?undefined:TextPr.Underline);if(undefined!==TextPr.FontSize)this.Set_FontSize(null===TextPr.FontSize?undefined:TextPr.FontSize);var oCompiledPr;if(undefined!==TextPr.AscUnifill&&null!==TextPr.AscUnifill){if(this.Paragraph&&!this.Paragraph.bFromDocument){oCompiledPr= this.Get_CompiledPr(true);this.Set_Unifill(AscFormat.CorrectUniFill(TextPr.AscUnifill,oCompiledPr.Unifill,0),AscCommon.isRealObject(TextPr.AscUnifill)&&TextPr.AscUnifill.asc_CheckForseSet());this.Set_Color(undefined);this.Set_TextFill(undefined)}}else if(undefined!==TextPr.AscFill&&null!==TextPr.AscFill){var oMergeUnifill,oColor;if(this.Paragraph&&this.Paragraph.bFromDocument){oCompiledPr=this.Get_CompiledPr(true);if(oCompiledPr.TextFill)oMergeUnifill=oCompiledPr.TextFill;else if(oCompiledPr.Unifill)oMergeUnifill= oCompiledPr.Unifill;else if(oCompiledPr.Color){oColor=oCompiledPr.Color;oMergeUnifill=AscFormat.CreateUnfilFromRGB(oColor.r,oColor.g,oColor.b)}this.Set_Unifill(undefined);this.Set_Color(undefined);this.Set_TextFill(AscFormat.CorrectUniFill(TextPr.AscFill,oMergeUnifill,1),AscCommon.isRealObject(TextPr.AscFill)&&TextPr.AscFill.asc_CheckForseSet())}}else{if(undefined!==TextPr.Color){this.Set_Color(null===TextPr.Color?undefined:TextPr.Color);if(null!==TextPr.Colornull){this.Set_Unifill(undefined);this.Set_TextFill(undefined)}}if(undefined!== TextPr.Unifill){this.Set_Unifill(null===TextPr.Unifill?undefined:TextPr.Unifill);if(null!==TextPr.Unifill){this.Set_Color(undefined);this.Set_TextFill(undefined)}}if(undefined!==TextPr.TextFill){this.Set_TextFill(null===TextPr.TextFill?undefined:TextPr.TextFill);if(null!==TextPr.TextFill){this.Set_Unifill(undefined);this.Set_Color(undefined)}}}if(undefined!==TextPr.AscLine){if(this.Paragraph){oCompiledPr=this.Get_CompiledPr(true);this.Set_TextOutline(AscFormat.CorrectUniStroke(TextPr.AscLine,oCompiledPr.TextOutline, 0))}}else if(undefined!==TextPr.TextOutline)this.Set_TextOutline(null===TextPr.TextOutline?undefined:TextPr.TextOutline);if(undefined!==TextPr.VertAlign)this.Set_VertAlign(null===TextPr.VertAlign?undefined:TextPr.VertAlign);if(undefined!==TextPr.HighLight)this.Set_HighLight(null===TextPr.HighLight?undefined:TextPr.HighLight);if(undefined!==TextPr.HighlightColor)this.SetHighlightColor(null===TextPr.HighlightColor?undefined:TextPr.HighlightColor);if(undefined!==TextPr.RStyle)this.Set_RStyle(null=== TextPr.RStyle?undefined:TextPr.RStyle);if(undefined!==TextPr.Spacing)this.Set_Spacing(null===TextPr.Spacing?undefined:TextPr.Spacing);if(undefined!==TextPr.DStrikeout)this.Set_DStrikeout(null===TextPr.DStrikeout?undefined:TextPr.DStrikeout);if(undefined!==TextPr.Caps)this.Set_Caps(null===TextPr.Caps?undefined:TextPr.Caps);if(undefined!==TextPr.SmallCaps)this.Set_SmallCaps(null===TextPr.SmallCaps?undefined:TextPr.SmallCaps);if(undefined!==TextPr.Position)this.Set_Position(null===TextPr.Position?undefined: TextPr.Position);if(undefined!==TextPr.RFonts&&!this.IsInCheckBox())if(para_Math_Run===this.Type&&!this.IsNormalText()){if(TextPr.RFonts.Ascii!==undefined||TextPr.RFonts.HAnsi!==undefined){var RFonts=new CRFonts;RFonts.SetAll("Cambria Math",-1);this.Set_RFonts2(RFonts)}}else this.Set_RFonts2(TextPr.RFonts);if(undefined!==TextPr.Lang)this.Set_Lang2(TextPr.Lang);if(undefined!==TextPr.Shd)this.Set_Shd(null===TextPr.Shd?undefined:TextPr.Shd);for(var nPos=0,nCount=this.Content.length;nPos=0;--nPos){var oItem=this.Content[nPos];if(para_RevisionMove===oItem.Type)if(sMoveId===oItem.GetMarkId()){if(isFrom===oItem.IsFrom())this.RemoveFromContent(nPos,1,true)}else oTrackMove.RegisterOtherMove(oItem.GetMarkId())}};ParaRun.prototype.private_RecalcCtrPrp=function(){if(para_Math_Run===this.Type&&undefined!==this.Parent&& null!==this.Parent&&null!==this.Parent.ParaMath)this.Parent.ParaMath.SetRecalcCtrPrp(this)};function CParaRunSelection(){this.Use=false;this.StartPos=0;this.EndPos=0}function CParaRunState(){this.Selection=new CParaRunSelection;this.ContentPos=0}function CParaRunRecalcInfo(){this.TextPr=true;this.Measure=true;this.Recalc=true;this.RunLen=0;this.MeasurePositions=[];this.NumberingItem=null;this.NumberingUse=false;this.NumberingAdd=true}CParaRunRecalcInfo.prototype.Reset=function(){this.TextPr=true; this.Measure=true;this.Recalc=true;this.RunLen=0;this.MeasurePositions=[]};CParaRunRecalcInfo.prototype.ResetMeasure=function(){this.Measure=false;this.MeasurePositions=[]};CParaRunRecalcInfo.prototype.IsMeasureNeed=function(){return this.Measure||this.MeasurePositions.length>0};CParaRunRecalcInfo.prototype.OnAdd=function(nPos){if(this.Measure)return;for(var nIndex=0,nCount=this.MeasurePositions.length;nIndex=nPos)this.MeasurePositions[nIndex]++;this.MeasurePositions.push(nPos)}; CParaRunRecalcInfo.prototype.OnRemove=function(nPos,nCount){if(this.Measure)return;for(var nIndex=0,nLen=this.MeasurePositions.length;nIndex=nPos+nCount)this.MeasurePositions[nIndex]-=nCount};function CParaRunRange(StartPos,EndPos){this.StartPos=StartPos;this.EndPos=EndPos}function CParaRunLine(){this.Ranges=[];this.Ranges[0]= new CParaRunRange(0,0);this.RangesLength=0}CParaRunLine.prototype={Add_Range:function(RangeIndex,StartPos,EndPos){if(0!==RangeIndex){this.Ranges[RangeIndex]=new CParaRunRange(StartPos,EndPos);this.RangesLength=RangeIndex+1}else{this.Ranges[0].StartPos=StartPos;this.Ranges[0].EndPos=EndPos;this.RangesLength=1}if(this.Ranges.length>this.RangesLength)this.Ranges.legth=this.RangesLength},Copy:function(){var NewLine=new CParaRunLine;NewLine.RangesLength=this.RangesLength;for(var CurRange=0;CurRange=Sizes[0]-1)NewValue=Sizes[0];else NewValue=Math.floor(Value+1);else if(Value>=Sizes[Sizes.length-1])NewValue=Math.min(300,Math.floor(Value/10+1)*10);else for(var Index=0;IndexSizes[Sizes.length-1])if(Value<=Math.floor(Sizes[Sizes.length-1]/10+1)*10)NewValue=Sizes[Sizes.length-1];else NewValue=Math.floor(Math.ceil(Value/10)-1)*10;else for(var Index=Sizes.length-1;Index>=0;Index--)if(Value>Sizes[Index]){NewValue=Sizes[Index];break}return NewValue}function CRunCollaborativeMarks(){this.Ranges=[];this.DrawingObj={}}CRunCollaborativeMarks.prototype={Add:function(PosS,PosE,Color){var Count=this.Ranges.length;for(var Index=0;IndexRange.PosE)continue;else if(PosS>=Range.PosS&&PosS<=Range.PosE&&PosE>=Range.PosS&&PosE<=Range.PosE){if(true!==Color.Compare(Range.Color)){var _PosE=Range.PosE;Range.PosE=PosS;this.Ranges.splice(Index+1,0,new CRunCollaborativeRange(PosS,PosE,Color));this.Ranges.splice(Index+2,0,new CRunCollaborativeRange(PosE,_PosE,Range.Color))}return}else if(PosERange.PosE){Range.PosS= PosS;Range.PosE=PosE;Range.Color=Color;return}else if(PosSRange.PosS&&Pos=Range.PosE){this.Ranges.splice(Index,1);Len--;Index--;continue}else{Range.PosS=Pos;Range.PosE-=Count}else if(Pos>=Range.PosS&&Pos=Range.PosE)Range.PosE=Pos;else Range.PosE-=Count;else continue}},Clear:function(){this.Ranges=[]},Init_Drawing:function(){this.DrawingObj={};var Count=this.Ranges.length;for(var CurPos=0;CurPos0){var CurLine=_CurLine-this.StartLine;var CurRange=0===CurLine?_CurRange- this.StartRange:_CurRange;bEmptyRange=this.protected_GetPrevRangeEndPos(CurLine,CurRange)>=Lng}return bEmptyRange};ParaRun.prototype.Math_UpdateGaps=function(_CurLine,_CurRange,GapsInfo){var CurLine=_CurLine-this.StartLine;var CurRange=0===CurLine?_CurRange-this.StartRange:_CurRange;var StartPos=this.protected_GetRangeStartPos(CurLine,CurRange);var EndPos=this.protected_GetRangeEndPos(CurLine,CurRange);var FontSize=this.Get_CompiledPr(false).FontSize;for(var Pos=StartPos;Pos 0){var StartPos=this.Selection.StartPos,EndPos=this.Selection.EndPos,bSelect=this.Selection.Use;if(StartPos>EndPos){StartPos=this.Selection.EndPos;EndPos=this.Selection.StartPos}var bCheckTwoItem=bSelect==false||bSelect==true&&EndPos==StartPos,bCheckOneItem=bSelect==true&&EndPos-StartPos==1;if(bStart)ResultPos=this.Content[0].Type==para_Math_BreakOperator?0:ResultPos;else if(bEnd){var lastPos=this.Content.length-1;ResultPos=this.Content[lastPos].Type==para_Math_BreakOperator?lastPos:ResultPos}else if(bCheckTwoItem){var Pos= bSelect==false?this.State.ContentPos:StartPos;var bPrevBreakOperator=Pos>0?this.Content[Pos-1].Type==para_Math_BreakOperator:false,bCurrBreakOperator=Pos0)NewRun=this.Split_Run(Pos);return NewRun};ParaRun.prototype.UpdLastElementForGaps=function(_CurLine,_CurRange,GapsInfo){var CurLine=_CurLine-this.StartLine;var CurRange=0===CurLine?_CurRange-this.StartRange:_CurRange;var EndPos=this.protected_GetRangeEndPos(CurLine,CurRange);var FontSize=this.Get_CompiledPr(false).FontSize;var Last=this.Content[EndPos];GapsInfo.updateCurrentObject(Last,FontSize)};ParaRun.prototype.IsPlaceholder=function(){return this.Content.length==1&&this.Content[0].IsPlaceholder&& this.Content[0].IsPlaceholder()};ParaRun.prototype.AddMathPlaceholder=function(){var oPlaceholder=new CMathText(false);oPlaceholder.SetPlaceholder();this.Add_ToContent(0,oPlaceholder,false)};ParaRun.prototype.RemoveMathPlaceholder=function(){for(var nPos=0;nPos0&&this.Content[0].Type==para_Math_BreakOperator;return true==this.IsForcedBreak()&&true==bStartOperator};ParaRun.prototype.Get_AlignBrk=function(_CurLine,bBrkBefore){var CurLine=_CurLine-this.StartLine;var AlnAt=null;if(CurLine>0){var RangesCount=this.protected_GetRangesCount(CurLine- 1);var StartPos=this.protected_GetRangeStartPos(CurLine-1,RangesCount-1);var EndPos=this.protected_GetRangeEndPos(CurLine-1,RangesCount-1);var bStartBreakOperator=bBrkBefore==true&&StartPos==0&&EndPos==0;var bEndBreakOperator=bBrkBefore==false&&StartPos==0&&EndPos==1;if(bStartBreakOperator||bEndBreakOperator)AlnAt=false==this.Is_StartForcedBreakOperator()?null:this.MathPrp.Get_AlignBrk()}return AlnAt};ParaRun.prototype.Math_Is_InclineLetter=function(){var result=false;if(this.Content.length==1)result= this.Content[0].Is_InclineLetter();return result};ParaRun.prototype.GetMathTextPrForMenu=function(){var TextPr=new CTextPr;if(this.IsPlaceholder())TextPr.Merge(this.Parent.GetCtrPrp());TextPr.Merge(this.Pr);var MathTextPr=this.MathPrp.Copy();var BI=MathTextPr.GetBoldItalic();TextPr.Italic=BI.Italic;TextPr.Bold=BI.Bold;return TextPr};ParaRun.prototype.ApplyPoints=function(PointsInfo){if(this.Parent.IsEqArray()){this.size.width=0;for(var Pos=0;Pos0){this.Get_StartPos(oStartPos,oStartPos.GetDepth()+1);this.Get_EndPos(true,oEndPos,oEndPos.GetDepth()+1)}else{this.Get_StartPos(oEndPos,oEndPos.Get_Depth()+1);this.Get_EndPos(true,oStartPos,oStartPos.Get_Depth()+1)}this.Paragraph.Selection.Use=true;this.Paragraph.Selection.Start=false; this.Paragraph.Set_ParaContentPos(oStartPos,true,-1,-1);this.Paragraph.Set_SelectionContentPos(oStartPos,oEndPos,false);this.Paragraph.Document_SetThisElementCurrent(false);return true};ParaRun.prototype.GetAllParagraphs=function(Props,ParaArray){var ContentLen=this.Content.length;for(var CurPos=0;CurPosEndPos){StartPos=this.Selection.EndPos;EndPos=this.Selection.StartPos}if(true===bAll){StartPos=0;EndPos=this.Content.length}var CenterRun=null,CenterRunPos=RunPos;if(0===StartPos&&this.Content.length===EndPos)CenterRun=this;else if(StartPos>0&&this.Content.length=== EndPos){CenterRun=this.Split2(StartPos,Parent,RunPos);CenterRunPos=RunPos+1}else if(0===StartPos&&this.Content.length>EndPos){CenterRun=this;this.Split2(EndPos,Parent,RunPos)}else{this.Split2(EndPos,Parent,RunPos);CenterRun=this.Split2(StartPos,Parent,RunPos);CenterRunPos=RunPos+1}if(true===HavePrChange&&(undefined===nType||c_oAscRevisionsChangeType.TextPr===nType))CenterRun.RemovePrChange();if(reviewtype_Add===ReviewType&&(undefined===nType||c_oAscRevisionsChangeType.TextAdd===nType||c_oAscRevisionsChangeType.MoveMark=== nType&&Asc.c_oAscRevisionsMove.NoMove!==this.GetReviewMoveType()&&oProcessMove&&!oProcessMove.IsFrom()&&oProcessMove.GetUserId()===this.GetReviewInfo().GetUserId()))CenterRun.SetReviewType(reviewtype_Common);else if(reviewtype_Remove===ReviewType&&(undefined===nType||c_oAscRevisionsChangeType.TextRem===nType||c_oAscRevisionsChangeType.MoveMark===nType&&Asc.c_oAscRevisionsMove.NoMove!==this.GetReviewMoveType()&&oProcessMove&&oProcessMove.IsFrom()&&oProcessMove.GetUserId()===this.GetReviewInfo().GetUserId())){Parent.RemoveFromContent(CenterRunPos, 1);if(Parent.GetContentLength()<=0){Parent.RemoveSelection();Parent.AddToContent(0,new ParaRun);Parent.MoveCursorToStartPos()}}}};ParaRun.prototype.RejectRevisionChanges=function(nType,bAll){var Parent=this.Get_Parent();var RunPos=this.private_GetPosInParent();var ReviewType=this.GetReviewType();var HavePrChange=this.HavePrChange();if(reviewtype_Common===ReviewType&&true!==HavePrChange)return;var oTrackManager=this.GetLogicDocument()?this.GetLogicDocument().GetTrackRevisionsManager():null;var oProcessMove= oTrackManager?oTrackManager.GetProcessTrackMove():null;if(true===this.Selection.Use||true===bAll){var StartPos=this.Selection.StartPos;var EndPos=this.Selection.EndPos;if(StartPos>EndPos){StartPos=this.Selection.EndPos;EndPos=this.Selection.StartPos}if(true===bAll){StartPos=0;EndPos=this.Content.length}var CenterRun=null,CenterRunPos=RunPos;if(0===StartPos&&this.Content.length===EndPos)CenterRun=this;else if(StartPos>0&&this.Content.length===EndPos){CenterRun=this.Split2(StartPos,Parent,RunPos);CenterRunPos= RunPos+1}else if(0===StartPos&&this.Content.length>EndPos){CenterRun=this;this.Split2(EndPos,Parent,RunPos)}else{this.Split2(EndPos,Parent,RunPos);CenterRun=this.Split2(StartPos,Parent,RunPos);CenterRunPos=RunPos+1}if(true===HavePrChange&&(undefined===nType||c_oAscRevisionsChangeType.TextPr===nType))CenterRun.Set_Pr(CenterRun.Pr.PrChange);var oReviewInfo=this.GetReviewInfo();var oPrevInfo=oReviewInfo.GetPrevAdded();if(reviewtype_Add===ReviewType&&(undefined===nType||c_oAscRevisionsChangeType.TextAdd=== nType||c_oAscRevisionsChangeType.MoveMark===nType&&Asc.c_oAscRevisionsMove.NoMove!==this.GetReviewMoveType()&&oProcessMove&&!oProcessMove.IsFrom()&&oProcessMove.GetUserId()===this.GetReviewInfo().GetUserId())||undefined===nType&&bAll&&reviewtype_Remove===ReviewType&&oPrevInfo){Parent.RemoveFromContent(CenterRunPos,1);if(Parent.GetContentLength()<=0){Parent.RemoveSelection();Parent.AddToContent(0,new ParaRun);Parent.MoveCursorToStartPos()}}else if(reviewtype_Remove===ReviewType&&(undefined===nType|| c_oAscRevisionsChangeType.TextRem===nType||c_oAscRevisionsChangeType.MoveMark===nType&&Asc.c_oAscRevisionsMove.NoMove!==this.GetReviewMoveType()&&oProcessMove&&oProcessMove.IsFrom()&&oProcessMove.GetUserId()===this.GetReviewInfo().GetUserId()))if(oPrevInfo&&c_oAscRevisionsChangeType.MoveMark!==nType)CenterRun.SetReviewTypeWithInfo(reviewtype_Add,oPrevInfo.Copy());else CenterRun.SetReviewType(reviewtype_Common)}};ParaRun.prototype.IsInHyperlink=function(){if(!this.Paragraph)return false;var ContentPos= this.Paragraph.Get_PosByElement(this);var Classes=this.Paragraph.Get_ClassesByPos(ContentPos);var bHyper=false;var bRun=false;for(var Index=0,Count=Classes.length;Index=0;--nIndex){if((para_FootnoteReference===this.Content[nIndex].Type&&isStepFootnote||para_EndnoteReference===this.Content[nIndex].Type&&isStepEndnote)&&(true!==isCurrent&&true===isStepOver||true===isCurrent&&(true===this.Selection.Use||nPos!==nIndex))){if(this.Paragraph&&this.Paragraph.bFromDocument&&this.Paragraph.LogicDocument)this.Paragraph.LogicDocument.RemoveSelection();this.State.ContentPos=nIndex;this.Make_ThisElementCurrent(true); return-1}nResult++}return nResult};ParaRun.prototype.GetFootnoteRefsInRange=function(arrFootnotes,_CurLine,_CurRange){var CurLine=_CurLine-this.StartLine;var CurRange=0===CurLine?_CurRange-this.StartRange:_CurRange;var StartPos=this.protected_GetRangeStartPos(CurLine,CurRange);var EndPos=this.protected_GetRangeEndPos(CurLine,CurRange);for(var CurPos=StartPos;CurPos=nStartPos&&nPos0)arrComplexFields[arrComplexFields.length-1].SetFieldCode(false)}else if(oItem.IsEnd())if(arrComplexFields.length>0)arrComplexFields.splice(arrComplexFields.length-1,1)}else if(oItem.IsBegin())arrComplexFields.push(oItem.GetComplexField()); else if(oItem.IsEnd())if(arrComplexFields.length>0)arrComplexFields.splice(arrComplexFields.length-1,1)}};ParaRun.prototype.RemoveTabsForTOC=function(_isTab){var isTab=_isTab;for(var nPos=0;nPos -1;--nPos){var oItem=this.Content[nPos];if(para_FieldChar===oItem.Type){var oComplexField=oItem.GetComplexField();if(oComplexField){var oInstruction=oComplexField.Instruction;if(oInstruction)if(oInstruction.Type===fieldtype_SEQ)if(oInstruction.Id===sType)return this.GetParagraphContentPosFromObject(nPos+1)}}else if(para_Field===oItem.Type)if(oItem.FieldType===fieldtype_SEQ)if(oItem.Arguments[0]===sType)return this.GetParagraphContentPosFromObject(nPos+1)}return null};ParaRun.prototype.FindNoSpaceElement= function(nStart){for(var nIndex=nStart;nIndex=this.Content.length)return null;return this.Content[nPos]};ParaRun.prototype.IsFootEndnoteReferenceRun= function(){return 1===this.Content.length&&(para_FootnoteReference===this.Content[0].Type||para_EndnoteReference==this.Content[0].Type)};ParaRun.prototype.ProcessAutoCorrect=function(nPos,nFlags){var nRes=AUTOCORRECT_FLAGS_NONE;if(!nFlags)return false;var nMaxElements=1E3;var oParagraph=this.GetParagraph();if(!oParagraph)return nRes;var oDocument=oParagraph.LogicDocument;if(!oDocument||!(oDocument instanceof CDocument)&&!(oDocument instanceof CPresentation))return nRes;var oContentPos=oParagraph.Get_PosByElement(this); if(!oContentPos)return nRes;oContentPos.Update(nPos,oContentPos.GetDepth()+1);var nLang=this.Get_CompiledPr(false).Lang?this.Get_CompiledPr(false).Lang.Val:1033;if(nFlags&AUTOCORRECT_FLAGS_FRENCH_PUNCTUATION&&this.private_ProcessFrenchPunctuation(oDocument,oParagraph,oContentPos,nPos,nLang))nRes|=AUTOCORRECT_FLAGS_FRENCH_PUNCTUATION;if(nFlags&AUTOCORRECT_FLAGS_SMART_QUOTES&&this.private_ProcessSmartQuotesAutoCorrect(oDocument,oParagraph,oContentPos,nPos,nLang))nRes|=AUTOCORRECT_FLAGS_SMART_QUOTES; if(nFlags&AUTOCORRECT_FLAGS_HYPHEN_WITH_DASH&&this.private_ProcessHyphenWithDashAutoCorrect(oDocument,oParagraph,oContentPos,nPos,nLang))nRes|=AUTOCORRECT_FLAGS_HYPHEN_WITH_DASH;var oRunElementsBefore=new CParagraphRunElements(oContentPos,nMaxElements,[para_Text],false);oRunElementsBefore.SetBreakOnBadType(true);oRunElementsBefore.SetBreakOnDifferentClass(true);oRunElementsBefore.SetSaveContentPositions(true);oParagraph.GetPrevRunElements(oRunElementsBefore);var arrElements=oRunElementsBefore.GetElements(); if(arrElements.length<=0)return nRes;var sText="";for(var nIndex=0,nCount=arrElements.length;nIndex0&&arrResult.length<=9)if(oPrevNumPr){var isAdd=false;var nResultLvL=oPrevNumPr.Lvl;var oResult=arrResult[arrResult.length-1];if(oResult&&-1!==oResult.Value&&oResult.Lvl){var oNumInfo=oPrevParagraph.Parent.CalculateNumberingValues(oPrevParagraph,oPrevNumPr);var oPrevNum=oDocument.GetNumbering().GetNum(oPrevNumPr.NumId);var nPrevLvl=oPrevNumPr.Lvl;for(var nLvl=nPrevLvl;nLvl>=0;--nLvl){var oPrevNumLvl=oPrevNum.GetLvl(nLvl); if(oPrevNumLvl.IsSimilar(oResult.Lvl))if(oResult.Value>oNumInfo[nLvl]&&oResult.Value<=oNumInfo[nLvl]+2&&arrResult.length-1>=nLvl){var isCheckPrevLvls=true;for(var nLvl2=0;nLvl2oNumInfo[oPrevNumPr.Lvl]&&oResult.Value<=oNumInfo[oPrevNumPr.Lvl]+2)isAdd=true}}}if(isAdd)oNumPr=new CNumPr(oPrevNumPr.NumId,nResultLvL)}else{var isCreateNew=true;for(var nIndex=0,nCount=arrResult.length;nIndex=sText.length)return null;var nNextParaPos=sText.indexOf(")",nPos);var nNextDotPos=sText.indexOf(".",nPos);var nEndPos;if(-1===nNextDotPos&&-1===nNextParaPos)return null;else if(-1===nNextDotPos)nEndPos=nNextParaPos;else if(-1===nNextParaPos)nEndPos=nNextDotPos;else nEndPos=Math.min(nNextDotPos,nNextParaPos);var sValue=sText.slice(nPos, nEndPos);var nValue=parseInt(sValue);if(isNaN(nValue))return null;return{Value:nValue,Char:sText.charAt(nEndPos),Pos:nEndPos+1}}if(48<=nFirstCharCode&&nFirstCharCode<=57){var arrResult=[],nPos=0;var oNum=private_ParseNextInt(sText,nPos);var oPrevLvl=null;var nCurLvl=0;while(oNum){nPos=oNum.Pos;var oNumberingLvl=new CNumberingLvl;if("."===oNum.Char)oNumberingLvl.SetByType(c_oAscNumberingLevel.DecimalDot_Left,nCurLvl);else if(")"===oNum.Char)oNumberingLvl.SetByType(c_oAscNumberingLevel.DecimalBracket_Left, nCurLvl);if(oPrevLvl){var arrPrevLvlText=oPrevLvl.GetLvlText();var arrLvlText=[];for(var nIndex=0,nCount=arrPrevLvlText.length;nIndex9)return null;return arrResult}else if(65<=nFirstCharCode&&nFirstCharCode<=90){var nRoman= AscCommon.RomanToInt(sValue);var nLetter=AscCommon.LatinNumberingToInt(sValue);var arrResult=[];if(!isNaN(nRoman)){var oNumberingLvl=new CNumberingLvl;oNumberingLvl.InitDefault(0,c_oAscMultiLevelNumbering.Numbered);if("."===sLastChar)oNumberingLvl.SetByType(c_oAscNumberingLevel.UpperRomanDot_Right,0);else if(")"===sLastChar)oNumberingLvl.SetByType(c_oAscNumberingLevel.UpperRomanBracket_Left,0);arrResult.push({Lvl:oNumberingLvl,Value:nRoman})}if(!isNaN(nLetter)){var oNumberingLvl=new CNumberingLvl; oNumberingLvl.InitDefault(0,c_oAscMultiLevelNumbering.Numbered);if("."===sLastChar)oNumberingLvl.SetByType(c_oAscNumberingLevel.UpperLetterDot_Left,0);else if(")"===sLastChar)oNumberingLvl.SetByType(c_oAscNumberingLevel.UpperLetterBracket_Left,0);arrResult.push({Lvl:oNumberingLvl,Value:nLetter})}if(arrResult.length>0)return arrResult;return null}else if(97<=nFirstCharCode&&nFirstCharCode<=122){var nRoman=AscCommon.RomanToInt(sValue);var nLetter=AscCommon.LatinNumberingToInt(sValue);var arrResult= [];if(!isNaN(nRoman)){var oNumberingLvl=new CNumberingLvl;oNumberingLvl.InitDefault(0,c_oAscMultiLevelNumbering.Numbered);if("."===sLastChar)oNumberingLvl.SetByType(c_oAscNumberingLevel.LowerRomanDot_Right,0);else if(")"===sLastChar)oNumberingLvl.SetByType(c_oAscNumberingLevel.LowerRomanBracket_Left,0);arrResult.push({Lvl:oNumberingLvl,Value:nRoman})}if(!isNaN(nLetter)){var oNumberingLvl=new CNumberingLvl;oNumberingLvl.InitDefault(0,c_oAscMultiLevelNumbering.Numbered);if("."===sLastChar)oNumberingLvl.SetByType(c_oAscNumberingLevel.LowerLetterDot_Left, 0);else if(")"===sLastChar)oNumberingLvl.SetByType(c_oAscNumberingLevel.LowerLetterBracket_Left,0);arrResult.push({Lvl:oNumberingLvl,Value:nLetter})}if(arrResult.length>0)return arrResult;return null}return null};ParaRun.prototype.private_GetSuitablePrBulletForAutoCorrect=function(sText){if("*"===sText)return AscFormat.fGetPresentationBulletByNumInfo({Type:0,SubType:0});else if("-"===sText)return AscFormat.fGetPresentationBulletByNumInfo({Type:0,SubType:8});return null};ParaRun.prototype.private_GetSuitablePrNumberingForAutoCorrect= function(sText){var sLastChar=sText.charAt(sText.length-1);if("."!==sLastChar&&")"!==sLastChar)return null;var nNumType=null;if(sText==="(a)")nNumType=numbering_presentationnumfrmt_AlphaLcParenBoth;else if(sText==="a)")nNumType=numbering_presentationnumfrmt_AlphaLcParenR;else if(sText==="a.")nNumType=numbering_presentationnumfrmt_AlphaLcPeriod;else if(sText==="(A)")nNumType=numbering_presentationnumfrmt_AlphaUcParenBoth;else if(sText==="A)")nNumType=numbering_presentationnumfrmt_AlphaUcParenR;else if(sText=== "A.")nNumType=numbering_presentationnumfrmt_AlphaUcPeriod;else if(sText==="(1)")nNumType=numbering_presentationnumfrmt_ArabicParenBoth;else if(sText==="1)")nNumType=numbering_presentationnumfrmt_ArabicParenR;else if(sText==="1.")nNumType=numbering_presentationnumfrmt_ArabicPeriod;else if(sText==="(i)")nNumType=numbering_presentationnumfrmt_RomanLcParenBoth;else if(sText==="i)")nNumType=numbering_presentationnumfrmt_RomanLcParenR;else if(sText==="i.")nNumType=numbering_presentationnumfrmt_RomanLcPeriod; else if(sText==="(I)")nNumType=numbering_presentationnumfrmt_RomanUcParenBoth;else if(sText==="I)")nNumType=numbering_presentationnumfrmt_RomanUcParenR;else if(sText==="I.")nNumType=numbering_presentationnumfrmt_RomanUcPeriod;if(nNumType!==null){var oBullet=new AscFormat.CBullet;oBullet.bulletType=new AscFormat.CBulletType;oBullet.bulletType.type=AscFormat.BULLET_TYPE_BULLET_AUTONUM;oBullet.bulletType.AutoNumType=nNumType;return oBullet}return null};ParaRun.prototype.private_ProcessFrenchPunctuation= function(oDocument,oParagraph,oContentPos,nPos,nLang){if(!oDocument.IsAutoCorrectFrenchPunctuation())return false;if(!(para_Text===this.Content[nPos].Type&&(1036===nLang&&(58===this.Content[nPos].Value||59===this.Content[nPos].Value||63===this.Content[nPos].Value||33===this.Content[nPos].Value))))return false;var oRunElementsBefore=new CParagraphRunElements(oContentPos,3,null,false);oRunElementsBefore.SetSaveContentPositions(true);oParagraph.GetPrevRunElements(oRunElementsBefore);var arrElements= oRunElementsBefore.GetElements();if(arrElements.length>0&¶_Text===arrElements[0].Type&&(33===arrElements[0].Value||58===arrElements[0].Value||59===arrElements[0].Value||63===arrElements[0].Value)||arrElements.length>=3&¶_Space===arrElements[0].Type&¶_Space===arrElements[1].Type&¶_Space===arrElements[2].Type)return false;oDocument.StartAction(AscDFH.historydescription_Document_AutoCorrectCommon);this.AddToContent(nPos,new ParaText(160));this.State.ContentPos=nPos+2;if(arrElements.length>= 1&&(para_Space===arrElements[0].Type||para_Text===arrElements[0].Type&&arrElements[0].IsNBSP())){var oTempPos=oRunElementsBefore.GetContentPositions()[0];var nInRunPos=oTempPos.Get(oTempPos.GetDepth());oTempPos.DecreaseDepth(1);var oRun=oParagraph.GetClassByPos(oTempPos);if(oRun instanceof ParaRun){oRun.RemoveFromContent(nInRunPos,1,true);if(arrElements.length>=2&&(para_Space===arrElements[1].Type||para_Text===arrElements[1].Type&&arrElements[1].IsNBSP())){oTempPos=oRunElementsBefore.GetContentPositions()[1]; nInRunPos=oTempPos.Get(oTempPos.GetDepth());oTempPos.DecreaseDepth(1);oRun=oParagraph.GetClassByPos(oTempPos);if(oRun instanceof ParaRun)oRun.RemoveFromContent(nInRunPos,1,true)}}}oDocument.FinalizeAction();return true};ParaRun.prototype.private_ProcessSmartQuotesAutoCorrect=function(oDocument,oParagraph,oContentPos,nPos,nLang){if(!oDocument.IsAutoCorrectSmartQuotes())return false;if(!(para_Text===this.Content[nPos].Type&&(34===this.Content[nPos].Value||39===this.Content[nPos].Value)))return false; var isOpenQuote=true;var isDoubleQoute=34===this.Content[nPos].Value;var oRunElementsBefore=new CParagraphRunElements(oContentPos,1,null,false);oParagraph.GetPrevRunElements(oRunElementsBefore);var arrElements=oRunElementsBefore.GetElements();if(arrElements.length>0){var oPrevElement=arrElements[0];if(para_Text===oPrevElement.Type&&45!==oPrevElement.Value&&40!==oPrevElement.Value&&91!==oPrevElement.Value&&123!==oPrevElement.Value)isOpenQuote=false}if(!isDoubleQoute&&(1050===nLang||1060===nLang))return false; oDocument.StartAction(AscDFH.historydescription_Document_AutoCorrectSmartQuotes);this.RemoveFromContent(nPos,1);if(isDoubleQoute)switch(nLang){case 1029:case 1031:case 1039:case 1050:case 1051:case 1061:{this.AddToContent(nPos,new ParaText(isOpenQuote?8222:8220));break}case 1038:case 1045:case 1048:case 1062:{this.AddToContent(nPos,new ParaText(isOpenQuote?8222:8221));break}case 1030:case 1035:case 1053:{this.AddToContent(nPos,new ParaText(8221));break}case 1049:{this.AddToContent(nPos,new ParaText(isOpenQuote? 171:187));break}case 1060:{this.AddToContent(nPos,new ParaText(isOpenQuote?187:171));break}case 1036:{if(isOpenQuote){this.AddToContent(nPos,new ParaText(171));this.AddToContent(nPos+1,new ParaText(160))}else{this.AddToContent(nPos,new ParaText(160));this.AddToContent(nPos+1,new ParaText(187))}nPos++;break}default:{this.AddToContent(nPos,new ParaText(isOpenQuote?8220:8221));break}}else switch(nLang){case 1029:case 1031:case 1039:case 1051:{this.AddToContent(nPos,new ParaText(isOpenQuote?8218:8216)); break}case 1048:{this.AddToContent(nPos,new ParaText(isOpenQuote?8218:8217));break}case 1030:case 1035:case 1038:case 1053:case 1061:{this.AddToContent(nPos,new ParaText(8217));break}default:{this.AddToContent(nPos,new ParaText(isOpenQuote?8216:8217));break}}this.State.ContentPos=nPos+1;oDocument.FinalizeAction();return true};ParaRun.prototype.private_ProcessHyphenWithDashAutoCorrect=function(oDocument,oParagraph,oContentPos,nPos,nLang){if(!oDocument.IsAutoCorrectHyphensWithDash())return false;if(!(para_Text=== this.Content[nPos].Type&&45===this.Content[nPos].Value))return false;var oRunElementsBefore=new CParagraphRunElements(oContentPos,1,null,false);oRunElementsBefore.SetSaveContentPositions(true);oParagraph.GetPrevRunElements(oRunElementsBefore);var arrElements=oRunElementsBefore.GetElements();if(arrElements.length>0&¶_Text===arrElements[0].Type&&45===arrElements[0].Value){oDocument.StartAction(AscDFH.historydescription_Document_AutoCorrectHyphensWithDash);var oDash=new ParaText(8212);this.AddToContent(nPos+ 1,oDash);var oStartPos=oRunElementsBefore.GetContentPositions()[0];var oEndPos=oContentPos;oContentPos.Update(nPos+1,oContentPos.GetDepth());oParagraph.RemoveSelection();oParagraph.SetSelectionUse(true);oParagraph.SetSelectionContentPos(oStartPos,oEndPos,false);oParagraph.Remove(1);oParagraph.RemoveSelection();for(var nTempPos=0,nCount=this.Content.length;nTempPos0?arrContentPosition[arrContentPosition.length-1]:oRunElementsBefore.CurContentPos;var oEndPos=oContentPos;oContentPos.Update(nPos,oContentPos.GetDepth());var oDocPos=[{Class:this,Position:nPos+1}];this.GetDocumentPositionFromObject(oDocPos);oDocument.TrackDocumentPositions([oDocPos]);oParagraph.RemoveSelection();oParagraph.SetSelectionUse(true);oParagraph.SetSelectionContentPos(oStartPos,oEndPos,false);oParagraph.AddHyperlink(new Asc.CHyperlinkProperty({Value:AscCommon.prepareUrl(sText, nTypeHyper)}));oParagraph.RemoveSelection();oDocument.RefreshDocumentPositions([oDocPos]);oTopElement.SetContentPosition(oDocPos,0,0);oDocument.Recalculate();oDocument.FinalizeAction()}return true}}return false};ParaRun.prototype.private_ProcessCapitalizeFirstLetterOfSentencesAutoCorrect=function(oDocument,oParagraph,oContentPos,nPos,oRunElementsBefore,sText){if(!oDocument.IsAutoCorrectFirstLetterOfSentences())return false;if("www"===sText||"http"===sText||"https"===sText)return;var nMaxElements= 1E3;var arrElements=oRunElementsBefore.GetElements();if(arrElements.length<=0)return false;var oHistory=oDocument.GetHistory();if(oHistory.CheckAsYouTypeAutoCorrect&&!oHistory.CheckAsYouTypeAutoCorrect(arrElements[0]))return false;for(var nIndex=0,nCount=arrElements.length;nIndex0&&!oRunElements.Elements[0].IsDot()&&!oRunElements.Elements[0].IsExclamationMark()&&!oRunElements.Elements[0].IsQuestionMark())return false; if(1===oRunElements.Elements.length&&oDocument.IsDocumentEditor()){var nExceptionMaxLen=oDocument.GetFirstLetterAutoCorrectExceptionsMaxLen()+1;var oDotContentPos=oRunElements.GetContentPositions()[0];oRunElements=new CParagraphRunElements(oDotContentPos,nExceptionMaxLen,null,false);oParagraph.GetPrevRunElements(oRunElements);arrElements=oRunElements.GetElements();var sCheckException="";for(var nIndex=0,nCount=arrElements.length;nIndex=0;--nPos)if(para_RevisionMove===this.Content[nPos].Type)return this.Content[nPos];return null};ParaRun.prototype.CanDeleteInReviewMode=function(){var nReviewType=this.GetReviewType();var oReviewInfo=this.GetReviewInfo();return reviewtype_Add===nReviewType&&oReviewInfo.IsCurrentUser()&&(!oReviewInfo.IsMovedTo()||this.Paragraph.LogicDocument.TrackMoveRelocation)|| reviewtype_Remove===nReviewType&&oReviewInfo.IsPrevAddedByCurrentUser()};ParaRun.prototype.GetFirstRun=function(){return this};ParaRun.prototype.GetFirstRunElementPos=function(nType,oStartPos,oEndPos,nDepth){for(var nPos=0,nCount=this.Content.length;nPos0)nRunLen=Math.min(oTextForm.MaxCharacters,nRunLen);var nStart=0;var nEnd=0;var nCount=Math.min(this.Content.length,oRun.Content.length);for(var nPos=0;nPos0)this.RemoveFromContent(nStart,this.Content.length-nStart-nEnd);for(var nPos=nStart,nEndPos=nRunLen-nEnd;nPosnEndPos){var nTemp=nStartPos;nStartPos=nEndPos;nEndPos=nTemp}}for(var nPos=0,nCount=this.Content.length;nPos=nStartPos&&nPos=nEndPos;--nIndex)if(this.Content[nIndex].FindNextFillingForm){var oRes= this.Content[nIndex].FindNextFillingForm(false,false,false);if(oRes)return oRes}return null};ParaRun.prototype.CalculateTextToTable=function(oEngine){if(reviewtype_Remove===this.GetReviewType())return;if(this.IsMathRun()&&(!this.ParaMath||this.Parent!==this.ParaMath.Root))return;if(oEngine.IsCalculateTableSizeMode())for(var nPos=0,nCount=this.Content.length;nPos0)this.SelectAll(1);else this.SelectAll(-1)};CPresentationField.prototype.Get_LeftPos=function(SearchPos,ContentPos,Depth,UseContentPos){if(false===UseContentPos&&this.Content.length>0){SearchPos.Found=true;SearchPos.Pos.Update(0,Depth);return true}return false};CPresentationField.prototype.Get_RightPos=function(SearchPos,ContentPos,Depth,UseContentPos,StepEnd){if(false===UseContentPos&& this.Content.length>0){SearchPos.Found=true;SearchPos.Pos.Update(this.Content.length,Depth);return true}return false};CPresentationField.prototype.Get_WordStartPos=function(SearchPos,ContentPos,Depth,UseContentPos){};CPresentationField.prototype.Get_WordEndPos=function(SearchPos,ContentPos,Depth,UseContentPos,StepEnd){};CPresentationField.prototype.IsSolid=function(){return true};CPresentationField.prototype.IsStopCursorOnEntryExit=function(){return true};CPresentationField.prototype.Cursor_Is_NeededCorrectPos= function(){return false};var drawingsChangesMap=window["AscDFH"].drawingsChangesMap;drawingsChangesMap[AscDFH.historyitem_PresentationField_FieldType]=function(oClass,value){oClass.FieldType=value};drawingsChangesMap[AscDFH.historyitem_PresentationField_Guid]=function(oClass,value){oClass.Guid=value};drawingsChangesMap[AscDFH.historyitem_PresentationField_PPr]=function(oClass,value){oClass.PPr=value};AscDFH.changesFactory[AscDFH.historyitem_PresentationField_FieldType]=window["AscDFH"].CChangesDrawingsString; AscDFH.changesFactory[AscDFH.historyitem_PresentationField_Guid]=window["AscDFH"].CChangesDrawingsString;AscDFH.changesFactory[AscDFH.historyitem_PresentationField_PPr]=window["AscDFH"].CChangesDrawingsObjectNoId;window["AscCommonWord"]=window["AscCommonWord"]||{};window["AscCommonWord"].CPresentationField=CPresentationField;window["AscCommonWord"].oDefaultDateTimeFormat={}})(window);"use strict";AscDFH.changesFactory[AscDFH.historyitem_ParaRun_AddItem]=CChangesRunAddItem;AscDFH.changesFactory[AscDFH.historyitem_ParaRun_RemoveItem]= CChangesRunRemoveItem;AscDFH.changesFactory[AscDFH.historyitem_ParaRun_Bold]=CChangesRunBold;AscDFH.changesFactory[AscDFH.historyitem_ParaRun_Italic]=CChangesRunItalic;AscDFH.changesFactory[AscDFH.historyitem_ParaRun_Strikeout]=CChangesRunStrikeout;AscDFH.changesFactory[AscDFH.historyitem_ParaRun_Underline]=CChangesRunUnderline;AscDFH.changesFactory[AscDFH.historyitem_ParaRun_FontFamily]=undefined;AscDFH.changesFactory[AscDFH.historyitem_ParaRun_FontSize]=CChangesRunFontSize;AscDFH.changesFactory[AscDFH.historyitem_ParaRun_Color]= CChangesRunColor;AscDFH.changesFactory[AscDFH.historyitem_ParaRun_VertAlign]=CChangesRunVertAlign;AscDFH.changesFactory[AscDFH.historyitem_ParaRun_HighLight]=CChangesRunHighLight;AscDFH.changesFactory[AscDFH.historyitem_ParaRun_HighlightColor]=CChangesRunHighlightColor;AscDFH.changesFactory[AscDFH.historyitem_ParaRun_RStyle]=CChangesRunRStyle;AscDFH.changesFactory[AscDFH.historyitem_ParaRun_Spacing]=CChangesRunSpacing;AscDFH.changesFactory[AscDFH.historyitem_ParaRun_DStrikeout]=CChangesRunDStrikeout; AscDFH.changesFactory[AscDFH.historyitem_ParaRun_Caps]=CChangesRunCaps;AscDFH.changesFactory[AscDFH.historyitem_ParaRun_SmallCaps]=CChangesRunSmallCaps;AscDFH.changesFactory[AscDFH.historyitem_ParaRun_Position]=CChangesRunPosition;AscDFH.changesFactory[AscDFH.historyitem_ParaRun_Value]=undefined;AscDFH.changesFactory[AscDFH.historyitem_ParaRun_RFonts]=CChangesRunRFonts;AscDFH.changesFactory[AscDFH.historyitem_ParaRun_Lang]=CChangesRunLang;AscDFH.changesFactory[AscDFH.historyitem_ParaRun_RFonts_Ascii]= CChangesRunRFontsAscii;AscDFH.changesFactory[AscDFH.historyitem_ParaRun_RFonts_HAnsi]=CChangesRunRFontsHAnsi;AscDFH.changesFactory[AscDFH.historyitem_ParaRun_RFonts_CS]=CChangesRunRFontsCS;AscDFH.changesFactory[AscDFH.historyitem_ParaRun_RFonts_EastAsia]=CChangesRunRFontsEastAsia;AscDFH.changesFactory[AscDFH.historyitem_ParaRun_RFonts_Hint]=CChangesRunRFontsHint;AscDFH.changesFactory[AscDFH.historyitem_ParaRun_Lang_Bidi]=CChangesRunLangBidi;AscDFH.changesFactory[AscDFH.historyitem_ParaRun_Lang_EastAsia]= CChangesRunLangEastAsia;AscDFH.changesFactory[AscDFH.historyitem_ParaRun_Lang_Val]=CChangesRunLangVal;AscDFH.changesFactory[AscDFH.historyitem_ParaRun_TextPr]=CChangesRunTextPr;AscDFH.changesFactory[AscDFH.historyitem_ParaRun_Unifill]=CChangesRunUnifill;AscDFH.changesFactory[AscDFH.historyitem_ParaRun_Shd]=CChangesRunShd;AscDFH.changesFactory[AscDFH.historyitem_ParaRun_MathStyle]=CChangesRunMathStyle;AscDFH.changesFactory[AscDFH.historyitem_ParaRun_MathPrp]=CChangesRunMathPrp;AscDFH.changesFactory[AscDFH.historyitem_ParaRun_ReviewType]= CChangesRunReviewType;AscDFH.changesFactory[AscDFH.historyitem_ParaRun_PrChange]=CChangesRunPrChange;AscDFH.changesFactory[AscDFH.historyitem_ParaRun_TextFill]=CChangesRunTextFill;AscDFH.changesFactory[AscDFH.historyitem_ParaRun_TextOutline]=CChangesRunTextOutline;AscDFH.changesFactory[AscDFH.historyitem_ParaRun_PrReviewInfo]=CChangesRunPrReviewInfo;AscDFH.changesFactory[AscDFH.historyitem_ParaRun_ContentReviewInfo]=CChangesRunContentReviewInfo;AscDFH.changesFactory[AscDFH.historyitem_ParaRun_OnStartSplit]= CChangesRunOnStartSplit;AscDFH.changesFactory[AscDFH.historyitem_ParaRun_OnEndSplit]=CChangesRunOnEndSplit;AscDFH.changesFactory[AscDFH.historyitem_ParaRun_MathAlnAt]=CChangesRunMathAlnAt;AscDFH.changesFactory[AscDFH.historyitem_ParaRun_MathForcedBreak]=CChangesRunMathForcedBreak;AscDFH.changesRelationMap[AscDFH.historyitem_ParaRun_AddItem]=[AscDFH.historyitem_ParaRun_AddItem,AscDFH.historyitem_ParaRun_RemoveItem];AscDFH.changesRelationMap[AscDFH.historyitem_ParaRun_RemoveItem]=[AscDFH.historyitem_ParaRun_AddItem, AscDFH.historyitem_ParaRun_RemoveItem];AscDFH.changesRelationMap[AscDFH.historyitem_ParaRun_Bold]=[AscDFH.historyitem_ParaRun_TextPr,AscDFH.historyitem_ParaRun_Bold];AscDFH.changesRelationMap[AscDFH.historyitem_ParaRun_Italic]=[AscDFH.historyitem_ParaRun_TextPr,AscDFH.historyitem_ParaRun_Italic];AscDFH.changesRelationMap[AscDFH.historyitem_ParaRun_Strikeout]=[AscDFH.historyitem_ParaRun_TextPr,AscDFH.historyitem_ParaRun_Strikeout];AscDFH.changesRelationMap[AscDFH.historyitem_ParaRun_Underline]=[AscDFH.historyitem_ParaRun_TextPr, AscDFH.historyitem_ParaRun_Underline];AscDFH.changesRelationMap[AscDFH.historyitem_ParaRun_FontSize]=[AscDFH.historyitem_ParaRun_TextPr,AscDFH.historyitem_ParaRun_FontSize];AscDFH.changesRelationMap[AscDFH.historyitem_ParaRun_Color]=[AscDFH.historyitem_ParaRun_TextPr,AscDFH.historyitem_ParaRun_Color];AscDFH.changesRelationMap[AscDFH.historyitem_ParaRun_VertAlign]=[AscDFH.historyitem_ParaRun_TextPr,AscDFH.historyitem_ParaRun_VertAlign];AscDFH.changesRelationMap[AscDFH.historyitem_ParaRun_HighLight]= [AscDFH.historyitem_ParaRun_TextPr,AscDFH.historyitem_ParaRun_HighLight];AscDFH.changesRelationMap[AscDFH.historyitem_ParaRun_HighlightColor]=[AscDFH.historyitem_ParaRun_TextPr,AscDFH.historyitem_ParaRun_HighlightColor];AscDFH.changesRelationMap[AscDFH.historyitem_ParaRun_RStyle]=[AscDFH.historyitem_ParaRun_TextPr,AscDFH.historyitem_ParaRun_RStyle];AscDFH.changesRelationMap[AscDFH.historyitem_ParaRun_Spacing]=[AscDFH.historyitem_ParaRun_TextPr,AscDFH.historyitem_ParaRun_Spacing];AscDFH.changesRelationMap[AscDFH.historyitem_ParaRun_DStrikeout]= [AscDFH.historyitem_ParaRun_TextPr,AscDFH.historyitem_ParaRun_DStrikeout];AscDFH.changesRelationMap[AscDFH.historyitem_ParaRun_Caps]=[AscDFH.historyitem_ParaRun_TextPr,AscDFH.historyitem_ParaRun_Caps];AscDFH.changesRelationMap[AscDFH.historyitem_ParaRun_SmallCaps]=[AscDFH.historyitem_ParaRun_TextPr,AscDFH.historyitem_ParaRun_SmallCaps];AscDFH.changesRelationMap[AscDFH.historyitem_ParaRun_Position]=[AscDFH.historyitem_ParaRun_TextPr,AscDFH.historyitem_ParaRun_Position];AscDFH.changesRelationMap[AscDFH.historyitem_ParaRun_RFonts]= [AscDFH.historyitem_ParaRun_TextPr,AscDFH.historyitem_ParaRun_RFonts,AscDFH.historyitem_ParaRun_RFonts_Ascii,AscDFH.historyitem_ParaRun_RFonts_HAnsi,AscDFH.historyitem_ParaRun_RFonts_CS,AscDFH.historyitem_ParaRun_RFonts_EastAsia,AscDFH.historyitem_ParaRun_RFonts_Hint];AscDFH.changesRelationMap[AscDFH.historyitem_ParaRun_Lang]=[AscDFH.historyitem_ParaRun_TextPr,AscDFH.historyitem_ParaRun_Lang,AscDFH.historyitem_ParaRun_Lang_Bidi,AscDFH.historyitem_ParaRun_Lang_EastAsia,AscDFH.historyitem_ParaRun_Lang_Val]; AscDFH.changesRelationMap[AscDFH.historyitem_ParaRun_RFonts_Ascii]=[AscDFH.historyitem_ParaRun_TextPr,AscDFH.historyitem_ParaRun_RFonts,AscDFH.historyitem_ParaRun_RFonts_Ascii];AscDFH.changesRelationMap[AscDFH.historyitem_ParaRun_RFonts_HAnsi]=[AscDFH.historyitem_ParaRun_TextPr,AscDFH.historyitem_ParaRun_RFonts,AscDFH.historyitem_ParaRun_RFonts_HAnsi];AscDFH.changesRelationMap[AscDFH.historyitem_ParaRun_RFonts_CS]=[AscDFH.historyitem_ParaRun_TextPr,AscDFH.historyitem_ParaRun_RFonts,AscDFH.historyitem_ParaRun_RFonts_CS]; AscDFH.changesRelationMap[AscDFH.historyitem_ParaRun_RFonts_EastAsia]=[AscDFH.historyitem_ParaRun_TextPr,AscDFH.historyitem_ParaRun_RFonts,AscDFH.historyitem_ParaRun_RFonts_EastAsia];AscDFH.changesRelationMap[AscDFH.historyitem_ParaRun_RFonts_Hint]=[AscDFH.historyitem_ParaRun_TextPr,AscDFH.historyitem_ParaRun_RFonts,AscDFH.historyitem_ParaRun_RFonts_Hint];AscDFH.changesRelationMap[AscDFH.historyitem_ParaRun_Lang_Bidi]=[AscDFH.historyitem_ParaRun_TextPr,AscDFH.historyitem_ParaRun_Lang,AscDFH.historyitem_ParaRun_Lang_Bidi]; AscDFH.changesRelationMap[AscDFH.historyitem_ParaRun_Lang_EastAsia]=[AscDFH.historyitem_ParaRun_TextPr,AscDFH.historyitem_ParaRun_Lang,AscDFH.historyitem_ParaRun_Lang_EastAsia];AscDFH.changesRelationMap[AscDFH.historyitem_ParaRun_Lang_Val]=[AscDFH.historyitem_ParaRun_TextPr,AscDFH.historyitem_ParaRun_Lang,AscDFH.historyitem_ParaRun_Lang_Val];AscDFH.changesRelationMap[AscDFH.historyitem_ParaRun_TextPr]=[AscDFH.historyitem_ParaRun_Bold,AscDFH.historyitem_ParaRun_Italic,AscDFH.historyitem_ParaRun_Strikeout, AscDFH.historyitem_ParaRun_Underline,AscDFH.historyitem_ParaRun_FontSize,AscDFH.historyitem_ParaRun_Color,AscDFH.historyitem_ParaRun_VertAlign,AscDFH.historyitem_ParaRun_HighLight,AscDFH.historyitem_ParaRun_HighlightColor,AscDFH.historyitem_ParaRun_RStyle,AscDFH.historyitem_ParaRun_Spacing,AscDFH.historyitem_ParaRun_DStrikeout,AscDFH.historyitem_ParaRun_Caps,AscDFH.historyitem_ParaRun_SmallCaps,AscDFH.historyitem_ParaRun_Position,AscDFH.historyitem_ParaRun_RFonts,AscDFH.historyitem_ParaRun_Lang,AscDFH.historyitem_ParaRun_RFonts_Ascii, AscDFH.historyitem_ParaRun_RFonts_HAnsi,AscDFH.historyitem_ParaRun_RFonts_CS,AscDFH.historyitem_ParaRun_RFonts_EastAsia,AscDFH.historyitem_ParaRun_RFonts_Hint,AscDFH.historyitem_ParaRun_Lang_Bidi,AscDFH.historyitem_ParaRun_Lang_EastAsia,AscDFH.historyitem_ParaRun_Lang_Val,AscDFH.historyitem_ParaRun_TextPr,AscDFH.historyitem_ParaRun_Unifill,AscDFH.historyitem_ParaRun_Shd,AscDFH.historyitem_ParaRun_PrChange,AscDFH.historyitem_ParaRun_TextFill,AscDFH.historyitem_ParaRun_TextOutline,AscDFH.historyitem_ParaRun_PrReviewInfo]; AscDFH.changesRelationMap[AscDFH.historyitem_ParaRun_Unifill]=[AscDFH.historyitem_ParaRun_TextPr,AscDFH.historyitem_ParaRun_Unifill];AscDFH.changesRelationMap[AscDFH.historyitem_ParaRun_Shd]=[AscDFH.historyitem_ParaRun_TextPr,AscDFH.historyitem_ParaRun_Shd];AscDFH.changesRelationMap[AscDFH.historyitem_ParaRun_MathStyle]=[AscDFH.historyitem_ParaRun_MathStyle,AscDFH.historyitem_ParaRun_MathPrp];AscDFH.changesRelationMap[AscDFH.historyitem_ParaRun_MathPrp]=[AscDFH.historyitem_ParaRun_MathStyle,AscDFH.historyitem_ParaRun_MathPrp, AscDFH.historyitem_ParaRun_MathAlnAt,AscDFH.historyitem_ParaRun_MathForcedBreak];AscDFH.changesRelationMap[AscDFH.historyitem_ParaRun_ReviewType]=[AscDFH.historyitem_ParaRun_ReviewType,AscDFH.historyitem_ParaRun_ContentReviewInfo];AscDFH.changesRelationMap[AscDFH.historyitem_ParaRun_PrChange]=[AscDFH.historyitem_ParaRun_TextPr,AscDFH.historyitem_ParaRun_PrChange,AscDFH.historyitem_ParaRun_PrReviewInfo];AscDFH.changesRelationMap[AscDFH.historyitem_ParaRun_TextFill]=[AscDFH.historyitem_ParaRun_TextPr, AscDFH.historyitem_ParaRun_TextFill];AscDFH.changesRelationMap[AscDFH.historyitem_ParaRun_TextOutline]=[AscDFH.historyitem_ParaRun_TextPr,AscDFH.historyitem_ParaRun_TextOutline];AscDFH.changesRelationMap[AscDFH.historyitem_ParaRun_PrReviewInfo]=[AscDFH.historyitem_ParaRun_TextPr,AscDFH.historyitem_ParaRun_PrChange,AscDFH.historyitem_ParaRun_PrReviewInfo];AscDFH.changesRelationMap[AscDFH.historyitem_ParaRun_ContentReviewInfo]=[AscDFH.historyitem_ParaRun_ReviewType,AscDFH.historyitem_ParaRun_ContentReviewInfo]; AscDFH.changesRelationMap[AscDFH.historyitem_ParaRun_OnStartSplit]=[];AscDFH.changesRelationMap[AscDFH.historyitem_ParaRun_OnEndSplit]=[];AscDFH.changesRelationMap[AscDFH.historyitem_ParaRun_MathAlnAt]=[AscDFH.historyitem_ParaRun_MathPrp,AscDFH.historyitem_ParaRun_MathAlnAt,AscDFH.historyitem_ParaRun_MathForcedBreak];AscDFH.changesRelationMap[AscDFH.historyitem_ParaRun_MathForcedBreak]=[AscDFH.historyitem_ParaRun_MathPrp,AscDFH.historyitem_ParaRun_MathAlnAt,AscDFH.historyitem_ParaRun_MathForcedBreak]; function private_ParaRunChangesOnMergeTextPr(oChange){if(oChange.Class!==this.Class)return true;if(oChange.Type===this.Type||oChange.Type===AscDFH.historyitem_ParaRun_TextPr)return false;return true}function private_ParaRunChangesOnMergeRFontsTextPr(oChange){if(oChange.Class!==this.Class)return true;if(oChange.Type===this.Type||oChange.Type===AscDFH.historyitem_ParaRun_TextPr||oChange.Type===AscDFH.historyitem_ParaRun_RFonts)return false;return true}function private_ParaRunChangesOnMergeLangTextPr(oChange){if(oChange.Class!== this.Class)return true;if(oChange.Type===this.Type||oChange.Type===AscDFH.historyitem_ParaRun_TextPr||oChange.Type===AscDFH.historyitem_ParaRun_Lang)return false;return true}function CChangesRunAddItem(Class,Pos,Items,Color){AscDFH.CChangesBaseContentChange.call(this,Class,Pos,Items,true);this.Color=true===Color?true:false}CChangesRunAddItem.prototype=Object.create(AscDFH.CChangesBaseContentChange.prototype);CChangesRunAddItem.prototype.constructor=CChangesRunAddItem;CChangesRunAddItem.prototype.Type= AscDFH.historyitem_ParaRun_AddItem;CChangesRunAddItem.prototype.Undo=function(){var oRun=this.Class;oRun.Content.splice(this.Pos,this.Items.length);oRun.RecalcInfo.Measure=true;oRun.private_UpdateSpellChecking();oRun.private_UpdateTrackRevisionOnChangeContent(false)};CChangesRunAddItem.prototype.Redo=function(){var oRun=this.Class;var Array_start=oRun.Content.slice(0,this.Pos);var Array_end=oRun.Content.slice(this.Pos);oRun.Content=Array_start.concat(this.Items,Array_end);oRun.RecalcInfo.Measure= true;oRun.private_UpdateSpellChecking();oRun.private_UpdateTrackRevisionOnChangeContent(false);for(var nIndex=0,nCount=this.Items.length;nIndex0)AscCommon.CollaborativeEditing.Add_NewImage(Unifill.fill.RasterImageId);if(this.Color&&Color)this.Class.private_AddCollPrChangeOther(Color)};CChangesRunTextPr.prototype.Merge= function(oChange){if(this.Class!==oChange.Class)return true;if(this.Type===oChange.Type)return false;if(!this.New)this.New=new CTextPr;switch(oChange.Type){case AscDFH.historyitem_ParaRun_Bold:{this.New.Bold=oChange.New;break}case AscDFH.historyitem_ParaRun_Italic:{this.New.Italic=oChange.New;break}case AscDFH.historyitem_ParaRun_Strikeout:{this.New.Strikeout=oChange.New;break}case AscDFH.historyitem_ParaRun_Underline:{this.New.Underline=oChange.New;break}case AscDFH.historyitem_ParaRun_FontSize:{this.New.FontSize= oChange.New;break}case AscDFH.historyitem_ParaRun_Color:{this.New.Color=oChange.New;break}case AscDFH.historyitem_ParaRun_VertAlign:{this.New.VertAlign=oChange.New;break}case AscDFH.historyitem_ParaRun_HighLight:{this.New.HighLight=oChange.New;break}case AscDFH.historyitem_ParaRun_HighlightColor:{this.New.HighlightColor=oChange.New;break}case AscDFH.historyitem_ParaRun_RStyle:{this.New.RStyle=oChange.New;break}case AscDFH.historyitem_ParaRun_Spacing:{this.New.Spacing=oChange.New;break}case AscDFH.historyitem_ParaRun_DStrikeout:{this.New.DStrikeout= oChange.New;break}case AscDFH.historyitem_ParaRun_Caps:{this.New.Caps=oChange.New;break}case AscDFH.historyitem_ParaRun_SmallCaps:{this.New.SmallCaps=oChange.New;break}case AscDFH.historyitem_ParaRun_Position:{this.New.Position=oChange.New;break}case AscDFH.historyitem_ParaRun_RFonts:{this.New.RFonts=oChange.New;break}case AscDFH.historyitem_ParaRun_Lang:{this.New.Lang=oChange.New;break}case AscDFH.historyitem_ParaRun_RFonts_Ascii:{if(!this.New.RFonts)this.New.RFonts=new CRFonts;this.New.RFonts.Ascii= oChange.New;break}case AscDFH.historyitem_ParaRun_RFonts_HAnsi:{if(!this.New.RFonts)this.New.RFonts=new CRFonts;this.New.RFonts.HAnsi=oChange.New;break}case AscDFH.historyitem_ParaRun_RFonts_CS:{if(!this.New.RFonts)this.New.RFonts=new CRFonts;this.New.RFonts.CS=oChange.New;break}case AscDFH.historyitem_ParaRun_RFonts_EastAsia:{if(!this.New.RFonts)this.New.RFonts=new CRFonts;this.New.RFonts.EastAsia=oChange.New;break}case AscDFH.historyitem_ParaRun_RFonts_Hint:{if(!this.New.RFonts)this.New.RFonts= new CRFonts;this.New.RFonts.Hint=oChange.New;break}case AscDFH.historyitem_ParaRun_Lang_Bidi:{if(!this.New.Lang)this.New.Lang=new CLang;this.New.Lang.Bidi=oChange.New;break}case AscDFH.historyitem_ParaRun_Lang_EastAsia:{if(!this.New.Lang)this.New.Lang=new CLang;this.New.Lang.EastAsia=oChange.New;break}case AscDFH.historyitem_ParaRun_Lang_Val:{if(!this.New.Lang)this.New.Lang=new CLang;this.New.Lang.Val=oChange.New;break}case AscDFH.historyitem_ParaRun_Unifill:{this.New.Unifill=oChange.New;break}case AscDFH.historyitem_ParaRun_Shd:{this.New.Shd= oChange.New;break}case AscDFH.historyitem_ParaRun_PrChange:{this.New.PrChange=oChange.New.PrChange;this.New.ReviewInfo=oChange.New.ReviewInfo;break}case AscDFH.historyitem_ParaRun_TextFill:{this.New.TextFil=oChange.New;break}case AscDFH.historyitem_ParaRun_TextOutline:{this.New.TextOutline=oChange.New;break}case AscDFH.historyitem_ParaRun_PrReviewInfo:{this.New.ReviewInfo=oChange.New;break}}return true};function CChangesRunUnifill(Class,Old,New,Color){AscDFH.CChangesBaseObjectProperty.call(this,Class, Old,New,Color)}CChangesRunUnifill.prototype=Object.create(AscDFH.CChangesBaseObjectProperty.prototype);CChangesRunUnifill.prototype.constructor=CChangesRunUnifill;CChangesRunUnifill.prototype.Type=AscDFH.historyitem_ParaRun_Unifill;CChangesRunUnifill.prototype.private_CreateObject=function(){return new AscFormat.CUniFill};CChangesRunUnifill.prototype.private_SetValue=function(Value){var oRun=this.Class;oRun.Pr.Unifill=Value;oRun.Recalc_CompiledPr(false);oRun.private_UpdateTrackRevisionOnChangeTextPr(false)}; CChangesRunUnifill.prototype.Load=function(Color){this.Redo();var Unifill=this.Class.Pr.Unifill;if(AscCommon.CollaborativeEditing&&Unifill&&Unifill.fill&&Unifill.fill.type===Asc.c_oAscFill.FILL_TYPE_BLIP&&typeof Unifill.fill.RasterImageId==="string"&&Unifill.fill.RasterImageId.length>0)AscCommon.CollaborativeEditing.Add_NewImage(Unifill.fill.RasterImageId);if(this.Color&&Color)this.Class.private_AddCollPrChangeOther(Color)};CChangesRunUnifill.prototype.Merge=private_ParaRunChangesOnMergeTextPr;function CChangesRunShd(Class, Old,New,Color){AscDFH.CChangesBaseObjectProperty.call(this,Class,Old,New,Color)}CChangesRunShd.prototype=Object.create(AscDFH.CChangesBaseObjectProperty.prototype);CChangesRunShd.prototype.constructor=CChangesRunShd;CChangesRunShd.prototype.Type=AscDFH.historyitem_ParaRun_Shd;CChangesRunShd.prototype.private_CreateObject=function(){return new CDocumentShd};CChangesRunShd.prototype.private_SetValue=function(Value){var oRun=this.Class;oRun.Pr.Shd=Value;oRun.Recalc_CompiledPr(false);oRun.private_UpdateTrackRevisionOnChangeTextPr(false)}; CChangesRunShd.prototype.Load=function(Color){this.Redo();var Unifill=this.Class.Pr.Unifill;if(AscCommon.CollaborativeEditing&&Unifill&&Unifill.fill&&Unifill.fill.type===Asc.c_oAscFill.FILL_TYPE_BLIP&&typeof Unifill.fill.RasterImageId==="string"&&Unifill.fill.RasterImageId.length>0)AscCommon.CollaborativeEditing.Add_NewImage(Unifill.fill.RasterImageId);if(this.Color&&Color)this.Class.private_AddCollPrChangeOther(Color)};CChangesRunShd.prototype.Merge=private_ParaRunChangesOnMergeTextPr;function CChangesRunMathStyle(Class, Old,New){AscDFH.CChangesBaseLongProperty.call(this,Class,Old,New)}CChangesRunMathStyle.prototype=Object.create(AscDFH.CChangesBaseLongProperty.prototype);CChangesRunMathStyle.prototype.constructor=CChangesRunMathStyle;CChangesRunMathStyle.prototype.Type=AscDFH.historyitem_ParaRun_MathStyle;CChangesRunMathStyle.prototype.private_SetValue=function(Value){var oRun=this.Class;oRun.MathPrp.sty=Value;oRun.Recalc_CompiledPr(true);oRun.private_UpdateTrackRevisionOnChangeTextPr(false)};CChangesRunMathStyle.prototype.Merge= function(oChange){if(oChange.Class!==this.Class)return true;if(this.Type===oChange.Type||AscDFH.historyitem_ParaRun_MathPrp===oChange.Type)return false;return true};function CChangesRunMathPrp(Class,Old,New,Color){AscDFH.CChangesBaseObjectProperty.call(this,Class,Old,New,Color)}CChangesRunMathPrp.prototype=Object.create(AscDFH.CChangesBaseObjectProperty.prototype);CChangesRunMathPrp.prototype.constructor=CChangesRunMathPrp;CChangesRunMathPrp.prototype.Type=AscDFH.historyitem_ParaRun_MathPrp;CChangesRunMathPrp.prototype.private_CreateObject= function(){return new CMPrp};CChangesRunMathPrp.prototype.private_IsCreateEmptyObject=function(){return true};CChangesRunMathPrp.prototype.private_SetValue=function(Value){var oRun=this.Class;oRun.MathPrp=Value;oRun.Recalc_CompiledPr(true);oRun.private_UpdateTrackRevisionOnChangeTextPr(false)};CChangesRunMathPrp.prototype.Merge=function(oChange){if(oChange.Class!==this.Class)return true;if(this.Type===oChange.Type)return false;if(!this.New)this.New=new CMPrp;if(AscDFH.historyitem_ParaRun_MathStyle=== oChange.Type)this.New.sty=oChange.New;else if(AscDFH.historyitem_ParaRun_MathAlnAt===oChange.Type){if(undefined!==this.New.brk)this.New.brk.Apply_AlnAt(oChange.New)}else if(AscDFH.historyitem_ParaRun_MathForcedBreak===oChange.Type)if(oChange.bInsert)this.New.Insert_ForcedBreak(oChange.alnAt);else this.New.Delete_ForcedBreak();return true};function CChangesRunReviewType(Class,Old,New,Color){AscDFH.CChangesBaseProperty.call(this,Class,Old,New,Color)}CChangesRunReviewType.prototype=Object.create(AscDFH.CChangesBaseProperty.prototype); CChangesRunReviewType.prototype.constructor=CChangesRunReviewType;CChangesRunReviewType.prototype.Type=AscDFH.historyitem_ParaRun_ReviewType;CChangesRunReviewType.prototype.WriteToBinary=function(Writer){Writer.WriteLong(this.New.ReviewType);this.New.ReviewInfo.Write_ToBinary(Writer);Writer.WriteLong(this.Old.ReviewType);this.Old.ReviewInfo.Write_ToBinary(Writer)};CChangesRunReviewType.prototype.ReadFromBinary=function(Reader){this.New={ReviewType:reviewtype_Common,ReviewInfo:new CReviewInfo};this.Old= {ReviewType:reviewtype_Common,ReviewInfo:new CReviewInfo};this.New.ReviewType=Reader.GetLong();this.New.ReviewInfo.Read_FromBinary(Reader);this.Old.ReviewType=Reader.GetLong();this.Old.ReviewInfo.Read_FromBinary(Reader)};CChangesRunReviewType.prototype.private_SetValue=function(Value){var oRun=this.Class;oRun.ReviewType=Value.ReviewType;oRun.ReviewInfo=Value.ReviewInfo;oRun.private_UpdateTrackRevisions()};CChangesRunReviewType.prototype.Merge=function(oChange){if(oChange.Class!==this.Class)return true; if(this.Type===oChange.Type)return false;if(AscDFH.historyitem_ParaRun_ContentReviewInfo===oChange.Type)this.New.ReviewInfo=oChange.New;return true};function CChangesRunPrChange(Class,Old,New,Color){AscDFH.CChangesBaseProperty.call(this,Class,Old,New,Color)}CChangesRunPrChange.prototype=Object.create(AscDFH.CChangesBaseProperty.prototype);CChangesRunPrChange.prototype.constructor=CChangesRunPrChange;CChangesRunPrChange.prototype.Type=AscDFH.historyitem_ParaRun_PrChange;CChangesRunPrChange.prototype.WriteToBinary= function(Writer){var nFlags=0;if(undefined===this.New.PrChange)nFlags|=1;if(undefined===this.New.ReviewInfo)nFlags|=2;if(undefined===this.Old.PrChange)nFlags|=4;if(undefined===this.Old.ReviewInfo)nFlags|=8;Writer.WriteLong(nFlags);if(undefined!==this.New.PrChange)this.New.PrChange.Write_ToBinary(Writer);if(undefined!==this.New.ReviewInfo)this.New.ReviewInfo.Write_ToBinary(Writer);if(undefined!==this.Old.PrChange)this.Old.PrChange.Write_ToBinary(Writer);if(undefined!==this.Old.ReviewInfo)this.Old.ReviewInfo.Write_ToBinary(Writer)}; CChangesRunPrChange.prototype.ReadFromBinary=function(Reader){var nFlags=Reader.GetLong();this.New={PrChange:undefined,ReviewInfo:undefined};this.Old={PrChange:undefined,ReviewInfo:undefined};if(nFlags&1)this.New.PrChange=undefined;else{this.New.PrChange=new CTextPr;this.New.PrChange.Read_FromBinary(Reader)}if(nFlags&2)this.New.ReviewInfo=undefined;else{this.New.ReviewInfo=new CReviewInfo;this.New.ReviewInfo.Read_FromBinary(Reader)}if(nFlags&4)this.Old.PrChange=undefined;else{this.Old.PrChange=new CTextPr; this.Old.PrChange.Read_FromBinary(Reader)}if(nFlags&8)this.Old.ReviewInfo=undefined;else{this.Old.ReviewInfo=new CReviewInfo;this.Old.ReviewInfo.Read_FromBinary(Reader)}};CChangesRunPrChange.prototype.private_SetValue=function(Value){var oRun=this.Class;oRun.Pr.PrChange=Value.PrChange;oRun.Pr.ReviewInfo=Value.ReviewInfo;oRun.private_UpdateTrackRevisions()};CChangesRunPrChange.prototype.Merge=function(oChange){if(this.Class!==oChange.Class)return true;if(this.Type===oChange.Type||AscDFH.historyitem_ParaRun_TextPr=== oChange.Type)return false;if(AscDFH.historyitem_ParaRun_PrReviewInfo===oChange.Type)this.New.ReviewInfo=oChange.New;return true};function CChangesRunTextFill(Class,Old,New,Color){AscDFH.CChangesBaseObjectProperty.call(this,Class,Old,New,Color)}CChangesRunTextFill.prototype=Object.create(AscDFH.CChangesBaseObjectProperty.prototype);CChangesRunTextFill.prototype.constructor=CChangesRunTextFill;CChangesRunTextFill.prototype.Type=AscDFH.historyitem_ParaRun_TextFill;CChangesRunTextFill.prototype.private_CreateObject= function(){return new AscFormat.CUniFill};CChangesRunTextFill.prototype.private_SetValue=function(Value){var oRun=this.Class;oRun.Pr.TextFill=Value;oRun.Recalc_CompiledPr(false);oRun.private_UpdateTrackRevisionOnChangeTextPr(false)};CChangesRunTextFill.prototype.Load=function(Color){this.Redo();if(this.Color&&Color)this.Class.private_AddCollPrChangeOther(Color)};CChangesRunTextFill.prototype.Merge=private_ParaRunChangesOnMergeTextPr;function CChangesRunTextOutline(Class,Old,New,Color){AscDFH.CChangesBaseObjectProperty.call(this, Class,Old,New,Color)}CChangesRunTextOutline.prototype=Object.create(AscDFH.CChangesBaseObjectProperty.prototype);CChangesRunTextOutline.prototype.constructor=CChangesRunTextOutline;CChangesRunTextOutline.prototype.Type=AscDFH.historyitem_ParaRun_TextOutline;CChangesRunTextOutline.prototype.private_CreateObject=function(){return new AscFormat.CLn};CChangesRunTextOutline.prototype.private_SetValue=function(Value){var oRun=this.Class;oRun.Pr.TextOutline=Value;oRun.Recalc_CompiledPr(false);oRun.private_UpdateTrackRevisionOnChangeTextPr(false)}; CChangesRunTextOutline.prototype.Load=function(Color){this.Redo();if(this.Color&&Color)this.Class.private_AddCollPrChangeOther(Color)};CChangesRunTextOutline.prototype.Merge=private_ParaRunChangesOnMergeTextPr;function CChangesRunPrReviewInfo(Class,Old,New,Color){AscDFH.CChangesBaseObjectProperty.call(this,Class,Old,New,Color)}CChangesRunPrReviewInfo.prototype=Object.create(AscDFH.CChangesBaseObjectProperty.prototype);CChangesRunPrReviewInfo.prototype.constructor=CChangesRunPrReviewInfo;CChangesRunPrReviewInfo.prototype.Type= AscDFH.historyitem_ParaRun_PrReviewInfo;CChangesRunPrReviewInfo.prototype.private_CreateObject=function(){return new CReviewInfo};CChangesRunPrReviewInfo.prototype.private_SetValue=function(Value){var oRun=this.Class;oRun.Pr.ReviewInfo=Value};CChangesRunPrReviewInfo.prototype.Merge=function(oChange){if(this.Class!==oChange.Class)return true;if(this.Type===oChange.Type||AscDFH.historyitem_ParaRun_TextPr===oChange.Type||AscDFH.historyitem_ParaRun_PrChange===oChange.Type)return false;return true};function CChangesRunContentReviewInfo(Class, Old,New,Color){AscDFH.CChangesBaseObjectProperty.call(this,Class,Old,New,Color)}CChangesRunContentReviewInfo.prototype=Object.create(AscDFH.CChangesBaseObjectProperty.prototype);CChangesRunContentReviewInfo.prototype.constructor=CChangesRunContentReviewInfo;CChangesRunContentReviewInfo.prototype.Type=AscDFH.historyitem_ParaRun_ContentReviewInfo;CChangesRunContentReviewInfo.prototype.private_CreateObject=function(){return new CReviewInfo};CChangesRunContentReviewInfo.prototype.private_IsCreateEmptyObject= function(){return true};CChangesRunContentReviewInfo.prototype.private_SetValue=function(Value){var oRun=this.Class;oRun.ReviewInfo=Value};CChangesRunContentReviewInfo.prototype.Merge=function(oChange){if(oChange.Class!==this.Class)return true;if(this.Type===oChange.Type||AscDFH.historyitem_ParaRun_ReviewType===oChange.Type)return false;return true};function CChangesRunOnStartSplit(Class,Pos){AscDFH.CChangesBase.call(this,Class);this.Pos=Pos}CChangesRunOnStartSplit.prototype=Object.create(AscDFH.CChangesBase.prototype); CChangesRunOnStartSplit.prototype.constructor=CChangesRunOnStartSplit;CChangesRunOnStartSplit.prototype.Type=AscDFH.historyitem_ParaRun_OnStartSplit;CChangesRunOnStartSplit.prototype.Undo=function(){};CChangesRunOnStartSplit.prototype.Redo=function(){};CChangesRunOnStartSplit.prototype.WriteToBinary=function(Writer){Writer.WriteLong(this.Pos)};CChangesRunOnStartSplit.prototype.ReadFromBinary=function(Reader){this.Pos=Reader.GetLong()};CChangesRunOnStartSplit.prototype.Load=function(){if(AscCommon.CollaborativeEditing)AscCommon.CollaborativeEditing.OnStart_SplitRun(this.Class, this.Pos)};CChangesRunOnStartSplit.prototype.CreateReverseChange=function(){return null};CChangesRunOnStartSplit.prototype.Merge=function(oChange){return true};function CChangesRunOnEndSplit(Class,NewRun){AscDFH.CChangesBase.call(this,Class);this.NewRun=NewRun}CChangesRunOnEndSplit.prototype=Object.create(AscDFH.CChangesBase.prototype);CChangesRunOnEndSplit.prototype.constructor=CChangesRunOnEndSplit;CChangesRunOnEndSplit.prototype.Type=AscDFH.historyitem_ParaRun_OnEndSplit;CChangesRunOnEndSplit.prototype.Undo= function(){};CChangesRunOnEndSplit.prototype.Redo=function(){};CChangesRunOnEndSplit.prototype.WriteToBinary=function(Writer){Writer.WriteString2(this.NewRun.Get_Id())};CChangesRunOnEndSplit.prototype.ReadFromBinary=function(Reader){var RunId=Reader.GetString2();this.NewRun=g_oTableId.Get_ById(RunId)};CChangesRunOnEndSplit.prototype.Load=function(){if(AscCommon.CollaborativeEditing)AscCommon.CollaborativeEditing.OnEnd_SplitRun(this.NewRun)};CChangesRunOnEndSplit.prototype.CreateReverseChange=function(){return null}; CChangesRunOnEndSplit.prototype.Merge=function(oChange){return true};function CChangesRunMathAlnAt(Class,Old,New){AscDFH.CChangesBaseProperty.call(this,Class,Old,New)}CChangesRunMathAlnAt.prototype=Object.create(AscDFH.CChangesBaseProperty.prototype);CChangesRunMathAlnAt.prototype.constructor=CChangesRunMathAlnAt;CChangesRunMathAlnAt.prototype.Type=AscDFH.historyitem_ParaRun_MathAlnAt;CChangesRunMathAlnAt.prototype.private_SetValue=function(Value){this.Class.MathPrp.Apply_AlnAt(Value)};CChangesRunMathAlnAt.prototype.WriteToBinary= function(Writer){var nFlags=0;if(undefined===this.New)nFlags|=1;if(undefined===this.Old)nFlags|=2;Writer.WriteLong(nFlags);if(undefined!==this.New)Writer.WriteLong(this.New);if(undefined!==this.Old)Writer.WriteLong(this.Old)};CChangesRunMathAlnAt.prototype.ReadFromBinary=function(Reader){var nFlags=Reader.GetLong();if(nFlags&1)this.New=undefined;else this.New=Reader.GetLong();if(nFlags&2)this.Old=undefined;else this.Old=Reader.GetLong()};CChangesRunMathAlnAt.prototype.Merge=function(oChange){if(this.Class!== oChange.Class)return true;if(this.Type===oChange.Type||AscDFH.historyitem_ParaRun_MathPrp===oChange.Type||AscDFH.historyitem_ParaRun_MathForcedBreak===oChange.Type)return false;return true};function CChangesRunMathForcedBreak(Class,bInsert,alnAt){AscDFH.CChangesBase.call(this,Class);this.bInsert=bInsert;this.alnAt=alnAt}CChangesRunMathForcedBreak.prototype=Object.create(AscDFH.CChangesBase.prototype);CChangesRunMathForcedBreak.prototype.constructor=CChangesRunMathForcedBreak;CChangesRunMathForcedBreak.prototype.Type= AscDFH.historyitem_ParaRun_MathForcedBreak;CChangesRunMathForcedBreak.prototype.Undo=function(){var oRun=this.Class;if(this.bInsert)oRun.MathPrp.Delete_ForcedBreak();else oRun.MathPrp.Insert_ForcedBreak(this.alnAt)};CChangesRunMathForcedBreak.prototype.Redo=function(){var oRun=this.Class;if(this.bInsert)oRun.MathPrp.Insert_ForcedBreak(this.alnAt);else oRun.MathPrp.Delete_ForcedBreak()};CChangesRunMathForcedBreak.prototype.WriteToBinary=function(Writer){var nFlags=0;if(true===this.bInsert)nFlags|= 1;if(undefined===this.alnAt)nFlags|=2;Writer.WriteLong(nFlags);if(undefined!==this.alnAt)Writer.WriteLong(this.alnAt)};CChangesRunMathForcedBreak.prototype.ReadFromBinary=function(Reader){var nFlags=Reader.GetLong();if(nFlags&1)this.bInsert=true;else this.bInsert=false;if(nFlags&2)this.alnAt=undefined;else this.alnAt=Reader.GetLong()};CChangesRunMathForcedBreak.prototype.CreateReverseChange=function(){return new CChangesRunMathForcedBreak(this.Class,!this.bInsert,this.alnAt)};CChangesRunMathForcedBreak.prototype.Merge= function(oChange){if(this.Class!==oChange.Class)return true;if(this.Type===oChange.Type||AscDFH.historyitem_ParaRun_MathPrp===oChange.Type)return false;if(AscDFH.historyitem_ParaRun_MathAlnAt===oChange.Type)this.alnAt=oChange.New;return true};"use strict";var align_Right=AscCommon.align_Right;var align_Left=AscCommon.align_Left;var align_Center=AscCommon.align_Center;var align_Justify=AscCommon.align_Justify;var c_oAscRevisionsChangeType=Asc.c_oAscRevisionsChangeType;var g_oTableId=AscCommon.g_oTableId; var History=AscCommon.History;var g_dMathArgSizeKoeff_1=.76;var g_dMathArgSizeKoeff_2=.6498;function CMathPropertiesSettings(){this.brkBin=null;this.defJc=null;this.dispDef=null;this.intLim=null;this.naryLim=null;this.lMargin=null;this.rMargin=null;this.wrapIndent=null;this.wrapRight=null;this.smallFrac=null;this.brkBinSub=null;this.mathFont=null;this.interSp=null;this.intraSp=null;this.postSp=null;this.preSp=null}CMathPropertiesSettings.prototype.SetDefaultPr=function(){this.brkBin=BREAK_BEFORE; this.defJc=align_Justify;this.dispDef=true;this.intLim=NARY_SubSup;this.mathFont={Name:"Cambria Math",Index:-1};this.lMargin=0;this.naryLim=NARY_UndOvr;this.rMargin=0;this.smallFrac=false;this.wrapIndent=25;this.wrapRight=false};CMathPropertiesSettings.prototype.Merge=function(Pr){if(Pr.wrapIndent!==null&&Pr.wrapIndent!==undefined)this.wrapIndent=Pr.wrapIndent;if(Pr.lMargin!==null&&Pr.lMargin!==undefined)this.lMargin=Pr.lMargin;if(Pr.rMargin!==null&&Pr.rMargin!==undefined)this.rMargin=Pr.rMargin; if(Pr.intLim!==null&&Pr.intLim!==undefined)this.intLim=Pr.intLim;if(Pr.naryLim!==null&&Pr.naryLim!==undefined)this.naryLim=Pr.naryLim;if(Pr.defJc!==null&&Pr.defJc!==undefined)this.defJc=Pr.defJc;if(Pr.brkBin!==null&&Pr.brkBin!==undefined)this.brkBin=Pr.brkBin;if(Pr.dispDef!==null&&Pr.dispDef!==undefined)this.dispDef=Pr.dispDef;if(Pr.mathFont!==null&&Pr.mathFont!==undefined)this.mathFont=Pr.mathFont;if(Pr.wrapRight!==null&&Pr.wrapRight!==undefined)this.wrapRight=Pr.wrapRight;if(Pr.smallFrac!==null&& Pr.smallFrac!==undefined)this.smallFrac=Pr.smallFrac};CMathPropertiesSettings.prototype.Copy=function(){var NewPr=new CMathPropertiesSettings;NewPr.brkBin=this.brkBin;NewPr.defJc=this.defJc;NewPr.dispDef=this.dispDef;NewPr.intLim=this.intLim;NewPr.lMargin=this.lMargin;NewPr.naryLim=this.naryLim;NewPr.rMargin=this.rMargin;NewPr.wrapIndent=this.wrapIndent;NewPr.brkBinSub=this.brkBinSub;NewPr.interSp=this.interSp;NewPr.intraSp=this.intraSp;NewPr.mathFont=this.mathFont;NewPr.postSp=this.postSp;NewPr.preSp= this.preSp;NewPr.smallFrac=this.smallFrac;NewPr.wrapRight=this.wrapRight;return NewPr};CMathPropertiesSettings.prototype.Write_ToBinary=function(Writer){var StartPos=Writer.GetCurPosition();Writer.Skip(4);var Flags=0;if(undefined!==this.brkBin){Writer.WriteLong(this.brkBin);Flags|=1}if(undefined!==this.brkBinSub){Writer.WriteLong(this.brkBinSub);Flags|=2}if(undefined!==this.defJc){Writer.WriteLong(this.defJc);Flags|=4}if(undefined!==this.dispDef){Writer.WriteBool(this.dispDef);Flags|=8}if(undefined!== this.interSp){Writer.WriteLong(this.interSp);Flags|=16}if(undefined!==this.intLim){Writer.WriteLong(this.intLim);Flags|=32}if(undefined!==this.intraSp){Writer.WriteLong(this.intraSp);Flags|=64}if(undefined!==this.lMargin){Writer.WriteLong(this.lMargin);Flags|=128}if(undefined!==this.mathFont){Writer.WriteString2(this.mathFont.Name);Flags|=256}if(undefined!==this.naryLim){Writer.WriteLong(this.naryLim);Flags|=512}if(undefined!==this.postSp){Writer.WriteLong(this.postSp);Flags|=1024}if(undefined!== this.preSp){Writer.WriteLong(this.preSp);Flags|=2048}if(undefined!==this.rMargin){Writer.WriteLong(this.rMargin);Flags|=4096}if(undefined!==this.smallFrac){Writer.WriteBool(this.smallFrac);Flags|=8192}if(undefined!==this.wrapIndent){Writer.WriteLong(this.wrapIndent);Flags|=16384}if(undefined!==this.wrapRight){Writer.WriteBool(this.wrapRight);Flags|=32768}var EndPos=Writer.GetCurPosition();Writer.Seek(StartPos);Writer.WriteLong(Flags);Writer.Seek(EndPos)};CMathPropertiesSettings.prototype.Read_FromBinary= function(Reader){var Flags=Reader.GetLong();if(Flags&1)this.brkBin=Reader.GetLong();if(Flags&2)this.brkBinSub=Reader.GetLong();if(Flags&4)this.defJc=Reader.GetLong();if(Flags&8)this.dispDef=Reader.GetBool();if(Flags&16)this.interSp=Reader.GetLong();if(Flags&32)this.intLim=Reader.GetLong();if(Flags&64)this.intraSp=Reader.GetLong();if(Flags&128)this.lMargin=Reader.GetLong();if(Flags&256)this.mathFont={Name:Reader.GetString2(),Index:-1};if(Flags&512)this.naryLim=Reader.GetLong();if(Flags&1024)this.postSp= Reader.GetLong();if(Flags&2048)this.preSp=Reader.GetLong();if(Flags&4096)this.rMargin=Reader.GetLong();if(Flags&8192)this.smallFrac=Reader.GetBool();if(Flags&16384)this.wrapIndent=Reader.GetLong();if(Flags&32768)this.wrapRight=Reader.GetBool()};function CMathSettings(){this.Pr=new CMathPropertiesSettings;this.CompiledPr=new CMathPropertiesSettings;this.DefaultPr=new CMathPropertiesSettings;this.DefaultPr.SetDefaultPr();this.bNeedCompile=true}CMathSettings.prototype.SetPr=function(Pr){this.bNeedCompile= true;this.Pr.Merge(Pr);this.SetCompiledPr()};CMathSettings.prototype.GetPr=function(){return this.Pr};CMathSettings.prototype.SetCompiledPr=function(){if(this.bNeedCompile){this.CompiledPr.Merge(this.DefaultPr);this.CompiledPr.Merge(this.Pr);this.bNeedCompile=false}};CMathSettings.prototype.GetPrDispDef=function(){var Pr;if(this.CompiledPr.dispDef==false)Pr=this.DefaultPr;else Pr=this.CompiledPr;return Pr};CMathSettings.prototype.Get_WrapIndent=function(WrapState){this.SetCompiledPr();var wrapIndent= 0;if(this.wrapRight==false&&(WrapState==ALIGN_MARGIN_WRAP||WrapState==ALIGN_WRAP))wrapIndent=this.GetPrDispDef().wrapIndent;return wrapIndent};CMathSettings.prototype.Get_LeftMargin=function(WrapState){this.SetCompiledPr();var lMargin=0;if(WrapState==ALIGN_MARGIN_WRAP||WrapState==ALIGN_MARGIN)lMargin=this.GetPrDispDef().lMargin;return lMargin};CMathSettings.prototype.Get_RightMargin=function(WrapState){this.SetCompiledPr();var rMargin=0;if(WrapState==ALIGN_MARGIN_WRAP||WrapState==ALIGN_MARGIN)rMargin= this.GetPrDispDef().rMargin;return rMargin};CMathSettings.prototype.Get_IntLim=function(){this.SetCompiledPr();return this.CompiledPr.intLim};CMathSettings.prototype.Get_NaryLim=function(){this.SetCompiledPr();return this.CompiledPr.naryLim};CMathSettings.prototype.Get_DefJc=function(){this.SetCompiledPr();return this.GetPrDispDef().defJc};CMathSettings.prototype.Get_DispDef=function(){this.SetCompiledPr();return this.CompiledPr.dispDef};CMathSettings.prototype.Get_BrkBin=function(){this.SetCompiledPr(); return this.CompiledPr.brkBin};CMathSettings.prototype.Get_WrapRight=function(){this.SetCompiledPr();return this.CompiledPr.wrapRight};CMathSettings.prototype.Get_SmallFrac=function(){this.SetCompiledPr();return this.CompiledPr.smallFrac};CMathSettings.prototype.Get_MenuProps=function(){return new CMathMenuSettings(this.CompiledPr)};CMathSettings.prototype.Set_MenuProps=function(Props){if(Props.BrkBin!==undefined)this.Pr.brkBin=Props.BrkBin==c_oAscMathInterfaceSettingsBrkBin.BreakAfter?BREAK_AFTER: BREAK_BEFORE;if(Props.Justification!==undefined)switch(Props.Justification){case c_oAscMathInterfaceSettingsAlign.Justify:{this.Pr.defJc=align_Justify;break}case c_oAscMathInterfaceSettingsAlign.Center:{this.Pr.defJc=align_Center;break}case c_oAscMathInterfaceSettingsAlign.Left:{this.Pr.defJc=align_Left;break}case c_oAscMathInterfaceSettingsAlign.Right:{this.Pr.defJc=align_Right;break}}if(Props.UseSettings!==undefined)this.Pr.dispDef=Props.UseSettings;if(Props.IntLim!==undefined)if(Props.IntLim== Asc.c_oAscMathInterfaceNaryLimitLocation.SubSup)this.Pr.intLim=NARY_SubSup;else if(Props.IntLim==Asc.c_oAscMathInterfaceNaryLimitLocation.UndOvr)this.Pr.intLim=NARY_UndOvr;if(Props.NaryLim!==undefined)if(Props.NaryLim==Asc.c_oAscMathInterfaceNaryLimitLocation.SubSup)this.Pr.naryLim=NARY_SubSup;else if(Props.NaryLim==Asc.c_oAscMathInterfaceNaryLimitLocation.UndOvr)this.Pr.naryLim=NARY_UndOvr;if(Props.LeftMargin!==undefined&&Props.LeftMargin==Props.LeftMargin+0)this.Pr.lMargin=Props.LeftMargin;if(Props.RightMargin!== undefined&&Props.RightMargin==Props.RightMargin+0)this.Pr.rMargin=Props.RightMargin;if(Props.WrapIndent!==undefined&&Props.WrapIndent==Props.WrapIndent+0)this.Pr.wrapIndent=Props.WrapIndent;if(Props.WrapRight!==undefined&&Props.WrapRight!==null)this.Pr.wrapRight=Props.WrapRight;this.bNeedCompile=true};CMathSettings.prototype.Write_ToBinary=function(Writer){this.Pr.Write_ToBinary(Writer)};CMathSettings.prototype.Read_FromBinary=function(Reader){this.Pr.Read_FromBinary(Reader);this.bNeedCompile=true}; function CMathMenuSettings(oMathPr){if(oMathPr){this.BrkBin=oMathPr.brkBin===BREAK_AFTER?c_oAscMathInterfaceSettingsBrkBin.BreakAfter:c_oAscMathInterfaceSettingsBrkBin.BreakBefore;switch(oMathPr.defJc){case align_Justify:{this.Justification=c_oAscMathInterfaceSettingsAlign.Justify;break}case align_Center:{this.Justification=c_oAscMathInterfaceSettingsAlign.Center;break}case align_Left:{this.Justification=c_oAscMathInterfaceSettingsAlign.Left;break}case align_Right:{this.Justification=c_oAscMathInterfaceSettingsAlign.Right; break}default:{this.Justification=align_Justify;break}}this.UseSettings=oMathPr.dispDef;this.IntLim=oMathPr.intLim===NARY_SubSup?Asc.c_oAscMathInterfaceNaryLimitLocation.SubSup:Asc.c_oAscMathInterfaceNaryLimitLocation.UndOvr;this.NaryLim=oMathPr.naryLim===NARY_SubSup?Asc.c_oAscMathInterfaceNaryLimitLocation.SubSup:Asc.c_oAscMathInterfaceNaryLimitLocation.UndOvr;this.LeftMargin=oMathPr.lMargin/10;this.RightMargin=oMathPr.rMargin/10;this.WrapIndent=oMathPr.wrapIndent/10;this.WrapRight=oMathPr.wrapRight; this.SmallFraction=oMathPr.smallFrac}else{this.BrkBin=undefined;this.Justification=undefined;this.UseSettings=undefined;this.IntLim=undefined;this.NaryLim=undefined;this.LeftMargin=undefined;this.RightMargin=undefined;this.WrapIndent=undefined;this.WrapRight=undefined;this.SmallFraction=undefined}}CMathMenuSettings.prototype.get_BreakBin=function(){return this.BrkBin};CMathMenuSettings.prototype.put_BreakBin=function(BreakBin){this.BrkBin=BreakBin};CMathMenuSettings.prototype.get_UseSettings=function(){return this.UseSettings}; CMathMenuSettings.prototype.put_UseSettings=function(UseSettings){this.UseSettings=UseSettings};CMathMenuSettings.prototype.get_Justification=function(){return this.Justification};CMathMenuSettings.prototype.put_Justification=function(Align){this.Justification=Align};CMathMenuSettings.prototype.get_IntLim=function(){return this.IntLim};CMathMenuSettings.prototype.put_IntLim=function(IntLim){this.IntLim=IntLim};CMathMenuSettings.prototype.get_NaryLim=function(){return this.NaryLim};CMathMenuSettings.prototype.put_NaryLim= function(NaryLim){this.NaryLim=NaryLim};CMathMenuSettings.prototype.get_LeftMargin=function(){return this.LeftMargin};CMathMenuSettings.prototype.put_LeftMargin=function(lMargin){this.LeftMargin=lMargin};CMathMenuSettings.prototype.get_RightMargin=function(){return this.RightMargin};CMathMenuSettings.prototype.put_RightMargin=function(rMargin){this.RightMargin=rMargin};CMathMenuSettings.prototype.get_WrapIndent=function(){return this.WrapIndent};CMathMenuSettings.prototype.put_WrapIndent=function(WrapIndent){this.WrapIndent= WrapIndent};CMathMenuSettings.prototype.get_WrapRight=function(){return this.WrapRight};CMathMenuSettings.prototype.put_WrapRight=function(WrapRight){this.WrapRight=WrapRight};CMathMenuSettings.prototype.get_SmallFraction=function(){return this.SmallFraction};CMathMenuSettings.prototype.put_SmallFraction=function(SmallFrac){this.SmallFraction=SmallFrac};window["CMathMenuSettings"]=CMathMenuSettings;CMathMenuSettings.prototype["get_BreakBin"]=CMathMenuSettings.prototype.get_BreakBin;CMathMenuSettings.prototype["put_BreakBin"]= CMathMenuSettings.prototype.put_BreakBin;CMathMenuSettings.prototype["get_UseSettings"]=CMathMenuSettings.prototype.get_UseSettings;CMathMenuSettings.prototype["put_UseSettings"]=CMathMenuSettings.prototype.put_UseSettings;CMathMenuSettings.prototype["get_Justification"]=CMathMenuSettings.prototype.get_Justification;CMathMenuSettings.prototype["put_Justification"]=CMathMenuSettings.prototype.put_Justification;CMathMenuSettings.prototype["get_IntLim"]=CMathMenuSettings.prototype.get_IntLim;CMathMenuSettings.prototype["put_IntLim"]= CMathMenuSettings.prototype.put_IntLim;CMathMenuSettings.prototype["get_NaryLim"]=CMathMenuSettings.prototype.get_NaryLim;CMathMenuSettings.prototype["put_NaryLim"]=CMathMenuSettings.prototype.put_NaryLim;CMathMenuSettings.prototype["get_LeftMargin"]=CMathMenuSettings.prototype.get_LeftMargin;CMathMenuSettings.prototype["put_LeftMargin"]=CMathMenuSettings.prototype.put_LeftMargin;CMathMenuSettings.prototype["get_RightMargin"]=CMathMenuSettings.prototype.get_RightMargin;CMathMenuSettings.prototype["put_RightMargin"]= CMathMenuSettings.prototype.put_RightMargin;CMathMenuSettings.prototype["get_WrapIndent"]=CMathMenuSettings.prototype.get_WrapIndent;CMathMenuSettings.prototype["put_WrapIndent"]=CMathMenuSettings.prototype.put_WrapIndent;CMathMenuSettings.prototype["get_WrapRight"]=CMathMenuSettings.prototype.get_WrapRight;CMathMenuSettings.prototype["put_WrapRight"]=CMathMenuSettings.prototype.put_WrapRight;CMathMenuSettings.prototype["get_SmallFraction"]=CMathMenuSettings.prototype.get_SmallFraction;CMathMenuSettings.prototype["put_SmallFraction"]= CMathMenuSettings.prototype.put_SmallFraction;function Get_WordDocumentDefaultMathSettings(){if(!editor||!editor.WordControl.m_oLogicDocument||!editor.WordControl.m_oLogicDocument.Settings)return new CMathSettings;return editor.WordControl.m_oLogicDocument.Settings.MathSettings}function MathMenu(type){this.Type=para_Math;this.Menu=type==undefined?c_oAscMathType.Default_Text:type;this.Text=null}MathMenu.prototype.Get_Type=function(){return this.Type};MathMenu.prototype.GetType=function(){return this.Type}; MathMenu.prototype.SetText=function(sText){this.Text=sText};MathMenu.prototype.GetText=function(){return this.Text};function CMathLineState(){this.StyleLine=MATH_LINE_WRAP;this.Width=0;this.SpaceAlign=0;this.MaxWidth=0;this.WrapState=ALIGN_EMPTY}function CMathLineInfo(){this.StyleLine=MATH_LINE_WRAP;this.Measure=0;this.SpaceAlign=0;this.bWordLarge=false}CMathLineInfo.prototype.Get_GeneralWidth=function(){return this.Measure+this.SpaceAlign};function CParaMathLineParameters(FirstLineNumber){this.FirstLineNumber= FirstLineNumber;this.WrapState=ALIGN_EMPTY;this.LineParameters=[];this.MaxW=0;this.bMathWordLarge=false;this.NeedUpdateWrap=true}CParaMathLineParameters.prototype.UpdateWidth=function(Line,W){var bUpdMaxWidth=false;var NumLine=this.private_GetNumberLine(Line);if(Math.abs(this.LineParameters[NumLine].Measure-W)>1E-5){var Max=this.MaxW;var CountLines=this.LineParameters.length;this.LineParameters[NumLine].Measure=W;this.MaxW=this.LineParameters[0].Get_GeneralWidth();for(var Pos=1;Pos1E-4}return bUpdMaxWidth};CParaMathLineParameters.prototype.Set_WordLarge=function(Line,bWordLarge){var NumLine=this.private_GetNumberLine(Line);if(this.WrapState!==ALIGN_EMPTY)bWordLarge=false;if(bWordLarge){this.bMathWordLarge=true;this.LineParameters[NumLine].bWordLarge=true}else{this.bMathWordLarge=false;var CountLines=this.LineParameters.length;for(var Pos=0;Pos=this.LineParameters.length){this.LineParameters[NumLine]=new CMathLineInfo;if(bStartLine)this.LineParameters[NumLine].StyleLine=MATH_LINE_START;else if(AlignAt!==undefined&&AlignAt!==null){this.LineParameters[NumLine].StyleLine=MATH_LINE_ALiGN_AT;this.LineParameters[NumLine].SpaceAlign= AlignAt}else{var MathSettings=Get_WordDocumentDefaultMathSettings();this.LineParameters[NumLine].StyleLine=MATH_LINE_WRAP;this.LineParameters[NumLine].SpaceAlign=bStartPage==true?MathSettings.Get_WrapIndent(this.WrapState):0}bInsideBounds=false}return bInsideBounds};CParaMathLineParameters.prototype.Is_Large=function(){return this.bMathWordLarge};CParaMathLineParameters.prototype.Get_MaxWidth=function(){return this.MaxW};CParaMathLineParameters.prototype.private_GetNumberLine=function(NumLine){return NumLine- this.FirstLineNumber};CParaMathLineParameters.prototype.Get_LineState=function(Line){var NumLine=this.private_GetNumberLine(Line);var LineInfo=this.LineParameters[NumLine];var LineState=new CMathLineState;LineState.StyleLine=LineInfo.StyleLine;LineState.Width=LineInfo.Measure;LineState.SpaceAlign=this.Get_SpaceAlign(Line);LineState.MaxWidth=this.MaxW;LineState.WrapState=this.WrapState;return LineState};CParaMathLineParameters.prototype.Get_SpaceAlign=function(Line){var NumLine=this.private_GetNumberLine(Line); var SpaceAlign=0;if(this.bMathWordLarge==false&&(this.WrapState==ALIGN_MARGIN_WRAP||this.WrapState==ALIGN_WRAP))SpaceAlign=this.LineParameters[NumLine].SpaceAlign;return SpaceAlign};function CMathPageInfo(){this.WPages=[];this.StartLine=-1;this.StartPage=-1;this.CurPage=-1;this.RelativePage=-1}CMathPageInfo.prototype.Reset=function(){this.StartLine=-1;this.StartPage=-1;this.CurPage=-1;this.RelativePage=-1;this.WPages.length=0};CMathPageInfo.prototype.Reset_Page=function(_Page){if(this.StartPage>= 0){var Page=_Page-this.StartPage;if(Page=Lng){var FirstLineOnPage=ParaLine-this.StartLine;this.WPages[this.CurPage]= new CParaMathLineParameters(FirstLineOnPage)}};CMathPageInfo.prototype.Update_CurrentWrap=function(DispDef,bInline){if(this.WPages[this.CurPage].NeedUpdateWrap==true){var WrapState;if(DispDef==false||bInline==true)WrapState=ALIGN_EMPTY;else if(this.CurPage==0)WrapState=ALIGN_MARGIN_WRAP;else WrapState=ALIGN_MARGIN;this.WPages[this.CurPage].WrapState=WrapState;this.WPages[this.CurPage].NeedUpdateWrap=false}};CMathPageInfo.prototype.Set_NeedUpdateWrap=function(){this.WPages[this.CurPage].NeedUpdateWrap= true};CMathPageInfo.prototype.Set_CurrentWrapState=function(WrapState){this.WPages[this.CurPage].WrapState=WrapState};CMathPageInfo.prototype.Set_NextWrapState=function(){var InfoPage=this.WPages[this.CurPage];if(InfoPage.WrapState!==ALIGN_EMPTY)InfoPage.WrapState++};CMathPageInfo.prototype.Set_StateWordLarge=function(_Line,bWordLarge){this.WPages[this.CurPage].Set_WordLarge(_Line-this.StartLine,bWordLarge)};CMathPageInfo.prototype.Get_CurrentWrapState=function(){return this.WPages[this.CurPage].WrapState}; CMathPageInfo.prototype.Get_CurrentStateWordLarge=function(){return this.WPages[this.CurPage].Is_Large()};CMathPageInfo.prototype.UpdateWidth=function(_Line,Width){return this.WPages[this.CurPage].UpdateWidth(_Line-this.StartLine,Width)};CMathPageInfo.prototype.Get_MaxWidthOnCurrentPage=function(){return this.WPages[this.CurPage].Get_MaxWidth()};CMathPageInfo.prototype.Get_FirstLineOnPage=function(_Page){var FirstLineOnPage=this.StartLine;var Page=_Page-this.StartPage;if(Page>=0&&Page=0){var Page= _Page-this.StartPage;if(PageMaxWidth?XStart+(XEnd-XStart-MaxWidth)/2+WrapLine:XStart;else X=XEnd-XStart>MaxWidth?XStart+WrapLine:XStart;return X};ParaMath.prototype.Remove=function(Direction,bOnAddText){var TrackRevisions=null;if(this.Paragraph&&this.Paragraph.LogicDocument)TrackRevisions=this.Paragraph.LogicDocument.IsTrackRevisions();var oSelectedContent=this.GetSelectContent();var nStartPos=oSelectedContent.Start;var nEndPos=oSelectedContent.End;var oContent=oSelectedContent.Content; if(nStartPos===nEndPos){var oElement=oContent.getElem(nStartPos);var ElementReviewType=oElement.GetReviewType();if(para_Math_Run===oElement.Type){if(true===oElement.IsPlaceholder()&&oElement.Parent.bRoot==true){this.Root.Remove_FromContent(0,1);return true}else if(true===oElement.IsPlaceholder()||false===oElement.Remove(Direction)&&true!==this.bSelectionUse){if(Direction>0&&oContent.Content.length-1===nStartPos||Direction<0&&0===nStartPos){if(oContent.bRoot)return false;oContent.ParentElement.Select_WholeElement(); return true}if(Direction>0){var oNextElement=oContent.getElem(nStartPos+1);if(para_Math_Run===oNextElement.Type){oNextElement.MoveCursorToStartPos();oNextElement.Remove(1);if(oNextElement.Is_Empty()){oContent.Correct_Content();oContent.Correct_ContentPos(1)}this.RemoveSelection()}else oContent.Select_ElementByPos(nStartPos+1,true)}else{var oPrevElement=oContent.getElem(nStartPos-1);if(para_Math_Run===oPrevElement.Type){oPrevElement.MoveCursorToEndPos();oPrevElement.Remove(-1);if(oPrevElement.Is_Empty()){oContent.Correct_Content(); oContent.Correct_ContentPos(-1)}this.RemoveSelection()}else oContent.Select_ElementByPos(nStartPos-1,true)}}else{if(oElement.Is_Empty()){oContent.CurPos=nStartPos;oContent.Correct_Content();oContent.Correct_ContentPos(-1)}this.RemoveSelection()}return true}else{this.RemoveSelection();if(true===TrackRevisions)if(reviewtype_Common===ElementReviewType){if(para_Math_Run===oElement.Type!==oElement.Type)oElement.RejectRevisionChanges(c_oAscRevisionsChangeType.TextAdd,true);oElement.SetReviewType(reviewtype_Remove)}else{if(reviewtype_Add=== ElementReviewType){oContent.Remove_FromContent(nStartPos,1);if(para_Math_Run===oContent.Content[nStartPos].Type)oContent.Content[nStartPos].MoveCursorToStartPos()}}else{oContent.Remove_FromContent(nStartPos,1);if(para_Math_Run===oContent.Content[nStartPos].Type)oContent.Content[nStartPos].MoveCursorToStartPos()}oContent.CurPos=nStartPos;oContent.Correct_Content();oContent.Correct_ContentPos(-1)}}else{if(nStartPos>nEndPos){var nTemp=nEndPos;nEndPos=nStartPos;nStartPos=nTemp}var oStartElement=oContent.getElem(nStartPos); var oEndElement=oContent.getElem(nEndPos);if(true===TrackRevisions){for(var CurPos=nEndPos;CurPos>=nStartPos;--CurPos){var Element=oContent.getElem(CurPos);var ElementReviewType=Element.GetReviewType();if(para_Math_Run===Element.Type&&(CurPos===nEndPos||CurPos===nStartPos))Element.Remove(Direction);else if(reviewtype_Common===ElementReviewType){if(para_Math_Run===Element.Type!==Element.Type)Element.RejectRevisionChanges(c_oAscRevisionsChangeType.TextAdd,true);Element.SetReviewType(reviewtype_Remove)}else if(reviewtype_Add=== ElementReviewType){oContent.Remove_FromContent(CurPos,1);nEndPos--}}this.RemoveSelection();if(Direction<0)oContent.CurPos=nStartPos;else{oContent.CurPos=nEndPos;if(para_Math_Run===oContent.Content[nEndPos].Type)oContent.Content[nEndPos].MoveCursorToStartPos()}}else{if(para_Math_Run===oEndElement.Type)oEndElement.Remove(Direction);else oContent.Remove_FromContent(nEndPos,1);oContent.Remove_FromContent(nStartPos+1,nEndPos-nStartPos-1);if(para_Math_Run===oStartElement.Type)oStartElement.Remove(Direction); else oContent.Remove_FromContent(nStartPos,1);this.RemoveSelection();oContent.CurPos=nStartPos}oContent.Correct_Content();oContent.Correct_ContentPos(Direction)}};ParaMath.prototype.GetSelectContent=function(isAll){return this.Root.GetSelectContent(isAll)};ParaMath.prototype.GetCurrentParaPos=function(){return this.Root.GetCurrentParaPos()};ParaMath.prototype.Apply_TextPr=function(TextPr,IncFontSize,ApplyToAll){if(ApplyToAll==true)this.Root.Apply_TextPr(TextPr,IncFontSize,true);else{var content=this.GetSelectContent().Content; var NewTextPr=new CTextPr;var bSetInRoot=false;if(IncFontSize==undefined){if(TextPr.Underline!==undefined){NewTextPr.Underline=TextPr.Underline;bSetInRoot=true}if(TextPr.FontSize!==undefined&&content.IsNormalTextInRuns()==false){NewTextPr.FontSize=TextPr.FontSize;bSetInRoot=true}content.Apply_TextPr(TextPr,IncFontSize,ApplyToAll);if(bSetInRoot)this.Root.Apply_TextPr(NewTextPr,IncFontSize,true)}else if(content.IsNormalTextInRuns()==false)this.Root.Apply_TextPr(TextPr,IncFontSize,true);else content.Apply_TextPr(TextPr, IncFontSize,ApplyToAll)}};ParaMath.prototype.Clear_TextPr=function(){};ParaMath.prototype.Check_NearestPos=function(ParaNearPos,Depth){this.Root.Check_NearestPos(ParaNearPos,Depth)};ParaMath.prototype.Get_DrawingObjectRun=function(Id){return null};ParaMath.prototype.GetRunByElement=function(oRunElement){return null};ParaMath.prototype.Get_DrawingObjectContentPos=function(Id,ContentPos,Depth){return false};ParaMath.prototype.Get_Layout=function(DrawingLayout,UseContentPos,ContentPos,Depth){if(true=== UseContentPos)DrawingLayout.Layout=true;else DrawingLayout.X+=this.Width};ParaMath.prototype.GetNextRunElements=function(oRunElements,isUseContentPos,nDepth){if(oRunElements.IsSkipMath())return;this.Root.GetNextRunElements(oRunElements,isUseContentPos,nDepth)};ParaMath.prototype.GetPrevRunElements=function(oRunElements,isUseContentPos,nDepth){if(oRunElements.IsSkipMath())return;this.Root.GetPrevRunElements(oRunElements,isUseContentPos,nDepth)};ParaMath.prototype.CollectDocumentStatistics=function(ParaStats){}; ParaMath.prototype.Create_FontMap=function(Map){this.Root.Create_FontMap(Map)};ParaMath.prototype.Get_AllFontNames=function(AllFonts){AllFonts["Cambria Math"]=true;this.Root.Get_AllFontNames(AllFonts)};ParaMath.prototype.GetSelectedElementsInfo=function(Info,ContentPos,Depth){Info.SetMath(this)};ParaMath.prototype.GetSelectedText=function(bAll,bClearText,oPr){if(true===bAll||true===this.IsSelectionUse()){if(true===bClearText)return null;var res="";var selectedContent=this.GetSelectContent(bAll);if(selectedContent&& selectedContent.Content&&selectedContent.Content.GetTextContent){var textContent=selectedContent.Content.GetTextContent(!bAll);if(textContent&&textContent.str)res=textContent.str}return res}return""};ParaMath.prototype.GetText=function(){var res="";if(this.Root&&this.Root.GetTextContent){var textContent=this.Root.GetTextContent();if(textContent&&textContent.str)res=textContent.str}return res};ParaMath.prototype.GetSelectDirection=function(){return this.Root.GetSelectDirection()};ParaMath.prototype.Clear_TextFormatting= function(DefHyper){};ParaMath.prototype.CanAddDropCap=function(){return false};ParaMath.prototype.Get_TextForDropCap=function(DropCapText,UseContentPos,ContentPos,Depth){if(true===DropCapText.Check)DropCapText.Mixed=true};ParaMath.prototype.Get_StartTabsCount=function(TabsCounter){return false};ParaMath.prototype.Remove_StartTabs=function(TabsCounter){return false};ParaMath.prototype.Add_ToContent=function(Pos,Item,UpdatePosition){};ParaMath.prototype.Get_MenuProps=function(){return this.Root.Get_MenuProps()}; ParaMath.prototype.Set_MenuProps=function(Props){if(Props!=undefined)this.Root.Set_MenuProps(Props)};ParaMath.prototype.CheckRunContent=function(fCheck){this.Root.CheckRunContent(fCheck)};ParaMath.prototype.Recalculate_Range=function(PRS,ParaPr,Depth){if(PRS.bFastRecalculate==true&&this.bFastRecalculate==false)return;if(this.Paragraph!==PRS.Paragraph){this.Paragraph=PRS.Paragraph;this.private_UpdateSpellChecking()}var Para=PRS.Paragraph;var ParaLine=PRS.Line;var ParaRange=PRS.Range;var Page=this.Paragraph== null?0:this.Paragraph.Get_AbsolutePage(PRS.Page);var RelativePage=PRS.Page;var bStartRange=this.Root.IsStartRange(ParaLine,ParaRange);var isInline=this.IsInline();var PrevLineObject=PRS.GetMathRecalcInfoObject();var bCurrentObj=PrevLineObject==null||PrevLineObject==this;var PrevObject=bCurrentObj?null:PrevLineObject;var bStartRecalculate=PrevLineObject==null&&true==bStartRange&&PRS.bFastRecalculate==false;var bContinueRecalc=!isInline&&PRS.bContinueRecalc===true;var LDRecalcInfo=this.Paragraph.Parent.RecalcInfo; if(bStartRecalculate==true&&bContinueRecalc==false){var RPI=new CRPI;RPI.MergeMathInfo(this.ParaMathRPI);this.Root.PreRecalc(null,this,new CMathArgSize,RPI);this.PageInfo.Reset();this.PageInfo.Set_StartPos(Page,ParaLine);this.PageInfo.Update_RelativePage(RelativePage);this.ParaMathRPI.Reset(PRS,ParaPr)}else{var bResetNextPage=true==this.PageInfo.Is_ResetNextPage(Page);var bResetPageInfo=PrevLineObject==null&&bContinueRecalc==false&&PRS.bFastRecalculate==false&&true==this.PageInfo.Is_FirstLineOnPage(ParaLine, Page);if(bResetNextPage==true||bResetPageInfo==true){this.ParaMathRPI.Reset(PRS,ParaPr);this.PageInfo.Reset_Page(Page)}if(true==this.PageInfo.Is_ResetRelativePage(PRS.Page)){this.ParaMathRPI.Reset(PRS,ParaPr);this.PageInfo.Update_RelativePage(RelativePage)}}PRS.MathNotInline=!isInline;PRS.bPriorityOper=!isInline;if(!isInline)PRS.SetMathRecalcInfoObject(this);if(this.ParaMathRPI.ShiftY-PRS.Y>0||PRS.bMathRangeY==true){PRS.bMathRangeY=true;PRS.ForceNewPage=true;this.private_UpdateRangeY(PRS,this.ParaMathRPI.ShiftY)}else{this.Root.SetParagraph(Para); this.Root.Set_ParaMath(this,null);this.PageInfo.Update_CurrentPage(Page,ParaLine);var bRecalcNormal=true;if(bCurrentObj==true&&!isInline&&PRS.bFastRecalculate==false){var UpdWrap=this.private_UpdateWrapSettings(PRS,ParaPr);if(UpdWrap==MATH_UPDWRAP_NEWRANGE){this.private_SetRestartRecalcInfo(PRS);this.PageInfo.Reset_Page(Page);this.ParaMathRPI.bInternalRanges=true}else if(UpdWrap==MATH_UPDWRAP_UNDERFLOW);bRecalcNormal=UpdWrap==MATH_UPDWRAP_NOCHANGES}if(bRecalcNormal==true){var MathSettings=Get_WordDocumentDefaultMathSettings(); var DispDef=MathSettings.Get_DispDef(),bInline=this.Is_Inline();this.PageInfo.Update_CurrentWrap(DispDef,bInline);if(this.ParaMathRPI.IntervalState!==MATH_INTERVAL_EMPTY&&this.ParaMathRPI.bInternalRanges==true)this.private_RecalculateRangeInsideInterval(PRS,ParaPr,Depth);else this.private_RecalculateRangeWrap(PRS,ParaPr,Depth);this.ParaMathRPI.ClearRecalculate()}}if(PRS.RecalcResult&recalcresult_ParaMath&&(true===LDRecalcInfo.Can_RecalcObject()||true===LDRecalcInfo.Check_ParaMath(this)))LDRecalcInfo.Set_ParaMath(this); else if(true===LDRecalcInfo.Check_ParaMath(this))LDRecalcInfo.Reset();else;if(bCurrentObj==true){PRS.bContinueRecalc=true;if(PRS.NewRange==false)PRS.SetMathRecalcInfoObject(null)}else PRS.SetMathRecalcInfoObject(PrevObject)};ParaMath.prototype.private_UpdateWrapSettings=function(PRS){var UpdateWrap=MATH_UPDWRAP_NOCHANGES;var LngR=PRS.Ranges.length,Ranges=PRS.Ranges;if(LngR>0){this.ParaMathRPI.IntervalState=MATH_INTERVAL_ON_SIDE;var RY_NotWrap=null;for(var Pos=0;PosXStart)XStart=this.ParaMathRPI.XStart;if(this.ParaMathRPI.XEnd.001||DiffXEnd>.001){this.ParaMathRPI.XStart=XStart;this.ParaMathRPI.XEnd=XEnd;UpdateWrap=MATH_UPDWRAP_NEWRANGE}}else{this.private_SetShiftY(PRS,RY_NotWrap);UpdateWrap=MATH_UPDWRAP_UNDERFLOW}}return UpdateWrap};ParaMath.prototype.private_RecalculateRangeInsideInterval=function(PRS,ParaPr,Depth){var bNotInsideRange=this.ParaMathRPI.XStart>PRS.XEnd||this.ParaMathRPI.XEnd0&& PRS.Word==true;PRS.bBreakPosInLWord=bNotBrPosInLWord==false;var bEmptyLine=PRS.EmptyLine;this.private_RecalculateRoot(PRS,ParaPr,Depth);var WrapState=this.PageInfo.Get_CurrentWrapState();this.PageInfo.Set_StateWordLarge(PRS.Line,PRS.bMathWordLarge);if(PRS.bMathWordLarge==true)if(WrapState!==ALIGN_EMPTY){this.private_SetRestartRecalcInfo(PRS);this.PageInfo.Set_NextWrapState()}else if(isInline&&PRS.Ranges.length>0)if(PRS.bBreakPosInLWord==true){PRS.EmptyLine=bEmptyLine;this.Root.Math_Set_EmptyRange(PRS.Line, PRS.Range);PRS.bMathWordLarge=false;PRS.NewRange=true;PRS.MoveToLBP=false}else PRS.MoveToLBP=true};ParaMath.prototype.private_RecalculateRoot=function(PRS,ParaPr,Depth){var Para=PRS.Paragraph;var ParaLine=PRS.Line;var ParaRange=PRS.Range;if(PRS.bFastRecalculate==true)this.Root.Math_UpdateGaps(ParaLine,ParaRange);this.Root.Recalculate_Range(PRS,ParaPr,Depth);if(PRS.NewRange==false){PRS.OperGapRight=0;var WidthLine=PRS.X-PRS.XRange+PRS.SpaceLen+PRS.WordLen;var bFirstItem=PRS.FirstItemOnLine==true&& true===Para.Internal_Check_Ranges(ParaLine,ParaRange);if(bFirstItem&&PRS.X+PRS.SpaceLen+PRS.WordLen>PRS.XEnd)PRS.bMathWordLarge=true;this.UpdateWidthLine(PRS,WidthLine)}};ParaMath.prototype.private_SetRestartRecalcInfo=function(PRS){var Page=this.Paragraph==null?0:this.Paragraph.GetAbsolutePage(PRS.Page);var Line=this.PageInfo.Get_FirstLineOnPage(Page);PRS.SetMathRecalcInfo(Line,this,PRS.Ranges,PRS.RangesCount);PRS.RecalcResult=recalcresult_ParaMath;PRS.NewRange=true};ParaMath.prototype.Set_EmptyRange= function(PRS){this.Root.Math_Set_EmptyRange(PRS.Line,PRS.Range);PRS.RecalcResult=recalcresult_NextLine;PRS.SetMathRecalcInfoObject(this);PRS.NewRange=true};ParaMath.prototype.private_UpdateRangeY=function(PRS,RY){if(Math.abs(RY-PRS.Y)<.001)PRS.Y=RY+1;else PRS.Y=RY+AscCommon.TwipsToMM(1)+.001;PRS.NewRange=true};ParaMath.prototype.private_SetShiftY=function(PRS,RY){this.PageInfo.Set_NeedUpdateWrap();this.ParaMathRPI.UpdateShiftY(RY);this.ParaMathRPI.Reset_WrapSettings();this.private_SetRestartRecalcInfo(PRS)}; ParaMath.prototype.private_UpdateXLimits=function(PRS){var MathSettings=Get_WordDocumentDefaultMathSettings();var WrapState=this.PageInfo.Get_CurrentWrapState();var Page=this.Paragraph==null?0:this.Paragraph.Get_AbsolutePage(PRS.Page);PRS.X+=MathSettings.Get_LeftMargin(WrapState);PRS.XEnd-=MathSettings.Get_RightMargin(WrapState);PRS.WrapIndent=MathSettings.Get_WrapIndent(WrapState);PRS.bFirstLine=this.Root.IsStartLine(PRS.Line);var AlignAt;var Jc=this.Get_Align();var alignBrk=this.Root.Get_AlignBrk(PRS.Line, this.Is_BrkBinBefore());if(alignBrk!==null)if(alignBrk==0||Jc==align_Right||Jc==align_Center)AlignAt=0;else{var PosAln=alignBrk0&&this.ParaMathRPI.bRecalcCtrPrp==false)this.ParaMathRPI.bRecalcCtrPrp=this.Root.Content[0]== Class};ParaMath.prototype.MathToImageConverter=function(bCopy,_canvasInput,_widthPx,_heightPx,raster_koef){var bTurnOnId=false;if(false===g_oTableId.m_bTurnOff){g_oTableId.m_bTurnOff=true;bTurnOnId=true}History.TurnOff();var oldDefTabStop=AscCommonWord.Default_Tab_Stop;AscCommonWord.Default_Tab_Stop=1;var oApi=Asc["editor"]||editor;if(!oApi||!oApi.textArtPreviewManager){History.TurnOn();if(true===bTurnOnId)g_oTableId.m_bTurnOff=false;return null}var oShape=oApi.textArtPreviewManager.getShape();var _dc= oShape.getDocContent();var par=_dc.Content[0];if(bCopy)par.Internal_Content_Add(0,this.Copy(false),false);else par.Internal_Content_Add(0,this,false);par.Set_Align(align_Left);par.Set_Tabs(new CParaTabs);var _ind=new CParaInd;_ind.FirstLine=0;_ind.Left=0;_ind.Right=0;par.Set_Ind(_ind,false);var _sp=new CParaSpacing;_sp.Line=1;_sp.LineRule=Asc.linerule_Auto;_sp.Before=0;_sp.BeforeAutoSpacing=false;_sp.After=0;_sp.AfterAutoSpacing=false;par.Set_Spacing(_sp,false);var XLimit=210,YLimit=1E4;_dc.Reset(0, 0,XLimit,YLimit);_dc.Recalculate_Page(0,true);_dc.Reset(0,0,par.Lines[0].Ranges[0].W+.001,1E4);_dc.Recalculate_Page(0,true);AscCommonWord.Default_Tab_Stop=oldDefTabStop;if(true===bTurnOnId)g_oTableId.m_bTurnOff=false;History.TurnOn();AscCommon.IsShapeToImageConverter=true;var dKoef=AscCommon.g_dKoef_mm_to_pix;var JointSize=this.Get_JointSize();var W=JointSize.W,H=JointSize.H;var w_mm=W;var h_mm=H;var w_px=w_mm*dKoef>>0;var h_px=h_mm*dKoef>>0;if(undefined!==raster_koef){w_px*=raster_koef;h_px*=raster_koef; if(undefined!==_widthPx)_widthPx=_widthPx*raster_koef>>0;if(undefined!==_heightPx)_heightPx=_heightPx*raster_koef>>0}var _canvas=null;if(window["NATIVE_EDITOR_ENJINE"]===true&&window["IS_NATIVE_EDITOR"]!==true){var _width=undefined==_widthPx?w_px:_widthPx;var _height=undefined==_heightPx?h_px:_heightPx;_canvas=new CNativeGraphics;_canvas.width=_width;_canvas.height=_height;_canvas.create(window["native"],_width,_height,_width/dKoef,_height/dKoef);_canvas.CoordTransformOffset(_widthPx!==undefined? (_widthPx-w_px)/2:0,_heightPx!==undefined?(_heightPx-h_px)/2:0);_canvas.transform(1,0,0,1,0,0);var bNeedSetParaMarks=false;if(AscCommon.isRealObject(editor)&&editor.ShowParaMarks){bNeedSetParaMarks=true;editor.ShowParaMarks=false}par.Draw(0,_canvas);if(bNeedSetParaMarks)editor.ShowParaMarks=true}else{var _canvas=_canvasInput===undefined?document.createElement("canvas"):_canvasInput;_canvas.width=undefined==_widthPx?w_px:_widthPx;_canvas.height=undefined==_heightPx?h_px:_heightPx;var _ctx=_canvas.getContext("2d"); var g=new AscCommon.CGraphics;g.init(_ctx,w_px,h_px,w_mm,h_mm);g.m_oFontManager=AscCommon.g_fontManager;g.m_oCoordTransform.tx=0;g.m_oCoordTransform.ty=0;if(_widthPx!==undefined&&_heightPx!==undefined){g.m_oCoordTransform.tx=(_widthPx-w_px)/2;g.m_oCoordTransform.ty=(_heightPx-h_px)/2}g.transform(1,0,0,1,0,0);var bNeedSetParaMarks=false;if(AscCommon.isRealObject(editor)&&editor.ShowParaMarks){bNeedSetParaMarks=true;editor.ShowParaMarks=false}par.Draw(0,g);if(bNeedSetParaMarks)editor.ShowParaMarks= true}AscCommon.IsShapeToImageConverter=false;if(undefined===_canvasInput){var _ret={ImageNative:_canvas,ImageUrl:"",w_px:_canvas.width,h_px:_canvas.height,w_mm:w_mm,h_mm:h_mm};try{_ret.ImageUrl=_canvas.toDataURL("image/png")}catch(err){_ret.ImageUrl=""}return _ret}return null};ParaMath.prototype.Get_FirstTextPr=function(){return this.Root.Get_FirstTextPr()};ParaMath.prototype.GetFirstRPrp=function(){return this.Root.getFirstRPrp()};ParaMath.prototype.GetShiftCenter=function(oMeasure,font){oMeasure.SetFont(font); var metrics=oMeasure.Measure2Code(8727);return.6*metrics.Height};ParaMath.prototype.GetPlh=function(oMeasure,font){oMeasure.SetFont(font);return oMeasure.Measure2Code(11034).Height};ParaMath.prototype.Get_Default_TPrp=function(){return this.DefaultTextPr};ParaMath.prototype.Draw_HighLights=function(PDSH){if(false==this.Root.IsEmptyRange(PDSH.Line,PDSH.Range)){var X=PDSH.X;var Y0=PDSH.Y0;var Y1=PDSH.Y1;var Comm=PDSH.Save_Comm();var Coll=PDSH.Save_Coll();this.Root.Draw_HighLights(PDSH,false);var CommFirst= PDSH.Comm.Get_Next();var CollFirst=PDSH.Coll.Get_Next();PDSH.Load_Comm(Comm);PDSH.Load_Coll(Coll);if(null!==CommFirst){var CommentsCount=PDSH.Comments.length;var CommentId=CommentsCount>0?PDSH.Comments[CommentsCount-1]:null;var CommentsFlag=PDSH.CommentsFlag;var Bounds=this.Root.Get_LineBound(PDSH.Line,PDSH.Range);Comm.Add(Bounds.Y,Bounds.Y+Bounds.H,Bounds.X,Bounds.X+Bounds.W,0,0,0,0,{Active:CommentsFlag===AscCommon.comments_ActiveComment?true:false,CommentId:CommentId})}if(null!==CollFirst){var Bounds= this.Root.Get_LineBound(PDSH.Line,PDSH.Range);Coll.Add(Bounds.Y,Bounds.Y+Bounds.H,Bounds.X,Bounds.X+Bounds.W,0,CollFirst.r,CollFirst.g,CollFirst.b)}PDSH.Y0=Y0;PDSH.Y1=Y1}};ParaMath.prototype.Draw_Elements=function(PDSE){var X=PDSE.X;this.Root.Draw_Elements(PDSE);PDSE.X=X+this.Root.Get_Width(PDSE.Line,PDSE.Range)};ParaMath.prototype.GetLinePosition=function(Line,Range){return this.Root.GetPos(Line,Range)};ParaMath.prototype.Draw_Lines=function(PDSL){if(false==this.Root.IsEmptyRange(PDSL.Line,PDSL.Range)){var FirstRPrp= this.GetFirstRPrp();var Para=PDSL.Paragraph;var aUnderline=PDSL.Underline;var X=PDSL.X;var Y=PDSL.Baseline;var UndOff=PDSL.UnderlineOffset;var UnderlineY=Y+UndOff;var LineW=FirstRPrp.FontSize/18*g_dKoef_pt_to_mm;var BgColor=PDSL.BgColor;if(undefined!==FirstRPrp.Shd&&Asc.c_oAscShdNil!==FirstRPrp.Shd.Value)BgColor=FirstRPrp.Shd.Get_Color(Para);var AutoColor=undefined!=BgColor&&false===BgColor.Check_BlackAutoColor()?new CDocumentColor(255,255,255,false):new CDocumentColor(0,0,0,false);var CurColor,RGBA, Theme=this.Paragraph.Get_Theme(),ColorMap=this.Paragraph.Get_ColorMap();if(true===PDSL.VisitedHyperlink&&(undefined===FirstRPrp.Color&&undefined===FirstRPrp.Unifill))CurColor=new CDocumentColor(128,0,151);else if(true===FirstRPrp.Color.Auto&&!FirstRPrp.Unifill)CurColor=new CDocumentColor(AutoColor.r,AutoColor.g,AutoColor.b);else if(FirstRPrp.Unifill){FirstRPrp.Unifill.check(Theme,ColorMap);RGBA=FirstRPrp.Unifill.getRGBAColor();CurColor=new CDocumentColor(RGBA.R,RGBA.G,RGBA.B)}else CurColor=new CDocumentColor(FirstRPrp.Color.r, FirstRPrp.Color.g,FirstRPrp.Color.b);var Bound=this.Root.Get_LineBound(PDSL.Line,PDSL.Range),Width=Bound.W;if(true===FirstRPrp.Underline)aUnderline.Add(UnderlineY,UnderlineY,X,X+Width,LineW,CurColor.r,CurColor.g,CurColor.b);this.Root.Draw_Lines(PDSL);PDSL.X=Bound.X+Width}};ParaMath.prototype.IsCursorPlaceable=function(){return true};ParaMath.prototype.Cursor_Is_Start=function(){return this.Root.Cursor_Is_Start()};ParaMath.prototype.Cursor_Is_NeededCorrectPos=function(){return false};ParaMath.prototype.Cursor_Is_End= function(){return this.Root.Cursor_Is_End()};ParaMath.prototype.MoveCursorToStartPos=function(){this.Root.MoveCursorToStartPos()};ParaMath.prototype.MoveCursorToEndPos=function(SelectFromEnd){this.Root.MoveCursorToEndPos(SelectFromEnd)};ParaMath.prototype.Get_ParaContentPosByXY=function(SearchPos,Depth,_CurLine,_CurRange,StepEnd,Flag){var Result=false;var CurX=SearchPos.CurX;var MathX=SearchPos.CurX;var MathW=this.Root.Get_Width(_CurLine,_CurRange);if(SearchPos.X>MathX&&SearchPos.X 1E6-1){var bFirstItem=SearchPos.DiffX>1E6-1?true:false;Result=this.Root.Get_ParaContentPosByXY(SearchPos,Depth,_CurLine,_CurRange,StepEnd);if(SearchPos.InText)SearchPos.DiffX=.001;if(Result&&!bFirstItem)SearchPos.DiffX=0}if(SearchPos.DiffX>1E6-1){this.Get_StartPos(SearchPos.Pos,Depth);Result=true}SearchPos.CurX=CurX+MathW;return Result};ParaMath.prototype.Get_ParaContentPos=function(bSelection,bStart,ContentPos,bUseCorrection){this.Root.Get_ParaContentPos(bSelection,bStart,ContentPos,bUseCorrection)}; ParaMath.prototype.Set_ParaContentPos=function(ContentPos,Depth){this.Root.Set_ParaContentPos(ContentPos,Depth)};ParaMath.prototype.Get_PosByElement=function(Class,ContentPos,Depth,UseRange,Range,Line){if(this===Class)return true;return this.Root.Get_PosByElement(Class,ContentPos,Depth,UseRange,Range,Line)};ParaMath.prototype.Get_ElementByPos=function(ContentPos,Depth){return this.Root.Get_ElementByPos(ContentPos,Depth)};ParaMath.prototype.Get_ClassesByPos=function(Classes,ContentPos,Depth){Classes.push(this); this.Root.Get_ClassesByPos(Classes,ContentPos,Depth)};ParaMath.prototype.Get_PosByDrawing=function(Id,ContentPos,Depth){return false};ParaMath.prototype.Get_RunElementByPos=function(ContentPos,Depth){return null};ParaMath.prototype.Get_LastRunInRange=function(_CurLine,_CurRange){return this.Root.Get_LastRunInRange(_CurLine,_CurRange)};ParaMath.prototype.Get_LeftPos=function(SearchPos,ContentPos,Depth,UseContentPos){return this.Root.Get_LeftPos(SearchPos,ContentPos,Depth,UseContentPos,false)};ParaMath.prototype.Get_RightPos= function(SearchPos,ContentPos,Depth,UseContentPos,StepEnd){return this.Root.Get_RightPos(SearchPos,ContentPos,Depth,UseContentPos,StepEnd,false)};ParaMath.prototype.Get_WordStartPos=function(SearchPos,ContentPos,Depth,UseContentPos){this.Root.Get_WordStartPos(SearchPos,ContentPos,Depth,UseContentPos,false)};ParaMath.prototype.Get_WordEndPos=function(SearchPos,ContentPos,Depth,UseContentPos,StepEnd){this.Root.Get_WordEndPos(SearchPos,ContentPos,Depth,UseContentPos,StepEnd,false)};ParaMath.prototype.Get_EndRangePos= function(_CurLine,_CurRange,SearchPos,Depth){return this.Root.Get_EndRangePos(_CurLine,_CurRange,SearchPos,Depth)};ParaMath.prototype.Get_StartRangePos=function(_CurLine,_CurRange,SearchPos,Depth){return this.Root.Get_StartRangePos(_CurLine,_CurRange,SearchPos,Depth)};ParaMath.prototype.Get_StartRangePos2=function(_CurLine,_CurRange,ContentPos,Depth){return this.Root.Get_StartRangePos2(_CurLine,_CurRange,ContentPos,Depth)};ParaMath.prototype.Get_EndRangePos2=function(_CurLine,_CurRange,ContentPos, Depth){return this.Root.Get_EndRangePos2(_CurLine,_CurRange,ContentPos,Depth)};ParaMath.prototype.Get_StartPos=function(ContentPos,Depth){this.Root.Get_StartPos(ContentPos,Depth)};ParaMath.prototype.Get_EndPos=function(BehindEnd,ContentPos,Depth){this.Root.Get_EndPos(BehindEnd,ContentPos,Depth)};ParaMath.prototype.Set_SelectionContentPos=function(StartContentPos,EndContentPos,Depth,StartFlag,EndFlag){this.Root.Set_SelectionContentPos(StartContentPos,EndContentPos,Depth,StartFlag,EndFlag);this.bSelectionUse= true};ParaMath.prototype.IsSelectionUse=function(){return this.bSelectionUse};ParaMath.prototype.RemoveSelection=function(){this.bSelectionUse=false;this.Root.RemoveSelection()};ParaMath.prototype.SelectAll=function(Direction){this.bSelectionUse=true;this.Root.SelectAll(Direction)};ParaMath.prototype.Selection_DrawRange=function(_CurLine,_CurRange,SelectionDraw){this.Root.Selection_DrawRange(_CurLine,_CurRange,SelectionDraw)};ParaMath.prototype.IsSelectionEmpty=function(CheckEnd){return this.Root.IsSelectionEmpty()}; ParaMath.prototype.Selection_IsPlaceholder=function(){var bPlaceholder=false;var result=this.GetSelectContent(),SelectContent=result.Content;var start=result.Start,end=result.End;if(start==end)bPlaceholder=SelectContent.IsPlaceholder();return bPlaceholder};ParaMath.prototype.Selection_CheckParaEnd=function(){return false};ParaMath.prototype.Selection_CheckParaContentPos=function(ContentPos,Depth,bStart,bEnd){return this.Root.Selection_CheckParaContentPos(ContentPos,Depth,bStart,bEnd)};ParaMath.prototype.IsSelectedAll= function(Props){return this.Root.IsSelectedAll(Props)};ParaMath.prototype.SkipAnchorsAtSelectionStart=function(nDirection){return false};ParaMath.prototype.Write_ToBinary2=function(Writer){Writer.WriteLong(AscDFH.historyitem_type_Math);Writer.WriteString2(this.Id);Writer.WriteLong(this.Type);Writer.WriteString2(this.Root.Id)};ParaMath.prototype.Read_FromBinary2=function(Reader){this.Id=Reader.GetString2();this.Type=Reader.GetLong();this.Root=g_oTableId.Get_ById(Reader.GetString2());this.Root.bRoot= true;this.Root.ParentElement=this};ParaMath.prototype.Get_ContentSelection=function(){var Bounds=null;var oContent=this.GetSelectContent().Content;if(true==oContent.Can_GetSelection())if(oContent.bOneLine){Bounds=[];Bounds[0]=[];var ContentBounds=oContent.Get_Bounds();var oBound=ContentBounds[0][0];Bounds[0][0]={X:oBound.X,Y:oBound.Y,W:oBound.W,H:oBound.H,Page:this.Paragraph.Get_AbsolutePage(oBound.Page)}}else Bounds=this.private_GetBounds(oContent);return Bounds};ParaMath.prototype.Recalc_RunsCompiledPr= function(){this.Root.Recalc_RunsCompiledPr()};ParaMath.prototype.Is_InInnerContent=function(){var oContent=this.GetSelectContent().Content;if(oContent.bRoot)return false;return true};ParaMath.prototype.Handle_AddNewLine=function(){var ContentPos=new CParagraphContentPos;var CurrContent=this.GetSelectContent().Content;if(true===CurrContent.bRoot)return false;CurrContent.Get_ParaContentPos(this.bSelectionUse,true,ContentPos);var NeedRecalculate=false;if(MATH_EQ_ARRAY===CurrContent.ParentElement.kind){var oEqArray= CurrContent.Parent;oEqArray.Add_Row(oEqArray.CurPos+1);oEqArray.CurPos++;NeedRecalculate=true}else if(MATH_MATRIX!==CurrContent.ParentElement.kind){var ctrPrp=CurrContent.Parent.CtrPrp.Copy();var props={row:2,ctrPrp:ctrPrp};var EqArray=new CEqArray(props);var FirstContent=EqArray.getElementMathContent(0);var SecondContent=EqArray.getElementMathContent(1);CurrContent.SplitContent(SecondContent,ContentPos,0);CurrContent.CopyTo(FirstContent,false);var Run=CurrContent.getElem(0);Run.Remove_FromContent(0, Run.Content.length,true);CurrContent.Remove_FromContent(1,CurrContent.Content.length);CurrContent.Add_ToContent(1,EqArray);CurrContent.Correct_Content(true);var CurrentContent=new CParagraphContentPos;this.Get_ParaContentPos(false,false,CurrentContent);var RightContentPos=new CParagraphSearchPos;this.Get_RightPos(RightContentPos,CurrentContent,0,true);this.Set_ParaContentPos(RightContentPos.Pos,0);EqArray.CurPos=1;SecondContent.MoveCursorToStartPos();NeedRecalculate=true}return NeedRecalculate};ParaMath.prototype.Split= function(ContentPos,Depth){if(this.Cursor_Is_End())return new ParaRun(this.Paragraph,false);var NewParaMath=new ParaMath;NewParaMath.Jc=this.Jc;this.Root.SplitContent(NewParaMath.Root,ContentPos,Depth);return NewParaMath};ParaMath.prototype.SplitNoDuplicate=function(oContentPos,nDepth,oNewParagraph){var oNewElement=this.Split(oContentPos,nDepth);if(!oNewElement)return;oNewParagraph.AddToContent(oNewParagraph.Content.length,oNewElement,false)};ParaMath.prototype.Make_AutoCorrect=function(){return false}; ParaMath.prototype.Get_Bounds=function(){if(undefined===this.Paragraph||null===this.Paragraph)return[[{X:0,Y:0,W:0,H:0,Page:0}]];else return this.private_GetBounds(this.Root)};ParaMath.prototype.Get_JointSize=function(){var W=0,H=0;var _bounds=this.Get_Bounds();for(var Line=0;Line<_bounds.length;Line++){if(_bounds[Line]===undefined)break;for(var Range=0;Range<_bounds[Line].length;Range++){W+=_bounds[Line][Range].W;H+=_bounds[Line][Range].H}}return{W:W,H:H}};ParaMath.prototype.private_GetBounds=function(Content){var Bounds= [[{X:0,Y:0,W:0,H:0,Page:0}]];var ContentBounds=Content.Get_Bounds();for(var Line=0;Line.001)result=false;return result};window["AscCommonWord"]=window["AscCommonWord"]||{};window["AscCommonWord"].MathMenu=MathMenu;window["AscCommonWord"].ParaMath=ParaMath;"use strict";AscDFH.changesFactory[AscDFH.historyitem_MathContent_AddItem]= CChangesMathContentAddItem;AscDFH.changesFactory[AscDFH.historyitem_MathContent_RemoveItem]=CChangesMathContentRemoveItem;AscDFH.changesFactory[AscDFH.historyitem_MathContent_ArgSize]=CChangesMathContentArgSize;AscDFH.changesFactory[AscDFH.historyitem_MathPara_Jc]=CChangesMathParaJc;AscDFH.changesFactory[AscDFH.historyitem_MathBase_AddItems]=CChangesMathBaseAddItems;AscDFH.changesFactory[AscDFH.historyitem_MathBase_RemoveItems]=CChangesMathBaseRemoveItems;AscDFH.changesFactory[AscDFH.historyitem_MathBase_FontSize]= CChangesMathBaseFontSize;AscDFH.changesFactory[AscDFH.historyitem_MathBase_Shd]=CChangesMathBaseShd;AscDFH.changesFactory[AscDFH.historyitem_MathBase_Color]=CChangesMathBaseColor;AscDFH.changesFactory[AscDFH.historyitem_MathBase_Unifill]=CChangesMathBaseUnifill;AscDFH.changesFactory[AscDFH.historyitem_MathBase_Underline]=CChangesMathBaseUnderline;AscDFH.changesFactory[AscDFH.historyitem_MathBase_Strikeout]=CChangesMathBaseStrikeout;AscDFH.changesFactory[AscDFH.historyitem_MathBase_DoubleStrikeout]= CChangesMathBaseDoubleStrikeout;AscDFH.changesFactory[AscDFH.historyitem_MathBase_Italic]=CChangesMathBaseItalic;AscDFH.changesFactory[AscDFH.historyitem_MathBase_Bold]=CChangesMathBaseBold;AscDFH.changesFactory[AscDFH.historyitem_MathBase_RFontsAscii]=CChangesMathBaseRFontsAscii;AscDFH.changesFactory[AscDFH.historyitem_MathBase_RFontsHAnsi]=CChangesMathBaseRFontsHAnsi;AscDFH.changesFactory[AscDFH.historyitem_MathBase_RFontsCS]=CChangesMathBaseRFontsCS;AscDFH.changesFactory[AscDFH.historyitem_MathBase_RFontsEastAsia]= CChangesMathBaseRFontsEastAsia;AscDFH.changesFactory[AscDFH.historyitem_MathBase_RFontsHint]=CChangesMathBaseRFontsHint;AscDFH.changesFactory[AscDFH.historyitem_MathBase_HighLight]=CChangesMathBaseHighLight;AscDFH.changesFactory[AscDFH.historyitem_MathBase_ReviewType]=CChangesMathBaseReviewType;AscDFH.changesFactory[AscDFH.historyitem_MathBase_TextFill]=CChangesMathBaseTextFill;AscDFH.changesFactory[AscDFH.historyitem_MathBase_TextOutline]=CChangesMathBaseTextOutline;AscDFH.changesFactory[AscDFH.historyitem_MathBase_HighlightColor]= CChangesMathBaseHighlightColor;AscDFH.changesFactory[AscDFH.historyitem_MathBox_AlnAt]=CChangesMathBoxAlnAt;AscDFH.changesFactory[AscDFH.historyitem_MathBox_ForcedBreak]=CChangesMathBoxForcedBreak;AscDFH.changesFactory[AscDFH.historyitem_MathFraction_Type]=CChangesMathFractionType;AscDFH.changesFactory[AscDFH.historyitem_MathRadical_HideDegree]=CChangesMathRadicalHideDegree;AscDFH.changesFactory[AscDFH.historyitem_MathNary_LimLoc]=CChangesMathNaryLimLoc;AscDFH.changesFactory[AscDFH.historyitem_MathNary_UpperLimit]= CChangesMathNaryUpperLimit;AscDFH.changesFactory[AscDFH.historyitem_MathNary_LowerLimit]=CChangesMathNaryLowerLimit;AscDFH.changesFactory[AscDFH.historyitem_MathDelimiter_BegOper]=CChangesMathDelimBegOper;AscDFH.changesFactory[AscDFH.historyitem_MathDelimiter_EndOper]=CChangesMathDelimEndOper;AscDFH.changesFactory[AscDFH.historyitem_MathDelimiter_Grow]=CChangesMathDelimiterGrow;AscDFH.changesFactory[AscDFH.historyitem_MathDelimiter_Shape]=CChangesMathDelimiterShape;AscDFH.changesFactory[AscDFH.historyitem_MathDelimiter_SetColumn]= CChangesMathDelimiterSetColumn;AscDFH.changesFactory[AscDFH.historyitem_MathGroupChar_Pr]=CChangesMathGroupCharPr;AscDFH.changesFactory[AscDFH.historyitem_MathLimit_Type]=CChangesMathLimitType;AscDFH.changesFactory[AscDFH.historyitem_MathBorderBox_Top]=CChangesMathBorderBoxTop;AscDFH.changesFactory[AscDFH.historyitem_MathBorderBox_Bot]=CChangesMathBorderBoxBot;AscDFH.changesFactory[AscDFH.historyitem_MathBorderBox_Left]=CChangesMathBorderBoxLeft;AscDFH.changesFactory[AscDFH.historyitem_MathBorderBox_Right]= CChangesMathBorderBoxRight;AscDFH.changesFactory[AscDFH.historyitem_MathBorderBox_Hor]=CChangesMathBorderBoxHor;AscDFH.changesFactory[AscDFH.historyitem_MathBorderBox_Ver]=CChangesMathBorderBoxVer;AscDFH.changesFactory[AscDFH.historyitem_MathBorderBox_TopLTR]=CChangesMathBorderBoxTopLTR;AscDFH.changesFactory[AscDFH.historyitem_MathBorderBox_TopRTL]=CChangesMathBorderBoxTopRTL;AscDFH.changesFactory[AscDFH.historyitem_MathBar_LinePos]=CChangesMathBarLinePos;AscDFH.changesFactory[AscDFH.historyitem_MathMatrix_AddRow]= CChangesMathMatrixAddRow;AscDFH.changesFactory[AscDFH.historyitem_MathMatrix_RemoveRow]=CChangesMathMatrixRemoveRow;AscDFH.changesFactory[AscDFH.historyitem_MathMatrix_AddColumn]=CChangesMathMatrixAddColumn;AscDFH.changesFactory[AscDFH.historyitem_MathMatrix_RemoveColumn]=CChangesMathMatrixRemoveColumn;AscDFH.changesFactory[AscDFH.historyitem_MathMatrix_BaseJc]=CChangesMathMatrixBaseJc;AscDFH.changesFactory[AscDFH.historyitem_MathMatrix_ColumnJc]=CChangesMathMatrixColumnJc;AscDFH.changesFactory[AscDFH.historyitem_MathMatrix_Interval]= CChangesMathMatrixInterval;AscDFH.changesFactory[AscDFH.historyitem_MathMatrix_Plh]=CChangesMathMatrixPlh;AscDFH.changesFactory[AscDFH.historyitem_MathDegree_SubSupType]=CChangesMathDegreeSubSupType;AscDFH.changesRelationMap[AscDFH.historyitem_MathContent_AddItem]=[AscDFH.historyitem_MathContent_AddItem,AscDFH.historyitem_MathContent_RemoveItem];AscDFH.changesRelationMap[AscDFH.historyitem_MathContent_RemoveItem]=[AscDFH.historyitem_MathContent_AddItem,AscDFH.historyitem_MathContent_RemoveItem];AscDFH.changesRelationMap[AscDFH.historyitem_MathContent_ArgSize]= [AscDFH.historyitem_MathContent_ArgSize];AscDFH.changesRelationMap[AscDFH.historyitem_MathPara_Jc]=[AscDFH.historyitem_MathPara_Jc];AscDFH.changesRelationMap[AscDFH.historyitem_MathBase_AddItems]=[AscDFH.historyitem_MathBase_AddItems,AscDFH.historyitem_MathBase_RemoveItems];AscDFH.changesRelationMap[AscDFH.historyitem_MathBase_RemoveItems]=[AscDFH.historyitem_MathBase_AddItems,AscDFH.historyitem_MathBase_RemoveItems];AscDFH.changesRelationMap[AscDFH.historyitem_MathBase_FontSize]=[AscDFH.historyitem_MathBase_FontSize]; AscDFH.changesRelationMap[AscDFH.historyitem_MathBase_Shd]=[AscDFH.historyitem_MathBase_Shd];AscDFH.changesRelationMap[AscDFH.historyitem_MathBase_Color]=[AscDFH.historyitem_MathBase_Color];AscDFH.changesRelationMap[AscDFH.historyitem_MathBase_Unifill]=[AscDFH.historyitem_MathBase_Unifill];AscDFH.changesRelationMap[AscDFH.historyitem_MathBase_Underline]=[AscDFH.historyitem_MathBase_Underline];AscDFH.changesRelationMap[AscDFH.historyitem_MathBase_Strikeout]=[AscDFH.historyitem_MathBase_Strikeout]; AscDFH.changesRelationMap[AscDFH.historyitem_MathBase_DoubleStrikeout]=[AscDFH.historyitem_MathBase_DoubleStrikeout];AscDFH.changesRelationMap[AscDFH.historyitem_MathBase_Italic]=[AscDFH.historyitem_MathBase_Italic];AscDFH.changesRelationMap[AscDFH.historyitem_MathBase_Bold]=[AscDFH.historyitem_MathBase_Bold];AscDFH.changesRelationMap[AscDFH.historyitem_MathBase_RFontsAscii]=[AscDFH.historyitem_MathBase_RFontsAscii];AscDFH.changesRelationMap[AscDFH.historyitem_MathBase_RFontsHAnsi]=[AscDFH.historyitem_MathBase_RFontsHAnsi]; AscDFH.changesRelationMap[AscDFH.historyitem_MathBase_RFontsCS]=[AscDFH.historyitem_MathBase_RFontsCS];AscDFH.changesRelationMap[AscDFH.historyitem_MathBase_RFontsEastAsia]=[AscDFH.historyitem_MathBase_RFontsEastAsia];AscDFH.changesRelationMap[AscDFH.historyitem_MathBase_RFontsHint]=[AscDFH.historyitem_MathBase_RFontsHint];AscDFH.changesRelationMap[AscDFH.historyitem_MathBase_HighLight]=[AscDFH.historyitem_MathBase_HighLight];AscDFH.changesRelationMap[AscDFH.historyitem_MathBase_ReviewType]=[AscDFH.historyitem_MathBase_ReviewType]; AscDFH.changesRelationMap[AscDFH.historyitem_MathBase_TextFill]=[AscDFH.historyitem_MathBase_TextFill];AscDFH.changesRelationMap[AscDFH.historyitem_MathBase_TextOutline]=[AscDFH.historyitem_MathBase_TextOutline];AscDFH.changesRelationMap[AscDFH.historyitem_MathBase_HighlightColor]=[AscDFH.historyitem_MathBase_HighlightColor];AscDFH.changesRelationMap[AscDFH.historyitem_MathBox_AlnAt]=[AscDFH.historyitem_MathBox_AlnAt,AscDFH.historyitem_MathBox_ForcedBreak];AscDFH.changesRelationMap[AscDFH.historyitem_MathBox_ForcedBreak]= [AscDFH.historyitem_MathBox_AlnAt,AscDFH.historyitem_MathBox_ForcedBreak];AscDFH.changesRelationMap[AscDFH.historyitem_MathFraction_Type]=[AscDFH.historyitem_MathFraction_Type];AscDFH.changesRelationMap[AscDFH.historyitem_MathRadical_HideDegree]=[AscDFH.historyitem_MathRadical_HideDegree];AscDFH.changesRelationMap[AscDFH.historyitem_MathNary_LimLoc]=[AscDFH.historyitem_MathNary_LimLoc];AscDFH.changesRelationMap[AscDFH.historyitem_MathNary_UpperLimit]=[AscDFH.historyitem_MathNary_UpperLimit];AscDFH.changesRelationMap[AscDFH.historyitem_MathNary_LowerLimit]= [AscDFH.historyitem_MathNary_LowerLimit];AscDFH.changesRelationMap[AscDFH.historyitem_MathDelimiter_BegOper]=[AscDFH.historyitem_MathDelimiter_BegOper];AscDFH.changesRelationMap[AscDFH.historyitem_MathDelimiter_EndOper]=[AscDFH.historyitem_MathDelimiter_EndOper];AscDFH.changesRelationMap[AscDFH.historyitem_MathDelimiter_Grow]=[AscDFH.historyitem_MathDelimiter_Grow];AscDFH.changesRelationMap[AscDFH.historyitem_MathDelimiter_Shape]=[AscDFH.historyitem_MathDelimiter_Shape];AscDFH.changesRelationMap[AscDFH.historyitem_MathDelimiter_SetColumn]= [AscDFH.historyitem_MathDelimiter_SetColumn];AscDFH.changesRelationMap[AscDFH.historyitem_MathGroupChar_Pr]=[AscDFH.historyitem_MathGroupChar_Pr];AscDFH.changesRelationMap[AscDFH.historyitem_MathLimit_Type]=[AscDFH.historyitem_MathLimit_Type];AscDFH.changesRelationMap[AscDFH.historyitem_MathBorderBox_Top]=[AscDFH.historyitem_MathBorderBox_Top];AscDFH.changesRelationMap[AscDFH.historyitem_MathBorderBox_Bot]=[AscDFH.historyitem_MathBorderBox_Bot];AscDFH.changesRelationMap[AscDFH.historyitem_MathBorderBox_Left]= [AscDFH.historyitem_MathBorderBox_Left];AscDFH.changesRelationMap[AscDFH.historyitem_MathBorderBox_Right]=[AscDFH.historyitem_MathBorderBox_Right];AscDFH.changesRelationMap[AscDFH.historyitem_MathBorderBox_Hor]=[AscDFH.historyitem_MathBorderBox_Hor];AscDFH.changesRelationMap[AscDFH.historyitem_MathBorderBox_Ver]=[AscDFH.historyitem_MathBorderBox_Ver];AscDFH.changesRelationMap[AscDFH.historyitem_MathBorderBox_TopLTR]=[AscDFH.historyitem_MathBorderBox_TopLTR];AscDFH.changesRelationMap[AscDFH.historyitem_MathBorderBox_TopRTL]= [AscDFH.historyitem_MathBorderBox_TopRTL];AscDFH.changesRelationMap[AscDFH.historyitem_MathBar_LinePos]=[AscDFH.historyitem_MathBar_LinePos];AscDFH.changesRelationMap[AscDFH.historyitem_MathMatrix_AddRow]=[AscDFH.historyitem_MathMatrix_AddRow,AscDFH.historyitem_MathMatrix_RemoveRow,AscDFH.historyitem_MathMatrix_AddColumn,AscDFH.historyitem_MathMatrix_RemoveColumn];AscDFH.changesRelationMap[AscDFH.historyitem_MathMatrix_RemoveRow]=[AscDFH.historyitem_MathMatrix_AddRow,AscDFH.historyitem_MathMatrix_RemoveRow, AscDFH.historyitem_MathMatrix_AddColumn,AscDFH.historyitem_MathMatrix_RemoveColumn];AscDFH.changesRelationMap[AscDFH.historyitem_MathMatrix_AddColumn]=[AscDFH.historyitem_MathMatrix_AddRow,AscDFH.historyitem_MathMatrix_RemoveRow,AscDFH.historyitem_MathMatrix_AddColumn,AscDFH.historyitem_MathMatrix_RemoveColumn];AscDFH.changesRelationMap[AscDFH.historyitem_MathMatrix_RemoveColumn]=[AscDFH.historyitem_MathMatrix_AddRow,AscDFH.historyitem_MathMatrix_RemoveRow,AscDFH.historyitem_MathMatrix_AddColumn, AscDFH.historyitem_MathMatrix_RemoveColumn];AscDFH.changesRelationMap[AscDFH.historyitem_MathMatrix_BaseJc]=[AscDFH.historyitem_MathMatrix_BaseJc];AscDFH.changesRelationMap[AscDFH.historyitem_MathMatrix_ColumnJc]=[AscDFH.historyitem_MathMatrix_ColumnJc];AscDFH.changesRelationMap[AscDFH.historyitem_MathMatrix_Interval]=[AscDFH.historyitem_MathMatrix_Interval];AscDFH.changesRelationMap[AscDFH.historyitem_MathMatrix_Plh]=[AscDFH.historyitem_MathMatrix_Plh];AscDFH.changesRelationMap[AscDFH.historyitem_MathDegree_SubSupType]= [AscDFH.historyitem_MathDegree_SubSupType];function CChangesMathContentAddItem(Class,Pos,Items){AscDFH.CChangesBaseContentChange.call(this,Class,Pos,Items,true)}CChangesMathContentAddItem.prototype=Object.create(AscDFH.CChangesBaseContentChange.prototype);CChangesMathContentAddItem.prototype.constructor=CChangesMathContentAddItem;CChangesMathContentAddItem.prototype.Type=AscDFH.historyitem_MathContent_AddItem;CChangesMathContentAddItem.prototype.Undo=function(){var oMathContent=this.Class;oMathContent.Content.splice(this.Pos, this.Items.length)};CChangesMathContentAddItem.prototype.Redo=function(){var oMathContent=this.Class;var Array_start=oMathContent.Content.slice(0,this.Pos);var Array_end=oMathContent.Content.slice(this.Pos);oMathContent.Content=Array_start.concat(this.Items,Array_end);for(var nIndex=0;nIndexoPage.EndLine)return this.Get_PageBounds(CurPage).Copy();var isJustify=this.Get_CompiledPr2(false).ParaPr.Jc===AscCommon.align_Justify&&this.Lines.length>1;var oBounds=null;for(var CurLine=oPage.StartLine;CurLine<=oPage.EndLine;++CurLine){var oLine= this.Lines[CurLine];var Top=oLine.Top+oPage.Y;var Bottom=oLine.Bottom+oPage.Y;var Left=null,Right=null;for(var CurRange=0,RangesCount=oLine.Ranges.length;CurRangeoRange.XVisible)Left=oRange.XVisible;if(isJustify){if(null===Right||RightTop)oBounds.Top=Top;if(oBounds.BottomLeft)oBounds.Left=Left;if(oBounds.Right0){if(Math.abs(Ranges[0].X0- X)<.001)this.X_ColumnStart=Ranges[0].X1;else this.X_ColumnStart=X;if(Math.abs(Ranges[Ranges.length-1].X1-XLimit)<.001)this.X_ColumnEnd=Ranges[Ranges.length-1].X0;else this.X_ColumnEnd=XLimit;if(this.X_ColumnStart>this.X_ColumnEnd){this.X_ColumnStart=X;this.X_ColumnEnd=XLimit}}}};Paragraph.prototype.CopyPr=function(OtherParagraph){return this.CopyPr_Open(OtherParagraph)};Paragraph.prototype.CopyPr_Open=function(OtherParagraph){OtherParagraph.X=this.X;OtherParagraph.XLimit=this.XLimit;if("undefined"!= typeof OtherParagraph.NumPr)OtherParagraph.RemoveNumPr();var NumPr=this.GetNumPr();if(undefined!=NumPr)OtherParagraph.SetNumPr(NumPr.NumId,NumPr.Lvl);var oOldPr=OtherParagraph.Pr;OtherParagraph.Pr=this.Pr.Copy(true);History.Add(new CChangesParagraphPr(OtherParagraph,oOldPr,OtherParagraph.Pr));OtherParagraph.private_UpdateTrackRevisionOnChangeParaPr(true);if(this.bFromDocument)OtherParagraph.Style_Add(this.Style_Get(),true);OtherParagraph.TextPr.Apply_TextPr(this.TextPr.Value)};Paragraph.prototype.private_UpdateSelectionPosOnAdd= function(nPosition,nCount){if(this.Content.length<=0){this.CurPos.ContentPos=0;this.Selection.StartPos=0;this.Selection.EndPos=0;return}if(undefined===nCount||null===nCount)nCount=1;if(this.CurPos.ContentPos>=nPosition)this.CurPos.ContentPos+=nCount;if(this.Selection.StartPos>=nPosition)this.Selection.StartPos+=nCount;if(this.Selection.EndPos>=nPosition)this.Selection.EndPos+=nCount;this.Selection.StartPos=Math.max(0,Math.min(this.Content.length-1,this.Selection.StartPos));this.Selection.EndPos=Math.max(0, Math.min(this.Content.length-1,this.Selection.EndPos));this.CurPos.ContentPos=Math.max(0,Math.min(this.Content.length-1,this.CurPos.ContentPos))};Paragraph.prototype.private_UpdateSelectionPosOnRemove=function(nPosition,nCount){if(this.CurPos.ContentPos>=nPosition+nCount)this.CurPos.ContentPos-=nCount;else if(this.CurPos.ContentPos>=nPosition)if(nPosition0)this.CurPos.ContentPos=nPosition-1;else this.CurPos.ContentPos=0;if(this.Selection.StartPos<= this.Selection.EndPos){if(this.Selection.StartPos>=nPosition+nCount)this.Selection.StartPos-=nCount;else if(this.Selection.StartPos>=nPosition)this.Selection.StartPos=nPosition;if(this.Selection.EndPos>=nPosition+nCount)this.Selection.EndPos-=nCount;else if(this.Selection.EndPos>=nPosition)this.Selection.StartPos=nPosition-1;if(this.Selection.StartPos>this.Selection.EndPos){this.Selection.Use=false;this.Selection.StartPos=0;this.Selection.EndPos=0}}else{if(this.Selection.EndPos>=nPosition+nCount)this.Selection.EndPos-= nCount;else if(this.Selection.EndPos>=nPosition)this.Selection.EndPos=nPosition;if(this.Selection.StartPos>=nPosition+nCount)this.Selection.StartPos-=nCount;else if(this.Selection.StartPos>=nPosition)this.Selection.StartPos=nPosition-1;if(this.Selection.EndPos>this.Selection.StartPos){this.Selection.Use=false;this.Selection.StartPos=0;this.Selection.EndPos=0}}this.Selection.StartPos=Math.max(0,Math.min(this.Content.length-1,this.Selection.StartPos));this.Selection.EndPos=Math.max(0,Math.min(this.Content.length- 1,this.Selection.EndPos));this.CurPos.ContentPos=Math.max(0,Math.min(this.Content.length-1,this.CurPos.ContentPos))};Paragraph.prototype.Internal_Content_Add=function(Pos,Item,bCorrectPos){History.Add(new CChangesParagraphAddItem(this,Pos,[Item]));this.Content.splice(Pos,0,Item);this.private_UpdateTrackRevisions();this.private_CheckUpdateBookmarks([Item]);this.UpdateDocumentOutline();this.private_UpdateSelectionPosOnAdd(Pos,1);var NearPosLen=this.NearPosArray.length;for(var Index=0;Index=Pos)ParaContentPos.Data[0]++}for(var Id in this.SearchResults){var ContentPos=this.SearchResults[Id].StartPos;if(ContentPos.Data[0]>=Pos)ContentPos.Data[0]++;ContentPos=this.SearchResults[Id].EndPos;if(ContentPos.Data[0]>=Pos)ContentPos.Data[0]++}for(var nIndex=0,nCount=this.SpellChecker.Elements.length;nIndex=Pos)ContentPos.Data[0]++;ContentPos=Element.EndPos;if(ContentPos.Data[0]>=Pos)ContentPos.Data[0]++}this.SpellChecker.Update_OnAdd(this,Pos,Item);if(Item.SetParent)Item.SetParent(this);if(Item.SetParagraph)Item.SetParagraph(this)};Paragraph.prototype.Add_ToContent=function(Pos,Item){this.Internal_Content_Add(Pos,Item)};Paragraph.prototype.AddToContent=function(nPos,oItem){this.Add_ToContent(nPos,oItem)};Paragraph.prototype.Remove_FromContent=function(Pos,Count){this.Internal_Content_Remove2(Pos, Count)};Paragraph.prototype.RemoveFromContent=function(nPos,nCount){return this.Internal_Content_Remove2(nPos,nCount)};Paragraph.prototype.Internal_Content_Concat=function(arrItems){var nStartPos=this.Content.length;for(var nIndex=0,nCount=arrItems.length;nIndexPos)ParaContentPos.Data[0]--}for(var Id in this.SearchResults){var ContentPos=this.SearchResults[Id].StartPos;if(ContentPos.Data[0]>Pos)ContentPos.Data[0]--;ContentPos=this.SearchResults[Id].EndPos;if(ContentPos.Data[0]>Pos)ContentPos.Data[0]--}if(true=== this.DeleteCommentOnRemove&¶_Comment===Item.Type&&this.LogicDocument)this.LogicDocument.RemoveComment(Item.CommentId,true,false);for(var nIndex=0,nCount=this.SpellChecker.Elements.length;nIndexPos)ContentPos.Data[0]--;ContentPos=Element.EndPos;if(ContentPos.Data[0]>Pos)ContentPos.Data[0]--}this.SpellChecker.Update_OnRemove(this,Pos,1)};Paragraph.prototype.Internal_Content_Remove2= function(Pos,Count){if(0===Pos&&this.Content.length===Count)return this.ClearContent();var CommentsToDelete=[];if(true===this.DeleteCommentOnRemove&&this.LogicDocument&&null!=this.LogicDocument.Comments){var DocumentComments=this.LogicDocument.Comments;for(var Index=Pos;IndexPos+Count)this.Selection.StartPos-=Count;else if(this.Selection.StartPos>Pos)this.Selection.StartPos= Pos;if(this.Selection.EndPos>Pos+Count)this.Selection.EndPos-=Count;if(this.Selection.EndPos>Pos)this.Selection.EndPos=Pos;if(this.CurPos.ContentPos>Pos+Count)this.CurPos.ContentPos-=Count;else if(this.CurPos.ContentPos>Pos)this.CurPos.ContentPos=Pos;var NearPosLen=this.NearPosArray.length;for(var Index=0;IndexPos+Count)ParaContentPos.Data[0]-=Count;else if(ParaContentPos.Data[0]> Pos)ParaContentPos.Data[0]=Math.max(0,Pos)}for(var Id in this.SearchResults){var ContentPos=this.SearchResults[Id].StartPos;if(ContentPos.Data[0]>Pos+Count)ContentPos.Data[0]-=Count;else if(ContentPos.Data[0]>Pos)ContentPos.Data[0]=Math.max(0,Pos);ContentPos=this.SearchResults[Id].EndPos;if(ContentPos.Data[0]>Pos+Count)ContentPos.Data[0]-=Count;else if(ContentPos.Data[0]>Pos)ContentPos.Data[0]=Math.max(0,Pos)}this.Content.splice(Pos,Count);this.private_UpdateSelectionPosOnRemove(Pos,Count);if(this.LogicDocument){var CountCommentsToDelete= CommentsToDelete.length;for(var Index=0;Index=0;CurPage--){var Page=this.Pages[CurPage];if(LineIndex>=Page.StartLine&&LineIndex<=Page.EndLine)return CurPage}return 0}; Paragraph.prototype.Get_ParaPosByContentPos=function(ContentPos){var ParaPos=this.Content[ContentPos.Get(0)].Get_ParaPosByContentPos(ContentPos,1);var CurLine=ParaPos.Line;var PagesCount=this.Pages.length;for(var CurPage=PagesCount-1;CurPage>=0;CurPage--){var Page=this.Pages[CurPage];if(CurLine>=Page.StartLine&&CurLine<=Page.EndLine){ParaPos.Page=CurPage;return ParaPos}}return ParaPos};Paragraph.prototype.ConvertParaContentPosToRangePos=function(oContentPos){var nRangePos=0;var nCurPos=oContentPos? Math.max(0,Math.min(this.Content.length-1,oContentPos.Get(0))):this.Content.length;for(var nPos=0;nPos=0;--nCurPos){this.Content[nCurPos].ProcessNotInlineObjectCheck(oChecker);if(oChecker.IsStop())break}if(!oChecker.IsStop())if(this.bFromDocument){if(undefined!==this.GetNumPr())return false}else if(undefined!==this.Get_CompiledPr2(false).ParaPr.Bullet)return false; if(!oChecker.GetResult())return false}if(undefined===nDirection||1===nDirection){oChecker.SetDirection(1);for(var nCurPos=nMathPos+1,nCount=this.Content.length;nCurPos=this.Lines.length)return{X:0,Y:0,Height:0,PageNum:0,Internal:{Line:0,Page:0,Range:0},Transform:Transform};var CurLine=LinePos.Line;var CurRange=LinePos.Range;var CurPage=LinePos.Page;if(-1!=this.CurPos.Line){CurLine=this.CurPos.Line;CurRange=this.CurPos.Range}if(this.Lines[CurLine].Ranges.length<=0)return{X:0,Y:0,Height:0,PageNum:0,Internal:{Line:0,Page:0,Range:0},Transform:Transform};var X=this.Lines[CurLine].Ranges[CurRange].XVisible;var Y=this.Pages[CurPage].Y+this.Lines[CurLine].Y; var StartPos=this.Lines[CurLine].Ranges[CurRange].StartPos;var EndPos=this.Lines[CurLine].Ranges[CurRange].EndPos;if(true===this.Numbering.Check_Range(CurRange,CurLine))X+=this.Numbering.WidthVisible;for(var CurPos=StartPos;CurPos<=EndPos;CurPos++){var Item=this.Content[CurPos];var Res=Item.Recalculate_CurPos(X,Y,CurPos===this.CurPos.ContentPos?true:false,CurRange,CurLine,CurPage,UpdateCurPos,UpdateTarget,ReturnTarget);if(CurPos===this.CurPos.ContentPos){Res.Transform=Transform;return Res}else X= Res.X}return{X:X,Y:Y,PageNum:this.Get_AbsolutePage(CurPage),Internal:{Line:CurLine,Page:CurPage,Range:CurRange},Transform:Transform}};Paragraph.prototype.Internal_Is_NullBorders=function(Borders){if(border_None!=Borders.Top.Value||border_None!=Borders.Bottom.Value||border_None!=Borders.Left.Value||border_None!=Borders.Right.Value||border_None!=Borders.Between.Value)return false;return true};Paragraph.prototype.Internal_Check_Ranges=function(CurLine,CurRange){var Ranges=this.Lines[CurLine].Ranges; var RangesCount=Ranges.length;if(RangesCount<=1)return true;else if(2===RangesCount){var Range0=Ranges[0];var Range1=Ranges[1];if(Range0.XEnd-Range0.X<.001&&1===CurRange&&Range1.XEnd-Range1.X>=.001)return true;else if(Range1.XEnd-Range1.X<.001&&0===CurRange&&Range0.XEnd-Range0.X>=.001)return true;else return false}else if(3===RangesCount&&1===CurRange){var Range0=Ranges[0];var Range2=Ranges[2];if(Range0.XEnd-Range0.X<.001&&Range2.XEnd-Range2.X<.001)return true;else return false}else return false}; Paragraph.prototype.GetNumberingTextPr=function(){var oNumPr=this.GetNumPr();if(!oNumPr)return new CTextPr;var oNumbering=this.Parent.GetNumbering();var oNum=oNumbering.GetNum(oNumPr.NumId);if(!oNum)return new CTextPr;var oLvl=oNum.GetLvl(oNumPr.Lvl);var oNumTextPr=this.Get_CompiledPr2(false).TextPr.Copy();oNumTextPr.Merge(this.TextPr.Value);oNumTextPr.Merge(oLvl.GetTextPr());if(undefined!==oNumTextPr.RFonts&&null!==oNumTextPr.RFonts){oNumTextPr.ReplaceThemeFonts(this.GetTheme().themeElements.fontScheme); if(!oNumTextPr.FontFamily)oNumTextPr.FontFamily={Name:"",Index:-1};oNumTextPr.FontFamily.Name=oNumTextPr.RFonts.Ascii.Name;oNumTextPr.FontFamily.Index=oNumTextPr.RFonts.Ascii.Index}return oNumTextPr};Paragraph.prototype.GetNumberingText=function(bWithoutLvlText){var oParent=this.GetParent();var oNumPr=this.GetNumPr();if(!oNumPr||!oParent)return"";var oNumbering=oParent.GetNumbering();var oNumInfo=oParent.CalculateNumberingValues(this,oNumPr);return oNumbering.GetText(oNumPr.NumId,oNumPr.Lvl,oNumInfo, bWithoutLvlText)};Paragraph.prototype.IsNumberedNumbering=function(){var oNumPr=this.GetNumPr();if(!oNumPr)return false;var oNumbering=this.Parent.GetNumbering();var oNum=oNumbering.GetNum(oNumPr.NumId);if(!oNum)return false;var oLvl=oNum.GetLvl(oNumPr.Lvl);return oLvl.IsNumbered()};Paragraph.prototype.IsBulletedNumbering=function(){var oNumPr=this.GetNumPr();if(!oNumPr)return false;var oNumbering=this.Parent.GetNumbering();var oNum=oNumbering.GetNum(oNumPr.NumId);if(!oNum)return false;var oLvl=oNum.GetLvl(oNumPr.Lvl); return oLvl.IsBulleted()};Paragraph.prototype.IsEmptyRange=function(nCurLine,nCurRange){var Line=this.Lines[nCurLine];var Range=Line.Ranges[nCurRange];var StartPos=Range.StartPos;var EndPos=Range.EndPos;for(var CurPos=StartPos;CurPos<=EndPos;CurPos++)if(false===this.Content[CurPos].IsEmptyRange(nCurLine,nCurRange))return false;return true};Paragraph.prototype.Reset_RecalculateCache=function(){};Paragraph.prototype.RecalculateCurPos=function(bUpdateX,bUpdateY,isUpdateTarget){if(undefined===isUpdateTarget)isUpdateTarget= true;var oCurPosInfo=this.Internal_Recalculate_CurPos(this.CurPos.ContentPos,true,isUpdateTarget,false);if(bUpdateX)this.CurPos.RealX=oCurPosInfo.X;if(bUpdateY)this.CurPos.RealY=oCurPosInfo.Y;return oCurPosInfo};Paragraph.prototype.GetCalculatedCurPosXY=function(){return this.Internal_Recalculate_CurPos(this.CurPos.ContentPos,false,false,true)};Paragraph.prototype.RecalculateMinMaxContentWidth=function(isRotated){var MinMax=new CParagraphMinMaxContentWidth;var Count=this.Content.length;for(var Pos= 0;Pos=AscCommon.document_compatibility_mode_Word15)MinInd+=ParaPr.Ind.FirstLine;if(MinMax.nMinWidth>.001||MinMax.nMaxWidth>.001){MinMax.nMinWidth+=MinInd;MinMax.nMaxWidth+=MinInd}if(true===isRotated){ParaPr=this.Get_CompiledPr().ParaPr; if(null===this.Get_DocumentNext()&&true===this.Is_Empty())return{Min:0,Max:0};var Min=MinMax.nMaxHeight+ParaPr.Spacing.Before+ParaPr.Spacing.After;return{Min:Min,Max:Min}}return{Min:MinMax.nMinWidth>0?MinMax.nMinWidth+.001:0,Max:MinMax.nMaxWidth>0?MinMax.nMaxWidth+.001:0}};Paragraph.prototype.Draw=function(CurPage,pGraphics){if(this.Pages[CurPage].EndLine<0)return;if(pGraphics.Start_Command)pGraphics.Start_Command(AscFormat.DRAW_COMMAND_PARAGRAPH);var Pr=this.Get_CompiledPr();var BgColor=undefined; if(Pr.ParaPr.Shd&&!Pr.ParaPr.Shd.IsNil()){BgColor=Pr.ParaPr.Shd.GetSimpleColor(this.GetTheme(),this.GetColorMap());if(true===BgColor.Auto)BgColor=this.Parent.Get_TextBackGroundColor()}else BgColor=this.Parent.Get_TextBackGroundColor();this.Internal_Draw_1(CurPage,pGraphics,Pr);this.Internal_Draw_2(CurPage,pGraphics,Pr);this.Internal_Draw_3(CurPage,pGraphics,Pr);this.Internal_Draw_4(CurPage,pGraphics,Pr,BgColor,this.GetTheme(),this.GetColorMap());this.Internal_Draw_5(CurPage,pGraphics,Pr,BgColor); this.Internal_Draw_6(CurPage,pGraphics,Pr);if(pGraphics.End_Command)pGraphics.End_Command()};Paragraph.prototype.Internal_Draw_1=function(CurPage,pGraphics,Pr){if(this.bFromDocument&&pGraphics.RENDERER_PDF_FLAG!==true){if(AscCommon.locktype_None!=this.Lock.Get_Type()&&this.LogicDocument&&!this.LogicDocument.IsViewModeInReview())if(CurPage>0||false===this.IsStartFromNewPage()||null===this.Get_DocumentPrev()){var X_min=-1+Math.min(this.Pages[CurPage].X,this.Pages[CurPage].X+Pr.ParaPr.Ind.Left,this.Pages[CurPage].X+ Pr.ParaPr.Ind.Left+Pr.ParaPr.Ind.FirstLine);var Y_top=this.Pages[CurPage].Bounds.Top;var Y_bottom=this.Pages[CurPage].Bounds.Bottom;if(true===editor.isCoMarksDraw||AscCommon.locktype_Mine!=this.Lock.Get_Type())pGraphics.DrawLockParagraph(this.Lock.Get_Type(),X_min,Y_top,Y_bottom)}var oColor=this.private_GetCollPrChange();if(false!==oColor)if(CurPage>0||false===this.IsStartFromNewPage()||null===this.Get_DocumentPrev()){var X_min=-3+Math.min(this.Pages[CurPage].X,this.Pages[CurPage].X+Pr.ParaPr.Ind.Left, this.Pages[CurPage].X+Pr.ParaPr.Ind.Left+Pr.ParaPr.Ind.FirstLine);var Y_top=this.Pages[CurPage].Bounds.Top;var Y_bottom=this.Pages[CurPage].Bounds.Bottom;pGraphics.p_color(oColor.r,oColor.g,oColor.b,255);pGraphics.drawVerLine(0,X_min,Y_top,Y_bottom,0)}if(true===this.Pr.HavePrChange())if(CurPage>0||false===this.IsStartFromNewPage()||null===this.Get_DocumentPrev()){var X_min=-3+Math.min(this.Pages[CurPage].X,this.Pages[CurPage].X+Pr.ParaPr.Ind.Left,this.Pages[CurPage].X+Pr.ParaPr.Ind.Left+Pr.ParaPr.Ind.FirstLine); var Y_top=this.Pages[CurPage].Bounds.Top;var Y_bottom=this.Pages[CurPage].Bounds.Bottom;var ReviewColor=this.GetPrReviewColor();pGraphics.p_color(ReviewColor.r,ReviewColor.g,ReviewColor.b,255);pGraphics.drawVerLine(0,X_min,Y_top,Y_bottom,0)}}};Paragraph.prototype.Internal_Draw_2=function(CurPage,pGraphics,Pr){var isFirstPage=this.Check_FirstPage(CurPage);if(this.bFromDocument&&!pGraphics.Start_Command&&true===editor.ShowParaMarks&&true===isFirstPage&&(true===Pr.ParaPr.KeepNext||true===Pr.ParaPr.KeepLines|| true===Pr.ParaPr.PageBreakBefore)){var SpecFont={FontFamily:{Name:"Arial",Index:-1},FontSize:12,Italic:false,Bold:false};var SpecSym=String.fromCharCode(9642);pGraphics.SetFont(SpecFont);pGraphics.b_color1(0,0,0,255);var CurLine=this.Pages[CurPage].FirstLine;var CurRange=0;var X=this.Lines[CurLine].Ranges[CurRange].XVisible;var Y=this.Pages[CurPage].Y+this.Lines[CurLine].Y;var SpecW=2.5;var SpecX=Math.min(X,this.Pages[CurPage].X)-SpecW;pGraphics.FillText(SpecX,Y,SpecSym)}};Paragraph.prototype.Internal_Draw_3= function(CurPage,pGraphics,Pr){var LogicDocument=this.LogicDocument;if(!LogicDocument)return;var bDrawBorders=this.Is_NeedDrawBorders();if(true===bDrawBorders&&0===CurPage&&true===this.private_IsEmptyPageWithBreak(CurPage))bDrawBorders=false;var PDSH=g_oPDSH;PDSH.ComplexFields.ResetPage(this,CurPage);var _Page=this.Pages[CurPage];var DocumentComments=LogicDocument.Comments;var Page_abs=this.Get_AbsolutePage(CurPage);var DrawComm=DocumentComments?DocumentComments.Is_Use():false;var DrawFind=LogicDocument.SearchEngine.Selection; var DrawColl=undefined!==pGraphics.RENDERER_PDF_FLAG;var DrawMMFields=!!(this.LogicDocument&&this.LogicDocument.Is_HighlightMailMergeFields&&true===this.LogicDocument.Is_HighlightMailMergeFields());var DrawSolvedComments=DocumentComments?DocumentComments.IsUseSolved():false;var SdtHighlightColor=this.LogicDocument.GetSdtGlobalShowHighlight&&this.LogicDocument.GetSdtGlobalShowHighlight()&&undefined===pGraphics.RENDERER_PDF_FLAG?this.LogicDocument.GetSdtGlobalColor():null;var FormsHighlight=this.LogicDocument.GetSpecialFormsHighlight&& this.LogicDocument.GetSpecialFormsHighlight()&&undefined===pGraphics.RENDERER_PDF_FLAG?this.LogicDocument.GetSpecialFormsHighlight():null;PDSH.Reset(this,pGraphics,DrawColl,DrawFind,DrawComm,DrawMMFields,this.GetEndInfoByPage(CurPage-1),DrawSolvedComments);var StartLine=_Page.StartLine;var EndLine=_Page.EndLine;for(var CurLine=StartLine;CurLine<=EndLine;CurLine++){var _Line=this.Lines[CurLine];var _LineMetrics=_Line.Metrics;var EndLinePos=_Line.EndPos;var Y0=_Page.Y+_Line.Y-_LineMetrics.Ascent;var Y1= _Page.Y+_Line.Y+_LineMetrics.Descent;if(_LineMetrics.LineGap<0)Y1+=_LineMetrics.LineGap;var RangesCount=_Line.Ranges.length;for(var CurRange=0;CurRange.001||true===this.IsEmpty()||true!==this.IsEmptyRange(CurLine,CurRange))&&(this.Pages.length-1===CurPage||CurLine1&&(Line.Ranges[0].W> .001||Line.Ranges[0].WEnd>.001))&&(!(Line.Info¶lineinfo_Empty)||Line.Info¶lineinfo_End||!(Line.Info¶lineinfo_BreakPage))&&(!(Line.Info¶lineinfo_Empty)||!(Line.Info¶lineinfo_End)||undefined===this.Get_SectionPr()))this.private_DrawLineNumber(X,Y,pGraphics,this.LineNumbersInfo.StartNum+CurLine+1,Theme,ColorMap,CurPage,CurLine);for(var CurRange=0;CurRange0)pGraphics.FillText2(X1+X0,Y,String.fromCharCode(tab_Symbol),0,TempWidth);else pGraphics.FillText2(X1, Y,String.fromCharCode(tab_Symbol),TempRealWidth-TempWidth,TempWidth)}}}else if(para_PresentationNumbering===this.Numbering.Type){var bIsEmpty=this.IsEmpty();if(!bIsEmpty||this.Is_ThisElementCurrent()||this.Parent.IsSelectionUse()&&this.Parent.IsSelectionEmpty()&&this.Parent.Selection.StartPos===this.Index)if(Pr.ParaPr.Ind.FirstLine<0)NumberingItem.Draw(X,Y,pGraphics,PDSE);else NumberingItem.Draw(this.Pages[CurPage].X+Pr.ParaPr.Ind.Left,Y,pGraphics,PDSE)}PDSE.X+=NumberingItem.WidthVisible}for(var Pos= StartPos;Pos<=EndPos;Pos++){var Item=this.Content[Pos];PDSE.CurPos.Update(Pos,0);Item.Draw_Elements(PDSE)}}if(pGraphics.End_Command)pGraphics.End_Command()}};Paragraph.prototype.Internal_Draw_5=function(CurPage,pGraphics,Pr,BgColor){var PDSL=g_oPDSL;PDSL.Reset(this,pGraphics,BgColor);PDSL.ComplexFields.ResetPage(this,CurPage);var Page=this.Pages[CurPage];var StartLine=Page.StartLine;var EndLine=Page.EndLine;var RunPrReview=null;var arrRunReviewAreasColors=[];var arrRunReviewAreas=[];var arrRunReviewRects= [];for(var CurLine=StartLine;CurLine<=EndLine;CurLine++){var Line=this.Lines[CurLine];var LineM=Line.Metrics;if(pGraphics.Start_Command)pGraphics.Start_Command(AscFormat.DRAW_COMMAND_LINE,Line,CurLine,3);var Baseline=Page.Y+Line.Y;var UnderlineOffset=LineM.TextDescent*.4;PDSL.Reset_Line(CurPage,CurLine,Baseline,UnderlineOffset);var RangesCount=Line.Ranges.length;for(var CurRange=0;CurRange0&&arrRunReviewRects){arrRunReviewRects.push(arrRunReviewRectsLine);arrRunReviewRectsLine= []}RunPrReview=Element.Additional.RunPr;arrRunReviewRects=[];arrRunReviewAreas.push(arrRunReviewRects);arrRunReviewAreasColors.push(new CDocumentColor(Element.r,Element.g,Element.b))}arrRunReviewRectsLine.push({X:Element.x0,Y:Page.Y+Line.Y-Line.Metrics.TextAscent,W:Element.x1-Element.x0,H:Line.Metrics.TextDescent+Line.Metrics.TextAscent+Line.Metrics.LineGap,Page:0});Element=aRunReview.Get_NextForward()}if(arrRunReviewRectsLine.length>0)arrRunReviewRects.push(arrRunReviewRectsLine);Element=aCollChange.Get_Next(); while(null!==Element){pGraphics.p_color(Element.r,Element.g,Element.b,255);pGraphics.AddSmartRect(Element.x0,Page.Y+Line.Top,Element.x1-Element.x0,Line.Bottom-Line.Top,0);Element=aCollChange.Get_Next()}if(editor&&this.LogicDocument&&true===this.LogicDocument.Spelling.Use&&!(pGraphics.IsThumbnail===true||pGraphics.IsDemonstrationMode===true||AscCommon.IsShapeToImageConverter)){pGraphics.p_color(255,0,0,255);var SpellingW=editor.WordControl.m_oDrawingDocument.GetMMPerDot(1);Element=aSpelling.Get_Next(); while(null!=Element){pGraphics.DrawSpellingLine(Element.y0,Element.x0,Element.x1,SpellingW);Element=aSpelling.Get_Next()}}}Element=aFormBorder.Get_Next(true);if(Element)if(this.IsInFixedForm()){var isIntegerGrid=pGraphics.GetIntegerGrid();if(!isIntegerGrid){pGraphics.SaveGrState();pGraphics.SetIntegerGrid(true)}var oForm=this.GetInnerForm();var oBounds=oForm.GetFixedFormBounds();var nFormX0=oBounds.X+.001;var nFormX1=oBounds.X+oBounds.W-.001;var nFormY0=oBounds.Y+.001;var nFormY1=oBounds.Y+oBounds.H- .001;pGraphics.p_color(Element.r,Element.g,Element.b,255);pGraphics.drawHorLineExt(c_oAscLineDrawingRule.Bottom,nFormY0,nFormX0,nFormX1,Element.w,-Element.w/2,Element.w/2);pGraphics.drawHorLineExt(c_oAscLineDrawingRule.Top,nFormY1,nFormX0,nFormX1,Element.w,-Element.w/2,Element.w/2);pGraphics.drawVerLine(c_oAscLineDrawingRule.Left,nFormX0,nFormY0,nFormY1,Element.w);pGraphics.drawVerLine(c_oAscLineDrawingRule.Right,nFormX1,nFormY0,nFormY1,Element.w);if(Element.Additional&&-1!==Element.Additional.Comb){var nCombMax= Element.Additional.Comb;var nInterStep=oBounds.W/nCombMax;var nInterX=nFormX0;for(var nInterIndex=0,nIntersCount=nCombMax-1;nInterIndex0){var nLinesCount=0;var nPageAbs=this.GetAbsolutePage(nCurPage);var _nCurLine= nCurLine-this.Pages[nCurPage].StartLine;while(nCurPage>0){nCurPage--;if(nPageAbs!==this.GetAbsolutePage(nCurPage))break;nLinesCount+=this.Pages[nCurPage].EndLine-this.Pages[nCurPage].StartLine+1;if(0===nCurPage)nLinesCount+=this.LineNumbersInfo.StartNum}_nLineNumber=nLinesCount+nStart+_nCurLine}if(nCountBy&&nCountBy>1&&0!==_nLineNumber%nCountBy)return;var nLineNumDistance=undefined===nDistance?this.ColumnsCount>1?AscCommon.TwipsToMM(180):AscCommon.TwipsToMM(360):AscCommon.TwipsToMM(nDistance);var sLineNum= ""+_nLineNumber;var oTextPr=oLineNumInfo.GetTextPr();var arrDigitsW=oLineNumInfo.GetWidths();var nLineNumSumW=0;for(var nPos=0,nCount=sLineNum.length;nPosEndPos){var Temp=StartPos; StartPos=EndPos;EndPos=Temp}if(EndPos===this.Content.length-1&&true===this.Content[EndPos].Selection_CheckParaEnd()){Result=false;this.Set_SectionPr(undefined)}if(StartPos===EndPos)if(this.Content[StartPos].IsSolid()){this.RemoveFromContent(StartPos,1);if(this.Content.length<=1){this.AddToContent(0,new ParaRun(this,false));this.CurPos.ContentPos=0}else if(StartPos>0){this.CurPos.ContentPos=StartPos-1;this.Content[StartPos-1].MoveCursorToEndPos()}else{this.CurPos.ContentPos=StartPos;this.Content[StartPos].MoveCursorToStartPos()}this.Correct_ContentPos2()}else{this.Content[StartPos].Remove(nCount, bOnAddText);var isRemoveOnDrag=this.LogicDocument?this.LogicDocument.DragAndDropAction:false;if(StartPos0){this.CurPos.ContentPos=StartPos-1;this.Content[EndPos- 1].MoveCursorToEndPos()}else{this.CurPos.ContentPos=EndPos;this.Content[EndPos].MoveCursorToStartPos()}this.Correct_ContentPos2()}else{this.Content[EndPos].Remove(nCount,bOnAddText);if(EndPos=StartPos+1;Pos--)if(para_Run===this.Content[Pos].Type)if(para_Run==this.Content[Pos].Type&&this.Content[Pos].CanDeleteInReviewMode())this.RemoveFromContent(Pos,1);else this.Content[Pos].SetReviewType(reviewtype_Remove,true);else{this.Content[Pos].Remove(nCount,bOnAddText);if(this.Content[Pos].IsEmpty())this.RemoveFromContent(Pos,1)}else this.RemoveFromContent(StartPos+1,EndPos-StartPos-1);var isFootEndnoteRefRun=para_Run===this.Content[StartPos].Type&&this.Content[StartPos].IsFootEndnoteReferenceRun(); if(this.Content[StartPos].IsSolid()){this.RemoveFromContent(StartPos,1);isStartDeleted=true;if(this.Content.length<=1){this.AddToContent(0,new ParaRun(this,false));this.CurPos.ContentPos=0}}else{this.Content[StartPos].Remove(nCount,bOnAddText);if(StartPos<=this.Content.length-2&&true===this.Content[StartPos].Is_Empty()&&true!==this.Content[StartPos].Is_CheckingNearestPos()&&(nCount>-1&&true!==bOnAddText||para_Run!==this.Content[StartPos].Type)){this.RemoveFromContent(StartPos,1);isStartDeleted=true}else if(isFootEndnoteRefRun)this.Content[StartPos].SetRStyle(undefined)}if(this.LogicDocument&& true===this.LogicDocument.IsTrackRevisions()){var _StartPos=Math.max(0,StartPos);var _EndPos=Math.min(this.Content.length-1,EndPos);for(var Pos=_StartPos;Pos<=_EndPos;++Pos)this.Content[Pos].RemoveSelection();this.CurPos.ContentPos=StartPos}if(isStartDeleted&&isEndDeleted)this.Selection.Use=false;if(nCount>-1&&true!==bOnAddText)this.Correct_ContentPos2();else{this.CurPos.ContentPos=StartPos;this.Selection.StartPos=StartPos;this.Selection.EndPos=StartPos;if(!this.Content[StartPos]||!this.Content[StartPos].IsCursorPlaceable())this.Correct_ContentPos2()}this.DeleteCommentOnRemove= true;if(this.LogicDocument)for(var CommentId in CommentsToDelete)this.LogicDocument.RemoveComment(CommentId,true,false)}if(true!==this.Content[this.CurPos.ContentPos].IsSelectionUse()){this.RemoveSelection();if(nCount>-1&&true!==bOnAddText)this.Correct_Content()}else{this.Selection.Use=true;this.Selection.Start=false;this.Selection.Flag=selectionflag_Common;this.Selection.StartPos=this.CurPos.ContentPos;this.Selection.EndPos=this.CurPos.ContentPos;if(nCount>-1&&true!==bOnAddText)this.Correct_Content(); this.Document_SetThisElementCurrent(false);return true}}else{if(isWord){var oStartPos=this.Get_ParaContentPos(false,false,false);var oSearchPos=new CParagraphSearchPos;if(nCount>0)this.Get_WordEndPos(oSearchPos,oStartPos);else this.Get_WordStartPos(oSearchPos,oStartPos);if(oSearchPos.Found&&0!==oSearchPos.Pos.Compare(oStartPos)){this.StartSelectionFromCurPos();this.SetSelectionContentPos(oStartPos,oSearchPos.Pos);this.Remove(1,false,false,false,false);this.RemoveSelection();return true}}var ContentPos= this.CurPos.ContentPos;while(false===this.Content[ContentPos].Remove(Direction,bOnAddText)){if(Direction<0)ContentPos--;else ContentPos++;if(ContentPos<0||ContentPos>=this.Content.length)break;if(Direction<0)this.Content[ContentPos].MoveCursorToEndPos(false);else this.Content[ContentPos].MoveCursorToStartPos()}if(ContentPos<0||ContentPos>=this.Content.length)Result=false;else{if(true===this.Content[ContentPos].IsSelectionUse()){this.Selection.Use=true;this.Selection.Start=false;this.Selection.Flag= selectionflag_Common;return true}if(ContentPos0&&true===Result){var oElement=this.Get_RunElementByPos(this.Get_ParaContentPos(false)); while(oElement&&oElement.IsDiacriticalSymbol&&oElement.IsDiacriticalSymbol()){if(false===this.Content[this.CurPos.ContentPos].Remove(Direction,bOnAddText)){this.CurPos.ContentPos++;if(this.CurPos.ContentPos>=this.Content.length-2)break;this.Content[this.CurPos.ContentPos].MoveCursorToStartPos()}oElement=this.Get_RunElementByPos(this.Get_ParaContentPos(false))}}if(Direction<0&&false===Result){Result=true;var Pr=this.Get_CompiledPr2(false).ParaPr;if(undefined!=this.GetNumPr()){var NumPr=this.GetNumPr(); if(0===NumPr.Lvl){this.RemoveNumPr();this.Set_Ind({FirstLine:0,Left:Math.max(Pr.Ind.Left,Pr.Ind.Left+Pr.Ind.FirstLine)},false)}else this.IndDecNumberingLevel(false)}else if(!this.PresentationPr.Bullet.IsNone())this.Remove_PresentationNumbering();else if(this.bFromDocument)if(align_Right===Pr.Jc)this.Set_Align(align_Center);else if(align_Center===Pr.Jc)this.Set_Align(align_Left);else if(Math.abs(Pr.Ind.FirstLine)>.001)if(Pr.Ind.FirstLine>0)this.Set_Ind({FirstLine:0},false);else this.Set_Ind({Left:Pr.Ind.Left+ Pr.Ind.FirstLine,FirstLine:0},false);else if(Math.abs(Pr.Ind.Left)>.001)this.Set_Ind({Left:0},false);else Result=false;else Result=false}}return Result};Paragraph.prototype.Remove_ParaEnd=function(){var ContentLen=this.Content.length;for(var CurPos=ContentLen-1;CurPos>=0;CurPos--){var Element=this.Content[CurPos];if(para_Run===Element.Type&&true===Element.Remove_ParaEnd())return}};Paragraph.prototype.Internal_FindForward=function(CurPos,arrId){var LetterPos=CurPos;var bFound=false;var Type=para_Unknown; if(CurPos<0||CurPos>=this.Content.length)return{Found:false};while(!bFound){Type=this.Content[LetterPos].Type;for(var Id=0;Idthis.Content.length-1)break}return{LetterPos:LetterPos,Found:bFound,Type:Type}};Paragraph.prototype.Internal_FindBackward=function(CurPos,arrId){var LetterPos=CurPos;var bFound=false;var Type=para_Unknown;if(CurPos<0||CurPos>=this.Content.length)return{Found:false};while(!bFound){Type= this.Content[LetterPos].Type;for(var Id=0;Id0){var nCurTabPos=(nLeft/nDefaultTabStop+.001|0)*nDefaultTabStop;if(Math.abs(nCurTabPos-nLeft)<.001)this.Set_Ind({Left:((nLeft/nDefaultTabStop+.001|0)-1)*nDefaultTabStop},false);else this.Set_Ind({Left:nCurTabPos},false)}else this.Set_Ind({Left:0},false);else if(nFirst>0){var nCurTabPos=((nFirst+nLeft)/nDefaultTabStop+.001|0)*nDefaultTabStop;if(Math.abs(nLeft+nFirst-nCurTabPos)<.001){var nPrevTabPos=Math.max(0,(((nFirst+ nLeft)/nDefaultTabStop+.001|0)-1)*nDefaultTabStop);if(nPrevTabPos>nLeft)this.Set_Ind({FirstLine:nPrevTabPos-nLeft},false);else this.Set_Ind({FirstLine:0},false)}else this.Set_Ind({FirstLine:nCurTabPos-nLeft},false)}else if(Math.abs(nFirst+nLeft)<.001)return;else if(nFirst+nLeft<0)this.Set_Ind({Left:-nFirst},false);else{var nCurTabPos=((nFirst+nLeft)/nDefaultTabStop+.001|0)*nDefaultTabStop;if(Math.abs(nLeft+nFirst-nCurTabPos)<.001){var nPrevTabPos=Math.max(0,(((nFirst+nLeft)/nDefaultTabStop+.001|0)- 1)*nDefaultTabStop);this.Set_Ind({Left:nPrevTabPos-nFirst},false)}else this.Set_Ind({Left:nCurTabPos-nFirst},false)}this.CompiledPr.NeedRecalc=true}};Paragraph.prototype.Extend_ToPos=function(_X){var CompiledPr=this.Get_CompiledPr2(false).ParaPr;var Page=this.Pages[this.Pages.length-1];var X0=Page.X;var X1=Page.XLimit-X0;var X=_X-X0;var Align=CompiledPr.Jc;if(X<0||X>X1||X<7.5&&align_Left===Align||X>X1-10&&align_Right===Align||Math.abs(X1/2-X)<10&&align_Center===Align)return false;if(true===this.IsEmpty()){if(align_Left!== Align)this.Set_Align(align_Left);if(Math.abs(X-X1/2)<12.5){this.Set_Align(align_Center);return true}else if(X>X1-12.5){this.Set_Align(align_Right);return true}else if(X<17.5){this.Set_Ind({FirstLine:12.5},false);return true}}var Tabs=CompiledPr.Tabs.Copy();if(Math.abs(X-X1/2)<12.5)Tabs.Add(new CParaTab(tab_Center,X1/2));else if(X>X1-12.5)Tabs.Add(new CParaTab(tab_Right,X1-.001));else Tabs.Add(new CParaTab(tab_Left,X));this.Set_Tabs(Tabs);this.Set_ParaContentPos(this.Get_EndPos(false),false,-1,-1); this.Add(new ParaTab);return true};Paragraph.prototype.IncDec_FontSize=function(bIncrease){if(true===this.ApplyToAll){var ContentLen=this.Content.length;for(var CurPos=0;CurPos=8)return false;NewPr=this.Internal_CompiledParaPrPresentation(CurLevel+1).TextPr}else{if(CurLevel<=0)return false;NewPr=this.Internal_CompiledParaPrPresentation(CurLevel-1).TextPr}DeltaFontSize=NewPr.FontSize-OldPr.FontSize;if(this.Pr.DefaultRunPr&&AscFormat.isRealNumber(this.Pr.DefaultRunPr.FontSize))if(this.Pr.DefaultRunPr.FontSize+ DeltaFontSize<1)return false;if(AscFormat.isRealNumber(this.TextPr.FontSize))if(this.TextPr.FontSize+DeltaFontSize<1)return false;for(i=0;i=0){LeftMargin=12.5*parseInt(10*LeftMargin/125);LeftMargin_new=((LeftMargin-10*LeftMargin%125/10)/12.5+1)*12.5}if(LeftMargin_new<0)LeftMargin_new= 12.5}else{var TempValue=125-10*LeftMargin%125;TempValue=125===TempValue?0:TempValue;LeftMargin_new=Math.max(((LeftMargin+TempValue/10)/12.5-1)*12.5,0)}this.Set_Ind({Left:LeftMargin_new},false)}var NewPresLvl=true===bIncrease?Math.min(8,this.PresentationPr.Level+1):Math.max(0,this.PresentationPr.Level-1);this.Set_PresentationLevel(NewPresLvl)};Paragraph.prototype.Correct_ContentPos=function(CorrectEndLinePos){if(this.IsSelectionUse())return;var Count=this.Content.length;var CurPos=this.CurPos.ContentPos; if(true===CorrectEndLinePos&&true===this.Content[CurPos].Cursor_Is_End()){var _CurPos=CurPos+1;while(_CurPos0&&true===this.Content[CurPos].Cursor_Is_NeededCorrectPos()&¶_Run===this.Content[CurPos-1].Type&&!this.Content[CurPos-1].IsSolid()){CurPos--;this.Content[CurPos].MoveCursorToEndPos()}this.CurPos.ContentPos= CurPos};Paragraph.prototype.Correct_ContentPos2=function(){if(this.IsSelectionUse())return;var Count=this.Content.length;var CurPos=Math.min(Math.max(0,this.CurPos.ContentPos),Count-1);while(CurPos>0&&false===this.Content[CurPos].IsCursorPlaceable()){CurPos--;this.Content[CurPos].MoveCursorToEndPos()}while(CurPos0&¶_Run!==this.Content[CurPos].Type&¶_Math!==this.Content[CurPos].Type&& para_Field!==this.Content[CurPos].Type&¶_InlineLevelSdt!==this.Content[CurPos].Type&&true===this.Content[CurPos].Cursor_Is_Start()){if(false===this.Content[CurPos-1].IsCursorPlaceable())break;CurPos--;this.Content[CurPos].MoveCursorToEndPos()}while(CurPos=this.Content.length)return ContentPos; this.Content[Pos].Get_ParaContentPos(bSelection,bStart,ContentPos,true===bUseCorrection?true:false);return ContentPos};Paragraph.prototype.Set_ParaContentPos=function(ContentPos,CorrectEndLinePos,Line,Range,bCorrectPos){var Pos=ContentPos.Get(0);if(Pos>=this.Content.length)Pos=this.Content.length-1;if(Pos<0)Pos=0;if(this.IsInFixedForm()){var nFormPos=-1;for(var nIndex=0,nCount=this.Content.length;nIndexnFormPos){this.Content[nFormPos].Get_EndPos(false,ContentPos,1);Pos=nFormPos}bCorrectPos=false}}this.CurPos.ContentPos=Pos;this.Content[Pos].Set_ParaContentPos(ContentPos,1);if(false!==bCorrectPos){this.Correct_ContentPos(CorrectEndLinePos);this.Correct_ContentPos2()}this.CurPos.Line=Line;this.CurPos.Range=Range};Paragraph.prototype.Set_SelectionContentPos=function(StartContentPos, EndContentPos,CorrectAnchor){var Depth=0;var Direction=1;if(StartContentPos.Compare(EndContentPos)>0)Direction=-1;var OldStartPos=Math.max(0,Math.min(this.Selection.StartPos,this.Content.length-1));var OldEndPos=Math.max(0,Math.min(this.Selection.EndPos,this.Content.length-1));if(OldStartPos>OldEndPos){OldStartPos=this.Selection.EndPos;OldEndPos=this.Selection.StartPos}var StartPos=StartContentPos.Get(Depth);var EndPos=EndContentPos.Get(Depth);if(this.IsInFixedForm()){var nFormPos=-1;for(var nIndex= 0,nCount=this.Content.length;nIndexnFormPos){this.Content[nFormPos].Get_EndPos(false,StartContentPos,1);StartPos=nFormPos}if(EndPosnFormPos){this.Content[nFormPos].Get_EndPos(false, EndContentPos,1);EndPos=nFormPos}CorrectAnchor=false}}this.Selection.StartPos=StartPos;this.Selection.EndPos=EndPos;if(OldStartPosStartPos&&OldEndPos>EndPos){var TempStart=Math.max(Math.max(StartPos,EndPos)+1,0);var TempEnd=Math.min(OldEndPos,this.Content.length- 1);for(var CurPos=TempStart;CurPos<=TempEnd;CurPos++)this.Content[CurPos].RemoveSelection()}if(StartPos===EndPos)this.Content[StartPos].Set_SelectionContentPos(StartContentPos,EndContentPos,Depth+1,0,0);else if(StartPos>EndPos){this.Content[StartPos].Set_SelectionContentPos(StartContentPos,null,Depth+1,0,1);this.Content[EndPos].Set_SelectionContentPos(null,EndContentPos,Depth+1,-1,0);for(var CurPos=EndPos+1;CurPosthis.Selection.EndPos)break;this.Selection.StartPos=nPos+1}else{if(nPos+1>this.Selection.StartPos)break;this.Selection.EndPos=nPos+1}this.Content[nPos].RemoveSelection()}else break}};Paragraph.prototype.SetSelectionContentPos=function(oStartPos,oEndPos,isCorrectAnchor){return this.Set_SelectionContentPos(oStartPos,oEndPos,isCorrectAnchor)};Paragraph.prototype.Get_ParaContentPosByXY= function(X,Y,PageIndex,bYLine,StepEnd,bCenterMode){var SearchPos=new CParagraphSearchPosXY;SearchPos.CenterMode=undefined===bCenterMode?true:bCenterMode;if(this.Lines.length<=0)return SearchPos;var PNum=-1===PageIndex||undefined===PageIndex?0:PageIndex;if(PNum>=this.Pages.length){PNum=this.Pages.length-1;bYLine=true;Y=this.Lines.length-1}else if(PNum<0){PNum=0;bYLine=true;Y=0}var CurLine=0;if(true===bYLine)CurLine=Y;else{CurLine=this.Pages[PNum].FirstLine;var bFindY=false;var CurLineY=this.Pages[PNum].Y+ this.Lines[CurLine].Y+this.Lines[CurLine].Metrics.Descent+this.Lines[CurLine].Metrics.LineGap;var LastLine=PNum>=this.Pages.length-1?this.Lines.length-1:this.Pages[PNum+1].FirstLine-1;while(!bFindY){if(Y=LastLine)break;CurLine++;CurLineY=this.Lines[CurLine].Y+this.Pages[PNum].Y+this.Lines[CurLine].Metrics.Descent+this.Lines[CurLine].Metrics.LineGap}}var CurRange=0;var RangesCount=this.Lines[CurLine].Ranges.length;if(RangesCount<=0)return SearchPos;else if(RangesCount>1)for(;CurRange< RangesCount-1;CurRange++){var _CurRange=this.Lines[CurLine].Ranges[CurRange];var _NextRange=this.Lines[CurLine].Ranges[CurRange+1];if(X<(_CurRange.XEnd+_NextRange.X)/2)break}if(CurRange>=RangesCount)CurRange=Math.max(RangesCount-1,0);var Range=this.Lines[CurLine].Ranges[CurRange];var StartPos=Range.StartPos;var EndPos=Range.EndPos;SearchPos.CurX=Range.XVisible;SearchPos.X=X;SearchPos.Y=Y;if(true===this.Numbering.Check_Range(CurRange,CurLine)){var oNumPr=this.GetNumPr();if(para_Numbering===this.Numbering.Type&& oNumPr&&oNumPr.IsValid()){var NumJc=this.Parent.GetNumbering().GetNum(oNumPr.NumId).GetLvl(oNumPr.Lvl).GetJc();var NumX0=SearchPos.CurX;var NumX1=SearchPos.CurX;switch(NumJc){case align_Right:{NumX0-=this.Numbering.WidthNum;break}case align_Center:{NumX0-=this.Numbering.WidthNum/2;NumX1+=this.Numbering.WidthNum/2;break}case align_Left:default:{NumX1+=this.Numbering.WidthNum;break}}if(SearchPos.X>=NumX0&&SearchPos.X<=NumX1)SearchPos.Numbering=true}SearchPos.CurX+=this.Numbering.WidthVisible}if(true!== StepEnd&&EndPos===this.Content.length-1&&EndPos>StartPos)EndPos--;for(var CurPos=StartPos;CurPos<=EndPos;CurPos++){var Item=this.Content[CurPos];if(false===SearchPos.InText)SearchPos.InTextPos.Update2(CurPos,0);if(true===Item.Get_ParaContentPosByXY(SearchPos,1,CurLine,CurRange,StepEnd))SearchPos.Pos.Update2(CurPos,0)}SearchPos.InTextX=SearchPos.InText;if(true===SearchPos.InText&&Y>=this.Pages[PNum].Y+this.Lines[CurLine].Y-this.Lines[CurLine].Metrics.Ascent-.01&&Y<=this.Pages[PNum].Y+this.Lines[CurLine].Y+ this.Lines[CurLine].Metrics.Descent+this.Lines[CurLine].Metrics.LineGap+.01)SearchPos.InText=true;else SearchPos.InText=false;if(SearchPos.DiffX>1E6-1){SearchPos.Line=-1;SearchPos.Range=-1}else{SearchPos.Line=CurLine;SearchPos.Range=CurRange}return SearchPos};Paragraph.prototype.GetCursorPosXY=function(){return{X:this.CurPos.RealX,Y:this.CurPos.RealY}};Paragraph.prototype.MoveCursorLeft=function(AddToSelect,Word){if(true===this.Selection.Use){var EndSelectionPos=this.Get_ParaContentPos(true,false); var StartSelectionPos=this.Get_ParaContentPos(true,true);if(true!==AddToSelect){var oPlaceHolderObject=this.GetPlaceHolderObject();var oPresentationField=this.GetPresentationField();var CorrectedStartPos=this.Get_ParaContentPos(true,true,true);var CorrectedEndPos=this.Get_ParaContentPos(true,false,true);var SelectPos=CorrectedStartPos;if(CorrectedStartPos.Compare(CorrectedEndPos)>0)SelectPos=CorrectedEndPos;this.RemoveSelection();var oResultPos=SelectPos;if(oPlaceHolderObject&&oPlaceHolderObject instanceof CInlineLevelSdt||oPresentationField){var oSearchPos=new CParagraphSearchPos;this.Get_LeftPos(oSearchPos,SelectPos);oResultPos=oSearchPos.Pos}this.Set_ParaContentPos(oResultPos,true,-1,-1)}else{var SearchPos=new CParagraphSearchPos;SearchPos.ForSelection=true;if(true===Word)this.Get_WordStartPos(SearchPos,EndSelectionPos);else this.Get_LeftPos(SearchPos,EndSelectionPos);if(true===SearchPos.Found)this.Set_SelectionContentPos(StartSelectionPos,SearchPos.Pos);else return false}}else{var SearchPos=new CParagraphSearchPos; var ContentPos=this.Get_ParaContentPos(false,false);if(true===AddToSelect)SearchPos.ForSelection=true;if(true===Word)this.Get_WordStartPos(SearchPos,ContentPos);else this.Get_LeftPos(SearchPos,ContentPos);if(true===AddToSelect)if(true===SearchPos.Found){this.Selection.Use=true;this.Set_SelectionContentPos(ContentPos,SearchPos.Pos)}else{this.Selection.Use=false;return false}else if(true===SearchPos.Found)this.Set_ParaContentPos(SearchPos.Pos,true,-1,-1);else return false}if(true===this.Selection.Use){var SelectionEndPos= this.Get_ParaContentPos(true,false);this.Set_ParaContentPos(SelectionEndPos,false,-1,-1)}this.Internal_Recalculate_CurPos(this.CurPos.ContentPos,true,false,false);this.CurPos.RealX=this.CurPos.X;this.CurPos.RealY=this.CurPos.Y;return true};Paragraph.prototype.MoveCursorLeftWithSelectionFromEnd=function(Word){this.MoveCursorToEndPos(true,true);this.MoveCursorLeft(true,Word)};Paragraph.prototype.MoveCursorRight=function(AddToSelect,Word){if(true===this.Selection.Use){var EndSelectionPos=this.Get_ParaContentPos(true, false);var StartSelectionPos=this.Get_ParaContentPos(true,true);if(true!==AddToSelect)if(true===this.Selection_CheckParaEnd()){this.RemoveSelection();this.MoveCursorToEndPos(false);return false}else{var oPlaceHolderObject=this.GetPlaceHolderObject();var oPresentationField=this.GetPresentationField();var CorrectedStartPos=this.Get_ParaContentPos(true,true,true);var CorrectedEndPos=this.Get_ParaContentPos(true,false,true);var SelectPos=CorrectedEndPos;if(CorrectedStartPos.Compare(CorrectedEndPos)>0)SelectPos= CorrectedStartPos;this.RemoveSelection();var oResultPos=SelectPos;if(oPlaceHolderObject&&oPlaceHolderObject instanceof CInlineLevelSdt||oPresentationField){var oSearchPos=new CParagraphSearchPos;this.Get_RightPos(oSearchPos,SelectPos);oResultPos=oSearchPos.Pos}this.Set_ParaContentPos(oResultPos,true,-1,-1)}else{var SearchPos=new CParagraphSearchPos;SearchPos.ForSelection=true;if(true===Word)this.Get_WordEndPos(SearchPos,EndSelectionPos,true);else this.Get_RightPos(SearchPos,EndSelectionPos,true); if(true===SearchPos.Found)this.Set_SelectionContentPos(StartSelectionPos,SearchPos.Pos);else return false}}else{var SearchPos=new CParagraphSearchPos;var ContentPos=this.Get_ParaContentPos(false,false);if(true===AddToSelect)SearchPos.ForSelection=true;if(true===Word)this.Get_WordEndPos(SearchPos,ContentPos,AddToSelect);else this.Get_RightPos(SearchPos,ContentPos,AddToSelect);if(true===AddToSelect)if(true===SearchPos.Found){this.Selection.Use=true;this.Set_SelectionContentPos(ContentPos,SearchPos.Pos)}else{this.Selection.Use= false;return false}else if(true===SearchPos.Found)this.Set_ParaContentPos(SearchPos.Pos,true,-1,-1);else return false}if(true===this.Selection.Use){var SelectionEndPos=this.Get_ParaContentPos(true,false);this.Set_ParaContentPos(SelectionEndPos,false,-1,-1)}this.Internal_Recalculate_CurPos(this.CurPos.ContentPos,true,false,false);this.CurPos.RealX=this.CurPos.X;this.CurPos.RealY=this.CurPos.Y;return true};Paragraph.prototype.MoveCursorRightWithSelectionFromStart=function(Word){this.MoveCursorToStartPos(false); this.MoveCursorRight(true,Word)};Paragraph.prototype.MoveCursorToXY=function(X,Y,bLine,bDontChangeRealPos,CurPage){var SearchPosXY=this.Get_ParaContentPosByXY(X,Y,CurPage,bLine,false);this.Set_ParaContentPos(SearchPosXY.Pos,false,SearchPosXY.Line,SearchPosXY.Range);this.Internal_Recalculate_CurPos(-1,false,false,false);if(bDontChangeRealPos!=true){this.CurPos.RealX=this.CurPos.X;this.CurPos.RealY=this.CurPos.Y}if(true!=bLine){this.CurPos.RealX=X;this.CurPos.RealY=Y}};Paragraph.prototype.Get_PosByElement= function(Class){var ContentPos=new CParagraphContentPos;var CurRange=Class.StartRange;var CurLine=Class.StartLine;if(undefined!==this.Lines[CurLine]&&undefined!==this.Lines[CurLine].Ranges[CurRange]){var StartPos=this.Lines[CurLine].Ranges[CurRange].StartPos;var EndPos=this.Lines[CurLine].Ranges[CurRange].EndPos;if(0<=StartPos&&StartPos0)return arrClasses[arrClasses.length-1];return null};Paragraph.prototype.Get_RunElementByPos=function(ContentPos){var CurPos= ContentPos.Get(0);var ContentLen=this.Content.length;var Element=this.Content[CurPos].Get_RunElementByPos(ContentPos,1);while(null===Element){CurPos++;if(CurPos>=ContentLen)break;Element=this.Content[CurPos].Get_RunElementByPos()}return Element};Paragraph.prototype.Get_PageStartPos=function(CurPage){var CurLine=this.Pages[CurPage].StartLine;var CurRange=0;return this.Get_StartRangePos2(CurLine,CurRange)};Paragraph.prototype.Get_LeftPos=function(SearchPos,ContentPos){SearchPos.InitComplexFields(this.GetComplexFieldsByPos(ContentPos, true));var Depth=0;var CurPos=ContentPos.Get(Depth);this.Content[CurPos].Get_LeftPos(SearchPos,ContentPos,Depth+1,true);SearchPos.Pos.Update(CurPos,Depth);if(true===SearchPos.Found)return true;CurPos--;if(CurPos>=0&&this.Content[CurPos+1].IsStopCursorOnEntryExit()){this.Content[CurPos].Get_EndPos(false,SearchPos.Pos,Depth+1);SearchPos.Pos.Update(CurPos,Depth);SearchPos.Found=true;return true}while(CurPos>=0){this.Content[CurPos].Get_LeftPos(SearchPos,ContentPos,Depth+1,false);SearchPos.Pos.Update(CurPos, Depth);if(true===SearchPos.Found)return true;CurPos--}return false};Paragraph.prototype.Get_RightPos=function(SearchPos,ContentPos,StepEnd){SearchPos.InitComplexFields(this.GetComplexFieldsByPos(ContentPos,true));var Depth=0;var CurPos=ContentPos.Get(Depth);SearchPos.Found=true;while(SearchPos.Found){SearchPos.Found=false;this.Content[CurPos].Get_RightPos(SearchPos,ContentPos,Depth+1,true,StepEnd);SearchPos.Pos.Update(CurPos,Depth);if(SearchPos.Found){var oRunElement=this.Get_RunElementByPos(SearchPos.Pos); if(oRunElement&&oRunElement.IsDiacriticalSymbol&&oRunElement.IsDiacriticalSymbol()){SearchPos.Found=false;continue}return true}}CurPos++;var Count=this.Content.length;if(CurPos=0&&this.Content[CurPos].IsStopCursorOnEntryExit()){SearchPos.Found=true;return}if(CurPos>=0&&this.Content[CurPos+1].IsStopCursorOnEntryExit()){this.Content[CurPos].Get_EndPos(false,SearchPos.Pos,Depth+1);SearchPos.Pos.Update(CurPos,Depth);SearchPos.Found=true;return}while(CurPos>=0){this.Content[CurPos].Get_WordStartPos(SearchPos,ContentPos,Depth+1,false);if(true===SearchPos.UpdatePos)SearchPos.Pos.Update(CurPos,Depth);if(true=== SearchPos.Found)return;CurPos--;if(SearchPos.Shift&&CurPos>=0&&this.Content[CurPos].IsStopCursorOnEntryExit()){SearchPos.Found=true;return}if(CurPos>=0&&this.Content[CurPos+1].IsStopCursorOnEntryExit()){this.Content[CurPos].Get_EndPos(false,SearchPos.Pos,Depth+1);SearchPos.Pos.Update(CurPos,Depth);SearchPos.Found=true;return}}if(SearchPos.Shift)SearchPos.Found=true};Paragraph.prototype.Get_WordEndPos=function(SearchPos,ContentPos,StepEnd){SearchPos.InitComplexFields(this.GetComplexFieldsByPos(ContentPos, true));var Depth=0;var CurPos=ContentPos.Get(Depth);this.Content[CurPos].Get_WordEndPos(SearchPos,ContentPos,Depth+1,true,StepEnd);if(true===SearchPos.UpdatePos)SearchPos.Pos.Update(CurPos,Depth);if(true===SearchPos.Found)return;CurPos++;var Count=this.Content.length;if(SearchPos.Shift&&CurPos=StartPos;CurPos--){var Item=this.Content[CurPos];if(true===Item.Get_StartRangePos(CurLine,CurRange,SearchPos,1))SearchPos.Pos.Update(CurPos,0)}};Paragraph.prototype.Get_StartRangePos2=function(CurLine,CurRange){var ContentPos=new CParagraphContentPos;var Depth=0; var Pos=this.Lines[CurLine].Ranges[CurRange].StartPos;ContentPos.Update(Pos,Depth);this.Content[Pos].Get_StartRangePos2(CurLine,CurRange,ContentPos,Depth+1);return ContentPos};Paragraph.prototype.Get_EndRangePos2=function(CurLine,CurRange){var ContentPos=new CParagraphContentPos;if(!this.Lines[CurLine]||!this.Lines[CurLine].Ranges[CurRange])return ContentPos;var Depth=0;var Pos=this.Lines[CurLine].Ranges[CurRange].EndPos;ContentPos.Update(Pos,Depth);this.Content[Pos].Get_EndRangePos2(CurLine,CurRange, ContentPos,Depth+1);return ContentPos};Paragraph.prototype.Get_StartPos=function(){var ContentPos=new CParagraphContentPos;var Depth=0;ContentPos.Update(0,Depth);this.Content[0].Get_StartPos(ContentPos,Depth+1);return ContentPos};Paragraph.prototype.GetStartPos=function(){return this.Get_StartPos()};Paragraph.prototype.Get_EndPos=function(BehindEnd){var ContentPos=new CParagraphContentPos;var Depth=0;var ContentLen=this.Content.length;ContentPos.Update(ContentLen-1,Depth);this.Content[ContentLen- 1].Get_EndPos(BehindEnd,ContentPos,Depth+1);return ContentPos};Paragraph.prototype.Get_EndPos2=function(BehindEnd){var ContentPos=new CParagraphContentPos;var Depth=0;var ContentLen=this.Content.length;var Pos;if(this.Content.length>1)Pos=ContentLen-2;else Pos=ContentLen-1;ContentPos.Update(Pos,Depth);this.Content[Pos].Get_EndPos(BehindEnd,ContentPos,Depth+1);return ContentPos};Paragraph.prototype.GetNextRunElements=function(oRunElements){var ContentPos=oRunElements.ContentPos;var CurPos=ContentPos.Get(0); var ContentLen=this.Content.length;oRunElements.UpdatePos(CurPos,0);this.Content[CurPos].GetNextRunElements(oRunElements,true,1);CurPos++;while(CurPos=0){if(oRunElements.IsEnoughElements())break;oRunElements.UpdatePos(CurPos,0);this.Content[CurPos].GetPrevRunElements(oRunElements,false,1);CurPos--}};Paragraph.prototype.GetNextRunElement=function(){var oRunElements=new CParagraphRunElements(this.Get_ParaContentPos(this.Selection.Use,false,false),1,null);this.GetNextRunElements(oRunElements);if(oRunElements.Elements.length<=0)return null;return oRunElements.Elements[0]}; Paragraph.prototype.GetPrevRunElement=function(){var oRunElements=new CParagraphRunElements(this.Get_ParaContentPos(this.Selection.Use,false,false),1,null,true);this.GetPrevRunElements(oRunElements);if(oRunElements.Elements.length<=0)return null;return oRunElements.Elements[0]};Paragraph.prototype.MoveCursorUp=function(AddToSelect){var Result=true;if(true===this.Selection.Use){var SelectionStartPos=this.Get_ParaContentPos(true,true);var SelectionEndPos=this.Get_ParaContentPos(true,false);if(true=== AddToSelect){var LinePos=this.Get_ParaPosByContentPos(SelectionEndPos);var CurLine=LinePos.Line;if(0==CurLine){EndPos=this.Get_StartPos();Result=false}else{this.MoveCursorToXY(this.CurPos.RealX,CurLine-1,true,true);EndPos=this.Get_ParaContentPos(false,false)}this.Selection.Use=true;this.Set_SelectionContentPos(SelectionStartPos,EndPos)}else{var TopPos=SelectionStartPos;if(SelectionStartPos.Compare(SelectionEndPos)>0)TopPos=SelectionEndPos;var LinePos=this.Get_ParaPosByContentPos(TopPos);var CurLine= LinePos.Line;var CurRange=LinePos.Range;this.Set_ParaContentPos(TopPos,false,CurLine,CurRange);this.Internal_Recalculate_CurPos(0,true,false,false);this.CurPos.RealX=this.CurPos.X;this.CurPos.RealY=this.CurPos.Y;this.RemoveSelection();if(0==CurLine)return false;else this.MoveCursorToXY(this.CurPos.RealX,CurLine-1,true,true)}}else{var LinePos=this.GetCurrentParaPos();var CurLine=LinePos.Line;if(true===AddToSelect){var StartPos=this.Get_ParaContentPos(false,false);var EndPos=null;if(0==CurLine){EndPos= this.Get_StartPos();Result=false}else{this.MoveCursorToXY(this.CurPos.RealX,CurLine-1,true,true);EndPos=this.Get_ParaContentPos(false,false)}this.Selection.Use=true;this.Set_SelectionContentPos(StartPos,EndPos)}else if(0==CurLine)return false;else this.MoveCursorToXY(this.CurPos.RealX,CurLine-1,true,true)}return Result};Paragraph.prototype.MoveCursorDown=function(AddToSelect){var Result=true;if(true===this.Selection.Use){var SelectionStartPos=this.Get_ParaContentPos(true,true);var SelectionEndPos= this.Get_ParaContentPos(true,false);if(true===AddToSelect){var LinePos=this.Get_ParaPosByContentPos(SelectionEndPos);var CurLine=LinePos.Line;if(this.Lines.length-1==CurLine){EndPos=this.Get_EndPos(true);Result=false}else{this.MoveCursorToXY(this.CurPos.RealX,CurLine+1,true,true);EndPos=this.Get_ParaContentPos(false,false)}this.Selection.Use=true;this.Set_SelectionContentPos(SelectionStartPos,EndPos)}else{var BottomPos=SelectionEndPos;if(SelectionStartPos.Compare(SelectionEndPos)>0)BottomPos=SelectionStartPos; var LinePos=this.Get_ParaPosByContentPos(BottomPos);var CurLine=LinePos.Line;var CurRange=LinePos.Range;this.Set_ParaContentPos(BottomPos,false,CurLine,CurRange);this.Internal_Recalculate_CurPos(0,true,false,false);this.CurPos.RealX=this.CurPos.X;this.CurPos.RealY=this.CurPos.Y;this.RemoveSelection();if(this.Lines.length-1==CurLine)return false;else this.MoveCursorToXY(this.CurPos.RealX,CurLine+1,true,true)}}else{var LinePos=this.GetCurrentParaPos();var CurLine=LinePos.Line;if(true===AddToSelect){var StartPos= this.Get_ParaContentPos(false,false);var EndPos=null;if(this.Lines.length-1==CurLine){EndPos=this.Get_EndPos(true);Result=false}else{this.MoveCursorToXY(this.CurPos.RealX,CurLine+1,true,true);EndPos=this.Get_ParaContentPos(false,false)}this.Selection.Use=true;this.Set_SelectionContentPos(StartPos,EndPos)}else if(this.Lines.length-1==CurLine)return false;else this.MoveCursorToXY(this.CurPos.RealX,CurLine+1,true,true)}return Result};Paragraph.prototype.MoveCursorToEndOfLine=function(AddToSelect){if(true=== this.Selection.Use){var EndSelectionPos=this.Get_ParaContentPos(true,false);var StartSelectionPos=this.Get_ParaContentPos(true,true);if(true===AddToSelect){var SearchPos=new CParagraphSearchPos;this.Get_EndRangePos(SearchPos,EndSelectionPos);this.Set_SelectionContentPos(StartSelectionPos,SearchPos.Pos)}else{var RightPos=EndSelectionPos;if(EndSelectionPos.Compare(StartSelectionPos)<0)RightPos=StartSelectionPos;var SearchPos=new CParagraphSearchPos;this.Get_EndRangePos(SearchPos,RightPos);this.RemoveSelection(); this.Set_ParaContentPos(SearchPos.Pos,false,SearchPos.Line,SearchPos.Range)}}else{var SearchPos=new CParagraphSearchPos;var ContentPos=this.Get_ParaContentPos(false,false);this.Get_EndRangePos(SearchPos,ContentPos);if(true===AddToSelect){this.Selection.Use=true;this.Set_SelectionContentPos(ContentPos,SearchPos.Pos)}else this.Set_ParaContentPos(SearchPos.Pos,false,SearchPos.Line,SearchPos.Range)}if(true===this.Selection.Use){var SelectionEndPos=this.Get_ParaContentPos(true,false);this.Set_ParaContentPos(SelectionEndPos, false,-1,-1)}this.Internal_Recalculate_CurPos(this.CurPos.ContentPos,true,false,false);this.CurPos.RealX=this.CurPos.X;this.CurPos.RealY=this.CurPos.Y};Paragraph.prototype.MoveCursorToStartOfLine=function(AddToSelect){if(true===this.Selection.Use){var EndSelectionPos=this.Get_ParaContentPos(true,false);var StartSelectionPos=this.Get_ParaContentPos(true,true);if(true===AddToSelect){var SearchPos=new CParagraphSearchPos;this.Get_StartRangePos(SearchPos,EndSelectionPos);this.Set_SelectionContentPos(StartSelectionPos, SearchPos.Pos)}else{var LeftPos=StartSelectionPos;if(StartSelectionPos.Compare(EndSelectionPos)>0)LeftPos=EndSelectionPos;var SearchPos=new CParagraphSearchPos;this.Get_StartRangePos(SearchPos,LeftPos);this.RemoveSelection();this.Set_ParaContentPos(SearchPos.Pos,false,SearchPos.Line,SearchPos.Range)}}else{var SearchPos=new CParagraphSearchPos;var ContentPos=this.Get_ParaContentPos(false,false);this.Get_StartRangePos(SearchPos,ContentPos);if(true===AddToSelect){this.Selection.Use=true;this.Set_SelectionContentPos(ContentPos, SearchPos.Pos)}else this.Set_ParaContentPos(SearchPos.Pos,false,SearchPos.Line,SearchPos.Range)}if(true===this.Selection.Use){var SelectionEndPos=this.Get_ParaContentPos(true,false);this.Set_ParaContentPos(SelectionEndPos,false,-1,-1)}this.Internal_Recalculate_CurPos(this.CurPos.ContentPos,true,false,false);this.CurPos.RealX=this.CurPos.X;this.CurPos.RealY=this.CurPos.Y};Paragraph.prototype.MoveCursorToStartPos=function(AddToSelect){if(true===AddToSelect){var StartPos=null;if(true===this.Selection.Use)StartPos= this.Get_ParaContentPos(true,true);else StartPos=this.Get_ParaContentPos(false,false);var EndPos=this.Get_StartPos();this.Selection.Use=true;this.Selection.Start=false;this.Set_SelectionContentPos(StartPos,EndPos)}else{this.RemoveSelection();this.CurPos.ContentPos=0;this.CurPos.Line=-1;this.CurPos.Range=-1;if(this.Content.length>0){this.Content[0].MoveCursorToStartPos();this.Correct_ContentPos(false);this.Correct_ContentPos2()}}};Paragraph.prototype.SkipPageColumnBreaks=function(){if(this.Selection.Use)return; var oRunItem=this.GetNextRunElement();while(oRunItem&¶_NewLine===oRunItem.Type&&oRunItem.IsPageOrColumnBreak()){this.MoveCursorRight();var oNextRunItem=this.GetNextRunElement();if(oNextRunItem===oRunItem)return;oRunItem=oNextRunItem}};Paragraph.prototype.MoveCursorToEndPos=function(AddToSelect,StartSelectFromEnd){if(true===AddToSelect){var StartPos=null;if(true===this.Selection.Use)StartPos=this.Get_ParaContentPos(true,true);else if(true===StartSelectFromEnd)StartPos=this.Get_EndPos(true);else StartPos= this.Get_ParaContentPos(false,false);var EndPos=this.Get_EndPos(true);this.Selection.Use=true;this.Selection.Start=false;this.Set_SelectionContentPos(StartPos,EndPos)}else if(true===StartSelectFromEnd){this.Selection.Use=true;this.Selection.Start=false;this.Selection.StartPos=this.Content.length-1;this.Selection.EndPos=this.Content.length-1;this.CurPos.ContentPos=this.Content.length-1;this.Content[this.CurPos.ContentPos].MoveCursorToEndPos(true)}else{this.RemoveSelection();this.CurPos.ContentPos= this.Content.length-1;this.CurPos.Line=-1;this.CurPos.Range=-1;this.Content[this.CurPos.ContentPos].MoveCursorToEndPos();this.Correct_ContentPos(false);this.Correct_ContentPos2()}};Paragraph.prototype.Cursor_MoveToNearPos=function(NearPos){this.Set_ParaContentPos(NearPos.ContentPos,true,-1,-1);this.Selection.Use=true;this.Set_SelectionContentPos(NearPos.ContentPos,NearPos.ContentPos);var SelectionStartPos=this.Get_ParaContentPos(true,true);var SelectionEndPos=this.Get_ParaContentPos(true,false);if(0=== SelectionStartPos.Compare(SelectionEndPos))this.RemoveSelection()};Paragraph.prototype.MoveCursorUpToLastRow=function(X,Y,AddToSelect){this.CurPos.RealX=X;this.CurPos.RealY=Y;this.MoveCursorToXY(X,this.Lines.length-1,true,true,this.Pages.length-1);if(true===AddToSelect)if(false===this.Selection.Use){this.Selection.Use=true;this.Set_SelectionContentPos(this.Get_EndPos(true),this.Get_ParaContentPos(false,false))}else this.Set_SelectionContentPos(this.Get_ParaContentPos(true,true),this.Get_ParaContentPos(false, false))};Paragraph.prototype.MoveCursorDownToFirstRow=function(X,Y,AddToSelect){this.CurPos.RealX=X;this.CurPos.RealY=Y;this.MoveCursorToXY(X,0,true,true,0);if(true===AddToSelect)if(false===this.Selection.Use){this.Selection.Use=true;this.Set_SelectionContentPos(this.Get_StartPos(),this.Get_ParaContentPos(false,false))}else this.Set_SelectionContentPos(this.Get_ParaContentPos(true,true),this.Get_ParaContentPos(false,false))};Paragraph.prototype.MoveCursorToDrawing=function(Id,bBefore){if(undefined=== bBefore)bBefore=true;var ContentPos=new CParagraphContentPos;var ContentLen=this.Content.length;var bFind=false;for(var CurPos=0;CurPos=this.Content.length-1)this.MoveCursorToEndPos()};Paragraph.prototype.Correct_Content=function(_StartPos,_EndPos,bDoNotDeleteEmptyRuns){if(this.NearPosArray.length>=1)return;var StartPos=undefined===_StartPos||null===_StartPos? 0:Math.max(_StartPos-1,0);var EndPos=undefined===_EndPos||null===_EndPos?this.Content.length-1:Math.min(_EndPos+1,this.Content.length-1);for(var CurPos=EndPos;CurPos>=StartPos;CurPos--){var CurElement=this.Content[CurPos];if(CurElement.CorrectContent)CurElement.CorrectContent();if((para_Hyperlink===CurElement.Type||para_Math===CurElement.Type||para_Field===CurElement.Type||para_InlineLevelSdt===CurElement.Type)&&true===CurElement.Is_Empty()&&true!==CurElement.Is_CheckingNearestPos())this.Internal_Content_Remove(CurPos); else if(para_Run!==CurElement.Type){if(CurPos===this.Content.length-1||para_Run!==this.Content[CurPos+1].Type||CurPos===this.Content.length-2){var NewRun=new ParaRun(this);this.Internal_Content_Add(CurPos+1,NewRun)}if(StartPos===CurPos&&(0===CurPos||para_Run!==this.Content[CurPos-1].Type)){var NewRun=new ParaRun(this);this.Internal_Content_Add(CurPos,NewRun)}}else if(true!==bDoNotDeleteEmptyRuns)if(true===CurElement.Is_Empty()&&(0EndPos){var Temp=StartPos;StartPos=EndPos;EndPos=Temp;Direction=-1}for(var CurPos=StartPos+1;CurPosPos)if(null!==LRun&&null!==RRun)this.CurPos.ContentPos=OldCurPos+2;else{if(null!==RRun||null!==RRun)this.CurPos.ContentPos=OldCurPos+1}else if(OldCurPos=== Pos)this.CurPos.ContentPos=CenterRunPos;this.CurPos.Line=-1;if(OldSelectionStartPos>Pos)if(null!==LRun&&null!==RRun)this.Selection.StartPos=OldSelectionStartPos+2;else{if(null!==RRun||null!==RRun)this.Selection.StartPos=OldSelectionStartPos+1}else if(OldSelectionStartPos===Pos)if(OldSelectionEndPos>OldSelectionStartPos)this.Selection.StartPos=Pos;else if(OldSelectionEndPosPos)if(null!==LRun&&null!==RRun)this.Selection.EndPos=OldSelectionEndPos+2;else{if(null!==RRun||null!==RRun)this.Selection.EndPos=OldSelectionEndPos+1}else if(OldSelectionEndPos===Pos)if(OldSelectionEndPos>OldSelectionStartPos)if(null!==LRun&&null!==RRun)this.Selection.EndPos= Pos+2;else if(null!==LRun||null!==RRun)this.Selection.EndPos=Pos+1;else this.Selection.EndPos=Pos;else if(OldSelectionEndPos0){var Temp=StartContentPos; StartContentPos=EndContentPos;EndContentPos=Temp}var StartPos=StartContentPos.Get(0);var EndPos=EndContentPos.Get(0);var CommentsToDelete={};for(var Pos=StartPos;Pos<=EndPos;Pos++){var Item=this.Content[Pos];if(para_Comment===Item.Type)CommentsToDelete[Item.CommentId]=true}if(this.LogicDocument)for(var CommentId in CommentsToDelete)this.LogicDocument.RemoveComment(CommentId,true,false);StartContentPos=this.Get_ParaContentPos(true,true);EndContentPos=this.Get_ParaContentPos(true,false);if(StartContentPos.Compare(EndContentPos)> 0){var Temp=StartContentPos;StartContentPos=EndContentPos;EndContentPos=Temp}StartPos=StartContentPos.Get(0);EndPos=EndContentPos.Get(0);if(this.Content.length-1===EndPos&&true===this.Selection_CheckParaEnd()){EndContentPos=this.Get_EndPos(false);EndPos=EndContentPos.Get(0)}var NewElementE=this.Content[EndPos].Split(EndContentPos,1);var NewElementS=this.Content[StartPos].Split(StartContentPos,1);var HyperPos=0;if(null!==NewElementS)Hyperlink.Add_ToContent(HyperPos++,NewElementS);for(var CurPos=StartPos+ 1;CurPos<=EndPos;CurPos++)Hyperlink.Add_ToContent(HyperPos++,this.Content[CurPos]);if(0===Hyperlink.Content.length)Hyperlink.Add_ToContent(0,new ParaRun(this,false));this.Internal_Content_Remove2(StartPos+1,EndPos-StartPos);this.Internal_Content_Add(StartPos+1,Hyperlink);if(null!==NewElementE)this.Internal_Content_Add(StartPos+2,NewElementE);this.RemoveSelection();this.Selection.Use=true;this.Selection.StartPos=StartPos+1;this.Selection.EndPos=StartPos+1;Hyperlink.MoveCursorToStartPos();Hyperlink.SelectAll(); var TextPr=new CTextPr;TextPr.Color=null;TextPr.Underline=null;TextPr.RStyle=editor&&editor.isDocumentEditor?editor.WordControl.m_oLogicDocument.Get_Styles().GetDefaultHyperlink():null;if(!this.bFromDocument)TextPr.Underline=true;Hyperlink.Apply_TextPr(TextPr,undefined,false);if(this.LogicDocument&&true===this.LogicDocument.IsTrackRevisions())Hyperlink.SetReviewType(reviewtype_Add,true)}else if(null!==HyperProps.Text&&""!==HyperProps.Text){var ContentPos=this.Get_ParaContentPos(false,false);var CurPos= ContentPos.Get(0);var TextPr=this.Get_TextPr(ContentPos);if(undefined!==HyperProps.TextPr&&null!==HyperProps.TextPr)TextPr=HyperProps.TextPr;Hyperlink=new ParaHyperlink;if(undefined!==HyperProps.Anchor&&null!==HyperProps.Anchor){Hyperlink.SetAnchor(HyperProps.Anchor);Hyperlink.SetValue("")}else if(undefined!=HyperProps.Value&&null!=HyperProps.Value){Hyperlink.SetValue(HyperProps.Value);Hyperlink.SetAnchor("")}if(undefined!=HyperProps.ToolTip&&null!=HyperProps.ToolTip)Hyperlink.SetToolTip(HyperProps.ToolTip); var HyperRun=new ParaRun(this);Hyperlink.Add_ToContent(0,HyperRun,false);if(this.bFromDocument){var Styles=editor.WordControl.m_oLogicDocument.Get_Styles();HyperRun.Set_Pr(TextPr.Copy());HyperRun.Set_Color(undefined);HyperRun.Set_Underline(undefined);HyperRun.Set_RStyle(Styles.GetDefaultHyperlink())}else{HyperRun.Set_Pr(TextPr.Copy());HyperRun.Set_Color(undefined);HyperRun.Set_Underline(true)}HyperRun.AddText(HyperProps.Text);var NewElement=this.Content[CurPos].Split(ContentPos,1);if(null!==NewElement)this.Internal_Content_Add(CurPos+ 1,NewElement);this.Internal_Content_Add(CurPos+1,Hyperlink);this.CurPos.ContentPos=CurPos+1;Hyperlink.MoveCursorToEndPos(false)}this.Correct_Content();return Hyperlink};Paragraph.prototype.ModifyHyperlink=function(HyperProps){var HyperPos=-1;if(true===this.Selection.Use){var StartPos=this.Selection.StartPos;var EndPos=this.Selection.EndPos;if(StartPos>EndPos){StartPos=this.Selection.EndPos;EndPos=this.Selection.StartPos}for(var CurPos=StartPos;CurPos<=EndPos;CurPos++){var Element=this.Content[CurPos]; if(true!==Element.IsSelectionEmpty()&¶_Hyperlink!==Element.Type)break;else if(true!==Element.IsSelectionEmpty()&¶_Hyperlink===Element.Type)if(-1===HyperPos)HyperPos=CurPos;else break}if(this.Selection.StartPos===this.Selection.EndPos&¶_Hyperlink===this.Content[this.Selection.StartPos].Type)HyperPos=this.Selection.StartPos}else if(para_Hyperlink===this.Content[this.CurPos.ContentPos].Type)HyperPos=this.CurPos.ContentPos;if(-1!=HyperPos){var Hyperlink=this.Content[HyperPos];if(undefined!== HyperProps.Anchor&&null!==HyperProps.Anchor){Hyperlink.SetAnchor(HyperProps.Anchor);Hyperlink.SetValue("")}else if(undefined!=HyperProps.Value&&null!=HyperProps.Value){Hyperlink.SetValue(HyperProps.Value);Hyperlink.SetAnchor("")}if(undefined!=HyperProps.ToolTip&&null!=HyperProps.ToolTip)Hyperlink.SetToolTip(HyperProps.ToolTip);if(null!=HyperProps.Text){var TextPr=Hyperlink.Get_TextPr();Hyperlink.Remove_FromContent(0,Hyperlink.Content.length);var HyperRun=new ParaRun(this);Hyperlink.Add_ToContent(0, HyperRun,false);if(this.bFromDocument){var Styles=editor.WordControl.m_oLogicDocument.Get_Styles();HyperRun.Set_Pr(TextPr.Copy());HyperRun.Set_Color(undefined);HyperRun.Set_Underline(undefined);HyperRun.Set_RStyle(Styles.GetDefaultHyperlink())}else{HyperRun.Set_Pr(TextPr.Copy());HyperRun.Set_Color(undefined);HyperRun.Set_Unifill(AscFormat.CreateUniFillSchemeColorWidthTint(11,0));HyperRun.Set_Underline(true)}HyperRun.AddText(HyperProps.Text);if(true===this.Selection.Use){this.Selection.StartPos=HyperPos; this.Selection.EndPos=HyperPos;Hyperlink.SelectAll()}else{this.CurPos.ContentPos=HyperPos;Hyperlink.MoveCursorToEndPos(false)}return true}return false}return false};Paragraph.prototype.RemoveHyperlink=function(){var HyperPos=-1;if(true===this.Selection.Use){var StartPos=this.Selection.StartPos;var EndPos=this.Selection.EndPos;if(StartPos>EndPos){StartPos=this.Selection.EndPos;EndPos=this.Selection.StartPos}for(var CurPos=StartPos;CurPos<=EndPos;CurPos++){var Element=this.Content[CurPos];if(true!== Element.IsSelectionEmpty()&¶_Hyperlink!==Element.Type)break;else if(true!==Element.IsSelectionEmpty()&¶_Hyperlink===Element.Type)if(-1===HyperPos)HyperPos=CurPos;else break}if(this.Selection.StartPos===this.Selection.EndPos&¶_Hyperlink===this.Content[this.Selection.StartPos].Type)HyperPos=this.Selection.StartPos}else if(para_Hyperlink===this.Content[this.CurPos.ContentPos].Type)HyperPos=this.CurPos.ContentPos;if(-1!==HyperPos){var Hyperlink=this.Content[HyperPos];var ContentLen=Hyperlink.Content.length; this.Internal_Content_Remove(HyperPos);var TextPr=new CTextPr;TextPr.RStyle=null;TextPr.Underline=null;TextPr.Color=null;TextPr.Unifill=null;for(var CurPos=0;CurPos=PagesCount-1&&Y>this.Pages[PagesCount-1].Bounds.Bottom&&MouseEvent.ClickCount>=2)return this.Parent.Extend_ToPos(X,Y);this.CurPos.RealX=X;this.CurPos.RealY=Y;this.Selection.EndManually=true;var SearchPosXY=this.Get_ParaContentPosByXY(X,Y,CurPage,false, true,true);var SearchPosXY2=this.Get_ParaContentPosByXY(X,Y,CurPage,false,false,true);this.Set_ParaContentPos(SearchPosXY2.Pos,true,SearchPosXY2.Line,SearchPosXY2.Range);if(true===SearchPosXY.End||true===this.Is_Empty()){var LastRange=this.Lines[this.Lines.length-1].Ranges[this.Lines[this.Lines.length-1].Ranges.length-1];if(!isFixedForm&&!this.Parent.IsFootnote()&&CurPage>=PagesCount-1&&X>LastRange.W&&MouseEvent.ClickCount>=2&&Y<=this.Pages[PagesCount-1].Bounds.Bottom)if(this.bFromDocument&&false=== this.LogicDocument.Document_Is_SelectionLocked(AscCommon.changestype_None,{Type:AscCommon.changestype_2_Element_and_Type,Element:this,CheckType:AscCommon.changestype_Paragraph_Content})){this.LogicDocument.StartAction(AscDFH.historydescription_Document_ParagraphExtendToPos);this.LogicDocument.GetHistory().Set_Additional_ExtendDocumentToPos();if(this.Extend_ToPos(X)){this.RemoveSelection();this.MoveCursorToEndPos();this.Document_SetThisElementCurrent(true);this.LogicDocument.Recalculate()}this.LogicDocument.FinalizeAction(); return}}this.Set_SelectionContentPos(this.Get_ParaContentPos(true,true),SearchPosXY.Pos);var SelectionStartPos=this.Get_ParaContentPos(true,true);var SelectionEndPos=this.Get_ParaContentPos(true,false);if(0===SelectionStartPos.Compare(SelectionEndPos)&&AscCommon.g_mouse_event_type_up===MouseEvent.Type){var oInfo=new CSelectedElementsInfo;this.GetSelectedElementsInfo(oInfo);var oField=oInfo.GetField();var oSdt=oInfo.GetInlineLevelSdt();if(oSdt&&oSdt.IsPlaceHolder()){oSdt.SelectAll(1);oSdt.SelectThisElement(1)}else if(oField&& fieldtype_FORMTEXT===oField.Get_FieldType()){oField.SelectAll(1);oField.SelectThisElement(1)}else if(oSdt&&oSdt.IsCheckBox())this.RemoveSelection();else{var ClickCounter=MouseEvent.ClickCount%2;if(1>=MouseEvent.ClickCount)this.RemoveSelection();else if(0==ClickCounter){var SearchPosS=new CParagraphSearchPos;var SearchPosE=new CParagraphSearchPos;this.Get_WordEndPos(SearchPosE,SearchPosXY.Pos);this.Get_WordStartPos(SearchPosS,SearchPosE.Pos);var StartPos=true===SearchPosS.Found?SearchPosS.Pos:this.Get_StartPos(); var EndPos=true===SearchPosE.Found?SearchPosE.Pos:this.Get_EndPos(false);this.Selection.Use=true;this.Set_SelectionContentPos(StartPos,EndPos);if(this.LogicDocument)this.LogicDocument.SetWordSelection(true)}else this.SelectAll(1)}}};Paragraph.prototype.StopSelection=function(){this.Selection.Start=false};Paragraph.prototype.RemoveSelection=function(){if(true===this.Selection.Use){var StartPos=this.Selection.StartPos;var EndPos=this.Selection.EndPos;if(StartPos>EndPos){StartPos=this.Selection.EndPos; EndPos=this.Selection.StartPos}StartPos=Math.max(0,StartPos);EndPos=Math.min(this.Content.length-1,EndPos);for(var CurPos=StartPos;CurPos<=EndPos;CurPos++)this.Content[CurPos].RemoveSelection()}this.Selection.Use=false;this.Selection.Start=false;this.Selection.Flag=selectionflag_Common;this.Selection.StartPos=0;this.Selection.EndPos=0};Paragraph.prototype.DrawSelectionOnPage=function(CurPage){if(!this.IsRecalculated())return;if(true!==this.Selection.Use)return;if(CurPage<0||CurPage>=this.Pages.length)return; var PageAbs=this.private_GetAbsolutePageIndex(CurPage);if(0===CurPage&&this.Pages[0].EndLine<0)return;var oLogicDocument=this.GetLogicDocument();var isFillingForm=oLogicDocument?oLogicDocument.IsFillingFormMode():false;var oFillingCC=null;if(isFillingForm||this.IsInFixedForm()){var oInfo=new CSelectedElementsInfo;this.GetSelectedElementsInfo(oInfo);oFillingCC=oInfo.GetInlineLevelSdt()}switch(this.Selection.Flag){case selectionflag_Common:{var StartPos=this.Selection.StartPos;var EndPos=this.Selection.EndPos; if(StartPos>EndPos){StartPos=this.Selection.EndPos;EndPos=this.Selection.StartPos}var _StartLine=this.Pages[CurPage].StartLine;var _EndLine=this.Pages[CurPage].EndLine;if(StartPos>this.Lines[_EndLine].Get_EndPos()||EndPosREndPos||EndPos.001&&oRect.H>.001)this.DrawingDocument.AddPageSelection(PageAbs,oRect.X,oRect.Y,oRect.W,oRect.H)}}else if(W>.001)this.DrawingDocument.AddPageSelection(PageAbs,StartX,StartY,W,H)}}break}case selectionflag_Numbering:case selectionflag_NumberingCur:{var ParaNum=this.Numbering;var NumberingRun=ParaNum.Run;if(null===NumberingRun)break;var CurLine=ParaNum.Line;var CurRange=ParaNum.Range;if(CurLinethis.Pages[CurPage].EndLine)break;var SelectY=this.Lines[CurLine].Top+ this.Pages[CurPage].Y;var SelectX=this.Lines[CurLine].Ranges[CurRange].XVisible;var SelectW=ParaNum.WidthVisible;var SelectH=this.Lines[CurLine].Bottom-this.Lines[CurLine].Top;var SelectW2=SelectW;var oNumPr=this.GetNumPr();var nNumJc=this.Parent.GetNumbering().GetNum(oNumPr.NumId).GetLvl(oNumPr.Lvl).GetJc();switch(nNumJc){case align_Center:{SelectX=this.Lines[CurLine].Ranges[CurRange].XVisible-ParaNum.WidthNum/2;SelectW=ParaNum.WidthVisible+ParaNum.WidthNum/2;break}case align_Right:{SelectX=this.Lines[CurLine].Ranges[CurRange].XVisible- ParaNum.WidthNum;SelectW=ParaNum.WidthVisible+ParaNum.WidthNum;break}case align_Left:default:{SelectX=this.Lines[CurLine].Ranges[CurRange].XVisible;SelectW=ParaNum.WidthVisible;break}}this.DrawingDocument.AddPageSelection(PageAbs,SelectX,SelectY,SelectW,SelectH);if(selectionflag_NumberingCur===this.Selection.Flag&&this.DrawingDocument.AddPageSelection2)this.DrawingDocument.AddPageSelection2(PageAbs,SelectX,SelectY,SelectW2,SelectH);break}}};Paragraph.prototype.SelectCurrentWord=function(){if(this.LogicDocument)this.LogicDocument.RemoveSelection(); else this.RemoveSelection();var oCurPos=this.Get_ParaContentPos(false,false);var SearchPosS=new CParagraphSearchPos;var SearchPosE=new CParagraphSearchPos;this.Get_WordEndPos(SearchPosE,oCurPos);this.Get_WordStartPos(SearchPosS,SearchPosE.Pos);var StartPos=true===SearchPosS.Found?SearchPosS.Pos:this.Get_StartPos();var EndPos=true===SearchPosE.Found?SearchPosE.Pos:this.Get_EndPos(false);this.Selection.Use=true;this.Set_SelectionContentPos(StartPos,EndPos);this.Document_SetThisElementCurrent(false); if(this.LogicDocument)this.LogicDocument.SetWordSelection(true)};Paragraph.prototype.Selection_CheckParaEnd=function(){if(true!==this.Selection.Use)return false;var EndPos=this.Selection.StartPos>this.Selection.EndPos?this.Selection.StartPos:this.Selection.EndPos;return this.Content[EndPos].Selection_CheckParaEnd()};Paragraph.prototype.CheckPosInSelection=function(X,Y,CurPage,NearPos){if(undefined!==NearPos){if(this===NearPos.Paragraph&&(true===this.Selection.Use&&true===this.Selection_CheckParaContentPos(NearPos.ContentPos)|| true===this.ApplyToAll))return true;return false}else{if(CurPage<0||CurPage>=this.Pages.length||true!=this.Selection.Use)return false;var SearchPosXY=this.Get_ParaContentPosByXY(X,Y,CurPage,false,true,false);if(true===SearchPosXY.InTextX)return this.Selection_CheckParaContentPos(SearchPosXY.InTextPos);return false}};Paragraph.prototype.Selection_CheckParaContentPos=function(ContentPos){var CurPos=ContentPos.Get(0);if(this.Selection.StartPos<=CurPos&&CurPos<=this.Selection.EndPos)return this.Content[CurPos].Selection_CheckParaContentPos(ContentPos, 1,this.Selection.StartPos===CurPos,CurPos===this.Selection.EndPos);else if(this.Selection.EndPos<=CurPos&&CurPos<=this.Selection.StartPos)return this.Content[CurPos].Selection_CheckParaContentPos(ContentPos,1,this.Selection.EndPos===CurPos,CurPos===this.Selection.StartPos);return false};Paragraph.prototype.Selection_CalculateTextPr=function(){if(true===this.Selection.Use||true===this.ApplyToAll){var StartPos=this.Selection.StartPos;var EndPos=this.Selection.EndPos;if(true===this.ApplyToAll){StartPos= 0;EndPos=this.Content.length-1}if(StartPos>EndPos){var Temp=EndPos;EndPos=StartPos;StartPos=Temp}if(EndPos>=this.Content.length)EndPos=this.Content.length-1;if(StartPos<0)StartPos=0;if(StartPos==EndPos)return this.Internal_CalculateTextPr(StartPos);while(this.Content[StartPos].Type==para_TextPr)StartPos++;var oEnd=this.Internal_FindBackward(EndPos-1,[para_Text,para_Space]);if(oEnd.Found)EndPos=oEnd.LetterPos;else while(this.Content[EndPos].Type==para_TextPr)EndPos--;var TextPr_start=this.Internal_CalculateTextPr(StartPos); var TextPr_vis=TextPr_start;for(var Pos=StartPos+1;PosEndPos){StartPos=this.Selection.EndPos;EndPos=this.Selection.StartPos}var LinesCount= this.Lines.length;var StartLine=-1;var EndLine=-1;for(var CurLine=0;CurLine=this.Lines[CurLine].Get_StartPos()&&StartPos<=this.Lines[CurLine].Get_EndPos())StartLine=CurLine;if(EndPos>=this.Lines[CurLine].Get_StartPos()&&EndPos<=this.Lines[CurLine].Get_EndPos())EndLine=CurLine}StartLine=Math.min(Math.max(0,StartLine),LinesCount-1);EndLine=Math.min(Math.max(0,EndLine),LinesCount-1);StartPage=this.GetPageByLine(StartLine);EndPage=this.GetPageByLine(EndLine); var PagesCount=this.Pages.length;var DrawSelection=new CParagraphDrawSelectionRange;DrawSelection.Draw=false;for(var CurLine=StartLine;CurLine<=EndLine;CurLine++){var Line=this.Lines[CurLine];var RangesCount=Line.Ranges.length;var CurPage=this.GetPageByLine(CurLine);DrawSelection.StartY=this.Pages[CurPage].Y+this.Lines[CurLine].Top;DrawSelection.H=this.Lines[CurLine].Bottom-this.Lines[CurLine].Top;var Result=null;for(var CurRange=0;CurRangeREndPos||EndPos.001){X0=StartX;X1=StartX+W;Y=StartY;var Page=this.Get_AbsolutePage(CurPage);if(null===BeginRect)BeginRect={X:StartX,Y:StartY,W:W,H:H,Page:Page};EndRect={X:StartX,Y:StartY,W:W,H:H,Page:Page}}if(null===_StartX){_StartX=StartX;_StartY=StartY}_EndX=StartX;_EndY=StartY}}}else{var oPos=this.GetTargetPos();_StartX=oPos.X;_StartY=oPos.Y;_EndX=oPos.X;_EndY=oPos.Y+oPos.Height;StartPage=this.CurPos.PagesPos;EndPage=this.CurPos.PagesPos}if(null=== BeginRect)BeginRect={X:_StartX===null?this.Pages[StartPage].X:_StartX,Y:_StartY===null?this.Pages[StartPage].Y:_StartY,W:0,H:0,Page:this.Get_AbsolutePage(StartPage)};if(null===EndRect)EndRect={X:_EndX===null?this.Pages[StartPage].X:_EndX,Y:_EndY===null?this.Pages[StartPage].Y:_EndY,W:0,H:0,Page:this.Get_AbsolutePage(EndPage)};return{Start:BeginRect,End:EndRect,Direction:this.GetSelectDirection()}};Paragraph.prototype.GetSelectDirection=function(){if(true!==this.Selection.Use)return 0;if(this.Selection.StartPos< this.Selection.EndPos)return 1;else if(this.Selection.StartPos>this.Selection.EndPos)return-1;return this.Content[this.Selection.StartPos].GetSelectDirection()};Paragraph.prototype.GetSelectionAnchorPos=function(){var X0=this.X,X1=this.XLimit,Y=this.Y,Page=this.Get_AbsolutePage(0);if(true===this.ApplyToAll);else if(true===this.Selection.Use){var StartPos=this.Selection.StartPos;var EndPos=this.Selection.EndPos;if(StartPos>EndPos){StartPos=this.Selection.EndPos;EndPos=this.Selection.StartPos}var LinesCount= this.Lines.length;var StartLine=-1;var EndLine=-1;for(var CurLine=0;CurLine=this.Lines[CurLine].Get_StartPos()&&StartPos<=this.Lines[CurLine].Get_EndPos())StartLine=CurLine;if(EndPos>=this.Lines[CurLine].Get_StartPos()&&EndPos<=this.Lines[CurLine].Get_EndPos())EndLine=CurLine}StartLine=Math.min(Math.max(0,StartLine),LinesCount-1);EndLine=Math.min(Math.max(0,EndLine),LinesCount-1);var PagesCount=this.Pages.length;var DrawSelection=new CParagraphDrawSelectionRange; DrawSelection.Draw=false;for(var CurLine=StartLine;CurLine<=EndLine;CurLine++){var Line=this.Lines[CurLine];var RangesCount=Line.Ranges.length;var CurPage=0;for(;CurPage=this.Pages[CurPage].StartLine&&CurLine<=this.Pages[CurPage].EndLine)break;CurPage=Math.min(PagesCount-1,CurPage);DrawSelection.StartY=this.Pages[CurPage].Y+this.Lines[CurLine].Top;DrawSelection.H=this.Lines[CurLine].Bottom-this.Lines[CurLine].Top;var Result=null;for(var CurRange=0;CurRangeREndPos||EndPos.001){X0=StartX;X1=StartX+W;Y=StartY;Page=this.Get_AbsolutePage(CurPage);if(null===Result)Result={X0:X0,X1:X1,Y:Y,Page:Page};else{Result.X0=Math.min(Result.X0,X0);Result.X1=Math.max(Result.X1,X1)}}}if(null!==Result)return Result}}else{X0=this.CurPos.X;X1=this.CurPos.X;Y=this.CurPos.Y;Page=this.Get_AbsolutePage(this.CurPos.PagesPos)}return{X0:X0, X1:X1,Y:Y,Page:Page}};Paragraph.prototype.GetSelectedText=function(bClearText,oPr){var Str="";if(!oPr||false!==oPr.Numbering){var oNumPr=this.GetNumPr();if(oNumPr&&oNumPr.IsValid()&&this.IsSelectionFromStart(false)){Str+=this.GetNumberingText(false);var nSuff=this.Parent.GetNumbering().GetNum(oNumPr.NumId).GetLvl(oNumPr.Lvl).GetSuff();if(Asc.c_oAscNumberingSuff.Tab===nSuff)Str+="\t";else if(Asc.c_oAscNumberingSuff.Space===nSuff)Str+=" "}}var Count=this.Content.length;for(var Pos=0;Pos 0)oInfo.SetComplexFields(arrComplexFields)};Paragraph.prototype.GetElementsInfoByXY=function(oInfo,X,Y,CurPage){var SearchPosXY=this.Get_ParaContentPosByXY(X,Y,CurPage,false,false);this.GetSelectedElementsInfo(oInfo,SearchPosXY.Pos,0)};Paragraph.prototype.GetSelectedContent=function(oSelectedContent){if(true!==this.Selection.Use)return;var isAllSelected=true===this.IsSelectionFromStart(true)&&true===this.Selection_CheckParaEnd();var nStartPos=this.Selection.StartPos;var nEndPos=this.Selection.EndPos; if(nStartPos>nEndPos){nStartPos=this.Selection.EndPos;nEndPos=this.Selection.StartPos}var oPara=null;if(oSelectedContent.IsTrackRevisions()){oPara=new Paragraph(this.DrawingDocument,this.Parent,!this.bFromDocument);oPara.Set_Pr(this.Pr.Copy());oPara.TextPr.Set_Value(this.TextPr.Value.Copy());for(var nPos=nStartPos,nParaPos=0;nPos<=nEndPos;++nPos){var oNewItem=this.Content[nPos].GetSelectedContent(oSelectedContent);if(oNewItem)if(oNewItem.Type===para_RevisionMove)oSelectedContent.SetMovedParts(true); else{oPara.AddToContent(nParaPos,oNewItem);nParaPos++}}}else if(isAllSelected)oPara=this.Copy(this.Parent);else{oPara=new Paragraph(this.DrawingDocument,this.Parent,!this.bFromDocument);oPara.Set_Pr(this.Pr.Copy(true));oPara.TextPr.Set_Value(this.TextPr.Value.Copy());for(var Pos=nStartPos,nParaPos=0;Pos<=nEndPos;Pos++){var Item=this.Content[Pos];if((nStartPos===Pos||nEndPos===Pos)&&true!==Item.IsSelectedAll()){var Content=Item.CopyContent(true);for(var ContentPos=0,ContentLen=Content.length;ContentPos< ContentLen;ContentPos++)if(Content[ContentPos].Type!==para_RevisionMove){oPara.Internal_Content_Add(nParaPos,Content[ContentPos],false);nParaPos++}}else if(Item.Type!==para_RevisionMove){oPara.Internal_Content_Add(nParaPos,Item.Copy(false,{CopyReviewPr:true}),false);nParaPos++}}if(undefined!==this.SectPr){var SectPr=new CSectionPr(this.SectPr.LogicDocument);SectPr.Copy(this.SectPr);oPara.Set_SectionPr(SectPr)}}if(oPara){if(oSelectedContent.IsSaveNumberingValues()&&this.GetParent()){var oParent=this.GetParent(); var oNumPr=this.GetNumPr();var oPrevNumPr=this.GetPrChangeNumPr();var oNumInfo=oNumPr?oParent.CalculateNumberingValues(this,oNumPr,true):null;var oPrevNumInfo=oPrevNumPr?oParent.CalculateNumberingValues(this.oPrevNumPr,true):null;oPara.SaveNumberingValues(oNumInfo,oPrevNumInfo)}oSelectedContent.Add(new CSelectedElement(oPara,isAllSelected))}};Paragraph.prototype.CheckHitInParaEnd=function(X,Y,CurPage){var oContentPos=this.Get_ParaContentPosByXY(X,Y,CurPage,false,true).InTextPos;return oContentPos.Get(0)=== this.Content.length-1};Paragraph.prototype.SaveNumberingValues=function(arrNumInfo,arrPrevNumInfo){this.SavedNumberingValues={NumInfo:arrNumInfo,PrevNumInfo:arrPrevNumInfo}};Paragraph.prototype.GetSavedNumberingValues=function(){return this.SavedNumberingValues};Paragraph.prototype.GetCalculatedTextPr=function(){var TextPr;if(true===this.ApplyToAll){var oState=this.SaveSelectionState();this.SelectAll(1);var StartPos=0;var Count=this.Content.length;while(true!==this.Content[StartPos].IsCursorPlaceable()&& StartPosEndPos){StartPos= this.Selection.EndPos;EndPos=this.Selection.StartPos}if(StartPos===EndPos&&this.Content.length-1===EndPos){TextPr=this.Get_CompiledPr2(false).TextPr.Copy();TextPr.Merge(this.TextPr.Value)}else{var bCheckParaEnd=false;if(this.Content.length-1===EndPos&&true!==this.Content[EndPos].IsSelectionEmpty(true)){EndPos--;bCheckParaEnd=true}var OldStartPos=StartPos;while(true===this.Content[StartPos].IsSelectionEmpty()&&StartPos OldStartPos)StartPos--;if(bCheckParaEnd&&StartPos===EndPos&&this.Content[StartPos].IsSelectionEmpty())TextPr=null;else TextPr=this.Content[StartPos].Get_CompiledTextPr(true);if(null===TextPr){TextPr=this.Get_CompiledPr2(false).TextPr.Copy();TextPr.Merge(this.TextPr.Value);TextPr.CheckFontScale()}for(var CurPos=StartPos+1;CurPos<=EndPos;CurPos++){var TempTextPr=this.Content[CurPos].Get_CompiledTextPr(false);if(null===TextPr||undefined===TextPr)TextPr=TempTextPr;else if(null!==TempTextPr&&undefined!== TempTextPr&&true!==this.Content[CurPos].IsSelectionEmpty())TextPr=TextPr.Compare(TempTextPr)}if(true===bCheckParaEnd){var EndTextPr=this.Get_CompiledPr2(false).TextPr.Copy();EndTextPr.Merge(this.TextPr.Value);EndTextPr.CheckFontScale();TextPr=TextPr.Compare(EndTextPr)}}}else{TextPr=this.Content[this.CurPos.ContentPos].Get_CompiledTextPr(true);var oRun=this.Get_ElementByPos(this.Get_ParaContentPos(false,false,false));if(para_Run===oRun.Type&&oRun.IsCurPosNearFootEndnoteReference())TextPr.VertAlign= AscCommon.vertalign_Baseline}if(null===TextPr||undefined===TextPr)TextPr=this.TextPr.Value.Copy();if(undefined!==TextPr.RFonts&&null!==TextPr.RFonts){TextPr.ReplaceThemeFonts(this.GetTheme().themeElements.fontScheme);if(!TextPr.FontFamily)TextPr.FontFamily={Name:"",Index:-1};TextPr.FontFamily.Name=TextPr.RFonts.Ascii.Name;TextPr.FontFamily.Index=TextPr.RFonts.Ascii.Index}return TextPr};Paragraph.prototype.GetCalculatedParaPr=function(){var ParaPr=this.Get_CompiledPr2(false).ParaPr;ParaPr.Locked=this.Lock.Is_Locked(); if(!ParaPr.PStyle&&this.bFromDocument&&this.LogicDocument&&this.LogicDocument.GetStyles)ParaPr.PStyle=this.LogicDocument.GetStyles().GetDefaultParagraph();if(undefined!==ParaPr.OutlineLvl&&undefined===this.Pr.OutlineLvl)ParaPr.OutlineLvlStyle=true;if(ParaPr.FramePr&&undefined!==ParaPr.FramePr.H&&undefined===ParaPr.FramePr.HRule)ParaPr.FramePr.HRule=Asc.linerule_AtLeast;return ParaPr};Paragraph.prototype.Is_Empty=function(Props){var Pr={SkipEnd:true};if(undefined!==Props){if(undefined!==Props.SkipNewLine)Pr.SkipNewLine= true;if(Props.SkipComplexFields)Pr.SkipComplexFields=true;if(undefined!==Props.SkipPlcHldr)Pr.SkipPlcHldr=Props.SkipPlcHldr}var ContentLen=this.Content.length;for(var CurPos=0;CurPos=this.Pages.length)return null;var SearchPosXY=this.Get_ParaContentPosByXY(X,Y,CurPage,false,true);if(true===SearchPosXY.InText)return this;return null};Paragraph.prototype.Is_UseInDocument= function(Id){if(Id!==undefined){for(var i=0;iEndPos){EndPos=this.Selection.StartPos;StartPos=this.Selection.EndPos}for(var CurPos=StartPos;CurPos<=EndPos;CurPos++)if(true!==this.Content[CurPos].IsSelectionEmpty(bCheckHidden))return false}return true};Paragraph.prototype.Get_StartTabsCount=function(TabsCounter){var ContentLen=this.Content.length;for(var Pos=0;Pos0&&ParaPr.Ind.FirstLine<0){X=ParaPr.Ind.Left;TabsCount--}var ParaTabsCount=ParaPr.Tabs.Get_Count();while(TabsCount){var TabFound=false;for(var TabIndex=0;TabIndexX){X=Tab.Pos;TabFound=true;break}}if(false===TabFound){var NewX=0;while(X>= NewX)NewX+=AscCommonWord.Default_Tab_Stop;X=NewX}TabsCount--}var oNumbering=this.Parent.GetNumbering();var oNum=oNumbering.GetNum(sNumId);this.private_AddPrChange();if(undefined===NumPr_old){if(true===SelectedOneElement||false===SelectionUse){var Prev=this.Get_DocumentPrev();var PrevNumbering=null!=Prev?type_Paragraph===Prev.GetType()?Prev.GetNumPr():undefined:undefined;if(undefined!=PrevNumbering&&sNumId===PrevNumbering.NumId&&nLvl===PrevNumbering.Lvl){var NewFirstLine=Prev.Pr.Ind.FirstLine;var NewLeft= Prev.Pr.Ind.Left;History.Add(new CChangesParagraphIndFirst(this,this.Pr.Ind.FirstLine,NewFirstLine));History.Add(new CChangesParagraphIndLeft(this,this.Pr.Ind.Left,NewLeft));this.Pr.Ind.FirstLine=NewFirstLine;this.Pr.Ind.Left=NewLeft}else{var oNumParaPr=oNum.GetLvl(nLvl).GetParaPr();if(undefined!=oNumParaPr.Ind&&undefined!=oNumParaPr.Ind.Left){oNum.ShiftLeftInd(X+12.5);History.Add(new CChangesParagraphIndFirst(this,this.Pr.Ind.FirstLine,undefined));History.Add(new CChangesParagraphIndLeft(this,this.Pr.Ind.Left, undefined));this.Pr.Ind.FirstLine=undefined;this.Pr.Ind.Left=undefined}}this.Pr.NumPr=new CNumPr;this.Pr.NumPr.Set(sNumId,nLvl);History.Add(new CChangesParagraphNumbering(this,NumPr_old,this.Pr.NumPr));this.private_RefreshNumbering(NumPr_old);this.private_RefreshNumbering(this.Pr.NumPr)}else{var LvlFound=-1;for(var LvlIndex=0;LvlIndex<9;++LvlIndex){var oNumLvl=oNum.GetLvl(LvlIndex);if(oNumLvl){var oNumParaPr=oNumLvl.GetParaPr();if(undefined!=oNumParaPr.Ind&&undefined!=oNumParaPr.Ind.Left&&X<=oNumParaPr.Ind.Left){LvlFound= LvlIndex;break}}}if(-1===LvlFound)LvlFound=8;if(this.Pr.Ind&&(undefined!==this.Pr.Ind||undefined!==this.Pr.Ind.Left)){History.Add(new CChangesParagraphIndFirst(this,this.Pr.Ind.FirstLine,undefined));History.Add(new CChangesParagraphIndLeft(this,this.Pr.Ind.Left,undefined));this.Pr.Ind.FirstLine=undefined;this.Pr.Ind.Left=undefined}this.Pr.NumPr=new CNumPr;this.Pr.NumPr.Set(sNumId,LvlFound);History.Add(new CChangesParagraphNumbering(this,NumPr_old,this.Pr.NumPr));this.private_RefreshNumbering(NumPr_old); this.private_RefreshNumbering(this.Pr.NumPr)}TabsCounter.Count=TabsCount;this.Remove_StartTabs(TabsCounter)}else{this.Pr.NumPr=new CNumPr;this.Pr.NumPr.Set(sNumId,nLvl);History.Add(new CChangesParagraphNumbering(this,NumPr_old,this.Pr.NumPr));this.private_RefreshNumbering(NumPr_old);this.private_RefreshNumbering(this.Pr.NumPr);var Left=NumPr_old.Lvl===nLvl?undefined:ParaPr.Ind.Left;var FirstLine=NumPr_old.Lvl===nLvl?undefined:ParaPr.Ind.FirstLine;History.Add(new CChangesParagraphIndFirst(this,this.Pr.Ind.FirstLine, FirstLine));History.Add(new CChangesParagraphIndLeft(this,this.Pr.Ind.Left,Left));this.Pr.Ind.FirstLine=FirstLine;this.Pr.Ind.Left=Left}if(undefined===this.Style_Get())if(this.bFromDocument)this.Style_Add(this.Parent.Get_Styles().Get_Default_ParaList());this.CompiledPr.NeedRecalc=true;this.private_UpdateTrackRevisionOnChangeParaPr(true);this.UpdateDocumentOutline()};Paragraph.prototype.SetNumPr=function(sNumId,nLvl){if(undefined===sNumId||null===sNumId){if(undefined!==this.Pr.NumPr){this.private_AddPrChange(); History.Add(new CChangesParagraphNumbering(this,this.Pr.NumPr,undefined));this.private_RefreshNumbering(this.Pr.NumPr);this.Pr.NumPr=undefined;this.CompiledPr.NeedRecalc=true;this.private_UpdateTrackRevisionOnChangeParaPr(true);this.UpdateDocumentOutline()}}else{if(nLvl<0||nLvl>8)nLvl=0;var oNumPrOld=this.Pr.NumPr;if(oNumPrOld&&oNumPrOld.NumId===sNumId&&oNumPrOld.Lvl===nLvl)return;this.private_AddPrChange();var oNewNumPr=new CNumPr(sNumId,nLvl);History.Add(new CChangesParagraphNumbering(this,this.Pr.NumPr, oNewNumPr));this.private_RefreshNumbering(oNewNumPr);this.private_RefreshNumbering(this.Pr.NumPr);this.Pr.NumPr=oNewNumPr;this.CompiledPr.NeedRecalc=true;this.private_UpdateTrackRevisionOnChangeParaPr(true);this.UpdateDocumentOutline()}};Paragraph.prototype.IndDecNumberingLevel=function(bIncrease){var NumPr=this.GetNumPr();if(undefined!=NumPr){this.private_AddPrChange();var oNumPrOld=this.Pr.NumPr;var NewLvl;if(true===bIncrease)NewLvl=Math.min(8,NumPr.Lvl+1);else NewLvl=Math.max(0,NumPr.Lvl-1);this.Pr.NumPr= new CNumPr;this.Pr.NumPr.Set(NumPr.NumId,NewLvl);History.Add(new CChangesParagraphNumbering(this,oNumPrOld,this.Pr.NumPr));this.private_RefreshNumbering(NumPr);this.private_RefreshNumbering(this.Pr.NumPr);this.CompiledPr.NeedRecalc=true;this.private_UpdateTrackRevisionOnChangeParaPr(true)}};Paragraph.prototype.GetNumPr=function(){var oNumPr=this.Get_CompiledPr2(false).ParaPr.NumPr;if(oNumPr&&oNumPr.IsValid())return oNumPr.Copy();return undefined};Paragraph.prototype.RemoveNumPr=function(){var OldNumPr= this.GetNumPr();var NewNumPr=undefined;if(undefined!=this.CompiledPr.Pr.ParaPr.StyleNumPr){NewNumPr=new CNumPr;NewNumPr.Set(0,0)}this.private_AddPrChange();var OldNumPr=undefined!=this.Pr.NumPr?this.Pr.NumPr:undefined;History.Add(new CChangesParagraphNumbering(this,OldNumPr,NewNumPr));this.private_RefreshNumbering(OldNumPr);this.private_RefreshNumbering(NewNumPr);this.Pr.NumPr=NewNumPr;if(undefined!=this.Pr.Ind&&undefined!=OldNumPr)if(undefined===this.Pr.Ind.FirstLine||Math.abs(this.Pr.Ind.FirstLine)< .001){if(undefined!=OldNumPr&&undefined!=OldNumPr.NumId&&this.Parent){var oNum=this.Parent.GetNumbering().GetNum(OldNumPr.NumId);if(oNum){var oLvl=oNum.GetLvl(OldNumPr.Lvl);var oLvlParaPr=oLvl?oLvl.GetParaPr():null;if(oLvlParaPr&&undefined!=oLvlParaPr.Ind&&undefined!=oLvlParaPr.Ind.Left){var CurParaPr=this.Get_CompiledPr2(false).ParaPr;var Left=CurParaPr.Ind.Left+CurParaPr.Ind.FirstLine;var NumLeftCorrection=undefined!=oLvlParaPr.Ind.FirstLine?Math.abs(oLvlParaPr.Ind.FirstLine):0;var NewFirstLine= 0;var NewLeft=Left<0?Left:Math.max(0,Left-NumLeftCorrection);History.Add(new CChangesParagraphIndLeft(this,this.Pr.Ind.Left,NewLeft));History.Add(new CChangesParagraphIndFirst(this,this.Pr.Ind.FirstLine,NewFirstLine));this.Pr.Ind.Left=NewLeft;this.Pr.Ind.FirstLine=NewFirstLine}}}}else if(this.Pr.Ind.FirstLine<0){History.Add(new CChangesParagraphIndFirst(this,this.Pr.Ind.FirstLine,0));this.Pr.Ind.FirstLine=0}else if(undefined!=this.Pr.Ind.Left&&this.Pr.Ind.FirstLine>0){History.Add(new CChangesParagraphIndLeft(this, this.Pr.Ind.Left,this.Pr.Ind.Left+this.Pr.Ind.FirstLine));History.Add(new CChangesParagraphIndFirst(this,this.Pr.Ind.FirstLine,0));this.Pr.Ind.Left+=this.Pr.Ind.FirstLine;this.Pr.Ind.FirstLine=0}var StyleId=this.Style_Get();var NumStyleId=this.LogicDocument?this.LogicDocument.Get_Styles().Get_Default_ParaList():null;if(StyleId===NumStyleId)this.Style_Remove();this.CompiledPr.NeedRecalc=true;this.private_UpdateTrackRevisionOnChangeParaPr(true);this.UpdateDocumentOutline()};Paragraph.prototype.HaveNumbering= function(){return!!this.GetNumPr()};Paragraph.prototype.GetNumberingCompiledPr=function(){var oNumPr=this.GetNumPr();if(!oNumPr||!this.LogicDocument)return null;var oNumbering=this.LogicDocument.GetNumbering();var oNumLvl=oNumbering.GetNum(oNumPr.NumId).GetLvl(oNumPr.Lvl);var oTextPr=this.Get_CompiledPr2(false).TextPr.Copy();oTextPr.Merge(this.TextPr.Value);oTextPr.Merge(oNumLvl.GetTextPr());return oTextPr};Paragraph.prototype.Add_PresentationNumbering=function(Bullet){var ParaPr=this.Get_CompiledPr2(false).ParaPr; var _OldBullet=this.Pr.Bullet;this.CompiledPr.NeedRecalc=true;var _Bullet;if(!ParaPr.Bullet)_Bullet=Bullet;else{_Bullet=ParaPr.Bullet.createDuplicate();_Bullet.merge(Bullet)}var oBullet2;if(_Bullet){oBullet2=_Bullet;this.Pr.Bullet=undefined;var oTheme=this.Get_Theme();var oColorMap=this.Get_ColorMap();var oUndefParaPr=this.Get_CompiledPr2(false).ParaPr;var NewType=oBullet2.getBulletType();var UndefType=oUndefParaPr.Bullet?oUndefParaPr.Bullet.getBulletType(oTheme,oColorMap):numbering_presentationnumfrmt_None; var LeftInd;if(NewType===UndefType){if(NewType===numbering_presentationnumfrmt_Char){var oUndefPresentationBullet=oUndefParaPr.Bullet.getPresentationBullet(oTheme,oColorMap);var oNewPresentationBullet=oBullet2.getPresentationBullet(oTheme,oColorMap);if(oUndefPresentationBullet.m_sChar===oNewPresentationBullet.m_sChar){this.Pr.Bullet=_OldBullet;this.Set_Bullet(undefined)}else{this.Pr.Bullet=_OldBullet;if(_OldBullet){if(_OldBullet.bulletSize&&!oBullet2.bulletSize)oBullet2.bulletSize=_OldBullet.bulletSize.createDuplicate(); if(_OldBullet.bulletColor&&!oBullet2.bulletColor)oBullet2.bulletColor=_OldBullet.bulletColor.createDuplicate()}this.Set_Bullet(oBullet2.createDuplicate())}}else{this.Pr.Bullet=_OldBullet;this.Set_Bullet(undefined)}this.Set_Ind({Left:undefined,FirstLine:undefined},true)}else{this.Pr.Bullet=_OldBullet;if(_OldBullet){if(_OldBullet.bulletSize&&!oBullet2.bulletSize)oBullet2.bulletSize=_OldBullet.bulletSize.createDuplicate();if(_OldBullet.bulletColor&&!oBullet2.bulletColor)oBullet2.bulletColor=_OldBullet.bulletColor.createDuplicate(); if(_OldBullet.bulletType&&AscFormat.isRealNumber(_OldBullet.bulletType.startAt)&&(oBullet2.bulletType&&!AscFormat.isRealNumber(oBullet2.bulletType.startAt)))oBullet2.bulletType.startAt=_OldBullet.bulletType.startAt}if(!oBullet2.isEqual(this.Pr.Bullet)){var bEqualBulletType=false;if(oBullet2.bulletType&&this.Pr.Bullet&&this.Pr.Bullet.bulletType)bEqualBulletType=this.Pr.Bullet.bulletType.IsIdentical(oBullet2.bulletType);this.Set_Bullet(oBullet2.createDuplicate());if(!bEqualBulletType){LeftInd=Math.min(ParaPr.Ind.Left, ParaPr.Ind.Left+ParaPr.Ind.FirstLine);var oFirstRunPr=this.Get_FirstTextPr2();var Indent=oFirstRunPr.FontSize*.305954545+2.378363636;if(NewType===numbering_presentationnumfrmt_Char)this.Set_Ind({Left:LeftInd+Indent,FirstLine:-Indent},false);else if(NewType===numbering_presentationnumfrmt_None)this.Set_Ind({FirstLine:0,Left:LeftInd},false);else if(!IsPrNumberingSameType(NewType,UndefType))if(!IsRomanPrNumbering(NewType))this.Set_Ind({Left:LeftInd+Indent,FirstLine:-Indent},false);else this.Set_Ind({Left:LeftInd+ Indent,FirstLine:-Indent},false);else this.Set_Ind({Left:undefined,FirstLine:undefined},true)}}}}};Paragraph.prototype.Get_PresentationNumbering=function(){this.Get_CompiledPr2(false);return this.PresentationPr.Bullet};Paragraph.prototype.Remove_PresentationNumbering=function(){var Bullet=new AscFormat.CBullet;Bullet.bulletType=new AscFormat.CBulletType;Bullet.bulletType.type=AscFormat.BULLET_TYPE_BULLET_NONE;this.Add_PresentationNumbering(Bullet)};Paragraph.prototype.Set_PresentationLevel=function(Level){if(this.Pr.Lvl!= Level){this.private_AddPrChange();History.Add(new CChangesParagraphPresentationPrLevel(this,this.Pr.Lvl,Level));this.Pr.Lvl=Level;this.CompiledPr.NeedRecalc=true;this.Recalc_RunsCompiledPr();this.private_UpdateTrackRevisionOnChangeParaPr(true)}};Paragraph.prototype.GetBulletNum=function(){var Level=this.PresentationPr.Level;var Bullet=this.PresentationPr.Bullet;var BulletNum=null;if(Bullet.IsNumbered()){var Prev=this.Prev;BulletNum=Bullet.Get_StartAt();while(null!=Prev&&type_Paragraph===Prev.GetType()){var PrevLevel= Prev.PresentationPr.Level;var PrevBullet=Prev.Get_PresentationNumbering();if(LevelPrevLevel)break;else if(PrevBullet.Get_Type()===Bullet.Get_Type()&&Bullet.Get_StartAt()===PrevBullet.Get_StartAt()){if(true!=Prev.IsEmpty())BulletNum++;Prev=Prev.Prev}else break}}return BulletNum};Paragraph.prototype.Get_CompiledPr=function(){var Pr=this.Get_CompiledPr2();var StyleId=this.Style_Get();var NumPr=this.GetNumPr();var FramePr=this.Get_FramePr();var PrevEl= this.GetPrevDocumentElement();var NextEl=this.GetNextDocumentElement();var oPrevParagraph=this.GetPrevParagraph();var oNextParagraph=this.GetNextParagraph();if(undefined!==FramePr){if(null===PrevEl||type_Paragraph!==PrevEl.GetType())PrevEl=null;else{var PrevFramePr=PrevEl.Get_FramePr();if(undefined===PrevFramePr||true!==FramePr.Compare(PrevFramePr))PrevEl=null}if(null===NextEl||type_Paragraph!==NextEl.GetType())NextEl=null;else{var NextFramePr=NextEl.Get_FramePr();if(undefined===NextFramePr||true!== FramePr.Compare(NextFramePr))NextEl=null}}else{while(PrevEl&&PrevEl.IsParagraph()&&undefined!==PrevEl.Get_FramePr())PrevEl=PrevEl.GetPrevDocumentElement();while(NextEl&&NextEl.IsParagraph()&&undefined!==NextEl.Get_FramePr())NextEl=NextEl.GetNextDocumentElement()}while(PrevEl&&PrevEl.IsBlockLevelSdt())PrevEl=PrevEl.GetLastElement();if(PrevEl&&PrevEl.IsParagraph()){var oPrevPr=PrevEl.Get_CompiledPr2(false).ParaPr;if(true===this.private_CompareBorderSettings(oPrevPr,Pr.ParaPr)&&undefined===PrevEl.Get_SectionPr()&& true!==Pr.ParaPr.PageBreakBefore){Pr.ParaPr.Brd.First=false;Pr.ParaPr.Brd.Between=oPrevPr.Brd.Between.Copy()}else Pr.ParaPr.Brd.First=true}if(oPrevParagraph&&StyleId===oPrevParagraph.Style_Get()&&Pr.ParaPr.ContextualSpacing)Pr.ParaPr.Spacing.Before=0;else if(null!=PrevEl&&type_Paragraph===PrevEl.GetType()){var PrevStyle=PrevEl.Style_Get();var Prev_Pr=PrevEl.Get_CompiledPr2(false).ParaPr;var Prev_After=Prev_Pr.Spacing.After;var Prev_AfterAuto=Prev_Pr.Spacing.AfterAutoSpacing;var Cur_Before=Pr.ParaPr.Spacing.Before; var Cur_BeforeAuto=Pr.ParaPr.Spacing.BeforeAutoSpacing;var Prev_NumPr=PrevEl.GetNumPr();if(true===Cur_BeforeAuto&&PrevStyle===StyleId&&undefined!=Prev_NumPr&&undefined!=NumPr&&Prev_NumPr.NumId===NumPr.NumId)Pr.ParaPr.Spacing.Before=0;else{Cur_Before=this.Internal_CalculateAutoSpacing(Cur_Before,Cur_BeforeAuto,this);Prev_After=this.Internal_CalculateAutoSpacing(Prev_After,Prev_AfterAuto,this);if(true===Prev_Pr.ContextualSpacing&&PrevStyle===StyleId||true===Prev_AfterAuto&&PrevStyle===StyleId&&undefined!= Prev_NumPr&&undefined!=NumPr&&Prev_NumPr.NumId===NumPr.NumId)Prev_After=0;Pr.ParaPr.Spacing.Before=Math.max(Prev_After,Cur_Before)-Prev_After}}else if(null===PrevEl)if(true===this.Parent.IsTableCellContent()&&true===Pr.ParaPr.ContextualSpacing){var Cell=this.Parent.IsTableCellContent(true);if(Cell){var PrevEl=Cell.GetLastElementInPrevCell();if(null!==PrevEl&&type_Paragraph===PrevEl.GetType()&&PrevEl.Style_Get()===StyleId||null===PrevEl&&undefined===StyleId)Pr.ParaPr.Spacing.Before=0}}else if(true=== this.Parent.IsBlockLevelSdtContent()&&true===Pr.ParaPr.ContextualSpacing){var oPrevPara=null;var oSdt=this.Parent.Parent;while(oSdt instanceof CBlockLevelSdt){var oTempPrev=oSdt.Get_DocumentPrev();if(oTempPrev){oPrevPara=oTempPrev.GetLastParagraph();break}if(oSdt.Parent instanceof CDocumentContent&&oSdt.Parent.Parent instanceof CBlockLevelSdt)oSdt=oSdt.Parent.Parent;else oSdt=null}if(null===oPrevPara&&undefined===StyleId||oPrevPara&&oPrevPara.Style_Get()===StyleId)Pr.ParaPr.Spacing.Before=0}else{if(true=== Pr.ParaPr.Spacing.BeforeAutoSpacing||!(this.bFromDocument===true))Pr.ParaPr.Spacing.Before=0}else if(type_Table===PrevEl.GetType())if(true===Pr.ParaPr.Spacing.BeforeAutoSpacing)Pr.ParaPr.Spacing.Before=14*g_dKoef_pt_to_mm;var oTempNextEl=NextEl;while(oTempNextEl&&oTempNextEl.IsBlockLevelSdt())oTempNextEl=oTempNextEl.GetElement(0);if(oTempNextEl&&oTempNextEl.IsParagraph()){var oNextPr=oTempNextEl.Get_CompiledPr2(false).ParaPr;if(true===this.private_CompareBorderSettings(oNextPr,Pr.ParaPr)&&undefined=== this.Get_SectionPr()&&(undefined===oTempNextEl.Get_SectionPr()||true!==oTempNextEl.IsEmpty())&&true!==oNextPr.PageBreakBefore)Pr.ParaPr.Brd.Last=false;else Pr.ParaPr.Brd.Last=true}if(oNextParagraph&&StyleId===oNextParagraph.Style_Get()&&Pr.ParaPr.ContextualSpacing)Pr.ParaPr.Spacing.After=0;else if(null!=NextEl)if(NextEl.IsParagraph()){var NextStyle=NextEl.Style_Get();var Cur_After=Pr.ParaPr.Spacing.After;var Cur_AfterAuto=Pr.ParaPr.Spacing.AfterAutoSpacing;var Next_NumPr=NextEl.GetNumPr();if(true=== Cur_AfterAuto&&NextStyle===StyleId&&undefined!=Next_NumPr&&undefined!=NumPr&&Next_NumPr.NumId===NumPr.NumId)Pr.ParaPr.Spacing.After=0;else Pr.ParaPr.Spacing.After=this.Internal_CalculateAutoSpacing(Cur_After,Cur_AfterAuto,this)}else{if(NextEl.IsTable()||NextEl.IsBlockLevelSdt()){var oNextElFirstParagraph=NextEl.GetFirstParagraph();if(oNextElFirstParagraph){var NextStyle=oNextElFirstParagraph.Style_Get();var Next_Before=oNextElFirstParagraph.Get_CompiledPr2(false).ParaPr.Spacing.Before;var Next_BeforeAuto= oNextElFirstParagraph.Get_CompiledPr2(false).ParaPr.Spacing.BeforeAutoSpacing;var Cur_After=Pr.ParaPr.Spacing.After;var Cur_AfterAuto=Pr.ParaPr.Spacing.AfterAutoSpacing;if(NextStyle===StyleId&&true===Pr.ParaPr.ContextualSpacing){Cur_After=this.Internal_CalculateAutoSpacing(Cur_After,Cur_AfterAuto,this);Next_Before=this.Internal_CalculateAutoSpacing(Next_Before,Next_BeforeAuto,this);Pr.ParaPr.Spacing.After=Math.max(Next_Before,Cur_After)-Cur_After}else Pr.ParaPr.Spacing.After=this.Internal_CalculateAutoSpacing(Pr.ParaPr.Spacing.After, Cur_AfterAuto,this)}}}else if(true===this.Parent.IsTableCellContent()&&true===Pr.ParaPr.ContextualSpacing){var Cell=this.Parent.IsTableCellContent(true);if(Cell){var NextEl=Cell.GetFirstElementInNextCell();if(null!==NextEl&&type_Paragraph===NextEl.GetType()&&NextEl.Style_Get()===StyleId||null===NextEl&&StyleId===undefined)Pr.ParaPr.Spacing.After=0}}else if(true===this.Parent.IsTableCellContent()&&true===Pr.ParaPr.Spacing.AfterAutoSpacing)Pr.ParaPr.Spacing.After=0;else if(this.Parent.IsBlockLevelSdtContent()&& true===Pr.ParaPr.ContextualSpacing){var oNextPara=null;var oSdt=this.Parent.Parent;while(oSdt instanceof CBlockLevelSdt){var oTempNext=oSdt.Get_DocumentNext();if(oTempNext){oNextPara=oTempNext.GetFirstParagraph();break}if(oSdt.Parent instanceof CDocumentContent&&oSdt.Parent.Parent instanceof CBlockLevelSdt)oSdt=oSdt.Parent.Parent;else oSdt=null}if(null===oNextPara&&undefined===StyleId||oNextPara&&oNextPara.Style_Get()===StyleId)Pr.ParaPr.Spacing.After=0}else if(!(this.bFromDocument===true))Pr.ParaPr.Spacing.After= 0;else Pr.ParaPr.Spacing.After=this.Internal_CalculateAutoSpacing(Pr.ParaPr.Spacing.After,Pr.ParaPr.Spacing.AfterAutoSpacing,this);return Pr};Paragraph.prototype.Recalc_CompiledPr=function(){this.CompiledPr.NeedRecalc=true};Paragraph.prototype.RecalcCompiledPr=function(isForce){this.CompiledPr.NeedRecalc=true;if(isForce&&this.bFromDocument)this.private_CompileParaPr(true)};Paragraph.prototype.Recalc_RunsCompiledPr=function(){var Count=this.Content.length;for(var Pos=0;Pos=0&&Lvl<=8)Pr.ParaPr.Merge(Numbering.GetParaPr(this.Pr.NumPr.NumId,this.Pr.NumPr.Lvl));else{Lvl=-1;Pr.ParaPr.NumPr= undefined}}else{if(0===this.Pr.NumPr.NumId){Lvl=-1;Pr.ParaPr.NumPr=undefined;Pr.ParaPr.Ind.Left=0;Pr.ParaPr.Ind.FirstLine=0}}else if(undefined!=Pr.ParaPr.NumPr)if(undefined!=Pr.ParaPr.NumPr.NumId&&0!=Pr.ParaPr.NumPr.NumId){var oNum=Numbering.GetNum(Pr.ParaPr.NumPr.NumId);var _StyleId=StyleId;Lvl=oNum.GetLvlByStyle(_StyleId);var PassedStyleId={};PassedStyleId[_StyleId]=true;while(-1===Lvl){var Style=Styles.Get(_StyleId);if(!Style)break;_StyleId=Style.Get_BasedOn();if(!_StyleId||true===PassedStyleId[_StyleId])break; PassedStyleId[_StyleId]=true;Lvl=oNum.GetLvlByStyle(_StyleId)}if(-1===Lvl)Pr.ParaPr.NumPr=undefined}Pr.ParaPr.StyleTabs=undefined!=Pr.ParaPr.Tabs?Pr.ParaPr.Tabs.Copy():new CParaTabs;Pr.ParaPr.Merge(this.Pr);if(-1!=Lvl&&undefined!=Pr.ParaPr.NumPr)Pr.ParaPr.NumPr.Lvl=Lvl;else Pr.ParaPr.NumPr=undefined;return Pr}else return this.Internal_CompiledParaPrPresentation()};Paragraph.prototype.Internal_CompiledParaPrPresentation=function(Lvl,bNoMergeDefault){var _Lvl=AscFormat.isRealNumber(Lvl)?Lvl:AscFormat.isRealNumber(this.Pr.Lvl)? this.Pr.Lvl:0;var styleObject=this.Parent.Get_Styles(_Lvl);if(!styleObject)return{ParaPr:g_oDocumentDefaultParaPr,TextPr:g_oDocumentDefaultTextPr};var Styles=styleObject.styles;var Pr=Styles.Get_Pr(styleObject.lastId,styletype_Paragraph,null);var TableStyle=this.Parent.Get_TableStyleForPara();if(TableStyle&&TableStyle.TextPr)Pr.TextPr.Merge(TableStyle.TextPr);Pr.ParaPr.StyleTabs=undefined!=Pr.ParaPr.Tabs?Pr.ParaPr.Tabs.Copy():new CParaTabs;if(Pr.ParaPr.LnSpcReduction!==undefined&&Pr.ParaPr.LnSpcReduction!== null){var Spacing=Pr.ParaPr.Spacing;if(Spacing.LineRule===Asc.linerule_Auto)Spacing.Line=Spacing.Line-Pr.ParaPr.LnSpcReduction}if(!(bNoMergeDefault===true)){Pr.ParaPr.Merge(this.Pr);if(this.Pr.DefaultRunPr)Pr.TextPr.Merge(this.Pr.DefaultRunPr)}Pr.TextPr.Color.Auto=false;return Pr};Paragraph.prototype.Recalc_CompileParaPr=function(){this.CompiledPr.NeedRecalc=true};Paragraph.prototype.Internal_CalculateAutoSpacing=function(Value,UseAuto,Para){var Result=Value;if(true===UseAuto)Result=14*g_dKoef_pt_to_mm; return Result};Paragraph.prototype.GetDirectTextPr=function(){var TextPr;if(true===this.ApplyToAll){var oState=this.SaveSelectionState();this.SelectAll(1);var Count=this.Content.length;var StartPos=0;while(true===this.Content[StartPos].IsSelectionEmpty()&&StartPosEndPos){StartPos=this.Selection.EndPos; EndPos=this.Selection.StartPos}while(true===this.Content[StartPos].IsSelectionEmpty()&&StartPos0)StartPos=EndPos;return true===this.IsCursorAtBegin(StartPos,bCheckAnchors)}return false};Paragraph.prototype.Clear_Formatting=function(){if(this.bFromDocument&&this.Parent){var oStyles=this.Parent.Get_Styles();var oHdrFtr= this.Parent.IsHdrFtr(true);var isFootnote=this.Parent.IsFootnote();if(null!==oHdrFtr){var sHdrFtrStyleId=null;if(AscCommon.hdrftr_Header===oHdrFtr.Type)sHdrFtrStyleId=oStyles.Get_Default_Header();else sHdrFtrStyleId=oStyles.Get_Default_Footer();if(null!==sHdrFtrStyleId)this.Style_Add(sHdrFtrStyleId,true);else this.Style_Remove()}else if(isFootnote){var sFootnoteStyleId=oStyles.GetDefaultFootnoteText();if(sFootnoteStyleId)this.Style_Add(sFootnoteStyleId,true);else this.Style_Remove()}else this.Style_Remove(); this.RemoveNumPr()}this.Set_ContextualSpacing(undefined);this.Set_Ind(new CParaInd,true);this.Set_Align(undefined,false);this.Set_KeepLines(undefined);this.Set_KeepNext(undefined);this.Set_PageBreakBefore(undefined);this.Set_Spacing(new CParaSpacing,true);this.Set_Shd(new CDocumentShd,true);this.Set_WidowControl(undefined);this.Set_Tabs(new CParaTabs);this.Set_Border(undefined,AscDFH.historyitem_Paragraph_Borders_Between);this.Set_Border(undefined,AscDFH.historyitem_Paragraph_Borders_Bottom);this.Set_Border(undefined, AscDFH.historyitem_Paragraph_Borders_Left);this.Set_Border(undefined,AscDFH.historyitem_Paragraph_Borders_Right);this.Set_Border(undefined,AscDFH.historyitem_Paragraph_Borders_Top);if(!(this.bFromDocument===true))this.Set_Bullet(undefined);this.CompiledPr.NeedRecalc=true};Paragraph.prototype.Clear_TextFormatting=function(){var sDefHyperlink=null;if(this.bFromDocument&&this.LogicDocument)sDefHyperlink=this.LogicDocument.GetStyles().GetDefaultHyperlink();for(var Index=0;Index1&&this.Pages[0].FirstLine===this.Pages[1].FirstLine||1===this.Pages.length&&-1===this.Pages[0].EndLine||null===this.Get_DocumentPrev())return true;return false};Paragraph.prototype.Get_DrawingObjectRun= function(Id){var Run=null;var ContentLen=this.Content.length;for(var Index=0;Index0){CurPos--;ContentPos=new CParagraphContentPos; ContentPos.Update(CurPos,0);this.Content[CurPos].Get_EndPos(false,ContentPos,1);this.Set_ParaContentPos(ContentPos,false,-1,-1)}else{CurPos++;ContentPos=new CParagraphContentPos;ContentPos.Update(CurPos,0);this.Content[CurPos].Get_StartPos(ContentPos,1);this.Set_ParaContentPos(ContentPos,false,-1,-1)}}return ContentPos};Paragraph.prototype.Check_NearestPos=function(NearPos){var ParaNearPos=new CParagraphNearPos;ParaNearPos.NearPos=NearPos;var Count=this.NearPosArray.length;for(var Index=0;IndexColumnAbs)_CurPage=CurPage-ColumnAbs;var ColumnStartX=0===CurPage?this.X_ColumnStart:this.Pages[_CurPage].X;var ColumnEndX=0===CurPage?this.X_ColumnEnd:this.Pages[_CurPage].XLimit; var Top_Margin=Y_Top_Margin;var Bottom_Margin=Y_Bottom_Margin;var Page_H=Page_Height;if(true===this.Parent.IsTableCellContent()&&undefined!=Drawing&&true==Drawing.Use_TextWrap()){Top_Margin=0;Bottom_Margin=0;Page_H=0}var PageLimitsOrigin=this.Parent.Get_PageLimits(PageRel);if(true===this.Parent.IsTableCellContent()&&false===Drawing.IsLayoutInCell()){PageLimitsOrigin=LogicDocument.Get_PageLimits(PageAbs);var PageFieldsOrigin=LogicDocument.Get_PageFields(PageAbs);ColumnStartX=PageFieldsOrigin.X;ColumnEndX= PageFieldsOrigin.XLimit}if(undefined!=Drawing&&true!=Drawing.Use_TextWrap()){PageFields=LD_PageFields;PageLimits=LD_PageLimits}var ParagraphTop=true!=Drawing.Use_TextWrap()?this.Lines[this.Pages[_CurPage].StartLine].Top+this.Pages[_CurPage].Y:this.Pages[_CurPage].Y;var Layout=new CParagraphLayout(DrawingLayout.X,DrawingLayout.Y,this.Get_AbsolutePage(CurPage),DrawingLayout.LastW,ColumnStartX,ColumnEndX,X_Left_Margin,X_Right_Margin,Page_Width,Top_Margin,Bottom_Margin,Page_H,PageFields.X,PageFields.Y, this.Pages[CurPage].Y+this.Lines[CurLine].Y-this.Lines[CurLine].Metrics.Ascent,ParagraphTop);return{ParagraphLayout:Layout,PageLimits:PageLimits,PageLimitsOrigin:PageLimitsOrigin}}}return null};Paragraph.prototype.Get_AnchorPos=function(Drawing){var ContentPos=this.Get_DrawingObjectContentPos(Drawing.Get_Id());if(null===ContentPos)return{X:0,Y:0,Height:0};var ParaPos=this.Get_ParaPosByContentPos(ContentPos);this.Set_ParaContentPos(ContentPos,false,-1,-1);var Result=this.Internal_Recalculate_CurPos(ContentPos, false,false,true);Result.Paragraph=this;Result.ContentPos=ContentPos;this.Internal_CorrectAnchorPos(Result,Drawing);return Result};Paragraph.prototype.IsContentOnFirstPage=function(){if(this.Pages[0].EndLine<0)return false;return true};Paragraph.prototype.Get_CurrentPage_Absolute=function(){this.Internal_Recalculate_CurPos(this.CurPos.ContentPos,true,false,false);return this.private_GetAbsolutePageIndex(this.CurPos.PagesPos)};Paragraph.prototype.Get_CurrentPage_Relative=function(){this.Internal_Recalculate_CurPos(this.CurPos.ContentPos, true,false,false);return this.private_GetRelativePageIndex(this.CurPos.PagesPos)};Paragraph.prototype.CollectDocumentStatistics=function(Stats){var ParaStats=new CParagraphStatistics(Stats);var Count=this.Content.length;for(var Index=0;Index=this.Pages[CurPage].Bounds.Top)){MMData.Type=Asc.c_oAscMouseMoveDataTypes.Hyperlink;MMData.Hyperlink=new Asc.CHyperlinkProperty(oHyperlink);MMData.Hyperlink.ToolTip= oHyperlink.GetToolTip()}else if(isInText&&null!==Footnote&&this.Parent.GetTopDocumentContent()instanceof CDocument){MMData.Type=Asc.c_oAscMouseMoveDataTypes.Footnote;MMData.Text=Footnote.GetHint();MMData.Number=Footnote.GetNumber()}else if(oReviewChange=this.private_GetReviewChangeForHover(X,Y,CurPage,oContentPos,isInText)){MMData.Type=Asc.c_oAscMouseMoveDataTypes.Review;MMData.ReviewChange=oReviewChange}else MMData.Type=Asc.c_oAscMouseMoveDataTypes.Common;if(isInText&&(isCheckBox||(null!=oHyperlink|| bPageRefLink)&&true===AscCommon.global_keyboardEvent.CtrlKey))this.DrawingDocument.SetCursorType("pointer",MMData);else this.DrawingDocument.SetCursorType("text",MMData);var Bounds=this.Pages[CurPage].Bounds;if(true===this.Lock.Is_Locked()&&XBounds.Left&&Y>Bounds.Top&&YEndPos){StartPos=this.Selection.EndPos;EndPos=this.Selection.StartPos}for(var CurPos= StartPos;CurPos<=EndPos;CurPos++){var Element=this.Content[CurPos];if(true!==Element.IsSelectionEmpty()&&Element.Document_UpdateInterfaceState)Element.Document_UpdateInterfaceState()}}else{var CurType=this.Content[this.CurPos.ContentPos].Type;if(this.Content[this.CurPos.ContentPos].Document_UpdateInterfaceState)this.Content[this.CurPos.ContentPos].Document_UpdateInterfaceState()}var arrComplexFields=this.GetCurrentComplexFields();for(var nIndex=0,nCount=arrComplexFields.length;nIndex0)for(var ChangeIndex=0,ChangesCount=Changes.length;ChangeIndex= 0&&StartPos.Compare(Change.get_EndPos())<=0){Change.put_InternalPos(_X,_Y,Page_abs);TrackManager.AddVisibleChange(Change)}}}}};Paragraph.prototype.private_GetReviewChangesByContentPos=function(oContentPos){var arrResultChanges=[];if(!this.LogicDocument||!oContentPos)return;var oTrackManager=this.LogicDocument.GetTrackRevisionsManager();var arrChanges=oTrackManager.GetElementChanges(this.GetId());if(arrChanges.length>0)for(var nChangeIndex=0,nChangesCount=arrChanges.length;nChangeIndex=0&&oContentPos.Compare(oChange.get_EndPos())<=0)arrResultChanges.push(oChange)}return arrResultChanges};Paragraph.prototype.private_GetReviewChangeForHover=function(X,Y,CurPage,oContentPos,isInText){if(this.Pages.length<=CurPage)return null;var oLogicDocument= this.LogicDocument;if(!oLogicDocument||!oLogicDocument.IsDocumentEditor()||oLogicDocument.IsSimpleMarkupInReview())return null;var oTrackManager=oLogicDocument.GetTrackRevisionsManager();var oCurChange=oTrackManager.GetCurrentChange();if(isInText&&oCurChange&&this===oTrackManager.GetCurrentChangeElement()&&oContentPos.Compare(oCurChange.get_StartPos())>=0&&oContentPos.Compare(oCurChange.get_EndPos())<=0)return oCurChange;var arrChanges=this.private_GetReviewChangesByContentPos(oContentPos);var oChange= null;for(var nIndex=0,nChangesCount=arrChanges.length;nIndexY_top-2&&Y=Count)return{X:X0,Y:Y0,W:X1-X0,H:Y1-Y0};for(var Index=0;IndexX1)X1=_X1}var _Y1=Y1;var BottomBorder=Paras[Count-1].Get_CompiledPr2(false).ParaPr.Brd.Bottom;if(undefined!==BottomBorder&&border_None!==BottomBorder.Value)_Y1+=BottomBorder.Size+BottomBorder.Space;if(_Y1>Y1&&(Asc.linerule_Auto=== FramePr.HRule||Asc.linerule_AtLeast===FramePr.HRule&&FrameH>=FramePr.H))Y1=_Y1;return{X:X0,Y:Y0,W:X1-X0,H:Y1-Y0}};Paragraph.prototype.SetCalculatedFrame=function(oFrame){this.CalculatedFrame=oFrame;oFrame.AddParagraph(this)};Paragraph.prototype.GetCalculatedFrame=function(){return this.CalculatedFrame};Paragraph.prototype.Internal_Get_FrameParagraphs=function(){if(this.CalculatedFrame&&this.CalculatedFrame.GetParagraphs().length>0)return this.CalculatedFrame.GetParagraphs();var FrameParas=[];var FramePr= this.Get_FramePr();if(undefined===FramePr)return FrameParas;FrameParas.push(this);var Prev=this.Get_DocumentPrev();while(null!=Prev)if(type_Paragraph===Prev.GetType()){var PrevFramePr=Prev.Get_FramePr();if(undefined!=PrevFramePr&&true===FramePr.Compare(PrevFramePr)){FrameParas.push(Prev);Prev=Prev.Get_DocumentPrev()}else break}else break;var Next=this.Get_DocumentNext();while(null!=Next)if(type_Paragraph===Next.GetType()){var NextFramePr=Next.Get_FramePr();if(undefined!=NextFramePr&&true===FramePr.Compare(NextFramePr)){FrameParas.push(Next); Next=Next.Get_DocumentNext()}else break}else break;return FrameParas};Paragraph.prototype.Is_LineDropCap=function(){var FrameParas=this.Internal_Get_FrameParagraphs();if(1!==FrameParas.length||1!==this.Lines.length)return false;return true};Paragraph.prototype.Get_LineDropCapWidth=function(){var W=this.Lines[0].Ranges[0].W;var ParaPr=this.Get_CompiledPr2(false).ParaPr;W+=ParaPr.Ind.Left+ParaPr.Ind.FirstLine;return W};Paragraph.prototype.Change_Frame=function(X,Y,W,H,PageIndex){if(!this.LogicDocument|| !this.CalculatedFrame||!this.CalculatedFrame.GetFramePr())return;var FramePr=this.CalculatedFrame.GetFramePr();if(Math.abs(Y-this.CalculatedFrame.T2)<.001&&Math.abs(X-this.CalculatedFrame.L2)<.001&&Math.abs(W-this.CalculatedFrame.W2)<.001&&Math.abs(H-this.CalculatedFrame.H2)<.001&&PageIndex===this.CalculatedFrame.PageIndex)return;var FrameParas=this.Internal_Get_FrameParagraphs();if(false===this.LogicDocument.Document_Is_SelectionLocked(AscCommon.changestype_None,{Type:AscCommon.changestype_2_ElementsArray_and_Type, Elements:FrameParas,CheckType:AscCommon.changestype_Paragraph_Content})){this.LogicDocument.StartAction(AscDFH.historydescription_Document_ParagraphChangeFrame);var NewFramePr=FramePr.Copy();if(Math.abs(X-this.CalculatedFrame.L2)>.001){NewFramePr.X=X+(this.CalculatedFrame.L-this.CalculatedFrame.L2);NewFramePr.XAlign=undefined;NewFramePr.HAnchor=Asc.c_oAscHAnchor.Page}if(Math.abs(Y-this.CalculatedFrame.T2)>.001){NewFramePr.Y=Y+(this.CalculatedFrame.T-this.CalculatedFrame.T2);NewFramePr.YAlign=undefined; NewFramePr.VAnchor=Asc.c_oAscVAnchor.Page}if(Math.abs(W-this.CalculatedFrame.W2)>.001)NewFramePr.W=W-Math.abs(this.CalculatedFrame.W2-this.CalculatedFrame.W);if(Math.abs(H-this.CalculatedFrame.H2)>.001)if(undefined!=FramePr.DropCap&&Asc.c_oAscDropCap.None!=FramePr.DropCap&&1===FrameParas.length){var PageH=this.LogicDocument.Get_PageLimits(PageIndex).YLimit;var _H=Math.min(H,PageH);NewFramePr.Lines=this.Update_DropCapByHeight(_H);NewFramePr.HRule=linerule_Exact;NewFramePr.H=H-Math.abs(this.CalculatedFrame.H2- this.CalculatedFrame.H)}else{if(H<=this.CalculatedFrame.H2)NewFramePr.HRule=linerule_Exact;else NewFramePr.HRule=Asc.linerule_AtLeast;NewFramePr.H=H}var Count=FrameParas.length;for(var Index=0;Index0))return}};Paragraph.prototype.Split_DropCap=function(NewParagraph){var DropCapText=new CParagraphGetDropCapText;if(true==this.Selection.Use&&this.Parent.IsSelectedSingleElement()){var SelSP=this.Get_ParaContentPos(true,true);var SelEP=this.Get_ParaContentPos(true,false);if(0<=SelSP.Compare(SelEP))SelEP=SelSP;DropCapText.Check=true;this.Get_TextForDropCap(DropCapText,true,SelEP, 0);DropCapText.Check=false;this.Get_TextForDropCap(DropCapText,true,SelEP,0)}else{DropCapText.Mixed=true;DropCapText.Check=false;this.Get_TextForDropCap(DropCapText,false)}var Count=DropCapText.Text.length;var PrevRun=null;var CurrRun=null;for(var Pos=0,ParaPos=0,RunPos=0;Pos0)return DropCapText.Runs[Count-1].Get_CompiledPr(true);return null};Paragraph.prototype.SelectFirstLetter=function(){var oStartPos=new CParagraphContentPos;var oEndPos=new CParagraphContentPos;for(var nPos=0,nCount=this.Content.length;nPos0;CurPage--)if(nDataPos>this.Lines[this.Pages[CurPage].StartLine].Get_StartPos())break;this.RecalcInfo.Set_Type_0(pararecalc_0_All);bNeedRecalc=true;break}case AscDFH.historyitem_Paragraph_Numbering:case AscDFH.historyitem_Paragraph_PStyle:case AscDFH.historyitem_Paragraph_Pr:case AscDFH.historyitem_Paragraph_PresentationPr_Bullet:case AscDFH.historyitem_Paragraph_PresentationPr_Level:{this.RecalcInfo.Set_Type_0(pararecalc_0_All); bNeedRecalc=true;this.CompiledPr.NeedRecalc=true;this.Recalc_RunsCompiledPr();break}case AscDFH.historyitem_Paragraph_Align:case AscDFH.historyitem_Paragraph_DefaultTabSize:case AscDFH.historyitem_Paragraph_Ind_First:case AscDFH.historyitem_Paragraph_Ind_Left:case AscDFH.historyitem_Paragraph_Ind_Right:case AscDFH.historyitem_Paragraph_ContextualSpacing:case AscDFH.historyitem_Paragraph_KeepLines:case AscDFH.historyitem_Paragraph_KeepNext:case AscDFH.historyitem_Paragraph_PageBreakBefore:case AscDFH.historyitem_Paragraph_Spacing_Line:case AscDFH.historyitem_Paragraph_Spacing_LineRule:case AscDFH.historyitem_Paragraph_Spacing_Before:case AscDFH.historyitem_Paragraph_Spacing_After:case AscDFH.historyitem_Paragraph_Spacing_AfterAutoSpacing:case AscDFH.historyitem_Paragraph_Spacing_BeforeAutoSpacing:case AscDFH.historyitem_Paragraph_WidowControl:case AscDFH.historyitem_Paragraph_Tabs:case AscDFH.historyitem_Paragraph_Borders_Between:case AscDFH.historyitem_Paragraph_Borders_Bottom:case AscDFH.historyitem_Paragraph_Borders_Left:case AscDFH.historyitem_Paragraph_Borders_Right:case AscDFH.historyitem_Paragraph_Borders_Top:case AscDFH.historyitem_Paragraph_FramePr:{bNeedRecalc= true;break}case AscDFH.historyitem_Paragraph_Shd_Value:case AscDFH.historyitem_Paragraph_Shd_Color:case AscDFH.historyitem_Paragraph_Shd_Unifill:case AscDFH.historyitem_Paragraph_Shd:{if(this.Parent){var oDrawingShape=this.Parent.Is_DrawingShape(true);if(oDrawingShape&&oDrawingShape.getObjectType&&oDrawingShape.getObjectType()===AscDFH.historyitem_type_Shape)if(oDrawingShape.chekBodyPrTransform(oDrawingShape.getBodyPr())||oDrawingShape.checkContentWordArt(oDrawingShape.getDocContent()))bNeedRecalc= true;if(this.Parent.IsTableHeader())bNeedRecalc=true}break}case AscDFH.historyitem_Paragraph_SectionPr:{if(this.Parent instanceof CDocument){this.Parent.UpdateContentIndexing();var nSectionIndex=this.Parent.GetSectionIndexByElementIndex(this.GetIndex());var oFirstElement=this.Parent.GetFirstElementInSection(nSectionIndex);if(oFirstElement)this.Parent.Refresh_RecalcData2(oFirstElement.GetIndex(),oFirstElement.private_GetRelativePageIndex(0))}break}case AscDFH.historyitem_Paragraph_PrChange:{if(Data instanceof CChangesParagraphPrChange&&Data.IsChangedNumbering())bNeedRecalc=true;break}case AscDFH.historyitem_Paragraph_SuppressLineNumbers:{History.AddLineNumbersToRecalculateData();break}}if(true===bNeedRecalc){var Prev=this.Get_DocumentPrev();if(0===CurPage&&null!=Prev&&type_Paragraph===Prev.GetType()&&true===Prev.Get_CompiledPr2(false).ParaPr.KeepNext)Prev.Refresh_RecalcData2(Prev.Pages.length-1);return this.Refresh_RecalcData2(CurPage)}};Paragraph.prototype.Refresh_RecalcData2=function(CurPage){if(!CurPage)CurPage= 0;if(this.Index>=0)this.Parent.Refresh_RecalcData2(this.Index,this.private_GetRelativePageIndex(CurPage))};Paragraph.prototype.Write_ToBinary2=function(Writer){Writer.WriteLong(AscDFH.historyitem_type_Paragraph);Writer.WriteString2(""+this.Id);var PrForWrite,TextPrForWrite,ContentForWrite;if(this.StartState){PrForWrite=this.StartState.Pr;TextPrForWrite=this.StartState.TextPr;ContentForWrite=this.StartState.Content;this.StartState=null}else{PrForWrite=this.Pr;TextPrForWrite=this.TextPr;ContentForWrite= this.Content}PrForWrite.Write_ToBinary(Writer);Writer.WriteString2(""+TextPrForWrite.Get_Id());var Count=ContentForWrite.length;Writer.WriteLong(Count);for(var Index=0;Index0){var Temp=StartContentPos;StartContentPos=EndContentPos;EndContentPos=Temp}if(true===bEnd){var CommentEnd=new AscCommon.ParaComment(false,Comment.Get_Id());var EndPos=EndContentPos.Get(0);if(para_Run===this.Content[EndPos].Type){var NewElement=this.Content[EndPos].Split(EndContentPos,1);if(null!==NewElement)this.Internal_Content_Add(EndPos+1,NewElement)}this.Internal_Content_Add(EndPos+1,CommentEnd);this.Selection.EndPos= EndPos+1}if(true===bStart){var CommentStart=new AscCommon.ParaComment(true,Comment.Get_Id());var StartPos=StartContentPos.Get(0);if(para_Run===this.Content[StartPos].Type){var NewElement=this.Content[StartPos].Split(StartContentPos,1);if(null!==NewElement){this.Internal_Content_Add(StartPos+1,NewElement);NewElement.SelectAll()}this.Internal_Content_Add(StartPos+1,CommentStart);this.Selection.StartPos=StartPos+1}else{this.Internal_Content_Add(StartPos,CommentStart);this.Selection.StartPos=StartPos}}}else{var ContentPos= this.Get_ParaContentPos(false,false);if(true===bEnd){var CommentEnd=new AscCommon.ParaComment(false,Comment.Get_Id());var EndPos=ContentPos.Get(0);if(para_Run===this.Content[EndPos].Type){var NewElement=this.Content[EndPos].Split(ContentPos,1);if(null!==NewElement)this.Internal_Content_Add(EndPos+1,NewElement)}this.Internal_Content_Add(EndPos+1,CommentEnd)}if(true===bStart){var CommentStart=new AscCommon.ParaComment(true,Comment.Get_Id());var StartPos=ContentPos.Get(0);if(para_Run===this.Content[StartPos].Type){var NewElement= this.Content[StartPos].Split(ContentPos,1);if(null!==NewElement)this.Internal_Content_Add(StartPos+1,NewElement);this.Internal_Content_Add(StartPos+1,CommentStart)}else this.Internal_Content_Add(StartPos,CommentStart)}}this.Correct_Content()};Paragraph.prototype.AddCommentToObject=function(Comment,ObjectId){};Paragraph.prototype.CanAddComment=function(){if(this.ApplyToAll){var oState=this.Get_SelectionState2();this.SetApplyToAll(false);this.SelectAll(1);var isCanAdd=this.CanAddComment();this.Set_SelectionState2(oState); this.SetApplyToAll(true);return isCanAdd}if(true===this.Selection.Use&&true!==this.IsSelectionEmpty()){var nStartPos=this.Selection.StartPos<=this.Selection.EndPos?this.Selection.StartPos:this.Selection.EndPos;var nEndPos=this.Selection.StartPos<=this.Selection.EndPos?this.Selection.EndPos:this.Selection.StartPos;for(var nPos=nStartPos;nPos<=nEndPos;++nPos)if(this.Content[nPos].CanAddComment&&!this.Content[nPos].CanAddComment())return false;return true}if(this.Content[this.CurPos.ContentPos].CanAddComment&& !this.Content[this.CurPos.ContentPos].CanAddComment())return false;var oNext=this.GetNextRunElement();var oPrev=this.GetPrevRunElement();return oNext&¶_Text===oNext.Type||oPrev&¶_Text===oPrev.Type};Paragraph.prototype.RemoveCommentMarks=function(Id){var Count=this.Content.length;for(var Pos=0;Pos=0){if(this.Content[nPos].IsCursorPlaceable()){this.Content[nPos].SetThisElementCurrent();this.Content[nPos].MoveCursorToEndPos();return}nPos--}}break}}this.MoveCursorToStartPos(); this.Document_SetThisElementCurrent(false)};Paragraph.prototype.GetCurrentComments=function(oComments){if(!oComments)oComments={};var oInfo=this.GetEndInfoByPage(-1);var arrCurComments=oInfo?oInfo.GetComments():[];if(this.IsSelectionUse()){var nStartPos=this.Selection.StartPos;var nEndPos=this.Selection.EndPos;if(nStartPos>nEndPos){var nTemp=nStartPos;nStartPos=nEndPos;nEndPos=nTemp}for(var nCommentIndex=0,nCommentsCount=arrCurComments.length;nCommentIndex0&¶_Run===this.Content[this.Content.length-1].Type){var LastRun=this.Content[this.Content.length-1];LastRun.RecalcInfo.Measure=true}}};Paragraph.prototype.GetLastRangeVisibleBounds=function(){var CurLine=this.Lines.length- 1;var CurPage=this.Pages.length-1;var Line=this.Lines[CurLine];var RangesCount=Line.Ranges.length;var RangeW=new CParagraphRangeVisibleWidth;var CurRange=0;for(;CurRange=nEndPos;--nIndex)if(this.Content[nIndex].FindNextFillingForm){var oRes=this.Content[nIndex].FindNextFillingForm(false,isCurrent&&nIndex===nCurPos?true:false,isStart);if(oRes)return oRes}return null};Paragraph.prototype.private_ResetSelection=function(){this.Selection.StartPos=0;this.Selection.EndPos=0;this.Selection.StartManually=false;this.Selection.EndManually=false;this.CurPos.ContentPos= 0};Paragraph.prototype.private_CorrectCurPosRangeLine=function(){if(-1!==this.CurPos.Line)return;var ParaCurPos=this.Get_ParaContentPos(false,false);var Ranges=this.Get_RangesByPos(ParaCurPos);this.CurPos.Line=-1;this.CurPos.Range=-1;for(var Index=0,Count=Ranges.length;Index0){this.CurPos.Line=LineIndex;this.CurPos.Range=RangeIndex;break}}}};Paragraph.prototype.Get_RangesByPos=function(ContentPos){var Run=this.Get_ElementByPos(ContentPos);if(null===Run||para_Run!==Run.Type)return[];return Run.Get_RangesByPos(ContentPos.Get(ContentPos.Depth-1))};Paragraph.prototype.Get_ElementByPos=function(ContentPos){if(ContentPos.Depth<1)return this;var CurPos=ContentPos.Get(0);return this.Content[CurPos].Get_ElementByPos(ContentPos,1)};Paragraph.prototype.GetElementByPos= function(oParaContentPos){return this.Get_ElementByPos(oParaContentPos)};Paragraph.prototype.private_RecalculateTextMetrics=function(TextMetrics){for(var Index=0,Count=this.Content.length;Index=this.Pages[CurPage].StartLine&&CurLine<=this.Pages[CurPage].EndLine)break; return Math.min(PagesCount-1,CurPage)};Paragraph.prototype.CompareDrawingsLogicPositions=function(CompareObject){var Run1=this.Get_DrawingObjectRun(CompareObject.Drawing1.Get_Id());var Run2=this.Get_DrawingObjectRun(CompareObject.Drawing2.Get_Id());if(Run1&&!Run2)CompareObject.Result=1;else if(Run2&&!Run1)CompareObject.Result=-1;else if(Run1&&Run2){var RunPos1=this.Get_PosByElement(Run1);var RunPos2=this.Get_PosByElement(Run2);var Result=RunPos2.Compare(RunPos1);if(0!==Result)CompareObject.Result= Result;else Run1.CompareDrawingsLogicPositions(CompareObject)}};Paragraph.prototype.StartSelectionFromCurPos=function(){var ContentPos=this.Get_ParaContentPos(false,false);this.Selection.Use=true;this.Selection.Start=false;this.Selection.StartManually=true;this.Selection.EndManually=true;this.Set_SelectionContentPos(ContentPos,ContentPos)};Paragraph.prototype.Get_PosByDrawing=function(Id){var ContentPos=new CParagraphContentPos;var ContentLen=this.Content.length;var bFind=false;for(var CurPos=0;CurPos< ContentLen;CurPos++){var Element=this.Content[CurPos];ContentPos.Update(CurPos,0);if(true===Element.Get_PosByDrawing(Id,ContentPos,1)){bFind=true;break}}if(false===bFind||ContentPos.Depth<=0)return null;return ContentPos};Paragraph.prototype.GetStyleFromFormatting=function(){var TextPr=null;var CurPos=0;if(true===this.Selection.Use){var StartPos=this.Selection.StartPos>this.Selection.EndPos?this.Selection.EndPos:this.Selection.StartPos;var EndPos=this.Selection.StartPos>this.Selection.EndPos?this.Selection.StartPos: this.Selection.EndPos;for(CurPos=StartPos;CurPosEndPos){StartPos=this.Selection.EndPos;EndPos=this.Selection.StartPos}if(true===bAll){StartPos=0;EndPos=this.Content.length-1}if(EndPos>=this.Content.length-1){EndPos=this.Content.length-2;if(true===bAll||undefined===Type||c_oAscRevisionsChangeType.TextPr===Type)this.Content[this.Content.length-1].AcceptPrChange()}if(this.IsSelectionToEnd())if(oTrackManager&&oTrackManager.GetProcessTrackMove()&&c_oAscRevisionsChangeType.MoveMark=== Type){var oParaEndRun=this.GetParaEndRun();oParaEndRun.RemoveTrackMoveMarks(oTrackManager)}else if(c_oAscRevisionsChangeType.MoveMarkRemove===Type){var oParaEndRun=this.GetParaEndRun();oParaEndRun.RemoveReviewMoveType()}for(var nCurPos=EndPos;nCurPos>=StartPos;--nCurPos){var oItem=this.Content[nCurPos];if(c_oAscRevisionsChangeType.MoveMark===Type&¶_RevisionMove===oItem.Type&&oProcessMove)if(oItem.GetMarkId()===oProcessMove.GetMoveId()){if(oItem.IsFrom()===oProcessMove.IsFrom())this.RemoveFromContent(nCurPos, 1)}else oProcessMove.RegisterOtherMove(oItem.GetMarkId());else if(oItem.AcceptRevisionChanges)oItem.AcceptRevisionChanges(Type,bAll)}if(c_oAscRevisionsChangeType.MoveMarkRemove!==Type){this.Correct_Content();this.Correct_ContentPos(false);this.private_UpdateTrackRevisions()}}};Paragraph.prototype.RejectRevisionChanges=function(Type,bAll){var oTrackManager=this.LogicDocument?this.LogicDocument.GetTrackRevisionsManager():null;var oProcessMove=oTrackManager?oTrackManager.GetProcessTrackMove():null;if(true=== this.Selection.Use||true===bAll){var StartPos=this.Selection.StartPos;var EndPos=this.Selection.EndPos;if(StartPos>EndPos){StartPos=this.Selection.EndPos;EndPos=this.Selection.StartPos}if(true===bAll){StartPos=0;EndPos=this.Content.length-1}if(EndPos>=this.Content.length-1){EndPos=this.Content.length-2;if(true===bAll||undefined===Type||c_oAscRevisionsChangeType.TextPr===Type)this.Content[this.Content.length-1].RejectPrChange()}if(oTrackManager&&oTrackManager.GetProcessTrackMove()&&c_oAscRevisionsChangeType.MoveMark=== Type&&this.IsSelectionToEnd()){var oParaEndRun=this.GetParaEndRun();oParaEndRun.RemoveTrackMoveMarks(oTrackManager)}for(var nCurPos=EndPos;nCurPos>=StartPos;--nCurPos){var oItem=this.Content[nCurPos];if(c_oAscRevisionsChangeType.MoveMark===Type&¶_RevisionMove===oItem.Type&&oProcessMove)if(oItem.GetMarkId()===oProcessMove.GetMoveId()){if(oItem.IsFrom()===oProcessMove.IsFrom())this.RemoveFromContent(nCurPos,1)}else oProcessMove.RegisterOtherMove(oItem.GetMarkId());else if(oItem.RejectRevisionChanges)oItem.RejectRevisionChanges(Type, bAll)}this.Correct_Content();this.Correct_ContentPos(false);this.private_UpdateTrackRevisions()}};Paragraph.prototype.GetRevisionsChangeElement=function(SearchEngine){if(true===SearchEngine.IsFound())return;var Direction=SearchEngine.GetDirection();if(Direction>0){var DrawingObjects=this.GetAllDrawingObjects();for(var DrawingIndex=0,Count=DrawingObjects.length;DrawingIndex=0;DrawingIndex--){DrawingObjects[DrawingIndex].GetRevisionsChangeElement(SearchEngine);if(true===SearchEngine.IsFound())return}}};Paragraph.prototype.IsSelectedAll=function(){var bStart=this.IsSelectionFromStart(); var bEnd=this.Selection_CheckParaEnd();return true===bStart&&true===bEnd||true===this.ApplyToAll?true:false};Paragraph.prototype.GetContentPosition=function(bSelection,bStart,PosArray){if(!PosArray)PosArray=[];var Index=PosArray.length;var ParaContentPos=this.Get_ParaContentPos(bSelection,bStart);var Depth=ParaContentPos.Get_Depth();while(Depth>0){var Pos=ParaContentPos.Get(Depth);ParaContentPos.Decrease_Depth(1);var Class=this.Get_ElementByPos(ParaContentPos);Depth--;PosArray.splice(Index,0,{Class:Class, Position:Pos})}PosArray.splice(Index,0,{Class:this,Position:ParaContentPos.Get(0)});return PosArray};Paragraph.prototype.SetContentSelection=function(StartDocPos,EndDocPos,Depth,StartFlag,EndFlag){if(0===StartFlag&&(!StartDocPos[Depth]||this!==StartDocPos[Depth].Class)||0===EndFlag&&(!EndDocPos[Depth]||this!==EndDocPos[Depth].Class))return;var StartPos=0,EndPos=0;switch(StartFlag){case 0:StartPos=StartDocPos[Depth].Position;break;case 1:StartPos=0;break;case -1:StartPos=this.Content.length-1;break}switch(EndFlag){case 0:EndPos= EndDocPos[Depth].Position;break;case 1:EndPos=0;break;case -1:EndPos=this.Content.length-1;break}var _StartDocPos=StartDocPos,_StartFlag=StartFlag;if(null!==StartDocPos&&true===StartDocPos[Depth].Deleted)if(StartPos0){StartPos--;_StartDocPos=null;_StartFlag=-1}else return;var _EndDocPos=EndDocPos,_EndFlag=EndFlag;if(null!==EndDocPos&&true===EndDocPos[Depth].Deleted)if(EndPos 0){EndPos--;_EndDocPos=null;_EndFlag=-1}else return;if(this.IsInFixedForm()){var nFormPos=-1;for(var nIndex=0,nCount=this.Content.length;nIndexnFormPos){_StartDocPos=null;_StartFlag=-1;StartPos=nFormPos}if(EndPos nFormPos){_EndDocPos=null;_EndFlag=-1;EndPos=nFormPos}}}this.Selection.Use=true;this.Selection.StartPos=StartPos;this.Selection.EndPos=EndPos;if(StartPos!==EndPos){if(this.Content[StartPos]&&this.Content[StartPos].SetContentSelection)this.Content[StartPos].SetContentSelection(_StartDocPos,null,Depth+1,_StartFlag,StartPos>EndPos?1:-1);if(this.Content[EndPos]&&this.Content[EndPos].SetContentSelection)this.Content[EndPos].SetContentSelection(null,_EndDocPos,Depth+1,StartPos>EndPos?-1:1,_EndFlag);var _StartPos= StartPos;var _EndPos=EndPos;var Direction=1;if(_StartPos>_EndPos){_StartPos=EndPos;_EndPos=StartPos;Direction=-1}for(var CurPos=_StartPos+1;CurPos<_EndPos;CurPos++)this.Content[CurPos].SelectAll(Direction)}else if(this.Content[StartPos]&&this.Content[StartPos].SetContentSelection)this.Content[StartPos].SetContentSelection(_StartDocPos,_EndDocPos,Depth+1,_StartFlag,_EndFlag)};Paragraph.prototype.SetContentPosition=function(DocPos,Depth,Flag){if(!DocPos)return;if(0===Flag&&(!DocPos[Depth]||this!==DocPos[Depth].Class))return; var Pos=0;switch(Flag){case 0:Pos=DocPos[Depth].Position;break;case 1:Pos=0;break;case -1:Pos=this.Content.length-1;break}var _DocPos=DocPos,_Flag=Flag;if(null!==DocPos&&true===DocPos[Depth].Deleted)if(Pos0){Pos--;_DocPos=null;_Flag=-1}else return;if(Pos===this.Content.length-1&&this.Content.length>1){Pos=this.Content.length-2;_Flag=-1;_DocPos=null}if(this.IsInFixedForm()){var nFormPos=-1;for(var nIndex=0,nCount=this.Content.length;nIndexnFormPos){_DocPos=null;_Flag=-1;Pos=nFormPos}}this.CurPos.ContentPos=Pos;if(this.Content[Pos]&&this.Content[Pos].SetContentPosition)this.Content[Pos].SetContentPosition(_DocPos,Depth+1,_Flag);else this.Correct_ContentPos2()};Paragraph.prototype.Get_XYByContentPos=function(ContentPos){var ParaContentPos=this.Get_ParaContentPos(false,false);this.Set_ParaContentPos(ContentPos, true,-1,-1);var Result=this.Internal_Recalculate_CurPos(-1,false,false,true);this.Set_ParaContentPos(ParaContentPos,true,this.CurPos.Line,this.CurPos.Range,false);return Result};Paragraph.prototype.GetContentLength=function(){return this.Content.length};Paragraph.prototype.Get_PagesCount=function(){return this.Pages.length};Paragraph.prototype.GetPagesCount=function(){return this.Pages.length};Paragraph.prototype.IsEmptyPage=function(CurPage,bSkipEmptyLinesWithBreak){if(!this.Pages[CurPage]||this.Pages[CurPage].EndLine< this.Pages[CurPage].StartLine)return true;if(true===bSkipEmptyLinesWithBreak&&this.Pages[CurPage].EndLine===this.Pages[CurPage].StartLine&&this.Lines[this.Pages[CurPage].EndLine]&&this.Lines[this.Pages[CurPage].EndLine].Info¶lineinfo_Empty&&this.Lines[this.Pages[CurPage].EndLine].Info¶lineinfo_BreakPage)return true;return false};Paragraph.prototype.Check_FirstPage=function(CurPage,bSkipEmptyLinesWithBreak){if(true===this.IsEmptyPage(CurPage,bSkipEmptyLinesWithBreak))return false;return this.Check_EmptyPages(CurPage- 1,bSkipEmptyLinesWithBreak)};Paragraph.prototype.Check_EmptyPages=function(CurPage,bSkipEmptyLinesWithBreak){for(var _CurPage=CurPage;_CurPage>=0;--_CurPage)if(true!==this.IsEmptyPage(_CurPage,bSkipEmptyLinesWithBreak))return false;return true};Paragraph.prototype.Get_CurrentColumn=function(CurPage){this.Internal_Recalculate_CurPos(this.CurPos.ContentPos,true,false,false);return this.Get_AbsoluteColumn(this.CurPos.PagesPos)};Paragraph.prototype.private_RefreshNumbering=function(NumPr){if(undefined=== NumPr||null===NumPr)return;History.Add_RecalcNumPr(NumPr)};Paragraph.prototype.Get_NumberingPage=function(){var ParaNum=this.Numbering;var NumberingRun=ParaNum.Run;if(null===NumberingRun)return-1;var NumLine=ParaNum.Line;for(var CurPage=0,PagesCount=this.Pages.length;CurPage=this.Pages[CurPage].StartLine&&NumLine<=this.Pages[CurPage].EndLine)return CurPage;return-1};Paragraph.prototype.Set_ParaPropsForVerticalTextInCell=function(isVerticalText){if(true===isVerticalText){var Left= undefined===this.Pr.Ind.Left||this.Pr.Ind.Left<.001?2:undefined;var Right=undefined===this.Pr.Ind.Right||this.Pr.Ind.Right<.001?2:undefined;this.Set_Ind({Left:Left,Right:Right},false)}else{var Left=undefined!==this.Pr.Ind.Left&&Math.abs(this.Pr.Ind.Left-2)<.01?undefined:this.Pr.Ind.Left;var Right=undefined!==this.Pr.Ind.Right&&Math.abs(this.Pr.Ind.Right-2)<.01?undefined:this.Pr.Ind.Right;var First=this.Pr.Ind.FirstLine;this.Set_Ind({Left:Left,Right:Right,FirstLine:First},true)}};Paragraph.prototype.private_CompareBorderSettings= function(Pr1,Pr2){var Left_1=Math.min(Pr1.Ind.Left,Pr1.Ind.Left+Pr1.Ind.FirstLine);var Right_1=Pr1.Ind.Right;var Left_2=Math.min(Pr2.Ind.Left,Pr2.Ind.Left+Pr2.Ind.FirstLine);var Right_2=Pr2.Ind.Right;if(Math.abs(Left_1-Left_2)>.001||Math.abs(Right_1-Right_2)>.001)return false;if(false===Pr1.Brd.Top.Compare(Pr2.Brd.Top)||false===Pr1.Brd.Bottom.Compare(Pr2.Brd.Bottom)||false===Pr1.Brd.Left.Compare(Pr2.Brd.Left)||false===Pr1.Brd.Right.Compare(Pr2.Brd.Right))return false;return true};Paragraph.prototype.GetFootnotesList= function(oEngine){oEngine.SetCurrentParagraph(this);for(var nIndex=0,nCount=this.Content.length;nIndex0)isStepOver=true;else if(-1===nRes)return true}else for(var nIndex=nPos;nIndex>=0;--nIndex){var nRes=this.Content[nIndex].GotoFootnoteRef?this.Content[nIndex].GotoFootnoteRef(false,true===isCurrent&&nPos===nIndex,isStepOver,isStepFootnote,isStepEndnote):0;if(nRes>0)isStepOver=true;else if(-1===nRes)return true}return false};Paragraph.prototype.GetText= function(oPr){var oText=new CParagraphGetText;oText.SetBreakOnNonText(false);oText.SetParaEndToSpace(oPr&&undefined!==oPr.ParaEndToSpace?oPr.ParaEndToSpace:true);for(var nIndex=0,nCount=this.Content.length;nIndex10)oNote=null;return oNote}return null};Paragraph.prototype.private_GetFootnoteRefsInLine=function(CurLine){var arrFootnotes=[];var oLine=this.Lines[CurLine];for(var CurRange=0,RangesCount=oLine.Ranges.length;CurRange=this.Lines.length)return new CParagraphContentPos; var oLine=this.Lines[CurLine];if(!oLine||oLine.Ranges.length<=0)return new CParagraphContentPos;return this.Get_EndRangePos2(CurLine,oLine.Ranges.length-1)};Paragraph.prototype.CheckCommentStartEnd=function(sCommentId){var oResult={Start:false,End:false};for(var nIndex=0,nCount=this.Content.length;nIndexnPos};Paragraph.prototype.IsInDrawing=function(X, Y,CurPage){return false};Paragraph.prototype.IsTableBorder=function(X,Y,CurPage){return null};Paragraph.prototype.GetNumberingInfo=function(oNumberingEngine){if(!oNumberingEngine||oNumberingEngine.IsStop())return;oNumberingEngine.CheckParagraph(this)};Paragraph.prototype.ClearParagraphFormatting=function(isClearParaPr,isClearTextPr){if(isClearParaPr&&(!this.IsSelectionUse()||this.IsSelectedAll()||!this.Parent.IsSelectedSingleElement()))this.Clear_Formatting();if(isClearTextPr){var oParaTextPr=new ParaTextPr; oParaTextPr.Value.Set_FromObject(new CTextPr,true);oParaTextPr.Value.Lang=undefined;oParaTextPr.Value.HighLight=undefined;this.Add(oParaTextPr)}};Paragraph.prototype.SetParagraphPr=function(oParaPr){this.SetDirectParaPr(oParaPr)};Paragraph.prototype.SetParagraphAlign=function(Align){this.Set_Align(Align)};Paragraph.prototype.GetParagraphAlign=function(){return this.Get_CompiledPr2(false).ParaPr.Jc};Paragraph.prototype.SetParagraphDefaultTabSize=function(TabSize){this.Set_DefaultTabSize(TabSize)}; Paragraph.prototype.SetParagraphSpacing=function(Spacing){this.Set_Spacing(Spacing,false)};Paragraph.prototype.SetParagraphTabs=function(Tabs){this.Set_Tabs(Tabs)};Paragraph.prototype.GetParagraphTabs=function(){return this.Get_CompiledPr2(false).ParaPr.Tabs};Paragraph.prototype.SetParagraphIndent=function(Ind){var NumPr=this.GetNumPr();if(undefined!==Ind.ChangeLevel&&0!==Ind.ChangeLevel&&undefined!==NumPr)if(Ind.ChangeLevel>0)this.ApplyNumPr(NumPr.NumId,Math.min(8,NumPr.Lvl+1));else this.ApplyNumPr(NumPr.NumId, Math.max(0,NumPr.Lvl-1));else this.Set_Ind(Ind,false)};Paragraph.prototype.SetParagraphShd=function(Shd){return this.Set_Shd(Shd,true)};Paragraph.prototype.SetParagraphStyle=function(Name){if(!this.LogicDocument)return;var StyleId=this.LogicDocument.Get_Styles().GetStyleIdByName(Name,true);this.Style_Add(StyleId)};Paragraph.prototype.GetParagraphStyle=function(){return this.Style_Get()};Paragraph.prototype.SetParagraphStyleById=function(sStyleId){this.Style_Add(sStyleId)};Paragraph.prototype.SetParagraphContextualSpacing= function(Value){this.Set_ContextualSpacing(Value)};Paragraph.prototype.SetParagraphPageBreakBefore=function(Value){this.Set_PageBreakBefore(Value)};Paragraph.prototype.SetParagraphKeepLines=function(Value){this.Set_KeepLines(Value)};Paragraph.prototype.SetParagraphKeepNext=function(Value){this.Set_KeepNext(Value)};Paragraph.prototype.SetParagraphWidowControl=function(Value){this.Set_WidowControl(Value)};Paragraph.prototype.SetParagraphBorders=function(Borders){this.Set_Borders(Borders)};Paragraph.prototype.IncreaseDecreaseFontSize= function(bIncrease){this.IncDec_FontSize(bIncrease)};Paragraph.prototype.GetCurrentParagraph=function(bIgnoreSelection,arrSelectedParagraphs,oPr){if(arrSelectedParagraphs)arrSelectedParagraphs.push(this);return this};Paragraph.prototype.Get_FirstParagraph=function(){return this};Paragraph.prototype.GetAllContentControls=function(arrContentControls){if(!arrContentControls)arrContentControls=[];for(var nIndex=0,nCount=this.Content.length;nIndexEndPos){StartPos=this.Selection.EndPos;EndPos=this.Selection.StartPos}for(var Index=StartPos;Index<=EndPos;++Index)if(this.Content[Index].GetSelectedContentControls)this.Content[Index].GetSelectedContentControls(arrContentControls)}else if(this.Content[this.CurPos.ContentPos]&& this.Content[this.CurPos.ContentPos].GetSelectedContentControls)this.Content[this.CurPos.ContentPos].GetSelectedContentControls(arrContentControls);return arrContentControls};Paragraph.prototype.AddContentControl=function(nContentControlType){if(c_oAscSdtLevelType.Inline!==nContentControlType)return null;if(true===this.IsSelectionUse())if(this.Selection.StartPos===this.Selection.EndPos&¶_Run!==this.Content[this.Selection.StartPos].Type){if(this.Content[this.Selection.StartPos].AddContentControl)return this.Content[this.Selection.StartPos].AddContentControl(); return null}else{var nStartPos=this.Selection.StartPos;var nEndPos=this.Selection.EndPos;if(nEndPos=nStartPos+1;--nIndex){oContentControl.Add_ToContent(0,this.Content[nIndex]);this.Remove_FromContent(nIndex,1)}if(oContentControl.IsEmpty())oContentControl.ReplaceContentWithPlaceHolder();this.Add_ToContent(nStartPos+1,oContentControl);this.Selection.StartPos=nStartPos+1;this.Selection.EndPos=nStartPos+1}oContentControl.MoveCursorToStartPos();oContentControl.SelectAll(1);return oContentControl}else{var oContentControl= new CInlineLevelSdt;oContentControl.SetDefaultTextPr(this.GetDirectTextPr());oContentControl.SetPlaceholder(c_oAscDefaultPlaceholderName.Text);oContentControl.ReplaceContentWithPlaceHolder(false);this.Add(oContentControl);var oContentControlPos=this.Get_PosByElement(oContentControl);if(oContentControlPos){oContentControl.Get_StartPos(oContentControlPos,oContentControlPos.Get_Depth()+1);this.Set_ParaContentPos(oContentControlPos,false,-1,-1)}oContentControl.SelectContentControl();return oContentControl}}; Paragraph.prototype.GetCurrentComplexFields=function(bReturnFieldPos){var arrComplexFields=[];var oInfo=this.GetEndInfoByPage(-1);if(oInfo)for(var nIndex=0,nCount=oInfo.ComplexFields.length;nIndex=oPr.OutlineStart-1&&nOutlineLvl<=oPr.OutlineEnd-1))arrOutline.push({Paragraph:this,Lvl:nOutlineLvl});else if(oPr&&oPr.Styles&&oPr.Styles.length>0){if(!this.LogicDocument)return;var oStyles=this.LogicDocument.GetStyles();var sStyleId=this.Style_Get();if(!sStyleId)sStyleId=oStyles.GetDefaultParagraph();var oStyle=oStyles.Get(sStyleId);if(!oStyle)return;var sStyleName=oStyle.GetName(); for(var nIndex=0,nCount=oPr.Styles.length;nIndex0){aEndBookmarks=this.private_FindBookmarks(this.Content.length-2,0);var aPair=this.private_FindPairBookmarks(aStartBookmarks,aEndBookmarks,"_Ref");if(aPair)return aPair[0].GetBookmarkName()}var oBookmarksManager=this.LogicDocument.GetBookmarksManager();var sId=oBookmarksManager.GetNewBookmarkId();var sBookmarkName=oBookmarksManager.GetNewBookmarkNameRef();this.Add_ToContent(0,new CParagraphBookmark(true, sId,sBookmarkName));this.Add_ToContent(this.Content.length-1,new CParagraphBookmark(false,sId,sBookmarkName));this.Correct_Content();return sBookmarkName};Paragraph.prototype.AddBookmarkForNoteRef=function(){if(!this.LogicDocument)return null;if(!this.Parent)return null;var oFootnote=this.Parent.IsFootnote(true);if(!oFootnote)return null;var oRef=oFootnote.Ref;if(!oRef)return null;var oRun=oRef.Run;if(!oRun)return null;var oRefParagraph=oRun.Paragraph;if(!oRefParagraph)return null;var nRefPos=-1, nPos;for(nPos=0;nPos1){nRunPos=oParaPos.Get(oParaPos.Get_Depth()-1);if(nRefPos0)oRun=oRun.Split2(nRefPos-1,oRefParagraph,nRunPos);oParaPos=oRun.GetParagraphContentPosFromObject(0)}nRunPos=oParaPos.Get(oParaPos.Get_Depth()- 1);var aStartBookmarks=oRefParagraph.private_FindBookmarks(nRunPos-1,0),aEndBookmarks;var sBookmarkName;if(aStartBookmarks.length>0){aEndBookmarks=oRefParagraph.private_FindBookmarks(nRunPos+1,oRefParagraph.Content.length-1);var aPair=oRefParagraph.private_FindPairBookmarks(aStartBookmarks,aEndBookmarks,"_Ref");if(aPair)return aPair[0].GetBookmarkName()}var oBookmarksManager=this.LogicDocument.GetBookmarksManager();var sId=oBookmarksManager.GetNewBookmarkId();sBookmarkName=oBookmarksManager.GetNewBookmarkNameRef(); oRefParagraph.Add_ToContent(nRunPos,new CParagraphBookmark(true,sId,sBookmarkName));oRefParagraph.Add_ToContent(nRunPos+2,new CParagraphBookmark(false,sId,sBookmarkName));oRefParagraph.Correct_Content();return sBookmarkName};Paragraph.prototype.private_FindBookmarks=function(nStart,nEnd){var nPos;var aBookmarks=[],oElement;if(nStart<0||nEnd<0)return aBookmarks;if(nStart>=this.Content.length||nEnd>=this.Content.length)return aBookmarks;if(nStart=nEnd;--nPos){oElement=this.Content[nPos];if(oElement.GetType()===para_Bookmark)aBookmarks.push(oElement);if(oElement.IsEmpty())continue;else break}return aBookmarks};Paragraph.prototype.private_FindPairBookmarks=function(aStartBookmarks,aEndBookmarks,sPrefix){if(aStartBookmarks.length>0&&aEndBookmarks.length>0)for(var nStart=0;nStart-1;--nPos){oElement=this.Content[nPos];if(oElement.Type=== para_Run){oFieldPos=oElement.GetLastSEQPos(sCaption);if(oFieldPos)return oFieldPos}else if(oElement.Type===para_Field){var oContentPos=this.GetPosByElement(oElement);if(oContentPos){oContentPos.Add(oElement.Content.length);return oContentPos}}}return null};Paragraph.prototype.CanAddRefAfterSEQ=function(sCaption){if(!this.LogicDocument)return false;var oSEQPos=this.private_GetLastSEQPos(sCaption);if(!oSEQPos)return false;var nRunPos=oSEQPos.Get(oSEQPos.Get_Depth()-1);var arrClasses=this.Get_ClassesByPos(oSEQPos); var oParaElement,oParent;if(1===arrClasses.length&&(arrClasses[arrClasses.length-1].Type===para_Run||arrClasses[arrClasses.length-1].Type===para_Field)){oParaElement=arrClasses[arrClasses.length-1];oParent=this}else if(arrClasses.length>=2&&(arrClasses[arrClasses.length-1].Type===para_Run||arrClasses[arrClasses.length-1].Type===para_Field)){oParaElement=arrClasses[arrClasses.length-1];oParent=arrClasses[arrClasses.length-2]}else return false;var nPos,oElement;for(nPos=oParent.Content.length-2;nPos> nRunPos;nPos--){oElement=oParent.Content[nPos];if(oElement.GetType()===para_Run){var oPr={SkipNewLine:true,SkipSpace:true,SkipTab:true};if(!oElement.Is_Empty(oPr))return true}else if((oElement.GetType()===para_Math_Run||oElement.GetType()===para_InlineLevelSdt||oElement.GetType()===para_Math)&&!oElement.IsEmpty())return true}if(oParaElement.Type===para_Run){var nPosInRun=oSEQPos.Get(oSEQPos.Get_Depth());if(nPosInRun -1)return true}}return false};Paragraph.prototype.AddBookmarkForCaption=function(sCaption,isOnlyText,isTOC){if(!this.LogicDocument)return null;if(isOnlyText&&!this.CanAddRefAfterSEQ(sCaption))return null;var oParaPos=this.private_GetLastSEQPos(sCaption);if(!oParaPos)return null;var arrClasses=this.Get_ClassesByPos(oParaPos);var oParent,nRunPos,nPosInRun,oElement;var sBookmarkName=null,sId;if(1===arrClasses.length&&(arrClasses[arrClasses.length-1].Type===para_Run||arrClasses[arrClasses.length-1].Type=== para_Field)){oElement=arrClasses[arrClasses.length-1];oParent=this}else if(arrClasses.length>=2&&(arrClasses[arrClasses.length-1].Type===para_Run||arrClasses[arrClasses.length-1].Type===para_Field)){oElement=arrClasses[arrClasses.length-1];oParent=arrClasses[arrClasses.length-2]}else return null;var oBookmarksManager=this.LogicDocument.GetBookmarksManager();nRunPos=oParaPos.Get(oParaPos.Get_Depth()-1);nPosInRun=oParaPos.Get(oParaPos.Get_Depth());var aStartBookmarks=[],aEndBookmarks=[];var nPos,aPair, nFindPos;if(isOnlyText){var bCurrentRun=false;var nBookmarkPos=nRunPos+1;if(oElement.Type===para_Run){nFindPos=oElement.FindNoSpaceElement(nPosInRun);if(nFindPos>-1){nPosInRun=nFindPos;oElement.Split2(nPosInRun,oParent,nRunPos);bCurrentRun=true}}if(!bCurrentRun)for(nPos=nRunPos+1;nPos-1){if(nFindPos>0){oElement.Split2(nFindPos,oParent, nPos);nBookmarkPos=nPos+1}break}}else if(!oElement.IsEmpty())break}aStartBookmarks=oParent.private_FindBookmarks(nBookmarkPos-1,0);if(aStartBookmarks.length>0){aEndBookmarks=oParent.private_FindBookmarks(oParent.Content.length-2,nBookmarkPos+1);aPair=oParent.private_FindPairBookmarks(aStartBookmarks,aEndBookmarks,isTOC?"_Toc":"_Ref");if(aPair)return aPair[0].GetBookmarkName()}sId=oBookmarksManager.GetNewBookmarkId();if(isTOC)sBookmarkName=oBookmarksManager.GetNewBookmarkNameTOC();else sBookmarkName= oBookmarksManager.GetNewBookmarkNameRef();oParent.Add_ToContent(oParent.Content.length-1,new CParagraphBookmark(false,sId,sBookmarkName));oParent.Add_ToContent(nBookmarkPos,new CParagraphBookmark(true,sId,sBookmarkName));oParent.Correct_Content()}else{if(oElement.Type===para_Run)if(nPosInRun0){aEndBookmarks=oParent.private_FindBookmarks(nRunPos+1, oParent.Content.length-1);aPair=oParent.private_FindPairBookmarks(aStartBookmarks,aEndBookmarks,"_Ref");if(aPair)return aPair[0].GetBookmarkName()}sId=oBookmarksManager.GetNewBookmarkId();sBookmarkName=oBookmarksManager.GetNewBookmarkNameRef();nRunPos=oParaPos.Get(oParaPos.Get_Depth()-1);oParent.Add_ToContent(nRunPos+1,new CParagraphBookmark(false,sId,sBookmarkName));oParent.Add_ToContent(0,new CParagraphBookmark(true,sId,sBookmarkName));oParent.Correct_Content()}return sBookmarkName};Paragraph.prototype.AddBookmarkChar= function(oBookmarkChar,isUseSelection,isStartSelection){var oParaPos=this.Get_ParaContentPos(isUseSelection,isStartSelection,false);var arrClasses=this.Get_ClassesByPos(oParaPos);var oRun,oParent;if(1===arrClasses.length&&arrClasses[arrClasses.length-1].Type===para_Run){oRun=arrClasses[arrClasses.length-1];oParent=this}else if(arrClasses.length>=2&&arrClasses[arrClasses.length-1].Type===para_Run){oRun=arrClasses[arrClasses.length-1];oParent=arrClasses[arrClasses.length-2]}else return false;var oRunPos= oParaPos.Get(oParaPos.Get_Depth()-1);oRun.Split2(oParaPos.Get(oParaPos.Get_Depth()),oParent,oRunPos);oParent.Add_ToContent(oRunPos+1,oBookmarkChar);return true};Paragraph.prototype.AddBookmarkAtBegin=function(sBookmarkName){if(!this.LogicDocument)return;var oBookmarksManager=this.LogicDocument.GetBookmarksManager();var sId=oBookmarksManager.GetNewBookmarkId();this.Add_ToContent(0,new CParagraphBookmark(true,sId,sBookmarkName));this.Add_ToContent(1,new CParagraphBookmark(false,sId,sBookmarkName)); this.Correct_Content()};Paragraph.prototype.CheckPageRefLink=function(X,Y,CurPage){var arrComplexFields=this.GetComplexFieldsByXY(X,Y,CurPage);for(var nIndex=0,nCount=arrComplexFields.length;nIndex=nPagesCount-1)break;nCurPage++}return this.Get_AbsolutePage(nCurPage)};Paragraph.prototype.RemoveTabsForTOC=function(){var isTab=false;for(var nIndex=0,nCount=this.Content.length;nIndex=this.Content.length)return null;return this.Content[nIndex]};Paragraph.prototype.GetElementsCount=function(){return this.Content.length-1};Paragraph.prototype.IsParagraphSimpleChanges=function(arrChanges){var _arrChanges=arrChanges;if(!arrChanges.length)_arrChanges=[arrChanges];for(var nChangesIndex=0,nChangesCount=_arrChanges.length;nChangesIndex=AscCommon.document_compatibility_mode_Word15&&this.Get_CompiledPr2(false).ParaPr.Jc===align_Justify)return true;return false};Paragraph.prototype.SelectCurrentWord=function(){if(this.Selection.Use)return false;var oLItem=this.GetPrevRunElement(); var oRItem=this.GetNextRunElement();if(!oLItem&&!oRItem)return false;var oStartPos=null;var oEndPos=null;var oCurPos=this.Get_ParaContentPos(false,false);var oSearchSPos=new CParagraphSearchPos;var oSearchEPos=new CParagraphSearchPos;if(oRItem&&oLItem&¶_Text===oRItem.Type&¶_Text===oLItem.Type)if(oRItem.IsPunctuation()&&!oLItem.IsPunctuation())oRItem=null;else if(!oRItem.IsPunctuation()&&oLItem.IsPunctuation())oLItem=null;if(!oRItem||para_Text!==oRItem.Type)oEndPos=oCurPos;else{oSearchEPos.SetTrimSpaces(true); this.Get_WordEndPos(oSearchEPos,oCurPos);if(true!==oSearchEPos.Found)return false;oEndPos=oSearchEPos.Pos}if(!oLItem||para_Text!==oLItem.Type)oStartPos=oCurPos;else{this.Get_WordStartPos(oSearchSPos,oCurPos);if(true!==oSearchSPos.Found)return false;oStartPos=oSearchSPos.Pos}if(!oStartPos||!oEndPos||0===oStartPos.Compare(oEndPos))return false;this.Selection.Use=true;this.Set_SelectionContentPos(oStartPos,oEndPos);this.Document_SetThisElementCurrent();return true};Paragraph.prototype.AddTrackMoveMark= function(isFrom,isStart,sMarkId){if(!this.Selection.Use)return;var oStartContentPos=this.Get_ParaContentPos(true,true);var oEndContentPos=this.Get_ParaContentPos(true,false);if(oStartContentPos.Compare(oEndContentPos)>0){var oTemp=oStartContentPos;oStartContentPos=oEndContentPos;oEndContentPos=oTemp}var nStartPos=oStartContentPos.Get(0);var nEndPos=oEndContentPos.Get(0);if(this.Content.length-1===nEndPos&&!isStart)if(true===this.Selection_CheckParaEnd()){var oEndRun=this.GetParaEndRun();oEndRun.AddAfterParaEnd(new CRunRevisionMove(false, isFrom,sMarkId));return}else{oEndContentPos=this.Get_EndPos(false);nEndPos=oEndContentPos.Get(0)}if(!isStart){var oNewElementE=this.Content[nEndPos].Split(oEndContentPos,1);if(oNewElementE){this.AddToContent(nEndPos+1,oNewElementE);oNewElementE.RemoveSelection()}this.AddToContent(nEndPos+1,new CParaRevisionMove(false,isFrom,sMarkId))}if(isStart){var nSelectionStartPos=this.Selection.StartPos;var nSelectionEndPos=this.Selection.EndPos;var oNewElementS=this.Content[nStartPos].Split(oStartContentPos, 1);if(oNewElementS){this.AddToContent(nStartPos+1,oNewElementS);oNewElementS.SelectAll();this.Content[nStartPos].RemoveSelection();nSelectionStartPos++;nSelectionEndPos++;nStartPos++}this.AddToContent(nStartPos,new CParaRevisionMove(true,isFrom,sMarkId));this.Selection.StartPos=nSelectionStartPos+1;this.Selection.EndPos=nSelectionEndPos+1}};Paragraph.prototype.RemoveElement=function(oElement){for(var nPos=0,nCount=this.Content.length;nPosnEndPos)break;if(para_RevisionMove===this.Content[nPos].GetType())if(private_CheckMarkDirection(this.Content[nPos])&&this.Content[nPos].IsStart())return this.Content[nPos].GetMarkId();else return null}if(this.Content[nStartPos].IsSelectedFromStart()){nPos=nStartPos-1;while(nPos>=0&¶_RevisionMove!==this.Content[nPos].GetType()&&this.Content[nPos].IsEmpty())nPos--;if(nPos<0){var oPrevElement=this.Get_DocumentPrev();if(oPrevElement&&oPrevElement.IsParagraph()){var oLastRun=oPrevElement.GetParaEndRun(); var oMark=oLastRun.GetLastTrackMoveMark();if(oMark&&private_CheckMarkDirection(oMark)&&oMark.IsStart())return oMark.GetMarkId()}}else if(para_RevisionMove===this.Content[nPos].GetType()&&private_CheckMarkDirection(this.Content[nPos])&&this.Content[nPos].IsStart())return this.Content[nPos].GetMarkId()}}else{if(para_RevisionMove===this.Content[nEndPos].GetType())if(private_CheckMarkDirection(this.Content[nEndPos])&&!this.Content[nEndPos].IsStart())return this.Content[nEndPos].GetMarkId();else return null; var nPos=nEndPos;while(this.Content[nPos].IsSelectionEmpty()){nPos--;if(nPos2||para_Run!==this.Content[0].Type){this.RemoveFromContent(0,this.Content.length-1,true);this.AddToContent(0,new ParaRun(this,false),true)}var oRun=this.Content[0];if(false!==isClearRun)oRun.ClearContent();return oRun};Paragraph.prototype.Document_Is_SelectionLocked=function(CheckType){var oState=null;if(this.IsApplyToAll()){oState=this.SaveSelectionState();this.SelectAll()}var isSelectionUse=this.IsSelectionUse();var arrContentControls=this.GetSelectedContentControls(); for(var nIndex=0,nCount=arrContentControls.length;nIndex0){var ParaState=this.GetSelectionState();this.RemoveSelection();this.Set_ParaContentPos(this.NearPosArray[0].NearPos.ContentPos,true,-1,-1);arrContentControls=this.GetSelectedContentControls();for(var nIndex=0,nCount=arrContentControls.length;nIndex.001||Math.abs(Pr.Ind.Left)>.001);else{var Prev=this.Get_DocumentPrev();if(null!=Prev&&type_Paragraph===Prev.GetType())Prev.Lock.Check(Prev.Get_Id())}}else if(true===this.Selection.Use){var StartPos=this.Selection.StartPos;var EndPos=this.Selection.EndPos;if(StartPos>EndPos){var Temp= EndPos;EndPos=StartPos;StartPos=Temp}if(EndPos>=this.Content.length-1&&StartPos>this.Internal_GetStartPos()){var Next=this.Get_DocumentNext();if(null!=Next&&type_Paragraph===Next.GetType())Next.Lock.Check(Next.Get_Id())}}this.Lock.Check(this.Get_Id());bCheckContentControl=true;break}case AscCommon.changestype_Delete:{if(true!=this.Selection.Use&&true===this.IsCursorAtEnd()){var Next=this.Get_DocumentNext();if(null!=Next&&type_Paragraph===Next.GetType())Next.Lock.Check(Next.Get_Id())}else if(true=== this.Selection.Use){var StartPos=this.Selection.StartPos;var EndPos=this.Selection.EndPos;if(StartPos>EndPos){var Temp=EndPos;EndPos=StartPos;StartPos=Temp}if(EndPos>=this.Content.length-1&&StartPos>this.Internal_GetStartPos()){var Next=this.Get_DocumentNext();if(null!=Next&&type_Paragraph===Next.GetType())Next.Lock.Check(Next.Get_Id())}}this.Lock.Check(this.Get_Id());bCheckContentControl=true;break}case AscCommon.changestype_Document_SectPr:case AscCommon.changestype_Table_Properties:case AscCommon.changestype_Table_RemoveCells:{AscCommon.CollaborativeEditing.Add_CheckLock(true); break}}if(oState)this.LoadSelectionState(oState);if(bCheckContentControl&&this.Parent&&this.Parent.CheckContentControlEditingLock)this.Parent.CheckContentControlEditingLock()};Paragraph.prototype.GetCurrentAnchorPosition=function(){var oNearPos={Paragraph:this,ContentPos:this.Get_ParaContentPos(false,false),transform:this.Get_ParentTextTransform()};this.Check_NearestPos(oNearPos);return oNearPos};Paragraph.prototype.SaveSelectionState=function(){var oState=new CParagraphSelectionState;oState.Selection.Use= this.Selection.Use;oState.Selection.Start=this.Selection.Start;oState.Selection.Flag=this.Selection.Flag;oState.Selection.StartManually=this.Selection.StartManually;oState.Selection.EndManually=this.Selection.EndManually;oState.CurPos.X=this.CurPos.X;oState.CurPos.Y=this.CurPos.Y;oState.CurPos.ContentPos=this.CurPos.ContentPos;oState.CurPos.Line=this.CurPos.Line;oState.CurPos.Range=this.CurPos.Range;oState.CurPos.RealX=this.CurPos.RealX;oState.CurPos.RealY=this.CurPos.RealY;oState.CurPos.PagesPos= this.CurPos.PagesPos;oState.ContentPos=this.Get_ParaContentPos(false,false,false);oState.StartPos=this.Get_ParaContentPos(true,true,false);oState.EndPos=this.Get_ParaContentPos(true,false,false);return oState};Paragraph.prototype.LoadSelectionState=function(oState){this.RemoveSelection();this.Set_ParaContentPos(oState.ContentPos,false,-1,-1,false);if(oState.Selection.Use)this.Set_SelectionContentPos(oState.StartPos,oState.EndPos,false);this.Selection.Use=oState.Selection.Use;this.Selection.Start= oState.Selection.Start;this.Selection.Flag=oState.Selection.Flag;this.Selection.StartManually=oState.Selection.StartManually;this.Selection.EndManually=oState.Selection.EndManually;this.CurPos.X=oState.CurPos.X;this.CurPos.Y=oState.CurPos.Y;this.CurPos.ContentPos=oState.CurPos.ContentPos;this.CurPos.Line=oState.CurPos.Line;this.CurPos.Range=oState.CurPos.Range;this.CurPos.RealX=oState.CurPos.RealX;this.CurPos.RealY=oState.CurPos.RealY;this.CurPos.PagesPos=oState.CurPos.PagesPos};Paragraph.prototype.TrackContentPositions= function(arrContentPositions){var oLogicDocument=this.GetLogicDocument();if(oLogicDocument)oLogicDocument.TrackDocumentPositions(arrContentPositions)};Paragraph.prototype.RefreshContentPositions=function(arrContentPositions){var oLogicDocument=this.GetLogicDocument();if(oLogicDocument){oLogicDocument.RefreshDocumentPositions(arrContentPositions);for(var nIndex=0,nCount=arrContentPositions.length;nIndex0)nStartLineNum=nPrevLinesCount;if(nRestart===Asc.c_oAscLineNumberRestartType.NewPage&&oPrevParagraph.GetAbsolutePage(oPrevParagraph.GetPagesCount()- 1)!==this.GetAbsolutePage(0))nStartLineNum=0}this.LineNumbersInfo=new CParagraphLineNumbersInfo(nStartLineNum)}else this.LineNumbersInfo=null};Paragraph.prototype.GetLineNumbersInfo=function(isNewPage){if(!this.LineNumbersInfo||this.Pages.length<=0||this.Lines.length<=0)return-1;if(isNewPage&&this.Pages.length>1){var nPageAbs=this.GetAbsolutePage(this.Pages.length-1);var nLinesCount=this.Pages[this.Pages.length-1].EndLine-this.Pages[this.Pages.length-1].StartLine+1;var nCurPage=this.Pages.length- 2;while(nCurPage>=0){if(nPageAbs!==this.GetAbsolutePage(nCurPage))break;if(0===nCurPage)nLinesCount+=this.LineNumbersInfo.StartNum;nLinesCount+=this.Pages[nCurPage].EndLine-this.Pages[nCurPage].StartLine+1;nCurPage--}return nLinesCount}else return this.LineNumbersInfo.StartNum+this.Lines.length};Paragraph.prototype.IsCountLineNumbers=function(){var oPrev=this.Get_DocumentPrev();return this.IsInline()&&(!this.Get_SectionPr()||!this.IsEmpty()||oPrev&&oPrev.IsParagraph()&&undefined!==oPrev.Get_SectionPr())&& !this.IsSuppressLineNumbers()};Paragraph.prototype.IsCursorInSpecialForm=function(){var nPos=-1;if(this.Selection.Use&&this.Selection.StartPos===this.Selection.EndPos)nPos=this.Selection.EndPos;else if(!this.Selection.Use)nPos=this.CurPos.ContentPos;if(-1===nPos)return false;var oElement=this.Content[nPos];return oElement&&oElement instanceof CInlineLevelSdt&&oElement.IsForm()};Paragraph.prototype.GetInnerForm=function(){var nIndex=-1;var nCount=this.Content.length-1;for(var nPos=0;nPos0){sText+=sNumText;sText+=" "}}sText+= this.GetText();return sText};Paragraph.prototype.asc_canAddRefToCaptionText=Paragraph.prototype.CanAddRefAfterSEQ;Paragraph.prototype["asc_getText"]=Paragraph.prototype.asc_getText;Paragraph.prototype["asc_canAddRefToCaptionText"]=Paragraph.prototype.asc_canAddRefToCaptionText;var pararecalc_0_All=0;var pararecalc_0_None=1;var pararecalc_0_Spell_All=0;var pararecalc_0_Spell_Pos=1;var pararecalc_0_Spell_Lang=2;var pararecalc_0_Spell_None=3;function CParaRecalcInfo(){this.Recalc_0_Type=pararecalc_0_All; this.Recalc_0_Spell={Type:pararecalc_0_All,StartPos:0,EndPos:0}}CParaRecalcInfo.prototype={Set_Type_0:function(Type){this.Recalc_0_Type=Type},Set_Type_0_Spell:function(Type,StartPos,EndPos){if(pararecalc_0_Spell_All===this.Recalc_0_Spell.Type)return;else if(pararecalc_0_Spell_None===this.Recalc_0_Spell.Type||pararecalc_0_Spell_Lang===this.Recalc_0_Spell.Type){this.Recalc_0_Spell.Type=Type;if(pararecalc_0_Spell_Pos===Type){this.Recalc_0_Spell.StartPos=StartPos;this.Recalc_0_Spell.EndPos=EndPos}}else if(pararecalc_0_Spell_Pos=== this.Recalc_0_Spell.Type)if(pararecalc_0_Spell_All===Type)this.Recalc_0_Spell.Type=Type;else if(pararecalc_0_Spell_Pos===Type){this.Recalc_0_Spell.StartPos=Math.min(StartPos,this.Recalc_0_Spell.StartPos);this.Recalc_0_Spell.EndPos=Math.max(EndPos,this.Recalc_0_Spell.EndPos)}},Update_Spell_OnChange:function(Pos,Count,bAdd){if(pararecalc_0_Spell_Pos===this.Recalc_0_Spell.Type)if(true===bAdd){if(this.Recalc_0_Spell.StartPos>Pos)this.Recalc_0_Spell.StartPos++;if(this.Recalc_0_Spell.EndPos>=Pos)this.Recalc_0_Spell.EndPos++}else{if(this.Recalc_0_Spell.StartPos> Pos)if(this.Recalc_0_Spell.StartPos>Pos+Count)this.Recalc_0_Spell.StartPos-=Count;else this.Recalc_0_Spell.StartPos=Pos;if(this.Recalc_0_Spell.EndPos>=Pos)if(this.Recalc_0_Spell.EndPos>=Pos+Count)this.Recalc_0_Spell.EndPos-=Count;else this.Recalc_0_Spell.EndPos=Math.max(0,Pos-1)}}};function CDocumentBounds(Left,Top,Right,Bottom){this.Bottom=Bottom;this.Left=Left;this.Right=Right;this.Top=Top}CDocumentBounds.prototype.CopyFrom=function(Bounds){if(!Bounds)return;this.Bottom=Bounds.Bottom;this.Left= Bounds.Left;this.Right=Bounds.Right;this.Top=Bounds.Top};CDocumentBounds.prototype.Shift=function(Dx,Dy){this.Bottom+=Dy;this.Top+=Dy;this.Left+=Dx;this.Right+=Dx};CDocumentBounds.prototype.Compare=function(Other){if(Math.abs(Other.Bottom-this.Bottom)>.001||Math.abs(Other.Top-this.Top)>.001||Math.abs(Other.Left-this.Left)>.001||Math.abs(Other.Right-this.Right))return false;return true};CDocumentBounds.prototype.Reset=function(){this.Bottom=0;this.Left=0;this.Right=0;this.Top=0};CDocumentBounds.prototype.Copy= function(){return new CDocumentBounds(this.Left,this.Top,this.Right,this.Bottom)};function CParagraphPageEndInfo(){this.Comments=[];this.ComplexFields=[];this.RunRecalcInfo=null}CParagraphPageEndInfo.prototype.Copy=function(){var oInfo=new CParagraphPageEndInfo;for(var nIndex=0,nCount=this.Comments.length;nIndex0){var PrevEl=this.Elements[Count-1];if(this.private_CanUnionElements(PrevEl,Element)){if(isSaveIntermediate)Element.Intermediate.push(Element.x0);Element.x0=PrevEl.x0;Count--}else break}this.Elements.length=Count;return Element},Get_NextForward:function(){var Count=this.Elements.length;if(Count<=0)return null;var Element=this.Elements[0];var Pos=1;while(PosPrevEl.w)for(var Index2=0;Index2this.Depth)this.Data.length=this.Depth},Get:function(Depth){return this.Data[Depth]},Get_Depth:function(){return this.Depth-1},Decrease_Depth:function(nCount){this.Depth=Math.max(0,this.Depth-nCount)},Copy:function(){var PRPos= new CParagraphContentPos;var Count=this.Data.length;for(var Index=0;IndexPos.Data[CurDepth])return 1;else return-1;if(Len1!==Len2)return-1;return 0}};CParagraphContentPos.prototype.GetDepth=function(){return this.Depth-1};CParagraphContentPos.prototype.ToAnchorPos=function(oParagraph){if(!oParagraph)return;var oNearPos={Paragraph:oParagraph,ContentPos:this,transform:oParagraph.Get_ParentTextTransform()};oParagraph.Check_NearestPos(oNearPos);return oNearPos};CParagraphContentPos.prototype.SetDepth=function(nDepth){this.Depth= Math.max(0,Math.min(nDepth+1,this.Data.length-1))};CParagraphContentPos.prototype.DecreaseDepth=function(nCount){this.Depth=Math.max(0,this.Depth-nCount)};function CComplexFieldStatePos(oComplexField,isFieldCode){this.FieldCode=undefined!==isFieldCode?isFieldCode:true;this.ComplexField=oComplexField?oComplexField:null}CComplexFieldStatePos.prototype.Copy=function(){return new CComplexFieldStatePos(this.ComplexField,this.FieldCode)};CComplexFieldStatePos.prototype.SetFieldCode=function(isFieldCode){this.FieldCode= isFieldCode};CComplexFieldStatePos.prototype.IsFieldCode=function(){return this.FieldCode};CComplexFieldStatePos.prototype.IsEqual=function(oState){return this.FieldCode===oState.FieldCode&&this.ComplexField&&oState.ComplexField&&this.ComplexField.GetBeginChar()===oState.ComplexField.GetBeginChar()};function CParagraphComplexFieldsInfo(){this.CF=[];this.isHidden=null;this.StoredState=null}CParagraphComplexFieldsInfo.prototype.ResetPage=function(Paragraph,CurPage){this.isHidden=null;var PageEndInfo= Paragraph.GetEndInfoByPage(CurPage-1);if(PageEndInfo)this.CF=PageEndInfo.GetComplexFields();else this.CF=[]};CParagraphComplexFieldsInfo.prototype.IsHiddenFieldContent=function(){if(null===this.isHidden)this.isHidden=this.private_IsHiddenFieldContent();return this.isHidden};CParagraphComplexFieldsInfo.prototype.private_IsHiddenFieldContent=function(){if(this.CF.length>0)for(var nIndex=0,nCount=this.CF.length;nIndex0){oChar.SetUse(true);var oComplexField=this.CF[this.CF.length-1].ComplexField;oComplexField.SetEndChar(oChar);this.CF.splice(this.CF.length- 1,1);if(this.CF.length>0&&this.CF[this.CF.length-1].IsFieldCode())this.CF[this.CF.length-1].ComplexField.SetInstructionCF(oComplexField)}else oChar.SetUse(false);else if(oChar.IsSeparate())if(this.CF.length>0){oChar.SetUse(true);var oComplexField=this.CF[this.CF.length-1].ComplexField;oComplexField.SetSeparateChar(oChar);this.CF[this.CF.length-1].SetFieldCode(false)}else oChar.SetUse(false)};CParagraphComplexFieldsInfo.prototype.ProcessFieldChar=function(oChar){this.isHidden=null;if(!oChar||!oChar.IsUse())return; var oComplexField=oChar.GetComplexField();if(oChar.IsBegin())this.CF.push(new CComplexFieldStatePos(oComplexField,true));else if(oChar.IsSeparate()){if(this.CF.length>0)this.CF[this.CF.length-1].SetFieldCode(false)}else if(oChar.IsEnd())if(this.CF.length>0)this.CF.splice(this.CF.length-1,1)};CParagraphComplexFieldsInfo.prototype.ProcessInstruction=function(oInstruction){if(this.CF.length<=0)return;var oComplexField=this.CF[this.CF.length-1].ComplexField;if(oComplexField&&null===oComplexField.GetSeparateChar())oComplexField.SetInstruction(oInstruction)}; CParagraphComplexFieldsInfo.prototype.IsComplexField=function(){return this.CF.length>0?true:false};CParagraphComplexFieldsInfo.prototype.IsComplexFieldCode=function(){if(!this.IsComplexField())return false;for(var nIndex=0,nCount=this.CF.length;nIndex=0;--nIndex){var oInstruction=this.CF[nIndex].ComplexField.GetInstruction();if(oInstruction&&(fieldtype_HYPERLINK=== oInstruction.GetType()||fieldtype_REF===oInstruction.GetType()&&oInstruction.GetHyperlink()||fieldtype_NOTEREF===oInstruction.GetType()&&oInstruction.GetHyperlink()))return this.CF[nIndex].ComplexField}return null};function CParagraphDrawStateHighlights(){this.Page=0;this.Line=0;this.Range=0;this.CurPos=new CParagraphContentPos;this.DrawColl=false;this.DrawMMFields=false;this.High=new CParaDrawingRangeLines;this.Coll=new CParaDrawingRangeLines;this.Find=new CParaDrawingRangeLines;this.Comm=new CParaDrawingRangeLines; this.Shd=new CParaDrawingRangeLines;this.MMFields=new CParaDrawingRangeLines;this.CFields=new CParaDrawingRangeLines;this.HyperCF=new CParaDrawingRangeLines;this.DrawComments=true;this.DrawSolvedComments=true;this.Comments=[];this.CommentsFlag=AscCommon.comments_NoComment;this.SearchCounter=0;this.Paragraph=undefined;this.Graphics=undefined;this.X=0;this.Y0=0;this.Y1=0;this.Spaces=0;this.InlineSdt=[];this.ComplexFields=new CParagraphComplexFieldsInfo}CParagraphDrawStateHighlights.prototype.Reset= function(Paragraph,Graphics,DrawColl,DrawFind,DrawComments,DrawMMFields,PageEndInfo,DrawSolvedComments){this.Paragraph=Paragraph;this.Graphics=Graphics;this.DrawColl=DrawColl;this.DrawFind=DrawFind;this.DrawMMFields=DrawMMFields;this.CurPos=new CParagraphContentPos;this.SearchCounter=0;this.DrawComments=DrawComments;this.DrawSolvedComments=DrawSolvedComments;this.Comments=[];if(null!==PageEndInfo)for(var nIndex=0,nCount=PageEndInfo.Comments.length;nIndex0?AscCommon.comments_NonActiveComment:AscCommon.comments_NoComment; for(var CurPos=0;CurPos0&&this.CurPos.Compare(oEndPos)<0)nCounter++}return nCounter};CParagraphDrawStateLines.prototype.GetLogicDocument=function(){return this.Paragraph.GetLogicDocument()};var g_oPDSH=new CParagraphDrawStateHighlights;var g_oPDSL=new CParagraphDrawStateLines;function CParagraphSearchPos(){this.Pos= new CParagraphContentPos;this.Found=false;this.Line=-1;this.Range=-1;this.Stage=0;this.Shift=false;this.Punctuation=false;this.First=true;this.UpdatePos=false;this.ForSelection=false;this.CheckAnchors=false;this.TrimSpaces=false;this.ComplexFields=[]}CParagraphSearchPos.prototype.SetCheckAnchors=function(bCheck){this.CheckAnchors=bCheck};CParagraphSearchPos.prototype.IsCheckAnchors=function(){return this.CheckAnchors};CParagraphSearchPos.prototype.ProcessComplexFieldChar=function(nDirection,oFieldChar){if(!oFieldChar|| !oFieldChar.IsUse())return;if(nDirection>0){var oComplexField=oFieldChar.GetComplexField();if(oFieldChar.IsBegin())this.ComplexFields.push(new CComplexFieldStatePos(oComplexField,true));else if(oFieldChar.IsSeparate())for(var nIndex=0,nCount=this.ComplexFields.length;nIndex0?true:false};CParagraphSearchPos.prototype.IsComplexFieldCode=function(){if(!this.IsComplexField())return false;for(var nIndex=0,nCount=this.ComplexFields.length;nIndex< nCount;++nIndex)if(this.ComplexFields[nIndex].IsFieldCode())return true;return false};CParagraphSearchPos.prototype.IsComplexFieldValue=function(){if(!this.IsComplexField()||this.IsComplexFieldCode())return false;return true};CParagraphSearchPos.prototype.IsHiddenComplexField=function(){for(var nIndex=0,nCount=this.ComplexFields.length;nIndex=this.private_Get_LinesCount()||CurLine>=OLI.protected_GetLinesCount()||CurRange<0||CurRange>=this.private_Get_RangesCount(CurLine)||CurRange>=OLI.protected_GetRangesCount(CurLine))return false;var ThisSP=this.private_Get_RangeStartPos(CurLine,CurRange);var ThisEP=this.private_Get_RangeEndPos(CurLine,CurRange);var OtherSP=OLI.protected_GetRangeStartPos(CurLine,CurRange);var OtherEP=OLI.protected_GetRangeEndPos(CurLine,CurRange);if(ThisSP!==OtherSP|| ThisEP!==OtherEP)return false;if((OLI.Content===undefined||para_Run===OLI.Type||para_Math_Run===OLI.Type)&&this.Content.length>0||OLI.Content!==undefined&¶_Run!==OLI.Type&¶_Math_Run!==OLI.Type&&OLI.Content.length!==this.Content.length)return false;var ContentLen=this.Content.length;var StartPos=ThisSP;var EndPos=Math.min(ContentLen-1,ThisEP);for(var CurPos=StartPos;CurPos<=EndPos;CurPos++)if(false===this.Content[CurPos].Compare(_CurLine,_CurRange,OLI.Content[CurPos]))return false;return true}, private_Get_RangeOffset:function(LineIndex,RangeIndex){return 1+this.Lines[0]+this.Lines[1+LineIndex]+RangeIndex*2},private_Get_RangeStartPos:function(LineIndex,RangeIndex){return this.Lines[this.private_Get_RangeOffset(LineIndex,RangeIndex)]},private_Get_RangeEndPos:function(LineIndex,RangeIndex){return this.Lines[this.private_Get_RangeOffset(LineIndex,RangeIndex)+1]},private_Get_LinesCount:function(){return this.Lines[0]},private_Get_RangesCount:function(LineIndex){if(LineIndex===this.Lines[0]- 1)return(this.Lines.length-this.Lines[1+LineIndex])/2;else return(this.Lines[1+LineIndex+1]-this.Lines[1+LineIndex])/2}};function CParagraphRunElements(ContentPos,Count,arrTypes,isReverse){this.ContentPos=ContentPos;this.Elements=[];this.Count=Count+1;this.Types=arrTypes?arrTypes:[];this.End=false;this.Reverse=undefined!==isReverse?isReverse:false;this.BreakBadType=false;this.BreakDifferentClass=false;this.SkipMath=true;this.CurContentPos=new CParagraphContentPos;this.SaveContentPositions=false;this.ContentPositions= [];this.StartClass=null}CParagraphRunElements.prototype.UpdatePos=function(nPos,nDepth){this.CurContentPos.Update(nPos,nDepth)};CParagraphRunElements.prototype.SetBreakOnBadType=function(isBreak){this.BreakBadType=isBreak};CParagraphRunElements.prototype.SetBreakOnDifferentClass=function(isBreak){this.BreakDifferentClass=isBreak};CParagraphRunElements.prototype.SetSaveContentPositions=function(isSave){this.SaveContentPositions=isSave};CParagraphRunElements.prototype.GetContentPositions=function(){return this.ContentPositions}; CParagraphRunElements.prototype.CheckType=function(nType){if(this.Types.length<=0)return true;for(var nIndex=0,nCount=this.Types.length;nIndex0&&isPageBreakLastLine1===(this.Lines[this.Lines.length-1].Info¶lineinfo_BreakPage)&&isPageBreakLastLine2===(this.Lines[this.Lines.length-1].Info¶lineinfo_BreakRealPage))return[this.Get_AbsolutePage(0)]}else if(2===this.Pages.length){var oEndInfo=this.GetEndInfo().Copy();var OldBounds_0=this.Pages[0].Bounds;var OldBounds_1=this.Pages[1].Bounds;var isPageBreakLastLine1=this.Lines[this.Lines.length- 1].Info¶lineinfo_BreakPage;var isPageBreakLastLine2=this.Lines[this.Lines.length-1].Info¶lineinfo_BreakRealPage;var OldStartFromNewPage=this.Pages[0].StartLine<0?true:false;var OldLinesCount_0=this.Pages[0].EndLine-this.Pages[0].StartLine+1;var OldLinesCount_1=this.Pages[1].EndLine-this.Pages[1].StartLine+1;this.m_oPRSW.SetFast(true);var FastRecalcResult=this.Recalculate_Page(0,true);if(!(FastRecalcResult&recalcresult_NextPage)){this.m_oPRSW.SetFast(false);return[]}FastRecalcResult=this.Recalculate_Page(1); this.m_oPRSW.SetFast(false);if(!(FastRecalcResult&recalcresult_NextElement))return[];if(2!==this.Pages.length||true!==this.Pages[0].Bounds.Compare(OldBounds_0)||true!==this.Pages[1].Bounds.Compare(OldBounds_1))return[];if(this.Lines.length<=0||isPageBreakLastLine1!==(this.Lines[this.Lines.length-1].Info¶lineinfo_BreakPage)||isPageBreakLastLine2!==(this.Lines[this.Lines.length-1].Info¶lineinfo_BreakRealPage))return[];var StartFromNewPage=this.Pages[0].StartLine<0?true:false;if(StartFromNewPage!== OldStartFromNewPage)return[];if(true!==StartFromNewPage){var LinesCount_0=this.Pages[0].EndLine-this.Pages[0].StartLine+1;var LinesCount_1=this.Pages[1].EndLine-this.Pages[1].StartLine+1;if((OldLinesCount_0<=2||LinesCount_0<=2)&&OldLinesCount_0!==LinesCount_0)return[];if((OldLinesCount_1<=2||LinesCount_1<=2)&&OldLinesCount_1!==LinesCount_1)return[]}if(!this.GetEndInfo().IsEqual(oEndInfo))return[];if(true===StartFromNewPage)return[this.Get_AbsolutePage(1)];else{var PageAbs0=this.Get_AbsolutePage(0); var PageAbs1=this.Get_AbsolutePage(1);if(PageAbs0!==PageAbs1)return[PageAbs0,PageAbs1];else return[PageAbs0]}}return[]};Paragraph.prototype.RecalculateFastRunRange=function(oParaPos){if(this.Pages.length<=0)return-1;if(true===this.Parent.IsHdrFtr(false))return-1;if(!oParaPos)return-1;var Line=oParaPos.Line;var Range=oParaPos.Range;if(this.Lines.length<=oParaPos.Line)return-1;if(undefined===this.Parent||true===this.Parent.IsTableCellContent())return-1;if(true===this.Parent.Check_AutoFit())return-1; if(true===this.Lines[Line].RangeY)return-1;if(this.Lines[Line].Info¶lineinfo_BreakPage||this.Lines[Line].Info¶lineinfo_Empty&&this.Lines[Line].Info¶lineinfo_End)return-1;if(0===Line&&0===Range&&undefined!==this.Get_SectionPr())return-1;if(1===this.Lines.length&&true!==this.Is_Inline())return-1;var PrevLine=Line;var PrevRange=Range;while(PrevLine>=0){PrevRange--;if(PrevRange<0){PrevLine--;if(PrevLine<0)break;PrevRange=this.Lines[PrevLine].Ranges.length-1}if(!this.IsEmptyRange(PrevLine, PrevRange))break}if(PrevLine<0){PrevLine=Line;PrevRange=Range}var NextLine=Line;var NextRange=Range;var LinesCount=this.Lines.length;while(NextLine<=LinesCount-1){NextRange++;if(NextRange>this.Lines[NextLine].Ranges.length-1){NextLine++;if(NextLine>LinesCount-1)break;NextRange=0}if(!this.IsEmptyRange(NextLine,NextRange))break}if(NextLine>LinesCount-1){NextLine=Line;NextRange=Range}if(null!==this.Numbering.Item&&(PrevLinethis.Lines[CurLine].Ranges.length-1){CurLine++;CurRange=0}}this.CurPos.Line=-1;this.CurPos.Range=-1;this.Internal_CheckSpelling();this.SetIsRecalculated(true);this.m_oPRSW.SetFast(false);return this.Get_AbsolutePage(Result)};Paragraph.prototype.Recalculate_Page=function(CurPage){if(0===CurPage)this.CalculatedFrame= null;this.Clear_NearestPosArray();this.CurPos.Line=-1;this.CurPos.Range=-1;this.SetIsRecalculated(true);this.FontMap.NeedRecalc=true;this.Internal_CheckSpelling();this.RecalculateEndInfo();var RecalcResult=this.private_RecalculatePage(CurPage);this.private_CheckColumnBreak(CurPage);this.Parent.RecalcInfo.Reset_WidowControl();if(RecalcResult&recalcresult_NextElement&&window["AscCommon"].g_specialPasteHelper&&window["AscCommon"].g_specialPasteHelper.showButtonIdParagraph===this.GetId())window["AscCommon"].g_specialPasteHelper.SpecialPasteButtonById_Show(); if(RecalcResult&recalcresult_NextElement)this.UpdateLineNumbersInfo();return RecalcResult};Paragraph.prototype.Recalculate_SkipPage=function(PageIndex){if(0===PageIndex)this.StartFromNewPage();else{var PrevPage=this.Pages[PageIndex-1];var EndLine=Math.max(PrevPage.StartLine,PrevPage.EndLine);var NewPage=new CParaPage(PrevPage.X,PrevPage.Y,PrevPage.XLimit,PrevPage.YLimit,EndLine);NewPage.StartLine=EndLine;NewPage.EndLine=EndLine-1;NewPage.TextPr=PrevPage.TextPr;this.Pages[PageIndex]=NewPage}};Paragraph.prototype.SaveRecalculateObject= function(){var RecalcObj=new CParagraphRecalculateObject;RecalcObj.Save(this);return RecalcObj};Paragraph.prototype.LoadRecalculateObject=function(RecalcObj){RecalcObj.Load(this)};Paragraph.prototype.PrepareRecalculateObject=function(){this.Pages=[];this.Lines=[];var Count=this.Content.length;for(var Index=0;Index=__Page.FirstLine){CurPage=TempPage;break}}if(-1===CurPage)return-1;var ParaPr=this.Get_CompiledPr2(false).ParaPr;if(0===CurPage){XStart=this.X;YStart= this.Y;XLimit=this.XLimit;YLimit=this.YLimit}else{var PageStart=this.Parent.Get_PageContentStartPos2(this.PageNum,this.ColumnNum,CurPage,this.Index);XStart=PageStart.X;YStart=PageStart.Y;XLimit=PageStart.XLimit;YLimit=PageStart.YLimit}PRS.XStart=XStart;PRS.YStart=YStart;PRS.XLimit=XLimit-ParaPr.Ind.Right;PRS.YLimit=YLimit;PRS.Reset_Line();PRS.Page=CurPage;PRS.Line=CurLine;PRS.Range=CurRange;PRS.Ranges=this.Lines[CurLine].Ranges;PRS.RangesCount=this.Lines[CurLine].Ranges.length-1;PRS.Paragraph=this; var RangesCount=PRS.RangesCount;var Line=this.Lines[CurLine];var Range=Line.Ranges[CurRange];var StartPos=Range.StartPos;var EndPos=Range.EndPos;PRS.Reset_Range(Range.X,Range.XEnd);var ContentLen=this.Content.length;for(var Pos=StartPos;Pos<=EndPos;Pos++){var Item=this.Content[Pos];if(para_Math===Item.Type){Item.Set_Inline(true!==this.CheckMathPara(Pos));PRS.bFastRecalculate=true}PRS.Update_CurPos(Pos,0);var SavedLines=Item.SaveRecalculateObject(true);Item.Recalculate_Range(PRS,ParaPr,1);if(true=== PRS.NewRange&&Pos!==EndPos||Pos===EndPos&&true!==PRS.NewRange)return-1;else if(Pos===EndPos&&true===PRS.NewRange&&true===PRS.MoveToLBP){var BreakPos=PRS.LineBreakPos.Get(0);if(BreakPos!==Pos)return-1;else Item.Recalculate_Set_RangeEndPos(PRS,PRS.LineBreakPos,1)}if(false===SavedLines.Compare(CurLine,CurRange,Item))return-1;Item.LoadRecalculateObject(SavedLines,this)}if(!(this.private_RecalculateLineAlign(CurLine,CurPage,PRS,ParaPr,true)&recalcresult_NextElement))return-1;return CurPage};Paragraph.prototype.private_RecalculatePage= function(CurPage,bFirstRecalculate){var PRS=this.m_oPRSW;PRS.Reset_Page(this,CurPage);this.m_oPRSW.ComplexFields.ResetPage(this,CurPage);this.m_oPRSC.ComplexFields.ResetPage(this,CurPage);this.m_oPRSA.ComplexFields.ResetPage(this,CurPage);var Pr=this.Get_CompiledPr();var ParaPr=Pr.ParaPr;var CurLine=CurPage>0?this.Pages[CurPage-1].EndLine+1:0;if(false===this.private_RecalculatePageKeepNext(CurLine,CurPage,PRS,ParaPr))return PRS.RecalcResult;this.private_RecalculatePageXY(CurLine,CurPage,PRS,ParaPr); if(false===this.private_RecalculatePageBreak(CurLine,CurPage,PRS,ParaPr)){this.Recalculate_PageEndInfo(null,CurPage);return PRS.RecalcResult}PRS.Reset_Ranges();if(false!==bFirstRecalculate){PRS.ResetMathRecalcInfo();PRS.Reset_MathRecalcInfo();PRS.SaveFootnotesInfo()}else PRS.LoadFootnotesInfo();var RecalcResult;while(true){PRS.Line=CurLine;PRS.RecalcResult=recalcresult_NextLine;PRS.ComplexFields.PushState();this.private_RecalculateLine(CurLine,CurPage,PRS,ParaPr);RecalcResult=PRS.RecalcResult;if(RecalcResult& recalcresult_NextLine){CurLine++;PRS.Reset_Ranges();PRS.Reset_RunRecalcInfo();PRS.Reset_MathRecalcInfo()}else if(RecalcResult&recalcresult_ParaMath){CurLine=PRS.GetMathRecalcInfoLine();PRS.Reset_RunRecalcInfo()}else if(RecalcResult&recalcresult_CurLine){PRS.Restore_RunRecalcInfo();PRS.ComplexFields.PopState()}else if(RecalcResult&recalcresult_NextElement||RecalcResult&recalcresult_NextPage)break;else if(RecalcResult&recalcresult_CurPagePara){RecalcResult=this.private_RecalculatePage(CurPage,false); break}else return RecalcResult}this.Recalculate_PageEndInfo(PRS,CurPage);return RecalcResult};Paragraph.prototype.private_RecalculatePageKeepNext=function(CurLine,CurPage,PRS,ParaPr){if(1===CurPage&&true===this.Check_EmptyPages(0)&&this.Parent instanceof CDocument&&false===ParaPr.PageBreakBefore){var Curr=this.Get_DocumentPrev();while(null!=Curr&&type_Paragraph===Curr.GetType()&&undefined===Curr.Get_SectionPr()){var CurrKeepNext=Curr.Get_CompiledPr2(false).ParaPr.KeepNext;if(true===CurrKeepNext&& Curr.Pages.length>1||false===CurrKeepNext||true!==Curr.Is_Inline()||true===Curr.Check_PageBreak())break;else{var Prev=Curr.Get_DocumentPrev();if(null===Prev||type_Paragraph===Prev.GetType()&&undefined!==Prev.Get_SectionPr())break;if(type_Paragraph!=Prev.GetType()||false===Prev.Get_CompiledPr2(false).ParaPr.KeepNext)if(true===this.Parent.RecalcInfo.Can_RecalcObject()){this.Parent.RecalcInfo.Set_KeepNext(Curr,this);PRS.RecalcResult=recalcresult_PrevPage|recalcresultflags_Column;return false}else break; else Curr=Prev}}}if(true===this.Parent.RecalcInfo.Check_KeepNextEnd(this))this.Parent.RecalcInfo.Reset();return true};Paragraph.prototype.private_RecalculatePageXY=function(CurLine,CurPage,PRS,ParaPr){var XStart,YStart,XLimit,YLimit;if(0===CurPage||undefined!=this.Get_FramePr()&&this.LogicDocument===this.Parent){XStart=this.X;YStart=this.Y;XLimit=this.XLimit;YLimit=this.YLimit}else{var PageStart=this.Parent.Get_PageContentStartPos2(this.PageNum,this.ColumnNum,CurPage,this.Index);XStart=PageStart.X; YStart=PageStart.Y;XLimit=PageStart.XLimit;YLimit=PageStart.YLimit}PRS.XStart=XStart;PRS.YStart=YStart;PRS.XLimit=XLimit-ParaPr.Ind.Right;PRS.YLimit=YLimit;PRS.Y=YStart;this.Pages.length=CurPage+1;this.Pages[CurPage]=new CParaPage(XStart,YStart,XLimit,YLimit,CurLine)};Paragraph.prototype.private_RecalculatePageBreak=function(CurLine,CurPage,PRS,ParaPr){if(undefined!==this.Get_SectionPr()&&true===this.IsEmpty())return true;var isParentDocument=this.Parent instanceof CDocument;var isParentBlockSdt= this.Parent instanceof CDocumentContent&&this.Parent.Parent instanceof CBlockLevelSdt&&PRS.GetTopDocument()instanceof CDocument&&!PRS.IsInTable();if(isParentDocument||isParentBlockSdt){var PageRelative=this.private_GetRelativePageIndex(CurPage)-this.Get_StartPage_Relative();if(0===PageRelative&&true===ParaPr.PageBreakBefore){var bNeedPageBreak=true;var Prev=this.Get_DocumentPrev();if(!Prev&&isParentBlockSdt){var oSdt=this.Parent.Parent;while(oSdt instanceof CBlockLevelSdt){Prev=oSdt.Get_DocumentPrev(); if(Prev)break;if(oSdt.Parent instanceof CDocumentContent&&oSdt.Parent.Parent instanceof CBlockLevelSdt)oSdt=oSdt.Parent.Parent;else oSdt=null}}while(Prev&&Prev instanceof CBlockLevelSdt)Prev=Prev.GetLastElement();if(true===this.IsEmpty()&&undefined!==this.Get_SectionPr()||null===Prev)bNeedPageBreak=false;else if(this.Parent===this.LogicDocument&&type_Paragraph===Prev.GetType()&&undefined!==Prev.Get_SectionPr()){var PrevSectPr=Prev.Get_SectionPr();var CurSectPr=this.LogicDocument.SectionsInfo.Get_SectPr(this.Index).SectPr; if(c_oAscSectionBreakType.Continuous!==CurSectPr.Get_Type()||true!==CurSectPr.Compare_PageSize(PrevSectPr))bNeedPageBreak=false}if(true===bNeedPageBreak){this.Pages[CurPage].Set_EndLine(CurLine-1);if(0===CurLine)this.Lines[-1]=new CParaLine;PRS.RecalcResult=recalcresult_NextPage|recalcresultflags_Column;return false}}else if(isParentDocument&&true===this.Parent.RecalcInfo.Check_KeepNext(this)&&0===CurPage&&null!=this.Get_DocumentPrev()){this.Pages[CurPage].Set_EndLine(CurLine-1);if(0===CurLine)this.Lines[-1]= new CParaLine(0);PRS.RecalcResult=recalcresult_NextPage;return false}else if(true===this.Is_Inline()){var isPageBreakOnPrevLine=false;var isColumnBreakOnPrevLine=false;var PrevElement=this.Get_DocumentPrev();if(!PrevElement&&isParentBlockSdt){var oSdt=this.Parent.Parent;while(oSdt instanceof CBlockLevelSdt){PrevElement=oSdt.Get_DocumentPrev();if(PrevElement)break;if(oSdt.Parent instanceof CDocumentContent&&oSdt.Parent.Parent instanceof CBlockLevelSdt)oSdt=oSdt.Parent.Parent;else oSdt=null}}while(PrevElement&& PrevElement instanceof CBlockLevelSdt)PrevElement=PrevElement.GetLastElement();var oFootnotes=this.LogicDocument?this.LogicDocument.Footnotes:null;if(null!==PrevElement&&type_Paragraph===PrevElement.Get_Type()&&true===PrevElement.Is_Empty()&&undefined!==PrevElement.Get_SectionPr()){var PrevSectPr=PrevElement.Get_SectionPr();var CurSectPr=this.LogicDocument.SectionsInfo.Get_SectPr(this.Index).SectPr;if(c_oAscSectionBreakType.Continuous===CurSectPr.Get_Type()&&true===CurSectPr.Compare_PageSize(PrevSectPr)&& oFootnotes&&oFootnotes.IsEmptyPage(PrevElement.GetAbsolutePage(PrevElement.GetPagesCount()-1)))PrevElement=PrevElement.Get_DocumentPrev()}if(0!==CurPage&&true!==this.Check_EmptyPages(CurPage-1)){var EndLine=this.Pages[CurPage-1].EndLine;if(-1!==EndLine&&this.Lines[EndLine].Info¶lineinfo_BreakRealPage)isPageBreakOnPrevLine=true}else if(null!==PrevElement&&type_Paragraph===PrevElement.Get_Type()){var bNeedPageBreak=true;if(type_Paragraph===PrevElement.GetType()&&undefined!==PrevElement.Get_SectionPr()){var PrevSectPr= PrevElement.Get_SectionPr();var CurSectPr=this.LogicDocument.SectionsInfo.Get_SectPr(this.Index).SectPr;if(c_oAscSectionBreakType.Continuous!==CurSectPr.Get_Type()||true!==CurSectPr.Compare_PageSize(PrevSectPr)||oFootnotes&&!oFootnotes.IsEmptyPage(PrevElement.GetAbsolutePage(PrevElement.GetPagesCount()-1)))bNeedPageBreak=false}if(true===bNeedPageBreak){var EndLine=PrevElement.Pages[PrevElement.Pages.length-1].EndLine;if(-1!==EndLine&&PrevElement.Lines[EndLine].Info¶lineinfo_BreakRealPage)isPageBreakOnPrevLine= true}}if(0===CurPage&&null!==PrevElement&&type_Paragraph===PrevElement.Get_Type()){var EndLine=PrevElement.Pages[PrevElement.Pages.length-1].EndLine;if(-1!==EndLine&&!(PrevElement.Lines[EndLine].Info¶lineinfo_BreakRealPage)&&PrevElement.Lines[EndLine].Info¶lineinfo_BreakPage)isColumnBreakOnPrevLine=true}if(true===isPageBreakOnPrevLine&&(0!==this.GetAbsoluteColumn(CurPage)||0===CurPage&&null!==PrevElement)||true===isColumnBreakOnPrevLine&&0===CurPage){this.Pages[CurPage].Set_EndLine(CurLine- 1);if(0===CurLine)this.Lines[-1]=new CParaLine;PRS.RecalcResult=recalcresult_NextPage|recalcresultflags_Column;return false}}}return true};Paragraph.prototype.private_RecalculateLine=function(CurLine,CurPage,PRS,ParaPr){this.ParaEnd.Line=-1;this.ParaEnd.Range=-1;this.Lines.length=CurLine+1;this.Lines[CurLine]=new CParaLine;if(false===this.private_RecalculateLineWidow(CurLine,CurPage,PRS,ParaPr))return;this.private_RecalculateLineFillRanges(CurLine,CurPage,PRS,ParaPr);if(false===this.private_RecalculateLineRanges(CurLine, CurPage,PRS,ParaPr))return;this.private_RecalculateLineInfo(CurLine,CurPage,PRS,ParaPr);this.private_RecalculateLineMetrics(CurLine,CurPage,PRS,ParaPr);this.private_RecalculateLinePosition(CurLine,CurPage,PRS,ParaPr);if(false===this.private_RecalculateLineBottomBound(CurLine,CurPage,PRS,ParaPr))return;if(false===this.private_RecalculateLineCheckRanges(CurLine,CurPage,PRS,ParaPr))return;this.private_RecalculateLineBaseLine(CurLine,CurPage,PRS,ParaPr);if(false===this.private_RecalculateLineCheckRangeY(CurLine, CurPage,PRS,ParaPr))return;if(!(this.private_RecalculateLineAlign(CurLine,CurPage,PRS,ParaPr,false)&recalcresult_NextElement))return;if(false===this.private_RecalculateLineEnd(CurLine,CurPage,PRS,ParaPr))return;if(false===this.private_RecalculateLineCheckFootnotes(CurLine,CurPage,PRS,ParaPr))return;this.private_RecalculateLineCheckEndnotes(CurLine,CurPage,PRS,ParaPr)};Paragraph.prototype.private_RecalculateLineWidow=function(CurLine,CurPage,PRS,ParaPr){if(this.Parent instanceof CDocument&&true=== this.Parent.RecalcInfo.Check_WidowControl(this,CurLine)){this.Parent.RecalcInfo.Need_ResetWidowControl();this.Pages[CurPage].Set_EndLine(CurLine-1);if(0===CurLine)this.Lines[-1]=new CParaLine(0);PRS.RecalcResult=recalcresult_NextPage|recalcresultflags_Column;return false}return true};Paragraph.prototype.private_RecalculateLineFillRanges=function(CurLine,CurPage,PRS,ParaPr){this.Lines[CurLine].Info=0;var Ranges=PRS.Ranges;var RangesCount=PRS.RangesCount;PRS.Reset_Line();var UseFirstLine=true;for(var TempCurLine= CurLine-1;TempCurLine>=0;TempCurLine--){var TempInfo=this.Lines[TempCurLine].Info;if(!(TempInfo¶lineinfo_BreakPage)||!(TempInfo¶lineinfo_Empty)){UseFirstLine=false;break}}if(0===CurLine&&true===UseFirstLine){var CurPos=0;var Count=this.Content.length;while(CurPos0||PRS.GetEndnoteReferenceCount()> 0)this.Lines[CurLine].Info|=paralineinfo_Notes;if(true===PRS.TextOnLine)this.Lines[CurLine].Info|=paralineinfo_TextOnLine;if(true===PRS.BreakLine)this.Lines[CurLine].Info|=paralineinfo_BreakLine};Paragraph.prototype.private_RecalculateLineMetrics=function(CurLine,CurPage,PRS,ParaPr){var Line=this.Lines[CurLine];var RangesCount=Line.Ranges.length;for(var CurRange=0;CurRangethis.YLimit&&Bottom-this.YLimit<=ParaPr.Spacing.After)Bottom=this.YLimit}this.Lines[CurLine].Top= Top-this.Pages[CurPage].Y;this.Lines[CurLine].Bottom=Bottom-this.Pages[CurPage].Y;if(this.LogicDocument&&this.LogicDocument.GetCompatibilityMode&&this.LogicDocument.GetCompatibilityMode()<=AscCommon.document_compatibility_mode_Word14&&this.Lines[CurLine].Info¶lineinfo_BreakPage&&this.Lines[CurLine].Info¶lineinfo_Empty&&!(this.Lines[CurLine].Info¶lineinfo_BreakRealPage)){Bottom=Top;Top2=Top;Bottom2=Top}if(CurLine===this.Pages[CurPage].FirstLine&&!(this.Lines[CurLine].Info¶lineinfo_RangeY))this.Pages[CurPage].Bounds.Top= Top;this.Pages[CurPage].Bounds.Bottom=Bottom;PRS.LineTop=AscCommon.CorrectMMToTwips(Top);PRS.LineBottom=AscCommon.CorrectMMToTwips(Bottom);PRS.LineTop2=AscCommon.CorrectMMToTwips(Top2);PRS.LineBottom2=AscCommon.CorrectMMToTwips(Bottom2);PRS.LinePrevBottom=AscCommon.CorrectMMToTwips(PrevBottom)};Paragraph.prototype.private_RecalculateLineBottomBound=function(CurLine,CurPage,PRS,ParaPr){var Top=PRS.LineTop;var Bottom2=PRS.LineBottom2;if(true===this.Parent.IsTableCellContent())Bottom2=PRS.LineBottom; var LineInfo=this.Lines[CurLine].Info;var BreakPageLineEmpty=LineInfo¶lineinfo_BreakPage&&LineInfo¶lineinfo_Empty&&!(LineInfo¶lineinfo_End)?true:false;PRS.BreakPageLineEmpty=BreakPageLineEmpty;var RealCurPage=this.private_GetRelativePageIndex(CurPage)-this.Get_StartPage_Relative();var YLimit=PRS.YLimit;var oTopDocument=PRS.TopDocument;var bNoFootnotes=true;if(oTopDocument instanceof CDocument){var nHeight=oTopDocument.Footnotes.GetHeight(PRS.PageAbs,PRS.ColumnAbs);if(nHeight>.001){bNoFootnotes= false;if(true!==PRS.IsInTable())YLimit-=nHeight}}else if(oTopDocument instanceof CFootEndnote){var oController=oTopDocument.GetParent();if(oController instanceof CEndnotesController||!oController.IsEmptyPageColumn(PRS.PageAbs,PRS.ColumnAbs,oTopDocument.GetSectionIndex()))bNoFootnotes=false}if(true===this.UseLimit()&&(Top>YLimit||Bottom2>YLimit)&&(CurLine!=this.Pages[CurPage].FirstLine||false===bNoFootnotes||0===RealCurPage&&(null!=this.Get_DocumentPrev()&&!this.Parent.IsElementStartOnNewPage(this.GetIndex())|| true===this.Parent.IsTableCellContent()&&true!==this.Parent.IsTableFirstRowOnNewPage()||true===this.Parent.IsBlockLevelSdtContent()&&true!==this.Parent.IsBlockLevelSdtFirstOnNewPage()))&&false===BreakPageLineEmpty){this.private_RecalculateMoveLineToNextPage(CurLine,CurPage,PRS,ParaPr);return false}return true};Paragraph.prototype.private_RecalculateLineCheckRanges=function(CurLine,CurPage,PRS,ParaPr){var Right=this.Pages[CurPage].XLimit-ParaPr.Ind.Right;var Top=PRS.LineTop;var Bottom=PRS.LineBottom; var Top2=PRS.LineTop2;var Bottom2=PRS.LineBottom2;var Left;if(true===PRS.MathNotInline)Left=this.Pages[CurPage].X;else Left=false===PRS.UseFirstLine?this.Pages[CurPage].X+ParaPr.Ind.Left:this.Pages[CurPage].X+ParaPr.Ind.Left+ParaPr.Ind.FirstLine;var PageFields=null;if(this.bFromDocument&&PRS.GetTopDocument()===this.LogicDocument&&!PRS.IsInTable())PageFields=this.LogicDocument.Get_ColumnFields(PRS.GetTopIndex(),this.Get_AbsoluteColumn(CurPage),this.GetAbsolutePage(CurPage));else PageFields=this.Parent.Get_ColumnFields? this.Parent.Get_ColumnFields(this.Get_Index(),this.Get_AbsoluteColumn(CurPage),this.GetAbsolutePage(CurPage)):this.Parent.Get_PageFields(this.private_GetRelativePageIndex(CurPage));var Ranges=PRS.Ranges;var Ranges2;for(var nIndex=0,nCount=Ranges.length;nIndex=AscCommon.document_compatibility_mode_Word15){Bottom=Bottom2; Top2=Top}if(true===this.Use_Wrap())Ranges2=this.Parent.CheckRange(Left,Top,Right,Bottom,Top2,Bottom2,PageFields.X,PageFields.XLimit,this.private_GetRelativePageIndex(CurPage),true,PRS.MathNotInline);else Ranges2=[];if(-1===FlowObjects_CompareRanges(Ranges,Ranges2)&&true===FlowObjects_CheckInjection(Ranges,Ranges2)&&false===PRS.BreakPageLineEmpty){PRS.Ranges=Ranges2;PRS.RangesCount=Ranges2.length;PRS.RecalcResult=recalcresult_CurLine;if(this.Lines[CurLine].Info¶lineinfo_RangeY)PRS.RangeY=true; return false}return true};Paragraph.prototype.private_RecalculateLineBaseLine=function(CurLine,CurPage,PRS,ParaPr){if(this.Lines[CurLine].Info¶lineinfo_RangeY)this.Lines[CurLine].Y=PRS.Y-this.Pages[CurPage].Y;else if(CurLine>0){if(CurLine!=this.Pages[CurPage].FirstLine&&(true===PRS.End||true!==PRS.EmptyLine||PRS.RangesCount<=0||true===PRS.NewPage))PRS.Y+=this.Lines[CurLine-1].Metrics.Descent+this.Lines[CurLine-1].Metrics.LineGap+this.Lines[CurLine].Metrics.Ascent;this.Lines[CurLine].Y=PRS.Y-this.Pages[CurPage].Y}else this.Lines[0].Y= 0;this.Lines[CurLine].Y+=PRS.BaseLineOffset;if(this.Lines[CurLine].Metrics.LineGap<0)this.Lines[CurLine].Y+=this.Lines[CurLine].Metrics.LineGap};Paragraph.prototype.private_RecalculateLineCheckRangeY=function(CurLine,CurPage,PRS,ParaPr){if(PRS.RecalcResult&recalcresult_NextPage)return false;if(true===PRS.EmptyLine&&true===PRS.bMathRangeY){PRS.bMathRangeY=false;PRS.RangeY=true;PRS.Reset_Ranges();PRS.RecalcResult=recalcresult_CurLine;return false}else if(true!==PRS.End&&true===PRS.EmptyLine&&PRS.RangesCount> 0){var Ranges=PRS.Ranges;var RangesMaxY=Ranges[0].Y1;for(var Index=1;IndexRanges[Index].Y1)RangesMaxY=Ranges[Index].Y1;if(Math.abs(RangesMaxY-PRS.Y)<.001)PRS.Y=RangesMaxY+1;else PRS.Y=RangesMaxY+AscCommon.TwipsToMM(1)+.001;PRS.RangeY=true;PRS.Reset_Ranges();PRS.RecalcResult=recalcresult_CurLine;return false}return true};Paragraph.prototype.private_RecalculateLineEnd=function(CurLine,CurPage,PRS,ParaPr){if(true===PRS.NewPage){this.Pages[CurPage].Set_EndLine(CurLine); PRS.RecalcResult=recalcresult_NextPage;return false}if(true!==PRS.End){if(true===PRS.ForceNewPage){this.Pages[CurPage].Set_EndLine(CurLine-1);if(0===CurLine)this.Lines[-1]=new CParaLine;PRS.RecalcResult=recalcresult_NextPage;return false}}else{if(PRS.Range=1&&false===this.private_CheckSkipKeepLinesAndWidowControl(CurPage)){var BreakPagePrevLine=this.Lines[CurLine- 1].Info¶lineinfo_BreakPage|0;if(this.Parent instanceof CDocument&&true===this.Parent.RecalcInfo.Can_RecalcWidowControl()&&0===BreakPagePrevLine&&(1===CurPage&&null!=this.Get_DocumentPrev())&&this.Lines[CurLine-1].Ranges.length<=1){var bBreakPageFromStart=false;for(var Index=0,Count=this.Pages[CurPage-1].Drawings.length;Index=CurLine-1){bBreakPageFromStart=true;break}}if(true===bBreakPageFromStart|| CurLine<=2){CurLine=0;this.Recalculate_Drawing_AddPageBreak(0,0,true)}else CurLine=CurLine-1;this.Parent.RecalcInfo.Set_WidowControl(this,CurLine);PRS.RecalcResult=recalcresult_PrevPage|recalcresultflags_Column;return false}}if(para_End===this.Numbering.Item.Type&&this.Lines[CurLine].Info¶lineinfo_BreakPage){this.Numbering.Item=null;this.Numbering.Run=null;this.Numbering.Line=-1;this.Numbering.Range=-1}this.Pages[CurPage].Set_EndLine(CurLine);PRS.RecalcResult=recalcresult_NextElement}return true}; Paragraph.prototype.private_RecalculateLineAlign=function(CurLine,CurPage,PRS,ParaPr,Fast){var PRSW=PRS;var PRSC=this.m_oPRSC;var PRSA=this.m_oPRSA;PRSA.Paragraph=this;PRSA.LastW=0;PRSA.RecalcFast=Fast;PRSA.RecalcResult=recalcresult_NextElement;PRSA.PageY=this.Pages[CurPage].Bounds.Top;PRSA.PageX=this.Pages[CurPage].Bounds.Left;var Line=this.Lines[CurLine];var RangesCount=Line.Ranges.length;var isDoNotExpandShiftReturn=this.LogicDocument?this.LogicDocument.IsDoNotExpandShiftReturn():false;for(var CurRange= 0;CurRange1)&&PRSC.Letters>1)JustifyWord=(RangeWidth-Range.W)/(PRSC.Letters-1)}else if(0==CurRange||Line.Info¶lineinfo_End);else if(CurRange==RangesCount-1)X=Range.X+ RangeWidth-Range.W;else X=Range.X+(RangeWidth-Range.W)/2;else if(PRSC.Spaces>0&&(!(Line.Info¶lineinfo_End)||CurRange!=Line.Ranges.length-1))JustifySpace=(RangeWidth-Range.W)/PRSC.Spaces;else JustifySpace=0;break}default:{X=Range.X;break}}if(CurLine===this.ParaEnd.Line&&CurRange===this.ParaEnd.Range||this.Lines[CurLine].Info¶lineinfo_BreakLine&&isDoNotExpandShiftReturn){JustifyWord=0;JustifySpace=0}}Range.Spaces=PRSC.Spaces+PRSC.SpacesSkip;PRSA.X=X;PRSA.Y=this.Pages[CurPage].Y+this.Lines[CurLine].Y; PRSA.XEnd=Range.XEnd;PRSA.JustifyWord=JustifyWord;PRSA.JustifySpace=JustifySpace;PRSA.SpacesCounter=PRSC.Spaces;PRSA.SpacesSkip=PRSC.SpacesSkip;PRSA.LettersSkip=PRSC.LettersSkip;PRSA.RecalcResult=recalcresult_NextElement;var _LineMetrics=this.Lines[CurLine].Metrics;PRSA.Y0=this.Pages[CurPage].Y+this.Lines[CurLine].Y-_LineMetrics.Ascent;PRSA.Y1=this.Pages[CurPage].Y+this.Lines[CurLine].Y+_LineMetrics.Descent;if(_LineMetrics.LineGap<0)PRSA.Y1+=_LineMetrics.LineGap;this.Lines[CurLine].Ranges[CurRange].XVisible= X;if(0===CurRange)this.Lines[CurLine].X=X-PRSW.XStart;if(true===this.Numbering.Check_Range(CurRange,CurLine))PRSA.X+=this.Numbering.WidthVisible;for(var Pos=StartPos;Pos<=EndPos;Pos++){var Item=this.Content[Pos];Item.Recalculate_Range_Spaces(PRSA,CurLine,CurRange,CurPage);if(!(PRSA.RecalcResult&recalcresult_NextElement)){PRSW.RecalcResult=PRSA.RecalcResult;return PRSA.RecalcResult}}}return PRSA.RecalcResult};Paragraph.prototype.private_RecalculateLineCheckFootnotes=function(CurLine,CurPage,PRS,ParaPr){if(!(PRS.RecalcResult& recalcresult_NextElement||PRS.RecalcResult&recalcresult_NextLine))return false;if(PRS.Fast)return true;var oTopDocument=PRS.TopDocument;var arrFootnotes=[];var oLineBreakPos=this.GetLineEndPos(CurLine);for(var nIndex=0,nCount=PRS.Footnotes.length;nIndex0)StartPos=this.Lines[CurLine].Ranges[CurRange- 1].EndPos;else StartPos=this.Lines[CurLine-1].Ranges[this.Lines[CurLine-1].Ranges.length-1].EndPos;var Line=this.Lines[CurLine];var Range=Line.Ranges[CurRange];this.Lines[CurLine].Set_RangeStartPos(CurRange,StartPos);if(true===PRS.UseFirstLine&&0!==CurRange&&true===PRS.EmptyLine)if(ParaPr.Ind.FirstLine<0)Range.X+=ParaPr.Ind.Left+ParaPr.Ind.FirstLine;else Range.X+=ParaPr.Ind.FirstLine;var X=Range.X;var XEnd=CurRange==RangesCount?PRS.XLimit:PRS.Ranges[CurRange].X0;PRS.Reset_Range(X,XEnd);var ContentLen= this.Content.length;var Pos=StartPos;for(;Pos=ContentLen)Pos= ContentLen-1;if(PRS.RecalcResult&recalcresult_NextLine)if(true===PRS.MoveToLBP)this.private_RecalculateRangeEndPos(PRS,PRS.LineBreakPos,0);else this.Lines[CurLine].Set_RangeEndPos(CurRange,Pos)};Paragraph.prototype.private_RecalculateRangeEndPos=function(PRS,PRP,Depth){var CurLine=PRS.Line;var CurRange=PRS.Range;var CurPos=PRP.Get(Depth);this.Content[CurPos].Recalculate_Set_RangeEndPos(PRS,PRP,Depth+1);this.Lines[CurLine].Set_RangeEndPos(CurRange,CurPos)};Paragraph.prototype.private_RecalculateGetTabPos= function(X,ParaPr,CurPage,NumTab){var PRS=this.m_oPRSW;var PageStart=this.Parent.Get_PageContentStartPos2(this.PageNum,this.ColumnNum,CurPage,this.Index);if(undefined!=this.Get_FramePr())PageStart.X=0;else if(PRS.RangesCount>0&&Math.abs(PRS.Ranges[0].X0-PageStart.X)<.001)PageStart.X=PRS.Ranges[0].X1;var TabsCount=ParaPr.Tabs.Get_Count();var TabsPos=[];var bCheckLeft=true;for(var Index=0;Index PageStart.X+ParaPr.Ind.Left){TabsPos.push(new CParaTab(tab_Left,ParaPr.Ind.Left));bCheckLeft=false}if(tab_Clear!=Tab.Value)TabsPos.push(Tab)}if(true===bCheckLeft)TabsPos.push(new CParaTab(tab_Left,ParaPr.Ind.Left));TabsCount=TabsPos.length;var Tab=null;for(var Index=0;Index=NewX-.001)NewX+=DefTab}var twX=AscCommon.MMToTwips(X);var twEndPos=AscCommon.MMToTwips(PageStart.XLimit);var twNewX=AscCommon.MMToTwips(NewX);if(twX=twEndPos&&AscCommon.MMToTwips(ParaPr.Ind.Right)<=0){NewX=PageStart.XLimit;isTabToRightEdge=true}}else NewX= Tab.Pos+PageStart.X;return{NewX:NewX,TabValue:Tab?Tab.Value:tab_Left,DefaultTab:Tab?false:true,TabLeader:Tab?Tab.Leader:Asc.c_oAscTabLeader.None,TabRightEdge:isTabToRightEdge,PageX:PageStart.X,PageXLimit:PageStart.XLimit}};Paragraph.prototype.private_CheckSkipKeepLinesAndWidowControl=function(CurPage){var bSkipWidowAndKeepLines=false;if(this.ColumnsCount>1){var bWrapDrawing=false;for(var TempPage=0;TempPage<=CurPage;++TempPage){for(var DrawingIndex=0,DrawingsCount=this.Pages[TempPage].Drawings.length;DrawingIndex< DrawingsCount;++DrawingIndex)if(this.Pages[TempPage].Drawings[DrawingIndex].Use_TextWrap()){bWrapDrawing=true;break}if(bWrapDrawing)break}bSkipWidowAndKeepLines=bWrapDrawing}return bSkipWidowAndKeepLines};Paragraph.prototype.private_CheckColumnBreak=function(CurPage){if(this.IsEmptyPage(CurPage))return;var Page=this.Pages[CurPage];var Line=this.Lines[Page.EndLine];if(!Line)return;if(Line.Info¶lineinfo_BreakPage&&!(Line.Info¶lineinfo_BreakRealPage))if(this.bFromDocument&&this.LogicDocument)this.LogicDocument.OnColumnBreak_WhileRecalculate()}; Paragraph.prototype.private_RecalculateMoveLineToNextPage=function(CurLine,CurPage,PRS,ParaPr){var bSkipWidowAndKeepLines=this.private_CheckSkipKeepLinesAndWidowControl(CurPage);if(this.Parent instanceof CDocument&&false===bSkipWidowAndKeepLines&&true===this.Parent.RecalcInfo.Can_RecalcWidowControl()&&true===ParaPr.WidowControl&&CurLine-this.Pages[CurPage].StartLine<=1&&CurLine>=1&&true!=PRS.BreakPageLine&&(0===CurPage&&null!=this.Get_DocumentPrev())){this.Recalculate_Drawing_AddPageBreak(0,0,true); this.Parent.RecalcInfo.Set_WidowControl(this,CurLine-1);PRS.RecalcResult=recalcresult_CurPage|recalcresultflags_Column;return false}else{if(true===ParaPr.KeepLines&&this.LogicDocument&&this.LogicDocument.GetCompatibilityMode&&false===bSkipWidowAndKeepLines){var CompatibilityMode=this.LogicDocument.GetCompatibilityMode();if(CompatibilityMode<=AscCommon.document_compatibility_mode_Word14){if(null!=this.Get_DocumentPrev()&&true!=this.Parent.IsTableCellContent()&&0===CurPage){CurLine=0;PRS.RunRecalcInfoBreak= null}}else if(CompatibilityMode>=AscCommon.document_compatibility_mode_Word15)if(null!=this.Get_DocumentPrev()&&0===CurPage){CurLine=0;PRS.RunRecalcInfoBreak=null}}this.Pages[CurPage].Bounds.Bottom=PRS.LinePrevBottom;this.Pages[CurPage].Set_EndLine(CurLine-1);if(0===CurLine)this.Lines[-1]=new CParaLine(0);PRS.RecalcResult=recalcresult_NextPage;return false}};Paragraph.prototype.private_CheckNeedBeforeSpacing=function(CurPage,Parent,PageAbs,ParaPr){if(CurPage<=0)return true;if(!this.Check_FirstPage(CurPage))if(this.Check_FirstPage(CurPage, true))return true;else return false;if(this.LogicDocument&&this.LogicDocument.GetCompatibilityMode&&this.LogicDocument.GetCompatibilityMode()<=AscCommon.document_compatibility_mode_Word14&&true===ParaPr.PageBreakBefore)return true;if(!(Parent instanceof CDocument)){if(Parent instanceof AscFormat.CDrawingDocContent&&0!==CurPage)return false;return true}var LogicDocument=Parent;var SectionIndex=LogicDocument.GetSectionIndexByElementIndex(this.Get_Index());var FirstElement=LogicDocument.GetFirstElementInSection(SectionIndex); if(0!==SectionIndex&&(!FirstElement||FirstElement.Get_AbsolutePage(0)===PageAbs))return true;return false};var ERecalcPageType={START:0,ELEMENT:1,Y:2};function CRecalcPageType(){this.Type=ERecalcPageType.START;this.Element=null;this.Y=-1}CRecalcPageType.prototype.Reset=function(){this.Type=ERecalcPageType.START;this.Element=null;this.Y=-1};CRecalcPageType.prototype.Set_Element=function(Element){this.Type=ERecalcPageType.Element;this.Element=Element};CRecalcPageType.prototype.Set_Y=function(Y){this.Type= ERecalcPageType.Y;this.Y=Y};var paralineinfo_BreakPage=1;var paralineinfo_Empty=2;var paralineinfo_End=4;var paralineinfo_RangeY=8;var paralineinfo_BreakRealPage=16;var paralineinfo_BadLeftTab=32;var paralineinfo_Notes=64;var paralineinfo_TextOnLine=128;var paralineinfo_BreakLine=256;function CParaLine(){this.Y=0;this.Top=0;this.Bottom=0;this.Metrics=new CParaLineMetrics;this.Ranges=[];this.Info=0}CParaLine.prototype={Add_Range:function(X,XEnd){this.Ranges.push(new CParaLineRange(X,XEnd))},Shift:function(Dx, Dy){for(var CurRange=0,RangesCount=this.Ranges.length;CurRangethis.TextAscent)this.TextAscent=TextAscent;if(TextAscent2>this.TextAscent2)this.TextAscent2=TextAscent2;if(TextDescent>this.TextDescent)this.TextDescent=TextDescent;if(Ascent>this.Ascent)this.Ascent= Ascent;if(Descent>this.Descent)this.Descent=Descent;if(this.Ascentthis.TextAscent+this.TextDescent){this.Ascent=this.Ascent+this.LineGap;this.LineGap=0}},Recalculate_LineGap:function(ParaPr,TextAscent,TextDescent){var LineGap= 0;switch(ParaPr.Spacing.LineRule){case Asc.linerule_Auto:{LineGap=(TextAscent+TextDescent)*(ParaPr.Spacing.Line-1);break}case Asc.linerule_Exact:{var ExactValue=Math.max(25.4/72,ParaPr.Spacing.Line);LineGap=ExactValue-(TextAscent+TextDescent);var Gap=this.Ascent+this.Descent-ExactValue;if(Gap>0){var DescentDiff=this.Descent-this.TextDescent;if(DescentDiff>0)if(DescentDiff 0)if(AscentDiff0){var OldTA=this.TextAscent;var OldTD=this.TextDescent;var Sum=OldTA+OldTD;this.Ascent=OldTA*(Sum-Gap)/Sum;this.Descent=OldTD*(Sum-Gap)/Sum}}else this.Ascent-=Gap;LineGap=0;break}case Asc.linerule_AtLeast:{var TargetLineGap=ParaPr.Spacing.Line;var TextLineGap=TextAscent+TextDescent;var RealLineGap=this.Ascent+this.Descent;if(Math.abs(TextLineGap)<.001||RealLineGap>=TargetLineGap)LineGap=0;else LineGap= TargetLineGap-RealLineGap;break}}return LineGap}};function CParaLineRange(X,XEnd){this.X=X;this.XVisible=0;this.XEnd=XEnd;this.StartPos=0;this.EndPos=0;this.W=0;this.Spaces=0;this.WEnd=0;this.WBreak=0}CParaLineRange.prototype={Shift:function(Dx,Dy){this.X+=Dx;this.XEnd+=Dx;this.XVisible+=Dx},Copy:function(){var NewRange=new CParaLineRange;NewRange.X=this.X;NewRange.XVisible=this.XVisible;NewRange.XEnd=this.XEnd;NewRange.StartPos=this.StartPos;NewRange.EndPos=this.EndPos;NewRange.W=this.W;NewRange.Spaces= this.Spaces;return NewRange}};function CParaPage(X,Y,XLimit,YLimit,FirstLine){this.X=X;this.Y=Y;this.XLimit=XLimit;this.YLimit=YLimit;this.FirstLine=FirstLine;this.Bounds=new CDocumentBounds(X,Y,XLimit,Y);this.StartLine=FirstLine;this.EndLine=FirstLine;this.TextPr=null;this.Drawings=[];this.EndInfo=new CParagraphPageEndInfo}CParaPage.prototype={Reset:function(X,Y,XLimit,YLimit,FirstLine){this.X=X;this.Y=Y;this.XLimit=XLimit;this.YLimit=YLimit;this.FirstLine=FirstLine;this.Bounds=new CDocumentBounds(X, Y,XLimit,Y);this.StartLine=FirstLine;this.Drawings=[]},Shift:function(Dx,Dy){this.X+=Dx;this.Y+=Dy;this.XLimit+=Dx;this.YLimit+=Dy;this.Bounds.Shift(Dx,Dy)},Set_EndLine:function(EndLine){this.EndLine=EndLine},Add_Drawing:function(Item){this.Drawings.push(Item)},Copy:function(){var NewPage=new CParaPage;NewPage.X=this.X;NewPage.Y=this.Y;NewPage.XLimit=this.XLimit;NewPage.YLimit=this.YLimit;NewPage.FirstLine=this.FirstLine;NewPage.Bounds.Left=this.Bounds.Left;NewPage.Bounds.Right=this.Bounds.Right; NewPage.Bounds.Top=this.Bounds.Top;NewPage.Bounds.Bottom=this.Bounds.Bottom;NewPage.StartLine=this.StartLine;NewPage.EndLine=this.EndLine;var Count=this.Drawings.length;for(var Index=0;Index780)BulletNum=BulletNum%780;if(BulletNum>32767)BulletNum=BulletNum%32767;NumberingItem.Bullet=Bullet;NumberingItem.BulletNum=BulletNum;NumberingItem.Measure(g_oTextMeasurer,FirstTextPr,Para.Get_Theme(),Para.Get_ColorMap());if(!Bullet.IsNone())if(ParaPr.Ind.FirstLine<0)NumberingItem.WidthVisible= Math.max(NumberingItem.Width,Para.Pages[CurPage].X+ParaPr.Ind.Left+ParaPr.Ind.FirstLine-X,Para.Pages[CurPage].X+ParaPr.Ind.Left-X);else NumberingItem.WidthVisible=Math.max(Para.Pages[CurPage].X+ParaPr.Ind.Left+NumberingItem.Width-X,Para.Pages[CurPage].X+ParaPr.Ind.Left+ParaPr.Ind.FirstLine-X,Para.Pages[CurPage].X+ParaPr.Ind.Left-X);X+=NumberingItem.WidthVisible}NumberingItem.Item=Item;NumberingItem.Run=Run;NumberingItem.Line=CurLine;NumberingItem.Range=CurRange;NumberingItem.LineAscent=LineAscent; NumberingItem.Page=CurPage;return X}};CParagraphRecalculateStateWrap.prototype.IsFast=function(){return this.Fast};CParagraphRecalculateStateWrap.prototype.AddFootnoteReference=function(oFootnoteReference,oPos){for(var nIndex=0,nCount=this.Footnotes.length;nIndex0)this.TopIndex=arrPos[0].Position}return this.TopIndex};CParagraphRecalculateStateWrap.prototype.ResetMathRecalcInfo=function(){this.MathRecalcInfo.Line=0;this.MathRecalcInfo.Math=null};CParagraphRecalculateStateWrap.prototype.SetMathRecalcInfo= function(nLine,oMath){this.MathRecalcInfo.Line=nLine;this.MathRecalcInfo.Math=oMath};CParagraphRecalculateStateWrap.prototype.GetMathRecalcInfoObject=function(){return this.MathRecalcInfo.Math};CParagraphRecalculateStateWrap.prototype.SetMathRecalcInfoObject=function(oMath){this.MathRecalcInfo.Math=oMath};CParagraphRecalculateStateWrap.prototype.GetMathRecalcInfoLine=function(){return this.MathRecalcInfo.Line};CParagraphRecalculateStateWrap.prototype.SetMathRecalcInfoLine=function(nLine){this.MathRecalcInfo.Line= nLine};CParagraphRecalculateStateWrap.prototype.IsCondensedSpaces=function(){return this.CondensedSpaces};CParagraphRecalculateStateWrap.prototype.AddCondensedSpaceToRange=function(oSpace){this.RangeSpaces.push(oSpace);oSpace.ResetCondensedWidth()};CParagraphRecalculateStateWrap.prototype.TryCondenseSpaces=function(nWidth1,nWidth2,nX,nXLimit){if(!this.CondensedSpaces)return false;var nKoef=1-.25*(Math.min(12.5,nWidth1)/12.5);var nSumSpaces=0;for(var nIndex=0,nCount=this.RangeSpaces.length;nIndex< nCount;++nIndex)nSumSpaces+=this.RangeSpaces[nIndex].WidthOrigin/TEXTWIDTH_DIVIDER;var nSpace=nSumSpaces*(1-nKoef);if(nX-nSpace+nWidth10?true:false};CParagraphRecalculateStateInfo.prototype.IsComplexFieldCode=function(){if(!this.IsComplexField())return false;for(var nIndex=0,nCount=this.ComplexFields.length;nIndex0){oChar.SetUse(true);var oComplexField=this.ComplexFields[this.ComplexFields.length-1].ComplexField;oComplexField.SetEndChar(oChar);this.ComplexFields.splice(this.ComplexFields.length-1,1);if(this.ComplexFields.length>0&&this.ComplexFields[this.ComplexFields.length- 1].IsFieldCode())this.ComplexFields[this.ComplexFields.length-1].ComplexField.SetInstructionCF(oComplexField)}else oChar.SetUse(false);else if(oChar.IsSeparate())if(this.ComplexFields.length>0){oChar.SetUse(true);var oComplexField=this.ComplexFields[this.ComplexFields.length-1].ComplexField;oComplexField.SetSeparateChar(oChar);this.ComplexFields[this.ComplexFields.length-1].SetFieldCode(false)}else oChar.SetUse(false)};CParagraphRecalculateStateInfo.prototype.ProcessInstruction=function(oInstruction){if(this.ComplexFields.length<= 0)return;var oComplexField=this.ComplexFields[this.ComplexFields.length-1].ComplexField;if(oComplexField&&null===oComplexField.GetSeparateChar())oComplexField.SetInstruction(oInstruction)};function CParagraphRecalculateObject(){this.X=0;this.Y=0;this.XLimit=0;this.YLimit=0;this.Pages=[];this.Lines=[];this.Content=[]}CParagraphRecalculateObject.prototype={Save:function(Para){this.X=Para.X;this.Y=Para.Y;this.XLimit=Para.XLimit;this.YLimit=Para.YLimit;this.Pages=Para.Pages;this.Lines=Para.Lines;var Content= Para.Content;var Count=Content.length;for(var Index=0;Index.001||Math.abs(ThisPS.H-OtherPS.H)>.001||ThisPS.Orient!==OtherPS.Orient)return false;return true},Set_Type:function(Type){if(this.Type!== Type){History.Add(new CChangesSectionType(this,this.Type,Type));this.Type=Type}},Get_Type:function(){return this.Type},Set_Borders_Left:function(Border){if(true!==this.Borders.Left.Compare(Border)){History.Add(new CChangesSectionBordersLeft(this,this.Borders.Left,Border));this.Borders.Left=Border}},Get_Borders_Left:function(){return this.Borders.Left},Set_Borders_Top:function(Border){if(true!==this.Borders.Top.Compare(Border)){History.Add(new CChangesSectionBordersTop(this,this.Borders.Top,Border)); this.Borders.Top=Border}},Get_Borders_Top:function(){return this.Borders.Top},Set_Borders_Right:function(Border){if(true!==this.Borders.Right.Compare(Border)){History.Add(new CChangesSectionBordersRight(this,this.Borders.Right,Border));this.Borders.Right=Border}},Get_Borders_Right:function(){return this.Borders.Right},Set_Borders_Bottom:function(Border){if(true!==this.Borders.Bottom.Compare(Border)){History.Add(new CChangesSectionBordersBottom(this,this.Borders.Bottom,Border));this.Borders.Bottom= Border}},Get_Borders_Bottom:function(){return this.Borders.Bottom},Set_Borders_Display:function(Display){if(Display!==this.Borders.Display){History.Add(new CChangesSectionBordersDisplay(this,this.Borders.Display,Display));this.Borders.Display=Display}},Get_Borders_Display:function(){return this.Borders.Display},Set_Borders_ZOrder:function(ZOrder){if(ZOrder!==this.Borders.ZOrder){History.Add(new CChangesSectionBordersZOrder(this,this.Borders.ZOrder,ZOrder));this.Borders.ZOrder=ZOrder}},Get_Borders_ZOrder:function(){return this.Borders.ZOrder}, Set_Footer_First:function(Footer){if(Footer!==this.FooterFirst){History.Add(new CChangesSectionFooterFirst(this,this.FooterFirst,Footer));this.FooterFirst=Footer}},Get_Footer_First:function(){return this.FooterFirst},Set_Footer_Even:function(Footer){if(Footer!==this.FooterEven){History.Add(new CChangesSectionFooterEven(this,this.FooterEven,Footer));this.FooterEven=Footer}},Get_Footer_Even:function(){return this.FooterEven},Set_Footer_Default:function(Footer){if(Footer!==this.FooterDefault){History.Add(new CChangesSectionFooterDefault(this, this.FooterDefault,Footer));this.FooterDefault=Footer}},Get_Footer_Default:function(){return this.FooterDefault},Set_Header_First:function(Header){if(Header!==this.HeaderFirst){History.Add(new CChangesSectionHeaderFirst(this,this.HeaderFirst,Header));this.HeaderFirst=Header}},Get_Header_First:function(){return this.HeaderFirst},Set_Header_Even:function(Header){if(Header!==this.HeaderEven){History.Add(new CChangesSectionHeaderEven(this,this.HeaderEven,Header));this.HeaderEven=Header}},Get_Header_Even:function(){return this.HeaderEven}, Set_Header_Default:function(Header){if(Header!==this.HeaderDefault){History.Add(new CChangesSectionHeaderDefault(this,this.HeaderDefault,Header));this.HeaderDefault=Header}},Get_Header_Default:function(){return this.HeaderDefault},Set_TitlePage:function(Value){if(Value!==this.TitlePage){History.Add(new CChangesSectionTitlePage(this,this.TitlePage,Value));this.TitlePage=Value}},Get_TitlePage:function(){return this.TitlePage},GetHdrFtr:function(bHeader,bFirst,bEven){if(true===bHeader)if(true===bFirst)return this.HeaderFirst; else if(true===bEven)return this.HeaderEven;else return this.HeaderDefault;else if(true===bFirst)return this.FooterFirst;else if(true===bEven)return this.FooterEven;else return this.FooterDefault},Set_HdrFtr:function(bHeader,bFirst,bEven,HdrFtr){if(true===bHeader)if(true===bFirst)return this.Set_Header_First(HdrFtr);else if(true===bEven)return this.Set_Header_Even(HdrFtr);else return this.Set_Header_Default(HdrFtr);else if(true===bFirst)return this.Set_Footer_First(HdrFtr);else if(true===bEven)return this.Set_Footer_Even(HdrFtr); else return this.Set_Footer_Default(HdrFtr)},GetHdrFtrInfo:function(HdrFtr){if(HdrFtr===this.HeaderFirst)return{Header:true,First:true,Even:false};else if(HdrFtr===this.HeaderEven)return{Header:true,First:false,Even:true};else if(HdrFtr===this.HeaderDefault)return{Header:true,First:false,Even:false};else if(HdrFtr===this.FooterFirst)return{Header:false,First:true,Even:false};else if(HdrFtr===this.FooterEven)return{Header:false,First:false,Even:true};else if(HdrFtr===this.FooterDefault)return{Header:false, First:false,Even:false};return null},Set_PageNum_Start:function(Start){if(Start!==this.PageNumType.Start){History.Add(new CChangesSectionPageNumTypeStart(this,this.PageNumType.Start,Start));this.PageNumType.Start=Start}},Get_PageNum_Start:function(){return this.PageNumType.Start},Get_ColumnsCount:function(){return this.Columns.Get_Count()},Get_ColumnWidth:function(ColIndex){return this.Columns.Get_ColumnWidth(ColIndex)},Get_ColumnSpace:function(ColIndex){return this.Columns.Get_ColumnSpace(ColIndex)}, Get_ColumnsSep:function(){return this.Columns.Sep},Set_Columns_EqualWidth:function(Equal){if(Equal!==this.Columns.Equal){History.Add(new CChangesSectionColumnsEqualWidth(this,this.Columns.EqualWidth,Equal));this.Columns.EqualWidth=Equal}},Set_Columns_Space:function(Space){if(Space!==this.Columns.Space){History.Add(new CChangesSectionColumnsSpace(this,this.Columns.Space,Space));this.Columns.Space=Space}},Set_Columns_Num:function(_Num){var Num=Math.max(_Num,1);if(Num!==this.Columns.Num){History.Add(new CChangesSectionColumnsNum(this, this.Columns.Num,Num));this.Columns.Num=Num}},Set_Columns_Sep:function(Sep){if(Sep!==this.Columns.Sep){History.Add(new CChangesSectionColumnsSep(this,this.Columns.Sep,Sep));this.Columns.Sep=Sep}},Set_Columns_Cols:function(Cols){History.Add(new CChangesSectionColumnsSetCols(this,this.Columns.Cols,Cols));this.Columns.Cols=Cols},Set_Columns_Col:function(Index,W,Space){var OldCol=this.Columns.Cols[Index];if(undefined===OldCol||OldCol.Space!==Space||OldCol.W!==W){var NewCol=new CSectionColumn;NewCol.W= W;NewCol.Space=Space;History.Add(new CChangesSectionColumnsCol(this,OldCol,NewCol,Index));this.Columns.Cols[Index]=NewCol}},Get_LayoutInfo:function(){var Margins=this.PageMargins;var H=this.PageSize.H;var _W=this.PageSize.W;var W=_W-Margins.Left-Margins.Right;if(W<0)W=10;var Columns=this.Columns;var Layout=new CSectionLayoutInfo(Margins.Left,Margins.Top,_W-Margins.Right,H-Margins.Bottom);var ColumnsInfo=Layout.Columns;if(true===Columns.EqualWidth){var Num=Math.max(Columns.Num,1);var Space=Columns.Space; var ColW=(W-Space*(Num-1))/Num;if(ColW<0){ColW=.3;var __W=W-ColW*Num;if(_W>0&&Num>1)Space=_W/(Num-1);else Space=0}var X=Margins.Left;for(var Pos=0;Pos XLimit){SectionColumn.W=XLimit-X;Cols.push(SectionColumn);X+=SectionColumn.W;break}X+=SectionColumn.W;if(Index!=Count-1)X+=SectionColumn.Space;Cols.push(SectionColumn)}if(SectionColumn&&X.01763)return false}else{var nColumnsCount=oColumnsProps.get_ColsCount();if(nColumnsCount!==this.GetColumnsCount())return false;for(var nIndex=0;nIndex .01763||this.GetColumnSpace(nIndex)!==oCol.get_Space())return false}}return true};CSectionPr.prototype.SetGutter=function(nGutter){if(Math.abs(nGutter-this.PageMargins.Gutter)>.001){History.Add(new CChangesSectionPageMarginsGutter(this,this.PageMargins.Gutter,nGutter));this.PageMargins.Gutter=nGutter}};CSectionPr.prototype.GetGutter=function(){return this.PageMargins.Gutter};CSectionPr.prototype.SetGutterRTL=function(isRTL){if(isRTL!==this.GutterRTL){History.Add(new CChangesSectionGutterRTL(this, this.GutterRTL,isRTL));this.GutterRTL=isRTL}};CSectionPr.prototype.IsGutterRTL=function(){return this.GutterRTL};CSectionPr.prototype.SetPageMargins=function(_L,_T,_R,_B){var L=undefined!==_L?_L:this.PageMargins.Left;var T=undefined!==_T?_T:this.PageMargins.Top;var R=undefined!==_R?_R:this.PageMargins.Right;var B=undefined!==_B?_B:this.PageMargins.Bottom;if(Math.abs(L-this.PageMargins.Left)>.001||Math.abs(T-this.PageMargins.Top)>.001||Math.abs(R-this.PageMargins.Right)>.001||Math.abs(B-this.PageMargins.Bottom)> .001){History.Add(new CChangesSectionPageMargins(this,{L:this.PageMargins.Left,T:this.PageMargins.Top,R:this.PageMargins.Right,B:this.PageMargins.Bottom},{L:L,T:T,R:R,B:B}));this.PageMargins.Left=L;this.PageMargins.Top=T;this.PageMargins.Right=R;this.PageMargins.Bottom=B}};CSectionPr.prototype.GetPageMarginLeft=function(){return this.PageMargins.Left};CSectionPr.prototype.GetPageMarginRight=function(){return this.PageMargins.Right};CSectionPr.prototype.GetPageMarginTop=function(){return this.PageMargins.Top}; CSectionPr.prototype.GetPageMarginBottom=function(){return this.PageMargins.Bottom};CSectionPr.prototype.SetPageSize=function(W,H){if(Math.abs(W-this.PageSize.W)>.001||Math.abs(H-this.PageSize.H)>.001){H=Math.max(2.6,H);W=Math.max(12.7,W);History.Add(new CChangesSectionPageSize(this,{W:this.PageSize.W,H:this.PageSize.H},{W:W,H:H}));this.PageSize.W=W;this.PageSize.H=H}};CSectionPr.prototype.GetPageWidth=function(){return this.PageSize.W};CSectionPr.prototype.GetPageHeight=function(){return this.PageSize.H}; CSectionPr.prototype.SetOrientation=function(Orient,ApplySize){var _Orient=this.GetOrientation();if(_Orient!==Orient){History.Add(new CChangesSectionPageOrient(this,this.PageSize.Orient,Orient));this.PageSize.Orient=Orient;if(true===ApplySize){var W=this.PageSize.W;var H=this.PageSize.H;var L=this.PageMargins.Left;var R=this.PageMargins.Right;var T=this.PageMargins.Top;var B=this.PageMargins.Bottom;this.SetPageSize(H,W);if(Asc.c_oAscPageOrientation.PagePortrait===Orient)this.SetPageMargins(T,R,B, L);else this.SetPageMargins(B,L,T,R)}}};CSectionPr.prototype.GetOrientation=function(){if(this.PageSize.W>this.PageSize.H)return Asc.c_oAscPageOrientation.PageLandscape;return Asc.c_oAscPageOrientation.PagePortrait};CSectionPr.prototype.GetColumnsCount=function(){return this.Columns.Get_Count()};CSectionPr.prototype.GetColumnWidth=function(nColIndex){return this.Columns.Get_ColumnWidth(nColIndex)};CSectionPr.prototype.GetColumnSpace=function(nColIndex){return this.Columns.Get_ColumnSpace(nColIndex)}; CSectionPr.prototype.GetColumnSep=function(){return this.Columns.Sep};CSectionPr.prototype.IsEqualColumnWidth=function(){return this.Columns.EqualWidth};CSectionPr.prototype.SetBordersOffsetFrom=function(nOffsetFrom){if(nOffsetFrom!==this.Borders.OffsetFrom){History.Add(new CChangesSectionBordersOffsetFrom(this,this.Borders.OffsetFrom,nOffsetFrom));this.Borders.OffsetFrom=nOffsetFrom}};CSectionPr.prototype.GetBordersOffsetFrom=function(){return this.Borders.OffsetFrom};CSectionPr.prototype.SetPageMarginHeader= function(nHeader){if(nHeader!==this.PageMargins.Header){History.Add(new CChangesSectionPageMarginsHeader(this,this.PageMargins.Header,nHeader));this.PageMargins.Header=nHeader}};CSectionPr.prototype.GetPageMarginHeader=function(){return this.PageMargins.Header};CSectionPr.prototype.SetPageMarginFooter=function(nFooter){if(nFooter!==this.PageMargins.Footer){History.Add(new CChangesSectionPageMarginsFooter(this,this.PageMargins.Footer,nFooter));this.PageMargins.Footer=nFooter}};CSectionPr.prototype.GetPageMarginFooter= function(){return this.PageMargins.Footer};CSectionPr.prototype.GetContentFrame=function(nPageAbs){var nT=this.GetPageMarginTop();var nB=this.GetPageHeight()-this.GetPageMarginBottom();var nL=this.GetPageMarginLeft();var nR=this.GetPageWidth()-this.GetPageMarginRight();if(nT<0)nT=-nT;if(this.LogicDocument&&this.LogicDocument.IsMirrorMargins()&&1===nPageAbs%2){nL=this.GetPageMarginRight();nR=this.GetPageWidth()-this.GetPageMarginLeft()}var nGutter=this.GetGutter();if(nGutter>.001)if(this.LogicDocument&& this.LogicDocument.IsGutterAtTop())nT+=nGutter;else if(this.LogicDocument&&this.LogicDocument.IsMirrorMargins()&&1===nPageAbs%2)if(this.IsGutterRTL())nL+=nGutter;else nR-=nGutter;else if(this.IsGutterRTL())nR-=nGutter;else nL+=nGutter;return{Left:nL,Top:nT,Right:nR,Bottom:nB}};CSectionPr.prototype.GetContentFrameWidth=function(){var nFrameWidth=this.GetPageWidth()-this.GetPageMarginLeft()-this.GetPageMarginRight();var nGutter=this.GetGutter();if(nGutter>.001&&!(this.LogicDocument&&this.LogicDocument.IsGutterAtTop()))nFrameWidth-= nGutter;return nFrameWidth};CSectionPr.prototype.GetContentFrameHeight=function(){var nFrameHeight=this.GetPageHeight()-this.GetPageMarginTop()-this.GetPageMarginBottom();var nGutter=this.GetGutter();if(nGutter>.001&&this.LogicDocument&&this.LogicDocument.IsGutterAtTop())nFrameHeight-=nGutter;return nFrameHeight};CSectionPr.prototype.HaveLineNumbers=function(){return undefined!==this.LnNumType&&undefined!==this.LnNumType.CountBy&&this.LnNumType.GetStart()>=0};CSectionPr.prototype.SetLineNumbers=function(nCountBy, nDistance,nStart,nRestartType){if(!this.HaveLineNumbers()||nCountBy!==this.GetLineNumbersCountBy()||nDistance!==this.GetLineNumbersDistance()||nStart!==this.GetLineNumbersStart()||nRestartType!==this.GetLineNumbersRestart()){var oLnNumType=new CSectionLnNumType(nCountBy,nDistance,nStart,nRestartType);History.Add(new CChangesSectionLnNumType(this,this.LnNumType,oLnNumType));this.LnNumType=oLnNumType}};CSectionPr.prototype.GetLineNumbers=function(){if(this.HaveLineNumbers())return this.LnNumType;return undefined}; CSectionPr.prototype.RemoveLineNumbers=function(){if(this.LnNumType){History.Add(new CChangesSectionLnNumType(this,this.LnNumType,undefined));this.LnNumType=undefined}};CSectionPr.prototype.GetLineNumbersCountBy=function(){return this.LnNumType&&undefined!==this.LnNumType.CountBy?this.LnNumType.CountBy:1};CSectionPr.prototype.GetLineNumbersStart=function(){return this.LnNumType&&undefined!==this.LnNumType.GetStart()?this.LnNumType.GetStart():0};CSectionPr.prototype.GetLineNumbersRestart=function(){return this.LnNumType&& undefined!==this.LnNumType.Restart?this.LnNumType.Restart:Asc.c_oAscLineNumberRestartType.NewPage};CSectionPr.prototype.GetLineNumbersDistance=function(){return this.LnNumType?this.LnNumType.Distance:undefined};function CSectionPageSize(){this.W=210;this.H=297;this.Orient=Asc.c_oAscPageOrientation.PagePortrait}CSectionPageSize.prototype={Write_ToBinary:function(Writer){Writer.WriteDouble(this.W);Writer.WriteDouble(this.H);Writer.WriteByte(this.Orient)},Read_FromBinary:function(Reader){this.W=Reader.GetDouble(); this.H=Reader.GetDouble();this.Orient=Reader.GetByte()}};function CSectionPageMargins(){this.Left=30;this.Top=20;this.Right=15;this.Bottom=20;this.Gutter=0;this.Header=12.5;this.Footer=12.5}CSectionPageMargins.prototype.Write_ToBinary=function(Writer){Writer.WriteDouble(this.Left);Writer.WriteDouble(this.Top);Writer.WriteDouble(this.Right);Writer.WriteDouble(this.Bottom);Writer.WriteDouble(this.Header);Writer.WriteDouble(this.Footer);Writer.WriteDouble(this.Gutter)};CSectionPageMargins.prototype.Read_FromBinary= function(Reader){this.Left=Reader.GetDouble();this.Top=Reader.GetDouble();this.Right=Reader.GetDouble();this.Bottom=Reader.GetDouble();this.Header=Reader.GetDouble();this.Footer=Reader.GetDouble();this.Gutter=Reader.GetDouble()};function CSectionBorders(){this.Top=new CDocumentBorder;this.Bottom=new CDocumentBorder;this.Left=new CDocumentBorder;this.Right=new CDocumentBorder;this.Display=section_borders_DisplayAllPages;this.OffsetFrom=section_borders_OffsetFromText;this.ZOrder=section_borders_ZOrderFront} CSectionBorders.prototype={Write_ToBinary:function(Writer){this.Left.Write_ToBinary(Writer);this.Top.Write_ToBinary(Writer);this.Right.Write_ToBinary(Writer);this.Bottom.Write_ToBinary(Writer);Writer.WriteByte(this.Display);Writer.WriteByte(this.OffsetFrom);Writer.WriteByte(this.ZOrder)},Read_FromBinary:function(Reader){this.Left.Read_FromBinary(Reader);this.Top.Read_FromBinary(Reader);this.Right.Read_FromBinary(Reader);this.Bottom.Read_FromBinary(Reader);this.Display=Reader.GetByte();this.OffsetFrom= Reader.GetByte();this.ZOrder=Reader.GetByte()}};CSectionBorders.prototype.IsEmptyBorders=function(){if(this.Top.IsNone()&&this.Bottom.IsNone()&&this.Left.IsNone()&&this.Right.IsNone())return true;return false};function CSectionPageNumType(){this.Start=-1}CSectionPageNumType.prototype={Write_ToBinary:function(Writer){Writer.WriteLong(this.Start)},Read_FromBinary:function(Reader){this.Start=Reader.GetLong()}};function CSectionPageNumInfo(FP,CP,bFirst,bEven,PageNum){this.FirstPage=FP;this.CurPage=CP; this.bFirst=bFirst;this.bEven=bEven;this.PageNum=PageNum}CSectionPageNumInfo.prototype={Compare:function(Other){if(undefined===Other||null===Other||this.CurPage!==Other.CurPage||this.bFirst!==Other.bFirst||this.bEven!==Other.bEven||this.PageNum!==Other.PageNum)return false;return true}};function CSectionColumn(){this.W=0;this.Space=0}CSectionColumn.prototype.Write_ToBinary=function(Writer){Writer.WriteDouble(this.W);Writer.WriteDouble(this.Space)};CSectionColumn.prototype.Read_FromBinary=function(Reader){this.W= Reader.GetDouble();this.Space=Reader.GetDouble()};function CSectionColumns(SectPr){this.SectPr=SectPr;this.EqualWidth=true;this.Num=1;this.Sep=false;this.Space=30;this.Cols=[]}CSectionColumns.prototype.Write_ToBinary=function(Writer){Writer.WriteBool(this.EqualWidth);Writer.WriteLong(this.Num);Writer.WriteBool(this.Sep);Writer.WriteDouble(this.Space);var Count=this.Cols.length;Writer.WriteLong(Count);for(var Pos=0;Pos0?(nFrameW-this.Space*(this.Num-1))/this.Num:nFrameW}else{if(this.Cols.length<=0)return 0;ColIndex=Math.max(0,Math.min(this.Cols.length-1,ColIndex));if(ColIndex<0)return 0;return this.Cols[ColIndex].W}};CSectionColumns.prototype.Get_ColumnSpace=function(ColIndex){if(true===this.EqualWidth)return this.Space;else{if(this.Cols.length<=0)return this.Space;ColIndex=Math.max(0,Math.min(this.Cols.length-1,ColIndex));if(ColIndex< 0)return this.Space;return this.Cols[ColIndex].Space}};function CSectionLayoutColumnInfo(X,XLimit){this.X=X;this.XLimit=XLimit;this.Pos=0;this.EndPos=0}function CSectionLayoutInfo(X,Y,XLimit,YLimit){this.X=X;this.Y=Y;this.XLimit=XLimit;this.YLimit=YLimit;this.Columns=[]}function CFootnotePr(){this.NumRestart=undefined;this.NumFormat=undefined;this.NumStart=undefined;this.Pos=undefined}CFootnotePr.prototype.InitDefault=function(){this.NumFormat=Asc.c_oAscNumberingFormat.Decimal;this.NumRestart=section_footnote_RestartContinuous; this.NumStart=1;this.Pos=Asc.c_oAscFootnotePos&&Asc.c_oAscFootnotePos.PageBottom};CFootnotePr.prototype.InitDefaultEndnotePr=function(){this.NumFormat=Asc.c_oAscNumberingFormat.LowerRoman;this.NumRestart=section_footnote_RestartContinuous;this.NumStart=1;this.Pos=Asc.c_oAscEndnotePos&&Asc.c_oAscEndnotePos.DocEnd};CFootnotePr.prototype.WriteToBinary=function(Writer){var StartPos=Writer.GetCurPosition();Writer.Skip(4);var Flags=0;if(undefined!==this.NumFormat){Writer.WriteLong(this.NumFormat);Flags|= 1}if(undefined!==this.NumRestart){Writer.WriteLong(this.NumRestart);Flags|=2}if(undefined!==this.NumStart){Writer.WriteLong(this.NumStart);Flags|=4}if(undefined!==this.Pos){Writer.WriteLong(this.Pos);Flags|=8}var EndPos=Writer.GetCurPosition();Writer.Seek(StartPos);Writer.WriteLong(Flags);Writer.Seek(EndPos)};CFootnotePr.prototype.ReadFromBinary=function(Reader){var Flags=Reader.GetLong();if(Flags&1)this.NumFormat=Reader.GetLong();else this.NumFormat=undefined;if(Flags&2)this.NumRestart=Reader.GetLong(); else this.NumRestart=undefined;if(Flags&4)this.NumStart=Reader.GetLong();else this.NumStart=undefined;if(Flags&8)this.Pos=Reader.GetLong();else this.Pos=undefined};function CSectionLnNumType(nCountBy,nDistance,nStart,nRestartType){this.CountBy=undefined!==nCountBy?nCountBy:1;this.Distance=undefined!==nDistance&&null!==nDistance?nDistance:undefined;this.Start=undefined!==nStart&&0!==nStart?nStart:undefined;this.Restart=undefined!==nRestartType&&Asc.c_oAscLineNumberRestartType.NewPage!==nRestartType? nRestartType:undefined}CSectionLnNumType.prototype.Copy=function(){return new CSectionLnNumType(this.CountBy,this.Distance,this.Start,this.Restart)};CSectionLnNumType.prototype.WriteToBinary=function(oWriter){var nStartPos=oWriter.GetCurPosition();oWriter.Skip(4);var nFlags=0;if(undefined!==this.CountBy){oWriter.WriteLong(this.CountBy);nFlags|=1}if(undefined!==this.Distance){oWriter.WriteLong(this.Distance);nFlags|=2}if(undefined!==this.Start){oWriter.WriteLong(this.Start);nFlags|=4}if(undefined!== this.Restart){oWriter.WriteLong(this.Restart);nFlags|=8}var nEndPos=oWriter.GetCurPosition();oWriter.Seek(nStartPos);oWriter.WriteLong(nFlags);oWriter.Seek(nEndPos)};CSectionLnNumType.prototype.ReadFromBinary=function(oReader){var nFlags=oReader.GetLong();if(nFlags&1)this.CountBy=oReader.GetLong();else this.CountBy=undefined;if(nFlags&2)this.Distance=oReader.GetLong();else this.Distance=undefined;if(nFlags&4)this.Start=oReader.GetLong();else this.Start=undefined;if(nFlags&8)this.Restart=oReader.GetLong(); else this.Restart=undefined};CSectionLnNumType.prototype.Write_ToBinary=function(oWriter){this.WriteToBinary(oWriter)};CSectionLnNumType.prototype.Read_FromBinary=function(oReader){this.ReadFromBinary(oReader)};CSectionLnNumType.prototype.SetCountBy=function(nCountBy){this.CountBy=nCountBy};CSectionLnNumType.prototype.GetCountBy=function(){return this.CountBy};CSectionLnNumType.prototype.SetDistance=function(nDistance){this.Distance=nDistance};CSectionLnNumType.prototype.GetDistance=function(){return this.Distance}; CSectionLnNumType.prototype.SetStart=function(nStart){this.Start=nStart};CSectionLnNumType.prototype.GetStart=function(){return undefined===this.Start?0:this.Start};CSectionLnNumType.prototype.SetRestart=function(nRestart){this.Restart=nRestart};CSectionLnNumType.prototype.GetRestart=function(){return undefined===this.Restart?Asc.c_oAscLineNumberRestartType.NewPage:this.Restart};window["AscCommonWord"]=window["AscCommonWord"]||{};window["AscCommonWord"].CSectionPr=CSectionPr;window["Asc"]["CSectionLnNumType"]= window["Asc"].CSectionLnNumType=CSectionLnNumType;CSectionLnNumType.prototype["get_CountBy"]=CSectionLnNumType.prototype.GetCountBy;CSectionLnNumType.prototype["put_CountBy"]=CSectionLnNumType.prototype.SetCountBy;CSectionLnNumType.prototype["get_Distance"]=CSectionLnNumType.prototype.GetDistance;CSectionLnNumType.prototype["put_Distance"]=CSectionLnNumType.prototype.SetDistance;CSectionLnNumType.prototype["get_Start"]=function(){return undefined===this.Start?1:this.Start+1};CSectionLnNumType.prototype["put_Start"]= function(nStart){this.Start=nStart-1};CSectionLnNumType.prototype["get_Restart"]=CSectionLnNumType.prototype.GetRestart;CSectionLnNumType.prototype["put_Restart"]=CSectionLnNumType.prototype.SetRestart;"use strict";AscDFH.changesFactory[AscDFH.historyitem_Section_PageSize_Orient]=CChangesSectionPageOrient;AscDFH.changesFactory[AscDFH.historyitem_Section_PageSize_Size]=CChangesSectionPageSize;AscDFH.changesFactory[AscDFH.historyitem_Section_PageMargins]=CChangesSectionPageMargins;AscDFH.changesFactory[AscDFH.historyitem_Section_Type]= CChangesSectionType;AscDFH.changesFactory[AscDFH.historyitem_Section_Borders_Left]=CChangesSectionBordersLeft;AscDFH.changesFactory[AscDFH.historyitem_Section_Borders_Top]=CChangesSectionBordersTop;AscDFH.changesFactory[AscDFH.historyitem_Section_Borders_Right]=CChangesSectionBordersRight;AscDFH.changesFactory[AscDFH.historyitem_Section_Borders_Bottom]=CChangesSectionBordersBottom;AscDFH.changesFactory[AscDFH.historyitem_Section_Borders_Display]=CChangesSectionBordersDisplay;AscDFH.changesFactory[AscDFH.historyitem_Section_Borders_OffsetFrom]= CChangesSectionBordersOffsetFrom;AscDFH.changesFactory[AscDFH.historyitem_Section_Borders_ZOrder]=CChangesSectionBordersZOrder;AscDFH.changesFactory[AscDFH.historyitem_Section_Header_First]=CChangesSectionHeaderFirst;AscDFH.changesFactory[AscDFH.historyitem_Section_Header_Even]=CChangesSectionHeaderEven;AscDFH.changesFactory[AscDFH.historyitem_Section_Header_Default]=CChangesSectionHeaderDefault;AscDFH.changesFactory[AscDFH.historyitem_Section_Footer_First]=CChangesSectionFooterFirst;AscDFH.changesFactory[AscDFH.historyitem_Section_Footer_Even]= CChangesSectionFooterEven;AscDFH.changesFactory[AscDFH.historyitem_Section_Footer_Default]=CChangesSectionFooterDefault;AscDFH.changesFactory[AscDFH.historyitem_Section_TitlePage]=CChangesSectionTitlePage;AscDFH.changesFactory[AscDFH.historyitem_Section_PageMargins_Header]=CChangesSectionPageMarginsHeader;AscDFH.changesFactory[AscDFH.historyitem_Section_PageMargins_Footer]=CChangesSectionPageMarginsFooter;AscDFH.changesFactory[AscDFH.historyitem_Section_PageNumType_Start]=CChangesSectionPageNumTypeStart; AscDFH.changesFactory[AscDFH.historyitem_Section_Columns_EqualWidth]=CChangesSectionColumnsEqualWidth;AscDFH.changesFactory[AscDFH.historyitem_Section_Columns_Space]=CChangesSectionColumnsSpace;AscDFH.changesFactory[AscDFH.historyitem_Section_Columns_Num]=CChangesSectionColumnsNum;AscDFH.changesFactory[AscDFH.historyitem_Section_Columns_Sep]=CChangesSectionColumnsSep;AscDFH.changesFactory[AscDFH.historyitem_Section_Columns_Col]=CChangesSectionColumnsCol;AscDFH.changesFactory[AscDFH.historyitem_Section_Columns_SetCols]= CChangesSectionColumnsSetCols;AscDFH.changesFactory[AscDFH.historyitem_Section_Footnote_Pos]=CChangesSectionFootnotePos;AscDFH.changesFactory[AscDFH.historyitem_Section_Footnote_NumStart]=CChangesSectionFootnoteNumStart;AscDFH.changesFactory[AscDFH.historyitem_Section_Footnote_NumRestart]=CChangesSectionFootnoteNumRestart;AscDFH.changesFactory[AscDFH.historyitem_Section_Footnote_NumFormat]=CChangesSectionFootnoteNumFormat;AscDFH.changesFactory[AscDFH.historyitem_Section_PageMargins_Gutter]=CChangesSectionPageMarginsGutter; AscDFH.changesFactory[AscDFH.historyitem_Section_Gutter_RTL]=CChangesSectionGutterRTL;AscDFH.changesFactory[AscDFH.historyitem_Section_Endnote_Pos]=CChangesSectionEndnotePos;AscDFH.changesFactory[AscDFH.historyitem_Section_Endnote_NumStart]=CChangesSectionEndnoteNumStart;AscDFH.changesFactory[AscDFH.historyitem_Section_Endnote_NumRestart]=CChangesSectionEndnoteNumRestart;AscDFH.changesFactory[AscDFH.historyitem_Section_Endnote_NumFormat]=CChangesSectionEndnoteNumFormat;AscDFH.changesFactory[AscDFH.historyitem_Section_LnNumType]= CChangesSectionLnNumType;AscDFH.changesRelationMap[AscDFH.historyitem_Section_PageSize_Orient]=[AscDFH.historyitem_Section_PageSize_Orient];AscDFH.changesRelationMap[AscDFH.historyitem_Section_PageSize_Size]=[AscDFH.historyitem_Section_PageSize_Size];AscDFH.changesRelationMap[AscDFH.historyitem_Section_PageMargins]=[AscDFH.historyitem_Section_PageMargins];AscDFH.changesRelationMap[AscDFH.historyitem_Section_Type]=[AscDFH.historyitem_Section_Type];AscDFH.changesRelationMap[AscDFH.historyitem_Section_Borders_Left]= [AscDFH.historyitem_Section_Borders_Left];AscDFH.changesRelationMap[AscDFH.historyitem_Section_Borders_Top]=[AscDFH.historyitem_Section_Borders_Top];AscDFH.changesRelationMap[AscDFH.historyitem_Section_Borders_Right]=[AscDFH.historyitem_Section_Borders_Right];AscDFH.changesRelationMap[AscDFH.historyitem_Section_Borders_Bottom]=[AscDFH.historyitem_Section_Borders_Bottom];AscDFH.changesRelationMap[AscDFH.historyitem_Section_Borders_Display]=[AscDFH.historyitem_Section_Borders_Display];AscDFH.changesRelationMap[AscDFH.historyitem_Section_Borders_OffsetFrom]= [AscDFH.historyitem_Section_Borders_OffsetFrom];AscDFH.changesRelationMap[AscDFH.historyitem_Section_Borders_ZOrder]=[AscDFH.historyitem_Section_Borders_ZOrder];AscDFH.changesRelationMap[AscDFH.historyitem_Section_Header_First]=[AscDFH.historyitem_Section_Header_First];AscDFH.changesRelationMap[AscDFH.historyitem_Section_Header_Even]=[AscDFH.historyitem_Section_Header_Even];AscDFH.changesRelationMap[AscDFH.historyitem_Section_Header_Default]=[AscDFH.historyitem_Section_Header_Default];AscDFH.changesRelationMap[AscDFH.historyitem_Section_Footer_First]= [AscDFH.historyitem_Section_Footer_First];AscDFH.changesRelationMap[AscDFH.historyitem_Section_Footer_Even]=[AscDFH.historyitem_Section_Footer_Even];AscDFH.changesRelationMap[AscDFH.historyitem_Section_Footer_Default]=[AscDFH.historyitem_Section_Footer_Default];AscDFH.changesRelationMap[AscDFH.historyitem_Section_TitlePage]=[AscDFH.historyitem_Section_TitlePage];AscDFH.changesRelationMap[AscDFH.historyitem_Section_PageMargins_Header]=[AscDFH.historyitem_Section_PageMargins_Header];AscDFH.changesRelationMap[AscDFH.historyitem_Section_PageMargins_Footer]= [AscDFH.historyitem_Section_PageMargins_Footer];AscDFH.changesRelationMap[AscDFH.historyitem_Section_PageNumType_Start]=[AscDFH.historyitem_Section_PageNumType_Start];AscDFH.changesRelationMap[AscDFH.historyitem_Section_Columns_EqualWidth]=[AscDFH.historyitem_Section_Columns_EqualWidth];AscDFH.changesRelationMap[AscDFH.historyitem_Section_Columns_Space]=[AscDFH.historyitem_Section_Columns_Space];AscDFH.changesRelationMap[AscDFH.historyitem_Section_Columns_Num]=[AscDFH.historyitem_Section_Columns_Num]; AscDFH.changesRelationMap[AscDFH.historyitem_Section_Columns_Sep]=[AscDFH.historyitem_Section_Columns_Sep];AscDFH.changesRelationMap[AscDFH.historyitem_Section_Columns_Col]=[AscDFH.historyitem_Section_Columns_Col,AscDFH.historyitem_Section_Columns_SetCols];AscDFH.changesRelationMap[AscDFH.historyitem_Section_Columns_SetCols]=[AscDFH.historyitem_Section_Columns_Col,AscDFH.historyitem_Section_Columns_SetCols];AscDFH.changesRelationMap[AscDFH.historyitem_Section_Footnote_Pos]=[AscDFH.historyitem_Section_Footnote_Pos]; AscDFH.changesRelationMap[AscDFH.historyitem_Section_Footnote_NumStart]=[AscDFH.historyitem_Section_Footnote_NumStart];AscDFH.changesRelationMap[AscDFH.historyitem_Section_Footnote_NumRestart]=[AscDFH.historyitem_Section_Footnote_NumRestart];AscDFH.changesRelationMap[AscDFH.historyitem_Section_Footnote_NumFormat]=[AscDFH.historyitem_Section_Footnote_NumFormat];AscDFH.changesRelationMap[AscDFH.historyitem_Section_PageMargins_Gutter]=[AscDFH.historyitem_Section_PageMargins_Gutter];AscDFH.changesRelationMap[AscDFH.historyitem_Section_Gutter_RTL]= [AscDFH.historyitem_Section_Gutter_RTL];AscDFH.changesRelationMap[AscDFH.historyitem_Section_Endnote_Pos]=[AscDFH.historyitem_Section_Endnote_Pos];AscDFH.changesRelationMap[AscDFH.historyitem_Section_Endnote_NumStart]=[AscDFH.historyitem_Section_Endnote_NumStart];AscDFH.changesRelationMap[AscDFH.historyitem_Section_Endnote_NumRestart]=[AscDFH.historyitem_Section_Endnote_NumRestart];AscDFH.changesRelationMap[AscDFH.historyitem_Section_Endnote_NumFormat]=[AscDFH.historyitem_Section_Endnote_NumFormat]; AscDFH.changesRelationMap[AscDFH.historyitem_Section_LnNumType]=[AscDFH.historyitem_Section_LnNumType];function CChangesSectionBaseHeaderFooter(Class,Old,New){AscDFH.CChangesBaseProperty.call(this,Class,Old,New)}CChangesSectionBaseHeaderFooter.prototype=Object.create(AscDFH.CChangesBaseProperty.prototype);CChangesSectionBaseHeaderFooter.prototype.constructor=CChangesSectionBaseHeaderFooter;CChangesSectionBaseHeaderFooter.prototype.WriteToBinary=function(Writer){var nFlags=0;if(null===this.New)nFlags|= 1;if(null===this.Old)nFlags|=2;Writer.WriteLong(nFlags);if(null!==this.New)Writer.WriteString2(this.New.Get_Id());if(null!==this.Old)Writer.WriteString2(this.Old.Get_Id())};CChangesSectionBaseHeaderFooter.prototype.ReadFromBinary=function(Reader){var nFlags=Reader.GetLong();if(nFlags&1)this.New=null;else this.New=AscCommon.g_oTableId.Get_ById(Reader.GetString2());if(nFlags&2)this.Old=null;else this.Old=AscCommon.g_oTableId.Get_ById(Reader.GetString2())};function CChangesSectionPageOrient(Class,Old, New){AscDFH.CChangesBaseByteValue.call(this,Class,Old,New)}CChangesSectionPageOrient.prototype=Object.create(AscDFH.CChangesBaseByteValue.prototype);CChangesSectionPageOrient.prototype.constructor=CChangesSectionPageOrient;CChangesSectionPageOrient.prototype.Type=AscDFH.historyitem_Section_PageSize_Orient;CChangesSectionPageOrient.prototype.private_SetValue=function(Value){this.Class.PageSize.Orient=Value};function CChangesSectionPageSize(Class,Old,New){AscDFH.CChangesBaseProperty.call(this,Class, Old,New)}CChangesSectionPageSize.prototype=Object.create(AscDFH.CChangesBaseProperty.prototype);CChangesSectionPageSize.prototype.constructor=CChangesSectionPageSize;CChangesSectionPageSize.prototype.Type=AscDFH.historyitem_Section_PageSize_Size;CChangesSectionPageSize.prototype.private_SetValue=function(Value){this.Class.PageSize.W=Value.W;this.Class.PageSize.H=Value.H};CChangesSectionPageSize.prototype.WriteToBinary=function(Writer){Writer.WriteDouble(this.New.W);Writer.WriteDouble(this.New.H); Writer.WriteDouble(this.Old.W);Writer.WriteDouble(this.Old.H)};CChangesSectionPageSize.prototype.ReadFromBinary=function(Reader){this.New={W:Reader.GetDouble(),H:Reader.GetDouble()};this.Old={W:Reader.GetDouble(),H:Reader.GetDouble()}};function CChangesSectionPageMargins(Class,Old,New){AscDFH.CChangesBaseProperty.call(this,Class,Old,New)}CChangesSectionPageMargins.prototype=Object.create(AscDFH.CChangesBaseProperty.prototype);CChangesSectionPageMargins.prototype.constructor=CChangesSectionPageMargins; CChangesSectionPageMargins.prototype.Type=AscDFH.historyitem_Section_PageMargins;CChangesSectionPageMargins.prototype.private_SetValue=function(Value){this.Class.PageMargins.Left=Value.L;this.Class.PageMargins.Top=Value.T;this.Class.PageMargins.Right=Value.R;this.Class.PageMargins.Bottom=Value.B};CChangesSectionPageMargins.prototype.WriteToBinary=function(Writer){Writer.WriteDouble(this.New.L);Writer.WriteDouble(this.New.T);Writer.WriteDouble(this.New.R);Writer.WriteDouble(this.New.B);Writer.WriteDouble(this.Old.L); Writer.WriteDouble(this.Old.T);Writer.WriteDouble(this.Old.R);Writer.WriteDouble(this.Old.B)};CChangesSectionPageMargins.prototype.ReadFromBinary=function(Reader){this.New={L:Reader.GetDouble(),T:Reader.GetDouble(),R:Reader.GetDouble(),B:Reader.GetDouble()};this.Old={L:Reader.GetDouble(),T:Reader.GetDouble(),R:Reader.GetDouble(),B:Reader.GetDouble()}};function CChangesSectionType(Class,Old,New){AscDFH.CChangesBaseByteValue.call(this,Class,Old,New)}CChangesSectionType.prototype=Object.create(AscDFH.CChangesBaseByteValue.prototype); CChangesSectionType.prototype.constructor=CChangesSectionType;CChangesSectionType.prototype.Type=AscDFH.historyitem_Section_Type;CChangesSectionType.prototype.private_SetValue=function(Value){this.Class.Type=Value};function CChangesSectionBordersLeft(Class,Old,New){AscDFH.CChangesBaseObjectValue.call(this,Class,Old,New)}CChangesSectionBordersLeft.prototype=Object.create(AscDFH.CChangesBaseObjectValue.prototype);CChangesSectionBordersLeft.prototype.constructor=CChangesSectionBordersLeft;CChangesSectionBordersLeft.prototype.Type= AscDFH.historyitem_Section_Borders_Left;CChangesSectionBordersLeft.prototype.private_CreateObject=function(){return new CDocumentBorder};CChangesSectionBordersLeft.prototype.private_SetValue=function(Value){this.Class.Borders.Left=Value};function CChangesSectionBordersTop(Class,Old,New){AscDFH.CChangesBaseObjectValue.call(this,Class,Old,New)}CChangesSectionBordersTop.prototype=Object.create(AscDFH.CChangesBaseObjectValue.prototype);CChangesSectionBordersTop.prototype.constructor=CChangesSectionBordersTop; CChangesSectionBordersTop.prototype.Type=AscDFH.historyitem_Section_Borders_Top;CChangesSectionBordersTop.prototype.private_CreateObject=function(){return new CDocumentBorder};CChangesSectionBordersTop.prototype.private_SetValue=function(Value){this.Class.Borders.Top=Value};function CChangesSectionBordersRight(Class,Old,New){AscDFH.CChangesBaseObjectValue.call(this,Class,Old,New)}CChangesSectionBordersRight.prototype=Object.create(AscDFH.CChangesBaseObjectValue.prototype);CChangesSectionBordersRight.prototype.constructor= CChangesSectionBordersRight;CChangesSectionBordersRight.prototype.Type=AscDFH.historyitem_Section_Borders_Right;CChangesSectionBordersRight.prototype.private_CreateObject=function(){return new CDocumentBorder};CChangesSectionBordersRight.prototype.private_SetValue=function(Value){this.Class.Borders.Right=Value};function CChangesSectionBordersBottom(Class,Old,New){AscDFH.CChangesBaseObjectValue.call(this,Class,Old,New)}CChangesSectionBordersBottom.prototype=Object.create(AscDFH.CChangesBaseObjectValue.prototype); CChangesSectionBordersBottom.prototype.constructor=CChangesSectionBordersBottom;CChangesSectionBordersBottom.prototype.Type=AscDFH.historyitem_Section_Borders_Bottom;CChangesSectionBordersBottom.prototype.private_CreateObject=function(){return new CDocumentBorder};CChangesSectionBordersBottom.prototype.private_SetValue=function(Value){this.Class.Borders.Bottom=Value};function CChangesSectionBordersDisplay(Class,Old,New){AscDFH.CChangesBaseByteValue.call(this,Class,Old,New)}CChangesSectionBordersDisplay.prototype= Object.create(AscDFH.CChangesBaseByteValue.prototype);CChangesSectionBordersDisplay.prototype.constructor=CChangesSectionBordersDisplay;CChangesSectionBordersDisplay.prototype.Type=AscDFH.historyitem_Section_Borders_Display;CChangesSectionBordersDisplay.prototype.private_SetValue=function(Value){this.Class.Borders.Display=Value};function CChangesSectionBordersOffsetFrom(Class,Old,New){AscDFH.CChangesBaseByteValue.call(this,Class,Old,New)}CChangesSectionBordersOffsetFrom.prototype=Object.create(AscDFH.CChangesBaseByteValue.prototype); CChangesSectionBordersOffsetFrom.prototype.constructor=CChangesSectionBordersOffsetFrom;CChangesSectionBordersOffsetFrom.prototype.Type=AscDFH.historyitem_Section_Borders_OffsetFrom;CChangesSectionBordersOffsetFrom.prototype.private_SetValue=function(Value){this.Class.Borders.OffsetFrom=Value};function CChangesSectionBordersZOrder(Class,Old,New){AscDFH.CChangesBaseByteValue.call(this,Class,Old,New)}CChangesSectionBordersZOrder.prototype=Object.create(AscDFH.CChangesBaseByteValue.prototype);CChangesSectionBordersZOrder.prototype.constructor= CChangesSectionBordersZOrder;CChangesSectionBordersZOrder.prototype.Type=AscDFH.historyitem_Section_Borders_ZOrder;CChangesSectionBordersZOrder.prototype.private_SetValue=function(Value){this.Class.Borders.ZOrder=Value};function CChangesSectionHeaderFirst(Class,Old,New){CChangesSectionBaseHeaderFooter.call(this,Class,Old,New)}CChangesSectionHeaderFirst.prototype=Object.create(CChangesSectionBaseHeaderFooter.prototype);CChangesSectionHeaderFirst.prototype.constructor=CChangesSectionHeaderFirst;CChangesSectionHeaderFirst.prototype.Type= AscDFH.historyitem_Section_Header_First;CChangesSectionHeaderFirst.prototype.private_SetValue=function(Value){this.Class.HeaderFirst=Value};function CChangesSectionHeaderEven(Class,Old,New){CChangesSectionBaseHeaderFooter.call(this,Class,Old,New)}CChangesSectionHeaderEven.prototype=Object.create(CChangesSectionBaseHeaderFooter.prototype);CChangesSectionHeaderEven.prototype.constructor=CChangesSectionHeaderEven;CChangesSectionHeaderEven.prototype.Type=AscDFH.historyitem_Section_Header_Even;CChangesSectionHeaderEven.prototype.private_SetValue= function(Value){this.Class.HeaderEven=Value};function CChangesSectionHeaderDefault(Class,Old,New){CChangesSectionBaseHeaderFooter.call(this,Class,Old,New)}CChangesSectionHeaderDefault.prototype=Object.create(CChangesSectionBaseHeaderFooter.prototype);CChangesSectionHeaderDefault.prototype.constructor=CChangesSectionHeaderDefault;CChangesSectionHeaderDefault.prototype.Type=AscDFH.historyitem_Section_Header_Default;CChangesSectionHeaderDefault.prototype.private_SetValue=function(Value){this.Class.HeaderDefault= Value};function CChangesSectionFooterFirst(Class,Old,New){CChangesSectionBaseHeaderFooter.call(this,Class,Old,New)}CChangesSectionFooterFirst.prototype=Object.create(CChangesSectionBaseHeaderFooter.prototype);CChangesSectionFooterFirst.prototype.constructor=CChangesSectionFooterFirst;CChangesSectionFooterFirst.prototype.Type=AscDFH.historyitem_Section_Footer_First;CChangesSectionFooterFirst.prototype.private_SetValue=function(Value){this.Class.FooterFirst=Value};function CChangesSectionFooterEven(Class, Old,New){CChangesSectionBaseHeaderFooter.call(this,Class,Old,New)}CChangesSectionFooterEven.prototype=Object.create(CChangesSectionBaseHeaderFooter.prototype);CChangesSectionFooterEven.prototype.constructor=CChangesSectionFooterEven;CChangesSectionFooterEven.prototype.Type=AscDFH.historyitem_Section_Footer_Even;CChangesSectionFooterEven.prototype.private_SetValue=function(Value){this.Class.FooterEven=Value};function CChangesSectionFooterDefault(Class,Old,New){CChangesSectionBaseHeaderFooter.call(this, Class,Old,New)}CChangesSectionFooterDefault.prototype=Object.create(CChangesSectionBaseHeaderFooter.prototype);CChangesSectionFooterDefault.prototype.constructor=CChangesSectionFooterDefault;CChangesSectionFooterDefault.prototype.Type=AscDFH.historyitem_Section_Footer_Default;CChangesSectionFooterDefault.prototype.private_SetValue=function(Value){this.Class.FooterDefault=Value};function CChangesSectionTitlePage(Class,Old,New){AscDFH.CChangesBaseBoolValue.call(this,Class,Old,New)}CChangesSectionTitlePage.prototype= Object.create(AscDFH.CChangesBaseBoolValue.prototype);CChangesSectionTitlePage.prototype.constructor=CChangesSectionTitlePage;CChangesSectionTitlePage.prototype.Type=AscDFH.historyitem_Section_TitlePage;CChangesSectionTitlePage.prototype.private_SetValue=function(Value){this.Class.TitlePage=Value};function CChangesSectionPageMarginsHeader(Class,Old,New){AscDFH.CChangesBaseDoubleValue.call(this,Class,Old,New)}CChangesSectionPageMarginsHeader.prototype=Object.create(AscDFH.CChangesBaseDoubleValue.prototype); CChangesSectionPageMarginsHeader.prototype.constructor=CChangesSectionPageMarginsHeader;CChangesSectionPageMarginsHeader.prototype.Type=AscDFH.historyitem_Section_PageMargins_Header;CChangesSectionPageMarginsHeader.prototype.private_SetValue=function(Value){this.Class.PageMargins.Header=Value};function CChangesSectionPageMarginsFooter(Class,Old,New){AscDFH.CChangesBaseDoubleValue.call(this,Class,Old,New)}CChangesSectionPageMarginsFooter.prototype=Object.create(AscDFH.CChangesBaseDoubleValue.prototype); CChangesSectionPageMarginsFooter.prototype.constructor=CChangesSectionPageMarginsFooter;CChangesSectionPageMarginsFooter.prototype.Type=AscDFH.historyitem_Section_PageMargins_Footer;CChangesSectionPageMarginsFooter.prototype.private_SetValue=function(Value){this.Class.PageMargins.Footer=Value};function CChangesSectionPageNumTypeStart(Class,Old,New){AscDFH.CChangesBaseLongValue.call(this,Class,Old,New)}CChangesSectionPageNumTypeStart.prototype=Object.create(AscDFH.CChangesBaseLongValue.prototype); CChangesSectionPageNumTypeStart.prototype.constructor=CChangesSectionPageNumTypeStart;CChangesSectionPageNumTypeStart.prototype.Type=AscDFH.historyitem_Section_PageNumType_Start;CChangesSectionPageNumTypeStart.prototype.private_SetValue=function(Value){this.Class.PageNumType.Start=Value};function CChangesSectionColumnsEqualWidth(Class,Old,New){AscDFH.CChangesBaseBoolValue.call(this,Class,Old,New)}CChangesSectionColumnsEqualWidth.prototype=Object.create(AscDFH.CChangesBaseBoolValue.prototype);CChangesSectionColumnsEqualWidth.prototype.constructor= CChangesSectionColumnsEqualWidth;CChangesSectionColumnsEqualWidth.prototype.Type=AscDFH.historyitem_Section_Columns_EqualWidth;CChangesSectionColumnsEqualWidth.prototype.private_SetValue=function(Value){this.Class.Columns.EqualWidth=Value};function CChangesSectionColumnsSpace(Class,Old,New){AscDFH.CChangesBaseDoubleValue.call(this,Class,Old,New)}CChangesSectionColumnsSpace.prototype=Object.create(AscDFH.CChangesBaseDoubleValue.prototype);CChangesSectionColumnsSpace.prototype.constructor=CChangesSectionColumnsSpace; CChangesSectionColumnsSpace.prototype.Type=AscDFH.historyitem_Section_Columns_Space;CChangesSectionColumnsSpace.prototype.private_SetValue=function(Value){this.Class.Columns.Space=Value};function CChangesSectionColumnsNum(Class,Old,New){AscDFH.CChangesBaseLongValue.call(this,Class,Old,New)}CChangesSectionColumnsNum.prototype=Object.create(AscDFH.CChangesBaseLongValue.prototype);CChangesSectionColumnsNum.prototype.constructor=CChangesSectionColumnsNum;CChangesSectionColumnsNum.prototype.Type=AscDFH.historyitem_Section_Columns_Num; CChangesSectionColumnsNum.prototype.private_SetValue=function(Value){this.Class.Columns.Num=Value};function CChangesSectionColumnsSep(Class,Old,New){AscDFH.CChangesBaseBoolValue.call(this,Class,Old,New)}CChangesSectionColumnsSep.prototype=Object.create(AscDFH.CChangesBaseBoolValue.prototype);CChangesSectionColumnsSep.prototype.constructor=CChangesSectionColumnsSep;CChangesSectionColumnsSep.prototype.Type=AscDFH.historyitem_Section_Columns_Sep;CChangesSectionColumnsSep.prototype.private_SetValue=function(Value){this.Class.Columns.Sep= Value};function CChangesSectionColumnsCol(Class,Old,New,Index){AscDFH.CChangesBaseProperty.call(this,Class,Old,New);this.Index=Index}CChangesSectionColumnsCol.prototype=Object.create(AscDFH.CChangesBaseProperty.prototype);CChangesSectionColumnsCol.prototype.constructor=CChangesSectionColumnsCol;CChangesSectionColumnsCol.prototype.Type=AscDFH.historyitem_Section_Columns_Col;CChangesSectionColumnsCol.prototype.private_SetValue=function(Value){this.Class.Columns.Cols[this.Index]=Value};CChangesSectionColumnsCol.prototype.WriteToBinary= function(Writer){Writer.WriteLong(this.Index);var nFlags=0;if(undefined===this.New)nFlags|=1;if(undefined===this.Old)nFlags|=2;Writer.WriteLong(nFlags);if(undefined!==this.New)this.New.Write_ToBinary(Writer);if(undefined!==this.Old)this.Old.Write_ToBinary(Writer)};CChangesSectionColumnsCol.prototype.ReadFromBinary=function(Reader){this.Index=Reader.GetLong();var nFlags=Reader.GetLong();if(nFlags&1)this.New=undefined;else{this.New=new CSectionColumn;this.New.Read_FromBinary(Reader)}if(nFlags&2)this.Old= undefined;else{this.Old=new CSectionColumn;this.Old.Read_FromBinary(Reader)}};CChangesSectionColumnsCol.prototype.CreateReverseChange=function(){return new CChangesSectionColumnsCol(this.Class,this.New,this.Old,this.Index)};CChangesSectionColumnsCol.prototype.Merge=function(oChange){if(this.Class!==oChange.Class)return true;if(this.Type===oChange.Type)if(this.Index!==oChange.Index)return true;else return false;else if(AscDFH.historyitem_Section_Columns_SetCols===oChange.Type)return false;return true}; function CChangesSectionColumnsSetCols(Class,Old,New){AscDFH.CChangesBaseProperty.call(this,Class,Old,New)}CChangesSectionColumnsSetCols.prototype=Object.create(AscDFH.CChangesBaseProperty.prototype);CChangesSectionColumnsSetCols.prototype.constructor=CChangesSectionColumnsSetCols;CChangesSectionColumnsSetCols.prototype.Type=AscDFH.historyitem_Section_Columns_SetCols;CChangesSectionColumnsSetCols.prototype.private_SetValue=function(Value){this.Class.Columns.Cols=Value};CChangesSectionColumnsSetCols.prototype.WriteToBinary= function(Writer){var nCount=this.New.length;Writer.WriteLong(nCount);for(var nIndex=0;nIndex0){while(Vals[Index2]<=Num){T+=Rims[Index2];Num-=Vals[Index2]}Index2++;if(Index2>=Rims.length)break}return T}"use strict";function CNumberingLvl(){this.Jc= AscCommon.align_Left;this.Format=Asc.c_oAscNumberingFormat.Bullet;this.PStyle=undefined;this.Start=1;this.Restart=-1;this.Suff=Asc.c_oAscNumberingSuff.Tab;this.TextPr=new CTextPr;this.ParaPr=new CParaPr;this.LvlText=[];this.Legacy=undefined;this.IsLgl=false;this.private_CheckSymbols()}CNumberingLvl.prototype.GetJc=function(){return this.Jc};CNumberingLvl.prototype.GetFormat=function(){return this.Format};CNumberingLvl.prototype.GetPStyle=function(){return this.PStyle};CNumberingLvl.prototype.SetPStyle= function(sStyleId){this.PStyle=sStyleId};CNumberingLvl.prototype.GetStart=function(){return this.Start};CNumberingLvl.prototype.GetRestart=function(){return this.Restart};CNumberingLvl.prototype.GetSuff=function(){return this.Suff};CNumberingLvl.prototype.GetTextPr=function(){return this.TextPr};CNumberingLvl.prototype.GetParaPr=function(){return this.ParaPr};CNumberingLvl.prototype.GetLvlText=function(){return this.LvlText};CNumberingLvl.prototype.SetLvlText=function(arrLvlText){this.LvlText=arrLvlText}; CNumberingLvl.prototype.IsLegacy=function(){return!!(this.Legacy instanceof CNumberingLvlLegacy&&this.Legacy.Legacy)};CNumberingLvl.prototype.GetLegacySpace=function(){if(this.Legacy)return this.Legacy.Space;return 0};CNumberingLvl.prototype.GetLegacyIndent=function(){if(this.Legacy)return this.Legacy.Indent;return 0};CNumberingLvl.prototype.IsLegalStyle=function(){return this.IsLgl};CNumberingLvl.prototype.InitDefault=function(nLvl,nType){switch(nType){case c_oAscMultiLevelNumbering.Numbered:this.private_InitDefaultNumbered(nLvl); break;case c_oAscMultiLevelNumbering.Bullet:this.private_InitDefaultBullet(nLvl);break;case c_oAscMultiLevelNumbering.MultiLevel1:this.private_InitDefaultMultilevel1(nLvl);break;case c_oAscMultiLevelNumbering.MultiLevel2:this.private_InitDefaultMultilevel2(nLvl);break;case c_oAscMultiLevelNumbering.MultiLevel3:this.private_InitDefaultMultiLevel3(nLvl);break;default:this.private_InitDefault(nLvl)}};CNumberingLvl.prototype.private_InitDefault=function(nLvl){this.Jc=AscCommon.align_Left;this.SetFormat(Asc.c_oAscNumberingFormat.Bullet); this.PStyle=undefined;this.Start=1;this.Restart=-1;this.Suff=Asc.c_oAscNumberingSuff.Tab;this.ParaPr=new CParaPr;this.ParaPr.Ind.Left=36*(nLvl+1)*g_dKoef_pt_to_mm;this.ParaPr.Ind.FirstLine=-18*g_dKoef_pt_to_mm;this.TextPr=new CTextPr;this.LvlText=[];if(0==nLvl%3){this.TextPr.RFonts.SetAll("Symbol",-1);this.LvlText.push(new CNumberingLvlTextString(String.fromCharCode(183)))}else if(1==nLvl%3){this.TextPr.RFonts.SetAll("Courier New",-1);this.LvlText.push(new CNumberingLvlTextString("o"))}else{this.TextPr.RFonts.SetAll("Wingdings", -1);this.LvlText.push(new CNumberingLvlTextString(String.fromCharCode(167)))}};CNumberingLvl.prototype.private_InitDefaultNumbered=function(nLvl){this.Start=1;this.Restart=-1;this.Suff=Asc.c_oAscNumberingSuff.Tab;var nLeft=36*(nLvl+1)*g_dKoef_pt_to_mm;var nFirstLine=-18*g_dKoef_pt_to_mm;if(0===nLvl%3){this.Jc=AscCommon.align_Left;this.SetFormat(Asc.c_oAscNumberingFormat.Decimal)}else if(1===nLvl%3){this.Jc=AscCommon.align_Left;this.SetFormat(Asc.c_oAscNumberingFormat.LowerLetter)}else{this.Jc=AscCommon.align_Right; this.SetFormat(Asc.c_oAscNumberingFormat.LowerRoman);nFirstLine=-9*g_dKoef_pt_to_mm}this.LvlText=[];this.LvlText.push(new CNumberingLvlTextNum(nLvl));this.LvlText.push(new CNumberingLvlTextString("."));this.ParaPr=new CParaPr;this.ParaPr.Ind.Left=nLeft;this.ParaPr.Ind.FirstLine=nFirstLine;this.TextPr=new CTextPr};CNumberingLvl.prototype.private_InitDefaultBullet=function(nLvl){this.Start=1;this.Restart=-1;this.Suff=Asc.c_oAscNumberingSuff.Tab;this.Jc=AscCommon.align_Left;this.SetFormat(Asc.c_oAscNumberingFormat.Bullet); this.ParaPr=new CParaPr;this.ParaPr.Ind.Left=36*(nLvl+1)*g_dKoef_pt_to_mm;this.ParaPr.Ind.FirstLine=-18*g_dKoef_pt_to_mm;this.TextPr=new CTextPr;this.LvlText=[];if(0===nLvl%3){this.TextPr.RFonts.SetAll("Symbol",-1);this.LvlText.push(new CNumberingLvlTextString(String.fromCharCode(183)))}else if(1===nLvl%3){this.TextPr.RFonts.SetAll("Courier New",-1);this.LvlText.push(new CNumberingLvlTextString("o"))}else{this.TextPr.RFonts.SetAll("Wingdings",-1);this.LvlText.push(new CNumberingLvlTextString(String.fromCharCode(167)))}}; CNumberingLvl.prototype.private_InitDefaultMultilevel1=function(nLvl){this.Start=1;this.Restart=-1;this.Suff=Asc.c_oAscNumberingSuff.Tab;this.Jc=AscCommon.align_Left;if(0===nLvl%3)this.SetFormat(Asc.c_oAscNumberingFormat.Decimal);else if(1===nLvl%3)this.SetFormat(Asc.c_oAscNumberingFormat.LowerLetter);else this.SetFormat(Asc.c_oAscNumberingFormat.LowerRoman);this.LvlText=[];this.LvlText.push(new CNumberingLvlTextNum(nLvl));this.LvlText.push(new CNumberingLvlTextString(")"));var nLeft=18*(nLvl+1)* g_dKoef_pt_to_mm;var nFirstLine=-18*g_dKoef_pt_to_mm;this.ParaPr=new CParaPr;this.ParaPr.Ind.Left=nLeft;this.ParaPr.Ind.FirstLine=nFirstLine;this.TextPr=new CTextPr};CNumberingLvl.prototype.private_InitDefaultMultilevel2=function(nLvl){this.Jc=AscCommon.align_Left;this.SetFormat(Asc.c_oAscNumberingFormat.Decimal);this.Start=1;this.Restart=-1;this.Suff=Asc.c_oAscNumberingSuff.Tab;var nLeft=0;var nFirstLine=0;switch(nLvl){case 0:nLeft=18*g_dKoef_pt_to_mm;nFirstLine=-18*g_dKoef_pt_to_mm;break;case 1:nLeft= 39.6*g_dKoef_pt_to_mm;nFirstLine=-21.6*g_dKoef_pt_to_mm;break;case 2:nLeft=61.2*g_dKoef_pt_to_mm;nFirstLine=-25.2*g_dKoef_pt_to_mm;break;case 3:nLeft=86.4*g_dKoef_pt_to_mm;nFirstLine=-32.4*g_dKoef_pt_to_mm;break;case 4:nLeft=111.6*g_dKoef_pt_to_mm;nFirstLine=-39.6*g_dKoef_pt_to_mm;break;case 5:nLeft=136.8*g_dKoef_pt_to_mm;nFirstLine=-46.8*g_dKoef_pt_to_mm;break;case 6:nLeft=162*g_dKoef_pt_to_mm;nFirstLine=-54*g_dKoef_pt_to_mm;break;case 7:nLeft=187.2*g_dKoef_pt_to_mm;nFirstLine=-61.2*g_dKoef_pt_to_mm; break;case 8:nLeft=216*g_dKoef_pt_to_mm;nFirstLine=-72*g_dKoef_pt_to_mm;break}this.LvlText=[];for(var nIndex=0;nIndex<=nLvl;++nIndex){this.LvlText.push(new CNumberingLvlTextNum(nIndex));this.LvlText.push(new CNumberingLvlTextString("."))}this.ParaPr=new CParaPr;this.ParaPr.Ind.Left=nLeft;this.ParaPr.Ind.FirstLine=nFirstLine;this.TextPr=new CTextPr};CNumberingLvl.prototype.private_InitDefaultMultiLevel3=function(nLvl){this.Start=1;this.Restart=-1;this.Suff=Asc.c_oAscNumberingSuff.Tab;this.SetFormat(Asc.c_oAscNumberingFormat.Bullet); this.Jc=AscCommon.align_Left;this.LvlText=[];switch(nLvl){case 0:this.LvlText.push(new CNumberingLvlTextString(String.fromCharCode(118)));break;case 1:this.LvlText.push(new CNumberingLvlTextString(String.fromCharCode(216)));break;case 2:this.LvlText.push(new CNumberingLvlTextString(String.fromCharCode(167)));break;case 3:this.LvlText.push(new CNumberingLvlTextString(String.fromCharCode(183)));break;case 4:this.LvlText.push(new CNumberingLvlTextString(String.fromCharCode(168)));break;case 5:this.LvlText.push(new CNumberingLvlTextString(String.fromCharCode(216))); break;case 6:this.LvlText.push(new CNumberingLvlTextString(String.fromCharCode(167)));break;case 7:this.LvlText.push(new CNumberingLvlTextString(String.fromCharCode(183)));break;case 8:this.LvlText.push(new CNumberingLvlTextString(String.fromCharCode(168)));break}var nLeft=18*(nLvl+1)*g_dKoef_pt_to_mm;var nFirstLine=-18*g_dKoef_pt_to_mm;this.ParaPr=new CParaPr;this.ParaPr.Ind.Left=nLeft;this.ParaPr.Ind.FirstLine=nFirstLine;this.TextPr=new CTextPr;if(3===nLvl||4===nLvl||7===nLvl||8===nLvl)this.TextPr.RFonts.SetAll("Symbol", -1);else this.TextPr.RFonts.SetAll("Wingdings",-1)};CNumberingLvl.prototype.Copy=function(){var oLvl=new CNumberingLvl;oLvl.Jc=this.Jc;oLvl.Format=this.Format;oLvl.PStyle=this.PStyle;oLvl.Start=this.Start;oLvl.Restart=this.Restart;oLvl.Suff=this.Suff;oLvl.LvlText=[];for(var nIndex=0,nCount=this.LvlText.length;nIndex=49&&sFormatText.charCodeAt(nPos+1)<=49+nLvl){if(nPos>nLastPos){var sSubString=sFormatText.substring(nLastPos,nPos);for(var nSubIndex=0,nSubLen=sSubString.length;nSubIndexnLastPos){var sSubString=sFormatText.substring(nLastPos, nPos);for(var nSubIndex=0,nSubLen=sSubString.length;nSubIndexnLvl)arrLvls.splice(nLvlIndex,0,nLvl)}return arrLvls};CNumberingLvl.prototype.SetFormat=function(nFormat){this.Format= nFormat;this.private_CheckSymbols()};CNumberingLvl.prototype.private_CheckSymbols=function(){if(AscFonts.IsCheckSymbols){for(var nIndex=0,nCount=this.LvlText.length;nIndex8)nLvl=undefined;var oLogicDocument= editor.WordControl.m_oLogicDocument;var arrParagraphs=oLogicDocument.GetAllParagraphsByNumbering({NumId:this.Id,Lvl:nLvl});for(var nIndex=0,nCount=arrParagraphs.length;nIndex=9)return;var oLvlOld=this.Lvl[nLvl];this.Lvl[nLvl]=oLvlNew;History.Add(new CChangesAbstractNumLvlChange(this, oLvlOld,oLvlNew,nLvl))};CAbstractNum.prototype.CreateDefault=function(nType){for(var nLvl=0;nLvl<9;++nLvl){var oLvlNew=new CNumberingLvl;oLvlNew.InitDefault(nLvl,nType);var oLvlOld=this.Lvl[nLvl].Copy();History.Add(new CChangesAbstractNumLvlChange(this,oLvlOld,oLvlNew.Copy(),nLvl));this.Lvl[nLvl]=oLvlNew}};CAbstractNum.prototype.SetLvlByType=function(nLvl,nType,sText,oTextPr){if("number"!==typeof nLvl||nLvl<0||nLvl>=9)return;var oLvlOld=this.Lvl[nLvl].Copy();this.Lvl[nLvl].SetByType(nType,nLvl,sText, oTextPr);History.Add(new CChangesAbstractNumLvlChange(this,oLvlOld,this.Lvl[nLvl].Copy(),nLvl))};CAbstractNum.prototype.SetLvlByFormat=function(nLvl,nType,sFormatText,nAlign){if("number"!==typeof nLvl||nLvl<0||nLvl>=9)return;var oLvlOld=this.Lvl[nLvl].Copy();this.Lvl[nLvl].SetByFormat(nLvl,nType,sFormatText,nAlign);History.Add(new CChangesAbstractNumLvlChange(this,oLvlOld,this.Lvl[nLvl].Copy(),nLvl))};CAbstractNum.prototype.SetLvlRestart=function(nLvl,isRestart){if("number"!==typeof nLvl||nLvl<0|| nLvl>=9)return;var oLvlOld=this.Lvl[nLvl].Copy();this.Lvl[nLvl].Restart=isRestart?-1:0;History.Add(new CChangesAbstractNumLvlChange(this,oLvlOld,this.Lvl[nLvl].Copy(),nLvl))};CAbstractNum.prototype.SetLvlStart=function(nLvl,nStart){if("number"!==typeof nLvl||nLvl<0||nLvl>=9)return;var oLvlOld=this.Lvl[nLvl].Copy();this.Lvl[nLvl].Start=nStart;History.Add(new CChangesAbstractNumLvlChange(this,oLvlOld,this.Lvl[nLvl].Copy(),nLvl))};CAbstractNum.prototype.GetLvlStart=function(nLvl){if("number"!==typeof nLvl|| nLvl<0||nLvl>=9)return 1;return this.Lvl[nLvl].Start};CAbstractNum.prototype.SetLvlSuff=function(nLvl,nSuff){if("number"!==typeof nLvl||nLvl<0||nLvl>=9)return;var oLvlOld=this.Lvl[nLvl].Copy();this.Lvl[nLvl].Suff=nSuff;History.Add(new CChangesAbstractNumLvlChange(this,oLvlOld,this.Lvl[nLvl].Copy(),nLvl))};CAbstractNum.prototype.ApplyTextPr=function(nLvl,oTextPr){var oTextPrOld=this.Lvl[nLvl].TextPr.Copy();this.Lvl[nLvl].TextPr.Merge(oTextPr);History.Add(new CChangesAbstractNumTextPrChange(this,oTextPrOld, this.Lvl[nLvl].TextPr.Copy(),nLvl))};CAbstractNum.prototype.SetTextPr=function(nLvl,oTextPr){History.Add(new CChangesAbstractNumTextPrChange(this,this.Lvl[nLvl].TextPr,oTextPr.Copy(),nLvl));this.Lvl[nLvl].TextPr=oTextPr};CAbstractNum.prototype.SetParaPr=function(nLvl,oParaPr){History.Add(new CChangesAbstractNumParaPrChange(this,this.Lvl[nLvl].ParaPr,oParaPr.Copy(),nLvl));this.Lvl[nLvl].ParaPr=oParaPr};CAbstractNum.prototype.Refresh_RecalcData=function(Data){var oHistory=History;if(!oHistory)return; if(!oHistory.AddChangedNumberingToRecalculateData(this.Get_Id(),Data.Index,this))return;var oLogicDocument=editor.WordControl.m_oLogicDocument;if(!oLogicDocument)return;var oNumbering=oLogicDocument.GetNumbering();var arrNumPr=[];for(var sId in oNumbering.Num){var oNum=oNumbering.Num[sId];if(this.Id===oNum.GetAbstractNumId())arrNumPr.push(new CNumPr(oNum.GetId(),Data.Index))}var arrAllParagraphs=oLogicDocument.GetAllParagraphsByNumbering(arrNumPr);for(var nIndex=0,nCount=arrAllParagraphs.length;nIndex< nCount;++nIndex)arrAllParagraphs[nIndex].Refresh_RecalcData({Type:AscDFH.historyitem_Paragraph_Numbering})};CAbstractNum.prototype.Document_Is_SelectionLocked=function(nCheckType){return this.IsSelectionLocked(nCheckType)};CAbstractNum.prototype.IsSelectionLocked=function(nCheckType){switch(nCheckType){case AscCommon.changestype_Paragraph_Content:case AscCommon.changestype_Paragraph_Properties:case AscCommon.changestype_Paragraph_AddText:case AscCommon.changestype_Paragraph_TextProperties:case AscCommon.changestype_ContentControl_Add:{this.Lock.Check(this.Get_Id()); break}case AscCommon.changestype_Document_Content:case AscCommon.changestype_Document_Content_Add:case AscCommon.changestype_Image_Properties:{AscCommon.CollaborativeEditing.Add_CheckLock(true);break}}};CAbstractNum.prototype.Write_ToBinary2=function(Writer){Writer.WriteLong(AscDFH.historyitem_type_AbstractNum);Writer.WriteString2(this.Id);Writer.WriteString2(this.StyleLink?this.StyleLink:"");Writer.WriteString2(this.NumStyleLink?this.NumStyleLink:"");for(var nLvl=0;nLvl<9;++nLvl)this.Lvl[nLvl].WriteToBinary(Writer)}; CAbstractNum.prototype.Read_FromBinary2=function(Reader){this.Id=Reader.GetString2();this.StyleLink=Reader.GetString2();this.NumStyleLink=Reader.GetString2();if(""===this.StyleLink)this.StyleLink=undefined;if(""===this.NumStyleLink)this.NumStyleLink=undefined;for(var nLvl=0;nLvl<9;++nLvl){this.Lvl[nLvl]=new CNumberingLvl;this.Lvl[nLvl].ReadFromBinary(Reader)}var Numbering=editor.WordControl.m_oLogicDocument.Get_Numbering();Numbering.AbstractNum[this.Id]=this};CAbstractNum.prototype.Process_EndLoad= function(Data){var iLvl=Data.iLvl;if(undefined!==iLvl)this.Recalc_CompiledPr(iLvl)};CAbstractNum.prototype.Recalc_CompiledPr=function(nLvl){this.private_RecalculateRelatedParagraphs(nLvl)};CAbstractNum.prototype.isEqual=function(abstractNum){var lvlUsuallyAdd=this.Lvl;var lvlNew=abstractNum.Lvl;for(var lvl=0;lvl=9)return;if(this.private_HaveLvlOverride(nLvl))this.SetLvlOverride(oNumberingLvl,nLvl);else{var oAbstractNum=this.Numbering.GetAbstractNum(this.AbstractNumId);if(!oAbstractNum)return;oAbstractNum.SetLvl(nLvl,oNumberingLvl)}};CNum.prototype.SetAscLvl=function(oAscNumberingLvl,nLvl){var oNumberingLvl=new CNumberingLvl;oNumberingLvl.FillFromAscNumberingLvl(oAscNumberingLvl);this.SetLvl(oNumberingLvl,nLvl)};CNum.prototype.SetLvlByType= function(nLvl,nType,sText,oTextPr){if("number"!==typeof nLvl||nLvl<0||nLvl>=9)return;if(this.private_HaveLvlOverride(nLvl)){var oNumberingLvl=new CNumberingLvl;oNumberingLvl.SetByType(nType,nLvl,sText,oTextPr);this.SetLvlOverride(oNumberingLvl,nLvl)}else{var oAbstractNum=this.Numbering.GetAbstractNum(this.AbstractNumId);if(!oAbstractNum)return;oAbstractNum.SetLvlByType(nLvl,nType,sText,oTextPr)}};CNum.prototype.SetLvlByFormat=function(nLvl,nType,sFormatText,nAlign){if("number"!==typeof nLvl||nLvl< 0||nLvl>=9)return;if(this.private_HaveLvlOverride(nLvl)){var oNumberingLvl=new CNumberingLvl;oNumberingLvl.SetByFormat(nLvl,nType,sFormatText,nAlign);this.SetLvlOverride(oNumberingLvl,nLvl)}else{var oAbstractNum=this.Numbering.GetAbstractNum(this.AbstractNumId);if(!oAbstractNum)return;oAbstractNum.SetLvlByFormat(nLvl,nType,sFormatText,nAlign)}};CNum.prototype.SetLvlRestart=function(nLvl,isRestart){if("number"!==typeof nLvl||nLvl<0||nLvl>=9)return;if(this.private_HaveLvlOverride(nLvl)){var oNumberingLvl= this.LvlOverride[nLvl].GetLvl();var oNewNumberingLvl=oNumberingLvl.Copy();oNewNumberingLvl.Restart=isRestart?-1:0;this.SetLvlOverride(oNewNumberingLvl,nLvl)}else{var oAbstractNum=this.Numbering.GetAbstractNum(this.AbstractNumId);if(!oAbstractNum)return;oAbstractNum.SetLvlRestart(nLvl,isRestart)}};CNum.prototype.SetLvlStart=function(nLvl,nStart){if("number"!==typeof nLvl||nLvl<0||nLvl>=9)return;if(this.private_HaveLvlOverride(nLvl)){var oNumberingLvl=this.LvlOverride[nLvl].GetLvl();var oNewNumberingLvl= oNumberingLvl.Copy();oNewNumberingLvl.Start=nStart;this.SetLvlOverride(oNewNumberingLvl,nLvl)}else{var oAbstractNum=this.Numbering.GetAbstractNum(this.AbstractNumId);if(!oAbstractNum)return;oAbstractNum.SetLvlStart(nLvl,nStart)}};CNum.prototype.SetLvlSuff=function(nLvl,nSuff){if("number"!==typeof nLvl||nLvl<0||nLvl>=9)return;if(this.private_HaveLvlOverride(nLvl)){var oNumberingLvl=this.LvlOverride[nLvl].GetLvl();var oNewNumberingLvl=oNumberingLvl.Copy();oNewNumberingLvl.Suff=nSuff;this.SetLvlOverride(oNewNumberingLvl, nLvl)}else{var oAbstractNum=this.Numbering.GetAbstractNum(this.AbstractNumId);if(!oAbstractNum)return;oAbstractNum.SetLvlSuff(nLvl,nSuff)}};CNum.prototype.SetLvlOverride=function(oNumberingLvl,nLvl,nStartOverride){if(nLvl<0||nLvl>8)return;if(!oNumberingLvl&&!this.LvlOverride[nLvl]&&(-1===nStartOverride||undefined==nStartOverride))return;var oLvlOverrideOld=this.LvlOverride[nLvl];var oLvlOverrideNew=new CLvlOverride(oNumberingLvl,nLvl,nStartOverride);AscCommon.History.Add(new CChangesNumLvlOverrideChange(this, oLvlOverrideOld,oLvlOverrideNew,nLvl));this.LvlOverride[nLvl]=oLvlOverrideNew;this.RecalculateRelatedParagraphs(nLvl)};CNum.prototype.ClearAllLvlOverride=function(){for(var nLvl=0;nLvl<9;++nLvl)this.SetLvlOverride(undefined,nLvl)};CNum.prototype.SetAbstractNumId=function(sId){if(sId!==this.AbstractNumId){AscCommon.History.Add(new CChangesNumAbstractNum(this,this.AbstractNumId,sId));this.AbstractNumId=sId;this.RecalculateRelatedParagraphs(-1)}};CNum.prototype.RecalculateRelatedParagraphs=function(nLvl){if(nLvl< 0||nLvl>8)nLvl=undefined;var oLogicDocument=editor.WordControl.m_oLogicDocument;var arrParagraphs=oLogicDocument.GetAllParagraphsByNumbering?oLogicDocument.GetAllParagraphsByNumbering({NumId:this.Id,Lvl:nLvl}):[];for(var nIndex=0,nCount=arrParagraphs.length;nIndex8)return;if(this.private_HaveLvlOverride(nLvl)){var oNumberingLvl=this.LvlOverride[nLvl].GetLvl();var oNewNumberingLvl= oNumberingLvl.Copy();oNewNumberingLvl.TextPr.Merge(oTextPr());this.SetLvlOverride(oNewNumberingLvl,nLvl)}else{var oAbstractNum=this.Numbering.GetAbstractNum(this.AbstractNumId);if(!oAbstractNum)return;oAbstractNum.ApplyTextPr(nLvl,oTextPr)}};CNum.prototype.ShiftLeftInd=function(nLeftNew){var oFirstLevel=this.GetLvl(0);var nLeftOld=oFirstLevel.ParaPr.Ind.Left?oFirstLevel.ParaPr.Ind.Left:0;for(var nLvl=0;nLvl<9;++nLvl){var oLvlOld=this.GetLvl(nLvl);var oLvlNew=this.GetLvl(nLvl).Copy();oLvlNew.ParaPr.Ind.Left= oLvlOld.ParaPr.Ind.Left?oLvlOld.ParaPr.Ind.Left-nLeftOld+nLeftNew:nLeftNew-nLeftOld;this.SetLvl(oLvlNew,nLvl)}};CNum.prototype.GetNumStyleLink=function(){var oAbstractNum=this.Numbering.GetAbstractNum(this.AbstractNumId);if(!oAbstractNum)return null;return oAbstractNum.GetNumStyleLink()};CNum.prototype.GetStyleLink=function(){var oAbstractNum=this.Numbering.GetAbstractNum(this.AbstractNumId);if(!oAbstractNum)return null;return oAbstractNum.GetStyleLink()};CNum.prototype.GetLvlByStyle=function(sStyleId){for(var nLvl= 0;nLvl<9;++nLvl){var oLvl=this.GetLvl(nLvl);if(oLvl&&sStyleId===oLvl.GetPStyle())return nLvl}return-1};CNum.prototype.private_GetNumberedLvlText=function(nLvl,nNumShift,isForceArabic){var nFormat=this.GetLvl(nLvl).GetFormat();if(true===isForceArabic&&nFormat!==Asc.c_oAscNumberingFormat.Decimal&&nFormat!==Asc.c_oAscNumberingFormat.DecimalZero)nFormat=Asc.c_oAscNumberingFormat.Decimal;return AscCommon.IntToNumberFormat(nNumShift,nFormat)};CNum.prototype.Draw=function(nX,nY,oContext,nLvl,oNumInfo,oNumTextPr, oTheme){var oLvl=this.GetLvl(nLvl);var arrText=oLvl.GetLvlText();var dKoef=oNumTextPr.VertAlign!==AscCommon.vertalign_Baseline?AscCommon.vaKSize:1;oContext.SetTextPr(oNumTextPr,oTheme);oContext.SetFontSlot(fontslot_ASCII,dKoef);g_oTextMeasurer.SetTextPr(oNumTextPr,oTheme);g_oTextMeasurer.SetFontSlot(fontslot_ASCII,dKoef);for(var nTextIndex=0,nTextLen=arrText.length;nTextIndex8)return;if(this.private_HaveLvlOverride(nLvl)){var oNumberingLvl=this.LvlOverride[nLvl].GetLvl();var oNewNumberingLvl=oNumberingLvl.Copy();oNewNumberingLvl.TextPr=oTextPr;this.SetLvlOverride(oNewNumberingLvl,nLvl)}else{var oAbstractNum=this.Numbering.GetAbstractNum(this.AbstractNumId);if(!oAbstractNum)return;oAbstractNum.SetTextPr(nLvl, oTextPr)}};CNum.prototype.SetParaPr=function(nLvl,oParaPr){if(nLvl<0||nLvl>8)return;if(this.private_HaveLvlOverride(nLvl)){var oNumberingLvl=this.LvlOverride[nLvl].GetLvl();var oNewNumberingLvl=oNumberingLvl.Copy();oNewNumberingLvl.ParaPr=oParaPr;this.SetLvlOverride(oNewNumberingLvl,nLvl)}else{var oAbstractNum=this.Numbering.GetAbstractNum(this.AbstractNumId);if(!oAbstractNum)return;oAbstractNum.SetParaPr(nLvl,oParaPr)}};CNum.prototype.FillToAscNum=function(oAscNum){oAscNum.NumId=this.GetId();for(var nLvl= 0;nLvl<9;++nLvl){var oLvl=this.GetLvl(nLvl);oLvl.FillToAscNumberingLvl(oAscNum.get_Lvl(nLvl))}};CNum.prototype.FillFromAscNum=function(oAscNum){for(var nLvl=0;nLvl<9;++nLvl){var oLvl=new CNumberingLvl;var oAscLvl=oAscNum.get_Lvl(nLvl);oLvl.FillFromAscNumberingLvl(oAscLvl);this.SetLvl(oLvl,nLvl)}};CNum.prototype.IsSimilar=function(oNum){if(!oNum)return false;for(var nLvl=0;nLvl<9;++nLvl){var oLvl=this.GetLvl(nLvl);if(!oLvl.IsSimilar(oNum.GetLvl(nLvl)))return false}return true};CNum.prototype.Refresh_RecalcData= function(Data){};CNum.prototype.Document_Is_SelectionLocked=function(nCheckType){return this.IsSelectionLocked(nCheckType)};CNum.prototype.IsSelectionLocked=function(nCheckType){switch(nCheckType){case AscCommon.changestype_Paragraph_Content:case AscCommon.changestype_Paragraph_Properties:case AscCommon.changestype_Paragraph_AddText:case AscCommon.changestype_Paragraph_TextProperties:case AscCommon.changestype_ContentControl_Add:{this.Lock.Check(this.Get_Id());break}case AscCommon.changestype_Document_Content:case AscCommon.changestype_Document_Content_Add:case AscCommon.changestype_Image_Properties:{AscCommon.CollaborativeEditing.Add_CheckLock(true); break}}var oAbstractNum=this.Numbering.GetAbstractNum(this.AbstractNumId);if(oAbstractNum)oAbstractNum.IsSelectionLocked(nCheckType)};CNum.prototype.Write_ToBinary2=function(oWriter){oWriter.WriteLong(AscDFH.historyitem_type_Num);oWriter.WriteString2(this.Id);oWriter.WriteString2(this.AbstractNumId);for(var nLvl=0;nLvl<9;++nLvl)if(this.LvlOverride[nLvl]){oWriter.WriteBool(true);this.LvlOverride[nLvl].WriteToBinary(oWriter)}else oWriter.WriteBool(false)};CNum.prototype.Read_FromBinary2=function(oReader){this.Id= oReader.GetString2();this.AbstractNumId=oReader.GetString2();for(var nLvl=0;nLvl<9;++nLvl)if(oReader.GetBool()){this.LvlOverride[nLvl]=new CLvlOverride;this.LvlOverride[nLvl].ReadFromBinary()}if(!this.Numbering)this.Numbering=editor.WordControl.m_oLogicDocument.GetNumbering();this.Numbering.AddNum(this)};function CLvlOverride(oNumberingLvl,nLvl,nStartOverride){this.NumberingLvl=oNumberingLvl;this.Lvl=nLvl;this.StartOverride=undefined!==nStartOverride?nStartOverride:-1}CLvlOverride.prototype.GetLvl= function(){return this.NumberingLvl};CLvlOverride.prototype.GetStartOverride=function(){return this.StartOverride};CLvlOverride.prototype.WriteToBinary=function(oWriter){oWriter.WriteLong(this.Lvl);oWriter.WriteLong(this.StartOverride);if(this.NumberingLvl){oWriter.WriteBool(false);this.NumberingLvl.WriteToBinary(oWriter)}else oWriter.WriteBool(true)};CLvlOverride.prototype.ReadFromBinary=function(oReader){this.Lvl=oReader.GetLong();this.StartOverride=oReader.GetLong();this.NumberingLvl=undefined; if(!oReader.GetBool()){this.NumberingLvl=new CNumberingLvl;this.NumberingLvl.ReadFromBinary(oReader)}};window["AscCommonWord"]=window["AscCommonWord"]||{};window["AscCommonWord"].CNum=CNum;"use strict";AscDFH.changesFactory[AscDFH.historyitem_Num_LvlOverrideChange]=CChangesNumLvlOverrideChange;AscDFH.changesFactory[AscDFH.historyitem_Num_AbstractNum]=CChangesNumAbstractNum;AscDFH.changesRelationMap[AscDFH.historyitem_Num_LvlOverrideChange]=[AscDFH.historyitem_Num_LvlOverrideChange];AscDFH.changesRelationMap[AscDFH.historyitem_Num_AbstractNum]= [AscDFH.historyitem_Num_AbstractNum];function CChangesNumLvlOverrideChange(Class,Old,New,nLvl){AscDFH.CChangesBaseProperty.call(this,Class,Old,New);this.Lvl=nLvl}CChangesNumLvlOverrideChange.prototype=Object.create(AscDFH.CChangesBaseProperty.prototype);CChangesNumLvlOverrideChange.prototype.constructor=CChangesNumLvlOverrideChange;CChangesNumLvlOverrideChange.prototype.Type=AscDFH.historyitem_Num_LvlOverrideChange;CChangesNumLvlOverrideChange.prototype.WriteToBinary=function(oWriter){oWriter.WriteLong(this.Lvl); var nFlags=0;if(undefined===this.New)nFlags|=1;if(undefined===this.Old)nFlags|=2;oWriter.WriteLong(nFlags);if(undefined!==this.New&&this.New.WriteToBinary)this.New.WriteToBinary(oWriter);if(undefined!==this.Old&&this.Old.WriteToBinary)this.Old.WriteToBinary(oWriter)};CChangesNumLvlOverrideChange.prototype.ReadFromBinary=function(oReader){this.Lvl=oReader.GetLong();var nFlags=oReader.GetLong();if(nFlags&1)this.New=undefined;else{this.New=new CLvlOverride;this.New.ReadFromBinary(oReader)}if(nFlags& 2)this.Old=undefined;else{this.Old=new CLvlOverride;this.Old.ReadFromBinary(oReader)}};CChangesNumLvlOverrideChange.prototype.private_SetValue=function(Value){var oNum=this.Class;oNum.LvlOverride[this.Lvl]=Value;oNum.RecalculateRelatedParagraphs(this.Lvl)};CChangesNumLvlOverrideChange.prototype.Load=function(Color){var oNum=this.Class;oNum.LvlOverride[this.Lvl]=this.New;AscCommon.CollaborativeEditing.Add_EndActions(this.Class,{Lvl:this.Lvl})};CChangesNumLvlOverrideChange.prototype.CreateReverseChange= function(){return new CChangesNumLvlOverrideChange(this.Class,this.New,this.Old,this.Lvl)};CChangesNumLvlOverrideChange.prototype.Merge=function(oChange){if(this.Class!==oChange.Class)return true;if(this.Type===oChange.Type)return false;return true};function CChangesNumAbstractNum(Class,Old,New,Color){AscDFH.CChangesBaseStringProperty.call(this,Class,Old,New,Color)}CChangesNumAbstractNum.prototype=Object.create(AscDFH.CChangesBaseStringProperty.prototype);CChangesNumAbstractNum.prototype.constructor= CChangesNumAbstractNum;CChangesNumAbstractNum.prototype.Type=AscDFH.historyitem_Num_AbstractNum;CChangesNumAbstractNum.prototype.private_SetValue=function(Value){this.Class.AbstractNumId=Value};"use strict";var g_oTextMeasurer=AscCommon.g_oTextMeasurer;var History=AscCommon.History;var numbering_presentationnumfrmt_AlphaLcParenBoth=0;var numbering_presentationnumfrmt_AlphaLcParenR=1;var numbering_presentationnumfrmt_AlphaLcPeriod=2;var numbering_presentationnumfrmt_AlphaUcParenBoth=3;var numbering_presentationnumfrmt_AlphaUcParenR= 4;var numbering_presentationnumfrmt_AlphaUcPeriod=5;var numbering_presentationnumfrmt_Arabic1Minus=6;var numbering_presentationnumfrmt_Arabic2Minus=7;var numbering_presentationnumfrmt_ArabicDbPeriod=8;var numbering_presentationnumfrmt_ArabicDbPlain=9;var numbering_presentationnumfrmt_ArabicParenBoth=10;var numbering_presentationnumfrmt_ArabicParenR=11;var numbering_presentationnumfrmt_ArabicPeriod=12;var numbering_presentationnumfrmt_ArabicPlain=13;var numbering_presentationnumfrmt_CircleNumDbPlain= 14;var numbering_presentationnumfrmt_CircleNumWdBlackPlain=15;var numbering_presentationnumfrmt_CircleNumWdWhitePlain=16;var numbering_presentationnumfrmt_Ea1ChsPeriod=17;var numbering_presentationnumfrmt_Ea1ChsPlain=18;var numbering_presentationnumfrmt_Ea1ChtPeriod=19;var numbering_presentationnumfrmt_Ea1ChtPlain=20;var numbering_presentationnumfrmt_Ea1JpnChsDbPeriod=21;var numbering_presentationnumfrmt_Ea1JpnKorPeriod=22;var numbering_presentationnumfrmt_Ea1JpnKorPlain=23;var numbering_presentationnumfrmt_Hebrew2Minus= 24;var numbering_presentationnumfrmt_HindiAlpha1Period=25;var numbering_presentationnumfrmt_HindiAlphaPeriod=26;var numbering_presentationnumfrmt_HindiNumParenR=27;var numbering_presentationnumfrmt_HindiNumPeriod=28;var numbering_presentationnumfrmt_RomanLcParenBoth=29;var numbering_presentationnumfrmt_RomanLcParenR=30;var numbering_presentationnumfrmt_RomanLcPeriod=31;var numbering_presentationnumfrmt_RomanUcParenBoth=32;var numbering_presentationnumfrmt_RomanUcParenR=33;var numbering_presentationnumfrmt_RomanUcPeriod= 34;var numbering_presentationnumfrmt_ThaiAlphaParenBoth=35;var numbering_presentationnumfrmt_ThaiAlphaParenR=36;var numbering_presentationnumfrmt_ThaiAlphaPeriod=37;var numbering_presentationnumfrmt_ThaiNumParenBoth=38;var numbering_presentationnumfrmt_ThaiNumParenR=39;var numbering_presentationnumfrmt_ThaiNumPeriod=40;var numbering_presentationnumfrmt_None=100;var numbering_presentationnumfrmt_Char=101;function IsAlphaPrNumbering(nType){if(AscFormat.isRealNumber(nType))return nType>=numbering_presentationnumfrmt_AlphaLcParenBoth&& nType<=numbering_presentationnumfrmt_AlphaUcPeriod;return false}function IsArabicPrNumbering(nType){if(AscFormat.isRealNumber(nType))return nType>=numbering_presentationnumfrmt_Arabic1Minus&&nType<=numbering_presentationnumfrmt_ArabicPlain;return false}function IsCirclePrNumbering(nType){if(AscFormat.isRealNumber(nType))return nType>=numbering_presentationnumfrmt_CircleNumDbPlain&&nType<=numbering_presentationnumfrmt_CircleNumWdWhitePlain;return false}function IsEaPrNumbering(nType){if(AscFormat.isRealNumber(nType))return nType>= numbering_presentationnumfrmt_Ea1ChsPeriod&&nType<=numbering_presentationnumfrmt_Ea1JpnKorPlain;return false}function IsHebrewPrNumbering(nType){return nType===numbering_presentationnumfrmt_Hebrew2Minus}function IsHindiPrNumbering(nType){if(AscFormat.isRealNumber(nType))return nType>=numbering_presentationnumfrmt_HindiAlpha1Period&&nType<=numbering_presentationnumfrmt_HindiNumPeriod;return false}function IsRomanPrNumbering(nType){if(AscFormat.isRealNumber(nType))return nType>=numbering_presentationnumfrmt_RomanLcParenBoth&& nType<=numbering_presentationnumfrmt_RomanUcPeriod;return false}function IsThaiPrNumbering(nType){if(AscFormat.isRealNumber(nType))return nType>=numbering_presentationnumfrmt_ThaiAlphaParenBoth&&nType<=numbering_presentationnumfrmt_ThaiNumPeriod;return false}function IsPrNumberingSameType(nType1,nType2){return IsAlphaPrNumbering(nType1)&&IsAlphaPrNumbering(nType2)||IsArabicPrNumbering(nType1)&&IsArabicPrNumbering(nType2)||IsCirclePrNumbering(nType1)&&IsCirclePrNumbering(nType2)||IsEaPrNumbering(nType1)&& IsEaPrNumbering(nType2)||IsHebrewPrNumbering(nType1)&&IsHebrewPrNumbering(nType2)||IsHindiPrNumbering(nType1)&&IsHindiPrNumbering(nType2)||IsRomanPrNumbering(nType1)&&IsRomanPrNumbering(nType2)||IsThaiPrNumbering(nType1)&&IsThaiPrNumbering(nType2)}function CPresentationBullet(){this.m_nType=numbering_presentationnumfrmt_None;this.m_nStartAt=null;this.m_sChar=null;this.m_oColor={r:0,g:0,b:0,a:255};this.m_bColorTx=true;this.Unifill=null;this.m_sFont="Arial";this.m_bFontTx=true;this.m_dSize=1;this.m_bSizeTx= false;this.m_bSizePct=true;this.m_oTextPr=null;this.m_nNum=null;this.m_sString=null}CPresentationBullet.prototype.Get_Type=function(){return this.m_nType};CPresentationBullet.prototype.Get_StartAt=function(){return this.m_nStartAt};CPresentationBullet.prototype.Measure=function(Context,FirstTextPr,Num,Theme,ColorMap){var sT="";switch(this.m_nType){case numbering_presentationnumfrmt_Char:{if(null!=this.m_sChar)sT=this.m_sChar;break}case numbering_presentationnumfrmt_AlphaLcParenBoth:{sT="("+Numbering_Number_To_Alpha(Num, true)+")";break}case numbering_presentationnumfrmt_AlphaLcParenR:{sT=Numbering_Number_To_Alpha(Num,true)+")";break}case numbering_presentationnumfrmt_AlphaLcPeriod:{sT=Numbering_Number_To_Alpha(Num,true)+".";break}case numbering_presentationnumfrmt_AlphaUcParenBoth:{sT="("+Numbering_Number_To_Alpha(Num,false)+")";break}case numbering_presentationnumfrmt_AlphaUcParenR:{sT=Numbering_Number_To_Alpha(Num,false)+")";break}case numbering_presentationnumfrmt_AlphaUcPeriod:{sT=Numbering_Number_To_Alpha(Num, false)+".";break}case numbering_presentationnumfrmt_ArabicParenBoth:{sT+="("+Numbering_Number_To_String(Num)+")";break}case numbering_presentationnumfrmt_ArabicParenR:{sT+=Numbering_Number_To_String(Num)+")";break}case numbering_presentationnumfrmt_ArabicPeriod:{sT+=Numbering_Number_To_String(Num)+".";break}case numbering_presentationnumfrmt_ArabicPlain:{sT+=Numbering_Number_To_String(Num);break}case numbering_presentationnumfrmt_RomanLcParenBoth:{sT+="("+Numbering_Number_To_Roman(Num,true)+")";break}case numbering_presentationnumfrmt_RomanLcParenR:{sT+= Numbering_Number_To_Roman(Num,true)+")";break}case numbering_presentationnumfrmt_RomanLcPeriod:{sT+=Numbering_Number_To_Roman(Num,true)+".";break}case numbering_presentationnumfrmt_RomanUcParenBoth:{sT+="("+Numbering_Number_To_Roman(Num,false)+")";break}case numbering_presentationnumfrmt_RomanUcParenR:{sT+=Numbering_Number_To_Roman(Num,false)+")";break}case numbering_presentationnumfrmt_RomanUcPeriod:{sT+=Numbering_Number_To_Roman(Num,false)+".";break}case numbering_presentationnumfrmt_None:{break}default:{sT+= Numbering_Number_To_String(Num)+".";break}}this.m_sString=sT;this.m_nNum=Num;if(sT.length===0)return{Width:0};var dFontSize=FirstTextPr.FontSize;if(false===this.m_bSizeTx)if(true===this.m_bSizePct)dFontSize*=this.m_dSize;else dFontSize=this.m_dSize;var RFonts;if(!this.m_bFontTx)RFonts={Ascii:{Name:this.m_sFont,Index:-1},EastAsia:{Name:this.m_sFont,Index:-1},CS:{Name:this.m_sFont,Index:-1},HAnsi:{Name:this.m_sFont,Index:-1}};else RFonts=FirstTextPr.RFonts;var FirstTextPr_=FirstTextPr.Copy();if(FirstTextPr_.Underline)FirstTextPr_.Underline= false;if(true===this.m_bColorTx||!this.Unifill)if(FirstTextPr.Unifill)this.Unifill=FirstTextPr_.Unifill;else this.Unifill=AscFormat.CreteSolidFillRGB(FirstTextPr.Color.r,FirstTextPr.Color.g,FirstTextPr.Color.b);var TextPr_=new CTextPr;var bIsNumbered=this.IsNumbered();TextPr_.Set_FromObject({RFonts:RFonts,Unifill:this.Unifill,FontSize:dFontSize,Bold:bIsNumbered?FirstTextPr.Bold:false,Italic:bIsNumbered?FirstTextPr.Italic:false});FirstTextPr_.Merge(TextPr_);this.m_oTextPr=FirstTextPr_;var X=0;var OldTextPr= Context.GetTextPr();var Hint=this.m_oTextPr.RFonts.Hint;var bCS=this.m_oTextPr.CS;var bRTL=this.m_oTextPr.RTL;var lcid=this.m_oTextPr.Lang.EastAsia;var FontSlot=g_font_detector.Get_FontClass(sT.charCodeAt(0),Hint,lcid,bCS,bRTL);Context.SetTextPr(this.m_oTextPr,Theme);Context.SetFontSlot(FontSlot);for(var Index2=0;Index2>0);g=Math.min(255,g*dAlpha+ gB*(1-dAlpha)+.5>>0);b=Math.min(255,b*dAlpha+bB*(1-dAlpha)+.5>>0)}Context.p_color(r,g,b,255);Context.b_color1(r,g,b,255)}g_oTextMeasurer.SetTextPr(this.m_oTextPr,PDSE.Theme);g_oTextMeasurer.SetFontSlot(FontSlot);for(var Index2=0;Index2=numbering_presentationnumfrmt_AlphaLcParenBoth&&this.m_nType<=numbering_presentationnumfrmt_ThaiNumPeriod};CPresentationBullet.prototype.IsNone=function(){return this.m_nType===numbering_presentationnumfrmt_None};CPresentationBullet.prototype.IsAlpha=function(){return IsAlphaPrNumbering(this.m_nType)};window["AscCommonWord"]=window["AscCommonWord"]||{};"use strict";function CNumbering(){this.AbstractNum={};this.Num={}}CNumbering.prototype.CopyAllNums=function(oNumbering){if(!oNumbering)oNumbering= this;var oAbstractMap={};var oNumMap={};var oNewAbstractNums={};var oNewNums={};for(var sOldId in this.AbstractNum){var oOldAbstractNum=this.AbstractNum[sOldId];var oNewAbstractNum=new CAbstractNum;var sNewId=oNewAbstractNum.GetId();oNewAbstractNum.Copy(oOldAbstractNum);oNewAbstractNums[sNewId]=oNewAbstractNum;oAbstractMap[sOldId]=sNewId}for(var sOldId in this.Num){var oOldNum=this.Num[sOldId];var oNewNum=new CNum(oNumbering,oAbstractMap[oOldNum.AbstractNumId]);for(var nLvl=0;nLvl<9;++nLvl)if(oOldNum.LvlOverride[nLvl]&& oOldNum.LvlOverride[nLvl].NumberingLvl)oNewNum.SetLvlOverride(oOldNum.LvlOverride[nLvl].GetLvl().Copy(),nLvl,oOldNum.LvlOverride[nLvl].GetStartOverride());var sNewId=oNewNum.GetId();oNewNums[sNewId]=oNewNum;oNumMap[sOldId]=sNewId}return{AbstractNum:oNewAbstractNums,AbstractMap:oAbstractMap,Num:oNewNums,NumMap:oNumMap}};CNumbering.prototype.Clear=function(){this.AbstractNum={};this.Num={}};CNumbering.prototype.AppendAbstractNums=function(oAbstractNums){for(var sId in oAbstractNums)if(undefined===this.AbstractNum[sId])this.AbstractNum[sId]= oAbstractNums[sId]};CNumbering.prototype.AppendNums=function(oNums){for(var sId in oNums)if(undefined===this.Num[sId])this.Num[sId]=oNums[sId]};CNumbering.prototype.CreateAbstractNum=function(){var oAbstractNum=new CAbstractNum;this.AbstractNum[oAbstractNum.GetId()]=oAbstractNum;return oAbstractNum};CNumbering.prototype.AddAbstractNum=function(oAbstractNum){if(!(oAbstractNum instanceof CAbstractNum))return;var sId=oAbstractNum.GetId();this.AbstractNum[sId]=oAbstractNum;return sId};CNumbering.prototype.AddNum= function(oNum){if(!(oNum instanceof CNum))return;var sNumId=oNum.GetId();this.Num[sNumId]=oNum;return sNumId};CNumbering.prototype.GetAbstractNum=function(sId){var oAbstractNum=this.AbstractNum[sId];if(oAbstractNum&&oAbstractNum.GetNumStyleLink()){var oStyles=editor.WordControl.m_oLogicDocument.GetStyles();var oNumStyle=oStyles.Get(oAbstractNum.GetNumStyleLink());if(oNumStyle&&oNumStyle.ParaPr.NumPr&&undefined!==oNumStyle.ParaPr.NumPr.NumId){var oStyleNum=this.GetNum(oNumStyle.ParaPr.NumPr.NumId); if(!oStyleNum)return null;return oStyleNum.GetAbstractNum()}}return oAbstractNum};CNumbering.prototype.CreateNum=function(){var oAbstractNum=new CAbstractNum;this.AbstractNum[oAbstractNum.GetId()]=oAbstractNum;var oNum=new CNum(this,oAbstractNum.GetId());this.Num[oNum.GetId()]=oNum;return oNum};CNumbering.prototype.GetNum=function(sId){if(this.Num[sId])return this.Num[sId];return null};CNumbering.prototype.GetParaPr=function(sNumId,nLvl){var oNum=this.GetNum(sNumId);if(oNum)return oNum.GetLvl(nLvl).GetParaPr(); return new CParaPr};CNumbering.prototype.GetNumFormat=function(sNumId,nLvl){var oNum=this.GetNum(sNumId);if(!oNum)return Asc.c_oAscNumberingFormat.Bullet;var oLvl=oNum.GetLvl(nLvl);if(!oLvl)return Asc.c_oAscNumberingFormat.Bullet;return oLvl.Format};CNumbering.prototype.CheckFormat=function(sNumId,nLvl,nType){var nFormat=this.GetNumFormat(sNumId,nLvl);if(Asc.c_oAscNumberingFormat.BulletFlag&nFormat&&Asc.c_oAscNumberingFormat.BulletFlag&nType||Asc.c_oAscNumberingFormat.NumberedFlag&nFormat&&Asc.c_oAscNumberingFormat.NumberedFlag& nType)return true;return false};CNumbering.prototype.Draw=function(sNumId,nLvl,nX,nY,oContext,oNumInfo,oTextPr,oTheme){var oNum=this.GetNum(sNumId);return oNum.Draw(nX,nY,oContext,nLvl,oNumInfo,oTextPr,oTheme)};CNumbering.prototype.Measure=function(sNumId,nLvl,oContext,oNumInfo,oTextPr,oTheme){var oNum=this.GetNum(sNumId);return oNum.Measure(oContext,nLvl,oNumInfo,oTextPr,oTheme)};CNumbering.prototype.CreateFontCharMap=function(oFontCharMap,oNumTextPr,oNumPr,oNumInfo){var oNum=this.GetNum(oNumPr.NumId); oNum.CreateFontCharMap(oFontCharMap,oNumPr.Lvl,oNumInfo,oNumTextPr)};CNumbering.prototype.GetAllFontNames=function(arrAllFonts){for(var sNumId in this.Num){var oNum=this.GetNum(sNumId);oNum.GetAllFontNames(arrAllFonts)}arrAllFonts["Symbol"]=true;arrAllFonts["Courier New"]=true;arrAllFonts["Wingdings"]=true};CNumbering.prototype.GetText=function(sNumId,nLvl,oNumInfo,bWithoutLastLvlText){var oNum=this.GetNum(sNumId);return oNum.GetText(nLvl,oNumInfo,bWithoutLastLvlText)};"use strict";var hdrftr_Header= AscCommon.hdrftr_Header;var hdrftr_Footer=AscCommon.hdrftr_Footer;var g_oTableId=AscCommon.g_oTableId;var History=AscCommon.History;function CHeaderFooter(Parent,LogicDocument,DrawingDocument,Type){this.Id=AscCommon.g_oIdCounter.Get_NewId();this.Parent=Parent;this.DrawingDocument=DrawingDocument;this.LogicDocument=LogicDocument;if("undefined"!=typeof LogicDocument&&null!=LogicDocument)if(Type===hdrftr_Header){this.Content=new CDocumentContent(this,DrawingDocument,0,0,0,0,false,true);this.Content.Content[0].Style_Add(this.Get_Styles().Get_Default_Header())}else{this.Content= new CDocumentContent(this,DrawingDocument,0,0,0,0,false,true);this.Content.Content[0].Style_Add(this.Get_Styles().Get_Default_Footer())}this.Type=Type;this.RecalcInfo={CurPage:-1,RecalcObj:{},NeedRecalc:{},PageNumInfo:{},SectPr:{},LastPage:-1,RequestedPage:-1};this.PageCountElements=[];g_oTableId.Add(this,this.Id)}CHeaderFooter.prototype={Get_Id:function(){return this.Id},Get_Theme:function(){return this.LogicDocument.Get_Theme()},Get_ColorMap:function(){return this.LogicDocument.Get_ColorMap()}, Copy:function(oLogicDocument,oCopyPr){if(!oLogicDocument)oLogicDocument=this.LogicDocument;var oNewHdrFtr=new CHeaderFooter(oLogicDocument.GetHdrFtr(),oLogicDocument,oLogicDocument.GetDrawingDocument(),this.Type);oNewHdrFtr.Content.Copy2(this.Content,oCopyPr);return oNewHdrFtr},Set_Page:function(Page_abs){if(Page_abs>this.RecalcInfo.LastPage){this.RecalcInfo.RequestedPage=Page_abs;return}if(Page_abs!==this.RecalcInfo.CurPage&&undefined!==this.LogicDocument.Pages[Page_abs]){var HdrFtrController=this.Parent; var HdrFtrPage=this.Parent.Pages[Page_abs];if(undefined===HdrFtrPage||this!==HdrFtrPage.Header&&this!==HdrFtrPage.Footer)return;var RecalcObj=this.RecalcInfo.RecalcObj[Page_abs];if(undefined!==RecalcObj){this.RecalcInfo.CurPage=Page_abs;this.Content.LoadRecalculateObject(RecalcObj)}}},Is_NeedRecalculate:function(PageAbs){var PageNumInfo=this.LogicDocument.Get_SectionPageNumInfo(PageAbs);if(true!==this.RecalcInfo.NeedRecalc[PageAbs]&&true===PageNumInfo.Compare(this.RecalcInfo.PageNumInfo[PageAbs])&& undefined!==this.RecalcInfo.RecalcObj[PageAbs])return false;return true},Recalculate:function(Page_abs,SectPr){var bChanges=false;var RecalcObj=this.RecalcInfo.RecalcObj[Page_abs];var OldSumH=0;var OldBounds=null;var OldFlowPos=[];if(undefined===RecalcObj)bChanges=true;else{OldSumH=RecalcObj.GetSummaryHeight();OldBounds=RecalcObj.Get_PageBounds(0);RecalcObj.Get_DrawingFlowPos(OldFlowPos)}this.Content.Set_StartPage(Page_abs);this.Content.PrepareRecalculateObject();this.Clear_PageCountElements();var CurPage= 0;var RecalcResult=recalcresult2_NextPage;while(recalcresult2_End!=RecalcResult)RecalcResult=this.Content.Recalculate_Page(CurPage++,true);this.RecalcInfo.RecalcObj[Page_abs]=this.Content.SaveRecalculateObject();this.RecalcInfo.PageNumInfo[Page_abs]=this.LogicDocument.Get_SectionPageNumInfo(Page_abs);this.RecalcInfo.SectPr[Page_abs]=SectPr;this.RecalcInfo.NeedRecalc[Page_abs]=false;this.RecalcInfo.LastPage=Page_abs;if(false===bChanges){var NewBounds=this.Content.Get_PageBounds(0);if(Math.abs(NewBounds.Bottom- OldBounds.Bottom)>.001&&hdrftr_Header===this.Type||Math.abs(NewBounds.Top-OldBounds.Top)>.001&&hdrftr_Footer===this.Type)bChanges=true}if(false===bChanges){var NewFlowPos=[];var AllDrawingObjects=this.Content.GetAllDrawingObjects();var Count=AllDrawingObjects.length;for(var Index=0;Index.001||Math.abs(OldObj.Y-NewObj.Y)>.001||Math.abs(OldObj.H-NewObj.H)>.001||Math.abs(OldObj.W-NewObj.W)>.001){bChanges=true;break}}}if(false===bChanges){var NewSumH=this.Content.GetSummaryHeight();if(Math.abs(OldSumH-NewSumH)>.001)bChanges=true}if(-1=== this.RecalcInfo.CurPage||false===this.LogicDocument.Get_SectionPageNumInfo(this.RecalcInfo.CurPage).Compare(this.RecalcInfo.PageNumInfo[this.RecalcInfo.CurPage])||-1!==this.RecalcInfo.RequestedPage&&this.RecalcInfo.RequestedPage===Page_abs){this.RecalcInfo.CurPage=Page_abs;if(docpostype_HdrFtr===this.LogicDocument.GetDocPosType()){this.LogicDocument.UpdateSelection();this.LogicDocument.UpdateInterface();if(-1!==this.RecalcInfo.RequestedPage&&this.RecalcInfo.RequestedPage===Page_abs){this.LogicDocument.NeedUpdateTarget= true;this.RecalcInfo.RequestedPage=-1}}}else{var RecalcObj=this.RecalcInfo.RecalcObj[this.RecalcInfo.CurPage];this.Content.LoadRecalculateObject(RecalcObj)}return bChanges},Recalculate2:function(Page_abs){this.Content.Set_StartPage(Page_abs);this.Content.PrepareRecalculateObject();var CurPage=0;var RecalcResult=recalcresult2_NextPage;while(recalcresult2_End!=RecalcResult)RecalcResult=this.Content.Recalculate_Page(CurPage++,true)},Reset_RecalculateCache:function(){this.Refresh_RecalcData2();this.Content.Reset_RecalculateCache()}, Get_Styles:function(){return this.LogicDocument.Get_Styles()},Get_TableStyleForPara:function(){return null},Get_ShapeStyleForPara:function(){return null},Get_TextBackGroundColor:function(){return undefined},Get_PageContentStartPos:function(){return{X:this.Content.X,Y:0,XLimit:this.Content.XLimit,YLimit:0}},Set_CurrentElement:function(bUpdateStates,PageAbs){var PageIndex=-1;if(undefined!==PageAbs&&null!==PageAbs&&this.Parent.Pages[PageAbs])if(this===this.Parent.Pages[PageAbs].Header||this===this.Parent.Pages[PageAbs].Footer)PageIndex= PageAbs;if(-1===PageIndex)for(var Key in this.Parent.Pages){var PIndex=Key|0;if((this===this.Parent.Pages[PIndex].Header||this===this.Parent.Pages[PIndex].Footer)&&(-1===PageIndex||PageIndex>PIndex))PageIndex=PIndex}this.Parent.CurHdrFtr=this;this.Parent.WaitMouseDown=true;this.Parent.CurPage=PageIndex;if(-1===PageIndex)this.RecalcInfo.CurPage=-1;var OldDocPosType=this.LogicDocument.GetDocPosType();this.LogicDocument.SetDocPosType(docpostype_HdrFtr);if(true===bUpdateStates&&-1!==PageIndex){this.Set_Page(PageIndex); this.LogicDocument.Document_UpdateInterfaceState();this.LogicDocument.Document_UpdateRulersState();this.LogicDocument.Document_UpdateSelectionState()}if(docpostype_HdrFtr!==OldDocPosType){this.DrawingDocument.ClearCachePages();this.DrawingDocument.FirePaint()}},Is_ThisElementCurrent:function(){if(this===this.Parent.CurHdrFtr&&docpostype_HdrFtr===this.LogicDocument.GetDocPosType())return true;return false},Reset:function(X,Y,XLimit,YLimit){this.Content.Reset(X,Y,XLimit,YLimit)},Draw:function(nPageIndex, pGraphics){this.Content.Draw(nPageIndex,pGraphics)},OnContentRecalculate:function(bChange,bForceRecalc){return},OnContentReDraw:function(StartPage,EndPage){this.DrawingDocument.ClearCachePages();this.DrawingDocument.FirePaint()},RecalculateCurPos:function(){if(-1!==this.RecalcInfo.CurPage)return this.Content.RecalculateCurPos();this.DrawingDocument.UpdateTarget(0,0,this.Content.Get_StartPage_Absolute());return null},Get_NearestPos:function(X,Y,bAnchor,Drawing){return this.Content.Get_NearestPos(0, X,Y,bAnchor,Drawing)},Get_Numbering:function(){return this.LogicDocument.Get_Numbering()},Get_Bounds:function(){return this.Content.Get_PageBounds(0)},Get_DividingLine:function(PageIndex){var OldPage=this.RecalcInfo.CurPage;this.Set_Page(PageIndex);var Bounds=this.Get_Bounds();if(-1!==OldPage)this.Set_Page(OldPage);if(hdrftr_Footer===this.Type)return Bounds.Top;else return Bounds.Bottom},Is_PointInDrawingObjects:function(X,Y){return this.Content.Is_PointInDrawingObjects(X,Y,this.Content.Get_StartPage_Absolute())}, Is_PointInFlowTable:function(X,Y){return this.Content.Is_PointInFlowTable(X,Y,this.Content.Get_StartPage_Absolute())},CheckRange:function(X0,Y0,X1,Y1,_Y0,_Y1,X_lf,X_rf,bMathWrap){return this.Content.CheckRange(X0,Y0,X1,Y1,_Y0,_Y1,X_lf,X_rf,0,false,bMathWrap)},AddPageNum:function(nAlign){var StyleId=null;if(this.Type===hdrftr_Header)StyleId=this.Get_Styles().Get_Default_Header();else StyleId=this.Get_Styles().Get_Default_Footer();this.Content.SetHdrFtrPageNum(nAlign,StyleId)},IsCell:function(isReturnCell){if(true=== isReturnCell)return null;return false},Check_AutoFit:function(){return false},IsHdrFtr:function(bReturnHdrFtr){if(true===bReturnHdrFtr)return this;return true},IsFootnote:function(bReturnFootnote){return bReturnFootnote?null:false},Get_ParentTextTransform:function(){return null},Is_DrawingShape:function(bRetShape){if(bRetShape===true)return null;return false},Is_TopDocument:function(bReturnTopDocument){if(true===bReturnTopDocument)return this.Content;return true},IsInTable:function(bReturnTopTable){if(true=== bReturnTopTable)return null;return false},IsSelectionUse:function(){return this.Content.IsSelectionUse()},IsNumberingSelection:function(){return this.Content.IsNumberingSelection()},IsTextSelectionUse:function(){return this.Content.IsTextSelectionUse()},Is_UseInDocument:function(Id){if(null!=this.Parent)return this.Parent.Is_UseInDocument(this.Get_Id());return false},Check_Page:function(PageIndex){return this.Parent.Check_Page(this,PageIndex)},GetCurPosXY:function(){return this.Content.GetCurPosXY()}, GetSelectedText:function(bClearText,oPr){return this.Content.GetSelectedText(bClearText,oPr)},GetSelectedElementsInfo:function(Info){this.Content.GetSelectedElementsInfo(Info)},GetSelectedContent:function(SelectedContent){this.Content.GetSelectedContent(SelectedContent)},UpdateCursorType:function(X,Y,PageAbs){if(PageAbs!=this.Content.Get_StartPage_Absolute())this.DrawingDocument.SetCursorType("text",new AscCommon.CMouseMoveData);else return this.Content.UpdateCursorType(X,Y,0)},IsTableBorder:function(X, Y,PageAbs){this.Set_Page(PageAbs);return this.Content.IsTableBorder(X,Y,0)},IsInText:function(X,Y,PageAbs){this.Set_Page(PageAbs);return this.Content.IsInText(X,Y,0)},IsInDrawing:function(X,Y,PageAbs){this.Set_Page(PageAbs);return this.Content.IsInDrawing(X,Y,0)},Document_UpdateInterfaceState:function(){this.Content.Document_UpdateInterfaceState()},Document_UpdateRulersState:function(){if(-1===this.RecalcInfo.CurPage)return;var Index=this.LogicDocument.Pages[this.RecalcInfo.CurPage].Pos;var SectPr= this.LogicDocument.SectionsInfo.Get_SectPr(Index).SectPr;var Bounds=this.Get_Bounds();if(this.Type===hdrftr_Header)this.DrawingDocument.Set_RulerState_HdrFtr(true,Bounds.Top,Math.max(Bounds.Bottom,SectPr.GetPageMarginTop()));else this.DrawingDocument.Set_RulerState_HdrFtr(false,Bounds.Top,SectPr.GetPageHeight());this.Content.Document_UpdateRulersState(this.Content.Get_StartPage_Absolute())},Document_UpdateSelectionState:function(){if(-1===this.RecalcInfo.CurPage){this.DrawingDocument.TargetEnd(); this.DrawingDocument.SelectEnabled(false);this.LogicDocument.NeedUpdateTarget=true;return}if(docpostype_DrawingObjects==this.Content.CurPos.Type)return this.LogicDocument.DrawingObjects.documentUpdateSelectionState();else if(true===this.Content.IsSelectionUse())if(selectionflag_Numbering==this.Content.Selection.Flag){this.DrawingDocument.TargetEnd();this.DrawingDocument.SelectEnabled(true);this.DrawingDocument.SelectClear();this.DrawingDocument.SelectShow()}else if(null!=this.Content.Selection.Data&& true===this.Content.Selection.Data.TableBorder&&type_Table==this.Content.Content[this.Content.Selection.Data.Pos].GetType())this.DrawingDocument.TargetEnd();else if(false===this.Content.IsSelectionEmpty()){if(true!==this.Content.Selection.Start)this.RecalculateCurPos();this.DrawingDocument.TargetEnd();this.DrawingDocument.SelectEnabled(true);this.DrawingDocument.SelectClear();this.DrawingDocument.SelectShow()}else{this.DrawingDocument.SelectEnabled(false);this.RecalculateCurPos();this.DrawingDocument.TargetStart(); this.DrawingDocument.TargetShow();if(this.LogicDocument&&this.LogicDocument.IsFillingFormMode()){var oContentControl=this.LogicDocument.GetContentControl();if(oContentControl&&oContentControl.IsCheckBox())this.DrawingDocument.TargetEnd()}}else{this.DrawingDocument.SelectEnabled(false);this.RecalculateCurPos();this.DrawingDocument.TargetStart();this.DrawingDocument.TargetShow();if(this.LogicDocument&&this.LogicDocument.IsFillingFormMode()){var oContentControl=this.LogicDocument.GetContentControl(); if(oContentControl&&oContentControl.IsCheckBox())this.DrawingDocument.TargetEnd()}}},AddNewParagraph:function(){this.Content.AddNewParagraph()},AddInlineImage:function(W,H,Img,Chart,bFlow){this.Content.AddInlineImage(W,H,Img,Chart,bFlow)},AddImages:function(aImages){this.Content.AddImages(aImages)},AddSignatureLine:function(oSignatureDrawing){this.Content.AddSignatureLine(oSignatureDrawing)},AddOleObject:function(W,H,nWidthPix,nHeightPix,Img,Data,sApplicationId){this.Content.AddOleObject(W,H,nWidthPix, nHeightPix,Img,Data,sApplicationId)},AddTextArt:function(nStyle){this.Content.AddTextArt(nStyle)},EditChart:function(Chart){this.Content.EditChart(Chart)},AddInlineTable:function(nCols,nRows,nMode){return this.Content.AddInlineTable(nCols,nRows,nMode)},AddToParagraph:function(ParaItem,bRecalculate){this.Content.AddToParagraph(ParaItem,bRecalculate)},ClearParagraphFormatting:function(isClearParaPr,isClearTextPr){this.Content.ClearParagraphFormatting(isClearParaPr,isClearTextPr)},PasteFormatting:function(TextPr, ParaPr,ApplyPara){this.Content.PasteFormatting(TextPr,ParaPr,ApplyPara)},Remove:function(Count,bOnlyText,bRemoveOnlySelection,bOnTextAdd,isWord){this.Content.Remove(Count,bOnlyText,bRemoveOnlySelection,bOnTextAdd,isWord)},GetCursorPosXY:function(){return this.Content.GetCursorPosXY()},MoveCursorLeft:function(AddToSelect,Word){var bRetValue=this.Content.MoveCursorLeft(AddToSelect,Word);this.Document_UpdateInterfaceState();this.Document_UpdateRulersState();return bRetValue},MoveCursorRight:function(AddToSelect, Word){var bRetValue=this.Content.MoveCursorRight(AddToSelect,Word);this.Document_UpdateInterfaceState();this.Document_UpdateRulersState();return bRetValue},MoveCursorUp:function(AddToSelect){var bRetValue=this.Content.MoveCursorUp(AddToSelect);this.Document_UpdateInterfaceState();this.Document_UpdateRulersState();return bRetValue},MoveCursorDown:function(AddToSelect){var bRetValue=this.Content.MoveCursorDown(AddToSelect);this.Document_UpdateInterfaceState();this.Document_UpdateRulersState();return bRetValue}, MoveCursorToEndOfLine:function(AddToSelect){var bRetValue=this.Content.MoveCursorToEndOfLine(AddToSelect);this.Document_UpdateInterfaceState();this.Document_UpdateRulersState();return bRetValue},MoveCursorToStartOfLine:function(AddToSelect){var bRetValue=this.Content.MoveCursorToStartOfLine(AddToSelect);this.Document_UpdateInterfaceState();this.Document_UpdateRulersState();return bRetValue},MoveCursorToStartPos:function(AddToSelect){var bRetValue=this.Content.MoveCursorToStartPos(AddToSelect);this.Document_UpdateInterfaceState(); this.Document_UpdateRulersState();return bRetValue},MoveCursorToEndPos:function(AddToSelect){var bRetValue=this.Content.MoveCursorToEndPos(AddToSelect);this.Document_UpdateInterfaceState();this.Document_UpdateRulersState();return bRetValue},MoveCursorToXY:function(X,Y,PageIndex,AddToSelect,bRemoveOldSelection){this.Set_Page(PageIndex);return this.Content.MoveCursorToXY(X,Y,AddToSelect,bRemoveOldSelection,PageIndex)},MoveCursorToCell:function(bNext){this.Content.MoveCursorToCell(bNext)},SetParagraphAlign:function(Align){return this.Content.SetParagraphAlign(Align)}, SetParagraphSpacing:function(Spacing){return this.Content.SetParagraphSpacing(Spacing)},SetParagraphIndent:function(Ind){return this.Content.SetParagraphIndent(Ind)},SetParagraphShd:function(Shd){return this.Content.SetParagraphShd(Shd)},SetParagraphStyle:function(Name){return this.Content.SetParagraphStyle(Name)},SetParagraphTabs:function(Tabs){return this.Content.SetParagraphTabs(Tabs)},SetParagraphContextualSpacing:function(Value){return this.Content.SetParagraphContextualSpacing(Value)},SetParagraphPageBreakBefore:function(Value){return this.Content.SetParagraphPageBreakBefore(Value)}, SetParagraphKeepLines:function(Value){return this.Content.SetParagraphKeepLines(Value)},SetParagraphKeepNext:function(Value){return this.Content.SetParagraphKeepNext(Value)},SetParagraphWidowControl:function(Value){return this.Content.SetParagraphWidowControl(Value)},SetParagraphBorders:function(Value){return this.Content.SetParagraphBorders(Value)},IncreaseDecreaseFontSize:function(bIncrease){return this.Content.IncreaseDecreaseFontSize(bIncrease)},IncreaseDecreaseIndent:function(bIncrease){return this.Content.IncreaseDecreaseIndent(bIncrease)}, SetImageProps:function(Props){return this.Content.SetImageProps(Props)},SetTableProps:function(Props){return this.Content.SetTableProps(Props)},GetCalculatedParaPr:function(){return this.Content.GetCalculatedParaPr()},GetCalculatedTextPr:function(){return this.Content.GetCalculatedTextPr()},GetDirectTextPr:function(){return this.Content.GetDirectTextPr()},GetDirectParaPr:function(){return this.Content.GetDirectParaPr()},GetAllParagraphs:function(Props,ParaArray){return this.Content.GetAllParagraphs(Props, ParaArray)},GetAllTables:function(oProps,arrTables){return this.Content.GetAllTables(oProps,arrTables)},GetAllDrawingObjects:function(arrDrawings){return this.Content.GetAllDrawingObjects(arrDrawings)},UpdateBookmarks:function(oBookmarkManager){this.Content.UpdateBookmarks(oBookmarkManager)},GetPrevElementEndInfo:function(CurElement){return null},RemoveSelection:function(bNoCheckDrawing){return this.Content.RemoveSelection(bNoCheckDrawing)},DrawSelectionOnPage:function(CurPage){return this.Content.DrawSelectionOnPage(0, true,true)},Selection_SetStart:function(X,Y,PageIndex,MouseEvent){this.Set_Page(PageIndex);if(true===editor.isStartAddShape){this.Content.SetDocPosType(docpostype_DrawingObjects);this.Content.Selection.Use=true;this.Content.Selection.Start=true;if(true!=this.LogicDocument.DrawingObjects.isPolylineAddition())this.LogicDocument.DrawingObjects.startAddShape(editor.addShapePreset);this.LogicDocument.DrawingObjects.OnMouseDown(MouseEvent,X,Y,PageIndex)}else return this.Content.Selection_SetStart(X,Y,0, MouseEvent)},Selection_SetEnd:function(X,Y,PageIndex,MouseEvent){this.Set_Page(PageIndex);return this.Content.Selection_SetEnd(X,Y,0,MouseEvent)},IsMovingTableBorder:function(){return this.Content.IsMovingTableBorder()},CheckPosInSelection:function(X,Y,PageAbs,NearPos){if(-1===this.RecalcInfo.CurPage)return false;var HdrFtrPage=this.Content.Get_StartPage_Absolute();if(undefined!==NearPos||HdrFtrPage===PageAbs)return this.Content.CheckPosInSelection(X,Y,0,NearPos);return false},SelectAll:function(){return this.Content.SelectAll()}, GetCurrentParagraph:function(bIgnoreSelection,arrSelectedParagraphs){return this.Content.GetCurrentParagraph(bIgnoreSelection,arrSelectedParagraphs)},GetCurrentTablesStack:function(arrTables){return this.Content.GetCurrentTablesStack(arrTables)},StartSelectionFromCurPos:function(){this.Content.StartSelectionFromCurPos()},Get_StartPage_Absolute:function(){return 0},Get_StartPage_Relative:function(){return 0},Get_AbsolutePage:function(CurPage){return CurPage},Get_AbsoluteColumn:function(CurPage){return 0}, AddTableRow:function(bBefore,nCount){this.Content.AddTableRow(bBefore,nCount)},AddTableColumn:function(bBefore,nCount){this.Content.AddTableColumn(bBefore,nCount)},RemoveTableRow:function(){this.Content.RemoveTableRow()},RemoveTableColumn:function(){this.Content.RemoveTableColumn()},MergeTableCells:function(){this.Content.MergeTableCells()},SplitTableCells:function(Cols,Rows){this.Content.SplitTableCells(Cols,Rows)},RemoveTableCells:function(){this.Content.RemoveTableCells()},RemoveTable:function(){this.Content.RemoveTable()}, SelectTable:function(Type){this.Content.SelectTable(Type)},CanMergeTableCells:function(){return this.Content.CanMergeTableCells()},CanSplitTableCells:function(){return this.Content.CanSplitTableCells()},CheckTableCoincidence:function(Table){return false},DistributeTableCells:function(isHorizontally){return this.Content.DistributeTableCells(isHorizontally)},Get_ParentObject_or_DocumentPos:function(){return{Type:AscDFH.historyitem_recalctype_HdrFtr,Data:this}},Refresh_RecalcData:function(Data){this.Refresh_RecalcData2()}, Refresh_RecalcData2:function(){this.RecalcInfo.PageNumInfo={};this.RecalcInfo.SectPr={};this.RecalcInfo.CurPage=-1;this.RecalcInfo.NeedRecalc={};this.RecalcInfo.LastPage=-1;this.RecalcInfo.RequestedPage=-1;History.RecalcData_Add({Type:AscDFH.historyitem_recalctype_HdrFtr,Data:this})},Refresh_RecalcData_BySection:function(SectPr){var MinPageIndex=-1;for(var PageIndex in this.RecalcInfo.PageNumInfo)if(SectPr===this.RecalcInfo.SectPr[PageIndex]&&(-1===MinPageIndex||PageIndex=MinPageIndex){delete this.RecalcInfo.PageNumInfo[PageIndex];delete this.RecalcInfo.SectPr[PageIndex];delete this.RecalcInfo.NeedRecalc[PageIndex]}},AddHyperlink:function(HyperProps){this.Content.AddHyperlink(HyperProps)},ModifyHyperlink:function(HyperProps){this.Content.ModifyHyperlink(HyperProps)},RemoveHyperlink:function(){this.Content.RemoveHyperlink()},CanAddHyperlink:function(bCheckInHyperlink){return this.Content.CanAddHyperlink(bCheckInHyperlink)}, IsCursorInHyperlink:function(bCheckEnd){return this.Content.IsCursorInHyperlink(bCheckEnd)},Document_CreateFontMap:function(FontMap){this.Content.Document_CreateFontMap(FontMap)},Document_CrateFontCharMap:function(FontCharMap){this.Content.Document_CreateFontCharMap(FontCharMap)},Document_Get_AllFontNames:function(AllFonts){this.Content.Document_Get_AllFontNames(AllFonts)},Write_ToBinary2:function(Writer){Writer.WriteLong(AscDFH.historyitem_type_HdrFtr);Writer.WriteString2(this.Id);Writer.WriteLong(this.Type); Writer.WriteString2(this.Content.Get_Id())},Read_FromBinary2:function(Reader){var LogicDocument=editor.WordControl.m_oLogicDocument;this.Parent=LogicDocument.HdrFtr;this.DrawingDocument=LogicDocument.DrawingDocument;this.LogicDocument=LogicDocument;this.Id=Reader.GetString2();this.Type=Reader.GetLong();this.Content=g_oTableId.Get_ById(Reader.GetString2())},AddComment:function(Comment){this.Content.AddComment(Comment,true,true)},CanAddComment:function(){return this.Content.CanAddComment()}};CHeaderFooter.prototype.Get_SectPr= function(){if(this.LogicDocument){var SectionsInfo=this.LogicDocument.SectionsInfo;var Index=SectionsInfo.Find_ByHdrFtr(this);if(-1!==Index)return SectionsInfo.Get_SectPr2(Index).SectPr}return null};CHeaderFooter.prototype.SetParagraphFramePr=function(FramePr,bDelete){return this.Content.SetParagraphFramePr(FramePr,bDelete)};CHeaderFooter.prototype.GetRevisionsChangeElement=function(SearchEngine){return this.Content.GetRevisionsChangeElement(SearchEngine)};CHeaderFooter.prototype.GetSelectionBounds= function(){if(-1!==this.RecalcInfo.CurPage)return this.Content.GetSelectionBounds();return null};CHeaderFooter.prototype.Get_DocumentContent=function(){return this.Content};CHeaderFooter.prototype.Add_PageCountElement=function(oElement){for(var nIndex=0,nCount=this.PageCountElements.length;nIndex0?true: false};CHeaderFooter.prototype.Clear_PageCountElements=function(){this.PageCountElements=[]};CHeaderFooter.prototype.Update_PageCountElements=function(nPageCount){for(var nIndex=0,nCount=this.PageCountElements.length;nIndex-1;--i){oDrawing=aAllDrawings[i];if(oDrawing.IsWatermark())if(null===oCandidate)oCandidate=oDrawing;else if(oCandidate.getDrawingArrayType()=2&&true!=editor.isStartAddShape&&!(Y<=PageMetrics.Y||null!==(TempHdrFtr= this.Pages[PageIndex].Header)&&true===TempHdrFtr.Is_PointInDrawingObjects(X,Y))&&!(Y>=PageMetrics.YLimit||null!==(TempHdrFtr=this.Pages[PageIndex].Footer)&&true===TempHdrFtr.Is_PointInDrawingObjects(X,Y))){if(null!=this.CurHdrFtr)this.CurHdrFtr.RemoveSelection();MouseEvent.ClickCount=1;return false}this.CurPage=PageIndex;var HdrFtr=null;if(Y<=PageMetrics.Y||null!==(TempHdrFtr=this.Pages[PageIndex].Header)&&true===TempHdrFtr.Is_PointInDrawingObjects(X,Y)||true===editor.isStartAddShape)if(null===this.Pages[PageIndex].Header)if(false=== editor.WordControl.m_oLogicDocument.Document_Is_SelectionLocked(AscCommon.changestype_HdrFtr)){this.LogicDocument.SetDocPosType(docpostype_Content);this.LogicDocument.StartAction(AscDFH.historydescription_Document_AddHeader);this.LogicDocument.SetDocPosType(docpostype_HdrFtr);HdrFtr=this.LogicDocument.Create_SectionHdrFtr(hdrftr_Header,PageIndex);if(this.CurHdrFtr)this.CurHdrFtr.RemoveSelection();this.CurHdrFtr=HdrFtr;this.LogicDocument.Recalculate();this.LogicDocument.FinalizeAction()}else return false; else HdrFtr=this.Pages[PageIndex].Header;else if(Y>=PageMetrics.YLimit||null!==(TempHdrFtr=this.Pages[PageIndex].Footer)&&true===TempHdrFtr.Is_PointInDrawingObjects(X,Y))if(null===this.Pages[PageIndex].Footer)if(false===editor.WordControl.m_oLogicDocument.Document_Is_SelectionLocked(AscCommon.changestype_HdrFtr)){this.LogicDocument.SetDocPosType(docpostype_Content);this.LogicDocument.StartAction(AscDFH.historydescription_Document_AddFooter);this.LogicDocument.SetDocPosType(docpostype_HdrFtr);HdrFtr= this.LogicDocument.Create_SectionHdrFtr(hdrftr_Footer,PageIndex);if(this.CurHdrFtr)this.CurHdrFtr.RemoveSelection();this.CurHdrFtr=HdrFtr;this.LogicDocument.Recalculate();this.LogicDocument.FinalizeAction()}else return false;else HdrFtr=this.Pages[PageIndex].Footer;if(!HdrFtr){this.WaitMouseDown=true;return true}var oPrevHdrFtr=this.CurHdrFtr;if(oPrevHdrFtr&&(oPrevHdrFtr!==HdrFtr||OldPage!=this.CurPage))oPrevHdrFtr.RemoveSelection();this.CurHdrFtr=HdrFtr;if(null!=this.CurHdrFtr){this.CurHdrFtr.Selection_SetStart(X, Y,PageIndex,MouseEvent);if(true===bActivate){var NewMouseEvent={};NewMouseEvent.Type=AscCommon.g_mouse_event_type_up;NewMouseEvent.ClickCount=1;this.CurHdrFtr.Selection_SetEnd(X,Y,PageIndex,NewMouseEvent);this.CurHdrFtr.Content.MoveCursorToStartPos(false)}}this.WaitMouseDown=false;return true},Selection_SetEnd:function(X,Y,PageIndex,MouseEvent){if(true===this.WaitMouseDown)return;if(null!=this.CurHdrFtr){var ResY=Y;if(docpostype_DrawingObjects!=this.CurHdrFtr.Content.GetDocPosType()){if(PageIndex> this.CurPage)ResY=this.LogicDocument.Get_PageLimits(this.CurPage).YLimit+10;else if(PageIndex=PageH/2&&null!=Footer)return Footer;else if(null!=Header)return Header;else return Footer;return null},AddTableRow:function(bBefore,nCount){if(null!=this.CurHdrFtr)this.CurHdrFtr.AddTableRow(bBefore,nCount)},AddTableColumn:function(bBefore,nCount){if(null!=this.CurHdrFtr)this.CurHdrFtr.AddTableColumn(bBefore,nCount)},RemoveTableRow:function(){if(null!=this.CurHdrFtr)this.CurHdrFtr.RemoveTableRow()}, RemoveTableColumn:function(){if(null!=this.CurHdrFtr)this.CurHdrFtr.RemoveTableColumn()},MergeTableCells:function(){if(null!=this.CurHdrFtr)this.CurHdrFtr.MergeTableCells()},SplitTableCells:function(Cols,Rows){if(null!=this.CurHdrFtr)this.CurHdrFtr.SplitTableCells(Cols,Rows)},RemoveTableCells:function(){if(this.CurHdrFtr)this.CurHdrFtr.RemoveTableCells()},RemoveTable:function(){if(null!=this.CurHdrFtr)this.CurHdrFtr.RemoveTable()},SelectTable:function(Type){if(null!=this.CurHdrFtr)this.CurHdrFtr.SelectTable(Type)}, CanMergeTableCells:function(){if(null!=this.CurHdrFtr)return this.CurHdrFtr.CanMergeTableCells()},CanSplitTableCells:function(){if(null!=this.CurHdrFtr)return this.CurHdrFtr.CanSplitTableCells()},DistributeTableCells:function(isHorizontally){if(this.CurHdrFtr)return this.CurHdrFtr.DistributeTableCells(isHorizontally);return false},GetSelectionState:function(){var HdrFtrState={};HdrFtrState.CurHdrFtr=this.CurHdrFtr;var State=null;if(null!=this.CurHdrFtr)State=this.CurHdrFtr.Content.GetSelectionState(); else State=[];State.push(HdrFtrState);return State},SetSelectionState:function(State,StateIndex){if(State.length<=0)return;var HdrFtrState=State[StateIndex];this.CurHdrFtr=HdrFtrState.CurHdrFtr;if(null!=this.CurHdrFtr)this.CurHdrFtr.Content.SetSelectionState(State,StateIndex-1)},AddHyperlink:function(HyperProps){if(null!=this.CurHdrFtr)this.CurHdrFtr.AddHyperlink(HyperProps)},ModifyHyperlink:function(HyperProps){if(null!=this.CurHdrFtr)this.CurHdrFtr.ModifyHyperlink(HyperProps)},RemoveHyperlink:function(){if(null!= this.CurHdrFtr)this.CurHdrFtr.RemoveHyperlink()},CanAddHyperlink:function(bCheckInHyperlink){if(null!=this.CurHdrFtr)return this.CurHdrFtr.CanAddHyperlink(bCheckInHyperlink);return false},IsCursorInHyperlink:function(bCheckEnd){if(null!=this.CurHdrFtr)return this.CurHdrFtr.IsCursorInHyperlink(bCheckEnd);return null},AddComment:function(Comment){if(null!=this.CurHdrFtr){Comment.Set_TypeInfo(AscCommon.comment_type_HdrFtr,this.CurHdrFtr);this.CurHdrFtr.AddComment(Comment)}},CanAddComment:function(){if(null!= this.CurHdrFtr)return this.CurHdrFtr.CanAddComment();return false},GetSelectionAnchorPos:function(){if(null!=this.CurHdrFtr)return this.CurHdrFtr.Content.GetSelectionAnchorPos();return{X:0,Y:0,Page:0}}};CHeaderFooterController.prototype.GetStyleFromFormatting=function(){if(null!=this.CurHdrFtr)return this.CurHdrFtr.Content.GetStyleFromFormatting();return null};CHeaderFooterController.prototype.GetSimilarNumbering=function(oEngine){if(this.CurHdrFtr)this.CurHdrFtr.Content.GetSimilarNumbering(oEngine)}; CHeaderFooterController.prototype.GetPlaceHolderObject=function(){if(this.CurHdrFtr)return this.CurHdrFtr.Content.GetPlaceHolderObject();return null};CHeaderFooterController.prototype.SetParagraphFramePr=function(FramePr,bDelete){if(null!==this.CurHdrFtr)this.CurHdrFtr.SetParagraphFramePr(FramePr,bDelete)};CHeaderFooterController.prototype.GetSelectionBounds=function(){if(null!==this.CurHdrFtr)return this.CurHdrFtr.GetSelectionBounds();return null};CHeaderFooterController.prototype.Get_CurHdrFtr= function(){return this.CurHdrFtr};CHeaderFooterController.prototype.GetCurHdrFtr=function(){return this.CurHdrFtr};CHeaderFooterController.prototype.Set_CurHdrFtr=function(HdrFtr){if(null!==this.CurHdrFtr)this.CurHdrFtr.RemoveSelection();this.CurHdrFtr=HdrFtr};CHeaderFooterController.prototype.RecalculatePageCountUpdate=function(nPageAbs,nPageCount){var oPage=this.Pages[nPageAbs];if(!oPage)return false;var oHeader=oPage.Header;var oFooter=oPage.Footer;var bNeedRecalc=false;if(oHeader&&oHeader.Have_PageCountElement()){oHeader.Update_PageCountElements(nPageCount); bNeedRecalc=true}if(oFooter&&oFooter.Have_PageCountElement()){oFooter.Update_PageCountElements(nPageCount);bNeedRecalc=true}if(true===bNeedRecalc)return this.Recalculate(nPageAbs);return null};CHeaderFooterController.prototype.UpdatePagesCount=function(nPageAbs,nPageCount){var oPage=this.Pages[nPageAbs];if(!oPage)return false;var oHeader=oPage.Header;var oFooter=oPage.Footer;if(oHeader&&oHeader.Have_PageCountElement())oHeader.Update_PageCountElements(nPageCount);if(oFooter&&oFooter.Have_PageCountElement())oFooter.Update_PageCountElements(nPageCount)}; CHeaderFooterController.prototype.HavePageCountElement=function(){var nStartPage=-1;var nPagesCount=this.LogicDocument.Pages.length;for(var nPageAbs=0;nPageAbs=0;--nIdx){oElement=this.Content[nIdx];if(oElement.GetType()===type_Paragraph){if(oElement.GetParagraphStyle()===sStyleId)oResultPara=oElement}else if(oElement.GetType()===type_Table)oResultPara=oElement.FindParaWithStyle(sStyleId,bBackward,null);else if(oElement.GetType()===type_BlockLevelSdt){oContent=oElement.GetContent();oResultPara=oContent.FindParaWithStyle(sStyleId,bBackward,null)}if(oResultPara!== null)return oResultPara}}else{if(nStartIdx!==null)nSearchStartIdx=Math.max(nStartIdx,0);else nSearchStartIdx=0;for(nIdx=nSearchStartIdx;nIdxStartPos)this.ReindexStartPos=StartPos};CDocumentContentBase.prototype.private_RecalculateEmptySectionParagraph=function(Element,PrevElement,PageIndex,ColumnIndex,ColumnsCount){var LastVisibleBounds=PrevElement.GetLastRangeVisibleBounds();var ___X=LastVisibleBounds.X+LastVisibleBounds.W;var ___Y=LastVisibleBounds.Y;var CompiledPr=Element.Get_CompiledPr2(false).ParaPr;CompiledPr.Jc=align_Left;CompiledPr.Ind.FirstLine=0;CompiledPr.Ind.Left= 0;CompiledPr.Ind.Right=0;Element.Reset(___X,___Y,Math.max(___X+10,LastVisibleBounds.XLimit),1E4,PageIndex,ColumnIndex,ColumnsCount);Element.Recalculate_Page(0);Element.Recalc_CompiledPr();Element.Pages[0].Y=___Y;Element.Lines[0].Top=0;Element.Lines[0].Y=LastVisibleBounds.BaseLine;Element.Lines[0].Bottom=LastVisibleBounds.H;Element.Pages[0].Bounds.Top=___Y;Element.Pages[0].Bounds.Bottom=___Y+LastVisibleBounds.H};CDocumentContentBase.prototype.GotoFootnoteRef=function(isNext,isCurrent,isStepFootnote, isStepEndnote){var nCurPos=0;if(true===isCurrent)if(true===this.Selection.Use)nCurPos=Math.min(this.Selection.StartPos,this.Selection.EndPos);else nCurPos=this.CurPos.ContentPos;else if(isNext)nCurPos=0;else nCurPos=this.Content.length-1;if(isNext)for(var nIndex=nCurPos,nCount=this.Content.length;nIndex= 0;--nIndex){var oElement=this.Content[nIndex];if(oElement.GotoFootnoteRef(false,true===isCurrent&&nIndex===nCurPos,isStepFootnote,isStepEndnote))return true}return false};CDocumentContentBase.prototype.MoveCursorToNearestPos=function(oNearestPos){var oPara=oNearestPos.Paragraph;var oParent=oPara.Parent;if(oParent){var oTopDocument=oParent.Is_TopDocument(true);if(oTopDocument)oTopDocument.RemoveSelection()}oPara.Set_ParaContentPos(oNearestPos.ContentPos,true,-1,-1);oPara.Document_SetThisElementCurrent(true)}; CDocumentContentBase.prototype.private_CreateNewParagraph=function(){var oPara=new Paragraph(this.DrawingDocument,this,this.bPresentation===true);oPara.Correct_Content();oPara.MoveCursorToStartPos(false);return oPara};CDocumentContentBase.prototype.StopSelection=function(){if(true!==this.Selection.Use)return;this.Selection.Start=false;if(this.Content[this.Selection.StartPos])this.Content[this.Selection.StartPos].StopSelection()};CDocumentContentBase.prototype.GetNumberingInfo=function(oNumberingEngine, oPara,oNumPr,isUseReview){if(undefined===oNumberingEngine||null===oNumberingEngine)oNumberingEngine=new CDocumentNumberingInfoEngine(oPara,oNumPr,this.GetNumbering());for(var nIndex=0,nCount=this.Content.length;nIndex0)this.Content[StartPos].Remove(1,true,bRemoveOnlySelection,bOnTextAdd);else if(this.Content[StartPos].IsRowSelection())this.Content[StartPos].RemoveTableRow();else{var oLogicDocument=this.GetLogicDocument();var isLocalTrackRevisions=oLogicDocument.GetLocalTrackRevisions();oLogicDocument.SetLocalTrackRevisions(false);this.Content[StartPos].RemoveTableCells();oLogicDocument.SetLocalTrackRevisions(isLocalTrackRevisions)}else for(var nIndex= StartPos;nIndex<=EndPos;++nIndex){var oElement=this.Content[nIndex];if(oElement.IsTable())oElement.RemoveTableRow();else oElement.Remove(1,true,bRemoveOnlySelection,bOnTextAdd)}this.RemoveSelection();for(var nIndex=_nEndPos;nIndex>=StartPos;--nIndex){var oElement=this.Content[nIndex];var nReviewType=oElement.GetReviewType();var oReviewInfo=oElement.GetReviewInfo();if(oElement.IsParagraph())if(reviewtype_Add===nReviewType&&oReviewInfo.IsCurrentUser()||reviewtype_Remove===nReviewType&&oReviewInfo.IsPrevAddedByCurrentUser())if(oElement.IsEmpty())this.RemoveFromContent(nIndex, 1);else{if(nIndex=this.Content.length){this.Internal_Content_Add(0,this.private_CreateNewParagraph());this.Internal_Content_Remove(1,this.Content.length- 1);bRetValue=false}else this.Internal_Content_Remove(StartPos,EndPos-StartPos+1);if(StartPos>=this.Content.length){this.CurPos.ContentPos=this.Content.length-1;this.Content[this.CurPos.ContentPos].MoveCursorToEndPos(false,false)}else{this.CurPos.ContentPos=StartPos;this.Content[StartPos].MoveCursorToStartPos(false)}}}else{this.CurPos.ContentPos=StartPos;if(Count<0&&this.Content[StartPos].IsTable()&&true===this.Content[StartPos].IsCellSelection()&&true!==bOnTextAdd)this.RemoveTableCells();else if(false=== this.Content[StartPos].Remove(Count,isRemoveWholeElement,bRemoveOnlySelection,bOnTextAdd))if(true!==bOnTextAdd||isRemoveOnDrag&&this.Content[StartPos].IsEmpty())if(this.Content.length>1&&(true===this.Content[StartPos].IsEmpty()||type_BlockLevelSdt===this.Content[StartPos].GetType()&&this.Content[StartPos].IsPlaceHolder()&&(!this.GetLogicDocument()||!this.GetLogicDocument().IsFillingFormMode()))){this.Internal_Content_Remove(StartPos,1);if(StartPos>=this.Content.length){this.CurPos.ContentPos=this.Content.length- 1;this.Content[this.CurPos.ContentPos].MoveCursorToEndPos(false,false)}else{this.CurPos.ContentPos=StartPos;this.Content[StartPos].MoveCursorToStartPos(false)}}else if(this.CurPos.ContentPos0){this.Internal_Content_Add(0, this.private_CreateNewParagraph());this.Internal_Content_Remove(1,this.Content.length-1)}bRetValue=false}}}}else{if(true===bRemoveOnlySelection||true===bOnTextAdd)return true;var nCurContentPos=this.CurPos.ContentPos;if(type_Paragraph==this.Content[nCurContentPos].GetType()){if(false===this.Content[nCurContentPos].Remove(Count,isRemoveWholeElement,false,false,isWord))if(Count<0)if(nCurContentPos>0&&type_Paragraph==this.Content[nCurContentPos-1].GetType()){var CurrFramePr=this.Content[nCurContentPos].Get_FramePr(); var PrevFramePr=this.Content[nCurContentPos-1].Get_FramePr();if(undefined===CurrFramePr&&undefined===PrevFramePr||undefined!==CurrFramePr&&undefined!==PrevFramePr&&true===CurrFramePr.Compare(PrevFramePr))if(true===this.IsTrackRevisions()&&(reviewtype_Add!==this.Content[nCurContentPos-1].GetReviewType()||!this.Content[nCurContentPos-1].GetReviewInfo().IsCurrentUser())&&(reviewtype_Remove!==this.Content[nCurContentPos-1].GetReviewType()||!this.Content[nCurContentPos-1].GetReviewInfo().IsPrevAddedByCurrentUser())){if(reviewtype_Add=== this.Content[nCurContentPos-1].GetReviewType()){var oReviewInfo=this.Content[nCurContentPos-1].GetReviewInfo().Copy();oReviewInfo.SavePrev(reviewtype_Add);oReviewInfo.Update();this.Content[nCurContentPos-1].SetReviewTypeWithInfo(reviewtype_Remove,oReviewInfo)}else this.Content[nCurContentPos-1].SetReviewType(reviewtype_Remove);nCurContentPos--;this.Content[nCurContentPos].MoveCursorToEndPos(false,false);if(this.Content[nCurContentPos].IsParagraph()){var oParaPr=this.Content[nCurContentPos].GetDirectParaPr(); var oPrChange=this.Content[nCurContentPos+1].GetDirectParaPr();var oReviewInfo=new CReviewInfo;oReviewInfo.Update();this.Content[nCurContentPos+1].SetDirectParaPr(oParaPr);this.Content[nCurContentPos+1].SetPrChange(oPrChange,oReviewInfo)}}else if(true===this.Content[nCurContentPos-1].IsEmpty()&&undefined===this.Content[nCurContentPos-1].GetNumPr()){this.Internal_Content_Remove(nCurContentPos-1,1);nCurContentPos--;this.Content[nCurContentPos].MoveCursorToStartPos(false)}else{var Prev=this.Content[nCurContentPos- 1];Prev.MoveCursorToEndPos(false,false);Prev.Concat(this.Content[nCurContentPos]);this.Internal_Content_Remove(nCurContentPos,1);nCurContentPos--}}else if(nCurContentPos>0&&type_BlockLevelSdt===this.Content[nCurContentPos-1].GetType()){nCurContentPos--;this.Content[nCurContentPos].MoveCursorToEndPos(false)}else{if(0===nCurContentPos)bRetValue=false}else if(Count>0)if(nCurContentPos0)this.Content[nCurContentPos].MoveCursorToStartPos(false);else this.Content[nCurContentPos].MoveCursorToEndPos(false);else if(this.Content[nCurContentPos].IsEmpty())if(this.Content[nCurContentPos].CanBeDeleted()){this.RemoveFromContent(nCurContentPos,1);if(Count<0&&nCurContentPos>0||nCurContentPos>=this.Content.length){nCurContentPos--; this.Content[nCurContentPos].MoveCursorToEndPos(false)}else this.Content[nCurContentPos].MoveCursorToStartPos(false)}else if(Count<0){if(nCurContentPos>0){nCurContentPos--;this.Content[nCurContentPos].MoveCursorToEndPos(false)}}else{if(nCurContentPos0){nCurContentPos--;this.Content[nCurContentPos].MoveCursorToEndPos(false)}}else if(nCurContentPos=nStartPos;--nIndex){var oElement=this.Content[nIndex];oSdt.Content.Add_ToContent(0,oElement); this.Remove_FromContent(nIndex,1);oElement.SelectAll(1)}oSdt.Content.Remove_FromContent(oSdt.Content.GetElementsCount()-1,1);oSdt.Content.Selection.Use=true;oSdt.Content.Selection.StartPos=0;oSdt.Content.Selection.EndPos=oSdt.Content.GetElementsCount()-1;this.Add_ToContent(nStartPos,oSdt);this.Selection.StartPos=nStartPos;this.Selection.EndPos=nStartPos;this.CurPos.ContentPos=nStartPos;oLogicDocument.RemoveCommentsOnPreDelete=true;return oSdt}else if(type_Paragraph===oElement.GetType()){var oSdt= new CBlockLevelSdt(editor.WordControl.m_oLogicDocument,this);oSdt.SetDefaultTextPr(this.GetDirectTextPr());oSdt.SetPlaceholder(c_oAscDefaultPlaceholderName.Text);oSdt.ReplaceContentWithPlaceHolder(false);var nContentPos=this.CurPos.ContentPos;if(oElement.IsCursorAtBegin()){this.AddToContent(nContentPos,oSdt);this.CurPos.ContentPos=nContentPos}else if(oElement.IsCursorAtEnd()){this.AddToContent(nContentPos+1,oSdt);this.CurPos.ContentPos=nContentPos+1}else{var oNewParagraph=new Paragraph(this.DrawingDocument, this);oElement.Split(oNewParagraph);this.AddToContent(nContentPos+1,oNewParagraph);this.AddToContent(nContentPos+1,oSdt);this.CurPos.ContentPos=nContentPos+1}oSdt.MoveCursorToStartPos(false);return oSdt}else return oElement.AddContentControl(nContentControlType);else return oElement.AddContentControl(nContentControlType)};CDocumentContentBase.prototype.RecalculateAllTables=function(){for(var nPos=0,nCount=this.Content.length;nPos=nEndPos;--nIndex){var oRes=this.Content[nIndex].FindNextFillingForm(false,isCurrent&&nIndex===nCurPos,isStart);if(oRes)return oRes}return null}; CDocumentContentBase.prototype.IsSelectedSingleElement=function(){return true===this.Selection.Use&&docpostype_Content===this.GetDocPosType()&&this.Selection.Flag===selectionflag_Common&&this.Selection.StartPos===this.Selection.EndPos};CDocumentContentBase.prototype.GetOutlineParagraphs=function(arrOutline,oPr){if(!arrOutline)arrOutline=[];for(var nIndex=0,nCount=this.Content.length;nIndex=nPosition)this.CurPos.ContentPos+=nCount; if(this.Selection.StartPos>=nPosition)this.Selection.StartPos+=nCount;if(this.Selection.EndPos>=nPosition)this.Selection.EndPos+=nCount;this.Selection.StartPos=Math.max(0,Math.min(this.Content.length-1,this.Selection.StartPos));this.Selection.EndPos=Math.max(0,Math.min(this.Content.length-1,this.Selection.EndPos));this.CurPos.ContentPos=Math.max(0,Math.min(this.Content.length-1,this.CurPos.ContentPos))};CDocumentContentBase.prototype.private_UpdateSelectionPosOnRemove=function(nPosition,nCount){if(this.CurPos.ContentPos>= nPosition+nCount)this.CurPos.ContentPos-=nCount;else if(this.CurPos.ContentPos>=nPosition)if(nPosition0)this.CurPos.ContentPos=nPosition-1;else this.CurPos.ContentPos=0;if(this.Selection.StartPos<=this.Selection.EndPos){if(this.Selection.StartPos>=nPosition+nCount)this.Selection.StartPos-=nCount;else if(this.Selection.StartPos>=nPosition)this.Selection.StartPos=nPosition;if(this.Selection.EndPos>=nPosition+nCount)this.Selection.EndPos-= nCount;else if(this.Selection.EndPos>=nPosition)this.Selection.StartPos=nPosition-1;if(this.Selection.StartPos>this.Selection.EndPos){this.Selection.Use=false;this.Selection.StartPos=0;this.Selection.EndPos=0}}else{if(this.Selection.EndPos>=nPosition+nCount)this.Selection.EndPos-=nCount;else if(this.Selection.EndPos>=nPosition)this.Selection.EndPos=nPosition;if(this.Selection.StartPos>=nPosition+nCount)this.Selection.StartPos-=nCount;else if(this.Selection.StartPos>=nPosition)this.Selection.StartPos= nPosition-1;if(this.Selection.EndPos>this.Selection.StartPos){this.Selection.Use=false;this.Selection.StartPos=0;this.Selection.EndPos=0}}this.Selection.StartPos=Math.max(0,Math.min(this.Content.length-1,this.Selection.StartPos));this.Selection.EndPos=Math.max(0,Math.min(this.Content.length-1,this.Selection.EndPos));this.CurPos.ContentPos=Math.max(0,Math.min(this.Content.length-1,this.CurPos.ContentPos))};CDocumentContentBase.prototype.ConcatParagraphs=function(nPosition,isUseConcatedStyle){if(nPosition< this.Content.length-1&&this.Content[nPosition].IsParagraph()&&this.Content[nPosition+1].IsParagraph()){this.Content[nPosition].Concat(this.Content[nPosition+1],isUseConcatedStyle);this.RemoveFromContent(nPosition+1,1);this.Content[nPosition].CorrectContent();return true}return false};CDocumentContentBase.prototype.CheckRunContent=function(fCheck){for(var nIndex=0,nCount=this.Content.length;nIndexEndPos){StartPos=this.Selection.EndPos;EndPos=this.Selection.StartPos}var LastParaEnd;if(true===bAll){StartPos=0;EndPos=this.Content.length-1;LastParaEnd=true}else{var LastElement=this.Content[EndPos]; LastParaEnd=!LastElement.IsParagraph()||true===LastElement.Selection_CheckParaEnd()}if(undefined===nType||c_oAscRevisionsChangeType.ParaPr===nType)for(var CurPos=StartPos;CurPos<=EndPos;CurPos++){var Element=this.Content[CurPos];if(type_Paragraph===Element.Get_Type()&&(true===bAll||true===Element.IsSelectedAll())&&true===Element.HavePrChange())Element.AcceptPrChange()}for(var nCurPos=StartPos;nCurPos<=EndPos;++nCurPos){var oElement=this.Content[nCurPos];oElement.AcceptRevisionChanges(nType,bAll)}if(undefined=== nType||c_oAscRevisionsChangeType.ParaAdd===nType||c_oAscRevisionsChangeType.ParaRem===nType||c_oAscRevisionsChangeType.RowsRem===nType||c_oAscRevisionsChangeType.RowsAdd===nType||c_oAscRevisionsChangeType.MoveMark===nType){EndPos=true===LastParaEnd?EndPos:EndPos-1;for(var nCurPos=EndPos;nCurPos>=StartPos;--nCurPos){var oElement=this.Content[nCurPos];if(oElement.IsParagraph()){var nReviewType=oElement.GetReviewType();var oReviewInfo=oElement.GetReviewInfo();if(reviewtype_Add===nReviewType&&(undefined=== nType||c_oAscRevisionsChangeType.ParaAdd===nType||c_oAscRevisionsChangeType.MoveMark===nType&&oReviewInfo.IsMovedTo()&&oTrackMove&&!oTrackMove.IsFrom()&&oTrackMove.GetUserId()===oReviewInfo.GetUserId()))oElement.SetReviewType(reviewtype_Common);else if(reviewtype_Remove===nReviewType&&(undefined===nType||c_oAscRevisionsChangeType.ParaRem===nType||c_oAscRevisionsChangeType.MoveMark===nType&&oReviewInfo.IsMovedFrom()&&oTrackMove&&oTrackMove.IsFrom()&&oTrackMove.GetUserId()===oReviewInfo.GetUserId())){oElement.SetReviewType(reviewtype_Common); this.ConcatParagraphs(nCurPos,true)}}else if(oElement.IsTable())if(oElement.GetRowsCount()<=0)this.RemoveFromContent(nCurPos,1,false)}}}};CDocumentContentBase.prototype.private_RejectRevisionChanges=function(nType,bAll){var oTrackManager=this.GetLogicDocument()?this.GetLogicDocument().GetTrackRevisionsManager():null;if(!oTrackManager)return;var oTrackMove=oTrackManager.GetProcessTrackMove();if(true===this.Selection.Use||true===bAll){var StartPos=this.Selection.StartPos;var EndPos=this.Selection.EndPos; if(StartPos>EndPos){StartPos=this.Selection.EndPos;EndPos=this.Selection.StartPos}var LastParaEnd;if(true===bAll){StartPos=0;EndPos=this.Content.length-1;LastParaEnd=true}else{var LastElement=this.Content[EndPos];LastParaEnd=!LastElement.IsParagraph()||true===LastElement.Selection_CheckParaEnd()}if(undefined===nType||c_oAscRevisionsChangeType.ParaPr===nType)for(var CurPos=StartPos;CurPos<=EndPos;CurPos++){var Element=this.Content[CurPos];if(type_Paragraph===Element.Get_Type()&&(true===bAll||true=== Element.IsSelectedAll())&&true===Element.HavePrChange())Element.RejectPrChange()}for(var nCurPos=StartPos;nCurPos<=EndPos;++nCurPos){var oElement=this.Content[nCurPos];oElement.RejectRevisionChanges(nType,bAll)}if(undefined===nType||c_oAscRevisionsChangeType.ParaAdd===nType||c_oAscRevisionsChangeType.ParaRem===nType||c_oAscRevisionsChangeType.RowsRem===nType||c_oAscRevisionsChangeType.RowsAdd===nType||c_oAscRevisionsChangeType.MoveMark===nType){EndPos=true===LastParaEnd?EndPos:EndPos-1;for(var nCurPos= EndPos;nCurPos>=StartPos;--nCurPos){var oElement=this.Content[nCurPos];if(oElement.IsParagraph()){var nReviewType=oElement.GetReviewType();var oReviewInfo=oElement.GetReviewInfo();if(reviewtype_Add===nReviewType&&(undefined===nType||c_oAscRevisionsChangeType.ParaAdd===nType||c_oAscRevisionsChangeType.MoveMark===nType&&oReviewInfo.IsMovedTo()&&oTrackMove&&!oTrackMove.IsFrom()&&oTrackMove.GetUserId()===oReviewInfo.GetUserId())){oElement.SetReviewType(reviewtype_Common);this.ConcatParagraphs(nCurPos, true)}else if(reviewtype_Remove===nReviewType&&(undefined===nType||c_oAscRevisionsChangeType.ParaRem===nType||c_oAscRevisionsChangeType.MoveMark===nType&&oReviewInfo.IsMovedFrom()&&oTrackMove&&oTrackMove.IsFrom()&&oTrackMove.GetUserId()===oReviewInfo.GetUserId())){var oReviewInfo=oElement.GetReviewInfo();var oPrevInfo=oReviewInfo.GetPrevAdded();if(oPrevInfo&&c_oAscRevisionsChangeType.MoveMark!==nType)oElement.SetReviewTypeWithInfo(reviewtype_Add,oPrevInfo.Copy());else oElement.SetReviewType(reviewtype_Common)}}else if(oElement.IsTable())if(oElement.GetRowsCount()<= 0)this.RemoveFromContent(nCurPos,1,false)}}}};CDocumentContentBase.prototype.IsCalculatingContinuousSectionBottomLine=function(){return false};CDocumentContentBase.prototype.private_CheckSelectedContentBeforePaste=function(oSelectedContent,oAnchorPos){var oParagraph=oAnchorPos.Paragraph;var oParaState=oParagraph.SaveSelectionState();oParagraph.RemoveSelection();oParagraph.Set_ParaContentPos(oAnchorPos.ContentPos,false,-1,-1,false);var arrContentControls=oParagraph.GetSelectedContentControls();oParagraph.LoadSelectionState(oParaState); for(var nIndex=0,nCount=arrContentControls.length;nIndex=0){if(0===_nIndex){var oParent=this.GetParent();if(oParent&&oParent.GetPrevParagraphForLineNumbers)return oParent.GetPrevParagraphForLineNumbers(true,isNewSection);return null}_nIndex--; if(this.Content[_nIndex].IsParagraph()){var oSectPr=this.Content[_nIndex].Get_SectionPr();if(oSectPr&&(isNewSection||!oSectPr.HaveLineNumbers()))return null;if(!this.Content[_nIndex].IsCountLineNumbers())continue;return this.Content[_nIndex]}else if(this.Content[_nIndex].IsBlockLevelSdt())return this.Content[_nIndex].GetPrevParagraphForLineNumbers(false,isNewSection)}return null};CDocumentContentBase.prototype.UpdateLineNumbersInfo=function(){for(var nIndex=0,nCount=this.Content.length;nIndex1)oElement.CorrectContent();if(oElement.IsTable())this.HaveTable=true;if(!oElement.IsParagraph())isNonParagraph=true;oElement.MoveCursorToEndPos(false)}this.HaveMath=this.Maths.length>0?true:false;if(!this.HaveMath&&!isNonParagraph)this.CanConvertToMath=true;Count=this.DrawingObjects.length;for(var Pos=0;Pos0&&LogicDocument&&null!==LogicDocument.TrackMoveId&&undefined!==LogicDocument.TrackMoveId){var isCanMove=!this.IsHaveMovedParts();for(var nIndex=0,nCount=this.Elements.length;nIndex< nCount;++nIndex)if(!this.Elements[nIndex].Element.IsParagraph()){isCanMove=false;break}if(LogicDocument.TrackMoveRelocation)isCanMove=true;if(isCanMove){if(LogicDocument.TrackMoveRelocation){var oMarks=LogicDocument.GetTrackRevisionsManager().GetMoveMarks(LogicDocument.TrackMoveId);if(oMarks){oMarks.To.Start.RemoveThisMarkFromDocument();oMarks.To.End.RemoveThisMarkFromDocument()}}var oStartElement=this.Elements[0].Element;var oEndElement=this.Elements[this.Elements.length-1].Element;var oStartParagraph= oStartElement.GetFirstParagraph();var oEndParagraph=oEndElement.GetLastParagraph();oStartParagraph.AddToContent(0,new CParaRevisionMove(true,false,LogicDocument.TrackMoveId));if(oEndParagraph!==oEndElement||this.Elements[this.Elements.length-1].SelectedAll){var oEndRun=oEndParagraph.GetParaEndRun();oEndRun.AddAfterParaEnd(new CRunRevisionMove(false,false,LogicDocument.TrackMoveId));var oInfo=new CReviewInfo;oInfo.Update();oInfo.SetMove(Asc.c_oAscRevisionsMove.MoveTo);oEndRun.SetReviewTypeWithInfo(reviewtype_Add, oInfo,false)}else oEndParagraph.AddToContent(oEndParagraph.GetElementsCount(),new CParaRevisionMove(false,false,LogicDocument.TrackMoveId));for(var nIndex=0,nCount=this.MoveTrackRuns.length;nIndex0&&true===this.RecalculateBottomLine};CDocumentPageSection.prototype.CanRecalculateBottomLine= function(){return this.RecalculateBottomLine};CDocumentPageSection.prototype.ForbidRecalculateBottomLine=function(){this.RecalculateBottomLine=false};CDocumentPageSection.prototype.Get_Y=function(){return this.Y};CDocumentPageSection.prototype.Get_YLimit=function(){if(0===this.IterationsCount)return this.YLimit;else return this.CurrentY};CDocumentPageSection.prototype.IterateBottomLineCalculation=function(isIncrease){if(0===this.IterationsCount){var nSumArea=0,nSumWidth=0;for(var nColumnIndex=0,nColumnsCount= this.Columns.length;nColumnIndex.001)this.CurrentY=this.Y+nSumArea/nSumWidth;else this.CurrentY=this.Y}else if(false===isIncrease){if(this.IterationDirection>0||this.WasIncrease)this.IterationStep/=2;this.CurrentY-=this.IterationStep;this.IterationDirection=-1;if(this.CurrentY.001};function CDocumentPageColumn(){this.Bounds=new CDocumentBounds(0,0,0,0);this.Pos=0;this.EndPos=-1;this.Empty=true;this.X=0;this.Y=0;this.XLimit=0;this.YLimit=0;this.SpaceBefore=0;this.SpaceAfter=0}CDocumentPageColumn.prototype.Copy=function(){var NewColumn=new CDocumentPageColumn;NewColumn.Bounds.CopyFrom(this.Bounds);NewColumn.Pos=this.Pos;NewColumn.EndPos=this.EndPos; NewColumn.X=this.X;NewColumn.Y=this.Y;NewColumn.XLimit=this.XLimit;NewColumn.YLimit=this.YLimit;return NewColumn};CDocumentPageColumn.prototype.Shift=function(Dx,Dy){this.X+=Dx;this.XLimit+=Dx;this.Y+=Dy;this.YLimit+=Dy;this.Bounds.Shift(Dx,Dy)};CDocumentPageColumn.prototype.Reset=function(){this.Bounds.Reset();this.Pos=0;this.EndPos=-1;this.Empty=true;this.X=0;this.Y=0;this.XLimit=0;this.YLimit=0};CDocumentPageColumn.prototype.IsEmpty=function(){return this.Empty};function CDocumentPage(){this.Width= 0;this.Height=0;this.Margins={Left:0,Right:0,Top:0,Bottom:0};this.Bounds=new CDocumentBounds(0,0,0,0);this.Pos=0;this.EndPos=0;this.X=0;this.Y=0;this.XLimit=0;this.YLimit=0;this.OriginX=0;this.OriginY=0;this.OriginXLimit=0;this.OriginTLimit=0;this.Sections=[];this.EndSectionParas=[];this.ResetStartElement=false;this.Frames=[];this.FlowTables=[]}CDocumentPage.prototype.Update_Limits=function(Limits){this.X=Limits.X;this.XLimit=Limits.XLimit;this.Y=Limits.Y;this.YLimit=Limits.YLimit;this.OriginX=Limits.X; this.OriginY=Limits.Y;this.OriginXLimit=Limits.XLimit;this.OriginYLimit=Limits.YLimit};CDocumentPage.prototype.Shift=function(Dx,Dy){this.X+=Dx;this.XLimit+=Dx;this.Y+=Dy;this.YLimit+=Dy;this.Bounds.Shift(Dx,Dy);for(var SectionIndex=0,Count=this.Sections.length;SectionIndex0?ParagrapsToRestore[0].LogicDocument:null;if(LogicDocument&&false===LogicDocument.Document_Is_SelectionLocked(changestype_None,{Type:changestype_2_ElementsArray_and_Type,Elements:ParagrapsToRestore,CheckType:changestype_Paragraph_Content})){LogicDocument.StartAction(AscDFH.historydescription_Document_RestoreFieldTemplateText);for(var nIndex=0,nCount=FieldsToRestore.length;nIndex=0;--nIndex){var oComplexField=this.m_arrComplexFields[nIndex];var oInstruction=oComplexField.GetInstruction();if(AscCommonWord.fieldtype_TOC=== oInstruction.GetType()&&oInstruction.IsTableOfFigures())aTOF.push(oComplexField)}return aTOF};CSelectedElementsInfo.prototype.GetTableOfContents=function(){for(var nIndex=this.m_arrComplexFields.length-1;nIndex>=0;--nIndex){var oComplexField=this.m_arrComplexFields[nIndex];var oInstruction=oComplexField.GetInstruction();if(AscCommonWord.fieldtype_TOC===oInstruction.GetType()&&oInstruction.IsTableOfContents())return oComplexField}if(this.m_oBlockLevelSdt&&this.m_oBlockLevelSdt.IsBuiltInTableOfContents())return this.m_oBlockLevelSdt; return null};CSelectedElementsInfo.prototype.SetHyperlink=function(oHyperlink){this.m_oHyperlink=oHyperlink};CSelectedElementsInfo.prototype.GetHyperlink=function(){if(this.m_oHyperlink)return this.m_oHyperlink;for(var nIndex=0,nCount=this.m_arrComplexFields.length;nIndexY&&oSectPr.GetPageMarginTop()>=0)Y=YHeader;var YFooter=HdrFtrLine.Bottom;if(null!==YFooter&&YFooter=0)YLimit=YFooter;return{X:X,Y:Y,XLimit:XLimit,YLimit:YLimit}};CDocument.prototype.Get_PageContentStartPos2=function(StartPageIndex,StartColumnIndex,ElementPageIndex,ElementIndex){if(undefined===ElementIndex&&undefined!==this.Pages[StartPageIndex])ElementIndex= this.Pages[StartPageIndex].Pos;var oSectPr=this.SectionsInfo.Get_SectPr(ElementIndex).SectPr;var ColumnsCount=oSectPr.GetColumnsCount();var ColumnAbs=StartColumnIndex+ElementPageIndex-((StartColumnIndex+ElementPageIndex)/ColumnsCount|0)*ColumnsCount;var PageAbs=StartPageIndex+((StartColumnIndex+ElementPageIndex)/ColumnsCount|0);var oFrame=oSectPr.GetContentFrame(PageAbs);var Y=oFrame.Top;var YLimit=oFrame.Bottom;var X=oFrame.Left;var XLimit=oFrame.Right;var SectionIndex=this.FullRecalc.SectionIndex; if(this.Pages[PageAbs]&&this.Pages[PageAbs].Sections[SectionIndex]){Y=this.Pages[PageAbs].Sections[SectionIndex].Get_Y();YLimit=this.Pages[PageAbs].Sections[SectionIndex].Get_YLimit()}var HdrFtrLine=this.HdrFtr.GetHdrFtrLines(PageAbs);for(var ColumnIndex=0;ColumnIndexY&& oSectPr.GetPageMarginTop()>=0)Y=YHeader;var YFooter=HdrFtrLine.Bottom;if(null!==YFooter&&YFooter=0)YLimit=YFooter;var ColumnSpaceBefore=ColumnAbs>0?oSectPr.GetColumnSpace(ColumnAbs-1):0;var ColumnSpaceAfter=ColumnAbs=ColumnsCount)nColumnIndex=ColumnsCount-1;for(var ColIndex=0;ColIndexthis.Action.Redraw.End)this.Action.Redraw.End= nEndPage}else{this.Action.Redraw.Start=-1;this.Action.Redraw.End=-1}else this.private_Redraw(nStartPage,nEndPage)};CDocument.prototype.private_Redraw=function(nStartPage,nEndPage){if(-1!==nStartPage&&-1!==nEndPage){var _nStartPage=Math.max(0,nStartPage);var _nEndPage=Math.min(this.DrawingDocument.m_lCountCalculatePages-1,nEndPage);for(var nCurPage=_nStartPage;nCurPage<=_nEndPage;++nCurPage)this.DrawingDocument.OnRepaintPage(nCurPage)}else{this.DrawingDocument.ClearCachePages();this.DrawingDocument.FirePaint()}}; CDocument.prototype.FinalizeAction=function(isCheckEmptyAction){if(!this.Action.Start)return;if(this.Action.Depth>0){if(this.Action.Depth+1===this.Action.PointsCount&&this.History.Is_LastPointEmpty()){this.History.Remove_LastPoint();this.Action.PointsCount--}this.Action.Depth--;return}if(this.Action.Additional.TrackMove)this.private_FinalizeRemoveTrackMove();if(this.TrackMoveId)this.private_FinalizeCheckTrackMove();if(this.Action.Additional.FormChange)this.private_FinalizeFormChange();if(this.Action.Additional.RadioRequired)this.private_FinalizeRadioRequired(); var isAllPointsEmpty=true;if(false!==isCheckEmptyAction)for(var nIndex=0,nPointsCount=this.Action.PointsCount;nIndex0){var oPicture=arrDrawings[0].GetPicture();if(oPicture)oPicture.setBlipFill(AscFormat.CreateBlipFillRasterImageId(oPr))}oTempForm.SetShowingPlcHdr(isPlaceHolder);oTempForm.UpdatePictureFormLayout()}}}}else{var isPlaceHolder=oForm.IsPlaceHolder();var oSrcRun=!isPlaceHolder?oForm.MakeSingleRunElement(false):null;for(var sId in this.SpecialForms){var oTempForm=this.SpecialForms[sId];if(!oTempForm.IsUseInDocument()||oTempForm.IsPicture()||oTempForm.IsCheckBox())continue; if(oTempForm!==oForm&&sKey===oTempForm.GetFormKey())if(isPlaceHolder){if(!oTempForm.IsPlaceHolder())oTempForm.ReplaceContentWithPlaceHolder(false)}else{if(oTempForm.IsPlaceHolder())oTempForm.ReplacePlaceHolderWithContent();var oDstRun=oTempForm.MakeSingleRunElement(false);oDstRun.CopyTextFormContent(oSrcRun)}}}}delete this.Action.Additional.FormChangeStart};CDocument.prototype.private_FinalizeFormAutoFit=function(isFastRecalc){for(var nIndex=0,nCount=this.Action.Additional.FormAutoFit.length;nIndex< nCount;++nIndex)this.Action.Additional.FormAutoFit[nIndex].ProcessAutoFitContent(isFastRecalc)};CDocument.prototype.private_FinalizeRadioRequired=function(){for(var sGroupKey in this.Action.Additional.RadioRequired){var isRequired=this.Action.Additional.RadioRequired[sGroupKey];var arrRadioGroup=this.GetSpecialRadioButtons(sGroupKey);for(var nIndex=0,nCount=arrRadioGroup.length;nIndex0&&this.FullRecalc.PageIndex>=nPagesCount+1)break}this.FullRecalc.UseRecursion=false};CDocument.prototype.private_Recalculate=function(_RecalcData,isForceStrictRecalc,nNoTimerPageIndex){if(this.RecalcInfo.Paused)this.ResumeRecalculate();if(this.RecalcInfo.Is_NeedRecalculateFromStart()){this.RecalcInfo.Set_NeedRecalculateFromStart(false); this.RecalculateFromStart();return document_recalcresult_NoRecal}this.DocumentOutline.Update();this.StartTime=(new Date).getTime();if(true!==this.Is_OnRecalculate())return document_recalcresult_NoRecal;if(false!=this.SearchEngine.ClearOnRecalc){var bOldSearch=this.SearchEngine.Count>0?true:false;this.SearchEngine.Clear();if(true===bOldSearch){editor.sync_SearchEndCallback();this.DrawingDocument.ClearCachePages();this.DrawingDocument.FirePaint()}}this.NeedUpdateTarget=true;this.RecalcId++;if(undefined=== _RecalcData){var arrChanges=this.History.GetNonRecalculatedChanges();if(this.private_RecalculateFastRunRange(arrChanges))return document_recalcresult_FastRange;if(this.private_RecalculateFastParagraph(arrChanges))return document_recalcresult_FastParagraph}var ChangeIndex=0;var MainChange=false;var RecalcData=History.Get_RecalcData(_RecalcData);History.Reset_RecalcIndex();this.DrawingObjects.recalculate_(RecalcData.Drawings);this.DrawingObjects.recalculateText_(RecalcData.Drawings);for(var GraphIndex= 0;GraphIndex= this.Content.length)ChangeIndex=this.Content.length-1;var nTempPage=this.private_GetPageByPos(ChangeIndex);var nTempIndex=-1!==nTempPage&&nTempPage>1?this.Pages[nTempPage-1].Pos:0;while(ChangeIndex>nTempIndex){var PrevElement=this.Content[ChangeIndex-1];if(type_Paragraph===PrevElement.GetType()&&PrevElement.IsKeepNext()){ChangeIndex--;RecalcData.Inline.PageNum=PrevElement.Get_AbsolutePage(PrevElement.GetPagesCount())}else break}var ChangedElement=this.Content[ChangeIndex];if(ChangedElement.GetPagesCount()> 0&&-1!==ChangedElement.GetIndex()&&ChangedElement.Get_StartPage_Absolute()0){var oFastPages={};var bCanFastRecalc=true;for(var nSimpleIndex=0,nSimplesCount=arrParagraphs.length;nSimpleIndexStartIndex))if(OldPage.EndPos>=Count-1&&PageIndex-this.Content[Count-1].Get_StartPage_Absolute()>=this.Content[Count-1].GetPagesCount()-1){this.Pages[PageIndex]=OldPage;this.DrawingDocument.OnRecalculatePage(PageIndex, this.Pages[PageIndex]);this.private_CheckCurPage();this.DrawingDocument.OnEndRecalculate(true);this.DrawingObjects.onEndRecalculateDocument(this.Pages.length);if(true===this.Selection.UpdateOnRecalc){this.Selection.UpdateOnRecalc=false;this.DrawingDocument.OnSelectEnd()}this.FullRecalc.Id=null;this.FullRecalc.MainStartPos=-1;return}else{if(undefined!==this.Pages[PageIndex+1]){this.Pages[PageIndex]=OldPage;this.DrawingDocument.OnRecalculatePage(PageIndex,this.Pages[PageIndex]);this.FullRecalc.PageIndex= PageIndex+1;this.FullRecalc.Start=true;this.FullRecalc.StartIndex=this.Pages[PageIndex+1].Pos;this.FullRecalc.ResetStartElement=false;var CurSectInfo=this.SectionsInfo.Get_SectPr(this.Pages[PageIndex+1].Pos);var PrevSectInfo=this.SectionsInfo.Get_SectPr(this.Pages[PageIndex].EndPos);if(PrevSectInfo!==CurSectInfo)this.FullRecalc.ResetStartElement=true;if(this.FullRecalc.UseRecursion){if(window["NATIVE_EDITOR_ENJINE_SYNC_RECALC"]===true){if(PageIndex+1>this.FullRecalc.StartPage+2)if(window["native"]["WC_CheckSuspendRecalculate"]!== undefined){this.FullRecalc.Id=setTimeout(Document_Recalculate_Page,10);return}this.Recalculate_Page();return}if(PageIndex+1>this.FullRecalc.StartPage+2)this.FullRecalc.Id=setTimeout(Document_Recalculate_Page,20);else this.Recalculate_Page()}else this.FullRecalc.Continue=true;return}}else if(true===bStart){this.Pages.length=PageIndex+1;this.DrawingObjects.createGraphicPage(PageIndex);this.DrawingObjects.resetDrawingArrays(PageIndex,this)}var StartPos=this.Get_PageContentStartPos(PageIndex,StartIndex); this.Footnotes.Reset(PageIndex,this.SectionsInfo.Get_SectPr(StartIndex).SectPr);this.Pages[PageIndex].ResetStartElement=this.FullRecalc.ResetStartElement;this.Pages[PageIndex].X=StartPos.X;this.Pages[PageIndex].XLimit=StartPos.XLimit;this.Pages[PageIndex].Y=StartPos.Y;this.Pages[PageIndex].YLimit=StartPos.YLimit;this.Pages[PageIndex].Sections[0].Y=StartPos.Y;this.Pages[PageIndex].Sections[0].YLimit=StartPos.YLimit;this.Pages[PageIndex].Sections[0].Pos=StartIndex;this.Pages[PageIndex].Sections[0].EndPos= StartIndex}if(0===SectionIndex&&0===ColumnIndex)this.Endnotes.Reset(PageIndex,this.SectionsInfo.Get_SectPr(StartIndex).SectPr);this.Recalculate_PageColumn()};CDocument.prototype.Recalculate_PageColumn=function(){var PageIndex=this.FullRecalc.PageIndex;var SectionIndex=this.FullRecalc.SectionIndex;var ColumnIndex=this.FullRecalc.ColumnIndex;var StartIndex=this.FullRecalc.StartIndex;var bResetStartElement=this.FullRecalc.ResetStartElement;var StartPos=this.Get_PageContentStartPos2(PageIndex,ColumnIndex, 0,StartIndex);var X=StartPos.X;var Y=StartPos.Y;var YLimit=StartPos.YLimit;var XLimit=StartPos.XLimit;var Page=this.Pages[PageIndex];var PageSection=Page.Sections[SectionIndex];var PageColumn=PageSection.Columns[ColumnIndex];PageColumn.X=X;PageColumn.XLimit=XLimit;PageColumn.Y=Y;PageColumn.YLimit=YLimit;PageColumn.Pos=StartIndex;PageColumn.Empty=false;PageColumn.SpaceBefore=StartPos.ColumnSpaceBefore;PageColumn.SpaceAfter=StartPos.ColumnSpaceAfter;PageColumn.Endnotes=this.FullRecalc.Endnotes;this.Footnotes.ContinueElementsFromPreviousColumn(PageIndex, ColumnIndex,Y,YLimit);var SectElement=this.SectionsInfo.Get_SectPr(StartIndex);var SectPr=SectElement.SectPr;var ColumnsCount=SectPr.Get_ColumnsCount();var bReDraw=true;var bContinue=false;var _PageIndex=PageIndex;var _ColumnIndex=ColumnIndex;var _StartIndex=StartIndex;var _SectionIndex=SectionIndex;var _bStart=false;var _bResetStartElement=false;var _bEndnotesContinue=false;var Count=this.Content.length;var Index;var isEndEndnoteRecalc=false;if(this.FullRecalc.Endnotes){var nEndnoteRecalcResult= this.Endnotes.Recalculate(X,Y,XLimit,YLimit-this.Footnotes.GetHeight(PageIndex,ColumnIndex),PageIndex,ColumnIndex,ColumnsCount,SectPr,this.SectionsInfo.Find(SectPr),StartIndex>=Count);if(recalcresult2_End===nEndnoteRecalcResult){PageColumn.EndPos=-1;Y=this.Endnotes.GetPageBounds(PageIndex,ColumnIndex,this.SectionsInfo.Find(SectPr)).Bottom;PageColumn.Bounds.Bottom=Y;_bEndnotesContinue=false;if(StartIndex=ColumnsCount-1){PageSection.IterateBottomLineCalculation(true);bContinue=true;_PageIndex=PageIndex;_SectionIndex=SectionIndex;_ColumnIndex=0;_StartIndex=this.Pages[_PageIndex].Sections[_SectionIndex].Columns[0].Pos;_bStart=false;_bResetStartElement=0===SectionIndex?Page.ResetStartElement:true;_bEndnotesContinue=this.Pages[_PageIndex].Sections[_SectionIndex].Columns[0].Endnotes===true;this.Pages[_PageIndex].Sections[_SectionIndex].Reset_Columns();bReDraw=false}else{bContinue=true;_PageIndex= ColumnIndex>=ColumnsCount-1?PageIndex+1:PageIndex;_ColumnIndex=ColumnIndex>=ColumnsCount-1?0:ColumnIndex+1;_SectionIndex=ColumnIndex>=ColumnsCount-1?0:SectionIndex;_bEndnotesContinue=true;_bStart=true;_bResetStartElement=true;_bEndnotesContinue=true}StartIndex=Count}}for(Index=StartIndex;Index 0&&(Index!==StartIndex||true!==bResetStartElement)&&Index===SectInfoElement.Index&&true===Element.IsEmpty()&&(type_Paragraph!==PrevElement.GetType()||undefined===PrevElement.Get_SectionPr())){RecalcResult=recalcresult_NextElement;this.private_RecalculateEmptySectionParagraph(Element,PrevElement,PageIndex,ColumnIndex,ColumnsCount);this.Pages[PageIndex].EndSectionParas.push(Element);bFlow=true}else{var ElementPageIndex=this.private_GetElementPageIndex(Index,PageIndex,ColumnIndex,ColumnsCount);RecalcResult= Element.Recalculate_Page(ElementPageIndex)}}if(true!=bFlow&&(RecalcResult&recalcresult_NextElement||RecalcResult&recalcresult_NextPage)){var ElementPageIndex=this.private_GetElementPageIndex(Index,PageIndex,ColumnIndex,ColumnsCount);Y=Element.Get_PageBounds(ElementPageIndex).Bottom}PageColumn.Bounds.Bottom=Y}if(RecalcResult&recalcresult_CurPage){bReDraw=false;bContinue=true;_PageIndex=PageIndex;_SectionIndex=SectionIndex;_bStart=false;if(RecalcResult&recalcresultflags_Column){_ColumnIndex=ColumnIndex; _StartIndex=StartIndex}else{_ColumnIndex=0;_StartIndex=this.Pages[_PageIndex].Sections[_SectionIndex].Columns[0].Pos}break}else if(RecalcResult&recalcresult_NextElement){var CurSectInfo=this.SectionsInfo.Get_SectPr(Index);if(Index= ColumnsCount-1){PageSection.IterateBottomLineCalculation(true);bContinue=true;_PageIndex=PageIndex;_SectionIndex=SectionIndex;_ColumnIndex=0;_StartIndex=this.Pages[_PageIndex].Sections[_SectionIndex].Columns[0].Pos;_bStart=false;_bResetStartElement=0===SectionIndex?Page.ResetStartElement:true;_bEndnotesContinue=this.Pages[_PageIndex].Sections[_SectionIndex].Columns[0].Endnotes===true;this.Pages[_PageIndex].Sections[_SectionIndex].Reset_Columns();bReDraw=false}else{bContinue=true;_StartIndex=Index; _PageIndex=ColumnIndex>=ColumnsCount-1?PageIndex+1:PageIndex;_ColumnIndex=ColumnIndex>=ColumnsCount-1?0:ColumnIndex+1;_SectionIndex=ColumnIndex>=ColumnsCount-1?0:SectionIndex;_bEndnotesContinue=true;_bStart=true;_bResetStartElement=true}break}}else this.Endnotes.ClearSection(this.SectionsInfo.Find(CurSectInfo.SectPr))}if(c_oAscSectionBreakType.Continuous===NextSectInfo.SectPr.Get_Type()&&true===CurSectInfo.SectPr.Compare_PageSize(NextSectInfo.SectPr)&&this.Footnotes.IsEmptyPage(PageIndex)){var SectionY= Y;for(var TempColumnIndex=0;TempColumnIndexSectionY)SectionY=PageSection.Columns[TempColumnIndex].Bounds.Bottom;PageSection.YLimit=SectionY;if((!PageSection.IsCalculatingSectionBottomLine()||PageSection.CanDecreaseBottomLine())&&ColumnsCount>1&&PageSection.CanRecalculateBottomLine()){PageSection.IterateBottomLineCalculation(false);bContinue=true;_PageIndex=PageIndex;_SectionIndex=SectionIndex;_ColumnIndex=0;_StartIndex= this.Pages[_PageIndex].Sections[_SectionIndex].Columns[0].Pos;_bStart=false;_bResetStartElement=0===SectionIndex?Page.ResetStartElement:true;this.Pages[_PageIndex].Sections[_SectionIndex].Reset_Columns();break}else{bContinue=true;_PageIndex=PageIndex;_SectionIndex=SectionIndex+1;_ColumnIndex=0;_StartIndex=Index+1;_bStart=false;_bResetStartElement=true;var NewPageSection=new CDocumentPageSection;NewPageSection.Init(PageIndex,NextSectInfo.SectPr,this.SectionsInfo.Find(NextSectInfo.SectPr));NewPageSection.Pos= Index;NewPageSection.EndPos=Index;NewPageSection.Y=SectionY+.001;NewPageSection.YLimit=this.Pages[PageIndex].YLimit;NewPageSection.YLimit2=this.Pages[PageIndex].YLimit;Page.Sections[_SectionIndex]=NewPageSection;break}}else{bContinue=true;_PageIndex=PageIndex+1;_SectionIndex=0;_ColumnIndex=0;_StartIndex=Index+1;_bStart=true;_bResetStartElement=true;break}}}else if(this.Endnotes.HaveEndnotes(CurSectInfo.SectPr,true)){var nSectionIndexAbs=this.SectionsInfo.Find(CurSectInfo.SectPr);this.Endnotes.FillSection(PageIndex, ColumnIndex,CurSectInfo.SectPr,nSectionIndexAbs,true);var nEndnoteRecalcResult=this.Endnotes.Recalculate(X,Y,XLimit,YLimit-this.Footnotes.GetHeight(PageIndex,ColumnIndex),PageIndex,ColumnIndex,ColumnsCount,CurSectInfo.SectPr,nSectionIndexAbs,true);if(recalcresult2_End===nEndnoteRecalcResult)Y=this.Endnotes.GetPageBounds(PageIndex,ColumnIndex,nSectionIndexAbs).Bottom;else _bEndnotesContinue=true}else this.Endnotes.ClearSection(this.SectionsInfo.Find(CurSectInfo.SectPr))}else if(RecalcResult&recalcresult_NextPage)if(true=== PageSection.IsCalculatingSectionBottomLine()&&PageSection.CanIncreaseBottomLine()&&(RecalcResult&recalcresultflags_LastFromNewPage||ColumnIndex>=ColumnsCount-1)){PageSection.IterateBottomLineCalculation(true);bContinue=true;_PageIndex=PageIndex;_SectionIndex=SectionIndex;_ColumnIndex=0;_StartIndex=this.Pages[_PageIndex].Sections[_SectionIndex].Columns[0].Pos;_bStart=false;_bResetStartElement=0===SectionIndex?Page.ResetStartElement:true;this.Pages[_PageIndex].Sections[_SectionIndex].Reset_Columns(); bReDraw=false;break}else if(RecalcResult&recalcresultflags_LastFromNewColumn){PageColumn.EndPos=Index-1;PageSection.EndPos=Index-1;Page.EndPos=Index-1;bContinue=true;_SectionIndex=SectionIndex;_ColumnIndex=ColumnIndex+1;_PageIndex=PageIndex;_StartIndex=Index;_bStart=true;_bResetStartElement=true;if(_ColumnIndex>=ColumnsCount){_SectionIndex=0;_ColumnIndex=0;_PageIndex=PageIndex+1}else bReDraw=false;break}else if(RecalcResult&recalcresultflags_LastFromNewPage){PageColumn.EndPos=Index-1;PageSection.EndPos= Index-1;Page.EndPos=Index-1;bContinue=true;_SectionIndex=0;_ColumnIndex=0;_PageIndex=PageIndex+1;_StartIndex=Index;_bStart=true;_bResetStartElement=true;if(PageColumn.EndPos===PageColumn.Pos){var Element=this.Content[PageColumn.Pos];var ElementPageIndex=this.private_GetElementPageIndex(Index,PageIndex,ColumnIndex,ColumnsCount);if(true===Element.IsEmptyPage(ElementPageIndex))PageColumn.Empty=true}for(var TempColumnIndex=ColumnIndex+1;TempColumnIndex=ColumnsCount){_SectionIndex=0;_ColumnIndex=0;_PageIndex=PageIndex+1}else bReDraw=false;_StartIndex=Index;_bStart=true;if(PageColumn.EndPos===PageColumn.Pos){var Element=this.Content[PageColumn.Pos];var ElementPageIndex=this.private_GetElementPageIndex(Index,PageIndex,ColumnIndex,ColumnsCount);if(true===Element.IsEmptyPage(ElementPageIndex))PageColumn.Empty=true}break}else if(RecalcResult&recalcresult_PrevPage){bReDraw= false;bContinue=true;if(RecalcResult&recalcresultflags_Column)if(0===ColumnIndex){_PageIndex=Math.max(PageIndex-1,0);_SectionIndex=this.Pages[_PageIndex].Sections.length-1;_ColumnIndex=this.Pages[_PageIndex].Sections[_SectionIndex].Columns.length-1}else{_PageIndex=PageIndex;_ColumnIndex=ColumnIndex-1;_SectionIndex=SectionIndex}else{if(_SectionIndex>0);_PageIndex=Math.max(PageIndex-1,0);_SectionIndex=this.Pages[_PageIndex].Sections.length-1;_ColumnIndex=0}_StartIndex=this.Pages[_PageIndex].Sections[_SectionIndex].Columns[_ColumnIndex].Pos; _bStart=false;break}if(docpostype_Content===this.GetDocPosType()&&Index===this.CurPos.ContentPos)if(type_Paragraph===Element.GetType())this.CurPage=PageIndex;else this.CurPage=PageIndex;if(docpostype_Content===this.GetDocPosType()&&(true!==this.Selection.Use&&Index===this.CurPos.ContentPos+1||true===this.Selection.Use&&Index===Math.max(this.Selection.EndPos,this.Selection.StartPos)+1))this.private_UpdateCursorXY(true,true)}if(Index>=Count){Page.EndPos=Count-1;PageSection.EndPos=Count-1;PageColumn.EndPos= Count-1}if(Index>=Count||_PageIndex>PageIndex||_ColumnIndex>ColumnIndex)this.private_RecalculateShiftFootnotes(PageIndex,ColumnIndex,Y,SectPr);if(true===bReDraw)this.DrawingDocument.OnRecalculatePage(PageIndex,this.Pages[PageIndex]);if(Index>=Count)if(_bEndnotesContinue||this.Footnotes.HaveContinuesFootnotes(PageIndex,ColumnIndex)){bContinue=true;_PageIndex=ColumnIndex>=ColumnsCount-1?PageIndex+1:PageIndex;_ColumnIndex=ColumnIndex>=ColumnsCount-1?0:ColumnIndex+1;_SectionIndex=ColumnIndex>=ColumnsCount- 1?0:SectionIndex;_bStart=true;_StartIndex=Count}else{this.FullRecalc.Id=null;this.FullRecalc.MainStartPos=-1;this.private_CheckUnusedFields();this.private_CheckCurPage();this.DrawingDocument.OnEndRecalculate(true);this.DrawingObjects.onEndRecalculateDocument(this.Pages.length);if(true===this.Selection.UpdateOnRecalc){this.Selection.UpdateOnRecalc=false;this.DrawingDocument.OnSelectEnd()}if(-1===this.HdrFtrRecalc.PageCount||this.HdrFtrRecalc.PageCountthis.FullRecalc.StartPage+this.FullRecalc.StartPagesCount)if(window["native"]["WC_CheckSuspendRecalculate"]!==undefined){this.FullRecalc.Id=setTimeout(Document_Recalculate_Page, 10);return}this.Recalculate_Page();return}if(_PageIndex>this.FullRecalc.StartPage+this.FullRecalc.StartPagesCount)this.FullRecalc.Id=setTimeout(Document_Recalculate_Page,20);else this.Recalculate_Page()}else this.FullRecalc.Continue=true}};CDocument.prototype.private_RecalculateIsNewSection=function(nPageAbs,nContentIndex){var bNewSection=0===nPageAbs?true:false;if(0!==nPageAbs){var PrevStartIndex=this.Pages[nPageAbs-1].Pos;var CurSectInfo=this.SectionsInfo.Get_SectPr(nContentIndex);var PrevSectInfo= this.SectionsInfo.Get_SectPr(PrevStartIndex);if(PrevSectInfo!==CurSectInfo&&(c_oAscSectionBreakType.Continuous!==CurSectInfo.SectPr.Get_Type()||true!==CurSectInfo.SectPr.Compare_PageSize(PrevSectInfo.SectPr)))bNewSection=true}return bNewSection};CDocument.prototype.private_RecalculateShiftFootnotes=function(nPageAbs,nColumnAbs,dY,oSectPr){var nPosType=oSectPr.GetFootnotePos();if(Asc.c_oAscFootnotePos.BeneathText===nPosType||Asc.c_oAscFootnotePos.DocEnd===nPosType||Asc.c_oAscFootnotePos.SectEnd=== nPosType)this.Footnotes.Shift(nPageAbs,nColumnAbs,0,dY);else{var dFootnotesHeight=this.Footnotes.GetHeight(nPageAbs,nColumnAbs);var oPageMetrics=this.Get_PageContentStartPos(nPageAbs);this.Footnotes.Shift(nPageAbs,nColumnAbs,0,oPageMetrics.YLimit-dFootnotesHeight)}};CDocument.prototype.private_RecalculateFlowTable=function(RecalcInfo){var Element=RecalcInfo.Element;var X=RecalcInfo.X;var Y=RecalcInfo.Y;var XLimit=RecalcInfo.XLimit;var YLimit=RecalcInfo.YLimit;var PageIndex=RecalcInfo.PageIndex;var ColumnIndex= RecalcInfo.ColumnIndex;var Index=RecalcInfo.Index;var StartIndex=RecalcInfo.StartIndex;var ColumnsCount=RecalcInfo.ColumnsCount;var bResetStartElement=RecalcInfo.ResetStartElement;var RecalcResult=RecalcInfo.RecalcResult;var isColumns=ColumnsCount>1?true:false;if(true===isColumns)YLimit=1E4;if(true===this.RecalcInfo.Can_RecalcObject()){var ElementPageIndex=0;if(0===Index&&0===PageIndex||Index!=StartIndex||Index===StartIndex&&true===bResetStartElement){Element.Set_DocumentIndex(Index);Element.Reset(X, Y,XLimit,YLimit,PageIndex,ColumnIndex,ColumnsCount,this.Pages[PageIndex].Sections[this.Pages[PageIndex].Sections.length-1].Y);ElementPageIndex=0}else ElementPageIndex=PageIndex-Element.PageNum;var TempRecalcResult=Element.Recalculate_Page(ElementPageIndex);this.RecalcInfo.Set_FlowObject(Element,ElementPageIndex,TempRecalcResult,-1,{X:X,Y:Y,XLimit:XLimit,YLimit:YLimit});if((0===Index&&0===PageIndex||Index!=StartIndex)&&true!=Element.IsContentOnFirstPage()&&true!==isColumns){this.RecalcInfo.Set_PageBreakBefore(true); RecalcResult=recalcresult_NextPage|recalcresultflags_LastFromNewPage}else{this.Pages[PageIndex].AddFlowTable(Element);this.DrawingObjects.addFloatTable(new CFlowTable(Element,PageIndex));RecalcResult=recalcresult_CurPage}}else if(true===this.RecalcInfo.Check_FlowObject(Element))if(Element.PageNum===PageIndex)if(true===this.RecalcInfo.Is_PageBreakBefore()){this.RecalcInfo.Reset();RecalcResult=recalcresult_NextPage|recalcresultflags_LastFromNewPage}else{X=this.RecalcInfo.AdditionalInfo.X;Y=this.RecalcInfo.AdditionalInfo.Y; XLimit=this.RecalcInfo.AdditionalInfo.XLimit;YLimit=this.RecalcInfo.AdditionalInfo.YLimit;Element.Reset(X,Y,XLimit,YLimit,PageIndex,ColumnIndex,ColumnsCount,this.Pages[PageIndex].Sections[this.Pages[PageIndex].Sections.length-1].Y);RecalcResult=Element.Recalculate_Page(0);this.RecalcInfo.FlowObjectPage++;if(true===isColumns)RecalcResult=recalcresult_NextElement;if(RecalcResult&recalcresult_NextElement)this.RecalcInfo.Reset()}else if(Element.PageNum>PageIndex||this.RecalcInfo.FlowObjectPage<=0&&Element.PageNum< PageIndex){this.Pages[PageIndex-1].RemoveFlowTable(Element);this.DrawingObjects.removeFloatTableById(PageIndex-1,Element.Get_Id());this.RecalcInfo.Set_PageBreakBefore(true);RecalcResult=recalcresult_PrevPage}else{RecalcResult=Element.Recalculate_Page(PageIndex-Element.PageNum);this.RecalcInfo.FlowObjectPage++;this.Pages[PageIndex].AddFlowTable(Element);this.DrawingObjects.addFloatTable(new CFlowTable(Element,PageIndex));if(RecalcResult&recalcresult_NextElement)this.RecalcInfo.Reset()}else RecalcResult= recalcresult_NextElement;RecalcInfo.Index=Index;RecalcInfo.RecalcResult=RecalcResult};CDocument.prototype.private_RecalculateFlowParagraph=function(RecalcInfo){var Element=RecalcInfo.Element;var X=RecalcInfo.X;var Y=RecalcInfo.Y;var XLimit=RecalcInfo.XLimit;var YLimit=RecalcInfo.YLimit;var PageIndex=RecalcInfo.PageIndex;var ColumnIndex=RecalcInfo.ColumnIndex;var Index=RecalcInfo.Index;var StartIndex=RecalcInfo.StartIndex;var ColumnsCount=RecalcInfo.ColumnsCount;var bResetStartElement=RecalcInfo.ResetStartElement; var RecalcResult=RecalcInfo.RecalcResult;var Page=this.Pages[PageIndex];if(true===this.RecalcInfo.Can_RecalcObject()){var FramePr=Element.GetFramePr();var FlowCount=this.private_RecalculateFlowParagraphCount(Index);var Page_W=Page.Width;var Page_H=Page.Height;var Page_Field_L=Page.Margins.Left;var Page_Field_R=Page.Margins.Right;var Page_Field_T=Page.Margins.Top;var Page_Field_B=Page.Margins.Bottom;var Column_Field_L=X;var Column_Field_R=XLimit;var FrameH=0;var FrameW=-1;var Frame_XLimit=FramePr.Get_W(); var Frame_YLimit=FramePr.Get_H();var FrameHRule=undefined===FramePr.HRule?undefined!==Frame_YLimit?Asc.linerule_AtLeast:Asc.linerule_Auto:FramePr.HRule;if(undefined===Frame_XLimit)Frame_XLimit=Page_Field_R-Page_Field_L;if(undefined===Frame_YLimit||Asc.linerule_Auto===FrameHRule)Frame_YLimit=Page_H;for(var TempIndex=Index;TempIndexnMaxGapLeft)nMaxGapLeft=oTempTableInfo.GapLeft;if(oTempTableInfo.GridWidth>nMaxGridWidth)nMaxGridWidth=oTempTableInfo.GridWidth;if(oTempTableInfo.GridWidth+oTempTableInfo.GapRight>nMaxGridWidthRightGap)nMaxGridWidthRightGap=oTempTableInfo.GridWidth+oTempTableInfo.GapRight}if(Element.IsParagraph()&&-1===FrameW&&1===FlowCount&& 1===Element.Lines.length&&undefined===FramePr.Get_W()){FrameW=Element.GetAutoWidthForDropCap();var ParaPr=Element.Get_CompiledPr2(false).ParaPr;FrameW+=ParaPr.Ind.Left+ParaPr.Ind.FirstLine;if(align_Left!=ParaPr.Jc){Element.Reset(0,0,FrameW,Frame_YLimit,PageIndex,ColumnIndex,ColumnsCount);Element.Recalculate_Page(0);FrameH=TempElement.Get_PageBounds(0).Bottom}}else if(-1===FrameW)if(Element.IsTable()&&!FramePr.Get_W())FrameW=nMaxGridWidth;else FrameW=Frame_XLimit;var nGapLeft=nMaxGapLeft;var nGapRight= nMaxGridWidthRightGap>FrameW&&nMaxGridWidthPage_H)FrameY=Page_H-FrameH;FrameY+=.001;FrameH-=.002;if(FrameY<0)FrameY=0;var FrameBounds; if(this.Content[Index].IsParagraph())FrameBounds=this.Content[Index].Get_FrameBounds(FrameX,FrameY,FrameW,FrameH);else FrameBounds=this.Content[Index].GetFirstParagraph().Get_FrameBounds(FrameX,FrameY,FrameW,FrameH);var FrameX2=FrameBounds.X-nGapLeft,FrameY2=FrameBounds.Y,FrameW2=FrameBounds.W+nGapLeft+nGapRight,FrameH2=FrameBounds.H;if(!(RecalcResult&recalcresult_NextElement)){if(RecalcResult&recalcresult_PrevPage)this.RecalcInfo.Set_FrameRecalc(false)}else if((FrameY2+FrameH2>Page_H||Y>Page_H-.001)&& Index!=StartIndex){this.RecalcInfo.Set_FrameRecalc(true);RecalcResult=recalcresult_NextPage|recalcresultflags_LastFromNewColumn}else{var oCalculatedFrame=new CCalculatedFrame(FramePr,FrameX,FrameY,FrameW,FrameH,FrameX2,FrameY2,FrameW2,FrameH2,PageIndex,Index,FlowCount);this.RecalcInfo.Set_FrameRecalc(false);for(var TempIndex=Index;TempIndex=Y&&FrameX>=X-.001)RecalcResult=recalcresult_NextElement;else{this.RecalcInfo.Set_FlowObject(Element,PageIndex,recalcresult_NextElement,FlowCount);RecalcResult=recalcresult_CurPage|recalcresultflags_Page}}}else if(true=== this.RecalcInfo.Check_FlowObject(Element)&&true===this.RecalcInfo.Is_PageBreakBefore()){this.RecalcInfo.Reset();this.RecalcInfo.Set_FrameRecalc(true);RecalcResult=recalcresult_NextPage|recalcresultflags_LastFromNewPage}else if(true===this.RecalcInfo.Check_FlowObject(Element))if(this.RecalcInfo.FlowObjectPage!==PageIndex){this.RecalcInfo.Set_PageBreakBefore(true);this.Pages[this.RecalcInfo.FlowObjectPage].RemoveFrame(Index);this.DrawingObjects.removeFloatTableById(this.RecalcInfo.FlowObjectPage,Element.Get_Id()); RecalcResult=recalcresult_PrevPage|recalcresultflags_Page}else{var FlowCount=this.RecalcInfo.FlowObjectElementsCount;for(var TempIndex=Index;TempIndex=this.HdrFtrRecalc.PageIndex+5&&window["native"]["WC_CheckSuspendRecalculate"]!==undefined){this.HdrFtrRecalc.PageIndex=nPageAbs+1;this.HdrFtrRecalc.Id=setTimeout(Document_Recalculate_HdrFtrPageCount,20);return}nPageAbs++}else if(nPageAbs=nPagesCount)this.DrawingDocument.OnEndRecalculate(false,true)};CDocument.prototype.private_CheckUnusedFields=function(){if(this.Content.length<=0)return;var oLastPara=this.Content[this.Content.length-1];if(type_Paragraph!==oLastPara.GetType())return;var oInfo=oLastPara.GetEndInfoByPage(oLastPara.GetPagesCount()- 1);for(var nIndex=0,nCount=oInfo.ComplexFields.length;nIndexthis.Pages[nCurPage].Pos)nResultPage=nCurPage;else break;return nResultPage}; CDocument.prototype.OnColumnBreak_WhileRecalculate=function(){var PageIndex=this.FullRecalc.PageIndex;var SectionIndex=this.FullRecalc.SectionIndex;if(this.Pages[PageIndex]&&this.Pages[PageIndex].Sections[SectionIndex])this.Pages[PageIndex].Sections[SectionIndex].ForbidRecalculateBottomLine()};CDocument.prototype.Reset_RecalculateCache=function(){this.SectionsInfo.Reset_HdrFtrRecalculateCache();var Count=this.Content.length;for(var Index=0;Index=this.FullRecalc.PageIndex-1)return false;return true};CDocument.prototype.Draw=function(nPageIndex,pGraphics){this.CollaborativeEditing.Update_ForeignCursorsPositions();this.Comments.Reset_Drawing(nPageIndex);var Page_StartPos=this.Pages[nPageIndex].Pos;var SectPr=this.SectionsInfo.Get_SectPr(Page_StartPos).SectPr;if(docpostype_HdrFtr!==this.CurPos.Type&&!this.IsViewMode())pGraphics.Start_GlobalAlpha(); if(section_borders_ZOrderBack===SectPr.Get_Borders_ZOrder())this.DrawPageBorders(pGraphics,SectPr,nPageIndex);this.HdrFtr.Draw(nPageIndex,pGraphics);if(docpostype_HdrFtr===this.CurPos.Type)pGraphics.put_GlobalAlpha(true,.4);else if(!this.IsViewMode())pGraphics.End_GlobalAlpha();this.DrawingObjects.drawBehindDoc(nPageIndex,pGraphics);this.Footnotes.Draw(nPageIndex,pGraphics);var Page=this.Pages[nPageIndex];for(var SectionIndex=0,SectionsCount=Page.Sections.length;SectionIndex0&&!Column.IsEmpty()){var SepX=(Column.X+PageSection.Columns[ColumnIndex-1].XLimit)/2;pGraphics.p_color(0,0,0,255);pGraphics.drawVerLine(c_oAscLineDrawingRule.Left, SepX,PageSection.Y,PageSection.YLimit,.75*g_dKoef_pt_to_mm)}if(ColumnsCount>1){pGraphics.SaveGrState();var X=ColumnIndex===0?0:Column.X-Column.SpaceBefore/2;var XEnd=ColumnIndex>=ColumnsCount-1?Page.Width:Column.XLimit+Column.SpaceAfter/2;pGraphics.AddClipRect(X,0,XEnd-X,Page.Height)}for(var ContentPos=ColumnStartPos;ContentPos<=ColumnEndPos;++ContentPos){var oElement=this.Content[ContentPos];if(Page.IsFlowTable(oElement)||Page.IsFrame(oElement))continue;var ElementPageIndex=this.private_GetElementPageIndex(ContentPos, nPageIndex,ColumnIndex,ColumnsCount);this.Content[ContentPos].Draw(ElementPageIndex,pGraphics)}if(ColumnsCount>1)pGraphics.RestoreGrState();for(var nFlowTableIndex=0,nFlowTablesCount=Page.FlowTables.length;nFlowTableIndexnHeaderY)nHeaderY=oHdrFtrLine.Top;var nFooterY=this.Pages[nPageIndex].YLimit;if(null!==oHdrFtrLine.Bottom&&oHdrFtrLine.BottomY)break;LastPara=NewParagraph}LastPara=this.Content[this.Content.length-1];if(LastPara!=LastPara2||false===this.Document_Is_SelectionLocked(changestype_None,{Type:changestype_2_Element_and_Type, Element:LastPara,CheckType:changestype_Paragraph_Content}))LastPara.Extend_ToPos(X);LastPara.MoveCursorToEndPos();LastPara.Document_SetThisElementCurrent(true);this.Recalculate();this.FinalizeAction()};CDocument.prototype.GroupGraphicObjects=function(){if(this.CanGroup())this.DrawingObjects.groupSelectedObjects()};CDocument.prototype.UnGroupGraphicObjects=function(){if(this.CanUnGroup())this.DrawingObjects.unGroupSelectedObjects()};CDocument.prototype.StartChangeWrapPolygon=function(){this.DrawingObjects.startChangeWrapPolygon()}; CDocument.prototype.CanChangeWrapPolygon=function(){return this.DrawingObjects.canChangeWrapPolygon()};CDocument.prototype.CanGroup=function(){return this.DrawingObjects.canGroup()};CDocument.prototype.CanUnGroup=function(){return this.DrawingObjects.canUnGroup()};CDocument.prototype.AddInlineImage=function(W,H,Img,Chart,bFlow){if(undefined===bFlow)bFlow=false;this.TurnOff_InterfaceEvents();this.Controller.AddInlineImage(W,H,Img,Chart,bFlow);this.TurnOn_InterfaceEvents(true)};CDocument.prototype.AddImages= function(aImages){this.Controller.AddImages(aImages)};CDocument.prototype.AddOleObject=function(W,H,nWidthPix,nHeightPix,Img,Data,sApplicationId){this.Controller.AddOleObject(W,H,nWidthPix,nHeightPix,Img,Data,sApplicationId)};CDocument.prototype.EditOleObject=function(oOleObject,sData,sImageUrl,nPixWidth,nPixHeight){oOleObject.setData(sData);var _blipFill=new AscFormat.CBlipFill;_blipFill.RasterImageId=sImageUrl;oOleObject.setBlipFill(_blipFill);oOleObject.setPixSizes(nPixWidth,nPixHeight)};CDocument.prototype.AddTextArt= function(nStyle){this.Controller.AddTextArt(nStyle)};CDocument.prototype.AddSignatureLine=function(oSignatureDrawing){this.Controller.AddSignatureLine(oSignatureDrawing)};CDocument.prototype.EditChart=function(Chart){this.Controller.EditChart(Chart)};CDocument.prototype.GetChartObject=function(type){var W=null,H=null;if(type!=null){var oTargetContent=this.DrawingObjects.getTargetDocContent();if(oTargetContent&&!oTargetContent.bPresentation){W=oTargetContent.XLimit;H=W}else{var oColumnSize=this.GetColumnSize(); if(oColumnSize){W=oColumnSize.W;H=oColumnSize.H}}}return this.DrawingObjects.getChartObject(type,W,H)};CDocument.prototype.AddInlineTable=function(nCols,nRows,nMode){if(nCols<=0||nRows<=0)return null;var oTable=this.Controller.AddInlineTable(nCols,nRows,nMode);this.Recalculate();this.UpdateSelection();this.UpdateInterface();this.UpdateRulers();return oTable};CDocument.prototype.AddDropCap=function(bInText){var Pos=-1;if(false===this.Selection.Use)Pos=this.CurPos.ContentPos;else if(true===this.Selection.Use&& this.Selection.StartPos<=this.Selection.EndPos)Pos=this.Selection.StartPos;else if(true===this.Selection.Use&&this.Selection.StartPos>this.Selection.EndPos)Pos=this.Selection.EndPos;if(-1===Pos||!this.Content[Pos].IsParagraph())return;var OldParagraph=this.Content[Pos];if(this.IsSelectionUse()&&!OldParagraph.CheckSelectionForDropCap())this.RemoveSelection();if(!this.IsSelectionUse()&&!OldParagraph.SelectFirstLetter())return;if(OldParagraph.Lines.length<=0)return;if(!this.IsSelectionLocked(changestype_Paragraph_Content)){this.StartAction(AscDFH.historydescription_Document_AddDropCap); var NewParagraph=new Paragraph(this.DrawingDocument,this);var TextPr=OldParagraph.Split_DropCap(NewParagraph);var Before=OldParagraph.Get_CompiledPr().ParaPr.Spacing.Before;var LineH=OldParagraph.Lines[0].Bottom-OldParagraph.Lines[0].Top-Before;var LineTA=OldParagraph.Lines[0].Metrics.TextAscent2;var LineTD=OldParagraph.Lines[0].Metrics.TextDescent+OldParagraph.Lines[0].Metrics.LineGap;var FramePr=new CFramePr;FramePr.Init_Default_DropCap(bInText);NewParagraph.Set_FrameParaPr(OldParagraph);NewParagraph.Set_FramePr2(FramePr); NewParagraph.Update_DropCapByLines(TextPr,NewParagraph.Pr.FramePr.Lines,LineH,LineTA,LineTD,Before);this.Internal_Content_Add(Pos,NewParagraph);NewParagraph.MoveCursorToEndPos();this.RemoveSelection();this.CurPos.ContentPos=Pos;this.SetDocPosType(docpostype_Content);this.Recalculate();this.UpdateInterface();this.UpdateRulers();this.UpdateTracks();this.FinalizeAction()}};CDocument.prototype.RemoveDropCap=function(bDropCap){var Pos=-1;if(false===this.Selection.Use&&type_Paragraph===this.Content[this.CurPos.ContentPos].GetType())Pos= this.CurPos.ContentPos;else if(true===this.Selection.Use&&this.Selection.StartPos<=this.Selection.EndPos&&type_Paragraph===this.Content[this.Selection.StartPos].GetType())Pos=this.Selection.StartPos;else if(true===this.Selection.Use&&this.Selection.StartPos>this.Selection.EndPos&&type_Paragraph===this.Content[this.Selection.EndPos].GetType())Pos=this.Selection.EndPos;if(-1===Pos)return;var Para=this.Content[Pos];var FramePr=Para.Get_FramePr();if(undefined===FramePr&&true===bDropCap){var Prev=Para.Get_DocumentPrev(); if(null!=Prev&&type_Paragraph===Prev.GetType()){var PrevFramePr=Prev.Get_FramePr();if(undefined!=PrevFramePr&&undefined!=PrevFramePr.DropCap){Para=Prev;FramePr=PrevFramePr}else return}else return}if(undefined===FramePr)return;var FrameParas=Para.Internal_Get_FrameParagraphs();if(false===bDropCap){if(false===this.Document_Is_SelectionLocked(changestype_None,{Type:changestype_2_ElementsArray_and_Type,Elements:FrameParas,CheckType:changestype_Paragraph_Content})){this.StartAction(AscDFH.historydescription_Document_RemoveDropCap); var Count=FrameParas.length;for(var Index=0;Index1&&arrDrawings[0].IsInline())return;for(var nIndex=0;nIndex.001)if(this.IsGutterAtTop())T=Math.max(0,T-nGutter);else if(oSectPr.IsGutterRTL())R=Math.max(0, R-nGutter);else L=Math.max(0,L-nGutter);if(oSectPr.GetPageMarginTop()<0&&T>0)T=-T}oSectPr.SetPageMargins(L,T,R,B);this.DrawingObjects.CheckAutoFit();this.Recalculate();this.UpdateSelection();this.UpdateInterface();this.UpdateRulers()};CDocument.prototype.Set_DocumentPageSize=function(W,H,bNoRecalc){var CurPos=this.CurPos.ContentPos;var SectPr=this.SectionsInfo.Get_SectPr(CurPos).SectPr;SectPr.SetPageSize(W,H);this.DrawingObjects.CheckAutoFit();if(true!=bNoRecalc){this.Recalculate();this.Document_UpdateSelectionState(); this.Document_UpdateInterfaceState();this.Document_UpdateRulersState()}};CDocument.prototype.Get_DocumentPageSize=function(){var CurPos=this.CurPos.ContentPos;var SectionInfoElement=this.SectionsInfo.Get_SectPr(CurPos);if(undefined===SectionInfoElement)return true;var SectPr=SectionInfoElement.SectPr;return{W:SectPr.GetPageWidth(),H:SectPr.GetPageHeight()}};CDocument.prototype.Set_DocumentOrientation=function(Orientation,bNoRecalc){var CurPos=this.CurPos.ContentPos;var SectPr=this.SectionsInfo.Get_SectPr(CurPos).SectPr; SectPr.SetOrientation(Orientation,true);this.DrawingObjects.CheckAutoFit();if(true!=bNoRecalc){this.Recalculate();this.Document_UpdateSelectionState();this.Document_UpdateInterfaceState();this.Document_UpdateRulersState()}};CDocument.prototype.Get_DocumentOrientation=function(){var CurPos=this.CurPos.ContentPos;var SectionInfoElement=this.SectionsInfo.Get_SectPr(CurPos);if(undefined===SectionInfoElement)return true;var SectPr=SectionInfoElement.SectPr;return SectPr.GetOrientation()===Asc.c_oAscPageOrientation.PagePortrait? true:false};CDocument.prototype.Set_DocumentDefaultTab=function(DTab){this.History.Add(new CChangesDocumentDefaultTab(this,AscCommonWord.Default_Tab_Stop,DTab));AscCommonWord.Default_Tab_Stop=DTab};CDocument.prototype.Set_DocumentEvenAndOddHeaders=function(Value){if(Value!==EvenAndOddHeaders){this.History.Add(new CChangesDocumentEvenAndOddHeaders(this,EvenAndOddHeaders,Value));EvenAndOddHeaders=Value}};CDocument.prototype.Interface_Update_ParaPr=function(){if(!this.Api)return;var ParaPr=this.GetCalculatedParaPr(); if(null!=ParaPr){ParaPr.CanAddDropCap=false;if(docpostype_Content===this.GetDocPosType()){var Para=null;if(false===this.Selection.Use&&type_Paragraph===this.Content[this.CurPos.ContentPos].GetType())Para=this.Content[this.CurPos.ContentPos];else if(true===this.Selection.Use&&this.Selection.StartPos<=this.Selection.EndPos&&type_Paragraph===this.Content[this.Selection.StartPos].GetType())Para=this.Content[this.Selection.StartPos];else if(true===this.Selection.Use&&this.Selection.StartPos>this.Selection.EndPos&& type_Paragraph===this.Content[this.Selection.EndPos].GetType())Para=this.Content[this.Selection.EndPos];if(null!=Para&&undefined===Para.Get_FramePr()){var Prev=Para.Get_DocumentPrev();if((null===Prev||type_Paragraph!=Prev.GetType()||undefined===Prev.Get_FramePr()||undefined===Prev.Get_FramePr().DropCap)&&true===Para.CanAddDropCap())ParaPr.CanAddDropCap=true}}var oSelectedInfo=this.GetSelectedElementsInfo({CheckAllSelection:true});var oMath=oSelectedInfo.GetMath();if(oMath)ParaPr.CanAddImage=false; else ParaPr.CanAddImage=true;if(oMath&&!oMath.Is_Inline())ParaPr.Jc=oMath.Get_Align();ParaPr.CanDeleteBlockCC=oSelectedInfo.CanDeleteBlockSdts();ParaPr.CanEditBlockCC=oSelectedInfo.CanEditBlockSdts();ParaPr.CanDeleteInlineCC=oSelectedInfo.CanDeleteInlineSdts();ParaPr.CanEditInlineCC=oSelectedInfo.CanEditInlineSdts();if(undefined!=ParaPr.Tabs)this.Api.Update_ParaTab(AscCommonWord.Default_Tab_Stop,ParaPr.Tabs);if(ParaPr.Shd&&ParaPr.Shd.Unifill)ParaPr.Shd.Unifill.check(this.theme,this.Get_ColorMap()); this.Api.UpdateParagraphProp(ParaPr)}};CDocument.prototype.Interface_Update_TextPr=function(){if(!this.Api)return;var TextPr=this.GetCalculatedTextPr();if(null!=TextPr){var theme=this.Get_Theme();if(theme&&theme.themeElements&&theme.themeElements.fontScheme)TextPr.ReplaceThemeFonts(theme.themeElements.fontScheme);if(TextPr.Unifill){var RGBAColor=TextPr.Unifill.getRGBAColor();TextPr.Color=new CDocumentColor(RGBAColor.R,RGBAColor.G,RGBAColor.B,false)}if(TextPr.Shd&&TextPr.Shd.Unifill)TextPr.Shd.Unifill.check(this.theme, this.Get_ColorMap());this.Api.UpdateTextPr(TextPr)}};CDocument.prototype.Interface_Update_DrawingPr=function(Flag){var DrawingPr=this.DrawingObjects.Get_Props();if(true===Flag)return DrawingPr;else if(this.Api)for(var i=0;i=this.Pages.length)nCurPage=this.Pages.length-1;else if(nCurPage<0)nCurPage=0;var oFlow=this.DrawingObjects.getTableByXY(X,Y,nCurPage,this);var nFlowPos=this.private_GetContentIndexByFlowObject(oFlow,X,Y);if(-1!==nFlowPos){var oElement=this.Content[nFlowPos];ColumnsInfo.Column=oElement.GetStartColumn();ColumnsInfo.ColumnsCount=oElement.GetColumnsCount(); return nFlowPos}var SectCount=this.Pages[nCurPage].EndSectionParas.length;for(var Index=0;IndexBounds.Top&&X>Bounds.Left&&X0&&(true===PageSection.Columns[ColumnIndex].Empty||PageSection.Columns[ColumnIndex].EndPos1){if(true!==Item.IsStartFromNewPage())return InlineElements[Pos+1];return InlineElements[Pos]}if(Pos=== Count-2)return InlineElements[Count-1]}return InlineElements[0]};CDocument.prototype.RemoveSelection=function(bNoCheckDrawing){this.ResetWordSelection();this.Controller.RemoveSelection(bNoCheckDrawing)};CDocument.prototype.IsSelectionEmpty=function(bCheckHidden){return this.Controller.IsSelectionEmpty(bCheckHidden)};CDocument.prototype.DrawSelectionOnPage=function(PageAbs){this.DrawingDocument.UpdateTargetTransform(null);this.DrawingDocument.SetTextSelectionOutline(false);this.Controller.DrawSelectionOnPage(PageAbs)}; CDocument.prototype.GetSelectionBounds=function(){return this.Controller.GetSelectionBounds()};CDocument.prototype.Selection_SetStart=function(X,Y,MouseEvent){this.ResetWordSelection();var bInText=null===this.IsInText(X,Y,this.CurPage)?false:true;var bTableBorder=null===this.IsTableBorder(X,Y,this.CurPage)?false:true;var nInDrawing=this.DrawingObjects.IsInDrawingObject(X,Y,this.CurPage,this);var bFlowTable=null===this.DrawingObjects.getTableByXY(X,Y,this.CurPage,this)?false:true;if(this.CanDragAndDrop()&& -1!==this.Selection.DragDrop.Flag&&MouseEvent.ClickCount<=1&&false===bTableBorder&&(nInDrawing<0||nInDrawing===DRAWING_ARRAY_TYPE_BEHIND&&true===bInText||nInDrawing>-1&&(docpostype_DrawingObjects===this.CurPos.Type||docpostype_HdrFtr===this.CurPos.Type&&this.HdrFtr.CurHdrFtr&&docpostype_DrawingObjects===this.HdrFtr.CurHdrFtr.Content.CurPos.Type)&&true===this.DrawingObjects.isSelectedText()&&null!==this.DrawingObjects.getMajorParaDrawing()&&this.DrawingObjects.getGraphicInfoUnderCursor(this.CurPage, X,Y).cursorType==="text")&&true===this.CheckPosInSelection(X,Y,this.CurPage,undefined)){this.Selection.DragDrop.Flag=1;this.Selection.DragDrop.Data={X:X,Y:Y,PageNum:this.CurPage};return}var bCheckHdrFtr=true;var bFootnotes=false;var bEndnotes=false;var nDocPosType=this.GetDocPosType();if(docpostype_HdrFtr===nDocPosType){bCheckHdrFtr=false;this.Selection.Start=true;this.Selection.Use=true;if(false!=this.HdrFtr.Selection_SetStart(X,Y,this.CurPage,MouseEvent,false))return;this.Selection.Start=false; this.Selection.Use=false;this.DrawingDocument.ClearCachePages();this.DrawingDocument.FirePaint();this.DrawingDocument.EndTrackTable(null,true)}else{bFootnotes=this.Footnotes.CheckHitInFootnote(X,Y,this.CurPage);bEndnotes=this.Endnotes.CheckHitInEndnote(X,Y,this.CurPage)}var PageMetrics=this.Get_PageContentStartPos(this.CurPage,this.Pages[this.CurPage].Pos);var oldDocPosType=this.GetDocPosType();if(true!=bFlowTable&&nInDrawing<0&&true===bCheckHdrFtr&&MouseEvent.ClickCount>=2&&(Y<=PageMetrics.Y||Y> PageMetrics.YLimit)){if(true===this.Selection.Use)this.RemoveSelection();this.SetDocPosType(docpostype_HdrFtr);MouseEvent.ClickCount=1;this.HdrFtr.Selection_SetStart(X,Y,this.CurPage,MouseEvent,true);this.Interface_Update_HdrFtrPr();this.DrawingDocument.ClearCachePages();this.DrawingDocument.FirePaint();this.DrawingDocument.EndTrackTable(null,true)}else if(true!==bFlowTable&&nInDrawing<0&&true===bFootnotes){this.RemoveSelection();this.Selection.Start=true;this.Selection.Use=true;this.SetDocPosType(docpostype_Footnotes); this.Footnotes.StartSelection(X,Y,this.CurPage,MouseEvent)}else if(true!==bFlowTable&&nInDrawing<0&&true===bEndnotes){this.RemoveSelection();this.Selection.Start=true;this.Selection.Use=true;this.SetDocPosType(docpostype_Endnotes);this.Endnotes.StartSelection(X,Y,this.CurPage,MouseEvent)}else if(nInDrawing===DRAWING_ARRAY_TYPE_BEFORE||nInDrawing===DRAWING_ARRAY_TYPE_INLINE||false===bTableBorder&&false===bInText&&nInDrawing>=0){if(docpostype_DrawingObjects!=this.CurPos.Type)this.RemoveSelection(); this.DrawingDocument.TargetEnd();this.DrawingDocument.SetCurrentPage(this.CurPage);this.Selection.Use=true;this.Selection.Start=true;this.Selection.Flag=selectionflag_Common;this.SetDocPosType(docpostype_DrawingObjects);this.DrawingObjects.OnMouseDown(MouseEvent,X,Y,this.CurPage)}else{var bOldSelectionIsCommon=true;if(docpostype_DrawingObjects===this.CurPos.Type&&(true!=this.IsInDrawing(X,Y,this.CurPage)||nInDrawing===DRAWING_ARRAY_TYPE_BEHIND&&true===bInText)){this.DrawingObjects.resetSelection(); bOldSelectionIsCommon=false}var ContentPos=this.Internal_GetContentPosByXY(X,Y);if(docpostype_Content!=this.CurPos.Type){this.SetDocPosType(docpostype_Content);this.CurPos.ContentPos=ContentPos;bOldSelectionIsCommon=false}var SelectionUse_old=this.Selection.Use;var Item=this.Content[ContentPos];var ElementPageIndex=this.private_GetElementPageIndexByXY(ContentPos,X,Y,this.CurPage);var bTableBorder=null===Item.IsTableBorder(X,Y,ElementPageIndex)?false:true;if(!(true===SelectionUse_old&&true===MouseEvent.ShiftKey&& true===bOldSelectionIsCommon))if(selectionflag_Common!=this.Selection.Flag||true===this.Selection.Use&&MouseEvent.ClickCount<=1&&true!=bTableBorder)this.RemoveSelection();this.Selection.Use=true;this.Selection.Start=true;this.Selection.Flag=selectionflag_Common;if(true===SelectionUse_old&&true===MouseEvent.ShiftKey&&true===bOldSelectionIsCommon){this.Selection_SetEnd(X,Y,{Type:AscCommon.g_mouse_event_type_up,ClickCount:1});this.Selection.Use=true;this.Selection.Start=true;this.Selection.EndPos=ContentPos; this.Selection.Data=null}else{var ElementPageIndex=this.private_GetElementPageIndexByXY(ContentPos,X,Y,this.CurPage);Item.Selection_SetStart(X,Y,ElementPageIndex,MouseEvent,bTableBorder);if(this.IsNumberingSelection())return;Item.Selection_SetEnd(X,Y,ElementPageIndex,{Type:AscCommon.g_mouse_event_type_move,ClickCount:1},bTableBorder);if(true!==bTableBorder){this.Selection.Use=true;this.Selection.StartPos=ContentPos;this.Selection.EndPos=ContentPos;this.Selection.Data=null;this.CurPos.ContentPos=ContentPos; if(type_Paragraph===Item.GetType()&&true===MouseEvent.CtrlKey){var oHyperlink=Item.CheckHyperlink(X,Y,ElementPageIndex);var oPageRefLink=Item.CheckPageRefLink(X,Y,ElementPageIndex);if(null!=oHyperlink)this.Selection.Data={Hyperlink:oHyperlink};else if(null!==oPageRefLink)this.Selection.Data={PageRef:oPageRefLink}}}else this.Selection.Data={TableBorder:true,Pos:ContentPos,Selection:SelectionUse_old}}}var newDocPosType=this.GetDocPosType();if(docpostype_HdrFtr===newDocPosType&&docpostype_Content=== oldDocPosType||docpostype_Content===newDocPosType&&docpostype_HdrFtr===oldDocPosType)window["AscCommon"].g_specialPasteHelper.SpecialPasteButton_Hide()};CDocument.prototype.Selection_SetEnd=function(X,Y,MouseEvent){this.ResetWordSelection();if(docpostype_HdrFtr===this.CurPos.Type){this.HdrFtr.Selection_SetEnd(X,Y,this.CurPage,MouseEvent);if(AscCommon.g_mouse_event_type_up==MouseEvent.Type)if(true!=this.DrawingObjects.isPolylineAddition())this.Selection.Start=false;else this.Selection.Start=true;return}else if(docpostype_DrawingObjects=== this.CurPos.Type){if(AscCommon.g_mouse_event_type_up==MouseEvent.Type){this.DrawingObjects.OnMouseUp(MouseEvent,X,Y,this.CurPage);if(true!=this.DrawingObjects.isPolylineAddition()){this.Selection.Start=false;this.Selection.Use=true}else{this.Selection.Start=true;this.Selection.Use=true}}else this.DrawingObjects.OnMouseMove(MouseEvent,X,Y,this.CurPage);return}else if(docpostype_Footnotes===this.CurPos.Type){this.Footnotes.EndSelection(X,Y,this.CurPage,MouseEvent);if(AscCommon.g_mouse_event_type_up== MouseEvent.Type)this.Selection.Start=false;return}else if(docpostype_Endnotes===this.CurPos.Type){this.Endnotes.EndSelection(X,Y,this.CurPage,MouseEvent);if(AscCommon.g_mouse_event_type_up==MouseEvent.Type)this.Selection.Start=false;return}if(true===this.IsMovingTableBorder()){var nPos=this.Selection.Data.Pos;if(AscCommon.g_mouse_event_type_up==MouseEvent.Type){this.Selection.Start=false;this.Selection.Use=this.Selection.Data.Selection;this.Selection.Data=null}var Item=this.Content[nPos];var ElementPageIndex= this.private_GetElementPageIndexByXY(nPos,X,Y,this.CurPage);Item.Selection_SetEnd(X,Y,ElementPageIndex,MouseEvent,true);return}if(false===this.Selection.Use)return;var ContentPos=this.Internal_GetContentPosByXY(X,Y);this.CurPos.ContentPos=ContentPos;var OldEndPos=this.Selection.EndPos;this.Selection.EndPos=ContentPos;if(OldEndPos this.Selection.StartPos&&OldEndPos>this.Selection.EndPos){var TempLimit=Math.max(this.Selection.StartPos,this.Selection.EndPos);for(var Index=TempLimit+1;Index<=OldEndPos;Index++)this.Content[Index].RemoveSelection()}var Direction=ContentPos>this.Selection.StartPos?1:ContentPos0){Start=this.Selection.StartPos;End=this.Selection.EndPos}else{End=this.Selection.StartPos;Start=this.Selection.EndPos}for(var Index=Start;Index<=End;Index++){var Item=this.Content[Index];Item.SetSelectionUse(true); switch(Index){case Start:Item.SetSelectionToBeginEnd(Direction>0?false:true,false);break;case End:Item.SetSelectionToBeginEnd(Direction>0?true:false,true);break;default:Item.SelectAll(Direction);break}}var ElementPageIndex=this.private_GetElementPageIndexByXY(ContentPos,X,Y,this.CurPage);this.Content[ContentPos].Selection_SetEnd(X,Y,ElementPageIndex,MouseEvent);if(true===this.Content[End].IsSelectionEmpty()&&true===this.CheckEmptyElementsOnSelection){this.Content[End].RemoveSelection();End--}if(Start!= End&&true===this.Content[Start].IsSelectionEmpty()&&true===this.CheckEmptyElementsOnSelection){this.Content[Start].RemoveSelection();Start++}if(Direction>0){this.Selection.StartPos=Start;this.Selection.EndPos=End}else{this.Selection.StartPos=End;this.Selection.EndPos=Start}};CDocument.prototype.GetSelectDirection=function(){var oStartPos=this.GetContentPosition(true,true);var oEndPos=this.GetContentPosition(true,false);for(var nPos=0,nLen=Math.min(oStartPos.length,oEndPos.length);nPosoEndPos[nPos].Position)return-1}return 1};CDocument.prototype.IsMovingTableBorder=function(){return this.Controller.IsMovingTableBorder()};CDocument.prototype.CheckPosInSelection=function(X,Y,PageAbs,NearPos){return this.Controller.CheckPosInSelection(X,Y,PageAbs,NearPos)};CDocument.prototype.SelectAll=function(){this.private_UpdateTargetForCollaboration(); this.ResetWordSelection();this.Controller.SelectAll();this.Selection.Start=true;this.Document_UpdateSelectionState();this.Document_UpdateInterfaceState();this.Document_UpdateRulersState();this.Selection.Start=false;this.Document_UpdateCopyCutState();this.private_UpdateCursorXY(true,true)};CDocument.prototype.SelectCurrentWord=function(){if(this.IsSelectionUse()&&!this.IsTextSelectionUse())return false;if(this.IsSelectionUse())this.RemoveSelection();var oParagraph=this.GetCurrentParagraph();if(!oParagraph)return false; oParagraph.SelectCurrentWord();if(this.IsSelectionEmpty()){this.RemoveSelection();return false}return true};CDocument.prototype.SelectRange=function(nStartPos,nEndPos){this.RemoveSelection();this.DrawingDocument.SelectEnabled(true);this.DrawingDocument.TargetEnd();this.SetDocPosType(docpostype_Content);this.Selection.Use=true;this.Selection.Start=false;this.Selection.Flag=selectionflag_Common;this.Selection.StartPos=Math.max(0,Math.min(nStartPos,this.Content.length-1));this.Selection.EndPos=Math.max(this.Selection.StartPos, Math.min(nEndPos,this.Content.length-1));for(var nIndex=0,nCount=this.Content.length;nIndex0&&!bCopy)for(var nIndex=0,nCount=arrSdts.length;nIndex0&&!arrSdts[arrSdts.length-1].CanBeEdited())isLocked=true}var CheckChangesType=true!==bCopy?AscCommon.changestype_Document_Content:changestype_None;if(!isLocked&&!this.IsSelectionLocked(CheckChangesType,{Type:changestype_2_ElementsArray_and_Type,Elements:[Para],CheckType:changestype_Paragraph_Content},true)){if(this.TrackMoveId&&!this.TrackMoveRelocation){var arrParagraphs= this.GetSelectedParagraphs();if(arrParagraphs.length>0){arrParagraphs[arrParagraphs.length-1].AddTrackMoveMark(true,false,this.TrackMoveId);arrParagraphs[0].AddTrackMoveMark(true,true,this.TrackMoveId)}}if(true!==bCopy){this.TurnOff_Recalculate();this.TurnOff_InterfaceEvents();this.Remove(1,false,false,true);this.TurnOn_Recalculate(false);this.TurnOn_InterfaceEvents(false);if(false===Para.Is_UseInDocument()){this.DragAndDropAction=false;this.TrackMoveId=null;this.TrackMoveRelocation=false;this.Document_Undo(); this.History.Clear_Redo();this.SetCheckContentControlsLock(true);this.FinalizeAction(false);return}}this.RemoveSelection(true);this.RefreshDocumentPositions([oDocPos]);var oTempNearPos=this.DocumentPositionToAnchorPosition(oDocPos);if(oTempNearPos){NearPos=oTempNearPos;Para=NearPos.Paragraph}if(bCopy)DocContent.CreateNewCommentsGuid(this.Comments);this.CheckFormPlaceHolder=false;Para.Parent.InsertContent(DocContent,NearPos);this.Recalculate();this.UpdateSelection();this.UpdateInterface();this.UpdateRulers(); this.FinalizeAction();this.CheckFormPlaceHolder=true}else{this.History.Remove_LastPoint();NearPos.Paragraph.Clear_NearestPosArray();this.FinalizeAction(false)}this.SetCheckContentControlsLock(true);this.DragAndDropAction=false;this.TrackMoveId=null;this.TrackMoveRelocation=false}};CDocument.prototype.GetSelectedContent=function(bUseHistory,oPr){var isTrack=this.IsTrackRevisions();var isLocalTrack=false;if(isTrack&&!bUseHistory){isLocalTrack=this.GetLocalTrackRevisions();this.SetLocalTrackRevisions(false)}var bNeedTurnOffTableId= g_oTableId.m_bTurnOff===false&&true!==bUseHistory;if(!bUseHistory)History.TurnOff();if(bNeedTurnOffTableId)g_oTableId.m_bTurnOff=true;var oSelectedContent=new CSelectedContent;if(oPr)if(undefined!==oPr.SaveNumberingValues)oSelectedContent.SetSaveNumberingValues(oPr.SaveNumberingValues);oSelectedContent.SetMoveTrack(isTrack,this.TrackMoveId);this.Controller.GetSelectedContent(oSelectedContent);oSelectedContent.On_EndCollectElements(this,false);if(!bUseHistory)History.TurnOn();if(bNeedTurnOffTableId)g_oTableId.m_bTurnOff= false;if(false!==isLocalTrack)this.SetLocalTrackRevisions(isLocalTrack);return oSelectedContent};CDocument.prototype.Can_InsertContent=function(SelectedContent,NearPos){if(SelectedContent.Elements.length<=0)return false;var Para=NearPos.Paragraph;if((true===Para.Parent.Is_DrawingShape()||true===Para.Parent.IsFootnote())&&true===SelectedContent.HaveShape)return false;if(Para.bFromDocument===false&&(SelectedContent.DrawingObjects.length>0||SelectedContent.HaveMath||SelectedContent.HaveTable))return false; var ParaNearPos=NearPos.Paragraph.Get_ParaNearestPos(NearPos);if(null===ParaNearPos||ParaNearPos.Classes.length<2)return false;var LastClass=ParaNearPos.Classes[ParaNearPos.Classes.length-1];if(para_Math_Run===LastClass.Type){if(!SelectedContent.CanConvertToMath){var Element=SelectedContent.Elements[0].Element;if(1!==SelectedContent.Elements.length||type_Paragraph!==Element.GetType()||null===LastClass.Parent)return false;var Math=null;var Count=Element.Content.length;for(var Index=0;Index0&&oSrcPicture){oDstPictureCC.SetShowingPlcHdr(false);oSrcPicture.setParent(arrParaDrawings[0]);arrParaDrawings[0].Set_GraphicObject(oSrcPicture);if(oDstPictureCC.IsPictureForm())oDstPictureCC.UpdatePictureFormLayout(); this.DrawingObjects.resetSelection();this.RemoveSelection();oDstPictureCC.SelectContentControl();var sKey=oDstPictureCC.GetFormKey();if(arrParaDrawings[0].IsPicture()&&sKey)this.OnChangeForm(sKey,oDstPictureCC,arrParaDrawings[0].GraphicObj.getImageUrl())}return}else if(LastClass.GetParentForm()){var nInLastClassPos=ParaNearPos.NearPos.ContentPos.Data[ParaNearPos.Classes.length-1];var isPlaceHolder=LastClass.GetParentForm().IsPlaceHolder();if(isPlaceHolder&&LastClass.GetParent()instanceof CInlineLevelSdt){var oInlineLeveLSdt= LastClass.GetParent();oInlineLeveLSdt.ReplacePlaceHolderWithContent();LastClass=oInlineLeveLSdt.GetElement(0);nInLastClassPos=0}LastClass.State.ContentPos=nInLastClassPos;var nInRunStartPos=LastClass.State.ContentPos;LastClass.AddText(SelectedContent.GetText({ParaEndToSpace:false}),nInLastClassPos);var nInRunEndPos=LastClass.State.ContentPos;LastClass.SelectThisElement();LastClass.Selection.Use=true;LastClass.Selection.StartPos=nInRunStartPos;LastClass.Selection.EndPos=nInRunEndPos;return}var NearContentPos= NearPos.ContentPos;var DstIndex=-1;var Count=this.Content.length;for(var Index=0;Index1){var _ParaE=Elements[ElementsCount-1].Element;var TempCount=_ParaE.Content.length-1;_ParaE.SelectAll();_ParaE.Concat(ParaE);_ParaE.Set_Pr(ParaE.Pr);this.Internal_Content_Add(ParaEIndex,_ParaE);this.Internal_Content_Remove(ParaEIndex+1,1);_ParaE.Selection.Use=true;_ParaE.Selection.StartPos=0;_ParaE.Selection.EndPos=TempCount;EndIndex--}for(var Index=StartIndex;Index<=EndIndex;Index++){this.Internal_Content_Add(DstIndex+Index,Elements[Index].Element);this.Content[DstIndex+ Index].SelectAll()}var LastPos=DstIndex+ElementsCount-1;if(NewEmptyPara&&NewEmptyPara===this.Content[LastPos+1]){LastPos++;this.Content[LastPos].SelectAll()}this.Selection.Use=true;this.Selection.StartPos=DstIndex;this.Selection.EndPos=LastPos;this.CurPos.ContentPos=LastPos}SelectedContent.CheckSignatures();if(docpostype_DrawingObjects!==this.CurPos.Type)this.SetDocPosType(docpostype_Content)}};CDocument.prototype.UpdateCursorType=function(X,Y,PageAbs,MouseEvent){if(null!==this.FullRecalc.Id&&this.FullRecalc.PageIndex<= PageAbs)return;this.Api.sync_MouseMoveStartCallback();this.DrawingDocument.OnDrawContentControl(null,AscCommon.ContentControlTrack.Hover);var nDocPosType=this.GetDocPosType();if(docpostype_HdrFtr===nDocPosType)this.HeaderFooterController.UpdateCursorType(X,Y,PageAbs,MouseEvent);else if(docpostype_DrawingObjects===nDocPosType)this.DrawingsController.UpdateCursorType(X,Y,PageAbs,MouseEvent);else if(true===this.Footnotes.CheckHitInFootnote(X,Y,PageAbs))this.Footnotes.UpdateCursorType(X,Y,PageAbs,MouseEvent); else if(this.Endnotes.CheckHitInEndnote(X,Y,PageAbs))this.Endnotes.UpdateCursorType(X,Y,PageAbs,MouseEvent);else this.LogicDocumentController.UpdateCursorType(X,Y,PageAbs,MouseEvent);this.Api.sync_MouseMoveEndCallback()};CDocument.prototype.CloseAllWindowsPopups=function(){this.Api.sync_MouseMoveStartCallback();this.Api.sync_MouseMoveCallback(new AscCommon.CMouseMoveData);this.Api.sync_MouseMoveEndCallback();this.TrackRevisionsManager.BeginCollectChanges(false);this.TrackRevisionsManager.EndCollectChanges(this); this.SelectComment(null,false);this.Api.sync_HideComment()};CDocument.prototype.IsTableBorder=function(X,Y,PageIndex){if(PageIndex>=this.Pages.length||PageIndex<0)return null;if(docpostype_HdrFtr===this.GetDocPosType())return this.HdrFtr.IsTableBorder(X,Y,PageIndex);else if(-1!=this.DrawingObjects.IsInDrawingObject(X,Y,PageIndex,this))return null;else if(true===this.Footnotes.CheckHitInFootnote(X,Y,PageIndex))return this.Footnotes.IsTableBorder(X,Y,PageIndex);else if(this.Endnotes.CheckHitInEndnote(X, Y,PageIndex))return this.Endnotes.IsTableBorder(X,Y,PageIndex);else{var ColumnsInfo={};var ElementPos=this.Internal_GetContentPosByXY(X,Y,PageIndex,ColumnsInfo);var Element=this.Content[ElementPos];var ElementPageIndex=this.private_GetElementPageIndex(ElementPos,PageIndex,ColumnsInfo.Column,ColumnsInfo.Column,ColumnsInfo.ColumnsCount);return Element.IsTableBorder(X,Y,ElementPageIndex)}};CDocument.prototype.IsTableCellSelection=function(){return this.Controller.IsTableCellSelection()};CDocument.prototype.IsInText= function(X,Y,PageIndex){if(PageIndex>=this.Pages.length||PageIndex<0)return null;if(docpostype_HdrFtr===this.GetDocPosType())return this.HdrFtr.IsInText(X,Y,PageIndex);else if(true===this.Footnotes.CheckHitInFootnote(X,Y,PageIndex))return this.Footnotes.IsInText(X,Y,PageIndex);else if(this.Endnotes.CheckHitInEndnote(X,Y,PageIndex))return this.Endnotes.IsInText(X,Y,PageIndex);else{var ContentPos=this.Internal_GetContentPosByXY(X,Y,PageIndex);var ElementPageIndex=this.private_GetElementPageIndexByXY(ContentPos, X,Y,PageIndex);var Item=this.Content[ContentPos];return Item.IsInText(X,Y,ElementPageIndex)}};CDocument.prototype.Get_ParentTextTransform=function(){return null};CDocument.prototype.IsInDrawing=function(X,Y,PageIndex){if(docpostype_HdrFtr===this.GetDocPosType())return this.HdrFtr.IsInDrawing(X,Y,PageIndex);else if(-1!=this.DrawingObjects.IsInDrawingObject(X,Y,this.CurPage,this))return true;else if(true===this.Footnotes.CheckHitInFootnote(X,Y,PageIndex))return this.Footnotes.IsInDrawing(X,Y,PageIndex); else if(this.Endnotes.CheckHitInEndnote(X,Y,PageIndex))return this.Endnotes.IsInDrawing(X,Y,PageIndex);else{var ContentPos=this.Internal_GetContentPosByXY(X,Y,PageIndex);var Item=this.Content[ContentPos];var ElementPageIndex=this.private_GetElementPageIndexByXY(ContentPos,X,Y,PageIndex);return Item.IsInDrawing(X,Y,ElementPageIndex)}};CDocument.prototype.IsInForm=function(X,Y,nPageAbs){var oAnchor=this.Get_NearestPos(nPageAbs,X,Y);if(!oAnchor||!oAnchor.Paragraph)return false;var oClass=oAnchor.Paragraph.GetClassByPos(oAnchor.ContentPos); if(!oClass||!(oClass instanceof ParaRun))return false;var oForm=oClass.GetParentForm();if(!oForm)return false;return oForm.CheckHitInContentControlByXY(X,Y,nPageAbs)};CDocument.prototype.IsInContentControl=function(X,Y,nPageAbs){var oAnchor=this.Get_NearestPos(nPageAbs,X,Y);if(!oAnchor||!oAnchor.Paragraph)return false;var oClass=oAnchor.Paragraph.GetClassByPos(oAnchor.ContentPos);if(!oClass||!(oClass instanceof ParaRun))return false;var arrContentControls=oClass.GetParentContentControls();for(var nIndex= 0,nCount=arrContentControls.length;nIndex 0)this.SearchEngine.Reset_Current();var bUpdateSelection=true;var bRetValue=keydownresult_PreventNothing;var nShortcutAction=this.Api.getShortcut(e);switch(nShortcutAction){case c_oAscDocumentShortcutType.InsertPageBreak:{if(!this.IsSelectionLocked(AscCommon.changestype_Paragraph_Content,null,false,false)){this.StartAction(AscDFH.historydescription_Document_EnterButton);this.AddToParagraph(new ParaNewLine(break_Page));this.FinalizeAction()}break}case c_oAscDocumentShortcutType.InsertLineBreak:{if(!this.IsSelectionLocked(AscCommon.changestype_Paragraph_Content, null,false,this.IsFormFieldEditing())){this.StartAction(AscDFH.historydescription_Document_EnterButton);this.AddToParagraph(new ParaNewLine(break_Line));this.FinalizeAction()}break}case c_oAscDocumentShortcutType.InsertColumnBreak:{if(!this.IsSelectionLocked(AscCommon.changestype_Paragraph_Content,null,false,false)){this.StartAction(AscDFH.historydescription_Document_EnterButton);this.AddToParagraph(new ParaNewLine(break_Column));this.FinalizeAction()}break}case c_oAscDocumentShortcutType.ResetChar:{if(!this.IsSelectionLocked(AscCommon.changestype_Paragraph_Content, null,true,false)){this.StartAction(AscDFH.historydescription_Document_Shortcut_ClearFormatting);this.ClearParagraphFormatting(false,true);this.FinalizeAction()}bRetValue=keydownresult_PreventNothing;break}case c_oAscDocumentShortcutType.NonBreakingSpace:{if(!this.IsSelectionLocked(AscCommon.changestype_Paragraph_Content,null,true,this.IsFormFieldEditing())){this.StartAction(AscDFH.historydescription_Document_Shortcut_AddNonBreakingSpace);this.DrawingDocument.TargetStart();this.DrawingDocument.TargetShow(); this.AddToParagraph(new ParaText(160));this.FinalizeAction()}bRetValue=keydownresult_PreventNothing;break}case c_oAscDocumentShortcutType.ApplyHeading1:{if(!this.IsSelectionLocked(AscCommon.changestype_Paragraph_Properties)){this.StartAction(AscDFH.historydescription_Document_Shortcut_SetStyleHeading1);this.SetParagraphStyle("Heading 1");this.UpdateInterface();this.FinalizeAction()}bRetValue=keydownresult_PreventAll;break}case c_oAscDocumentShortcutType.ApplyHeading2:{if(!this.IsSelectionLocked(AscCommon.changestype_Paragraph_Properties)){this.StartAction(AscDFH.historydescription_Document_Shortcut_SetStyleHeading2); this.SetParagraphStyle("Heading 2");this.UpdateInterface();this.FinalizeAction()}bRetValue=keydownresult_PreventAll;break}case c_oAscDocumentShortcutType.ApplyHeading3:{if(!this.IsSelectionLocked(AscCommon.changestype_Paragraph_Properties)){this.StartAction(AscDFH.historydescription_Document_Shortcut_SetStyleHeading3);this.SetParagraphStyle("Heading 3");this.UpdateInterface();this.FinalizeAction()}bRetValue=keydownresult_PreventAll;break}case c_oAscDocumentShortcutType.Strikeout:{var oTextPr=this.GetCalculatedTextPr(); if(oTextPr){if(!this.IsSelectionLocked(AscCommon.changestype_Paragraph_TextProperties)){this.StartAction(AscDFH.historydescription_Document_SetTextStrikeoutHotKey);this.AddToParagraph(new ParaTextPr({Strikeout:oTextPr.Strikeout!==true}));this.UpdateInterface();this.FinalizeAction()}bRetValue=keydownresult_PreventAll}break}case c_oAscDocumentShortcutType.ShowAll:{var isShow=this.Api.get_ShowParaMarks();this.Api.put_ShowParaMarks(!isShow);this.Api.sync_ShowParaMarks();bRetValue=keydownresult_PreventAll; break}case c_oAscDocumentShortcutType.EditSelectAll:{this.SelectAll();bUpdateSelection=false;bRetValue=keydownresult_PreventAll;break}case c_oAscDocumentShortcutType.Bold:{var oTextPr=this.GetCalculatedTextPr();if(oTextPr){if(!this.IsSelectionLocked(AscCommon.changestype_Paragraph_TextProperties)){this.StartAction(AscDFH.historydescription_Document_SetTextBoldHotKey);this.AddToParagraph(new ParaTextPr({Bold:oTextPr.Bold!==true}));this.UpdateInterface();this.FinalizeAction()}bRetValue=keydownresult_PreventAll}break}case c_oAscDocumentShortcutType.CopyFormat:{this.Document_Format_Copy(); bRetValue=keydownresult_PreventAll;break}case c_oAscDocumentShortcutType.CopyrightSign:{this.private_AddSymbolByShortcut(169);bRetValue=keydownresult_PreventAll;break}case c_oAscDocumentShortcutType.InsertEndnoteNow:{this.AddEndnote();bRetValue=keydownresult_PreventAll;break}case c_oAscDocumentShortcutType.CenterPara:{this.private_ToggleParagraphAlignByHotkey(AscCommon.align_Center);bRetValue=keydownresult_PreventAll;break}case c_oAscDocumentShortcutType.EuroSign:{this.private_AddSymbolByShortcut(8364); bRetValue=keydownresult_PreventAll;break}case c_oAscDocumentShortcutType.InsertFootnoteNow:{this.AddFootnote();bRetValue=keydownresult_PreventAll;break}case c_oAscDocumentShortcutType.Italic:{var oTextPr=this.GetCalculatedTextPr();if(oTextPr){if(!this.IsSelectionLocked(AscCommon.changestype_Paragraph_TextProperties)){this.StartAction(AscDFH.historydescription_Document_SetTextItalicHotKey);this.AddToParagraph(new ParaTextPr({Italic:oTextPr.Italic!==true}));this.UpdateInterface();this.FinalizeAction()}bRetValue= keydownresult_PreventAll}break}case c_oAscDocumentShortcutType.JustifyPara:{this.private_ToggleParagraphAlignByHotkey(AscCommon.align_Justify);bRetValue=keydownresult_PreventAll;break}case c_oAscDocumentShortcutType.InsertHyperlink:{if(true===this.CanAddHyperlink(false)&&this.CanEdit())this.Api.sync_DialogAddHyperlink();bRetValue=keydownresult_PreventAll;break}case c_oAscDocumentShortcutType.ApplyListBullet:{if(!this.IsSelectionLocked(AscCommon.changestype_Paragraph_Content)){this.StartAction(AscDFH.historydescription_Document_SetParagraphNumberingHotKey); this.SetParagraphNumbering({Type:0,SubType:1});this.UpdateInterface();this.FinalizeAction()}bRetValue=keydownresult_PreventAll;break}case c_oAscDocumentShortcutType.LeftPara:{this.private_ToggleParagraphAlignByHotkey(align_Left);bRetValue=keydownresult_PreventAll;break}case c_oAscDocumentShortcutType.Indent:{this.IncreaseIndent();bRetValue=keydownresult_PreventAll;break}case c_oAscDocumentShortcutType.UnIndent:{this.DecreaseIndent();bRetValue=keydownresult_PreventAll;break}case c_oAscDocumentShortcutType.PrintPreviewAndPrint:{this.DrawingDocument.m_oWordControl.m_oApi.onPrint(); bRetValue=keydownresult_PreventAll;break}case c_oAscDocumentShortcutType.InsertPageNumber:{if(!this.IsSelectionLocked(AscCommon.changestype_Paragraph_Content)){this.StartAction(AscDFH.historydescription_Document_AddPageNumHotKey);this.AddToParagraph(new ParaPageNum);this.FinalizeAction()}bRetValue=keydownresult_PreventAll;break}case c_oAscDocumentShortcutType.RightPara:{this.private_ToggleParagraphAlignByHotkey(AscCommon.align_Right);bRetValue=keydownresult_PreventAll;break}case c_oAscDocumentShortcutType.RegisteredSign:{this.private_AddSymbolByShortcut(174); bRetValue=keydownresult_PreventAll;break}case c_oAscDocumentShortcutType.Save:{if(!this.IsViewMode())this.Api.asc_Save(false);bRetValue=keydownresult_PreventAll;break}case c_oAscDocumentShortcutType.TrademarkSign:{this.private_AddSymbolByShortcut(8482);bRetValue=keydownresult_PreventAll;break}case c_oAscDocumentShortcutType.Underline:{var oTextPr=this.GetCalculatedTextPr();if(oTextPr){if(!this.IsSelectionLocked(AscCommon.changestype_Paragraph_TextProperties)){this.StartAction(AscDFH.historydescription_Document_SetTextUnderlineHotKey); this.AddToParagraph(new ParaTextPr({Underline:oTextPr.Underline!==true}));this.UpdateInterface();this.FinalizeAction()}bRetValue=keydownresult_PreventAll}break}case c_oAscDocumentShortcutType.PasteFormat:{if(!this.IsSelectionLocked(AscCommon.changestype_Paragraph_Content)){this.StartAction(AscDFH.historydescription_Document_FormatPasteHotKey);this.Document_Format_Paste();this.FinalizeAction()}bRetValue=keydownresult_PreventAll;break}case c_oAscDocumentShortcutType.EditRedo:{if(this.CanEdit()||this.IsEditCommentsMode()|| this.IsFillingFormMode())this.Document_Redo();bRetValue=keydownresult_PreventAll;break}case c_oAscDocumentShortcutType.EditUndo:{if((this.CanEdit()||this.IsEditCommentsMode()||this.IsFillingFormMode())&&!this.IsViewModeInReview())this.Document_Undo();bRetValue=keydownresult_PreventAll;break}case c_oAscDocumentShortcutType.EmDash:{this.private_AddSymbolByShortcut(8212);bRetValue=keydownresult_PreventAll;break}case c_oAscDocumentShortcutType.EnDash:{this.private_AddSymbolByShortcut(8211);bRetValue= keydownresult_PreventAll;break}case c_oAscDocumentShortcutType.UpdateFields:{this.UpdateFields(true);bUpdateSelection=false;bRetValue=keydownresult_PreventAll;break}case c_oAscDocumentShortcutType.InsertEquation:{var oSelectedInfo=this.GetSelectedElementsInfo();var oMath=oSelectedInfo.GetMath();if(null===oMath)this.Api.asc_AddMath();bRetValue=keydownresult_PreventAll;break}case c_oAscDocumentShortcutType.Superscript:{var oTextPr=this.GetCalculatedTextPr();if(oTextPr){if(!this.IsSelectionLocked(AscCommon.changestype_Paragraph_TextProperties)){this.StartAction(AscDFH.historydescription_Document_SetTextVertAlignHotKey2); this.AddToParagraph(new ParaTextPr({VertAlign:oTextPr.VertAlign===AscCommon.vertalign_SuperScript?AscCommon.vertalign_Baseline:AscCommon.vertalign_SuperScript}));this.UpdateInterface();this.FinalizeAction()}bRetValue=keydownresult_PreventAll}break}case c_oAscDocumentShortcutType.NonBreakingHyphen:{if(!this.IsSelectionLocked(AscCommon.changestype_Paragraph_Content,null,true)){this.StartAction(AscDFH.historydescription_Document_MinusButton);this.DrawingDocument.TargetStart();this.DrawingDocument.TargetShow(); var oItem=new ParaText(45);oItem.Set_SpaceAfter(false);this.AddToParagraph(oItem);this.FinalizeAction()}bRetValue=keydownresult_PreventAll;break}case c_oAscDocumentShortcutType.SoftHyphen:{bRetValue=keydownresult_PreventAll;break}case c_oAscDocumentShortcutType.HorizontalEllipsis:{this.private_AddSymbolByShortcut(8230);bRetValue=keydownresult_PreventAll;break}case c_oAscDocumentShortcutType.Subscript:{var oTextPr=this.GetCalculatedTextPr();if(oTextPr){if(!this.IsSelectionLocked(AscCommon.changestype_Paragraph_TextProperties)){this.StartAction(AscDFH.historydescription_Document_SetTextVertAlignHotKey3); this.AddToParagraph(new ParaTextPr({VertAlign:oTextPr.VertAlign===AscCommon.vertalign_SubScript?AscCommon.vertalign_Baseline:AscCommon.vertalign_SubScript}));this.UpdateInterface();this.FinalizeAction()}bRetValue=keydownresult_PreventAll}break}case c_oAscDocumentShortcutType.IncreaseFontSize:{this.Api.FontSizeOut();bRetValue=keydownresult_PreventAll;break}case c_oAscDocumentShortcutType.DecreaseFontSize:{this.Api.FontSizeIn();bRetValue=keydownresult_PreventAll;break}default:{var oCustom=this.Api.getCustomShortcutAction(nShortcutAction); if(oCustom)if(AscCommon.c_oAscCustomShortcutType.Symbol===oCustom.Type)this.Api["asc_insertSymbol"](oCustom.Font,oCustom.CharCode);break}}if(!nShortcutAction)if(e.KeyCode===8){if(false===this.Document_Is_SelectionLocked(AscCommon.changestype_Remove,null,true,this.IsFormFieldEditing())){this.StartAction(AscDFH.historydescription_Document_BackSpaceButton);var oSelectInfo=this.GetSelectedElementsInfo();if(oSelectInfo.GetInlineLevelSdt())this.CheckInlineSdtOnDelete=oSelectInfo.GetInlineLevelSdt();this.Remove(-1, true,false,false,e.CtrlKey);this.CheckInlineSdtOnDelete=null;this.FinalizeAction()}bRetValue=keydownresult_PreventAll}else if(e.KeyCode===9){if(this.IsFillingFormMode()){this.DrawingDocument.UpdateTargetFromPaint=true;this.ResetWordSelection();this.private_UpdateTargetForCollaboration();this.MoveToFillingForm(true!==e.ShiftKey);this.private_CheckCursorPosInFillingFormMode();this.CheckComplexFieldsInSelection()}else{var SelectedInfo=this.GetSelectedElementsInfo();if(null!==SelectedInfo.GetMath()){var ParaMath= SelectedInfo.GetMath();var Paragraph=ParaMath.GetParagraph();if(Paragraph&&false===this.Document_Is_SelectionLocked(changestype_None,{Type:changestype_2_Element_and_Type,Element:Paragraph,CheckType:changestype_Paragraph_Content})){this.StartAction(AscDFH.historydescription_Document_AddTabToMath);ParaMath.HandleTab(!e.ShiftKey);this.Recalculate();this.FinalizeAction()}}else if(true===SelectedInfo.IsInTable()&&true!=e.CtrlKey)this.MoveCursorToCell(true===e.ShiftKey?false:true);else if(true===SelectedInfo.IsDrawingObjSelected()&& true!=e.CtrlKey)this.DrawingObjects.selectNextObject(e.ShiftKey===true?-1:1);else if(true===SelectedInfo.IsMixedSelection())if(true===e.ShiftKey)this.DecreaseIndent();else this.IncreaseIndent();else{var Paragraph=SelectedInfo.GetParagraph();var ParaPr=Paragraph?Paragraph.Get_CompiledPr2(false).ParaPr:null;if(null!=Paragraph&&(true===Paragraph.IsCursorAtBegin()||true===Paragraph.IsSelectionFromStart())&&(undefined!=Paragraph.GetNumPr()||true!=Paragraph.IsEmpty()&&ParaPr.Tabs.Tabs.length<=0)){if(false=== this.Document_Is_SelectionLocked(changestype_None,{Type:changestype_2_Element_and_Type,Element:Paragraph,CheckType:AscCommon.changestype_Paragraph_Properties})){this.StartAction(AscDFH.historydescription_Document_MoveParagraphByTab);Paragraph.Add_Tab(e.ShiftKey);this.Recalculate();this.UpdateInterface();this.UpdateSelection();this.FinalizeAction()}}else if(false===this.Document_Is_SelectionLocked(changestype_Paragraph_Content)){this.StartAction(AscDFH.historydescription_Document_AddTab);this.AddToParagraph(new ParaTab); this.FinalizeAction()}}}bRetValue=keydownresult_PreventAll}else if(e.KeyCode===13){var Hyperlink=this.IsCursorInHyperlink(false);if(Hyperlink){var sBookmarkName=Hyperlink.GetAnchor();var sValue=Hyperlink.GetValue();if(Hyperlink.IsTopOfDocument())this.MoveCursorToStartOfDocument();else if(sValue){this.Api.sync_HyperlinkClickCallback(sBookmarkName?sValue+"#"+sBookmarkName:sValue);Hyperlink.SetVisited(true);this.DrawingDocument.ClearCachePages();this.DrawingDocument.FirePaint()}else if(sBookmarkName){var oBookmark= this.BookmarksManager.GetBookmarkByName(sBookmarkName);if(oBookmark)oBookmark[0].GoToBookmark()}}else{var oSelectedInfo=this.GetSelectedElementsInfo();var CheckType=AscCommon.changestype_Document_Content_Add;var bCanPerform=true;if(oSelectedInfo.GetInlineLevelSdt()&&!oSelectedInfo.IsSdtOverDrawing()&&(!e.ShiftKey||e.CtrlKey)||oSelectedInfo.GetField()&&oSelectedInfo.GetField().IsFillingForm())bCanPerform=false;if(bCanPerform&&(docpostype_DrawingObjects===this.CurPos.Type||docpostype_HdrFtr===this.CurPos.Type&& null!=this.HdrFtr.CurHdrFtr&&docpostype_DrawingObjects===this.HdrFtr.CurHdrFtr.Content.CurPos.Type)){var oTargetDocContent=this.DrawingObjects.getTargetDocContent();if(!oTargetDocContent){var nRet=this.DrawingObjects.handleEnter();bCanPerform=nRet===0}if(this.DrawingObjects.selection&&null!==this.DrawingObjects.selection.cropSelection)CheckType=AscCommon.changestype_Drawing_Props}if(bCanPerform&&false===this.Document_Is_SelectionLocked(CheckType,null,false,this.IsFormFieldEditing())){this.StartAction(AscDFH.historydescription_Document_EnterButton); var oMath=oSelectedInfo.GetMath();if(null!==oMath&&oMath.Is_InInnerContent()){if(oMath.Handle_AddNewLine())this.Recalculate()}else this.AddNewParagraph();this.FinalizeAction()}}bRetValue=keydownresult_PreventAll}else if(e.KeyCode===27){this.CloseAllWindowsPopups();if(editor.isDrawTablePen||editor.isDrawTableErase){editor.isDrawTablePen&&editor.sync_TableDrawModeCallback(false);editor.isDrawTableErase&&editor.sync_TableEraseModeCallback(false);this.UpdateCursorType(this.CurPos.RealX,this.CurPos.RealY, this.CurPage,new AscCommon.CMouseEventHandler)}else if(true===this.DrawingDocument.IsTrackText()){this.Selection.DragDrop.Flag=0;this.Selection.DragDrop.Data=null;this.DrawingDocument.CancelTrackText()}else if(true===editor.isMarkerFormat){editor.sync_MarkerFormatCallback(false);this.UpdateCursorType(this.CurPos.RealX,this.CurPos.RealY,this.CurPage,new AscCommon.CMouseEventHandler)}else if(c_oAscFormatPainterState.kOff!==editor.isPaintFormat){editor.sync_PaintFormatCallback(c_oAscFormatPainterState.kOff); this.UpdateCursorType(this.CurPos.RealX,this.CurPos.RealY,this.CurPage,new AscCommon.CMouseEventHandler)}else if(editor.isStartAddShape){editor.sync_StartAddShapeCallback(false);editor.sync_EndAddShape();this.DrawingObjects.endTrackNewShape();this.UpdateCursorType(this.CurPos.RealX,this.CurPos.RealY,this.CurPage,new AscCommon.CMouseEventHandler)}else if(docpostype_DrawingObjects===this.CurPos.Type||docpostype_HdrFtr===this.CurPos.Type&&null!=this.HdrFtr.CurHdrFtr&&docpostype_DrawingObjects===this.HdrFtr.CurHdrFtr.Content.CurPos.Type)this.EndDrawingEditing(); else if(docpostype_HdrFtr==this.CurPos.Type)this.EndHdrFtrEditing(true);if(window["AscCommon"].g_specialPasteHelper.showSpecialPasteButton)window["AscCommon"].g_specialPasteHelper.SpecialPasteButton_Hide();bRetValue=keydownresult_PreventAll}else if(e.KeyCode===32){var oSelectedInfo=this.GetSelectedElementsInfo();var oMath=oSelectedInfo.GetMath();var oInlineSdt=oSelectedInfo.GetInlineLevelSdt();var oBlockSdt=oSelectedInfo.GetBlockLevelSdt();var oCheckBox;if(oInlineSdt&&oInlineSdt.IsCheckBox())oCheckBox= oInlineSdt;else if(oBlockSdt&&oBlockSdt.IsCheckBox())oCheckBox=oBlockSdt;if(oCheckBox){oCheckBox.SkipSpecialContentControlLock(true);if(!this.IsSelectionLocked(changestype_Paragraph_Content,null,true,this.IsFormFieldEditing())){this.StartAction(AscDFH.historydescription_Document_SpaceButton);oCheckBox.ToggleCheckBox();this.Recalculate();this.FinalizeAction()}oCheckBox.SkipSpecialContentControlLock(false)}else if(false===this.Document_Is_SelectionLocked(changestype_Paragraph_Content,null,true,this.IsFormFieldEditing())){this.StartAction(AscDFH.historydescription_Document_SpaceButton); if(null!==oMath&&true===oMath.Make_AutoCorrect());else{this.DrawingDocument.TargetStart();this.DrawingDocument.TargetShow();this.CheckLanguageOnTextAdd=true;this.AddToParagraph(new ParaSpace);this.CheckLanguageOnTextAdd=false}this.FinalizeAction()}bRetValue=keydownresult_PreventNothing}else if(e.KeyCode===33){if(true===e.AltKey){var MouseEvent=new AscCommon.CMouseEventHandler;MouseEvent.ClickCount=1;MouseEvent.Type=AscCommon.g_mouse_event_type_down;this.CurPage--;if(this.CurPage<0)this.CurPage=0; this.Selection_SetStart(0,0,MouseEvent);MouseEvent.Type=AscCommon.g_mouse_event_type_up;this.Selection_SetEnd(0,0,MouseEvent)}else if(docpostype_HdrFtr===this.CurPos.Type){if(true===this.HdrFtr.GoTo_PrevHdrFtr()){this.Document_UpdateSelectionState();this.Document_UpdateInterfaceState()}}else{if(this.Controller!==this.LogicDocumentController){this.RemoveSelection();this.SetDocPosType(docpostype_Content)}this.MoveCursorPageUp(true===e.ShiftKey,true===e.CtrlKey)}this.private_CheckCursorPosInFillingFormMode(); this.CheckComplexFieldsInSelection();bRetValue=keydownresult_PreventAll}else if(e.KeyCode===34){if(true===e.AltKey){var MouseEvent=new AscCommon.CMouseEventHandler;MouseEvent.ClickCount=1;MouseEvent.Type=AscCommon.g_mouse_event_type_down;this.CurPage++;if(this.CurPage>=this.DrawingDocument.m_lPagesCount)this.CurPage=this.DrawingDocument.m_lPagesCount-1;this.Selection_SetStart(0,0,MouseEvent);MouseEvent.Type=AscCommon.g_mouse_event_type_up;this.Selection_SetEnd(0,0,MouseEvent)}else if(docpostype_HdrFtr=== this.CurPos.Type){if(true===this.HdrFtr.GoTo_NextHdrFtr()){this.Document_UpdateSelectionState();this.Document_UpdateInterfaceState()}}else{if(this.Controller!==this.LogicDocumentController){this.RemoveSelection();this.SetDocPosType(docpostype_Content)}this.MoveCursorPageDown(true===e.ShiftKey,true===e.CtrlKey)}this.private_CheckCursorPosInFillingFormMode();this.CheckComplexFieldsInSelection();bRetValue=keydownresult_PreventAll}else if(e.KeyCode===35){if(true===e.CtrlKey)this.MoveCursorToEndPos(true=== e.ShiftKey);else this.MoveCursorToEndOfLine(true===e.ShiftKey);this.Document_UpdateInterfaceState();this.Document_UpdateRulersState();this.private_CheckCursorPosInFillingFormMode();this.CheckComplexFieldsInSelection();bRetValue=keydownresult_PreventAll}else if(e.KeyCode===36){if(true===e.CtrlKey)this.MoveCursorToStartPos(true===e.ShiftKey);else this.MoveCursorToStartOfLine(true===e.ShiftKey);this.Document_UpdateInterfaceState();this.Document_UpdateRulersState();this.private_CheckCursorPosInFillingFormMode(); this.CheckComplexFieldsInSelection();bRetValue=keydownresult_PreventAll}else if(e.KeyCode===37){if(true!==e.ShiftKey)this.DrawingDocument.TargetStart();this.DrawingDocument.UpdateTargetFromPaint=true;this.MoveCursorLeft(true===e.ShiftKey,true===e.CtrlKey);this.private_CheckCursorPosInFillingFormMode();this.CheckComplexFieldsInSelection();bRetValue=keydownresult_PreventAll}else if(e.KeyCode===38){if(this.IsFillingFormMode()){var oSelectedInfo=this.GetSelectedElementsInfo();var oForm=oSelectedInfo.GetForm(); if(oForm&&!oForm.IsComboBox()&&!oForm.IsDropDownList())oForm=null;if(oForm)this.TurnComboBoxFormValue(oForm,true)}else{if(true!==e.ShiftKey)this.DrawingDocument.TargetStart();this.DrawingDocument.UpdateTargetFromPaint=true;this.MoveCursorUp(true===e.ShiftKey,true===e.CtrlKey);this.private_CheckCursorPosInFillingFormMode();this.CheckComplexFieldsInSelection()}bRetValue=keydownresult_PreventAll}else if(e.KeyCode===39){if(true!==e.ShiftKey)this.DrawingDocument.TargetStart();this.DrawingDocument.UpdateTargetFromPaint= true;this.MoveCursorRight(true===e.ShiftKey,true===e.CtrlKey);this.private_CheckCursorPosInFillingFormMode();this.CheckComplexFieldsInSelection();bRetValue=keydownresult_PreventAll}else if(e.KeyCode===40){if(this.IsFillingFormMode()){var oSelectedInfo=this.GetSelectedElementsInfo();var oForm=oSelectedInfo.GetForm();if(oForm&&!oForm.IsComboBox()&&!oForm.IsDropDownList())oForm=null;if(oForm)this.TurnComboBoxFormValue(oForm,true)}else{if(true!==e.ShiftKey)this.DrawingDocument.TargetStart();this.DrawingDocument.UpdateTargetFromPaint= true;this.MoveCursorDown(true===e.ShiftKey,true===e.CtrlKey);this.private_CheckCursorPosInFillingFormMode();this.CheckComplexFieldsInSelection()}bRetValue=keydownresult_PreventAll}else if(e.KeyCode===46){if(true!==e.ShiftKey){if(false===this.Document_Is_SelectionLocked(AscCommon.changestype_Delete,null,true,this.IsFormFieldEditing())){this.StartAction(AscDFH.historydescription_Document_DeleteButton);var oSelectInfo=this.GetSelectedElementsInfo();if(oSelectInfo.GetInlineLevelSdt())this.CheckInlineSdtOnDelete= oSelectInfo.GetInlineLevelSdt();this.Remove(1,false,false,false,e.CtrlKey);this.CheckInlineSdtOnDelete=null;this.FinalizeAction()}bRetValue=keydownresult_PreventAll}}else if(e.KeyCode===93&&!e.MacCmdKey||AscCommon.AscBrowser.isOpera&&57351===e.KeyCode||e.KeyCode===121&&true===e.ShiftKey){var X_abs,Y_abs,oPosition,ConvertedPos;if(this.DrawingObjects.selectedObjects.length>0){oPosition=this.DrawingObjects.getContextMenuPosition(this.CurPage);ConvertedPos=this.DrawingDocument.ConvertCoordsToCursorWR(oPosition.X, oPosition.Y,oPosition.PageIndex)}else ConvertedPos=this.DrawingDocument.ConvertCoordsToCursorWR(this.TargetPos.X,this.TargetPos.Y,this.TargetPos.PageNum);X_abs=ConvertedPos.X;Y_abs=ConvertedPos.Y;editor.sync_ContextMenuCallback({Type:Asc.c_oAscContextMenuTypes.Common,X_abs:X_abs,Y_abs:Y_abs});bUpdateSelection=false;bRetValue=keydownresult_PreventAll}else if(e.KeyCode===144){bUpdateSelection=false;bRetValue=keydownresult_PreventAll}else if(e.KeyCode===145){bUpdateSelection=false;bRetValue=keydownresult_PreventAll}else if(e.KeyCode=== 12288){if(false===this.Document_Is_SelectionLocked(changestype_Paragraph_Content,null,true,this.IsFormFieldEditing())){this.StartAction(AscDFH.historydescription_Document_SpaceButton);this.DrawingDocument.TargetStart();this.DrawingDocument.TargetShow();this.CheckLanguageOnTextAdd=true;this.AddToParagraph(new ParaSpace);this.CheckLanguageOnTextAdd=false;this.FinalizeAction()}bRetValue=keydownresult_PreventAll}if(bRetValue&keydownresult_PreventKeyPress&&OldRecalcId===this.RecalcId)this.private_UpdateTargetForCollaboration(); if(bRetValue&keydownflags_PreventKeyPress&&true===bUpdateSelection)this.Document_UpdateSelectionState();return bRetValue};CDocument.prototype.private_AddSymbolByShortcut=function(nCode){if(!this.IsSelectionLocked(AscCommon.changestype_Paragraph_Content,null,true,this.IsFormFieldEditing())){this.StartAction(AscDFH.historydescription_Document_AddEuroLetter);this.DrawingDocument.TargetStart();this.DrawingDocument.TargetShow();this.AddToParagraph(new ParaText(nCode));this.FinalizeAction()}};CDocument.prototype.OnKeyPress= function(e){var Code;if(null!=e.Which)Code=e.Which;else if(e.KeyCode)Code=e.KeyCode;else Code=0;if(Code>32){if(false===this.Document_Is_SelectionLocked(AscCommon.changestype_Paragraph_AddText,null,true,this.IsFormFieldEditing())){this.StartAction(AscDFH.historydescription_Document_AddLetter);this.DrawingDocument.TargetStart();this.DrawingDocument.TargetShow();this.CheckLanguageOnTextAdd=true;this.AddToParagraph(new ParaText(Code));this.CheckLanguageOnTextAdd=false;this.FinalizeAction()}this.UpdateSelection(); return true}return false};CDocument.prototype.OnMouseDown=function(e,X,Y,PageIndex){if(PageIndex<0)return;this.private_UpdateTargetForCollaboration();this.Selection.DragDrop.Flag=0;this.Selection.DragDrop.Data=null;if(this.SearchEngine.Count>0)this.SearchEngine.Reset_Current();this.CurPos.CC=null;if(AscCommon.g_mouse_button_right===e.Button)return;if(this.DrawTableMode.Draw||this.DrawTableMode.Erase){this.DrawTableMode.Start=true;this.DrawTableMode.StartX=X;this.DrawTableMode.StartY=Y;this.DrawTableMode.Page= PageIndex;var arrTables=this.GetAllTablesOnPage(PageIndex);this.DrawTableMode.TablesOnPage=arrTables;var oElement=null;var nMinDistance=null;var isInside=false;for(var nTableIndex=0,nTablesCount=arrTables.length;nTableIndex5)oElement=null;if(oElement)this.DrawTableMode.Table=oElement;this.DrawTableMode.UpdateTablePages();return}if(true===this.History.Is_ExtendDocumentToPos()){this.Document_Undo();if(PageIndex>=this.Pages.length){this.RemoveSelection();return}}var OldCurPage=this.CurPage;this.CurPage=PageIndex;if(true===editor.isStartAddShape&&(docpostype_HdrFtr!==this.CurPos.Type||null!==this.HdrFtr.CurHdrFtr)){if(docpostype_HdrFtr!== this.CurPos.Type){this.SetDocPosType(docpostype_DrawingObjects);this.Selection.Use=true;this.Selection.Start=true}else{this.Selection.Use=true;this.Selection.Start=true;this.HdrFtr.WaitMouseDown=false;var CurHdrFtr=this.HdrFtr.CurHdrFtr;var DocContent=CurHdrFtr.Content;DocContent.SetDocPosType(docpostype_DrawingObjects);DocContent.Selection.Use=true;DocContent.Selection.Start=true}if(true!=this.DrawingObjects.isPolylineAddition())this.DrawingObjects.startAddShape(editor.addShapePreset);this.DrawingObjects.OnMouseDown(e, X,Y,this.CurPage)}else{if(true===e.ShiftKey&&(docpostype_DrawingObjects!==this.CurPos.Type&&!(docpostype_HdrFtr===this.CurPos.Type&&this.HdrFtr.CurHdrFtr&&this.HdrFtr.CurHdrFtr.Content.CurPos.Type===docpostype_DrawingObjects)||true===this.DrawingObjects.checkTextObject(X,Y,PageIndex))){if(true===this.IsSelectionUse())this.Selection.Start=false;else this.StartSelectionFromCurPos();this.Selection_SetEnd(X,Y,e);this.Document_UpdateSelectionState();return}if(!this.IsFillingFormMode()){var oSelectedContent= this.GetSelectedElementsInfo();var oInlineSdt=oSelectedContent.GetInlineLevelSdt();var oBlockSdt=oSelectedContent.GetBlockLevelSdt();if(oInlineSdt&&oInlineSdt.IsForm()&&oInlineSdt.IsCheckBox()||oBlockSdt&&oBlockSdt.IsForm()&&oBlockSdt.IsCheckBox())this.CurPos.CC=oInlineSdt&&oInlineSdt.IsForm()&&oInlineSdt.IsCheckBox()?oInlineSdt:oBlockSdt}this.Selection_SetStart(X,Y,e);var oSelectedContent=this.GetSelectedElementsInfo();var oInlineSdt=oSelectedContent.GetInlineLevelSdt();var oBlockSdt=oSelectedContent.GetBlockLevelSdt(); if(oInlineSdt&&oInlineSdt.IsCheckBox()||oBlockSdt&&oBlockSdt.IsCheckBox()){var oCC=oInlineSdt&&oInlineSdt.IsCheckBox()?oInlineSdt:oBlockSdt;if(oCC.CheckHitInContentControlByXY(X,Y,PageIndex)&&(!oCC.IsForm()||this.IsFillingFormMode()||oCC===this.CurPos.CC)){this.CurPos.CC=oCC;oCC.SkipSpecialContentControlLock(true);if(!this.IsSelectionLocked(AscCommon.changestype_Paragraph_Content,null,true,this.IsFillingFormMode())){this.RemoveTextSelection();this.StartAction();oCC.ToggleCheckBox();this.Recalculate(); this.UpdateTracks();this.FinalizeAction()}oCC.SkipSpecialContentControlLock(false)}this.UpdateSelection()}if(this.IsFillingFormMode()&&(oBlockSdt||oInlineSdt))this.CurPos.CC=oInlineSdt?oInlineSdt:oBlockSdt;if(e.ClickCount<=1&&1!==this.Selection.DragDrop.Flag){this.RecalculateCurPos();this.Document_UpdateSelectionState()}}};CDocument.prototype.OnMouseUp=function(e,X,Y,PageIndex){if(PageIndex<0)return;if(this.IsFillingFormMode()&&this.CurPos.CC&&!this.CurPos.CC.CheckHitInContentControlByXY(X,Y,PageIndex)){var oCorrectedPos= this.CurPos.CC.CorrectXYToHitIn(X,Y,PageIndex);if(!oCorrectedPos){if(this.Selection.Start)this.StopSelection();return}X=oCorrectedPos.X;Y=oCorrectedPos.Y}if(this.DrawTableMode.Draw||this.DrawTableMode.Erase){if(!this.DrawTableMode.Start)return;this.DrawTableMode.Start=false;if(PageIndex!==this.DrawTableMode.Page)return;this.DrawTableMode.EndX=X;this.DrawTableMode.EndY=Y;this.DrawTableMode.UpdateTablePages();this.DrawTable();this.DrawTableMode.StartX=-1;this.DrawTableMode.StartY=-1;this.DrawTableMode.EndX= -1;this.DrawTableMode.EndY=-1;this.DrawTableMode.Page=-1;this.DrawTableMode.Table=null;this.DrawingDocument.OnUpdateOverlay();return}this.private_UpdateTargetForCollaboration();if(1===this.Selection.DragDrop.Flag){this.Selection.DragDrop.Flag=-1;var OldCurPage=this.CurPage;this.CurPage=this.Selection.DragDrop.Data.PageNum;this.Selection_SetStart(this.Selection.DragDrop.Data.X,this.Selection.DragDrop.Data.Y,e);this.Selection.DragDrop.Flag=0;this.Selection.DragDrop.Data=null}if(AscCommon.g_mouse_button_right=== e.Button){if(true===this.Selection.Start)return;var ConvertedPos=this.DrawingDocument.ConvertCoordsToCursorWR(X,Y,PageIndex);var X_abs=ConvertedPos.X;var Y_abs=ConvertedPos.Y;if(true===this.DrawingDocument.IsCursorInTableCur(X,Y,PageIndex)){var Table=this.DrawingDocument.TableOutlineDr.TableOutline.Table;Table.SelectAll();Table.Document_SetThisElementCurrent(false);this.Document_UpdateSelectionState();this.Document_UpdateInterfaceState();editor.sync_ContextMenuCallback({Type:Asc.c_oAscContextMenuTypes.Common, X_abs:X_abs,Y_abs:Y_abs});return}var pFlowTable=this.DrawingObjects.getTableByXY(X,Y,PageIndex,this);var nInDrawing=this.DrawingObjects.IsInDrawingObject(X,Y,PageIndex,this);if(docpostype_HdrFtr!=this.CurPos.Type&&-1===nInDrawing&&null===pFlowTable){var PageMetrics=this.Get_PageContentStartPos(this.CurPage,this.Pages[this.CurPage].Pos);if(Y<=PageMetrics.Y){editor.sync_ContextMenuCallback({Type:Asc.c_oAscContextMenuTypes.ChangeHdrFtr,X_abs:X_abs,Y_abs:Y_abs,Header:true,PageNum:PageIndex});return}else if(Y> PageMetrics.YLimit){editor.sync_ContextMenuCallback({Type:Asc.c_oAscContextMenuTypes.ChangeHdrFtr,X_abs:X_abs,Y_abs:Y_abs,Header:false,PageNum:PageIndex});return}}if(false===this.CheckPosInSelection(X,Y,PageIndex,undefined)){this.CurPage=PageIndex;var MouseEvent_new={ClickCount:1,Type:AscCommon.g_mouse_event_type_down,CtrlKey:false,Button:AscCommon.g_mouse_button_right};this.Selection_SetStart(X,Y,MouseEvent_new);MouseEvent_new.Type=AscCommon.g_mouse_event_type_up;this.Selection_SetEnd(X,Y,MouseEvent_new); this.Document_UpdateSelectionState();this.Document_UpdateRulersState();this.Document_UpdateInterfaceState()}editor.sync_ContextMenuCallback({Type:Asc.c_oAscContextMenuTypes.Common,X_abs:X_abs,Y_abs:Y_abs});this.private_UpdateCursorXY(true,true);return}else if(AscCommon.g_mouse_button_left===e.Button)if(true===this.Comments.Is_Use()){var arrComments=this.Comments.GetByXY(PageIndex,X,Y);var CommentsX=null;var CommentsY=null;var arrCommentsId=[];for(var nCommentIndex=0,nCommentsCount=arrComments.length;nCommentIndex< nCommentsCount;++nCommentIndex){var Comment=arrComments[nCommentIndex];if(null!=Comment&&(this.Comments.IsUseSolved()||!Comment.IsSolved())){if(null===CommentsX){var Comment_PageNum=Comment.m_oStartInfo.PageNum;var Comment_Y=Comment.m_oStartInfo.Y;var Comment_X=this.Get_PageLimits(PageIndex).XLimit;var Para=this.TableId.Get_ById(Comment.StartId);if(window["NATIVE_EDITOR_ENJINE"])Comment_X=Comment.m_oStartInfo.X;if(Para){var TextTransform=Para.Get_ParentTextTransform();if(TextTransform)Comment_Y=TextTransform.TransformPointY(Comment.m_oStartInfo.X, Comment.m_oStartInfo.Y);var Coords=this.DrawingDocument.ConvertCoordsToCursorWR(Comment_X,Comment_Y,Comment_PageNum);this.SelectComment(Comment.Get_Id(),false);CommentsX=Coords.X;CommentsY=Coords.Y}}arrCommentsId.push(Comment.Get_Id())}}if(null!==CommentsX&&null!==CommentsY&&arrCommentsId.length>0)this.Api.sync_ShowComment(arrCommentsId,CommentsX,CommentsY);else{this.SelectComment(null,false);this.Api.sync_HideComment()}}if(true===this.Selection.Start){this.CurPage=PageIndex;this.Selection.Start= false;this.Selection_SetEnd(X,Y,e);this.CheckComplexFieldsInSelection();this.Document_UpdateSelectionState();if(c_oAscFormatPainterState.kOff!==editor.isPaintFormat){if(false===this.Document_Is_SelectionLocked(changestype_Paragraph_Content)){this.StartAction(AscDFH.historydescription_Document_FormatPasteHotKey2);this.Document_Format_Paste();this.FinalizeAction()}if(c_oAscFormatPainterState.kOn===editor.isPaintFormat)editor.sync_PaintFormatCallback(c_oAscFormatPainterState.kOff)}else if(true===editor.isMarkerFormat&& true===this.IsTextSelectionUse())if(false===this.Document_Is_SelectionLocked(AscCommon.changestype_Paragraph_TextProperties)){this.StartAction(AscDFH.historydescription_Document_SetTextHighlight2);var ParaItem=null;if(this.HighlightColor!=highlight_None){var TextPr=this.GetCalculatedTextPr();if("undefined"===typeof TextPr.HighLight||null===TextPr.HighLight||highlight_None===TextPr.HighLight||this.HighlightColor.r!=TextPr.HighLight.r||this.HighlightColor.g!=TextPr.HighLight.g||this.HighlightColor.b!= TextPr.HighLight.b)ParaItem=new ParaTextPr({HighLight:this.HighlightColor});else ParaItem=new ParaTextPr({HighLight:highlight_None})}else ParaItem=new ParaTextPr({HighLight:this.HighlightColor});this.AddToParagraph(ParaItem);this.MoveCursorToXY(X,Y,false);this.Document_UpdateSelectionState();this.FinalizeAction();this.Api.sync_MarkerFormatCallback(true)}}this.private_CheckCursorPosInFillingFormMode(12);this.private_UpdateCursorXY(true,true)};CDocument.prototype.OnMouseMove=function(e,X,Y,PageIndex){if(PageIndex< 0)return;if(this.DrawTableMode.Start&&PageIndex===this.DrawTableMode.Page&&(this.DrawTableMode.Draw||this.DrawTableMode.Erase)){this.DrawTableMode.EndX=X;this.DrawTableMode.EndY=Y;this.DrawTableMode.CheckSelectedTable();this.DrawTableMode.UpdateTablePages()}if(true===this.Selection.Start)this.private_UpdateTargetForCollaboration();this.UpdateCursorType(X,Y,PageIndex,e);this.CollaborativeEditing.Check_ForeignCursorsLabels(X,Y,PageIndex);if(this.DrawTableMode.Draw||this.DrawTableMode.Erase){if(this.DrawTableMode.Start)this.DrawingDocument.OnUpdateOverlay(); return}if(1===this.Selection.DragDrop.Flag){if(Math.abs(this.Selection.DragDrop.Data.X-X)>.001||Math.abs(this.Selection.DragDrop.Data.Y-Y)>.001){this.Selection.DragDrop.Flag=0;this.Selection.DragDrop.Data=null;this.Api.sync_MouseMoveStartCallback();this.Api.sync_MouseMoveCallback(new AscCommon.CMouseMoveData);this.Api.sync_MouseMoveEndCallback();this.DrawingDocument.StartTrackText()}return}if(this.IsFillingFormMode()&&this.CurPos.CC&&!this.CurPos.CC.CheckHitInContentControlByXY(X,Y,PageIndex)){var oCorrectedPos= this.CurPos.CC.CorrectXYToHitIn(X,Y,PageIndex);if(!oCorrectedPos)return;X=oCorrectedPos.X;Y=oCorrectedPos.Y}if(true===this.Selection.Use&&true===this.Selection.Start){this.CurPage=PageIndex;this.Selection_SetEnd(X,Y,e);this.Document_UpdateSelectionState()}};CDocument.prototype.GetAddedTextOnKeyDown=function(e){if(e.KeyCode===32){var oSelectedInfo=this.GetSelectedElementsInfo();var oMath=oSelectedInfo.GetMath();if(!oMath)if(true===e.ShiftKey&&true===e.CtrlKey)return[160]}else if(e.KeyCode==69&&true=== e.CtrlKey){if(true===e.AltKey)return[8364]}else if(e.KeyCode==189)if(true===e.CtrlKey&&true===e.ShiftKey)return[8211];return[]};CDocument.prototype.Get_Numbering=function(){return this.Numbering};CDocument.prototype.GetNumbering=function(){return this.Numbering};CDocument.prototype.GetStyleFromFormatting=function(){return this.Controller.GetStyleFromFormatting()};CDocument.prototype.Add_NewStyle=function(oStyle){if(false===this.Document_Is_SelectionLocked(AscCommon.changestype_Document_Styles,{Type:AscCommon.changestype_2_AdditionalTypes, Types:[AscCommon.changestype_Paragraph_Properties]})){this.StartAction(AscDFH.historydescription_Document_AddNewStyle);var NewStyle=this.Styles.Create_StyleFromInterface(oStyle);this.SetParagraphStyle(NewStyle.Get_Name());this.Recalculate();this.UpdateInterface();this.FinalizeAction()}};CDocument.prototype.Remove_Style=function(sStyleName){var StyleId=this.Styles.GetStyleIdByName(sStyleName);if(null==StyleId)return;if(false===this.Document_Is_SelectionLocked(AscCommon.changestype_Document_Styles)){this.StartAction(AscDFH.historydescription_Document_RemoveStyle); this.Styles.Remove_StyleFromInterface(StyleId);this.Recalculate();this.UpdateInterface();this.FinalizeAction()}};CDocument.prototype.Remove_AllCustomStyles=function(){if(false===this.Document_Is_SelectionLocked(AscCommon.changestype_Document_Styles)){this.StartAction(AscDFH.historydescription_Document_RemoveAllCustomStyles);this.Styles.Remove_AllCustomStylesFromInterface();this.Recalculate();this.UpdateInterface();this.FinalizeAction()}};CDocument.prototype.Is_StyleDefault=function(sName){return this.Styles.Is_StyleDefault(sName)}; CDocument.prototype.Is_DefaultStyleChanged=function(sName){return this.Styles.Is_DefaultStyleChanged(sName)};CDocument.prototype.Get_Styles=function(){return this.Styles};CDocument.prototype.GetStyles=function(){return this.Styles};CDocument.prototype.CopyStyle=function(){return this.Styles.CopyStyle()};CDocument.prototype.Get_TableStyleForPara=function(){return null};CDocument.prototype.Get_ShapeStyleForPara=function(){return null};CDocument.prototype.Get_TextBackGroundColor=function(){return undefined}; CDocument.prototype.Select_DrawingObject=function(Id){this.RemoveSelection();this.DrawingDocument.TargetEnd();this.DrawingDocument.SetCurrentPage(this.CurPage);this.Selection.Start=false;this.Selection.Use=true;this.SetDocPosType(docpostype_DrawingObjects);this.DrawingObjects.selectById(Id,this.CurPage);this.Document_UpdateInterfaceState();this.Document_UpdateSelectionState()};CDocument.prototype.Get_NearestPos=function(PageNum,X,Y,bAnchor,Drawing){if(undefined===bAnchor)bAnchor=false;if(docpostype_HdrFtr=== this.GetDocPosType())return this.HdrFtr.Get_NearestPos(PageNum,X,Y,bAnchor,Drawing);var bInText=null===this.IsInText(X,Y,PageNum)?false:true;var nInDrawing=this.DrawingObjects.IsInDrawingObject(X,Y,PageNum,this);if(true!=bAnchor){var NearestPos=this.DrawingObjects.getNearestPos(X,Y,PageNum,Drawing);if((nInDrawing===DRAWING_ARRAY_TYPE_BEFORE||nInDrawing===DRAWING_ARRAY_TYPE_INLINE||false===bInText&&nInDrawing>=0)&&null!=NearestPos)return NearestPos;NearestPos=true===this.Footnotes.CheckHitInFootnote(X, Y,PageNum)?this.Footnotes.GetNearestPos(X,Y,PageNum,false,Drawing):null;if(null!==NearestPos)return NearestPos;NearestPos=this.Endnotes.CheckHitInEndnote(X,Y,PageNum)?this.Endnotes.GetNearestPos(X,Y,PageNum,false,Drawing):null;if(NearestPos)return NearestPos}var ContentPos=this.Internal_GetContentPosByXY(X,Y,PageNum);if(true===bAnchor&&ContentPos>0&&PageNum>0&&ContentPos===this.Pages[PageNum].Pos&&ContentPos===this.Pages[PageNum-1].EndPos&&this.Pages[PageNum].EndPos>this.Pages[PageNum].Pos&&type_Paragraph=== this.Content[ContentPos].GetType()&&true===this.Content[ContentPos].IsContentOnFirstPage())ContentPos++;var ElementPageIndex=this.private_GetElementPageIndexByXY(ContentPos,X,Y,PageNum);return this.Content[ContentPos].GetNearestPos(ElementPageIndex,X,Y,bAnchor,Drawing)};CDocument.prototype.Internal_Content_Add=function(Position,NewObject,isCorrectContent){if(Position<0||Position>this.Content.length)return;var PrevObj=this.Content[Position-1]?this.Content[Position-1]:null;var NextObj=this.Content[Position]? this.Content[Position]:null;this.private_RecalculateNumbering([NewObject]);this.History.Add(new CChangesDocumentAddItem(this,Position,[NewObject]));this.Content.splice(Position,0,NewObject);this.private_UpdateSelectionPosOnAdd(Position);NewObject.Set_Parent(this);NewObject.Set_DocumentNext(NextObj);NewObject.Set_DocumentPrev(PrevObj);if(null!=PrevObj)PrevObj.Set_DocumentNext(NewObject);if(null!=NextObj)NextObj.Set_DocumentPrev(NewObject);this.SectionsInfo.Update_OnAdd(Position,[NewObject]);if(false!== isCorrectContent){this.Check_SectionLastParagraph();if(!this.Content[this.Content.length-1].IsParagraph())this.Internal_Content_Add(this.Content.length,new Paragraph(this.DrawingDocument,this),false)}this.private_ReindexContent(Position);if(type_Paragraph===NewObject.GetType())this.DocumentOutline.CheckParagraph(NewObject)};CDocument.prototype.Internal_Content_Remove=function(Position,Count,isCorrectContent){var ChangePos=-1;if(Position<0||Position>=this.Content.length||Count<=0)return-1;var PrevObj= this.Content[Position-1]?this.Content[Position-1]:null;var NextObj=this.Content[Position+Count]?this.Content[Position+Count]:null;for(var Index=0;Index=0){var PageIndex=this.CurPage;if(docpostype_HdrFtr===this.GetDocPosType())PageIndex=this.HdrFtr.Get_CurPage();if(PageIndex<0)PageIndex=this.CurPage;this.Create_HdrFtrWidthPageNum(PageIndex,AlignV,AlignH)}else this.AddToParagraph(new ParaPageNum); this.Document_UpdateInterfaceState()};CDocument.prototype.Document_SetHdrFtrFirstPage=function(Value){var CurHdrFtr=this.HdrFtr.CurHdrFtr;if(null===CurHdrFtr||-1===CurHdrFtr.RecalcInfo.CurPage)return;var CurPage=CurHdrFtr.RecalcInfo.CurPage;var Index=this.Pages[CurPage].Pos;var SectPr=this.SectionsInfo.Get_SectPr(Index).SectPr;SectPr.Set_TitlePage(Value);if(true===Value){var FirstSectPr=this.SectionsInfo.Get_SectPr2(0).SectPr;var FirstHeader=FirstSectPr.Get_Header_First();var FirstFooter=FirstSectPr.Get_Footer_First(); if(null===FirstHeader){var Header=new CHeaderFooter(this.HdrFtr,this,this.DrawingDocument,hdrftr_Header);FirstSectPr.Set_Header_First(Header);this.HdrFtr.Set_CurHdrFtr(Header)}else this.HdrFtr.Set_CurHdrFtr(FirstHeader);if(null===FirstFooter){var Footer=new CHeaderFooter(this.HdrFtr,this,this.DrawingDocument,hdrftr_Footer);FirstSectPr.Set_Footer_First(Footer)}}else{var TempSectPr=SectPr;var TempIndex=Index;while(null===TempSectPr.Get_Header_Default()){TempIndex--;if(TempIndex<0)break;TempSectPr=this.SectionsInfo.Get_SectPr(TempIndex).SectPr}this.HdrFtr.Set_CurHdrFtr(TempSectPr.Get_Header_Default())}this.Recalculate(); if(null!==this.HdrFtr.CurHdrFtr){this.HdrFtr.CurHdrFtr.Content.MoveCursorToStartPos();this.HdrFtr.CurHdrFtr.Set_Page(CurPage)}this.Document_UpdateSelectionState();this.Document_UpdateInterfaceState()};CDocument.prototype.Document_SetHdrFtrEvenAndOddHeaders=function(Value){this.Set_DocumentEvenAndOddHeaders(Value);var FirstSectPr;if(true===Value){FirstSectPr=this.SectionsInfo.Get_SectPr2(0).SectPr;if(null===FirstSectPr.Get_Header_Even()){var Header=new CHeaderFooter(this.HdrFtr,this,this.DrawingDocument, hdrftr_Header);FirstSectPr.Set_Header_Even(Header)}if(null===FirstSectPr.Get_Footer_Even()){var Footer=new CHeaderFooter(this.HdrFtr,this,this.DrawingDocument,hdrftr_Footer);FirstSectPr.Set_Footer_Even(Footer)}}else FirstSectPr=this.SectionsInfo.Get_SectPr2(0).SectPr;if(null!==FirstSectPr.Get_Header_First()&&true===FirstSectPr.TitlePage)this.HdrFtr.Set_CurHdrFtr(FirstSectPr.Get_Header_First());else this.HdrFtr.Set_CurHdrFtr(FirstSectPr.Get_Header_Default());this.Recalculate();if(null!==this.HdrFtr.CurHdrFtr)this.HdrFtr.CurHdrFtr.Content.MoveCursorToStartPos(); this.Document_UpdateSelectionState();this.Document_UpdateInterfaceState()};CDocument.prototype.Document_SetHdrFtrDistance=function(Value){var CurHdrFtr=this.HdrFtr.CurHdrFtr;if(null===CurHdrFtr)return;var CurPage=CurHdrFtr.RecalcInfo.CurPage;if(-1===CurPage)return;var Index=this.Pages[CurPage].Pos;var SectPr=this.SectionsInfo.Get_SectPr(Index).SectPr;if(hdrftr_Header===CurHdrFtr.Type)SectPr.SetPageMarginHeader(Value);else SectPr.SetPageMarginFooter(Value);this.Recalculate();this.Document_UpdateRulersState(); this.Document_UpdateInterfaceState();this.Document_UpdateSelectionState()};CDocument.prototype.Document_SetHdrFtrBounds=function(Y0,Y1){var CurHdrFtr=this.HdrFtr.CurHdrFtr;if(null===CurHdrFtr)return;var CurPage=CurHdrFtr.RecalcInfo.CurPage;if(-1===CurPage)return;var Index=this.Pages[CurPage].Pos;var SectPr=this.SectionsInfo.Get_SectPr(Index).SectPr;var Bounds=CurHdrFtr.Get_Bounds();if(hdrftr_Header===CurHdrFtr.Type){if(null!==Y0)SectPr.SetPageMarginHeader(Y0);if(null!==Y1)SectPr.SetPageMargins(undefined, Y1,undefined,undefined)}else if(null!==Y0){var H=Bounds.Bottom-Bounds.Top;var _Y1=Y0+H;SectPr.SetPageMarginFooter(SectPr.GetPageHeight()-_Y1)}this.Recalculate();this.Document_UpdateRulersState();this.Document_UpdateInterfaceState()};CDocument.prototype.Document_SetHdrFtrLink=function(bLinkToPrevious){var CurHdrFtr=this.HdrFtr.CurHdrFtr;if(docpostype_HdrFtr!==this.GetDocPosType()||null===CurHdrFtr||-1===CurHdrFtr.RecalcInfo.CurPage)return;var PageIndex=CurHdrFtr.RecalcInfo.CurPage;var Index=this.Pages[PageIndex].Pos; var SectPr=this.SectionsInfo.Get_SectPr(Index).SectPr;if(SectPr===this.SectionsInfo.Get_SectPr2(0).SectPr)return;var SectionPageInfo=this.Get_SectionPageNumInfo(PageIndex);var bFirst=true===SectionPageInfo.bFirst&&true===SectPr.Get_TitlePage()?true:false;var bEven=true===SectionPageInfo.bEven&&true===EvenAndOddHeaders?true:false;var bHeader=hdrftr_Header===CurHdrFtr.Type?true:false;var _CurHdrFtr=SectPr.GetHdrFtr(bHeader,bFirst,bEven);if(true===bLinkToPrevious){if(null===_CurHdrFtr)return;_CurHdrFtr.RemoveSelection(); SectPr.Set_HdrFtr(bHeader,bFirst,bEven,null);var HdrFtr=this.Get_SectionHdrFtr(PageIndex,bFirst,bEven);if(true===bHeader)if(null===HdrFtr.Header)CurHdrFtr=this.Create_SectionHdrFtr(hdrftr_Header,PageIndex);else CurHdrFtr=HdrFtr.Header;else if(null===HdrFtr.Footer)CurHdrFtr=this.Create_SectionHdrFtr(hdrftr_Footer,PageIndex);else CurHdrFtr=HdrFtr.Footer;this.HdrFtr.Set_CurHdrFtr(CurHdrFtr);this.HdrFtr.CurHdrFtr.MoveCursorToStartPos(false)}else{if(null!==_CurHdrFtr)return;var NewHdrFtr=CurHdrFtr.Copy(); SectPr.Set_HdrFtr(bHeader,bFirst,bEven,NewHdrFtr);this.HdrFtr.Set_CurHdrFtr(NewHdrFtr);this.HdrFtr.CurHdrFtr.MoveCursorToStartPos(false)}this.Recalculate();this.Document_UpdateSelectionState();this.Document_UpdateInterfaceState()};CDocument.prototype.SetSectionStartPage=function(nStartPage){var oCurHdrFtr=this.HdrFtr.CurHdrFtr;if(!oCurHdrFtr)return;var nCurPage=oCurHdrFtr.RecalcInfo.CurPage;if(-1===nCurPage)return;var nIndex=this.Pages[nCurPage].Pos;var oSectPr=this.SectionsInfo.Get_SectPr(nIndex).SectPr; oSectPr.Set_PageNum_Start(nStartPage);this.Recalculate();this.Document_UpdateRulersState();this.Document_UpdateInterfaceState();this.Document_UpdateSelectionState()};CDocument.prototype.Document_Format_Copy=function(){this.CopyTextPr=this.GetDirectTextPr();this.CopyParaPr=this.GetDirectParaPr()};CDocument.prototype.EndHdrFtrEditing=function(bCanStayOnPage){if(docpostype_HdrFtr===this.GetDocPosType()){this.SetDocPosType(docpostype_Content);var CurHdrFtr=this.HdrFtr.Get_CurHdrFtr();if(null===CurHdrFtr|| undefined===CurHdrFtr||true!==bCanStayOnPage)this.MoveCursorToStartPos(false);else{CurHdrFtr.RemoveSelection();if(hdrftr_Header==CurHdrFtr.Type)this.MoveCursorToXY(0,0,false);else this.MoveCursorToXY(0,1E5,false)}this.DrawingDocument.ClearCachePages();this.DrawingDocument.FirePaint();this.Document_UpdateRulersState();this.Document_UpdateInterfaceState();this.Document_UpdateSelectionState()}};CDocument.prototype.EndFootnotesEditing=function(){if(docpostype_Footnotes===this.GetDocPosType()){this.SetDocPosType(docpostype_Content); this.MoveCursorToStartPos(false);this.DrawingDocument.ClearCachePages();this.DrawingDocument.FirePaint();this.Document_UpdateRulersState();this.Document_UpdateInterfaceState();this.Document_UpdateSelectionState()}};CDocument.prototype.EndEndnotesEditing=function(){if(docpostype_Endnotes===this.GetDocPosType()){this.SetDocPosType(docpostype_Content);this.MoveCursorToStartPos(false);this.DrawingDocument.ClearCachePages();this.DrawingDocument.FirePaint();this.Document_UpdateRulersState();this.Document_UpdateInterfaceState(); this.Document_UpdateSelectionState()}};CDocument.prototype.EndDrawingEditing=function(){if(docpostype_DrawingObjects===this.GetDocPosType()||docpostype_HdrFtr===this.GetDocPosType()&&null!=this.HdrFtr.CurHdrFtr&&docpostype_DrawingObjects===this.HdrFtr.CurHdrFtr.Content.CurPos.Type){this.DrawingObjects.resetSelection2();this.Document_UpdateInterfaceState();this.Document_UpdateSelectionState();this.private_UpdateCursorXY(true,true)}};CDocument.prototype.Document_Format_Paste=function(){this.Controller.PasteFormatting(this.CopyTextPr, this.CopyParaPr);this.Recalculate();this.Document_UpdateInterfaceState();this.Document_UpdateSelectionState()};CDocument.prototype.IsTableCellContent=function(isReturnCell){if(true===isReturnCell)return null;return false};CDocument.prototype.Check_AutoFit=function(){return false};CDocument.prototype.Is_TopDocument=function(bReturnTopDocument){if(true===bReturnTopDocument)return this;return true};CDocument.prototype.IsInTable=function(bReturnTopTable){if(true===bReturnTopTable)return null;return false}; CDocument.prototype.Is_DrawingShape=function(bRetShape){if(bRetShape===true)return null;return false};CDocument.prototype.IsSelectionUse=function(){return this.Controller.IsSelectionUse()};CDocument.prototype.IsNumberingSelection=function(){return this.Controller.IsNumberingSelection()};CDocument.prototype.IsTextSelectionUse=function(){return this.Controller.IsTextSelectionUse()};CDocument.prototype.GetCurPosXY=function(){var TempXY=this.Controller.GetCurPosXY();this.private_CheckCurPage();return{X:TempXY.X, Y:TempXY.Y,PageNum:this.CurPage}};CDocument.prototype.GetSelectedText=function(bClearText,oPr){if(undefined===oPr)oPr={};if(undefined===bClearText)bClearText=false;return this.Controller.GetSelectedText(bClearText,oPr)};CDocument.prototype.GetCurrentParagraph=function(bIgnoreSelection,bReturnSelectedArray,oPr){if(true!==bIgnoreSelection&&true===bReturnSelectedArray){var arrSelectedParagraphs=[];this.Controller.GetCurrentParagraph(bIgnoreSelection,arrSelectedParagraphs,oPr);return arrSelectedParagraphs}else return this.Controller.GetCurrentParagraph(bIgnoreSelection, null,oPr)};CDocument.prototype.GetSelectedParagraphs=function(){return this.GetCurrentParagraph(false,true)};CDocument.prototype.GetCurrentTable=function(){var arrTables=this.GetCurrentTablesStack();return arrTables.length>0?arrTables[arrTables.length-1]:null};CDocument.prototype.GetCurrentTablesStack=function(){var arrTables=[];this.Controller.GetCurrentTablesStack(arrTables);return arrTables};CDocument.prototype.GetSelectedElementsInfo=function(oPr){var oInfo=new CSelectedElementsInfo(oPr);this.Controller.GetSelectedElementsInfo(oInfo); return oInfo};CDocument.prototype.AddTableRow=function(bBefore,nCount){this.Controller.AddTableRow(bBefore,nCount);this.Recalculate();this.Document_UpdateSelectionState();this.Document_UpdateInterfaceState()};CDocument.prototype.AddTableColumn=function(bBefore,nCount){this.Controller.AddTableColumn(bBefore,nCount);this.Recalculate();this.Document_UpdateSelectionState();this.Document_UpdateInterfaceState()};CDocument.prototype.RemoveTableRow=function(){this.Controller.RemoveTableRow();this.Recalculate(); this.UpdateSelection();this.UpdateInterface()};CDocument.prototype.RemoveTableColumn=function(){this.Controller.RemoveTableColumn();this.Recalculate();this.Document_UpdateSelectionState();this.Document_UpdateInterfaceState()};CDocument.prototype.MergeTableCells=function(){var isLocalTrackRevisions=this.GetLocalTrackRevisions();this.SetLocalTrackRevisions(false);this.Controller.MergeTableCells();this.SetLocalTrackRevisions(isLocalTrackRevisions);this.Recalculate();this.UpdateSelection();this.UpdateInterface()}; CDocument.prototype.SplitTableCells=function(Cols,Rows){var isLocalTrackRevisions=this.GetLocalTrackRevisions();this.SetLocalTrackRevisions(false);this.Controller.SplitTableCells(Cols,Rows);this.SetLocalTrackRevisions(isLocalTrackRevisions);this.Recalculate();this.UpdateSelection();this.UpdateInterface()};CDocument.prototype.RemoveTableCells=function(){this.Controller.RemoveTableCells();this.Recalculate();this.UpdateSelection();this.UpdateInterface()};CDocument.prototype.RemoveTable=function(){this.Controller.RemoveTable(); this.Recalculate();this.Document_UpdateSelectionState();this.Document_UpdateInterfaceState();this.Document_UpdateRulersState()};CDocument.prototype.SelectTable=function(Type){this.Controller.SelectTable(Type);this.Document_UpdateSelectionState();this.Document_UpdateInterfaceState()};CDocument.prototype.CanMergeTableCells=function(){return this.Controller.CanMergeTableCells()};CDocument.prototype.CanSplitTableCells=function(){return this.Controller.CanSplitTableCells()};CDocument.prototype.CheckTableCoincidence= function(Table){return false};CDocument.prototype.DistributeTableCells=function(isHorizontally){if(!this.Controller.DistributeTableCells(isHorizontally))return false;this.Recalculate();this.Document_UpdateSelectionState();this.Document_UpdateInterfaceState();return true};CDocument.prototype.Document_CreateFontMap=function(){var FontMap={};this.SectionsInfo.Document_CreateFontMap(FontMap);var Count=this.Content.length;for(var Index=0;Index1){this.ColumnsMarkup.UpdateFromSectPr(oSectPr,this.CurPage);var oElement=this.Content[nCurPos];if(oElement.IsParagraph())this.ColumnsMarkup.SetCurCol(oElement.Get_CurrentColumn());this.DrawingDocument.Set_RulerState_Columns(this.ColumnsMarkup)}else{var oFrame=oSectPr.GetContentFrame(this.CurPage); this.DrawingDocument.Set_RulerState_Paragraph({L:oFrame.Left,T:oFrame.Top,R:oFrame.Right,B:oFrame.Bottom},true)}};CDocument.prototype.Document_UpdateSelectionState=function(){this.UpdateSelection()};CDocument.prototype.private_UpdateSelection=function(){if(true===this.TurnOffInterfaceEvents)return;if(true===AscCommon.CollaborativeEditing.Get_GlobalLockSelection())return;this.DrawingDocument.UpdateTargetTransform(null);this.Controller.UpdateSelectionState();this.UpdateDocumentOutlinePosition();this.Document_UpdateCopyCutState()}; CDocument.prototype.UpdateDocumentOutlinePosition=function(){if(this.DocumentOutline.IsUse())if(this.Controller!==this.LogicDocumentController)this.DocumentOutline.UpdateCurrentPosition(null);else{var oCurrentParagraph=this.GetCurrentParagraph(false,false);this.DocumentOutline.UpdateCurrentPosition(oCurrentParagraph.GetDocumentPositionFromObject())}};CDocument.prototype.private_UpdateDocumentTracks=function(){if(true===this.TurnOffInterfaceEvents)return;if(true===AscCommon.CollaborativeEditing.Get_GlobalLockSelection())return; this.private_UpdateTracks(this.IsSelectionUse(),this.IsSelectionEmpty())};CDocument.prototype.private_UpdateTracks=function(bSelection,bEmptySelection){var Pos=true===this.Selection.Use&&selectionflag_Numbering!==this.Selection.Flag?this.Selection.EndPos:this.CurPos.ContentPos;if(docpostype_Content===this.GetDocPosType()&&!(Pos>=0&&(null===this.FullRecalc.Id||this.FullRecalc.StartIndex>Pos))){this.NeedUpdateTracksOnRecalc=true;this.NeedUpdateTracksParams.Selection=bSelection;this.NeedUpdateTracksParams.EmptySelection= bEmptySelection;return}var isNeedRedraw=false;this.NeedUpdateTracksOnRecalc=false;var oSelectedInfo=this.GetSelectedElementsInfo();var Math=oSelectedInfo.GetMath();if(null!==Math&&this.IsShowEquationTrack())this.DrawingDocument.Update_MathTrack(true,false===bSelection||true===bEmptySelection?true:false,Math);else this.DrawingDocument.Update_MathTrack(false);var oBlockLevelSdt=oSelectedInfo.GetBlockLevelSdt();var oInlineLevelSdt=oSelectedInfo.GetInlineLevelSdt();var oCurrentForm=null;if(oInlineLevelSdt){if(oInlineLevelSdt.IsForm())oCurrentForm= oInlineLevelSdt;oInlineLevelSdt.DrawContentControlsTrack(false)}else if(oBlockLevelSdt)oBlockLevelSdt.DrawContentControlsTrack(false);else{var oForm=null,oMajorParaDrawing;if(docpostype_DrawingObjects===this.GetDocPosType()&&(oMajorParaDrawing=this.DrawingObjects.getMajorParaDrawing())&&this.DrawingObjects.getTargetDocContent())oForm=oMajorParaDrawing.GetInnerForm();if(oForm)oForm.DrawContentControlsTrack(false);else this.DrawingDocument.OnDrawContentControl(null,AscCommon.ContentControlTrack.In)}if(this.private_SetCurrentSpecialForm(oCurrentForm))isNeedRedraw= true;var oField=oSelectedInfo.GetField();if(null!==oField&&(fieldtype_MERGEFIELD!==oField.Get_FieldType()||true!==this.MailMergeFieldsHighlight)){var aBounds=oField.Get_Bounds();this.DrawingDocument.Update_FieldTrack(true,aBounds)}else{this.DrawingDocument.Update_FieldTrack(false);var arrComplexFields=oSelectedInfo.GetComplexFields();if(arrComplexFields.length>0&&this.FieldsManager.SetCurrentComplexField(arrComplexFields[arrComplexFields.length-1])||arrComplexFields.length<=0&&this.FieldsManager.SetCurrentComplexField(null))isNeedRedraw= true}if(isNeedRedraw){this.DrawingDocument.ClearCachePages();this.DrawingDocument.FirePaint()}};CDocument.prototype.Document_UpdateUndoRedoState=function(){this.UpdateUndoRedo()};CDocument.prototype.private_UpdateUndoRedo=function(){if(true===this.TurnOffInterfaceEvents)return;if(true===AscCommon.CollaborativeEditing.Get_GlobalLockSelection())return;if(this.IsViewModeInReview()){this.Api.sync_CanUndoCallback(false);this.Api.sync_CanRedoCallback(false)}else{var bCanUndo=this.History.Can_Undo();if(true!== bCanUndo&&this.Api&&this.CollaborativeEditing&&true===this.CollaborativeEditing.Is_Fast()&&true!==this.CollaborativeEditing.Is_SingleUser())bCanUndo=this.CollaborativeEditing.CanUndo();this.Api.sync_CanUndoCallback(bCanUndo);this.Api.sync_CanRedoCallback(this.History.Can_Redo());this.Api.CheckChangedDocument()}};CDocument.prototype.Document_UpdateCopyCutState=function(){if(true===this.TurnOffInterfaceEvents)return;if(true===AscCommon.CollaborativeEditing.Get_GlobalLockSelection())return;if(true=== this.Selection.Start)return;this.Api.sync_CanCopyCutCallback(this.Can_CopyCut())};CDocument.prototype.Document_UpdateCanAddHyperlinkState=function(){if(true===this.TurnOffInterfaceEvents)return;if(true===AscCommon.CollaborativeEditing.Get_GlobalLockSelection())return;this.Api.sync_CanAddHyperlinkCallback(this.CanAddHyperlink(false))};CDocument.prototype.Document_UpdateSectionPr=function(){if(true===this.TurnOffInterfaceEvents)return;if(true===this.CollaborativeEditing.Get_GlobalLockSelection())return; this.Api.sync_PageOrientCallback(this.Get_DocumentOrientation());var PageSize=this.Get_DocumentPageSize();this.Api.sync_DocSizeCallback(PageSize.W,PageSize.H);var CurPos=this.CurPos.ContentPos;var SectPr=this.SectionsInfo.Get_SectPr(CurPos).SectPr;if(SectPr){var ColumnsPr=new CDocumentColumnsProps;ColumnsPr.From_SectPr(SectPr);this.Api.sync_ColumnsPropsCallback(ColumnsPr);this.Api.sync_LineNumbersPropsCollback(SectPr.GetLineNumbers());this.Api.sync_SectionPropsCallback(new CDocumentSectionProps(SectPr, this))}};CDocument.prototype.Get_ColumnsProps=function(){var CurPos=this.CurPos.ContentPos;var SectPr=this.SectionsInfo.Get_SectPr(CurPos).SectPr;var ColumnsPr=new CDocumentColumnsProps;if(SectPr)ColumnsPr.From_SectPr(SectPr);return ColumnsPr};CDocument.prototype.GetWatermarkProps=function(){var SectionPageInfo=this.Get_SectionPageNumInfo(this.CurPage);var bFirst=SectionPageInfo.bFirst;var bEven=SectionPageInfo.bEven;var HdrFtr=this.Get_SectionHdrFtr(this.CurPage,false,false);var Header=HdrFtr.Header; var oProps;if(null===Header){oProps=new Asc.CAscWatermarkProperties;oProps.put_Type(Asc.c_oAscWatermarkType.None);oProps.put_Api(this.Api);return oProps}var oWatermark=Header.FindWatermark();if(oWatermark){oProps=oWatermark.GetWatermarkProps();oProps.put_Api(this.Api);return oProps}oProps=new Asc.CAscWatermarkProperties;oProps.put_Type(Asc.c_oAscWatermarkType.None);oProps.put_Api(this.Api);return oProps};CDocument.prototype.SetWatermarkProps=function(oProps){if(!this.CanPerformAction())return;this.StartAction(AscDFH.historydescription_Document_AddWatermark); var SectionPageInfo=this.Get_SectionPageNumInfo(this.CurPage);var bFirst=SectionPageInfo.bFirst;var bEven=SectionPageInfo.bEven;var HdrFtr=this.Get_SectionHdrFtr(this.CurPage,bFirst,bEven);var Header=HdrFtr.Header;if(null===Header){if(Asc.c_oAscWatermarkType.None===oProps.get_Type()){this.FinalizeAction(true);return}Header=this.Create_SectionHdrFtr(hdrftr_Header,this.CurPage)}var oWatermark=Header.FindWatermark();if(oWatermark){if(oWatermark.GraphicObj.selected)this.RemoveSelection(true);oWatermark.Remove_FromDocument(false)}oWatermark= this.DrawingObjects.createWatermark(oProps);if(oWatermark){var oDocState=this.Get_SelectionState2();var oContent=Header.Content;oContent.MoveCursorToEndPos(false);var oSdt=null,oElement;for(var i=0;ithis.Selection.EndPos?this.Selection.EndPos:this.Selection.StartPos;var EndPos=this.Selection.StartPos>this.Selection.EndPos? this.Selection.StartPos:this.Selection.EndPos;if(StartPos!=EndPos&&AscCommon.changestype_Delete===CheckType)CheckType=AscCommon.changestype_Remove;for(var Index=StartPos;Index<=EndPos;Index++)this.Content[Index].Document_Is_SelectionLocked(CheckType)}else{var CurElement=this.Content[this.CurPos.ContentPos];if(AscCommon.changestype_Document_Content_Add===CheckType&&CurElement.IsParagraph()&&CurElement.IsCursorAtEnd()&&CurElement.Lock.Is_Locked())AscCommon.CollaborativeEditing.Add_CheckLock(false); else this.Content[this.CurPos.ContentPos].Document_Is_SelectionLocked(CheckType)}break}case selectionflag_Numbering:{var oNumPr=this.Selection.Data.CurPara.GetNumPr();if(oNumPr){var oNum=this.GetNumbering().GetNum(oNumPr.NumId);oNum.IsSelectionLocked(CheckType)}this.Content[this.CurPos.ContentPos].Document_Is_SelectionLocked(CheckType);break}}};CDocument.prototype.Get_SelectionState2=function(){this.RemoveSelection();var State=new CDocumentSelectionState;var nDocPosType=this.GetDocPosType();if(docpostype_HdrFtr=== nDocPosType){State.Type=docpostype_HdrFtr;if(null!=this.HdrFtr.CurHdrFtr)State.Id=this.HdrFtr.CurHdrFtr.Get_Id();else State.Id=null}else if(docpostype_DrawingObjects===nDocPosType){var X=0;var Y=0;var PageNum=this.CurPage;var ContentPos=this.Internal_GetContentPosByXY(X,Y,PageNum);State.Type=docpostype_Content;State.Id=this.Content[ContentPos].GetId()}else if(docpostype_Footnotes===nDocPosType){var oFootnote=this.Footnotes.GetCurFootnote();State.Type=docpostype_Footnotes;State.Id=oFootnote?oFootnote.GetId(): null}else if(docpostype_Endnotes===nDocPosType){var oEndnote=this.Footnotes.GetCurEndnote();State.Type=docpostype_Endnotes;State.Id=oEndnote?oEndnote.GetId():null}else{State.Id=this.Get_Id();State.Type=docpostype_Content;var Element=this.Content[this.CurPos.ContentPos];State.Data=Element.Get_SelectionState2()}return State};CDocument.prototype.Set_SelectionState2=function(State){this.RemoveSelection();var Id=State.Id;if(docpostype_HdrFtr===State.Type){this.SetDocPosType(docpostype_HdrFtr);if(null=== Id||true!=this.HdrFtr.Set_CurHdrFtr_ById(Id)){this.SetDocPosType(docpostype_Content);this.CurPos.ContentPos=0;this.Content[this.CurPos.ContentPos].MoveCursorToStartPos(false)}}else if(docpostype_Footnotes===State.Type){this.SetDocPosType(docpostype_Footnotes);var oFootnote=g_oTableId.Get_ById(State.Id);if(oFootnote&&true===this.Footnotes.Is_UseInDocument(State.Id)){this.Footnotes.private_SetCurrentFootnoteNoSelection(oFootnote);oFootnote.MoveCursorToStartPos(false)}else this.EndFootnotesEditing()}else if(docpostype_Endnotes=== State.Type){this.SetDocPosType(docpostype_Endnotes);var oEndnote=g_oTableId.Get_ById(State.Id);if(oEndnote&&true===this.Endnotes.Is_UseInDocument(State.Id)){this.Endnotes.private_SetCurrentEndnoteNoSelection(oEndnote);oEndnote.MoveCursorToStartPos(false)}else this.EndEndnotesEditing()}else{var CurId=State.Data.Id;var bFlag=false;var Pos=0;var Count=this.Content.length;for(Pos=0;Pos0)this.Api.sync_ShowComment(arrCommentsId,CommentsX,CommentsY);else this.Api.sync_HideComment()};CDocument.prototype.ShowComments=function(isShowSolved){if(false!==isShowSolved)isShowSolved=true;this.Comments.Set_Use(true);this.Comments.SetUseSolved(isShowSolved);this.DrawingDocument.ClearCachePages();this.DrawingDocument.FirePaint()};CDocument.prototype.HideComments=function(){this.Comments.Set_Use(false);this.Comments.SetUseSolved(false);this.Comments.Set_Current(null); this.DrawingDocument.ClearCachePages();this.DrawingDocument.FirePaint()};CDocument.prototype.GetPrevElementEndInfo=function(CurElement){var PrevElement=CurElement.Get_DocumentPrev();if(null!==PrevElement&&undefined!==PrevElement)return PrevElement.GetEndInfo();else return null};CDocument.prototype.GetSelectionAnchorPos=function(){var Result=this.Controller.GetSelectionAnchorPos();var PageLimit=this.Get_PageLimits(Result.Page);Result.X0=PageLimit.X;Result.X1=PageLimit.XLimit;var Coords0=this.DrawingDocument.ConvertCoordsToCursorWR(Result.X0, Result.Y,Result.Page);var Coords1=this.DrawingDocument.ConvertCoordsToCursorWR(Result.X1,Result.Y,Result.Page);return{X0:Coords0.X,X1:Coords1.X,Y:Coords0.Y}};CDocument.prototype.GetAllComments=function(isMine,isCurrent){var arrCommentsId=[];if(isCurrent){if(true===this.Comments.Is_Use()){var arrParagraphs=this.GetSelectedParagraphs();var oComments={};for(var nParaIndex=0,nParasCount=arrParagraphs.length;nParaIndex0;CurPage--)if(this.Pages[CurPage].EndPos>=StartIndex&&this.Pages[CurPage].Pos<= StartIndex)break;return CurPage+1};CDocument.prototype.Get_SectionPageNumInfo=function(Page_abs){var PageNumInfo=this.Get_SectionPageNumInfo2(Page_abs);var FP=PageNumInfo.FirstPage;var CP=PageNumInfo.CurPage;var bCheckFP=true;var SectIndex=PageNumInfo.SectIndex;if(SectIndex>0){var CurSectInfo=this.SectionsInfo.Get_SectPr2(SectIndex);var PrevSectInfo=this.SectionsInfo.Get_SectPr2(SectIndex-1);if(CurSectInfo!==PrevSectInfo&&c_oAscSectionBreakType.Continuous===CurSectInfo.SectPr.Get_Type()&&true===CurSectInfo.SectPr.Compare_PageSize(PrevSectInfo.SectPr)){var ElementIndex= PrevSectInfo.Index;if(ElementIndex0){SectIndex--;FirstPage=this.Get_SectionFirstPage(SectIndex,Page_abs);PageNumStart=this.SectionsInfo.Get_SectPr2(SectIndex).SectPr.Get_PageNum_Start();BreakType=this.SectionsInfo.Get_SectPr2(SectIndex).SectPr.Get_Type(); StartInfo.push({FirstPage:FirstPage,BreakType:BreakType})}if(PageNumStart<0)PageNumStart=1;var InfoCount=StartInfo.length;var InfoIndex=InfoCount-1;var FP=StartInfo[InfoIndex].FirstPage;var BT=StartInfo[InfoIndex].BreakType;var PrevFP=StartInfo[InfoIndex].FirstPage;while(InfoIndex>=0){FP=StartInfo[InfoIndex].FirstPage;BT=StartInfo[InfoIndex].BreakType;PageNumStart+=FP-PrevFP;PrevFP=FP;if(c_oAscSectionBreakType.OddPage===BT&&0===PageNumStart%2||c_oAscSectionBreakType.EvenPage===BT&&1===PageNumStart% 2)PageNumStart++;InfoIndex--}if(FP>Page_abs)Page_abs=FP;var _FP=PageNumStart;var _CP=PageNumStart+Page_abs-FP;return{FirstPage:_FP,CurPage:_CP,SectIndex:StartSectIndex}};CDocument.prototype.Get_SectionHdrFtr=function(Page_abs,_bFirst,_bEven){var StartIndex=this.Pages[Page_abs].Pos;var SectIndex=this.SectionsInfo.Get_Index(StartIndex);var CurSectPr=this.SectionsInfo.Get_SectPr2(SectIndex).SectPr;var bEven=true===_bEven&&true===EvenAndOddHeaders?true:false;var bFirst=true===_bFirst&&true===CurSectPr.TitlePage? true:false;var CurSectIndex=SectIndex;var Header=null,Footer=null;while(CurSectIndex>=0){var SectPr=this.SectionsInfo.Get_SectPr2(CurSectIndex).SectPr;if(null===Header)if(true===bFirst)Header=SectPr.Get_Header_First();else if(true===bEven)Header=SectPr.Get_Header_Even();else Header=SectPr.Get_Header_Default();if(null===Footer)if(true===bFirst)Footer=SectPr.Get_Footer_First();else if(true===bEven)Footer=SectPr.Get_Footer_Even();else Footer=SectPr.Get_Footer_Default();if(null!==Header&&null!==Footer)break; CurSectIndex--}return{Header:Header,Footer:Footer,SectPr:CurSectPr}};CDocument.prototype.Create_SectionHdrFtr=function(Type,PageIndex){var SectionPageInfo=this.Get_SectionPageNumInfo(PageIndex);var _bFirst=SectionPageInfo.bFirst;var _bEven=SectionPageInfo.bEven;var StartIndex=this.Pages[PageIndex].Pos;var SectIndex=this.SectionsInfo.Get_Index(StartIndex);var CurSectPr=this.SectionsInfo.Get_SectPr2(SectIndex).SectPr;var bEven=true===_bEven&&true===EvenAndOddHeaders?true:false;var bFirst=true===_bFirst&& true===CurSectPr.TitlePage?true:false;var SectPr=this.SectionsInfo.Get_SectPr2(0).SectPr;var HdrFtr=new CHeaderFooter(this.HdrFtr,this,this.DrawingDocument,Type);if(hdrftr_Header===Type)if(true===bFirst)SectPr.Set_Header_First(HdrFtr);else if(true===bEven)SectPr.Set_Header_Even(HdrFtr);else SectPr.Set_Header_Default(HdrFtr);else if(true===bFirst)SectPr.Set_Footer_First(HdrFtr);else if(true===bEven)SectPr.Set_Footer_Even(HdrFtr);else SectPr.Set_Footer_Default(HdrFtr);return HdrFtr};CDocument.prototype.On_SectionChange= function(_SectPr){var Index=this.SectionsInfo.Find(_SectPr);if(-1===Index)return;var SectPr=null;var HeaderF=null,HeaderD=null,HeaderE=null,FooterF=null,FooterD=null,FooterE=null;while(Index>=0){SectPr=this.SectionsInfo.Get_SectPr2(Index).SectPr;if(null===HeaderF)HeaderF=SectPr.Get_Header_First();if(null===HeaderD)HeaderD=SectPr.Get_Header_Default();if(null===HeaderE)HeaderE=SectPr.Get_Header_Even();if(null===FooterF)FooterF=SectPr.Get_Footer_First();if(null===FooterD)FooterD=SectPr.Get_Footer_Default(); if(null===FooterE)FooterE=SectPr.Get_Footer_Even();Index--}if(null!==HeaderF)HeaderF.Refresh_RecalcData_BySection(_SectPr);if(null!==HeaderD)HeaderD.Refresh_RecalcData_BySection(_SectPr);if(null!==HeaderE)HeaderE.Refresh_RecalcData_BySection(_SectPr);if(null!==FooterF)FooterF.Refresh_RecalcData_BySection(_SectPr);if(null!==FooterD)FooterD.Refresh_RecalcData_BySection(_SectPr);if(null!==FooterE)FooterE.Refresh_RecalcData_BySection(_SectPr)};CDocument.prototype.Create_HdrFtrWidthPageNum=function(PageIndex, AlignV,AlignH){var SectionPageInfo=this.Get_SectionPageNumInfo(PageIndex);var bFirst=SectionPageInfo.bFirst;var bEven=SectionPageInfo.bEven;var HdrFtr=this.Get_SectionHdrFtr(PageIndex,bFirst,bEven);switch(AlignV){case hdrftr_Header:{var Header=HdrFtr.Header;if(null===Header)Header=this.Create_SectionHdrFtr(hdrftr_Header,PageIndex);Header.AddPageNum(AlignH);break}case hdrftr_Footer:{var Footer=HdrFtr.Footer;if(null===Footer)Footer=this.Create_SectionHdrFtr(hdrftr_Footer,PageIndex);Footer.AddPageNum(AlignH); break}}this.Recalculate()};CDocument.prototype.GetCurrentSectionPr=function(){var oSectPr=this.Controller.GetCurrentSectionPr();if(null===oSectPr)return this.controller_GetCurrentSectionPr();return oSectPr};CDocument.prototype.GetFirstElementInSection=function(SectionIndex){if(SectionIndex<=0)return this.Content[0]?this.Content[0]:null;var nElementPos=this.SectionsInfo.Get_SectPr2(SectionIndex-1).Index+1;return this.Content[nElementPos]?this.Content[nElementPos]:null};CDocument.prototype.GetSectionIndexByElementIndex= function(ElementIndex){return this.SectionsInfo.Get_Index(ElementIndex)};CDocument.prototype.GetSectionsCount=function(){return this.SectionsInfo.GetSectionsCount()};CDocument.prototype.SetUseTextShd=function(isUse){this.UseTextShd=isUse};CDocument.prototype.RecalculateFromStart=function(bUpdateStates){var RecalculateData={Inline:{Pos:0,PageNum:0},Flow:[],HdrFtr:[],Drawings:{All:true,Map:{}},Tables:[]};this.Reset_RecalculateCache();this.RecalculateWithParams(RecalculateData,true);if(true===bUpdateStates){this.Document_UpdateInterfaceState(); this.Document_UpdateSelectionState()}};CDocument.prototype.Register_Field=function(oField){this.FieldsManager.Register_Field(oField)};CDocument.prototype.Is_MailMergePreviewResult=function(){return this.MailMergePreview};CDocument.prototype.Is_HighlightMailMergeFields=function(){return this.MailMergeFieldsHighlight};CDocument.prototype.CompareDrawingsLogicPositions=function(Drawing1,Drawing2){var ParentPara1=Drawing1.GetParagraph();var ParentPara2=Drawing2.GetParagraph();if(!ParentPara1||!ParentPara2|| !ParentPara1.Parent||!ParentPara2.Parent)return 0;var TopDocument1=ParentPara1.Parent.Is_TopDocument(true);var TopDocument2=ParentPara2.Parent.Is_TopDocument(true);if(TopDocument1!==TopDocument2||!TopDocument1)return 0;var TopElement1=ParentPara1.GetTopElement();var TopElement2=ParentPara2.GetTopElement();if(!TopElement1||!TopElement2)return 0;var TopIndex1=TopElement1.Get_Index();var TopIndex2=TopElement2.Get_Index();if(TopIndex1TopIndex2)return-1;if(undefined!== TopDocument1.Content[TopIndex1]){var CompareEngine=new CDocumentCompareDrawingsLogicPositions(Drawing1,Drawing2);TopDocument1.Content[TopIndex1].CompareDrawingsLogicPositions(CompareEngine);return CompareEngine.Result}return 0};CDocument.prototype.GetTopElement=function(){return null};CDocument.prototype.private_StopSelection=function(){this.Selection.Start=false};CDocument.prototype.private_UpdateCurPage=function(){if(true===this.TurnOffRecalcCurPos)return;this.private_CheckCurPage()};CDocument.prototype.private_UpdateCursorXY= function(bUpdateX,bUpdateY,isUpdateTarget){if(undefined===isUpdateTarget)isUpdateTarget=true;this.private_UpdateCurPage();var NewCursorPos=null;if(true!==this.IsSelectionUse()||true===this.IsSelectionEmpty()){this.DrawingDocument.UpdateTargetTransform(null);NewCursorPos=this.Controller.RecalculateCurPos(bUpdateX,bUpdateY,isUpdateTarget);if(NewCursorPos&&NewCursorPos.Transform){var x=NewCursorPos.Transform.TransformPointX(NewCursorPos.X,NewCursorPos.Y);var y=NewCursorPos.Transform.TransformPointY(NewCursorPos.X, NewCursorPos.Y);NewCursorPos.X=x;NewCursorPos.Y=y}}else{var SelectionBounds=this.GetSelectionBounds();if(null!==SelectionBounds){NewCursorPos={};if(-1===SelectionBounds.Direction){NewCursorPos.X=SelectionBounds.Start.X;NewCursorPos.Y=SelectionBounds.Start.Y;if(this.CurPageSelectionBounds.End.Page)NewCursorPos.Y= 0}}}if(null===NewCursorPos||undefined===NewCursorPos)return;if(bUpdateX)this.CurPos.RealX=NewCursorPos.X;if(bUpdateY)this.CurPos.RealY=NewCursorPos.Y;if(true===this.Selection.Use&&true!==this.Selection.Start)this.private_OnSelectionEnd();this.private_CheckCursorInPlaceHolder()};CDocument.prototype.private_MoveCursorDown=function(StartX,StartY,AddToSelect){var StartPage=this.CurPage;var CurY=StartY;if(StartPage>=this.Pages.length)return true;var PageH=this.Pages[this.CurPage].Height;this.TurnOff_InterfaceEvents(); this.CheckEmptyElementsOnSelection=false;var Result=false;while(true){CurY+=.1;if(CurY>PageH||this.CurPage>StartPage){this.CurPage=StartPage;if(this.Pages.length-1<=this.CurPage){Result=false;break}else{this.CurPage++;StartY=0;var NewPage=this.CurPage;var bBreak=false;while(true){this.MoveCursorToXY(StartX,StartY,AddToSelect);this.private_UpdateCursorXY(false,true,false);if(this.CurPagethis.Pages[NewPage].Height){NewPage++;if(this.Pages.length-1StartY+.001){Result=true;break}}this.CheckEmptyElementsOnSelection=true;this.TurnOn_InterfaceEvents(true);this.private_UpdateCursorXY(false,true,true);return Result};CDocument.prototype.private_MoveCursorUp=function(StartX,StartY,AddToSelect){var StartPage= this.CurPage;var CurY=StartY;if(StartPage>=this.Pages.length)return true;var PageH=this.Pages[this.CurPage].Height;this.TurnOff_InterfaceEvents();this.CheckEmptyElementsOnSelection=false;var Result=false;while(true){CurY-=.1;if(CurY<0||this.CurPageNewPage){this.CurPage=NewPage;StartY-=.1;if(StartY<0)if(0===this.CurPage){Result=false;bBreak=true;break}else{this.CurPage--;StartY=this.Pages[this.CurPage].Height;NewPage=this.CurPage}}else{Result=true;bBreak=true;break}}if(false===Result||true===bBreak)break;CurY=StartY}}this.MoveCursorToXY(StartX,CurY,AddToSelect);this.private_UpdateCursorXY(false,true,false);if(this.CurPos.RealY=this.Pages.length-1){this.MoveCursorToXY(0,0,false);this.private_UpdateCursorXY(false,true);return}this.CurPage++;StartX=0;StartY=0}else if(this.CurPage>= this.Pages.length){this.CurPage=this.Pages.length-1;var LastElement=this.Content[this.Pages[this.CurPage].EndPos];Dy=LastElement.GetPageBounds(LastElement.GetPagesCount()-1).Bottom;StartPage=this.CurPage}else{Dy=this.DrawingDocument.GetVisibleMMHeight();if(StartY+Dy>this.Get_PageLimits(this.CurPage).YLimit){this.CurPage++;var PageH=this.Get_PageLimits(this.CurPage).YLimit;Dy-=PageH-StartY;StartY=0;while(Dy>PageH){Dy-=PageH;this.CurPage++}if(this.CurPage>=this.Pages.length){this.CurPage=this.Pages.length- 1;var LastElement=this.Content[this.Pages[this.CurPage].EndPos];Dy=LastElement.GetPageBounds(LastElement.GetPagesCount()-1).Bottom}StartPage=this.CurPage}}this.MoveCursorToXY(StartX,StartY+Dy,AddToSelect);this.private_UpdateCursorXY(false,true);if(this.CurPage>StartPage||this.CurPos.RealY>StartY+.001&&this.CurPage===StartPage)return true;return this.private_MoveCursorDown(this.CurPos.RealX,this.CurPos.RealY,AddToSelect)};CDocument.prototype.MoveCursorPageUp=function(AddToSelect,PrevPage){if(this.Pages.length<= 0)return;if(true===this.IsSelectionUse()&&true!==AddToSelect)this.MoveCursorRight(false,false);var bStopSelection=false;if(true!==this.IsSelectionUse()&&true===AddToSelect&&true!==PrevPage){bStopSelection=true;this.StartSelectionFromCurPos()}this.private_UpdateCursorXY(false,true);var Result=this.private_MoveCursorPageUp(this.CurPos.RealX,this.CurPos.RealY,AddToSelect,PrevPage);if(true===AddToSelect&&true!==PrevPage&&true!==Result)this.MoveCursorToEndPos(true);if(bStopSelection)this.private_StopSelection()}; CDocument.prototype.private_MoveCursorPageUp=function(StartX,StartY,AddToSelect,PrevPage){if(this.Pages.length<=0)return true;if(this.CurPage>=this.Pages.length){this.CurPage=this.Pages.length-1;var LastElement=this.Content[this.Pages[this.CurPage].EndPos];StartY=LastElement.GetPageBounds(LastElement.GetPagesCount()-1).Bottom}var Dy=0;var StartPage=this.CurPage;if(PrevPage){if(this.CurPage<=0){this.MoveCursorToXY(0,0,false);this.private_UpdateCursorXY(false,true);return}this.CurPage--;StartX=0;StartY= 0}else{Dy=this.DrawingDocument.GetVisibleMMHeight();if(StartY-Dy<0){this.CurPage--;var PageH=this.Get_PageLimits(this.CurPage).YLimit;Dy-=StartY;StartY=PageH;while(Dy>PageH){Dy-=PageH;this.CurPage--}if(this.CurPage<0){this.CurPage=0;var oElement=this.Content[0];Dy=PageH-oElement.GetPageBounds(oElement.GetPagesCount()-1).Top}StartPage=this.CurPage}}this.MoveCursorToXY(StartX,StartY-Dy,AddToSelect);this.private_UpdateCursorXY(false,true);if(this.CurPage0))return[];this.GetAllSeqFieldsByType(sCaption,aFields);var aParagraphs=[];for(var nField=0;nField1E3){this.NeedUpdateTargetForCollaboration=false;if(true!==HaveChanges){var CursorInfo=this.History.Get_DocumentPositionBinary();if(null!==CursorInfo){this.Api.CoAuthoringApi.sendCursor(CursorInfo); this.LastUpdateTargetTime=CurTime}}else this.LastUpdateTargetTime=CurTime}};CDocument.prototype.Save_DocumentStateBeforeLoadChanges=function(isRemoveSelection){var State={};State.CurPos={X:this.CurPos.X,Y:this.CurPos.Y,RealX:this.CurPos.RealX,RealY:this.CurPos.RealY,Type:this.CurPos.Type};State.Selection={Start:this.Selection.Start,Use:this.Selection.Use,Flag:this.Selection.Flag,UpdateOnRecalc:this.Selection.UpdateOnRecalc,DragDrop:{Flag:this.Selection.DragDrop.Flag,Data:null===this.Selection.DragDrop.Data? null:{X:this.Selection.DragDrop.Data.X,Y:this.Selection.DragDrop.Data.Y,PageNum:this.Selection.DragDrop.Data.PageNum}}};State.SingleCell=this.GetSelectedElementsInfo().GetSingleCell();State.Pos=[];State.StartPos=[];State.EndPos=[];this.Controller.SaveDocumentStateBeforeLoadChanges(State);if(false!==isRemoveSelection)this.RemoveSelection();this.CollaborativeEditing.WatchDocumentPositionsByState(State);return State};CDocument.prototype.Load_DocumentStateAfterLoadChanges=function(State){this.CollaborativeEditing.UpdateDocumentPositionsByState(State); this.RemoveSelection();this.CurPos.X=State.CurPos.X;this.CurPos.Y=State.CurPos.Y;this.CurPos.RealX=State.CurPos.RealX;this.CurPos.RealY=State.CurPos.RealY;this.SetDocPosType(State.CurPos.Type);this.Selection.Start=State.Selection.Start;this.Selection.Use=State.Selection.Use;this.Selection.Flag=State.Selection.Flag;this.Selection.UpdateOnRecalc=State.Selection.UpdateOnRecalc;this.Selection.DragDrop.Flag=State.Selection.DragDrop.Flag;this.Selection.DragDrop.Data=State.Selection.DragDrop.Data===null? null:{X:State.Selection.DragDrop.Data.X,Y:State.Selection.DragDrop.Data.Y,PageNum:State.Selection.DragDrop.Data.PageNum};this.Controller.RestoreDocumentStateAfterLoadChanges(State);if(true===this.Selection.Use&&null!==State.SingleCell&&undefined!==State.SingleCell){var Cell=State.SingleCell;var Table=Cell.Get_Table();if(Table&&true===Table.Is_UseInDocument()){Table.Set_CurCell(Cell);Table.RemoveSelection();Table.SelectTable(c_oAscTableSelectionType.Cell)}}this.UpdateSelection()};CDocument.prototype.SaveDocumentState= function(isRemoveSelection){return this.Save_DocumentStateBeforeLoadChanges(isRemoveSelection)};CDocument.prototype.LoadDocumentState=function(oState){return this.Load_DocumentStateAfterLoadChanges(oState)};CDocument.prototype.SetContentSelection=function(StartDocPos,EndDocPos,Depth,StartFlag,EndFlag){if(0===StartFlag&&(!StartDocPos[Depth]||this!==StartDocPos[Depth].Class)||0===EndFlag&&(!EndDocPos[Depth]||this!==EndDocPos[Depth].Class))return;var StartPos=0,EndPos=0;switch(StartFlag){case 0:StartPos= StartDocPos[Depth].Position;break;case 1:StartPos=0;break;case -1:StartPos=this.Content.length-1;break}switch(EndFlag){case 0:EndPos=EndDocPos[Depth].Position;break;case 1:EndPos=0;break;case -1:EndPos=this.Content.length-1;break}var _StartDocPos=StartDocPos,_StartFlag=StartFlag;if(null!==StartDocPos&&true===StartDocPos[Depth].Deleted)if(StartPos0){StartPos--;_StartDocPos=null;_StartFlag=-1}else return;var _EndDocPos=EndDocPos, _EndFlag=EndFlag;if(null!==EndDocPos&&true===EndDocPos[Depth].Deleted)if(EndPos0){EndPos--;_EndDocPos=null;_EndFlag=-1}else return;this.Selection.StartPos=StartPos;this.Selection.EndPos=EndPos;if(StartPos!==EndPos){this.Content[StartPos].SetContentSelection(_StartDocPos,null,Depth+1,_StartFlag,StartPos>EndPos?1:-1);this.Content[EndPos].SetContentSelection(null,_EndDocPos,Depth+1,StartPos>EndPos?-1:1,_EndFlag);var _StartPos=StartPos;var _EndPos= EndPos;var Direction=1;if(_StartPos>_EndPos){_StartPos=EndPos;_EndPos=StartPos;Direction=-1}for(var CurPos=_StartPos+1;CurPos<_EndPos;CurPos++)this.Content[CurPos].SelectAll(Direction)}else this.Content[StartPos].SetContentSelection(_StartDocPos,_EndDocPos,Depth+1,_StartFlag,_EndFlag)};CDocument.prototype.GetContentPosition=function(bSelection,bStart,PosArray){if(undefined===PosArray)PosArray=[];var oSelection=this.private_GetSelectionPos();var Pos=true===bSelection?true===bStart?oSelection.Start: oSelection.End:this.CurPos.ContentPos;PosArray.push({Class:this,Position:Pos});if(undefined!==this.Content[Pos]&&this.Content[Pos].GetContentPosition)this.Content[Pos].GetContentPosition(bSelection,bStart,PosArray);return PosArray};CDocument.prototype.SetContentPosition=function(DocPos,Depth,Flag){if(0===Flag&&(!DocPos[Depth]||this!==DocPos[Depth].Class))return;var Pos=0;switch(Flag){case 0:Pos=DocPos[Depth].Position;break;case 1:Pos=0;break;case -1:Pos=this.Content.length-1;break}var _DocPos=DocPos, _Flag=Flag;if(null!==DocPos&&true===DocPos[Depth].Deleted)if(Pos0){Pos--;_DocPos=null;_Flag=-1}else return;this.CurPos.ContentPos=Pos;if(this.Content[Pos])this.Content[Pos].SetContentPosition(_DocPos,Depth+1,_Flag)};CDocument.prototype.GetDocumentPositionFromObject=function(arrPos){if(!arrPos)arrPos=[];return arrPos};CDocument.prototype.Get_CursorLogicPosition=function(){var nDocPosType=this.GetDocPosType();if(docpostype_HdrFtr===nDocPosType){var HdrFtr= this.HdrFtr.Get_CurHdrFtr();if(HdrFtr)return this.private_GetLogicDocumentPosition(HdrFtr.Get_DocumentContent())}else if(docpostype_Footnotes===nDocPosType){var oFootnote=this.Footnotes.GetCurFootnote();if(oFootnote)return this.private_GetLogicDocumentPosition(oFootnote)}else if(docpostype_Endnotes===nDocPosType){var oEndnote=this.Endnotes.GetCurEndnote();if(oEndnote)return this.private_GetLogicDocumentPosition(oEndnote)}else return this.private_GetLogicDocumentPosition(this);return null};CDocument.prototype.private_GetLogicDocumentPosition= function(LogicDocument){if(!LogicDocument)return null;if(docpostype_DrawingObjects===LogicDocument.GetDocPosType()){var ParaDrawing=this.DrawingObjects.getMajorParaDrawing();var DrawingContent=this.DrawingObjects.getTargetDocContent();if(!ParaDrawing)return null;if(DrawingContent)return DrawingContent.GetContentPosition(DrawingContent.IsSelectionUse(),false);else{var Run=ParaDrawing.Get_Run();if(null===Run)return null;var DrawingInRunPos=Run.Get_DrawingObjectSimplePos(ParaDrawing.Get_Id());if(-1=== DrawingInRunPos)return null;var DocPos=[{Class:Run,Position:DrawingInRunPos}];Run.GetDocumentPositionFromObject(DocPos);return DocPos}}else return LogicDocument.GetContentPosition(LogicDocument.IsSelectionUse(),false)};CDocument.prototype.Get_DocumentPositionInfoForCollaborative=function(){var DocPos=this.Get_CursorLogicPosition();if(!DocPos||DocPos.length<=0)return null;var Last=DocPos[DocPos.length-1];if(!(Last.Class instanceof ParaRun))return null;return Last};CDocument.prototype.Update_ForeignCursor= function(CursorInfo,UserId,Show,UserShortId){if(!this.Api.User)return;if(UserId===this.Api.CoAuthoringApi.getUserConnectionId())return;if(!CursorInfo||""===CursorInfo){this.Remove_ForeignCursor(UserId);return}var Changes=new AscCommon.CCollaborativeChanges;var Reader=Changes.GetStream(CursorInfo,0,CursorInfo.length);var RunId=Reader.GetString2();var InRunPos=Reader.GetLong();var Run=this.TableId.Get_ById(RunId);if(!Run){this.Remove_ForeignCursor(UserId);return}var CursorPos=[{Class:Run,Position:InRunPos}]; Run.GetDocumentPositionFromObject(CursorPos);this.CollaborativeEditing.Add_ForeignCursor(UserId,CursorPos,UserShortId);if(true===Show)this.CollaborativeEditing.Update_ForeignCursorPosition(UserId,Run,InRunPos,true)};CDocument.prototype.Remove_ForeignCursor=function(UserId){this.CollaborativeEditing.Remove_ForeignCursor(UserId)};CDocument.prototype.private_UpdateTargetForCollaboration=function(){this.NeedUpdateTargetForCollaboration=true};CDocument.prototype.GetHdrFtr=function(){return this.HdrFtr}; CDocument.prototype.Get_DrawingDocument=function(){return this.DrawingDocument};CDocument.prototype.GetDrawingDocument=function(){return this.DrawingDocument};CDocument.prototype.GetDrawingObjects=function(){return this.DrawingObjects};CDocument.prototype.Get_Api=function(){return this.Api};CDocument.prototype.GetApi=function(){return this.Api};CDocument.prototype.Get_IdCounter=function(){return this.IdCounter};CDocument.prototype.GetIdCounter=function(){return this.IdCounter};CDocument.prototype.Get_TableId= function(){return this.TableId};CDocument.prototype.GetTableId=function(){return this.TableId};CDocument.prototype.Get_History=function(){return this.History};CDocument.prototype.GetHistory=function(){return this.History};CDocument.prototype.Get_CollaborativeEditing=function(){return this.CollaborativeEditing};CDocument.prototype.GetDocumentOutline=function(){return this.DocumentOutline};CDocument.prototype.private_CorrectDocumentPosition=function(){if(this.CurPos.ContentPos<0||this.CurPos.ContentPos>= this.Content.length){this.RemoveSelection();if(this.CurPos.ContentPos<0){this.CurPos.ContentPos=0;this.Content[0].MoveCursorToStartPos(false)}else{this.CurPos.ContentPos=this.Content.length-1;this.Content[this.CurPos.ContentPos].MoveCursorToEndPos(false)}}};CDocument.prototype.private_ToggleParagraphAlignByHotkey=function(Align){var SelectedInfo=this.GetSelectedElementsInfo();var Math=SelectedInfo.GetMath();if(null!==Math&&true!==Math.Is_Inline()){var MathAlign=Math.Get_Align();if(Align!==MathAlign)if(false=== this.Document_Is_SelectionLocked(changestype_Paragraph_Content)){this.StartAction(AscDFH.historydescription_Document_SetParagraphAlignHotKey);Math.Set_Align(Align);this.Recalculate();this.UpdateInterface();this.FinalizeAction()}}else{var ParaPr=this.GetCalculatedParaPr();if(null!=ParaPr)if(false===this.Document_Is_SelectionLocked(AscCommon.changestype_Paragraph_Properties)){this.StartAction(AscDFH.historydescription_Document_SetParagraphAlignHotKey);this.SetParagraphAlign(ParaPr.Jc===Align?Align=== align_Left?AscCommon.align_Justify:align_Left:Align);this.UpdateInterface();this.FinalizeAction()}}};CDocument.prototype.Is_ShowParagraphMarks=function(){return this.Api.ShowParaMarks};CDocument.prototype.Set_ShowParagraphMarks=function(isShow,isRedraw){this.Api.ShowParaMarks=isShow;if(true===isRedraw){this.DrawingDocument.ClearCachePages();this.DrawingDocument.FirePaint()}};CDocument.prototype.Get_StyleNameById=function(StyleId){if(!this.Styles)return"";var Style=this.Styles.Get(StyleId);if(!Style)return""; return Style.Get_Name()};CDocument.prototype.private_GetElementPageIndex=function(ElementPos,PageIndex,ColumnIndex,ColumnsCount){var Element=this.Content[ElementPos];if(!Element)return 0;var StartPage=Element.Get_StartPage_Relative();var StartColumn=Element.Get_StartColumn();return ColumnIndex-StartColumn+(PageIndex-StartPage)*ColumnsCount};CDocument.prototype.private_GetElementPageIndexByXY=function(ElementPos,X,Y,PageIndex){var Element=this.Content[ElementPos];if(!Element)return 0;var Page=this.Pages[PageIndex]; if(!Page)return 0;var PageSection=null;for(var SectionIndex=0,SectionsCount=Page.Sections.length;SectionIndexStartColumn)EndColumn--;var ResultColumn=EndColumn;for(var ColumnIndex=StartColumn;ColumnIndex=Page.Sections.length)return 0;return SectionIndex};CDocument.prototype.Update_ColumnsMarkupFromRuler=function(oNewMarkup){var oSectPr=oNewMarkup.SectPr;if(!oSectPr)return;if(false===this.Document_Is_SelectionLocked(AscCommon.changestype_Document_SectPr)){this.StartAction(AscDFH.historydescription_Document_SetColumnsFromRuler); oSectPr.Set_Columns_EqualWidth(oNewMarkup.EqualWidth);var nLeft=oNewMarkup.X;var nRight=oSectPr.GetPageWidth()-oNewMarkup.R;if(this.IsMirrorMargins()&&1===oNewMarkup.PageIndex%2){nLeft=oSectPr.GetPageWidth()-oNewMarkup.R;nRight=oNewMarkup.X}var nGutter=oSectPr.GetGutter();if(nGutter>.001&&!this.IsGutterAtTop())if(oSectPr.IsGutterRTL())nRight=Math.max(0,nRight-nGutter);else nLeft=Math.max(0,nLeft-nGutter);oSectPr.SetPageMargins(nLeft,undefined,nRight,undefined);if(false===oNewMarkup.EqualWidth)for(var Index= 0,Count=oNewMarkup.Cols.length;Index0&&(type_Paragraph!==this.Content[nStartPos-1].GetType()||!this.Content[nStartPos-1].Get_SectionPr())){var oSectPr=new CSectionPr(this);oSectPr.Copy(oStartSectPr,false);var oStartParagraph=new Paragraph(this.DrawingDocument,this);this.Add_ToContent(nStartPos,oStartParagraph); oStartParagraph.Set_SectionPr(oSectPr,true);nStartPos++;nEndPos++}if(nEndPos!==this.Content.length-1){oEndSectPr.Set_Type(c_oAscSectionBreakType.Continuous);var oSectPr=new CSectionPr(this);oSectPr.Copy(oEndSectPr,false);oEndParagraph.Set_SectionPr(oSectPr,true);oSectPr.SetColumnProps(ColumnsProps)}else{oEndSectPr.Set_Type(c_oAscSectionBreakType.Continuous);oEndSectPr.SetColumnProps(ColumnsProps)}for(var nIndex=nStartPos;nIndex=0){this.Selection.StartPos=nStartPos;this.Selection.EndPos=nEndPos}else{this.Selection.StartPos=nEndPos;this.Selection.EndPos=nStartPos}this.Recalculate();this.UpdateSelection();this.UpdateInterface();this.UpdateRulers();this.FinalizeAction()}else{var CurPos=this.CurPos.ContentPos;var SectPr=this.SectionsInfo.Get_SectPr(CurPos).SectPr;if(!SectPr)return;if(false===this.Document_Is_SelectionLocked(AscCommon.changestype_Document_SectPr)){this.StartAction(AscDFH.historydescription_Document_SetColumnsProps); SectPr.SetColumnProps(ColumnsProps);this.Recalculate();this.UpdateSelection();this.UpdateInterface();this.UpdateRulers();this.FinalizeAction()}}};CDocument.prototype.GetTopDocumentContent=function(isOneLevel){return this};CDocument.prototype.private_RecalculateNumbering=function(Elements){if(true===AscCommon.g_oIdCounter.m_bLoad)return;for(var Index=0,Count=Elements.length;Index1){var oParagraph=this.GetCurrentParagraph();if(!oParagraph)return 0;var nCurrentColumn=oParagraph.Get_CurrentColumn();return oSectPr.Get_ColumnWidth(nCurrentColumn)}return oSectPr.GetContentFrameWidth()};CDocument.prototype.Get_FirstParagraph=function(){if(type_Paragraph==this.Content[0].GetType())return this.Content[0]; else if(type_Table==this.Content[0].GetType())return this.Content[0].Get_FirstParagraph();return null};CDocument.prototype.IncreaseIndent=function(){if(false===this.Document_Is_SelectionLocked(AscCommon.changestype_Paragraph_Properties)){this.StartAction(AscDFH.historydescription_Document_IncParagraphIndent);this.IncreaseDecreaseIndent(true);this.UpdateSelection();this.UpdateInterface();this.Recalculate();this.FinalizeAction()}};CDocument.prototype.DecreaseIndent=function(){if(false===this.Document_Is_SelectionLocked(AscCommon.changestype_Paragraph_Properties)){this.StartAction(AscDFH.historydescription_Document_DecParagraphIndent); this.IncreaseDecreaseIndent(false);this.UpdateSelection();this.UpdateInterface();this.Recalculate();this.FinalizeAction()}};CDocument.prototype.GetColumnSize=function(){return this.Controller.GetColumnSize()};CDocument.prototype.private_OnSelectionEnd=function(){this.Api.sendEvent("asc_onSelectionEnd")};CDocument.prototype.AddPageCount=function(){if(false===this.Document_Is_SelectionLocked(changestype_Paragraph_Content)){this.StartAction(AscDFH.historydescription_Document_AddPageCount);this.AddToParagraph(new ParaPageCount(this.Pages.length)); this.FinalizeAction()}};CDocument.prototype.GetCompatibilityMode=function(){return this.Settings.CompatibilityMode};CDocument.prototype.GetSdtGlobalColor=function(){return this.Settings.SdtSettings.Color};CDocument.prototype.SetSdtGlobalColor=function(r,g,b){var oNewColor=new CDocumentColor(r,g,b);if(!oNewColor.Compare(this.Settings.SdtSettings.Color)){var oNewSettings=this.Settings.SdtSettings.Copy();oNewSettings.Color=oNewColor;this.History.Add(new CChangesDocumentSdtGlobalSettings(this,this.Settings.SdtSettings, oNewSettings));this.Settings.SdtSettings=oNewSettings;this.OnChangeSdtGlobalSettings()}};CDocument.prototype.GetSdtGlobalShowHighlight=function(){return this.Settings.SdtSettings.ShowHighlight};CDocument.prototype.SetSdtGlobalShowHighlight=function(isShow){if(this.Settings.SdtSettings.ShowHighlight!==isShow){var oNewSettings=this.Settings.SdtSettings.Copy();oNewSettings.ShowHighlight=isShow;this.History.Add(new CChangesDocumentSdtGlobalSettings(this,this.Settings.SdtSettings,oNewSettings));this.Settings.SdtSettings= oNewSettings;this.OnChangeSdtGlobalSettings()}};CDocument.prototype.OnChangeSdtGlobalSettings=function(){this.GetApi().sync_OnChangeSdtGlobalSettings()};CDocument.prototype.IsSplitPageBreakAndParaMark=function(){return this.Settings.SplitPageBreakAndParaMark};CDocument.prototype.IsDoNotExpandShiftReturn=function(){return this.Settings.DoNotExpandShiftReturn};CDocument.prototype.IsSdtGlobalSettingsDefault=function(){return this.Settings.SdtSettings.IsDefault()};CDocument.prototype.GetSpecialFormsHighlight= function(){return this.Settings.SpecialFormsSettings.Highlight};CDocument.prototype.SetSpecialFormsHighlight=function(r,g,b){if((undefined===r||null===r)&&undefined!==this.Settings.SpecialFormsSettings.Highlight){var oNewSettings=this.Settings.SpecialFormsSettings.Copy();oNewSettings.Highlight=undefined;this.History.Add(new CChangesDocumentSpecialFormsGlobalSettings(this,this.Settings.SpecialFormsSettings,oNewSettings));this.Settings.SpecialFormsSettings=oNewSettings;this.OnChangeSpecialFormsGlobalSettings()}else if(undefined!== r&&null!==r){var oNewColor=new CDocumentColor(r,g,b);if(!oNewColor.IsEqual(this.Settings.SpecialFormsSettings.Highlight)){var oNewSettings=this.Settings.SpecialFormsSettings.Copy();oNewSettings.Highlight=oNewColor;this.History.Add(new CChangesDocumentSpecialFormsGlobalSettings(this,this.Settings.SpecialFormsSettings,oNewSettings));this.Settings.SpecialFormsSettings=oNewSettings;this.OnChangeSpecialFormsGlobalSettings()}}};CDocument.prototype.OnChangeSpecialFormsGlobalSettings=function(){this.GetApi().sync_OnChangeSpecialFormsGlobalSettings()}; CDocument.prototype.IsSpecialFormsSettingsDefault=function(){return this.Settings.SpecialFormsSettings.IsDefault()};CDocument.prototype.private_SetCurrentSpecialForm=function(oForm){if(this.CurrentForm===oForm)return false;if(this.CurrentForm)this.CurrentForm.SetCurrent(false);this.CurrentForm=oForm;if(this.CurrentForm)this.CurrentForm.SetCurrent(true);return true};CDocument.prototype.AddContentControlCheckBox=function(oPr){this.RemoveTextSelection();if(!oPr)oPr=new CSdtCheckBoxPr;var oTextPr=this.GetDirectTextPr(); var oCC=this.AddContentControl(c_oAscSdtLevelType.Inline);if(!oCC)return;oCC.ApplyCheckBoxPr(oPr,oTextPr);oCC.MoveCursorToStartPos();this.UpdateSelection();this.UpdateTracks();return oCC};CDocument.prototype.AddContentControlPicture=function(){this.RemoveTextSelection();var oCC=this.AddContentControl(c_oAscSdtLevelType.Inline);if(!oCC)return null;oCC.SetPlaceholderText(AscCommon.translateManager.getValue("Click to load image"));oCC.ApplyPicturePr(true);return oCC};CDocument.prototype.AddContentControlComboBox= function(oPr){this.RemoveTextSelection();if(!oPr){oPr=new CSdtComboBoxPr;oPr.AddItem(AscCommon.translateManager.getValue("Choose an item"),"")}var oCC=this.AddContentControl(c_oAscSdtLevelType.Inline);if(!oCC)return null;oCC.ApplyComboBoxPr(oPr);oCC.SelectContentControl();return oCC};CDocument.prototype.AddContentControlDropDownList=function(oPr){this.RemoveTextSelection();if(!oPr){oPr=new CSdtComboBoxPr;oPr.AddItem(AscCommon.translateManager.getValue("Choose an item"),"")}var oCC=this.AddContentControl(c_oAscSdtLevelType.Inline); if(!oCC)return null;oCC.ApplyDropDownListPr(oPr);oCC.SelectContentControl();return oCC};CDocument.prototype.AddContentControlDatePicker=function(oPr){this.RemoveTextSelection();if(!oPr)oPr=new CSdtDatePickerPr;var oCC=this.AddContentControl(c_oAscSdtLevelType.Inline);if(!oCC)return null;oCC.ApplyDatePickerPr(oPr);oCC.SelectContentControl();return oCC};CDocument.prototype.AddContentControlTextForm=function(oPr){if(!oPr)oPr=new CSdtTextFormPr;var sText=this.GetSelectedText();var oTextPr=this.GetDirectTextPr(); if(this.IsTextSelectionUse())this.RemoveBeforePaste();else if(this.IsSelectionUse())this.RemoveSelection();var oCC=this.AddContentControl(c_oAscSdtLevelType.Inline);if(oPr.Comb){if(!oPr.MaxCharacters||!oPr.MaxCharacters<=0)oPr.MaxCharacters=12;var oDocPart;if(oPr.CombPlaceholderSymbol)oCC.SetPlaceholderText(String.fromCharCode(oPr.CombPlaceholderSymbol));else oCC.SetPlaceholder(c_oAscDefaultPlaceholderName.TextForm);if(oDocPart&&oPr.CombPlaceholderFont){oDocPart.SelectAll();oDocPart.AddToParagraph(new ParaTextPr({RFonts:{Ascii:{Name:oPr.CombPlaceholderFont, Index:-1},EastAsia:{Name:oPr.CombPlaceholderFont,Index:-1},HAnsi:{Name:oPr.CombPlaceholderFont,Index:-1},CS:{Name:oPr.CombPlaceholderFont,Index:-1}}}));oDocPart.RemoveSelection()}}if(!oCC)return null;oCC.ApplyTextFormPr(oPr);oCC.MoveCursorToStartPos();if(sText&&oCC instanceof CInlineLevelSdt){oCC.ReplacePlaceHolderWithContent();var oRun=oCC.MakeSingleRunElement(false);oRun.AddText(sText);oRun.ApplyTextPr(oTextPr);oCC.SelectContentControl()}this.UpdateSelection();this.UpdateTracks();return oCC};CDocument.prototype.SetContentControlTextPlaceholder= function(sText,oCC){if(!oCC)return;if(!sText)sText=String.fromCharCode(nbsp_charcode,nbsp_charcode,nbsp_charcode,nbsp_charcode);var oGlossary=this.GetGlossaryDocument();if(!this.IsSelectionLocked(AscCommon.changestype_None,{Type:AscCommon.changestype_2_Element_and_Type,Element:oGlossary,CheckType:AscCommon.changestype_Document_Content})){this.StartAction(AscDFH.historydescription_Document_SetContentControlTextPlaceholder);oCC.SetPlaceholderText(sText);if(oCC.IsPlaceHolder()){this.Recalculate();this.UpdateInterface(); this.UpdateSelection()}this.FinalizeAction()}};CDocument.prototype.SetContentControlText=function(sText,oCC){if(!oCC||oCC.IsCheckBox()||oCC.IsDropDownList()||oCC.IsPicture())return;if(!sText)return;oCC.SelectContentControl();if(!this.IsSelectionLocked(AscCommon.changestype_Paragraph_Content,null,false,this.IsFormFieldEditing())){this.StartAction(AscDFH.historydescription_Document_SetContentControlText);oCC.ReplacePlaceHolderWithContent();var oRun;if(oCC.IsBlockLevel())oRun=this.Content.MakeSingleParagraphContent().MakeSingleRunParagraph(true); else if(oCC.IsInlineLevel())oRun=oCC.MakeSingleRunElement(true);if(oRun)oRun.AddText(sText);this.RemoveSelection();oCC.MoveCursorToContentControl(false);this.Recalculate();this.UpdateInterface();this.UpdateSelection();this.FinalizeAction()}};CDocument.prototype.SetGutterAtTop=function(isGutterAtTop){if(isGutterAtTop!==this.Settings.GutterAtTop){this.History.Add(new CChangesDocumentSettingsGutterAtTop(this,this.Settings.GutterAtTop,isGutterAtTop));this.Settings.GutterAtTop=isGutterAtTop}};CDocument.prototype.IsGutterAtTop= function(){return this.Settings.GutterAtTop};CDocument.prototype.SetMirrorMargins=function(isMirror){if(isMirror!==this.Settings.MirrorMargins){this.History.Add(new CChangesDocumentSettingsMirrorMargins(this,this.Settings.MirrorIndent,isMirror));this.Settings.MirrorMargins=isMirror}};CDocument.prototype.IsMirrorMargins=function(){return this.Settings.MirrorMargins};CDocument.prototype.Set_MathProps=function(MathProps){var SelectedInfo=this.GetSelectedElementsInfo();if(null!==SelectedInfo.GetMath()&& false===this.Document_Is_SelectionLocked(changestype_Paragraph_Content)){this.StartAction(AscDFH.historydescription_Document_SetMathProps);var ParaMath=SelectedInfo.GetMath();ParaMath.Set_MenuProps(MathProps);this.Recalculate();this.UpdateSelection();this.UpdateInterface();this.FinalizeAction()}};CDocument.prototype.Statistics_Start=function(){this.Statistics.Start()};CDocument.prototype.Statistics_GetParagraphsInfo=function(){var Count=this.Content.length;var CurPage=this.Statistics.CurPage;var Index= 0;var CurIndex=0;for(Index=this.Statistics.StartPos;Index20){this.Statistics.Next_ParagraphsInfo(Index+1);break}}if(Index>=Count)this.Statistics.Stop_ParagraphsInfo()};CDocument.prototype.Statistics_GetPagesInfo=function(){this.Statistics.Update_Pages(this.Pages.length);if(null!==this.FullRecalc.Id)this.Statistics.Next_PagesInfo();else{for(var CurPage=0,PagesCount=this.Pages.length;CurPage< PagesCount;++CurPage)this.DrawingObjects.documentStatistics(CurPage,this.Statistics);this.Statistics.Stop_PagesInfo()}};CDocument.prototype.Statistics_Stop=function(){this.Statistics.Stop()};CDocument.prototype.Start_MailMerge=function(MailMergeMap,arrFields){this.EndPreview_MailMergeResult();this.MailMergeMap=MailMergeMap;this.MailMergeFields=arrFields;editor.sync_HighlightMailMergeFields(this.MailMergeFieldsHighlight);editor.sync_StartMailMerge()};CDocument.prototype.Get_MailMergeReceptionsCount= function(){if(null===this.MailMergeMap||!this.MailMergeMap)return 0;return this.MailMergeMap.length};CDocument.prototype.Get_MailMergeFieldsNameList=function(){if(this.Get_MailMergeReceptionsCount()<=0)return this.MailMergeFields;var Element=this.MailMergeMap[0];var aList=[];for(var sId in Element)aList.push(sId);return aList};CDocument.prototype.Add_MailMergeField=function(Name){if(false===this.Document_Is_SelectionLocked(AscCommon.changestype_Paragraph_Content)){this.StartAction(AscDFH.historydescription_Document_AddMailMergeField); var oField=new ParaField(fieldtype_MERGEFIELD,[Name],[]);var oRun=new ParaRun;oRun.AddText("\u00ab"+Name+"\u00bb");oField.Add_ToContent(0,oRun);this.Register_Field(oField);this.AddToParagraph(oField);this.UpdateInterface();this.FinalizeAction()}};CDocument.prototype.Set_HightlighMailMergeFields=function(Value){if(Value!==this.MailMergeFieldsHighlight){this.MailMergeFieldsHighlight=Value;this.DrawingDocument.ClearCachePages();this.DrawingDocument.FirePaint();this.DrawingDocument.Update_FieldTrack(false); editor.sync_HighlightMailMergeFields(this.MailMergeFieldsHighlight)}};CDocument.prototype.Preview_MailMergeResult=function(Index){if(null===this.MailMergeMap)return;if(true!==this.MailMergePreview){this.MailMergePreview=true;this.RemoveSelection();AscCommon.CollaborativeEditing.Set_GlobalLock(true)}this.FieldsManager.Update_MailMergeFields(this.MailMergeMap[Index]);this.RecalculateFromStart(true);editor.sync_PreviewMailMergeResult(Index)};CDocument.prototype.EndPreview_MailMergeResult=function(){if(null=== this.MailMergeMap||true!==this.MailMergePreview)return;this.MailMergePreview=false;AscCommon.CollaborativeEditing.Set_GlobalLock(false);this.FieldsManager.Restore_MailMergeTemplate();this.RecalculateFromStart(true);editor.sync_EndPreviewMailMergeResult()};CDocument.prototype.Get_MailMergeReceptionsList=function(){var aList=[];var aHeaders=[];var nCount=this.MailMergeMap.length;if(nCount<=0)return[this.MailMergeFields];for(var sId in this.MailMergeMap[0])aHeaders.push(sId);var nHeadersCount=aHeaders.length; aList.push(aHeaders);for(var nIndex=0;nIndexnEndIndex||nStartIndex>=this.MailMergeMap.length)return null;AscCommon.History.TurnOff();AscCommon.g_oTableId.TurnOff();var LogicDocument=new CDocument(undefined,false);AscCommon.History.Document=this;LogicDocument.Styles=this.Styles.Copy();LogicDocument.Numbering.Clear(); LogicDocument.DrawingDocument=this.DrawingDocument;LogicDocument.theme=this.theme.createDuplicate();LogicDocument.clrSchemeMap=this.clrSchemeMap.createDuplicate();var FieldsManager=this.FieldsManager;var ContentCount=this.Content.length;var OverallIndex=0;this.ForceCopySectPr=true;for(var Index=nStartIndex;Index<=nEndIndex;Index++){this.FieldsManager=LogicDocument.FieldsManager;var NewNumbering=this.Numbering.CopyAllNums(LogicDocument.Numbering);LogicDocument.Numbering.AppendAbstractNums(NewNumbering.AbstractNum); LogicDocument.Numbering.AppendNums(NewNumbering.Num);this.CopyNumberingMap=NewNumbering.NumMap;for(var ContentIndex=0;ContentIndex0){if(true!==oSearchEngine.IsFound())this.private_GetRevisionsChangeElementInDocument(oSearchEngine,0);if(true!==oSearchEngine.IsFound())this.private_GetRevisionsChangeElementInFootnotes(oSearchEngine,null)}else{if(true!==oSearchEngine.IsFound())this.private_GetRevisionsChangeElementInFootnotes(oSearchEngine, null);if(true!==oSearchEngine.IsFound())this.private_GetRevisionsChangeElementInDocument(oSearchEngine,this.Content.length-1)}if(true!==oSearchEngine.IsFound())this.private_GetRevisionsChangeElementInHdrFtr(oSearchEngine,null)}else if(oFootnote){this.private_GetRevisionsChangeElementInFootnotes(oSearchEngine,oFootnote);if(nDirection>0){if(true!==oSearchEngine.IsFound())this.private_GetRevisionsChangeElementInHdrFtr(oSearchEngine,null);if(true!==oSearchEngine.IsFound())this.private_GetRevisionsChangeElementInDocument(oSearchEngine, 0)}else{if(true!==oSearchEngine.IsFound())this.private_GetRevisionsChangeElementInDocument(oSearchEngine,this.Content.length-1);if(true!==oSearchEngine.IsFound())this.private_GetRevisionsChangeElementInHdrFtr(oSearchEngine,null)}if(true!==oSearchEngine.IsFound())this.private_GetRevisionsChangeElementInFootnotes(oSearchEngine,null)}else{var Pos=true===this.Selection.Use&&docpostype_DrawingObjects!==this.GetDocPosType()?this.Selection.StartPos<=this.Selection.EndPos?this.Selection.StartPos:this.Selection.EndPos: this.CurPos.ContentPos;this.private_GetRevisionsChangeElementInDocument(oSearchEngine,Pos);if(nDirection>0){if(true!==oSearchEngine.IsFound())this.private_GetRevisionsChangeElementInFootnotes(oSearchEngine,null);if(true!==oSearchEngine.IsFound())this.private_GetRevisionsChangeElementInHdrFtr(oSearchEngine,null)}else{if(true!==oSearchEngine.IsFound())this.private_GetRevisionsChangeElementInHdrFtr(oSearchEngine,null);if(true!==oSearchEngine.IsFound())this.private_GetRevisionsChangeElementInFootnotes(oSearchEngine, null)}if(true!==oSearchEngine.IsFound())this.private_GetRevisionsChangeElementInDocument(oSearchEngine,nDirection>0?0:this.Content.length-1)}return oSearchEngine};CDocument.prototype.private_GetRevisionsChangeElementInDocument=function(SearchEngine,Pos){var Direction=SearchEngine.GetDirection();this.Content[Pos].GetRevisionsChangeElement(SearchEngine);while(true!==SearchEngine.IsFound()){Pos=Direction>0?Pos+1:Pos-1;if(Pos>=this.Content.length||Pos<0)break;this.Content[Pos].GetRevisionsChangeElement(SearchEngine)}}; CDocument.prototype.private_GetRevisionsChangeElementInHdrFtr=function(SearchEngine,HdrFtr){var AllHdrFtrs=this.SectionsInfo.GetAllHdrFtrs();var Count=AllHdrFtrs.length;if(Count<=0)return;var Pos=-1;if(null!==HdrFtr)for(var Index=0;Index=Count)if(Direction>0)Pos=0;else Pos=Count-1;AllHdrFtrs[Pos].GetRevisionsChangeElement(SearchEngine);while(true!==SearchEngine.IsFound()){Pos=Direction> 0?Pos+1:Pos-1;if(Pos>=Count||Pos<0)break;AllHdrFtrs[Pos].GetRevisionsChangeElement(SearchEngine)}};CDocument.prototype.private_GetRevisionsChangeElementInFootnotesList=function(SearchEngine,oFootnote,arrFootnotes){var nCount=arrFootnotes.length;if(nCount<=0)return;var nPos=-1;if(oFootnote)for(var nIndex=0;nIndex=nCount)if(nDirection>0)nPos=0;else nPos=nCount-1;arrFootnotes[nPos].GetRevisionsChangeElement(SearchEngine); while(true!==SearchEngine.IsFound()){nPos=nDirection>0?nPos+1:nPos-1;if(nPos>=nCount||nPos<0)break;arrFootnotes[nPos].GetRevisionsChangeElement(SearchEngine)}};CDocument.prototype.private_GetRevisionsChangeElementInFootnotes=function(oSearchEngine,oFootnote){if(oSearchEngine.GetDirection()>0){if(true!==oSearchEngine.IsFound())this.private_GetRevisionsChangeElementInFootnotesList(oSearchEngine,oFootnote,this.GetFootnotesList(null,null));if(true!==oSearchEngine.IsFound())this.private_GetRevisionsChangeElementInFootnotesList(oSearchEngine, oFootnote,this.GetEndnotesList(null,null))}else{if(true!==oSearchEngine.IsFound())this.private_GetRevisionsChangeElementInFootnotesList(oSearchEngine,oFootnote,this.GetEndnotesList(null,null));if(true!==oSearchEngine.IsFound())this.private_GetRevisionsChangeElementInFootnotesList(oSearchEngine,oFootnote,this.GetFootnotesList(null,null))}};CDocument.prototype.private_SelectRevisionChange=function(oChange,isSkipCompleteCheck){if(oChange&&oChange.get_Paragraph()){this.RemoveSelection();if(oChange.IsComplexChange()){if(oChange.IsMove())this.SelectTrackMove(oChange.GetMoveId(), oChange.IsMoveFrom(),false,false)}else{var oElement=oChange.get_Paragraph();if(true!==isSkipCompleteCheck&&this.TrackRevisionsManager.CompleteTrackChangesForElements([oElement]))return;if(oElement instanceof Paragraph){oElement.Set_ParaContentPos(oChange.get_StartPos(),false,-1,-1);oElement.Selection.Use=true;oElement.Set_SelectionContentPos(oChange.get_StartPos(),oChange.get_EndPos(),false);oElement.Document_SetThisElementCurrent(false)}else if(oElement instanceof CTable){oElement.SelectRows(oChange.get_StartPos(), oChange.get_EndPos());oElement.Document_SetThisElementCurrent(false)}}}};CDocument.prototype.AcceptRevisionChange=function(oChange){if(oChange){var arrRelatedParas=this.TrackRevisionsManager.GetChangeRelatedParagraphs(oChange,true);if(this.TrackRevisionsManager.CompleteTrackChangesForElements(arrRelatedParas)){this.Document_UpdateInterfaceState();this.Document_UpdateSelectionState();return}if(false===this.Document_Is_SelectionLocked(AscCommon.changestype_None,{Type:changestype_2_ElementsArray_and_Type, Elements:arrRelatedParas,CheckType:AscCommon.changestype_Paragraph_Properties})){this.StartAction(AscDFH.historydescription_Document_AcceptRevisionChange);var isTrackRevision=this.GetLocalTrackRevisions();if(false!==isTrackRevision)this.SetLocalTrackRevisions(false);if(oChange.IsComplexChange()){if(oChange.IsMove())this.private_ProcessMoveReview(oChange,true)}else{this.private_SelectRevisionChange(oChange);this.AcceptRevisionChanges(oChange.GetType(),false)}if(false!==isTrackRevision)this.SetLocalTrackRevisions(isTrackRevision); this.FinalizeAction()}}};CDocument.prototype.private_ProcessMoveReview=function(oChange,isAccept){var oTrackRevisionsManager=this.GetTrackRevisionsManager();var sMoveId=oChange.GetMoveId();var isMovedDown=oChange.IsMovedDown();var oThis=this;var oTrackMove=oTrackRevisionsManager.StartProcessReviewMove(sMoveId,oChange.GetUserId());function privateProcessChanges(isFrom){oTrackMove.SetFrom(isFrom);oThis.SelectTrackMove(sMoveId,isFrom,false,false);if(isAccept)oThis.AcceptRevisionChanges(c_oAscRevisionsChangeType.MoveMark, false);else oThis.RejectRevisionChanges(c_oAscRevisionsChangeType.MoveMark,false)}if(isMovedDown){privateProcessChanges(false);privateProcessChanges(true)}else{privateProcessChanges(true);privateProcessChanges(false)}oTrackRevisionsManager.EndProcessReviewMove()};CDocument.prototype.RejectRevisionChange=function(oChange){if(oChange){var arrRelatedParas=this.TrackRevisionsManager.GetChangeRelatedParagraphs(oChange,false);if(this.TrackRevisionsManager.CompleteTrackChangesForElements(arrRelatedParas)){this.Document_UpdateInterfaceState(); this.Document_UpdateSelectionState();return}if(false===this.Document_Is_SelectionLocked(AscCommon.changestype_None,{Type:changestype_2_ElementsArray_and_Type,Elements:arrRelatedParas,CheckType:AscCommon.changestype_Paragraph_Properties})){this.StartAction(AscDFH.historydescription_Document_RejectRevisionChange);var isTrackRevision=this.GetLocalTrackRevisions();if(false!==isTrackRevision)this.SetLocalTrackRevisions(false);if(oChange.IsComplexChange()){if(oChange.IsMove())this.private_ProcessMoveReview(oChange, false)}else{this.private_SelectRevisionChange(oChange);this.RejectRevisionChanges(oChange.GetType(),false)}if(false!==isTrackRevision)this.SetLocalTrackRevisions(isTrackRevision);this.FinalizeAction()}}};CDocument.prototype.AcceptRevisionChangesBySelection=function(){var CurrentChange=this.TrackRevisionsManager.GetCurrentChange();if(null!==CurrentChange)this.AcceptRevisionChange(CurrentChange);else{var sMoveId=this.CheckTrackMoveInSelection();if(sMoveId){var oChange=this.TrackRevisionsManager.GetMoveMarkChange(sMoveId, true,false);if(oChange){oChange=this.TrackRevisionsManager.CollectMoveChange(oChange);return this.AcceptRevisionChange(oChange)}}var SelectedParagraphs=this.GetAllParagraphs({Selected:true});var RelatedParas=this.TrackRevisionsManager.Get_AllChangesRelatedParagraphsBySelectedParagraphs(SelectedParagraphs,true);if(false===this.Document_Is_SelectionLocked(AscCommon.changestype_None,{Type:changestype_2_ElementsArray_and_Type,Elements:RelatedParas,CheckType:AscCommon.changestype_Paragraph_Content})){this.StartAction(AscDFH.historydescription_Document_AcceptRevisionChangesBySelection); var isTrackRevision=this.GetLocalTrackRevisions();if(false!==isTrackRevision)this.SetLocalTrackRevisions(false);this.AcceptRevisionChanges(undefined,false);if(false!==isTrackRevision)this.SetLocalTrackRevisions(isTrackRevision);this.FinalizeAction()}}this.TrackRevisionsManager.ClearCurrentChange();this.GetNextRevisionChange()};CDocument.prototype.RejectRevisionChangesBySelection=function(){var CurrentChange=this.TrackRevisionsManager.GetCurrentChange();if(null!==CurrentChange)this.RejectRevisionChange(CurrentChange); else{var sMoveId=this.CheckTrackMoveInSelection();if(sMoveId){var oChange=this.TrackRevisionsManager.GetMoveMarkChange(sMoveId,true,false);if(oChange){oChange=this.TrackRevisionsManager.CollectMoveChange(oChange);return this.RejectRevisionChange(oChange)}}var SelectedParagraphs=this.GetAllParagraphs({Selected:true});var RelatedParas=this.TrackRevisionsManager.Get_AllChangesRelatedParagraphsBySelectedParagraphs(SelectedParagraphs,false);if(false===this.Document_Is_SelectionLocked(AscCommon.changestype_None, {Type:changestype_2_ElementsArray_and_Type,Elements:RelatedParas,CheckType:AscCommon.changestype_Paragraph_Content})){this.StartAction(AscDFH.historydescription_Document_AcceptRevisionChangesBySelection);var isTrackRevision=this.GetLocalTrackRevisions();if(false!==isTrackRevision)this.SetLocalTrackRevisions(false);this.RejectRevisionChanges(undefined,false);if(false!==isTrackRevision)this.SetLocalTrackRevisions(isTrackRevision);this.FinalizeAction()}}this.TrackRevisionsManager.ClearCurrentChange(); this.GetNextRevisionChange()};CDocument.prototype.AcceptAllRevisionChanges=function(isSkipCheckLock,isCheckEmptyAction){var _isCheckEmptyAction=false!==isCheckEmptyAction;var RelatedParas=this.TrackRevisionsManager.Get_AllChangesRelatedParagraphs(true);if(true===isSkipCheckLock||false===this.IsSelectionLocked(AscCommon.changestype_None,{Type:changestype_2_ElementsArray_and_Type,Elements:RelatedParas,CheckType:AscCommon.changestype_Paragraph_Properties})){this.StartAction(AscDFH.historydescription_Document_AcceptAllRevisionChanges); var isTrackRevision=this.GetLocalTrackRevisions();if(false!==isTrackRevision)this.SetLocalTrackRevisions(false);var LogicDocuments=this.TrackRevisionsManager.Get_AllChangesLogicDocuments();for(var LogicDocId in LogicDocuments){var LogicDoc=AscCommon.g_oTableId.Get_ById(LogicDocId);if(LogicDoc)LogicDoc.AcceptRevisionChanges(undefined,true)}if(false!==isTrackRevision)this.SetLocalTrackRevisions(isTrackRevision);if(true!==isSkipCheckLock&&true===this.History.Is_LastPointEmpty()){this.FinalizeAction(_isCheckEmptyAction); return}this.RemoveSelection();this.private_CorrectDocumentPosition();this.Recalculate();this.UpdateSelection();this.UpdateInterface();this.FinalizeAction(_isCheckEmptyAction)}};CDocument.prototype.RejectAllRevisionChanges=function(isSkipCheckLock,isCheckEmptyAction){var _isCheckEmptyAction=false!==isCheckEmptyAction;var RelatedParas=this.TrackRevisionsManager.Get_AllChangesRelatedParagraphs(false);if(true===isSkipCheckLock||false===this.IsSelectionLocked(AscCommon.changestype_None,{Type:changestype_2_ElementsArray_and_Type, Elements:RelatedParas,CheckType:AscCommon.changestype_Paragraph_Properties})){this.StartAction(AscDFH.historydescription_Document_RejectAllRevisionChanges);var isTrackRevision=this.GetLocalTrackRevisions();if(false!==isTrackRevision)this.SetLocalTrackRevisions(false);this.private_RejectAllRevisionChanges();if(false!==isTrackRevision)this.SetLocalTrackRevisions(isTrackRevision);if(true!==isSkipCheckLock&&true===this.History.Is_LastPointEmpty()){this.FinalizeAction(_isCheckEmptyAction);return}this.RemoveSelection(); this.private_CorrectDocumentPosition();this.Recalculate();this.UpdateSelection();this.UpdateInterface();this.FinalizeAction(_isCheckEmptyAction)}};CDocument.prototype.private_RejectAllRevisionChanges=function(){var LogicDocuments=this.TrackRevisionsManager.Get_AllChangesLogicDocuments();for(var LogicDocId in LogicDocuments){var LogicDoc=this.TableId.Get_ById(LogicDocId);if(LogicDoc)LogicDoc.RejectRevisionChanges(undefined,true)}};CDocument.prototype.AcceptRevisionChanges=function(nType,bAll){if(docpostype_Content=== this.CurPos.Type||true===bAll)this.private_AcceptRevisionChanges(nType,bAll);else if(docpostype_HdrFtr===this.CurPos.Type)this.HdrFtr.AcceptRevisionChanges(nType,bAll);else if(docpostype_DrawingObjects===this.CurPos.Type)this.DrawingObjects.AcceptRevisionChanges(nType,bAll);else if(docpostype_Footnotes===this.CurPos.Type)this.Footnotes.AcceptRevisionChanges(nType,bAll);else if(docpostype_Endnotes===this.CurPos.Type)this.Endnotes.AcceptRevisionChanges(nType,bAll);if(true!==bAll){this.Recalculate(); this.UpdateInterface();this.UpdateSelection()}};CDocument.prototype.RejectRevisionChanges=function(nType,bAll){if(docpostype_Content===this.CurPos.Type||true===bAll)this.private_RejectRevisionChanges(nType,bAll);else if(docpostype_HdrFtr===this.CurPos.Type)this.HdrFtr.RejectRevisionChanges(nType,bAll);else if(docpostype_DrawingObjects===this.CurPos.Type)this.DrawingObjects.RejectRevisionChanges(nType,bAll);else if(docpostype_Footnotes===this.CurPos.Type)this.Footnotes.RejectRevisionChanges(nType, bAll);else if(docpostype_Endnotes===this.CurPos.Type)this.Endnotes.RejectRevisionChanges(nType,bAll);if(true!==bAll){this.Recalculate();this.UpdateInterface();this.UpdateSelection()}};CDocument.prototype.HaveRevisionChanges=function(isCheckOwnChanges){this.TrackRevisionsManager.ContinueTrackRevisions();if(true===isCheckOwnChanges)return this.TrackRevisionsManager.Have_Changes();else return this.TrackRevisionsManager.HaveOtherUsersChanges()};CDocument.prototype.Begin_CompositeInput=function(){var bResult= false;if(false===this.Document_Is_SelectionLocked(changestype_Paragraph_Content,null,true,this.IsFormFieldEditing())){this.StartAction(AscDFH.historydescription_Document_CompositeInput);this.DrawingObjects.CreateDocContent();this.DrawingDocument.TargetStart();this.DrawingDocument.TargetShow();if(true===this.IsSelectionUse())if(docpostype_DrawingObjects===this.GetDocPosType()&&null===this.DrawingObjects.getTargetDocContent())this.RemoveSelection();else this.Remove(1,true,false,true);var oPara=this.GetCurrentParagraph(); if(oPara){var oRun=oPara.Get_ElementByPos(oPara.Get_ParaContentPos(false,false));if(oRun instanceof ParaRun){var oRunParent=oRun.GetParent();if(oRunParent instanceof CInlineLevelSdt&&oRunParent.IsPlaceHolder()){oRunParent.ReplacePlaceHolderWithContent(false);oRun=oRunParent.GetElement(0)}}if(oRun instanceof ParaRun){var oNewRun=oRun.CheckRunBeforeAdd();if(oNewRun){oRun=oNewRun;oRun.Make_ThisElementCurrent()}this.CompositeInput={Run:oRun,Pos:oRun.State.ContentPos,Length:0,CanUndo:true};oRun.Set_CompositeInput(this.CompositeInput); bResult=true}}this.FinalizeAction(false)}return bResult};CDocument.prototype.Replace_CompositeText=function(arrCharCodes){if(null===this.CompositeInput)return;this.StartAction(AscDFH.historydescription_Document_CompositeInputReplace);this.Start_SilentMode();this.private_RemoveCompositeText(this.CompositeInput.Length);for(var nIndex=0,nCount=arrCharCodes.length;nIndex=this.CompositeInput.Pos&&nInRunPos<=this.CompositeInput.Pos+this.CompositeInput.Length)return true;return false};CDocument.prototype.GotoFootnotesOnPage=function(nPageIndex){if(this.Footnotes.IsEmptyPage(nPageIndex))return false;this.SetDocPosType(docpostype_Footnotes);this.Footnotes.GotoPage(nPageIndex);this.Document_UpdateSelectionState(); return true};CDocument.prototype.AddFootnote=function(sText){var nDocPosType=this.GetDocPosType();if(docpostype_Content!==nDocPosType&&docpostype_Footnotes!==nDocPosType)return;var oInfo=this.GetSelectedElementsInfo();if(oInfo.GetMath())return;if(false===this.Document_Is_SelectionLocked(changestype_Paragraph_Content)){this.StartAction(AscDFH.historydescription_Document_AddFootnote);if(docpostype_Content===nDocPosType){var oFootnote=this.Footnotes.CreateFootnote();oFootnote.AddDefaultFootnoteContent(sText); if(true===this.IsSelectionUse()){this.MoveCursorRight(false,false,false);this.RemoveSelection()}if(sText)this.AddToParagraph(new ParaFootnoteReference(oFootnote,sText));else this.AddToParagraph(new ParaFootnoteReference(oFootnote));this.SetDocPosType(docpostype_Footnotes);this.Footnotes.Set_CurrentElement(true,0,oFootnote)}else if(docpostype_Footnotes===nDocPosType){this.Footnotes.AddFootnoteRef();this.Recalculate()}this.FinalizeAction()}};CDocument.prototype.RemoveAllFootnotes=function(bRemoveFootnotes, bRemoveEndnotes){var nDocPosType=this.GetDocPosType();var oEngine=new CDocumentFootnotesRangeEngine(true);oEngine.Init(null,null,bRemoveFootnotes,bRemoveEndnotes);var arrParagraphs=this.GetAllParagraphs({OnlyMainDocument:true,All:true});for(var nIndex=0,nCount=arrParagraphs.length;nIndex0)arrRuns[0].Make_ThisElementCurrent()}this.FinalizeAction()}};CDocument.prototype.GotoFootnote=function(isNext){var nDocPosType=this.GetDocPosType();if(docpostype_Footnotes===nDocPosType){if(isNext)this.Footnotes.GotoNextFootnote();else this.Footnotes.GotoPrevFootnote();this.Document_UpdateSelectionState();this.Document_UpdateInterfaceState(); return}if(docpostype_HdrFtr===nDocPosType)this.EndHdrFtrEditing(true);else if(docpostype_Endnotes===nDocPosType)this.EndEndnotesEditing();else if(docpostype_DrawingObjects===nDocPosType){this.DrawingObjects.resetSelection2();this.private_UpdateCursorXY(true,true);this.CurPos.Type=docpostype_Content;this.Document_UpdateInterfaceState();this.Document_UpdateSelectionState()}return this.GotoFootnoteRef(isNext,true,true,false)};CDocument.prototype.GetFootnotesController=function(){return this.Footnotes}; CDocument.prototype.GetEndnotesController=function(){return this.Endnotes};CDocument.prototype.SetFootnotePr=function(oFootnotePr,bApplyToAll){var nNumStart=oFootnotePr.get_NumStart();var nNumRestart=oFootnotePr.get_NumRestart();var nNumFormat=oFootnotePr.get_NumFormat();var nPos=oFootnotePr.get_Pos();if(false===this.Document_Is_SelectionLocked(AscCommon.changestype_Document_SectPr)){this.StartAction(AscDFH.historydescription_Document_SetFootnotePr);if(bApplyToAll)for(var nIndex=0,nCount=this.SectionsInfo.GetSectionsCount();nIndex< nCount;++nIndex){var oSectPr=this.SectionsInfo.Get_SectPr2(nIndex).SectPr;if(undefined!==nNumStart)oSectPr.SetFootnoteNumStart(nNumStart);if(undefined!==nNumRestart)oSectPr.SetFootnoteNumRestart(nNumRestart);if(undefined!==nNumFormat)oSectPr.SetFootnoteNumFormat(nNumFormat);if(undefined!==nPos)oSectPr.SetFootnotePos(nPos)}else{var oSectPr=this.GetCurrentSectionPr();if(undefined!==nNumStart)oSectPr.SetFootnoteNumStart(nNumStart);if(undefined!==nNumRestart)oSectPr.SetFootnoteNumRestart(nNumRestart); if(undefined!==nNumFormat)oSectPr.SetFootnoteNumFormat(nNumFormat);if(undefined!==nPos)oSectPr.SetFootnotePos(nPos)}this.Recalculate();this.FinalizeAction()}};CDocument.prototype.GetFootnotePr=function(){var oSectPr=this.GetCurrentSectionPr();var oFootnotePr=new Asc.CAscFootnotePr;oFootnotePr.put_Pos(oSectPr.GetFootnotePos());oFootnotePr.put_NumStart(oSectPr.GetFootnoteNumStart());oFootnotePr.put_NumRestart(oSectPr.GetFootnoteNumRestart());oFootnotePr.put_NumFormat(oSectPr.GetFootnoteNumFormat()); return oFootnotePr};CDocument.prototype.IsCursorInFootnote=function(){return docpostype_Footnotes===this.GetDocPosType()};CDocument.prototype.GetFootnotesList=function(oFirstFootnote,oLastFootnote){if(null===oFirstFootnote&&null===oLastFootnote&&null!==this.AllFootnotesList)return this.AllFootnotesList;var arrFootnotes=CDocumentContentBase.prototype.GetFootnotesList.call(this,oFirstFootnote,oLastFootnote,false);if(null===oFirstFootnote&&null===oLastFootnote)this.AllFootnotesList=arrFootnotes;return arrFootnotes}; CDocument.prototype.GetEndnotesList=function(oFirstEndnote,oLastEndnote){if(null===oFirstEndnote&&null===oLastEndnote&&null!==this.AllEndnotesList)return this.AllEndnotesList;var arrEndnotes=CDocumentContentBase.prototype.GetFootnotesList.call(this,oFirstEndnote,oLastEndnote,true);if(null===oFirstEndnote&&null===oLastEndnote)this.AllEndnotesList=arrEndnotes;return arrEndnotes};CDocument.prototype.AddEndnote=function(sText){var nDocPosType=this.GetDocPosType();if(docpostype_Content!==nDocPosType&& docpostype_Endnotes!==nDocPosType)return;var oInfo=this.GetSelectedElementsInfo();if(oInfo.GetMath())return;if(!this.IsSelectionLocked(changestype_Paragraph_Content)){this.StartAction(AscDFH.historydescription_Document_AddEndnote);if(docpostype_Content===nDocPosType){var oEndnote=this.Endnotes.CreateEndnote();oEndnote.AddDefaultEndnoteContent(sText);if(true===this.IsSelectionUse()){this.MoveCursorRight(false,false,false);this.RemoveSelection()}if(sText)this.AddToParagraph(new ParaEndnoteReference(oEndnote, sText));else this.AddToParagraph(new ParaEndnoteReference(oEndnote));this.SetDocPosType(docpostype_Endnotes);this.Endnotes.Set_CurrentElement(true,0,oEndnote)}else if(docpostype_Endnotes===nDocPosType)this.Endnotes.AddEndnoteRef();this.Recalculate();this.FinalizeAction()}};CDocument.prototype.GotoEndnote=function(isNext){var nDocPosType=this.GetDocPosType();if(docpostype_Endnotes===nDocPosType){if(isNext)this.Endnotes.GotoNextEndnote();else this.Endnotes.GotoPrevEndnote();this.UpdateSelection();this.UpdateInterface(); return}if(docpostype_HdrFtr===nDocPosType)this.EndHdrFtrEditing(true);else if(docpostype_Footnotes===nDocPosType)this.EndFootnotesEditing();else if(docpostype_DrawingObjects===nDocPosType){this.DrawingObjects.resetSelection2();this.private_UpdateCursorXY(true,true);this.CurPos.Type=docpostype_Content;this.Document_UpdateInterfaceState();this.Document_UpdateSelectionState()}return this.GotoFootnoteRef(isNext,true,false,true)};CDocument.prototype.IsCursorInEndnote=function(){return docpostype_Endnotes=== this.GetDocPosType()};CDocument.prototype.GetEndnotePr=function(){var oSectPr=this.GetCurrentSectionPr();var oEndnotePr=new Asc.CAscFootnotePr;oEndnotePr.put_Pos(this.Endnotes.GetEndnotePrPos());oEndnotePr.put_NumStart(oSectPr.GetEndnoteNumStart());oEndnotePr.put_NumRestart(oSectPr.GetEndnoteNumRestart());oEndnotePr.put_NumFormat(oSectPr.GetEndnoteNumFormat());return oEndnotePr};CDocument.prototype.SetEndnotePr=function(oEndnotePr,bApplyToAll){var nNumStart=oEndnotePr.get_NumStart();var nNumRestart= oEndnotePr.get_NumRestart();var nNumFormat=oEndnotePr.get_NumFormat();var nPos=oEndnotePr.get_Pos();if(!this.IsSelectionLocked(AscCommon.changestype_Document_SectPr)){this.StartAction(AscDFH.historydescription_Document_SetEndnotePr);if(undefined!==nPos)this.Endnotes.SetEndnotePrPos(nPos);if(bApplyToAll)for(var nIndex=0,nCount=this.SectionsInfo.GetSectionsCount();nIndex=0&&(null===this.FullRecalc.Id||this.FullRecalc.StartIndex>nPos))return this.Content[nPos].Get_CurrentPage_Absolute(); return-1};CDocument.prototype.controller_AddNewParagraph=function(bRecalculate,bForceAdd){if(this.CurPos.ContentPos<0)return false;if(true===this.Selection.Use)this.Remove(1,true,false,true);var Item=this.Content[this.CurPos.ContentPos];if(type_Paragraph===Item.GetType()){var isCheckAutoCorrect=false;if(true!==bForceAdd&&undefined!=Item.GetNumPr()&&true===Item.IsEmpty({SkipNewLine:true})&&true===Item.IsCursorAtBegin()){Item.RemoveNumPr();Item.Set_Ind({FirstLine:undefined,Left:undefined,Right:Item.Pr.Ind.Right}, true)}else{var ItemReviewType=Item.GetReviewType();var NewParagraph=new Paragraph(this.DrawingDocument,this);if(Item.IsCursorAtBegin()){Item.Continue(NewParagraph);NewParagraph.Correct_Content();NewParagraph.MoveCursorToStartPos();var nContentPos=this.CurPos.ContentPos;this.AddToContent(nContentPos,NewParagraph);this.CurPos.ContentPos=nContentPos+1}else{if(true===Item.IsCursorAtEnd()){if(!Item.Lock.Is_Locked())isCheckAutoCorrect=true;var StyleId=Item.Style_Get();var NextId=undefined;if(undefined!= StyleId){NextId=this.Styles.Get_Next(StyleId);var oNextStyle=this.Styles.Get(NextId);if(!NextId||!oNextStyle||!oNextStyle.IsParagraphStyle())NextId=StyleId}if(StyleId===NextId)Item.Continue(NewParagraph);else if(NextId===this.Styles.Get_Default_Paragraph())NewParagraph.Style_Remove();else NewParagraph.Style_Add(NextId,true);var SectPr=Item.Get_SectionPr();if(undefined!==SectPr){Item.Set_SectionPr(undefined);NewParagraph.Set_SectionPr(SectPr)}var LastRun=Item.Content[Item.Content.length-1];if(LastRun&& LastRun.Pr.Lang&&LastRun.Pr.Lang.Val){NewParagraph.SelectAll();NewParagraph.Add(new ParaTextPr({Lang:LastRun.Pr.Lang.Copy()}));NewParagraph.RemoveSelection()}}else Item.Split(NewParagraph);NewParagraph.Correct_Content();NewParagraph.MoveCursorToStartPos();var nContentPos=this.CurPos.ContentPos+1;this.AddToContent(nContentPos,NewParagraph);this.CurPos.ContentPos=nContentPos}if(true===this.IsTrackRevisions()){Item.RemovePrChange();NewParagraph.SetReviewType(ItemReviewType);Item.SetReviewType(reviewtype_Add)}else if(reviewtype_Common!== ItemReviewType){NewParagraph.SetReviewType(ItemReviewType);Item.SetReviewType(reviewtype_Common)}NewParagraph.CheckSignatureLinesOnAdd()}if(isCheckAutoCorrect){var nContentPos=this.CurPos.ContentPos;var oParaEndRun=Item.GetParaEndRun();if(oParaEndRun)oParaEndRun.ProcessAutoCorrectOnParaEnd();this.CurPos.ContentPos=nContentPos}}else if(type_Table===Item.GetType()||type_BlockLevelSdt===Item.GetType())if(0===this.CurPos.ContentPos&&Item.IsCursorAtBegin(true)){var NewParagraph=new Paragraph(this.DrawingDocument, this);this.Internal_Content_Add(0,NewParagraph);this.CurPos.ContentPos=0;if(true===this.IsTrackRevisions()){NewParagraph.RemovePrChange();NewParagraph.SetReviewType(reviewtype_Add)}}else if(this.Content.length-1===this.CurPos.ContentPos&&Item.IsCursorAtEnd()){var oNewParagraph=new Paragraph(this.DrawingDocument,this);this.Internal_Content_Add(this.Content.length,oNewParagraph);this.CurPos.ContentPos=this.Content.length-1;if(this.IsTrackRevisions()){oNewParagraph.RemovePrChange();oNewParagraph.SetReviewType(reviewtype_Add)}}else Item.AddNewParagraph()}; CDocument.prototype.controller_AddInlineImage=function(W,H,Img,Chart,bFlow){if(true==this.Selection.Use)this.Remove(1,true);var Item=this.Content[this.CurPos.ContentPos];if(type_Paragraph==Item.GetType()){var Drawing;if(!AscCommon.isRealObject(Chart)){Drawing=new ParaDrawing(W,H,null,this.DrawingDocument,this,null);var Image=this.DrawingObjects.createImage(Img,0,0,W,H);Image.setParent(Drawing);Drawing.Set_GraphicObject(Image)}else{Drawing=new ParaDrawing(W,H,null,this.DrawingDocument,this,null);var Image= this.DrawingObjects.getChartSpace2(Chart,null);Image.setParent(Drawing);Drawing.Set_GraphicObject(Image);Drawing.setExtent(Image.spPr.xfrm.extX,Image.spPr.xfrm.extY)}if(true===bFlow){Drawing.Set_DrawingType(drawing_Anchor);Drawing.Set_WrappingType(WRAPPING_TYPE_SQUARE);Drawing.Set_BehindDoc(false);Drawing.Set_Distance(3.2,0,3.2,0);Drawing.Set_PositionH(Asc.c_oAscRelativeFromH.Column,false,0,false);Drawing.Set_PositionV(Asc.c_oAscRelativeFromV.Paragraph,false,0,false)}this.AddToParagraph(Drawing); this.Select_DrawingObject(Drawing.Get_Id())}else Item.AddInlineImage(W,H,Img,Chart,bFlow)};CDocument.prototype.controller_AddImages=function(aImages){if(true===this.Selection.Use)this.Remove(1,true);var Item=this.Content[this.CurPos.ContentPos];if(type_Paragraph===Item.GetType()){var Drawing,W,H;var ColumnSize=this.GetColumnSize();for(var i=0;i1){for(var CurCol=0,ColsCount=SectPr.Get_ColumnsCount();CurColColumnWidth)W= ColumnWidth}W+=nAdd}W=Math.max(W,nCols*2*1.9);for(var Index=0;Index 0&&oPage&&nContentPos===oPage.Pos){this.AddToContent(nContentPos+1,NewTable);this.CurPos.ContentPos=nContentPos+1}else{this.AddToContent(nContentPos,NewTable);this.CurPos.ContentPos=nContentPos}}else if(nMode>0){NewTable.MoveCursorToStartPos(false);this.AddToContent(nContentPos+1,NewTable);this.CurPos.ContentPos=nContentPos+1}else{var NewParagraph=new Paragraph(this.DrawingDocument,this);Item.Split(NewParagraph);this.AddToContent(nContentPos+1,NewParagraph);NewTable.MoveCursorToStartPos(false);this.AddToContent(nContentPos+ 1,NewTable);this.CurPos.ContentPos=nContentPos+1}return NewTable}else return Item.AddInlineTable(nCols,nRows,nMode);this.Recalculate();return null};CDocument.prototype.controller_ClearParagraphFormatting=function(isClearParaPr,isClearTextPr){if(true===this.Selection.Use){if(selectionflag_Common===this.Selection.Flag){var StartPos=this.Selection.StartPos;var EndPos=this.Selection.EndPos;if(StartPos>EndPos){var Temp=StartPos;StartPos=EndPos;EndPos=Temp}for(var Index=StartPos;Index<=EndPos;Index++)this.Content[Index].ClearParagraphFormatting(isClearParaPr, isClearTextPr)}}else this.Content[this.CurPos.ContentPos].ClearParagraphFormatting(isClearParaPr,isClearTextPr)};CDocument.prototype.controller_AddToParagraph=function(ParaItem,bRecalculate){if(true===this.Selection.Use){var nSpaceCharCode=-1;if(this.IsWordSelection()){var sText=this.GetSelectedText();if(sText.length>1&&AscCommon.IsSpace(sText.charCodeAt(sText.length-1)))nSpaceCharCode=sText.charCodeAt(sText.length-1)}var Type=ParaItem.Get_Type();switch(Type){case para_Math:case para_NewLine:case para_Text:case para_Space:case para_Tab:case para_PageNum:case para_Field:case para_FootnoteReference:case para_FootnoteRef:case para_Separator:case para_ContinuationSeparator:case para_InstrText:case para_EndnoteReference:case para_EndnoteRef:{if(ParaItem instanceof AscCommonWord.MathMenu){var oInfo=this.GetSelectedElementsInfo();if(oInfo.GetMath()){var oMath=oInfo.GetMath();if(!oMath.IsParentEquationPlaceholder())ParaItem.SetText(oMath.Copy(true))}else if(!oInfo.IsMixedSelection())ParaItem.SetText(this.GetSelectedText({MathAdd:true}))}this.Remove(1,true,false,true);if(-1!==nSpaceCharCode){this.AddToParagraph(new ParaSpace(nSpaceCharCode));this.MoveCursorLeft(false,false)}break}case para_TextPr:{switch(this.Selection.Flag){case selectionflag_Common:{var StartPos= this.Selection.StartPos;var EndPos=this.Selection.EndPos;if(EndPos=EndPos;Index--)this.Content[Index].SelectAll(-1);this.Content[StartPos].MoveCursorToStartPos(true)}else{this.RemoveSelection();this.Selection.Start=false;this.Selection.Use=false;this.Selection.StartPos=0;this.Selection.EndPos=0;this.Selection.Flag=selectionflag_Common;this.CurPos.ContentPos=0;this.SetDocPosType(docpostype_Content); this.Content[0].MoveCursorToStartPos(false)}};CDocument.prototype.controller_MoveCursorToEndPos=function(AddToSelect){if(true===AddToSelect){var StartPos=true===this.Selection.Use?this.Selection.StartPos:this.CurPos.ContentPos;var EndPos=this.Content.length-1;this.Selection.Start=false;this.Selection.Use=true;this.Selection.StartPos=StartPos;this.Selection.EndPos=EndPos;this.Selection.Flag=selectionflag_Common;this.CurPos.ContentPos=this.Content.length-1;this.SetDocPosType(docpostype_Content);for(var Index= StartPos+1;Index<=EndPos;Index++)this.Content[Index].SelectAll(1);this.Content[StartPos].MoveCursorToEndPos(true,false)}else{this.RemoveSelection();this.Selection.Start=false;this.Selection.Use=false;this.Selection.StartPos=0;this.Selection.EndPos=0;this.Selection.Flag=selectionflag_Common;this.CurPos.ContentPos=this.Content.length-1;this.SetDocPosType(docpostype_Content);this.Content[this.CurPos.ContentPos].MoveCursorToEndPos(false)}};CDocument.prototype.controller_MoveCursorLeft=function(AddToSelect, Word){if(this.CurPos.ContentPos<0)return false;this.RemoveNumberingSelection();if(true===this.Selection.Use)if(true===AddToSelect){if(false===this.Content[this.Selection.EndPos].MoveCursorLeft(true,Word))if(0!==this.Selection.EndPos){this.Selection.EndPos--;this.CurPos.ContentPos=this.Selection.EndPos;var Item=this.Content[this.Selection.EndPos];Item.MoveCursorLeftWithSelectionFromEnd(Word)}if(this.Selection.EndPos!=this.Selection.StartPos&&false===this.Content[this.Selection.EndPos].IsSelectionUse()){this.Selection.EndPos--; this.CurPos.ContentPos=this.Selection.EndPos}if(this.Selection.StartPos==this.Selection.EndPos&&false===this.Content[this.Selection.StartPos].IsSelectionUse()){this.Selection.Use=false;this.CurPos.ContentPos=this.Selection.EndPos}}else{var Start=this.Selection.StartPos;if(Start>this.Selection.EndPos)Start=this.Selection.EndPos;this.CurPos.ContentPos=Start;if(false===this.Content[this.CurPos.ContentPos].MoveCursorLeft(false,Word))if(this.CurPos.ContentPos>0){this.CurPos.ContentPos--;this.Content[this.CurPos.ContentPos].MoveCursorToEndPos(false, false)}this.RemoveSelection()}else if(true===AddToSelect){this.Selection.Use=true;this.Selection.StartPos=this.CurPos.ContentPos;this.Selection.EndPos=this.CurPos.ContentPos;if(false===this.Content[this.CurPos.ContentPos].MoveCursorLeft(true,Word))if(0!=this.CurPos.ContentPos){this.CurPos.ContentPos--;this.Selection.EndPos=this.CurPos.ContentPos;var Item=this.Content[this.CurPos.ContentPos];Item.MoveCursorLeftWithSelectionFromEnd(Word)}if(this.Selection.StartPos==this.Selection.EndPos&&false===this.Content[this.Selection.StartPos].IsSelectionUse()){this.Selection.Use= false;this.CurPos.ContentPos=this.Selection.EndPos}}else if(false===this.Content[this.CurPos.ContentPos].MoveCursorLeft(false,Word))if(0!=this.CurPos.ContentPos){this.CurPos.ContentPos--;this.Content[this.CurPos.ContentPos].MoveCursorToEndPos(false,false)}};CDocument.prototype.controller_MoveCursorRight=function(AddToSelect,Word){if(this.CurPos.ContentPos<0)return false;this.RemoveNumberingSelection();if(true===this.Selection.Use)if(true===AddToSelect){if(false===this.Content[this.Selection.EndPos].MoveCursorRight(true, Word))if(this.Content.length-1!=this.Selection.EndPos){this.Selection.EndPos++;this.CurPos.ContentPos=this.Selection.EndPos;var Item=this.Content[this.Selection.EndPos];Item.MoveCursorRightWithSelectionFromStart(Word)}if(this.Selection.EndPos!=this.Selection.StartPos&&false===this.Content[this.Selection.EndPos].IsSelectionUse()){this.Selection.EndPos++;this.CurPos.ContentPos=this.Selection.EndPos}if(this.Selection.StartPos==this.Selection.EndPos&&false===this.Content[this.Selection.StartPos].IsSelectionUse()){this.Selection.Use= false;this.CurPos.ContentPos=this.Selection.EndPos}}else{var End=this.Selection.EndPos;if(End= this.Selection.StartPos?this.Selection.EndPos:this.Selection.StartPos;this.CurPos.ContentPos=Pos;var Item=this.Content[Pos];Item.MoveCursorToEndOfLine(AddToSelect);this.RemoveSelection()}else if(true===AddToSelect){this.Selection.Use=true;this.Selection.StartPos=this.CurPos.ContentPos;this.Selection.EndPos=this.CurPos.ContentPos;var Item=this.Content[this.CurPos.ContentPos];Item.MoveCursorToEndOfLine(AddToSelect);if(this.Selection.StartPos==this.Selection.EndPos&&false===this.Content[this.Selection.StartPos].IsSelectionUse()){this.Selection.Use= false;this.CurPos.ContentPos=this.Selection.EndPos}}else{var Item=this.Content[this.CurPos.ContentPos];Item.MoveCursorToEndOfLine(AddToSelect)}this.Document_UpdateInterfaceState();this.private_UpdateCursorXY(true,true)};CDocument.prototype.controller_MoveCursorToStartOfLine=function(AddToSelect){if(this.CurPos.ContentPos<0)return false;this.RemoveNumberingSelection();if(true===this.Selection.Use)if(true===AddToSelect){var Item=this.Content[this.Selection.EndPos];Item.MoveCursorToStartOfLine(AddToSelect); if(this.Selection.StartPos==this.Selection.EndPos&&false===this.Content[this.Selection.StartPos].IsSelectionUse()){this.Selection.Use=false;this.CurPos.ContentPos=this.Selection.EndPos}}else{var Pos=this.Selection.StartPos<=this.Selection.EndPos?this.Selection.StartPos:this.Selection.EndPos;this.CurPos.ContentPos=Pos;var Item=this.Content[Pos];Item.MoveCursorToStartOfLine(AddToSelect);this.RemoveSelection()}else if(true===AddToSelect){this.Selection.Use=true;this.Selection.StartPos=this.CurPos.ContentPos; this.Selection.EndPos=this.CurPos.ContentPos;var Item=this.Content[this.CurPos.ContentPos];Item.MoveCursorToStartOfLine(AddToSelect);if(this.Selection.StartPos==this.Selection.EndPos&&false===this.Content[this.Selection.StartPos].IsSelectionUse()){this.Selection.Use=false;this.CurPos.ContentPos=this.Selection.EndPos}}else{var Item=this.Content[this.CurPos.ContentPos];Item.MoveCursorToStartOfLine(AddToSelect)}this.Document_UpdateInterfaceState();this.private_UpdateCursorXY(true,true)};CDocument.prototype.controller_MoveCursorToXY= function(X,Y,PageAbs,AddToSelect){this.CurPage=PageAbs;this.RemoveNumberingSelection();if(true===this.Selection.Use)if(true===AddToSelect)this.Selection_SetEnd(X,Y,true);else{this.RemoveSelection();var ContentPos=this.Internal_GetContentPosByXY(X,Y);this.CurPos.ContentPos=ContentPos;var ElementPageIndex=this.private_GetElementPageIndexByXY(ContentPos,X,Y,PageAbs);this.Content[ContentPos].MoveCursorToXY(X,Y,false,false,ElementPageIndex);this.Document_UpdateInterfaceState()}else if(true===AddToSelect){this.StartSelectionFromCurPos(); var oMouseEvent=new AscCommon.CMouseEventHandler;oMouseEvent.Type=AscCommon.g_mouse_event_type_up;this.Selection_SetEnd(X,Y,oMouseEvent)}else{var ContentPos=this.Internal_GetContentPosByXY(X,Y);this.CurPos.ContentPos=ContentPos;var ElementPageIndex=this.private_GetElementPageIndexByXY(ContentPos,X,Y,PageAbs);this.Content[ContentPos].MoveCursorToXY(X,Y,false,false,ElementPageIndex);this.Document_UpdateInterfaceState()}};CDocument.prototype.controller_MoveCursorToCell=function(bNext){if(true===this.Selection.Use){if(this.Selection.StartPos=== this.Selection.EndPos)this.Content[this.Selection.StartPos].MoveCursorToCell(bNext)}else this.Content[this.CurPos.ContentPos].MoveCursorToCell(bNext)};CDocument.prototype.controller_SetParagraphAlign=function(Align){if(this.CurPos.ContentPos<0)return false;if(true===this.Selection.Use){var StartPos=this.Selection.StartPos;var EndPos=this.Selection.EndPos;if(EndPos=this.Content.length){EndPos=this.Content.length-1;break}var TempItem=this.Content[EndPos];if(type_Paragraph!==TempItem.GetType()){EndPos--;break}CurBrd=TempItem.Get_CompiledPr().ParaPr.Brd}for(var Index=StartPos;Index<=EndPos;Index++)this.Content[Index].SetParagraphBorders(Borders)}else Item.SetParagraphBorders(Borders)}};CDocument.prototype.controller_SetParagraphFramePr= function(FramePr,bDelete){if(true===this.Selection.Use){if(this.Selection.StartPos===this.Selection.EndPos&&type_Paragraph!==this.Content[this.Selection.StartPos].GetType()){this.Content[this.Selection.StartPos].SetParagraphFramePr(FramePr,bDelete);return}var StartPos=this.Selection.StartPos;var EndPos=this.Selection.EndPos;if(StartPos>EndPos){StartPos=this.Selection.EndPos;EndPos=this.Selection.StartPos}var Element=this.Content[StartPos];if(type_Paragraph!==Element.GetType()||undefined===Element.Get_FramePr())return; var FramePr=Element.Get_FramePr();for(var Pos=StartPos+1;Pos0&&type_Paragraph===this.Content[StartPos-1].GetType()){var PrevFrame=this.Content[StartPos-1].Get_FramePr();if(undefined!=PrevFrame&&undefined!=PrevFrame.DropCap){Result_ParaPr.FramePr=PrevFrame.Copy();this.Content[StartPos-1].Supplement_FramePr(Result_ParaPr.FramePr)}}}else{var Item= this.Content[this.CurPos.ContentPos];if(type_Paragraph==Item.GetType()){Result_ParaPr=Item.GetCalculatedParaPr().Copy();Result_ParaPr.CanAddTable=true===Result_ParaPr.Locked?Item.IsCursorAtEnd():true;if(undefined!=Result_ParaPr.FramePr)Item.Supplement_FramePr(Result_ParaPr.FramePr);else if(this.CurPos.ContentPos>0&&type_Paragraph===this.Content[this.CurPos.ContentPos-1].GetType()){var PrevFrame=this.Content[this.CurPos.ContentPos-1].Get_FramePr();if(undefined!=PrevFrame&&undefined!=PrevFrame.DropCap){Result_ParaPr.FramePr= PrevFrame.Copy();this.Content[this.CurPos.ContentPos-1].Supplement_FramePr(Result_ParaPr.FramePr)}}}else Result_ParaPr=Item.GetCalculatedParaPr()}if(Result_ParaPr.Shd&&Result_ParaPr.Shd.Unifill)Result_ParaPr.Shd.Unifill.check(this.theme,this.Get_ColorMap());return Result_ParaPr};CDocument.prototype.controller_GetCalculatedTextPr=function(){var Result_TextPr=null;if(true===this.Selection.Use){var VisTextPr;switch(this.Selection.Flag){case selectionflag_Common:{var StartPos=this.Selection.StartPos; var EndPos=this.Selection.EndPos;if(EndPosEnd){var Temp=Start;Start=End;End=Temp}Start=Math.max(0,Start);End=Math.min(this.Content.length-1,End);for(var Index=Start;Index<=End;Index++)this.Content[Index].RemoveSelection();this.Selection.Use=false;this.Selection.Start=false;this.Selection.StartPos=0;this.Selection.EndPos=0;this.DrawingDocument.SelectEnabled(false);this.DrawingDocument.TargetStart();this.DrawingDocument.TargetShow();break}case selectionflag_Numbering:{if(!this.Selection.Data)break; for(var nIndex=0,nCount=this.Selection.Data.Paragraphs.length;nIndexEnd){var Temp=Start;Start=End;End=Temp}Start=Math.max(0,Start);End=Math.min(this.Content.length-1,End);for(var Index=Start;Index<=End;Index++)this.Content[Index].RemoveSelection(); this.Selection.Use=false;this.Selection.Start=false;this.Selection.Flag=selectionflag_Common;this.DrawingDocument.SelectEnabled(false);this.DrawingDocument.TargetStart();this.DrawingDocument.TargetShow();break}}};CDocument.prototype.controller_IsSelectionEmpty=function(bCheckHidden){if(true===this.Selection.Use)if(selectionflag_Numbering==this.Selection.Flag)return false;else if(true===this.IsMovingTableBorder())return false;else if(this.Selection.StartPos===this.Selection.EndPos)return this.Content[this.Selection.StartPos].IsSelectionEmpty(bCheckHidden); else return false;return true};CDocument.prototype.controller_DrawSelectionOnPage=function(PageAbs){if(true!==this.Selection.Use)return;var Page=this.Pages[PageAbs];for(var SectionIndex=0,SectionsCount=Page.Sections.length;SectionIndexEnd){Start=this.Selection.EndPos;End=this.Selection.StartPos}var Start=Math.max(Start,Pos_start);var End=Math.min(End,Pos_end);for(var Index=Start;Index<=End;++Index){var ElementPage=this.private_GetElementPageIndex(Index,PageAbs,ColumnIndex,ColumnsCount);this.Content[Index].DrawSelectionOnPage(ElementPage)}if(PageAbs>=2&&End=2&&this.Selection.Data[this.Selection.Data.length-1]End){Start=this.Selection.EndPos;End=this.Selection.StartPos}if(Start===End)return this.Content[Start].GetSelectionBounds();else{var Result={};Result.Start=this.Content[Start].GetSelectionBounds().Start;Result.End=this.Content[End].GetSelectionBounds().End;Result.Direction=this.Selection.StartPos> this.Selection.EndPos?-1:1;return Result}}else if(this.Content[this.CurPos.ContentPos])return this.Content[this.CurPos.ContentPos].GetSelectionBounds();return null};CDocument.prototype.controller_IsMovingTableBorder=function(){if(null!=this.Selection.Data&&true===this.Selection.Data.TableBorder)return true;return false};CDocument.prototype.controller_CheckPosInSelection=function(X,Y,PageAbs,NearPos){if(this.Footnotes.CheckHitInFootnote(X,Y,PageAbs)||this.Endnotes.CheckHitInEndnote(X,Y,PageAbs))return false; if(true===this.Selection.Use){switch(this.Selection.Flag){case selectionflag_Common:{var Start=this.Selection.StartPos;var End=this.Selection.EndPos;if(Start>End){Start=this.Selection.EndPos;End=this.Selection.StartPos}if(undefined!==NearPos){for(var Index=Start;Index<=End;Index++)if(true===this.Content[Index].CheckPosInSelection(0,0,0,NearPos))return true;return false}else{var ContentPos=this.Internal_GetContentPosByXY(X,Y,PageAbs,NearPos);if(ContentPos>Start&&ContentPosEnd)return false;else{var ElementPageIndex=this.private_GetElementPageIndexByXY(ContentPos,X,Y,PageAbs);return this.Content[ContentPos].CheckPosInSelection(X,Y,ElementPageIndex,undefined)}}}case selectionflag_Numbering:{return false}}return false}return false};CDocument.prototype.controller_SelectAll=function(){if(true===this.Selection.Use)this.RemoveSelection();this.DrawingDocument.SelectEnabled(true);this.DrawingDocument.TargetEnd();this.SetDocPosType(docpostype_Content);this.Selection.Use= true;this.Selection.Start=false;this.Selection.Flag=selectionflag_Common;this.Selection.StartPos=0;this.Selection.EndPos=this.Content.length-1;for(var Index=0;IndexEndPos){StartPos=this.Selection.EndPos; EndPos=this.Selection.StartPos}for(var Index=StartPos;Index<=EndPos;Index++)this.Content[Index].GetSelectedContent(oSelectedContent);oSelectedContent.SetLastSection(this.SectionsInfo.Get_SectPr(EndPos).SectPr)};CDocument.prototype.controller_UpdateCursorType=function(X,Y,PageAbs,MouseEvent){var bInText=null===this.IsInText(X,Y,PageAbs)?false:true;var bTableBorder=null===this.IsTableBorder(X,Y,PageAbs)?false:true;if(true===this.DrawingObjects.updateCursorType(PageAbs,X,Y,MouseEvent,true===bInText|| true===bTableBorder?true:false))return;var ContentPos=this.Internal_GetContentPosByXY(X,Y,PageAbs);var Item=this.Content[ContentPos];var ElementPageIndex=this.private_GetElementPageIndexByXY(ContentPos,X,Y,PageAbs);Item.UpdateCursorType(X,Y,ElementPageIndex)};CDocument.prototype.controller_PasteFormatting=function(TextPr,ParaPr){if(true===this.Selection.Use){if(selectionflag_Common===this.Selection.Flag){var Start=this.Selection.StartPos;var End=this.Selection.EndPos;if(Start>End){Start=this.Selection.EndPos; End=this.Selection.StartPos}for(var Pos=Start;Pos<=End;Pos++)this.Content[Pos].PasteFormatting(TextPr,ParaPr,Start===End?false:true)}}else this.Content[this.CurPos.ContentPos].PasteFormatting(TextPr,ParaPr,true)};CDocument.prototype.controller_IsSelectionUse=function(){if(true===this.Selection.Use)return true;return false};CDocument.prototype.controller_IsNumberingSelection=function(){return CDocumentContentBase.prototype.IsNumberingSelection.apply(this,arguments)};CDocument.prototype.controller_IsTextSelectionUse= function(){return this.Selection.Use};CDocument.prototype.controller_GetCurPosXY=function(){if(true===this.Selection.Use)if(selectionflag_Numbering===this.Selection.Flag)return{X:0,Y:0};else return this.Content[this.Selection.EndPos].GetCurPosXY();else return this.Content[this.CurPos.ContentPos].GetCurPosXY()};CDocument.prototype.controller_GetSelectedText=function(bClearText,oPr){if(true===this.Selection.Use&&selectionflag_Common===this.Selection.Flag||false===this.Selection.Use)if(true===bClearText&& this.Selection.StartPos===this.Selection.EndPos){var Pos=true==this.Selection.Use?this.Selection.StartPos:this.CurPos.ContentPos;return this.Content[Pos].GetSelectedText(true,oPr)}else if(false===bClearText){var StartPos=true==this.Selection.Use?Math.min(this.Selection.StartPos,this.Selection.EndPos):this.CurPos.ContentPos;var EndPos=true==this.Selection.Use?Math.max(this.Selection.StartPos,this.Selection.EndPos):this.CurPos.ContentPos;var ResultText="";for(var Index=StartPos;Index<=EndPos;Index++)ResultText+= this.Content[Index].GetSelectedText(false,oPr);return ResultText}return null};CDocument.prototype.controller_GetCurrentParagraph=function(bIgnoreSelection,arrSelectedParagraphs,oPr){if(null!==arrSelectedParagraphs)if(true===this.Selection.Use){var nStartPos=this.Selection.StartPos<=this.Selection.EndPos?this.Selection.StartPos:this.Selection.EndPos;var nEndPos=this.Selection.StartPos<=this.Selection.EndPos?this.Selection.EndPos:this.Selection.StartPos;for(var nPos=nStartPos;nPos<=nEndPos;++nPos)this.Content[nPos].GetCurrentParagraph(false, arrSelectedParagraphs,oPr)}else this.Content[this.CurPos.ContentPos].GetCurrentParagraph(false,arrSelectedParagraphs,oPr);else{var Pos=true===this.Selection.Use&&true!==bIgnoreSelection?this.Selection.StartPos:this.CurPos.ContentPos;if(Pos<0||Pos>=this.Content.length)return null;return this.Content[Pos].GetCurrentParagraph(bIgnoreSelection,null,oPr)}};CDocument.prototype.controller_GetCurrentTablesStack=function(arrTables){if(true===this.Selection.Use)if(this.Selection.StartPos!==this.Selection.EndPos)return arrTables; else return this.Content[this.Selection.StartPos].GetCurrentTablesStack(arrTables);else return this.Content[this.CurPos.ContentPos].GetCurrentTablesStack(arrTables)};CDocument.prototype.controller_GetSelectedElementsInfo=function(oInfo){if(true===this.Selection.Use)if(selectionflag_Numbering===this.Selection.Flag){if(this.Selection.Data&&this.Selection.Data.CurPara)this.Selection.Data.CurPara.GetSelectedElementsInfo(oInfo)}else{if(this.Selection.StartPos!==this.Selection.EndPos)oInfo.SetMixedSelection(); if(oInfo.IsCheckAllSelection()||this.Selection.StartPos===this.Selection.EndPos){var nStart=this.Selection.StartPos=this.Content.length-1)Pos--;if(Pos<0)Pos=0;this.SetDocPosType(docpostype_Content);this.CurPos.ContentPos=Pos;this.Content[Pos].MoveCursorToStartPos()}}else Table.RemoveTable()}};CDocument.prototype.controller_SelectTable=function(Type){if(true===this.Selection.Use&& this.Selection.StartPos==this.Selection.EndPos&&type_Paragraph!==this.Content[this.Selection.StartPos].GetType()||false==this.Selection.Use&&type_Paragraph!==this.Content[this.CurPos.ContentPos].GetType()){var Pos=0;if(true===this.Selection.Use)Pos=this.Selection.StartPos;else Pos=this.CurPos.ContentPos;this.Content[Pos].SelectTable(Type);if(false===this.Selection.Use&&true===this.Content[Pos].IsSelectionUse()){this.Selection.Use=true;this.Selection.StartPos=Pos;this.Selection.EndPos=Pos}}};CDocument.prototype.controller_CanMergeTableCells= function(){if(true===this.Selection.Use&&this.Selection.StartPos==this.Selection.EndPos&&type_Paragraph!==this.Content[this.Selection.StartPos].GetType()||false==this.Selection.Use&&type_Paragraph!==this.Content[this.CurPos.ContentPos].GetType()){var Pos=0;if(true===this.Selection.Use)Pos=this.Selection.StartPos;else Pos=this.CurPos.ContentPos;return this.Content[Pos].CanMergeTableCells()}return false};CDocument.prototype.controller_CanSplitTableCells=function(){var nPos=true===this.Selection.Use? this.Selection.StartPos:this.CurPos.ContentPos;return this.Content[nPos].CanSplitTableCells()};CDocument.prototype.controller_UpdateInterfaceState=function(){if(true===this.Selection.Use&&this.Selection.StartPos==this.Selection.EndPos&&type_Paragraph!==this.Content[this.Selection.StartPos].GetType()||false==this.Selection.Use&&type_Paragraph!==this.Content[this.CurPos.ContentPos].GetType()){this.Interface_Update_TablePr();if(true==this.Selection.Use)this.Content[this.Selection.StartPos].Document_UpdateInterfaceState(); else this.Content[this.CurPos.ContentPos].Document_UpdateInterfaceState()}else{this.Interface_Update_ParaPr();this.Interface_Update_TextPr();if(docpostype_Content==this.CurPos.Type&&(true===this.Selection.Use&&this.Selection.StartPos==this.Selection.EndPos&&type_Paragraph==this.Content[this.Selection.StartPos].GetType()||false==this.Selection.Use&&type_Paragraph==this.Content[this.CurPos.ContentPos].GetType()))if(true==this.Selection.Use)this.Content[this.Selection.StartPos].Document_UpdateInterfaceState(); else this.Content[this.CurPos.ContentPos].Document_UpdateInterfaceState()}};CDocument.prototype.controller_UpdateRulersState=function(){this.Document_UpdateRulersStateBySection();if(true===this.Selection.Use){var oSelection=this.private_GetSelectionPos(false);if(oSelection.Start===oSelection.End&&type_Paragraph!==this.Content[oSelection.Start].GetType()){var PagePos=this.Get_DocumentPagePositionByContentPosition(this.GetContentPosition(true,true));var Page=PagePos?PagePos.Page:this.CurPage;var Column= PagePos?PagePos.Column:0;var ElementPos=oSelection.Start;var Element=this.Content[ElementPos];var ElementPageIndex=this.private_GetElementPageIndex(ElementPos,Page,Column,Element.Get_ColumnsCount());Element.Document_UpdateRulersState(ElementPageIndex)}else{var StartPos=oSelection.Start;var EndPos=oSelection.End;var FramePr=undefined;for(var Pos=StartPos;Pos<=EndPos;Pos++){var Element=this.Content[Pos];if(type_Paragraph!=Element.GetType()){FramePr=undefined;break}else{var TempFramePr=Element.Get_FramePr(); if(undefined===FramePr){if(undefined===TempFramePr)break;FramePr=TempFramePr}else if(undefined===TempFramePr||false===FramePr.Compare(TempFramePr)){FramePr=undefined;break}}}if(undefined!==FramePr)this.Content[StartPos].Document_UpdateRulersState()}}else{this.private_CheckCurPage();if(this.CurPos.ContentPos>=0&&(null===this.FullRecalc.Id||this.FullRecalc.StartIndex>this.CurPos.ContentPos)){var PagePos=this.Get_DocumentPagePositionByContentPosition(this.GetContentPosition(false));var Page=PagePos? PagePos.Page:this.CurPage;var Column=PagePos?PagePos.Column:0;var ElementPos=this.CurPos.ContentPos;var Element=this.Content[ElementPos];var ElementPageIndex=this.private_GetElementPageIndex(ElementPos,Page,Column,Element.Get_ColumnsCount());Element.Document_UpdateRulersState(ElementPageIndex)}}};CDocument.prototype.controller_UpdateSelectionState=function(){if(true===this.Selection.Use)if(selectionflag_Numbering==this.Selection.Flag){this.DrawingDocument.TargetEnd();this.DrawingDocument.SelectEnabled(true); this.DrawingDocument.SelectShow()}else if(true===this.IsMovingTableBorder()){this.DrawingDocument.TargetEnd();this.DrawingDocument.SetCurrentPage(this.CurPage)}else if(false===this.IsSelectionEmpty()||!this.RemoveEmptySelection){if(true!==this.Selection.Start){this.private_CheckCurPage();this.RecalculateCurPos()}this.private_UpdateTracks(true,false);this.DrawingDocument.TargetEnd();this.DrawingDocument.SelectEnabled(true);this.DrawingDocument.SelectShow()}else{if(true!==this.Selection.Start)this.RemoveSelection(); this.private_CheckCurPage();this.RecalculateCurPos();this.private_UpdateTracks(true,true);this.DrawingDocument.SelectEnabled(false);this.DrawingDocument.TargetStart();this.DrawingDocument.TargetShow();if(this.IsFillingFormMode()){var oContentControl=this.GetContentControl();if(oContentControl&&oContentControl.IsCheckBox())this.DrawingDocument.TargetEnd()}}else{this.RemoveSelection();this.private_CheckCurPage();this.RecalculateCurPos();this.private_UpdateTracks(false,false);this.DrawingDocument.SelectEnabled(false); this.DrawingDocument.TargetShow();if(this.IsFillingFormMode()){var oContentControl=this.GetContentControl();if(oContentControl&&oContentControl.IsCheckBox())this.DrawingDocument.TargetEnd()}}};CDocument.prototype.controller_GetSelectionState=function(){var State;if(true===this.Selection.Use)if(this.controller_IsNumberingSelection()||this.controller_IsMovingTableBorder())State=[];else{var StartPos=this.Selection.StartPos;var EndPos=this.Selection.EndPos;if(StartPos>EndPos){var Temp=StartPos;StartPos= EndPos;EndPos=Temp}State=[];var TempState=[];for(var Index=StartPos;Index<=EndPos;Index++)TempState.push(this.Content[Index].GetSelectionState());State.push(TempState)}else State=this.Content[this.CurPos.ContentPos].GetSelectionState();return State};CDocument.prototype.controller_SetSelectionState=function(State,StateIndex){if(true===this.Selection.Use)if(selectionflag_Numbering==this.Selection.Flag)if(type_Paragraph===this.Content[this.Selection.StartPos].Get_Type()){var NumPr=this.Content[this.Selection.StartPos].GetNumPr(); if(undefined!==NumPr)this.SelectNumbering(NumPr,this.Content[this.Selection.StartPos]);else this.RemoveSelection()}else this.RemoveSelection();else{var StartPos=this.Selection.StartPos;var EndPos=this.Selection.EndPos;if(StartPos>EndPos){var Temp=StartPos;StartPos=EndPos;EndPos=Temp}var CurState=State[StateIndex];for(var Index=StartPos;Index<=EndPos;Index++)this.Content[Index].SetSelectionState(CurState[Index-StartPos],CurState[Index-StartPos].length-1)}else this.Content[this.CurPos.ContentPos].SetSelectionState(State, StateIndex)};CDocument.prototype.controller_AddHyperlink=function(Props){if(false===this.Selection.Use||this.Selection.StartPos===this.Selection.EndPos){var Pos=true==this.Selection.Use?this.Selection.StartPos:this.CurPos.ContentPos;this.Content[Pos].AddHyperlink(Props)}};CDocument.prototype.controller_ModifyHyperlink=function(Props){if(false==this.Selection.Use||this.Selection.StartPos==this.Selection.EndPos){var Pos=true==this.Selection.Use?this.Selection.StartPos:this.CurPos.ContentPos;this.Content[Pos].ModifyHyperlink(Props)}}; CDocument.prototype.controller_RemoveHyperlink=function(){if(false==this.Selection.Use||this.Selection.StartPos==this.Selection.EndPos){var Pos=true==this.Selection.Use?this.Selection.StartPos:this.CurPos.ContentPos;this.Content[Pos].RemoveHyperlink()}};CDocument.prototype.controller_CanAddHyperlink=function(bCheckInHyperlink){if(true===this.Selection.Use){if(selectionflag_Common===this.Selection.Flag){if(this.Selection.StartPos!=this.Selection.EndPos)return false;return this.Content[this.Selection.StartPos].CanAddHyperlink(bCheckInHyperlink)}}else return this.Content[this.CurPos.ContentPos].CanAddHyperlink(bCheckInHyperlink); return false};CDocument.prototype.controller_IsCursorInHyperlink=function(bCheckEnd){if(true===this.Selection.Use){if(selectionflag_Common===this.Selection.Flag){if(this.Selection.StartPos!=this.Selection.EndPos)return null;return this.Content[this.Selection.StartPos].IsCursorInHyperlink(bCheckEnd)}}else return this.Content[this.CurPos.ContentPos].IsCursorInHyperlink(bCheckEnd);return null};CDocument.prototype.controller_AddComment=function(Comment){if(selectionflag_Numbering===this.Selection.Flag)return; if(true===this.Selection.Use){var StartPos,EndPos;if(this.Selection.StartPosthis.Selection.EndPos)return this.Content[this.Selection.EndPos].GetStyleFromFormatting();else return this.Content[this.Selection.StartPos].GetStyleFromFormatting();else return this.Content[this.CurPos.ContentPos].GetStyleFromFormatting()};CDocument.prototype.controller_GetSimilarNumbering=function(oContinueEngine){this.GetSimilarNumbering(oContinueEngine)};CDocument.prototype.controller_GetPlaceHolderObject=function(){var nCurPos=this.CurPos.ContentPos; if(this.Selection.Use)if(this.Selection.StartPos===this.Selection.EndPos)nCurPos=this.Selection.StartPos;else return null;return this.Content[nCurPos].GetPlaceHolderObject()};CDocument.prototype.controller_GetAllFields=function(isUseSelection,arrFields){if(!arrFields)arrFields=[];var nStartPos=isUseSelection?this.Selection.Use?this.Selection.StartPos=nCount)nNewIndex=0}else{nNewIndex=nIndex-1;if(nNewIndex<0)nNewIndex=nCount-1}var sNewValue=oComboBoxPr.GetItemValue(nNewIndex);oForm.SelectContentControl();oForm.SkipSpecialContentControlLock(true);if(!this.IsSelectionLocked(AscCommon.changestype_Paragraph_Content,null,true,this.IsFormFieldEditing())){this.StartAction();oForm.SelectListItem(sNewValue);oForm.SelectContentControl();this.Recalculate();this.FinalizeAction()}oForm.SkipSpecialContentControlLock(false)}; CDocument.prototype.OnContentControlTrackEnd=function(Id,NearestPos,isCopy){return this.OnEndTextDrag(NearestPos,isCopy)};CDocument.prototype.AddContentControl=function(nContentControlType){if(this.IsDrawingSelected()&&!this.DrawingObjects.getTargetDocContent()){var oDrawing=this.DrawingObjects.getMajorParaDrawing();if(oDrawing)oDrawing.SelectAsText()}return this.Controller.AddContentControl(nContentControlType)};CDocument.prototype.GetAllContentControls=function(){var arrContentControls=[];this.SectionsInfo.GetAllContentControls(arrContentControls); for(var nIndex=0,nCount=this.Content.length;nIndex=oDocContent.GetElementsCount())oDocContent.MoveCursorToEndPos();else{oDocContent.CurPos.ContentPos=Math.max(0,Math.min(oDocContent.GetElementsCount()-1,nIndex));oDocContent.Content[oDocContent.CurPos.ContentPos].MoveCursorToStartPos()}else if(nIndex0))return;var sInstr="";var sSuffix="";if(bHyperlink)sSuffix+=" \\h";if(bAboveBelow&&nType!==Asc.c_oAscDocumentRefenceToType.AboveBelow)sSuffix+=" \\p";if(typeof sSeparator==="string"&&sSeparator.length>0)sSuffix+=" \\d "+sSeparator;switch(nType){case Asc.c_oAscDocumentRefenceToType.PageNum:{sInstr=" PAGEREF "+sBookmarkName;sInstr+=sSuffix;break}case Asc.c_oAscDocumentRefenceToType.Text:case Asc.c_oAscDocumentRefenceToType.OnlyCaptionText:case Asc.c_oAscDocumentRefenceToType.OnlyLabelAndNumber:{sInstr= " REF "+sBookmarkName+" ";sInstr+=sSuffix;break}case Asc.c_oAscDocumentRefenceToType.ParaNum:{sInstr=" REF "+sBookmarkName+" \\r ";sInstr+=sSuffix;break}case Asc.c_oAscDocumentRefenceToType.ParaNumNoContext:{sInstr=" REF "+sBookmarkName+" \\n ";sInstr+=sSuffix;break}case Asc.c_oAscDocumentRefenceToType.ParaNumFullContex:{sInstr=" REF "+sBookmarkName+" \\w ";sInstr+=sSuffix;break}case Asc.c_oAscDocumentRefenceToType.AboveBelow:{sInstr=" REF "+sBookmarkName+" \\p ";sInstr+=sSuffix;break}}var oComplexField= this.AddFieldWithInstruction(sInstr);if(nType===Asc.c_oAscDocumentRefenceToType.PageNum){this.FullRecalc.Continue=false;this.FullRecalc.UseRecursion=false;this.private_Recalculate(undefined,true);while(this.FullRecalc.Continue){this.FullRecalc.Continue=false;this.Recalculate_Page()}this.FullRecalc.UseRecursion=true;oComplexField.Update(false)}return oComplexField};CDocument.prototype.AddNoteRefToParagraph=function(oParagraph,nType,bHyperlink,bAboveBelow){if(!oParagraph.Parent)return;var oFootnote= oParagraph.Parent.IsFootnote(true);if(!oFootnote)return;var oRef=oFootnote.Ref;if(!oRef)return;var oRun=oRef.Run;if(!oRun)return;var oRefParagraph=oRun.Paragraph;if(!oRefParagraph)return;if(Asc.c_oAscDocumentRefenceToType.AboveBelow===nType){var bIsHdrFtr=docpostype_HdrFtr===this.GetDocPosType();var bIsRefHdrFtr=oRefParagraph.Parent&&oRefParagraph.Parent.IsHdrFtr(false);if(bIsHdrFtr!==bIsRefHdrFtr)return}if(false===this.IsSelectionLocked(AscCommon.changestype_Document_Content,{Type:changestype_2_ElementsArray_and_Type, Elements:[oRefParagraph],CheckType:changestype_Paragraph_Content})){this.StartAction(AscDFH.historydescription_Document_AddCrossRef);var sBookmarkName;if(Asc.c_oAscDocumentRefenceToType.PageNum===nType)sBookmarkName=oParagraph.AddBookmarkForRef();else sBookmarkName=oParagraph.AddBookmarkForNoteRef();if(sBookmarkName){this.private_AddNoteRefToBookmark(sBookmarkName,nType,bHyperlink,bAboveBelow);this.Recalculate()}this.UpdateInterface();this.UpdateSelection();this.FinalizeAction()}};CDocument.prototype.private_AddNoteRefToBookmark= function(sBookmarkName,nType,bHyperlink,bAboveBelow){if(!(typeof sBookmarkName==="string"&&sBookmarkName.length>0))return;var sInstr="";var sSuffix="";if(bHyperlink)sSuffix+=" \\h";if(bAboveBelow&&nType!==Asc.c_oAscDocumentRefenceToType.AboveBelow)sSuffix+=" \\p";switch(nType){case Asc.c_oAscDocumentRefenceToType.NoteNumber:{sInstr=" NOTEREF "+sBookmarkName;sInstr+=sSuffix;break}case Asc.c_oAscDocumentRefenceToType.PageNum:{sInstr=" PAGEREF "+sBookmarkName;sInstr+=sSuffix;break}case Asc.c_oAscDocumentRefenceToType.NoteNumberFormatted:{sInstr= " NOTEREF "+sBookmarkName+" \\f ";sInstr+=sSuffix;break}case Asc.c_oAscDocumentRefenceToType.AboveBelow:{sInstr=" NOTEREF "+sBookmarkName+" \\p ";sInstr+=sSuffix;break}}var oComplexField=this.AddFieldWithInstruction(sInstr);if(nType!==Asc.c_oAscDocumentRefenceToType.AboveBelow){this.FullRecalc.Continue=false;this.FullRecalc.UseRecursion=false;this.private_Recalculate(undefined,true);while(this.FullRecalc.Continue){this.FullRecalc.Continue=false;this.Recalculate_Page()}this.FullRecalc.UseRecursion= true;oComplexField.Update(false)}return oComplexField};CDocument.prototype.AddRefToCaption=function(sCaption,oParagraph,nType,bHyperlink,bAboveBelow){if(nType===Asc.c_oAscDocumentRefenceToType.PageNum||nType===Asc.c_oAscDocumentRefenceToType.AboveBelow||nType===Asc.c_oAscDocumentRefenceToType.Text){this.AddRefToParagraph(oParagraph,nType,bHyperlink,bAboveBelow);return}this.StartAction(AscDFH.historydescription_Document_AddCrossRef);var sBookmarkName=null;switch(nType){case Asc.c_oAscDocumentRefenceToType.OnlyLabelAndNumber:{sBookmarkName= oParagraph.AddBookmarkForCaption(sCaption,false);break}case Asc.c_oAscDocumentRefenceToType.OnlyCaptionText:{sBookmarkName=oParagraph.AddBookmarkForCaption(sCaption,true);break}}if(sBookmarkName)this.private_AddRefToBookmark(sBookmarkName,nType,bHyperlink,bAboveBelow,null);this.UpdateInterface();this.UpdateSelection();this.FinalizeAction()};CDocument.prototype.private_CreateComplexFieldRun=function(sInstruction,oParagraph){var oBeginChar=new ParaFieldChar(fldchartype_Begin,this),oSeparateChar=new ParaFieldChar(fldchartype_Separate, this),oEndChar=new ParaFieldChar(fldchartype_End,this);var oRun=new ParaRun;oRun.AddToContent(-1,oBeginChar);oRun.AddInstrText(sInstruction);oRun.AddToContent(-1,oSeparateChar);oRun.AddToContent(-1,oEndChar);oParagraph.Add(oRun);oBeginChar.SetRun(oRun);oSeparateChar.SetRun(oRun);oEndChar.SetRun(oRun);var oComplexField=oBeginChar.GetComplexField();oComplexField.SetBeginChar(oBeginChar);oComplexField.SetInstructionLine(sInstruction);oComplexField.SetSeparateChar(oSeparateChar);oComplexField.SetEndChar(oEndChar); oComplexField.Update(false);return oComplexField};CDocument.prototype.UpdateComplexField=function(oField){if(!oField)return;oField.Update(true)};CDocument.prototype.GetCurrentComplexFields=function(){var oParagraph=this.GetCurrentParagraph();if(!oParagraph)return[];return oParagraph.GetCurrentComplexFields()};CDocument.prototype.IsFastCollaborationBeforeViewModeInReview=function(){return this.ViewModeInReview.isFastCollaboration};CDocument.prototype.CheckComplexFieldsInSelection=function(){if(true!== this.Selection.Use||this.Controller!==this.LogicDocumentController)return;var oStartPos=this.GetContentPosition(true,true);var oEndPos=this.GetContentPosition(true,false);var arrStartComplexFields=this.GetComplexFieldsByContentPos(oStartPos);var arrEndComplexFields=this.GetComplexFieldsByContentPos(oEndPos);var arrStartFields=[];for(var nIndex=0,nCount=arrStartComplexFields.length;nIndex0){if(arrStartFields.length> 0&&arrStartFields[0].IsValid())oStartPos=arrStartFields[0].GetStartDocumentPosition();if(arrEndFields.length>0&&arrEndFields[0].IsValid())oEndPos=arrEndFields[0].GetEndDocumentPosition()}else{if(arrStartFields.length>0&&arrStartFields[0].IsValid())oStartPos=arrStartFields[0].GetEndDocumentPosition();if(arrEndFields.length>0&&arrEndFields[0].IsValid())oEndPos=arrEndFields[0].GetStartDocumentPosition()}this.SetContentSelection(oStartPos,oEndPos,0,0,0)};CDocument.prototype.GetComplexFieldTextValue=function(oComplexField){if(!oComplexField)return null; var oState=this.SaveDocumentState();oComplexField.SelectFieldValue();var sResult=this.GetSelectedText();this.LoadDocumentState(oState);this.Document_UpdateSelectionState();return sResult};CDocument.prototype.GetComplexFieldTextPr=function(oComplexField){if(!oComplexField)return new CTextPr;var oState=this.SaveDocumentState();oComplexField.SelectFieldValue();var oTextPr=this.GetDirectTextPr();this.LoadDocumentState(oState);this.Document_UpdateSelectionState();return oTextPr};CDocument.prototype.GetFieldsManager= function(){return this.FieldsManager};CDocument.prototype.GetComplexFieldsByContentPos=function(oDocPos){if(!oDocPos)return[];var oCurrentDocPos=this.GetContentPosition(false);this.SetContentPosition(oDocPos,0,0);var oCurrentParagraph=this.controller_GetCurrentParagraph(true,null);if(!oCurrentParagraph)return[];var arrComplexFields=oCurrentParagraph.GetCurrentComplexFields();this.SetContentPosition(oCurrentDocPos,0,0);return arrComplexFields};CDocument.prototype.GetAllFields=function(isUseSelection){var arrFields= [];if(isUseSelection)this.Controller.GetAllFields(isUseSelection,arrFields);else{this.LogicDocumentController.GetAllFields(false,arrFields);var arrHdrFtrs=this.SectionsInfo.GetAllHdrFtrs();for(var nIndex=0,nCount=arrHdrFtrs.length;nIndex1){arrParagraphs.push(arrSelectedParagraphs[0]);arrParagraphs.push(arrSelectedParagraphs[arrSelectedParagraphs.length-1]);oStartPara=arrSelectedParagraphs[0];oEndPara=arrSelectedParagraphs[arrSelectedParagraphs.length-1]}else if(arrSelectedParagraphs.length===1){arrParagraphs.push(arrSelectedParagraphs[0]);oStartPara=arrSelectedParagraphs[0]; oEndPara=arrSelectedParagraphs[0]}}else{var oCurrentParagraph=this.GetCurrentParagraph(true);if(oCurrentParagraph){arrParagraphs.push(oCurrentParagraph);oStartPara=oCurrentParagraph}}if(arrParagraphs.length<=0)return;if(arrBookmarkChars){var oStartPara=arrBookmarkChars[0].GetParagraph();var oEndPara=arrBookmarkChars[1].GetParagraph();if(oStartPara)arrParagraphs.push(oStartPara);if(oEndPara)arrParagraphs.push(oEndPara)}if(false===this.Document_Is_SelectionLocked(changestype_None,{Type:AscCommon.changestype_2_ElementsArray_and_Type, Elements:arrParagraphs,CheckType:changestype_Paragraph_Content},true)){this.StartAction(AscDFH.historydescription_Document_AddBookmark);if(this.BookmarksManager.HaveBookmark(sName))this.private_RemoveBookmark(sName);var sBookmarkId=this.BookmarksManager.GetNewBookmarkId();if(true===this.IsSelectionUse()){var nDirection=this.GetSelectDirection();if(nDirection>0){oEndPara.AddBookmarkChar(new CParagraphBookmark(false,sBookmarkId,sName),true,false);oStartPara.AddBookmarkChar(new CParagraphBookmark(true, sBookmarkId,sName),true,true)}else{oEndPara.AddBookmarkChar(new CParagraphBookmark(false,sBookmarkId,sName),true,true);oStartPara.AddBookmarkChar(new CParagraphBookmark(true,sBookmarkId,sName),true,false)}}else{oStartPara.AddBookmarkChar(new CParagraphBookmark(false,sBookmarkId,sName),false);oStartPara.AddBookmarkChar(new CParagraphBookmark(true,sBookmarkId,sName),false)}this.Recalculate();this.FinalizeAction()}};CDocument.prototype.RemoveBookmark=function(sName){var arrBookmarkChars=this.BookmarksManager.GetBookmarkByName(sName); var arrParagraphs=[];if(arrBookmarkChars){var oStartPara=arrBookmarkChars[0].GetParagraph();var oEndPara=arrBookmarkChars[1].GetParagraph();if(oStartPara)arrParagraphs.push(oStartPara);if(oEndPara)arrParagraphs.push(oEndPara)}if(false===this.Document_Is_SelectionLocked(changestype_None,{Type:AscCommon.changestype_2_ElementsArray_and_Type,Elements:arrParagraphs,CheckType:changestype_Paragraph_Content},true)){this.StartAction(AscDFH.historydescription_Document_RemoveBookmark);this.private_RemoveBookmark(sName); this.Recalculate();this.FinalizeAction()}};CDocument.prototype.GoToBookmark=function(sName,isSelect){if(isSelect)this.BookmarksManager.SelectBookmark(sName);else this.BookmarksManager.GoToBookmark(sName)};CDocument.prototype.private_RemoveBookmark=function(sName){var arrBookmarkChars=this.BookmarksManager.GetBookmarkByName(sName);if(!arrBookmarkChars)return;arrBookmarkChars[1].RemoveBookmark();arrBookmarkChars[0].RemoveBookmark()};CDocument.prototype.AddTableOfContents=function(sHeading,oPr,oSdt){var oStyles= this.GetStyles();var nStylesType=oPr?oPr.get_StylesType():Asc.c_oAscTOCStylesType.Current;var isNeedChangeStyles=Asc.c_oAscTOCStylesType.Current!==nStylesType&&nStylesType!==oStyles.GetTOCStylesType();var isLocked=true;if(isNeedChangeStyles)isLocked=this.IsSelectionLocked(AscCommon.changestype_Document_Content,{Type:AscCommon.changestype_2_AdditionalTypes,Types:[AscCommon.changestype_Document_Styles]});else isLocked=this.IsSelectionLocked(AscCommon.changestype_Document_Content);if(!isLocked){this.StartAction(AscDFH.historydescription_Document_AddTableOfContents); if(this.DrawingObjects.selectedObjects.length>0){var oContent=this.DrawingObjects.getTargetDocContent();if(!oContent||oContent.bPresentation)this.DrawingObjects.resetInternalSelection()}if(oSdt instanceof CBlockLevelSdt)oSdt.ClearContentControl();else{this.Remove(1,true,true,true);oSdt=this.AddContentControl(c_oAscSdtLevelType.Block);if(sHeading){var oParagraph=oSdt.GetCurrentParagraph();oParagraph.Style_Add(this.Get_Styles().GetDefaultTOCHeading());for(var oIterator=sHeading.getUnicodeIterator();oIterator.check();oIterator.next()){var nCharCode= oIterator.value();if(AscCommon.IsSpace(nCharCode))oParagraph.Add(new ParaSpace(nCharCode));else oParagraph.Add(new ParaText(nCharCode))}oSdt.AddNewParagraph(false,true)}}oSdt.SetThisElementCurrent();var sInstruction='TOC \\o "1-3" \\h \\z \\u';if(oPr){var oInstruction=new CFieldInstructionTOC;oInstruction.SetPr(oPr);sInstruction=oInstruction.ToString();if(isNeedChangeStyles)oStyles.SetTOCStylesType(nStylesType)}this.AddFieldWithInstruction(sInstruction);oSdt.SetDocPartObj(undefined,"Table of Contents", true);var oNextParagraph=oSdt.GetNextParagraph();if(oNextParagraph){oNextParagraph.MoveCursorToStartPos(false);oNextParagraph.Document_SetThisElementCurrent()}else oSdt.MoveCursorToEndPos(false);this.Recalculate();this.UpdateInterface();this.UpdateSelection();this.UpdateRulers();this.FinalizeAction()}};CDocument.prototype.AddTableOfFigures=function(oPr){var oStyles=this.GetStyles();var nStylesType=oPr?oPr.get_StylesType():Asc.c_oAscTOFStylesType.Current;var isNeedChangeStyles=Asc.c_oAscTOFStylesType.Current!== nStylesType&&nStylesType!==oStyles.GetTOFStyleType();var isLocked=true;if(isNeedChangeStyles)isLocked=this.IsSelectionLocked(AscCommon.changestype_Document_Content,{Type:AscCommon.changestype_2_AdditionalTypes,Types:[AscCommon.changestype_Document_Styles]});else isLocked=this.IsSelectionLocked(AscCommon.changestype_Document_Content);if(!isLocked){this.StartAction(AscDFH.historydescription_Document_AddTableOfContents);if(this.DrawingObjects.selectedObjects.length>0){var oContent=this.DrawingObjects.getTargetDocContent(); if(!oContent||oContent.bPresentation)this.DrawingObjects.resetInternalSelection()}var sInstruction="TOC \\h \\z \\u";if(oPr){var oInstruction=new CFieldInstructionTOC;oInstruction.SetPr(oPr);sInstruction=oInstruction.ToString()}this.Remove(1,true,true,true);var oCurParagraph=this.GetCurrentParagraph();if(oCurParagraph){if(!oCurParagraph.IsEmpty())this.AddNewParagraph(false,false)}else this.AddNewParagraph(false,false);var oComplexField=this.AddFieldWithInstruction(sInstruction);if(oComplexField){if(oPr){if(isNeedChangeStyles)oStyles.SetTOFStyleType(nStylesType); oComplexField.Update();oComplexField.MoveCursorOutsideElement(false);var oNextParagraph;var oParagraph=this.GetCurrentParagraph();if(oParagraph){oNextParagraph=oParagraph.GetNextParagraph();if(oNextParagraph){oNextParagraph.MoveCursorToStartPos(false);oNextParagraph.Document_SetThisElementCurrent()}else oParagraph.MoveCursorToEndPos(false)}}this.Recalculate();this.UpdateInterface();this.UpdateSelection();this.UpdateRulers();this.FinalizeAction()}else{this.FinalizeAction();this.Document_Undo()}}}; CDocument.prototype.GetPagesCount=function(){return this.Pages.length};CDocument.prototype.GetTableOfContents=function(isCurrent){if(true===isCurrent){var oSelectedInfo=this.GetSelectedElementsInfo();return oSelectedInfo.GetTableOfContents()}else{for(var nIndex=0,nCount=this.Content.length;nIndex0)return aResult}return aResult}};CDocument.prototype.GetCurrentComplexField= function(){var oSelectedInfo=this.GetSelectedElementsInfo();var arrComplexFields=oSelectedInfo.GetComplexFields();if(arrComplexFields.length>0)return arrComplexFields[arrComplexFields.length-1];var oPageNum=oSelectedInfo.GetPageNum();if(oPageNum)return oPageNum;var oPagesCount=oSelectedInfo.GetPagesCount();if(oPagesCount)return oPagesCount;return null};CDocument.prototype.ClearListsCache=function(){this.AllParagraphsList=null;this.AllFootnotesList=null;this.AllEndnotesList=null};CDocument.prototype.GetHyperlinkAnchors= function(){var arrAnchors=[];var arrOutline=[];this.GetOutlineParagraphs(arrOutline,{SkipEmptyParagraphs:true,OutlineStart:1,OutlineEnd:9});var nIndex=0,nCount=arrOutline.length;for(nIndex=0;nIndexoNumPr.Lvl)continue; arrParagraphsToChange.push(oPara)}}if(!this.Document_Is_SelectionLocked(changestype_None,{Type:changestype_2_ElementsArray_and_Type,Elements:arrParagraphsToChange,CheckType:AscCommon.changestype_Paragraph_Properties})){this.StartAction(AscDFH.historydescription_Document_ContinueNumbering);for(var nIndex=0,nCount=arrParagraphsToChange.length;nIndex oNumPr.Lvl)continue;arrParagraphsToChange.push(oPara)}if(oCurNumPr)nPrevLvl=oCurNumPr.Lvl}var oNum=this.Numbering.GetNum(oNumPr.NumId);if(isFirstParaOnLvl){if(Asc.c_oAscNumberingFormat.Bullet===oNum.GetLvl(oNumPr.Lvl).GetFormat())return;if(!this.Document_Is_SelectionLocked(changestype_None,{Type:changestype_2_ElementsArray_and_Type,Elements:[oNum],CheckType:AscCommon.changestype_Paragraph_Properties})){this.StartAction(AscDFH.historydescription_Document_RestartNumbering);var oLvl=oNum.GetLvl(oNumPr.Lvl).Copy(); oLvl.Start=nRestartValue;oNum.SetLvl(oLvl,oNumPr.Lvl);this.Recalculate();this.UpdateInterface();this.UpdateSelection();this.FinalizeAction()}}else if(!this.Document_Is_SelectionLocked(changestype_None,{Type:changestype_2_ElementsArray_and_Type,Elements:arrParagraphsToChange,CheckType:AscCommon.changestype_Paragraph_Properties})){this.StartAction(AscDFH.historydescription_Document_RestartNumbering);var oNewNum=oNum.Copy();if(Asc.c_oAscNumberingFormat.Bullet!==oNum.GetLvl(oNumPr.Lvl).GetFormat()){var oLvl= oNewNum.GetLvl(oNumPr.Lvl).Copy();oLvl.Start=nRestartValue;oNewNum.SetLvl(oLvl,oNumPr.Lvl)}var sNewId=oNewNum.GetId();for(var nIndex=0,nCount=arrParagraphsToChange.length;nIndexnMaxLen)nMaxLen=arrExceptions[nIndex].length;var nChar=arrExceptions[nIndex].charAt(0);if(!this.AutoCorrectSettings.FirstLetterExceptions[nChar])this.AutoCorrectSettings.FirstLetterExceptions[nChar]=[];this.AutoCorrectSettings.FirstLetterExceptions[nChar].push(arrExceptions[nIndex])}this.AutoCorrectSettings.FirstLetterExcMaxLen= nMaxLen};CDocument.prototype.CheckFirstLetterAutoCorrectException=function(sWord){var _sWord=sWord.toLowerCase();var nChar=_sWord.charAt(0);if(!this.AutoCorrectSettings.FirstLetterExceptions[nChar])return false;var arrExceptions=this.AutoCorrectSettings.FirstLetterExceptions[nChar];for(var nIndex=0,nCount=arrExceptions.length;nIndexnEndPos){var nTemp=nStartPos;nStartPos=nEndPos;nEndPos= nTemp}return{Start:nStartPos,End:nEndPos}};CDocument.prototype.GetPlaceHolderObject=function(){return this.Controller.GetPlaceHolderObject()};CDocument.prototype.AddBlankPage=function(){if(this.LogicDocumentController===this.Controller)if(!this.Document_Is_SelectionLocked(AscCommon.changestype_Document_Content)){this.StartAction(AscDFH.historydescription_Document_AddBlankPage);if(this.IsSelectionUse()){this.MoveCursorLeft(false,false);this.RemoveSelection()}var oElement=this.Content[this.CurPos.ContentPos]; if(oElement.IsParagraph()){if(this.CurPos.ContentPos===this.Content.length-1&&oElement.IsCursorAtEnd()){var oBreakParagraph=oElement.Split();var oEmptyParagraph=oElement.Split();oBreakParagraph.AddToParagraph(new ParaNewLine(break_Page));this.AddToContent(this.CurPos.ContentPos+1,oBreakParagraph);this.AddToContent(this.CurPos.ContentPos+2,oEmptyParagraph);this.CurPos.ContentPos=this.CurPos.ContentPos+2}else{var oNext=oElement.Split();var oBreak1=oElement.Split();var oBreak2=oElement.Split();var oEmpty= oElement.Split();oBreak1.AddToParagraph(new ParaNewLine(break_Page));oBreak2.AddToParagraph(new ParaNewLine(break_Page));this.AddToContent(this.CurPos.ContentPos+1,oNext);this.AddToContent(this.CurPos.ContentPos+1,oBreak2);this.AddToContent(this.CurPos.ContentPos+1,oEmpty);this.AddToContent(this.CurPos.ContentPos+1,oBreak1);this.CurPos.ContentPos=this.CurPos.ContentPos+2}this.Content[this.CurPos.ContentPos].MoveCursorToStartPos(false)}else if(oElement.IsTable()){var oNewTable=oElement.Split();var oBreak1= new Paragraph(this.DrawingDocument,this);var oEmpty=new Paragraph(this.DrawingDocument,this);var oBreak2=new Paragraph(this.DrawingDocument,this);oBreak1.AddToParagraph(new ParaNewLine(break_Page));oBreak2.AddToParagraph(new ParaNewLine(break_Page));if(!oNewTable){this.AddToContent(this.CurPos.ContentPos,oBreak2);this.AddToContent(this.CurPos.ContentPos,oEmpty);this.AddToContent(this.CurPos.ContentPos,oBreak1);this.CurPos.ContentPos=this.CurPos.ContentPos+1}else{this.AddToContent(this.CurPos.ContentPos+ 1,oNewTable);this.AddToContent(this.CurPos.ContentPos+1,oBreak2);this.AddToContent(this.CurPos.ContentPos+1,oEmpty);this.AddToContent(this.CurPos.ContentPos+1,oBreak1);this.CurPos.ContentPos=this.CurPos.ContentPos+2}this.Content[this.CurPos.ContentPos].MoveCursorToStartPos(false)}this.Recalculate();this.UpdateInterface();this.UpdateSelection();this.FinalizeAction()}};CDocument.prototype.GetTableCellFormula=function(isReturnField){var sDefault=isReturnField?null:"=";var oParagraph=this.GetCurrentParagraph(); if(!oParagraph)return sDefault;var oParaParent=oParagraph.GetParent();if(!oParaParent)return sDefault;var oCell=oParaParent.IsTableCellContent(true);if(!oCell)return sDefault;var oCellContent=oCell.GetContent();var arrAllFields=oCellContent.GetAllFields(false);for(var nIndex=0,nCount=arrAllFields.length;nIndex0){NewRun=new ParaRun(NewParagraph,false); NewRun.AddText(sLabel+" ");NewParagraph.Internal_Content_Add(nCurPos++,NewRun,false)}}if(oPr.get_IncludeChapterNumber()){var nHeadingLvl=oPr.get_HeadingLvl();if(AscFormat.isRealNumber(nHeadingLvl)){oBeginChar=new ParaFieldChar(fldchartype_Begin,this);oSeparateChar=new ParaFieldChar(fldchartype_Separate,this);oEndChar=new ParaFieldChar(fldchartype_End,this);NewRun=new ParaRun;NewRun.AddToContent(-1,oBeginChar);var sStyleId=this.Styles.GetDefaultHeading(nHeadingLvl-1);var oStyle=this.Styles.Get(sStyleId); NewRun.AddInstrText(' STYLEREF "'+oStyle.GetName()+'" \\s');NewRun.AddToContent(-1,oSeparateChar);NewRun.AddToContent(-1,oEndChar);oBeginChar.SetRun(NewRun);oSeparateChar.SetRun(NewRun);oEndChar.SetRun(NewRun);NewParagraph.Internal_Content_Add(nCurPos++,NewRun,false);oComplexField=oBeginChar.GetComplexField();oComplexField.SetBeginChar(oBeginChar);oComplexField.SetInstructionLine(' STYLEREF "'+oStyle.GetName()+'" \\s');oComplexField.SetSeparateChar(oSeparateChar);oComplexField.SetEndChar(oEndChar); aFieldsToUpdate.push(oComplexField)}var sSeparator=oPr.get_Separator();if(!sSeparator||sSeparator.length===0)sSeparator=" ";NewRun=new ParaRun(NewParagraph,false);NewRun.AddText(sSeparator);NewParagraph.Internal_Content_Add(nCurPos++,NewRun,false)}var sInstruction=" SEQ "+oPr.getLabelForInstruction()+" \\* "+oPr.get_FormatGeneral()+" ";if(AscFormat.isRealNumber(nHeadingLvl))sInstruction+="\\s "+nHeadingLvl;oBeginChar=new ParaFieldChar(fldchartype_Begin,this);oSeparateChar=new ParaFieldChar(fldchartype_Separate, this);oEndChar=new ParaFieldChar(fldchartype_End,this);NewRun=new ParaRun;NewRun.AddToContent(-1,oBeginChar);NewRun.AddInstrText(sInstruction);NewRun.AddToContent(-1,oSeparateChar);NewRun.AddToContent(-1,oEndChar);oBeginChar.SetRun(NewRun);oSeparateChar.SetRun(NewRun);oEndChar.SetRun(NewRun);NewParagraph.Internal_Content_Add(nCurPos++,NewRun,false);oComplexField=oBeginChar.GetComplexField();oComplexField.SetBeginChar(oBeginChar);oComplexField.SetInstructionLine(sInstruction);oComplexField.SetSeparateChar(oSeparateChar); oComplexField.SetEndChar(oEndChar);var sAdditional=oPr.get_Additional();if(typeof sAdditional==="string"&&sAdditional.length>0){NewRun=new ParaRun(NewParagraph,false);NewRun.AddText(sAdditional+" ");NewParagraph.Internal_Content_Add(nCurPos++,NewRun,false)}aFieldsToUpdate.push(oComplexField);for(nField=aFieldsToUpdate.length-1;nField>-1;--nField)aFieldsToUpdate[nField].Update(false,false);var aFields=[];this.GetAllSeqFieldsByType(oPr.get_Label(),aFields);var arrParagraphs=[];for(var nIndex=0,nCount= aFields.length;nIndex0)if(!this.Document_Is_SelectionLocked(changestype_None,{Type:changestype_2_ElementsArray_and_Type,Elements:arrParagraphs,CheckType:changestype_Paragraph_Content}))for(nField= 0;nField0)return arrMoveMarks[0].GetMarkId();if(!oSelectedInfo.HaveRemovedInReview()&&!oSelectedInfo.HaveAddedInReview())return null;var arrParagraphs=this.GetSelectedParagraphs();if(arrParagraphs.length<=0)return null; var sMarkS=arrParagraphs[0].CheckTrackMoveMarkInSelection(true);var sMarkE=arrParagraphs[arrParagraphs.length-1].CheckTrackMoveMarkInSelection(false);if(sMarkS&&sMarkS===sMarkE)return sMarkS;sMarkS=arrParagraphs[0].CheckTrackMoveMarkInSelection(true,false);sMarkE=arrParagraphs[arrParagraphs.length-1].CheckTrackMoveMarkInSelection(false,false);if(sMarkS&&sMarkS===sMarkE)return sMarkS;return null};CDocument.prototype.CheckFormAutoFit=function(oForm){if(!this.Action.Additional.FormAutoFit)this.Action.Additional.FormAutoFit= [];this.Action.Additional.FormAutoFit.push(oForm)};CDocument.prototype.DrawTable=function(){if(!this.DrawTableMode.Draw&&!this.DrawTableMode.Erase)return;if(!this.DrawTableMode.Table){if(!this.DrawTableMode.Draw||Math.abs(this.DrawTableMode.StartX-this.DrawTableMode.EndX)<1||Math.abs(this.DrawTableMode.StartY-this.DrawTableMode.EndY)<1){if(this.DrawTableMode.StartX===this.DrawTableMode.EndX&&this.DrawTableMode.StartY===this.DrawTableMode.EndY){this.DrawTableMode.Draw&&editor.sync_TableDrawModeCallback(false); this.DrawTableMode.Erase&&editor.sync_TableEraseModeCallback(false);this.UpdateCursorType(this.CurPos.RealX,this.CurPos.RealY,this.CurPage,new AscCommon.CMouseEventHandler)}return}var oSelectionState=this.GetSelectionState();this.RemoveSelection();this.CurPage=this.DrawTableMode.Page;this.MoveCursorToXY(this.DrawTableMode.StartX,this.DrawTableMode.StartY,false);if(!this.IsSelectionLocked(AscCommon.changestype_Document_Content_Add)){this.StartAction(AscDFH.historydescription_Document_DrawNewTable, oSelectionState);var oTable=this.AddInlineTable(1,1,-1);if(oTable&&oTable.GetRowsCount()>0){oTable.Set_Inline(false);oTable.Set_Distance(3.2,0,3.2,0);oTable.Set_PositionH(c_oAscHAnchor.Page,false,Math.min(this.DrawTableMode.StartX,this.DrawTableMode.EndX));oTable.Set_PositionV(c_oAscVAnchor.Page,false,Math.min(this.DrawTableMode.StartY,this.DrawTableMode.EndY));oTable.Set_TableW(tblwidth_Mm,Math.abs(this.DrawTableMode.EndX-this.DrawTableMode.StartX));oTable.GetRow(0).SetHeight(Math.abs(this.DrawTableMode.EndY- this.DrawTableMode.StartY),Asc.linerule_AtLeast)}this.FinalizeAction();this.Api.SetTableDrawMode(true)}return}if(!this.IsSelectionLocked(changestype_None,{Type:changestype_2_ElementsArray_and_Type,Elements:[this.DrawTableMode.Table],CheckType:AscCommon.changestype_Table_Properties})){var isDraw=this.DrawTableMode.Draw;var isErase=this.DrawTableMode.Erase;var oTable=this.DrawTableMode.Table;this.StartAction(AscDFH.historydescription_Document_DrawTable);var bKeepDrawMode=oTable.DrawTableCells(this.DrawTableMode.StartX, this.DrawTableMode.StartY,this.DrawTableMode.EndX,this.DrawTableMode.EndY,this.DrawTableMode.TablePageStart,this.DrawTableMode.TablePageEnd,isDraw);if(bKeepDrawMode===false){isDraw=false;isErase=false}if(oTable.GetRowsCount()<=0&&oTable.GetParent()){var oParentDocContent=oTable.GetParent();this.RemoveSelection();oTable.PreDelete();var nPos=oTable.GetIndex();oParentDocContent.RemoveFromContent(nPos,1);oParentDocContent.SetDocPosType(docpostype_Content);if(nPos>=oParentDocContent.Content.length){oParentDocContent.CurPos.ContentPos= nPos-1;oParentDocContent.Content[nPos-1].MoveCursorToEndPos()}else{if(nPos<0)nPos=0;oParentDocContent.CurPos.ContentPos=nPos;oParentDocContent.Content[nPos].MoveCursorToEndPos()}}this.Recalculate();this.FinalizeAction();if(isDraw)this.Api.SetTableDrawMode(true);else if(isErase)this.Api.SetTableEraseMode(true);this.UpdateCursorType(this.CurPos.RealX,this.CurPos.RealY,this.CurPage,new AscCommon.CMouseEventHandler)}};CDocument.prototype.AddTextWithPr=function(sText,oTextPr,isMoveCursorOutside){if(!this.IsSelectionLocked(AscCommon.changestype_Paragraph_AddText)){this.StartAction(AscDFH.historydescription_Document_AddTextWithProperties); this.RemoveBeforePaste();var oCurrentTextPr=this.GetDirectTextPr();var oParagraph=this.GetCurrentParagraph();if(oParagraph&&oParagraph.GetParent()){var oTempPara=new Paragraph(this.GetDrawingDocument(),oParagraph.GetParent());var oRun=new ParaRun(oTempPara,false);oRun.AddText(sText);oTempPara.AddToContent(0,oRun);oRun.SetPr(oCurrentTextPr.Copy());if(oTextPr)oRun.ApplyPr(oTextPr);var oAnchorPos=oParagraph.GetCurrentAnchorPosition();var oSelectedContent=new CSelectedContent;var oSelectedElement=new CSelectedElement; oSelectedElement.Element=oTempPara;oSelectedElement.SelectedAll=false;oSelectedContent.Add(oSelectedElement);oSelectedContent.On_EndCollectElements(this,false);var isMath=false;if(oAnchorPos&&oAnchorPos.Paragraph){var oParaNearPos=oAnchorPos.Paragraph.Get_ParaNearestPos(oAnchorPos);var oLastClass=oParaNearPos.Classes[oParaNearPos.Classes.length-1];isMath=para_Math_Run===oLastClass.Type}oParagraph.GetParent().InsertContent(oSelectedContent,oAnchorPos);if(isMath)this.MoveCursorRight(false,false,true); else if(this.IsSelectionUse())if(isMoveCursorOutside){this.RemoveSelection();oRun.MoveCursorOutsideElement(false)}else this.MoveCursorRight(false,false,true);else if(isMoveCursorOutside)oRun.MoveCursorOutsideElement(false)}this.Recalculate();this.UpdateInterface();this.UpdateSelection();this.FinalizeAction()}};CDocument.prototype.AddSpecialSymbol=function(oPr){var oItem;if(oPr)if(true===oPr["NonBreakingHyphen"]){oItem=new ParaText(45);oItem.Set_SpaceAfter(false)}if(!oItem)return;if(!this.IsSelectionLocked(AscCommon.changestype_Paragraph_AddText)){this.StartAction(AscDFH.historydescription_Document_AddTextWithProperties); this.AddToParagraph(oItem);this.Recalculate();this.UpdateInterface();this.UpdateSelection();this.FinalizeAction()}};CDocument.prototype.TrackDocumentPositions=function(arrPositions){this.CollaborativeEditing.Clear_DocumentPositions();for(var nIndex=0,nCount=arrPositions.length;nIndex=0;--nIndex)if(oDocPos[nIndex].Class instanceof ParaRun){oRun=oDocPos[nIndex].Class;nInRunPos=oDocPos[nIndex].Position;break}if(!oRun)return;var oParaContentPos=oRun.GetParagraphContentPosFromObject(nInRunPos);var oParagraph=oRun.GetParagraph();if(!oParagraph||!oParaContentPos)return;return oParaContentPos.ToAnchorPos(oParagraph)};CDocument.prototype.AnchorPositionToDocumentPosition= function(oAnchorPos){var oParagraph=oAnchorPos.Paragraph;var oRun=oParagraph.GetElementByPos(oAnchorPos.ContentPos);if(!oRun||!(oRun instanceof ParaRun))return null;var nInRunPos=oAnchorPos.ContentPos.Get(oAnchorPos.ContentPos.GetDepth());var oDocPos=oRun.GetDocumentPositionFromObject();oDocPos.push({Class:oRun,Position:nInRunPos});return oDocPos};CDocument.prototype.IsDrawingSelected=function(){return docpostype_DrawingObjects===this.GetDocPosType()||docpostype_HdrFtr===this.CurPos.Type&&null!=this.HdrFtr.CurHdrFtr&& docpostype_DrawingObjects===this.HdrFtr.CurHdrFtr.Content.CurPos.Type};CDocument.prototype.GetAllTablesOnPage=function(nPageAbs){var arrTables=[];if(!this.Pages[nPageAbs])return[];if(docpostype_HdrFtr===this.GetDocPosType())this.HdrFtr.GetAllTablesOnPage(nPageAbs,arrTables);else{var nStartPos=this.Pages[nPageAbs].Pos;var nEndPos=this.Pages[nPageAbs].EndPos;for(var nPos=nStartPos;nPos<=nEndPos;++nPos)this.Content[nPos].GetAllTablesOnPage(nPageAbs,arrTables);this.Footnotes.GetAllTablesOnPage(nPageAbs, arrTables);this.Endnotes.GetAllTablesOnPage(nPageAbs,arrTables)}return arrTables};CDocument.prototype.ConvertEquationToMath=function(oEquation,isAll){if(isAll){var arrParagraphs=[];var arrDrawings=this.GetAllDrawingObjects();for(var nIndex=0,nCount=arrDrawings.length;nIndex0&&arrDrawings[0].IsPicture()){var nW=arrDrawings[0].Extent.W;var nH=arrDrawings[0].Extent.H;oForm.ReplaceContentWithPlaceHolder();oForm.ApplyPicturePr(true,nW,nH)}else{oForm.ReplaceContentWithPlaceHolder();oForm.ApplyPicturePr(true)}}else oForm.ReplaceContentWithPlaceHolder();oForm.RemoveSelection()}if(oCurrentForm)oCurrentForm.SelectContentControl();this.Recalculate();this.UpdateInterface();this.UpdateSelection();this.FinalizeAction()}for(var sId in this.SpecialForms)oForm.SkipSpecialContentControlLock(false)}; CDocument.prototype.GetSpecialFormsByKey=function(sKey){var arrForms=[];for(var sId in this.SpecialForms){var oForm=this.SpecialForms[sId];if(sKey===oForm.GetFormKey()&&oForm.Is_UseInDocument())arrForms.push(oForm)}return arrForms};CDocument.prototype.GetSpecialRadioButtons=function(sGroupKey){var arrForms=[];for(var sId in this.SpecialForms){var oForm=this.SpecialForms[sId];if(oForm.IsRadioButton()&&oForm.Is_UseInDocument()&&sGroupKey===oForm.GetCheckBoxPr().GetGroupKey())arrForms.push(oForm)}return arrForms}; CDocument.prototype.IsAllRequiredSpecialFormsFilled=function(){for(var sId in this.SpecialForms){var oForm=this.SpecialForms[sId];if(oForm.Is_UseInDocument()&&oForm.IsFormRequired()&&!oForm.IsFormFilled())return false}return true};CDocument.prototype.ConvertFormFixedType=function(sId,isToFixed){var oForm=this.GetContentControl(sId);if(!oForm||!oForm.IsForm())return false;var isLocked=false;var oParagraph=oForm.GetParagraph();if(oParagraph)isLocked=this.IsSelectionLocked(AscCommon.changestype_None, {Type:AscCommon.changestype_2_ElementsArray_and_Type,Elements:[oParagraph],CheckType:AscCommon.changestype_Paragraph_Properties},false,false);if(!isLocked){this.StartAction(AscDFH.historydescription_Document_ConvertFormFixedType);if(isToFixed)oForm.ConvertFormToFixed();else oForm.ConvertFormToInline();this.RemoveSelection();oForm.MoveCursorToContentControl(false);this.Recalculate();this.UpdateInterface();this.UpdateSelection();this.FinalizeAction();return true}return false};CDocument.prototype.IsHighlightRequiredFields= function(){return this.HighlightRequiredFields};CDocument.prototype.SetHighlightRequiredFields=function(isHighlight){this.HighlightRequiredFields=isHighlight};CDocument.prototype.GetRequiredFieldsBorder=function(){return this.RequiredFieldsBorder};CDocument.prototype.GetSectionEndMarkPr=function(nType){if(this.SectionEndMark[nType])return this.SectionEndMark[nType];else{var strSectionBreak="";switch(nType){case c_oAscSectionBreakType.Column:strSectionBreak=" End of Section ";break;case c_oAscSectionBreakType.Continuous:strSectionBreak= " Section Break (Continuous) ";break;case c_oAscSectionBreakType.EvenPage:strSectionBreak=" Section Break (Even Page) ";break;case c_oAscSectionBreakType.NextPage:strSectionBreak=" Section Break (Next Page) ";break;case c_oAscSectionBreakType.OddPage:strSectionBreak=" Section Break (Odd Page) ";break}g_oTextMeasurer.SetFont({FontFamily:{Name:"Courier New",Index:-1},FontSize:8,Italic:false,Bold:false});this.SectionEndMark[nType]={String:strSectionBreak,Widths:[],ColonSymbol:58,ColonWidth:0,StringWidth:0}; var oPr=this.SectionEndMark[nType];for(var nPos=0,nLen=strSectionBreak.length;nPos0)if(undefined===oProps||null===oProps)for(var nIndex=0,nCount=this.SectionsInfo.GetCount();nIndex0){var oSectPrS=arrParagraphs[0].GetDocumentSectPr();var oSectPrE=arrParagraphs[arrParagraphs.length-1].GetDocumentSectPr();var nStartIndex=this.SectionsInfo.Find(oSectPrS); var nEndIndex=this.SectionsInfo.Find(oSectPrE);if(-1===nStartIndex||-1===nEndIndex)return[oSectPrE];if(nStartIndex>nEndIndex){var nTemp=nStartIndex;nStartIndex=nEndIndex;nEndIndex=nTemp}var arrSectPr=[];for(var nIndex=nStartIndex;nIndex<=nEndIndex;++nIndex)arrSectPr.push(this.SectionsInfo.Get(nIndex).SectPr);return arrSectPr}}else{var oParagraph=this.GetCurrentParagraph();if(!oParagraph)return[];var oSectPr=oParagraph.GetDocumentSectPr();if(oSectPr)return[oSectPr]}}else if(Asc.c_oAscSectionApplyType.ToEnd=== nType){if(docpostype_Content!==this.GetDocPosType())return[];var oParagraph=this.GetCurrentParagraph();if(!oParagraph)return[];var oSectPr=oParagraph.GetDocumentSectPr();if(!oSectPr)return[];var nIndex=this.SectionsInfo.Find(oSectPr);if(-1===nIndex)return[oSectPr];var arrSectPr=[];for(nCount=this.SectionsInfo.GetCount();nIndex1){for(var CurCol=0,ColsCount=SectPr.Get_ColumnsCount();CurColColumnWidth)W=ColumnWidth}W+=nAdd}W=Math.max(W,nCols*2*1.9)}else{var nAdd=this.GetCompatibilityMode()<=AscCommon.document_compatibility_mode_Word14&&oItem.IsTableCellContent()?2*1.9:0;W=Math.max(oItem.XLimit- oItem.X+nAdd,nCols*2*1.9)}for(var Index=0;Index0?width:null);oTableProps.put_CellSelect(true);if(width===-10&&!haveTable)oTableProps.put_TableLayout(1);oTable.SetTableProps(oTableProps)}var oCC=oEngine.GetContentControl(); if(oCC){var oDocContent=oCC.GetContent();oDocContent.Internal_Content_RemoveAll();oDocContent.AddToContent(0,oTable,false);oSelectedContent.Add(new CSelectedElement(oCC,true))}else oSelectedContent.Add(new CSelectedElement(oTable,true));return true};CDocument.prototype.GetConvertTextToTableProps=function(oProps){if(!oProps){oProps=new Asc.CAscTextToTableProperties(this.GetSelectedContent(false));var oEngine=new CTextToTableEngine;oEngine.SetCheckSeparatorMode();for(var nIndex=0,nCount=oProps.Selected.Elements.length;nIndex< nCount;++nIndex){var oElement=oProps.Selected.Elements[nIndex].Element;oElement.CalculateTextToTable(oEngine)}if(oEngine.HaveTab())oProps.put_SeparatorType(Asc.c_oAscTextToTableSeparator.Tab);else if(oEngine.HaveSemicolon()){oProps.put_SeparatorType(Asc.c_oAscTextToTableSeparator.Symbol);oProps.put_Separator(59)}}oProps.CalculateTableSize();return oProps};CDocument.prototype.ConvertTableToText=function(oProps){var oTable=this.GetCurrentTable();if(!oTable)return;if(!this.IsSelectionLocked(AscCommon.changestype_None, {Type:changestype_2_ElementsArray_and_Type,Elements:[oTable],CheckType:changestype_Paragraph_Content})){this.StartAction(AscDFH.historydescription_Document_ConvertTableToText);var FramePr=null;var NewContent=this.private_ConvertTableToText(oTable,oProps);var oNewContent=new CSelectedContent;var oSkipStart=NewContent.before?1:0;if(!oTable.IsInline()){FramePr=new CFramePr;FramePr.HAnchor=Asc.c_oAscHAnchor.Page;FramePr.VAnchor=Asc.c_oAscVAnchor.Page;FramePr.X=oTable.PositionH.Value;FramePr.Y=oTable.PositionV.Value}if(NewContent.before)oNewContent.Add(new CSelectedElement(NewContent.before, true));for(var i=0;i>0)+2;Tabs.Add(new CParaTab(tab_Left, pos,Asc.c_oAscTabLeader.None));break;case 1:oNewParagraph=new Paragraph(this.DrawingDocument,this);NewContent.content.push(oNewParagraph);break;default:oText=new ParaText(oProps.separator);break}if(oText){oRun.Add(oText);oNewParagraph.Internal_Content_Add(oNewParagraph.Content.length-1>0?oNewParagraph.Content.length-1:oNewParagraph.Content.length,oRun)}}else if(oProps.type==2)oNewParagraph.SetParagraphTabs(Tabs)}}if(!isConvertAll){for(var i=oSelectedRows.End;i>=oSelectedRows.Start;i--)TableC.RemoveTableRow(i); if(!oSelectedRows.IsSelectionToEnd&&oSelectedRows.Start){var oNewTable=TableC.Split();NewContent.after=oNewTable;NewContent.before=TableC}if(oSelectedRows.IsSelectionToEnd)NewContent.before=TableC;else if(!oSelectedRows.Start)NewContent.after=TableC}for(var i=0;i=Pos)this.Elements[Index].Index+=Count;for(var Index=0;Index< Count;Index++){var Item=Items[Index];var SectPr=type_Paragraph===Item.GetType()?Item.Get_SectionPr():undefined;if(undefined!==SectPr){var TempPos=0;for(;TempPos=Pos&&CurPos=Pos+Count)this.Elements[Index].Index-=Count}}};CDocumentSectionsInfo.prototype.GetCount=function(){return this.Elements.length};CDocumentSectionsInfo.prototype.Get=function(nIndex){return this.Elements[nIndex]};CDocumentSectionsInfo.prototype.GetByContentPos=function(nContentPos){var nCount=this.Elements.length;for(var nPos=0;nPos=0&&nCurPos<=nCount-1){var oRes=oCurHdrFtr.GetContent().FindNextFillingForm(isNext,isCurrent,isCurrent);if(oRes)return oRes;if(isNext)for(var nIndex=nCurPos+1;nIndex=0;--nIndex){oRes= arrHdrFtrs[nIndex].GetContent().FindNextFillingForm(isNext,false);if(oRes)return oRes}}return null};function CDocumentSectionsInfoElement(SectPr,Index){this.SectPr=SectPr;this.Index=Index}function CDocumentCompareDrawingsLogicPositions(Drawing1,Drawing2){this.Drawing1=Drawing1;this.Drawing2=Drawing2;this.Result=0}function CTrackRevisionsManager(oLogicDocument){this.LogicDocument=oLogicDocument;this.CheckElements={};this.Changes={};this.ChangesOutline=[];this.CurChange=null;this.CurElement=null;this.VisibleChanges= [];this.OldVisibleChanges=[];this.MoveId=1;this.MoveMarks={};this.ProcessMove=null}CTrackRevisionsManager.prototype.CheckElement=function(oElement){if(!(oElement instanceof Paragraph)&&!(oElement instanceof CTable))return;var sElementId=oElement.GetId();if(!this.CheckElements[sElementId])this.CheckElements[sElementId]=1;else this.CheckElements[sElementId]++};CTrackRevisionsManager.prototype.AddChange=function(sId,oChange){this.private_CheckChangeObject(sId);this.Changes[sId].push(oChange)};CTrackRevisionsManager.prototype.GetElementChanges= function(sElementId){if(this.Changes[sElementId])return this.Changes[sElementId];return[]};CTrackRevisionsManager.prototype.ContinueTrackRevisions=function(isComplete){var nMaxCounter=50,nCounter=0;var bNeedUpdate=false;for(var sId in this.CheckElements){if(this.private_TrackChangesForSingleElement(sId))bNeedUpdate=true;if(true!==isComplete){++nCounter;if(nCounter>=nMaxCounter)break}}if(bNeedUpdate)this.LogicDocument.Document_UpdateInterfaceState()};CTrackRevisionsManager.prototype.GetNextChange= function(){if(this.CurChange&&this.CurChange.IsComplexChange()){var arrChanges=this.CurChange.GetSimpleChanges();this.CurChange=null;this.CurElement=null;if(arrChanges.length>0){this.CurChange=arrChanges[arrChanges.length-1];this.CurElement=this.CurChange.GetElement();if(!this.CurElement||!this.Changes[this.CurElement.GetId()]){this.CurChange=null;this.CurElement=null}}}var oChange=this.private_GetNextChange();if(oChange&&oChange.IsMove()&&!oChange.IsComplexChange()){oChange=this.CollectMoveChange(oChange); this.CurChange=oChange}return oChange};CTrackRevisionsManager.prototype.private_GetNextChange=function(){var oInitialCurChange=this.CurChange;var oInitialCurElement=this.CurElement;var oNextElement=null;if(null!==this.CurChange&&null!==this.CurElement&&this.Changes[this.CurElement.GetId()]){var arrChangesArray=this.Changes[this.CurElement.GetId()];var nChangeIndex=-1;for(var nIndex=0,nCount=arrChangesArray.length;nIndex0){if(oNextElement instanceof Paragraph){var ParaContentPos=oNextElement.Get_ParaContentPos(oNextElement.IsSelectionUse(),true);for(var nChangeIndex=0,nCount=arrNextChangesArray.length;nChangeIndex0){var nTableRow=arrSelectedCells[0].Row;for(var nChangeIndex=0,nCount=arrNextChangesArray.length;nChangeIndex0){this.CurChange=arrNextChangesArray[0];this.CurElement=oNextElement;return this.CurChange}}if(null!==oInitialCurChange&&null!==oInitialCurElement){this.CurChange=oInitialCurChange;this.CurElement=oInitialCurElement;return oInitialCurChange}this.CurChange=null;this.CurElement=null;return null};CTrackRevisionsManager.prototype.GetPrevChange=function(){if(this.CurChange&&this.CurChange.IsComplexChange()){var arrChanges= this.CurChange.GetSimpleChanges();this.CurChange=null;this.CurElement=null;if(arrChanges.length>0){this.CurChange=arrChanges[0];this.CurElement=this.CurChange.GetElement();if(!this.CurElement||!this.Changes[this.CurElement.GetId()]){this.CurChange=null;this.CurElement=null}}}var oChange=this.private_GetPrevChange();if(oChange&&oChange.IsMove()&&!oChange.IsComplexChange()){oChange=this.CollectMoveChange(oChange);this.CurChange=oChange}return oChange};CTrackRevisionsManager.prototype.private_GetPrevChange= function(){var oInitialCurChange=this.CurChange;var oInitialCurElement=this.CurElement;var oPrevElement=null;if(null!==this.CurChange&&null!==this.CurElement){var arrChangesArray=this.Changes[this.CurElement.GetId()];var nChangeIndex=-1;for(var nIndex=0,nCount=arrChangesArray.length;nIndex0){this.CurChange=arrChangesArray[nChangeIndex-1];return this.CurChange}oPrevElement=this.LogicDocument.GetRevisionsChangeElement(-1, this.CurElement)}else{var SearchEngine=this.LogicDocument.private_GetRevisionsChangeElement(-1,null);oPrevElement=SearchEngine.GetFoundedElement();if(null!==oPrevElement&&oPrevElement===SearchEngine.GetCurrentElement()){var arrPrevChangesArray=this.Changes[oPrevElement.GetId()];if(undefined!==arrPrevChangesArray&&arrPrevChangesArray.length>0){if(oPrevElement instanceof Paragraph){var ParaContentPos=oPrevElement.Get_ParaContentPos(oPrevElement.IsSelectionUse(),true);for(var ChangeIndex=arrPrevChangesArray.length- 1;ChangeIndex>=0;ChangeIndex--){var ChangeStartPos=arrPrevChangesArray[ChangeIndex].get_StartPos();if(ParaContentPos.Compare(ChangeStartPos)>=0){this.CurChange=arrPrevChangesArray[ChangeIndex];this.CurElement=oPrevElement;return this.CurChange}}}else if(oPrevElement instanceof CTable&&oPrevElement.IsCellSelection()){var arrSelectedCells=oPrevElement.GetSelectionArray();if(arrSelectedCells.length>0){var nTableRow=arrSelectedCells[0].Row;for(var nChangeIndex=arrPrevChangesArray.length-1;nChangeIndex>= 0;--nChangeIndex){var nStartRow=arrPrevChangesArray[nChangeIndex].get_StartPos();if(nTableRow>=nStartRow){this.CurChange=arrPrevChangesArray[nChangeIndex];this.CurElement=oPrevElement;return this.CurChange}}}}oPrevElement=this.LogicDocument.GetRevisionsChangeElement(-1,oPrevElement)}}}if(null!==oPrevElement){var arrPrevChangesArray=this.Changes[oPrevElement.GetId()];if(undefined!==arrPrevChangesArray&&arrPrevChangesArray.length>0){this.CurChange=arrPrevChangesArray[arrPrevChangesArray.length-1];this.CurElement= oPrevElement;return this.CurChange}}if(null!==oInitialCurChange&&null!==oInitialCurElement){this.CurChange=oInitialCurChange;this.CurElement=oInitialCurElement;return oInitialCurChange}this.CurChange=null;this.CurElement=null;return null};CTrackRevisionsManager.prototype.Have_Changes=function(){var oTableId=this.LogicDocument?this.LogicDocument.GetTableId():null;for(var sElementId in this.Changes){var oElement=oTableId?oTableId.Get_ById(sElementId):null;if(!oElement||!oElement.Is_UseInDocument||!oElement.Is_UseInDocument())continue; if(this.Changes[sElementId].length>0)return true}return false};CTrackRevisionsManager.prototype.HaveOtherUsersChanges=function(){var sUserId=this.LogicDocument.GetUserId(false);for(var sParaId in this.Changes){var oParagraph=AscCommon.g_oTableId.Get_ById(sParaId);if(!oParagraph||!oParagraph.Is_UseInDocument())continue;for(var nIndex=0,nCount=this.Changes[sParaId].length;nIndex0){var oEditorApi=this.LogicDocument.Get_Api(); oEditorApi.sync_BeginCatchRevisionsChanges();oEditorApi.sync_EndCatchRevisionsChanges()}this.VisibleChanges=[]};CTrackRevisionsManager.prototype.AddVisibleChange=function(oChange){if(this.CurChange)return;if(oChange&&c_oAscRevisionsChangeType.MoveMark===oChange.get_Type())return;if(oChange.IsMove()&&!oChange.IsComplexChange())oChange=this.CollectMoveChange(oChange);for(var nIndex=0,nCount=this.VisibleChanges.length;nIndex0?oSelectionBounds.Start: oSelectionBounds.End;if(oBounds){var X=this.LogicDocument.Get_PageLimits(oBounds.Page).XLimit;this.CurChange.put_InternalPos(X,oBounds.Y,oBounds.Page);this.VisibleChanges.push(this.CurChange)}}};CTrackRevisionsManager.prototype.EndCollectChanges=function(oDocument){if(true===this.private_HaveParasToCheck())return;var oEditor=oDocument.GetApi();if(oDocument.IsSimpleMarkupInReview()){this.VisibleChanges=[];oEditor.sync_BeginCatchRevisionsChanges();oEditor.sync_EndCatchRevisionsChanges();return}if(null!== this.CurChange)this.VisibleChanges=[this.CurChange];var bMove=false;var bChange=false;var Len=this.VisibleChanges.length;if(this.OldVisibleChanges.length!==Len)bChange=true;else if(0!==Len)for(var ChangeIndex=0;ChangeIndex0){var Pos=this.private_GetVisibleChangesXY(); for(var ChangeIndex=0;ChangeIndex0){var Pos=this.private_GetVisibleChangesXY();oEditor.sync_UpdateRevisionsChangesPosition(Pos.X,Pos.Y)}};CTrackRevisionsManager.prototype.private_GetVisibleChangesXY= function(){if(this.VisibleChanges.length>0){var Change=this.VisibleChanges[0];var Change_X=Change.get_InternalPosX();var Change_Y=Change.get_InternalPosY();var Change_PageNum=Change.get_InternalPosPageNum();var Change_Para=Change.get_Paragraph();if(Change_Para&&Change_Para.DrawingDocument){var TextTransform=Change_Para?Change_Para.Get_ParentTextTransform():undefined;if(TextTransform)Change_Y=TextTransform.TransformPointY(Change_X,Change_Y);var Coords=Change_Para.DrawingDocument.ConvertCoordsToCursorWR(Change_X, Change_Y,Change_PageNum);return{X:Coords.X,Y:Coords.Y}}}return{X:0,Y:0}};CTrackRevisionsManager.prototype.Get_AllChangesLogicDocuments=function(){this.CompleteTrackChanges();var LogicDocuments={};for(var ParaId in this.Changes){var Para=g_oTableId.Get_ById(ParaId);if(Para&&Para.Get_Parent())LogicDocuments[Para.Get_Parent().Get_Id()]=true}return LogicDocuments};CTrackRevisionsManager.prototype.GetChangeRelatedParagraphs=function(oChange,bAccept){var oRelatedParas={};if(oChange.IsComplexChange()){var arrSimpleChanges= oChange.GetSimpleChanges();for(var nIndex=0,nCount=arrSimpleChanges.length;nIndex 0){RelatedParas[ParaId]=true;if(true===Para.Selection_CheckParaEnd()){var CheckNext=false;for(var ChangeIndex=0,ChangesCount=this.Changes[ParaId].length;ChangeIndexnDeletePosition)nAddPosition--}this.ChangesOutline.splice(nAddPosition,0,oElement)};CTrackRevisionsManager.prototype.private_CompareDocumentPositions= function(oDocPos1,oDocPos2){if(oDocPos1.Class!==oDocPos2.Class)if(oDocPos1.Class instanceof CDocument)return-1;else if(oDocPos1.Class instanceof CDocument)return 1;else return 1;for(var nIndex=0,nCount=oDocPos1.length;nIndexoDocPos2[nIndex].Position)return 1}return 0};CTrackRevisionsManager.prototype.private_RemoveChangeObject=function(sId){if(this.Changes[sId])delete this.Changes[sId]; for(var nIndex=0,nCount=this.ChangesOutline.length;nIndex=0;--nIndex){var arrCurChanges=this.Changes[this.ChangesOutline[nIndex].GetId()];if(!arrCurChanges){isStart=true;continue}for(var nChangeIndex=arrCurChanges.length-1;nChangeIndex>=0;--nChangeIndex){var oCurChange= arrCurChanges[nChangeIndex];if(!isStart)if(oCurChange===oChange)isStart=true;if(isStart){var nCurChangeType=oCurChange.GetType();if(nCurChangeType===c_oAscRevisionsChangeType.MoveMark){var oMoveMark=oCurChange.GetValue();if(isFrom&&oMoveMark.IsFrom()||!isFrom&&!oMoveMark.IsFrom())if(oMoveMark.IsStart())if(nDeep>0)nDeep--;else{if(nDeep===0){nStartIndex=nIndex;oStartChange=oCurChange;break}}else if(oCurChange!==oChange)nDeep++}}}if(oStartChange)break;isStart=true}if(!oStartChange||-1===nStartIndex)return oChange; var sValue="";var arrChanges=[oStartChange];isStart=false;nDeep=0;var isEnd=false;for(var nIndex=nStartIndex,nCount=this.ChangesOutline.length;nIndex0)nDeep--;else{arrChanges.push(oCurChange);isEnd=true;break}}else if(c_oAscRevisionsChangeType.TextAdd===nCurChangeType||c_oAscRevisionsChangeType.ParaAdd=== nCurChangeType){if(0===nDeep){sValue+=c_oAscRevisionsChangeType.TextAdd===nCurChangeType?oCurChange.GetValue():"\n";arrChanges.push(oCurChange)}}else if(c_oAscRevisionsChangeType.MoveMark===nCurChangeType&&!oCurChange.GetValue().IsFrom())if(oCurChange.GetValue().IsStart())nDeep++;else if(nDeep>0)nDeep--;else{arrChanges.push(oCurChange);isEnd=true;break}}}if(!isStart)return oChange;if(isEnd)break}var sMoveId=oStartChange.GetValue().GetMarkId();var isDown=null;for(var nIndex=0,nCount=this.ChangesOutline.length;nIndex< nCount;++nIndex){var arrCurChanges=this.Changes[this.ChangesOutline[nIndex].GetId()];if(!arrCurChanges)continue;for(var nChangeIndex=0,nChangesCount=arrCurChanges.length;nChangeIndex0)this.Element=oElement};CRevisionsChangeParagraphSearchEngine.prototype.IsFound=function(){return null!==this.Element};CRevisionsChangeParagraphSearchEngine.prototype.GetFoundedElement=function(){return this.Element};CRevisionsChangeParagraphSearchEngine.prototype.GetDirection=function(){return this.Direction}; function CDocumentPagePosition(){this.Page=0;this.Column=0}function CDocumentNumberingInfoCounter(){this.Nums={};this.NumInfo=new Array(9);this.PrevLvl=-1;for(var nIndex=0;nIndex<9;++nIndex)this.NumInfo[nIndex]=undefined}CDocumentNumberingInfoCounter.prototype.CheckNum=function(oNum){if(this.Nums[oNum.GetId()])return false;this.Nums[oNum.GetId()]=oNum;return true};function CDocumentNumberingInfoEngine(oPara,oNumPr,oNumbering){this.Paragraph=oPara;this.NumId=oNumPr.NumId;this.Lvl=oNumPr.Lvl!==undefined? oNumPr.Lvl:0;this.Numbering=oNumbering;this.NumInfo=new Array(this.Lvl+1);this.Restart=[-1,-1,-1,-1,-1,-1,-1,-1,-1];this.PrevLvl=-1;this.Found=false;this.AbstractNum=null;this.Start=[];this.FinalCounter=new CDocumentNumberingInfoCounter;this.SourceCounter=new CDocumentNumberingInfoCounter;for(var nIndex=0;nIndex<9;++nIndex)this.NumInfo[nIndex]=undefined;if(!this.Numbering)return;var oNum=this.Numbering.GetNum(this.NumId);if(!oNum)return;var oAbstractNum=oNum.GetAbstractNum();if(oAbstractNum)for(var nLvl= 0;nLvl<9;++nLvl){this.Restart[nLvl]=oAbstractNum.GetLvl(nLvl).GetRestart();this.Start[nLvl]=oAbstractNum.GetLvl(nLvl).GetStart()-1}this.AbstractNum=oAbstractNum}CDocumentNumberingInfoEngine.prototype.IsStop=function(){return this.Found};CDocumentNumberingInfoEngine.prototype.CheckParagraph=function(oPara){if(!this.Numbering)return;if(this.Paragraph===oPara)this.Found=true;var oParaNumPr=oPara.GetNumPr();var oParaNumPrPrev=oPara.GetPrChangeNumPr();var isPrChange=oPara.HavePrChange();if(undefined!== oPara.Get_SectionPr()&&true===oPara.IsEmpty())return;var isEqualNumPr=false;if(!isPrChange||isPrChange&&oParaNumPr&&oParaNumPrPrev&&oParaNumPr.NumId===oParaNumPrPrev.NumId&&oParaNumPr.Lvl===oParaNumPrPrev.Lvl)isEqualNumPr=true;if(isEqualNumPr){if(!oParaNumPr)return;var oNum=this.Numbering.GetNum(oParaNumPr.NumId);var oAbstractNum=oNum.GetAbstractNum();if(oAbstractNum===this.AbstractNum){var oReviewType=oPara.GetReviewType();var oReviewInfo=oPara.GetReviewInfo();if(reviewtype_Common===oReviewType){this.private_UpdateCounter(this.FinalCounter, oNum,oParaNumPr.Lvl);this.private_UpdateCounter(this.SourceCounter,oNum,oParaNumPr.Lvl)}else if(reviewtype_Add===oReviewType)this.private_UpdateCounter(this.FinalCounter,oNum,oParaNumPr.Lvl);else if(reviewtype_Remove===oReviewType)if(!oReviewInfo.GetPrevAdded())this.private_UpdateCounter(this.SourceCounter,oNum,oParaNumPr.Lvl)}}else{if(oParaNumPr){var oNum=this.Numbering.GetNum(oParaNumPr.NumId);var oAbstractNum=oNum.GetAbstractNum();if(oAbstractNum===this.AbstractNum){var oReviewType=oPara.GetReviewType(); var oReviewInfo=oPara.GetReviewInfo();if(reviewtype_Common===oReviewType)this.private_UpdateCounter(this.FinalCounter,oNum,oParaNumPr.Lvl);else if(reviewtype_Add===oReviewType)this.private_UpdateCounter(this.FinalCounter,oNum,oParaNumPr.Lvl)}}if(oParaNumPrPrev){var oNum=this.Numbering.GetNum(oParaNumPrPrev.NumId);if(oNum){var oAbstractNum=oNum.GetAbstractNum();if(oAbstractNum===this.AbstractNum){var oReviewType=oPara.GetReviewType();var oReviewInfo=oPara.GetReviewInfo();if(reviewtype_Common===oReviewType)this.private_UpdateCounter(this.SourceCounter, oNum,oParaNumPrPrev.Lvl);else if(reviewtype_Add===oReviewType);else if(reviewtype_Remove===oReviewType)if(!oReviewInfo.GetPrevAdded())this.private_UpdateCounter(this.SourceCounter,oNum,oParaNumPrPrev.Lvl)}}}}};CDocumentNumberingInfoEngine.prototype.GetNumInfo=function(isFinal){if(false===isFinal)return this.SourceCounter.NumInfo;return this.FinalCounter.NumInfo};CDocumentNumberingInfoEngine.prototype.private_UpdateCounter=function(oCounter,oNum,nParaLvl){if(-1===oCounter.PrevLvl){for(var nLvl=0;nLvl< 9;++nLvl)oCounter.NumInfo[nLvl]=this.Start[nLvl];for(var nLvl=oCounter.PrevLvl+1;nLvlnParaLvl&&0!==this.Restart[nLvl]&&(-1===this.Restart[nLvl]||nParaLvl<=this.Restart[nLvl]-1))oCounter.NumInfo[nLvl]=this.Start[nLvl]}else if(nParaLvl>oCounter.PrevLvl)for(var nLvl=oCounter.PrevLvl+1;nLvl=0;--nIndex)if(undefined===oCounter.NumInfo[nIndex]||0===oCounter.NumInfo[nIndex])oCounter.NumInfo[nIndex]=1;oCounter.PrevLvl=nParaLvl};function CDocumentFootnotesRangeEngine(bExtendedInfo){this.m_oFirstFootnote=null;this.m_oLastFootnote=null;this.m_bFootnotes=true;this.m_bEndnotes=true;this.m_arrFootnotes=[];this.m_bForceStop=false;this.m_bExtendedInfo=true===bExtendedInfo? true:false;this.m_arrParagraphs=[];this.m_oCurParagraph=null;this.m_arrRuns=[];this.m_arrRefs=[]}CDocumentFootnotesRangeEngine.prototype.Init=function(oFirstFootnote,oLastFootnote,isFootnotes,isEndnotes){this.m_oFirstFootnote=oFirstFootnote?oFirstFootnote:null;this.m_oLastFootnote=oLastFootnote?oLastFootnote:null;this.m_bFootnotes=isFootnotes;this.m_bEndnotes=isEndnotes};CDocumentFootnotesRangeEngine.prototype.Add=function(oFootnote,oFootnoteRef,oRun){if(!oFootnote||true===this.m_bForceStop)return; if(this.m_arrFootnotes.length<=0&&null!==this.m_oFirstFootnote)if(this.m_oFirstFootnote===oFootnote)this.private_AddFootnote(oFootnote,oFootnoteRef,oRun);else{if(this.m_oLastFootnote===oFootnote)this.m_bForceStop=true}else if(this.m_arrFootnotes.length>=1&&null!==this.m_oLastFootnote){if(this.m_oLastFootnote!==this.m_arrFootnotes[this.m_arrFootnotes.length-1])this.private_AddFootnote(oFootnote,oFootnoteRef,oRun)}else this.private_AddFootnote(oFootnote,oFootnoteRef,oRun)};CDocumentFootnotesRangeEngine.prototype.IsRangeFull= function(){if(true===this.m_bForceStop)return true;if(null!==this.m_oLastFootnote&&this.m_arrFootnotes.length>=1&&this.m_oLastFootnote===this.m_arrFootnotes[this.m_arrFootnotes.length-1])return true;return false};CDocumentFootnotesRangeEngine.prototype.GetRange=function(){return this.m_arrFootnotes};CDocumentFootnotesRangeEngine.prototype.GetParagraphs=function(){return this.m_arrParagraphs};CDocumentFootnotesRangeEngine.prototype.SetCurrentParagraph=function(oParagraph){this.m_oCurParagraph=oParagraph}; CDocumentFootnotesRangeEngine.prototype.private_AddFootnote=function(oFootnote,oFootnoteRef,oRun){this.m_arrFootnotes.push(oFootnote);if(true===this.m_bExtendedInfo){this.m_arrRuns.push(oRun);this.m_arrRefs.push(oFootnoteRef);var nCount=this.m_arrParagraphs.length;if(nCount<=0||this.m_arrParagraphs[nCount-1]!==this.m_oCurParagraph)this.m_arrParagraphs[nCount]=this.m_oCurParagraph}};CDocumentFootnotesRangeEngine.prototype.GetRuns=function(){return this.m_arrRuns};CDocumentFootnotesRangeEngine.prototype.GetRefs= function(){return this.m_arrRefs};CDocumentFootnotesRangeEngine.prototype.IsCheckFootnotes=function(){return this.m_bFootnotes};CDocumentFootnotesRangeEngine.prototype.IsCheckEndnotes=function(){return this.m_bEndnotes};function CDocumentNumberingContinueEngine(oParagraph,oNumPr,oNumbering){this.Paragraph=oParagraph;this.NumPr=oNumPr;this.Numbering=oNumbering;this.Found=false;this.SimilarNumPr=null;this.LastNumPr=null}CDocumentNumberingContinueEngine.prototype.IsFound=function(){return this.Found}; CDocumentNumberingContinueEngine.prototype.CheckParagraph=function(oParagraph){if(this.IsFound())return;if(oParagraph===this.Paragraph)this.Found=true;else{var oNumPr=oParagraph.GetNumPr();if(oNumPr&&oNumPr.Lvl===this.NumPr.Lvl){if(oNumPr.Lvl>0)this.SimilarNumPr=new CNumPr(oNumPr.NumId,this.NumPr.Lvl);else{var oCurLvl=this.Numbering.GetNum(oNumPr.NumId).GetLvl(0);var oLvl=this.Numbering.GetNum(this.NumPr.NumId).GetLvl(0);if(oCurLvl.IsSimilar(oLvl)||oCurLvl.GetFormat()===oLvl.GetFormat()&&Asc.c_oAscNumberingFormat.Bullet=== oCurLvl.GetFormat())this.SimilarNumPr=new CNumPr(oNumPr.NumId,0)}this.LastNumPr=new CNumPr(oNumPr.NumId,this.NumPr.Lvl)}}};CDocumentNumberingContinueEngine.prototype.GetNumPr=function(){return this.SimilarNumPr?this.SimilarNumPr:this.LastNumPr};function CDocumentLineNumbersInfo(oLogicDocument){this.LogicDocument=oLogicDocument;this.Widths=[0,0,0,0,0,0,0,0,0];this.TextPr=null;this.RecalcId=null}CDocumentLineNumbersInfo.prototype.GetTextPr=function(){this.private_Update();return this.TextPr};CDocumentLineNumbersInfo.prototype.GetWidths= function(){this.private_Update();return this.Widths};CDocumentLineNumbersInfo.prototype.private_Update=function(){if(this.RecalcId&&this.RecalcId===this.LogicDocument.GetRecalcId())return;this.RecalcId=this.LogicDocument.GetRecalcId();var oPr=this.LogicDocument.GetStyles().Get_Pr(undefined,styletype_Paragraph);this.TextPr=oPr.TextPr.Copy();var nFontKoef=1;if(this.TextPr.VertAlign!==AscCommon.vertalign_Baseline)nFontKoef=AscCommon.vaKSize;g_oTextMeasurer.SetTextPr(this.TextPr,this.LogicDocument.GetTheme()); g_oTextMeasurer.SetFontSlot(fontslot_ASCII,nFontKoef);for(var nDigit=0;nDigit<10;++nDigit)this.Widths[nDigit]=g_oTextMeasurer.MeasureCode(48+nDigit).Width};function CDocumentChangeTextCaseEngine(nType){this.ChangeType=nType;this.StartSentence=true;this.WordBuffer=[]}CDocumentChangeTextCaseEngine.prototype.Reset=function(){this.StartSentence=true;this.WordBuffer=[]};CDocumentChangeTextCaseEngine.prototype.FlushWord=function(){var isFirstCapital=false;var isAllCapital=true;var isAllExceptFirstLower= true;for(var nIndex=0,nCount=this.WordBuffer.length;nIndex0)this.StartSentence=false;this.WordBuffer=[]};CDocumentChangeTextCaseEngine.prototype.AddLetter=function(oRun,nInRunPos,isChange){this.WordBuffer.push({Run:oRun,Pos:nInRunPos,Change:isChange})};CDocumentChangeTextCaseEngine.prototype.SetStartSentence= function(isStart){this.StartSentence=isStart};window["Asc"]=window["Asc"]||{};window["AscCommon"]=window["AscCommon"]||{};window["AscCommonWord"]=window["AscCommonWord"]||{};window["AscCommonSlide"]=window["AscCommonSlide"]||{};window["AscCommonExcel"]=window["AscCommonExcel"]||{};window["AscCommonWord"].CDocument=CDocument;window["AscCommonWord"].docpostype_Content=docpostype_Content;window["AscCommonWord"].docpostype_HdrFtr=docpostype_HdrFtr;window["AscCommonWord"].docpostype_DrawingObjects=docpostype_DrawingObjects; window["AscCommonWord"].docpostype_Footnotes=docpostype_Footnotes;window["AscCommonWord"].docpostype_Endnotes=docpostype_Endnotes;window["AscCommon"].Page_Width=Page_Width;window["AscCommon"].Page_Height=Page_Height;window["AscCommon"].X_Left_Margin=X_Left_Margin;window["AscCommon"].X_Right_Margin=X_Right_Margin;window["AscCommon"].Y_Bottom_Margin=Y_Bottom_Margin;window["AscCommon"].Y_Top_Margin=Y_Top_Margin;window["AscCommon"].selectionflag_Common=selectionflag_Common;CDocumentColumnProps.prototype["put_W"]= CDocumentColumnProps.prototype.put_W;CDocumentColumnProps.prototype["get_W"]=CDocumentColumnProps.prototype.get_W;CDocumentColumnProps.prototype["put_Space"]=CDocumentColumnProps.prototype.put_Space;CDocumentColumnProps.prototype["get_Space"]=CDocumentColumnProps.prototype.get_Space;window["Asc"]["CDocumentColumnsProps"]=CDocumentColumnsProps;CDocumentColumnsProps.prototype["get_EqualWidth"]=CDocumentColumnsProps.prototype.get_EqualWidth;CDocumentColumnsProps.prototype["put_EqualWidth"]=CDocumentColumnsProps.prototype.put_EqualWidth; CDocumentColumnsProps.prototype["get_Num"]=CDocumentColumnsProps.prototype.get_Num;CDocumentColumnsProps.prototype["put_Num"]=CDocumentColumnsProps.prototype.put_Num;CDocumentColumnsProps.prototype["get_Sep"]=CDocumentColumnsProps.prototype.get_Sep;CDocumentColumnsProps.prototype["put_Sep"]=CDocumentColumnsProps.prototype.put_Sep;CDocumentColumnsProps.prototype["get_Space"]=CDocumentColumnsProps.prototype.get_Space;CDocumentColumnsProps.prototype["put_Space"]=CDocumentColumnsProps.prototype.put_Space; CDocumentColumnsProps.prototype["get_ColsCount"]=CDocumentColumnsProps.prototype.get_ColsCount;CDocumentColumnsProps.prototype["get_Col"]=CDocumentColumnsProps.prototype.get_Col;CDocumentColumnsProps.prototype["put_Col"]=CDocumentColumnsProps.prototype.put_Col;CDocumentColumnsProps.prototype["put_ColByValue"]=CDocumentColumnsProps.prototype.put_ColByValue;CDocumentColumnsProps.prototype["get_TotalWidth"]=CDocumentColumnsProps.prototype.get_TotalWidth;window["Asc"]["CDocumentSectionProps"]=window["Asc"].CDocumentSectionProps= CDocumentSectionProps;CDocumentSectionProps.prototype["get_W"]=CDocumentSectionProps.prototype.get_W;CDocumentSectionProps.prototype["put_W"]=CDocumentSectionProps.prototype.put_W;CDocumentSectionProps.prototype["get_H"]=CDocumentSectionProps.prototype.get_H;CDocumentSectionProps.prototype["put_H"]=CDocumentSectionProps.prototype.put_H;CDocumentSectionProps.prototype["get_Orientation"]=CDocumentSectionProps.prototype.get_Orientation;CDocumentSectionProps.prototype["put_Orientation"]=CDocumentSectionProps.prototype.put_Orientation; CDocumentSectionProps.prototype["get_LeftMargin"]=CDocumentSectionProps.prototype.get_LeftMargin;CDocumentSectionProps.prototype["put_LeftMargin"]=CDocumentSectionProps.prototype.put_LeftMargin;CDocumentSectionProps.prototype["get_TopMargin"]=CDocumentSectionProps.prototype.get_TopMargin;CDocumentSectionProps.prototype["put_TopMargin"]=CDocumentSectionProps.prototype.put_TopMargin;CDocumentSectionProps.prototype["get_RightMargin"]=CDocumentSectionProps.prototype.get_RightMargin;CDocumentSectionProps.prototype["put_RightMargin"]= CDocumentSectionProps.prototype.put_RightMargin;CDocumentSectionProps.prototype["get_BottomMargin"]=CDocumentSectionProps.prototype.get_BottomMargin;CDocumentSectionProps.prototype["put_BottomMargin"]=CDocumentSectionProps.prototype.put_BottomMargin;CDocumentSectionProps.prototype["get_HeaderDistance"]=CDocumentSectionProps.prototype.get_HeaderDistance;CDocumentSectionProps.prototype["put_HeaderDistance"]=CDocumentSectionProps.prototype.put_HeaderDistance;CDocumentSectionProps.prototype["get_FooterDistance"]= CDocumentSectionProps.prototype.get_FooterDistance;CDocumentSectionProps.prototype["put_FooterDistance"]=CDocumentSectionProps.prototype.put_FooterDistance;CDocumentSectionProps.prototype["get_Gutter"]=CDocumentSectionProps.prototype.get_Gutter;CDocumentSectionProps.prototype["put_Gutter"]=CDocumentSectionProps.prototype.put_Gutter;CDocumentSectionProps.prototype["get_GutterRTL"]=CDocumentSectionProps.prototype.get_GutterRTL;CDocumentSectionProps.prototype["put_GutterRTL"]=CDocumentSectionProps.prototype.put_GutterRTL; CDocumentSectionProps.prototype["get_GutterAtTop"]=CDocumentSectionProps.prototype.get_GutterAtTop;CDocumentSectionProps.prototype["put_GutterAtTop"]=CDocumentSectionProps.prototype.put_GutterAtTop;CDocumentSectionProps.prototype["get_MirrorMargins"]=CDocumentSectionProps.prototype.get_MirrorMargins;CDocumentSectionProps.prototype["put_MirrorMargins"]=CDocumentSectionProps.prototype.put_MirrorMargins;"use strict";function CDocumentOutline(oLogicDocument){this.LogicDocument=oLogicDocument;this.Use= false;this.Elements=[];this.CurPos=-1;this.ParagraphsToUpdate={}}CDocumentOutline.prototype.SetUse=function(isUse){this.Use=isUse;if(this.Use)this.UpdateAll()};CDocumentOutline.prototype.IsUse=function(){return this.Use};CDocumentOutline.prototype.UpdateAll=function(){if(!this.Use)return;this.ParagraphsToUpdate={};this.Elements=[];this.LogicDocument.GetOutlineParagraphs(this.Elements,{SkipEmptyParagraphs:false,SkipTables:true,SkipDrawings:true,OutlineStart:1,OutlineEnd:9});if(this.Elements.length> 0){this.LogicDocument.UpdateContentIndexing();if(0!==this.Elements[0].Paragraph.GetIndex())this.Elements.splice(0,0,{Paragraph:null,Lvl:0})}this.CurPos=-1;this.LogicDocument.GetApi().sync_OnDocumentOutlineUpdate(this);this.LogicDocument.UpdateDocumentOutlinePosition()};CDocumentOutline.prototype.CheckParagraph=function(oParagraph){if((-1!==this.private_FindElementByParagraph(oParagraph)||undefined!==oParagraph.GetOutlineLvl())&&!this.ParagraphsToUpdate[oParagraph.GetId()])this.ParagraphsToUpdate[oParagraph.GetId()]= oParagraph};CDocumentOutline.prototype.Update=function(){var arrParagraphs=[];for(var sId in this.ParagraphsToUpdate)arrParagraphs.push(this.ParagraphsToUpdate[sId]);if(arrParagraphs.length>0){this.LogicDocument.UpdateContentIndexing();for(var nIndex=0,nCount=arrParagraphs.length;nIndexarrDocPos2[nPos].Position)return 1}if(nLen2>nLen1)return-1;return 0};CDocumentOutline.prototype.private_IsStartDocumentPosition=function(arrDocPos){if(arrDocPos.length<=0)return false;for(var nIndex=0,nCount=arrDocPos.length;nIndex=this.Elements.length)return"";var oParagraph=this.Elements[nIndex].Paragraph;if(!oParagraph)return"";var sText=oParagraph.GetText();if(oParagraph.IsNumberedNumbering()){var sNumText=oParagraph.GetNumberingText();if(sNumText!=="")sText=sNumText+" "+sText}return sText};CDocumentOutline.prototype.GetLevel=function(nIndex){if(nIndex<0||nIndex>=this.Elements.length)return-1;return this.Elements[nIndex].Lvl};CDocumentOutline.prototype.GoTo= function(nIndex){if(nIndex<0||nIndex>=this.Elements.length)return-1;var oParagraph=this.Elements[nIndex].Paragraph;this.LogicDocument.RemoveSelection();if(!oParagraph)this.LogicDocument.MoveCursorToStartPos(false);else{oParagraph.MoveCursorToStartPos();oParagraph.SkipPageColumnBreaks();oParagraph.Document_SetThisElementCurrent(true)}};CDocumentOutline.prototype.Demote=function(nIndex){this.private_PromoteDemote(nIndex,false)};CDocumentOutline.prototype.Promote=function(nIndex){this.private_PromoteDemote(nIndex, true)};CDocumentOutline.prototype.private_PromoteDemote=function(nIndex,isPromote){if(nIndex<0||nIndex>=this.Elements.length)return;var nLevel=this.Elements[nIndex].Lvl;var oParagraph=this.Elements[nIndex].Paragraph;if(!oParagraph)return;if(isPromote&&(nLevel<=0||nLevel>8)||!isPromote&&(nLevel>=8||nLevel<0))return;var arrParagraphs=[oParagraph];var arrLevels=[nLevel];nIndex++;while(nIndex 0&&nCurLevel<=8)nCurLevel--;else if(!isPromote&&nCurLevel<8&&nCurLevel>=0)nCurLevel++;else continue;var sStyleId=this.LogicDocument.GetStyles().GetDefaultHeading(nCurLevel);arrParagraphs[nPos].SetParagraphStyleById(sStyleId)}this.LogicDocument.Recalculate();this.LogicDocument.UpdateInterface();this.LogicDocument.FinalizeAction()}};CDocumentOutline.prototype.InsertHeader=function(nIndex,isBefore){if(nIndex<0||nIndex>=this.Elements.length)return;var nPos=this.private_GetPositionForInsertHeaderBefore(isBefore? nIndex:this.private_GetNextSiblingOrHigher(nIndex));var nLevel=this.GetLevel(nIndex);if(false===this.LogicDocument.Document_Is_SelectionLocked(changestype_None)){this.LogicDocument.StartAction(AscDFH.historydescription_Document_AddElementToOutline);var oParagraph=new Paragraph(this.LogicDocument.GetDrawingDocument(),this.LogicDocument);oParagraph.SetParagraphStyleById(this.LogicDocument.GetStyles().GetDefaultHeading(nLevel));this.LogicDocument.AddToContent(nPos,oParagraph);this.LogicDocument.Recalculate(); oParagraph.MoveCursorToStartPos(false);oParagraph.Document_SetThisElementCurrent(true);this.LogicDocument.FinalizeAction()}};CDocumentOutline.prototype.InsertSubHeader=function(nIndex){if(nIndex<0||nIndex>=this.Elements.length)return;var nPos=this.private_GetPositionForInsertHeaderBefore(this.private_GetNextSiblingOrHigher(nIndex));var nLevel=this.GetLevel(nIndex);if(nLevel>=8)return;if(false===this.LogicDocument.Document_Is_SelectionLocked(changestype_None)){this.LogicDocument.StartAction(AscDFH.historydescription_Document_AddElementToOutline); var oParagraph=new Paragraph(this.LogicDocument.GetDrawingDocument(),this.LogicDocument);oParagraph.SetParagraphStyleById(this.LogicDocument.GetStyles().GetDefaultHeading(nLevel+1));this.LogicDocument.AddToContent(nPos,oParagraph);this.LogicDocument.Recalculate();oParagraph.MoveCursorToStartPos(false);oParagraph.Document_SetThisElementCurrent(true);this.LogicDocument.FinalizeAction()}};CDocumentOutline.prototype.private_GetPositionForInsertHeaderBefore=function(nIndex){if(nIndex===this.Elements.length)return this.LogicDocument.GetElementsCount(); var oParagraph=this.Elements[nIndex].Paragraph;if(!oParagraph)return 0;this.LogicDocument.UpdateContentIndexing();return oParagraph.GetIndex()};CDocumentOutline.prototype.private_GetNextSiblingOrHigher=function(nIndex){if(nIndex<0||nIndex>=this.Elements.length)return 0;var nLevel=this.GetLevel(nIndex);var nPos=nIndex+1;while(nPos=this.GetLevel(nPos))return nPos;nPos++}return this.Elements.length};CDocumentOutline.prototype.IsFirstItemNotHeader=function(){return this.Elements.length<= 0||!this.Elements[0].Paragraph?true:false};CDocumentOutline.prototype.SelectContent=function(nIndex){if(nIndex<0||nIndex>=this.Elements.length)return;var oStartParagraph=this.Elements[nIndex].Paragraph,oEndParagraph=null;var nNextIndex=this.private_GetNextSiblingOrHigher(nIndex);if(nNextIndex0){nFindIndex=nIndex-1;break}}if(nFindIndex!==this.CurPos){this.CurPos=nFindIndex;this.LogicDocument.GetApi().sync_OnDocumentOutlineCurrentPosition(nFindIndex)}};CDocumentOutline.prototype.IsEmptyItem=function(nIndex){if(nIndex<0||nIndex>=this.Elements.length||!this.Elements[nIndex].Paragraph)return true;return this.Elements[nIndex].Paragraph.IsEmpty()};CDocumentOutline.prototype.GetCurrentPosition=function(){return this.CurPos}; CDocumentOutline.prototype["get_ElementsCount"]=CDocumentOutline.prototype.GetElementsCount;CDocumentOutline.prototype["get_Text"]=CDocumentOutline.prototype.GetText;CDocumentOutline.prototype["get_Level"]=CDocumentOutline.prototype.GetLevel;CDocumentOutline.prototype["get_CurrentPosition"]=CDocumentOutline.prototype.GetCurrentPosition;CDocumentOutline.prototype["goto"]=CDocumentOutline.prototype.GoTo;CDocumentOutline.prototype["promote"]=CDocumentOutline.prototype.Promote;CDocumentOutline.prototype["demote"]= CDocumentOutline.prototype.Demote;CDocumentOutline.prototype["insertHeader"]=CDocumentOutline.prototype.InsertHeader;CDocumentOutline.prototype["insertSubHeader"]=CDocumentOutline.prototype.InsertSubHeader;CDocumentOutline.prototype["isFirstItemNotHeader"]=CDocumentOutline.prototype.IsFirstItemNotHeader;CDocumentOutline.prototype["selectContent"]=CDocumentOutline.prototype.SelectContent;CDocumentOutline.prototype["isEmptyItem"]=CDocumentOutline.prototype.IsEmptyItem;"use strict";AscDFH.changesFactory[AscDFH.historyitem_Document_AddItem]= CChangesDocumentAddItem;AscDFH.changesFactory[AscDFH.historyitem_Document_RemoveItem]=CChangesDocumentRemoveItem;AscDFH.changesFactory[AscDFH.historyitem_Document_DefaultTab]=CChangesDocumentDefaultTab;AscDFH.changesFactory[AscDFH.historyitem_Document_EvenAndOddHeaders]=CChangesDocumentEvenAndOddHeaders;AscDFH.changesFactory[AscDFH.historyitem_Document_DefaultLanguage]=CChangesDocumentDefaultLanguage;AscDFH.changesFactory[AscDFH.historyitem_Document_MathSettings]=CChangesDocumentMathSettings;AscDFH.changesFactory[AscDFH.historyitem_Document_SdtGlobalSettings]= CChangesDocumentSdtGlobalSettings;AscDFH.changesFactory[AscDFH.historyitem_Document_Settings_GutterAtTop]=CChangesDocumentSettingsGutterAtTop;AscDFH.changesFactory[AscDFH.historyitem_Document_Settings_MirrorMargins]=CChangesDocumentSettingsMirrorMargins;AscDFH.changesFactory[AscDFH.historyitem_Document_SpecialFormsGlobalSettings]=CChangesDocumentSpecialFormsGlobalSettings;AscDFH.changesFactory[AscDFH.historyitem_Document_Settings_TrackRevisions]=CChangesDocumentSettingsTrackRevisions;AscDFH.changesRelationMap[AscDFH.historyitem_Document_AddItem]= [AscDFH.historyitem_Document_AddItem,AscDFH.historyitem_Document_RemoveItem];AscDFH.changesRelationMap[AscDFH.historyitem_Document_RemoveItem]=[AscDFH.historyitem_Document_AddItem,AscDFH.historyitem_Document_RemoveItem];AscDFH.changesRelationMap[AscDFH.historyitem_Document_DefaultTab]=[AscDFH.historyitem_Document_DefaultTab];AscDFH.changesRelationMap[AscDFH.historyitem_Document_EvenAndOddHeaders]=[AscDFH.historyitem_Document_EvenAndOddHeaders];AscDFH.changesRelationMap[AscDFH.historyitem_Document_DefaultLanguage]= [AscDFH.historyitem_Document_DefaultLanguage];AscDFH.changesRelationMap[AscDFH.historyitem_Document_MathSettings]=[AscDFH.historyitem_Document_MathSettings];AscDFH.changesRelationMap[AscDFH.historyitem_Document_SdtGlobalSettings]=[AscDFH.historyitem_Document_SdtGlobalSettings];AscDFH.changesRelationMap[AscDFH.historyitem_Document_Settings_GutterAtTop]=[AscDFH.historyitem_Document_Settings_GutterAtTop];AscDFH.changesRelationMap[AscDFH.historyitem_Document_Settings_MirrorMargins]=[AscDFH.historyitem_Document_Settings_MirrorMargins]; AscDFH.changesRelationMap[AscDFH.historyitem_Document_SpecialFormsGlobalSettings]=[AscDFH.historyitem_Document_SpecialFormsGlobalSettings];AscDFH.changesRelationMap[AscDFH.historyitem_Document_Settings_TrackRevisions]=[AscDFH.historyitem_Document_Settings_TrackRevisions];function CChangesDocumentAddItem(Class,Pos,Items){AscDFH.CChangesBaseContentChange.call(this,Class,Pos,Items,true)}CChangesDocumentAddItem.prototype=Object.create(AscDFH.CChangesBaseContentChange.prototype);CChangesDocumentAddItem.prototype.constructor= CChangesDocumentAddItem;CChangesDocumentAddItem.prototype.Type=AscDFH.historyitem_Document_AddItem;CChangesDocumentAddItem.prototype.Undo=function(){var oDocument=this.Class;for(var nIndex=0,nCount=this.Items.length;nIndex0)if(Pos<=oDocument.Content.length-1){oDocument.Content[Pos-1].Next=oDocument.Content[Pos];oDocument.Content[Pos].Prev=oDocument.Content[Pos-1]}else oDocument.Content[Pos-1].Next=null;else if(Pos<=oDocument.Content.length-1)oDocument.Content[Pos].Prev=null}};CChangesDocumentAddItem.prototype.Redo=function(){var oDocument=this.Class;for(var nIndex=0,nCount=this.Items.length;nIndex0){oDocument.Content[Pos-1].Next=Element;Element.Prev=oDocument.Content[Pos-1]}else Element.Prev=null;if(Pos0){oDocument.Content[Pos-1].Next=Element;Element.Prev=oDocument.Content[Pos-1]}else Element.Prev=null;if(Pos<=oDocument.Content.length-1){oDocument.Content[Pos].Prev=Element;Element.Next=oDocument.Content[Pos]}else Element.Next=null;Element.Parent=oDocument;oDocument.Content.splice(Pos,0,Element);oDocument.private_RecalculateNumbering([Element]);if(oDocument.SectionsInfo)oDocument.SectionsInfo.Update_OnAdd(Pos,[Element]);oDocument.private_ReindexContent(Pos); AscCommon.CollaborativeEditing.Update_DocumentPositionsOnAdd(oDocument,Pos);if(Element.IsParagraph()){Element.RecalcCompiledPr(true);Element.UpdateDocumentOutline()}}}};CChangesDocumentAddItem.prototype.IsRelated=function(oChanges){if(this.Class===oChanges.Class&&(AscDFH.historyitem_Document_AddItem===oChanges.Type||AscDFH.historyitem_Document_RemoveItem===oChanges.Type))return true;return false};CChangesDocumentAddItem.prototype.CreateReverseChange=function(){return this.private_CreateReverseChange(CChangesDocumentRemoveItem)}; function CChangesDocumentRemoveItem(Class,Pos,Items){AscDFH.CChangesBaseContentChange.call(this,Class,Pos,Items,false)}CChangesDocumentRemoveItem.prototype=Object.create(AscDFH.CChangesBaseContentChange.prototype);CChangesDocumentRemoveItem.prototype.constructor=CChangesDocumentRemoveItem;CChangesDocumentRemoveItem.prototype.Type=AscDFH.historyitem_Document_RemoveItem;CChangesDocumentRemoveItem.prototype.Undo=function(){var oDocument=this.Class;var Array_start=oDocument.Content.slice(0,this.Pos); var Array_end=oDocument.Content.slice(this.Pos);oDocument.private_RecalculateNumbering(this.Items);oDocument.private_ReindexContent(this.Pos);oDocument.Content=Array_start.concat(this.Items,Array_end);if(oDocument.SectionsInfo)oDocument.SectionsInfo.Update_OnAdd(this.Pos,this.Items);var nStartIndex=Math.max(this.Pos-1,0);var nEndIndex=Math.min(oDocument.Content.length-1,this.Pos+this.Items.length+1);for(var nIndex=nStartIndex;nIndex<=nEndIndex;++nIndex){var oElement=oDocument.Content[nIndex];if(nIndex> 0)oElement.Prev=oDocument.Content[nIndex-1];else oElement.Prev=null;if(nIndex0)if(Pos<=oDocument.Content.length-1){oDocument.Content[Pos-1].Next=oDocument.Content[Pos];oDocument.Content[Pos].Prev=oDocument.Content[Pos-1]}else oDocument.Content[Pos-1].Next=null;else if(Pos<=oDocument.Content.length-1)oDocument.Content[Pos].Prev=null};CChangesDocumentRemoveItem.prototype.private_WriteItem=function(Writer,Item){Writer.WriteString2(Item.Get_Id())};CChangesDocumentRemoveItem.prototype.private_ReadItem=function(Reader){return AscCommon.g_oTableId.Get_ById(Reader.GetString2())}; CChangesDocumentRemoveItem.prototype.Load=function(Color){var oDocument=this.Class;for(var nIndex=0,nCount=this.Items.length;nIndex0)if(Pos<=oDocument.Content.length-1){oDocument.Content[Pos-1].Next=oDocument.Content[Pos];oDocument.Content[Pos].Prev=oDocument.Content[Pos-1]}else oDocument.Content[Pos-1].Next=null;else if(Pos<=oDocument.Content.length-1)oDocument.Content[Pos].Prev=null;if(0<=Pos&&Pos<=oDocument.Content.length-1){if(oDocument.SectionsInfo)oDocument.SectionsInfo.Update_OnRemove(Pos, 1);oDocument.private_ReindexContent(Pos)}}};CChangesDocumentRemoveItem.prototype.IsRelated=function(oChanges){if(this.Class===oChanges.Class&&(AscDFH.historyitem_Document_AddItem===oChanges.Type||AscDFH.historyitem_Document_RemoveItem===oChanges.Type))return true;return false};CChangesDocumentRemoveItem.prototype.CreateReverseChange=function(){return this.private_CreateReverseChange(CChangesDocumentAddItem)};function CChangesDocumentDefaultTab(Class,Old,New){AscDFH.CChangesBase.call(this,Class);this.Old= Old;this.New=New}CChangesDocumentDefaultTab.prototype=Object.create(AscDFH.CChangesBase.prototype);CChangesDocumentDefaultTab.prototype.constructor=CChangesDocumentDefaultTab;CChangesDocumentDefaultTab.prototype.Type=AscDFH.historyitem_Document_DefaultTab;CChangesDocumentDefaultTab.prototype.Undo=function(){AscCommonWord.Default_Tab_Stop=this.Old};CChangesDocumentDefaultTab.prototype.Redo=function(){AscCommonWord.Default_Tab_Stop=this.New};CChangesDocumentDefaultTab.prototype.WriteToBinary=function(Writer){Writer.WriteDouble(this.New); Writer.WriteDouble(this.Old)};CChangesDocumentDefaultTab.prototype.ReadFromBinary=function(Reader){this.New=Reader.GetDouble();this.Old=Reader.GetDouble()};CChangesDocumentDefaultTab.prototype.CreateReverseChange=function(){return new CChangesDocumentDefaultTab(this.Class,this.New,this.Old)};function CChangesDocumentEvenAndOddHeaders(Class,Old,New){AscDFH.CChangesBase.call(this,Class);this.Old=Old;this.New=New}CChangesDocumentEvenAndOddHeaders.prototype=Object.create(AscDFH.CChangesBase.prototype); CChangesDocumentEvenAndOddHeaders.prototype.constructor=CChangesDocumentEvenAndOddHeaders;CChangesDocumentEvenAndOddHeaders.prototype.Type=AscDFH.historyitem_Document_EvenAndOddHeaders;CChangesDocumentEvenAndOddHeaders.prototype.Undo=function(){EvenAndOddHeaders=this.Old};CChangesDocumentEvenAndOddHeaders.prototype.Redo=function(){EvenAndOddHeaders=this.New};CChangesDocumentEvenAndOddHeaders.prototype.WriteToBinary=function(Writer){Writer.WriteBool(this.New);Writer.WriteBool(this.Old)};CChangesDocumentEvenAndOddHeaders.prototype.ReadFromBinary= function(Reader){this.New=Reader.GetBool();this.Old=Reader.GetBool()};CChangesDocumentEvenAndOddHeaders.prototype.CreateReverseChange=function(){return new CChangesDocumentEvenAndOddHeaders(this.Class,this.New,this.Old)};function CChangesDocumentDefaultLanguage(Class,Old,New){AscDFH.CChangesBase.call(this,Class);this.Old=Old;this.New=New}CChangesDocumentDefaultLanguage.prototype=Object.create(AscDFH.CChangesBase.prototype);CChangesDocumentDefaultLanguage.prototype.constructor=CChangesDocumentDefaultLanguage; CChangesDocumentDefaultLanguage.prototype.Type=AscDFH.historyitem_Document_DefaultLanguage;CChangesDocumentDefaultLanguage.prototype.Undo=function(){var oDocument=this.Class;oDocument.Styles.Default.TextPr.Lang.Val=this.Old;oDocument.Restart_CheckSpelling()};CChangesDocumentDefaultLanguage.prototype.Redo=function(){var oDocument=this.Class;oDocument.Styles.Default.TextPr.Lang.Val=this.New;oDocument.Restart_CheckSpelling()};CChangesDocumentDefaultLanguage.prototype.WriteToBinary=function(Writer){Writer.WriteLong(this.New); Writer.WriteLong(this.Old)};CChangesDocumentDefaultLanguage.prototype.ReadFromBinary=function(Reader){this.New=Reader.GetLong();this.Old=Reader.GetLong()};CChangesDocumentDefaultLanguage.prototype.CreateReverseChange=function(){return new CChangesDocumentDefaultLanguage(this.Class,this.New,this.Old)};function CChangesDocumentMathSettings(Class,Old,New){AscDFH.CChangesBase.call(this,Class);this.Old=Old;this.New=New}CChangesDocumentMathSettings.prototype=Object.create(AscDFH.CChangesBase.prototype); CChangesDocumentMathSettings.prototype.constructor=CChangesDocumentMathSettings;CChangesDocumentMathSettings.prototype.Type=AscDFH.historyitem_Document_MathSettings;CChangesDocumentMathSettings.prototype.Undo=function(){var oDocument=this.Class;oDocument.Settings.MathSettings.SetPr(this.Old)};CChangesDocumentMathSettings.prototype.Redo=function(){var oDocument=this.Class;oDocument.Settings.MathSettings.SetPr(this.New)};CChangesDocumentMathSettings.prototype.WriteToBinary=function(Writer){this.New.Write_ToBinary(Writer); this.Old.Write_ToBinary(Writer)};CChangesDocumentMathSettings.prototype.ReadFromBinary=function(Reader){this.New=new CMathSettings;this.New.Read_FromBinary(Reader);this.Old=new CMathSettings;this.Old.Read_FromBinary(Reader)};CChangesDocumentMathSettings.prototype.CreateReverseChange=function(){return new CChangesDocumentMathSettings(this.Class,this.New,this.Old)};function CChangesDocumentSdtGlobalSettings(Class,Old,New){AscDFH.CChangesBaseObjectProperty.call(this,Class);this.Old=Old;this.New=New} CChangesDocumentSdtGlobalSettings.prototype=Object.create(AscDFH.CChangesBaseObjectProperty.prototype);CChangesDocumentSdtGlobalSettings.prototype.constructor=CChangesDocumentSdtGlobalSettings;CChangesDocumentSdtGlobalSettings.prototype.Type=AscDFH.historyitem_Document_SdtGlobalSettings;CChangesDocumentSdtGlobalSettings.prototype.private_SetValue=function(Value){this.Class.Settings.SdtSettings=Value;this.Class.OnChangeSdtGlobalSettings()};CChangesDocumentSdtGlobalSettings.prototype.private_CreateObject= function(){return new CSdtGlobalSettings};CChangesDocumentSdtGlobalSettings.prototype.private_IsCreateEmptyObject=function(){return true};function CChangesDocumentSettingsGutterAtTop(Class,Old,New){AscDFH.CChangesBaseBoolProperty.call(this,Class,Old,New)}CChangesDocumentSettingsGutterAtTop.prototype=Object.create(AscDFH.CChangesBaseBoolProperty.prototype);CChangesDocumentSettingsGutterAtTop.prototype.constructor=CChangesDocumentSettingsGutterAtTop;CChangesDocumentSettingsGutterAtTop.prototype.Type= AscDFH.historyitem_Document_Settings_GutterAtTop;CChangesDocumentSettingsGutterAtTop.prototype.private_SetValue=function(Value){this.Class.Settings.GutterAtTop=Value};function CChangesDocumentSettingsMirrorMargins(Class,Old,New){AscDFH.CChangesBaseBoolProperty.call(this,Class,Old,New)}CChangesDocumentSettingsMirrorMargins.prototype=Object.create(AscDFH.CChangesBaseBoolProperty.prototype);CChangesDocumentSettingsMirrorMargins.prototype.constructor=CChangesDocumentSettingsMirrorMargins;CChangesDocumentSettingsMirrorMargins.prototype.Type= AscDFH.historyitem_Document_Settings_MirrorMargins;CChangesDocumentSettingsMirrorMargins.prototype.private_SetValue=function(Value){this.Class.Settings.MirrorMargins=Value};function CChangesDocumentSpecialFormsGlobalSettings(Class,Old,New){AscDFH.CChangesBaseObjectProperty.call(this,Class);this.Old=Old;this.New=New}CChangesDocumentSpecialFormsGlobalSettings.prototype=Object.create(AscDFH.CChangesBaseObjectProperty.prototype);CChangesDocumentSpecialFormsGlobalSettings.prototype.constructor=CChangesDocumentSpecialFormsGlobalSettings; CChangesDocumentSpecialFormsGlobalSettings.prototype.Type=AscDFH.historyitem_Document_SpecialFormsGlobalSettings;CChangesDocumentSpecialFormsGlobalSettings.prototype.private_SetValue=function(Value){this.Class.Settings.SpecialFormsSettings=Value;this.Class.OnChangeSpecialFormsGlobalSettings()};CChangesDocumentSpecialFormsGlobalSettings.prototype.private_CreateObject=function(){return new CSpecialFormsGlobalSettings};CChangesDocumentSpecialFormsGlobalSettings.prototype.private_IsCreateEmptyObject= function(){return true};function CChangesDocumentSettingsTrackRevisions(Class,Old,New,sUserId){AscDFH.CChangesBase.call(this,Class);this.Old=Old;this.New=New;this.UserId=sUserId}CChangesDocumentSettingsTrackRevisions.prototype=Object.create(AscDFH.CChangesBase.prototype);CChangesDocumentSettingsTrackRevisions.prototype.constructor=CChangesDocumentSettingsTrackRevisions;CChangesDocumentSettingsTrackRevisions.prototype.Type=AscDFH.historyitem_Document_Settings_TrackRevisions;CChangesDocumentSettingsTrackRevisions.prototype.Undo= function(){this.Class.Settings.TrackRevisions=this.Old;this.Class.private_OnTrackRevisionsChange()};CChangesDocumentSettingsTrackRevisions.prototype.Redo=function(){this.Class.Settings.TrackRevisions=this.New;this.Class.private_OnTrackRevisionsChange()};CChangesDocumentSettingsTrackRevisions.prototype.Load=function(){this.Class.Settings.TrackRevisions=this.New;this.Class.private_OnTrackRevisionsChange(this.UserId)};CChangesDocumentSettingsTrackRevisions.prototype.WriteToBinary=function(oWriter){var nStartPos= oWriter.GetCurPosition();oWriter.Skip(4);var nFlags=0;if(undefined!==this.Old){oWriter.WriteBool(this.Old);nFlags|=1}if(undefined!==this.New){oWriter.WriteBool(this.New);nFlags|=2}if(this.UserId){oWriter.WriteString2(this.UserId);nFlags|=4}var nEndPos=oWriter.GetCurPosition();oWriter.Seek(nStartPos);oWriter.WriteLong(nFlags);oWriter.Seek(nEndPos)};CChangesDocumentSettingsTrackRevisions.prototype.ReadFromBinary=function(oReader){var nFlags=oReader.GetLong();if(nFlags&1)this.Old=oReader.GetBool();else this.Old= undefined;if(nFlags&2)this.New=oReader.GetBool();else this.New=undefined;if(nFlags&4)this.UserId=oReader.GetString2();else this.UserId=undefined};CChangesDocumentSettingsTrackRevisions.prototype.CreateReverseChange=function(){return new CChangesDocumentSettingsTrackRevisions(this.Class,this.New,this.Old,this.UserId)};"use strict";var g_oTableId=AscCommon.g_oTableId;var History=AscCommon.History;var c_oAscHAnchor=Asc.c_oAscHAnchor;var c_oAscXAlign=Asc.c_oAscXAlign;var c_oAscYAlign=Asc.c_oAscYAlign; var c_oAscVAnchor=Asc.c_oAscVAnchor;function CDocumentContent(Parent,DrawingDocument,X,Y,XLimit,YLimit,Split,TurnOffInnerWrap,bPresentation){CDocumentContentBase.call(this);this.Id=AscCommon.g_oIdCounter.Get_NewId();this.X=X;this.Y=Y;this.XLimit=XLimit;this.YLimit=YLimit;this.UseXLimit=true;this.UseYLimit=true;this.StartPage=0;this.StartColumn=0;this.ColumnsCount=1;this.Parent=Parent;this.DrawingDocument=null;this.LogicDocument=null;this.Styles=null;this.Numbering=null;this.DrawingObjects=null;if(undefined!== DrawingDocument&&null!==DrawingDocument){this.DrawingDocument=DrawingDocument;if(undefined!==editor&&true===editor.isDocumentEditor&&!(bPresentation===true)&&DrawingDocument.m_oLogicDocument){this.LogicDocument=DrawingDocument.m_oLogicDocument;this.Styles=DrawingDocument.m_oLogicDocument.Get_Styles();this.Numbering=DrawingDocument.m_oLogicDocument.Get_Numbering();this.DrawingObjects=DrawingDocument.m_oLogicDocument.DrawingObjects}}if("undefined"===typeof TurnOffInnerWrap)TurnOffInnerWrap=false;this.TurnOffInnerWrap= TurnOffInnerWrap;this.Pages=[];this.RecalcInfo=new CDocumentRecalcInfo;this.Split=Split;this.bPresentation=bPresentation;this.Content[0]=new Paragraph(DrawingDocument,this,bPresentation);this.Content[0].Correct_Content();this.Content[0].Set_DocumentNext(null);this.Content[0].Set_DocumentPrev(null);this.CurPos={X:0,Y:0,ContentPos:0,RealX:0,RealY:0,Type:docpostype_Content,TableMove:0};this.Selection={Start:false,Use:false,StartPos:0,EndPos:0,Flag:selectionflag_Common,Data:null};this.ClipInfo=[];this.ShiftViewX= 0;this.ShiftViewY=0;this.ApplyToAll=false;this.TurnOffRecalc=false;this.m_oContentChanges=new AscCommon.CContentChanges;this.StartState=null;this.ReindexStartPos=0;g_oTableId.Add(this,this.Id);if(this.bPresentation)this.Save_StartState()}CDocumentContent.prototype=Object.create(CDocumentContentBase.prototype);CDocumentContent.prototype.constructor=CDocumentContent;CDocumentContent.prototype.Save_StartState=function(){this.StartState=new CDocumentContentStartState(this)};CDocumentContent.prototype.Copy= function(Parent,DrawingDocument,oPr){var DC=new CDocumentContent(Parent,DrawingDocument?DrawingDocument:this.DrawingDocument,0,0,0,0,this.Split,this.TurnOffInnerWrap,this.bPresentation);DC.Internal_Content_RemoveAll();var Count=this.Content.length;for(var Index=0;Index=0){var Y=this.Pages[PageIndex].Y;var YLimit=this.Pages[PageIndex].YLimit;var X=this.Pages[PageIndex].X; var XLimit=this.Pages[PageIndex].XLimit;return{X:X,XLimit:XLimit,Y:Y,YLimit:YLimit}}else{if(null===this.LogicDocument)return{X:0,Y:0,XLimit:0,YLimit:0};var Page_abs=this.Get_AbsolutePage(PageIndex);var Index=undefined!==this.LogicDocument.Pages[Page_abs]?this.LogicDocument.Pages[Page_abs].Pos:0;var SectPr=this.LogicDocument.SectionsInfo.Get_SectPr(Index).SectPr;var W=SectPr.GetPageWidth();var H=SectPr.GetPageHeight();return{X:0,Y:0,XLimit:W,YLimit:H}}else{if(null===this.LogicDocument)return{X:0,Y:0, XLimit:0,YLimit:0};var nPageAbs=this.Get_AbsolutePage(PageIndex);var Index=undefined!==this.LogicDocument.Pages[nPageAbs]?this.LogicDocument.Pages[nPageAbs].Pos:0;var oSectPr=this.LogicDocument.SectionsInfo.Get_SectPr(Index).SectPr;var oFrame=oSectPr.GetContentFrame(nPageAbs);return{X:oFrame.Left,Y:oFrame.Top,XLimit:oFrame.Right,YLimit:oFrame.Bottom}}};CDocumentContent.prototype.Get_EmptyHeight=function(){var Count=this.Content.length;if(Count<=0)return 0;var Element=this.Content[Count-1];if(type_Paragraph=== Element.GetType())return Element.Get_EmptyHeight();else return 0};CDocumentContent.prototype.CheckRange=function(X0,Y0,X1,Y1,_Y0,_Y1,X_lf,X_rf,CurPage,Inner,bMathWrap){if(undefined===Inner)Inner=true;if(this.IsBlockLevelSdtContent()&&true===Inner)return this.Parent.CheckRange(X0,Y0,X1,Y1,_Y0,_Y1,X_lf,X_rf,CurPage,true,bMathWrap);if(this.LogicDocument&&editor&&editor.isDocumentEditor){var oDocContent=this;if(this.Parent&&this.Parent instanceof CBlockLevelSdt)oDocContent=this.Parent.Parent;if(false=== this.TurnOffInnerWrap&&true===Inner||false===Inner)return this.LogicDocument.DrawingObjects.CheckRange(X0,Y0,X1,Y1,_Y0,_Y1,X_lf,X_rf,this.Get_AbsolutePage(CurPage),[],this,bMathWrap)}return[]};CDocumentContent.prototype.Is_PointInDrawingObjects=function(X,Y,Page_Abs){return this.LogicDocument&&this.LogicDocument.DrawingObjects.pointInObjInDocContent(this,X,Y,Page_Abs)};CDocumentContent.prototype.Is_PointInFlowTable=function(X,Y,PageAbs){return this.LogicDocument&&null!==this.LogicDocument.DrawingObjects.getTableByXY(X, Y,PageAbs,this)};CDocumentContent.prototype.Get_Numbering=function(){return this.Parent.Get_Numbering()};CDocumentContent.prototype.GetNumbering=function(){if(this.LogicDocument)return this.LogicDocument.GetNumbering();return this.Get_Numbering()};CDocumentContent.prototype.Get_Styles=function(lvl){if(!this.bPresentation)return this.Styles;else return this.Parent?this.Parent.Get_Styles(lvl):this.LogicDocument?this.LogicDocument.GetStyles():null};CDocumentContent.prototype.Get_TableStyleForPara=function(){return this.Parent? this.Parent.Get_TableStyleForPara():null};CDocumentContent.prototype.Get_ShapeStyleForPara=function(){return this.Parent?this.Parent.Get_ShapeStyleForPara():null};CDocumentContent.prototype.Get_TextBackGroundColor=function(){return this.Parent?this.Parent.Get_TextBackGroundColor():undefined};CDocumentContent.prototype.Recalc_AllParagraphs_CompiledPr=function(){var Count=this.Content.length;for(var Pos=0;Pos=this.Pages.length){CurPage=this.Pages.length-1;Y=1E4}var PageAbs=this.Get_AbsolutePage(CurPage);if(this.Parent&&this.Parent instanceof CHeaderFooter){var bInText=null===this.IsInText(X,Y,CurPage)?false:true;var nInDrawing=this.LogicDocument.DrawingObjects.IsInDrawingObject(X,Y,PageAbs,this);if(true!=bAnchor){var NearestPos=this.LogicDocument.DrawingObjects.getNearestPos(X,Y,PageAbs,Drawing);if((nInDrawing===DRAWING_ARRAY_TYPE_BEFORE|| nInDrawing===DRAWING_ARRAY_TYPE_INLINE||false===bInText&&nInDrawing>=0)&&null!=NearestPos)return NearestPos}}var ContentPos=this.Internal_GetContentPosByXY(X,Y,CurPage);if(true!=bAnchor&&(00)&&ContentPos===this.Pages[CurPage].Pos&&this.Pages[CurPage].EndPos>this.Pages[CurPage].Pos&&type_Paragraph===this.Content[ContentPos].GetType()&&true===this.Content[ContentPos].IsContentOnFirstPage())ContentPos++;var oShape=this.Is_DrawingShape(true);if(oShape&&oShape.isForm())ContentPos= 0;var ElementPageIndex=this.private_GetElementPageIndexByXY(ContentPos,X,Y,CurPage);return this.Content[ContentPos].Get_NearestPos(ElementPageIndex,X,Y,bAnchor,Drawing)};CDocumentContent.prototype.IsTableCellContent=function(isReturnCell){return this.Parent.IsCell(isReturnCell)};CDocumentContent.prototype.IsLastTableCellInRow=function(isSelection){if(!this.Parent.IsCell())return false;return this.Parent.IsLastTableCellInRow(isSelection)};CDocumentContent.prototype.IsTableHeader=function(){var oCell= this.IsTableCellContent(true);if(oCell)return oCell.IsInHeader(true);return false};CDocumentContent.prototype.IsTableFirstRowOnNewPage=function(){if(false===this.Parent.IsCell())return false;return this.Parent.IsTableFirstRowOnNewPage()};CDocumentContent.prototype.Check_AutoFit=function(){return this.Parent.Check_AutoFit()};CDocumentContent.prototype.IsInTable=function(bReturnTopTable){return this.Parent.IsInTable(bReturnTopTable)};CDocumentContent.prototype.Is_TopDocument=function(bReturnTopDocument){return this.Parent.Is_TopDocument(bReturnTopDocument)}; CDocumentContent.prototype.Is_UseInDocument=function(Id){var bUse=false;if(null!=Id){var Count=this.Content.length;for(var Index=0;Index0)StartIndex=this.Pages[PageIndex-1].EndPos;if(true===bStart){this.Pages.length= PageIndex;this.Pages[PageIndex]=new CDocumentPage;this.Pages[PageIndex].Pos=StartIndex;if(this.LogicDocument&&oDocContentRI===this)this.LogicDocument.DrawingObjects.resetDrawingArrays(this.Get_AbsolutePage(PageIndex),oDocContentRI)}var Count=this.Content.length;var StartPos;if(0===PageIndex)StartPos={X:this.X,Y:this.Y,XLimit:this.XLimit,YLimit:this.YLimit};else StartPos=this.Get_PageContentStartPos(PageIndex);this.Pages[PageIndex].Update_Limits(StartPos);var X=StartPos.X;var StartY=StartPos.Y;var Y= StartY;var YLimit=StartPos.YLimit;var XLimit=StartPos.XLimit;var Result=recalcresult2_End;for(var Index=StartIndex;IndexPageIndex||oRecalcInfo.FlowObjectPage<=0&&Element.PageNumnMaxGapLeft)nMaxGapLeft=oTempTableInfo.GapLeft;if(oTempTableInfo.GridWidth>nMaxGridWidth)nMaxGridWidth=oTempTableInfo.GridWidth; if(oTempTableInfo.GridWidth+oTempTableInfo.GapRight>nMaxGridWidthRightGap)nMaxGridWidthRightGap=oTempTableInfo.GridWidth+oTempTableInfo.GapRight}if(Element.IsParagraph()&&-1===FrameW&&1===FlowCount&&1===Element.Lines.length&&undefined===FramePr.Get_W()){FrameW=Element.GetAutoWidthForDropCap();var ParaPr=Element.Get_CompiledPr2(false).ParaPr;FrameW+=ParaPr.Ind.Left+ParaPr.Ind.FirstLine;if(AscCommon.align_Left!=ParaPr.Jc){TempElement.Reset(0,0,FrameW,Frame_YLimit,PageIndex);TempElement.Recalculate_Page(PageIndex); FrameH=TempElement.Get_PageBounds(PageIndex-TempElement.Get_StartPage_Relative()).Bottom}}else if(-1===FrameW)if(Element.IsTable()&&!FramePr.Get_W())FrameW=nMaxGridWidth;else FrameW=Frame_XLimit;var nGapLeft=nMaxGapLeft;var nGapRight=nMaxGridWidthRightGap>FrameW?nMaxGridWidthRightGap-FrameW:0;switch(FrameHRule){case Asc.linerule_Auto:break;case Asc.linerule_AtLeast:{if(FrameHPage_W)FrameX=Page_W-FrameW;if(FrameX<0)FrameX=0;var FrameY=0;if(undefined!=FramePr.YAlign){var YAlign=FramePr.YAlign;switch(FrameVAnchor){case c_oAscVAnchor.Page:{switch(YAlign){case c_oAscYAlign.Inside:case c_oAscYAlign.Outside:case c_oAscYAlign.Top:FrameY=0;break;case c_oAscYAlign.Bottom:FrameY=Page_H-FrameH;break;case c_oAscYAlign.Center:FrameY=(Page_H-FrameH)/2;break}break}case c_oAscVAnchor.Text:{FrameY=Y;break}case c_oAscVAnchor.Margin:{switch(YAlign){case c_oAscYAlign.Inside:case c_oAscYAlign.Outside:case c_oAscYAlign.Top:FrameY= Page_Field_T;break;case c_oAscYAlign.Bottom:FrameY=Page_Field_B-FrameH;break;case c_oAscYAlign.Center:FrameY=(Page_Field_B+Page_Field_T-FrameH)/2;break}break}}}else{var FramePrY=0;if(undefined!=FramePr.Y)FramePrY=FramePr.Y;switch(FrameVAnchor){case c_oAscVAnchor.Page:FrameY=FramePrY;break;case c_oAscVAnchor.Text:FrameY=FramePrY+Y;break;case c_oAscVAnchor.Margin:FrameY=FramePrY+Page_Field_T;break}}if(FrameH+FrameY>Page_H)FrameY=Page_H-FrameH;FrameY+=.001;FrameH-=.002;if(FrameY<0)FrameY=0;var FrameBounds= this.Content[Index].Get_FrameBounds(FrameX,FrameY,FrameW,FrameH);var FrameX2=FrameBounds.X-nGapLeft,FrameY2=FrameBounds.Y,FrameW2=FrameBounds.W+nGapLeft+nGapRight,FrameH2=FrameBounds.H;if((FrameY2+FrameH2>Page_H||Y>Page_H-.001)&&Index!=StartIndex){oRecalcInfo.Set_FrameRecalc(true);this.Content[Index].StartFromNewPage();RecalcResult=recalcresult_NextPage}else{oRecalcInfo.Set_FrameRecalc(false);for(var TempIndex=Index;TempIndex=Y)RecalcResult=recalcresult_NextElement;else{oRecalcInfo.Set_FlowObject(Element, FlowCount,recalcresult_NextElement,FlowCount);RecalcResult=recalcresult_CurPage}}}else if(true===oRecalcInfo.Check_FlowObject(Element)){Index+=oRecalcInfo.FlowObjectPage-1;oRecalcInfo.Reset();RecalcResult=recalcresult_NextElement}else RecalcResult=recalcresult_NextElement}else{if(0===Index&&0===PageIndex||Index!=StartIndex){Element.Set_DocumentIndex(Index);Element.Reset(X,Y,XLimit,YLimit,PageIndex,0,1);Element.SetUseXLimit(this.UseXLimit);Element.SetUseYLimit(this.UseYLimit)}if(this.IsEmptyParagraphAfterTableInTableCell(Index)){RecalcResult= recalcresult_NextElement;this.private_RecalculateEmptySectionParagraph(Element,this.Content[Index-1],PageIndex,0,1);this.Pages[PageIndex].EndSectionParas.push(Element);bFlow=true}else{var ElementPageIndex=this.private_GetElementPageIndex(Index,PageIndex,0,1);RecalcResult=Element.Recalculate_Page(ElementPageIndex)}}if(true!=bFlow){var ElementPageIndex=this.private_GetElementPageIndex(Index,PageIndex,0,1);Y=Element.Get_PageBounds(ElementPageIndex).Bottom}if(RecalcResult&recalcresult_CurPage){if(true=== this.IsBlockLevelSdtContent())return recalcresult2_CurPage;if(RecalcResult&recalcresultflags_Footnotes)return recalcresult2_CurPage|recalcresultflags_Column|recalcresultflags_Footnotes;return this.Recalculate_Page(PageIndex,false)}else if(RecalcResult&recalcresult_NextElement);else if(RecalcResult&recalcresult_NextPage){this.Pages[PageIndex].EndPos=Index;Result=recalcresult2_NextPage;break}}this.Pages[PageIndex].Bounds.Left=X;this.Pages[PageIndex].Bounds.Top=StartY;this.Pages[PageIndex].Bounds.Right= XLimit;this.Pages[PageIndex].Bounds.Bottom=Y;if(Index>=Count){this.Pages[PageIndex].EndPos=Count-1;if(undefined!=this.Parent.OnEndRecalculate_Page)this.Parent.OnEndRecalculate_Page(true)}else if(undefined!=this.Parent.OnEndRecalculate_Page)this.Parent.OnEndRecalculate_Page(false);return Result};CDocumentContent.prototype.GetDocumentContentForRecalcInfo=function(){var oDocContent=this;while(oDocContent.IsBlockLevelSdtContent()){if(oDocContent.Parent&&oDocContent.Parent.GetTopDocumentContent)oDocContent= oDocContent.Parent.GetTopDocumentContent(true);else break;if(!oDocContent)return this}return oDocContent};CDocumentContent.prototype.RecalculateContent=function(fWidth,fHeight,nStartPage){this.Set_StartPage(nStartPage);this.Reset(0,0,fWidth,2E4);var nRecalcResult=recalcresult2_NextPage;var nCurPage=0;while(recalcresult2_End!==nRecalcResult)nRecalcResult=this.Recalculate_Page(nCurPage++,true)};CDocumentContent.prototype.RecalculateMinMaxContentWidth=function(isRotated){var Min=0;var Max=0;var Count= this.Content.length;if(true===isRotated)for(var Pos=0;Pos=this.Pages.length)return;if(pGraphics.Start_Command)pGraphics.Start_Command(AscFormat.DRAW_COMMAND_CONTENT);var nPixelError=this.DrawingDocument.GetMMPerDot(1);var ClipInfo=this.ClipInfo[CurPage];if(ClipInfo){var Bounds=this.Pages[CurPage].Bounds;pGraphics.SaveGrState();pGraphics.AddClipRect(ClipInfo.X0,Bounds.Top-nPixelError,Math.abs(ClipInfo.X1-ClipInfo.X0),Bounds.Bottom-Bounds.Top+nPixelError)}var oPage= this.Pages[CurPage];for(var nIndex=oPage.Pos;nIndex<=oPage.EndPos;++nIndex){var oElement=this.Content[nIndex];if(oPage.IsFrame(oElement)||oPage.IsFlowTable(oElement))continue;var nElementPageIndex=this.private_GetElementPageIndex(nIndex,CurPage,0,1);oElement.Draw(nElementPageIndex,pGraphics)}for(var nFlowTableIndex=0,nFlowTablesCount=oPage.FlowTables.length;nFlowTableIndexoFormBounds.W)if(oPageBounds.Left>oFormBounds.X)nDx=-oPageBounds.Left+oFormBounds.X;else{if(oPageBounds.RightoFormBounds.H)if(oPageBounds.Top>oFormBounds.Y)nDy=-oPageBounds.Top+oFormBounds.Y;else{if(oPageBounds.Bottom.001||Math.abs(nDy)>.001){this.ShiftView(nDx,nDy);isChanged=true}var oCursorPos=oParagraph.GetCalculatedCurPosXY();nDx=0;nDy=0;if(oPageBounds.Right-oPageBounds.Left>oFormBounds.W)if(oCursorPos.X< oFormBounds.X+nPad)nDx=oFormBounds.X+nPad-oCursorPos.X;else if(oCursorPos.X>oFormBounds.W-nPad)nDx=oFormBounds.W-nPad-oCursorPos.X;if(oPageBounds.Bottom-oPageBounds.Top>oFormBounds.H)if(oCursorPos.Height>oFormBounds.H-nPad||oCursorPos.YoFormBounds.H-nPad)nDy=oFormBounds.H-nPad-oCursorPos.Y-oCursorPos.Height;if(Math.abs(nDx)>.001||Math.abs(nDy)>.001){this.ShiftView(nDx,nDy);isChanged=true}return isChanged}; CDocumentContent.prototype.UpdateEndInfo=function(){for(var Index=0,Count=this.Content.length;Index=0&&undefined!==this.Content[this.CurPos.ContentPos]){this.private_CheckCurPage();if(this.CurPage>0&&true===this.Parent.IsHdrFtr(false)){this.CurPage=0;this.DrawingDocument.TargetEnd()}else oCurPosInfo= this.Content[this.CurPos.ContentPos].RecalculateCurPos(bUpdateX,bUpdateY,isUpdateTarget)}}else oCurPosInfo=this.LogicDocument.DrawingObjects.recalculateCurPos(bUpdateX,bUpdateY,isUpdateTarget);if(oCurPosInfo){if(bUpdateX)this.CurPos.RealX=oCurPosInfo.X;if(bUpdateY)this.CurPos.RealY=oCurPosInfo.Y}return oCurPosInfo};CDocumentContent.prototype.Get_PageBounds=function(CurPage,Height,bForceCheckDrawings){if(this.Pages.length<=0)return new CDocumentBounds(0,0,0,0);if(CurPage<0)CurPage=0;if(CurPage>=this.Pages.length)CurPage= this.Pages.length-1;var Bounds=this.Pages[CurPage].Bounds;var PageAbs=this.Get_AbsolutePage(CurPage);if(true!=this.IsHdrFtr(false)&&true!==this.IsBlockLevelSdtContent()||true===bForceCheckDrawings){var AllDrawingObjects=this.GetAllDrawingObjects();var Count=AllDrawingObjects.length;for(var Index=0;IndexBounds.Bottom)Bounds.Bottom=ObjBounds.Bottom}else if(undefined!== Height&&ObjBounds.Top=this.Y+Height)Bounds.Bottom=this.Y+Height;else if(ObjBounds.Bottom>Bounds.Bottom)Bounds.Bottom=ObjBounds.Bottom}}var Count=this.Content.length;for(var Index=0;IndexBounds.Bottom)Bounds.Bottom=TableBounds.Bottom}}}return Bounds};CDocumentContent.prototype.GetPageBounds=function(nCurPage,nHeight,isForceCheckDrawings){return this.Get_PageBounds(nCurPage,nHeight,isForceCheckDrawings)};CDocumentContent.prototype.GetContentBounds=function(CurPage){var oPage=this.Pages[CurPage];if(!oPage||oPage.Pos>oPage.EndPos)return this.Get_PageBounds(CurPage);var oBounds=null;for(var nIndex=oPage.Pos;nIndex<=oPage.EndPos;++nIndex){var oElement=this.Content[nIndex]; var nElementPageIndex=this.private_GetElementPageIndex(nIndex,CurPage,0,1);var oElementBounds=oElement.GetContentBounds(nElementPageIndex);if(null===oBounds)oBounds=oElementBounds.Copy();else{if(oElementBounds.Bottom>oBounds.Bottom)oBounds.Bottom=oElementBounds.Bottom;if(oElementBounds.TopoBounds.Right)oBounds.Right=oElementBounds.Right;if(oElementBounds.Left0)return this.Content[0].Get_FirstParagraph();return null};CDocumentContent.prototype.GetAllParagraphs=function(Props,ParaArray){var arrParagraphs=ParaArray?ParaArray:[];var Count=this.Content.length; for(var Index=0;Index0)this.Internal_Content_RemoveAll();for(var nIndex=0,nCount=arrElements.length;nIndex1||type_Paragraph!==this.Content[0].GetType())return false;return this.Content[0].IsEmpty({SkipPlcHldr:false})};CDocumentContent.prototype.IsEmpty= function(){return this.Is_Empty()};CDocumentContent.prototype.Is_CurrentElementTable=function(){if(docpostype_DrawingObjects==this.CurPos.Type)return this.LogicDocument.DrawingObjects.isCurrentElementTable();else if(docpostype_Content==this.CurPos.Type&&(true===this.Selection.Use&&this.Selection.StartPos==this.Selection.EndPos&&type_Table==this.Content[this.Selection.StartPos].GetType()||false==this.Selection.Use&&type_Table==this.Content[this.CurPos.ContentPos].GetType()))return true;return false}; CDocumentContent.prototype.Is_CurrentElementParagraph=function(){if(docpostype_DrawingObjects==this.CurPos.Type)return this.LogicDocument.DrawingObjects.isCurrentElementParagraph();else if(docpostype_Content==this.CurPos.Type&&(true===this.Selection.Use&&this.Selection.StartPos==this.Selection.EndPos&&type_Table==this.Content[this.Selection.StartPos].GetType()||false==this.Selection.Use&&type_Table==this.Content[this.CurPos.ContentPos].GetType()))return false;return true};CDocumentContent.prototype.GetCurrentParagraph= function(bIgnoreSelection,arrSelectedParagraphs,oPr){if(docpostype_DrawingObjects===this.CurPos.Type)return this.LogicDocument.DrawingObjects.getCurrentParagraph(bIgnoreSelection,arrSelectedParagraphs,oPr);else if(arrSelectedParagraphs)if(true===this.ApplyToAll)for(var nPos=0,nCount=this.Content.length;nPos=this.Content.length)return null;return this.Content[Pos].GetCurrentParagraph(bIgnoreSelection,null,oPr)}return null};CDocumentContent.prototype.GetCurrentTablesStack=function(arrTables){if(!arrTables)arrTables=[];if(true===this.Selection.Use)if(this.Selection.StartPos===this.Selection.EndPos)return this.Content[this.CurPos.ContentPos].GetCurrentTablesStack(arrTables);else return arrTables;else return this.Content[this.CurPos.ContentPos].GetCurrentTablesStack(arrTables)};CDocumentContent.prototype.IsContentOnFirstPage= function(){if(this.Content.length<=0)return false;var Element=this.Content[0];return Element.IsContentOnFirstPage()};CDocumentContent.prototype.StartFromNewPage=function(){this.Pages.length=1;this.Pages[0]=new CDocumentPage;var Element=this.Content[0];Element.StartFromNewPage()};CDocumentContent.prototype.Get_ParentTextTransform=function(){if(this.Parent)return this.Parent.Get_ParentTextTransform();return null};CDocumentContent.prototype.IsTableBorder=function(X,Y,CurPage){CurPage=Math.max(0,Math.min(this.Pages.length- 1,CurPage));var ElementPos=this.Internal_GetContentPosByXY(X,Y,CurPage);var Element=this.Content[ElementPos];var ElementPageIndex=this.private_GetElementPageIndex(ElementPos,CurPage,0,1);return Element.IsTableBorder(X,Y,ElementPageIndex)};CDocumentContent.prototype.IsInText=function(X,Y,CurPage){if(CurPage<0||CurPage>=this.Pages.length)CurPage=0;var ContentPos=this.Internal_GetContentPosByXY(X,Y,CurPage);var Item=this.Content[ContentPos];var ElementPageIndex=this.private_GetElementPageIndexByXY(ContentPos, X,Y,CurPage);return Item.IsInText(X,Y,ElementPageIndex)};CDocumentContent.prototype.IsInDrawing=function(X,Y,CurPage){if(-1!=this.DrawingObjects.IsInDrawingObject(X,Y,this.Get_AbsolutePage(CurPage),this))return true;else{if(CurPage<0||CurPage>=this.Pages.length)CurPage=0;var ContentPos=this.Internal_GetContentPosByXY(X,Y,CurPage);var Item=this.Content[ContentPos];if(type_Table==Item.GetType()){var ElementPageIndex=this.private_GetElementPageIndexByXY(ContentPos,X,Y,CurPage);return Item.IsInDrawing(X, Y,ElementPageIndex)}return false}};CDocumentContent.prototype.Get_CurrentPage_Absolute=function(){if(docpostype_DrawingObjects==this.CurPos.Type)return this.LogicDocument.DrawingObjects.getCurrentPageAbsolute();else{if(this.IsNumberingSelection())return this.Selection.Data.CurPara.Get_CurrentPage_Absolute();var Pos=true===this.Selection.Use?this.Selection.EndPos:this.CurPos.ContentPos;if(Pos>=0&&Pos=EndPos;Index--)this.Content[Index].SelectAll(-1); this.Content[StartPos].MoveCursorToStartPos(true)}}else{this.RemoveSelection();this.Selection.Start=false;this.Selection.Use=false;this.Selection.StartPos=0;this.Selection.EndPos=0;this.Selection.Flag=selectionflag_Common;this.CurPos.ContentPos=0;this.SetDocPosType(docpostype_Content);this.Content[0].MoveCursorToStartPos(false)}};CDocumentContent.prototype.MoveCursorToEndPos=function(AddToSelect,StartSelectFromEnd){if(true===AddToSelect)if(docpostype_DrawingObjects===this.CurPos.Type);else{if(docpostype_Content=== this.CurPos.Type){var StartPos=true===this.Selection.Use?this.Selection.StartPos:this.CurPos.ContentPos;var EndPos=this.Content.length-1;this.Selection.Start=false;this.Selection.Use=true;this.Selection.StartPos=StartPos;this.Selection.EndPos=EndPos;this.Selection.Flag=selectionflag_Common;this.CurPos.ContentPos=this.Content.length-1;this.SetDocPosType(docpostype_Content);for(var Index=StartPos+1;Index<=EndPos;Index++)this.Content[Index].SelectAll(1);this.Content[StartPos].MoveCursorToEndPos(true)}}else if(true=== StartSelectFromEnd){this.Selection.Start=false;this.Selection.Use=true;this.Selection.StartPos=this.Content.length-1;this.Selection.EndPos=this.Content.length-1;this.Selection.Flag=selectionflag_Common;this.CurPos.ContentPos=this.Content.length-1;this.SetDocPosType(docpostype_Content);this.Content[this.Content.length-1].MoveCursorToEndPos(false,true)}else{this.RemoveSelection();this.Selection.Start=false;this.Selection.Use=false;this.Selection.StartPos=0;this.Selection.EndPos=0;this.Selection.Flag= selectionflag_Common;this.CurPos.ContentPos=this.Content.length-1;this.SetDocPosType(docpostype_Content);this.Content[this.CurPos.ContentPos].MoveCursorToEndPos(false)}};CDocumentContent.prototype.MoveCursorUpToLastRow=function(X,Y,AddToSelect){this.SetCurPosXY(X,Y);if(true===AddToSelect)if(true!==this.Selection.Use){this.CurPos.ContentPos=this.Content.length-1;this.SetDocPosType(docpostype_Content);this.Selection.Use=true;this.Selection.Start=false;this.Selection.StartPos=this.CurPos.ContentPos; this.Selection.EndPos=this.CurPos.ContentPos;this.Selection.Flag=selectionflag_Common;this.Content[this.CurPos.ContentPos].MoveCursorToEndPos(false,true);this.Content[this.CurPos.ContentPos].MoveCursorUpToLastRow(X,Y,true)}else{var StartPos=this.Selection.StartPos;var EndPos=this.Content.length-1;this.CurPos.ContentPos=EndPos;var _S=this.Selection.StartPos<=this.Selection.EndPos?this.Selection.StartPos:this.Selection.EndPos;var _E=this.Selection.StartPos<=this.Selection.EndPos?this.Selection.EndPos: this.Selection.StartPos;for(var nPos=_S;nPos<=_E;++nPos)if(nPos!==StartPos)this.Content[nPos].RemoveSelection();if(StartPos===EndPos){this.Selection.StartPos=StartPos;this.Selection.EndPos=StartPos;this.Content[StartPos].MoveCursorUpToLastRow(X,Y,true)}else{this.Content[StartPos].MoveCursorToEndPos(true);for(var nPos=StartPos+1;nPos<=EndPos;++nPos)this.Content[nPos].SelectAll(1);this.Content[EndPos].MoveCursorUpToLastRow(X,Y,true)}}else{this.CurPos.ContentPos=this.Content.length-1;this.Content[this.CurPos.ContentPos].MoveCursorUpToLastRow(X, Y,false)}};CDocumentContent.prototype.MoveCursorDownToFirstRow=function(X,Y,AddToSelect){this.SetCurPosXY(X,Y);if(true===AddToSelect)if(true!==this.Selection.Use){this.CurPos.ContentPos=0;this.SetDocPosType(docpostype_Content);this.Selection.Use=true;this.Selection.Start=false;this.Selection.StartPos=0;this.Selection.EndPos=0;this.Selection.Flag=selectionflag_Common;this.Content[0].MoveCursorToStartPos(false);this.Content[0].MoveCursorDownToFirstRow(X,Y,true)}else{var StartPos=this.Selection.StartPos; var EndPos=0;this.CurPos.ContentPos=EndPos;var _S=this.Selection.StartPos<=this.Selection.EndPos?this.Selection.StartPos:this.Selection.EndPos;var _E=this.Selection.StartPos<=this.Selection.EndPos?this.Selection.EndPos:this.Selection.StartPos;for(var nPos=_S;nPos<=_E;++nPos)if(nPos!==StartPos)this.Content[nPos].RemoveSelection();if(StartPos===EndPos){this.Selection.StartPos=StartPos;this.Selection.EndPos=StartPos;this.Content[StartPos].MoveCursorDownToFirstRow(X,Y,true)}else{this.Content[StartPos].MoveCursorToStartPos(true); for(var nPos=EndPos;nPos=this.Pages.length)return this.DrawingDocument.SetCursorType("text",new AscCommon.CMouseMoveData);var bInText=null===this.IsInText(X,Y,CurPage)?false:true;var bTableBorder=null===this.IsTableBorder(X,Y,CurPage)?false:true;if(this.Parent instanceof CHeaderFooter&&true===this.LogicDocument.DrawingObjects.updateCursorType(this.Get_AbsolutePage(CurPage),X,Y,{},true===bInText||true===bTableBorder?true:false))return;var ContentPos=this.Internal_GetContentPosByXY(X, Y,CurPage);var Item=this.Content[ContentPos];var ElementPageIndex=this.private_GetElementPageIndexByXY(ContentPos,X,Y,CurPage);Item.UpdateCursorType(X,Y,ElementPageIndex)};CDocumentContent.prototype.AddNewParagraph=function(bForceAdd){if(docpostype_DrawingObjects===this.CurPos.Type)return this.DrawingObjects.addNewParagraph();else{if(this.CurPos.ContentPos<0)return false;if(true===this.Selection.Use)this.Remove(1,true,false,true);var Item=this.Content[this.CurPos.ContentPos];if(type_Paragraph===Item.GetType()){var isCheckAutoCorrect= false;if(true!==bForceAdd&&undefined!=Item.GetNumPr()&&true===Item.IsEmpty({SkipNewLine:true})&&true===Item.IsCursorAtBegin()){Item.RemoveNumPr();Item.Set_Ind({FirstLine:undefined,Left:undefined,Right:Item.Pr.Ind.Right},true)}else{var ItemReviewType=Item.GetReviewType();var NewParagraph=new Paragraph(this.DrawingDocument,this,this.bPresentation===true);if(Item.IsCursorAtBegin()){Item.Continue(NewParagraph);NewParagraph.Correct_Content();NewParagraph.MoveCursorToStartPos();var nContentPos=this.CurPos.ContentPos; this.AddToContent(nContentPos,NewParagraph);this.CurPos.ContentPos=nContentPos+1}else{if(true===Item.IsCursorAtEnd()){if(!Item.Lock.Is_Locked())isCheckAutoCorrect=true;var StyleId=Item.Style_Get();var NextId=undefined;if(undefined!=StyleId){var Styles=this.Parent.Get_Styles();NextId=Styles.Get_Next(StyleId);var oNextStyle=Styles.Get(NextId);if(!NextId||!oNextStyle||!oNextStyle.IsParagraphStyle())NextId=StyleId}if(StyleId===NextId)Item.Continue(NewParagraph);else if(NextId===this.Get_Styles().Get_Default_Paragraph())NewParagraph.Style_Remove(); else NewParagraph.Style_Add(NextId,true);var LastRun=Item.Content[Item.Content.length-1];if(LastRun&&LastRun.Pr.Lang&&LastRun.Pr.Lang.Val){NewParagraph.SelectAll();NewParagraph.Add(new ParaTextPr({Lang:LastRun.Pr.Lang.Copy()}));NewParagraph.RemoveSelection()}}else Item.Split(NewParagraph);NewParagraph.Correct_Content();NewParagraph.MoveCursorToStartPos();var nContentPos=this.CurPos.ContentPos+1;this.AddToContent(nContentPos,NewParagraph);this.CurPos.ContentPos=nContentPos}if(true===this.IsTrackRevisions()){Item.RemovePrChange(); NewParagraph.SetReviewType(ItemReviewType);Item.SetReviewType(reviewtype_Add)}else if(reviewtype_Common!==ItemReviewType){NewParagraph.SetReviewType(ItemReviewType);Item.SetReviewType(reviewtype_Common)}NewParagraph.CheckSignatureLinesOnAdd()}if(isCheckAutoCorrect){var nContentPos=this.CurPos.ContentPos;var oParaEndRun=Item.GetParaEndRun();if(oParaEndRun)oParaEndRun.ProcessAutoCorrectOnParaEnd();this.CurPos.ContentPos=nContentPos}}else if(type_Table===Item.GetType()||type_BlockLevelSdt===Item.GetType())if(0=== this.CurPos.ContentPos&&Item.IsCursorAtBegin(true)){var NewParagraph=new Paragraph(this.DrawingDocument,this,this.bPresentation===true);this.Internal_Content_Add(0,NewParagraph);this.CurPos.ContentPos=0;if(true===this.IsTrackRevisions()){NewParagraph.RemovePrChange();NewParagraph.SetReviewType(reviewtype_Add)}}else if(this.Content.length-1===this.CurPos.ContentPos&&Item.IsCursorAtEnd()){var oNewParagraph=new Paragraph(this.DrawingDocument,this);this.Internal_Content_Add(this.Content.length,oNewParagraph); this.CurPos.ContentPos=this.Content.length-1;if(this.IsTrackRevisions()){oNewParagraph.RemovePrChange();oNewParagraph.SetReviewType(reviewtype_Add)}}else Item.AddNewParagraph()}};CDocumentContent.prototype.Extend_ToPos=function(X,Y){if(!this.LogicDocument||!this.LogicDocument.CanPerformAction||!this.LogicDocument.CanPerformAction())return;if(this.IsFootnote())return;if(this.IsBlockLevelSdtContent()){var oParent=this.Parent.GetParent();if(oParent)return oParent.Extend_ToPos(X,Y)}var LastPara=this.GetLastParagraph(); var LastPara2=LastPara;this.LogicDocument.StartAction(AscDFH.historydescription_Document_DocumentContentExtendToPos);this.LogicDocument.GetHistory().Set_Additional_ExtendDocumentToPos();while(true){var NewParagraph=new Paragraph(this.DrawingDocument,this,this.bPresentation===true);var NewRun=new ParaRun(NewParagraph,false);NewParagraph.Add_ToContent(0,NewRun);var StyleId=LastPara.Style_Get();var NextId=undefined;if(undefined!=StyleId){NextId=this.Styles.Get_Next(StyleId);if(null===NextId||undefined=== NextId)NextId=StyleId}if(NextId===this.Styles.Get_Default_Paragraph())NewParagraph.Style_Remove();else NewParagraph.Style_Add(NextId,true);if(undefined!=LastPara.TextPr.Value.FontSize||undefined!==LastPara.TextPr.Value.RFonts.Ascii){var TextPr=new CTextPr;TextPr.FontSize=LastPara.TextPr.Value.FontSize;TextPr.FontSizeCS=LastPara.TextPr.Value.FontSize;TextPr.RFonts=LastPara.TextPr.Value.RFonts.Copy();NewParagraph.SelectAll();NewParagraph.Apply_TextPr(TextPr)}var CurPage=LastPara.Pages.length-1;var X0= LastPara.Pages[CurPage].X;var Y0=LastPara.Pages[CurPage].Bounds.Bottom;var XLimit=LastPara.Pages[CurPage].XLimit;var YLimit=LastPara.Pages[CurPage].YLimit;var PageNum=LastPara.PageNum;this.AddToContent(this.Content.length,NewParagraph,false);NewParagraph.Reset(X0,Y0,XLimit,YLimit,PageNum);var RecalcResult=NewParagraph.Recalculate_Page(0);if(!(RecalcResult&recalcresult_NextElement)){this.RemoveFromContent(this.Content.length-1,1,false);break}this.Internal_Content_Add(this.Content.length,NewParagraph); if(NewParagraph.Pages[0].Bounds.Bottom>Y)break;LastPara=NewParagraph}LastPara=this.Content[this.Content.length-1];if(LastPara!=LastPara2||false===this.LogicDocument.Document_Is_SelectionLocked(AscCommon.changestype_None,{Type:AscCommon.changestype_2_Element_and_Type,Element:LastPara,CheckType:AscCommon.changestype_Paragraph_Content}))LastPara.Extend_ToPos(X);LastPara.MoveCursorToEndPos();LastPara.Document_SetThisElementCurrent(true);this.LogicDocument.Recalculate();this.LogicDocument.FinalizeAction()}; CDocumentContent.prototype.AddInlineImage=function(W,H,Img,Chart,bFlow){if(docpostype_DrawingObjects===this.CurPos.Type)return this.DrawingObjects.addInlineImage(W,H,Img,Chart,bFlow);else{if(true==this.Selection.Use)this.Remove(1,true);var Item=this.Content[this.CurPos.ContentPos];if(type_Paragraph==Item.GetType()){var Drawing;if(!AscCommon.isRealObject(Chart)){Drawing=new ParaDrawing(W,H,null,this.DrawingDocument,this,null);var Image=this.DrawingObjects.createImage(Img,0,0,W,H);Image.setParent(Drawing); Drawing.Set_GraphicObject(Image)}else{Drawing=new ParaDrawing(W,H,null,this.DrawingDocument,this,null);var Image=this.DrawingObjects.getChartSpace2(Chart,null);Image.setParent(Drawing);Drawing.Set_GraphicObject(Image);Drawing.setExtent(Image.spPr.xfrm.extX,Image.spPr.xfrm.extY)}if(true===bFlow){Drawing.Set_DrawingType(drawing_Anchor);Drawing.Set_WrappingType(WRAPPING_TYPE_SQUARE);Drawing.Set_BehindDoc(false);Drawing.Set_Distance(3.2,0,3.2,0);Drawing.Set_PositionH(Asc.c_oAscRelativeFromH.Column,false, 0,false);Drawing.Set_PositionV(Asc.c_oAscRelativeFromV.Paragraph,false,0,false)}this.AddToParagraph(Drawing);this.Select_DrawingObject(Drawing.Get_Id())}else Item.AddInlineImage(W,H,Img,Chart,bFlow)}};CDocumentContent.prototype.AddImages=function(aImages){if(docpostype_DrawingObjects===this.CurPos.Type)return this.DrawingObjects.addImages(aImages);else{if(true===this.Selection.Use)this.Remove(1,true);var Item=this.Content[this.CurPos.ContentPos];if(type_Paragraph===Item.GetType()){var Drawing,W,H; var ColumnSize=this.LogicDocument.GetColumnSize();for(var i=0;i0&&oPage&&nContentPos===oPage.Pos){this.AddToContent(nContentPos+1,NewTable);this.CurPos.ContentPos=nContentPos+1}else{this.AddToContent(nContentPos, NewTable);this.CurPos.ContentPos=nContentPos}}else if(nMode>0){NewTable.MoveCursorToStartPos(false);this.AddToContent(nContentPos+1,NewTable);this.CurPos.ContentPos=nContentPos+1}else{var NewParagraph=new Paragraph(this.DrawingDocument,this,this.bPresentation===true);Item.Split(NewParagraph);this.AddToContent(nContentPos+1,NewParagraph);NewTable.MoveCursorToStartPos();this.AddToContent(nContentPos+1,NewTable);this.CurPos.ContentPos=nContentPos+1}return NewTable}else return Item.AddInlineTable(nCols, nRows,nMode)}return null};CDocumentContent.prototype.AddToParagraph=function(ParaItem,bRecalculate){if(true===this.ApplyToAll){if(para_TextPr===ParaItem.Type)for(var Index=0;Index1&&AscCommon.IsSpace(sText.charCodeAt(sText.length-1)))nSpaceCharCode=sText.charCodeAt(sText.length-1)}var Type=ParaItem.Get_Type();switch(Type){case para_Math:case para_NewLine:case para_Text:case para_Space:case para_Tab:case para_PageNum:case para_Field:case para_FootnoteReference:case para_FootnoteRef:case para_Separator:case para_ContinuationSeparator:case para_InstrText:case para_EndnoteReference:case para_EndnoteRef:{if(ParaItem instanceof AscCommonWord.MathMenu){var oInfo=this.GetSelectedElementsInfo();if(oInfo.GetMath()){var oMath=oInfo.GetMath();if(!oMath.IsParentEquationPlaceholder())ParaItem.SetText(oMath.Copy(true))}else if(!oInfo.IsMixedSelection())ParaItem.SetText(this.GetSelectedText())}this.Remove(1,true,false,true);if(-1!==nSpaceCharCode){this.AddToParagraph(new ParaSpace(nSpaceCharCode));this.MoveCursorLeft(false,false)}break}case para_TextPr:{switch(this.Selection.Flag){case selectionflag_Common:{var StartPos=this.Selection.StartPos; var EndPos=this.Selection.EndPos;if(EndPosEndPos){var Temp=StartPos;StartPos=EndPos;EndPos=Temp}for(var Index=StartPos;Index<=EndPos;Index++){var Item=this.Content[Index];Item.ClearParagraphFormatting(isClearParaPr,isClearTextPr)}}}else{var Item=this.Content[this.CurPos.ContentPos];Item.ClearParagraphFormatting(isClearParaPr,isClearTextPr)}};CDocumentContent.prototype.Remove= function(Count,bOnlyText,bRemoveOnlySelection,bOnTextAdd,isWord){if(true===this.ApplyToAll){this.SelectAll();this.private_Remove(1,false,true,false,false);this.CurPos={X:0,Y:0,ContentPos:0,RealX:0,RealY:0,Type:docpostype_Content};this.Selection={Start:false,Use:false,StartPos:0,EndPos:0,Flag:selectionflag_Common,Data:null};return false}if(undefined===bRemoveOnlySelection)bRemoveOnlySelection=false;if(undefined===bOnTextAdd)bOnTextAdd=false;if(docpostype_DrawingObjects===this.CurPos.Type)return this.LogicDocument.DrawingObjects.remove(Count, bOnlyText,bRemoveOnlySelection,bOnTextAdd,isWord);else return this.private_Remove(Count,bOnlyText,bRemoveOnlySelection,bOnTextAdd,isWord)};CDocumentContent.prototype.GetCursorPosXY=function(){if(docpostype_DrawingObjects===this.CurPos.Type)return this.LogicDocument.DrawingObjects.cursorGetPos();else if(true===this.Selection.Use){if(selectionflag_Common===this.Selection.Flag)return this.Content[this.Selection.EndPos].GetCursorPosXY();return{X:0,Y:0}}else return this.Content[this.CurPos.ContentPos].GetCursorPosXY()}; CDocumentContent.prototype.MoveCursorLeft=function(AddToSelect,Word){if(docpostype_DrawingObjects===this.CurPos.Type)return this.LogicDocument.DrawingObjects.cursorMoveLeft(AddToSelect,Word);else{if(this.CurPos.ContentPos<0)return false;var ReturnValue=true;this.RemoveNumberingSelection();if(true===this.Selection.Use)if(true===AddToSelect){if(false===this.Content[this.Selection.EndPos].MoveCursorLeft(true,Word))if(0!=this.Selection.EndPos){this.Selection.EndPos--;this.CurPos.ContentPos=this.Selection.EndPos; var Item=this.Content[this.Selection.EndPos];Item.MoveCursorLeftWithSelectionFromEnd(Word)}else ReturnValue=false;if(this.Selection.EndPos!=this.Selection.StartPos&&false===this.Content[this.Selection.EndPos].IsSelectionUse()){this.Selection.EndPos--;this.CurPos.ContentPos=this.Selection.EndPos}if(this.Selection.StartPos==this.Selection.EndPos&&false===this.Content[this.Selection.StartPos].IsSelectionUse()){this.Selection.Use=false;this.CurPos.ContentPos=this.Selection.EndPos}}else{var Start=this.Selection.StartPos; if(Start>this.Selection.EndPos)Start=this.Selection.EndPos;this.CurPos.ContentPos=Start;if(false===this.Content[this.CurPos.ContentPos].MoveCursorLeft(false,Word))if(this.CurPos.ContentPos>0){this.CurPos.ContentPos--;this.Content[this.CurPos.ContentPos].MoveCursorToEndPos(false,false)}else ReturnValue=false;this.RemoveSelection()}else if(true===AddToSelect){this.Selection.Use=true;this.Selection.StartPos=this.CurPos.ContentPos;this.Selection.EndPos=this.CurPos.ContentPos;if(false===this.Content[this.CurPos.ContentPos].MoveCursorLeft(true, Word))if(0!=this.CurPos.ContentPos){this.CurPos.ContentPos--;this.Selection.EndPos=this.CurPos.ContentPos;var Item=this.Content[this.CurPos.ContentPos];Item.MoveCursorLeftWithSelectionFromEnd(Word)}else ReturnValue=false;if(this.Selection.StartPos==this.Selection.EndPos&&false===this.Content[this.Selection.StartPos].IsSelectionUse()){this.Selection.Use=false;this.CurPos.ContentPos=this.Selection.EndPos}}else if(false===this.Content[this.CurPos.ContentPos].MoveCursorLeft(false,Word))if(0!=this.CurPos.ContentPos){this.CurPos.ContentPos--; this.Content[this.CurPos.ContentPos].MoveCursorToEndPos(false,false)}else ReturnValue=false;return ReturnValue}};CDocumentContent.prototype.MoveCursorLeftWithSelectionFromEnd=function(Word){this.RemoveSelection();if(this.Content.length<=0)return;this.Selection.Use=true;this.Selection.Start=false;this.Selection.Data=null;this.Selection.Flag=selectionflag_Common;this.Selection.StartPos=this.Content.length-1;this.Selection.EndPos=this.Content.length-1;this.Content[this.Content.length-1].MoveCursorLeftWithSelectionFromEnd(Word)}; CDocumentContent.prototype.MoveCursorRight=function(AddToSelect,Word,FromPaste){if(docpostype_DrawingObjects===this.CurPos.Type)return this.LogicDocument.DrawingObjects.cursorMoveRight(AddToSelect,Word);else{if(this.CurPos.ContentPos<0)return false;var ReturnValue=true;this.RemoveNumberingSelection();if(true===this.Selection.Use)if(true===AddToSelect){if(false===this.Content[this.Selection.EndPos].MoveCursorRight(true,Word))if(this.Content.length-1!=this.Selection.EndPos){this.Selection.EndPos++; this.CurPos.ContentPos=this.Selection.EndPos;var Item=this.Content[this.Selection.EndPos];Item.MoveCursorRightWithSelectionFromStart(Word)}else ReturnValue=false;if(this.Selection.EndPos!=this.Selection.StartPos&&false===this.Content[this.Selection.EndPos].IsSelectionUse()){this.Selection.EndPos++;this.CurPos.ContentPos=this.Selection.EndPos}if(this.Selection.StartPos==this.Selection.EndPos&&false===this.Content[this.Selection.StartPos].IsSelectionUse()){this.Selection.Use=false;this.CurPos.ContentPos= this.Selection.EndPos}}else{var End=this.Selection.EndPos;if(Endthis.Selection.EndPos)Start=this.Selection.EndPos;this.CurPos.ContentPos=Start;var Item=this.Content[this.CurPos.ContentPos];if(false===this.Content[this.CurPos.ContentPos].MoveCursorUp(false))if(0!= this.CurPos.ContentPos){var TempXY=Item.GetCurPosXY();this.CurPos.RealX=TempXY.X;this.CurPos.RealY=TempXY.Y;this.CurPos.ContentPos--;Item=this.Content[this.CurPos.ContentPos];Item.MoveCursorUpToLastRow(this.CurPos.RealX,this.CurPos.RealY,false)}else ReturnValue=false;this.RemoveSelection()}else if(true===AddToSelect){this.Selection.Use=true;this.Selection.StartPos=this.CurPos.ContentPos;this.Selection.EndPos=this.CurPos.ContentPos;var Item=this.Content[this.CurPos.ContentPos];if(false===Item.MoveCursorUp(true))if(0!= this.CurPos.ContentPos){var TempXY=Item.GetCurPosXY();this.CurPos.RealX=TempXY.X;this.CurPos.RealY=TempXY.Y;this.CurPos.ContentPos--;Item=this.Content[this.CurPos.ContentPos];Item.MoveCursorUpToLastRow(this.CurPos.RealX,this.CurPos.RealY,true);this.Selection.EndPos=this.CurPos.ContentPos}else ReturnValue=false;if(this.Selection.StartPos==this.Selection.EndPos&&false===this.Content[this.Selection.StartPos].IsSelectionUse())this.Selection.Use=false;this.CurPos.ContentPos=this.Selection.EndPos}else{var Item= this.Content[this.CurPos.ContentPos];if(false===Item.MoveCursorUp(false))if(0!=this.CurPos.ContentPos){var TempXY=Item.GetCurPosXY();this.CurPos.RealX=TempXY.X;this.CurPos.RealY=TempXY.Y;this.CurPos.ContentPos--;Item=this.Content[this.CurPos.ContentPos];Item.MoveCursorUpToLastRow(this.CurPos.RealX,this.CurPos.RealY,false)}else ReturnValue=false}return ReturnValue}};CDocumentContent.prototype.MoveCursorDown=function(AddToSelect){if(docpostype_DrawingObjects===this.CurPos.Type)return this.LogicDocument.DrawingObjects.cursorMoveDown(AddToSelect); else if(docpostype_Content===this.CurPos.Type){if(this.CurPos.ContentPos<0)return false;var ReturnValue=true;this.RemoveNumberingSelection();if(true===this.Selection.Use)if(true===AddToSelect){var SelectDirection=this.Selection.StartPos===this.Selection.EndPos?0:this.Selection.StartPos=this.Selection.StartPos?this.Selection.EndPos:this.Selection.StartPos;this.CurPos.ContentPos=Pos;var Item=this.Content[Pos];Item.MoveCursorToEndOfLine(AddToSelect);this.RemoveSelection()}else if(true===AddToSelect){this.Selection.Use=true;this.Selection.StartPos=this.CurPos.ContentPos;this.Selection.EndPos= this.CurPos.ContentPos;var Item=this.Content[this.CurPos.ContentPos];Item.MoveCursorToEndOfLine(AddToSelect);if(this.Selection.StartPos==this.Selection.EndPos&&false===this.Content[this.Selection.StartPos].IsSelectionUse()){this.Selection.Use=false;this.CurPos.ContentPos=this.Selection.EndPos}}else{var Item=this.Content[this.CurPos.ContentPos];Item.MoveCursorToEndOfLine(AddToSelect)}}};CDocumentContent.prototype.MoveCursorToStartOfLine=function(AddToSelect){if(docpostype_DrawingObjects===this.CurPos.Type)return this.LogicDocument.DrawingObjects.cursorMoveStartOfLine(AddToSelect); else{if(this.CurPos.ContentPos<0)return false;this.RemoveNumberingSelection();if(true===this.Selection.Use)if(true===AddToSelect){var Item=this.Content[this.Selection.EndPos];Item.MoveCursorToStartOfLine(AddToSelect);if(this.Selection.StartPos==this.Selection.EndPos&&false===this.Content[this.Selection.StartPos].IsSelectionUse()){this.Selection.Use=false;this.CurPos.ContentPos=this.Selection.EndPos}}else{var Pos=this.Selection.StartPos<=this.Selection.EndPos?this.Selection.StartPos:this.Selection.EndPos; this.CurPos.ContentPos=Pos;var Item=this.Content[Pos];Item.MoveCursorToStartOfLine(AddToSelect);this.RemoveSelection()}else if(true===AddToSelect){this.Selection.Use=true;this.Selection.StartPos=this.CurPos.ContentPos;this.Selection.EndPos=this.CurPos.ContentPos;var Item=this.Content[this.CurPos.ContentPos];Item.MoveCursorToStartOfLine(AddToSelect);if(this.Selection.StartPos==this.Selection.EndPos&&false===this.Content[this.Selection.StartPos].IsSelectionUse()){this.Selection.Use=false;this.CurPos.ContentPos= this.Selection.EndPos}}else{var Item=this.Content[this.CurPos.ContentPos];Item.MoveCursorToStartOfLine(AddToSelect)}}};CDocumentContent.prototype.MoveCursorToXY=function(X,Y,AddToSelect,bRemoveOldSelection,CurPage){if(this.Pages.length<=0)return;if(undefined!==CurPage){if(CurPage<0){CurPage=0;Y=0}else if(CurPage>=this.Pages.length){CurPage=this.Pages.length-1;Y=this.Pages[CurPage].YLimit}this.CurPage=CurPage}if(false!=bRemoveOldSelection)this.RemoveNumberingSelection();if(true===this.Selection.Use)if(true=== AddToSelect){var oMouseEvent=new AscCommon.CMouseEventHandler;oMouseEvent.Type=AscCommon.g_mouse_event_type_up;this.Selection_SetEnd(X,Y,this.CurPage,oMouseEvent)}else{this.RemoveSelection();var ContentPos=this.Internal_GetContentPosByXY(X,Y);this.CurPos.ContentPos=ContentPos;var ElementPageIndex=this.private_GetElementPageIndexByXY(ContentPos,X,Y,this.CurPage);this.Content[ContentPos].MoveCursorToXY(X,Y,false,false,ElementPageIndex)}else if(true===AddToSelect){this.StartSelectionFromCurPos();var oMouseEvent= new AscCommon.CMouseEventHandler;oMouseEvent.Type=AscCommon.g_mouse_event_type_up;this.Selection_SetEnd(X,Y,this.CurPage,oMouseEvent)}else{var ContentPos=this.Internal_GetContentPosByXY(X,Y);this.CurPos.ContentPos=ContentPos;var ElementPageIndex=this.private_GetElementPageIndexByXY(ContentPos,X,Y,this.CurPage);this.Content[ContentPos].MoveCursorToXY(X,Y,false,false,ElementPageIndex)}};CDocumentContent.prototype.IsCursorAtBegin=function(bOnlyPara){if(undefined===bOnlyPara)bOnlyPara=false;if(true=== bOnlyPara&&true!=this.Is_CurrentElementParagraph())return false;if(docpostype_DrawingObjects===this.CurPos.Type)return false;else if(false!=this.Selection.Use||0!=this.CurPos.ContentPos)return false;var Item=this.Content[0];return Item.IsCursorAtBegin()};CDocumentContent.prototype.IsCursorAtEnd=function(){if(docpostype_DrawingObjects===this.CurPos.Type)return false;else if(false!=this.Selection.Use||this.Content.length-1!=this.CurPos.ContentPos)return false;var Item=this.Content[this.Content.length- 1];return Item.IsCursorAtEnd()};CDocumentContent.prototype.GetCurPosXY=function(){return{X:this.CurPos.RealX,Y:this.CurPos.RealY}};CDocumentContent.prototype.SetCurPosXY=function(X,Y){this.CurPos.RealX=X;this.CurPos.RealY=Y};CDocumentContent.prototype.IsSelectionUse=function(){if(docpostype_DrawingObjects===this.GetDocPosType())return this.DrawingObjects.isSelectionUse();if(true===this.Selection.Use)return true;return false};CDocumentContent.prototype.IsSelectionToEnd=function(){if(true!==this.Selection.Use)return false; if((this.Selection.StartPos===this.Content.length-1||this.Selection.EndPos===this.Content.length-1)&&true===this.Content[this.Content.length-1].IsSelectionToEnd())return true;return false};CDocumentContent.prototype.IsTextSelectionUse=function(){if(docpostype_DrawingObjects===this.CurPos.Type)return this.LogicDocument.DrawingObjects.isTextSelectionUse();return this.IsSelectionUse()};CDocumentContent.prototype.GetSelectedText=function(bClearText,oPr){if(true===this.ApplyToAll)if(true===bClearText&& this.Content.length<=1){this.Content[0].SetApplyToAll(true);var ResultText=this.Content[0].GetSelectedText(true,oPr);this.Content[0].SetApplyToAll(false);return ResultText}else{if(true!=bClearText){var ResultText="";var Count=this.Content.length;for(var Index=0;Index1)oInfo.SetMixedSelection();if(oInfo.IsCheckAllSelection()|| nCount===1)for(var nPos=0;nPosEndPos){StartPos=this.Selection.EndPos;EndPos=this.Selection.StartPos}for(var Index=StartPos;Index<=EndPos;Index++)this.Content[Index].GetSelectedContent(SelectedContent)}};CDocumentContent.prototype.InsertContent=function(SelectedContent,NearPos){var Para=NearPos.Paragraph;var ParaNearPos=Para.Get_ParaNearestPos(NearPos);var LastClass=ParaNearPos.Classes[ParaNearPos.Classes.length-1];this.private_CheckSelectedContentBeforePaste(SelectedContent,NearPos); if(para_Math_Run===LastClass.Type){var MathRun=LastClass;var NewMathRun=MathRun.Split(ParaNearPos.NearPos.ContentPos,ParaNearPos.Classes.length-1);var MathContent=ParaNearPos.Classes[ParaNearPos.Classes.length-2];var MathContentPos=ParaNearPos.NearPos.ContentPos.Data[ParaNearPos.Classes.length-2];var Element=SelectedContent.Elements[0].Element;var InsertMathContent=null;for(var nPos=0,nParaLen=Element.Content.length;nPos0&&oSrcPicture){oDstPictureCC.SetShowingPlcHdr(false);oSrcPicture.setParent(arrParaDrawings[0]);arrParaDrawings[0].Set_GraphicObject(oSrcPicture);if(oDstPictureCC.IsPictureForm())oDstPictureCC.UpdatePictureFormLayout();if(this.LogicDocument){this.LogicDocument.RemoveSelection();oDstPictureCC.SelectContentControl();var sKey=oDstPictureCC.GetFormKey();if(arrParaDrawings[0].IsPicture()&& sKey)this.LogicDocument.OnChangeForm(sKey,oDstPictureCC,arrParaDrawings[0].GraphicObj.getImageUrl())}}return}else if(LastClass.GetParentForm()){var nInLastClassPos=ParaNearPos.NearPos.ContentPos.Data[ParaNearPos.Classes.length-1];var isPlaceHolder=LastClass.GetParentForm().IsPlaceHolder();if(isPlaceHolder&&LastClass.GetParent()instanceof CInlineLevelSdt){var oInlineLeveLSdt=LastClass.GetParent();oInlineLeveLSdt.ReplacePlaceHolderWithContent();LastClass=oInlineLeveLSdt.GetElement(0);nInLastClassPos= 0}LastClass.State.ContentPos=nInLastClassPos;var nInRunStartPos=LastClass.State.ContentPos;LastClass.AddText(SelectedContent.GetText({ParaEndToSpace:false}),nInLastClassPos);var nInRunEndPos=LastClass.State.ContentPos;LastClass.SelectThisElement();LastClass.Selection.Use=true;LastClass.Selection.StartPos=nInRunStartPos;LastClass.Selection.EndPos=nInRunEndPos;return}var Elements=SelectedContent.Elements;var Para=NearPos.Paragraph;var DstIndex=-1;var Count=this.Content.length;for(var Index=0;Index< Count;Index++)if(this.Content[Index]===Para){DstIndex=Index;break}if(-1===DstIndex)return;if(this.IsBlockLevelSdtContent()&&this.Parent.IsPlaceHolder()){var oBlockLevelSdt=this.Parent;oBlockLevelSdt.ReplacePlaceHolderWithContent();Para=this.Content[0];if(!Para||type_Paragraph!==Para.GetType())return;NearPos=Para.Get_NearestPos(0,0,0,false,false);Para.Check_NearestPos(NearPos);ParaNearPos=Para.Get_ParaNearestPos(NearPos);LastClass=ParaNearPos.Classes[ParaNearPos.Classes.length-1];DstIndex=0}var bNeedSelect= true;var Elements=SelectedContent.Elements;var ElementsCount=Elements.length;var FirstElement=SelectedContent.Elements[0];if(1===ElementsCount&&true!==FirstElement.SelectedAll&&type_Paragraph===FirstElement.Element.GetType()){var NewPara=FirstElement.Element;var NewElementsCount=NewPara.Content.length-1;if(LastClass instanceof ParaRun&&LastClass.GetParent()instanceof CInlineLevelSdt&&LastClass.GetParent().IsPlaceHolder()){var oInlineLeveLSdt=LastClass.GetParent();oInlineLeveLSdt.ReplacePlaceHolderWithContent(); LastClass=oInlineLeveLSdt.GetElement(0);ParaNearPos.Classes[ParaNearPos.Classes.length-1]=LastClass;ParaNearPos.NearPos.ContentPos.Update(0,ParaNearPos.Classes.length-1);ParaNearPos.NearPos.ContentPos.Update(0,ParaNearPos.Classes.length-2)}var NewElement=LastClass.Split(ParaNearPos.NearPos.ContentPos,ParaNearPos.Classes.length-1);var PrevClass=ParaNearPos.Classes[ParaNearPos.Classes.length-2];var PrevPos=ParaNearPos.NearPos.ContentPos.Data[ParaNearPos.Classes.length-2];PrevClass.Add_ToContent(PrevPos+ 1,NewElement);bNeedSelect=true===SelectedContent.MoveDrawing?false:true;for(var Index=0;IndexNextLevel)break;else if(NextBullet.Get_Type()===oLastBullet.Get_Type()&&NextBullet.Get_StartAt()===oLastBullet.Get_StartAt()){var nNumStartAt=Bullet.getNumStartAt();if(AscFormat.isRealNumber(nNumStartAt)){var oPrBullet=new AscFormat.CBullet;oPrBullet.putNumStartAt(nNumStartAt);Next.Add_PresentationNumbering(oPrBullet)}Next= Next.Next}else break}}}};CDocumentContent.prototype.Can_IncreaseParagraphLevel=function(bIncrease){if(true===this.ApplyToAll){for(var Index=0;Index=this.Content.length){EndPos=this.Content.length-1;break}var TempItem=this.Content[EndPos];if(type_Paragraph!==TempItem.GetType()){EndPos--;break}CurBrd=TempItem.Get_CompiledPr().ParaPr.Brd}for(var Index=StartPos;Index<=EndPos;Index++)this.Content[Index].SetParagraphBorders(Borders)}else Item.SetParagraphBorders(Borders)}}};CDocumentContent.prototype.IncreaseDecreaseFontSize=function(bIncrease){if(true===this.ApplyToAll){for(var Index=0;IndexEnd){Start= this.Selection.EndPos;End=this.Selection.StartPos}for(var Pos=Start;Pos<=End;Pos++)this.Content[Pos].PasteFormatting(TextPr,ParaPr,Start===End?false:true);break}}else this.Content[this.CurPos.ContentPos].PasteFormatting(TextPr,ParaPr,true)};CDocumentContent.prototype.SetImageProps=function(Props){if(docpostype_DrawingObjects===this.CurPos.Type){this.LogicDocument.DrawingObjects.setProps(Props);this.Document_UpdateInterfaceState()}else if(docpostype_Content==this.CurPos.Type&&(true===this.Selection.Use&& this.Selection.StartPos==this.Selection.EndPos&&type_Table==this.Content[this.Selection.StartPos].GetType()||false==this.Selection.Use&&type_Table==this.Content[this.CurPos.ContentPos].GetType()))if(true==this.Selection.Use)this.Content[this.Selection.StartPos].SetImageProps(Props);else this.Content[this.CurPos.ContentPos].SetImageProps(Props)};CDocumentContent.prototype.SetTableProps=function(Props){if(true===this.ApplyToAll)return false;if(docpostype_DrawingObjects===this.CurPos.Type)return this.LogicDocument.DrawingObjects.setTableProps(Props); else{var Pos=-1;if(true===this.Selection.Use&&this.Selection.StartPos==this.Selection.EndPos)Pos=this.Selection.StartPos;else if(false===this.Selection.Use)Pos=this.CurPos.ContentPos;if(-1!==Pos)return this.Content[Pos].SetTableProps(Props);return false}};CDocumentContent.prototype.GetTableProps=function(){var TablePr=null;if(docpostype_Content==this.GetDocPosType()&&(true===this.Selection.Use&&this.Selection.StartPos==this.Selection.EndPos||false==this.Selection.Use))if(true==this.Selection.Use)TablePr= this.Content[this.Selection.StartPos].GetTableProps();else TablePr=this.Content[this.CurPos.ContentPos].GetTableProps();if(null!==TablePr)TablePr.CanBeFlow=true;return TablePr};CDocumentContent.prototype.GetCalculatedParaPr=function(){var Result_ParaPr=new CParaPr;var FirstTextPr,FirstTextPrTmp,oBullet;if(true===this.ApplyToAll){var StartPr=this.Content[0].GetCalculatedParaPr();var Pr=StartPr.Copy();Pr.Locked=StartPr.Locked;if(this.bPresentation)if(this.Content[0].GetType()===type_Paragraph)FirstTextPr= this.Content[0].Get_FirstTextPr2();for(var Index=1;IndexEnd){var Temp=Start;Start=End;End=Temp}Start=Math.max(0,Start);End=Math.min(this.Content.length-1,End);for(var Index=Start;Index<=End;Index++)this.Content[Index].RemoveSelection();break}case selectionflag_Numbering:{if(!this.Selection.Data)break; for(var nIndex=0,nCount=this.Selection.Data.Paragraphs.length;nIndex=this.Pages.length)return;if(docpostype_DrawingObjects===this.CurPos.Type){this.DrawingDocument.SetTextSelectionOutline(true); var PageAbs=CurPage+this.Get_StartPage_Absolute();this.LogicDocument.DrawingObjects.drawSelectionPage(PageAbs)}else{var Pos_start=this.Pages[CurPage].Pos;var Pos_end=this.Pages[CurPage].EndPos;if(true===this.Selection.Use)switch(this.Selection.Flag){case selectionflag_Common:{var Start=this.Selection.StartPos;var End=this.Selection.EndPos;if(Start>End){Start=this.Selection.EndPos;End=this.Selection.StartPos}var Start=Math.max(Start,Pos_start);var End=Math.min(End,Pos_end);for(var Index=Start;Index<= End;Index++){var ElementPageIndex=this.private_GetElementPageIndex(Index,CurPage,0,1);this.Content[Index].DrawSelectionOnPage(ElementPageIndex)}break}case selectionflag_Numbering:{if(!this.Selection.Data)break;var nPageAbs=this.Get_AbsolutePage(CurPage);for(var nIndex=0,nCount=this.Selection.Data.Paragraphs.length;nIndex=this.Pages.length){CurPage=this.Pages.length-1;Y=this.Pages[CurPage].YLimit}this.CurPage=CurPage;var AbsPage=this.Get_AbsolutePage(this.CurPage);var isTopDocumentContent=this===this.GetTopDocumentContent();var bInText=null!==this.IsInText(X,Y,CurPage);var bTableBorder=null!==this.IsTableBorder(X,Y,CurPage);var nInDrawing=this.LogicDocument&&this.LogicDocument.DrawingObjects.IsInDrawingObject(X, Y,AbsPage,this);if(this.Parent instanceof CHeaderFooter&&(nInDrawing===DRAWING_ARRAY_TYPE_BEFORE||nInDrawing===DRAWING_ARRAY_TYPE_INLINE||false===bTableBorder&&false===bInText&&nInDrawing>=0)){if(docpostype_DrawingObjects!=this.CurPos.Type)this.RemoveSelection();this.DrawingDocument.TargetEnd();this.DrawingDocument.SetCurrentPage(AbsPage);var HdrFtr=this.IsHdrFtr(true);if(null===HdrFtr){this.LogicDocument.Selection.Use=true;this.LogicDocument.Selection.Start=true;this.LogicDocument.Selection.Flag= selectionflag_Common;this.LogicDocument.SetDocPosType(docpostype_DrawingObjects)}else{HdrFtr.Content.Selection.Use=true;HdrFtr.Content.Selection.Start=true;HdrFtr.Content.Selection.Flag=selectionflag_Common;HdrFtr.Content.SetDocPosType(docpostype_DrawingObjects)}this.LogicDocument.DrawingObjects.OnMouseDown(MouseEvent,X,Y,AbsPage)}else{var bOldSelectionIsCommon=true;if(docpostype_DrawingObjects===this.CurPos.Type&&true!=this.IsInDrawing(X,Y,AbsPage)){this.LogicDocument.DrawingObjects.resetSelection(); bOldSelectionIsCommon=false}var ContentPos=this.Internal_GetContentPosByXY(X,Y);if(docpostype_Content!=this.CurPos.Type){this.SetDocPosType(docpostype_Content);this.CurPos.ContentPos=ContentPos;bOldSelectionIsCommon=false}var SelectionUse_old=this.Selection.Use;var Item=this.Content[ContentPos];if(!(true===SelectionUse_old&&true===MouseEvent.ShiftKey&&true===bOldSelectionIsCommon))if(selectionflag_Common!=this.Selection.Flag||true===this.Selection.Use&&MouseEvent.ClickCount<=1&&true!=bTableBorder)this.RemoveSelection(); this.Selection.Use=true;this.Selection.Start=true;this.Selection.Flag=selectionflag_Common;if(true===SelectionUse_old&&true===MouseEvent.ShiftKey&&true===bOldSelectionIsCommon){this.Selection_SetEnd(X,Y,this.CurPage,{Type:AscCommon.g_mouse_event_type_up,ClickCount:1});this.Selection.Use=true;this.Selection.Start=true;this.Selection.EndPos=ContentPos;this.Selection.Data=null}else{var ElementPageIndex=this.private_GetElementPageIndexByXY(ContentPos,X,Y,this.CurPage);Item.Selection_SetStart(X,Y,ElementPageIndex, MouseEvent);if(this.IsNumberingSelection())return;if(isTopDocumentContent)Item.Selection_SetEnd(X,Y,ElementPageIndex,{Type:AscCommon.g_mouse_event_type_move,ClickCount:1});if(true!==bTableBorder){this.Selection.Use=true;this.Selection.StartPos=ContentPos;this.Selection.EndPos=ContentPos;this.Selection.Data=null;this.CurPos.ContentPos=ContentPos;if(type_Paragraph===Item.GetType()&&true===MouseEvent.CtrlKey){var oHyperlink=Item.CheckHyperlink(X,Y,ElementPageIndex);var oPageRefLink=Item.CheckPageRefLink(X, Y,ElementPageIndex);if(null!=oHyperlink)this.Selection.Data={Hyperlink:oHyperlink};else if(null!==oPageRefLink)this.Selection.Data={PageRef:oPageRefLink}}}else this.Selection.Data={TableBorder:true,Pos:ContentPos,Selection:SelectionUse_old}}}};CDocumentContent.prototype.Selection_SetEnd=function(X,Y,CurPage,MouseEvent){if(this.Pages.length<=0)return;if(CurPage<0){CurPage=0;Y=0}else if(CurPage>=this.Pages.length){CurPage=this.Pages.length-1;Y=this.Pages[CurPage].YLimit}if(docpostype_DrawingObjects=== this.CurPos.Type){var PageAbs=this.Get_StartPage_Absolute(CurPage);if(AscCommon.g_mouse_event_type_up==MouseEvent.Type){this.LogicDocument.DrawingObjects.OnMouseUp(MouseEvent,X,Y,PageAbs);this.Selection.Start=false;this.Selection.Use=true}else this.LogicDocument.DrawingObjects.OnMouseMove(MouseEvent,X,Y,PageAbs);return}this.CurPage=CurPage;if(selectionflag_Numbering===this.Selection.Flag)return;if(null!=this.Selection.Data&&true===this.Selection.Data.TableBorder&&type_Table==this.Content[this.Selection.Data.Pos].GetType()){var nPos= this.Selection.Data.Pos;if(AscCommon.g_mouse_event_type_up==MouseEvent.Type){this.Selection.Start=false;this.Selection.Use=this.Selection.Data.Selection;this.Selection.Data=null}var Item=this.Content[nPos];var ElementPageIndex=this.private_GetElementPageIndexByXY(nPos,X,Y,this.CurPage);Item.Selection_SetEnd(X,Y,ElementPageIndex,MouseEvent);return}if(false===this.Selection.Use)return;var ContentPos=this.Internal_GetContentPosByXY(X,Y);this.CurPos.ContentPos=ContentPos;var OldEndPos=this.Selection.EndPos; this.Selection.EndPos=ContentPos;if(OldEndPosthis.Selection.StartPos&&OldEndPos>this.Selection.EndPos){var TempLimit=Math.max(this.Selection.StartPos,this.Selection.EndPos);for(var Index=TempLimit+1;Index<=OldEndPos;Index++)this.Content[Index].RemoveSelection()}var Direction= ContentPos>this.Selection.StartPos?1:ContentPos0){Start=this.Selection.StartPos;End=this.Selection.EndPos}else{End=this.Selection.StartPos;Start=this.Selection.EndPos}if(Direction>0&&type_Paragraph===this.Content[Start].GetType()&&true===this.Content[Start].IsSelectionEmpty()&&this.Content[Start].Selection.StartPos==this.Content[Start].Content.length-1){this.Content[Start].Selection.StartPos=this.Content[Start].Internal_GetEndPos();this.Content[Start].Selection.EndPos= this.Content[Start].Content.length-1}var ElementPageIndex=this.private_GetElementPageIndexByXY(ContentPos,X,Y,this.CurPage);this.Content[ContentPos].Selection_SetEnd(X,Y,ElementPageIndex,MouseEvent);for(var Index=Start;Index<=End;Index++){var Item=this.Content[Index];Item.SetSelectionUse(true);switch(Index){case Start:Item.SetSelectionToBeginEnd(Direction>0?false:true,false);break;case End:Item.SetSelectionToBeginEnd(Direction>0?true:false,true);break;default:Item.SelectAll(Direction);break}}};CDocumentContent.prototype.CheckPosInSelection= function(X,Y,CurPage,NearPos){if(docpostype_DrawingObjects===this.CurPos.Type)return this.DrawingObjects.selectionCheck(X,Y,this.Get_AbsolutePage(CurPage),NearPos);else{if(true===this.Selection.Use||true===this.ApplyToAll){switch(this.Selection.Flag){case selectionflag_Common:{var Start=this.Selection.StartPos;var End=this.Selection.EndPos;if(Start>End){Start=this.Selection.EndPos;End=this.Selection.StartPos}if(undefined!==NearPos){if(true===this.ApplyToAll){Start=0;End=this.Content.length-1}for(var Index= Start;Index<=End;Index++){if(true===this.ApplyToAll)this.Content[Index].SetApplyToAll(true);if(true===this.Content[Index].CheckPosInSelection(0,0,0,NearPos)){if(true===this.ApplyToAll)this.Content[Index].SetApplyToAll(false);return true}if(true===this.ApplyToAll)this.Content[Index].SetApplyToAll(false)}return false}else{var ContentPos=this.Internal_GetContentPosByXY(X,Y,CurPage);if(ContentPos>Start&&ContentPosEnd)return false;else{var ElementPageIndex= this.private_GetElementPageIndexByXY(ContentPos,X,Y,CurPage);return this.Content[ContentPos].CheckPosInSelection(X,Y,ElementPageIndex,NearPos)}return false}}case selectionflag_Numbering:return false}return false}return false}};CDocumentContent.prototype.IsSelectionEmpty=function(bCheckHidden){if(docpostype_DrawingObjects===this.CurPos.Type)return this.LogicDocument.DrawingObjects.selectionIsEmpty(bCheckHidden);else{if(true===this.Selection.Use)if(selectionflag_Numbering==this.Selection.Flag)return false; else if(null!=this.Selection.Data&&true===this.Selection.Data.TableBorder&&type_Table==this.Content[this.Selection.Data.Pos].GetType())return false;else if(this.Selection.StartPos===this.Selection.EndPos)return this.Content[this.Selection.StartPos].IsSelectionEmpty(bCheckHidden);else return false;return true}};CDocumentContent.prototype.SelectAll=function(){if(docpostype_DrawingObjects===this.CurPos.Type&&true===this.DrawingObjects.isSelectedText())this.DrawingObjects.selectAll();else{if(true===this.Selection.Use)this.RemoveSelection(); this.SetDocPosType(docpostype_Content);this.Selection.Use=true;this.Selection.Start=false;this.Selection.Flag=selectionflag_Common;this.Selection.StartPos=0;this.Selection.EndPos=this.Content.length-1;for(var Index=0;Index=this.Content.length-1)Pos--;if(Pos<0)Pos=0;this.SetDocPosType(docpostype_Content);this.CurPos.ContentPos=Pos;this.Content[Pos].MoveCursorToStartPos()}}return true}else return Table.RemoveTable()}return false};CDocumentContent.prototype.SelectTable=function(Type){if(docpostype_DrawingObjects==this.CurPos.Type)return this.LogicDocument.DrawingObjects.tableSelect(Type); else if(docpostype_Content==this.CurPos.Type&&(true===this.Selection.Use&&this.Selection.StartPos==this.Selection.EndPos&&type_Paragraph!==this.Content[this.Selection.StartPos].GetType()||false==this.Selection.Use&&type_Paragraph!==this.Content[this.CurPos.ContentPos].GetType())){var Pos=0;if(true===this.Selection.Use)Pos=this.Selection.StartPos;else Pos=this.CurPos.ContentPos;this.Content[Pos].SelectTable(Type);if(false===this.Selection.Use&&true===this.Content[Pos].IsSelectionUse()){this.Selection.Use= true;this.Selection.StartPos=Pos;this.Selection.EndPos=Pos}return true}return false};CDocumentContent.prototype.CanMergeTableCells=function(){if(docpostype_DrawingObjects==this.CurPos.Type)return this.LogicDocument.DrawingObjects.tableCheckMerge();else if(docpostype_Content==this.CurPos.Type&&(true===this.Selection.Use&&this.Selection.StartPos==this.Selection.EndPos&&type_Paragraph!==this.Content[this.Selection.StartPos].GetType()||false==this.Selection.Use&&type_Paragraph!==this.Content[this.CurPos.ContentPos].GetType())){var Pos= 0;if(true===this.Selection.Use)Pos=this.Selection.StartPos;else Pos=this.CurPos.ContentPos;return this.Content[Pos].CanMergeTableCells()}return false};CDocumentContent.prototype.CanSplitTableCells=function(){if(docpostype_DrawingObjects==this.CurPos.Type)return this.LogicDocument.DrawingObjects.tableCheckSplit();else if(docpostype_Content==this.CurPos.Type){var nPos=true===this.Selection.Use?this.Selection.StartPos:this.CurPos.ContentPos;return this.Content[nPos].CanSplitTableCells()}return false}; CDocumentContent.prototype.DistributeTableCells=function(isHorizontally){if(docpostype_DrawingObjects==this.CurPos.Type)return this.LogicDocument.DrawingObjects.distributeTableCells(isHorizontally);else if(docpostype_Content==this.CurPos.Type&&(true===this.Selection.Use&&this.Selection.StartPos==this.Selection.EndPos&&type_Paragraph!==this.Content[this.Selection.StartPos].GetType()||false==this.Selection.Use&&type_Paragraph!==this.Content[this.CurPos.ContentPos].GetType())){var Pos=0;if(true===this.Selection.Use)Pos= this.Selection.StartPos;else Pos=this.CurPos.ContentPos;return this.Content[Pos].DistributeTableCells(isHorizontally)}return false};CDocumentContent.prototype.Internal_GetContentPosByXY=function(X,Y,PageNum){if(undefined===PageNum||null===PageNum)PageNum=this.CurPage;PageNum=Math.max(0,Math.min(PageNum,this.Pages.length-1));var oFlow=this.LogicDocument&&this.LogicDocument.DrawingObjects.getTableByXY(X,Y,this.GetAbsolutePage(PageNum),this);var nFlowPos=this.private_GetContentIndexByFlowObject(oFlow, X,Y);if(-1!==nFlowPos)return nFlowPos;var SectCount=this.Pages[PageNum].EndSectionParas.length;for(var Index=0;IndexBounds.Top&&X>Bounds.Left&&X 1){if(true!==Item.IsStartFromNewPage())return InlineElements[Pos+1];return InlineElements[Pos]}if(Pos===Count-2)return InlineElements[Count-1]}return InlineElements[0]};CDocumentContent.prototype.private_CheckCurPage=function(){if(docpostype_DrawingObjects===this.CurPos.Type)this.CurPage=0;else if(docpostype_Content===this.CurPos.Type)if(true===this.Selection.Use)this.CurPage=this.Content[this.Selection.EndPos].Get_CurrentPage_Relative();else if(this.CurPos.ContentPos>=0)this.CurPage=this.Content[this.CurPos.ContentPos].Get_CurrentPage_Relative()}; CDocumentContent.prototype.Internal_Content_Add=function(Position,NewObject,isCorrectContent){if(Position<0||Position>this.Content.length)return;var PrevObj=this.Content[Position-1]?this.Content[Position-1]:null;var NextObj=this.Content[Position]?this.Content[Position]:null;this.private_RecalculateNumbering([NewObject]);History.Add(new CChangesDocumentContentAddItem(this,Position,[NewObject]));this.Content.splice(Position,0,NewObject);this.private_UpdateSelectionPosOnAdd(Position);NewObject.Set_Parent(this); NewObject.Set_DocumentNext(NextObj);NewObject.Set_DocumentPrev(PrevObj);if(null!=PrevObj)PrevObj.Set_DocumentNext(NewObject);if(null!=NextObj)NextObj.Set_DocumentPrev(NewObject);if(Position<=this.CurPos.TableMove)this.CurPos.TableMove++;if(false!==isCorrectContent&&!this.Content[this.Content.length-1].IsParagraph()&&!this.Content[this.Content.length-1].IsBlockLevelSdt()&&!this.IsBlockLevelSdtContent())this.Internal_Content_Add(this.Content.length,new Paragraph(this.DrawingDocument,this,this.bPresentation=== true));this.private_ReindexContent(Position)};CDocumentContent.prototype.Internal_Content_Remove=function(Position,Count,isCorrectContent){if(Position<0||Position>=this.Content.length||Count<=0)return;var PrevObj=this.Content[Position-1]?this.Content[Position-1]:null;var NextObj=this.Content[Position+Count]?this.Content[Position+Count]:null;for(var Index=0;IndexEndPos){var Temp=StartPos;StartPos=EndPos;EndPos=Temp}State=[];var TempState=[];for(var Index=StartPos;Index<= EndPos;Index++)TempState.push(this.Content[Index].GetSelectionState());State.push(TempState)}else State=this.Content[this.CurPos.ContentPos].GetSelectionState();if(null!=this.Selection.Data&&true===this.Selection.Data.TableBorder)DocState.Selection.Data=null;State.push(DocState);return State};CDocumentContent.prototype.SetSelectionState=function(State,StateIndex){if(docpostype_DrawingObjects===this.CurPos.Type)this.LogicDocument.DrawingObjects.resetSelection();if(State.length<=0)return;var DocState= State[StateIndex];this.CurPos={X:DocState.CurPos.X,Y:DocState.CurPos.Y,ContentPos:DocState.CurPos.ContentPos,RealX:DocState.CurPos.RealX,RealY:DocState.CurPos.RealY,Type:DocState.CurPos.Type};this.SetDocPosType(DocState.CurPos.Type);this.Selection={Start:DocState.Selection.Start,Use:DocState.Selection.Use,StartPos:DocState.Selection.StartPos,EndPos:DocState.Selection.EndPos,Flag:DocState.Selection.Flag,Data:DocState.Selection.Data};this.CurPage=DocState.CurPage;var NewStateIndex=StateIndex-1;if(docpostype_DrawingObjects== this.CurPos.Type)this.LogicDocument.DrawingObjects.setSelectionState(State,NewStateIndex);else if(true===this.Selection.Use)if(selectionflag_Numbering==this.Selection.Flag)if(type_Paragraph===this.Content[this.Selection.StartPos].Get_Type()){var NumPr=this.Content[this.Selection.StartPos].GetNumPr();if(undefined!==NumPr)this.SelectNumbering(NumPr,this.Content[this.Selection.StartPos]);else this.LogicDocument.RemoveSelection()}else this.LogicDocument.RemoveSelection();else{var StartPos=this.Selection.StartPos; var EndPos=this.Selection.EndPos;if(StartPos>EndPos){var Temp=StartPos;StartPos=EndPos;EndPos=Temp}var CurState=State[NewStateIndex];for(var Index=StartPos;Index<=EndPos;Index++)this.Content[Index].SetSelectionState(CurState[Index-StartPos],CurState[Index-StartPos].length-1)}else this.Content[this.CurPos.ContentPos].SetSelectionState(State,NewStateIndex)};CDocumentContent.prototype.Get_ParentObject_or_DocumentPos=function(){return this.Parent.Get_ParentObject_or_DocumentPos()};CDocumentContent.prototype.Refresh_RecalcData= function(oData){var nCurPage=0;switch(oData.Type){case AscDFH.historyitem_DocumentContent_AddItem:case AscDFH.historyitem_DocumentContent_RemoveItem:{var nDataPos=0;if(oData instanceof CChangesDocumentContentAddItem||oData instanceof CChangesDocumentContentRemoveItem)nDataPos=oData.GetMinPos();else if(undefined!==oData.Pos)nDataPos=oData.Pos;for(nCurPage=this.Pages.length-1;nCurPage>0;nCurPage--)if(nDataPos>this.Pages[nCurPage].Pos)break;break}}this.Refresh_RecalcData2(0,nCurPage)};CDocumentContent.prototype.Refresh_RecalcData2= function(nIndex,nPageRel){if(-1===nIndex)return;this.Parent.Refresh_RecalcData2(this.StartPage+nPageRel)};CDocumentContent.prototype.AddHyperlink=function(HyperProps){if(docpostype_DrawingObjects===this.CurPos.Type)return this.LogicDocument.DrawingObjects.hyperlinkAdd(HyperProps);else if(docpostype_Content===this.CurPos.Type&&(false===this.Selection.Use||this.Selection.StartPos===this.Selection.EndPos)){var Pos=true==this.Selection.Use?this.Selection.StartPos:this.CurPos.ContentPos;this.Content[Pos].AddHyperlink(HyperProps)}}; CDocumentContent.prototype.ModifyHyperlink=function(HyperProps){if(docpostype_DrawingObjects==this.CurPos.Type)return this.LogicDocument.DrawingObjects.hyperlinkModify(HyperProps);else if(docpostype_Content==this.CurPos.Type&&(false===this.Selection.Use||this.Selection.StartPos===this.Selection.EndPos)){var Pos=true==this.Selection.Use?this.Selection.StartPos:this.CurPos.ContentPos;this.Content[Pos].ModifyHyperlink(HyperProps)}};CDocumentContent.prototype.RemoveHyperlink=function(){if(docpostype_DrawingObjects=== this.CurPos.Type)return this.LogicDocument.DrawingObjects.hyperlinkRemove();else if(docpostype_Content==this.CurPos.Type&&(false===this.Selection.Use||this.Selection.StartPos===this.Selection.EndPos)){var Pos=true==this.Selection.Use?this.Selection.StartPos:this.CurPos.ContentPos;this.Content[Pos].RemoveHyperlink()}};CDocumentContent.prototype.CanAddHyperlink=function(bCheckInHyperlink){if(docpostype_DrawingObjects===this.CurPos.Type)return this.LogicDocument.DrawingObjects.hyperlinkCanAdd(bCheckInHyperlink); else if(true===this.Selection.Use)switch(this.Selection.Flag){case selectionflag_Numbering:return false;case selectionflag_Common:{if(this.Selection.StartPos!=this.Selection.EndPos)return false;return this.Content[this.Selection.StartPos].CanAddHyperlink(bCheckInHyperlink)}}else return this.Content[this.CurPos.ContentPos].CanAddHyperlink(bCheckInHyperlink);return false};CDocumentContent.prototype.IsCursorInHyperlink=function(bCheckEnd){if(docpostype_DrawingObjects==this.CurPos.Type)return this.LogicDocument.DrawingObjects.hyperlinkCheck(bCheckEnd); else if(true===this.Selection.Use)switch(this.Selection.Flag){case selectionflag_Numbering:return null;case selectionflag_Common:{if(this.Selection.StartPos!=this.Selection.EndPos)return null;return this.Content[this.Selection.StartPos].IsCursorInHyperlink(bCheckEnd)}}else return this.Content[this.CurPos.ContentPos].IsCursorInHyperlink(bCheckEnd);return null};CDocumentContent.prototype.Write_ToBinary2=function(Writer){Writer.WriteLong(AscDFH.historyitem_type_DocumentContent);Writer.WriteString2(this.Id); Writer.WriteLong(this.StartPage);Writer.WriteString2(this.Parent.Get_Id());Writer.WriteBool(this.TurnOffInnerWrap);Writer.WriteBool(this.Split);AscFormat.writeBool(Writer,this.bPresentation);var ContentToWrite;if(this.StartState)ContentToWrite=this.StartState.Content;else ContentToWrite=this.Content;var Count=ContentToWrite.length;Writer.WriteLong(Count);for(var Index=0;Index1)return true;else{var oElement=this.Content[0];oElement.SetApplyToAll(true);var isCanAdd=oElement.CanAddComment();oElement.SetApplyToAll(false);return isCanAdd}else if(docpostype_DrawingObjects=== this.CurPos.Type)if(true!=this.LogicDocument.DrawingObjects.isSelectedText())return true;else return this.LogicDocument.DrawingObjects.canAddComment();else switch(this.Selection.Flag){case selectionflag_Numbering:return false;case selectionflag_Common:{if(true===this.Selection.Use&&this.Selection.StartPos!=this.Selection.EndPos)return true;else{var Pos=this.Selection.Use===true?this.Selection.StartPos:this.CurPos.ContentPos;var Element=this.Content[Pos];return Element.CanAddComment()}}}return false}; CDocumentContent.prototype.GetSelectionBounds=function(){if(true===this.Selection.Use&&selectionflag_Common===this.Selection.Flag){var Start=this.Selection.StartPos;var End=this.Selection.EndPos;if(Start>End){Start=this.Selection.EndPos;End=this.Selection.StartPos}if(Start===End)return this.Content[Start].GetSelectionBounds();else{var Result={};Result.Start=this.Content[Start].GetSelectionBounds().Start;Result.End=this.Content[End].GetSelectionBounds().End;Result.Direction=this.Selection.StartPos> this.Selection.EndPos?-1:1;return Result}}else if(this.Content[this.CurPos.ContentPos])return this.Content[this.CurPos.ContentPos].GetSelectionBounds();return null};CDocumentContent.prototype.GetSelectionAnchorPos=function(){var Pos=true===this.Selection.Use?this.Selection.StartPos0)return this.Content[ContentLen-1].GetEndInfo();else return null};CDocumentContent.prototype.GetPrevElementEndInfo=function(CurElement){var PrevElement=CurElement.Get_DocumentPrev();if(null!==PrevElement&&undefined!==PrevElement)return PrevElement.GetEndInfo();else return this.Parent.GetPrevElementEndInfo(this)};CDocumentContent.prototype.GetTopElement=function(){if(this.Parent)return this.Parent.GetTopElement();return null};CDocumentContent.prototype.CompareDrawingsLogicPositions= function(CompareObject){for(var Index=0,Count=this.Content.length;Indexthis.Selection.EndPos)return this.Content[this.Selection.EndPos].GetStyleFromFormatting();else return this.Content[this.Selection.StartPos].GetStyleFromFormatting();else return this.Content[this.CurPos.ContentPos].GetStyleFromFormatting()}; CDocumentContent.prototype.IsTrackRevisions=function(){if(this.LogicDocument)return this.LogicDocument.IsTrackRevisions();return false};CDocumentContent.prototype.Get_SectPr=function(){if(this.Parent&&this.Parent.Get_SectPr)return this.Parent.Get_SectPr();return null};CDocumentContent.prototype.SetParagraphFramePr=function(FramePr,bDelete){if(docpostype_DrawingObjects===this.CurPos.Type)return;else if(true===this.Selection.Use){var StartPos=this.Selection.StartPos;var EndPos=this.Selection.EndPos; if(StartPos>EndPos){StartPos=this.Selection.EndPos;EndPos=this.Selection.StartPos}var Element=this.Content[StartPos];if(type_Paragraph!==Element.GetType()||undefined===Element.Get_FramePr())return;var FramePr=Element.Get_FramePr();for(var Pos=StartPos+1;Pos0){StartPos--;_StartDocPos=null;_StartFlag=-1}else return;var _EndDocPos=EndDocPos,_EndFlag=EndFlag;if(null!==EndDocPos&&true===EndDocPos[Depth].Deleted)if(EndPos0){EndPos--;_EndDocPos= null;_EndFlag=-1}else return;StartPos=Math.min(this.Content.length-1,Math.max(0,StartPos));EndPos=Math.min(this.Content.length-1,Math.max(0,EndPos));this.Selection.Use=true;this.Selection.StartPos=StartPos;this.Selection.EndPos=EndPos;if(StartPos!==EndPos){this.Content[StartPos].SetContentSelection(_StartDocPos,null,Depth+1,_StartFlag,StartPos>EndPos?1:-1);this.Content[EndPos].SetContentSelection(null,_EndDocPos,Depth+1,StartPos>EndPos?-1:1,_EndFlag);var _StartPos=StartPos;var _EndPos=EndPos;var Direction= 1;if(_StartPos>_EndPos){_StartPos=EndPos;_EndPos=StartPos;Direction=-1}for(var CurPos=_StartPos+1;CurPos<_EndPos;CurPos++)this.Content[CurPos].SelectAll(Direction)}else this.Content[StartPos].SetContentSelection(_StartDocPos,_EndDocPos,Depth+1,_StartFlag,_EndFlag)};CDocumentContent.prototype.SetContentPosition=function(DocPos,Depth,Flag){if(0===Flag&&(!DocPos[Depth]||this!==DocPos[Depth].Class))return;if(this.Content.length<=0)return;var Pos=0;switch(Flag){case 0:Pos=DocPos[Depth].Position;break; case 1:Pos=0;break;case -1:Pos=this.Content.length-1;break}var _DocPos=DocPos,_Flag=Flag;if(null!==DocPos&&true===DocPos[Depth].Deleted)if(Pos0){Pos--;_DocPos=null;_Flag=-1}else return;Pos=Math.min(this.Content.length-1,Math.max(0,Pos));this.CurPos.ContentPos=Pos;this.Content[Pos].SetContentPosition(_DocPos,Depth+1,_Flag)};CDocumentContent.prototype.private_GetElementPageIndex=function(ElementPos,PageIndex,ColumnIndex,ColumnsCount){var Element= this.Content[ElementPos];if(!Element||Element.GetPagesCount()<=0)return 0;var StartPage=Element.Get_StartPage_Relative();var StartColumn=Element.Get_StartColumn();return ColumnIndex-StartColumn+(PageIndex-StartPage)*ColumnsCount};CDocumentContent.prototype.private_GetElementPageIndexByXY=function(ElementPos,X,Y,PageIndex){return this.private_GetElementPageIndex(ElementPos,PageIndex,0,1)};CDocumentContent.prototype.GetPageIndexByXYAndPageAbs=function(X,Y,nPageAbs){var nResultPage=0;var nMinDistance= null;for(var nCurPage=0,nPagesCount=this.Pages.length;nCurPagenPageAbs)break}return nResultPage};CDocumentContent.prototype.GetTopDocumentContent=function(isOneLevel){var TopDocument=null;if(true!==isOneLevel&&this.Parent&&this.Parent.GetTopDocumentContent)TopDocument= this.Parent.GetTopDocumentContent();if(null!==TopDocument&&undefined!==TopDocument)return TopDocument;return this};CDocumentContent.prototype.private_RecalculateNumbering=function(Elements){if(true===AscCommon.g_oIdCounter.m_bLoad||true===AscCommon.g_oIdCounter.m_bRead||true===this.bPresentation)return;for(var Index=0,Count=Elements.length;IndexnPos)return true;else if(this.Pages[CurPage].EndPos=this.Pages.length)return true;var nStartPos=this.Pages[nCurPage].Pos;var nEndPos=this.Pages[nCurPage].EndPos;if(nStartPos>nEndPos)return true;if(nStartPos this.Selection.EndPos?this.Selection.EndPos:this.Selection.StartPos;var EndPos=this.Selection.StartPos>this.Selection.EndPos?this.Selection.StartPos:this.Selection.EndPos;if(StartPos!=EndPos&&AscCommon.changestype_Delete===CheckType)CheckType=AscCommon.changestype_Remove;for(var Index=StartPos;Index<=EndPos;Index++)this.Content[Index].Document_Is_SelectionLocked(CheckType)}else{var CurElement=this.Content[this.CurPos.ContentPos];if(AscCommon.changestype_Document_Content_Add===CheckType&&CurElement.IsParagraph()&& CurElement.IsCursorAtEnd()&&CurElement.Lock.Is_Locked())AscCommon.CollaborativeEditing.Add_CheckLock(false);else this.Content[this.CurPos.ContentPos].Document_Is_SelectionLocked(CheckType)}break}case selectionflag_Numbering:{var oNumPr=this.Selection.Data.CurPara.GetNumPr();if(oNumPr){var oNum=this.GetNumbering().GetNum(oNumPr.NumId);oNum.IsSelectionLocked(CheckType)}this.Content[this.CurPos.ContentPos].Document_Is_SelectionLocked(CheckType);break}}};CDocumentContent.prototype.CheckContentControlEditingLock= function(){if(this.Parent&&this.Parent.CheckContentControlEditingLock)this.Parent.CheckContentControlEditingLock()};CDocumentContent.prototype.MakeSingleParagraphContent=function(){if(this.Content.length<=0)this.AddToContent(0,new Paragraph(this.DrawingDocument,this));else if(this.Content.length>1||!this.Content[0].IsParagraph()){this.RemoveFromContent(0,this.Content.length,true);this.AddToContent(0,new Paragraph(this.DrawingDocument,this))}return this.Content[0]};CDocumentContent.prototype.AcceptRevisionChanges= function(nType,bAll){if(docpostype_Content===this.CurPos.Type||true===bAll)this.private_AcceptRevisionChanges(nType,bAll);else if(docpostype_DrawingObjects===this.CurPos.Type)this.DrawingObjects.AcceptRevisionChanges(nType,bAll)};CDocumentContent.prototype.RejectRevisionChanges=function(nType,bAll){if(docpostype_Content===this.CurPos.Type||true===bAll)this.private_RejectRevisionChanges(nType,bAll);else if(docpostype_DrawingObjects===this.CurPos.Type)this.DrawingObjects.RejectRevisionChanges(nType, bAll)};CDocumentContent.prototype.GetRevisionsChangeElement=function(SearchEngine){if(true===SearchEngine.IsFound())return;var Direction=SearchEngine.GetDirection();var Pos=0;if(true!==SearchEngine.IsCurrentFound())Pos=true===this.Selection.Use?this.Selection.StartPos<=this.Selection.EndPos?this.Selection.StartPos:this.Selection.EndPos:this.CurPos.ContentPos;else if(Direction>0)Pos=0;else Pos=this.Content.length-1;this.Content[Pos].GetRevisionsChangeElement(SearchEngine);while(true!==SearchEngine.IsFound()){Pos= Direction>0?Pos+1:Pos-1;if(Pos>=this.Content.length||Pos<0)break;this.Content[Pos].GetRevisionsChangeElement(SearchEngine)}};CDocumentContent.prototype.GetAllTablesOnPage=function(nPageAbs,arrTables){if(!arrTables)arrTables=[];var nStartPos=-1;var nEndPos=-2;for(var nCurPage=0,nPagesCount=this.Pages.length;nCurPage nPageAbs)break}for(var nCurPos=nStartPos;nCurPos<=nEndPos;++nCurPos)this.Content[nCurPos].GetAllTablesOnPage(nPageAbs,arrTables);return arrTables};CDocumentContent.prototype.ProcessComplexFields=function(){for(var nIndex=0,nCount=this.Content.length;nIndex this.Pages.length)return this.Pages[0].Bounds;var Bounds=this.Pages[PageNum].Bounds;return Bounds},Get_DrawingFlowPos:function(FlowPos){var Count=this.Content.length;for(var Index=0;Index0)if(Pos<=oDocument.Content.length-1){oDocument.Content[Pos-1].Next=oDocument.Content[Pos];oDocument.Content[Pos].Prev=oDocument.Content[Pos-1]}else oDocument.Content[Pos-1].Next=null;else if(Pos<=oDocument.Content.length-1)oDocument.Content[Pos].Prev=null}};CChangesDocumentContentAddItem.prototype.Redo=function(){var oDocument=this.Class;for(var nIndex=0,nCount=this.Items.length;nIndex0){oDocument.Content[Pos-1].Next=Element;Element.Prev=oDocument.Content[Pos-1]}else Element.Prev=null;if(Pos0){oDocument.Content[Pos-1].Next=Element;Element.Prev=oDocument.Content[Pos-1]}else Element.Prev=null;if(Pos<=oDocument.Content.length-1){oDocument.Content[Pos].Prev=Element;Element.Next=oDocument.Content[Pos]}else Element.Next=null;Element.Parent=oDocument;oDocument.Content.splice(Pos,0,Element);oDocument.private_RecalculateNumbering([Element]);oDocument.private_ReindexContent(Pos);AscCommon.CollaborativeEditing.Update_DocumentPositionsOnAdd(oDocument, Pos)}}};CChangesDocumentContentAddItem.prototype.IsRelated=function(oChanges){if(this.Class===oChanges.Class&&(AscDFH.historyitem_DocumentContent_AddItem===oChanges.Type||AscDFH.historyitem_DocumentContent_RemoveItem===oChanges.Type))return true;return false};CChangesDocumentContentAddItem.prototype.CreateReverseChange=function(){return this.private_CreateReverseChange(CChangesDocumentContentRemoveItem)};function CChangesDocumentContentRemoveItem(Class,Pos,Items){AscDFH.CChangesBaseContentChange.call(this, Class,Pos,Items,false)}CChangesDocumentContentRemoveItem.prototype=Object.create(AscDFH.CChangesBaseContentChange.prototype);CChangesDocumentContentRemoveItem.prototype.constructor=CChangesDocumentContentRemoveItem;CChangesDocumentContentRemoveItem.prototype.Type=AscDFH.historyitem_DocumentContent_RemoveItem;CChangesDocumentContentRemoveItem.prototype.Undo=function(){if(!this.Items||this.Items.length<=0)return;var oDocument=this.Class;var Array_start=oDocument.Content.slice(0,this.Pos);var Array_end= oDocument.Content.slice(this.Pos);oDocument.private_RecalculateNumbering(this.Items);oDocument.private_ReindexContent(this.Pos);oDocument.Content=Array_start.concat(this.Items,Array_end);var nStartIndex=Math.max(this.Pos-1,0);var nEndIndex=Math.min(oDocument.Content.length-1,this.Pos+this.Items.length+1);for(var nIndex=nStartIndex;nIndex<=nEndIndex;++nIndex){var oElement=oDocument.Content[nIndex];if(nIndex>0)oElement.Prev=oDocument.Content[nIndex-1];else oElement.Prev=null;if(nIndex0)if(Pos<=oDocument.Content.length-1){oDocument.Content[Pos-1].Next=oDocument.Content[Pos];oDocument.Content[Pos].Prev= oDocument.Content[Pos-1]}else oDocument.Content[Pos-1].Next=null;else if(Pos<=oDocument.Content.length-1)oDocument.Content[Pos].Prev=null};CChangesDocumentContentRemoveItem.prototype.private_WriteItem=function(Writer,Item){Writer.WriteString2(Item.Get_Id())};CChangesDocumentContentRemoveItem.prototype.private_ReadItem=function(Reader){return AscCommon.g_oTableId.Get_ById(Reader.GetString2())};CChangesDocumentContentRemoveItem.prototype.Load=function(Color){var oDocument=this.Class;for(var nIndex= 0,nCount=this.Items.length;nIndex0)if(Pos<=oDocument.Content.length-1){oDocument.Content[Pos-1].Next=oDocument.Content[Pos];oDocument.Content[Pos].Prev= oDocument.Content[Pos-1]}else{if(oDocument.Content[Pos-1])oDocument.Content[Pos-1].Next=null}else if(Pos<=oDocument.Content.length-1)oDocument.Content[Pos].Prev=null;oDocument.private_ReindexContent(Pos)}};CChangesDocumentContentRemoveItem.prototype.IsRelated=function(oChanges){if(this.Class===oChanges.Class&&(AscDFH.historyitem_DocumentContent_AddItem===oChanges.Type||AscDFH.historyitem_DocumentContent_RemoveItem===oChanges.Type))return true;return false};CChangesDocumentContentRemoveItem.prototype.CreateReverseChange= function(){return this.private_CreateReverseChange(CChangesDocumentContentAddItem)};"use strict";function CDocumentControllerBase(LogicDocument){this.LogicDocument=LogicDocument;this.DrawingDocument=LogicDocument.Get_DrawingDocument()}CDocumentControllerBase.prototype.Get_LogicDocument=function(){return this.LogicDocument};CDocumentControllerBase.prototype.Get_DrawingDocument=function(){return this.DrawingDocument};CDocumentControllerBase.prototype.IsHdrFtr=function(bReturnHdrFtr){if(bReturnHdrFtr)return null; return false};CDocumentControllerBase.prototype.IsFootnote=function(bReturnFootnote){if(bReturnFootnote)return null;return false};CDocumentControllerBase.prototype.Is_DrawingShape=function(bReturnShape){if(bReturnShape)return null;return false};CDocumentControllerBase.prototype.Get_AbsolutePage=function(CurPage){return CurPage};CDocumentControllerBase.prototype.Get_AbsoluteColumn=function(CurPage){return 0};CDocumentControllerBase.prototype.Is_TopDocument=function(bReturnTopDocument){if(bReturnTopDocument)return null; return false};CDocumentControllerBase.prototype.Get_Numbering=function(){return this.LogicDocument.Get_Numbering()};CDocumentControllerBase.prototype.Get_Styles=function(){return this.LogicDocument.Get_Styles()};CDocumentControllerBase.prototype.Get_TableStyleForPara=function(){return null};CDocumentControllerBase.prototype.Get_ShapeStyleForPara=function(){return null};CDocumentControllerBase.prototype.Get_TextBackGroundColor=function(){return undefined};CDocumentControllerBase.prototype.IsCell=function(isReturnCell){if(true=== isReturnCell)return null;return false};CDocumentControllerBase.prototype.Get_Theme=function(){return this.LogicDocument.Get_Theme()};CDocumentControllerBase.prototype.Get_ColorMap=function(){return this.LogicDocument.Get_ColorMap()};CDocumentControllerBase.prototype.GetPrevElementEndInfo=function(CurElement){return null};CDocumentControllerBase.prototype.Get_ParentTextTransform=function(){return null};CDocumentControllerBase.prototype.Check_AutoFit=function(){return false};CDocumentControllerBase.prototype.Refresh_RecalcData2= function(){};CDocumentControllerBase.prototype.IsInTable=function(bReturnTopTable){if(true===bReturnTopTable)return null;return false};CDocumentControllerBase.prototype.Is_DrawingShape=function(bRetShape){if(bRetShape===true)return null;return false};CDocumentControllerBase.prototype.OnContentRecalculate=function(bChange,bForceRecalc){return};CDocumentControllerBase.prototype.Get_PageContentStartPos=function(PageAbs){return{X:0,Y:0,XLimit:0,YLimit:0}};CDocumentControllerBase.prototype.Set_CurrentElement= function(bUpdateStates,PageAbs,oClass){};CDocumentControllerBase.prototype.CanUpdateTarget=function(){return true};CDocumentControllerBase.prototype.RecalculateCurPos=function(bUpdateX,bUpdateY,isUpdateTarget){return{X:0,Y:0,Height:0,PageNum:0,Internal:{Line:0,Page:0,Range:0},Transform:null}};CDocumentControllerBase.prototype.GetCurPage=function(){return-1};CDocumentControllerBase.prototype.AddNewParagraph=function(bRecalculate,bForceAdd){return false};CDocumentControllerBase.prototype.AddInlineImage= function(nW,nH,oImage,oChart,bFlow){};CDocumentControllerBase.prototype.AddImages=function(aImages){};CDocumentControllerBase.prototype.AddOleObject=function(nW,nH,nWidthPix,nHeightPix,oImage,oData,sApplicationId){};CDocumentControllerBase.prototype.AddTextArt=function(nStyle){};CDocumentControllerBase.prototype.AddSignatureLine=function(oSignatureDrawing){};CDocumentControllerBase.prototype.EditChart=function(Chart){};CDocumentControllerBase.prototype.AddInlineTable=function(nCols,nRows,nMode){return null}; CDocumentControllerBase.prototype.ClearParagraphFormatting=function(isClearParaPr,isClearTextPr){};CDocumentControllerBase.prototype.AddToParagraph=function(oItem,bRecalculate){};CDocumentControllerBase.prototype.Remove=function(nDirection,isRemoveWholeElement,bRemoveOnlySelection,bOnAddText,isWord){return true};CDocumentControllerBase.prototype.GetCursorPosXY=function(){return{X:0,Y:0}};CDocumentControllerBase.prototype.MoveCursorToStartPos=function(AddToSelect){};CDocumentControllerBase.prototype.MoveCursorToEndPos= function(AddToSelect){};CDocumentControllerBase.prototype.MoveCursorLeft=function(AddToSelect,Word){return false};CDocumentControllerBase.prototype.MoveCursorRight=function(AddToSelect,Word){return false};CDocumentControllerBase.prototype.MoveCursorUp=function(AddToSelect){return false};CDocumentControllerBase.prototype.MoveCursorDown=function(AddToSelect){return false};CDocumentControllerBase.prototype.MoveCursorToEndOfLine=function(AddToSelect){return false};CDocumentControllerBase.prototype.MoveCursorToStartOfLine= function(AddToSelect){return false};CDocumentControllerBase.prototype.MoveCursorToXY=function(X,Y,PageAbs,AddToSelect){};CDocumentControllerBase.prototype.MoveCursorToCell=function(bNext){};CDocumentControllerBase.prototype.SetParagraphAlign=function(Align){};CDocumentControllerBase.prototype.SetParagraphSpacing=function(Spacing){};CDocumentControllerBase.prototype.SetParagraphTabs=function(Tabs){};CDocumentControllerBase.prototype.SetParagraphIndent=function(Ind){};CDocumentControllerBase.prototype.SetParagraphShd= function(Shd){};CDocumentControllerBase.prototype.SetParagraphStyle=function(Name){};CDocumentControllerBase.prototype.SetParagraphContextualSpacing=function(Value){};CDocumentControllerBase.prototype.SetParagraphPageBreakBefore=function(Value){};CDocumentControllerBase.prototype.SetParagraphKeepLines=function(Value){};CDocumentControllerBase.prototype.SetParagraphKeepNext=function(Value){};CDocumentControllerBase.prototype.SetParagraphWidowControl=function(Value){};CDocumentControllerBase.prototype.SetParagraphBorders= function(Borders){};CDocumentControllerBase.prototype.SetParagraphFramePr=function(FramePr,bDelete){};CDocumentControllerBase.prototype.IncreaseDecreaseFontSize=function(bIncrease){};CDocumentControllerBase.prototype.IncreaseDecreaseIndent=function(bIncrease){};CDocumentControllerBase.prototype.SetImageProps=function(Props){};CDocumentControllerBase.prototype.SetTableProps=function(Props){};CDocumentControllerBase.prototype.GetCalculatedParaPr=function(){var oParaPr=new CParaPr;oParaPr.InitDefault(); return oParaPr};CDocumentControllerBase.prototype.GetCalculatedTextPr=function(){var oTextPr=new CTextPr;oTextPr.InitDefault();return oTextPr};CDocumentControllerBase.prototype.GetDirectParaPr=function(){var oParaPr=new CParaPr;oParaPr.InitDefault();return oParaPr};CDocumentControllerBase.prototype.GetDirectTextPr=function(){var oTextPr=new CTextPr;oTextPr.InitDefault();return oTextPr};CDocumentControllerBase.prototype.RemoveSelection=function(bNoCheckDrawing){};CDocumentControllerBase.prototype.IsSelectionEmpty= function(bCheckHidden){return true};CDocumentControllerBase.prototype.DrawSelectionOnPage=function(PageAbs){};CDocumentControllerBase.prototype.GetSelectionBounds=function(){return null};CDocumentControllerBase.prototype.IsMovingTableBorder=function(){return false};CDocumentControllerBase.prototype.CheckPosInSelection=function(X,Y,PageAbs,NearPos){return false};CDocumentControllerBase.prototype.SelectAll=function(){};CDocumentControllerBase.prototype.GetSelectedContent=function(SelectedContent){}; CDocumentControllerBase.prototype.UpdateCursorType=function(X,Y,PageAbs,MouseEvent){};CDocumentControllerBase.prototype.PasteFormatting=function(TextPr,ParaPr){};CDocumentControllerBase.prototype.IsSelectionUse=function(){return false};CDocumentControllerBase.prototype.IsNumberingSelection=function(){return false};CDocumentControllerBase.prototype.IsTextSelectionUse=function(){return false};CDocumentControllerBase.prototype.GetCurPosXY=function(){return{X:0,Y:0}};CDocumentControllerBase.prototype.GetSelectedText= function(bClearText,oPr){return""};CDocumentControllerBase.prototype.GetCurrentParagraph=function(bIgnoreSelection,arrSelectedParagraphs,oPr){return null};CDocumentControllerBase.prototype.GetCurrentTablesStack=function(arrTables){return arrTables?arrTables:[]};CDocumentControllerBase.prototype.GetSelectedElementsInfo=function(oInfo){};CDocumentControllerBase.prototype.AddTableRow=function(bBefore,nCount){};CDocumentControllerBase.prototype.AddTableColumn=function(bBefore,nCount){};CDocumentControllerBase.prototype.RemoveTableRow= function(){};CDocumentControllerBase.prototype.RemoveTableColumn=function(){};CDocumentControllerBase.prototype.MergeTableCells=function(){};CDocumentControllerBase.prototype.SplitTableCells=function(Cols,Rows){};CDocumentControllerBase.prototype.RemoveTableCells=function(){};CDocumentControllerBase.prototype.RemoveTable=function(){};CDocumentControllerBase.prototype.SelectTable=function(Type){};CDocumentControllerBase.prototype.CanMergeTableCells=function(){return false};CDocumentControllerBase.prototype.CanSplitTableCells= function(){return false};CDocumentControllerBase.prototype.DistributeTableCells=function(isHorizontally){return false};CDocumentControllerBase.prototype.UpdateInterfaceState=function(){};CDocumentControllerBase.prototype.UpdateRulersState=function(){};CDocumentControllerBase.prototype.UpdateSelectionState=function(){};CDocumentControllerBase.prototype.GetSelectionState=function(){return[]};CDocumentControllerBase.prototype.SetSelectionState=function(State,StateIndex){};CDocumentControllerBase.prototype.AddHyperlink= function(Props){};CDocumentControllerBase.prototype.ModifyHyperlink=function(Props){};CDocumentControllerBase.prototype.RemoveHyperlink=function(){};CDocumentControllerBase.prototype.CanAddHyperlink=function(bCheckInHyperlink){return false};CDocumentControllerBase.prototype.IsCursorInHyperlink=function(bCheckEnd){return null};CDocumentControllerBase.prototype.AddComment=function(Comment){};CDocumentControllerBase.prototype.CanAddComment=function(){return false};CDocumentControllerBase.prototype.GetSelectionAnchorPos= function(){return{X0:0,X1:0,Y:0,Page:0}};CDocumentControllerBase.prototype.StartSelectionFromCurPos=function(){};CDocumentControllerBase.prototype.SaveDocumentStateBeforeLoadChanges=function(State){};CDocumentControllerBase.prototype.RestoreDocumentStateAfterLoadChanges=function(State){};CDocumentControllerBase.prototype.GetColumnSize=function(){return{W:0,H:0}};CDocumentControllerBase.prototype.GetCurrentSectionPr=function(){return null};CDocumentControllerBase.prototype.RemoveTextSelection=function(){}; CDocumentControllerBase.prototype.AddContentControl=function(nContentControlType){return null};CDocumentControllerBase.prototype.GetStyleFromFormatting=function(){return null};CDocumentControllerBase.prototype.GetSimilarNumbering=function(oContinueEngine){};CDocumentControllerBase.prototype.GetPlaceHolderObject=function(){return null};CDocumentControllerBase.prototype.GetAllFields=function(isUseSelection,arrFields){return arrFields?arrFields:[]};CDocumentControllerBase.prototype.IsTableCellSelection= function(){return false};CDocumentControllerBase.prototype.IsSelectionLocked=function(CheckType){};CDocumentControllerBase.prototype.FindNextFillingForm=function(isNext,isCurrent){return null};"use strict";function CLogicDocumentController(LogicDocument){CDocumentControllerBase.call(this,LogicDocument)}CLogicDocumentController.prototype=Object.create(CDocumentControllerBase.prototype);CLogicDocumentController.prototype.constructor=CLogicDocumentController;CLogicDocumentController.prototype.CanUpdateTarget= function(){return this.LogicDocument.controller_CanUpdateTarget()};CLogicDocumentController.prototype.RecalculateCurPos=function(bUpdateX,bUpdateY,isUpdateTarget){return this.LogicDocument.controller_RecalculateCurPos(bUpdateX,bUpdateY,isUpdateTarget)};CLogicDocumentController.prototype.GetCurPage=function(){return this.LogicDocument.controller_GetCurPage()};CLogicDocumentController.prototype.AddNewParagraph=function(bRecalculate,bForceAdd){return this.LogicDocument.controller_AddNewParagraph(bRecalculate, bForceAdd)};CLogicDocumentController.prototype.AddInlineImage=function(nW,nH,oImage,oChart,bFlow){this.LogicDocument.controller_AddInlineImage(nW,nH,oImage,oChart,bFlow)};CLogicDocumentController.prototype.AddImages=function(aImages){this.LogicDocument.controller_AddImages(aImages)};CLogicDocumentController.prototype.AddOleObject=function(nW,nH,nWidthPix,nHeightPix,oImage,oData,sApplicationId){this.LogicDocument.controller_AddOleObject(nW,nH,nWidthPix,nHeightPix,oImage,oData,sApplicationId)};CLogicDocumentController.prototype.AddTextArt= function(nStyle){this.LogicDocument.controller_AddTextArt(nStyle)};CLogicDocumentController.prototype.EditChart=function(Chart){};CLogicDocumentController.prototype.AddSignatureLine=function(oSignatureDrawing){this.LogicDocument.controller_AddSignatureLine(oSignatureDrawing)};CLogicDocumentController.prototype.AddInlineTable=function(nCols,nRows,nMode){return this.LogicDocument.controller_AddInlineTable(nCols,nRows,nMode)};CLogicDocumentController.prototype.ClearParagraphFormatting=function(isClearParaPr, isClearTextPr){this.LogicDocument.controller_ClearParagraphFormatting(isClearParaPr,isClearTextPr)};CLogicDocumentController.prototype.AddToParagraph=function(oItem){this.LogicDocument.controller_AddToParagraph(oItem)};CLogicDocumentController.prototype.Remove=function(nDirection,bOnlyText,bRemoveOnlySelection,bOnAddText,isWord){return this.LogicDocument.controller_Remove(nDirection,bOnlyText,bRemoveOnlySelection,bOnAddText,isWord)};CLogicDocumentController.prototype.GetCursorPosXY=function(){return this.LogicDocument.controller_GetCursorPosXY()}; CLogicDocumentController.prototype.MoveCursorToStartPos=function(bAddToSelect){this.LogicDocument.controller_MoveCursorToStartPos(bAddToSelect)};CLogicDocumentController.prototype.MoveCursorToEndPos=function(AddToSelect){this.LogicDocument.controller_MoveCursorToEndPos(AddToSelect)};CLogicDocumentController.prototype.MoveCursorLeft=function(AddToSelect,Word){return this.LogicDocument.controller_MoveCursorLeft(AddToSelect,Word)};CLogicDocumentController.prototype.MoveCursorRight=function(AddToSelect, Word){return this.LogicDocument.controller_MoveCursorRight(AddToSelect,Word)};CLogicDocumentController.prototype.MoveCursorUp=function(AddToSelect){return this.LogicDocument.controller_MoveCursorUp(AddToSelect)};CLogicDocumentController.prototype.MoveCursorDown=function(AddToSelect){return this.LogicDocument.controller_MoveCursorDown(AddToSelect)};CLogicDocumentController.prototype.MoveCursorToEndOfLine=function(AddToSelect){return this.LogicDocument.controller_MoveCursorToEndOfLine(AddToSelect)}; CLogicDocumentController.prototype.MoveCursorToStartOfLine=function(AddToSelect){return this.LogicDocument.controller_MoveCursorToStartOfLine(AddToSelect)};CLogicDocumentController.prototype.MoveCursorToXY=function(X,Y,PageAbs,AddToSelect){return this.LogicDocument.controller_MoveCursorToXY(X,Y,PageAbs,AddToSelect)};CLogicDocumentController.prototype.MoveCursorToCell=function(bNext){return this.LogicDocument.controller_MoveCursorToCell(bNext)};CLogicDocumentController.prototype.SetParagraphAlign= function(Align){this.LogicDocument.controller_SetParagraphAlign(Align)};CLogicDocumentController.prototype.SetParagraphSpacing=function(Spacing){this.LogicDocument.controller_SetParagraphSpacing(Spacing)};CLogicDocumentController.prototype.SetParagraphTabs=function(Tabs){this.LogicDocument.controller_SetParagraphTabs(Tabs)};CLogicDocumentController.prototype.SetParagraphIndent=function(Ind){this.LogicDocument.controller_SetParagraphIndent(Ind)};CLogicDocumentController.prototype.SetParagraphShd=function(Shd){this.LogicDocument.controller_SetParagraphShd(Shd)}; CLogicDocumentController.prototype.SetParagraphStyle=function(Name){this.LogicDocument.controller_SetParagraphStyle(Name)};CLogicDocumentController.prototype.SetParagraphContextualSpacing=function(Value){this.LogicDocument.controller_SetParagraphContextualSpacing(Value)};CLogicDocumentController.prototype.SetParagraphPageBreakBefore=function(Value){this.LogicDocument.controller_SetParagraphPageBreakBefore(Value)};CLogicDocumentController.prototype.SetParagraphKeepLines=function(Value){this.LogicDocument.controller_SetParagraphKeepLines(Value)}; CLogicDocumentController.prototype.SetParagraphKeepNext=function(Value){this.LogicDocument.controller_SetParagraphKeepNext(Value)};CLogicDocumentController.prototype.SetParagraphWidowControl=function(Value){this.LogicDocument.controller_SetParagraphWidowControl(Value)};CLogicDocumentController.prototype.SetParagraphBorders=function(Borders){this.LogicDocument.controller_SetParagraphBorders(Borders)};CLogicDocumentController.prototype.SetParagraphFramePr=function(FramePr,bDelete){this.LogicDocument.controller_SetParagraphFramePr(FramePr, bDelete)};CLogicDocumentController.prototype.IncreaseDecreaseFontSize=function(bIncrease){this.LogicDocument.controller_IncreaseDecreaseFontSize(bIncrease)};CLogicDocumentController.prototype.IncreaseDecreaseIndent=function(bIncrease){this.LogicDocument.controller_IncreaseDecreaseIndent(bIncrease)};CLogicDocumentController.prototype.SetImageProps=function(Props){this.LogicDocument.controller_SetImageProps(Props)};CLogicDocumentController.prototype.SetTableProps=function(Props){this.LogicDocument.controller_SetTableProps(Props)}; CLogicDocumentController.prototype.GetCalculatedParaPr=function(){return this.LogicDocument.controller_GetCalculatedParaPr()};CLogicDocumentController.prototype.GetCalculatedTextPr=function(){return this.LogicDocument.controller_GetCalculatedTextPr()};CLogicDocumentController.prototype.GetDirectParaPr=function(){return this.LogicDocument.controller_GetDirectParaPr()};CLogicDocumentController.prototype.GetDirectTextPr=function(){return this.LogicDocument.controller_GetDirectTextPr()};CLogicDocumentController.prototype.RemoveSelection= function(bNoCheckDrawing){this.LogicDocument.controller_RemoveSelection(bNoCheckDrawing)};CLogicDocumentController.prototype.IsSelectionEmpty=function(bCheckHidden){return this.LogicDocument.controller_IsSelectionEmpty(bCheckHidden)};CLogicDocumentController.prototype.DrawSelectionOnPage=function(PageAbs){this.LogicDocument.controller_DrawSelectionOnPage(PageAbs)};CLogicDocumentController.prototype.GetSelectionBounds=function(){return this.LogicDocument.controller_GetSelectionBounds()};CLogicDocumentController.prototype.IsMovingTableBorder= function(){return this.LogicDocument.controller_IsMovingTableBorder()};CLogicDocumentController.prototype.CheckPosInSelection=function(X,Y,PageAbs,NearPos){return this.LogicDocument.controller_CheckPosInSelection(X,Y,PageAbs,NearPos)};CLogicDocumentController.prototype.SelectAll=function(){this.LogicDocument.controller_SelectAll()};CLogicDocumentController.prototype.GetSelectedContent=function(SelectedContent){this.LogicDocument.controller_GetSelectedContent(SelectedContent)};CLogicDocumentController.prototype.UpdateCursorType= function(X,Y,PageAbs,MouseEvent){this.LogicDocument.controller_UpdateCursorType(X,Y,PageAbs,MouseEvent)};CLogicDocumentController.prototype.PasteFormatting=function(TextPr,ParaPr){this.LogicDocument.controller_PasteFormatting(TextPr,ParaPr)};CLogicDocumentController.prototype.IsSelectionUse=function(){return this.LogicDocument.controller_IsSelectionUse()};CLogicDocumentController.prototype.IsNumberingSelection=function(){return this.LogicDocument.controller_IsNumberingSelection()};CLogicDocumentController.prototype.IsTextSelectionUse= function(){return this.LogicDocument.controller_IsTextSelectionUse()};CLogicDocumentController.prototype.GetCurPosXY=function(){return this.LogicDocument.controller_GetCurPosXY()};CLogicDocumentController.prototype.GetSelectedText=function(bClearText,oPr){return this.LogicDocument.controller_GetSelectedText(bClearText,oPr)};CLogicDocumentController.prototype.GetCurrentParagraph=function(bIgnoreSelection,arrSelectedParagraphs,oPr){return this.LogicDocument.controller_GetCurrentParagraph(bIgnoreSelection, arrSelectedParagraphs,oPr)};CLogicDocumentController.prototype.GetCurrentTablesStack=function(arrTables){return this.LogicDocument.controller_GetCurrentTablesStack(arrTables)};CLogicDocumentController.prototype.GetSelectedElementsInfo=function(oInfo){this.LogicDocument.controller_GetSelectedElementsInfo(oInfo)};CLogicDocumentController.prototype.AddTableRow=function(bBefore,nCount){this.LogicDocument.controller_AddTableRow(bBefore,nCount)};CLogicDocumentController.prototype.AddTableColumn=function(bBefore, nCount){this.LogicDocument.controller_AddTableColumn(bBefore,nCount)};CLogicDocumentController.prototype.RemoveTableRow=function(){this.LogicDocument.controller_RemoveTableRow()};CLogicDocumentController.prototype.RemoveTableColumn=function(){this.LogicDocument.controller_RemoveTableColumn()};CLogicDocumentController.prototype.MergeTableCells=function(){this.LogicDocument.controller_MergeTableCells()};CLogicDocumentController.prototype.DistributeTableCells=function(isHorizontally){return this.LogicDocument.controller_DistributeTableCells(isHorizontally)}; CLogicDocumentController.prototype.SplitTableCells=function(Cols,Rows){this.LogicDocument.controller_SplitTableCells(Cols,Rows)};CLogicDocumentController.prototype.RemoveTableCells=function(){this.LogicDocument.controller_RemoveTableCells()};CLogicDocumentController.prototype.RemoveTable=function(){this.LogicDocument.controller_RemoveTable()};CLogicDocumentController.prototype.SelectTable=function(Type){this.LogicDocument.controller_SelectTable(Type)};CLogicDocumentController.prototype.CanMergeTableCells= function(){return this.LogicDocument.controller_CanMergeTableCells()};CLogicDocumentController.prototype.CanSplitTableCells=function(){return this.LogicDocument.controller_CanSplitTableCells()};CLogicDocumentController.prototype.UpdateInterfaceState=function(){this.LogicDocument.controller_UpdateInterfaceState()};CLogicDocumentController.prototype.UpdateRulersState=function(){this.LogicDocument.controller_UpdateRulersState()};CLogicDocumentController.prototype.UpdateSelectionState=function(){this.LogicDocument.controller_UpdateSelectionState()}; CLogicDocumentController.prototype.GetSelectionState=function(){return this.LogicDocument.controller_GetSelectionState()};CLogicDocumentController.prototype.SetSelectionState=function(State,StateIndex){this.LogicDocument.controller_SetSelectionState(State,StateIndex)};CLogicDocumentController.prototype.AddHyperlink=function(Props){this.LogicDocument.controller_AddHyperlink(Props)};CLogicDocumentController.prototype.ModifyHyperlink=function(Props){this.LogicDocument.controller_ModifyHyperlink(Props)}; CLogicDocumentController.prototype.RemoveHyperlink=function(){this.LogicDocument.controller_RemoveHyperlink()};CLogicDocumentController.prototype.CanAddHyperlink=function(bCheckInHyperlink){return this.LogicDocument.controller_CanAddHyperlink(bCheckInHyperlink)};CLogicDocumentController.prototype.IsCursorInHyperlink=function(bCheckEnd){return this.LogicDocument.controller_IsCursorInHyperlink(bCheckEnd)};CLogicDocumentController.prototype.AddComment=function(Comment){this.LogicDocument.controller_AddComment(Comment)}; CLogicDocumentController.prototype.CanAddComment=function(){return this.LogicDocument.controller_CanAddComment()};CLogicDocumentController.prototype.GetSelectionAnchorPos=function(){return this.LogicDocument.controller_GetSelectionAnchorPos()};CLogicDocumentController.prototype.StartSelectionFromCurPos=function(){this.LogicDocument.controller_StartSelectionFromCurPos()};CLogicDocumentController.prototype.SaveDocumentStateBeforeLoadChanges=function(State){this.LogicDocument.controller_SaveDocumentStateBeforeLoadChanges(State)}; CLogicDocumentController.prototype.RestoreDocumentStateAfterLoadChanges=function(State){this.LogicDocument.controller_RestoreDocumentStateAfterLoadChanges(State)};CLogicDocumentController.prototype.GetColumnSize=function(){return this.LogicDocument.controller_GetColumnSize()};CLogicDocumentController.prototype.GetCurrentSectionPr=function(){return this.LogicDocument.controller_GetCurrentSectionPr()};CLogicDocumentController.prototype.RemoveTextSelection=function(){return this.RemoveSelection()};CLogicDocumentController.prototype.AddContentControl= function(nContentControlType){return this.LogicDocument.controller_AddContentControl(nContentControlType)};CLogicDocumentController.prototype.GetStyleFromFormatting=function(){return this.LogicDocument.controller_GetStyleFromFormatting()};CLogicDocumentController.prototype.GetSimilarNumbering=function(oContinueEngine){this.LogicDocument.controller_GetSimilarNumbering(oContinueEngine)};CLogicDocumentController.prototype.GetPlaceHolderObject=function(){return this.LogicDocument.controller_GetPlaceHolderObject()}; CLogicDocumentController.prototype.GetAllFields=function(isUseSelection,arrFields){return this.LogicDocument.controller_GetAllFields(isUseSelection,arrFields)};CLogicDocumentController.prototype.IsTableCellSelection=function(){return this.LogicDocument.controller_IsTableCellSelection()};CLogicDocumentController.prototype.IsSelectionLocked=function(CheckType){this.LogicDocument.controller_IsSelectionLocked(CheckType)};"use strict";function CDrawingsController(LogicDocument,DrawingsObjects){CDocumentControllerBase.call(this, LogicDocument);this.DrawingObjects=DrawingsObjects}CDrawingsController.prototype=Object.create(CDocumentControllerBase.prototype);CDrawingsController.prototype.constructor=CDrawingsController;CDrawingsController.prototype.private_GetParentContentControl=function(){var oDrawing=this.DrawingObjects.getMajorParaDrawing();if(oDrawing){var oRun=oDrawing.GetRun();if(oRun){var arrDocPos=oRun.GetDocumentPositionFromObject();for(var nIndex=arrDocPos.length-1;nIndex>=0;--nIndex){var oClass=arrDocPos[nIndex].Class; if(oClass instanceof CDocumentContent&&oClass.Parent instanceof CBlockLevelSdt)return oClass.Parent;else if(oClass instanceof CInlineLevelSdt)return oClass}}}return null};CDrawingsController.prototype.CanUpdateTarget=function(){return true};CDrawingsController.prototype.RecalculateCurPos=function(bUpdateX,bUpdateY,isUpdateTarget){return this.DrawingObjects.recalculateCurPos(bUpdateX,bUpdateY,isUpdateTarget)};CDrawingsController.prototype.GetCurPage=function(){var ParaDrawing=this.DrawingObjects.getMajorParaDrawing(); if(null!==ParaDrawing)return ParaDrawing.PageNum;return-1};CDrawingsController.prototype.AddNewParagraph=function(bRecalculate,bForceAdd){return this.DrawingObjects.addNewParagraph(bRecalculate,bForceAdd)};CDrawingsController.prototype.AddInlineImage=function(nW,nH,oImage,oChart,bFlow){return this.DrawingObjects.addInlineImage(nW,nH,oImage,oChart,bFlow)};CDrawingsController.prototype.AddImages=function(aImages){return this.DrawingObjects.addImages(aImages)};CDrawingsController.prototype.AddSignatureLine= function(oSignatureDrawing){return this.DrawingObjects.addSignatureLine(oSignatureDrawing)};CDrawingsController.prototype.AddOleObject=function(W,H,nWidthPix,nHeightPix,Img,Data,sApplicationId){this.DrawingObjects.addOleObject(W,H,nWidthPix,nHeightPix,Img,Data,sApplicationId)};CDrawingsController.prototype.AddTextArt=function(nStyle){var ParaDrawing=this.DrawingObjects.getMajorParaDrawing();if(ParaDrawing){ParaDrawing.GoTo_Text(undefined,false);this.LogicDocument.AddTextArt(nStyle)}};CDrawingsController.prototype.EditChart= function(Chart){this.DrawingObjects.editChart(Chart)};CDrawingsController.prototype.AddInlineTable=function(nCols,nRows,nMode){return this.DrawingObjects.addInlineTable(nCols,nRows,nMode)};CDrawingsController.prototype.ClearParagraphFormatting=function(isClearParaPr,isClearTextPr){this.DrawingObjects.paragraphClearFormatting(isClearParaPr,isClearTextPr)};CDrawingsController.prototype.AddToParagraph=function(oItem,bRecalculate){if(para_NewLine===oItem.Type&&true===oItem.IsPageBreak())return;this.DrawingObjects.paragraphAdd(oItem, bRecalculate);this.LogicDocument.Document_UpdateSelectionState();this.LogicDocument.Document_UpdateUndoRedoState();this.LogicDocument.Document_UpdateInterfaceState()};CDrawingsController.prototype.Remove=function(Count,bOnlyText,bRemoveOnlySelection,bOnTextAdd,isWord){return this.DrawingObjects.remove(Count,bOnlyText,bRemoveOnlySelection,bOnTextAdd,isWord)};CDrawingsController.prototype.GetCursorPosXY=function(){return this.DrawingObjects.cursorGetPos()};CDrawingsController.prototype.MoveCursorToStartPos= function(AddToSelect){if(true===AddToSelect);else this.LogicDocument.controller_MoveCursorToStartPos(false)};CDrawingsController.prototype.MoveCursorToEndPos=function(AddToSelect){if(true===AddToSelect);else this.LogicDocument.controller_MoveCursorToEndPos(false)};CDrawingsController.prototype.MoveCursorLeft=function(AddToSelect,Word){if(!this.LogicDocument.Pages[this.LogicDocument.CurPage])return true;return this.DrawingObjects.cursorMoveLeft(AddToSelect,Word)};CDrawingsController.prototype.MoveCursorRight= function(AddToSelect,Word,FromPaste){if(!this.LogicDocument.Pages[this.LogicDocument.CurPage])return true;return this.DrawingObjects.cursorMoveRight(AddToSelect,Word,FromPaste)};CDrawingsController.prototype.MoveCursorUp=function(AddToSelect,CtrlKey){if(!this.LogicDocument.Pages[this.LogicDocument.CurPage])return true;var RetValue=this.DrawingObjects.cursorMoveUp(AddToSelect,CtrlKey);this.LogicDocument.Document_UpdateInterfaceState();this.LogicDocument.Document_UpdateSelectionState();return RetValue}; CDrawingsController.prototype.MoveCursorDown=function(AddToSelect,CtrlKey){if(!this.LogicDocument.Pages[this.LogicDocument.CurPage])return true;var RetValue=this.DrawingObjects.cursorMoveDown(AddToSelect,CtrlKey);this.LogicDocument.Document_UpdateInterfaceState();this.LogicDocument.Document_UpdateSelectionState();return RetValue};CDrawingsController.prototype.MoveCursorToEndOfLine=function(AddToSelect){return this.DrawingObjects.cursorMoveEndOfLine(AddToSelect)};CDrawingsController.prototype.MoveCursorToStartOfLine= function(AddToSelect){return this.DrawingObjects.cursorMoveStartOfLine(AddToSelect)};CDrawingsController.prototype.MoveCursorToXY=function(X,Y,PageAbs,AddToSelect){return this.DrawingObjects.cursorMoveAt(X,Y,AddToSelect)};CDrawingsController.prototype.MoveCursorToCell=function(bNext){return this.DrawingObjects.cursorMoveToCell(bNext)};CDrawingsController.prototype.SetParagraphAlign=function(Align){if(true!=this.DrawingObjects.isSelectedText()){var ParaDrawing=this.DrawingObjects.getMajorParaDrawing(); if(null!=ParaDrawing){var Paragraph=ParaDrawing.Parent;Paragraph.Set_Align(Align)}}else this.DrawingObjects.setParagraphAlign(Align)};CDrawingsController.prototype.SetParagraphSpacing=function(Spacing){if(true!=this.DrawingObjects.isSelectedText()){var ParaDrawing=this.DrawingObjects.getMajorParaDrawing();if(null!=ParaDrawing){var Paragraph=ParaDrawing.Parent;Paragraph.Set_Spacing(Spacing,false);this.LogicDocument.Recalculate()}}else this.DrawingObjects.setParagraphSpacing(Spacing)};CDrawingsController.prototype.SetParagraphTabs= function(Tabs){this.DrawingObjects.setParagraphTabs(Tabs)};CDrawingsController.prototype.SetParagraphIndent=function(Ind){this.DrawingObjects.setParagraphIndent(Ind)};CDrawingsController.prototype.SetParagraphShd=function(Shd){this.DrawingObjects.setParagraphShd(Shd)};CDrawingsController.prototype.SetParagraphStyle=function(Name){this.DrawingObjects.setParagraphStyle(Name)};CDrawingsController.prototype.SetParagraphContextualSpacing=function(Value){this.DrawingObjects.setParagraphContextualSpacing(Value)}; CDrawingsController.prototype.SetParagraphPageBreakBefore=function(Value){this.DrawingObjects.setParagraphPageBreakBefore(Value)};CDrawingsController.prototype.SetParagraphKeepLines=function(Value){this.DrawingObjects.setParagraphKeepLines(Value)};CDrawingsController.prototype.SetParagraphKeepNext=function(Value){this.DrawingObjects.setParagraphKeepNext(Value)};CDrawingsController.prototype.SetParagraphWidowControl=function(Value){this.DrawingObjects.setParagraphWidowControl(Value)};CDrawingsController.prototype.SetParagraphBorders= function(Borders){this.DrawingObjects.setParagraphBorders(Borders)};CDrawingsController.prototype.SetParagraphFramePr=function(FramePr,bDelete){};CDrawingsController.prototype.IncreaseDecreaseFontSize=function(bIncrease){this.DrawingObjects.paragraphIncDecFontSize(bIncrease)};CDrawingsController.prototype.IncreaseDecreaseIndent=function(bIncrease){if(true!=this.DrawingObjects.isSelectedText()){var ParaDrawing=this.DrawingObjects.getMajorParaDrawing();if(null!=ParaDrawing){var Paragraph=ParaDrawing.Parent; Paragraph.IncreaseDecreaseIndent(bIncrease)}}else this.DrawingObjects.paragraphIncDecIndent(bIncrease)};CDrawingsController.prototype.SetImageProps=function(Props){this.DrawingObjects.setProps(Props)};CDrawingsController.prototype.SetTableProps=function(Props){this.DrawingObjects.setTableProps(Props)};CDrawingsController.prototype.GetCalculatedParaPr=function(){return this.DrawingObjects.getParagraphParaPr()};CDrawingsController.prototype.GetCalculatedTextPr=function(){return this.DrawingObjects.getParagraphTextPr()}; CDrawingsController.prototype.GetDirectParaPr=function(){return this.DrawingObjects.getParagraphParaPrCopy()};CDrawingsController.prototype.GetDirectTextPr=function(){return this.DrawingObjects.getParagraphTextPrCopy()};CDrawingsController.prototype.RemoveSelection=function(bNoCheckDrawing){var ParaDrawing=this.DrawingObjects.getMajorParaDrawing();if(ParaDrawing)ParaDrawing.GoTo_Text(undefined,false);return this.DrawingObjects.resetSelection(undefined,bNoCheckDrawing)};CDrawingsController.prototype.IsSelectionEmpty= function(bCheckHidden){return false};CDrawingsController.prototype.DrawSelectionOnPage=function(PageAbs){var oParaDrawing=this.DrawingObjects.getMajorParaDrawing();if(!oParaDrawing||!oParaDrawing.IsForm())this.DrawingDocument.SetTextSelectionOutline(true);this.DrawingObjects.drawSelectionPage(PageAbs)};CDrawingsController.prototype.GetSelectionBounds=function(){return this.DrawingObjects.GetSelectionBounds()};CDrawingsController.prototype.IsMovingTableBorder=function(){return this.DrawingObjects.selectionIsTableBorder()}; CDrawingsController.prototype.CheckPosInSelection=function(X,Y,PageAbs,NearPos){return this.DrawingObjects.selectionCheck(X,Y,PageAbs,NearPos)};CDrawingsController.prototype.SelectAll=function(){this.DrawingObjects.selectAll()};CDrawingsController.prototype.GetSelectedContent=function(SelectedContent){this.DrawingObjects.GetSelectedContent(SelectedContent)};CDrawingsController.prototype.UpdateCursorType=function(X,Y,PageAbs,MouseEvent){this.LogicDocument.controller_UpdateCursorType(X,Y,PageAbs,MouseEvent)}; CDrawingsController.prototype.PasteFormatting=function(TextPr,ParaPr){this.DrawingObjects.paragraphFormatPaste(TextPr,ParaPr,false)};CDrawingsController.prototype.IsSelectionUse=function(){return this.DrawingObjects.isSelectionUse()};CDrawingsController.prototype.IsNumberingSelection=function(){var oTargetDocContent=this.DrawingObjects.getTargetDocContent();if(oTargetDocContent&&oTargetDocContent.IsNumberingSelection)return oTargetDocContent.IsNumberingSelection();return false};CDrawingsController.prototype.IsTextSelectionUse= function(){return this.DrawingObjects.isTextSelectionUse()};CDrawingsController.prototype.GetCurPosXY=function(){return this.DrawingObjects.getCurPosXY()};CDrawingsController.prototype.GetSelectedText=function(bClearText,oPr){return this.DrawingObjects.GetSelectedText(bClearText,oPr)};CDrawingsController.prototype.GetCurrentParagraph=function(bIgnoreSelection,arrSelectedParagraphs,oPr){return this.DrawingObjects.getCurrentParagraph(bIgnoreSelection,arrSelectedParagraphs,oPr)};CDrawingsController.prototype.GetCurrentTablesStack= function(arrTables){return this.DrawingObjects.getCurrentTablesStack(arrTables)};CDrawingsController.prototype.GetSelectedElementsInfo=function(oInfo){var oContentControl=this.private_GetParentContentControl();if(oContentControl)if(oContentControl.IsBlockLevel())oInfo.SetBlockLevelSdt(oContentControl);else if(oContentControl.IsInlineLevel())oInfo.SetInlineLevelSdt(oContentControl);this.DrawingObjects.getSelectedElementsInfo(oInfo);var oParaDrawing=this.DrawingObjects.getMajorParaDrawing();if(oParaDrawing&& oParaDrawing.IsForm()){var oInnerForm=oParaDrawing.GetInnerForm();if(oInnerForm)oInfo.SetInlineLevelSdt(oInnerForm)}};CDrawingsController.prototype.AddTableRow=function(bBefore,nCount){this.DrawingObjects.tableAddRow(bBefore,nCount)};CDrawingsController.prototype.AddTableColumn=function(bBefore,nCount){this.DrawingObjects.tableAddCol(bBefore,nCount)};CDrawingsController.prototype.RemoveTableRow=function(){this.DrawingObjects.tableRemoveRow()};CDrawingsController.prototype.RemoveTableColumn=function(){this.DrawingObjects.tableRemoveCol()}; CDrawingsController.prototype.MergeTableCells=function(){this.DrawingObjects.tableMergeCells()};CDrawingsController.prototype.SplitTableCells=function(Cols,Rows){this.DrawingObjects.tableSplitCell(Cols,Rows)};CDrawingsController.prototype.RemoveTableCells=function(){this.DrawingObjects.tableRemoveCells()};CDrawingsController.prototype.RemoveTable=function(){this.DrawingObjects.tableRemoveTable()};CDrawingsController.prototype.SelectTable=function(Type){this.DrawingObjects.tableSelect(Type)};CDrawingsController.prototype.CanMergeTableCells= function(){return this.DrawingObjects.tableCheckMerge()};CDrawingsController.prototype.CanSplitTableCells=function(){return this.DrawingObjects.tableCheckSplit()};CDrawingsController.prototype.DistributeTableCells=function(isHorizontally){return this.DrawingObjects.distributeTableCells(isHorizontally)};CDrawingsController.prototype.UpdateInterfaceState=function(){var oTargetTextObject=AscFormat.getTargetTextObject(this.DrawingObjects);if(oTargetTextObject){this.LogicDocument.Interface_Update_DrawingPr(); this.DrawingObjects.documentUpdateInterfaceState()}else{this.DrawingObjects.resetInterfaceTextPr();this.DrawingObjects.updateTextPr();this.LogicDocument.Interface_Update_DrawingPr();this.DrawingObjects.updateParentParagraphParaPr()}};CDrawingsController.prototype.UpdateRulersState=function(){this.DrawingDocument.Set_RulerState_Paragraph(null);this.LogicDocument.Document_UpdateRulersStateBySection(this.LogicDocument.CurPos.ContentPos);this.DrawingObjects.documentUpdateRulersState()};CDrawingsController.prototype.UpdateSelectionState= function(){this.DrawingObjects.documentUpdateSelectionState();this.LogicDocument.UpdateTracks()};CDrawingsController.prototype.GetSelectionState=function(){return this.DrawingObjects.getSelectionState()};CDrawingsController.prototype.SetSelectionState=function(State,StateIndex){this.DrawingObjects.setSelectionState(State,StateIndex)};CDrawingsController.prototype.AddHyperlink=function(Props){this.DrawingObjects.hyperlinkAdd(Props)};CDrawingsController.prototype.ModifyHyperlink=function(Props){this.DrawingObjects.hyperlinkModify(Props)}; CDrawingsController.prototype.RemoveHyperlink=function(){this.DrawingObjects.hyperlinkRemove()};CDrawingsController.prototype.CanAddHyperlink=function(bCheckInHyperlink){return this.DrawingObjects.hyperlinkCanAdd(bCheckInHyperlink)};CDrawingsController.prototype.IsCursorInHyperlink=function(bCheckEnd){return this.DrawingObjects.hyperlinkCheck(bCheckEnd)};CDrawingsController.prototype.AddComment=function(Comment){if(true!==this.DrawingObjects.isSelectedText()){var ParaDrawing=this.DrawingObjects.getMajorParaDrawing(); if(null!=ParaDrawing){var Paragraph=ParaDrawing.Parent;Paragraph.AddCommentToObject(Comment,ParaDrawing.Get_Id())}}else this.DrawingObjects.addComment(Comment)};CDrawingsController.prototype.CanAddComment=function(){if(true!=this.DrawingObjects.isSelectedText())return false;else return this.DrawingObjects.canAddComment()};CDrawingsController.prototype.GetSelectionAnchorPos=function(){var ParaDrawing=this.DrawingObjects.getMajorParaDrawing();return{X0:ParaDrawing.GraphicObj.x,Y:ParaDrawing.GraphicObj.y, X1:ParaDrawing.GraphicObj.x+ParaDrawing.GraphicObj.extX,Page:ParaDrawing.PageNum}};CDrawingsController.prototype.StartSelectionFromCurPos=function(){this.DrawingObjects.startSelectionFromCurPos()};CDrawingsController.prototype.SaveDocumentStateBeforeLoadChanges=function(State){this.DrawingObjects.Save_DocumentStateBeforeLoadChanges(State)};CDrawingsController.prototype.RestoreDocumentStateAfterLoadChanges=function(State){if(true!==this.DrawingObjects.Load_DocumentStateAfterLoadChanges(State)){var LogicDocument= this.LogicDocument;LogicDocument.SetDocPosType(docpostype_Content);var ContentPos=0;if(LogicDocument.Pages[LogicDocument.CurPage])ContentPos=LogicDocument.Pages[LogicDocument.CurPage].Pos+1;else ContentPos=0;ContentPos=Math.max(0,Math.min(LogicDocument.Content.length-1,ContentPos));LogicDocument.CurPos.ContentPos=ContentPos;LogicDocument.Content[ContentPos].MoveCursorToStartPos(false)}};CDrawingsController.prototype.GetColumnSize=function(){var _w=Math.max(1,AscCommon.Page_Width-(AscCommon.X_Left_Margin+ AscCommon.X_Right_Margin));var _h=Math.max(1,AscCommon.Page_Height-(AscCommon.Y_Top_Margin+AscCommon.Y_Bottom_Margin));return{W:AscCommon.Page_Width-(AscCommon.X_Left_Margin+AscCommon.X_Right_Margin),H:AscCommon.Page_Height-(AscCommon.Y_Top_Margin+AscCommon.Y_Bottom_Margin)}};CDrawingsController.prototype.GetCurrentSectionPr=function(){return null};CDrawingsController.prototype.RemoveTextSelection=function(){this.DrawingObjects.removeTextSelection()};CDrawingsController.prototype.AddContentControl= function(nContentControlType){return this.DrawingObjects.AddContentControl(nContentControlType)};CDrawingsController.prototype.GetStyleFromFormatting=function(){return this.DrawingObjects.GetStyleFromFormatting()};CDrawingsController.prototype.GetSimilarNumbering=function(oEngine){var oDocContent=this.DrawingObjects.getTargetDocContent();if(oDocContent&&oDocContent.GetSimilarNumbering)oDocContent.GetSimilarNumbering(oEngine)};CDrawingsController.prototype.GetAllFields=function(isUseSelection,arrFields){return this.DrawingObjects.GetAllFields(isUseSelection, arrFields)};CDrawingsController.prototype.IsTableCellSelection=function(){var oTargetDocContent=this.DrawingObjects.getTargetDocContent();if(oTargetDocContent&&oTargetDocContent.IsTableCellSelection)return oTargetDocContent.IsTableCellSelection();return false};CDrawingsController.prototype.IsSelectionLocked=function(nCheckType){this.DrawingObjects.documentIsSelectionLocked(nCheckType);var oContentControl=this.private_GetParentContentControl();if(oContentControl)oContentControl.Document_Is_SelectionLocked(nCheckType)}; "use strict";function CHdrFtrController(LogicDocument,HdrFtr){CDocumentControllerBase.call(this,LogicDocument);this.HdrFtr=HdrFtr}CHdrFtrController.prototype=Object.create(CDocumentControllerBase.prototype);CHdrFtrController.prototype.constructor=CHdrFtrController;CHdrFtrController.prototype.CanUpdateTarget=function(){return true};CHdrFtrController.prototype.RecalculateCurPos=function(bUpdateX,bUpdateY,isUpdateTarget){return this.HdrFtr.RecalculateCurPos(bUpdateX,bUpdateY,isUpdateTarget)};CHdrFtrController.prototype.GetCurPage= function(){var CurHdrFtr=this.HdrFtr.CurHdrFtr;if(null!==CurHdrFtr&&-1!==CurHdrFtr.RecalcInfo.CurPage)return CurHdrFtr.RecalcInfo.CurPage;return-1};CHdrFtrController.prototype.AddNewParagraph=function(bRecalculate,bForceAdd){return this.HdrFtr.AddNewParagraph(bRecalculate,bForceAdd)};CHdrFtrController.prototype.AddSignatureLine=function(oSignatureDrawing){this.HdrFtr.AddSignatureLine(oSignatureDrawing)};CHdrFtrController.prototype.AddInlineImage=function(nW,nH,oImage,oChart,bFlow){this.HdrFtr.AddInlineImage(nW, nH,oImage,oChart,bFlow)};CHdrFtrController.prototype.AddImages=function(aImages){this.HdrFtr.AddImages(aImages)};CHdrFtrController.prototype.AddOleObject=function(W,H,nWidthPix,nHeightPix,Img,Data,sApplicationId){this.HdrFtr.AddOleObject(W,H,nWidthPix,nHeightPix,Img,Data,sApplicationId)};CHdrFtrController.prototype.AddTextArt=function(nStyle){this.HdrFtr.AddTextArt(nStyle)};CHdrFtrController.prototype.EditChart=function(Chart){this.HdrFtr.EditChart(Chart)};CHdrFtrController.prototype.AddInlineTable= function(nCols,nRows,nMode){return this.HdrFtr.AddInlineTable(nCols,nRows,nMode)};CHdrFtrController.prototype.ClearParagraphFormatting=function(isClearParaPr,isClearTextPr){this.HdrFtr.ClearParagraphFormatting(isClearParaPr,isClearTextPr)};CHdrFtrController.prototype.AddToParagraph=function(oItem,bRecalculate){if(para_NewLine===oItem.Type&&true===oItem.IsPageBreak())return;this.HdrFtr.AddToParagraph(oItem,bRecalculate);this.LogicDocument.Document_UpdateSelectionState();this.LogicDocument.Document_UpdateUndoRedoState()}; CHdrFtrController.prototype.Remove=function(Count,bOnlyText,bRemoveOnlySelection,bOnTextAdd,isWord){var nResult=this.HdrFtr.Remove(Count,bOnlyText,bRemoveOnlySelection,bOnTextAdd,isWord);return nResult};CHdrFtrController.prototype.GetCursorPosXY=function(){return this.HdrFtr.GetCursorPosXY()};CHdrFtrController.prototype.MoveCursorToStartPos=function(AddToSelect){this.HdrFtr.MoveCursorToStartPos(AddToSelect)};CHdrFtrController.prototype.MoveCursorToEndPos=function(AddToSelect){this.HdrFtr.MoveCursorToEndPos(AddToSelect)}; CHdrFtrController.prototype.MoveCursorLeft=function(AddToSelect,Word){return this.HdrFtr.MoveCursorLeft(AddToSelect,Word)};CHdrFtrController.prototype.MoveCursorRight=function(AddToSelect,Word,FromPaste){return this.HdrFtr.MoveCursorRight(AddToSelect,Word,FromPaste)};CHdrFtrController.prototype.MoveCursorUp=function(AddToSelect){var RetValue=this.HdrFtr.MoveCursorUp(AddToSelect);this.LogicDocument.Document_UpdateInterfaceState();this.LogicDocument.Document_UpdateSelectionState();return RetValue}; CHdrFtrController.prototype.MoveCursorDown=function(AddToSelect){var RetValue=this.HdrFtr.MoveCursorDown(AddToSelect);this.LogicDocument.Document_UpdateInterfaceState();this.LogicDocument.Document_UpdateSelectionState();return RetValue};CHdrFtrController.prototype.MoveCursorToEndOfLine=function(AddToSelect){return this.HdrFtr.MoveCursorToEndOfLine(AddToSelect)};CHdrFtrController.prototype.MoveCursorToStartOfLine=function(AddToSelect){return this.HdrFtr.MoveCursorToStartOfLine(AddToSelect)};CHdrFtrController.prototype.MoveCursorToXY= function(X,Y,PageAbs,AddToSelect){return this.HdrFtr.MoveCursorToXY(X,Y,PageAbs,AddToSelect)};CHdrFtrController.prototype.MoveCursorToCell=function(bNext){return this.HdrFtr.MoveCursorToCell(bNext)};CHdrFtrController.prototype.SetParagraphAlign=function(Align){this.HdrFtr.SetParagraphAlign(Align)};CHdrFtrController.prototype.SetParagraphSpacing=function(Spacing){this.HdrFtr.SetParagraphSpacing(Spacing)};CHdrFtrController.prototype.SetParagraphTabs=function(Tabs){this.HdrFtr.SetParagraphTabs(Tabs)}; CHdrFtrController.prototype.SetParagraphIndent=function(Ind){this.HdrFtr.SetParagraphIndent(Ind)};CHdrFtrController.prototype.SetParagraphShd=function(Shd){this.HdrFtr.SetParagraphShd(Shd)};CHdrFtrController.prototype.SetParagraphStyle=function(Name){this.HdrFtr.SetParagraphStyle(Name)};CHdrFtrController.prototype.SetParagraphContextualSpacing=function(Value){this.HdrFtr.SetParagraphContextualSpacing(Value)};CHdrFtrController.prototype.SetParagraphPageBreakBefore=function(Value){this.HdrFtr.SetParagraphPageBreakBefore(Value)}; CHdrFtrController.prototype.SetParagraphKeepLines=function(Value){this.HdrFtr.SetParagraphKeepLines(Value)};CHdrFtrController.prototype.SetParagraphKeepNext=function(Value){this.HdrFtr.SetParagraphKeepNext(Value)};CHdrFtrController.prototype.SetParagraphWidowControl=function(Value){this.HdrFtr.SetParagraphWidowControl(Value)};CHdrFtrController.prototype.SetParagraphBorders=function(Borders){this.HdrFtr.SetParagraphBorders(Borders)};CHdrFtrController.prototype.SetParagraphFramePr=function(FramePr, bDelete){this.HdrFtr.SetParagraphFramePr(FramePr,bDelete)};CHdrFtrController.prototype.IncreaseDecreaseFontSize=function(bIncrease){this.HdrFtr.IncreaseDecreaseFontSize(bIncrease)};CHdrFtrController.prototype.IncreaseDecreaseIndent=function(bIncrease){this.HdrFtr.IncreaseDecreaseIndent(bIncrease)};CHdrFtrController.prototype.SetImageProps=function(Props){this.HdrFtr.SetImageProps(Props)};CHdrFtrController.prototype.SetTableProps=function(Props){this.HdrFtr.SetTableProps(Props)};CHdrFtrController.prototype.GetCalculatedParaPr= function(){return this.HdrFtr.GetCalculatedParaPr()};CHdrFtrController.prototype.GetCalculatedTextPr=function(){return this.HdrFtr.GetCalculatedTextPr()};CHdrFtrController.prototype.GetDirectParaPr=function(){return this.HdrFtr.GetDirectParaPr()};CHdrFtrController.prototype.GetDirectTextPr=function(){return this.HdrFtr.GetDirectTextPr()};CHdrFtrController.prototype.RemoveSelection=function(bNoCheckDrawing){this.HdrFtr.RemoveSelection(bNoCheckDrawing)};CHdrFtrController.prototype.IsSelectionEmpty= function(bCheckHidden){return this.HdrFtr.IsSelectionEmpty(bCheckHidden)};CHdrFtrController.prototype.DrawSelectionOnPage=function(PageAbs){this.HdrFtr.DrawSelectionOnPage(PageAbs)};CHdrFtrController.prototype.GetSelectionBounds=function(){return this.HdrFtr.GetSelectionBounds()};CHdrFtrController.prototype.IsMovingTableBorder=function(){return this.HdrFtr.IsMovingTableBorder()};CHdrFtrController.prototype.CheckPosInSelection=function(X,Y,PageAbs,NearPos){return this.HdrFtr.CheckPosInSelection(X, Y,PageAbs,NearPos)};CHdrFtrController.prototype.SelectAll=function(){this.HdrFtr.SelectAll()};CHdrFtrController.prototype.GetSelectedContent=function(SelectedContent){this.HdrFtr.GetSelectedContent(SelectedContent)};CHdrFtrController.prototype.UpdateCursorType=function(X,Y,PageAbs,MouseEvent){this.HdrFtr.UpdateCursorType(X,Y,PageAbs,MouseEvent)};CHdrFtrController.prototype.PasteFormatting=function(TextPr,ParaPr){this.HdrFtr.PasteFormatting(TextPr,ParaPr,false)};CHdrFtrController.prototype.IsSelectionUse= function(){return this.HdrFtr.IsSelectionUse()};CHdrFtrController.prototype.IsNumberingSelection=function(){return this.HdrFtr.IsNumberingSelection()};CHdrFtrController.prototype.IsTextSelectionUse=function(){return this.HdrFtr.IsTextSelectionUse()};CHdrFtrController.prototype.GetCurPosXY=function(){return this.HdrFtr.GetCurPosXY()};CHdrFtrController.prototype.GetSelectedText=function(bClearText,oPr){return this.HdrFtr.GetSelectedText(bClearText,oPr)};CHdrFtrController.prototype.GetCurrentParagraph= function(bIgnoreSelection,arrSelectedParagraphs,oPr){return this.HdrFtr.GetCurrentParagraph(bIgnoreSelection,arrSelectedParagraphs,oPr)};CHdrFtrController.prototype.GetCurrentTablesStack=function(arrTables){return this.HdrFtr.GetCurrentTablesStack(arrTables)};CHdrFtrController.prototype.GetSelectedElementsInfo=function(oInfo){this.HdrFtr.GetSelectedElementsInfo(oInfo)};CHdrFtrController.prototype.AddTableRow=function(bBefore,nCount){this.HdrFtr.AddTableRow(bBefore,nCount)};CHdrFtrController.prototype.AddTableColumn= function(bBefore,nCount){this.HdrFtr.AddTableColumn(bBefore,nCount)};CHdrFtrController.prototype.RemoveTableRow=function(){this.HdrFtr.RemoveTableRow()};CHdrFtrController.prototype.RemoveTableColumn=function(){this.HdrFtr.RemoveTableColumn()};CHdrFtrController.prototype.MergeTableCells=function(){this.HdrFtr.MergeTableCells()};CHdrFtrController.prototype.SplitTableCells=function(Cols,Rows){this.HdrFtr.SplitTableCells(Cols,Rows)};CHdrFtrController.prototype.RemoveTableCells=function(){this.HdrFtr.RemoveTableCells()}; CHdrFtrController.prototype.RemoveTable=function(){this.HdrFtr.RemoveTable()};CHdrFtrController.prototype.SelectTable=function(Type){this.HdrFtr.SelectTable(Type)};CHdrFtrController.prototype.CanMergeTableCells=function(){return this.HdrFtr.CanMergeTableCells()};CHdrFtrController.prototype.CanSplitTableCells=function(){return this.HdrFtr.CanSplitTableCells()};CHdrFtrController.prototype.UpdateInterfaceState=function(){this.LogicDocument.Interface_Update_HdrFtrPr();this.HdrFtr.Document_UpdateInterfaceState()}; CHdrFtrController.prototype.UpdateRulersState=function(){this.DrawingDocument.Set_RulerState_Paragraph(null);this.HdrFtr.Document_UpdateRulersState(this.LogicDocument.CurPage)};CHdrFtrController.prototype.UpdateSelectionState=function(){this.HdrFtr.Document_UpdateSelectionState();this.LogicDocument.UpdateTracks()};CHdrFtrController.prototype.GetSelectionState=function(){return this.HdrFtr.GetSelectionState()};CHdrFtrController.prototype.SetSelectionState=function(State,StateIndex){this.HdrFtr.SetSelectionState(State, StateIndex)};CHdrFtrController.prototype.AddHyperlink=function(Props){this.HdrFtr.AddHyperlink(Props)};CHdrFtrController.prototype.ModifyHyperlink=function(Props){this.HdrFtr.ModifyHyperlink(Props)};CHdrFtrController.prototype.RemoveHyperlink=function(){this.HdrFtr.RemoveHyperlink()};CHdrFtrController.prototype.CanAddHyperlink=function(bCheckInHyperlink){return this.HdrFtr.CanAddHyperlink(bCheckInHyperlink)};CHdrFtrController.prototype.IsCursorInHyperlink=function(bCheckEnd){return this.HdrFtr.IsCursorInHyperlink(bCheckEnd)}; CHdrFtrController.prototype.AddComment=function(Comment){this.HdrFtr.AddComment(Comment)};CHdrFtrController.prototype.CanAddComment=function(){return this.HdrFtr.CanAddComment()};CHdrFtrController.prototype.GetSelectionAnchorPos=function(){return this.HdrFtr.GetSelectionAnchorPos()};CHdrFtrController.prototype.StartSelectionFromCurPos=function(){this.HdrFtr.StartSelectionFromCurPos()};CHdrFtrController.prototype.SaveDocumentStateBeforeLoadChanges=function(State){var HdrFtr=this.HdrFtr.Get_CurHdrFtr(); if(null!==HdrFtr){var HdrFtrContent=HdrFtr.Get_DocumentContent();State.HdrFtr=HdrFtr;State.HdrFtrDocPosType=HdrFtrContent.CurPos.Type;State.HdrFtrSelection=HdrFtrContent.Selection.Use;if(docpostype_Content===HdrFtrContent.GetDocPosType()){State.Pos=HdrFtrContent.GetContentPosition(false,false,undefined);State.StartPos=HdrFtrContent.GetContentPosition(true,true,undefined);State.EndPos=HdrFtrContent.GetContentPosition(true,false,undefined)}else if(docpostype_DrawingObjects===HdrFtrContent.GetDocPosType())this.LogicDocument.DrawingObjects.Save_DocumentStateBeforeLoadChanges(State)}}; CHdrFtrController.prototype.RestoreDocumentStateAfterLoadChanges=function(State){var HdrFtr=State.HdrFtr;if(null!==HdrFtr&&undefined!==HdrFtr&&true===HdrFtr.Is_UseInDocument()){this.HdrFtr.Set_CurHdrFtr(HdrFtr);var HdrFtrContent=HdrFtr.Get_DocumentContent();if(docpostype_Content===State.HdrFtrDocPosType){HdrFtrContent.SetDocPosType(docpostype_Content);HdrFtrContent.Selection.Use=State.HdrFtrSelection;if(true===HdrFtrContent.Selection.Use){HdrFtrContent.SetContentPosition(State.StartPos,0,0);HdrFtrContent.SetContentSelection(State.StartPos, State.EndPos,0,0,0)}else{HdrFtrContent.SetContentPosition(State.Pos,0,0);this.LogicDocument.NeedUpdateTarget=true}}else if(docpostype_DrawingObjects===State.HdrFtrDocPosType){HdrFtrContent.SetDocPosType(docpostype_DrawingObjects);if(true!==this.LogicDocument.DrawingObjects.Load_DocumentStateAfterLoadChanges(State)){HdrFtrContent.SetDocPosType(docpostype_Content);HdrFtrContent.MoveCursorToStartPos()}}}else this.LogicDocument.EndHdrFtrEditing(false)};CHdrFtrController.prototype.GetColumnSize=function(){var CurHdrFtr= this.HdrFtr.CurHdrFtr;if(null!==CurHdrFtr&&-1!==CurHdrFtr.RecalcInfo.CurPage){var oPage=this.LogicDocument.Pages[CurHdrFtr.RecalcInfo.CurPage];var oSectPr=this.LogicDocument.Get_SectPr(oPage.Pos);return{W:oSectPr.GetContentFrameWidth(),H:oSectPr.GetContentFrameHeight()}}return{W:0,H:0}};CHdrFtrController.prototype.GetCurrentSectionPr=function(){return null};CHdrFtrController.prototype.RemoveTextSelection=function(){var CurHdrFtr=this.HdrFtr.CurHdrFtr;if(null!=CurHdrFtr)return CurHdrFtr.Content.RemoveTextSelection()}; CHdrFtrController.prototype.AddContentControl=function(nContentControlType){var CurHdrFtr=this.HdrFtr.CurHdrFtr;if(null!=CurHdrFtr)return CurHdrFtr.Content.AddContentControl(nContentControlType);return null};CHdrFtrController.prototype.GetStyleFromFormatting=function(){return this.HdrFtr.GetStyleFromFormatting()};CHdrFtrController.prototype.GetSimilarNumbering=function(oEngine){this.HdrFtr.GetSimilarNumbering(oEngine)};CHdrFtrController.prototype.GetPlaceHolderObject=function(){return this.HdrFtr.GetPlaceHolderObject()}; CHdrFtrController.prototype.GetAllFields=function(isUseSelection,arrFields){if(!isUseSelection)return arrFields?arrFields:[];return this.HdrFtr.GetAllFields(isUseSelection,arrFields)};CHdrFtrController.prototype.IsTableCellSelection=function(){return this.HdrFtr.IsTableCellSelection()};CHdrFtrController.prototype.IsSelectionLocked=function(CheckType){this.HdrFtr.Document_Is_SelectionLocked(CheckType)};"use strict";function Common_CopyObj(Obj){if(!Obj||!("object"==typeof Obj||"array"==typeof Obj))return Obj; var c="function"===typeof Obj.pop?[]:{};var p,v;for(p in Obj)if(Obj.hasOwnProperty(p)){v=Obj[p];if(v&&"object"===typeof v)c[p]=Common_CopyObj(v);else c[p]=v}return c}function CTextToTableEngine(){this.SeparatorType=Asc.c_oAscTextToTableSeparator.Paragraph;this.Separator=0;this.MaxCols=0;this.Mode=0;this.Cols=0;this.Rows=0;this.CurCols=0;this.Tab=true;this.Semicolon=true;this.ParaTab=false;this.ParaSemicolon=false;this.ParaPositions=[];this.Rows=[];this.ItemsBuffer=[];this.CurCol=0;this.CurRow=0;this.CC= null}CTextToTableEngine.prototype.Reset=function(){this.Cols=0;this.Rows=0;this.CurCols=0;this.Tab=true;this.Semicolon=true;this.ParaTab=false;this.ParaSemicolon=false};CTextToTableEngine.prototype.GetSeparatorType=function(){return this.Type};CTextToTableEngine.prototype.GetSeparator=function(){return this.Separator};CTextToTableEngine.prototype.AddItem=function(){if(this.IsParagraphSeparator())return;if(0===this.CurCols)this.Rows++;if(this.MaxCols)if(this.CurCols=this.MaxCols){this.CurCol=0;this.CurRow++}}else{var arrParagraphs=[];for(var nIndex=this.ParaPositions.length-1;nIndex>=0;--nIndex){var oTempParagraph=oParagraph.SplitNoDuplicate(this.ParaPositions[nIndex]);var oRunElements= new CParagraphRunElements(oTempParagraph.GetStartPos(),1,null);oRunElements.SetSaveContentPositions(true);oRunElements.SetSkipMath(false);oTempParagraph.GetNextRunElements(oRunElements);if(1===oRunElements.Elements.length&&this.CheckSeparator(oRunElements.Elements[0])){var oTempRunPos=oRunElements.GetContentPositions()[0];var nInRunPos=oTempRunPos.Get(oTempRunPos.GetDepth());oTempRunPos.DecreaseDepth(1);var oTempRun=oTempParagraph.GetClassByPos(oTempRunPos);if(oTempRun)oTempRun.RemoveFromContent(nInRunPos, 1)}arrParagraphs.push(oTempParagraph)}this.CurCol=0;this.CheckBuffer();this.Rows[this.CurRow][this.CurCol].push(oElement.Copy());this.CurCol++;if(this.CurCol>=this.MaxCols){this.CurCol=0;if(arrParagraphs.length>0)this.CurRow++}for(var nIndex=arrParagraphs.length-1;nIndex>=0;--nIndex){if(0===this.CurCol)this.Rows[this.CurRow]=[];if(!this.Rows[this.CurRow][this.CurCol])this.Rows[this.CurRow][this.CurCol]=[];this.Rows[this.CurRow][this.CurCol].push(arrParagraphs[nIndex]);this.CurCol++;if(this.CurCol>= this.MaxCols){this.CurCol=0;if(nIndex>0)this.CurRow++}}this.CurRow++}}};CTextToTableEngine.prototype.OnTable=function(oTable){if(this.IsConvertMode())this.ItemsBuffer.push(oTable)};CTextToTableEngine.prototype.FinalizeConvert=function(){if(this.IsConvertMode()&&this.ItemsBuffer.length>0)this.CheckBuffer()};CTextToTableEngine.prototype.CheckBuffer=function(){if(0===this.CurCol)this.Rows[this.CurRow]=[];this.Rows[this.CurRow][this.CurCol]=[];if(this.ItemsBuffer.length>0){for(var nIndex=0,nCount=this.ItemsBuffer.length;nIndex< nCount;++nIndex)this.Rows[this.CurRow][this.CurCol].push(this.ItemsBuffer[nIndex].Copy());this.ItemsBuffer=[]}};CTextToTableEngine.prototype.IsParagraphSeparator=function(){return this.SeparatorType===Asc.c_oAscTextToTableSeparator.Paragraph};CTextToTableEngine.prototype.IsSymbolSeparator=function(nCharCode){return this.SeparatorType===Asc.c_oAscTextToTableSeparator.Symbol&&this.Separator===nCharCode};CTextToTableEngine.prototype.IsTabSeparator=function(){return this.SeparatorType===Asc.c_oAscTextToTableSeparator.Tab}; CTextToTableEngine.prototype.CheckSeparator=function(oRunItem){var nItemType=oRunItem.Type;return para_Tab===nItemType&&this.IsTabSeparator()||para_Text===nItemType&&this.IsSymbolSeparator(oRunItem.Value)||para_Space===nItemType&&this.IsSymbolSeparator(oRunItem.Value)||para_Math_Text===nItemType&&this.IsSymbolSeparator(oRunItem.value)};CTextToTableEngine.prototype.SetCalculateTableSizeMode=function(nSeparatorType,nSeparator,nMaxCols){this.Mode=0;this.SeparatorType=undefined!==nSeparatorType?nSeparatorType: Asc.c_oAscTextToTableSeparator.Paragraph;this.Separator=undefined!==nSeparator?nSeparator:0;this.MaxCols=undefined!==nMaxCols?nMaxCols:0};CTextToTableEngine.prototype.SetCheckSeparatorMode=function(){this.Mode=1};CTextToTableEngine.prototype.SetConvertMode=function(nSeparatorType,nSeparator,nMaxCols){this.Mode=2;this.SeparatorType=undefined!==nSeparatorType?nSeparatorType:Asc.c_oAscTextToTableSeparator.Paragraph;this.Separator=undefined!==nSeparator?nSeparator:0;this.MaxCols=undefined!==nMaxCols? nMaxCols:1};CTextToTableEngine.prototype.IsCalculateTableSizeMode=function(){return 0===this.Mode};CTextToTableEngine.prototype.IsCheckSeparatorMode=function(){return 1===this.Mode};CTextToTableEngine.prototype.IsConvertMode=function(){return 2===this.Mode};CTextToTableEngine.prototype.AddTab=function(){this.ParaTab=true};CTextToTableEngine.prototype.AddSemicolon=function(){this.ParaSemicolon=true};CTextToTableEngine.prototype.HaveTab=function(){return this.Tab};CTextToTableEngine.prototype.HaveSemicolon= function(){return this.Semicolon};CTextToTableEngine.prototype.AddParaPosition=function(oParaContentPos){this.ParaPositions.push(oParaContentPos)};CTextToTableEngine.prototype.GetRows=function(){return this.Rows};CTextToTableEngine.prototype.SetContentControl=function(oCC){this.CC=oCC};CTextToTableEngine.prototype.GetContentControl=function(){return this.CC};window["AscCommonWord"]=window["AscCommonWord"]||{};window["AscCommonWord"].CTextToTableEngine=CTextToTableEngine;"use strict";var align_Left= AscCommon.align_Left;var CMouseMoveData=AscCommon.CMouseMoveData;var g_oTableId=AscCommon.g_oTableId;var History=AscCommon.History;var linerule_AtLeast=Asc.linerule_AtLeast;var c_oAscError=Asc.c_oAscError;var c_oAscHAnchor=Asc.c_oAscHAnchor;var c_oAscXAlign=Asc.c_oAscXAlign;var c_oAscYAlign=Asc.c_oAscYAlign;var c_oAscVAnchor=Asc.c_oAscVAnchor;var c_oAscCellTextDirection=Asc.c_oAscCellTextDirection;var c_oAscRevisionsChangeType=Asc.c_oAscRevisionsChangeType;var table_Selection_Cell=0;var table_Selection_Text= 1;var table_Selection_Common=0;var table_Selection_Border=1;var table_Selection_Border_InnerTable=2;var table_Selection_Rows=3;var table_Selection_Columns=4;var table_Selection_Cells=5;var type_Table=2;function CTable(DrawingDocument,Parent,Inline,Rows,Cols,TableGrid,bPresentation){CDocumentContentElementBase.call(this,Parent);this.Markup=new AscCommon.CTableMarkup(this);this.Inline=Inline;this.Lock=new AscCommon.CLock;if(false===AscCommon.g_oIdCounter.m_bLoad&&true===History.Is_On()&&AscCommon.CollaborativeEditing&& !AscCommon.CollaborativeEditing.Is_SingleUser()){this.Lock.Set_Type(AscCommon.locktype_Mine,false);AscCommon.CollaborativeEditing.Add_Unlock2(this)}this.DrawingDocument=null;this.LogicDocument=null;if(undefined!==DrawingDocument&&null!==DrawingDocument){this.DrawingDocument=DrawingDocument;this.LogicDocument=this.DrawingDocument.m_oLogicDocument}this.CompiledPr={Pr:null,NeedRecalc:true};this.Pr=new CTablePr;this.Pr.TableW=new CTableMeasurement(tblwidth_Auto,0);this.bPresentation=bPresentation===true; this.TableStyle=undefined!==this.DrawingDocument&&null!==this.DrawingDocument&&this.DrawingDocument.m_oLogicDocument&&this.DrawingDocument.m_oLogicDocument.Styles?this.DrawingDocument.m_oLogicDocument.Styles.Get_Default_TableGrid():null;this.TableLook=new CTableLook(true,true,false,false,true,false);this.TableSumGrid=[];this.TableGrid=TableGrid?TableGrid:[];this.TableGridCalc=this.private_CopyTableGrid();this.CalculatedMinWidth=-1;this.CalculatedPctWidth=-1;this.CalculatedTableW=-1;this.CalculatedX= null;this.CalculatedXLimit=null;this.RecalcInfo=new CTableRecalcInfo;this.Rows=Rows;this.Cols=Cols;this.Content=[];for(var Index=0;Index0)this.CurCell=this.Content[0].Get_Cell(0);else this.CurCell=null;this.TurnOffRecalc=false;this.ApplyToAll=false;this.m_oContentChanges=new AscCommon.CContentChanges;g_oTableId.Add(this,this.Id)}CTable.prototype=Object.create(CDocumentContentElementBase.prototype);CTable.prototype.constructor=CTable; CTable.prototype.GetType=function(){return type_Table};CTable.prototype.Get_Theme=function(){if(!this.Parent)return null;return this.Parent.Get_Theme()};CTable.prototype.Get_ColorMap=function(){if(!this.Parent)return null;return this.Parent.Get_ColorMap()};CTable.prototype.Get_Props=function(){var TablePr=this.Get_CompiledPr(false).TablePr;var Pr={};if(tblwidth_Auto===TablePr.TableW.Type||tblwidth_Mm===TablePr.TableW.Type&&TablePr.TableW.W<.001)Pr.TableWidth=null;else if(tblwidth_Mm===TablePr.TableW.Type)Pr.TableWidth= TablePr.TableW.W;else Pr.TableWidth=-TablePr.TableW.W;Pr.AllowOverlap=this.AllowOverlap;Pr.TableSpacing=this.Content[0].Get_CellSpacing();Pr.TableDefaultMargins={Left:TablePr.TableCellMar.Left.W,Right:TablePr.TableCellMar.Right.W,Top:TablePr.TableCellMar.Top.W,Bottom:TablePr.TableCellMar.Bottom.W};if(true===this.Selection.Use&&table_Selection_Cell===this.Selection.Type){Pr.CellSelect=true;var CellMargins=null;var CellMarginFlag=false;var Border_left=null;var Border_right=null;var Border_top=null; var Border_bottom=null;var Border_insideH=null;var Border_insideV=null;var CellShd=null;var CellWidth=undefined;var CellWidthStart=undefined;var Prev_row=-1;var bFirstRow=true;var VAlign=null;var TextDirection=null;var NoWrap=null;var nRowHeight=null;for(var Index=0;Index.001))CellWidth=undefined;if(0===Index||this.Selection.Data[Index-1].Row!=Pos.Row)if(null===Border_left)Border_left=Cell_borders.Left;else Border_left=this.Internal_CompareBorders2(Border_left,Cell_borders.Left);else if(null=== Border_insideV)Border_insideV=Cell_borders.Left;else Border_insideV=this.Internal_CompareBorders2(Border_insideV,Cell_borders.Left);if(this.Selection.Data.length-1===Index||this.Selection.Data[Index+1].Row!=Pos.Row)if(null===Border_right)Border_right=Cell_borders.Right;else Border_right=this.Internal_CompareBorders2(Border_right,Cell_borders.Right);else if(null===Border_insideV)Border_insideV=Cell_borders.Right;else Border_insideV=this.Internal_CompareBorders2(Border_insideV,Cell_borders.Right);if(Prev_row!= Pos.Row){if(-1!=Prev_row)bFirstRow=false;if(false===bFirstRow)if(null===Border_insideH){Border_insideH=Border_bottom;Border_insideH=this.Internal_CompareBorders2(Border_insideH,Cell_borders.Top)}else{Border_insideH=this.Internal_CompareBorders2(Border_insideH,Border_bottom);Border_insideH=this.Internal_CompareBorders2(Border_insideH,Cell_borders.Top)}else if(null===Border_top)Border_top=Cell_borders.Top;Border_bottom=Cell_borders.Bottom;Prev_row=Pos.Row}else{if(false===bFirstRow)if(null===Border_insideH)Border_insideH= Cell_borders.Top;else Border_insideH=this.Internal_CompareBorders2(Border_insideH,Cell_borders.Top);else if(null===Border_top)Border_top=Cell_borders.Top;else Border_top=this.Internal_CompareBorders2(Border_top,Cell_borders.Top);Border_bottom=this.Internal_CompareBorders2(Border_bottom,Cell_borders.Bottom)}if(true!=Cell.Is_TableMargins())if(null===CellMargins)CellMargins=Common_CopyObj(Cell_margins);else{if(CellMargins.Left.W!=Cell_margins.Left.W)CellMargins.Left.W=null;if(CellMargins.Right.W!=Cell_margins.Right.W)CellMargins.Right.W= null;if(CellMargins.Top.W!=Cell_margins.Top.W)CellMargins.Top.W=null;if(CellMargins.Bottom.W!=Cell_margins.Bottom.W)CellMargins.Bottom.W=null}else CellMarginFlag=true;var nCurRowHeight;var oRowH=Row.GetHeight();if(oRowH.IsAuto()){var oRow=Row;var nCurRow=oRow.GetIndex();var nRowSummaryH=0;if(this.RowsInfo[nCurRow]){for(var nCurPage in this.RowsInfo[nCurRow].H)nRowSummaryH+=this.RowsInfo[nCurRow].H[nCurPage];if(null!==Pr.TableSpacing)nRowSummaryH+=Pr.TableSpacing;else if(this.RowsInfo[nCurRow].TopDy[0])nRowSummaryH-= this.RowsInfo[nCurRow].TopDy[0];nRowSummaryH-=oRow.GetTopMargin()+oRow.GetBottomMargin()}nCurRowHeight=nRowSummaryH}else nCurRowHeight=oRowH.GetValue();if(null===nRowHeight)nRowHeight=nCurRowHeight;else if(undefined!==nRowHeight&&Math.abs(nRowHeight-nCurRowHeight)>.001)nRowHeight=undefined}Pr.CellsVAlign=VAlign;Pr.CellsTextDirection=TextDirection;Pr.CellsNoWrap=NoWrap;if(undefined===CellWidth){Pr.CellsWidth=CellWidthStart;Pr.CellsWidthNotEqual=true}else{Pr.CellsWidth=CellWidthStart;Pr.CellsWidthNotEqual= false}Pr.RowHeight=nRowHeight;Pr.CellBorders={Left:Border_left.Copy(),Right:Border_right.Copy(),Top:Border_top.Copy(),Bottom:Border_bottom.Copy(),InsideH:null===Border_insideH?null:Border_insideH.Copy(),InsideV:null===Border_insideV?null:Border_insideV.Copy()};if(null===CellShd)Pr.CellsBackground=null;else Pr.CellsBackground=CellShd.Copy();if(null===CellMargins)Pr.CellMargins={Flag:0};else{var Flag=2;if(true===CellMarginFlag)Flag=1;Pr.CellMargins={Left:CellMargins.Left.W,Right:CellMargins.Right.W, Top:CellMargins.Top.W,Bottom:CellMargins.Bottom.W,Flag:Flag}}}else{Pr.CellSelect=false;var Cell=this.CurCell;var CellMargins=Cell.GetMargins(true);var CellBorders=Cell.Get_Borders();var CellShd=Cell.Get_Shd();var CellW=Cell.Get_W();if(true===Cell.Is_TableMargins())Pr.CellMargins={Flag:0};else Pr.CellMargins={Left:CellMargins.Left.W,Right:CellMargins.Right.W,Top:CellMargins.Top.W,Bottom:CellMargins.Bottom.W,Flag:2};Pr.CellsVAlign=Cell.Get_VAlign();Pr.CellsTextDirection=Cell.Get_TextDirection();Pr.CellsNoWrap= Cell.GetNoWrap();Pr.CellsBackground=CellShd.Copy();if(tblwidth_Auto===CellW.Type)Pr.CellsWidth=null;else if(tblwidth_Mm===CellW.Type)Pr.CellsWidth=CellW.W;else Pr.CellsWidth=-CellW.W;Pr.CellsWidthNotEqual=false;var Spacing=this.Content[0].Get_CellSpacing();var Border_left=null;var Border_right=null;var Border_top=null;var Border_bottom=null;var Border_insideH=null;var Border_insideV=null;var CellShd=null;for(var CurRow=0;CurRow.001){nColumnWidth=undefined;break}}if(undefined===nColumnWidth)break}Pr.ColumnWidth=nColumnWidth;switch(Pr.CellsVAlign){case vertalignjc_Top:Pr.CellsVAlign=c_oAscVertAlignJc.Top;break;case vertalignjc_Bottom:Pr.CellsVAlign=c_oAscVertAlignJc.Bottom;break;case vertalignjc_Center:Pr.CellsVAlign=c_oAscVertAlignJc.Center;break;default:Pr.CellsVAlign=null;break}switch(Pr.CellsTextDirection){case textdirection_LRTB:Pr.CellsTextDirection= c_oAscCellTextDirection.LRTB;break;case textdirection_TBRL:Pr.CellsTextDirection=c_oAscCellTextDirection.TBRL;break;case textdirection_BTLR:Pr.CellsTextDirection=c_oAscCellTextDirection.BTLR;break;default:Pr.CellsTextDirection=null;break}var oSelectionRowsRange=this.GetSelectedRowsRange();var nRowsInHeader=this.GetRowsCountInHeader();if(oSelectionRowsRange.Start>nRowsInHeader)Pr.RowsInHeader=null;else if(oSelectionRowsRange.End-.001){this.Set_TableW(tblwidth_Mm,Props.TableWidth);bRecalc_All=true}else{this.Set_TableW(tblwidth_Pct,Math.abs(Props.TableWidth));bRecalc_All=true}if(undefined!=Props.TableLayout){this.SetTableLayout(Props.TableLayout===c_oAscTableLayout.AutoFit?tbllayout_AutoFit:tbllayout_Fixed);bRecalc_All=true}if(undefined!=Props.TableWrappingStyle)if(0===Props.TableWrappingStyle&&true!=this.Inline){this.Set_Inline(true); bRecalc_All=true}else if(1===Props.TableWrappingStyle&&false!=this.Inline){this.Set_Inline(false);if(undefined===Props.PositionH)this.Set_PositionH(c_oAscHAnchor.Page,false,this.AnchorPosition.Calculate_X_Value(c_oAscHAnchor.Page));if(undefined===Props.PositionV){var ValueY=AscCommon.CorrectMMToTwips(this.AnchorPosition.Calculate_Y_Value(c_oAscVAnchor.Page))+AscCommon.TwipsToMM(1);this.Set_PositionV(c_oAscVAnchor.Page,false,ValueY)}if(undefined===Props.TablePaddings)this.Set_Distance(3.2,0,3.2,0); this.Set_TableInd(0);bRecalc_All=true}var _Jc=TablePr.Jc;if("undefined"!=typeof Props.TableAlignment&&true===this.Is_Inline()){var NewJc=0===Props.TableAlignment?align_Left:1===Props.TableAlignment?AscCommon.align_Center:AscCommon.align_Right;if(TablePr.Jc!=NewJc){_Jc=NewJc;this.Set_TableAlign(NewJc);bRecalc_All=true}}if("undefined"!=typeof Props.TableIndent&&true===this.Is_Inline()&&align_Left===_Jc)if(Props.TableIndent!=TablePr.TableInd){this.Set_TableInd(Props.TableIndent);bRecalc_All=true}if(undefined!= Props.Position){this.PositionH.RelativeFrom=c_oAscHAnchor.Page;this.PositionH.Align=true;this.PositionV.RelativeFrom=c_oAscVAnchor.Page;this.PositionH.Align=true;this.PositionH.Value=c_oAscXAlign.Center;this.PositionV.Value=c_oAscYAlign.Center;bRecalc_All=true}if(undefined!=Props.PositionH)this.Set_PositionH(Props.PositionH.RelativeFrom,Props.PositionH.UseAlign,true===Props.PositionH.UseAlign?Props.PositionH.Align:Props.PositionH.Value);if(undefined!=Props.PositionV)this.Set_PositionV(Props.PositionV.RelativeFrom, Props.PositionV.UseAlign,true===Props.PositionV.UseAlign?Props.PositionV.Align:Props.PositionV.Value);if(undefined!=Props.TablePaddings){var TP=Props.TablePaddings;var CurPaddings=this.Distance;var NewPaggings_left=undefined!=TP.Left?null!=TP.Left?TP.Left:CurPaddings.L:CurPaddings.L;var NewPaggings_right=undefined!=TP.Right?null!=TP.Right?TP.Right:CurPaddings.R:CurPaddings.R;var NewPaggings_top=undefined!=TP.Top?null!=TP.Top?TP.Top:CurPaddings.T:CurPaddings.T;var NewPaggings_bottom=undefined!=TP.Bottom? null!=TP.Bottom?TP.Bottom:CurPaddings.B:CurPaddings.B;if(Math.abs(CurPaddings.L-NewPaggings_left)>.001||Math.abs(CurPaddings.R-NewPaggings_right)>.001||Math.abs(CurPaddings.T-NewPaggings_top)>.001||Math.abs(CurPaddings.B-NewPaggings_bottom)>.001){this.Set_Distance(NewPaggings_left,NewPaggings_top,NewPaggings_right,NewPaggings_bottom);bRecalc_All=true}}if("undefined"!=typeof Props.TableBorders&&null!=Props.TableBorders){if(false===this.Internal_CheckNullBorder(Props.TableBorders.Top)&&false===this.Internal_CompareBorders3(Props.TableBorders.Top, TablePr.TableBorders.Top)){this.Set_TableBorder_Top(Props.TableBorders.Top);bRecalc_All=true;if(true!=bSpacing){var Row=this.Content[0];for(var CurCell=0;CurCell0&&true===bBorder_top){var Cell_start=0,Cell_end=0;var bStart=false;var bEnd=false;var Row=this.Content[Row_first-1];for(var CurCell= 0;CurCellGrid_row_first_start)break;else{Cell_start=CurCell;bStart=true;if(EndGridColGrid_row_first_end)break;else{Cell_end=CurCell;bEnd=true;break}}if(false===bEnd)if(EndGridCol Grid_row_first_end)break;else{Cell_end=CurCell;bEnd=true;break}}if(true===bStart&&true===bEnd){for(var CurCell=Cell_start;CurCell<=Cell_end;CurCell++){var Cell=Row.Get_Cell(CurCell);Cell.Set_Border(Props.CellBorders.Top,2)}bRecalc_All=true}}if(Row_lastGrid_row_last_start)break;else{Cell_start=CurCell;bStart=true;if(EndGridColGrid_row_last_end)break;else{Cell_end=CurCell;bEnd=true;break}}if(false===bEnd)if(EndGridColGrid_row_last_end)break;else{Cell_end=CurCell;bEnd=true;break}}if(true===bStart&&true===bEnd){for(var CurCell= Cell_start;CurCell<=Cell_end;CurCell++){var Cell=Row.Get_Cell(CurCell);Cell.Set_Border(Props.CellBorders.Bottom,0)}bRecalc_All=true}}}var PrevRow=Row_first;var Cell_start=Pos_first.Cell,Cell_end=Pos_first.Cell;for(var Index=0;Index0&&true===bBorder_left){Row_temp.Get_Cell(Cell_start-1).Set_Border(Props.CellBorders.Left, 1);bRecalc_All=true}if(true!=bSpacing&&Cell_end0&&true===bBorder_left){Row_temp.Get_Cell(Cell_start-1).Set_Border(Props.CellBorders.Left,1);bRecalc_All=true}if(true!=bSpacing&&Cell_end-.001)Cell.Set_W(new CTableMeasurement(tblwidth_Mm,CellsWidth));else Cell.Set_W(new CTableMeasurement(tblwidth_Pct, Math.abs(CellsWidth)))}}else if(null===CellsWidth)this.CurCell.Set_W(new CTableMeasurement(tblwidth_Auto,0));else if(CellsWidth>-.001)this.CurCell.Set_W(new CTableMeasurement(tblwidth_Mm,CellsWidth));else this.CurCell.Set_W(new CTableMeasurement(tblwidth_Pct,Math.abs(CellsWidth)))}if(undefined!==Props.TableDescription&&null!==Props.TableDescription)this.Set_TableDescription(Props.TableDescription);if(undefined!==Props.TableCaption&&null!==Props.TableCaption)this.Set_TableCaption(Props.TableCaption); if(undefined!==Props.RowHeight)this.SetRowHeight(Props.RowHeight);if(undefined!==Props.ColumnWidth)this.SetColumnWidth(Props.ColumnWidth);return true};CTable.prototype.Get_Styles=function(Lvl){if(this.Parent)return this.Parent.Get_Styles(Lvl);return null};CTable.prototype.Get_TextBackGroundColor=function(){var Shd=this.Get_Shd();if(Shd&&!Shd.IsNil())return Shd.GetSimpleColor(this.Get_Theme(),this.Get_ColorMap());return this.Parent.Get_TextBackGroundColor()};CTable.prototype.Get_Numbering=function(){if(this.Parent)return this.Parent.Get_Numbering(); return null};CTable.prototype.Get_PageBounds=function(CurPage){return this.Pages[CurPage].Bounds};CTable.prototype.GetPageBounds=function(nCurPage){return this.Get_PageBounds(nCurPage)};CTable.prototype.GetContentBounds=function(CurPage){return this.Get_PageBounds(CurPage)};CTable.prototype.Get_PagesCount=function(){return this.Pages.length};CTable.prototype.GetAllDrawingObjects=function(DrawingObjs){if(undefined===DrawingObjs)DrawingObjs=[];var Rows_Count=this.Content.length;for(var CurRow=0;CurRow< Rows_Count;CurRow++){var Row=this.Content[CurRow];var Cells_Count=Row.Get_CellsCount();for(var CurCell=0;CurCell=0;--nIdx){oResult=this.Content[nIdx].FindParaWithStyle(sStyleId,bBackward,null);if(oResult)return oResult}}else{if(nStartIdx!==null)nSearchStartIdx=Math.max(nStartIdx,0);else nSearchStartIdx=0;for(nIdx=nSearchStartIdx;nIdx0&&CurPage>this.HeaderInfo.PageIndex&& true===this.HeaderInfo.Pages[CurPage].Draw){Y=this.HeaderInfo.Pages[CurPage].RowsInfo[this.HeaderInfo.Count-1].TableRowsBottom;bHeader=true}var CellSpacing=Row.Get_CellSpacing();if(null!=CellSpacing){var Table_Border_Top=this.Get_Borders().Top;if(border_Single===Table_Border_Top.Value)Y+=Table_Border_Top.Size;if(true===bHeader||0===CurPage||1===CurPage&&true!=this.RowsInfo[0].FirstPage)Y+=CellSpacing;else Y+=CellSpacing/2}var MaxTopBorder=this.private_GetMaxTopBorderWidth(RowIndex,bHeader);Pos.X= this.Pages[CurPage].X;Y+=MaxTopBorder;Y+=CellMar.Top.W;var YLimit=Pos.YLimit;YLimit-=this.Pages[CurPage].FootnotesH;return{X:Pos.X+CellInfo.X_content_start,XLimit:Pos.X+CellInfo.X_content_end,Y:Y,YLimit:YLimit,MaxTopBorder:MaxTopBorder}};CTable.prototype.Get_MaxTopBorder=function(RowIndex){var Row=this.Content[RowIndex];var MaxTopBorder=0;var CellsCount=Row.Get_CellsCount();var TableBorders=this.Get_Borders();for(var CurCell=0;CurCell=AscCommon.document_compatibility_mode_Word15)return 0;var Row=this.Content[0];var Cell=Row.Get_Cell(0);var Margins=Cell.GetMargins();var CellSpacing=Row.Get_CellSpacing();if(null!=CellSpacing){var TableBorder_Left=this.Get_Borders().Left;if(border_None!=TableBorder_Left.Value)X+= TableBorder_Left.Size/2;X+=CellSpacing;var CellBorder_Left=Cell.Get_Borders().Left;if(border_None!=CellBorder_Left.Value)X+=CellBorder_Left.Size;X+=Margins.Left.W}else{var TableBorder_Left=this.Get_Borders().Left;var CellBorder_Left=Cell.Get_Borders().Left;var Result_Border=this.private_ResolveBordersConflict(TableBorder_Left,CellBorder_Left,true,false);if(border_None!=Result_Border.Value)X+=Math.max(Result_Border.Size/2,Margins.Left.W);else X+=Margins.Left.W}return-X};CTable.prototype.GetRightTableOffsetCorrection= function(){var X=0;if(!this.Parent||true===this.Parent.IsTableCellContent()||this.bPresentation||!this.LogicDocument||!this.LogicDocument.GetCompatibilityMode||this.LogicDocument.GetCompatibilityMode()>=AscCommon.document_compatibility_mode_Word15)return 0;var Row=this.Content[0];var Cell=Row.Get_Cell(Row.Get_CellsCount()-1);var Margins=Cell.GetMargins();var CellSpacing=Row.Get_CellSpacing();if(null!=CellSpacing){var TableBorder_Right=this.Get_Borders().Right;if(border_None!=TableBorder_Right.Value)X+= TableBorder_Right.Size/2;X+=CellSpacing;var CellBorder_Right=Cell.Get_Borders().Right;if(border_None!=CellBorder_Right.Value)X+=CellBorder_Right.Size;X+=Margins.Right.W}else{var TableBorder_Right=this.Get_Borders().Right;var CellBorder_Right=Cell.Get_Borders().Right;var Result_Border=this.private_ResolveBordersConflict(TableBorder_Right,CellBorder_Right,true,false);if(border_None!=Result_Border.Value)X+=Math.max(Result_Border.Size/2,Margins.Right.W);else X+=Margins.Right.W}return X};CTable.prototype.Get_FirstParagraph= function(){if(this.Content.length<=0||this.Content[0].Content.length<=0)return null;return this.Content[0].Content[0].Content.Get_FirstParagraph()};CTable.prototype.GetAllParagraphs=function(Props,ParaArray){if(!ParaArray)ParaArray=[];var Count=this.Content.length;for(var CurRow=0;CurRow0)return this.Content[RowsCount- 1].GetEndInfo();return null};CTable.prototype.GetPrevElementEndInfo=function(RowIndex){if(-1===RowIndex||!this.Parent)return null;if(0===RowIndex)return this.Parent.GetPrevElementEndInfo(this);else return this.Content[RowIndex-1].GetEndInfo()};CTable.prototype.Copy=function(Parent,DrawingDocument,oPr){var TableGrid=this.private_CopyTableGrid();var Table=new CTable(this.DrawingDocument,Parent,this.Inline,0,0,TableGrid,this.bPresentation);Table.Set_Distance(this.Distance.L,this.Distance.T,this.Distance.R, this.Distance.B);Table.Set_PositionH(this.PositionH.RelativeFrom,this.PositionH.Align,this.PositionH.Value);Table.Set_PositionV(this.PositionV.RelativeFrom,this.PositionV.Align,this.PositionV.Value);var sStyle=this.TableStyle;if(oPr&&oPr.Comparison)sStyle=oPr.Comparison.copyStyleById(sStyle);Table.Set_TableStyle(sStyle);Table.Set_TableLook(this.TableLook.Copy());Table.SetPr(this.Pr.Copy());Table.Rows=this.Rows;Table.Cols=this.Cols;var Rows=this.Content.length;var Index;for(Index=0;Index0&&Table.Content[0].Get_CellsCount()>0)Table.CurCell=Table.Content[0].Get_Cell(0);return Table};CTable.prototype.Shift=function(CurPage,Dx,Dy){this.Pages[CurPage].Shift(Dx,Dy);if(0===CurPage){this.X_origin+=Dx;this.X+=Dx;this.Y+=Dy;this.XLimit+= Dx;this.YLimit+=Dy}var StartRow=this.Pages[CurPage].FirstRow;var LastRow=this.Pages[CurPage].LastRow;for(var CurRow=StartRow;CurRow<=LastRow;CurRow++){var Row=this.Content[CurRow];var CellsCount=Row.Get_CellsCount();for(var CurCell=0;CurCellNearestPos.Paragraph.Get_StartPage_Absolute())if(NearestPos.Paragraph.Pages.length>2){var NewParagraph=new Paragraph(NewDocContent.DrawingDocument, NewDocContent);NearestPos.Paragraph.Split(NewParagraph,NearestPos.ContentPos);NewDocContent.Internal_Content_Add(NewIndex+1,NewParagraph);if(NewDocContent===OldDocContent&&NewIndex+1<=OldIndex)OldIndex++;NewIndex++}else{NewIndex++;if(NewIndex>=NewDocContent.Content.length-1)NewDocContent.Internal_Content_Add(NewDocContent.Content.length,new Paragraph(NewDocContent.DrawingDocument,NewDocContent))}oTargetTable=AscCommon.CollaborativeEditing.Is_SingleUser()?this:this.Copy(NewDocContent);if(NewDocContent!= OldDocContent){NewDocContent.Internal_Content_Add(NewIndex,oTargetTable);OldDocContent.Internal_Content_Remove(OldIndex,1);oTargetTable.Parent=NewDocContent}else if(NearestPos.Paragraph.Index>this.Index){NewDocContent.Internal_Content_Add(NewIndex,oTargetTable);OldDocContent.Internal_Content_Remove(OldIndex,1)}else{OldDocContent.Internal_Content_Remove(OldIndex,1);NewDocContent.Internal_Content_Add(NewIndex,oTargetTable)}oPageLimits=NewDocContent.Get_PageLimits(NearestPos.Paragraph.GetRelativePage(NearestPos.Internal.Page))}else oPageLimits= OldDocContent.Get_PageLimits(this.GetRelativePage(0));oTargetTable.PositionH_Old={RelativeFrom:oTargetTable.PositionH.RelativeFrom,Align:oTargetTable.PositionH.Align,Value:oTargetTable.PositionH.Value};oTargetTable.PositionV_Old={RelativeFrom:oTargetTable.PositionV.RelativeFrom,Align:oTargetTable.PositionV.Align,Value:oTargetTable.PositionV.Value};oTargetTable.PositionH.RelativeFrom=c_oAscHAnchor.Page;oTargetTable.PositionH.Align=false;oTargetTable.PositionH.Value=X-oPageLimits.X;oTargetTable.PositionV.RelativeFrom= c_oAscVAnchor.Page;oTargetTable.PositionV.Align=false;oTargetTable.PositionV.Value=Y-oPageLimits.Y;oTargetTable.PageNum=PageNum;var nTableInd=oTargetTable.Get_TableInd();if(Math.abs(nTableInd)>.001)oTargetTable.Set_TableInd(0);this.LogicDocument.Recalculate(true);oTargetTable.StartTrackTable();if(undefined!==oTargetTable.PositionH_Old){oTargetTable.PositionH.RelativeFrom=oTargetTable.PositionH_Old.RelativeFrom;oTargetTable.PositionH.Align=oTargetTable.PositionH_Old.Align;oTargetTable.PositionH.Value= oTargetTable.PositionH_Old.Value;oTargetTable.Set_PositionH(c_oAscHAnchor.Page,false,X);oTargetTable.PositionH_Old=undefined}if(undefined!==oTargetTable.PositionV_Old){oTargetTable.PositionV.RelativeFrom=oTargetTable.PositionV_Old.RelativeFrom;oTargetTable.PositionV.Align=oTargetTable.PositionV_Old.Align;oTargetTable.PositionV.Value=oTargetTable.PositionV_Old.Value;oTargetTable.Set_PositionV(c_oAscVAnchor.Page,false,Y);oTargetTable.PositionV_Old=undefined}oLogicDocument.FinalizeAction()}}else if(false=== oLogicDocument.Document_Is_SelectionLocked(AscCommon.changestype_Table_Properties,{Type:AscCommon.changestype_2_InlineObjectMove,PageNum:PageNum,X:X,Y:Y},true)){oLogicDocument.StartAction(AscDFH.historydescription_Document_MoveInlineTable);var NewDocContent=NearestPos.Paragraph.Parent;var OldDocContent=this.Parent;if(true!=NewDocContent.CheckTableCoincidence(this)){var TarParagraph=NearestPos.Paragraph;var ParaContentPos=NearestPos.ContentPos;var OldIndex=this.Index;var NewIndex=NearestPos.Paragraph.Index; if(true===TarParagraph.IsCursorAtEnd(ParaContentPos))NewIndex++;else if(true!=TarParagraph.IsCursorAtBegin(ParaContentPos)){var NewParagraph=new Paragraph(NewDocContent.DrawingDocument,NewDocContent);NearestPos.Paragraph.Split(NewParagraph,NearestPos.ContentPos);NewDocContent.Internal_Content_Add(NewIndex+1,NewParagraph);if(NewDocContent===OldDocContent&&NewIndex+1<=OldIndex)OldIndex++;NewIndex++}var oTargetTable=AscCommon.CollaborativeEditing.Is_SingleUser()?this:this.Copy(NewDocContent);if(NewDocContent!= OldDocContent){NewDocContent.Internal_Content_Add(NewIndex,oTargetTable);OldDocContent.Internal_Content_Remove(OldIndex,1);oTargetTable.Parent=NewDocContent}else if(NearestPos.Paragraph.Index>this.Index){NewDocContent.Internal_Content_Add(NewIndex,oTargetTable);OldDocContent.Internal_Content_Remove(OldIndex,1)}else{OldDocContent.Internal_Content_Remove(OldIndex,1);NewDocContent.Internal_Content_Add(NewIndex,oTargetTable)}editor.WordControl.m_oLogicDocument.Recalculate()}oTargetTable.StartTrackTable(); oLogicDocument.FinalizeAction()}editor.WordControl.m_oLogicDocument.RemoveSelection();oTargetTable.Document_SetThisElementCurrent(true);oTargetTable.MoveCursorToStartPos();editor.WordControl.m_oLogicDocument.Document_UpdateSelectionState()};CTable.prototype.Reset=function(X,Y,XLimit,YLimit,PageNum,ColumnNum,ColumnsCount,SectionY){this.X_origin=X;this.X=X;this.Y=Y+.001;this.XLimit=XLimit;this.YLimit=YLimit;this.PageNum=PageNum;this.ColumnNum=ColumnNum?ColumnNum:0;this.ColumnsCount=ColumnsCount?ColumnsCount: 1;if(!this.IsInline()&&ColumnNum>0&&undefined!==SectionY)this.Y=SectionY;var _X=this.X;var _XLimit=this.XLimit;if(this.LogicDocument&&this.LogicDocument.IsDocumentEditor()&&this.IsInline()){var arrRanges=this.Parent.CheckRange(_X,this.Y,_XLimit,this.Y+.001,this.Y,this.Y+.001,_X,_XLimit,this.private_GetRelativePageIndex(0));if(arrRanges.length>0)for(var nRangeIndex=0,nRangesCount=arrRanges.length;nRangeIndex _X)_X=arrRanges[nRangeIndex].X1+.001;if(arrRanges[nRangeIndex].X1>this.XLimit-3.2&&arrRanges[nRangeIndex].X0<_XLimit)_XLimit=arrRanges[nRangeIndex].X0-.001}}this.X=_X;this.XLimit=_XLimit};CTable.prototype.Recalculate=function(){this.private_RecalculateGrid();this.Internal_Recalculate_1()};CTable.prototype.Reset_RecalculateCache=function(){this.RecalcInfo.Reset(true);var RowsCount=this.Content.length;for(var RowIndex=0;RowIndex=CellsCount)return{X:X_start,Y:0,W:X_end-X_start,H:0,BaseLine:0,XLimit:Page.XLimit};var Bounds=Cell.Content_Get_PageBounds(Cell_PageRel); var Y_offset=Cell.Temp.Y_VAlign_offset[Cell_PageRel];var Y=0;var H=0;if(0!=Cell_PageRel){var TempRowIndex=this.Pages[CurPage].FirstRow;Y=this.RowsInfo[TempRowIndex].Y[CurPage]+this.RowsInfo[TempRowIndex].TopDy[CurPage]+CellMar.Top.W+Y_offset;H=this.RowsInfo[TempRowIndex].H[CurPage]}else{Y=this.RowsInfo[CurRow].Y[CurPage]+this.RowsInfo[CurRow].TopDy[CurPage]+CellMar.Top.W+Y_offset;H=this.RowsInfo[CurRow].H[CurPage]}return{X:X_start,Y:Y,W:X_end-X_start,H:H,BaseLine:H,XLimit:Page.XLimit}};CTable.prototype.FindNextFillingForm= function(isNext,isCurrent,isStart){var nCurRow=this.Selection.Use===true?this.Selection.StartPos.Pos.Row:this.CurCell.Row.Index;var nCurCell=this.Selection.Use===true?this.Selection.StartPos.Pos.Cell:this.CurCell.Index;var nStartRow=0,nStartCell=0,nEndRow=0,nEndCell=0;if(isCurrent)if(isStart){nStartRow=nCurRow;nStartCell=nCurCell;nEndRow=isNext?this.GetRowsCount()-1:0;nEndCell=isNext?this.GetRow(nEndRow).GetCellsCount()-1:0}else{nStartRow=isNext?0:this.GetRowsCount()-1;nStartCell=isNext?0:this.GetRow(nStartRow).GetCellsCount()- 1;nEndRow=nCurRow;nEndCell=nCurCell}else if(isNext){nStartRow=0;nStartCell=0;nEndRow=this.GetRowsCount()-1;nEndCell=this.GetRow(nEndRow).GetCellsCount()-1}else{nStartRow=this.GetRowsCount()-1;nStartCell=this.GetRow(nStartRow).GetCellsCount()-1;nEndRow=0;nEndCell=0}if(isNext)for(var nRowIndex=nStartRow;nRowIndex<=nEndRow;++nRowIndex){var _nStartCell=nRowIndex===nStartRow?nStartCell:0;var _nEndCell=nRowIndex===nEndRow?nEndCell:this.GetRow(nRowIndex).GetCellsCount()-1;for(var nCellIndex=_nStartCell;nCellIndex<= _nEndCell;++nCellIndex){var oCell=this.GetRow(nRowIndex).GetCell(nCellIndex);var oRes=oCell.GetContent().FindNextFillingForm(true,isCurrent&&nCellIndex===nCurCell&&nRowIndex===nCurRow?true:false,isStart);if(oRes)return oRes}}else for(var nRowIndex=nStartRow;nRowIndex>=nEndRow;--nRowIndex){var _nStartCell=nRowIndex===nStartRow?nStartCell:this.GetRow(nRowIndex).GetCellsCount()-1;var _nEndCell=nRowIndex===nEndRow?nEndCell:0;for(var nCellIndex=_nStartCell;nCellIndex>=_nEndCell;--nCellIndex){var oCell= this.GetRow(nRowIndex).GetCell(nCellIndex);var oRes=oCell.GetContent().FindNextFillingForm(false,isCurrent&&nCellIndex===nCurCell&&nRowIndex===nCurRow?true:false,isStart);if(oRes)return oRes}}return null};CTable.prototype.Get_NearestPos=function(CurPage,X,Y,bAnchor,Drawing){var Pos=this.private_GetCellByXY(X,Y,CurPage);var Cell=this.Content[Pos.Row].Get_Cell(Pos.Cell);return Cell.Content_Get_NearestPos(CurPage-Cell.Content.Get_StartPage_Relative(),X,Y,bAnchor,Drawing)};CTable.prototype.Get_ParentTextTransform= function(){return this.Parent.Get_ParentTextTransform()};CTable.prototype.IsStartFromNewPage=function(){if(this.Pages.length>1&&true===this.IsEmptyPage(0)||null===this.Get_DocumentPrev()&&true===this.Parent.Is_TopDocument())return true;return false};CTable.prototype.IsContentOnFirstPage=function(){if(this.Pages.length>=1&&true===this.RowsInfo[0].FirstPage&&this.Pages[0].LastRow>=this.Pages[0].FirstRow)return true;return false};CTable.prototype.IsTableBorder=function(X,Y,CurPage){if(true===this.DrawingDocument.IsMobileVersion())return null; CurPage=Math.max(0,Math.min(this.Pages.length-1,CurPage));if(true===this.IsEmptyPage(CurPage))return null;var Result=this.private_CheckHitInBorder(X,Y,CurPage);if(Result.Border!=-1)return this;else{var Cell=this.Content[Result.Pos.Row].Get_Cell(Result.Pos.Cell);return Cell.Content_Is_TableBorder(X,Y,CurPage-Cell.Content.Get_StartPage_Relative())}};CTable.prototype.IsInText=function(X,Y,CurPage){if(CurPage<0||CurPage>=this.Pages.length)CurPage=0;var Result=this.private_CheckHitInBorder(X,Y,CurPage); if(Result.Border!=-1)return null;else{var Cell=this.Content[Result.Pos.Row].Get_Cell(Result.Pos.Cell);return Cell.Content_Is_InText(X,Y,CurPage-Cell.Content.Get_StartPage_Relative())}};CTable.prototype.IsInDrawing=function(X,Y,CurPage){if(CurPage<0||CurPage>=this.Pages.length)CurPage=0;var Result=this.private_CheckHitInBorder(X,Y,CurPage);if(Result.Border!=-1)return null;else{var Cell=this.Content[Result.Pos.Row].Get_Cell(Result.Pos.Cell);return Cell.Content_Is_InDrawing(X,Y,CurPage-Cell.Content.Get_StartPage_Relative())}}; CTable.prototype.IsInnerTable=function(){if(this.Content.length<=0)return false;if(false===this.Selection.Use||true===this.Selection.Use&&table_Selection_Text===this.Selection.Type)return this.CurCell.Content.Is_CurrentElementTable();return false};CTable.prototype.Is_UseInDocument=function(Id){var bUse=false;if(null!=Id){var RowsCount=this.Content.length;for(var Index=0;Index=this.Pages.length)CurPage=0;if(true===this.Lock.Is_Locked()){var _X=this.Pages[CurPage].Bounds.Left;var _Y=this.Pages[CurPage].Bounds.Top;var MMData=new CMouseMoveData;var Coords=this.DrawingDocument.ConvertCoordsToCursorWR(_X,_Y,this.Get_AbsolutePage(CurPage));MMData.X_abs=Coords.X-5;MMData.Y_abs=Coords.Y-5;MMData.Type=Asc.c_oAscMouseMoveDataTypes.LockedObject;MMData.UserId=this.Lock.Get_UserId();MMData.HaveChanges=this.Lock.Have_Changes(); MMData.LockedObjectType=c_oAscMouseMoveLockedObjectType.Common;editor.sync_MouseMoveCallback(MMData)}if(true===this.Selection.Start||table_Selection_Border===this.Selection.Type2||table_Selection_Border_InnerTable===this.Selection.Type2)return;if(this.LogicDocument&&this.LogicDocument.IsShowTableAdjustments&&this.LogicDocument.IsShowTableAdjustments()){if(true!==this.DrawingDocument.IsCursorInTableCur(X,Y,this.GetAbsolutePage(CurPage))&&true===this.Check_EmptyPages(CurPage-1)&&true!==this.IsEmptyPage(CurPage))this.private_StartTrackTable(CurPage); var oHitInfo=this.private_CheckHitInBorder(X,Y,CurPage);if(true===oHitInfo.RowSelection)return this.DrawingDocument.SetCursorType("select-table-row",new CMouseMoveData);else if(true===oHitInfo.ColumnSelection)return this.DrawingDocument.SetCursorType("select-table-column",new CMouseMoveData);else if(true===oHitInfo.CellSelection)return this.DrawingDocument.SetCursorType("select-table-cell",new CMouseMoveData);else if(-1!==oHitInfo.Border){var Transform=this.Get_ParentTextTransform();if(null!==Transform){var dX= Math.abs(Transform.TransformPointX(0,0)-Transform.TransformPointX(0,1));var dY=Math.abs(Transform.TransformPointY(0,0)-Transform.TransformPointY(0,1));if(Math.abs(dY)>Math.abs(dX))switch(oHitInfo.Border){case 0:case 2:return this.DrawingDocument.SetCursorType("row-resize",new CMouseMoveData);case 1:case 3:return this.DrawingDocument.SetCursorType("col-resize",new CMouseMoveData)}else switch(oHitInfo.Border){case 0:case 2:return this.DrawingDocument.SetCursorType("col-resize",new CMouseMoveData);case 1:case 3:return this.DrawingDocument.SetCursorType("row-resize", new CMouseMoveData)}}else switch(oHitInfo.Border){case 0:case 2:return this.DrawingDocument.SetCursorType("row-resize",new CMouseMoveData);case 1:case 3:return this.DrawingDocument.SetCursorType("col-resize",new CMouseMoveData)}}}var oCellPos=this.private_GetCellByXY(X,Y,CurPage);var oCell=this.GetRow(oCellPos.Row).GetCell(oCellPos.Cell);oCell.Content_UpdateCursorType(X,Y,CurPage-oCell.Content.Get_StartPage_Relative());var oLogicDocument=this.GetLogicDocument();if(oLogicDocument&&oLogicDocument.GetApi&& oLogicDocument.IsDocumentEditor()&&!oLogicDocument.IsSimpleMarkupInReview()&&this.IsCellSelection()){var oTrackManager=oLogicDocument.GetTrackRevisionsManager();var oCurChange=oTrackManager.GetCurrentChange();if(oCurChange&&this===oTrackManager.GetCurrentChangeElement()){var arrSelection=this.GetSelectionArray();for(var nIndex=0,nCount=arrSelection.length;nIndex 0){var nCurRow=this.CurCell.GetRow().GetIndex();if(this.RowsInfo[nCurRow]&&undefined!==this.RowsInfo[nCurRow].Y[this.RowsInfo[nCurRow].StartPage]){var nCurPage=this.RowsInfo[nCurRow].StartPage;var nPageAbs=this.GetAbsolutePage(nCurPage);var dY=this.RowsInfo[nCurRow].Y[nCurPage];var dX=this.LogicDocument.Get_PageLimits(nPageAbs).XLimit;for(var nChangeIndex=0,nChangesCount=arrChanges.length;nChangeIndex=oChange.get_StartPos()&&nCurRow<=oChange.get_EndPos()){oChange.put_InternalPos(dX,dY,nPageAbs);oTrackManager.AddVisibleChange(oChange)}}}}}}else{var ParaPr=this.GetCalculatedParaPr();ParaPr.CanAddTable=false;if(null!=ParaPr)editor.UpdateParagraphProp(ParaPr);var TextPr=this.GetCalculatedTextPr();if(null!=TextPr){var theme=this.Get_Theme();if(theme&&theme.themeElements&&theme.themeElements.fontScheme)TextPr.ReplaceThemeFonts(theme.themeElements.fontScheme); editor.UpdateTextPr(TextPr)}}};CTable.prototype.Document_UpdateRulersState=function(CurPage){if(CurPage<0||CurPage>=this.Pages.length)CurPage=0;if(true==this.Selection.Use&&table_Selection_Cell==this.Selection.Type)this.private_UpdateTableMarkup(this.Selection.EndPos.Pos.Row,this.Selection.EndPos.Pos.Cell,CurPage);else{this.private_UpdateTableMarkup(this.CurCell.Row.Index,this.CurCell.Index,CurPage);this.CurCell.Content.Document_UpdateRulersState(CurPage-this.CurCell.Content.Get_StartPage_Relative())}}; CTable.prototype.Document_SetThisElementCurrent=function(bUpdateStates){this.Parent.Update_ContentIndexing();this.Parent.Set_CurrentElement(this.Index,bUpdateStates)};CTable.prototype.Can_CopyCut=function(){if(true===this.Selection.Use&&table_Selection_Cell===this.Selection.Type)return true;else return this.CurCell.Content.Can_CopyCut()};CTable.prototype.Set_Inline=function(Value){History.Add(new CChangesTableInline(this,this.Inline,Value));this.Inline=Value};CTable.prototype.Is_Inline=function(){if(this.Parent&& true===this.Parent.Is_DrawingShape())return true;return this.Inline};CTable.prototype.IsInline=function(){return this.Is_Inline()};CTable.prototype.GetFramePr=function(){var nRowsCount=this.GetRowsCount();if(nRowsCount<=0)return null;var oRow=this.GetRow(nRowsCount-1);if(oRow.GetCellsCount()<=0)return null;var oCell=oRow.GetCell(0);return oCell.GetContent().GetFirstParagraph().GetFramePr()};CTable.prototype.SetCalculatedFrame=function(oFrame){for(var nCurRow=0,nRowsCount=this.GetRowsCount();nCurRow< nRowsCount;++nCurRow){var oRow=this.GetRow(nCurRow);for(var nCurCell=0,nCellsCount=oRow.GetCellsCount();nCurCell0){var oStartPos=this.Selection.Data[0];var oEndPos=this.Selection.Data[this.Selection.Data.length-1];var oStartRow=this.GetRow(oStartPos.Row);var oEndRow=this.GetRow(oEndPos.Row);nGridStart=oStartRow.GetCellInfo(oStartPos.Cell).StartGridCol;nGridEnd=oEndRow.GetCellInfo(oEndPos.Cell).StartGridCol+oEndRow.GetCell(oEndPos.Cell).GetGridSpan()-1}else{nGridStart=this.CurCell.GetRow().GetCellInfo(this.CurCell.GetIndex()).StartGridCol; nGridEnd=nGridStart+this.CurCell.GetGridSpan()-1}this.private_GetColumnByGridRange(nGridStart,nGridEnd,NewSelectionData);break}case c_oAscTableSelectionType.Cell:default:{if(true===this.Selection.Use&&table_Selection_Cell===this.Selection.Type)NewSelectionData=this.Selection.Data;else NewSelectionData.push({Row:this.CurCell.Row.Index,Cell:this.CurCell.Index});break}}this.Selection.Use=true;this.Selection.Start=false;this.Selection.Type=table_Selection_Cell;this.Selection.Type2=table_Selection_Common; this.Selection.Data2=null;this.private_SetSelectionData(NewSelectionData);this.Selection.StartPos.Pos={Row:NewSelectionData[0].Row,Cell:NewSelectionData[0].Cell};this.Selection.EndPos.Pos={Row:NewSelectionData[NewSelectionData.length-1].Row,Cell:NewSelectionData[NewSelectionData.length-1].Cell}};CTable.prototype.CanSplitTableCells=function(){if(true===this.IsInnerTable())return this.CurCell.Content.CanSplitTableCells();if(!(false===this.Selection.Use||true===this.Selection.Use&&(table_Selection_Text=== this.Selection.Type||table_Selection_Cell===this.Selection.Type&&1===this.Selection.Data.length)))return false;return true};CTable.prototype.CanMergeTableCells=function(){if(true===this.IsInnerTable())return this.CurCell.Content.CanMergeTableCells();if(true!=this.Selection.Use||table_Selection_Cell!=this.Selection.Type||this.Selection.Data.length<=1)return false;return this.Internal_CheckMerge().bCanMerge};CTable.prototype.SelectRows=function(nStartRow,nEndRow){var nRowsCount=this.GetRowsCount(); if(nRowsCount<=0)return;nStartRow=Math.max(0,Math.min(nStartRow,nRowsCount-1));nEndRow=Math.max(0,Math.min(nEndRow,nRowsCount-1),nStartRow);var arrSelectionData=[];for(var nCurRow=nStartRow;nCurRow<=nEndRow;++nCurRow)for(var nCurCell=0,nCellsCount=this.GetRow(nCurRow).GetCellsCount();nCurCell=0)if(Math.min(nRowIndex,this.RowsInfo.length-1)<0)this.Parent.Refresh_RecalcData2(this.Index,this.private_GetRelativePageIndex(0));else this.Parent.Refresh_RecalcData2(this.Index,this.private_GetRelativePageIndex(nCurPage))}; CTable.prototype.Write_ToBinary2=function(Writer){Writer.WriteLong(AscDFH.historyitem_type_Table);Writer.WriteLong(type_Table);Writer.WriteString2(this.Id);Writer.WriteString2(null===this.TableStyle?"":this.TableStyle);Writer.WriteBool(this.Inline);var GridCount=this.TableGrid.length;Writer.WriteLong(GridCount);for(var Index=0;Index 0&&this.Content[0].Get_CellsCount()>0)this.CurCell=this.Content[0].Get_Cell(0)};CTable.prototype.Get_SelectionState2=function(){var TableState={};TableState.Id=this.Get_Id();TableState.CellId=null!==this.CurCell?this.CurCell.Get_Id():null;TableState.Data=null!==this.CurCell?this.CurCell.Content.Get_SelectionState2():null;return TableState};CTable.prototype.Set_SelectionState2=function(TableState){var CellId=TableState.CellId;var CurCell=null;var Pos={Cell:0,Row:0};var RowsCount=this.Content.length; for(var RowIndex=0;RowIndex1||this.Content[0].Get_CellsCount()>1)return true;this.Content[0].Get_Cell(0).Content.SetApplyToAll(true); var Result=this.Content[0].Get_Cell(0).Content.CanAddComment();this.Content[0].Get_Cell(0).Content.SetApplyToAll(false);return Result}else if(true===this.Selection.Use&&table_Selection_Cell===this.Selection.Type)if(this.Selection.Data.length>1)return true;else{var oPos=this.Selection.Data[0];var oCell=this.GetRow(oPos.Row).GetCell(oPos.Cell);var oCellContent=oCell.GetContent();oCellContent.SetApplyToAll(true);var isCanAdd=oCellContent.CanAddComment();oCellContent.SetApplyToAll(false);return isCanAdd}else return this.CurCell.Content.CanAddComment()}; CTable.prototype.Can_IncreaseParagraphLevel=function(bIncrease){if(true===this.Selection.Use&&table_Selection_Cell===this.Selection.Type)if(this.Selection.Data.length>0){var Data=this.Selection.Data;for(var i=0;i=this.Pages.length)CurPage=0;var Page=this.Pages[CurPage];var oHitInfo=this.private_CheckHitInBorder(X,Y,CurPage);var Pos=oHitInfo.Pos;if(oHitInfo.ColumnSelection||oHitInfo.RowSelection||oHitInfo.CellSelection){this.RemoveSelection(); this.CurCell=this.Content[Pos.Row].Get_Cell(Pos.Cell);this.CurCell.Content_Selection_SetStart(X,Y,CurPage-this.CurCell.Content.Get_StartPage_Relative(),MouseEvent);this.Selection.Use=true;this.Selection.Start=true;this.Selection.Type=table_Selection_Cell;this.Selection.Type2=table_Selection_Cells;this.Selection.Data2=null;this.Selection.StartPos.Pos=Pos;this.Selection.StartPos.X=X;this.Selection.StartPos.Y=Y;this.Selection.StartPos.PageIndex=CurPage;this.Selection.StartPos.MouseEvent={ClickCount:MouseEvent.ClickCount, Type:MouseEvent.Type,CtrlKey:MouseEvent.CtrlKey};var oEndPos={Row:Pos.Row,Cell:Pos.Cell};if(oHitInfo.RowSelection){oEndPos.Cell=this.GetRow(Pos.Row).GetCellsCount()-1;this.Selection.Type2=table_Selection_Rows}else if(oHitInfo.ColumnSelection){var oRow=this.GetRow(Pos.Row);var nEndRow=this.GetRowsCount()-1;var nEndCell=this.private_GetCellIndexByStartGridCol(nEndRow,oRow.GetCellInfo(Pos.Cell).StartGridCol,true);if(-1!==nEndCell){oEndPos.Row=nEndRow;oEndPos.Cell=nEndCell;this.Selection.Type2=table_Selection_Columns}}this.Selection.EndPos.Pos= oEndPos;this.Selection.EndPos.X=X;this.Selection.EndPos.Y=Y;this.Selection.EndPos.PageIndex=CurPage;this.Selection.EndPos.MouseEvent={ClickCount:MouseEvent.ClickCount,Type:MouseEvent.Type,CtrlKey:MouseEvent.CtrlKey};this.Selection.Type=table_Selection_Cell;this.private_UpdateSelectedCellsArray()}else if(-1===oHitInfo.Border){var bInnerTableBorder=null!=this.IsTableBorder(X,Y,CurPage)?true:false;if(true===bInnerTableBorder){var Cell=this.Content[Pos.Row].Get_Cell(Pos.Cell);Cell.Content_Selection_SetStart(X, Y,CurPage-Cell.Content.Get_StartPage_Relative(),MouseEvent);this.Selection.Type2=table_Selection_Border_InnerTable;this.Selection.Data2=Cell}else{this.RemoveSelection();this.CurCell=this.Content[Pos.Row].Get_Cell(Pos.Cell);this.CurCell.Content_Selection_SetStart(X,Y,CurPage-this.CurCell.Content.Get_StartPage_Relative(),MouseEvent);this.Selection.Use=true;this.Selection.Start=true;this.Selection.Type=table_Selection_Text;this.Selection.Type2=table_Selection_Common;this.Selection.Data2=null;this.Selection.StartPos.Pos= Pos;this.Selection.StartPos.X=X;this.Selection.StartPos.Y=Y;this.Selection.StartPos.PageIndex=CurPage;this.Selection.StartPos.MouseEvent={ClickCount:MouseEvent.ClickCount,Type:MouseEvent.Type,CtrlKey:MouseEvent.CtrlKey}}}else{this.private_UpdateTableMarkup(Pos.Row,Pos.Cell,CurPage);this.Selection.Type2=table_Selection_Border;this.Selection.Data2={};this.Selection.Data2.PageNum=CurPage;var Row=this.Content[Pos.Row];var _X=X;var _Y=Y;if(0===oHitInfo.Border||2===oHitInfo.Border){var PageH=this.LogicDocument.Get_PageLimits(this.Get_StartPage_Absolute()).YLimit; var Y_min=0;var Y_max=PageH;this.Selection.Data2.bCol=false;var Row_start=this.Pages[CurPage].FirstRow;var Row_end=this.Pages[CurPage].LastRow;if(0===oHitInfo.Border)this.Selection.Data2.Index=Pos.Row-Row_start;else this.Selection.Data2.Index=oHitInfo.Row-Row_start+1;if(0!=this.Selection.Data2.Index){var TempRow=this.Selection.Data2.Index+Row_start-1;Y_min=this.RowsInfo[TempRow].Y[CurPage]}if(this.Selection.Data2.Index!==Row_end-Row_start+1)_Y=this.RowsInfo[this.Selection.Data2.Index+Row_start].Y[CurPage]; else _Y=this.RowsInfo[this.Selection.Data2.Index+Row_start-1].Y[CurPage]+this.RowsInfo[this.Selection.Data2.Index+Row_start-1].H[CurPage];this.Selection.Data2.Min=Y_min;this.Selection.Data2.Max=Y_max;this.Selection.Data2.Pos={Row:Pos.Row,Cell:Pos.Cell};if(null!=this.Selection.Data2.Min)_Y=Math.max(_Y,this.Selection.Data2.Min);if(null!=this.Selection.Data2.Max)_Y=Math.min(_Y,this.Selection.Data2.Max)}else{var CellsCount=Row.Get_CellsCount();var CellSpacing=null===Row.Get_CellSpacing()?0:Row.Get_CellSpacing(); var X_min=null;var X_max=null;this.Selection.Data2.bCol=true;if(3===oHitInfo.Border)this.Selection.Data2.Index=Pos.Cell;else this.Selection.Data2.Index=Pos.Cell+1;if(0!=this.Selection.Data2.Index){var Margins=Row.Get_Cell(this.Selection.Data2.Index-1).GetMargins();if(0!=this.Selection.Data2.Index-1&&this.Selection.Data2.Index!=CellsCount)X_min=Page.X+Row.Get_CellInfo(this.Selection.Data2.Index-1).X_grid_start+Margins.Left.W+Margins.Right.W+CellSpacing;else X_min=Page.X+Row.Get_CellInfo(this.Selection.Data2.Index- 1).X_grid_start+Margins.Left.W+Margins.Right.W+1.5*CellSpacing}if(CellsCount!=this.Selection.Data2.Index){var Margins=Row.Get_Cell(this.Selection.Data2.Index).GetMargins();if(CellsCount-1!=this.Selection.Data2.Index)X_max=Page.X+Row.Get_CellInfo(this.Selection.Data2.Index).X_grid_end-(Margins.Left.W+Margins.Right.W+CellSpacing);else X_max=Page.X+Row.Get_CellInfo(this.Selection.Data2.Index).X_grid_end-(Margins.Left.W+Margins.Right.W+1.5*CellSpacing)}if(CellsCount!=this.Selection.Data2.Index)_X=Page.X+ Row.Get_CellInfo(this.Selection.Data2.Index).X_grid_start;else _X=Page.X+Row.Get_CellInfo(this.Selection.Data2.Index-1).X_grid_end;this.Selection.Data2.Min=X_min;this.Selection.Data2.Max=X_max;this.Selection.Data2.Pos={Row:Pos.Row,Cell:Pos.Cell};if(null!=this.Selection.Data2.Min)_X=Math.max(_X,this.Selection.Data2.Min);if(null!=this.Selection.Data2.Max)_X=Math.min(_X,this.Selection.Data2.Max)}this.Selection.Data2.X=_X;this.Selection.Data2.Y=_Y;this.Selection.Data2.StartCX=_X;this.Selection.Data2.StartCY= _Y;this.Selection.Data2.StartX=X;this.Selection.Data2.StartY=Y;this.Selection.Data2.Start=true;this.DrawingDocument.LockCursorTypeCur()}};CTable.prototype.Selection_SetEnd=function(X,Y,CurPage,MouseEvent){var TablePr=this.Get_CompiledPr(false).TablePr;if(CurPage<0||CurPage>=this.Pages.length)CurPage=0;var Page=this.Pages[CurPage];if(this.Selection.Type2===table_Selection_Border){var LogicDocument=this.LogicDocument;if(!LogicDocument||true!==LogicDocument.CanEdit()||this.Selection.Data2.PageNum!=CurPage)return; var _X=X;var _Y=Y;if(true!==this.Selection.Data2.Start||Math.abs(X-this.Selection.Data2.StartX)>.05||Math.abs(Y-this.Selection.Data2.StartY)>.05){_X=this.DrawingDocument.CorrectRulerPosition(X);_Y=this.DrawingDocument.CorrectRulerPosition(Y);this.Selection.Data2.Start=false}else{_X=this.Selection.Data2.X;_Y=this.Selection.Data2.Y}if(true===this.Selection.Data2.bCol)_X=this.private_UpdateTableRulerOnBorderMove(_X);else _Y=this.private_UpdateTableRulerOnBorderMove(_Y);this.Selection.Data2.X=_X;this.Selection.Data2.Y= _Y;if(MouseEvent.Type===AscCommon.g_mouse_event_type_up){if(Math.abs(_X-this.Selection.Data2.StartCX)<.001&&Math.abs(_Y-this.Selection.Data2.StartCY)<.001){this.Selection.Type2=table_Selection_Common;this.Selection.Data2=null;return}if(false===LogicDocument.Document_Is_SelectionLocked(AscCommon.changestype_None,{Type:AscCommon.changestype_2_Element_and_Type,Element:this,CheckType:AscCommon.changestype_Table_Properties})){LogicDocument.StartAction(AscDFH.historydescription_Document_MoveTableBorder); if(true===this.Selection.Data2.bCol){var Index=this.Selection.Data2.Index;var CurRow=this.Selection.Data2.Pos.Row;var Row=this.Content[CurRow];var Col=0;if(Index===this.Markup.Cols.length)Col=Row.Get_CellInfo(Index-1).StartGridCol+Row.Get_Cell(Index-1).Get_GridSpan();else Col=Row.Get_CellInfo(Index).StartGridCol;var Dx=_X-(Page.X+this.TableSumGrid[Col-1]);var Rows_info=[];var bBorderInSelection=false;if(true===this.Selection.Use&&table_Selection_Cell===this.Selection.Type&&this.Selection.Data.length> 0&&!this.bPresentation){var CellsFlag=[];for(CurRow=0;CurRow=StartGridCol&&Col<=StartGridCol+GridSpan)bBorderInSelection=true;for(var TempIndex=1;TempIndex=StartGridCol&&Col<=StartGridCol+GridSpan)bBorderInSelection=true}}if(CurSelectedIndex0&&Col===oBeforeInfo.Grid&&1===CellsFlag[nCurRow][0])WBefore=this.TableSumGrid[oBeforeInfo.Grid-1]+Dx;else if(null!=BeforeSpace)WBefore=this.TableSumGrid[oBeforeInfo.Grid-1]+BeforeSpace;else WBefore=this.TableSumGrid[oBeforeInfo.Grid-1];else if(BeforeSpace2>0)if(0===oBeforeInfo.Grid&&1===CellsFlag[nCurRow][0])WBefore=BeforeSpace2;else{if(0!=oBeforeInfo.Grid)WBefore=this.TableSumGrid[oBeforeInfo.Grid- 1]}else if(0===oBeforeInfo.Grid&&1!=CellsFlag[nCurRow][0])WBefore=-BeforeSpace2;else if(0!=oBeforeInfo.Grid)WBefore=-BeforeSpace2+this.TableSumGrid[oBeforeInfo.Grid-1];if(WBefore>.001)Rows_info[nCurRow].push({W:WBefore,Type:-1,GridSpan:1});var TempDx=Dx;var isFindLeft=true,isFindRight=false;for(var nCurCell=0,nCellsCount=oRow.GetCellsCount();nCurCellCol&&this.TableSumGrid[nCellGridEnd]-this.TableSumGrid[Col-1]<.635)&&(1===CellsFlag[nCurRow][nCurCell]||nCurCell+1Rows_info[CurRow][0].W)MinBefore=Rows_info[CurRow][0].W}if(0!=MinBefore){for(CurRow=0;CurRowthis.TableSumGrid[0]){BeforeFlag=true;Page.X+=this.TableSumGrid[0]}else Page.X+=Dx;if(true===this.Is_Inline())if(-BeforeSpace2>this.TableSumGrid[0])NewTableInd=NewTableInd+ this.TableSumGrid[0];else NewTableInd=NewTableInd+Dx;else this.Internal_UpdateFlowPosition(Page.X,Page.Y)}var BeforeSpace=null;if(0===Index&&0!=Col&&_X 0&&Col===oBeforeInfo.Grid)WBefore=this.TableSumGrid[oBeforeInfo.Grid-1]+Dx;else{if(null!=BeforeSpace)WBefore=this.TableSumGrid[oBeforeInfo.Grid-1]+BeforeSpace;else WBefore=this.TableSumGrid[oBeforeInfo.Grid-1];if(null!=BeforeSpace2)if(oBeforeInfo.Grid>0)if(true===BeforeFlag)WBefore=this.TableSumGrid[oBeforeInfo.Grid-1]-this.TableSumGrid[0];else WBefore=this.TableSumGrid[oBeforeInfo.Grid-1]+BeforeSpace2;else if(0===oBeforeInfo.Grid&&true===BeforeFlag)WBefore=-BeforeSpace2-this.TableSumGrid[0]}if(WBefore> .001)Rows_info[nCurRow].push({W:WBefore,Type:-1,GridSpan:1});var TempDx=Dx;var isFindLeft=true,isFindRight=false;for(var nCurCell=0,nCellsCount=oRow.GetCellsCount();nCurCellCol&&this.TableSumGrid[nCellGridEnd]-this.TableSumGrid[Col-1]<.635){isFindLeft=false;nCellW=this.TableSumGrid[Col-1]-this.TableSumGrid[nCellGridStart-1]+Dx}if(isFindLeft)nCellW=this.TableSumGrid[nCellGridEnd]-this.TableSumGrid[nCellGridStart-1];var _nCellW=Math.max(1,Math.max(nCellW,oCellMargins.Left.W+oCellMargins.Right.W));if(!isFindLeft){TempDx= _nCellW-(this.TableSumGrid[Col-1]-this.TableSumGrid[nCellGridStart-1]);isFindRight=true}}else if(isFindRight){isFindRight=false;nCellW=this.TableSumGrid[nCellGridEnd]-this.TableSumGrid[Col-1]-TempDx}else nCellW=this.TableSumGrid[nCellGridEnd]-this.TableSumGrid[nCellGridStart-1];nCellW=Math.max(1,Math.max(nCellW,oCellMargins.Left.W+oCellMargins.Right.W));Rows_info[nCurRow].push({W:nCellW,Type:0,GridSpan:1})}}}if(Math.abs(NewTableInd-OldTableInd)>.001)this.Set_TableInd(NewTableInd);var oTablePr=this.Get_CompiledPr(false).TablePr; if(tbllayout_AutoFit===oTablePr.TableLayout)this.SetTableLayout(tbllayout_Fixed);this.Internal_CreateNewGrid(Rows_info);if(undefined!==oTablePr.TableW&&tblwidth_Auto!==oTablePr.TableW.Type){var nTableW=0;for(var nCurCol=0,nColsCount=this.TableGrid.length;nCurCol0&&0===this.Selection.Data2.Index);else{var _Y_old=this.Markup.Rows[this.Selection.Data2.Index-1].Y+this.Markup.Rows[this.Selection.Data2.Index- 1].H;var Dy=_Y-_Y_old;var NewH=this.Markup.Rows[this.Selection.Data2.Index-1].H+Dy;this.Content[RowIndex-1].Set_Height(NewH,linerule_AtLeast)}}LogicDocument.Recalculate();LogicDocument.FinalizeAction()}this.Selection.Type2=table_Selection_Common;this.Selection.Data2=null}return}else if(table_Selection_Border_InnerTable===this.Selection.Type2){var Cell=this.Selection.Data2;Cell.Content_Selection_SetEnd(X,Y,CurPage-Cell.Content.Get_StartPage_Relative(),MouseEvent);if(MouseEvent.Type===AscCommon.g_mouse_event_type_up){this.Selection.Type2= table_Selection_Common;this.Selection.Data2=null}return}var oTempPos=this.private_GetCellByXY(X,Y,CurPage);var Pos={Row:oTempPos.Row,Cell:oTempPos.Cell};if(table_Selection_Rows===this.Selection.Type2)Pos.Cell=this.GetRow(Pos.Row).GetCellsCount()-1;else if(table_Selection_Columns===this.Selection.Type2){var oRow=this.GetRow(oTempPos.Row);var nEndRow=this.GetRowsCount()-1;var nEndCell=this.private_GetCellIndexByStartGridCol(nEndRow,oRow.GetCellInfo(oTempPos.Cell).StartGridCol,true);if(-1!==nEndCell){Pos.Row= nEndRow;Pos.Cell=nEndCell}}this.Content[Pos.Row].Get_Cell(Pos.Cell).Content_SetCurPosXY(X,Y);this.Selection.EndPos.Pos=Pos;this.Selection.EndPos.X=X;this.Selection.EndPos.Y=Y;this.Selection.EndPos.PageIndex=CurPage;this.Selection.EndPos.MouseEvent=MouseEvent;this.Selection.CurRow=Pos.Row;if(table_Selection_Common===this.Selection.Type2&&this.Parent.IsSelectedSingleElement()&&this.Selection.StartPos.Pos.Row===this.Selection.EndPos.Pos.Row&&this.Selection.StartPos.Pos.Cell===this.Selection.EndPos.Pos.Cell){this.private_SetSelectionData(null); this.CurCell.Content_Selection_SetStart(this.Selection.StartPos.X,this.Selection.StartPos.Y,this.Selection.StartPos.PageIndex-this.CurCell.Content.Get_StartPage_Relative(),this.Selection.StartPos.MouseEvent);this.Selection.Type=table_Selection_Text;this.CurCell.Content_Selection_SetEnd(X,Y,CurPage-this.CurCell.Content.Get_StartPage_Relative(),MouseEvent);if(AscCommon.g_mouse_event_type_up==MouseEvent.Type)this.Selection.Start=false;if(false===this.CurCell.Content.Selection.Use){this.Selection.Use= false;this.Selection.Start=false;this.MoveCursorToXY(X,Y,false,false,CurPage);return}}else{if(AscCommon.g_mouse_event_type_up===MouseEvent.Type){this.Selection.Start=false;this.CurCell=this.Content[Pos.Row].Get_Cell(Pos.Cell);if(table_Selection_Cells===this.Selection.Type2&&this.Selection.StartPos.Pos.Cell===this.Selection.EndPos.Pos.Cell&&this.Selection.StartPos.Pos.Row===this.Selection.EndPos.Pos.Row&&MouseEvent.ClickCount>1&&0===MouseEvent.ClickCount%2){this.Selection.StartPos.Pos.Cell=0;this.Selection.EndPos.Pos.Cell= this.GetRow(this.Selection.StartPos.Pos.Row).GetCellsCount()-1}}this.Selection.Type=table_Selection_Cell;this.private_UpdateSelectedCellsArray(table_Selection_Rows===this.Selection.Type2?true:false)}};CTable.prototype.Selection_Stop=function(){if(true!=this.Selection.Use)return;this.Selection.Start=false;var Cell=this.Content[this.Selection.StartPos.Pos.Row].Get_Cell(this.Selection.StartPos.Pos.Cell);Cell.Content_Selection_Stop()};CTable.prototype.DrawSelectionOnPage=function(CurPage){if(false=== this.Selection.Use)return;if(CurPage<0||CurPage>=this.Pages.length)return;var Page=this.Pages[CurPage];var PageAbs=this.private_GetAbsolutePageIndex(CurPage);switch(this.Selection.Type){case table_Selection_Cell:{for(var Index=0;Index=Cell_Pages)continue;var Bounds=Cell.Content_Get_PageBounds(Cell_PageRel);var Y_offset=Cell.Temp.Y_VAlign_offset[Cell_PageRel];var RowIndex=0!=Cell_PageRel?this.Pages[CurPage].FirstRow:Pos.Row;if(true===Cell.IsVerticalText()){var X_start=Page.X+CellInfo.X_cell_start;var TextDirection=Cell.Get_TextDirection(); var MergeCount=this.private_GetVertMergeCountOnPage(CurPage,RowIndex,CellInfo.StartGridCol,Cell.Get_GridSpan());if(MergeCount<=0)continue;var LastRow=Math.min(RowIndex+MergeCount-1,this.Pages[CurPage].LastRow);var Y_start=this.RowsInfo[RowIndex].Y[CurPage]+this.RowsInfo[RowIndex].TopDy[CurPage]+CellMar.Top.W;var Y_end=this.TableRowsBottom[LastRow][CurPage]-CellMar.Bottom.W;if(TextDirection===textdirection_BTLR){var SelectionW=Math.min(X_end-X_start-CellMar.Left.W,Bounds.Bottom-Bounds.Top);this.DrawingDocument.AddPageSelection(PageAbs, X_start+CellMar.Left.W+Y_offset,Y_start,SelectionW,Y_end-Y_start)}else if(TextDirection===textdirection_TBRL){var SelectionW=Math.min(X_end-X_start-CellMar.Right.W,Bounds.Bottom-Bounds.Top);this.DrawingDocument.AddPageSelection(PageAbs,X_end-CellMar.Right.W-Y_offset-SelectionW,Y_start,SelectionW,Y_end-Y_start)}}else this.DrawingDocument.AddPageSelection(PageAbs,X_start,this.RowsInfo[RowIndex].Y[CurPage]+this.RowsInfo[RowIndex].TopDy[CurPage]+CellMar.Top.W+Y_offset,X_end-X_start,Bounds.Bottom-Bounds.Top)}break}case table_Selection_Text:{var Cell= this.Content[this.Selection.StartPos.Pos.Row].Get_Cell(this.Selection.StartPos.Pos.Cell);var Cell_PageRel=CurPage-Cell.Content.Get_StartPage_Relative();Cell.Content_DrawSelectionOnPage(Cell_PageRel);break}}};CTable.prototype.RemoveSelection=function(){if(false===this.Selection.Use)return;this.CurCell=null;if(this.GetRowsCount()>0){var oRow=this.GetRow(this.Selection.EndPos.Pos.Row);var oCell=null;if(!oRow)oCell=this.GetRow(0).GetCell(0);else oCell=oRow.GetCellsCount()>this.Selection.EndPos.Pos.Cell? oRow.GetCell(this.Selection.EndPos.Pos.Cell):oRow.GetCell(0);if(oCell){this.CurCell=oCell;this.CurCell.GetContent().RemoveSelection()}}this.Selection.Use=false;this.Selection.Start=false;this.private_SetSelectionData(null);this.Selection.StartPos.Pos={Row:0,Cell:0};this.Selection.EndPos.Pos={Row:0,Cell:0};this.Markup.Internal.RowIndex=0;this.Markup.Internal.CellIndex=0;this.Markup.Internal.PageNum=0};CTable.prototype.CheckPosInSelection=function(X,Y,CurPage,NearPos){if(undefined!=NearPos){if(true=== this.Selection.Use&&table_Selection_Cell===this.Selection.Type||true===this.ApplyToAll){var Cells_array=this.GetSelectionArray();for(var Index=0;Index=this.Pages.length)return false;var oHitInfo=this.private_CheckHitInBorder(X,Y,CurPage);if(oHitInfo.CellSelection||oHitInfo.RowSelection||oHitInfo.ColumnSelection)return false;var CellPos=this.private_GetCellByXY(X,Y,CurPage);if(true===this.Selection.Use&&table_Selection_Cell===this.Selection.Type){for(var Index=0;Index=0)this.Internal_RecalculateFrom(Cells_array[0].Row-1,0,true,true);else this.Internal_Recalculate_1();else this.Parent.OnContentReDraw(this.Get_AbsolutePage(0), this.Get_AbsolutePage(this.Pages.length-1))}else this.CurCell.Content.AddToParagraph(ParaItem,bRecalculate)};CTable.prototype.ClearParagraphFormatting=function(isClearParaPr,isClearTextPr){if(this.IsCellSelection()){var Cells_array=this.GetSelectionArray();for(var Index=0;Index0){var Pos=Cells_array[0];var Cell=this.Content[Pos.Row].Get_Cell(Pos.Cell);Cell.Content.SelectAll();Cell.Content.Remove(Count,bOnlyText,bRemoveOnlySelection,true,false);this.CurCell=Cell;this.Selection.Use= false;this.Selection.Start=false;this.Selection.StartPos.Pos={Row:Cell.Row.Index,Cell:Cell.Index};this.Selection.EndPos.Pos={Row:Cell.Row.Index,Cell:Cell.Index};this.Document_SetThisElementCurrent(true)}else{var Cells_array=this.GetSelectionArray();for(var Index=0;Index0&&this.Parent.IsSelectedSingleElement())this.Selection.EndPos.Pos={Cell:EndPos.Cell-1,Row:EndPos.Row};else this.Selection.EndPos.Pos={Cell:0,Row:EndPos.Row-1};var bForceSelectByLines=false;if(false===bRet&&true==this.Is_Inline())bForceSelectByLines=true;this.private_UpdateSelectedCellsArray(bForceSelectByLines); return bRet}}else{this.Selection.Use=false;var Pos=this.Selection.Data[0];this.CurCell=this.Content[Pos.Row].Get_Cell(Pos.Cell);this.CurCell.Content_MoveCursorToStartPos();return true}else if(false===this.CurCell.Content.MoveCursorLeft(AddToSelect,Word))if(false===AddToSelect){var nCurCell=this.CurCell.GetIndex();var nCurRow=this.CurCell.GetRow().GetIndex();if(0!==nCurCell||0!==nCurRow){while(true){if(nCurCell>0)nCurCell--;else if(nCurRow>0){nCurRow--;nCurCell=this.GetRow(nCurRow).GetCellsCount()- 1}else{this.CurCell=this.GetRow(0).GetCell(0);break}var oTempCell=this.GetRow(nCurRow).GetCell(nCurCell);if(vmerge_Restart!==oTempCell.GetVMerge())continue;this.RemoveSelection();this.CurCell=oTempCell;break}this.CurCell.Content.MoveCursorToEndPos()}else return false}else{if(0==this.CurCell.Index&&0==this.CurCell.Row.Index&&(null===this.Get_DocumentPrev()&&true===this.Parent.Is_TopDocument()))return false;this.Selection.Use=true;this.Selection.Type=table_Selection_Cell;var bRet=true;this.Selection.StartPos.Pos= {Cell:this.CurCell.Index,Row:this.CurCell.Row.Index};if(0==this.CurCell.Index&&0==this.CurCell.Row.Index){this.Selection.EndPos.Pos={Cell:this.CurCell.Row.Get_CellsCount()-1,Row:0};bRet=false}else if(this.CurCell.Index>0)this.Selection.EndPos.Pos={Cell:this.CurCell.Index-1,Row:this.CurCell.Row.Index};else this.Selection.EndPos.Pos={Cell:0,Row:this.CurCell.Row.Index-1};this.private_UpdateSelectedCellsArray();return bRet}else{if(true===AddToSelect){this.Selection.Use=true;this.Selection.Type=table_Selection_Text; this.Selection.StartPos.Pos={Cell:this.CurCell.Index,Row:this.CurCell.Row.Index};this.Selection.EndPos.Pos={Cell:this.CurCell.Index,Row:this.CurCell.Row.Index}}return true}};CTable.prototype.MoveCursorLeftWithSelectionFromEnd=function(Word){if(true===this.IsSelectionUse())this.RemoveSelection();if(this.Content.length<=0)return;var LastRow=this.Content[this.Content.length-1];this.Selection.Use=true;this.Selection.Type=table_Selection_Cell;this.Selection.StartPos.Pos={Row:LastRow.Index,Cell:LastRow.Get_CellsCount()- 1};this.Selection.EndPos.Pos={Row:LastRow.Index,Cell:0};this.CurCell=LastRow.Get_Cell(0);var arrSelectionData=[];for(var CellIndex=0;CellIndexnCurRow||nCellsCount-1>nCurCell){while(true){if(nCurCell=this.GetRowsCount()-1){this.Selection.EndPos.Pos={Cell:oLastRow.GetCellsCount()-1,Row:oLastRow.Index};bRet=false}else this.Selection.EndPos.Pos={Cell:this.GetRow(this.CurCell.Row.Index+1).GetCellsCount()-1,Row:this.CurCell.Row.Index+1};var bForceSelectByLines=false;if(false===bRet&&true==this.Is_Inline())bForceSelectByLines= true;this.private_UpdateSelectedCellsArray(bForceSelectByLines);return bRet}else{if(true===AddToSelect){this.Selection.Use=true;this.Selection.Type=table_Selection_Text;this.Selection.StartPos.Pos={Cell:this.CurCell.Index,Row:this.CurCell.Row.Index};this.Selection.EndPos.Pos={Cell:this.CurCell.Index,Row:this.CurCell.Row.Index}}return true}};CTable.prototype.MoveCursorRightWithSelectionFromStart=function(Word){if(true===this.IsSelectionUse())this.RemoveSelection();if(this.Content.length<=0)return; var FirstRow=this.Content[0];this.Selection.Use=true;this.Selection.Type=table_Selection_Cell;this.Selection.StartPos.Pos={Row:0,Cell:0};this.Selection.EndPos.Pos={Row:0,Cell:FirstRow.Get_CellsCount()-1};this.CurCell=FirstRow.Get_Cell(FirstRow.Get_CellsCount()-1);var arrSelectionData=[];for(var CellIndex=0;CellIndexBeforeGrid||-1===MinBefore)MinBefore=BeforeGrid;if(MinAfter>AfterGrid||-1===MinAfter)MinAfter=AfterGrid}for(var CurRow=0;CurRow0)TableGrid.splice(TableGrid.length-MinAfter,MinAfter);if(MinBefore>0)TableGrid.splice(0,MinBefore);var Table=new CTable(this.DrawingDocument,this.Parent,this.Inline,0,0,TableGrid,this.bPresentation);Table.Set_TableStyle(this.TableStyle);Table.Set_TableLook(this.TableLook.Copy());Table.Set_PositionH(this.PositionH.RelativeFrom,this.PositionH.Align,this.PositionH.Value);Table.Set_PositionV(this.PositionV.RelativeFrom, this.PositionV.Align,this.PositionV.Value);Table.Set_Distance(this.Distance.L,this.Distance.T,this.Distance.R,this.Distance.B);Table.SetPr(this.Pr.Copy());for(var CurRow=0,CurRow2=0;CurRow0&&Table.Content[0].Get_CellsCount()>0)Table.CurCell=Table.Content[0].Get_Cell(0);SelectedContent.Add(new CSelectedElement(Table,false))}else this.CurCell.Content.GetSelectedContent(SelectedContent)};CTable.prototype.SetParagraphPrOnAdd= function(oPara){this.SetApplyToAll(true);var oParaPr=oPara.GetDirectParaPr().Copy();oParaPr.Ind=new CParaInd;this.SetParagraphPr(oParaPr);var oTextPr=oPara.Get_TextPr();this.AddToParagraph(new ParaTextPr(oTextPr));this.SetApplyToAll(false)};CTable.prototype.SetParagraphAlign=function(Align){if(this.IsCellSelection()){var Cells_array=this.GetSelectionArray();for(var Index=0;Index=0)this.Internal_RecalculateFrom(Cells_array[0].Row- 1,0,true,true);else this.Internal_Recalculate_1()}else return this.CurCell.Content.Set_ParagraphPresentationNumbering(NumInfo)};CTable.prototype.Increase_ParagraphLevel=function(bIncrease){if(this.IsCellSelection()){var Cells_array=this.GetSelectionArray();for(var Index=0;Index=0)this.Internal_RecalculateFrom(Cells_array[0].Row-1,0,true,true);else this.Internal_Recalculate_1()}else return this.CurCell.Content.Increase_ParagraphLevel(bIncrease)};CTable.prototype.SetParagraphShd=function(Shd){if(this.IsCellSelection()){var Cells_array=this.GetSelectionArray();for(var Index=0;Index=0){LeftIndOld=12.5*parseInt(10*LeftIndOld/125);LeftIndNew=((LeftIndOld-10*LeftIndOld%125/10)/12.5+1)*12.5}if(LeftIndNew<0)LeftIndNew=12.5}else{var TempValue=125-10*LeftIndOld%125;TempValue=125===TempValue?0:TempValue;LeftIndNew=Math.max(((LeftIndOld+TempValue/10)/12.5-1)*12.5,0)}this.Set_TableInd(LeftIndNew)}else this.CurCell.Content.IncreaseDecreaseIndent(bIncrease)}; CTable.prototype.GetCalculatedParaPr=function(){if(true===this.ApplyToAll){var Row=this.Content[0];var Cell=Row.Get_Cell(0);Cell.Content.SetApplyToAll(true);var Result_ParaPr=Cell.Content.GetCalculatedParaPr();Cell.Content.SetApplyToAll(false);for(var CurRow=0;CurRow0){var nCurCell=arrSelectionArray[0].Cell;var nCurRow=arrSelectionArray[0].Row;var oCellContent=this.GetRow(nCurRow).GetCell(nCurCell).GetContent();if(true===this.Selection.Use&&table_Selection_Cell===this.Selection.Type){oCellContent.SetApplyToAll(true);var oRes=oCellContent.GetCurrentParagraph(bIgnoreSelection, null,oPr);oCellContent.SetApplyToAll(false);return oRes}else return oCellContent.GetCurrentParagraph(bIgnoreSelection,null,oPr)}}return null};CTable.prototype.GetCurrentTablesStack=function(arrTables){if(!arrTables)arrTables=[];arrTables.push(this);if(true!==this.Selection.Use||table_Selection_Text===this.Selection.Type)return this.CurCell.GetContent().GetCurrentTablesStack(arrTables);return arrTables};CTable.prototype.SetImageProps=function(Props){if(true===this.Selection.Use&&table_Selection_Text=== this.Selection.Type||false===this.Selection.Use)return this.CurCell.Content.SetImageProps(Props)};CTable.prototype.Recalc_CompiledPr=function(){this.CompiledPr.NeedRecalc=true;this.RecalcInfo.RecalcBorders()};CTable.prototype.Recalc_CompiledPr2=function(){this.Recalc_CompiledPr();var RowsCount=this.Content.length;for(var CurRow=0;CurRow.001){this.private_AddPrChange();var TableW=new CTableMeasurement(Type,W);History.Add(new CChangesTableTableW(this,this.Pr.TableW,TableW));this.Pr.TableW=TableW;this.Recalc_CompiledPr();this.private_UpdateTableGrid()}};CTable.prototype.Get_TableW=function(){var Pr=this.Get_CompiledPr(false).TablePr;return Pr.TableW};CTable.prototype.SetTableW=function(nType,nW){this.Set_TableW(nType,nW)};CTable.prototype.GetTableW=function(){return this.Get_TableW()};CTable.prototype.SetTableLayout=function(Value){if(this.Pr.TableLayout=== Value)return;this.private_AddPrChange();History.Add(new CChangesTableTableLayout(this,this.Pr.TableLayout,Value));this.Pr.TableLayout=Value;this.Recalc_CompiledPr()};CTable.prototype.GetTableLayout=function(){var Pr=this.Get_CompiledPr(false).TablePr;return Pr.TableLayout};CTable.prototype.Set_TableCellMar=function(Left,Top,Right,Bottom){var old_Left=undefined===this.Pr.TableCellMar.Left?undefined:this.Pr.TableCellMar.Left;var old_Right=undefined===this.Pr.TableCellMar.Right?undefined:this.Pr.TableCellMar.Right; var old_Top=undefined===this.Pr.TableCellMar.Top?undefined:this.Pr.TableCellMar.Top;var old_Bottom=undefined===this.Pr.TableCellMar.Bottom?undefined:this.Pr.TableCellMar.Bottom;var new_Left=undefined===Left?undefined:new CTableMeasurement(tblwidth_Mm,Left);var new_Right=undefined===Right?undefined:new CTableMeasurement(tblwidth_Mm,Right);var new_Top=undefined===Top?undefined:new CTableMeasurement(tblwidth_Mm,Top);var new_Bottom=undefined===Bottom?undefined:new CTableMeasurement(tblwidth_Mm,Bottom); this.private_AddPrChange();History.Add(new CChangesTableTableCellMar(this,{Left:old_Left,Right:old_Right,Top:old_Top,Bottom:old_Bottom},{Left:new_Left,Right:new_Right,Top:new_Top,Bottom:new_Bottom}));this.Pr.TableCellMar.Left=new_Left;this.Pr.TableCellMar.Right=new_Right;this.Pr.TableCellMar.Top=new_Top;this.Pr.TableCellMar.Bottom=new_Bottom;this.Recalc_CompiledPr();this.private_UpdateTableGrid()};CTable.prototype.Get_TableCellMar=function(){var Pr=this.Get_CompiledPr(false).TablePr;return Pr.TableCellMar}; CTable.prototype.Set_TableAlign=function(Align){if(undefined===Align){if(undefined===this.Pr.Jc)return;this.private_AddPrChange();History.Add(new CChangesTableTableAlign(this,this.Pr.Jc,undefined));this.Pr.Jc=undefined;this.Recalc_CompiledPr()}else if(undefined===this.Pr.Jc){this.private_AddPrChange();History.Add(new CChangesTableTableAlign(this,undefined,Align));this.Pr.Jc=Align;this.Recalc_CompiledPr()}else if(Align!=this.Pr.Jc){this.private_AddPrChange();History.Add(new CChangesTableTableAlign(this, this.Pr.Jc,Align));this.Pr.Jc=Align;this.Recalc_CompiledPr()}};CTable.prototype.Get_TableAlign=function(){var Pr=this.Get_CompiledPr(false).TablePr;return Pr.Jc};CTable.prototype.Set_TableInd=function(Ind){if(undefined===Ind){if(undefined===this.Pr.TableInd)return;this.private_AddPrChange();History.Add(new CChangesTableTableInd(this,this.Pr.TableInd,undefined));this.Pr.TableInd=undefined;this.Recalc_CompiledPr()}else if(undefined===this.Pr.TableInd){this.private_AddPrChange();History.Add(new CChangesTableTableInd(this, undefined,Ind));this.Pr.TableInd=Ind;this.Recalc_CompiledPr()}else if(Math.abs(this.Pr.TableInd-Ind)>.001){this.private_AddPrChange();History.Add(new CChangesTableTableInd(this,this.Pr.TableInd,Ind));this.Pr.TableInd=Ind;this.Recalc_CompiledPr()}};CTable.prototype.Get_TableInd=function(){var Pr=this.Get_CompiledPr(false).TablePr;return Pr.TableInd};CTable.prototype.Set_TableBorder_Left=function(Border){if(undefined===this.Pr.TableBorders.Left&&undefined===Border)return;var _Border=Border;if(undefined!== _Border){_Border=new CDocumentBorder;_Border.Set_FromObject(Border)}this.private_AddPrChange();History.Add(new CChangesTableTableBorderLeft(this,this.Pr.TableBorders.Left,_Border));this.Pr.TableBorders.Left=_Border;this.Recalc_CompiledPr()};CTable.prototype.Set_TableBorder_Right=function(Border){if(undefined===this.Pr.TableBorders.Right&&undefined===Border)return;var _Border=Border;if(undefined!==_Border){_Border=new CDocumentBorder;_Border.Set_FromObject(Border)}this.private_AddPrChange();History.Add(new CChangesTableTableBorderRight(this, this.Pr.TableBorders.Right,_Border));this.Pr.TableBorders.Right=_Border;this.Recalc_CompiledPr()};CTable.prototype.Set_TableBorder_Top=function(Border){if(undefined===this.Pr.TableBorders.Top&&undefined===Border)return;var _Border=Border;if(undefined!==_Border){_Border=new CDocumentBorder;_Border.Set_FromObject(Border)}this.private_AddPrChange();History.Add(new CChangesTableTableBorderTop(this,this.Pr.TableBorders.Top,_Border));this.Pr.TableBorders.Top=_Border;this.Recalc_CompiledPr()};CTable.prototype.Set_TableBorder_Bottom= function(Border){if(undefined===this.Pr.TableBorders.Bottom&&undefined===Border)return;var _Border=Border;if(undefined!==_Border){_Border=new CDocumentBorder;_Border.Set_FromObject(Border)}this.private_AddPrChange();History.Add(new CChangesTableTableBorderBottom(this,this.Pr.TableBorders.Bottom,_Border));this.Pr.TableBorders.Bottom=_Border;this.Recalc_CompiledPr()};CTable.prototype.Set_TableBorder_InsideH=function(Border){if(undefined===this.Pr.TableBorders.InsideH&&undefined===Border)return;var _Border= Border;if(undefined!==_Border){_Border=new CDocumentBorder;_Border.Set_FromObject(Border)}this.private_AddPrChange();History.Add(new CChangesTableTableBorderInsideH(this,this.Pr.TableBorders.InsideH,_Border));this.Pr.TableBorders.InsideH=_Border;this.Recalc_CompiledPr()};CTable.prototype.Set_TableBorder_InsideV=function(Border){if(undefined===this.Pr.TableBorders.InsideV&&undefined===Border)return;var _Border=Border;if(undefined!==_Border){_Border=new CDocumentBorder;_Border.Set_FromObject(Border)}this.private_AddPrChange(); History.Add(new CChangesTableTableBorderInsideV(this,this.Pr.TableBorders.InsideV,_Border));this.Pr.TableBorders.InsideV=_Border;this.Recalc_CompiledPr()};CTable.prototype.Get_TableBorders=function(){var Pr=this.Get_CompiledPr(false).TablePr;return Pr.TableBorders};CTable.prototype.GetTopTableBorder=function(){return this.Get_CompiledPr(false).TablePr.TableBorders.Top};CTable.prototype.GetBottomTableBorder=function(){return this.Get_CompiledPr(false).TablePr.TableBorders.Bottom};CTable.prototype.Set_TableShd= function(Value,r,g,b){if(undefined===Value&&undefined===this.Pr.Shd)return;var _Shd=undefined;if(undefined!==Value){_Shd=new CDocumentShd;_Shd.Value=Value;_Shd.Color=new CDocumentColor(r,g,b);_Shd.Fill=new CDocumentColor(r,g,b)}this.private_AddPrChange();History.Add(new CChangesTableTableShd(this,this.Pr.Shd,_Shd));this.Pr.Shd=_Shd;this.Recalc_CompiledPr()};CTable.prototype.Get_Shd=function(){var Pr=this.Get_CompiledPr(false).TablePr;return Pr.Shd};CTable.prototype.Get_Borders=function(){return this.Get_TableBorders()}; CTable.prototype.Set_TableDescription=function(sDescription){this.private_AddPrChange();History.Add(new CChangesTableTableDescription(this,this.Pr.TableDescription,sDescription));this.Pr.TableDescription=sDescription;this.Recalc_CompiledPr()};CTable.prototype.Get_TableDescription=function(){var Pr=this.Get_CompiledPr(false).TablePr;return Pr.TableDescription};CTable.prototype.Set_TableCaption=function(sCaption){this.private_AddPrChange();History.Add(new CChangesTableTableCaption(this,this.Pr.TableCaption, sCaption));this.Pr.TableCaption=sCaption;this.Recalc_CompiledPr()};CTable.prototype.Get_TableCaption=function(){var Pr=this.Get_CompiledPr(false).TablePr;return Pr.TableCaption};CTable.prototype.Split=function(){var CurRow=this.CurCell.Row.Index;if(0===CurRow)return null;var NewTable=new CTable(this.DrawingDocument,this.Parent,this.Inline,0,0,this.private_CopyTableGrid());var Len=this.Content.length;for(var RowIndex=CurRow;RowIndexnRowMax)nRowMax= RowIndex;if(-1===nRowMin||RowIndexRowsInfo[RowIndex].Grid_end)RowsInfo[RowIndex].Grid_end=EndGridCol}}for(var nRowIndex=nRowMin;nRowIndex<=nRowMax;++nRowIndex)if(!RowsInfo[nRowIndex]){bCanMerge=false;break}for(var Index in RowsInfo){if(-1===Grid_start)Grid_start=RowsInfo[Index].Grid_start;else if(Grid_start!=RowsInfo[Index].Grid_start){bCanMerge=false;break}if(-1=== Grid_end)Grid_end=RowsInfo[Index].Grid_end;else if(Grid_end!=RowsInfo[Index].Grid_end){bCanMerge=false;break}}if(true===bCanMerge){var TopRow=-1;var BotRow=-1;for(var GridIndex=Grid_start;GridIndex<=Grid_end;GridIndex++){var Pos_top=null;var Pos_bot=null;for(var Index=0;Index=StartGridCol&&GridIndex<=EndGridCol){if(null===Pos_top||Pos_top.Row>Pos.Row)Pos_top=Pos;if(null===Pos_bot||Pos_bot.RowRow_grid_end){bCanMerge=false;break}}}return{Grid_start:Grid_start,Grid_end:Grid_end,RowsInfo:RowsInfo,bCanMerge:bCanMerge}};CTable.prototype.MergeTableCells=function(isClearMerge){var bApplyToInnerTable=false;if(false===this.Selection.Use||true===this.Selection.Use&&table_Selection_Text===this.Selection.Type)bApplyToInnerTable=this.CurCell.Content.MergeTableCells();if(true===bApplyToInnerTable)return false;if(true!=this.Selection.Use||table_Selection_Cell!=this.Selection.Type|| this.Selection.Data.length<=1)return false;var Temp=this.Internal_CheckMerge();var bCanMerge=Temp.bCanMerge;var Grid_start=Temp.Grid_start;var Grid_end=Temp.Grid_end;var RowsInfo=Temp.RowsInfo;if(false===bCanMerge)return false;var Pos_tl=this.Selection.Data[0];var Cell_tl=this.Content[Pos_tl.Row].Get_Cell(Pos_tl.Cell);for(var Index=0;IndexGrid_start&&Cell_grid_start<=Grid_end){Row.Remove_Cell(CellIndex);CellIndex--}else if(Cell_grid_start>Grid_end)break}}this.Internal_Check_TableRows(true!==isClearMerge?true:false);for(var PageNum=0;PageNum1)if(Rows>VMerge_count){if(false!==isFailureEvents){var ErrData=new AscCommon.CErrorData;ErrData.put_Value(VMerge_count);editor.sendEvent("asc_onError",c_oAscError.ID.SplitCellMaxRows,c_oAscError.Level.NoCritical,ErrData)}return false}else if(0!=VMerge_count%Rows){if(false!==isFailureEvents){var ErrData=new AscCommon.CErrorData; ErrData.put_Value(VMerge_count);editor.sendEvent("asc_onError",c_oAscError.ID.SplitCellRowsDivider,c_oAscError.Level.NoCritical,ErrData)}return false}if(this.IsRecalculated()){var Sum_before=this.TableSumGrid[Grid_start-1];var Sum_with=this.TableSumGrid[Grid_start+Grid_span-1];var Span_width=Sum_with-Sum_before;var Grid_width=Span_width/Cols;var CellSpacing=Row.Get_CellSpacing();var CellMar=Cell.GetMargins();var MinW=CellSpacing+CellMar.Right.W+CellMar.Left.W;if(Grid_width1){var New_VMerge_Count=VMerge_count/Rows;for(var Index=0;Index1){var Sum_before=this.TableSumGrid[Grid_start-1];var Sum_with=this.TableSumGrid[Grid_start+Grid_span-1];var Span_width=Sum_with-Sum_before; var Grid_width=Span_width/Cols;var Grid_Info=[];for(var Index=0;Index=0;Index--){var Summary=this.TableGridCalc[Index];if(Grid_Info[Index]>0){arrNewGrid[Index]=Grid_Info_start[Index];Summary-=Grid_Info_start[Index]-Grid_width;for(var NewIndex=0;NewIndex=Cells_pos[0].Row&&CurRow<=Cells_pos[Cells_pos.length-1].Row)continue;var TempRow=this.Content[CurRow];var GridBefore=TempRow.Get_Before().GridBefore;var GridAfter=TempRow.Get_After().GridAfter;if(GridBefore>0){var SummaryGridSpan=GridBefore;for(var CurGrid=0;CurGrid0){var SummaryGridSpan=GridAfter;for(var CurGrid=LastGrid;CurGrid0)Count=nCount;if(Cells_pos.length<=0)return;if(true===bBefore)RowId=Cells_pos[0].Row; else RowId=Cells_pos[Cells_pos.length-1].Row;var Row=this.Content[RowId];var CellsCount=Row.Get_CellsCount();var Cells_info=[];for(var CurCell=0;CurCell1)New_Cell.SetVMerge(vmerge_Continue);else New_Cell.SetVMerge(vmerge_Restart);else if(Cells_info[CurCell].VMerge_count_after>1)New_Cell.SetVMerge(vmerge_Continue);else New_Cell.SetVMerge(vmerge_Restart)}}this.Selection.Use=true;this.Selection.Use=true;this.Selection.Type=table_Selection_Cell;var StartRow=true===bBefore?RowId:RowId+1;this.Selection.StartPos.Pos={Row:StartRow, Cell:0};this.Selection.EndPos.Pos={Row:StartRow+Count-1,Cell:this.Content[StartRow+Count-1].GetCellsCount()-1};var arrSelectionData=[];for(var Index=0;Index=FirstRow_to_delete)Cell.SetVMerge(vmerge_Restart)}}this.RemoveSelection();var oLogicDocument=this.LogicDocument;var isTrackRevisions=oLogicDocument?oLogicDocument.IsTrackRevisions():false;if(isTrackRevisions)for(var nIndex=Rows_to_delete.length-1;nIndex>=0;--nIndex){var oRow=this.GetRow(Rows_to_delete[nIndex]);var nRowReviewType= oRow.GetReviewType();var oRowReviewInfo=oRow.GetReviewInfo();if(reviewtype_Add===nRowReviewType&&oRowReviewInfo.IsCurrentUser())this.private_RemoveRow(Rows_to_delete[nIndex]);else{for(var nCurCell=0,nCellsCount=oRow.GetCellsCount();nCurCell=0;Index--)this.private_RemoveRow(Rows_to_delete[Index]); this.DrawingDocument.TargetStart();this.DrawingDocument.TargetShow();this.DrawingDocument.SelectEnabled(false);if(this.Content.length<=0)return false;var CurRow=Math.min(Rows_to_delete[0],this.Content.length-1);var Row=this.Content[CurRow];this.CurCell=Row.Get_Cell(0);this.CurCell.Content.MoveCursorToStartPos();var PageNum=0;for(PageNum=0;PageNum=0;Index--)if(0!=Rows_to_delete[Index])this.private_RemoveRow(Index); if(this.Content.length<=0)return false;if(this.CurCell.Row.Index>=this.Content.length)this.CurCell=this.Content[this.Content.length-1].Get_Cell(0);this.RemoveSelection();return true};CTable.prototype.RemoveTableColumn=function(){var bApplyToInnerTable=false;if(false===this.Selection.Use||true===this.Selection.Use&&table_Selection_Text===this.Selection.Type)bApplyToInnerTable=this.CurCell.Content.RemoveTableColumn();if(true===bApplyToInnerTable)return true;var Cells_pos=[];if(true===this.Selection.Use&& table_Selection_Cell===this.Selection.Type)Cells_pos=this.Selection.Data;else Cells_pos[0]={Row:this.CurCell.Row.Index,Cell:this.CurCell.Index};if(Cells_pos.length<=0)return;var Grid_start=-1;var Grid_end=-1;for(var Index=0;IndexCur_Grid_start)Grid_start=Cur_Grid_start;if(-1===Grid_end||-1!==Grid_end&&Grid_end0)Rows_info[CurRow].push({W:this.TableSumGrid[Before_Info.GridBefore-1],Type:-1,GridSpan:1});var CellsCount=Row.Get_CellsCount();for(var CurCell=0;CurCell< CellsCount;CurCell++){var Cell=Row.Get_Cell(CurCell);var Cur_Grid_start=Row.Get_CellInfo(CurCell).StartGridCol;var Cur_Grid_end=Cur_Grid_start+Cell.Get_GridSpan()-1;if(Cur_Grid_start<=Grid_end&&Cur_Grid_end>=Grid_start)Delete_info[CurRow].push(CurCell);else{var W=this.TableSumGrid[Cur_Grid_end]-this.TableSumGrid[Cur_Grid_start-1];Rows_info[CurRow].push({W:W,Type:0,GridSpan:1})}}}for(var CurRow=0;CurRow=0;Index--){var CurCell=Delete_info[CurRow][Index];Row.Remove_Cell(CurCell)}}for(var CurRow=this.Content.length-1;CurRow>=0;CurRow--){var bRemove=true;for(var Index=0;Index=0;CurRow--){var bRemove=true;var Row=this.Content[CurRow];var CellsCount=Row.Get_CellsCount();for(var CurCell=0;CurCell0)Count=nCount;if(Cells_pos.length<=0)return;if(true===bBefore){var FirstCell_Grid_start=this.Content[Cells_pos[0].Row].Get_CellInfo(Cells_pos[0].Cell).StartGridCol;var FirstCell_Grid_end=FirstCell_Grid_start+this.Content[Cells_pos[0].Row].Get_Cell(Cells_pos[0].Cell).Get_GridSpan()- 1;Width=this.TableSumGrid[FirstCell_Grid_end]-this.TableSumGrid[FirstCell_Grid_start-1]}else{var LastPos=Cells_pos.length-1;var LastCell_Grid_start=this.Content[Cells_pos[LastPos].Row].Get_CellInfo(Cells_pos[LastPos].Cell).StartGridCol;var LastCell_Grid_end=LastCell_Grid_start+this.Content[Cells_pos[LastPos].Row].Get_Cell(Cells_pos[LastPos].Cell).Get_GridSpan()-1;Width=this.TableSumGrid[LastCell_Grid_end]-this.TableSumGrid[LastCell_Grid_start-1]}var Rows_info=[];var Add_info=[];if(true===bBefore){var Grid_start= -1;for(var Index=0;IndexCur_Grid_start)Grid_start=Cur_Grid_start}for(var CurRow=0;CurRow0)Rows_info[CurRow].push({W:this.TableSumGrid[Before_Info.GridBefore- 1],Type:-1,GridSpan:1});var CellsCount=Row.Get_CellsCount();for(var CurCell=0;CurCell0)if(Row.Get_CellInfo(CellsCount- 1).StartGridCol+Row.Get_Cell(CellsCount-1).Get_GridSpan()<=Grid_start)Add_info[CurRow]=CellsCount}for(var CurRow=0;CurRow0&&Rows_info[CurRow][0].Type===-1)bBefore2=true;for(var Index=0;Index=Row.Get_CellsCount()-1?Row.Get_Cell(Add_info[CurRow]-1):Row.Get_Cell(Add_info[CurRow]+1);NewCell.Copy_Pr(NextCell.Pr, true);var FirstPara=NextCell.Content.Get_FirstParagraph();var TextPr=FirstPara.GetFirstRunPr();NewCell.Content.SetApplyToAll(true);var PStyleId=FirstPara.Style_Get();if(undefined!==PStyleId&&null!==this.LogicDocument){var Styles=this.LogicDocument.Get_Styles();NewCell.Content.SetParagraphStyle(Styles.Get_Name(PStyleId))}NewCell.Content.AddToParagraph(new ParaTextPr(TextPr));NewCell.Content.SetApplyToAll(false);if(false===bBefore2)Rows_info[CurRow].splice(Add_info[CurRow],0,{W:Width,Type:0,GridSpan:1}); else Rows_info[CurRow].splice(Add_info[CurRow]+1,0,{W:Width,Type:0,GridSpan:1})}}}else{var Grid_end=-1;for(var Index=0;Index0)Rows_info[CurRow].push({W:this.TableSumGrid[Before_Info.GridBefore-1],Type:-1,GridSpan:1});var CellsCount=Row.Get_CellsCount();for(var CurCell=0;CurCell0&&Rows_info[CurRow][0].Type===-1)bBefore2=true;for(var Index=0;Index=Row.Get_CellsCount()-1?Row.Get_Cell(Add_info[CurRow]):Row.Get_Cell(Add_info[CurRow]+2);NewCell.Copy_Pr(NextCell.Pr,true); var FirstPara=NextCell.Content.Get_FirstParagraph();var TextPr=FirstPara.GetFirstRunPr();NewCell.Content.SetApplyToAll(true);var PStyleId=FirstPara.Style_Get();if(undefined!==PStyleId&&null!==this.LogicDocument){var Styles=this.LogicDocument.Get_Styles();NewCell.Content.SetParagraphStyle(Styles.Get_Name(PStyleId))}NewCell.Content.AddToParagraph(new ParaTextPr(TextPr));NewCell.Content.SetApplyToAll(false);if(false===bBefore2)Rows_info[CurRow].splice(Add_info[CurRow]+1,0,{W:Width,Type:0,GridSpan:1}); else Rows_info[CurRow].splice(Add_info[CurRow]+2,0,{W:Width,Type:0,GridSpan:1})}}}this.Internal_CreateNewGrid(Rows_info);this.Selection.Use=true;this.Selection.Type=table_Selection_Cell;var arrSelectionData=[];for(var CurRow=0;CurRow2&&Math.abs(X2-X1)<3)this.DrawVertLine(X1,Y1,X2,Y2,CurPageStart);else if(Math.abs(X2-X1)>2&&Math.abs(Y2-Y1)<3)this.DrawHorLine(X1,Y1,X2,Y2,CurPageStart);else this.DrawCellInCell(X1, Y1,X2,Y2,CurPageStart);else if(drawMode===false)return this.EraseTable(X1,Y1,X2,Y2,CurPageStart)};CTable.prototype.DrawVertLine=function(X1,Y1,X2,Y2,CurPageStart){if(Y1>Y2){var cache;cache=Y2;Y2=Y1;Y1=cache}if(Y2this.Pages[CurPageStart].Bounds.Top&&Y1X2){var cache;cache=X2;X2=X1;X1=cache}var RowNumb=[];var CellsIndexes=[];RowNumb=this.GetAffectedRows(X1,Y1,X2,Y2,CurPageStart,1);if(RowNumb.length===0)return;else for(var curCell=0;curCellthis.GetRow(RowNumb[0]).CellsInfo[curCell].X_cell_start||X1this.GetRow(RowNumb[0]).CellsInfo[curCell].X_cell_end||X1>this.GetRow(RowNumb[0]).CellsInfo[curCell].X_cell_start&&X2X2){var cache;cache=X2;X2=X1;X1=cache}if(Y1>Y2){var cache;cache=Y2;Y2=Y1;Y1=cache}if(Y2>=this.RowsInfo[this.Pages[CurPageStart].LastRow].Y[CurPageStart]+this.RowsInfo[this.Pages[CurPageStart].LastRow].H[CurPageStart])Y_Under= true;if(Y1<=this.RowsInfo[this.Pages[CurPageStart].FirstRow].Y[CurPageStart])Y_Over=true;if(X1<=this.TableSumGrid[-1])X_Front=true;if(X2>=this.TableSumGrid[this.TableSumGrid.length-1])X_After=true}if(isSelected===false||this.Selection.Data===null)return;var Temp=this.Internal_CheckMerge();var bCanMerge=Temp.bCanMerge;var Grid_start=Temp.Grid_start;var Grid_end=Temp.Grid_end;var RowsInfo=Temp.RowsInfo;if(this.DeleteTablePart(X_Front,X_After,Y_Over,Y_Under,bCanMerge))return;var CellsCanBeMerge=[];CellsCanBeMerge.push(this.Selection.Data); var CellsCantBeMerge=[];var SelectedCells=this.Selection.Data;if(this.Selection.Data.length===1){var Cell_pos=this.Selection.Data[0];var Row=this.GetRow(Cell_pos.Row);var Cell=Row.Get_Cell(Cell_pos.Cell);var Grid_start=Row.Get_CellInfo(Cell_pos.Cell).StartGridCol;var Grid_span=Cell.Get_GridSpan();var VMerge_Count=this.Internal_GetVertMergeCount(Cell_pos.Row,Grid_start,Grid_span);var rowHSum=0;var CellsToDelete=[];if(VMerge_Count>=1)for(var Index=Cell_pos.Row;IndexY1)Y_Over=true;if(Cell.Index===0&&this.GetRow(Cell.Row.Index).CellsInfo[Cell.Index].X_cell_start>X1)X_Front=true;if(Cell.Index===this.GetRow(Cell.Row.Index).Get_CellsCount()-1&&this.GetRow(Cell.Row.Index).CellsInfo[Cell.Index].X_cell_endGrid_start&&Cell_grid_start<=Grid_end){Row.Remove_Cell(CellIndex);CellIndex--}else if(Cell_grid_start>Grid_end)break}}var Cell_tl_VMergeCount=this.GetVMergeCount(Cell_tl.GetIndex(),Cell_tl.GetRow().GetIndex());if(!click){if(this.TableSumGrid[Grid_start-1]>X1)X_Front= true;if(this.TableSumGrid[Grid_end]Y1)Y_Over=true}this.Internal_Check_TableRows(true!==isClearMerge?true:false);for(var PageNum=0;PageNumIndex)CellsCanBeMerge[newIndex][Index2].Row-=1;for(var Index2=0;Index2Index)CellsCantBeMerge[Index2].Row-=1;oldRows.splice(Index,1);oldCells.splice(Index,1);Index=-1}for(var Index=0;IndexIndex2)CellsCanBeMerge[newIndex][Index3].Cell-=1;for(var Index3=0;Index3Index2)CellsCantBeMerge[Index3].Cell-=1;oldCells[Index].splice(Index2,1);Index2= -1}}if(CellsCanBeMerge.length>=1)for(var nTempIndex=0,nTempLen=CellsCanBeMerge.length;nTempIndex=1){var CellsToDelete=[];for(var firstCellPos=0;firstCellPos=1)for(var newIndex=Cell_pos_1.Row;newIndexY1)Y_Over=true;if(Cell_pos_1.Cell===0&&this.GetRow(Cell_pos_1.Row).CellsInfo[Cell_pos_1.Cell].X_cell_start>X1)X_Front=true;if(Cell_pos_1.Cell===this.GetRow(Cell_pos_1.Row).Get_CellsCount()-1&&this.TableSumGrid[Grid_end_1]0){var rowsInfo=[];for(var curRow=0;curRow=1&&Grid_start===this.GetRow(curRow).Get_Before().GridBefore){var cell_Indent={W:X_end-cellWidth,Type:-1,Grid_span:1};cellsInfo[cellsInfo.length]=cell_Indent}var cell={W:cellWidth,Type:0,GridSpan:1};cellsInfo[cellsInfo.length]=cell;rowsInfo[curRow]=cellsInfo}}if(rowsInfo.length!==0)this.SetTableGrid(this.Internal_CreateNewGrid(rowsInfo));return true}else return false};CTable.prototype.GetDrawLine= function(X1,Y1,X2,Y2,CurPageStart,CurPageEnd,drawMode){var X1_origin=0;var X2_origin=0;X1_origin+=X1;X2_origin+=X2;var Y1_origin=0;var Y2_origin=0;Y1_origin+=Y1;Y2_origin+=Y2;X1=X1-this.Pages[CurPageStart].X;X2=X2-this.Pages[CurPageStart].X;if(X1>X2){var cache;cache=X2;X2=X1;X1=cache}if(drawMode===true){if(Y1<0)Y1=0;if(Y2<0)Y2=0;var borders=[];if(Math.abs(Y2-Y1)>2&&Math.abs(X2-X1)<3){if(Y1===Y2)return;if(Y1>Y2){var cache;cache=Y2;Y2=Y1;Y1=cache}var Rows=[];var CellsIndexes=[];Rows=this.GetAffectedRows(X1, Y1,X2,Y2,CurPageStart,0);var StartRow=Rows[0];var EndRow=Rows[Rows.length-1];for(var Index=0;Indexthis.GetRow(Rows[Index]).CellsInfo[curCell].X_cell_start&&X1=this.RowsInfo[Rows[0]].H[CurPageStart]/2)if(Math.abs(Cell.Metrics.X_cell_start-X1)<=1.5){var Vline={X1:Cell.Metrics.X_cell_start+this.Pages[CurPageStart].X,X2:Cell.Metrics.X_cell_start+this.Pages[CurPageStart].X,Y1:this.RowsInfo[StartRow].Y[CurPageStart],Y2:this.RowsInfo[EndRow].Y[CurPageStart]+this.RowsInfo[EndRow].H[CurPageStart], Color:"Grey",Bold:true};borders.push(Vline)}else if(Math.abs(Cell.Metrics.X_cell_end-X1)<=1.5){var Vline={X1:Cell.Metrics.X_cell_end+this.Pages[CurPageStart].X,X2:Cell.Metrics.X_cell_end+this.Pages[CurPageStart].X,Y1:this.RowsInfo[StartRow].Y[CurPageStart],Y2:this.RowsInfo[EndRow].Y[CurPageStart]+this.RowsInfo[EndRow].H[CurPageStart],Color:"Grey",Bold:true};borders.push(Vline)}else{var Vline={X1:X1_origin,X2:X1_origin,Y1:this.RowsInfo[StartRow].Y[CurPageStart],Y2:this.RowsInfo[EndRow].Y[CurPageStart]+ this.RowsInfo[EndRow].H[CurPageStart],Color:"Grey",Bold:false};borders.push(Vline)}else if(Y2-Y12&&Math.abs(Y2-Y1)<3){if(X1===X2)return;if(X1>X2){var cache;cache=X2;X2=X1;X1=cache}var RowNumb=[];var CellsIndexes=[];RowNumb=this.GetAffectedRows(X1,Y1,X2,Y2,CurPageStart,1);if(RowNumb.length===0){var Line={X1:X1_origin, X2:X2_origin,Y1:Y1,Y2:Y2,Color:"Red",Bold:false};borders.push(Line);return borders}else for(var curCell=0;curCellthis.GetRow(RowNumb[0]).CellsInfo[curCell].X_cell_start||X1this.GetRow(RowNumb[0]).CellsInfo[curCell].X_cell_end||X1>this.GetRow(RowNumb[0]).CellsInfo[curCell].X_cell_start&&X2=(this.GetRow(RowNumb[0]).Get_Cell(CellsIndexes[0]).Metrics.X_cell_end-this.GetRow(RowNumb[0]).Get_Cell(CellsIndexes[0]).Metrics.X_cell_start)/2||Math.abs(X2_origin-X1_origin)<(this.GetRow(RowNumb[0]).Get_Cell(CellsIndexes[0]).Metrics.X_cell_end-this.GetRow(RowNumb[0]).Get_Cell(CellsIndexes[0]).Metrics.X_cell_start)/2)if(Math.abs(this.RowsInfo[RowNumb[0]].Y[CurPageStart]- Y1)<=1.5){var Row=this.GetRow(RowNumb[0]);var startCell=Row.Get_Cell(CellsIndexes[0]);var endCell=Row.Get_Cell(CellsIndexes[CellsIndexes.length-1]);if(startCell.GetVMerge()===2){var Hline={Y1:this.RowsInfo[RowNumb[0]].Y[CurPageStart],Y2:this.RowsInfo[RowNumb[0]].Y[CurPageStart],X1:startCell.Metrics.X_cell_start+this.Pages[CurPageStart].X,X2:endCell.Metrics.X_cell_end+this.Pages[CurPageStart].X,Color:"Grey",Bold:false};borders.push(Hline)}else{var Hline={Y1:this.RowsInfo[RowNumb[0]].Y[CurPageStart], Y2:this.RowsInfo[RowNumb[0]].Y[CurPageStart],X1:startCell.Metrics.X_cell_start+this.Pages[CurPageStart].X,X2:endCell.Metrics.X_cell_end+this.Pages[CurPageStart].X,Color:"Grey",Bold:true};borders.push(Hline)}}else if(Math.abs(this.RowsInfo[RowNumb[0]].Y[CurPageStart]+this.RowsInfo[RowNumb[0]].H[CurPageStart]-Y1)<=1.5){var Row=this.GetRow(RowNumb[0]);var startCell=Row.Get_Cell(CellsIndexes[0]);var endCell=Row.Get_Cell(CellsIndexes[CellsIndexes.length-1]);var Grid_start=Row.Get_CellInfo(startCell.Index).StartGridCol; var Grid_span=startCell.Get_GridSpan();var VMerge_count=this.Internal_GetVertMergeCount(Row.Index,Grid_start,Grid_span);if(VMerge_count>1){var Hline={Y1:this.RowsInfo[RowNumb[0]].Y[CurPageStart]+this.RowsInfo[RowNumb[0]].H[CurPageStart],Y2:this.RowsInfo[RowNumb[0]].Y[CurPageStart]+this.RowsInfo[RowNumb[0]].H[CurPageStart],X1:startCell.Metrics.X_cell_start+this.Pages[CurPageStart].X,X2:endCell.Metrics.X_cell_end+this.Pages[CurPageStart].X,Color:"Grey",Bold:false};borders.push(Hline)}else{var Hline= {Y1:this.RowsInfo[RowNumb[0]].Y[CurPageStart]+this.RowsInfo[RowNumb[0]].H[CurPageStart],Y2:this.RowsInfo[RowNumb[0]].Y[CurPageStart]+this.RowsInfo[RowNumb[0]].H[CurPageStart],X1:startCell.Metrics.X_cell_start+this.Pages[CurPageStart].X,X2:endCell.Metrics.X_cell_end+this.Pages[CurPageStart].X,Color:"Grey",Bold:true};borders.push(Hline)}}else{var Hline={Y1:Y1,Y2:Y1,X1:this.GetRow(RowNumb[0]).Get_Cell(CellsIndexes[0]).Metrics.X_cell_start+this.Pages[CurPageStart].X,X2:this.GetRow(RowNumb[0]).Get_Cell(CellsIndexes[CellsIndexes.length- 1]).Metrics.X_cell_end+this.Pages[CurPageStart].X,Color:"Grey",Bold:false};borders.push(Hline)}return borders}else{var Cell_pos=this.private_GetCellByXY(X1+this.Pages[CurPageStart].X,Y1,CurPageStart);var Row=this.GetRow(Cell_pos.Row);var Cell=Row.Get_Cell(Cell_pos.Cell);var X_start=Row.CellsInfo[Cell_pos.Cell].X_cell_start;var X_end=Row.CellsInfo[Cell_pos.Cell].X_cell_end;var Cell_width=X_end-X_start;var Grid_start=Row.Get_CellInfo(Cell_pos.Cell).StartGridCol;var Grid_span=Cell.Get_GridSpan();var VMerge_count= this.Internal_GetVertMergeCount(Cell_pos.Row,Grid_start,Grid_span);var rowHSum=0;var CellSpacing=Row.Get_CellSpacing();var CellMar=Cell.GetMargins();var MinW=CellSpacing+CellMar.Right.W+CellMar.Left.W;if(VMerge_count>=1)for(var Index=Cell_pos.Row;Index=MinW*1.5&&X2-X1>MinW*1.5&&rowHSum>=4.63864881727431*1.5&&Math.abs(Y2-Y1)>=4.63864881727431*1.5&&!(X2>X_end||Y2this.RowsInfo[Cell_pos.Row].Y[CurPageStart]+rowHSum)){var tLine={X1:X1_origin,X2:X2_origin,Y1:Y1,Y2:Y1,Color:"Grey",Bold:false};var lLine={X1:X1_origin,X2:X1_origin,Y1:Y1,Y2:Y2,Color:"Grey",Bold:false};var rLine={X1:X2_origin,X2:X2_origin,Y1:Y1,Y2:Y2,Color:"Grey",Bold:false};var bLine={X1:X1_origin,X2:X2_origin,Y1:Y2,Y2:Y2,Color:"Grey",Bold:false};borders.push(tLine,lLine,rLine,bLine)}else{var Line={X1:X1_origin,X2:X2_origin,Y1:Y1,Y2:Y2,Color:"Red",Bold:false};borders.push(Line)}return borders}}else if(drawMode=== false){if(X1>X2){var cache;cache=X2;X2=X1;X1=cache}if(Y1>Y2){var cache;cache=Y2;Y2=Y1;Y1=cache}var Rows=[];var Borders=[];this.Selection.Data=[];var SizeOfIndent=this.Pages[0].X;SizeOfIndent+=this.Pages[CurPageStart].X-this.Pages[CurPageStart].X-(this.Pages[0].X-this.Pages[CurPageStart].X);Rows=this.GetAffectedRows(X1,Y1,X2,Y2,CurPageStart,2);for(var curRow=0;curRowthis.GetRow(curRow).CellsInfo[curCell].X_cell_start||X1this.GetRow(curRow).CellsInfo[curCell].X_cell_end||X1>this.GetRow(curRow).CellsInfo[curCell].X_cell_start&& X2=0;curRow2--){var TempCell=this.GetCellByStartGridCol(curRow2,Grid_start);if(!TempCell)continue;var TempRow=this.GetRow(curRow2);var TempGrid_start=Row.Get_CellInfo(curCell).StartGridCol;var TempGrid_span=Cell.Get_GridSpan();var TempVMerge_count=this.Internal_GetVertMergeCount(TempRow.Index,TempGrid_start,TempGrid_span);var TempRowHSum=0;if(TempVMerge_count>=1)for(var Index=TempRow.Index;Index=TempCell.Metrics.X_cell_end){var Line={X1:TempCell.Metrics.X_cell_end+SizeOfIndent,X2:TempCell.Metrics.X_cell_end+SizeOfIndent,Y1:this.RowsInfo[TempCell.Row.Index].Y[CurPageStart],Y2:this.RowsInfo[TempCell.Row.Index].Y[CurPageStart]+TempRowHSum,Color:"Red",Bold:false};Borders.push(Line)}if(Y1<=this.RowsInfo[TempCell.Row.Index].Y[CurPageStart]&&Y2>this.RowsInfo[TempCell.Row.Index].Y[CurPageStart]){var Line= {X1:TempCell.Metrics.X_cell_start+SizeOfIndent,X2:TempCell.Metrics.X_cell_end+SizeOfIndent,Y1:this.RowsInfo[TempCell.Row.Index].Y[CurPageStart],Y2:this.RowsInfo[TempCell.Row.Index].Y[CurPageStart],Color:"Red",Bold:false};Borders.push(Line)}if(Y2>=this.RowsInfo[TempCell.Row.Index].Y[CurPageStart]+TempRowHSum&&Y1Y2){var cache=Y2;Y2=Y1;Y1=cache}if(X1>X2){var cache=X2;X2=X1;X1=cache}var Cell_pos=this.private_GetCellByXY(X1+this.Pages[CurPageStart].X,Y1,CurPageStart);var oRow=this.GetRow(Cell_pos.Row);var oCell=oRow.GetCell(Cell_pos.Cell);var oCellContent=oCell.GetContent();var nInnerPos=oCellContent.Internal_GetContentPosByXY(X1+this.Pages[CurPageStart].X,Y1,CurPageStart-oCellContent.Get_StartPage_Relative());var nInnerCount=oCellContent.GetElementsCount();while(!oCellContent.GetElement(nInnerPos).IsParagraph()){nInnerPos++; if(nInnerPos>=nInnerCount)return}var oParagraph=oCellContent.GetElement(nInnerPos);if(!oParagraph||!oParagraph.IsParagraph())return;oCellContent.CurPos.ContentPos=nInnerPos;oParagraph.MoveCursorToStartPos();var oCellInfo=oRow.GetCellInfo(Cell_pos.Cell);if(!oCellInfo)return;var X_start=oCellInfo.X_cell_start;var X_end=oCellInfo.X_cell_end;var Cell_width=X_end-X_start;var Grid_start=oCellInfo.StartGridCol;var Grid_span=oCell.GetGridSpan();var VMerge_count=this.Internal_GetVertMergeCount(Cell_pos.Row, Grid_start,Grid_span);var CellMar=oCell.GetMargins();var MinW=oRow.GetCellSpacing()+CellMar.Right.W+CellMar.Left.W;var rowHSum=0;if(VMerge_count>=1)for(var Index=Cell_pos.Row;IndexX_end||X1this.RowsInfo[Cell_pos.Row].Y[CurPageStart]+rowHSum)return;if(Cell_width>=MinW*1.5&&X2-X1>MinW*1.5&&rowHSum>=4.63864881727431*1.5&&Y2-Y1>=4.63864881727431*1.5){var oTable= oCellContent.AddInlineTable(1,1);if(oTable&&oTable.GetRowsCount()>0){oTable.Set_Inline(false);oTable.Set_PositionH(c_oAscHAnchor.Page,false,X1-X_start);oTable.Set_PositionV(c_oAscVAnchor.Page,false,Y1-this.RowsInfo[Cell_pos.Row].Y[CurPageStart]);oTable.GetRow(0).SetHeight(Math.abs(this.LogicDocument.DrawTableMode.EndY-this.LogicDocument.DrawTableMode.StartY),Asc.linerule_AtLeast);oTable.Set_TableW(tblwidth_Mm,Math.abs(this.LogicDocument.DrawTableMode.EndX-this.LogicDocument.DrawTableMode.StartX-(new CDocumentBorder).Size* 2));oTable.Set_Distance(3.2,undefined,3.2,undefined);oTable.MoveCursorToStartPos();oTable.Document_SetThisElementCurrent()}}};CTable.prototype.DrawBorderByClick=function(X1,Y1,CurPageStart){var SelectedCells=this.GetCellAndBorderByClick(X1,Y1,CurPageStart,true);var isVSelect=SelectedCells.isVSelect;var isHSelect=SelectedCells.isHSelect;var isRightBorder=SelectedCells.isRightBorder;var isLeftBorder=SelectedCells.isLeftBorder;var isTopBorder=SelectedCells.isTopBorder;var isBottomBorder=SelectedCells.isBottomBorder; if(SelectedCells.Cells.length===0)return false;else if(isRightBorder||isLeftBorder||isTopBorder||isBottomBorder||isVSelect||isHSelect)this.Selection.Data=SelectedCells.Cells;else return true;if(this.Selection.Data.length===1){var Cell_pos=this.Selection.Data[0];var Row=this.GetRow(Cell_pos.Row);var Cell=Row.Get_Cell(this.Selection.Data[0].Cell);if(isHSelect)if(isTopBorder)Cell.CheckNonEmptyBorder(0);else{if(isBottomBorder)Cell.CheckNonEmptyBorder(2)}else if(isVSelect)if(isRightBorder)Cell.CheckNonEmptyBorder(1); else if(isLeftBorder)Cell.CheckNonEmptyBorder(3)}else if(this.Selection.Data.length===2)if(isHSelect){var Cell_1_pos=this.Selection.Data[0];var Cell_2_pos=this.Selection.Data[1];var Row_1=this.GetRow(Cell_1_pos.Row);var Row_2=this.GetRow(Cell_2_pos.Row);var Cell_1=Row_1.Get_Cell(Cell_1_pos.Cell);var Cell_2=Row_2.Get_Cell(Cell_2_pos.Cell);var Grid_start_1=Row_1.Get_CellInfo(Cell_1_pos.Cell).StartGridCol;var Grid_span_1=Cell_1.Get_GridSpan();var VMerge_count_1=this.Internal_GetVertMergeCount(Cell_1_pos.Row, Grid_start_1,Grid_span_1);if(VMerge_count_1>1)Cell_1=this.GetCellByStartGridCol(Cell_1_pos.Row+VMerge_count_1-1,Grid_start_1);Cell_1.CheckNonEmptyBorder(2);Cell_2.CheckNonEmptyBorder(0)}else if(isVSelect){if(this.Selection.Data.length===1){var Cell=this.GetRow(this.Selection.Data[0].Row).Get_Cell(this.Selection.Data[0].Cell);Cell.Set_Border(border,3)}var Cell_1=this.GetRow(this.Selection.Data[0].Row).Get_Cell(this.Selection.Data[0].Cell);var Cell_2=this.GetRow(this.Selection.Data[1].Row).Get_Cell(this.Selection.Data[1].Cell); Cell_1.CheckNonEmptyBorder(1);Cell_2.CheckNonEmptyBorder(3)}};CTable.prototype.DeleteTablePart=function(X_Front,X_After,Y_Over,Y_Under,bCanMerge){if(X_Front&&X_After&&Y_Over&&Y_Under){for(var Index=0,rowsCount=this.GetRowsCount();Index=Cell_pos_1.Row&&Cell_pos_2.Row<=Cell_pos_1.Row+VMerge_count_1-1||Cell_pos_1.Row>=Cell_pos_2.Row&&Cell_pos_1.Row<=Cell_pos_2.Row+VMerge_count_2-1)){Cell_1.CheckEmptyBorder(1);Cell_2.CheckEmptyBorder(3);return true}else if(Grid_end_2===Grid_start_1-1&&(Cell_pos_1.Row>=Cell_pos_2.Row&&Cell_pos_1.Row<=Cell_pos_2.Row+VMerge_count_2-1||Cell_pos_2.Row>=Cell_pos_1.Row&& Cell_pos_2.Row<=Cell_pos_1.Row+VMerge_count_1-1)){Cell_1.CheckEmptyBorder(3);Cell_2.CheckEmptyBorder(1);return true}else if(Cell_pos_1.Row+VMerge_count_1-1===Cell_pos_2.Row-1){Cell_1.CheckEmptyBorder(2);Cell_2.CheckEmptyBorder(0);return true}else if(Cell_pos_2.Row+VMerge_count_2-1===Cell_pos_1.Row-1){Cell_1.CheckEmptyBorder(0);Cell_2.CheckEmptyBorder(2);return true}return false};CTable.prototype.VertSplitCells=function(X,RowsIndices){var CellAdded=false;for(var curRow=0;curRow1.5&&this.GetRow(curRow).CellsInfo[curCell].X_cell_end-X>1.5){if(RowsIndices.indexOf(curRow)!=-1){CellAdded=true;var Row=this.GetRow(curRow);var Cell=Row.Get_Cell(curCell);var X_start=Row.CellsInfo[curCell].X_grid_start;var X_end=Row.CellsInfo[curCell].X_grid_end;var Cell_pos={Cell:curCell,Row:curRow};var Grid_start=Row.Get_CellInfo(Cell_pos.Cell).StartGridCol;var Grid_span=Cell.Get_GridSpan(); var VMerge_count=this.Internal_GetVertMergeCount(Cell_pos.Row,Grid_start,Grid_span);var Cells=[];var Cells_pos=[];var Rows_=[];for(var Index=0;Index1)curRow+=VMerge_count-1;break}}else if(RowsIndices.indexOf(curRow)!=-1){var Cell=this.GetRow(curRow).Get_Cell(curCell);if(Math.abs(X-this.GetRow(curRow).CellsInfo[curCell].X_cell_start)<1.5)Cell.CheckNonEmptyBorder(3);else if(Math.abs(this.GetRow(curRow).CellsInfo[curCell].X_cell_end- X)<1.5)Cell.CheckNonEmptyBorder(1)}return CellAdded};CTable.prototype.HorSplitCells=function(Y,RowIndex,CellsIndexes,CurPageStart){var CallAdded=false;for(var curCell=0;curCell1)if(Math.abs(this.RowsInfo[RowIndex].Y[CurPageStart]-Y)<=1.5){var TempRow=this.GetRow(Cell_pos.Row);var TempCell=TempRow.Get_Cell(Cell_pos.Cell);TempCell.SetVMerge(vmerge_Restart)}else{if(Math.abs(this.RowsInfo[RowIndex].Y[CurPageStart]+this.RowsInfo[RowIndex].H[CurPageStart]-Y)<=1.5)if(RowIndex!=this.Get_RowsCount()-1){var TempRow=this.GetRow(Cell_pos.Row+1);var TempCell= this.GetCellByStartGridCol(TempRow.GetIndex(),Grid_start);TempCell.SetVMerge(vmerge_Restart)}}else if(Math.abs(this.RowsInfo[RowIndex].Y[CurPageStart]-Y)<=1.5){var TempRow=this.GetRow(Cell_pos.Row);var TempCell=TempRow.Get_Cell(Cell_pos.Cell);TempCell.CheckNonEmptyBorder(0);if(TempCell.GetVMerge()===2)TempCell.SetVMerge(vmerge_Restart);else continue}else if(Math.abs(this.RowsInfo[RowIndex].Y[CurPageStart]+this.RowsInfo[RowIndex].H[CurPageStart]-Y)<=1.5){var TempRow=this.GetRow(Cell_pos.Row);var TempCell= TempRow.Get_Cell(Cell_pos.Cell);TempCell.CheckNonEmptyBorder(2);continue}}if(Math.abs(this.RowsInfo[RowIndex].Y[CurPageStart]-Y)>=1.5&&Math.abs(this.RowsInfo[RowIndex].Y[CurPageStart]+this.RowsInfo[RowIndex].H[CurPageStart]-Y)>=1.5){var Cell=this.GetRow(RowIndex).Get_Cell(CellsIndexes[0]);var Cell_pos={Cell:CellsIndexes[0],Row:RowIndex};var Row=this.GetRow(Cell_pos.Row);var Grid_start=Row.Get_CellInfo(Cell_pos.Cell).StartGridCol;var Grid_span=Cell.Get_GridSpan();var VMerge_count=this.Internal_GetVertMergeCount(Cell_pos.Row, Grid_start,Grid_span);var Cells=[];var Cells_pos=[];var Rows_=[];Rows_[0]=Row;Cells[0]=Cell;Cells_pos[0]=Cell_pos;var Border_Height=this.GetBottomTableBorder().Size;var rowHeight_1=Y-this.RowsInfo[Cell_pos.Row].Y[CurPageStart]-Border_Height;var rowHeight_2=this.RowsInfo[Cell_pos.Row].Y[CurPageStart]+this.RowsInfo[Cell_pos.Row].H[CurPageStart]-Y-Border_Height;var CellsCount=Row.Get_CellsCount();var NewRow=this.private_AddRow(Cell_pos.Row+1,CellsCount);NewRow.Copy_Pr(Row.Pr);Row.Set_Height(rowHeight_1, linerule_AtLeast);NewRow.Set_Height(rowHeight_2,linerule_AtLeast);Rows_[1]=NewRow;Cells[1]=null;Cells_pos[1]=null;for(var CurCell=0;CurCell1){for(var Item=0;Itemb.Row)return 1;if(a.Rowb.Cell&&a.Row===b.Row)return 1;if(a.Cell=1)for(var Index=curRow;Index=1)for(var Index2=curRow2;Index2this.GetRow(Rows[Index]).CellsInfo[curCell].X_cell_start&&X1=0;curRowIndex--){var ViewCell=this.GetCellByStartGridCol(curRowIndex,Grid_start);if(ViewCell&&ViewCell.GetVMerge()===1){StartRow=curRowIndex;isFind=true;break}}if(isFind)break}else{StartRow=Index;break}}for(var Index=CellsIndexes.length;Index>=0;Index--)if(CellsIndexes[Index]!==undefined){var curCell=this.GetRow(Index).GetCell(CellsIndexes[Index]);var VMergeCount= this.GetVMergeCount(curCell.GetIndex(),Index);if(VMergeCount>1){EndRow=Index+VMergeCount-1;break}else{EndRow=Index;break}}Rows=[];for(var Index=StartRow;Index<=EndRow;Index++)Rows.push(Index);return Rows}else if(typeOfDrawing===1){for(var curRow=0;curRowthis.RowsInfo[curRow].Y[CurPageStart]&&Y1 X2){var cache;cache=X2;X2=X1;X1=cache}if(Y1>Y2){var cache;cache=Y2;Y2=Y1;Y1=cache}var Rows=this.GetAffectedRows(X1,Y1,X2,Y2,CurPageStart,2);var SelectionData=[];if(Rows.length===0)return SelectionData;for(var curRow=0;curRowthis.GetRow(curRow).CellsInfo[curCell].X_cell_start||X1this.GetRow(curRow).CellsInfo[curCell].X_cell_end||X1>this.GetRow(curRow).CellsInfo[curCell].X_cell_start&&X2=0;curRow2--){if(check)break;var TempCell=this.GetCellByStartGridCol(curRow2,Grid_start);if(TempCell)if(TempCell.GetVMerge()===1){var cell_pos={Cell:TempCell.GetIndex(),Row:curRow2}; for(var Index=0;Index 1.5&&this.GetRow(curRow).CellsInfo[curCell].X_cell_end-X>1.5)if(RowsIndices.indexOf(curRow)!=-1){var Row=this.GetRow(curRow);var Cell=Row.Get_Cell(curCell);var X_start=Row.CellsInfo[curCell].X_cell_start;var X_end=Row.CellsInfo[curCell].X_cell_end;var Grid_start=Row.Get_CellInfo(curCell).StartGridCol;var Grid_span=Cell.Get_GridSpan();var VMerge_count=this.Internal_GetVertMergeCount(curRow,Grid_start,Grid_span);var NarrowCell=false;var Span_width=X_end-X_start;var Grid_width_1=X-X_start;var Grid_width_2= X_end-X;var CellSpacing=Row.Get_CellSpacing();var CellMar=Cell.GetMargins();var MinW=CellSpacing+CellMar.Right.W+CellMar.Left.W;for(var Index=0;Index0&&Grid_width_2>0)if(Grid_width_1=1&&Grid_start===this.GetRow(curRow).Get_Before().GridBefore){var cell_Indent={W:X_end-Span_width,Type:-1,Grid_span:1};cellsInfo[cellsInfo.length]= cell_Indent}var cell_1={W:Grid_width_1,Type:0,GridSpan:1};var cell_2={W:Grid_width_2,Type:0,GridSpan:1};if(cell_1.W!=0)cellsInfo[cellsInfo.length]=cell_1;if(cell_2.W!=0)cellsInfo[cellsInfo.length]=cell_2;if(NarrowCell&&Cell.GetVMerge()!==2)for(var Index=curCell+1;Index=1&&Grid_start===this.GetRow(curRow).Get_Before().GridBefore){var cell_Indent={W:X_end-cellWidth,Type:-1,Grid_span:1};cellsInfo[cellsInfo.length]=cell_Indent}var cell={W:cellWidth,Type:0,GridSpan:1};cellsInfo[cellsInfo.length]=cell}else{var X_start=this.GetRow(curRow).CellsInfo[curCell].X_cell_start;var X_end=this.GetRow(curRow).CellsInfo[curCell].X_cell_end;var cellWidth= X_end-X_start;var Grid_start=this.GetRow(curRow).Get_CellInfo(curCell).StartGridCol;var Row=this.GetRow(curRow);var Cell=Row.Get_Cell(curCell);if(this.GetRow(curRow).Get_Before().GridBefore>=1&&Grid_start===this.GetRow(curRow).Get_Before().GridBefore){var cell_Indent={W:X_end-cellWidth,Type:-1,Grid_span:1};cellsInfo[cellsInfo.length]=cell_Indent}var cell={W:cellWidth,Type:0,GridSpan:1};cellsInfo[cellsInfo.length]=cell}rowsInfo[curRow]=cellsInfo}}return rowsInfo};CTable.prototype.Update_TableMarkupFromRuler= function(NewMarkup,bCol,Index){var TablePr=this.Get_CompiledPr(false).TablePr;if(true===bCol){var RowIndex=NewMarkup.Internal.RowIndex;var Row=this.Content[RowIndex];var Col=0;var Dx=0;if(Index===NewMarkup.Cols.length){Col=Row.Get_CellInfo(Index-1).StartGridCol+Row.Get_Cell(Index-1).Get_GridSpan();Dx=NewMarkup.Cols[Index-1]-this.Markup.Cols[Index-1]}else{Col=Row.Get_CellInfo(Index).StartGridCol;if(0!=Index)Dx=NewMarkup.Cols[Index-1]-this.Markup.Cols[Index-1];else Dx=NewMarkup.X-this.Markup.X}if(0=== Dx)return;if(0===Col){Dx=this.Markup.X-NewMarkup.X;this.X_origin-=Dx;if(true===this.Is_Inline()){this.Set_TableAlign(align_Left);this.Set_TableInd(TablePr.TableInd-Dx);this.private_SetTableLayoutFixedAndUpdateCellsWidth(-1);this.SetTableGrid(this.private_CopyTableGridCalc())}else this.Internal_UpdateFlowPosition(this.X_origin,this.Y)}else{var GridSpan=1;if(Dx>0){if(Index!=NewMarkup.Cols.length){var Cell=Row.Get_Cell(Index);GridSpan=Cell.Get_GridSpan()}else{var GridAfter=Row.Get_After().GridAfter; GridSpan=GridAfter}this.TableGridCalc[Col-1]=this.TableGridCalc[Col-1]+Dx;this.Internal_UpdateCellW(Col-1);this.private_SetTableLayoutFixedAndUpdateCellsWidth(Col-1);this.SetTableGrid(this.private_CopyTableGridCalc())}else{if(0!=Index){var Cell=Row.Get_Cell(Index-1);GridSpan=Cell.Get_GridSpan()}else{var GridBefore=Row.Get_Before().GridBefore;GridSpan=GridBefore}if(1===GridSpan||-Dx0)if(Before_Info.GridBefore>=Col){var W=Math.max(0,this.TableSumGrid[Before_Info.GridBefore-1]+Dx);if(W>.001)Rows_info[CurRow].push({W:W,Type:-1,GridSpan:1})}else Rows_info[CurRow].push({W:this.TableSumGrid[Before_Info.GridBefore- 1],Type:-1,GridSpan:1});var CellsCount=Row.Get_CellsCount();for(var CurCell=0;CurCell=Col-1){var W=this.TableSumGrid[Cur_Grid_end]-this.TableSumGrid[Cur_Grid_start-1]+Dx;W=Math.max(1,Math.max(W,CellMargins.Left.W+CellMargins.Right.W));Rows_info[CurRow].push({W:W, Type:0,GridSpan:1})}else{var W=this.TableSumGrid[Cur_Grid_end]-this.TableSumGrid[Cur_Grid_start-1];W=Math.max(1,Math.max(W,CellMargins.Left.W+CellMargins.Right.W));Rows_info[CurRow].push({W:W,Type:0,GridSpan:1})}}}this.Internal_CreateNewGrid(Rows_info)}}this.private_RecalculateGrid()}if(0!==Index&&undefined!==TablePr.TableW&&TablePr.TableW.Type!==tblwidth_Auto){var nTableW=0;for(var nCurCol=0,nColsCount=this.TableGrid.length;nCurCol0&&0===Index);else{var NewH=NewMarkup.Rows[Index-1].H;this.Content[RowIndex-1].Set_Height(NewH,linerule_AtLeast)}}if(this.LogicDocument){this.LogicDocument.Recalculate();this.LogicDocument.UpdateSelection()}};CTable.prototype.DistributeTableCells=function(isHorizontally){if(isHorizontally)return this.DistributeColumns();else return this.DistributeRows()};CTable.prototype.RemoveTableCells= function(){var bApplyToInnerTable=false;if(false===this.Selection.Use||true===this.Selection.Use&&table_Selection_Text===this.Selection.Type)bApplyToInnerTable=this.CurCell.Content.RemoveTableColumn();if(true===bApplyToInnerTable)return true;var arrSelectedCells=this.GetSelectionArray(true);var arrDeleteInfo=[];var arrRowsInfo=[];var oDeletedFirstCellPos=null;for(var nCurRow=0,nRowsCount=this.GetRowsCount();nCurRow0)arrRowsInfo[nCurRow].push({W:this.TableSumGrid[oBeforeInfo.Grid-1],Type:-1,GridSpan:1});for(var nCurCell=0,nCellsCount=oRow.GetCellsCount();nCurCell=0;--nIndex){var nCurCell=arrDeleteInfo[nCurRow][nIndex];oRow.RemoveCell(nCurCell)}}for(var nCurRow=this.GetRowsCount()-1;nCurRow>=0;--nCurRow){var isRemove=true;for(var nIndex=0;nIndex=0;--nCurRow){var isRemove=true;var oRow=this.GetRow(nCurRow);for(var nCurCell=0,nCellsCount=oRow.GetCellsCount();nCurCell=this.GetRowsCount())nCurRow=this.GetRowsCount()-1;else nCurCell=Math.min(oDeletedFirstCellPos.Cell, this.GetRow(nCurRow).GetCellsCount()-1);var oRow=this.GetRow(nCurRow);this.CurCell=oRow.GetCell(nCurCell);this.CurCell.Content.MoveCursorToStartPos();this.Markup.Internal.RowIndex=nCurRow;this.Markup.Internal.CellIndex=nCurCell;this.Markup.Internal.PageNum=0;this.Selection.Use=false;this.Selection.Start=false;this.Selection.StartPos.Pos={Row:nCurRow,Cell:nCurCell};this.Selection.EndPos.Pos={Row:nCurRow,Cell:nCurCell};this.Selection.CurRow=nCurRow;this.private_RecalculateGrid();return true};CTable.prototype.Internal_Recalculate_1= function(){return editor.WordControl.m_oLogicDocument.Recalculate()};CTable.prototype.Internal_RecalculateFrom=function(RowIndex,CellIndex,bChange,bForceRecalc){return editor.WordControl.m_oLogicDocument.Recalculate()};CTable.prototype.private_GetCellByXY=function(X,Y,PageIndex){var CurGrid=0;var CurPage=Math.min(this.Pages.length-1,Math.max(0,PageIndex));var Page=this.Pages[CurPage];var ColsCount=this.TableGridCalc.length;var twX=AscCommon.MMToTwips(X);var twPageX=AscCommon.MMToTwips(Page.X);if(twX>= twPageX)for(CurGrid=0;CurGrid=ColsCount)CurGrid=ColsCount-1;var PNum=PageIndex;var Row_start,Row_last;if(PNum<0){Row_start=0;Row_last=0}else if(PNum>=this.Pages.length){Row_start=this.Content.length-1;Row_last=this.Content.length-1}else{Row_start=this.Pages[PNum].FirstRow;Row_last=this.Pages[PNum].LastRow}if(Row_last< Row_start)return{Row:0,Cell:0};for(var CurRow=Row_start;CurRow<=Row_last;CurRow++){var Row=this.Content[CurRow];var CellsCount=Row.Get_CellsCount();var BeforeInfo=Row.Get_Before();var CurGridCol=BeforeInfo.GridBefore;for(var CurCell=0;CurCell=CurGridCol&&CurGrid=Row_last))if(vmerge_Continue===Vmerge&&Row_start===CurRow){Cell=this.Internal_Get_StartMergedCell(CurRow,CurGridCol,GridSpan);if(null!=Cell)return{Row:Cell.Row.Index, Cell:Cell.Index};else return{Row:0,Cell:0}}else return{Row:CurRow,Cell:CurCell};CurGridCol+=GridSpan}}return{Row:0,Cell:0}};CTable.prototype.Internal_GetVertMergeCount=function(StartRow,StartGridCol,GridSpan){var VmergeCount=1;for(var Index=StartRow+1;Index=StartGridCol)break;CurGridCol+=CellGridSpan;CurCell++}if(false===bWasMerged)break}return VmergeCount};CTable.prototype.Internal_GetVertMergeCount2= function(StartRow,StartGridCol,GridSpan){var VmergeCount=1;var Start_Row=this.Content[StartRow];var Start_VMerge=vmerge_Restart;var Start_CellsCount=Start_Row.Get_CellsCount();for(var Index=0;Index=0;Index--){var Row=this.Content[Index]; var BeforeInfo=Row.Get_Before();var CurGridCol=BeforeInfo.GridBefore;var CurCell=0;var CellsCount=Row.Get_CellsCount();var bWasMerged=false;while(CurGridCol<=StartGridCol&&CurCell=StartGridCol)break;CurGridCol+=CellGridSpan;CurCell++}if(false===bWasMerged)break}return VmergeCount};CTable.prototype.Internal_Check_TableRows=function(bSaveHeight){var Rows_to_Delete=[];var Rows_to_CalcH=[];var Rows_to_CalcH2=[];for(var CurRow=0;CurRow0||Row.Get_After().GridAfter>0)bNeedCalcHeight=true;for(var CurCell=0;CurCell1)bVmerge_Restart=true;bNeedDeleteRow=false;if(true===bNeedCalcHeight)if(1===VMergeCount)bNeedCalcHeight=false}else bVmerge_Continue= true}if(true===bVmerge_Continue&&true===bVmerge_Restart)Rows_to_CalcH2.push(CurRow);else if(true===bNeedCalcHeight)Rows_to_CalcH.push(CurRow);if(true===bNeedDeleteRow)Rows_to_Delete.push(CurRow)}for(var Index=0;IndexOldHeight.Value)this.Content[RowIndex].Set_Height(MinHeight,linerule_AtLeast)}if(Rows_to_Delete.length<=0)return false;if(true===bSaveHeight){for(var nIndex=0,nCount=Rows_to_CalcH.length;nIndex=0;Index--){var Row_to_Delete=Rows_to_Delete[Index];this.private_RemoveRow(Row_to_Delete)}return true};CTable.prototype.private_RemoveRow=function(nIndex){if(nIndex>= this.Content.length||nIndex<0)return;this.Content[nIndex].PreDelete();History.Add(new CChangesTableRemoveRow(this,nIndex,[this.Content[nIndex]]));this.Rows--;this.Content.splice(nIndex,1);this.TableRowsBottom.splice(nIndex,1);this.RowsInfo.splice(nIndex,1);this.Internal_ReIndexing(nIndex);this.private_CheckCurCell();this.private_UpdateTableGrid()};CTable.prototype.private_AddRow=function(Index,CellsCount,bReIndexing,_NewRow){if(Index<0)Index=0;if(Index>=this.Content.length)Index=this.Content.length; this.Rows++;var NewRow=undefined===_NewRow?new CTableRow(this,CellsCount):_NewRow;History.Add(new CChangesTableAddRow(this,Index,[NewRow]));this.Content.splice(Index,0,NewRow);this.TableRowsBottom.splice(Index,0,{});this.RowsInfo.splice(Index,0,new CTableRowsInfo);if(true===bReIndexing)this.Internal_ReIndexing(Index);else{if(Index>0){this.Content[Index-1].Next=NewRow;NewRow.Prev=this.Content[Index-1]}else NewRow.Prev=null;if(Index0?this.Content[Ind-1]:null;this.Content[Ind].Next=Ind0)Row.Set_Before(RowInfo[0].GridSpan);CurIndex++}else Row.Set_Before(0);for(var CurCell=0;CurIndex0)arrRowsInfo[nCurRow].push({W:this.TableSumGrid[oBeforeInfo.Grid-1],Type:-1,GridSpan:1});for(var nCurCell=0,nCellsCount=oRow.GetCellsCount();nCurCellarrRowsInfo[nRowIndex].length)return false;arrRowsInfo[nRowIndex].splice(nPos,0,{W:nW,Type:0,GridSpan:1});return true};CTable.prototype.Internal_UpdateCellW=function(Col){for(var CurRow=0;CurRow=CurGridCol&&ColW_b_2)return oBorder1;else if(W_b_2>W_b_1)return oBorder2;var Brightness_1_1=oBorder1.Color.r+oBorder1.Color.b+2*oBorder1.Color.g;var Brightness_1_2=oBorder2.Color.r+oBorder2.Color.b+2* oBorder2.Color.g;if(Brightness_1_1=0;Index--){var Row=this.Content[Index];var BeforeInfo=Row.Get_Before();var CurGridCol=BeforeInfo.GridBefore;var CurCell=0;var CellsCount=Row.Get_CellsCount();var bWasMerged=false;while(CurGridCol<=StartGridCol&&CurCell=StartGridCol)break;CurGridCol+=CellGridSpan;CurCell++}if(false===bWasMerged)break}return Result};CTable.prototype.Internal_Get_EndMergedCell=function(StartRow,StartGridCol,GridSpan){var Result=null;for(var Index=StartRow, Count=this.Content.length;Index=StartGridCol)break;CurGridCol+=CellGridSpan;CurCell++}if(false===bWasMerged)break}return Result};CTable.prototype.private_GetMergedCells=function(RowIndex,StartGridCol,GridSpan){var Row=this.Content[RowIndex];var CellIndex=this.private_GetCellIndexByStartGridCol(RowIndex,StartGridCol);if(-1===CellIndex)return[];var Cell=Row.Get_Cell(CellIndex);if(GridSpan!==Cell.Get_GridSpan())return[];var CellsArray=[Cell];for(var Index=RowIndex- 1;Index>=0;Index--){var CellIndex=this.private_GetCellIndexByStartGridCol(Index,StartGridCol);if(-1===CellIndex)break;var Cell=this.Content[Index].Get_Cell(CellIndex);if(GridSpan!==Cell.Get_GridSpan())break;var Vmerge=Cell.GetVMerge();if(vmerge_Continue!==Vmerge)break;CellsArray.splice(0,0,Cell)}for(var Index=RowIndex+1,Count=this.Content.length;IndexnStartGridCol)return nCurCell-1;var oCell=oRow.GetCell(nCurCell);nCurGridCol+=oCell.GetGridSpan()}return oRow.GetCellsCount()- 1}else for(var nCurCell=0,nCellsCount=oRow.GetCellsCount();nCurCellnStartGridCol)return-1;var oCell=oRow.GetCell(nCurCell);nCurGridCol+=oCell.GetGridSpan()}return-1};CTable.prototype.GetCellByStartGridCol=function(nCurRow,nStartGridCol){var oRow=this.GetRow(nCurRow);if(!oRow)return null;var nCurCell=this.private_GetCellIndexByStartGridCol(nCurRow,nStartGridCol,false);if(-1===nCurCell)return null;var oCell= oRow.GetCell(nCurCell);return oCell?oCell:null};CTable.prototype.private_UpdateTableGrid=function(){this.RecalcInfo.TableGrid=true};CTable.prototype.private_UpdateTableMarkup=function(nRowIndex,nCellIndex,nCurPage){this.Markup.Internal={RowIndex:nRowIndex,CellIndex:nCellIndex,PageNum:nCurPage};var oPage=this.Pages[nCurPage];if(!oPage||!this.IsRecalculated())return;this.Markup.X=oPage.X;var oRow=this.GetRow(nRowIndex);var nCellSpacing=null===oRow.GetCellSpacing()?0:oRow.GetCellSpacing();var nCellsCount= oRow.GetCellsCount();var nGridBefore=oRow.GetBefore().Grid;this.Markup.X+=this.TableSumGrid[nGridBefore-1];this.Markup.Cols=[];this.Markup.Margins=[];for(var nCurCell=0;nCurCell=Y_cell_start-nRadius)oResult.Border=0;else if(Y<=Y_cell_end+ nRadius&&Y>=Y_cell_end-nRadius)if(nVMergeCountOnPage!==nVMergeCount)oResult.Border=-1;else{oResult.Border=2;oResult.Row=nCurRow+nVMergeCount-1}else if(X<=X_cell_start+nRadius&&X>=X_cell_start-nRadius)oResult.Border=3;else if(X<=X_cell_end+nRadius&&X>=X_cell_end-nRadius)oResult.Border=1;if(0===nCurCell&&X<=X_cell_start){oResult.RowSelection=true;oResult.Border=-1}else if(0===nCurRow&&Y<=Y_cell_start+nRadius){oResult.ColumnSelection=true;oResult.Border=-1}else if(X_cell_start+nRadius<=X&&X<=X_cell_end){var oLeftMargin= oCell.GetMargins().Left;var nCellSpacing=oRow.GetCellSpacing();var nSpacingShift=null===nCellSpacing?0:nCellSpacing/2;if(X<=X_cell_start+nSpacingShift+oLeftMargin.W){oResult.CellSelection=true;oResult.Border=-1}}return oResult};CTable.prototype.private_UpdateSelectedCellsArray=function(bForceSelectByLines){if(undefined===bForceSelectByLines)bForceSelectByLines=false;this.Selection.Type=table_Selection_Cell;var arrSelectionData=[];if(this.Parent.IsSelectedSingleElement()&&false===bForceSelectByLines){var StartRow= this.Selection.StartPos.Pos.Row;var StartCell=this.Selection.StartPos.Pos.Cell;var EndRow=this.Selection.EndPos.Pos.Row;var EndCell=this.Selection.EndPos.Pos.Cell;if(EndRow0&&GridCol_end>GridCol_start)if(this.TableSumGrid[GridCol_end]- this.TableSumGrid[GridCol_end-1]= GridCol_start&&nCurGridCol<=GridCol_end||nCurGridCol+nGridSpan-1>=GridCol_start&&nCurGridCol+nGridSpan-1<=GridCol_end||nCurGridCol<=GridCol_start&&GridCol_end<=nCurGridCol+nGridSpan-1)arrSelectionData.push({Row:nCurRow,Cell:nCurCell});nCurGridCol+=nGridSpan}}}}else{var nRowsCount=this.GetRowsCount();var nStartRow=Math.min(Math.max(0,this.Selection.StartPos.Pos.Row),nRowsCount-1);var nEndRow=Math.min(Math.max(0,this.Selection.EndPos.Pos.Row),nRowsCount-1);if(nEndRow1)this.Selection.CurRow=arrSelectionData[arrSelectionData.length-1].Row;this.private_SetSelectionData(arrSelectionData)};CTable.prototype.private_SetSelectionData= function(oData){if(!this.Selection.Data&&!oData){this.Selection.Data=null;return}if(!this.Selection.Data){this.Selection.Data=oData;return this.private_UpdateSelectionInCells()}if(!oData){this.Selection.Data=null;return this.private_RemoveSelectionInCells()}var arrOldSelectionData=this.Selection.Data;this.Selection.Data=oData;var arrFlags=[];for(var nIndex=0,nCount=arrOldSelectionData.length;nIndex0&&CurrentW>.001){var Koef=TableW/CurrentW;var TableGrid_cur=[];for(var Index=0;Index0){Pos.Cell=Cell_Index-1;return this.Content[Pos.Row].Get_Cell(Pos.Cell)}else if(Row_Index>0){Pos.Row=Row_Index-1;Pos.Cell=this.Content[Row_Index-1].Get_CellsCount()-1;return this.Content[Pos.Row].Get_Cell(Pos.Cell)}else return null};CTable.prototype.Internal_Copy_Grid=function(Grid){if(undefined!== Grid&&null!==Grid){var Count=Grid.length;var NewGrid=new Array(Count);var Index=0;for(;Index=this.Pages[CurPage].LastRow){VMergeCount=this.Pages[CurPage].LastRow+1-CurRow;if(false===this.RowsInfo[CurRow+VMergeCount-1].FirstPage&&CurPage===this.RowsInfo[CurRow+VMergeCount-1].StartPage)VMergeCount--}return VMergeCount};CTable.prototype.GetSelectedRowsRange=function(){var arrSelectedCells=this.GetSelectionArray();var nStartRow=-1,nEndRow=-2;for(var nIndex=0,nCount=arrSelectedCells.length;nIndexnRowIndex)nStartRow=nRowIndex;if(-1===nEndRow||nEndRow0){var Pos=SelectionArray[0];var Cell=this.Content[Pos.Row].Get_Cell(Pos.Cell);return Cell.Content.GetStyleFromFormatting()}return null};CTable.prototype.SetReviewType=function(ReviewType){};CTable.prototype.GetReviewType=function(){return reviewtype_Common};CTable.prototype.Get_SectPr= function(){if(this.Parent&&this.Parent.Get_SectPr){this.Parent.Update_ContentIndexing();return this.Parent.Get_SectPr(this.Index)}return null};CTable.prototype.IsSelectedAll=function(){if(!this.IsCellSelection())return false;var nArrayPos=0;var arrSelectionArray=this.Selection.Data;for(var nCurRow=0,nRowsCount=this.GetRowsCount();nCurRow= arrSelectionArray.length)return false;var oPos=arrSelectionArray[nArrayPos];if(oPos.Row!==nCurRow||oPos.Cell!==nCurCell)return false}}return true};CTable.prototype.AcceptRevisionChanges=function(nType,bAll){var arrSelectionArray=this.GetSelectionArray();var nFirstRow=arrSelectionArray.length>0?arrSelectionArray[0].Row:0;var isCellSelection=this.IsCellSelection();var isAllSelected=this.IsSelectedAll();if(bAll){nFirstRow=0;arrSelectionArray=[];for(var nCurRow=0,nRowsCount=this.GetRowsCount();nCurRow< nRowsCount;++nCurRow){var oRow=this.GetRow(nCurRow);for(var nCurCell=0,nCellsCount=oRow.GetCellsCount();nCurCell=0;--nIndex){var nCurRow=arrSelectionArray[nIndex].Row;if(arrSelectedRows.length<=0||arrSelectedRows[arrSelectedRows.length-1]>nCurRow)arrSelectedRows.push(nCurRow)}for(var nSelectedRowIndex=0,nSelectedRowsCount=arrSelectedRows.length;nSelectedRowIndex=0;--nIndex)if(arrSelectionArray[nIndex].Row===nCurRow)arrSelectionArray.splice(nIndex,1);else if(arrSelectionArray[nIndex].Row>nCurRow)arrSelectionArray[nIndex].Row--}}}if(this.GetRowsCount()<= 0)return;if(arrSelectionArray.length<=0){this.RemoveSelection();var nCurRow=nFirstRow0?arrSelectionArray[0].Row:0;var isCellSelection=this.IsCellSelection();var isAllSelected=this.IsSelectedAll();if(bAll){nFirstRow=0;arrSelectionArray=[];for(var nCurRow=0,nRowsCount=this.GetRowsCount();nCurRow=0;--nIndex){var nCurRow=arrSelectionArray[nIndex].Row;if(arrSelectedRows.length<= 0||arrSelectedRows[arrSelectedRows.length-1]>nCurRow)arrSelectedRows.push(nCurRow)}for(var nSelectedRowIndex=0,nSelectedRowsCount=arrSelectedRows.length;nSelectedRowIndex=0;--nIndex)if(arrSelectionArray[nIndex].Row===nCurRow)arrSelectionArray.splice(nIndex,1);else if(arrSelectionArray[nIndex].Row>nCurRow)arrSelectionArray[nIndex].Row--}else if(reviewtype_Remove===nRowReviewType&&(undefined===nType||c_oAscRevisionsChangeType.RowsRem===nType))oRow.SetReviewType(reviewtype_Common)}}if(this.GetRowsCount()<=0)return;if(arrSelectionArray.length<=0){this.RemoveSelection();var nCurRow=nFirstRow0){oSearchEngine.SetFoundedElement(this);if(true===oSearchEngine.IsFound())return}var nCurCell=0,nCurRow=0;if(!oSearchEngine.IsCurrentFound()){var arrSelectedCells=this.GetSelectionArray();if(arrSelectedCells.length<=0)return;nCurRow=arrSelectedCells[0].Row;nCurCell=arrSelectedCells[0].Cell}else if(oSearchEngine.GetDirection()>0){nCurRow=0;nCurCell=0}else{nCurRow=this.GetRowsCount()-1;nCurCell=this.GetRow(nCurRow).GetCellsCount()- 1}var oCell=this.GetRow(nCurRow).GetCell(nCurCell);while(oCell&&vmerge_Restart!==oCell.GetVMerge())oCell=this.private_GetPrevCell(nCurRow,nCurCell);oCell.GetContent().GetRevisionsChangeElement(oSearchEngine);while(!oSearchEngine.IsFound()){if(oSearchEngine.GetDirection()>0){oCell=this.private_GetNextCell(oCell.GetRow().GetIndex(),oCell.GetIndex());while(oCell&&vmerge_Restart!==oCell.GetVMerge())oCell=this.private_GetNextCell(oCell.GetRow().GetIndex(),oCell.GetIndex())}else{oCell=this.private_GetPrevCell(oCell.GetRow().GetIndex(), oCell.GetIndex());while(oCell&&vmerge_Restart!==oCell.GetVMerge())oCell=this.private_GetPrevCell(oCell.GetRow().GetIndex(),oCell.GetIndex())}if(!oCell)break;oCell.GetContent().GetRevisionsChangeElement(oSearchEngine)}if(!oSearchEngine.IsFound()&&oSearchEngine.GetDirection()<0)oSearchEngine.SetFoundedElement(this)};CTable.prototype.private_GetNextCell=function(RowIndex,CellIndex){return this.Internal_Get_NextCell({Cell:CellIndex,Row:RowIndex})};CTable.prototype.private_GetPrevCell=function(RowIndex, CellIndex){return this.Internal_Get_PrevCell({Cell:CellIndex,Row:RowIndex})};CTable.prototype.Check_ChangedTableGrid=function(){var TableGrid_old=this.Internal_Copy_Grid(this.TableGridCalc);this.private_RecalculateGrid();var TableGrid_new=this.TableGridCalc;for(var CurCol=0,ColsCount=this.TableGridCalc.length;CurCol.001){this.RecalcInfo.TableBorders=true;return true}return false};CTable.prototype.GetContentPosition=function(bSelection, bStart,PosArray){if(!PosArray)PosArray=[];var CurRow=true===bSelection?true===bStart?this.Selection.StartPos.Pos.Row:this.Selection.EndPos.Pos.Row:this.CurCell.Row.Index;var CurCell=true===bSelection?true===bStart?this.Selection.StartPos.Pos.Cell:this.Selection.EndPos.Pos.Cell:this.CurCell.Index;var Row=this.Get_Row(CurRow);PosArray.push({Class:this,Position:CurRow,Type:this.Selection.Type,Type2:this.Selection.Type2});PosArray.push({Class:this.Get_Row(CurRow),Position:CurCell});if(Row&&CurCell>=0&& CurCell0){StartRow--;_StartDocPos=null;_StartFlag=-1}else return;var _EndDocPos=EndDocPos,_EndFlag=EndFlag;if(null!==EndDocPos&&true===EndDocPos[Depth].Deleted)if(EndRow0){EndRow--;_EndDocPos=null;_EndFlag=-1}else return;var StartCell=0;switch(_StartFlag){case 0:StartCell=_StartDocPos[Depth+1].Position;break;case 1:StartCell=0;break;case -1:StartCell=this.Content[StartRow].Get_CellsCount()-1;break}var EndCell= 0;switch(_EndFlag){case 0:EndCell=_EndDocPos[Depth+1].Position;break;case 1:EndCell=0;break;case -1:EndCell=this.Content[EndRow].Get_CellsCount()-1;break}var __StartDocPos=_StartDocPos,__StartFlag=_StartFlag;if(null!==_StartDocPos&&true===_StartDocPos[Depth+1].Deleted)if(StartCell0){StartCell--;__StartDocPos=null;__StartFlag=-1}else return;var __EndDocPos=_EndDocPos,__EndFlag=_EndFlag;if(null!==_EndDocPos&& true===_EndDocPos[Depth+1].Deleted)if(EndCell0){EndCell--;__EndDocPos=null;__EndFlag=-1}else return;this.Selection.Use=true;this.Selection.StartPos.Pos={Row:StartRow,Cell:StartCell};this.Selection.EndPos.Pos={Row:EndRow,Cell:EndCell};this.Selection.CurRow=EndRow;this.Selection.Type2=table_Selection_Common;this.Selection.Data2=null;this.private_SetSelectionData(null);if(StartRow===EndRow&&StartCell===EndCell&&null!== __StartDocPos&&null!==__EndDocPos){this.CurCell=this.Get_Row(StartRow).Get_Cell(StartCell);this.Selection.Type=table_Selection_Text;this.CurCell.Content.SetContentSelection(__StartDocPos,__EndDocPos,Depth+2,__StartFlag,__EndFlag)}else{this.Selection.Type=table_Selection_Cell;this.private_UpdateSelectedCellsArray(isOneElement?false:true)}if(null!==EndDocPos&&undefined!==EndDocPos[Depth].Type&&undefined!==EndDocPos[Depth].Type2){this.Selection.Type=EndDocPos[Depth].Type;this.Selection.Type2=EndDocPos[Depth].Type2; if(table_Selection_Cell===this.Selection.Type)this.private_UpdateSelectedCellsArray(!isOneElement||table_Selection_Rows===this.Selection.Type2?true:false)}};CTable.prototype.SetContentPosition=function(DocPos,Depth,Flag){if(this.GetRowsCount()<=0)return;if(0===Flag&&(!DocPos[Depth]||this!==DocPos[Depth].Class))return;var CurRow=0;switch(Flag){case 0:CurRow=DocPos[Depth].Position;break;case 1:CurRow=0;break;case -1:CurRow=this.Content.length-1;break}var _DocPos=DocPos,_Flag=Flag;if(null!==DocPos&& true===DocPos[Depth].Deleted)if(CurRow0){CurRow--;_DocPos=null;_Flag=-1}else return;if(CurRow>=this.GetRowsCount()){CurRow=this.GetRowsCount()-1;_DocPos=null;_Flag=-1}else if(CurRow<0){CurRow=0;_DocPos=null;_Flag=1}var Row=this.GetRow(CurRow);if(!Row)return;var CurCell=0;switch(_Flag){case 0:CurCell=_DocPos[Depth+1].Position;break;case 1:CurCell=0;break;case -1:CurCell=Row.GetCellsCount()-1;break}var __DocPos=_DocPos,__Flag=_Flag;if(null!== _DocPos&&true===_DocPos[Depth+1].Deleted)if(CurCell0){CurCell--;__DocPos=null;__Flag=-1}else return;if(CurCell>=Row.GetCellsCount()){CurCell=Row.GetCellsCount()-1;__DocPos=null;__Flag=-1}else if(CurCell<0){CurCell=0;__DocPos=null;__Flag=1}var Cell=Row.GetCell(CurCell);if(!Cell)return;this.CurCell=Cell;this.CurCell.Content.SetContentPosition(__DocPos,Depth+2,__Flag)};CTable.prototype.Set_CurCell=function(Cell){if(!Cell||this!==Cell.Get_Table())return; this.CurCell=Cell};CTable.prototype.IsEmptyPage=function(CurPage){if(!this.Pages[CurPage]||this.Pages[CurPage].LastRow=0;--_CurPage)if(true!==this.IsEmptyPage(_CurPage))return false;return true};CTable.prototype.private_StartTrackTable=function(CurPage){if(CurPage<0||CurPage>=this.Pages.length)return; var Bounds=this.Get_PageBounds(CurPage);var NewOutline=new AscCommon.CTableOutline(this,this.Get_AbsolutePage(CurPage),Bounds.Left,Bounds.Top,Bounds.Right-Bounds.Left,Bounds.Bottom-Bounds.Top);var Transform=this.Get_ParentTextTransform();this.DrawingDocument.StartTrackTable(NewOutline,Transform)};CTable.prototype.Correct_BadTable=function(){this.Internal_Check_TableRows(false);this.CorrectBadGrid();this.CorrectHMerge();this.CorrectVMerge()};CTable.prototype.CorrectHMerge=function(){var bLoad=AscCommon.g_oIdCounter.m_bLoad; var bRead=AscCommon.g_oIdCounter.m_bRead;AscCommon.g_oIdCounter.m_bLoad=false;AscCommon.g_oIdCounter.m_bRead=false;var nColsCount=this.TableGrid.length;for(var nCurRow=0,nRowsCount=this.GetRowsCount();nCurRownColsCount)nGridSpan=Math.max(1,nColsCount-nCurGridCol);oCell.SetGridSpan(nGridSpan); oCell.SetW(new CTableMeasurement(nWType,nWValue))}nCurGridCol+=nGridSpan}}AscCommon.g_oIdCounter.m_bLoad=bLoad;AscCommon.g_oIdCounter.m_bRead=bRead;this.Recalc_CompiledPr2()};CTable.prototype.CorrectVMerge=function(){if(this.GetRowsCount()<=0)return;var bLoad=AscCommon.g_oIdCounter.m_bLoad;var bRead=AscCommon.g_oIdCounter.m_bRead;AscCommon.g_oIdCounter.m_bLoad=false;AscCommon.g_oIdCounter.m_bRead=false;var oRow=this.GetRow(0);for(var nCurCell=0,nCellsCount=oRow.GetCellsCount();nCurCell.001){isChanged=true;break}if(!isChanged)return;var oLogicDocument=this.LogicDocument; if(oLogicDocument&&oLogicDocument.IsTrackRevisions()&&!this.TableGridChange){this.SetTableGridChange(this.private_CopyTableGrid());this.private_AddPrChange()}History.Add(new CChangesTableTableGrid(this,this.TableGrid,arrGrid));this.TableGrid=arrGrid;this.private_UpdateTableGrid()};CTable.prototype.SetTableGridChange=function(arrTableGridChange){History.Add(new CChangesTableTableGridChange(this,this.TableGridChange,arrTableGridChange));this.TableGridChange=arrTableGridChange};CTable.prototype.GetSpanWidth= function(nStartCol,nGridSpan){if(nStartCol<0||nStartCol+nGridSpan<0||nGridSpan<=0||nStartCol+nGridSpan>this.TableGrid.length)return 0;var nSum=0;for(var nCurCol=nStartCol;nCurColnGridCol)break;nPrevGridCol+= nPrevGridSpan}}if(true===bNeedReset)oCell.SetVMerge(vmerge_Restart)}nGridCol+=nGridSpan}}};CTable.prototype.private_SetTableLayoutFixedAndUpdateCellsWidth=function(nExceptColNum){if(tbllayout_AutoFit===this.Get_CompiledPr(false).TablePr.TableLayout){this.SetTableLayout(tbllayout_Fixed);var nColsCount=this.TableGrid.length;for(var nColIndex=0;nColIndex=0;--nCurRow){var oRow=this.Content[nCurRow];var nStartCell=nCurRow===nRow?nCell:oRow.Get_CellsCount()-1;for(var nCurCell=nStartCell;nCurCell>=0;--nCurCell){var oCell=oRow.Get_Cell(nCurCell);if(oCell.Content.GotoFootnoteRef(false,true===isCurrent&&nCurRow===nRow&&nCurCell===nCell,isStepFootnote,isStepEndnote))return true}}return false};CTable.prototype.CanUpdateTarget=function(nCurPage){if(this.Pages.length<=0)return false;var oRow,oCell;if(this.IsSelectionUse()){oRow=this.GetRow(this.Selection.EndPos.Pos.Row); oCell=oRow.GetCell(this.Selection.EndPos.Pos.Cell)}else{oCell=this.CurCell;oRow=this.CurCell.GetRow()}if(!oRow||!oCell)return false;if(nCurPage>=this.Pages.length){var nLastPage=this.Pages.length-1;if(this.Pages[nLastPage].LastRow>=oRow.Index)return true;return false}else{if(this.Pages[nCurPage].LastRow>oRow.Index)return true;else if(this.Pages[nCurPage].LastRow0)return true;return false};CTable.prototype.IsRowSelection=function(){if(!this.IsCellSelection())return false;var arrSelectionArray=this.GetSelectionArray(true);var oPrevPos=null;for(var nIndex=0,nCount=arrSelectionArray.length;nIndex=this.GetRowsCount())return;var nAddRows=oTable.GetRowsCount()+nRowIndex-this.GetRowsCount();while(nAddRows>0){this.RemoveSelection();this.CurCell=this.GetRow(this.GetRowsCount()-1).GetCell(0);this.AddTableRow(false,undefined,false);nAddRows--;this.private_RecalculateGridCols()}var arrClearedCells= [];function private_IsProcessedCell(oCell){for(var nIndex=0,nCount=arrClearedCells.length;nIndex.01){var arrRowsH=[];var nTableSumH=0;for(var nCurRow=0,nRowsCount=this.GetRowsCount();nCurRownTopMargin)nTopMargin=oMargins.Top.W;if(oMargins.Bottom.W>nBotMargin)nBotMargin=oMargins.Bottom.W}nNewH-=nTopMargin+nBotMargin;oRow.SetHeight(nNewH,oRowH.HRule===Asc.linerule_Exact?Asc.linerule_Exact:Asc.linerule_AtLeast)}}else if(nDiffY<-.01){var nNewTableH=nSummaryHeight+nDiffY;var arrRowsMinH=[];var arrRowsH=[];var nTableSumH=0;var arrRowsFlag=[];for(var nCurRow=0,nRowsCount=this.GetRowsCount();nCurRownTopMargin)nTopMargin=oMargins.Top.W;if(oMargins.Bottom.W>nBotMargin)nBotMargin=oMargins.Bottom.W}nNewH-=nTopMargin+nBotMargin;oRow.SetHeight(nNewH,oRowH.HRule===Asc.linerule_Exact?Asc.linerule_Exact:Asc.linerule_AtLeast)}}this.private_RecalculateGrid();var nFinalTableSum=null;if(nDiffX>.001){var arrColsW= [];var nTableSumW=0;for(var nCurCol=0,nColsCount=this.TableGridCalc.length;nCurCol0){var nW=this.GetSpanWidth(0,oBefore.Grid);if(oBefore.W.IsMM())oRow.SetBefore(oBefore.Grid,new CTableMeasurement(tblwidth_Mm,nW));else if(oBefore.W.IsPercent()&&nPercentWidth>.001)oRow.SetBefore(oBefore.Grid,new CTableMeasurement(tblwidth_Pct,nW/nPercentWidth*100));else oRow.SetBefore(oBefore.Grid,new CTableMeasurement(tblwidth_Auto, 0))}var nCellSpacing=oRow.GetCellSpacing();var nCurCol=oBefore.Grid;for(var nCurCell=0,nCellsCount=oRow.GetCellsCount();nCurCell.001)oCell.SetW(new CTableMeasurement(tblwidth_Pct,nW/nPercentWidth*100));else oCell.SetW(new CTableMeasurement(tblwidth_Auto,0))}nCurCol+=nGridSpan}var oAfter=oRow.GetAfter();if(oAfter.W&&oAfter.Grid>0){var nW=this.GetSpanWidth(nCurCol,oAfter.Grid);if(oAfter.W.IsMM())oRow.SetAfter(oAfter.Grid,new CTableMeasurement(tblwidth_Mm,nW));else if(oAfter.W.IsPercent()&&nPercentWidth>.001)oRow.SetAfter(oAfter.Grid,new CTableMeasurement(tblwidth_Pct,nW/nPercentWidth*100));else oRow.SetAfter(oAfter.Grid, new CTableMeasurement(tblwidth_Auto,0))}}var oTableW=this.GetTableW();if(oTableW)if(oTableW.IsMM())this.SetTableW(tblwidth_Mm,nFinalTableSum);else if(oTableW.IsPercent()&&nPercentWidth>.001)this.SetTableW(tblwidth_Pct,nFinalTableSum/nPercentWidth*100);else this.SetTableW(tblwidth_Auto,0)}};CTable.prototype.ResizeTableInDocument=function(nWidth,nHeight){if(!this.LogicDocument)return;if(true===this.LogicDocument.Document_Is_SelectionLocked(AscCommon.changestype_Table_Properties,null,true))return;this.LogicDocument.StartAction(AscDFH.historydescription_Document_ResizeTable); this.Resize(nWidth,nHeight);this.LogicDocument.Recalculate();this.StartTrackTable();this.LogicDocument.UpdateSelection();this.LogicDocument.FinalizeAction()};CTable.prototype.GetMinWidth=function(isReturnByColumns){var arrMinMargin=[];var nGridCount=this.TableGrid.length;for(var nCurCol=0;nCurColnCurCell)arrRows[nCurRow].Start=nCurCell;if(arrRows[nCurRow].End1)arrCheckMergedCells.push([nCurRow]);for(var nMergeIndex=1,nMergedCount=arrMergedCells.length;nMergeIndexnCurCell2)arrRows[nCurRow2].Start=nCurCell2;if(arrRows[nCurRow2].EndnNewW)isNeedChangeLayout=true}}if(isAutofitLayout&&isNeedChangeLayout)this.SetTableLayout(tbllayout_Fixed);this.private_CreateNewGrid(arrRowsInfo);this.private_RecalculateGrid();return true};CTable.prototype.DistributeRows=function(){if((true!=this.Selection.Use||true===this.Selection.Use&&table_Selection_Text===this.Selection.Type)&& this.CurCell.Content.DistributeTableCells(false))return true;var isApplyToAll=this.ApplyToAll;if(!this.Selection.Use||table_Selection_Text===this.Selection.Type)this.ApplyToAll=true;var arrSelectedCells=this.GetSelectionArray();this.ApplyToAll=isApplyToAll;if(arrSelectedCells.length<=1)return false;var arrRows=[],nRowsCount=0;for(var nIndex=0,nCount=arrSelectedCells.length;nIndex1)for(var nCurRow=oCell.Row.Index;nCurRow558.8)nWidth=558.8;var arrSelectedCells=this.GetSelectionArray();var oCells={};for(var nIndex=0,nCount=arrSelectedCells.length;nIndex=oRow.GetCellsCount())nCurCell=oRow.GetCellsCount()-1;var oCell=oRow.GetCell(nCurCell);if(!oCell)return[];var nGridStart=oRow.GetCellInfo(nCurCell).StartGridCol;var nGridEnd= nGridStart+oCell.GetGridSpan()-1;var arrCells=[];var arrPoses=this.private_GetColumnByGridRange(nGridStart,nGridEnd);for(var nIndex=0,nCount=arrPoses.length;nIndex=nGridStart&&nStartGridCol<=nGridEnd||nStartGridCol<=nGridStart&&nGridEnd<=nEndGridCol)arrPos.push({Cell:nCurCell,Row:nCurRow})}}return arrPos};CTable.prototype.HavePrChange=function(){return this.Pr.HavePrChange()};CTable.prototype.AddPrChange= function(){if(false===this.HavePrChange()){this.Pr.AddPrChange();History.Add(new CChangesTablePrChange(this,{PrChange:undefined,ReviewInfo:undefined},{PrChange:this.Pr.PrChange,ReviewInfo:this.Pr.ReviewInfo}));this.UpdateTrackRevisions()}};CTable.prototype.RemovePrChange=function(){if(true===this.HavePrChange()){History.Add(new CChangesTablePrChange(this,{PrChange:this.Pr.PrChange,ReviewInfo:this.Pr.ReviewInfo},{PrChange:undefined,ReviewInfo:undefined}));this.Pr.RemovePrChange();this.UpdateTrackRevisions()}}; CTable.prototype.private_AddPrChange=function(){if(this.LogicDocument&&true===this.LogicDocument.IsTrackRevisions()&&true!==this.HavePrChange())this.AddPrChange()};CTable.prototype.UpdateTrackRevisions=function(){if(this.LogicDocument&&this.LogicDocument.GetTrackRevisionsManager){var oRevisionsManager=this.LogicDocument.GetTrackRevisionsManager();oRevisionsManager.CheckElement(this)}};CTable.prototype.GetPrReviewColor=function(){if(this.Pr.ReviewInfo)return this.Pr.ReviewInfo.Get_Color();return REVIEW_COLOR}; CTable.prototype.CheckRevisionsChanges=function(oRevisionsManager){var nRowsCount=this.GetRowsCount();if(nRowsCount<=0)return;var sTableId=this.GetId();if(true===this.HavePrChange()){var oChange=new CRevisionsChange;oChange.put_Paragraph(this);oChange.put_StartPos(0);oChange.put_EndPos(nRowsCount-1);oChange.put_Type(c_oAscRevisionsChangeType.TablePr);oChange.put_UserId(this.Pr.ReviewInfo.GetUserId());oChange.put_UserName(this.Pr.ReviewInfo.GetUserName());oChange.put_DateTime(this.Pr.ReviewInfo.GetDateTime()); oRevisionsManager.AddChange(sTableId,oChange)}var oTable=this;function private_FlushTableChange(nType,nStartRow,nEndRow){if(reviewtype_Common===nType)return;var oRow=oTable.GetRow(nStartRow);var oRowReviewInfo=oRow.GetReviewInfo();var oChange=new CRevisionsChange;oChange.put_Paragraph(oTable);oChange.put_StartPos(nStartRow);oChange.put_EndPos(nEndRow);oChange.put_Type(nType===reviewtype_Add?c_oAscRevisionsChangeType.RowsAdd:c_oAscRevisionsChangeType.RowsRem);oChange.put_UserId(oRowReviewInfo.GetUserId()); oChange.put_UserName(oRowReviewInfo.GetUserName());oChange.put_DateTime(oRowReviewInfo.GetDateTime());oRevisionsManager.AddChange(sTableId,oChange)}var nType=reviewtype_Common;var nStartRow=0;var nEndRow=0;var sUserId="";for(var nCurRow=0;nCurRow0){this.CurCell=oRow.GetCell(0);return}}};CTable.prototype.CheckRunContent=function(fCheck){for(var nCurRow=0,nRowsCount=this.GetRowsCount();nCurRownPageAbs)break}for(var nCurRow=nFirstRow;nCurRow<=nLastRow;++nCurRow){var oRow=this.GetRow(nCurRow);if(oRow)for(var nCurCell=0,nCellsCount=oRow.GetCellsCount();nCurCell=FlowTable.X&&CurY<=FlowTable.Y+FlowTable.H&& CurY+H>=FlowTable.Y)){CurY=FlowTable.Y+FlowTable.H+.001;bBreak=false}}}if(CurY+H>Y_max)CurY=Y_max-H;if(CurY0){this.New=[];for(var nIndex=0;nIndex0){this.Old=[];for(var nIndex=0;nIndex0){var CellsCount=this.Content[0].Get_CellsCount();for(var CurCell=0;CurCell.001||Math.abs(this.XLimit-this.CalculatedXLimit)){this.CalculatedX=this.X;this.CalculatedXLimit=this.XLimit;this.RecalcInfo.TableGrid=true;this.RecalcInfo.TableBorders=true}if(this.RecalcInfo.TableGrid){var arrSumGrid=[];var nTempSum=0;arrSumGrid[-1]=0;for(var nIndex=0,nCount=this.TableGrid.length;nIndexnTableW)nTableW=0;else if(nTableW0&&arrSumGrid[nCurGridCol-1]arrSumGrid.length)for(var nAddIndex=arrSumGrid.length;nAddIndex<=nCurGridCol+nGridSpan-1;++nAddIndex)arrSumGrid[nAddIndex]=arrSumGrid[nAddIndex-1]+20;if(tblwidth_Auto!==oCellW.Type&&tblwidth_Nil!==oCellW.Type){var nCellWidth=0;if(tblwidth_Pct===oCellW.Type)nCellWidth=PctWidth*oCellW.W/100;else nCellWidth=oCellW.W;if(null!==nCellSpacing){if(0=== nCurCell)nCellWidth+=nCellSpacing/2;nCellWidth+=nCellSpacing;if(nCellsCount-1===nCurCell)nCellWidth+=nCellSpacing/2}if(nCellWidth+arrSumGrid[nCurGridCol-1]>arrSumGrid[nCurGridCol+nGridSpan-1]){var nTempDiff=nCellWidth+arrSumGrid[nCurGridCol-1]-arrSumGrid[nCurGridCol+nGridSpan-1];for(var nTempIndex=nCurGridCol+nGridSpan-1;nTempIndexarrSumGrid.length)for(var nAddIndex= arrSumGrid.length;nAddIndex<=nCurGridCol+oAfterInfo.Grid-1;++nAddIndex)arrSumGrid[nAddIndex]=arrSumGrid[nAddIndex-1]+20;if(arrSumGrid[nCurGridCol+oAfterInfo.Grid-1]0&&Math.abs(arrSumGrid[arrSumGrid.length-1]-nTableW)>.01)arrSumGrid= this.Internal_ScaleTableWidth(arrSumGrid,nTableW);else if(MinWidth>arrSumGrid[arrSumGrid.length-1])arrSumGrid=this.Internal_ScaleTableWidth(arrSumGrid,arrSumGrid[arrSumGrid.length-1]);this.TableGridCalc=[];this.TableGridCalc[0]=arrSumGrid[0];for(var nIndex=1,nCount=arrSumGrid.length;nIndex558.7)arrMinNoPref[nCurCol]=558.7;if(arrMinContent[nCurCol]>558.7)arrMinContent[nCurCol]=558.7;if(arrMaxContent[nCurCol]>558.7)arrMaxContent[nCurCol]=558.7}var oPageFields;if(!this.Parent)oPageFields={X:0,Y:0,XLimit:0, YLimit:0};else{if(this.Parent instanceof CDocumentContent&&this.LogicDocument&&this.Parent.IsBlockLevelSdtContent()&&this.Parent.GetTopDocumentContent()===this.LogicDocument&&!this.Parent.IsTableCellContent()){var nTopIndex=-1;var arrPos=this.GetDocumentPositionFromObject();if(arrPos.length>0)nTopIndex=arrPos[0].Position;if(-1!==nTopIndex)oPageFields=this.LogicDocument.Get_ColumnFields(nTopIndex,this.Get_AbsoluteColumn(this.PageNum),this.GetAbsolutePage(this.PageNum))}if(!oPageFields)oPageFields= this.Parent.Get_ColumnFields?this.Parent.Get_ColumnFields(this.Get_Index(),this.Get_AbsoluteColumn(this.PageNum),this.GetAbsolutePage(this.PageNum)):this.Parent.Get_PageFields(this.private_GetRelativePageIndex(this.PageNum))}var oFramePr=this.GetFramePr();if(oFramePr&&undefined!==oFramePr.GetW()){oPageFields.X=0;oPageFields.XLimit=oFramePr.GetW()}else if(this.LogicDocument&&this.LogicDocument.IsDocumentEditor()&&this.IsInline()){var _X=oPageFields.X;var _XLimit=oPageFields.XLimit;var arrRanges=this.Parent.CheckRange(_X, this.Y,_XLimit,this.Y+.001,this.Y,this.Y+.001,_X,_XLimit,this.private_GetRelativePageIndex(0));if(arrRanges.length>0)for(var nRangeIndex=0,nRangesCount=arrRanges.length;nRangeIndex_X)_X=arrRanges[nRangeIndex].X1+.001;if(arrRanges[nRangeIndex].X1>oPageFields.XLimit-3.2&&arrRanges[nRangeIndex].X0<_XLimit)_XLimit=arrRanges[nRangeIndex].X0-.001}oPageFields.X=_X;oPageFields.XLimit=_XLimit}var nMaxTableW= oPageFields.XLimit-oPageFields.X-TablePr.TableInd-this.GetTableOffsetCorrection()+this.GetRightTableOffsetCorrection();var arrMaxOverMin=[],nSumMaxOverMin=0,nSumMin=0,nSumMinMargin=0,nSumMax=0;for(var nCurCol=0;nCurCol=nTableW){var nSumMinContent=0,nSumPrefOverMinContent=0,arrPrefOverMinContent=[];for(var nCurCol=0;nCurCol=nTableW)for(var nCurCol=0;nCurCol.001)for(var nCurCol=0;nCurCol.001)for(var nCurCol=0;nCurCol.001)for(var nCurCol=0;nCurColnMaxTableW)if(nTableW> nMaxTableWOrigin)for(var nCurCol=0;nCurCol.001)for(var nCurCol=0;nCurCol.001)for(var nCurCol=0;nCurCol0&&nGridBefore>0)if(1===nGridBefore){if(arrMinContent[nCurGridCol]1){arrMergedColumns.push({Start:nCurGridCol,Min:nCellMin,Max:nCellMax,Preferred:nPreferred,Margins:nMarginsMin, Grid:nGridSpan,MinNoPref:oCellMinMax.ContentMin+nSpacingAdd});if(nPreferred>.001){if(!arrMergedPreferred[nGridSpan])arrMergedPreferred[nGridSpan]=[];arrMergedPreferred[nGridSpan].push({Start:nCurGridCol,W:nPreferred});nMergedPrefCount++}}nCurGridCol+=nGridSpan}var oAfterInfo=oRow.GetAfter();var nGridAfter=oAfterInfo.Grid;var nAfterW=oAfterInfo.W.GetCalculatedValue(nPctWidth);if(nAfterW>0&&nGridAfter>0)if(1===nGridAfter){if(arrMinContent[nCurGridCol]0){var nPrevCount=nMergedPrefCount;for(var nGridSpan=2,nMaxGridSpan=arrMergedPreferred.length;nGridSpan=0;--nIndex){var nStart=arrMergedPreferred[nGridSpan][nIndex].Start;var nPreferred=arrMergedPreferred[nGridSpan][nIndex].W;var nPreferredSum=0;for(var nCurSpan=nStart;nCurSpan 0&&-1!==nPreferredSum)nPreferredSum+=arrPreferred[nCurSpan];else nPreferredSum=-1;if(-1!==nPreferredSum&&nPreferred>nPreferredSum&&arrPreferred[nStart+nGridSpan-1]nSumMargin)if(nSumMargin<.001)for(var nCurSpan=nStart;nCurSpannSumSpanMin)if(nSumSpanMin<.001)for(var nCurSpan=nStart;nCurSpannSumSpanMinNoPref)if(nSumSpanMin<.001)for(var nCurSpan=nStart;nCurSpan nSumSpanMax){var nSumSpanMax2=0;for(var nCurSpan=nStart;nCurSpan.001)for(var nCurSpan=nStart;nCurSpan.001)arrPreferred[nCurSpan]=arrMaxContent[nCurSpan]}}}};CTable.prototype.private_RecalculateBorders=function(){if(true!= this.RecalcInfo.TableBorders)return;for(var Index=-1;Index MaxBotMargin[CurRow+VMergeCount-1])MaxBotMargin[CurRow+VMergeCount-1]=CellMargins.Bottom.W;var CellBorders=Cell.Get_Borders();if(true===bSpacing_Top){if(border_Single===CellBorders.Top.Value&&MaxTopBorder[CurRow]1){var BottomCell=this.Internal_Get_EndMergedCell(CurRow,CurGridCol,GridSpan);if(null!==BottomCell)CellBordersBottom=BottomCell.Get_Borders().Bottom}if(true===bSpacing_Bot){Cell.Set_BorderInfo_Bottom([CellBordersBottom], -1,-1);if(border_Single===CellBordersBottom.Value&&CellBordersBottom.Size>MaxBotBorder[CurRow+VMergeCount-1])MaxBotBorder[CurRow+VMergeCount-1]=CellBordersBottom.Size}else if(this.Content.length-1===CurRow+VMergeCount-1){var Result_Border=this.private_ResolveBordersConflict(TableBorders.Bottom,CellBordersBottom,true,false);if(border_Single===Result_Border.Value&&Result_Border.Size>MaxBotBorder[CurRow+VMergeCount-1])MaxBotBorder[CurRow+VMergeCount-1]=Result_Border.Size;if(GridSpan>0)for(var TempIndex= 0;TempIndex0){var StartAfterGrid=Next_GridCol;if(CurGridCol+GridSpan-1>=StartAfterGrid){var Result_Border= this.private_ResolveBordersConflict(TableBorders.Right,CellBordersBottom,true,false);AfterCount=Math.min(CurGridCol+GridSpan-StartAfterGrid,GridSpan);for(var TempIndex=0;TempIndexTableBorders.Left.Size/2)X_cell_start+=CellSpacing;else X_cell_start+=TableBorders.Left.Size/2;else if(border_None===TableBorders.Left.Value||CellSpacing>TableBorders.Left.Size)X_cell_start+=CellSpacing/2;else X_cell_start+=TableBorders.Left.Size/2;else X_cell_start+=CellSpacing/2;if(CellsCount-1===CurCell)if(0===AfterInfo.GridAfter)if(border_None===TableBorders.Right.Value||CellSpacing> TableBorders.Right.Size/2)X_cell_end-=CellSpacing;else X_cell_end-=TableBorders.Right.Size/2;else if(border_None===TableBorders.Right.Value||CellSpacing>TableBorders.Right.Size)X_cell_end-=CellSpacing/2;else X_cell_end-=TableBorders.Right.Size/2;else X_cell_end-=CellSpacing/2}var CellMar=Cell.GetMargins();var VMergeCount=this.Internal_GetVertMergeCount(CurRow,CurGridCol,GridSpan);var X_content_start=X_cell_start;var X_content_end=X_cell_end;var CellBorders=Cell.Get_Borders();if(null!=CellSpacing){X_content_start+= CellMar.Left.W;X_content_end-=CellMar.Right.W;if(border_Single===CellBorders.Left.Value)X_content_start+=CellBorders.Left.Size;if(border_Single===CellBorders.Right.Value)X_content_end-=CellBorders.Right.Size}else if(vmerge_Continue===Vmerge){X_content_start+=CellMar.Left.W;X_content_end-=CellMar.Right.W}else{var Max_r_w=0;var Max_l_w=0;var Borders_Info={Right:[],Left:[],Right_Max:0,Left_Max:0};for(var nTempCurRow=0;nTempCurRowMax_l_w)Max_l_w=oLeftBorder.Size;Borders_Info.Left.push(oLeftBorder)}else{var oLeftBorder=this.private_ResolveBordersConflict(oTempRow.GetCell(nTempCurCell- 1).GetBorders().Right,oTempCellBorders.Left,false,false);if(border_Single===oLeftBorder.Value&&oLeftBorder.Size>Max_l_w)Max_l_w=oLeftBorder.Size;Borders_Info.Left.push(oLeftBorder)}if(oTempRow.GetCellsCount()-1===nTempCurCell){var oRightBorder=this.private_ResolveBordersConflict(TableBorders.Right,oTempCellBorders.Right,true,false);if(border_Single===oRightBorder.Value&&oRightBorder.Size>Max_r_w)Max_r_w=oRightBorder.Size;Borders_Info.Right.push(oRightBorder)}else{var oRightBorder=this.private_ResolveBordersConflict(oTempRow.GetCell(nTempCurCell+ 1).GetBorders().Left,oTempCellBorders.Right,false,false);if(border_Single===oRightBorder.Value&&oRightBorder.Size>Max_r_w)Max_r_w=oRightBorder.Size;Borders_Info.Right.push(oRightBorder)}}Borders_Info.Right_Max=Max_r_w;Borders_Info.Left_Max=Max_l_w;if(Max_l_w/2>CellMar.Left.W)X_content_start+=Max_l_w/2;else X_content_start+=CellMar.Left.W;if(Max_r_w/2>CellMar.Right.W)X_content_end-=Max_r_w/2;else X_content_end-=CellMar.Right.W;Cell.Set_BorderInfo_Left(Borders_Info.Left,Max_l_w);Cell.Set_BorderInfo_Right(Borders_Info.Right, Max_r_w)}if(0===CurCell)if(null!=CellSpacing){Row_x_min=X_grid_start;if(border_Single===TableBorders.Left.Value)Row_x_min-=TableBorders.Left.Size/2}else{var BorderInfo=Cell.GetBorderInfo();Row_x_min=X_grid_start-BorderInfo.MaxLeft/2}if(CellsCount-1===CurCell)if(null!=CellSpacing){Row_x_max=X_grid_end;if(border_Single===TableBorders.Right.Value)Row_x_max+=TableBorders.Right.Size/2}else{var BorderInfo=Cell.GetBorderInfo();Row_x_max=X_grid_end+BorderInfo.MaxRight/2}Cell.Set_Metrics(CurGridCol,X_grid_start, X_grid_end,X_cell_start,X_cell_end,X_content_start,X_content_end);CurGridCol+=GridSpan}Row.Set_Metrics_X(Row_x_min,Row_x_max)}this.RecalcInfo.TableBorders=false};CTable.prototype.private_RecalculateCellTopBorder=function(oPrevRow,nCurRow,nCurGridCol,nGridSpan,oTableBorders,oCellBorders){var nPrevCellsCount=oPrevRow.GetCellsCount();var oPrevBefore=oPrevRow.GetBefore();var oPrevAfter=oPrevRow.GetAfter();var nPrevPos=-1;var nPrevGridCol=oPrevBefore.Grid;for(var nPrevCell=0;nPrevCell=nCurGridCol){nPrevPos=nPrevCell;break}nPrevGridCol+=nPrevGridSpan}var arrBorderTopInfo=[];var nMaxTopBorder=0;if(nCurGridCol<=oPrevBefore.Grid-1){var oBorder=this.private_ResolveBordersConflict(oTableBorders.Left,oCellBorders.Top,true,false);var nBorderW=oBorder.GetWidth();if(nMaxTopBorder=nCurGridCol)if(nPrevGridCol+nPrevGridSpan-1>nCurGridCol+nGridSpan-1)nGridCount=nCurGridCol+nGridSpan-nPrevGridCol;else nGridCount=nPrevGridSpan;else if(nPrevGridCol+nPrevGridSpan-1>nCurGridCol+nGridSpan-1)nGridCount=nGridSpan;else nGridCount=nPrevGridCol+nPrevGridSpan-nCurGridCol;for(var nCurGrid=0;nCurGrid0){var nStartAfterGrid=oPrevRow.GetCellInfo(nPrevCellsCount-1).StartGridCol+oPrevRow.GetCell(nPrevCellsCount-1).GetGridSpan();if(nCurGridCol+nGridSpan-1>=nStartAfterGrid){var oBorder=this.private_ResolveBordersConflict(oTableBorders.Right,oCellBorders.Top,true,false);var nBorderW=oBorder.GetWidth();if(nMaxTopBorder=0;CurRow--){var Row=this.Content[CurRow]; var Cells_Count=Row.Get_CellsCount();var bContinue=false;for(var CurCell=0;CurCell1){Header_RowsCount--;bContinue=true;break}}if(true!=bContinue)break}this.HeaderInfo.Count=Header_RowsCount};CTable.prototype.private_RecalculatePageXY=function(CurPage){var FirstRow=0;if(0!==CurPage)if(true=== this.IsEmptyPage(CurPage-1))FirstRow=this.Pages[CurPage-1].FirstRow;else if(true===this.Pages[CurPage-1].LastRowSplit)FirstRow=this.Pages[CurPage-1].LastRow;else FirstRow=Math.min(this.Pages[CurPage-1].LastRow+1,this.Content.length-1);var TempMaxTopBorder=this.Get_MaxTopBorder(FirstRow);this.Pages.length=Math.max(CurPage,0);if(0===CurPage){this.Pages.length=CurPage+1;this.Pages[CurPage]=new CTablePage(this.X,this.Y,this.XLimit,this.YLimit,FirstRow,TempMaxTopBorder)}else{var StartPos=this.Parent.Get_PageContentStartPos2(this.PageNum, this.ColumnNum,CurPage,this.Index);this.Pages.length=CurPage+1;this.Pages[CurPage]=new CTablePage(StartPos.X,StartPos.Y,StartPos.XLimit,StartPos.YLimit,FirstRow,TempMaxTopBorder)}};CTable.prototype.private_RecalculatePositionX=function(CurPage){var TablePr=this.Get_CompiledPr(false).TablePr;var PageLimits=this.Parent.Get_PageLimits(this.PageNum);var PageFields=this.Parent.Get_PageFields(this.PageNum);var LD_PageLimits=this.LogicDocument.Get_PageLimits(this.Get_StartPage_Absolute());var LD_PageFields= this.LogicDocument.Get_PageFields(this.Get_StartPage_Absolute());if(true===this.Is_Inline()){var Page=this.Pages[CurPage];if(0===CurPage){this.AnchorPosition.CalcX=this.X_origin+TablePr.TableInd;this.AnchorPosition.Set_X(this.TableSumGrid[this.TableSumGrid.length-1],this.X_origin,LD_PageFields.X,LD_PageFields.XLimit,LD_PageLimits.XLimit,PageLimits.X,PageLimits.XLimit)}switch(TablePr.Jc){case AscCommon.align_Left:{Page.X=Page.X_origin+this.GetTableOffsetCorrection()+TablePr.TableInd;break}case AscCommon.align_Right:{var TableWidth= this.TableSumGrid[this.TableSumGrid.length-1];if(false===this.Parent.IsTableCellContent())Page.X=Page.XLimit-TableWidth+this.GetRightTableOffsetCorrection();else Page.X=Page.XLimit-TableWidth;break}case AscCommon.align_Center:{var TableWidth=this.TableSumGrid[this.TableSumGrid.length-1];var RangeWidth=Page.XLimit-Page.X_origin;Page.X=Page.X_origin+(RangeWidth-TableWidth)/2;break}}}else{if(0===CurPage){var oSectPr=this.Get_SectPr();if(oSectPr){var oFrame=oSectPr.GetContentFrame(this.GetAbsolutePage(CurPage)); PageFields.Y=oFrame.Top;PageFields.YLimit=oFrame.Bottom;PageFields.X=oFrame.Left;PageFields.XLimit=oFrame.Right}var OffsetCorrection_Left=this.GetTableOffsetCorrection();var OffsetCorrection_Right=this.GetRightTableOffsetCorrection();this.X=this.X_origin+OffsetCorrection_Left;this.AnchorPosition.Set_X(this.TableSumGrid[this.TableSumGrid.length-1],this.X_origin,PageFields.X+OffsetCorrection_Left,PageFields.XLimit+OffsetCorrection_Right,LD_PageLimits.XLimit,PageLimits.X+OffsetCorrection_Left,PageLimits.XLimit+ OffsetCorrection_Right);this.AnchorPosition.Calculate_X(this.PositionH.RelativeFrom,this.PositionH.Align,this.PositionH.Value);this.AnchorPosition.CalcX+=TablePr.TableInd;this.X=this.AnchorPosition.CalcX;this.X_origin=this.X-OffsetCorrection_Left;if(undefined!=this.PositionH_Old){this.PositionH.RelativeFrom=this.PositionH_Old.RelativeFrom;this.PositionH.Align=this.PositionH_Old.Align;this.PositionH.Value=this.PositionH_Old.Value;var Value=this.AnchorPosition.Calculate_X_Value(this.PositionH_Old.RelativeFrom); this.Set_PositionH(this.PositionH_Old.RelativeFrom,false,Value);this.X=this.AnchorPosition.Calculate_X(this.PositionH.RelativeFrom,this.PositionH.Align,this.PositionH.Value);this.X_origin=this.X-OffsetCorrection_Left;this.PositionH_Old=undefined}}this.Pages[CurPage].X=this.X;this.Pages[CurPage].XLimit=this.XLimit;this.Pages[CurPage].X_origin=this.X_origin}};CTable.prototype.private_RecalculatePage=function(CurPage){if(true===this.TurnOffRecalc)return;var isInnerTable=this.Parent.IsTableCellContent(); var oTopDocument=this.Parent.Is_TopDocument(true);var isTopLogicDocument=oTopDocument instanceof CDocument?true:false;var oFootnotes=isTopLogicDocument&&!isInnerTable?oTopDocument.Footnotes:null;var nPageAbs=this.Get_AbsolutePage(CurPage);var nColumnAbs=this.Get_AbsoluteColumn(CurPage);this.TurnOffRecalc=true;var FirstRow=0;var LastRow=0;var ResetStartElement=false;if(0===CurPage)for(var Index=-1;IndexnTableX_max)nTableX_max=nRowX_max}nTableX_min+=Page.X;nTableX_max+=Page.X;var arrRanges=this.Parent.CheckRange(nTableX_min,Page.Y,nTableX_max,Page.Y+.001,Page.Y,Page.Y+.001,nTableX_min,nTableX_max,this.private_GetRelativePageIndex(CurPage));if(arrRanges.length>0)for(var nRangeIndex=0,nRangesCount=arrRanges.length;nRangeIndex0&&this.HeaderInfo.PageIndex!=-1&&CurPage>this.HeaderInfo.PageIndex&&this.IsInline()){this.HeaderInfo.HeaderRecalculate=true;this.HeaderInfo.Pages[CurPage]={};this.HeaderInfo.Pages[CurPage].RowsInfo=[];var HeaderPage=this.HeaderInfo.Pages[CurPage];HeaderPage.Draw=true;HeaderPage.Rows=[];AscCommon.g_oTableId.m_bTurnOff= true;AscCommon.History.TurnOff();this.LogicDocument.RecalcTableHeader=true;var aContentDrawings=[];for(var Index=0;IndexX_max)X_max=Row_x_max;var MaxBotValue_vmerge= -1;var RowH=Row.Get_Height();var VerticallCells=[];for(var CurCell=0;CurCell1){CurGridCol+=GridSpan;continue}else if(vmerge_Restart!=Vmerge){Cell=this.Internal_Get_StartMergedCell(CurRow,CurGridCol,GridSpan);var cIndex=Cell.Index;var rIndex=Cell.Row.Index;Cell=HeaderPage.Rows[rIndex].Get_Cell(cIndex); CellMar=Cell.GetMargins();Y_content_start=Cell.Temp.Y+CellMar.Top.W}if(true===Cell.IsVerticalText()){VerticallCells.push(Cell);CurGridCol+=GridSpan;continue}Cell.Content.Set_StartPage(CurPage);Cell.Content.Reset(X_content_start,Y_content_start,X_content_end,Y_content_end);Cell.Content.Set_ClipInfo(0,Page.X+CellMetrics.X_cell_start,Page.X+CellMetrics.X_cell_end);Cell.Content.RecalculateEndInfo();if(recalcresult2_NextPage===Cell.Content.Recalculate_Page(0,true)){bHeaderNextPage=true;break}var CellContentBounds= Cell.Content.Get_PageBounds(0,undefined,true);var CellContentBounds_Bottom=CellContentBounds.Bottom+BottomMargin;if(undefined===HeaderPage.RowsInfo[CurRow].TableRowsBottom||HeaderPage.RowsInfo[CurRow].TableRowsBottom1)continue;else{var Vmerge=Cell.GetVMerge();if(vmerge_Restart!=Vmerge){Cell=this.Internal_Get_StartMergedCell(CurRow,Cell.Metrics.StartGridCol,Cell.Get_GridSpan());var cIndex=Cell.Index;var rIndex=Cell.Row.Index;Cell=HeaderPage.Rows[rIndex].Get_Cell(cIndex)}}var CellMar=Cell.GetMargins();var VAlign=Cell.Get_VAlign();var CellPageIndex=CurPage-Cell.Content.Get_StartPage_Relative();if(CellPageIndex>=Cell.PagesCount)continue;if(vertalignjc_Top===VAlign||CellPageIndex> 1){Cell.Temp.Y_VAlign_offset[CellPageIndex]=0;continue}var TempCurRow=Cell.Row.Index;var TempCellSpacing=HeaderPage.Rows[TempCurRow].Get_CellSpacing();var Y_0=HeaderPage.RowsInfo[TempCurRow].Y;if(null===TempCellSpacing)Y_0+=MaxTopBorder[TempCurRow];Y_0+=CellMar.Top.W;var Y_1=HeaderPage.RowsInfo[CurRow].TableRowsBottom-CellMar.Bottom.W;var CellHeight=Y_1-Y_0;var CellContentBounds=Cell.Content.Get_PageBounds(CellPageIndex,CellHeight,true);var ContentHeight=CellContentBounds.Bottom-CellContentBounds.Top; var Dy=0;if(true===Cell.IsVerticalText()){var CellMetrics=Cell.Row.Get_CellInfo(Cell.Index);CellHeight=CellMetrics.X_cell_end-CellMetrics.X_cell_start-CellMar.Left.W-CellMar.Right.W}if(CellHeight-ContentHeight>.001){if(vertalignjc_Bottom===VAlign)Dy=CellHeight-ContentHeight;else if(vertalignjc_Center===VAlign)Dy=(CellHeight-ContentHeight)/2;Cell.Content.Shift(CellPageIndex,0,Dy)}Cell.Temp.Y_VAlign_offset[CellPageIndex]=Dy}}nHeaderMaxTopBorder=this.private_GetMaxTopBorderWidth(FirstRow,true);this.LogicDocument.RecalcTableHeader= false}else{this.HeaderInfo.Pages[CurPage]={};this.HeaderInfo.Pages[CurPage].Draw=false}this.HeaderInfo.HeaderRecalculate=false;var bNextPage=false;var nFootnotesHeight=0;var arrSavedY=[];var arrSavedTableHeight=[];var arrFootnotesObject=[];var nResetFootnotesIndex=-1;for(var CurRow=FirstRow;CurRownResetFootnotesIndex)){nFootnotesHeight=oFootnotes.GetHeight(nPageAbs,nColumnAbs);arrFootnotesObject[CurRow]=oFootnotes.SaveRecalculateObject(nPageAbs, nColumnAbs);arrSavedY[CurRow]=Y;arrSavedTableHeight[CurRow]=TableHeight;this.Pages[CurPage].FootnotesH=nFootnotesHeight}if(0===CurRow&&true===this.Check_EmptyPages(CurPage-1)||CurRow!=FirstRow||CurRow===FirstRow&&true===ResetStartElement){this.RowsInfo[CurRow]=new CTableRowsInfo;this.RowsInfo[CurRow].StartPage=CurPage;this.TableRowsBottom[CurRow]=[]}else this.RowsInfo[CurRow].Pages=CurPage-this.RowsInfo[CurRow].StartPage+1;this.TableRowsBottom[CurRow][CurPage]=Y;var Row=this.Content[CurRow];var CellsCount= Row.Get_CellsCount();var CellSpacing=Row.Get_CellSpacing();var BeforeInfo=Row.Get_Before();var AfterInfo=Row.Get_After();var CurGridCol=BeforeInfo.GridBefore;var nMaxTopBorder=MaxTopBorder[CurRow];if(CurRow===FirstRow&&nHeaderMaxTopBorder>0)nMaxTopBorder=nHeaderMaxTopBorder;Y+=nMaxTopBorder;TableHeight+=nMaxTopBorder;if(FirstRow===CurRow){if(null!=CellSpacing){var TableBorder_Top=this.Get_Borders().Top;if(border_Single===TableBorder_Top.Value){Y+=TableBorder_Top.Size;TableHeight+=TableBorder_Top.Size}if(true=== this.HeaderInfo.Pages[CurPage].Draw||0===CurRow&&(0===CurPage||1===CurPage&&false===this.RowsInfo[0].FirstPage)){Y+=CellSpacing;TableHeight+=CellSpacing}else{Y+=CellSpacing/2;TableHeight+=CellSpacing/2}}}else{var PrevCellSpacing=this.Content[CurRow-1].Get_CellSpacing();if(null!=CellSpacing&&null!=PrevCellSpacing){Y+=(PrevCellSpacing+CellSpacing)/2;TableHeight+=(PrevCellSpacing+CellSpacing)/2}else if(null!=CellSpacing){Y+=CellSpacing/2;TableHeight+=CellSpacing/2}else if(null!=PrevCellSpacing){Y+=PrevCellSpacing/ 2;TableHeight+=PrevCellSpacing/2}}var Row_x_max=Row.Metrics.X_max;var Row_x_min=Row.Metrics.X_min;if(-1===X_min||Row_x_minX_max)X_max=Row_x_max;var MaxTopMargin=0;for(var CurCell=0;CurCellMaxTopMargin)MaxTopMargin=CellMar.Top.W}var RowH=Row.Get_Height();var RowHValue=RowH.Value+this.MaxBotMargin[CurRow]+ MaxTopMargin;if(null!==CellSpacing)RowHValue-=CellSpacing;if(Asc.linerule_Exact===RowH.HRule)RowHValue-=nMaxTopBorder;if(oFootnotes&&(Asc.linerule_AtLeast===RowH.HRule||Asc.linerule_Exact==RowH.HRule))oFootnotes.PushCellLimit(Y+RowHValue);var MaxBotValue_vmerge=-1;var Merged_Cell=[];var VerticallCells=[];var bAllCellsVertical=true;var bFootnoteBreak=false;for(var CurCell=0;CurCell1){CurGridCol+=GridSpan;Merged_Cell.push(Cell);Cell.Content.RecalculateEndInfo();continue}else if(vmerge_Restart!=Vmerge){Cell=this.Internal_Get_StartMergedCell(CurRow,CurGridCol,GridSpan);CellMar=Cell.GetMargins();var oTempRow=Cell.GetRow();var oTempCellMetrics=oTempRow.GetCellInfo(Cell.GetIndex());X_content_start=Page.X+oTempCellMetrics.X_content_start;X_content_end= Page.X+oTempCellMetrics.X_content_end;Y_content_start=Cell.Temp.Y+CellMar.Top.W}if(true===Cell.IsVerticalText()){VerticallCells.push(Cell);CurGridCol+=GridSpan;continue}bAllCellsVertical=false;var bCanShift=false;var ShiftDy=0;var ShiftDx=0;if(0===Cell.Row.Index&&true===this.Check_EmptyPages(CurPage-1)||Cell.Row.Index>FirstRow||Cell.Row.Index===FirstRow&&true===ResetStartElement){Cell.Content.Set_StartPage(CurPage);if(true===this.Is_Inline()&&1===Cell.PagesCount&&1===Cell.Content.Pages.length&&true!= this.RecalcInfo.Check_Cell(Cell)){var X_content_start_old=Cell.Content.Pages[0].X;var X_content_end_old=Cell.Content.Pages[0].XLimit;var Y_content_height_old=Cell.Content.Pages[0].Bounds.Bottom-Cell.Content.Pages[0].Bounds.Top;if(Math.abs(X_content_start-X_content_start_old)<.001&&Math.abs(X_content_end_old-X_content_end)<.001&&Y_content_start+Y_content_height_old0||arrEndnotes&&arrEndnotes.length>0)bCanShift=false}}Cell.PagesCount=1;Cell.Content.Reset(X_content_start,Y_content_start,X_content_end,Y_content_end)}var CellPageIndex=CurPage-Cell.Content.Get_StartPage_Relative();Cell.Content.Set_ClipInfo(CellPageIndex,Page.X+CellMetrics.X_cell_start,Page.X+CellMetrics.X_cell_end);if(CellPageIndexnFootnotesHeight+.001){this.Pages[CurPage].FootnotesH=nCurFootnotesHeight;nFootnotesHeight=nCurFootnotesHeight;nResetFootnotesIndex=CurRow;Y=arrSavedY[oOriginCell.Row.Index];TableHeight=arrSavedTableHeight[oOriginCell.Row.Index];oFootnotes.LoadRecalculateObject(nPageAbs,nColumnAbs,arrFootnotesObject[oOriginCell.Row.Index]);CurRow=oOriginCell.Row.Index-1;bFootnoteBreak= true;break}CurGridCol+=GridSpan}if(oFootnotes&&(Asc.linerule_AtLeast===RowH.HRule||Asc.linerule_Exact==RowH.HRule))oFootnotes.PopCellLimit();if(bFootnoteBreak)continue;if(undefined===this.TableRowsBottom[CurRow][CurPage])this.TableRowsBottom[CurRow][CurPage]=Y;if(true===bAllCellsVertical&&Asc.linerule_Auto===RowH.HRule)this.TableRowsBottom[CurRow][CurPage]=Y+4.5+this.MaxBotMargin[CurRow]+MaxTopMargin;if((Asc.linerule_AtLeast===RowH.HRule||Asc.linerule_Exact==RowH.HRule)&&Y+RowHValue>Y_content_end&& (0===CurRow&&0===CurPage&&null!==this.Get_DocumentPrev()&&!this.Parent.IsFirstElementOnPage(this.private_GetRelativePageIndex(CurPage),this.GetIndex())||CurRow!=FirstRow)){bNextPage=true;for(var CurCell=0;CurCell1)continue;Cell.Content.StartFromNewPage();Cell.PagesCount=2}}if(true=== bNextPage){var bContentOnFirstPage=false;var bNoContentOnFirstPage=false;for(var CurCell=0;CurCell1)continue;if(true===Cell.IsVerticalText()||true===Cell.Content_Is_ContentOnFirstPage())bContentOnFirstPage=true;else bNoContentOnFirstPage=true}if(true===bContentOnFirstPage&&true=== bNoContentOnFirstPage){for(var CurCell=0;CurCell1)continue;Cell.Content.StartFromNewPage();Cell.PagesCount=2}bContentOnFirstPage=false}this.RowsInfo[CurRow].FirstPage=bContentOnFirstPage;if(0!=CurRow&&false===this.RowsInfo[CurRow].FirstPage)if(this.TableRowsBottom[CurRow-1][CurPage]< MaxBotValue_vmerge){var Diff=MaxBotValue_vmerge-this.TableRowsBottom[CurRow-1][CurPage];this.TableRowsBottom[CurRow-1][CurPage]=MaxBotValue_vmerge;this.RowsInfo[CurRow-1].H[CurPage]+=Diff}var CellsCount2=Merged_Cell.length;var bFootnoteBreak=false;for(var TempCellIndex=0;TempCellIndexFirstRow){Cell.PagesCount=1;Cell.Content.Set_StartPage(CurPage);Cell.Content.Reset(X_content_start,Y_content_start,X_content_end,Y_content_end)}var CellPageIndex=CurPage-Cell.Content.Get_StartPage_Relative();if(CellPageIndexnFootnotesHeight+.001&&Cell.Row.Index>=FirstRow){this.Pages[CurPage].FootnotesH=nCurFootnotesHeight;nFootnotesHeight=nCurFootnotesHeight;nResetFootnotesIndex=CurRow;Y=arrSavedY[Cell.Row.Index];TableHeight= arrSavedTableHeight[Cell.Row.Index];oFootnotes.LoadRecalculateObject(nPageAbs,nColumnAbs,arrFootnotesObject[Cell.Row.Index]);CurRow=Cell.Row.Index-1;bFootnoteBreak=true;break}CurGridCol+=GridSpan}if(bFootnoteBreak)continue;bContentOnFirstPage=false;for(var CurCell=0;CurCellFirstRow||Cell.Row.Index===FirstRow&&true===ResetStartElement){Cell.PagesCount=1;Cell.Content.Set_StartPage(CurPage);Cell.Content.Reset(0,0,Y_content_end-Y_content_start,1E4);Cell.Temp.X_start=X_content_start;Cell.Temp.Y_start=Y_content_start;Cell.Temp.X_end=X_content_end;Cell.Temp.Y_end=Y_content_end;Cell.Temp.X_cell_start=Page.X+CellMetrics.X_cell_start;Cell.Temp.X_cell_end=Page.X+CellMetrics.X_cell_end;Cell.Temp.Y_cell_start=Y_content_start-CellMar.Top.W;Cell.Temp.Y_cell_end= Y_content_end+BottomMargin}var CellPageIndex=CurPage-Cell.Content.Get_StartPage_Relative();if(0===CellPageIndex)Cell.Content.Recalculate_Page(CellPageIndex,true)}var nCurFootnotesHeight=oFootnotes?oFootnotes.GetHeight(nPageAbs,nColumnAbs):0;if(oFootnotes&&nCurFootnotesHeight>nFootnotesHeight+.001){this.Pages[CurPage].FootnotesH=nCurFootnotesHeight;nFootnotesHeight=nCurFootnotesHeight;nResetFootnotesIndex=CurRow;Y=arrSavedY[CurRow];TableHeight=arrSavedTableHeight[CurRow];oFootnotes.LoadRecalculateObject(nPageAbs, nColumnAbs,arrFootnotesObject[CurRow]);CurRow--;continue}if(null!=CellSpacing)this.RowsInfo[CurRow].H[CurPage]=CellHeight;else this.RowsInfo[CurRow].H[CurPage]=CellHeight+TempMaxTopBorder;Y+=CellHeight;TableHeight+=CellHeight;Row.Height=CellHeight;Y+=MaxBotBorder[CurRow];TableHeight+=MaxBotBorder[CurRow];if(this.Content.length-1===CurRow)if(null!=CellSpacing){TableHeight+=CellSpacing;var TableBorder_Bottom=this.Get_Borders().Bottom;if(border_Single===TableBorder_Bottom.Value)TableHeight+=TableBorder_Bottom.Size}if(true=== bNextPage){LastRow=CurRow;this.Pages[CurPage].LastRow=CurRow;if(-1===this.HeaderInfo.PageIndex&&this.HeaderInfo.Count>0&&CurRow>=this.HeaderInfo.Count)this.HeaderInfo.PageIndex=CurPage;break}else if(this.Content.length-1===CurRow){LastRow=this.Content.length-1;this.Pages[CurPage].LastRow=this.Content.length-1}}for(var CurRow=FirstRow;CurRow<=LastRow;CurRow++){var Row=this.Content[CurRow];var CellsCount=Row.Get_CellsCount();for(var CurCell=0;CurCell1&&CurRow!=LastRow)continue;else{var Vmerge=Cell.GetVMerge();if(vmerge_Restart!=Vmerge)Cell=this.Internal_Get_StartMergedCell(CurRow,Cell.Metrics.StartGridCol,Cell.Get_GridSpan())}var CellMar=Cell.GetMargins();var VAlign=Cell.Get_VAlign();var CellPageIndex=CurPage-Cell.Content.Get_StartPage_Relative();if(CellPageIndex>=Cell.PagesCount)continue;var TempCurRow=Cell.Row.Index;if(vertalignjc_Top=== VAlign||CellPageIndex>1||1===CellPageIndex&&true===this.RowsInfo[TempCurRow].FirstPage){Cell.Temp.Y_VAlign_offset[CellPageIndex]=0;continue}var TempCellSpacing=this.Content[TempCurRow].Get_CellSpacing();var Y_0=this.RowsInfo[TempCurRow].Y[CurPage];if(null===TempCellSpacing)Y_0+=MaxTopBorder[TempCurRow];Y_0+=CellMar.Top.W;var Y_1=this.TableRowsBottom[CurRow][CurPage]-CellMar.Bottom.W;var CellHeight=Y_1-Y_0;var CellContentBounds=Cell.Content.Get_PageBounds(CellPageIndex,CellHeight,true);var ContentHeight= CellContentBounds.Bottom-CellContentBounds.Top;var Dy=0;if(true===Cell.IsVerticalText()){var CellMetrics=Row.Get_CellInfo(CurCell);CellHeight=CellMetrics.X_cell_end-CellMetrics.X_cell_start-CellMar.Left.W-CellMar.Right.W}if(CellHeight-ContentHeight>.001){if(vertalignjc_Bottom===VAlign)Dy=CellHeight-ContentHeight;else if(vertalignjc_Center===VAlign)Dy=(CellHeight-ContentHeight)/2;Cell.Content.Shift(CellPageIndex,0,Dy)}Cell.Temp.Y_VAlign_offset[CellPageIndex]=Dy}}var CurRow=LastRow;if(0===CurRow&&false=== this.RowsInfo[CurRow].FirstPage&&0===CurPage){this.Pages[0].MaxBotBorder=0;this.Pages[0].BotBorders=[]}else{if(false===this.RowsInfo[CurRow].FirstPage&&CurPage===this.RowsInfo[CurRow].StartPage)CurRow--;var MaxBotBorder=0;var BotBorders=[];if(CurRow>=this.Pages[CurPage].FirstRow)if(this.Content.length-1===CurRow){var Row=this.Content[CurRow];var CellsCount=Row.Get_CellsCount();for(var CurCell=0;CurCell=this.Pages.length)return 0;if(true===this.IsEmptyPage(CurPage))return;var Page=this.Pages[CurPage];var Row_start=this.Pages[CurPage].FirstRow;var Row_last=this.Pages[CurPage].LastRow;if(Row_last0||false===this.IsStartFromNewPage()||null===this.Get_DocumentPrev()){var _X_min=-3+this.Pages[CurPage].Bounds.Left;var _Y_top=this.Pages[CurPage].Bounds.Top;var _Y_bottom=this.Pages[CurPage].Bounds.Bottom;var ReviewColor=this.GetPrReviewColor();pGraphics.p_color(ReviewColor.r,ReviewColor.g,ReviewColor.b,255);pGraphics.drawVerLine(0, _X_min,_Y_top,_Y_bottom,0)}var TableBorders=this.Get_Borders();var bHeader=false;if(this.bPresentation){var Row=this.Content[0];var CellSpacing=Row.Get_CellSpacing();var CellsCount=Row.Get_CellsCount();var X_left_new=Page.X+Row.Get_CellInfo(0).X_grid_start;var X_right_new=Page.X+Row.Get_CellInfo(CellsCount-1).X_grid_end;pGraphics.SaveGrState();pGraphics.SetIntegerGrid(false);var ShapeDrawer=new AscCommon.CShapeDrawer;TableShd.Unifill&&TableShd.Unifill.check(this.Get_Theme(),this.Get_ColorMap());var Transform= this.Parent.transform.CreateDublicate();global_MatrixTransformer.TranslateAppend(Transform,Math.min(X_left_new,X_right_new),Math.min(Y_top,Y_bottom));pGraphics.transform3(Transform,false);ShapeDrawer.fromShape2(new AscFormat.ObjectToDraw(TableShd.Unifill,null,Math.abs(X_right_new-X_left_new),Math.abs(this.Pages[0].Bounds.Bottom-Y_top),null,Transform),pGraphics,null);ShapeDrawer.draw(null);pGraphics.RestoreGrState()}var arrFrames=Asc.c_oAscShdNil!==TableShd.Value?this.private_GetTableCellsBackgroundFrames(CurPage, Row_start,Row_last):[];if(this.HeaderInfo.Count>0&&PNum>this.HeaderInfo.PageIndex&&true===this.HeaderInfo.Pages[PNum].Draw){bHeader=true;var HeaderPage=this.HeaderInfo.Pages[PNum];for(var CurRow=0;CurRownY){oGraphics.TableRect(nCurrentX, nY,oFrame.X-nCurrentX,nH);nCurrentX=oFrame.X+oFrame.W;nCurGridCol=oFrame.GridCol+oFrame.GridSpan;if(oFrame.Y>nY+.001)oGraphics.TableRect(oFrame.X,nY,oFrame.W,oFrame.Y-nY);if(oFrame.Y+oFrame.H+.001X_left_old)pGraphics.drawHorLineExt(c_oAscLineDrawingRule.Top, Y_top,X_left_old,X_left_new,TableBorders.Left.Size,-TableBorders.Left.Size/2,0);else pGraphics.drawHorLineExt(c_oAscLineDrawingRule.Bottom,Y_top,X_left_old,X_left_new,TableBorders.Left.Size,+TableBorders.Left.Size/2,-TableBorders.Left.Size/2);pGraphics.drawVerLine(c_oAscLineDrawingRule.Center,X_left_new,Y_top,Y_bottom,TableBorders.Left.Size)}}else if(null===X_left_old||Math.abs(X_left_new-X_left_old)<.001)pGraphics.DrawEmptyTableLine(X_left_new,Y_top,X_left_new,Y_bottom);else{pGraphics.DrawEmptyTableLine(X_left_old, Y_top,X_left_new,Y_top);pGraphics.DrawEmptyTableLine(X_left_new,Y_top,X_left_new,Y_bottom)}if(border_Single===TableBorders.Right.Value){RGBA=TableBorders.Right.Get_Color2(Theme,ColorMap);pGraphics.p_color(RGBA.r,RGBA.g,RGBA.b,255);if(pGraphics.SetBorder)pGraphics.SetBorder(TableBorders.Right);if(null===X_right_old||Math.abs(X_right_new-X_right_old)<.001)pGraphics.drawVerLine(c_oAscLineDrawingRule.Center,X_right_new,Y_top,Y_bottom,TableBorders.Right.Size);else{if(X_right_new>X_right_old)pGraphics.drawHorLineExt(c_oAscLineDrawingRule.Bottom, Y_top,X_right_old,X_right_new,TableBorders.Right.Size,-TableBorders.Right.Size/2,+TableBorders.Right.Size/2);else pGraphics.drawHorLineExt(c_oAscLineDrawingRule.Top,Y_top,X_right_old,X_right_new,TableBorders.Right.Size,+TableBorders.Right.Size/2,0);pGraphics.drawVerLine(c_oAscLineDrawingRule.Center,X_right_new,Y_top,Y_bottom,TableBorders.Right.Size)}}else if(null===X_right_old||Math.abs(X_right_new-X_right_old)<.001)pGraphics.DrawEmptyTableLine(X_right_new,Y_top,X_right_new,Y_bottom);else{pGraphics.DrawEmptyTableLine(X_right_old, Y_top,X_right_new,Y_top);pGraphics.DrawEmptyTableLine(X_right_new,Y_top,X_right_new,Y_bottom)}if(true===bStartRow)if(border_Single===TableBorders.Top.Value){RGBA=TableBorders.Top.Get_Color2(Theme,ColorMap);pGraphics.p_color(RGBA.r,RGBA.g,RGBA.b,255);if(pGraphics.SetBorder)pGraphics.SetBorder(TableBorders.Top);var LeftMW=0;if(border_Single===TableBorders.Left.Value)LeftMW=-TableBorders.Left.Size/2;var RightMW=0;if(border_Single===TableBorders.Right.Value)RightMW=+TableBorders.Right.Size/2;pGraphics.drawHorLineExt(c_oAscLineDrawingRule.Top, Y_top,X_left_new,X_right_new,TableBorders.Top.Size,LeftMW,RightMW)}else pGraphics.DrawEmptyTableLine(X_left_new,Y_top,X_right_new,Y_top);if(true===bLastRow)if(border_Single===TableBorders.Bottom.Value){RGBA=TableBorders.Bottom.Get_Color2(Theme,ColorMap);pGraphics.p_color(RGBA.r,RGBA.g,RGBA.b,255);if(pGraphics.SetBorder)pGraphics.SetBorder(TableBorders.Bottom);var LeftMW=0;if(border_Single===TableBorders.Left.Value)LeftMW=-TableBorders.Left.Size/2;var RightMW=0;if(border_Single===TableBorders.Right.Value)RightMW= +TableBorders.Right.Size/2;pGraphics.drawHorLineExt(c_oAscLineDrawingRule.Top,Y_bottom,X_left_new,X_right_new,TableBorders.Bottom.Size,LeftMW,RightMW)}else pGraphics.DrawEmptyTableLine(X_left_new,Y_bottom,X_right_new,Y_bottom)};CTable.prototype.private_DrawCellsBackground=function(pGraphics,PNum,Row_start,Row_last){var CurPage=PNum;var Page=this.Pages[CurPage];var Theme=this.Get_Theme();var ColorMap=this.Get_ColorMap();if(this.bPresentation){pGraphics.SaveGrState();pGraphics.SetIntegerGrid(false)}if(this.HeaderInfo.Count> 0&&PNum>this.HeaderInfo.PageIndex&&true===this.HeaderInfo.Pages[PNum].Draw){var HeaderPage=this.HeaderInfo.Pages[PNum];for(var CurRow=0;CurRow=0;CurCell--){var Cell=Row.Get_Cell(CurCell);var GridSpan=Cell.Get_GridSpan();var VMerge=Cell.GetVMerge();var CurGridCol=Row.Get_CellInfo(CurCell).StartGridCol;if(vmerge_Continue===VMerge)continue; var CellInfo=Row.Get_CellInfo(CurCell);var X_cell_start=Page.X+CellInfo.X_cell_start;var X_cell_end=Page.X+CellInfo.X_cell_end;var VMergeCount=this.Internal_GetVertMergeCount(CurRow,CurGridCol,GridSpan);var RealHeight=HeaderPage.RowsInfo[CurRow+VMergeCount-1].Y+HeaderPage.RowsInfo[CurRow+VMergeCount-1].H-Y;var CellShd=Cell.Get_Shd();if(!this.bPresentation){if(CellShd&&!CellShd.IsNil()){var RGBA=CellShd.GetSimpleColor(Theme,ColorMap);if(true!==RGBA.Auto){pGraphics.b_color1(RGBA.r,RGBA.g,RGBA.b,255); if(pGraphics.SetShd)pGraphics.SetShd(CellShd);pGraphics.TableRect(Math.min(X_cell_start,X_cell_end),Math.min(Y,Y+RealHeight),Math.abs(X_cell_end-X_cell_start),Math.abs(RealHeight))}}}else if(CellShd.Unifill&&CellShd.Unifill.fill){{var ShapeDrawer=new AscCommon.CShapeDrawer;CellShd.Unifill.check(Theme,ColorMap);var Transform=this.Parent.transform.CreateDublicate();global_MatrixTransformer.TranslateAppend(Transform,Math.min(X_cell_start,X_cell_end),Math.min(Y,Y+RealHeight));pGraphics.transform3(Transform, false);ShapeDrawer.fromShape2(new AscFormat.ObjectToDraw(CellShd.Unifill,null,Math.abs(X_cell_end-X_cell_start),Math.abs(RealHeight),null,Transform),pGraphics,null);ShapeDrawer.draw(null)}}}}}for(var CurRow=Row_start;CurRow<=Row_last;CurRow++){var Row=this.Content[CurRow];var CellsCount=Row.Get_CellsCount();var Y=this.RowsInfo[CurRow].Y[PNum];var nReviewType=Row.GetReviewType();for(var CurCell=CellsCount-1;CurCell>=0;CurCell--){var Cell=Row.Get_Cell(CurCell);var GridSpan=Cell.Get_GridSpan();var VMerge= Cell.GetVMerge();var CurGridCol=Row.Get_CellInfo(CurCell).StartGridCol;if(vmerge_Continue===VMerge)if(Row_start===CurRow){Cell=this.Internal_Get_StartMergedCell(CurRow,CurGridCol,GridSpan);if(null===Cell)continue}else continue;var CellInfo=Row.Get_CellInfo(CurCell);var X_cell_start=Page.X+CellInfo.X_cell_start;var X_cell_end=Page.X+CellInfo.X_cell_end;var VMergeCount=this.private_GetVertMergeCountOnPage(PNum,CurRow,CurGridCol,GridSpan);if(VMergeCount<=0)continue;var RealHeight=this.RowsInfo[CurRow+ VMergeCount-1].Y[PNum]+this.RowsInfo[CurRow+VMergeCount-1].H[PNum]-Y;var CellShd=Cell.Get_Shd();if(CellShd&&(!CellShd.IsNil()||!this.bPresentation&&reviewtype_Common!==nReviewType))if(!this.bPresentation)if(reviewtype_Common!==nReviewType){if(reviewtype_Add===nReviewType)pGraphics.b_color1(225,242,250,255);else if(reviewtype_Remove===nReviewType)pGraphics.b_color1(252,230,244,255);pGraphics.TableRect(Math.min(X_cell_start,X_cell_end),Math.min(Y,Y+RealHeight),Math.abs(X_cell_end-X_cell_start),Math.abs(RealHeight))}else{var RGBA= CellShd.GetSimpleColor(Theme,ColorMap);if(true!==RGBA.Auto){pGraphics.b_color1(RGBA.r,RGBA.g,RGBA.b,255);if(pGraphics.SetShd)pGraphics.SetShd(CellShd);pGraphics.TableRect(Math.min(X_cell_start,X_cell_end),Math.min(Y,Y+RealHeight),Math.abs(X_cell_end-X_cell_start),Math.abs(RealHeight))}}else if(CellShd.Unifill&&CellShd.Unifill.fill){{var ShapeDrawer=new AscCommon.CShapeDrawer;CellShd.Unifill.check(Theme,ColorMap);var Transform=this.Parent.transform.CreateDublicate();global_MatrixTransformer.TranslateAppend(Transform, Math.min(X_cell_start,X_cell_end),Math.min(Y,Y+RealHeight));pGraphics.transform3(Transform,false);ShapeDrawer.fromShape2(new AscFormat.ObjectToDraw(CellShd.Unifill,null,Math.abs(X_cell_end-X_cell_start),Math.abs(RealHeight),null,Transform),pGraphics,null);ShapeDrawer.draw(null)}}}}if(this.bPresentation)pGraphics.RestoreGrState()};CTable.prototype.private_DrawCellsContent=function(pGraphics,PNum,Row_start,Row_last){if(this.HeaderInfo.Count>0&&PNum>this.HeaderInfo.PageIndex&&true===this.HeaderInfo.Pages[PNum].Draw){if(pGraphics.Start_Command)pGraphics.Start_Command(AscFormat.DRAW_COMMAND_TABLE_ROW); var HeaderPage=this.HeaderInfo.Pages[PNum];for(var CurRow=0;CurRow0&&PNum>this.HeaderInfo.PageIndex&&true===this.HeaderInfo.Pages[PNum].Draw){var Y=this.Y;var HeaderPage=this.HeaderInfo.Pages[PNum]; for(var CurRow=0;CurRow=0;CurCell--){var Cell=Row.Get_Cell(CurCell);var GridSpan=Cell.Get_GridSpan();var VMerge=Cell.GetVMerge();var CurGridCol=Row.Get_CellInfo(CurCell).StartGridCol;if(vmerge_Continue===VMerge){LastBorderTop={W:0,L:0};continue}var CellInfo=Row.Get_CellInfo(CurCell); var X_cell_start=Page.X+CellInfo.X_cell_start;var X_cell_end=Page.X+CellInfo.X_cell_end;var VMergeCount=this.Internal_GetVertMergeCount(CurRow,CurGridCol,GridSpan);var RealHeight=HeaderPage.RowsInfo[CurRow+VMergeCount-1].Y+HeaderPage.RowsInfo[CurRow+VMergeCount-1].H-Y;var CellBorders=Cell.Get_Borders();if(null!=CellSpacing){if(border_Single===CellBorders.Left.Value){RGBA=CellBorders.Left.Get_Color2(Theme,ColorMap);pGraphics.p_color(RGBA.r,RGBA.g,RGBA.b,255);if(pGraphics.SetBorder)pGraphics.SetBorder(CellBorders.Left); pGraphics.drawVerLine(c_oAscLineDrawingRule.Left,X_cell_start,Y,Y+RealHeight,CellBorders.Left.Size)}else pGraphics.DrawEmptyTableLine(X_cell_start,Y,X_cell_start,Y+RealHeight);if(border_Single===CellBorders.Right.Value){RGBA=CellBorders.Right.Get_Color2(Theme,ColorMap);pGraphics.p_color(RGBA.r,RGBA.g,RGBA.b,255);if(pGraphics.SetBorder)pGraphics.SetBorder(CellBorders.Right);pGraphics.drawVerLine(c_oAscLineDrawingRule.Right,X_cell_end,Y,Y+RealHeight,CellBorders.Right.Size)}else pGraphics.DrawEmptyTableLine(X_cell_end, Y,X_cell_end,Y+RealHeight);if(border_Single===CellBorders.Top.Value){RGBA=CellBorders.Top.Get_Color2(Theme,ColorMap);pGraphics.p_color(RGBA.r,RGBA.g,RGBA.b,255);if(pGraphics.SetBorder)pGraphics.SetBorder(CellBorders.Top);pGraphics.drawHorLineExt(c_oAscLineDrawingRule.Top,Y-CellBorders.Top.Size,X_cell_start,X_cell_end,CellBorders.Top.Size,0,0)}else pGraphics.DrawEmptyTableLine(X_cell_start,Y,X_cell_end,Y);if(border_Single===CellBorders.Bottom.Value){RGBA=CellBorders.Bottom.Get_Color2(Theme,ColorMap); pGraphics.p_color(RGBA.r,RGBA.g,RGBA.b,255);if(pGraphics.SetBorder)pGraphics.SetBorder(CellBorders.Bottom);pGraphics.drawHorLineExt(c_oAscLineDrawingRule.Bottom,Y+RealHeight+CellBorders.Bottom.Size,X_cell_start,X_cell_end,CellBorders.Bottom.Size,0,0)}else pGraphics.DrawEmptyTableLine(X_cell_start,Y+RealHeight,X_cell_end,Y+RealHeight)}else{var CellBordersInfo=Cell.GetBorderInfo();var BorderInfo_Left=CellBordersInfo.Left;var TempCurRow=Cell.Row.Index;var Row_side_border_start=0;var Row_side_border_end= BorderInfo_Left.length-1;for(var Index=Row_side_border_start;Index<=Row_side_border_end;Index++){var CurBorderInfo=BorderInfo_Left[Index];var Y0=HeaderPage.RowsInfo[TempCurRow+Index].Y;var Y1=HeaderPage.RowsInfo[TempCurRow+Index].Y+HeaderPage.RowsInfo[TempCurRow+Index].H;if(border_Single===CurBorderInfo.Value){RGBA=CurBorderInfo.Get_Color2(Theme,ColorMap);pGraphics.p_color(RGBA.r,RGBA.g,RGBA.b,255);if(pGraphics.SetBorder)pGraphics.SetBorder(CurBorderInfo);pGraphics.drawVerLine(c_oAscLineDrawingRule.Center, X_cell_start,Y0,Y1,CurBorderInfo.Size)}else if(0===CurCell)pGraphics.DrawEmptyTableLine(X_cell_start,Y0,X_cell_start,Y1)}var BorderInfo_Right=CellBordersInfo.Right;for(var Index=Row_side_border_start;Index<=Row_side_border_end;Index++){var CurBorderInfo=BorderInfo_Right[Index];var Y0=HeaderPage.RowsInfo[TempCurRow+Index].Y;var Y1=HeaderPage.RowsInfo[TempCurRow+Index].Y+HeaderPage.RowsInfo[TempCurRow+Index].H;var TempCellIndex=this.private_GetCellIndexByStartGridCol(TempCurRow+Index,CellInfo.StartGridCol); var TempCellsCount=HeaderPage.Rows[TempCurRow+Index].Get_CellsCount();if(TempCellsCount-1===TempCellIndex)if(border_Single===CurBorderInfo.Value){RGBA=CurBorderInfo.Get_Color2(Theme,ColorMap);pGraphics.p_color(RGBA.r,RGBA.g,RGBA.b,255);if(pGraphics.SetBorder)pGraphics.SetBorder(CurBorderInfo);pGraphics.drawVerLine(c_oAscLineDrawingRule.Center,X_cell_end,Y0,Y1,CurBorderInfo.Size)}else pGraphics.DrawEmptyTableLine(X_cell_end,Y0,X_cell_end,Y1);else if(border_None===CurBorderInfo.Value)pGraphics.DrawEmptyTableLine(X_cell_end, Y0,X_cell_end,Y1)}var LastBorderTop_prev={W:LastBorderTop.W,H:LastBorderTop.H};var BorderInfo_Top=CellBordersInfo.Top;for(var Index=0;IndexCurGridCol)break;if(null!=bLeft){var Prev_VMerge= Prev_Cell.GetVMerge();if(vmerge_Continue===Prev_VMerge)Prev_Cell=this.Internal_Get_StartMergedCell(CurRow-1,Prev_GridCol,Prev_GridSpan);if(null===Prev_Cell)break;var Num=CurRow-1-Prev_Cell.Row.Index;if(Num<0)break;if(true===bLeft){var Prev_Cell_BorderInfo_Left=Prev_Cell.GetBorderInfo().Left;if(null!=Prev_Cell_BorderInfo_Left&&Prev_Cell_BorderInfo_Left.length>Num&&border_Single===Prev_Cell_BorderInfo_Left[Num].Value)Max_r=Prev_Cell_BorderInfo_Left[Num].Size/2}else{var Prev_Cell_BorderInfo_Right=Prev_Cell.GetBorderInfo().Right; if(null!=Prev_Cell_BorderInfo_Right&&Prev_Cell_BorderInfo_Right.length>Num&&border_Single===Prev_Cell_BorderInfo_Right[Num].Value)Max_r=Prev_Cell_BorderInfo_Right[Num].Size/2}break}}}if(BorderInfo_Right.length>0&&border_Single===BorderInfo_Right[0].Value&&BorderInfo_Right[0].Size/2>Max_r)Max_r=BorderInfo_Right[0].Size/2;if(border_Single===CurBorderInfo.Value&&CurBorderInfo.Size>LastBorderTop_prev.W)RightMW=Max_r;else RightMW=-Max_r}if(0===Index){var Max_l=0;if(0!=CurRow){var Prev_Row=this.Content[CurRow- 1];var Prev_CellsCount=Prev_Row.Get_CellsCount();for(var TempIndex=0;TempIndexCurGridCol)break;if(null!=bLeft){var Prev_VMerge=Prev_Cell.GetVMerge();if(vmerge_Continue===Prev_VMerge)Prev_Cell= this.Internal_Get_StartMergedCell(CurRow-1,Prev_GridCol,Prev_GridSpan);if(null===Prev_Cell)break;var Num=CurRow-1-Prev_Cell.Row.Index;if(Num<0)break;if(true===bLeft){var Prev_Cell_BorderInfo_Left=Prev_Cell.GetBorderInfo().Left;if(null!=Prev_Cell_BorderInfo_Left&&Prev_Cell_BorderInfo_Left.length>Num&&border_Single===Prev_Cell_BorderInfo_Left[Num].Value)Max_l=Prev_Cell_BorderInfo_Left[Num].Size/2}else{var Prev_Cell_BorderInfo_Right=Prev_Cell.GetBorderInfo().Right;if(null!=Prev_Cell_BorderInfo_Right&& Prev_Cell_BorderInfo_Right.length>Num&&border_Single===Prev_Cell_BorderInfo_Right[Num].Value)Max_l=Prev_Cell_BorderInfo_Right[Num].Size/2}break}}}if(BorderInfo_Left.length>0&&border_Single===BorderInfo_Left[0].Value&&BorderInfo_Left[0].Size/2>Max_l)Max_l=BorderInfo_Left[0].Size/2;LastBorderTop.L=Max_l;LastBorderTop.W=0;if(border_Single===CurBorderInfo.Value)LastBorderTop.W=CurBorderInfo.Size}if(border_Single===CurBorderInfo.Value){RGBA=CurBorderInfo.Get_Color2(Theme,ColorMap);pGraphics.p_color(RGBA.r, RGBA.g,RGBA.b,255);if(pGraphics.SetBorder)pGraphics.SetBorder(CurBorderInfo);pGraphics.drawHorLineExt(c_oAscLineDrawingRule.Top,Y,X0,X1,CurBorderInfo.Size,LeftMW,RightMW)}else pGraphics.DrawEmptyTableLine(X0+LeftMW,Y,X1+RightMW,Y)}}}}}var Y=this.Y;for(var CurRow=Row_start;CurRow<=Row_last;CurRow++){var Row=this.Content[CurRow];var CellsCount=Row.Get_CellsCount();Y=this.RowsInfo[CurRow].Y[PNum];var CellSpacing=Row.Get_CellSpacing();var LastBorderTop={W:0,L:0};var oHeaderLastRow=null;if(CurRow===Row_start&& this.HeaderInfo.Count>0&&PNum>this.HeaderInfo.PageIndex&&true===this.HeaderInfo.Pages[PNum].Draw&&this.HeaderInfo.Pages[PNum].Rows.length>0)oHeaderLastRow=this.HeaderInfo.Pages[PNum].Rows[this.HeaderInfo.Pages[PNum].Rows.length-1];for(var CurCell=CellsCount-1;CurCell>=0;CurCell--){var Cell=Row.Get_Cell(CurCell);var GridSpan=Cell.Get_GridSpan();var VMerge=Cell.GetVMerge();var CurGridCol=Row.Get_CellInfo(CurCell).StartGridCol;if(vmerge_Continue===VMerge)if(Row_start===CurRow){Cell=this.Internal_Get_StartMergedCell(CurRow, CurGridCol,GridSpan);if(null===Cell){LastBorderTop={W:0,L:0};continue}}else{LastBorderTop={W:0,L:0};continue}var CellInfo=Row.Get_CellInfo(CurCell);var X_cell_start=Page.X+CellInfo.X_cell_start;var X_cell_end=Page.X+CellInfo.X_cell_end;var VMergeCount=this.private_GetVertMergeCountOnPage(PNum,CurRow,CurGridCol,GridSpan);if(VMergeCount<=0){LastBorderTop={W:0,L:0};continue}var RealHeight=this.RowsInfo[CurRow+VMergeCount-1].Y[PNum]+this.RowsInfo[CurRow+VMergeCount-1].H[PNum]-Y;var CellBorders=Cell.Get_Borders(); if(null!=CellSpacing){if(border_Single===CellBorders.Left.Value){RGBA=CellBorders.Left.Get_Color2(Theme,ColorMap);pGraphics.p_color(RGBA.r,RGBA.g,RGBA.b,255);if(pGraphics.SetBorder)pGraphics.SetBorder(CellBorders.Left);pGraphics.drawVerLine(c_oAscLineDrawingRule.Left,X_cell_start,Y-CellBorders.Top.Size,Y+RealHeight+CellBorders.Bottom.Size,CellBorders.Left.Size)}else pGraphics.DrawEmptyTableLine(X_cell_start,Y,X_cell_start,Y+RealHeight);if(border_Single===CellBorders.Right.Value){RGBA=CellBorders.Right.Get_Color2(Theme, ColorMap);pGraphics.p_color(RGBA.r,RGBA.g,RGBA.b,255);if(pGraphics.SetBorder)pGraphics.SetBorder(CellBorders.Right);pGraphics.drawVerLine(c_oAscLineDrawingRule.Right,X_cell_end,Y-CellBorders.Top.Size,Y+RealHeight+CellBorders.Bottom.Size,CellBorders.Right.Size)}else pGraphics.DrawEmptyTableLine(X_cell_end,Y,X_cell_end,Y+RealHeight);if(border_Single===CellBorders.Top.Value){RGBA=CellBorders.Top.Get_Color2(Theme,ColorMap);pGraphics.p_color(RGBA.r,RGBA.g,RGBA.b,255);if(pGraphics.SetBorder)pGraphics.SetBorder(CellBorders.Top); pGraphics.drawHorLineExt(c_oAscLineDrawingRule.Top,Y-CellBorders.Top.Size,X_cell_start,X_cell_end,CellBorders.Top.Size,0,0)}else pGraphics.DrawEmptyTableLine(X_cell_start,Y,X_cell_end,Y);if(border_Single===CellBorders.Bottom.Value){RGBA=CellBorders.Bottom.Get_Color2(Theme,ColorMap);pGraphics.p_color(RGBA.r,RGBA.g,RGBA.b,255);if(pGraphics.SetBorder)pGraphics.SetBorder(CellBorders.Bottom);pGraphics.drawHorLineExt(c_oAscLineDrawingRule.Bottom,Y+RealHeight+CellBorders.Bottom.Size,X_cell_start,X_cell_end, CellBorders.Bottom.Size,0,0)}else pGraphics.DrawEmptyTableLine(X_cell_start,Y+RealHeight,X_cell_end,Y+RealHeight)}else{var CellBordersInfo=Cell.GetBorderInfo();var BorderInfo_Left=CellBordersInfo.Left;var TempCurRow=Cell.Row.Index;var Row_side_border_start=TempCurRowRow_last?Row_last-TempCurRow+1:BorderInfo_Left.length-1;for(var Index=Row_side_border_start;Index<=Row_side_border_end;Index++){var CurBorderInfo= BorderInfo_Left[Index];var Y0=this.RowsInfo[TempCurRow+Index].Y[PNum];var Y1=this.RowsInfo[TempCurRow+Index].Y[PNum]+this.RowsInfo[TempCurRow+Index].H[PNum];if(border_Single===CurBorderInfo.Value){RGBA=CurBorderInfo.Get_Color2(Theme,ColorMap);pGraphics.p_color(RGBA.r,RGBA.g,RGBA.b,255);if(pGraphics.SetBorder)pGraphics.SetBorder(CurBorderInfo);pGraphics.drawVerLine(c_oAscLineDrawingRule.Center,X_cell_start,Y0,Y1,CurBorderInfo.Size)}else if(0===CurCell)pGraphics.DrawEmptyTableLine(X_cell_start,Y0,X_cell_start, Y1)}var BorderInfo_Right=CellBordersInfo.Right;for(var Index=Row_side_border_start;Index<=Row_side_border_end;Index++){var CurBorderInfo=BorderInfo_Right[Index];var Y0=this.RowsInfo[TempCurRow+Index].Y[PNum];var Y1=this.RowsInfo[TempCurRow+Index].Y[PNum]+this.RowsInfo[TempCurRow+Index].H[PNum];var TempCellIndex=this.private_GetCellIndexByStartGridCol(TempCurRow+Index,CellInfo.StartGridCol);var TempCellsCount=this.Content[TempCurRow+Index].Get_CellsCount();if(TempCellsCount-1===TempCellIndex)if(border_Single=== CurBorderInfo.Value){RGBA=CurBorderInfo.Get_Color2(Theme,ColorMap);pGraphics.p_color(RGBA.r,RGBA.g,RGBA.b,255);if(pGraphics.SetBorder)pGraphics.SetBorder(CurBorderInfo);pGraphics.drawVerLine(c_oAscLineDrawingRule.Center,X_cell_end,Y0,Y1,CurBorderInfo.Size)}else pGraphics.DrawEmptyTableLine(X_cell_end,Y0,X_cell_end,Y1);else if(border_None===CurBorderInfo.Value)pGraphics.DrawEmptyTableLine(X_cell_end,Y0,X_cell_end,Y1)}var BorderInfo_Top=oHeaderLastRow?CellBordersInfo.TopHeader:CellBordersInfo.Top;var LastBorderTop_prev= {W:LastBorderTop.W,H:LastBorderTop.H};for(var Index=0;IndexCurGridCol)break;if(null!=bLeft){var Prev_VMerge=Prev_Cell.GetVMerge();if(vmerge_Continue=== Prev_VMerge)Prev_Cell=this.Internal_Get_StartMergedCell(CurRow-1,Prev_GridCol,Prev_GridSpan);if(null===Prev_Cell)break;var Num=CurRow-1-Prev_Cell.Row.Index;if(Num<0)break;if(true===bLeft){var Prev_Cell_BorderInfo_Left=Prev_Cell.GetBorderInfo().Left;if(null!=Prev_Cell_BorderInfo_Left&&Prev_Cell_BorderInfo_Left.length>Num&&border_Single===Prev_Cell_BorderInfo_Left[Num].Value)Max_r=Prev_Cell_BorderInfo_Left[Num].Size/2}else{var Prev_Cell_BorderInfo_Right=Prev_Cell.GetBorderInfo().Right;if(null!=Prev_Cell_BorderInfo_Right&& Prev_Cell_BorderInfo_Right.length>Num&&border_Single===Prev_Cell_BorderInfo_Right[Num].Value)Max_r=Prev_Cell_BorderInfo_Right[Num].Size/2}break}}}if(BorderInfo_Right.length>0&&border_Single===BorderInfo_Right[0].Value&&BorderInfo_Right[0].Size/2>Max_r)Max_r=BorderInfo_Right[0].Size/2;if(border_Single===CurBorderInfo.Value&&CurBorderInfo.Size>LastBorderTop_prev.W)RightMW=Max_r;else RightMW=-Max_r;if(border_Single===BorderInfo_Right[0].Value&&CurBorderInfo.Size<=BorderInfo_Right[0].Size)RightMW=-BorderInfo_Right[0].Size/ 2}if(0===Index){var Max_l=0;if(oHeaderLastRow||0!=CurRow){var Prev_Row=oHeaderLastRow?oHeaderLastRow:this.Content[CurRow-1];var Prev_CellsCount=Prev_Row.Get_CellsCount();for(var TempIndex=0;TempIndex CurGridCol)break;if(null!=bLeft){var Prev_VMerge=Prev_Cell.GetVMerge();if(vmerge_Continue===Prev_VMerge)Prev_Cell=this.Internal_Get_StartMergedCell(CurRow-1,Prev_GridCol,Prev_GridSpan);if(null===Prev_Cell)break;var Num=CurRow-1-Prev_Cell.Row.Index;if(Num<0)break;if(true===bLeft){var Prev_Cell_BorderInfo_Left=Prev_Cell.GetBorderInfo().Left;if(null!=Prev_Cell_BorderInfo_Left&&Prev_Cell_BorderInfo_Left.length>Num&&border_Single===Prev_Cell_BorderInfo_Left[Num].Value)Max_l=Prev_Cell_BorderInfo_Left[Num].Size/ 2}else{var Prev_Cell_BorderInfo_Right=Prev_Cell.GetBorderInfo().Right;if(null!=Prev_Cell_BorderInfo_Right&&Prev_Cell_BorderInfo_Right.length>Num&&border_Single===Prev_Cell_BorderInfo_Right[Num].Value)Max_l=Prev_Cell_BorderInfo_Right[Num].Size/2}break}}}if(BorderInfo_Left.length>0&&border_Single===BorderInfo_Left[0].Value&&BorderInfo_Left[0].Size/2>Max_l)Max_l=BorderInfo_Left[0].Size/2;LeftMW=-Max_l;if(border_Single===BorderInfo_Left[0].Value&&CurBorderInfo.Size<=BorderInfo_Left[0].Size)LeftMW=BorderInfo_Left[0].Size/ 2;LastBorderTop.L=Max_l;LastBorderTop.W=0;if(border_Single===CurBorderInfo.Value)LastBorderTop.W=CurBorderInfo.Size}if(border_Single===CurBorderInfo.Value){RGBA=CurBorderInfo.Get_Color2(Theme,ColorMap);pGraphics.p_color(RGBA.r,RGBA.g,RGBA.b,255);if(pGraphics.SetBorder)pGraphics.SetBorder(CurBorderInfo);pGraphics.drawHorLineExt(c_oAscLineDrawingRule.Top,Y,X0,X1,CurBorderInfo.Size,LeftMW,RightMW)}else pGraphics.DrawEmptyTableLine(X0+LeftMW,Y,X1+RightMW,Y)}if(PNum!=this.Pages.length-1&&CurRow+VMergeCount- 1===Row_last){var X0=X_cell_start;var X1=X_cell_end;var LowerCell=this.private_GetCellIndexByStartGridCol(CurRow+VMergeCount-1,Row.Get_CellInfo(CurCell).StartGridCol);var BottomBorder=-1===LowerCell?this.Pages[PNum].BotBorders[0]:this.Pages[PNum].BotBorders[LowerCell];if(border_Single===BottomBorder.Value){RGBA=BottomBorder.Get_Color2(Theme,ColorMap);pGraphics.p_color(RGBA.r,RGBA.g,RGBA.b,255);if(pGraphics.SetBorder)pGraphics.SetBorder(BottomBorder);var X0=X_cell_start;var X1=X_cell_end;var LeftMW= 0;if(BorderInfo_Left.length>0&&border_Single===BorderInfo_Left[BorderInfo_Left.length-1].Value)LeftMW=-BorderInfo_Left[BorderInfo_Left.length-1].Size/2;var RightMW=0;if(BorderInfo_Right.length>0&&border_Single===BorderInfo_Right[BorderInfo_Right.length-1].Value)RightMW=+BorderInfo_Right[BorderInfo_Right.length-1].Size/2;pGraphics.drawHorLineExt(c_oAscLineDrawingRule.Top,Y+RealHeight,X0,X1,BottomBorder.Size,LeftMW,RightMW)}else pGraphics.DrawEmptyTableLine(X_cell_start,Y+RealHeight,X_cell_end,Y+RealHeight)}else{var BorderInfo_Bottom= CellBordersInfo.Bottom;var BorderInfo_Bottom_BeforeCount=CellBordersInfo.Bottom_BeforeCount;var BorderInfo_Bottom_AfterCount=CellBordersInfo.Bottom_AfterCount;if(null!=BorderInfo_Bottom&&BorderInfo_Bottom.length>0)if(-1===BorderInfo_Bottom_BeforeCount&&-1===BorderInfo_Bottom_AfterCount){var BottomBorder=BorderInfo_Bottom[0];if(border_Single===BottomBorder.Value){RGBA=BottomBorder.Get_Color2(Theme,ColorMap);pGraphics.p_color(RGBA.r,RGBA.g,RGBA.b,255);if(pGraphics.SetBorder)pGraphics.SetBorder(BottomBorder); var X0=X_cell_start;var X1=X_cell_end;var LeftMW=0;if(BorderInfo_Left.length>0&&border_Single===BorderInfo_Left[BorderInfo_Left.length-1].Value)LeftMW=-BorderInfo_Left[BorderInfo_Left.length-1].Size/2;var RightMW=0;if(BorderInfo_Right.length>0&&border_Single===BorderInfo_Right[BorderInfo_Right.length-1].Value)RightMW=+BorderInfo_Right[BorderInfo_Right.length-1].Size/2;pGraphics.drawHorLineExt(c_oAscLineDrawingRule.Top,Y+RealHeight,X0,X1,BottomBorder.Size,LeftMW,RightMW)}else pGraphics.DrawEmptyTableLine(X_cell_start, Y+RealHeight,X_cell_end,Y+RealHeight)}else{for(var Index=0;Index0&&border_Single===BorderInfo_Left[BorderInfo_Left.length-1].Value)LeftMW=-BorderInfo_Left[BorderInfo_Left.length-1].Size/2;pGraphics.drawHorLineExt(c_oAscLineDrawingRule.Top,Y+RealHeight,X0,X1,BottomBorder.Size,LeftMW,0)}else pGraphics.DrawEmptyTableLine(X_cell_start,Y+RealHeight,X_cell_end,Y+RealHeight)}for(var Index=0;Index0&&border_Single===BorderInfo_Right[BorderInfo_Right.length-1].Value)RightMW=+BorderInfo_Right[BorderInfo_Right.length-1].Size/2;pGraphics.drawHorLineExt(c_oAscLineDrawingRule.Top, Y+RealHeight,X0,X1,BottomBorder.Size,0,RightMW)}else pGraphics.DrawEmptyTableLine(X_cell_start,Y+RealHeight,X_cell_end,Y+RealHeight)}}}}}}};CTable.prototype.private_GetTableCellsBackgroundFrames=function(nCurPage,nStartRow,nLastRow){var arrFrames=[];var oPage=this.Pages[nCurPage];if(this.HeaderInfo.Count>0&&nCurPage>this.HeaderInfo.PageIndex&&true===this.HeaderInfo.Pages[nCurPage].Draw){var oHeaderPage=this.HeaderInfo.Pages[nCurPage];for(var nCurRow=0;nCurRow=0;--nCurCell){var oCell=oRow.GetCell(nCurCell);var nGridSpan=oCell.GetGridSpan();var nVMerge=oCell.GetVMerge();var nCurGridCol=oRow.GetCellInfo(nCurCell).StartGridCol;var oBorders=oCell.GetBorders();var nTopBorderSize=border_Single===oBorders.Top.Value?oBorders.Top.Size:0;var nBottomBorderSize=border_Single===oBorders.Bottom.Value?oBorders.Bottom.Size:0;if(vmerge_Continue=== nVMerge)continue;var oCellInfo=oRow.GetCellInfo(nCurCell);var X_cell_start=oPage.X+oCellInfo.X_cell_start;var X_cell_end=oPage.X+oCellInfo.X_cell_end;var nVMergeCount=this.Internal_GetVertMergeCount(nCurRow,nCurGridCol,nGridSpan);var nRealHeight=oHeaderPage.RowsInfo[nCurRow+nVMergeCount-1].Y+oHeaderPage.RowsInfo[nCurRow+nVMergeCount-1].H-nY;arrFrames.push({X:X_cell_start,Y:nY-nTopBorderSize,W:X_cell_end-X_cell_start,H:nRealHeight+nBottomBorderSize+nTopBorderSize,GridCol:nCurGridCol,GridSpan:nGridSpan})}}}for(var nCurRow= nStartRow;nCurRow<=nLastRow;++nCurRow){var oRow=this.GetRow(nCurRow);var nCellsCount=oRow.GetCellsCount();var nY=this.RowsInfo[nCurRow].Y[nCurPage];for(var nCurCell=nCellsCount-1;nCurCell>=0;--nCurCell){var oCell=oRow.GetCell(nCurCell);var nGridSpan=oCell.GetGridSpan();var nVMerge=oCell.GetVMerge();var nCurGridCol=oRow.GetCellInfo(nCurCell).StartGridCol;var oBorders=oCell.GetBorders();var nTopBorderSize=border_Single===oBorders.Top.Value?oBorders.Top.Size:0;var nBottomBorderSize=border_Single===oBorders.Bottom.Value? oBorders.Bottom.Size:0;if(vmerge_Continue===nVMerge)if(nStartRow===nCurRow){oCell=this.Internal_Get_StartMergedCell(nCurRow,nCurGridCol,nGridSpan);if(null===oCell)continue}else continue;var oCellInfo=oRow.GetCellInfo(nCurCell);var X_cell_start=oPage.X+oCellInfo.X_cell_start;var X_cell_end=oPage.X+oCellInfo.X_cell_end;var nVMergeCount=this.private_GetVertMergeCountOnPage(nCurPage,nCurRow,nCurGridCol,nGridSpan);if(nVMergeCount<=0)continue;var nRealHeight=this.RowsInfo[nCurRow+nVMergeCount-1].Y[nCurPage]+ this.RowsInfo[nCurRow+nVMergeCount-1].H[nCurPage]-nY;arrFrames.push({X:X_cell_start,Y:nY-nTopBorderSize,W:X_cell_end-X_cell_start,H:nRealHeight+nBottomBorderSize+nTopBorderSize,GridCol:nCurGridCol,GridSpan:nGridSpan})}}return arrFrames};"use strict";var History=AscCommon.History;function CTableRow(Table,Cols,TableGrid){this.Id=AscCommon.g_oIdCounter.Get_NewId();this.Table=Table;this.Next=null;this.Prev=null;this.Content=[];for(var Index=0;Index0)return this.Content[CellsCount-1].GetEndInfo();else return null},GetPrevElementEndInfo:function(CellIndex){if(-1===CellIndex||!this.Table)return null;if(0===CellIndex)return this.Table.GetPrevElementEndInfo(this.Index); else return this.Content[CellIndex-1].GetEndInfo()},SaveRecalculateObject:function(){var RecalcObj=new CTableRowRecalculateObject;RecalcObj.Save(this);return RecalcObj},LoadRecalculateObject:function(RecalcObj){RecalcObj.Load(this)},PrepareRecalculateObject:function(){this.CellsInfo=[];this.Metrics={X_min:0,X_max:0};this.SpacingInfo={Top:false,Bottom:false};var Count=this.Content.length;for(var Index=0;Index=this.Content.length)return null;return this.Content[Index]},Get_CellsCount:function(){return this.Content.length},Set_CellInfo:function(Index,StartGridCol,X_grid_start,X_grid_end,X_cell_start,X_cell_end, X_content_start,X_content_end){this.CellsInfo[Index]={StartGridCol:StartGridCol,X_grid_start:X_grid_start,X_grid_end:X_grid_end,X_cell_start:X_cell_start,X_cell_end:X_cell_end,X_content_start:X_content_start,X_content_end:X_content_end}},Update_CellInfo:function(Index){var Cell=this.Content[Index];var StartGridCol=Cell.Metrics.StartGridCol;var X_grid_start=Cell.Metrics.X_grid_start;var X_grid_end=Cell.Metrics.X_grid_end;var X_cell_start=Cell.Metrics.X_cell_start;var X_cell_end=Cell.Metrics.X_cell_end; var X_content_start=Cell.Metrics.X_content_start;var X_content_end=Cell.Metrics.X_content_end;this.Set_CellInfo(Index,StartGridCol,X_grid_start,X_grid_end,X_cell_start,X_cell_end,X_content_start,X_content_end)},Get_CellInfo:function(Index){if(!this.CellsInfo[Index]||undefined===this.CellsInfo[Index].StartGridCol)this.GetTable().private_RecalculateGridCols();return this.CellsInfo[Index]},Get_StartGridCol:function(Index){var Max=Math.min(this.Content.length-1,Index-1);var CurGridCol=this.Get_Before().GridBefore; for(var CurCell=0;CurCell<=Max;CurCell++){var Cell=this.Get_Cell(CurCell);var GridSpan=Cell.Get_GridSpan();CurGridCol+=GridSpan}return CurGridCol},Remove_Cell:function(Index){History.Add(new CChangesTableRowRemoveCell(this,Index,[this.Content[Index]]));this.Content.splice(Index,1);this.CellsInfo.splice(Index,1);this.Internal_ReIndexing(Index);this.private_CheckCurCell();this.private_UpdateTableGrid()},Add_Cell:function(Index,Row,Cell,bReIndexing){if("undefined"===typeof Cell||null===Cell)Cell=new CTableCell(Row); History.Add(new CChangesTableRowAddCell(this,Index,[Cell]));this.Content.splice(Index,0,Cell);this.CellsInfo.splice(Index,0,{});if(true===bReIndexing)this.Internal_ReIndexing(Index);else{if(Index>0){this.Content[Index-1].Next=Cell;Cell.Prev=this.Content[Index-1]}else Cell.Prev=null;if(Index0?this.Content[Ind-1]:null;this.Content[Ind].Next=Ind0){arrPos.splice(0,0,{Class:oTable,Position:this.GetIndex()});oTable.GetDocumentPositionFromObject(arrPos)}else{oTable.GetDocumentPositionFromObject(arrPos);arrPos.push({Class:oTable,Position:this.GetIndex()})}return arrPos};CTableRow.prototype.GetCell=function(nCellIndex){return this.Get_Cell(nCellIndex)};CTableRow.prototype.GetCellsCount=function(){return this.Get_CellsCount()};CTableRow.prototype.AddCell=function(nIndex,oRow,oCell,isReIndexing){this.Add_Cell(nIndex, oRow,oCell,isReIndexing)};CTableRow.prototype.RemoveCell=function(nIndex){this.Remove_Cell(nIndex)};CTableRow.prototype.GetCellInfo=function(nIndex){return this.Get_CellInfo(nIndex)};CTableRow.prototype.GetCellSpacing=function(){return this.Get_CellSpacing()};CTableRow.prototype.GetHeight=function(){return this.Get_Height()};CTableRow.prototype.SetHeight=function(nValue,nHRule){return this.Set_Height(nValue,nHRule)};CTableRow.prototype.GetBefore=function(){var oRowPr=this.Get_CompiledPr(false);return{W:oRowPr.WBefore.Copy(), Grid:oRowPr.GridBefore}};CTableRow.prototype.SetBefore=function(Grid,W){this.Set_Before(Grid,W)};CTableRow.prototype.GetAfter=function(){var oRowPr=this.Get_CompiledPr(false);return{W:oRowPr.WAfter.Copy(),Grid:oRowPr.GridAfter}};CTableRow.prototype.SetAfter=function(Grid,W){this.Set_After(Grid,W)};CTableRow.prototype.GetTopMargin=function(){var nTopMargin=0;for(var nCurCell=0,nCellsCount=this.GetCellsCount();nCurCellnTopMargin)nTopMargin=oMargins.Top.W}return nTopMargin};CTableRow.prototype.GetBottomMargin=function(){var nBottomMargin=0;for(var nCurCell=0,nCellsCount=this.GetCellsCount();nCurCell1)continue;var oMargins=oCell.GetMargins();if(oMargins.Bottom.W>nBottomMargin)nBottomMargin= oMargins.Bottom.W}return nBottomMargin};CTableRow.prototype.IsHeader=function(){return this.Get_CompiledPr(false).TableHeader};CTableRow.prototype.SetHeader=function(isHeader){if(isHeader===this.Pr.TableHeader)return;this.private_AddPrChange();History.Add(new CChangesTableRowTableHeader(this,this.Pr.TableHeader,isHeader));this.Pr.TableHeader=isHeader;this.Recalc_CompiledPr();this.RecalcCopiledPrCells()};CTableRow.prototype.RecalcCopiledPrCells=function(){for(var nCurCell=0,nCellsCount=this.GetCellsCount();nCurCell< nCellsCount;++nCurCell)this.GetCell(nCurCell).Recalc_CompiledPr()};CTableRow.prototype.GetReviewType=function(){return this.ReviewType};CTableRow.prototype.GetReviewInfo=function(){return this.ReviewInfo};CTableRow.prototype.SetReviewType=function(nType,isCheckDeleteAdded){if(nType!==this.ReviewType){var OldReviewType=this.ReviewType;var OldReviewInfo=this.ReviewInfo.Copy();if(reviewtype_Add===this.ReviewType&&reviewtype_Remove===nType&&true===isCheckDeleteAdded)this.ReviewInfo.SavePrev(this.ReviewType); this.ReviewType=nType;this.ReviewInfo.Update();History.Add(new CChangesTableRowReviewType(this,{ReviewType:OldReviewType,ReviewInfo:OldReviewInfo},{ReviewType:this.ReviewType,ReviewInfo:this.ReviewInfo.Copy()}));this.private_UpdateTrackRevisions()}};CTableRow.prototype.SetReviewTypeWithInfo=function(nType,oInfo){History.Add(new CChangesTableRowReviewType(this,{ReviewType:this.ReviewType,ReviewInfo:this.ReviewInfo?this.ReviewInfo.Copy():undefined},{ReviewType:nType,ReviewInfo:oInfo?oInfo.Copy():undefined})); this.ReviewType=nType;this.ReviewInfo=oInfo;this.private_UpdateTrackRevisions()};CTableRow.prototype.private_UpdateTrackRevisions=function(){var oTable=this.GetTable();if(oTable)oTable.UpdateTrackRevisions()};CTableRow.prototype.HavePrChange=function(){return this.Pr.HavePrChange()};CTableRow.prototype.AddPrChange=function(){if(false===this.HavePrChange()){this.Pr.AddPrChange();History.Add(new CChangesTableRowPrChange(this,{PrChange:undefined,ReviewInfo:undefined},{PrChange:this.Pr.PrChange,ReviewInfo:this.Pr.ReviewInfo})); this.private_UpdateTrackRevisions()}};CTableRow.prototype.RemovePrChange=function(){if(true===this.HavePrChange()){History.Add(new CChangesTableRowPrChange(this,{PrChange:this.Pr.PrChange,ReviewInfo:this.Pr.ReviewInfo},{PrChange:undefined,ReviewInfo:undefined}));this.Pr.RemovePrChange();this.private_UpdateTrackRevisions()}};CTableRow.prototype.private_AddPrChange=function(){var oTable=this.GetTable();if(oTable&&oTable.LogicDocument&&true===oTable.LogicDocument.IsTrackRevisions()&&true!==this.HavePrChange()&& reviewtype_Common===this.GetReviewType()){this.AddPrChange();oTable.AddPrChange()}};CTableRow.prototype.AcceptPrChange=function(){this.RemovePrChange()};CTableRow.prototype.RejectPrChange=function(){if(this.HavePrChange()){this.Set_Pr(this.Pr.PrChange);this.RemovePrChange()}};CTableRow.prototype.private_CheckCurCell=function(){if(this.GetTable())this.GetTable().private_CheckCurCell()};CTableRow.prototype.private_UpdateTableGrid=function(){var oTable=this.GetTable();if(oTable)oTable.private_UpdateTableGrid()}; CTableRow.prototype.FindParaWithStyle=function(sStyleId,bBackward,nStartIdx){var nSearchStartIdx,nIdx,oResult,oContent;if(bBackward){if(nStartIdx!==null)nSearchStartIdx=Math.min(nStartIdx,this.Content.length-1);else nSearchStartIdx=this.Content.length-1;for(nIdx=nSearchStartIdx;nIdx>=0;--nIdx){oContent=this.Content[nIdx].GetContent();oResult=oContent.FindParaWithStyle(sStyleId,bBackward,null);if(oResult)return oResult}}else{if(nStartIdx!==null)nSearchStartIdx=Math.max(nStartIdx,0);else nSearchStartIdx= 0;for(nIdx=nSearchStartIdx;nIdxoMargins.Left.W)nAdd+= oBorders.Left.Size/2;else nAdd+=oMargins.Left.W;if(border_Single===oBorders.Right.Value&&oBorders.Right.Size/2>oMargins.Right.W)nAdd+=oBorders.Right.Size/2;else nAdd+=oMargins.Right.W}}else nAdd=oMargins.Left.W+oMargins.Right.W;oResult.Min+=nAdd;oResult.Max+=nAdd;oResult.ContentMin=oResult.Min;oResult.ContentMax=oResult.Max;var oPrefW=this.GetW();if(tblwidth_Mm===oPrefW.Type){if(oResult.Min0&&nCellsCount>0){var oPrevCell=oRow.GetCell(nCurCell<=nCellsCount?nCurCell-1:nCellsCount-1);if(oPrevCell)oTable.RecalcInfo.Add_Cell(oPrevCell)}if(nCurCell< nCellsCount-1&&nCurCell>=0&&nCellsCount>0){var oNextCell=oRow.GetCell(nCurCell+1);if(oNextCell)oTable.RecalcInfo.Add_Cell(oRow.GetCell(nCurCell+1))}var TablePr=oTable.Get_CompiledPr(false).TablePr;if(tbllayout_AutoFit===TablePr.TableLayout)if(oTable.Parent&&oTable.Parent.Pages.length>0)History.Add_RecalcTableGrid(oTable.Get_Id());else return oTable.Refresh_RecalcData2(0,0);oRow.Refresh_RecalcData2(nCurCell,Page_Rel)},Write_ToBinary2:function(Writer){Writer.WriteLong(AscDFH.historyitem_type_TableCell); Writer.WriteString2(this.Id);this.Pr.Write_ToBinary(Writer);Writer.WriteString2(this.Content.Get_Id())},Read_FromBinary2:function(Reader){this.Id=Reader.GetString2();this.Pr=new CTableCellPr;this.Pr.Read_FromBinary(Reader);this.Recalc_CompiledPr();this.Content=AscCommon.g_oTableId.Get_ById(Reader.GetString2());if(this.Content)this.Content.Parent=this;AscCommon.CollaborativeEditing.Add_NewObject(this)},Load_LinkData:function(LinkData){}};CTableCell.prototype.GetContent=function(){return this.Content}; CTableCell.prototype.GetRow=function(){return this.Row};CTableCell.prototype.GetTable=function(){var oRow=this.GetRow();if(!oRow)return null;return oRow.GetTable()};CTableCell.prototype.GetTableParent=function(){var oTable=this.GetTable();if(!oTable)return null;return oTable.GetParent()};CTableCell.prototype.GetIndex=function(){return this.Index};CTableCell.prototype.SetIndex=function(nIndex){if(nIndex!=this.Index){this.Index=nIndex;this.Recalc_CompiledPr()}};CTableCell.prototype.private_TransformXY= function(X,Y){var _X=X,_Y=Y;var Transform=this.private_GetTextDirectionTransform();if(null!==Transform){Transform=global_MatrixTransformer.Invert(Transform);_X=Transform.TransformPointX(X,Y);_Y=Transform.TransformPointY(X,Y)}return{X:_X,Y:_Y}};CTableCell.prototype.GetTopElement=function(){if(this.Row&&this.Row.Table)return this.Row.Table.GetTopElement();return null};CTableCell.prototype.Is_EmptyFirstPage=function(){if(!this.Row||!this.Row.Table||!this.Row.Table.RowsInfo[this.Row.Index]||true===this.Row.Table.RowsInfo[this.Row.Index].FirstPage)return true; return false};CTableCell.prototype.Get_SectPr=function(){if(this.Row&&this.Row.Table&&this.Row.Table)return this.Row.Table.Get_SectPr();return null};CTableCell.prototype.GetDocumentPositionFromObject=function(arrPos){if(!arrPos)arrPos=[];var oRow=this.GetRow();if(oRow)if(arrPos.length>0){arrPos.splice(0,0,{Class:oRow,Position:this.GetIndex()});oRow.GetDocumentPositionFromObject(arrPos)}else{oRow.GetDocumentPositionFromObject(arrPos);arrPos.push({Class:oRow,Position:this.GetIndex()})}return arrPos}; CTableCell.prototype.Get_Table=function(){var Row=this.Row;if(!Row)return null;var Table=Row.Table;if(!Table)return null;return Table};CTableCell.prototype.GetTopDocumentContent=function(isOneLevel){if(this.Row&&this.Row.Table&&this.Row.Table.Parent)return this.Row.Table.Parent.GetTopDocumentContent(isOneLevel);return null};CTableCell.prototype.InsertTableContent=function(oTable){if(!this.Row||!this.Row.Table)return;this.Row.Table.InsertTableContent(this.Index,this.Row.Index,oTable)};CTableCell.prototype.GetCalculatedW= function(){var oRow=this.Row,oTable=oRow.Table;var nCurGridStart=oRow.GetCellInfo(this.Index).StartGridCol;var nCurGridEnd=nCurGridStart+this.Get_GridSpan()-1;if(oTable.TableSumGrid.length>nCurGridEnd)return oTable.TableSumGrid[nCurGridEnd]-oTable.TableSumGrid[nCurGridStart-1];return 3.8};CTableCell.prototype.GetGridSpan=function(){return this.Get_GridSpan()};CTableCell.prototype.SetGridSpan=function(nGridSpan){return this.Set_GridSpan(nGridSpan)};CTableCell.prototype.GetBorder=function(nType){return this.Get_Border(nType)}; CTableCell.prototype.SetBorder=function(oBorder,nType){return this.Set_Border(oBorder,nType)};CTableCell.prototype.IsLastTableCellInRow=function(isSelection){if(true!==isSelection)return!!(this.Row&&this.Row.GetCellsCount()-1===this.Index);if(!this.Row||!this.Row.Table)return false;var nCurCell=this.Index;var nCurRow=this.Row.Index;var oTable=this.Row.Table;var arrSelectionArray=oTable.GetSelectionArray();for(var nIndex=0,nCount=arrSelectionArray.length;nIndexnCurCell)return false}return true};CTableCell.prototype.CheckEmptyBorder=function(nType){var oBorderNone=new CDocumentBorder;if(nType===0){if(border_None!==this.GetBorder(nType).Value)this.SetBorder(oBorderNone,nType)}else if(nType===1||nType===3){var oTable=this.GetTable();var oRow=this.GetRow();var nVMergeCount=oTable.GetVMergeCount(this.GetIndex(),oRow.GetIndex());var nCurGridStart=oRow.GetCellInfo(this.Index).StartGridCol;if(this.Get_Border(nType).Value!= 0)this.Set_Border(oBorderNone,nType);if(nVMergeCount>1)for(var nIndex=oRow.GetIndex()+1;nIndex1)for(var nIndex=oRow.GetIndex()+1;nIndex=oRow.GetCellsCount()-1)return null;var oCellContent=oRow.GetCell(nCurCell+1).GetContent();var nCount=oCellContent.GetElementsCount();if(nCount<=0)return null;return oCellContent.GetElement(0)};CTableCell.prototype.GetPrevParagraph= function(){var oTable=this.GetTable();var oRow=this.GetRow();var nCellIndex=this.GetIndex();if(0===nCellIndex){var nRowIndex=oRow.GetIndex();if(0===nRowIndex)return oTable.GetPrevParagraph();else{var oPrevRow=oTable.GetRow(nRowIndex-1);var oPrevCell=oPrevRow.GetCell(oPrevRow.GetCellsCount()-1);if(!oPrevCell)return null;return oPrevCell.GetContent().GetLastParagraph()}}else{var oPrevCell=oRow.GetCell(nCellIndex-1);if(!oPrevCell)return null;return oPrevCell.GetContent().GetLastParagraph()}};CTableCell.prototype.GetHMerge= function(){return this.Get_CompiledPr(false).HMerge};CTableCell.prototype.SetHMerge=function(nType){if(nType===this.Pr.HMerge)return;this.private_AddPrChange();History.Add(new CChangesTableCellHMerge(this,this.Pr.HMerge,nType));this.Pr.HMerge=nType;this.Recalc_CompiledPr()};CTableCell.prototype.GetCurPageByAbsolutePage=function(nPageAbs){var arrPages=[];var oRow=this.GetRow();var oTable=this.GetTable();if(!oRow||!oTable||!oTable.RowsInfo[oRow.GetIndex()])return arrPages;var nStartPage=oTable.RowsInfo[oRow.GetIndex()].StartPage; var nPagesCount=this.Content.Pages.length;for(var nCurPage=0;nCurPageoBounds.Left&&Y>oBounds.Top&&YoBounds.Top)nT=oBounds.Top;if(-1===nB||nBnElementPos)this.Parent.CurPos.ContentPos=nParentCurPos+nCount-1;if(nParentSelectionStartPos===nElementPos)this.Parent.Selection.StartPos=nParentSelectionStartPos+this.Content.Selection.StartPos;else if(nParentSelectionStartPos>nElementPos)this.Parent.Selection.StartPos=nParentSelectionStartPos+nCount-1;if(nParentSelectionEndPos===nElementPos)this.Parent.Selection.EndPos= nParentSelectionEndPos+this.Content.Selection.EndPos;else if(nParentSelectionEndPos>nElementPos)this.Parent.Selection.EndPos=nParentSelectionEndPos+nCount-1;this.Content.RemoveFromContent(0,this.Content.Content.length,false)};CBlockLevelSdt.prototype.IsTableFirstRowOnNewPage=function(){return this.Parent.IsTableFirstRowOnNewPage()};CBlockLevelSdt.prototype.UpdateBookmarks=function(oManager){this.Content.UpdateBookmarks(oManager)};CBlockLevelSdt.prototype.GetSimilarNumbering=function(oContinueEngine){if(oContinueEngine.IsFound())return; this.Content.GetSimilarNumbering(oContinueEngine)};CBlockLevelSdt.prototype.GetTableOfContents=function(isUnique,isCheckFields){if(this.IsBuiltInTableOfContents()&&(!isUnique||this.IsBuiltInUnique()))return this;return this.Content.GetTableOfContents(isCheckFields)};CBlockLevelSdt.prototype.GetInnerTableOfContents=function(){var oTOC=this.Content.GetTableOfContents(false,true);if(oTOC instanceof CBlockLevelSdt)return oTOC.GetInnerTableOfContents();return oTOC};CBlockLevelSdt.prototype.GetTablesOfFigures= function(arrComplexFields){this.Content.GetTablesOfFigures(arrComplexFields)};CBlockLevelSdt.prototype.IsBlockLevelSdtFirstOnNewPage=function(){if(null!=this.Get_DocumentPrev()&&!this.Parent.IsElementStartOnNewPage(this.GetIndex())||true===this.Parent.IsTableCellContent()&&true!==this.Parent.IsTableFirstRowOnNewPage()||true===this.Parent.IsBlockLevelSdtContent()&&true!==this.Parent.IsBlockLevelSdtFirstOnNewPage())return false;return true};CBlockLevelSdt.prototype.GetContentControlType=function(){return c_oAscSdtLevelType.Block}; CBlockLevelSdt.prototype.SetPr=function(oPr){if(!oPr||this.IsBuiltInTableOfContents())return;this.SetAlias(oPr.Alias);this.SetTag(oPr.Tag);this.SetLabel(oPr.Label);this.SetContentControlLock(oPr.Lock);this.SetContentControlId(oPr.Id);if(undefined!==oPr.DocPartObj)this.SetDocPartObj(oPr.DocPartObj.Category,oPr.DocPartObj.Gallery,oPr.DocPartObj.Unique);if(undefined!==oPr.Appearance)this.SetAppearance(oPr.Appearance);if(undefined!==oPr.Color)this.SetColor(oPr.Color)};CBlockLevelSdt.prototype.SetDefaultTextPr= function(oTextPr){if(oTextPr&&!this.Pr.TextPr.IsEqual(oTextPr)){History.Add(new CChangesSdtPrTextPr(this,this.Pr.TextPr,oTextPr));this.Pr.TextPr=oTextPr}};CBlockLevelSdt.prototype.GetDefaultTextPr=function(){return this.Pr.TextPr};CBlockLevelSdt.prototype.SetAlias=function(sAlias){if(sAlias!==this.Pr.Alias){History.Add(new CChangesSdtPrAlias(this,this.Pr.Alias,sAlias));this.Pr.Alias=sAlias}};CBlockLevelSdt.prototype.GetAlias=function(){return undefined!==this.Pr.Alias?this.Pr.Alias:""};CBlockLevelSdt.prototype.SetContentControlId= function(Id){if(this.Pr.Id!==Id){History.Add(new CChangesSdtPrId(this,this.Pr.Id,Id));this.Pr.Id=Id}};CBlockLevelSdt.prototype.GetContentControlId=function(){return this.Pr.Id};CBlockLevelSdt.prototype.SetTag=function(sTag){if(this.Pr.Tag!==sTag){History.Add(new CChangesSdtPrTag(this,this.Pr.Tag,sTag));this.Pr.Tag=sTag}};CBlockLevelSdt.prototype.GetTag=function(){return undefined!==this.Pr.Tag?this.Pr.Tag:""};CBlockLevelSdt.prototype.SetLabel=function(sLabel){if(this.Pr.Label!==sLabel){History.Add(new CChangesSdtPrLabel(this, this.Pr.Label,sLabel));this.Pr.Label=sLabel}};CBlockLevelSdt.prototype.GetLabel=function(){return undefined!==this.Pr.Label?this.Pr.Label:""};CBlockLevelSdt.prototype.SetAppearance=function(nType){if(this.Pr.Appearance!==nType){History.Add(new CChangesSdtPrAppearance(this,this.Pr.Appearance,nType));this.Pr.Appearance=nType}};CBlockLevelSdt.prototype.GetAppearance=function(){return this.Pr.Appearance};CBlockLevelSdt.prototype.SetColor=function(oColor){if(null===oColor||undefined===oColor){if(undefined!== this.Pr.Color){History.Add(new CChangesSdtPrColor(this,this.Pr.Color,undefined));this.Pr.Color=undefined}}else{History.Add(new CChangesSdtPrColor(this,this.Pr.Color,oColor));this.Pr.Color=oColor}};CBlockLevelSdt.prototype.GetColor=function(){return this.Pr.Color};CBlockLevelSdt.prototype.SetDocPartObj=function(sCategory,sGallery,isUnique){History.Add(new CChangesSdtPrDocPartObj(this,this.Pr.DocPartObj,{Category:sCategory,Gallery:sGallery,Unique:isUnique}));this.Pr.DocPartObj.Category=sCategory;this.Pr.DocPartObj.Gallery= sGallery;this.Pr.DocPartObj.Unique=isUnique};CBlockLevelSdt.prototype.IsBuiltInTableOfContents=function(){return this.Pr.DocPartObj.Gallery==="Table of Contents"};CBlockLevelSdt.prototype.IsBuiltInUnique=function(){return true===this.Pr.DocPartObj.Unique};CBlockLevelSdt.prototype.SetContentControlLock=function(nLockType){if(this.Pr.Lock!==nLockType){History.Add(new CChangesSdtPrLock(this,this.Pr.Lock,nLockType));this.Pr.Lock=nLockType}};CBlockLevelSdt.prototype.GetContentControlLock=function(){return undefined!== this.Pr.Lock?this.Pr.Lock:c_oAscSdtLockType.Unlocked};CBlockLevelSdt.prototype.SetContentControlPr=function(oPr){if(!oPr||this.IsBuiltInTableOfContents())return;if(oPr&&!(oPr instanceof CContentControlPr)){var oTemp=new CContentControlPr(c_oAscSdtLockType.Block);oTemp.FillFromObject(oPr);oPr=oTemp}oPr.SetToContentControl(this)};CBlockLevelSdt.prototype.GetContentControlPr=function(){var oPr=new CContentControlPr(c_oAscSdtLevelType.Block);oPr.FillFromContentControl(this);return oPr};CBlockLevelSdt.prototype.Restart_CheckSpelling= function(){this.Content.Restart_CheckSpelling()};CBlockLevelSdt.prototype.ClearContentControl=function(){var oParagraph=new Paragraph(this.LogicDocument.Get_DrawingDocument(),this.Content);oParagraph.Correct_Content();oParagraph.SelectAll();oParagraph.ApplyTextPr(this.Pr.TextPr);oParagraph.RemoveSelection();this.Content.AddToContent(0,oParagraph);this.Content.RemoveFromContent(1,this.Content.GetElementsCount()-1);this.Content.RemoveSelection();this.Content.MoveCursorToStartPos()};CBlockLevelSdt.prototype.GotoFootnoteRef= function(isNext,isCurrent,isStepFootnote,isStepEndnote){return this.Content.GotoFootnoteRef(isNext,isCurrent,isStepFootnote,isStepEndnote)};CBlockLevelSdt.prototype.GetLastElement=function(){var nCount=this.Content.GetElementsCount();if(nCount<=0)return null;return this.Content.GetElement(nCount-1)};CBlockLevelSdt.prototype.GetElement=function(nIndex){return this.Content.GetElement(nIndex)};CBlockLevelSdt.prototype.GetElementsCount=function(){return this.Content.GetElementsCount()};CBlockLevelSdt.prototype.GetLastParagraph= function(){return this.Content.GetLastParagraph()};CBlockLevelSdt.prototype.GetOutlineParagraphs=function(arrOutline,oPr){this.Content.GetOutlineParagraphs(arrOutline,oPr)};CBlockLevelSdt.prototype.IsLastTableCellInRow=function(isSelection){return this.Parent.IsLastTableCellInRow(isSelection)};CBlockLevelSdt.prototype.CanBeDeleted=function(){return undefined===this.Pr.Lock||c_oAscSdtLockType.Unlocked===this.Pr.Lock||c_oAscSdtLockType.ContentLocked===this.Pr.Lock};CBlockLevelSdt.prototype.CanBeEdited= function(){if(!this.SkipSpecialLock&&(this.IsCheckBox()||this.IsPicture()||this.IsDropDownList()))return false;return undefined===this.Pr.Lock||c_oAscSdtLockType.Unlocked===this.Pr.Lock||c_oAscSdtLockType.SdtLocked===this.Pr.Lock};CBlockLevelSdt.prototype.IsPlaceHolder=function(){return this.Pr.ShowingPlcHdr};CBlockLevelSdt.prototype.private_ReplacePlaceHolderWithContent=function(isSkipTemporaryCheck){if(!this.IsPlaceHolder())return;this.SetShowingPlcHdr(false);this.Content.RemoveFromContent(0,this.Content.GetElementsCount(), false);var oParagraph=new Paragraph(this.LogicDocument?this.LogicDocument.GetDrawingDocument():null,this.Content,false);oParagraph.Correct_Content();oParagraph.SelectAll();oParagraph.ApplyTextPr(this.Pr.TextPr);oParagraph.RemoveSelection();this.Content.AddToContent(0,oParagraph);this.Content.RemoveSelection();this.Content.MoveCursorToStartPos();if(this.IsContentControlEquation()){var oParaMath=new ParaMath;oParaMath.Root.Load_FromMenu(c_oAscMathType.Default_Text,oParagraph,null);oParaMath.Root.Correct_Content(true); oParagraph.AddToContent(0,oParaMath);oParaMath.SetThisElementCurrentInParagraph();oParaMath.MoveCursorToStartPos()}if(true!==isSkipTemporaryCheck&&this.IsContentControlTemporary())this.RemoveContentControlWrapper()};CBlockLevelSdt.prototype.private_ReplaceContentWithPlaceHolder=function(isSelect){if(this.IsPlaceHolder())return;this.SetShowingPlcHdr(true);this.private_FillPlaceholderContent();if(false!==isSelect)this.SelectContentControl()};CBlockLevelSdt.prototype.private_FillPlaceholderContent=function(){this.Content.RemoveFromContent(0, this.Content.GetElementsCount(),false);var oLogicDocument=this.GetLogicDocument()?this.GetLogicDocument():editor.WordControl.m_oLogicDocument;var oDocPart=oLogicDocument.GetGlossaryDocument().GetDocPartByName(this.GetPlaceholder());if(oDocPart)if(this.IsContentControlEquation()){var oFirstParagraph=oDocPart.GetFirstParagraph();var oNewParagraph=oFirstParagraph.Copy();oNewParagraph.RemoveFromContent(0,oNewParagraph.GetElementsCount());var oParaMath=new ParaMath;oParaMath.Root.Load_FromMenu(c_oAscMathType.Default_Text, oNewParagraph,null,oFirstParagraph.GetText());oParaMath.Root.Correct_Content(true);oNewParagraph.AddToContent(0,oParaMath);oNewParagraph.CorrectContent();this.Content.AddToContent(0,oNewParagraph)}else for(var nIndex=0,nCount=oDocPart.GetElementsCount();nIndex=1&&this.Content.GetElement(0).IsParagraph()){var oPara=this.Content.GetElement(0); if(oPara.Content[0]&¶_Run===oPara.Content[0].Type)oPara.Content[0].SetPr(oTextPr)}this.private_UpdateCheckBoxContent();this.SetShowingPlcHdr(false);this.SetPlaceholder(undefined)}};CBlockLevelSdt.prototype.SetCheckBoxPr=function(oCheckBoxPr){if(undefined===this.Pr.CheckBox||!this.Pr.CheckBox.IsEqual(oCheckBoxPr)){History.Add(new CChangesSdtPrCheckBox(this,this.Pr.CheckBox,oCheckBoxPr));this.Pr.CheckBox=oCheckBoxPr}};CBlockLevelSdt.prototype.GetCheckBoxPr=function(){return this.Pr.CheckBox};CBlockLevelSdt.prototype.ToggleCheckBox= function(isChecked){if(!this.IsCheckBox())return;if(undefined!==isChecked&&this.Pr.CheckBox.Checked===isChecked)return;var oLogicDocument=this.GetLogicDocument();if(oLogicDocument||this.IsRadioButton()||this.GetFormKey())oLogicDocument.OnChangeForm(this.IsRadioButton()?this.Pr.CheckBox.GroupKey:this.GetFormKey(),this);if(undefined===isChecked&&this.IsRadioButton()&&true===this.Pr.CheckBox.Checked)return;this.SetCheckBoxChecked(!this.Pr.CheckBox.Checked)};CBlockLevelSdt.prototype.SetCheckBoxChecked= function(isChecked){History.Add(new CChangesSdtPrCheckBoxChecked(this,this.Pr.CheckBox.Checked,isChecked));this.Pr.CheckBox.Checked=isChecked;this.private_UpdateCheckBoxContent()};CBlockLevelSdt.prototype.private_UpdateCheckBoxContent=function(){var isChecked=this.Pr.CheckBox.Checked;var oRun;if(this.LogicDocument&&this.LogicDocument.IsTrackRevisions()){var oFirstParagraph=this.GetFirstParagraph();var oFirstRun=oFirstParagraph?oFirstParagraph.GetFirstRun():null;var oTextPr=oFirstRun?oFirstRun.GetDirectTextPr(): new CTextPr;this.SelectAll();this.Remove();this.RemoveSelection();oFirstParagraph=null;var oDocContent=this.Content;if(oDocContent.Content.length<=0||!oDocContent.Content[0].IsParagraph()){oFirstParagraph=new Paragraph(this.LogicDocument.GetDrawingDocument(),oDocContent);oDocContent.AddToContent(0,oFirstParagraph)}else oFirstParagraph=oDocContent.Content[0];oFirstParagraph.SetReviewType(reviewtype_Common);oRun=new ParaRun(oFirstParagraph,false);oRun.SetPr(oTextPr);oFirstParagraph.AddToContent(0,oRun); if(3===oFirstParagraph.Content.length&¶_Run===oFirstParagraph.Content[0].Type&¶_Run===oFirstParagraph.Content[1].Type&&reviewtype_Add===oFirstParagraph.Content[0].GetReviewType()&&reviewtype_Remove===oFirstParagraph.Content[1].GetReviewType()&&oFirstParagraph.Content[0].GetReviewInfo().IsCurrentUser()&&oFirstParagraph.Content[1].GetReviewInfo().IsCurrentUser()&&(isChecked&&String.fromCharCode(this.Pr.CheckBox.CheckedSymbol)===oFirstParagraph.Content[1].GetText()||!isChecked&&String.fromCharCode(this.Pr.CheckBox.UncheckedSymbol)=== oFirstParagraph.Content[1].GetText())){oFirstParagraph.RemoveFromContent(1,1);oRun.SetReviewType(reviewtype_Common)}}else{var oPara=this.Content.MakeSingleParagraphContent();oRun=oPara.MakeSingleRunParagraph();oRun.ClearContent()}oRun.AddText(String.fromCharCode(isChecked?this.Pr.CheckBox.CheckedSymbol:this.Pr.CheckBox.UncheckedSymbol));if(isChecked&&this.Pr.CheckBox.CheckedFont){oRun.Set_RFonts_Ascii({Index:-1,Name:this.Pr.CheckBox.CheckedFont});oRun.Set_RFonts_HAnsi({Index:-1,Name:this.Pr.CheckBox.CheckedFont}); oRun.Set_RFonts_CS({Index:-1,Name:this.Pr.CheckBox.CheckedFont});oRun.Set_RFonts_EastAsia({Index:-1,Name:this.Pr.CheckBox.CheckedFont})}else if(!isChecked&&this.Pr.CheckBox.UncheckedFont){oRun.Set_RFonts_Ascii({Index:-1,Name:this.Pr.CheckBox.UncheckedFont});oRun.Set_RFonts_HAnsi({Index:-1,Name:this.Pr.CheckBox.UncheckedFont});oRun.Set_RFonts_CS({Index:-1,Name:this.Pr.CheckBox.UncheckedFont});oRun.Set_RFonts_EastAsia({Index:-1,Name:this.Pr.CheckBox.UncheckedFont})}};CBlockLevelSdt.prototype.IsPicture= function(){return!!this.Pr.Picture};CBlockLevelSdt.prototype.SetPicturePr=function(isPicture){if(this.Pr.Picture!==isPicture){History.Add(new CChangesSdtPrPicture(this,this.Pr.Picture,isPicture));this.Pr.Picture=isPicture}};CBlockLevelSdt.prototype.private_UpdatePictureContent=function(_nW,_nH){if(!this.IsPicture())return;var arrDrawings=this.GetAllDrawingObjects();if(this.IsPlaceHolder()){this.ReplacePlaceHolderWithContent();this.SetShowingPlcHdr(true)}var oDrawing;for(var nIndex=0,nCount=arrDrawings.length;nIndex< nCount;++nIndex)if(arrDrawings[nIndex].IsPicture()){oDrawing=arrDrawings[nIndex];break}var oPara=this.Content.MakeSingleParagraphContent();var oRun=oPara.MakeSingleRunParagraph();if(!oDrawing){var oDrawingObjects=this.LogicDocument?this.LogicDocument.DrawingObjects:null;if(!oDrawingObjects)return;var nW=_nW?_nW:50;var nH=_nH?_nH:50;oDrawing=new ParaDrawing(nW,nH,null,oDrawingObjects,this.LogicDocument,null);var oImage=oDrawingObjects.createImage(AscCommon.g_sWordPlaceholderImage,0,0,nW,nH);oImage.setParent(oDrawing); oDrawing.Set_GraphicObject(oImage)}oRun.AddToContent(0,oDrawing)};CBlockLevelSdt.prototype.ApplyPicturePr=function(isPicture,nW,nH){this.SetPicturePr(isPicture);this.SetPlaceholder(undefined);this.private_UpdatePictureContent(nW,nH)};CBlockLevelSdt.prototype.SelectPicture=function(){if(!this.IsPicture())return false;var arrDrawings=this.GetAllDrawingObjects();if(arrDrawings.length<=0)return false;this.Content.Select_DrawingObject(arrDrawings[0].GetId());return true};CBlockLevelSdt.prototype.IsComboBox= function(){return undefined!==this.Pr.ComboBox};CBlockLevelSdt.prototype.SetComboBoxPr=function(oPr){if(undefined===this.Pr.ComboBox||!this.Pr.ComboBox.IsEqual(oPr)){History.Add(new CChangesSdtPrComboBox(this,this.Pr.ComboBox,oPr));this.Pr.ComboBox=oPr}};CBlockLevelSdt.prototype.GetComboBoxPr=function(){return this.Pr.ComboBox};CBlockLevelSdt.prototype.IsDropDownList=function(){return undefined!==this.Pr.DropDown};CBlockLevelSdt.prototype.SetDropDownListPr=function(oPr){if(undefined===this.Pr.DropDown|| !this.Pr.DropDown.IsEqual(oPr)){History.Add(new CChangesSdtPrDropDownList(this,this.Pr.DropDown,oPr));this.Pr.DropDown=oPr}};CBlockLevelSdt.prototype.GetDropDownListPr=function(){return this.Pr.DropDown};CBlockLevelSdt.prototype.ApplyComboBoxPr=function(oPr){this.SetPlaceholder(c_oAscDefaultPlaceholderName.List);if(this.IsPlaceHolder())this.private_FillPlaceholderContent();this.SetComboBoxPr(oPr);this.SelectListItem()};CBlockLevelSdt.prototype.ApplyDropDownListPr=function(oPr){this.SetPlaceholder(c_oAscDefaultPlaceholderName.List); if(this.IsPlaceHolder())this.private_FillPlaceholderContent();this.SetDropDownListPr(oPr);this.SelectListItem()};CBlockLevelSdt.prototype.SelectListItem=function(sValue){var oList=null;if(this.IsComboBox())oList=this.Pr.ComboBox;else if(this.IsDropDownList())oList=this.Pr.DropDown;if(!oList)return;var sText=oList.GetTextByValue(sValue);if(this.LogicDocument&&this.LogicDocument.IsTrackRevisions()){if(!sText&&this.IsPlaceHolder()){this.private_FillPlaceholderContent();return}var oFirstParagraph=this.GetFirstParagraph(); var oFirstRun=oFirstParagraph?oFirstParagraph.GetFirstRun():null;var oTextPr=oFirstRun?oFirstRun.GetDirectTextPr():new CTextPr;if(!this.IsPlaceHolder()){this.SelectAll();this.Remove();this.RemoveSelection()}else this.ReplacePlaceHolderWithContent();if(!sText&&this.IsEmpty())this.ReplaceContentWithPlaceHolder();if(sText){var oRun,oParagraph;if(this.IsEmpty()){oParagraph=this.Content.MakeSingleParagraphContent();if(!oParagraph)return;oRun=oParagraph.MakeSingleRunParagraph();if(!oRun)return;oRun.SetReviewType(reviewtype_Add)}else{if(this.Content.Content[this.Content.Content.length- 1].IsParagraph())oParagraph=this.Content.Content[this.Content.Content.length-1];else{oParagraph=new Paragraph(this.LogicDocument.GetDrawingDocument(),this.Content);this.Content.AddToParagraph(this.Content.length,oParagraph)}oRun=new ParaRun(oParagraph,false);oParagraph.AddToContent(oParagraph.GetContentLength()-1,oRun)}oParagraph.SetReviewType(reviewtype_Common);oRun.SetPr(oTextPr);oRun.AddText(sText)}}else if(null===sText)this.private_ReplaceContentWithPlaceHolder();else{this.private_ReplacePlaceHolderWithContent(); var oRun=this.private_UpdateListContent();if(oRun)oRun.AddText(sText)}};CBlockLevelSdt.prototype.private_UpdateListContent=function(){if(this.IsPlaceHolder())return null;var oParagraph=this.Content.MakeSingleParagraphContent();if(!oParagraph)return null;var oRun=oParagraph.MakeSingleRunParagraph();if(!oRun)return null;return oRun};CBlockLevelSdt.prototype.IsDatePicker=function(){return undefined!==this.Pr.Date};CBlockLevelSdt.prototype.SetDatePickerPr=function(oPr){if(undefined===this.Pr.Date||!this.Pr.Date.IsEqual(oPr)){var _oPr= oPr?oPr.Copy():undefined;History.Add(new CChangesSdtPrDatePicker(this,this.Pr.Date,_oPr));this.Pr.Date=_oPr}};CBlockLevelSdt.prototype.GetDatePickerPr=function(){return this.Pr.Date};CBlockLevelSdt.prototype.ApplyDatePickerPr=function(oPr){this.SetDatePickerPr(oPr);if(!this.IsDatePicker())return;this.SetPlaceholder(c_oAscDefaultPlaceholderName.DateTime);if(this.IsPlaceHolder())this.private_FillPlaceholderContent();this.private_UpdateDatePickerContent()};CBlockLevelSdt.prototype.private_UpdateDatePickerContent= function(){if(!this.Pr.Date)return;if(this.IsPlaceHolder())return this.ReplacePlaceHolderWithContent();var oRun;var sText=this.Pr.Date.ToString();if(this.LogicDocument&&this.LogicDocument.IsTrackRevisions()){if(!sText&&this.IsPlaceHolder())return;var oFirstParagraph=this.GetFirstParagraph();var oFirstRun=oFirstParagraph?oFirstParagraph.GetFirstRun():null;var oTextPr=oFirstRun?oFirstRun.GetDirectTextPr():new CTextPr;if(!this.IsPlaceHolder()){this.SelectAll();this.Remove();this.RemoveSelection()}else this.ReplacePlaceHolderWithContent(); if(!sText&&this.IsEmpty())this.ReplaceContentWithPlaceHolder();if(sText){var oRun,oParagraph;if(this.IsEmpty()){oParagraph=this.Content.MakeSingleParagraphContent();if(!oParagraph)return;oRun=oParagraph.MakeSingleRunParagraph();if(!oRun)return;oRun.SetReviewType(reviewtype_Add)}else{if(this.Content.Content[this.Content.Content.length-1].IsParagraph())oParagraph=this.Content.Content[this.Content.Content.length-1];else{oParagraph=new Paragraph(this.LogicDocument.GetDrawingDocument(),this.Content);this.Content.AddToParagraph(this.Content.length, oParagraph)}oRun=new ParaRun(oParagraph,false);oParagraph.AddToContent(oParagraph.GetContentLength()-1,oRun)}oParagraph.SetReviewType(reviewtype_Common);oRun.SetPr(oTextPr)}}else{var oParagraph=this.Content.MakeSingleParagraphContent();if(!oParagraph)return;oRun=oParagraph.MakeSingleRunParagraph();if(!oRun)return}if(oRun)oRun.AddText(sText)};CBlockLevelSdt.prototype.Document_Is_SelectionLocked=function(CheckType,bCheckInner){if(AscCommon.changestype_Document_Content_Add===CheckType&&this.Content.IsCursorAtBegin())return AscCommon.CollaborativeEditing.Add_CheckLock(false); var isCheckContentControlLock=this.LogicDocument?this.LogicDocument.IsCheckContentControlsLock():true;if(AscCommon.changestype_Paragraph_TextProperties===CheckType||(AscCommon.changestype_Drawing_Props===CheckType||AscCommon.changestype_Image_Properties===CheckType)&&this.IsPicture()){this.SkipSpecialContentControlLock(true);if(!this.CanBeEdited())AscCommon.CollaborativeEditing.Add_CheckLock(true);this.SkipSpecialContentControlLock(false);isCheckContentControlLock=false}var nContentControlLock=this.GetContentControlLock(); if(AscCommon.changestype_ContentControl_Properties===CheckType)return this.Lock.Check(this.GetId());if(AscCommon.changestype_ContentControl_Remove===CheckType){isCheckContentControlLock=false;this.Lock.Check(this.GetId())}if(isCheckContentControlLock&&(AscCommon.changestype_Paragraph_Content===CheckType||AscCommon.changestype_Paragraph_AddText===CheckType||AscCommon.changestype_ContentControl_Add===CheckType||AscCommon.changestype_Remove===CheckType||AscCommon.changestype_Delete===CheckType||AscCommon.changestype_Document_Content=== CheckType||AscCommon.changestype_Document_Content_Add===CheckType||AscCommon.changestype_ContentControl_Remove===CheckType)&&(this.IsSelectionUse()&&this.IsSelectedAll()||this.IsApplyToAll())){var bSelectedOnlyThis=false;if(AscCommon.changestype_Remove!==CheckType&&AscCommon.changestype_Delete!==CheckType){var oInfo=this.LogicDocument.GetSelectedElementsInfo();bSelectedOnlyThis=oInfo.GetBlockLevelSdt()===this?true:false}if(c_oAscSdtLockType.SdtContentLocked===nContentControlLock||c_oAscSdtLockType.SdtLocked=== nContentControlLock&&true!==bSelectedOnlyThis||!this.CanBeEdited()&&true===bSelectedOnlyThis)return AscCommon.CollaborativeEditing.Add_CheckLock(true);else{AscCommon.CollaborativeEditing.AddContentControlForSkippingOnCheckEditingLock(this);this.Content.Document_Is_SelectionLocked(CheckType,bCheckInner);AscCommon.CollaborativeEditing.RemoveContentControlForSkippingOnCheckEditingLock(this);return}}else if(isCheckContentControlLock&&!this.CanBeEdited())return AscCommon.CollaborativeEditing.Add_CheckLock(true); else return this.Content.Document_Is_SelectionLocked(CheckType,bCheckInner)};CBlockLevelSdt.prototype.CheckContentControlEditingLock=function(){var isCheckContentControlLock=this.LogicDocument?this.LogicDocument.IsCheckContentControlsLock():true;if(!isCheckContentControlLock)return;var nContentControlLock=this.GetContentControlLock();if(false===AscCommon.CollaborativeEditing.IsNeedToSkipContentControlOnCheckEditingLock(this)&&(c_oAscSdtLockType.SdtContentLocked===nContentControlLock||c_oAscSdtLockType.ContentLocked=== nContentControlLock))return AscCommon.CollaborativeEditing.Add_CheckLock(true);if(this.Parent&&this.Parent.CheckContentControlEditingLock)this.Parent.CheckContentControlEditingLock()};CBlockLevelSdt.prototype.GetSpecificType=function(){if(this.IsBuiltInTableOfContents())return Asc.c_oAscContentControlSpecificType.TOC;if(this.IsCheckBox())return Asc.c_oAscContentControlSpecificType.CheckBox;if(this.IsPicture())return Asc.c_oAscContentControlSpecificType.Picture;if(this.IsComboBox())return Asc.c_oAscContentControlSpecificType.ComboBox; if(this.IsDropDownList())return Asc.c_oAscContentControlSpecificType.DropDownList;if(this.IsDatePicker())return Asc.c_oAscContentControlSpecificType.DateTime;return Asc.c_oAscContentControlSpecificType.None};CBlockLevelSdt.prototype.GetAllTablesOnPage=function(nPageAbs,arrTables){return this.Content.GetAllTablesOnPage(nPageAbs,arrTables)};CBlockLevelSdt.prototype.ProcessComplexFields=function(){return this.Content.ProcessComplexFields()};CBlockLevelSdt.prototype.RecalculateEndInfo=function(){this.Content.RecalculateEndInfo()}; CBlockLevelSdt.prototype.SetPlaceholder=function(sDocPartName){if(this.Pr.Placeholder!==sDocPartName){History.Add(new CChangesSdtPrPlaceholder(this,this.Pr.Placeholder,sDocPartName));this.Pr.Placeholder=sDocPartName}};CBlockLevelSdt.prototype.GetPlaceholder=function(){return this.Pr.Placeholder};CBlockLevelSdt.prototype.SetShowingPlcHdr=function(isShow){if(this.Pr.ShowingPlcHdr!==isShow){History.Add(new CChangesSdtPrShowingPlcHdr(this,this.Pr.ShowingPlcHdr,isShow));this.Pr.ShowingPlcHdr=isShow}}; CBlockLevelSdt.prototype.IsShowingPlcHdr=function(){return this.Pr.ShowingPlcHdr};CBlockLevelSdt.prototype.GetFramePr=function(){return this.Content.GetFramePr()};CBlockLevelSdt.prototype.SetCalculatedFrame=function(oFrame){this.Content.SetCalculatedFrame(oFrame)};CBlockLevelSdt.prototype.GetPrevParagraphForLineNumbers=function(isPrev,isNewSection){var oPrevPara=null;if(!isPrev)oPrevPara=this.Content.GetPrevParagraphForLineNumbers(-1,isNewSection);if(!oPrevPara){var oParent=this.GetParent();if(oParent&& oParent.GetPrevParagraphForLineNumbers)return oParent.GetPrevParagraphForLineNumbers(this.GetIndex(),isNewSection)}return oPrevPara};CBlockLevelSdt.prototype.UpdateLineNumbersInfo=function(){this.Content.UpdateLineNumbersInfo()};CBlockLevelSdt.prototype.private_OnAddFormPr=function(){this.Content.Recalc_AllParagraphs_CompiledPr()};CBlockLevelSdt.prototype.CheckHitInContentControlByXY=function(X,Y,nPageAbs){var oTransform=this.Get_ParentTextTransform();var _X=X;var _Y=Y;if(oTransform){oTransform=oTransform.Invert(); _X=oTransform.TransformPointX(X,Y);_Y=oTransform.TransformPointY(X,Y)}for(var nPageIndex=0,nPagesCount=this.GetPagesCount();nPageIndex0&&oTextFormRun.GetElementsCount()>=this.Pr.TextForm.MaxCharacters)return}CParagraphContentWithParagraphLikeContent.prototype.Add.apply(this, arguments)};CInlineLevelSdt.prototype.Copy=function(isUseSelection,oPr){var oContentControl=new CInlineLevelSdt;var nStartPos=0;var nEndPos=this.Content.length-1;if(isUseSelection&&this.State.Selection.Use){nStartPos=this.State.Selection.StartPos;nEndPos=this.State.Selection.EndPos;if(nStartPos>nEndPos){nStartPos=this.State.Selection.EndPos;nEndPos=this.State.Selection.StartPos}}if(nStartPos<=nEndPos)oContentControl.ClearContent();for(var nCurPos=nStartPos;nCurPos<=nEndPos;++nCurPos){var oItem=this.Content[nCurPos]; if(nStartPos===nEndPos||nEndPos===nCurPos)oContentControl.AddToContent(nCurPos-nStartPos,oItem.Copy(isUseSelection,oPr));else oContentControl.AddToContent(nCurPos-nStartPos,oItem.Copy(false,oPr))}this.private_CopyPrTo(oContentControl,oPr);if(oContentControl.IsEmpty())oContentControl.ReplaceContentWithPlaceHolder();return oContentControl};CInlineLevelSdt.prototype.private_CopyPrTo=function(oContentControl,oPr){oContentControl.SetDefaultTextPr(this.GetDefaultTextPr());oContentControl.SetLabel(this.GetLabel()); oContentControl.SetTag(this.GetTag());oContentControl.SetAlias(this.GetAlias());oContentControl.SetContentControlLock(this.GetContentControlLock());oContentControl.SetAppearance(this.GetAppearance());oContentControl.SetColor(this.GetColor());if(undefined!==this.Pr.DocPartObj)oContentControl.SetDocPartObj(this.Pr.DocPartObj.Category,this.Pr.DocPartObj.Gallery,this.Pr.DocPartObj.Unique);if(undefined!==this.Pr.CheckBox){var oCheckBoxPr=this.Pr.CheckBox;var isChangeChecked=false;if(this.Pr.CheckBox.GroupKey&& true===this.Pr.CheckBox.Checked&&this.GetLogicDocument()&&!this.GetLogicDocument().DragAndDropAction){oCheckBoxPr=this.Pr.CheckBox.Copy();oCheckBoxPr.Checked=false;isChangeChecked=true}oContentControl.SetCheckBoxPr(oCheckBoxPr);if(isChangeChecked)oContentControl.private_UpdateCheckBoxContent()}if(undefined!==this.Pr.Picture)oContentControl.SetPicturePr(this.Pr.Picture);if(undefined!==this.Pr.ComboBox)oContentControl.SetComboBoxPr(this.Pr.ComboBox);if(undefined!==this.Pr.DropDown)oContentControl.SetDropDownListPr(this.Pr.DropDown); if(undefined!==this.Pr.Date)oContentControl.SetDatePickerPr(this.Pr.Date);oContentControl.SetShowingPlcHdr(this.Pr.ShowingPlcHdr);oContentControl.SetPlaceholder(this.private_CopyPlaceholder(oPr));oContentControl.SetContentControlEquation(this.Pr.Equation);oContentControl.SetContentControlTemporary(this.Pr.Temporary);if(undefined!==this.Pr.FormPr)oContentControl.SetFormPr(this.Pr.FormPr);if(undefined!==this.Pr.TextForm)oContentControl.SetTextFormPr(this.Pr.TextForm);if(undefined!==this.Pr.PictureFormPr)oContentControl.SetPictureFormPr(this.Pr.PictureFormPr)}; CInlineLevelSdt.prototype.GetSelectedContent=function(oSelectedContent){var oNewElement=new CInlineLevelSdt;this.private_CopyPrTo(oNewElement);if(this.IsPlaceHolder())return oNewElement;else{oNewElement.ReplacePlaceHolderWithContent();var nStartPos=this.State.Selection.StartPos;var nEndPos=this.State.Selection.EndPos;if(nStartPos>nEndPos){nStartPos=this.State.Selection.EndPos;nEndPos=this.State.Selection.StartPos}var nItemPos=0;for(var nPos=nStartPos,nItemPos=0;nPos<=nEndPos;++nPos){var oNewItem= this.Content[nPos].GetSelectedContent(oSelectedContent);if(oNewItem){oNewElement.AddToContent(nItemPos,oNewItem);nItemPos++}}if(0===nItemPos)return null;return oNewElement}};CInlineLevelSdt.prototype.GetSelectedText=function(bAll,bClearText,oPr){if(oPr&&oPr.MathAdd&&this.IsContentControlEquation()&&this.IsPlaceHolder())return"";return CParagraphContentWithParagraphLikeContent.prototype.GetSelectedText.apply(this,arguments)};CInlineLevelSdt.prototype.GetSelectedElementsInfo=function(Info){Info.SetInlineLevelSdt(this); CParagraphContentWithParagraphLikeContent.prototype.GetSelectedElementsInfo.apply(this,arguments)};CInlineLevelSdt.prototype.Add_ToContent=function(Pos,Item,UpdatePosition){History.Add(new CChangesParaFieldAddItem(this,Pos,[Item]));CParagraphContentWithParagraphLikeContent.prototype.Add_ToContent.apply(this,arguments);var sKey=this.GetFormKey();if(sKey)this.GetLogicDocument().OnChangeForm(sKey,this)};CInlineLevelSdt.prototype.Remove_FromContent=function(Pos,Count,UpdatePosition){var DeletedItems= this.Content.slice(Pos,Pos+Count);History.Add(new CChangesParaFieldRemoveItem(this,Pos,DeletedItems));CParagraphContentWithParagraphLikeContent.prototype.Remove_FromContent.apply(this,arguments);var sKey=this.GetFormKey();if(sKey)this.GetLogicDocument().OnChangeForm(sKey,this)};CInlineLevelSdt.prototype.Split=function(ContentPos,Depth){return null};CInlineLevelSdt.prototype.CanSplit=function(){return false};CInlineLevelSdt.prototype.Recalculate_Range_Spaces=function(PRSA,_CurLine,_CurRange,_CurPage){var isFastRangeRecalc= PRSA.IsFastRangeRecalc();var CurLine=_CurLine-this.StartLine;var CurRange=0===CurLine?_CurRange-this.StartRange:_CurRange;if(0===CurLine&&0===CurRange&&!isFastRangeRecalc)this.Bounds={};var oParagraph=PRSA.Paragraph;var Y0=oParagraph.Lines[_CurLine].Top+oParagraph.Pages[_CurPage].Y;var Y1=oParagraph.Lines[_CurLine].Y+oParagraph.Pages[_CurPage].Y+oParagraph.Lines[_CurLine].Metrics.Descent;var X0=PRSA.X;if(0===CurLine)Y0=oParagraph.Lines[_CurLine].Y+oParagraph.Pages[_CurPage].Y-oParagraph.Lines[_CurLine].Metrics.Ascent; if(this.IsForm()&&!this.IsPicture()&&this.Content[0]instanceof ParaRun){var oRun=this.Content[0];var oTextPr=oRun.Get_CompiledPr(false);g_oTextMeasurer.SetTextPr(oTextPr,oParagraph.GetTheme());g_oTextMeasurer.SetFontSlot(fontslot_ASCII);var nTextHeight=g_oTextMeasurer.GetHeight();var nTextDescent=Math.abs(g_oTextMeasurer.GetDescender());var nTextAscent=nTextHeight-nTextDescent;var nYOffset=oTextPr.Position;if(0===CurLine)Y0=oParagraph.Lines[_CurLine].Y+oParagraph.Pages[_CurPage].Y-nTextAscent-nYOffset; Y1=oParagraph.Lines[_CurLine].Y+oParagraph.Pages[_CurPage].Y+nTextDescent-nYOffset}if(!isFastRangeRecalc)for(var Key in this.Bounds){var __CurLine=(Key|0)>>16;if(__CurLine===CurLine-1&&this.Bounds[Key].PageInternal===_CurPage)this.Bounds[Key].H=Y0-this.Bounds[Key].Y}CParagraphContentWithParagraphLikeContent.prototype.Recalculate_Range_Spaces.apply(this,arguments);var X1=PRSA.X;if(this.IsForm()&&this.IsPicture()&&Math.abs(X1-X0)>.001){var arrDrawings=this.GetAllDrawingObjects();if(arrDrawings.length> 0&&arrDrawings[0].IsPicture()){Y0=arrDrawings[0].GraphicObj.y;Y1=arrDrawings[0].GraphicObj.y+arrDrawings[0].GraphicObj.extY;X0=arrDrawings[0].GraphicObj.x;X1=arrDrawings[0].GraphicObj.x+arrDrawings[0].GraphicObj.extX}}if(isFastRangeRecalc&&this.Bounds[CurLine<<16&4294901760|CurRange&65535]){var oBounds=this.Bounds[CurLine<<16&4294901760|CurRange&65535];oBounds.X=X0;oBounds.W=X1-X0}else this.Bounds[CurLine<<16&4294901760|CurRange&65535]={X:X0,W:X1-X0,Y:Y0,H:Y1-Y0,TextLineH:Y1-Y0,Page:PRSA.Paragraph.Get_AbsolutePage(_CurPage), PageInternal:_CurPage};this.BoundsPaths=null};CInlineLevelSdt.prototype.Draw_HighLights=function(PDSH){PDSH.AddInlineSdt(this);var oGraphics=PDSH.Graphics;if(this.IsForm()&&oGraphics&&oGraphics.AddFormField&&!this.Get_ParentTextTransform()){this.SkipDraw(PDSH);var oBounds=null;for(var Key in this.Bounds)if(this.Bounds[Key].W>.001&&this.Bounds[Key].H>.001){if(this.Bounds[Key].PageInternal===PDSH.Page)oBounds=this.Bounds[Key];var CurLine=PDSH.Line-this.StartLine;var CurRange=0===CurLine?PDSH.Range- this.StartRange:PDSH.Range;if((Key|0)!==(CurLine<<16&4294901760)|CurRange&65535)return;break}var oRun=this.Content[0];if(oBounds&&oRun){var oTextPr=oRun.Get_CompiledPr(false);g_oTextMeasurer.SetTextPr(oTextPr,PDSH.Paragraph.GetTheme());g_oTextMeasurer.SetFontSlot(fontslot_ASCII);var nTextHeight=g_oTextMeasurer.GetHeight();var nTextDescent=Math.abs(g_oTextMeasurer.GetDescender());var nTextAscent=nTextHeight-nTextDescent;var oColor=oTextPr.GetSimpleTextColor(PDSH.Paragraph.GetTheme(),PDSH.Paragraph.GetColorMap()); oGraphics.SetTextPr(oTextPr,PDSH.Paragraph.GetTheme());oGraphics.b_color1(oColor.r,oColor.g,oColor.b,this.IsPlaceHolder()?127:255);oGraphics.SetFontSlot(fontslot_ASCII);oGraphics.AddFormField(oBounds.X,oBounds.Y,oBounds.W,oBounds.H,nTextAscent,this)}}else CParagraphContentWithParagraphLikeContent.prototype.Draw_HighLights.apply(this,arguments)};CInlineLevelSdt.prototype.Draw_Elements=function(PDSE){var oGraphics=PDSE.Graphics;if(this.IsForm()&&oGraphics&&oGraphics.AddFormField&&!this.Get_ParentTextTransform())this.SkipDraw(PDSE); else CParagraphContentWithParagraphLikeContent.prototype.Draw_Elements.apply(this,arguments)};CInlineLevelSdt.prototype.Draw_Lines=function(PDSL){var oGraphics=PDSL.Graphics;if(this.IsForm()&&oGraphics&&oGraphics.AddFormField&&!this.Get_ParentTextTransform())this.SkipDraw(PDSL);else CParagraphContentWithParagraphLikeContent.prototype.Draw_Lines.apply(this,arguments)};CInlineLevelSdt.prototype.GetRangeBounds=function(_CurLine,_CurRange){var CurLine=_CurLine-this.StartLine;var CurRange=0===CurLine? _CurRange-this.StartRange:_CurRange;return this.Bounds[CurLine<<16&4294901760|CurRange&65535]};CInlineLevelSdt.prototype.Get_LeftPos=function(SearchPos,ContentPos,Depth,UseContentPos){if(false===UseContentPos&&this.Content.length>0){var CurPos=this.Content.length-1;this.Content[CurPos].Get_EndPos(false,SearchPos.Pos,Depth+1);SearchPos.Pos.Update(CurPos,Depth);SearchPos.Found=true;return true}if(this.IsForm()&&this.IsPlaceHolder())return false;var bResult=CParagraphContentWithParagraphLikeContent.prototype.Get_LeftPos.call(this, SearchPos,ContentPos,Depth,UseContentPos);if(true!==bResult&&this.Paragraph&&this.Paragraph.LogicDocument&&true===this.Paragraph.LogicDocument.IsFillingFormMode()){this.Get_StartPos(SearchPos.Pos,Depth);SearchPos.Found=true;return true}return bResult};CInlineLevelSdt.prototype.Get_RightPos=function(SearchPos,ContentPos,Depth,UseContentPos,StepEnd){if(false===UseContentPos&&this.Content.length>0){this.Content[0].Get_StartPos(SearchPos.Pos,Depth+1);SearchPos.Pos.Update(0,Depth);SearchPos.Found=true; return true}if(this.IsForm()&&this.IsPlaceHolder())return false;var bResult=CParagraphContentWithParagraphLikeContent.prototype.Get_RightPos.call(this,SearchPos,ContentPos,Depth,UseContentPos,StepEnd);if(true!==bResult&&this.Paragraph&&this.Paragraph.LogicDocument&&true===this.Paragraph.LogicDocument.IsFillingFormMode()){this.Get_EndPos(false,SearchPos.Pos,Depth);SearchPos.Found=true;return true}return bResult};CInlineLevelSdt.prototype.Remove=function(nDirection,bOnAddText){if(this.IsPlaceHolder()){if(!this.CanBeDeleted()&& !bOnAddText)return true;if(bOnAddText||!this.Paragraph.LogicDocument.IsFillingFormMode())this.private_ReplacePlaceHolderWithContent();return true}var bResult=CParagraphContentWithParagraphLikeContent.prototype.Remove.call(this,nDirection,bOnAddText);if(this.Is_Empty()&&this.Paragraph&&this.Paragraph.LogicDocument&&this.CanBeEdited()&&(!bOnAddText&&true===this.Paragraph.LogicDocument.IsFillingFormMode()||this===this.Paragraph.LogicDocument.CheckInlineSdtOnDelete)){this.private_ReplaceContentWithPlaceHolder(); return true}return bResult};CInlineLevelSdt.prototype.Shift_Range=function(Dx,Dy,_CurLine,_CurRange,_CurPage){CParagraphContentWithParagraphLikeContent.prototype.Shift_Range.call(this,Dx,Dy,_CurLine,_CurRange,_CurPage);var CurLine=_CurLine-this.StartLine;var CurRange=0===CurLine?_CurRange-this.StartRange:_CurRange;var oRangeBounds=this.Bounds[CurLine<<16&4294901760|CurRange&65535];if(oRangeBounds){oRangeBounds.X+=Dx;oRangeBounds.Y+=Dy}if(this.BoundsPaths)this.BoundsPaths=null};CInlineLevelSdt.prototype.Get_WordStartPos= function(SearchPos,ContentPos,Depth,UseContentPos){CParagraphContentWithParagraphLikeContent.prototype.Get_WordStartPos.call(this,SearchPos,ContentPos,Depth,UseContentPos);if(true!==SearchPos.Found&&this.Paragraph&&this.Paragraph.LogicDocument&&true===this.Paragraph.LogicDocument.IsFillingFormMode()){this.Get_StartPos(SearchPos.Pos,Depth);SearchPos.UpdatePos=true;SearchPos.Found=true}};CInlineLevelSdt.prototype.Get_WordEndPos=function(SearchPos,ContentPos,Depth,UseContentPos,StepEnd){CParagraphContentWithParagraphLikeContent.prototype.Get_WordEndPos.call(this, SearchPos,ContentPos,Depth,UseContentPos,StepEnd);if(true!==SearchPos.Found&&this.Paragraph&&this.Paragraph.LogicDocument&&true===this.Paragraph.LogicDocument.IsFillingFormMode()){this.Get_EndPos(false,SearchPos.Pos,Depth);SearchPos.UpdatePos=true;SearchPos.Found=true}};CInlineLevelSdt.prototype.GetBoundingPolygon=function(){var oHdrFtr=this.Paragraph.Parent.IsHdrFtr(true);var nHdrFtrPage=oHdrFtr?oHdrFtr.GetContent().GetAbsolutePage(0):null;var StartPage=this.Paragraph.Get_StartPage_Absolute();if(null=== this.BoundsPaths||StartPage!==this.BoundsPathsStartPage){var arrBounds=[],arrRects=[],CurPage=-1;for(var Key in this.Bounds){if(null!==nHdrFtrPage&&nHdrFtrPage!==this.Paragraph.GetAbsolutePage(this.Bounds[Key].PageInternal))continue;if(CurPage!==this.Bounds[Key].PageInternal){arrRects=[];arrBounds.push(arrRects);CurPage=this.Bounds[Key].PageInternal}this.Bounds[Key].Page=this.Paragraph.GetAbsolutePage(this.Bounds[Key].PageInternal);arrRects.push(this.Bounds[Key])}this.BoundsPaths=[];for(var nIndex= 0,nCount=arrBounds.length;nIndex0)return oBounds.TextLineH}return 0};CInlineLevelSdt.prototype.GetBoundingPolygonAnchorPoint=function(){var nR=0;var nT=-1;var nB=-1;var nCurPage=-1;for(var Key in this.Bounds)if(this.Bounds[Key].H>.001&&this.Bounds[Key].W>.001&&(-1===nCurPage||nCurPage>this.Bounds[Key].PageInternal))nCurPage=this.Bounds[Key].PageInternal;if(-1===nCurPage)return{X:0,Y:0,Page:-1,Transform:null};var nPageAbs=this.Paragraph.GetAbsolutePage(nCurPage); for(var Key in this.Bounds){if(nCurPage!==this.Bounds[Key].PageInternal)continue;if(nRthis.Bounds[Key].Y)nT=this.Bounds[Key].Y;if(-1===nB||nBnElementPos)if(oParent instanceof Paragraph)oParent.CurPos.ContentPos=nParentCurPos+nCount-1;else oParent.State.ContentPos=nParentCurPos+nCount-1;if(nParentSelectionStartPos===nElementPos)oParent.Selection.StartPos= nParentSelectionStartPos+this.Selection.StartPos;else if(nParentSelectionStartPos>nElementPos)oParent.Selection.StartPos=nParentSelectionStartPos+nCount-1;if(nParentSelectionEndPos===nElementPos)oParent.Selection.EndPos=nParentSelectionEndPos+this.Selection.EndPos;else if(nParentSelectionEndPos>nElementPos)oParent.Selection.EndPos=nParentSelectionEndPos+nCount-1;this.Remove_FromContent(0,this.Content.length)};CInlineLevelSdt.prototype.FindNextFillingForm=function(isNext,isCurrent,isStart){if(isCurrent&& (true===this.IsSelectedAll()||this.IsPlaceHolder())){if(isNext)return CParagraphContentWithParagraphLikeContent.prototype.FindNextFillingForm.apply(this,arguments);return null}if(!isCurrent&&isNext)return this;var oRes=CParagraphContentWithParagraphLikeContent.prototype.FindNextFillingForm.apply(this,arguments);if(!oRes&&!isNext)return this;return null};CInlineLevelSdt.prototype.GetAllContentControls=function(arrContentControls){arrContentControls.push(this);CParagraphContentWithParagraphLikeContent.prototype.GetAllContentControls.apply(this, arguments)};CInlineLevelSdt.prototype.Document_UpdateInterfaceState=function(){if(this.Paragraph&&this.Paragraph.LogicDocument)this.Paragraph.LogicDocument.Api.sync_ContentControlCallback(this.GetContentControlPr());CParagraphContentWithParagraphLikeContent.prototype.Document_UpdateInterfaceState.apply(this,arguments)};CInlineLevelSdt.prototype.SetParagraph=function(oParagraph){if(this.GetTextFormPr()&&this.GetLogicDocument())this.GetLogicDocument().RegisterForm(this);CParagraphContentWithParagraphLikeContent.prototype.SetParagraph.apply(this, arguments)};CInlineLevelSdt.prototype.Apply_TextPr=function(TextPr,IncFontSize,ApplyToAll){if(this.IsPlaceHolder()||ApplyToAll||this.IsSelectedAll()||this.IsDropDownList()||this.IsComboBox()||this.IsCheckBox()||this.IsDatePicker()||this.IsTextForm())if(undefined!==IncFontSize){var oCompiledTextPr=this.Get_CompiledTextPr(false);if(oCompiledTextPr){var oNewTextPr=new CTextPr;oNewTextPr.FontSize=oCompiledTextPr.GetIncDecFontSize(IncFontSize);oNewTextPr.FontSizeCS=oCompiledTextPr.GetIncDecFontSizeCS(IncFontSize); var oTempTextPr=this.Pr.TextPr.Copy();oTempTextPr.Merge(oNewTextPr);this.SetDefaultTextPr(oTempTextPr)}}else{var oTempTextPr=this.Pr.TextPr.Copy();oTempTextPr.Merge(TextPr);this.SetDefaultTextPr(oTempTextPr)}if(this.IsDropDownList()||this.IsComboBox()||this.IsCheckBox()||this.IsDatePicker()||this.IsTextForm())CParagraphContentWithParagraphLikeContent.prototype.Apply_TextPr.call(this,TextPr,IncFontSize,true);else CParagraphContentWithParagraphLikeContent.prototype.Apply_TextPr.call(this,TextPr,IncFontSize, ApplyToAll)};CInlineLevelSdt.prototype.CanAddDropCap=function(){if(!this.CanBeEdited()||this.IsPlaceHolder())return false;return CParagraphContentWithParagraphLikeContent.prototype.CanAddDropCap.apply(this,arguments)};CInlineLevelSdt.prototype.CheckSelectionForDropCap=function(isUsePos,oEndPos,nDepth){return false};CInlineLevelSdt.prototype.IsPlaceHolder=function(){return this.Pr.ShowingPlcHdr};CInlineLevelSdt.prototype.private_ReplacePlaceHolderWithContent=function(bMathRun){if(!this.IsPlaceHolder())return; this.SetShowingPlcHdr(false);var isUseSelection=this.IsSelectionUse();this.RemoveSelection();this.MoveCursorToStartPos();this.RemoveFromContent(0,this.GetElementsCount());if(this.IsContentControlEquation()){var oParaMath=new ParaMath;oParaMath.Root.Load_FromMenu(c_oAscMathType.Default_Text,this.GetParagraph());oParaMath.Root.Correct_Content(true);this.AddToContent(0,oParaMath)}else{var oRun=new ParaRun(undefined,bMathRun);oRun.SetPr(this.Pr.TextPr.Copy());this.AddToContent(0,oRun)}this.RemoveSelection(); this.MoveCursorToStartPos();if(isUseSelection)this.SelectAll();if(this.IsContentControlTemporary())this.RemoveContentControlWrapper()};CInlineLevelSdt.prototype.private_ReplaceContentWithPlaceHolder=function(isSelect){if(this.IsPlaceHolder())return;this.SetShowingPlcHdr(true);var isUseSelection=this.IsSelectionUse();this.private_FillPlaceholderContent();if(false!==isSelect)this.SelectContentControl();if(isUseSelection)this.SelectAll()};CInlineLevelSdt.prototype.private_FillPlaceholderContent=function(){var isSelection= this.IsSelectionUse();this.RemoveFromContent(0,this.GetElementsCount());var oParagraph=this.GetParagraph();var oLogicDocument=oParagraph?oParagraph.GetLogicDocument():editor.WordControl.m_oLogicDocument;var oDocPart=oLogicDocument.GetGlossaryDocument().GetDocPartByName(this.GetPlaceholder());if(oDocPart){var oFirstParagraph=oDocPart.GetFirstParagraph();if(this.IsContentControlEquation()){var oParaMath=new ParaMath;oParaMath.Root.Load_FromMenu(c_oAscMathType.Default_Text,this.GetParagraph(),null,oFirstParagraph.GetText()); oParaMath.Root.Correct_Content(true);this.AddToContent(0,oParaMath)}else{for(var nPos=0,nCount=oFirstParagraph.Content.length;nPos0&&this.Content[0]instanceof ParaRun){var oRun=this.Content[0];if(oRun.Content.length>this.GetTextFormPr().MaxCharacters)oRun.RemoveFromContent(this.GetTextFormPr().MaxCharacters,oRun.Content.length-this.GetTextFormPr().MaxCharacters,true)}}}else if(this.IsContentControlEquation()){var oParaMath= new ParaMath;oParaMath.Root.Load_FromMenu(c_oAscMathType.Default_Text,this.GetParagraph(),null,String.fromCharCode(nbsp_charcode,nbsp_charcode,nbsp_charcode,nbsp_charcode));oParaMath.Root.Correct_Content(true);this.AddToContent(0,oParaMath)}else{var oRun=new ParaRun(oParagraph,false);oRun.AddText(String.fromCharCode(nbsp_charcode,nbsp_charcode,nbsp_charcode,nbsp_charcode));this.AddToContent(0,oRun)}if(this.IsForm())for(var nIndex=0,nCount=this.Content.length;nIndex0)this.SelectAll(1);else this.SelectAll(-1);else CParagraphContentWithParagraphLikeContent.prototype.Set_SelectionContentPos.apply(this,arguments)};CInlineLevelSdt.prototype.Set_ParaContentPos=function(ContentPos,Depth){if(this.IsPlaceHolder()&&this.IsForm()&&ContentPos&&this.GetLogicDocument()&&this.GetLogicDocument().CheckFormPlaceHolder){this.Get_StartPos(ContentPos,Depth);CParagraphContentWithParagraphLikeContent.prototype.Set_ParaContentPos.call(this, ContentPos,Depth)}else CParagraphContentWithParagraphLikeContent.prototype.Set_ParaContentPos.apply(this,arguments)};CInlineLevelSdt.prototype.ReplacePlaceHolderWithContent=function(bMathRun){this.private_ReplacePlaceHolderWithContent(bMathRun)};CInlineLevelSdt.prototype.ReplaceContentWithPlaceHolder=function(isSelect){this.private_ReplaceContentWithPlaceHolder(isSelect)};CInlineLevelSdt.prototype.CorrectContent=function(){if(this.IsForm())this.MakeSingleRunElement(false);else CParagraphContentWithParagraphLikeContent.prototype.CorrectContent.apply(this, arguments)};CInlineLevelSdt.prototype.GetContentControlType=function(){return c_oAscSdtLevelType.Inline};CInlineLevelSdt.prototype.SetPr=function(oPr){this.SetAlias(oPr.Alias);this.SetTag(oPr.Tag);this.SetLabel(oPr.Label);this.SetContentControlLock(oPr.Lock);this.SetContentControlId(oPr.Id);if(undefined!==oPr.DocPartObj)this.SetDocPartObj(oPr.DocPartObj.Category,oPr.DocPartObj.Gallery,oPr.DocPartObj.Unique);if(undefined!==oPr.Appearance)this.SetAppearance(oPr.Appearance);if(undefined!==oPr.Color)this.SetColor(oPr.Color)}; CInlineLevelSdt.prototype.SetDefaultTextPr=function(oTextPr){if(oTextPr&&!this.Pr.TextPr.IsEqual(oTextPr)){History.Add(new CChangesSdtPrTextPr(this,this.Pr.TextPr,oTextPr));this.Pr.TextPr=oTextPr}};CInlineLevelSdt.prototype.GetDefaultTextPr=function(){return this.Pr.TextPr};CInlineLevelSdt.prototype.SetAlias=function(sAlias){if(sAlias!==this.Pr.Alias){History.Add(new CChangesSdtPrAlias(this,this.Pr.Alias,sAlias));this.Pr.Alias=sAlias}};CInlineLevelSdt.prototype.GetAlias=function(){return undefined!== this.Pr.Alias?this.Pr.Alias:""};CInlineLevelSdt.prototype.SetAppearance=function(nType){if(this.Pr.Appearance!==nType){History.Add(new CChangesSdtPrAppearance(this,this.Pr.Appearance,nType));this.Pr.Appearance=nType}};CInlineLevelSdt.prototype.GetAppearance=function(){return this.Pr.Appearance};CInlineLevelSdt.prototype.SetColor=function(oColor){if(null===oColor||undefined===oColor){if(undefined!==this.Pr.Color){History.Add(new CChangesSdtPrColor(this,this.Pr.Color,undefined));this.Pr.Color=undefined}}else{History.Add(new CChangesSdtPrColor(this, this.Pr.Color,oColor));this.Pr.Color=oColor}};CInlineLevelSdt.prototype.GetColor=function(){return this.Pr.Color};CInlineLevelSdt.prototype.SetContentControlId=function(Id){if(this.Pr.Id!==Id){History.Add(new CChangesSdtPrId(this,this.Pr.Id,Id));this.Pr.Id=Id}};CInlineLevelSdt.prototype.GetContentControlId=function(){return this.Pr.Id};CInlineLevelSdt.prototype.SetTag=function(sTag){if(this.Pr.Tag!==sTag){History.Add(new CChangesSdtPrTag(this,this.Pr.Tag,sTag));this.Pr.Tag=sTag}};CInlineLevelSdt.prototype.GetTag= function(){return undefined!==this.Pr.Tag?this.Pr.Tag:""};CInlineLevelSdt.prototype.SetLabel=function(sLabel){if(this.Pr.Label!==sLabel){History.Add(new CChangesSdtPrLabel(this,this.Pr.Label,sLabel));this.Pr.Label=sLabel}};CInlineLevelSdt.prototype.GetLabel=function(){return undefined!==this.Pr.Label?this.Pr.Label:""};CInlineLevelSdt.prototype.SetDocPartObj=function(sCategory,sGallery,isUnique){History.Add(new CChangesSdtPrDocPartObj(this,this.Pr.DocPartObj,{Category:sCategory,Gallery:sGallery,Unique:isUnique})); this.Pr.DocPartObj.Category=sCategory;this.Pr.DocPartObj.Gallery=sGallery;this.Pr.DocPartObj.Unique=isUnique};CInlineLevelSdt.prototype.SetContentControlLock=function(nLockType){if(this.Pr.Lock!==nLockType){History.Add(new CChangesSdtPrLock(this,this.Pr.Lock,nLockType));this.Pr.Lock=nLockType}};CInlineLevelSdt.prototype.GetContentControlLock=function(){return undefined!==this.Pr.Lock?this.Pr.Lock:c_oAscSdtLockType.Unlocked};CInlineLevelSdt.prototype.SetContentControlPr=function(oPr){if(!oPr)return; if(oPr&&!(oPr instanceof CContentControlPr)){var oTemp=new CContentControlPr(c_oAscSdtLockType.Inline);oTemp.FillFromObject(oPr);oPr=oTemp}oPr.SetToContentControl(this);if(this.IsForm())this.GetLogicDocument().CheckFormAutoFit(this)};CInlineLevelSdt.prototype.GetContentControlPr=function(){var oPr=new CContentControlPr(c_oAscSdtLevelType.Inline);oPr.FillFromContentControl(this);return oPr};CInlineLevelSdt.prototype.CanBeDeleted=function(){if(this.IsFixedForm())return false;return undefined===this.Pr.Lock|| c_oAscSdtLockType.Unlocked===this.Pr.Lock||c_oAscSdtLockType.ContentLocked===this.Pr.Lock};CInlineLevelSdt.prototype.CanBeEdited=function(){if(!this.SkipSpecialLock&&(this.IsCheckBox()||this.IsPicture()||this.IsDropDownList()))return false;return undefined===this.Pr.Lock||c_oAscSdtLockType.Unlocked===this.Pr.Lock||c_oAscSdtLockType.SdtLocked===this.Pr.Lock};CInlineLevelSdt.prototype.IsFormLocked=function(){return!(undefined===this.Pr.Lock||c_oAscSdtLockType.Unlocked===this.Pr.Lock||c_oAscSdtLockType.ContentLocked=== this.Pr.Lock)};CInlineLevelSdt.prototype.Write_ToBinary2=function(Writer){Writer.WriteLong(AscDFH.historyitem_type_InlineLevelSdt);Writer.WriteString2(this.Id);var Count=this.Content.length;Writer.WriteLong(Count);for(var Index=0;Index.001&&this.Bounds[Key].H>.001){nW=this.Bounds[Key].W+.5;nH=this.Bounds[Key].H+.1;break}var oSpPr=new AscFormat.CSpPr;var oXfrm=new AscFormat.CXfrm;oXfrm.setOffX(0);oXfrm.setOffY(0);oXfrm.setExtX(nW);oXfrm.setExtY(nH);oSpPr.setXfrm(oXfrm);oXfrm.setParent(oSpPr);oSpPr.setFill(AscFormat.CreateNoFillUniFill());oSpPr.setLn(AscFormat.CreateNoFillLine());oSpPr.setGeometry(AscFormat.CreateGeometry("rect"));oSpPr.setParent(oShape);oShape.setSpPr(oSpPr);oShape.createTextBoxContent(); var oContent=oShape.getDocContent();var oInnerParagraph=oContent.GetElement(0);if(!oInnerParagraph)return this;oInnerParagraph.MoveCursorToStartPos();oInnerParagraph.Add(this);oInnerParagraph.SetParagraphAlign(this.IsCheckBox()?AscCommon.align_Center:AscCommon.align_Left);oInnerParagraph.SetParagraphSpacing({Before:0,After:0,Line:1,LineRule:AscCommon.linerule_Auto});var oBodyPr=oShape.getBodyPr().createDuplicate();oBodyPr.spcFirstLastPara=false;oBodyPr.vertOverflow=AscFormat.nOTOwerflow;oBodyPr.horzOverflow= AscFormat.nOTOwerflow;oBodyPr.vert=AscFormat.nVertTThorz;oBodyPr.rot=0;oBodyPr.lIns=0;oBodyPr.tIns=0;oBodyPr.rIns=0;oBodyPr.bIns=0;oBodyPr.numCol=1;oBodyPr.spcCol=0;oBodyPr.rtlCol=0;oBodyPr.fromWordArt=false;oBodyPr.anchor=1;oBodyPr.anchorCtr=false;oBodyPr.forceAA=false;oBodyPr.compatLnSpc=true;oBodyPr.prstTxWarp=null;oShape.setBodyPr(oBodyPr);var oParaDrawing=new ParaDrawing(oShape.spPr.xfrm.extX,oShape.spPr.xfrm.extY,oShape,oLogicDocument.GetDrawingDocument(),oParentDocContent,null);oShape.setParent(oParaDrawing); oParaDrawing.Set_DrawingType(drawing_Inline);oParaDrawing.SetForm(true);var oRun=new ParaRun(oParagraph,false);oRun.AddToContent(0,oParaDrawing);if(this.Content.length>0&&this.Content[0]instanceof ParaRun){var oInnerRun=this.Content[0];var oTextPr=oInnerRun.Get_CompiledPr(false);g_oTextMeasurer.SetTextPr(oTextPr,oParagraph.GetTheme());g_oTextMeasurer.SetFontSlot(fontslot_ASCII);var nTextDescent=Math.abs(g_oTextMeasurer.GetDescender());oRun.Set_Position(oTextPr.Position-nTextDescent);oInnerRun.Recalc_CompiledPr(true)}oParent.RemoveFromContent(nPosInParent, 1,true);oParent.AddToContent(nPosInParent,oRun,true);return oParaDrawing};CInlineLevelSdt.prototype.ConvertFormToInline=function(){var oParagraph=this.GetParagraph();var oParent=this.GetParent();var nPosInParent=this.GetPosInParent(oParent);if(!oParagraph||!oParent||!oParagraph.IsInFixedForm()||-1===nPosInParent||this.IsPicture())return false;var oShape=oParagraph.Parent.Is_DrawingShape(true);if(!oShape||!oShape.parent)return false;var oParaDrawing=oShape.parent;var oRun=oParaDrawing.GetRun();if(!oRun)return false; var oRunParent=oRun.GetParent();var nInRunParentPos=oRun.GetPosInParent(oRunParent);if(!oRunParent||-1===nInRunParentPos)return false;if(1===oRun.GetElementsCount()){oParent.RemoveFromContent(nPosInParent,1,true);oRunParent.RemoveFromContent(nInRunParentPos,1,true);oRunParent.AddToContent(nInRunParentPos,this,true)}else{var nInRunPos=-1;for(var nPos=0,nRunLen=oRun.GetElementsCount();nPos0){var oNewTextFormPr=oTextFormPr.Copy();oNewTextFormPr.SetWidth(AscCommon.MMToTwips(nW/nMax));this.SetTextFormPr(oNewTextFormPr)}}};CInlineLevelSdt.prototype.IsAutoFitContent=function(){if(!this.IsForm())return false;var oTextPr=this.GetTextFormPr();if(oTextPr)return oTextPr.GetAutoFit();var oComboPr=this.GetComboBoxPr();if(oComboPr)return oComboPr.GetAutoFit();return false};CInlineLevelSdt.prototype.ProcessAutoFitContent=function(isFastRecalc){if(this.IsMultiLineForm()&& isFastRecalc)return;var oParagraph=this.GetParagraph();var oRun=this.GetElement(0);var oTextPr=this.Get_CompiledTextPr();var oShape=oParagraph.Parent?oParagraph.Parent.Is_DrawingShape(true):null;if(!oShape||!oShape.isForm())return;var oShapeBounds=oShape.getFormRelRect();g_oTextMeasurer.SetTextPr(oTextPr,oParagraph.GetTheme());g_oTextMeasurer.SetFontSlot(fontslot_ASCII);var nTextHeight=g_oTextMeasurer.GetHeight();var nMaxWidth=oParagraph.RecalculateMinMaxContentWidth(false).Max;var nFontSize=oTextPr.FontSize; if(nMaxWidth<.001||nTextHeight<.001||oShapeBounds.W<.001||oShapeBounds.H<.001)return;var nNewFontSize=nFontSize;History.TurnOff();if(this.IsMultiLineForm()){var nFontStep=.1;if(nMaxWidth>oShapeBounds.W){oParagraph.Recalculate_Page(0);var oContentBounds=oParagraph.GetContentBounds(0);if(oContentBounds.Bottom-oContentBounds.Top>oShapeBounds.H){nNewFontSize=AscCommon.CorrectFontSize(nFontSize,true);while(nNewFontSize>1){oRun.Set_FontSize(nNewFontSize);oParagraph.Recalculate_Page(0);oContentBounds=oParagraph.GetContentBounds(0); if(oContentBounds.Bottom-oContentBounds.TopoShapeBounds.H){nNewFontSize-=nFontStep;oRun.Set_FontSize(nNewFontSize);break}nNewFontSize+=nFontStep}nNewFontSize=Math.min(nNewFontSize,nMaxFontSize)}}oParagraph.Recalculate_Page(0); oShape.recalcContent();oShape.recalculateText();oRun.Set_FontSize(nFontSize)}else{nNewFontSize=Math.min(nFontSize*oShapeBounds.H/nTextHeight*.9,100,nFontSize*oShapeBounds.W/nMaxWidth);if(!isFastRecalc){oRun.Set_FontSize(nNewFontSize);oParagraph.Recalculate_Page(0);oShape.recalcContent();oShape.recalculateText();oRun.Set_FontSize(nFontSize)}else if(AscCommon.align_Left!==oParagraph.GetParagraphAlign()){oRun.Set_FontSize(nNewFontSize);oParagraph.private_RecalculateFastRange(0,0);oRun.Set_FontSize(nFontSize)}}nNewFontSize= (nNewFontSize*100|0)/100;History.TurnOn();if(Math.abs(nNewFontSize-nFontSize)>.001)oRun.Set_FontSize(nNewFontSize)};CInlineLevelSdt.prototype.UpdatePictureFormLayout=function(){var oBounds=this.GetFixedFormBounds();this.private_UpdatePictureFormLayout(oBounds.W,oBounds.H)};CInlineLevelSdt.prototype.private_UpdatePictureFormLayout=function(nW,nH){var arrDrawings=this.GetAllDrawingObjects();if(1!==arrDrawings.length||nW<.001||nH<.001)return;var oDrawing=arrDrawings[0];var oShape=oDrawing.GraphicObj; if(this.IsPlaceHolder()||!oDrawing.IsPicture()){oShape.spPr.xfrm.setExtX(nW);oShape.spPr.xfrm.setExtY(nH)}else{var oLogicDocument=this.GetLogicDocument();if(!oLogicDocument||!oLogicDocument.GetDrawingObjects()||!oLogicDocument.GetApi())return;var oDrawingProps=oLogicDocument.GetDrawingObjects().getDrawingPropsFromArray([oDrawing.GraphicObj]);if(!oDrawingProps||!oDrawingProps.imageProps)return;var oProps=new Asc.asc_CImgProperty;oProps.ImageUrl=oDrawingProps.imageProps.ImageUrl;var oOriginSize=oProps.asc_getOriginSize(oLogicDocument.GetApi()); if(!oOriginSize.asc_getIsCorrect())return;var nOriginW=oOriginSize.asc_getImageWidth();var nOriginH=oOriginSize.asc_getImageHeight();var oPictureFormPr=this.GetPictureFormPr();if(!oPictureFormPr||nOriginW<.001||nOriginH<.001)return;var nScaleFlag=oPictureFormPr.GetScaleFlag();var nDstW,nDstH,isCrop=false;if(Asc.c_oAscPictureFormScaleFlag.Never===nScaleFlag||Asc.c_oAscPictureFormScaleFlag.Smaller===nScaleFlag&&(nOriginH>nH||nOriginW>nW)||Asc.c_oAscPictureFormScaleFlag.Bigger===nScaleFlag&&nH>nOriginH&& nW>nOriginW){nDstW=nOriginW;nDstH=nOriginH;isCrop=true}else if(oPictureFormPr.IsConstantProportions()){var nCoef=Math.min(nW/nOriginW,nH/nOriginH);nDstW=nOriginW*nCoef;nDstH=nOriginH*nCoef;isCrop=true}if(isCrop){var nSpaceX=nW-nDstW;var nSpaceY=nH-nDstH;var nPadL=oPictureFormPr.GetShiftX()*nSpaceX;var nPadT=oPictureFormPr.GetShiftY()*nSpaceY;var oSrcRect=new AscFormat.CSrcRect;oSrcRect.setLTRB(100*-nPadL/nDstW,100*-nPadT/nDstH,100*(1+(nSpaceX-nPadL)/nDstW),100*(1+(nSpaceY-nPadT)/nDstH));oShape.setSrcRect(oSrcRect)}else{var oSrcRect= new AscFormat.CSrcRect;oSrcRect.setLTRB(0,0,100,100);oShape.setSrcRect(oSrcRect)}oShape.spPr.xfrm.setExtX(nW);oShape.spPr.xfrm.setExtY(nH)}oDrawing.SetSizeRelH({RelativeFrom:AscCommon.c_oAscSizeRelFromH.sizerelfromhPage,Percent:0});oDrawing.SetSizeRelV({RelativeFrom:AscCommon.c_oAscSizeRelFromV.sizerelfromvPage,Percent:0});oDrawing.CheckWH()};CInlineLevelSdt.prototype.GetFixedFormWrapperShape=function(){var oParagraph=this.GetParagraph();if(!oParagraph||!oParagraph.Parent)return null;var oShape=oParagraph.Parent.Is_DrawingShape(true); if(!oShape||!oShape.isForm())return null;return oShape};CInlineLevelSdt.prototype.UpdateFixedFormSizeByCombWidth=function(){var oParagraph=this.GetParagraph();if(!oParagraph||!oParagraph.Parent)return;var oShape=oParagraph.Parent.Is_DrawingShape(true);if(!oShape||!oShape.parent||!oShape.spPr||!oShape.spPr.xfrm)return;var oTextFormPr=this.GetTextFormPr();if(!oTextFormPr||!oTextFormPr.IsComb()||oTextFormPr.GetMaxCharacters()<=0||oTextFormPr.GetWidth()<=0)return;var oDrawing=oShape.parent;oShape.spPr.xfrm.setExtX(AscCommon.TwipsToMM(oTextFormPr.GetWidth())* oTextFormPr.GetMaxCharacters());oDrawing.CheckWH()};CInlineLevelSdt.prototype.UpdateFixedFormCombWidthByFormSize=function(oTextFormPr){if(!oTextFormPr||!oTextFormPr.IsComb()||oTextFormPr.GetMaxCharacters()<=0)return;var oParagraph=this.GetParagraph();if(!oParagraph||!oParagraph.Parent)return;var oShape=oParagraph.Parent.Is_DrawingShape(true);if(!oShape||!oShape.parent||!oShape.spPr||!oShape.spPr.xfrm)return;var nW=oShape.spPr.xfrm.extX;if(nW<.001)return;oTextFormPr.SetWidth(AscCommon.MMToTwips(nW/ oTextFormPr.GetMaxCharacters()))};CInlineLevelSdt.prototype.IsFormExceedsBounds=function(){var oParagraph=this.GetParagraph();var oFormBounds=this.GetFixedFormBounds();if(oFormBounds.W<=.001||oFormBounds.H<=.001||!oParagraph||!oParagraph.IsRecalculated())return false;var oParaBounds=oParagraph.GetContentBounds(0);return oParaBounds.Right-oParaBounds.Left>oFormBounds.W||oParaBounds.Bottom-oParaBounds.Top>oFormBounds.H};window["AscCommonWord"]=window["AscCommonWord"]||{};window["AscCommonWord"].CInlineLevelSdt= CInlineLevelSdt;"use strict";function CSdtPr(){this.Alias=undefined;this.Id=undefined;this.Tag=undefined;this.Label=undefined;this.Lock=undefined;this.DocPartObj={Gallery:undefined,Category:undefined,Unique:undefined};this.Appearance=Asc.c_oAscSdtAppearance.Frame;this.Color=undefined;this.CheckBox=undefined;this.Picture=false;this.ComboBox=undefined;this.DropDown=undefined;this.Date=undefined;this.Equation=false;this.TextForm=undefined;this.TextPr=new CTextPr;this.Placeholder=undefined;this.ShowingPlcHdr= false;this.Text=false;this.Temporary=false;this.FormPr=undefined;this.PictureFormPr=undefined}CSdtPr.prototype.Copy=function(){var oPr=new CSdtPr;oPr.Alias=this.Alias;oPr.Id=this.Id;oPr.Tag=this.Tag;oPr.Label=this.Label;oPr.Lock=this.Lock;oPr.Appearance=this.Appearance;oPr.Color=this.Color?this.Color.Copy():undefined;if(this.CheckBox)oPr.CheckBox=this.CheckBox.Copy();oPr.Picture=this.Picture;if(this.ComboBox)oPr.ComboBox=this.ComboBox.Copy();if(this.DropDown)oPr.DropDown=this.DropDown.Copy();if(this.Date)oPr.Date= this.Date.Copy();if(this.TextForm)oPr.TextForm=this.TextForm.Copy();if(this.PictureFormPr)oPr.PictureFormPr=this.PictureFormPr.Copy();oPr.TextPr=this.TextPr.Copy();oPr.Placeholder=this.Placeholder;oPr.ShowingPlcHdr=this.ShowingPlcHdr;oPr.Equation=this.Equation;oPr.Text=this.Text;oPr.Temporary=this.Temporary;return oPr};CSdtPr.prototype.Write_ToBinary=function(Writer){this.TextPr.WriteToBinary(Writer);var StartPos=Writer.GetCurPosition();Writer.Skip(4);var Flags=0;if(undefined!==this.Alias){Writer.WriteString2(this.Alias); Flags|=1}if(undefined!==this.Id){Writer.WriteLong(this.Id);Flags|=2}if(undefined!==this.Tag){Writer.WriteString2(this.Tag);Flags|=4}if(undefined!==this.Label){Writer.WriteLong(this.Tag);Flags|=8}if(undefined!==this.Lock){Writer.WriteLong(this.Lock);Flags|=16}if(undefined!==this.DocPartObj.Unique){Writer.WriteBool(this.DocPartObj.Unique);Flags|=32}if(undefined!==this.DocPartObj.Gallery){Writer.WriteString2(this.DocPartObj.Gallery);Flags|=64}if(undefined!==this.DocPartObj.Category){Writer.WriteString2(this.DocPartObj.Category); Flags|=128}if(undefined!==this.Appearance){Writer.WriteLong(this.Appearance);Flags|=256}if(undefined!==this.Color){this.Color.WriteToBinary(Writer);Flags|=512}if(undefined!==this.CheckBox){this.CheckBox.WriteToBinary(Writer);Flags|=1024}if(undefined!==this.Picture){Writer.WriteBool(this.Picture);Flags|=2048}if(undefined!==this.ComboBox){this.ComboBox.WriteToBinary(Writer);Flags|=4096}if(undefined!==this.DropDown){this.DropDown.WriteToBinary(Writer);Flags|=8192}if(undefined!==this.Date){this.Date.WriteToBinary(Writer); Flags|=16384}if(undefined!==this.Placeholder){Writer.WriteString2(this.Placeholder);Flags|=32768}if(undefined!==this.ShowingPlcHdr){Writer.WriteBool(this.ShowingPlcHdr);Flags|=65536}if(undefined!==this.Equation){Writer.WriteBool(this.Equation);Flags|=131072}if(undefined!==this.Text){Writer.WriteBool(this.Text);Flags|=262144}if(undefined!==this.Temporary){Writer.WriteBool(this.Temporary);Flags|=524288}if(undefined!==this.TextForm){this.TextForm.WriteToBinary(Writer);Flags|=1048576}if(undefined!==this.PictureFormPr){this.PictureFormPr.WriteToBinary(Writer); Flags|=2097152}var EndPos=Writer.GetCurPosition();Writer.Seek(StartPos);Writer.WriteLong(Flags);Writer.Seek(EndPos)};CSdtPr.prototype.Read_FromBinary=function(Reader){this.TextPr=new CTextPr;this.TextPr.ReadFromBinary(Reader);var Flags=Reader.GetLong();if(Flags&1)this.Alias=Reader.GetString2();if(Flags&2)this.Id=Reader.GetLong();if(Flags&4)this.Tag=Reader.GetString2();if(Flags&8)this.Tag=Reader.GetLong();if(Flags&16)this.Lock=Reader.GetLong();if(Flags&32)this.DocPartObj.Unique=Reader.GetBool();if(Flags& 64)this.DocPartObj.Gallery=Reader.GetString2();if(Flags&128)this.DocPartObj.Category=Reader.GetString2();if(Flags&256)this.Appearance=Reader.GetLong();if(Flags&512){this.Color=new CDocumentColor;this.Color.ReadFromBinary(Reader)}if(Flags&1024){this.CheckBox=new CSdtCheckBoxPr;this.CheckBox.ReadFromBinary(Reader)}if(Flags&2048)this.Picture=Reader.GetBool();if(Flags&4096){this.ComboBox=new CSdtComboBoxPr;this.ComboBox.ReadFromBinary(Reader)}if(Flags&8192){this.DropDown=new CSdtComboBoxPr;this.DropDown.ReadFromBinary(Reader)}if(Flags& 16384){this.Date=new CSdtDatePickerPr;this.Date.ReadToBinary(Reader)}if(Flags&32768)this.Placeholder=Reader.GetString2();if(Flags&65536)this.ShowingPlcHdr=Reader.GetBool();if(Flags&131072)this.Equation=Reader.GetBool();if(Flags&262144)this.Text=Reader.GetBool();if(Flags&524288)this.Temporary=Reader.GetBool();if(Flags&1048576){this.TextForm=new CSdtTextFormPr;this.TextForm.ReadFromBinary(oReader)}if(Flags&2097152){this.PictureFormPr=new CSdtPictureFormPr;this.PictureFormPr.ReadFromBinary(oReader)}}; CSdtPr.prototype.IsBuiltInDocPart=function(){if(this.DocPartObj&&(this.DocPartObj.Category||this.DocPartObj.Gallery))return true;return false};function CContentControlPr(nType){this.CC=null;this.Id=undefined;this.Tag=undefined;this.Alias=undefined;this.Lock=undefined;this.InternalId=undefined;this.CCType=undefined!==nType?nType:c_oAscSdtLevelType.Inline;this.SectionBreak=undefined;this.PageSizeW=undefined;this.PageSizeH=undefined;this.Orient=undefined;this.MarginT=undefined;this.MarginL=undefined; this.MarginR=undefined;this.MarginB=undefined;this.Appearance=Asc.c_oAscSdtAppearance.Frame;this.Color=undefined;this.CheckBoxPr=undefined;this.ComboBoxPr=undefined;this.DropDownPr=undefined;this.DateTimePr=undefined;this.TextFormPr=undefined;this.PictureFormPr=undefined;this.PlaceholderText=undefined;this.FormPr=undefined}CContentControlPr.prototype.FillFromObject=function(oPr){if(undefined!==oPr.Id)this.Id=oPr.Id;if(undefined!==oPr.Tag)this.Tag=oPr.Tag;if(undefined!==oPr.Alias)this.Alias=oPr.Alias; if(undefined!==oPr.Lock)this.Lock=oPr.Lock;if(undefined!==oPr.InternalId)this.InternalId=oPr.InternalId;if(undefined!==oPr.Appearance)this.Appearance=oPr.Appearance;if(undefined!==oPr.Color)this.Color=oPr.Color;if(undefined!==oPr.PlaceholderText)this.PlaceholderText=oPr.PlaceholderText};CContentControlPr.prototype.FillFromContentControl=function(oContentControl){if(!oContentControl)return;this.CC=oContentControl;this.CCType=oContentControl.IsBlockLevel()?c_oAscSdtLevelType.Block:c_oAscSdtLevelType.Inline; this.Id=oContentControl.Pr.Id;this.Lock=oContentControl.Pr.Lock;this.InternalId=oContentControl.GetId();this.Tag=oContentControl.GetTag();this.Alias=oContentControl.GetAlias();this.Appearance=oContentControl.GetAppearance();this.Color=oContentControl.GetColor();if(oContentControl.IsCheckBox())this.CheckBoxPr=oContentControl.GetCheckBoxPr().Copy();else if(oContentControl.IsComboBox())this.ComboBoxPr=oContentControl.GetComboBoxPr().Copy();else if(oContentControl.IsDropDownList())this.DropDownPr=oContentControl.GetDropDownListPr().Copy(); else if(oContentControl.IsDatePicker())this.DateTimePr=oContentControl.GetDatePickerPr().Copy();else if(oContentControl.IsTextForm())this.TextFormPr=oContentControl.GetTextFormPr().Copy();else if(oContentControl.IsPictureForm())this.PictureFormPr=oContentControl.GetPictureFormPr().Copy();this.PlaceholderText=oContentControl.GetPlaceholderText();if(oContentControl.IsForm()){this.FormPr=oContentControl.GetFormPr().Copy();this.FormPr.SetFixed(oContentControl.IsFixedForm())}};CContentControlPr.prototype.SetToContentControl= function(oContentControl){if(!oContentControl)return;if(undefined!==this.FormPr&&oContentControl.IsRadioButton()&&oContentControl.IsFormRequired()!==this.FormPr.GetRequired()&&oContentControl.GetLogicDocument())oContentControl.GetLogicDocument().OnChangeRadioRequired(oContentControl.GetRadioButtonGroupKey(),this.FormPr.GetRequired());if(undefined!==this.Tag)oContentControl.SetTag(this.Tag);if(undefined!==this.Id)oContentControl.SetContentControlId(this.Id);if(undefined!==this.Lock)oContentControl.SetContentControlLock(this.Lock); if(undefined!==this.Alias)oContentControl.SetAlias(this.Alias);if(undefined!==this.Appearance)oContentControl.SetAppearance(this.Appearance);if(undefined!==this.Color)if(!this.Color)oContentControl.SetColor(undefined);else oContentControl.SetColor(new CDocumentColor(this.Color.r,this.Color.g,this.Color.b));if(undefined!==this.CheckBoxPr){if(undefined!==this.CheckBoxPr.GroupKey&&undefined!==this.CheckBoxPr.Checked)this.CheckBoxPr.Checked=false;oContentControl.SetCheckBoxPr(this.CheckBoxPr);oContentControl.private_UpdateCheckBoxContent()}if(undefined!== this.ComboBoxPr)oContentControl.SetComboBoxPr(this.ComboBoxPr);if(undefined!==this.DropDownPr)oContentControl.SetDropDownListPr(this.DropDownPr);if(undefined!==this.DateTimePr)oContentControl.ApplyDatePickerPr(this.DateTimePr);if(undefined!==this.TextFormPr&&oContentControl.IsInlineLevel()){var isCombChanged=!oContentControl.Pr.TextForm||this.TextFormPr.Comb!==oContentControl.Pr.TextForm.Comb;if(oContentControl.IsFixedForm()&&isCombChanged)oContentControl.UpdateFixedFormCombWidthByFormSize(this.TextFormPr); oContentControl.SetTextFormPr(this.TextFormPr);if(oContentControl.IsFixedForm()&&!isCombChanged)oContentControl.UpdateFixedFormSizeByCombWidth()}if(undefined!==this.PlaceholderText)oContentControl.SetPlaceholderText(this.PlaceholderText);if(undefined!==this.FormPr)oContentControl.SetFormPr(this.FormPr);if(undefined!==this.PictureFormPr&&oContentControl.IsInlineLevel()){oContentControl.SetPictureFormPr(this.PictureFormPr);oContentControl.UpdatePictureFormLayout()}};CContentControlPr.prototype.GetId= function(){return this.Id};CContentControlPr.prototype.SetId=function(Id){this.Id=Id};CContentControlPr.prototype.GetTag=function(){return this.Tag};CContentControlPr.prototype.SetTag=function(sTag){this.Tag=sTag};CContentControlPr.prototype.GetLock=function(){return this.Lock};CContentControlPr.prototype.SetLock=function(nLock){this.Lock=nLock};CContentControlPr.prototype.GetInternalId=function(){return this.InternalId};CContentControlPr.prototype.GetContentControlType=function(){return this.CCType}; CContentControlPr.prototype.GetAlias=function(){return this.Alias};CContentControlPr.prototype.SetAlias=function(sAlias){this.Alias=sAlias};CContentControlPr.prototype.GetAppearance=function(){return this.Appearance};CContentControlPr.prototype.SetAppearance=function(nAppearance){this.Appearance=nAppearance};CContentControlPr.prototype.GetColor=function(){if(!this.Color)return null;return new Asc.asc_CColor(this.Color.r,this.Color.g,this.Color.b)};CContentControlPr.prototype.SetColor=function(r,g, b){if(undefined===r)this.Color=undefined;else if(null===r)this.Color=null;else this.Color=new CDocumentColor(r,g,b)};CContentControlPr.prototype.GetSpecificType=function(){if(this.CC)return this.CC.GetSpecificType();return Asc.c_oAscContentControlSpecificType.None};CContentControlPr.prototype.GetCheckBoxPr=function(){if(this.CC&&this.CC.IsCheckBox())return this.CheckBoxPr;return null};CContentControlPr.prototype.SetCheckBoxPr=function(oPr){this.CheckBoxPr=oPr};CContentControlPr.prototype.GetComboBoxPr= function(){if(this.CC&&this.CC.IsComboBox())return this.ComboBoxPr;return null};CContentControlPr.prototype.SetComboBoxPr=function(oPr){this.ComboBoxPr=oPr};CContentControlPr.prototype.GetDropDownListPr=function(){if(this.CC&&this.CC.IsDropDownList())return this.DropDownPr;return null};CContentControlPr.prototype.SetDropDownListPr=function(oPr){this.DropDownPr=oPr};CContentControlPr.prototype.GetDateTimePr=function(){if(this.CC&&this.CC.IsDatePicker())return this.DateTimePr;return null};CContentControlPr.prototype.SetDateTimePr= function(oPr){this.DateTimePr=oPr};CContentControlPr.prototype.GetTextFormPr=function(){if(this.CC&&this.CC.IsTextForm())return this.TextFormPr;return null};CContentControlPr.prototype.SetTextFormPr=function(oPr){this.TextFormPr=oPr};CContentControlPr.prototype.GetPlaceholderText=function(){return this.PlaceholderText};CContentControlPr.prototype.SetPlaceholderText=function(sText){this.PlaceholderText=sText};CContentControlPr.prototype.GetFormPr=function(){if(this.CC&&this.CC.IsForm())return this.FormPr; return null};CContentControlPr.prototype.SetFormPr=function(oPr){this.FormPr=oPr};CContentControlPr.prototype.SetPictureFormPr=function(oPr){this.PictureFormPr=oPr};CContentControlPr.prototype.GetPictureFormPr=function(){return this.PictureFormPr};function CSdtGlobalSettings(){this.Color=new AscCommonWord.CDocumentColor(220,220,220);this.ShowHighlight=false}CSdtGlobalSettings.prototype.IsDefault=function(){if(!this.Color||220!==this.Color.r||220!==this.Color.g||220!==this.Color.b||false!==this.ShowHighlight)return false; return true};CSdtGlobalSettings.prototype.Copy=function(){var oSettings=new CSdtGlobalSettings;oSettings.Color=this.Color.Copy();oSettings.ShowHighlight=this.ShowHighlight;return oSettings};CSdtGlobalSettings.prototype.Write_ToBinary=function(oWriter){this.Color.WriteToBinary(oWriter);oWriter.WriteBool(this.ShowHighlight)};CSdtGlobalSettings.prototype.Read_FromBinary=function(oReader){this.Color.ReadFromBinary(oReader);this.ShowHighlight=oReader.GetBool()};function CSpecialFormsGlobalSettings(){this.Highlight= new AscCommonWord.CDocumentColor(201,200,255)}CSpecialFormsGlobalSettings.prototype.Copy=function(){var oSettings=new CSpecialFormsGlobalSettings;if(this.Highlight)oSettings.Highlight=this.Highlight.Copy();return oSettings};CSpecialFormsGlobalSettings.prototype.IsDefault=function(){return undefined===this.Highlight};CSpecialFormsGlobalSettings.prototype.Write_ToBinary=function(oWriter){var nStartPos=oWriter.GetCurPosition();oWriter.Skip(4);var nFlags=0;if(undefined!==this.Highlight){this.Highlight.WriteToBinary(oWriter); nFlags|=1}var nEndPos=oWriter.GetCurPosition();oWriter.Seek(nStartPos);oWriter.WriteLong(nFlags);oWriter.Seek(nEndPos)};CSpecialFormsGlobalSettings.prototype.Read_FromBinary=function(oReader){var nFlags=oReader.GetLong();if(nFlags&1){this.Highlight=new AscCommonWord.CDocumentColor;this.Highlight.ReadFromBinary(oReader)}else this.Highlight=undefined};function CSdtCheckBoxPr(){this.Checked=false;this.CheckedSymbol=Asc.c_oAscSdtCheckBoxDefaults.CheckedSymbol;this.UncheckedSymbol=Asc.c_oAscSdtCheckBoxDefaults.UncheckedSymbol; this.CheckedFont=Asc.c_oAscSdtCheckBoxDefaults.CheckedFont;this.UncheckedFont=Asc.c_oAscSdtCheckBoxDefaults.UncheckedFont;this.GroupKey=undefined}CSdtCheckBoxPr.prototype.Copy=function(){var oCopy=new CSdtCheckBoxPr;oCopy.Checked=this.Checked;oCopy.CheckedSymbol=this.CheckedSymbol;oCopy.CheckedFont=this.CheckedFont;oCopy.UncheckedSymbol=this.UncheckedSymbol;oCopy.UncheckedFont=this.UncheckedFont;oCopy.GroupKey=this.GroupKey;return oCopy};CSdtCheckBoxPr.prototype.IsEqual=function(oOther){if(!oOther|| oOther.Checked!==this.Checked||oOther.CheckedSymbol!==this.CheckedSymbol||oOther.CheckedFont!==this.CheckedFont||oOther.UncheckedSymbol!==this.UncheckedSymbol||oOther.UncheckedFont!==this.UncheckedFont||oOther.GroupKey!==this.GroupKey)return false;return true};CSdtCheckBoxPr.prototype.WriteToBinary=function(oWriter){oWriter.WriteBool(this.Checked);oWriter.WriteString2(this.CheckedFont);oWriter.WriteLong(this.CheckedSymbol);oWriter.WriteString2(this.UncheckedFont);oWriter.WriteLong(this.UncheckedSymbol); if(undefined!==this.GroupKey){oWriter.WriteBool(true);oWriter.WriteString2(this.GroupKey)}else oWriter.WriteBool(false)};CSdtCheckBoxPr.prototype.ReadFromBinary=function(oReader){this.Checked=oReader.GetBool();this.CheckedFont=oReader.GetString2();this.CheckedSymbol=oReader.GetLong();this.UncheckedFont=oReader.GetString2();this.UncheckedSymbol=oReader.GetLong();if(oReader.GetBool())this.GroupKey=oReader.GetString2()};CSdtCheckBoxPr.prototype.Write_ToBinary=function(oWriter){this.WriteToBinary(oWriter)}; CSdtCheckBoxPr.prototype.Read_FromBinary=function(oReader){this.ReadFromBinary(oReader)};CSdtCheckBoxPr.prototype.SetChecked=function(isChecked){this.Checked=isChecked};CSdtCheckBoxPr.prototype.GetChecked=function(){return this.Checked};CSdtCheckBoxPr.prototype.GetCheckedSymbol=function(){return this.CheckedSymbol};CSdtCheckBoxPr.prototype.SetCheckedSymbol=function(nSymbol){this.CheckedSymbol=nSymbol};CSdtCheckBoxPr.prototype.GetCheckedFont=function(){return this.CheckedFont};CSdtCheckBoxPr.prototype.SetCheckedFont= function(sFont){this.CheckedFont=sFont};CSdtCheckBoxPr.prototype.GetUncheckedSymbol=function(){return this.UncheckedSymbol};CSdtCheckBoxPr.prototype.SetUncheckedSymbol=function(nSymbol){this.UncheckedSymbol=nSymbol};CSdtCheckBoxPr.prototype.GetUncheckedFont=function(){return this.UncheckedFont};CSdtCheckBoxPr.prototype.SetUncheckedFont=function(sFont){this.UncheckedFont=sFont};CSdtCheckBoxPr.prototype.GetGroupKey=function(){return this.GroupKey};CSdtCheckBoxPr.prototype.SetGroupKey=function(sKey){this.GroupKey= sKey};function CSdtListItem(){this.DisplayText="";this.Value=""}CSdtListItem.prototype.Copy=function(){var oItem=new CSdtListItem;oItem.DisplayText=this.DisplayText;oItem.Value=this.Value;return oItem};CSdtListItem.prototype.IsEqual=function(oItem){return this.DisplayText===oItem.DisplayText&&this.Value===oItem.Value};CSdtListItem.prototype.WriteToBinary=function(oWriter){oWriter.WriteString2(this.DisplayText);oWriter.WriteString2(this.Value)};CSdtListItem.prototype.ReadFromBinary=function(oReader){this.DisplayText= oReader.GetString2();this.Value=oReader.GetString2()};function CSdtComboBoxPr(){this.ListItems=[];this.LastValue=-1;this.AutoFit=false}CSdtComboBoxPr.prototype.Copy=function(){var oList=new CSdtComboBoxPr;oList.LastValue=this.LastValue;oList.ListItems=[];for(var nIndex=0,nCount=this.ListItems.length;nIndex 0){var dateStr=(new Date(reviewInfo.DateTime)).toISOString().slice(0,19)+"Z";bs.memory.WriteByte(c_oSerProp_RevisionType.Date);bs.memory.WriteString2(dateStr)}if(reviewInfo.UserId){bs.memory.WriteByte(c_oSerProp_RevisionType.UserId);bs.memory.WriteString2(reviewInfo.UserId)}}if(options){if(null!=options.run)bs.WriteItem(c_oSerProp_RevisionType.Content,function(){options.run()});if(null!=options.runContent)bs.WriteItem(c_oSerProp_RevisionType.ContentRun,function(){options.runContent()});if(null!=options.rPr)bs.WriteItem(c_oSerProp_RevisionType.rPrChange, function(){options.brPrs.Write_rPr(options.rPr,null,null)});if(null!=options.pPr)bs.WriteItem(c_oSerProp_RevisionType.pPrChange,function(){options.bpPrs.Write_pPr(options.pPr)});if(null!=options.grid)bs.WriteItem(c_oSerProp_RevisionType.tblGridChange,function(){options.btw.WriteTblGrid(options.grid)});if(null!=options.tblPr)bs.WriteItem(c_oSerProp_RevisionType.tblPrChange,function(){options.btw.WriteTblPr(options.tblPr)});if(null!=options.trPr)bs.WriteItem(c_oSerProp_RevisionType.trPrChange,function(){options.btw.WriteRowPr(options.trPr)}); if(null!=options.tcPr)bs.WriteItem(c_oSerProp_RevisionType.tcPrChange,function(){options.btw.WriteCellPr(options.tcPr)})}}function ReadTrackRevision(type,length,stream,reviewInfo,options){var res=c_oSerConstants.ReadOk;if(c_oSerProp_RevisionType.Author==type)reviewInfo.UserName=stream.GetString2LE(length);else if(c_oSerProp_RevisionType.Date==type){var dateStr=stream.GetString2LE(length);var dateMs=AscCommon.getTimeISO8601(dateStr);if(isNaN(dateMs))dateMs=(new Date).getTime();reviewInfo.DateTime= dateMs}else if(c_oSerProp_RevisionType.UserId==type)reviewInfo.UserId=stream.GetString2LE(length);else if(options)if(c_oSerProp_RevisionType.Content==type)res=options.bdtr.bcr.Read1(length,function(t,l){return options.bdtr.ReadParagraphContent(t,l,options.parStruct)});else if(c_oSerProp_RevisionType.ContentRun==type)res=options.bmr.bcr.Read1(length,function(t,l){return options.bmr.ReadMathMRun(t,l,options.run,options.props,options.oElem,options.parStruct)});else if(c_oSerProp_RevisionType.rPrChange== type)res=options.brPrr.Read(length,options.rPr,null);else if(c_oSerProp_RevisionType.pPrChange==type)res=options.bpPrr.Read(length,options.pPr,null);else if(c_oSerProp_RevisionType.tblGridChange==type)res=options.btblPrr.bcr.Read2(length,function(t,l){return options.btblPrr.Read_tblGrid(t,l,options.grid)});else if(c_oSerProp_RevisionType.tblPrChange==type)res=options.btblPrr.bcr.Read1(length,function(t,l){return options.btblPrr.Read_tblPr(t,l,options.tblPr)});else if(c_oSerProp_RevisionType.trPrChange== type)res=options.btblPrr.bcr.Read2(length,function(t,l){return options.btblPrr.Read_RowPr(t,l,options.trPr)});else if(c_oSerProp_RevisionType.tcPrChange==type)res=options.btblPrr.bcr.Read2(length,function(t,l){return options.btblPrr.Read_CellPr(t,l,options.tcPr)});else res=c_oSerConstants.ReadUnknown;else res=c_oSerConstants.ReadUnknown;return res}function WiteMoveRangeStartElem(bs,Id,moveRange){bs.WriteItem(c_oSerMoveRange.Id,function(){bs.memory.WriteLong(Id)});if(null!=moveRange.GetMarkId()){bs.memory.WriteByte(c_oSerMoveRange.Name); bs.memory.WriteString2(moveRange.GetMarkId())}var reviewInfo=moveRange.GetReviewInfo();if(reviewInfo){if(null!=reviewInfo.UserName){bs.memory.WriteByte(c_oSerMoveRange.Author);bs.memory.WriteString2(reviewInfo.UserName)}if(reviewInfo.DateTime>0){var dateStr=(new Date(reviewInfo.DateTime)).toISOString().slice(0,19)+"Z";bs.memory.WriteByte(c_oSerMoveRange.Date);bs.memory.WriteString2(dateStr)}if(reviewInfo.UserId){bs.memory.WriteByte(c_oSerMoveRange.UserId);bs.memory.WriteString2(reviewInfo.UserId)}}} function WiteMoveRangeEndElem(bs,Id){bs.WriteItem(c_oSerMoveRange.Id,function(){bs.memory.WriteLong(Id)})}function WiteMoveRange(bs,saveParams,elem){var recordType;var moveRangeNameToId;if(elem.IsFrom()){moveRangeNameToId=saveParams.moveRangeFromNameToId;recordType=elem.IsStart()?c_oSerParType.MoveFromRangeStart:c_oSerParType.MoveFromRangeEnd}else{moveRangeNameToId=saveParams.moveRangeToNameToId;recordType=elem.IsStart()?c_oSerParType.MoveToRangeStart:c_oSerParType.MoveToRangeEnd}var revisionId=moveRangeNameToId[elem.GetMarkId()]; if(undefined===revisionId){revisionId=saveParams.trackRevisionId++;moveRangeNameToId[elem.GetMarkId()]=revisionId}bs.WriteItem(recordType,function(){if(elem.IsStart())WiteMoveRangeStartElem(bs,revisionId,elem);else WiteMoveRangeEndElem(bs,revisionId)})}function ReadMoveRangeStartElem(type,length,stream,reviewInfo,options){var res=c_oSerConstants.ReadOk;if(c_oSerMoveRange.Author==type)reviewInfo.UserName=stream.GetString2LE(length);else if(c_oSerMoveRange.Date==type){var dateStr=stream.GetString2LE(length); var dateMs=AscCommon.getTimeISO8601(dateStr);if(isNaN(dateMs))dateMs=(new Date).getTime();reviewInfo.DateTime=dateMs}else if(c_oSerMoveRange.Id==type)options.id=stream.GetULongLE();else if(c_oSerMoveRange.Name==type)options.name=stream.GetString2LE(length);else if(c_oSerMoveRange.UserId==type)reviewInfo.UserId=stream.GetString2LE(length);else res=c_oSerConstants.ReadUnknown;return res}function ReadMoveRangeEndElem(type,length,stream,options){var res=c_oSerConstants.ReadOk;if(c_oSerMoveRange.Id==type)options.id= stream.GetULongLE();else res=c_oSerConstants.ReadUnknown;return res}function readMoveRangeStart(length,bcr,stream,oReadResult,oParStruct,isFrom){var reviewInfo=new CReviewInfo;var options={name:null,id:null};var res=bcr.Read1(length,function(t,l){return ReadMoveRangeStartElem(t,l,stream,reviewInfo,options)});if(null!==options.name&&null!==options.id){var move=new CParaRevisionMove(true,isFrom,options.name,reviewInfo);oReadResult.moveRanges[options.id]=move;oParStruct.addToContent(move)}return res} function readMoveRangeEnd(length,bcr,stream,oReadResult,oParStruct,isFrom,isRun){if(!oParStruct)return false;var options={id:null};bcr.Read1(length,function(t,l){return ReadMoveRangeEndElem(t,l,stream,options)});var moveStart=oReadResult.moveRanges[options.id];if(moveStart)if(isRun){if(oParStruct.GetContentLength()>0){var run=oParStruct.GetFromContent(oParStruct.GetContentLength()-1);run.Add_ToContent(run.GetElementsCount(),new CRunRevisionMove(false,isFrom,moveStart.GetMarkId()),false)}}else oParStruct.addToContent(new CParaRevisionMove(false, isFrom,moveStart.GetMarkId()));return true}function readBookmarkStart(length,bcr,oReadResult,oParStruct,openParams){var bookmark=oReadResult.bookmarkForRead;bookmark.BookmarkId=undefined;bookmark.BookmarkName=undefined;bcr.Read1(length,function(t,l){return bcr.ReadBookmark(t,l,bookmark)});if(undefined!==bookmark.BookmarkId&&undefined!==bookmark.BookmarkName){var isCopyPaste=oReadResult.bCopyPaste;var bookmarksManager=oReadResult.logicDocument.BookmarksManager;if(!isCopyPaste||isCopyPaste&&bookmarksManager&& null===bookmarksManager.GetBookmarkByName(bookmark.BookmarkName)){var newBookmark=new CParagraphBookmark(true,bookmark.BookmarkId,bookmark.BookmarkName);oReadResult.bookmarksStarted[bookmark.BookmarkId]={parent:oParStruct.getElem(),bookmark:newBookmark};oParStruct.addToContent(newBookmark)}}}function readBookmarkEnd(length,bcr,stream,oReadResult,oParStruct){if(!oParStruct)return false;var bookmark=oReadResult.bookmarkForRead;bookmark.BookmarkId=undefined;bcr.Read1(length,function(t,l){return bcr.ReadBookmark(t, l,bookmark)});if(oReadResult.bookmarksStarted[bookmark.BookmarkId]){delete oReadResult.bookmarksStarted[bookmark.BookmarkId];oParStruct.addToContent(new CParagraphBookmark(false,bookmark.BookmarkId))}return true}function addToNextPar(toNextParStruct,bcr,stream,oReadResult,oParStruct,openParams){if(toNextParStruct.length>0){var oldPos=stream.GetCurPos();for(var i=0;i0)this.WriteTable(c_oSerTableTypes.Customs,new BinaryCustomsTableWriter(this.memory,this.Document,this.Document.CustomXmls));this.WriteTable(c_oSerTableTypes.Settings,new BinarySettingsTableWriter(this.memory,this.Document,this.saveParams));var oMapCommentId={};var commentUniqueGuids={};this.WriteTable(c_oSerTableTypes.Comments,new BinaryCommentsTableWriter(this.memory,this.Document,oMapCommentId,commentUniqueGuids, false));this.WriteTable(c_oSerTableTypes.DocumentComments,new BinaryCommentsTableWriter(this.memory,this.Document,oMapCommentId,commentUniqueGuids,true));var oNumIdMap={};this.WriteTable(c_oSerTableTypes.Numbering,new BinaryNumberingTableWriter(this.memory,this.Document,oNumIdMap,null,this.saveParams));this.WriteTable(c_oSerTableTypes.Style,new BinaryStyleTableWriter(this.memory,this.Document,oNumIdMap,null,this.saveParams));var oBinaryHeaderFooterTableWriter=new BinaryHeaderFooterTableWriter(this.memory, this.Document,oNumIdMap,oMapCommentId,this.saveParams);this.WriteTable(c_oSerTableTypes.Document,new BinaryDocumentTableWriter(this.memory,this.Document,oMapCommentId,oNumIdMap,null,this.saveParams,oBinaryHeaderFooterTableWriter));this.WriteTable(c_oSerTableTypes.HdrFtr,oBinaryHeaderFooterTableWriter);if(this.saveParams.footnotesIndex>0)this.WriteTable(c_oSerTableTypes.Footnotes,new BinaryNotesTableWriter(this.memory,this.Document,oNumIdMap,oMapCommentId,null,this.saveParams,this.saveParams.footnotes)); if(this.saveParams.endnotesIndex>0)this.WriteTable(c_oSerTableTypes.Endnotes,new BinaryNotesTableWriter(this.memory,this.Document,oNumIdMap,oMapCommentId,null,this.saveParams,this.saveParams.endnotes));var oBinaryOtherTableWriter=new BinaryOtherTableWriter(this.memory,this.Document);this.WriteTable(c_oSerTableTypes.Other,oBinaryOtherTableWriter);this.WriteGlossary(docParts)};this.WriteMainTableEnd=function(){this.memory.Seek(this.nStart);this.memory.WriteByte(this.nRealTableCount);this.memory.Seek(this.nLastFilePos)}; this.WriteGlossary=function(){var t=this;var docParts=[];var glossaryDocument=this.Document.GetGlossaryDocument();if(glossaryDocument)for(var placeholderId in this.saveParams.placeholders)if(this.saveParams.placeholders.hasOwnProperty(placeholderId)){var docPart=glossaryDocument.GetDocPartByName(placeholderId);if(docPart)docParts.push(docPart)}if(docParts.length>0)AscFormat.ExecuteNoHistory(function(){this.WriteTable(c_oSerTableTypes.Glossary,{Write:function(){var doc=new AscCommonWord.CDocument(editor.WordControl.m_oDrawingDocument, false);doc.GlossaryDocument=null;doc.Numbering=glossaryDocument.GetNumbering();doc.Styles=glossaryDocument.GetStyles();doc.Footnotes=glossaryDocument.GetFootnotes();doc.Endnotes=glossaryDocument.GetEndnotes();var oBinaryFileWriter=new AscCommonWord.BinaryFileWriter(doc,undefined,undefined,t.saveParams.isCompatible,t.memory,docParts);oBinaryFileWriter.WriteToMemory(false)}})},this,[])};this.CopyStart=function(){var api=this.Document.DrawingDocument.m_oWordControl.m_oApi;pptx_content_writer.Start_UseFullUrl(); if(api.ThemeLoader)pptx_content_writer.Start_UseDocumentOrigin(api.ThemeLoader.ThemesUrlAbs);pptx_content_writer._Start();this.copyParams.bLockCopyElems=0;this.copyParams.itemCount=0;this.copyParams.oUsedNumIdMap={};this.copyParams.nNumIdIndex=1;this.copyParams.oUsedStyleMap={};this.copyParams.bdtw=new BinaryDocumentTableWriter(this.memory,this.Document,null,this.copyParams.oUsedNumIdMap,this.copyParams,this.saveParams,null);this.copyParams.nDocumentWriterTablePos=0;this.copyParams.nDocumentWriterPos= 0;this.WriteMainTableStart();var oMapCommentId={};var commentUniqueGuids={};this.WriteTable(c_oSerTableTypes.Comments,new BinaryCommentsTableWriter(this.memory,this.Document,oMapCommentId,commentUniqueGuids,false));this.WriteTable(c_oSerTableTypes.DocumentComments,new BinaryCommentsTableWriter(this.memory,this.Document,oMapCommentId,commentUniqueGuids,true));this.copyParams.bdtw.oMapCommentId=oMapCommentId;this.copyParams.nDocumentWriterTablePos=this.WriteTableStart(c_oSerTableTypes.Document);this.copyParams.nDocumentWriterPos= this.bs.WriteItemWithLengthStart()};this.CopyParagraph=function(Item,selectedAll){if(this.copyParams.bLockCopyElems>0)return;var oThis=this;this.bs.WriteItem(c_oSerParType.Par,function(){oThis.copyParams.bdtw.WriteParapraph(Item,false,selectedAll)});this.copyParams.itemCount++};this.CopyTable=function(Item,aRowElems,nMinGrid,nMaxGrid){if(this.copyParams.bLockCopyElems>0)return;var oThis=this;this.bs.WriteItem(c_oSerParType.Table,function(){oThis.copyParams.bdtw.WriteDocTable(Item,aRowElems,nMinGrid, nMaxGrid)});this.copyParams.itemCount++};this.CopySdt=function(Item){if(this.copyParams.bLockCopyElems>0)return;var oThis=this;this.bs.WriteItem(c_oSerParType.Sdt,function(){oThis.copyParams.bdtw.WriteSdt(Item,0)});this.copyParams.itemCount++};this.CopyEnd=function(){this.bs.WriteItemWithLengthEnd(this.copyParams.nDocumentWriterPos);this.WriteTableEnd(this.copyParams.nDocumentWriterTablePos);if(this.saveParams.footnotesIndex>0)this.WriteTable(c_oSerTableTypes.Footnotes,new BinaryNotesTableWriter(this.memory, this.Document,this.copyParams.oUsedNumIdMap,null,this.copyParams,this.saveParams,this.saveParams.footnotes));if(this.saveParams.endnotesIndex>0)this.WriteTable(c_oSerTableTypes.Endnotes,new BinaryNotesTableWriter(this.memory,this.Document,this.copyParams.oUsedNumIdMap,null,this.copyParams,this.saveParams,this.saveParams.endnotes));this.WriteTable(c_oSerTableTypes.Numbering,new BinaryNumberingTableWriter(this.memory,this.Document,{},this.copyParams.oUsedNumIdMap,this.saveParams));this.WriteTable(c_oSerTableTypes.Style, new BinaryStyleTableWriter(this.memory,this.Document,this.copyParams.oUsedNumIdMap,this.copyParams,this.saveParams));this.WriteGlossary(docParts);this.WriteMainTableEnd();pptx_content_writer._End();pptx_content_writer.End_UseFullUrl()};this.WriteTable=function(type,oTableSer){var nCurPos=this.WriteTableStart(type);oTableSer.Write();this.WriteTableEnd(nCurPos)};this.WriteTableStart=function(type){this.memory.WriteByte(type);this.memory.WriteLong(this.nLastFilePos);var nCurPos=this.memory.GetCurPosition(); this.memory.Seek(this.nLastFilePos);return nCurPos};this.WriteTableEnd=function(nCurPos){this.nLastFilePos=this.memory.GetCurPosition();this.memory.Seek(nCurPos);this.nRealTableCount++}}function BinarySigTableWriter(memory){this.memory=memory;this.Write=function(){this.memory.WriteByte(c_oSerSigTypes.Version);this.memory.WriteByte(c_oSerPropLenType.Long);this.memory.WriteLong(AscCommon.c_oSerFormat.Version)}}function BinaryStyleTableWriter(memory,doc,oNumIdMap,copyParams,saveParams){this.memory=memory; this.Document=doc;this.copyParams=copyParams;this.bs=new BinaryCommonWriter(this.memory);this.btblPrs=new Binary_tblPrWriter(this.memory,oNumIdMap,saveParams);this.bpPrs=new Binary_pPrWriter(this.memory,oNumIdMap,null,saveParams);this.brPrs=new Binary_rPrWriter(this.memory,saveParams);this.Write=function(){var oThis=this;this.bs.WriteItemWithLength(function(){oThis.WriteStylesContent()})};this.WriteStylesContent=function(){var oThis=this;var oStyles=this.Document.Styles;var oDef_pPr=oStyles.GetDefaultParaPrForWrite(); var oDef_rPr=oStyles.GetDefaultTextPrForWrite();this.bs.WriteItem(c_oSer_st.DefpPr,function(){oThis.bpPrs.Write_pPr(oDef_pPr)});this.bs.WriteItem(c_oSer_st.DefrPr,function(){oThis.brPrs.Write_rPr(oDef_rPr,null,null)});this.bs.WriteItem(c_oSer_st.Styles,function(){oThis.WriteStyles(oStyles.Style,oStyles.Default)})};this.WriteStyles=function(styles,oDefault){var oThis=this;var oStyleToWrite=styles;if(this.copyParams&&this.copyParams.oUsedStyleMap)oStyleToWrite=this.copyParams.oUsedStyleMap;for(var styleId in oStyleToWrite){var style= styles[styleId];var bDefault=false;if(styleId==oDefault.Character)bDefault=true;else if(styleId==oDefault.Paragraph)bDefault=true;else if(styleId==oDefault.Numbering)bDefault=true;else if(styleId==oDefault.Table)bDefault=true;this.bs.WriteItem(c_oSer_sts.Style,function(){oThis.WriteStyle(styleId,style,bDefault)})}};this.WriteStyle=function(id,style,bDefault){var oThis=this;var compilePr=this.copyParams?this.Document.Styles.Get_Pr(id,style.Get_Type()):style;if(null!=id){this.memory.WriteByte(c_oSer_sts.Style_Id); this.memory.WriteString2(id.toString())}if(null!=style.Name){this.memory.WriteByte(c_oSer_sts.Style_Name);this.memory.WriteString2(style.Name.toString())}if(null!=style.Type){var nSerStyleType=c_oSer_StyleType.Paragraph;switch(style.Type){case styletype_Character:nSerStyleType=c_oSer_StyleType.Character;break;case styletype_Numbering:nSerStyleType=c_oSer_StyleType.Numbering;break;case styletype_Paragraph:nSerStyleType=c_oSer_StyleType.Paragraph;break;case styletype_Table:nSerStyleType=c_oSer_StyleType.Table; break}this.bs.WriteItem(c_oSer_sts.Style_Type,function(){oThis.memory.WriteByte(nSerStyleType)})}if(true==bDefault)this.bs.WriteItem(c_oSer_sts.Style_Default,function(){oThis.memory.WriteBool(bDefault)});if(null!=style.BasedOn){this.memory.WriteByte(c_oSer_sts.Style_BasedOn);this.memory.WriteString2(style.BasedOn.toString())}if(null!=style.Next){this.memory.WriteByte(c_oSer_sts.Style_Next);this.memory.WriteString2(style.Next.toString())}if(null!=style.Link){this.memory.WriteByte(c_oSer_sts.Style_Link); this.memory.WriteString2(style.Link)}if(null!=style.qFormat)this.bs.WriteItem(c_oSer_sts.Style_qFormat,function(){oThis.memory.WriteBool(style.qFormat)});if(null!=style.uiPriority)this.bs.WriteItem(c_oSer_sts.Style_uiPriority,function(){oThis.memory.WriteLong(style.uiPriority)});if(null!=style.hidden)this.bs.WriteItem(c_oSer_sts.Style_hidden,function(){oThis.memory.WriteBool(style.hidden)});if(null!=style.semiHidden)this.bs.WriteItem(c_oSer_sts.Style_semiHidden,function(){oThis.memory.WriteBool(style.semiHidden)}); if(null!=style.unhideWhenUsed)this.bs.WriteItem(c_oSer_sts.Style_unhideWhenUsed,function(){oThis.memory.WriteBool(style.unhideWhenUsed)});if(null!=compilePr.TextPr)this.bs.WriteItem(c_oSer_sts.Style_TextPr,function(){oThis.brPrs.Write_rPr(compilePr.TextPr,null,null)});if(null!=compilePr.ParaPr)this.bs.WriteItem(c_oSer_sts.Style_ParaPr,function(){oThis.bpPrs.Write_pPr(compilePr.ParaPr)});if(styletype_Table==style.Type){if(null!=compilePr.TablePr)this.bs.WriteItem(c_oSer_sts.Style_TablePr,function(){oThis.btblPrs.WriteTblPr(compilePr.TablePr, null)});if(null!=compilePr.TableRowPr)this.bs.WriteItem(c_oSer_sts.Style_RowPr,function(){oThis.btblPrs.WriteRowPr(compilePr.TableRowPr)});if(null!=compilePr.TableCellPr)this.bs.WriteItem(c_oSer_sts.Style_CellPr,function(){oThis.btblPrs.WriteCellPr(compilePr.TableCellPr)});var aTblStylePr=[];if(null!=compilePr.TableBand1Horz)aTblStylePr.push({type:ETblStyleOverrideType.tblstyleoverridetypeBand1Horz,val:compilePr.TableBand1Horz});if(null!=compilePr.TableBand1Vert)aTblStylePr.push({type:ETblStyleOverrideType.tblstyleoverridetypeBand1Vert, val:compilePr.TableBand1Vert});if(null!=compilePr.TableBand2Horz)aTblStylePr.push({type:ETblStyleOverrideType.tblstyleoverridetypeBand2Horz,val:compilePr.TableBand2Horz});if(null!=compilePr.TableBand2Vert)aTblStylePr.push({type:ETblStyleOverrideType.tblstyleoverridetypeBand2Vert,val:compilePr.TableBand2Vert});if(null!=compilePr.TableFirstCol)aTblStylePr.push({type:ETblStyleOverrideType.tblstyleoverridetypeFirstCol,val:compilePr.TableFirstCol});if(null!=compilePr.TableFirstRow)aTblStylePr.push({type:ETblStyleOverrideType.tblstyleoverridetypeFirstRow, val:compilePr.TableFirstRow});if(null!=compilePr.TableLastCol)aTblStylePr.push({type:ETblStyleOverrideType.tblstyleoverridetypeLastCol,val:compilePr.TableLastCol});if(null!=compilePr.TableLastRow)aTblStylePr.push({type:ETblStyleOverrideType.tblstyleoverridetypeLastRow,val:compilePr.TableLastRow});if(null!=compilePr.TableTLCell)aTblStylePr.push({type:ETblStyleOverrideType.tblstyleoverridetypeNwCell,val:compilePr.TableTLCell});if(null!=compilePr.TableTRCell)aTblStylePr.push({type:ETblStyleOverrideType.tblstyleoverridetypeNeCell, val:compilePr.TableTRCell});if(null!=compilePr.TableBLCell)aTblStylePr.push({type:ETblStyleOverrideType.tblstyleoverridetypeSwCell,val:compilePr.TableBLCell});if(null!=compilePr.TableBRCell)aTblStylePr.push({type:ETblStyleOverrideType.tblstyleoverridetypeSeCell,val:compilePr.TableBRCell});if(null!=compilePr.TableWholeTable)aTblStylePr.push({type:ETblStyleOverrideType.tblstyleoverridetypeWholeTable,val:compilePr.TableWholeTable});if(aTblStylePr.length>0)this.bs.WriteItem(c_oSer_sts.Style_TblStylePr, function(){oThis.WriteTblStylePr(aTblStylePr)})}if(style.IsCustom())this.bs.WriteItem(c_oSer_sts.Style_CustomStyle,function(){oThis.memory.WriteBool(true)})};this.WriteTblStylePr=function(aTblStylePr){var oThis=this;for(var i=0,length=aTblStylePr.length;i 0){this.memory.WriteByte(c_oSerProp_pPrType.Tab);this.memory.WriteByte(c_oSerPropLenType.Variable);this.bs.WriteItemWithLength(function(){oThis.WriteTabs(pPr.Tabs.Tabs)})}if(null!=pPr_rPr&&null!=EndRun){this.memory.WriteByte(c_oSerProp_pPrType.pPr_rPr);this.memory.WriteByte(c_oSerPropLenType.Variable);this.bs.WriteItemWithLength(function(){oThis.brPrs.Write_rPr(pPr_rPr,EndRun.Pr,EndRun)})}if(null!=pPr.Brd){this.memory.WriteByte(c_oSerProp_pPrType.pBdr);this.memory.WriteByte(c_oSerPropLenType.Variable); this.bs.WriteItemWithLength(function(){oThis.bs.WriteBorders(pPr.Brd)})}if(null!=pPr.FramePr){this.memory.WriteByte(c_oSerProp_pPrType.FramePr);this.memory.WriteByte(c_oSerPropLenType.Variable);this.bs.WriteItemWithLength(function(){oThis.WriteFramePr(pPr.FramePr)})}if(null!=SectPr&&null!=oDocument){this.memory.WriteByte(c_oSerProp_pPrType.SectPr);this.memory.WriteByte(c_oSerPropLenType.Variable);this.bs.WriteItemWithLength(function(){oThis.WriteSectPr(SectPr,oDocument)})}if(null!=pPr.PrChange&&pPr.ReviewInfo){var bpPrs= new Binary_pPrWriter(this.memory,this.oNumIdMap,this.oBinaryHeaderFooterTableWriter,this.saveParams);this.memory.WriteByte(c_oSerProp_pPrType.pPrChange);this.memory.WriteByte(c_oSerPropLenType.Variable);this.bs.WriteItemWithLength(function(){WriteTrackRevision(oThis.bs,oThis.saveParams.trackRevisionId++,pPr.ReviewInfo,{bpPrs:bpPrs,pPr:pPr.PrChange})})}if(null!=pPr.OutlineLvl){this.memory.WriteByte(c_oSerProp_pPrType.outlineLvl);this.memory.WriteByte(c_oSerPropLenType.Long);this.memory.WriteLong(pPr.OutlineLvl)}if(null!= pPr.SuppressLineNumbers){this.memory.WriteByte(c_oSerProp_pPrType.SuppressLineNumbers);this.memory.WriteByte(c_oSerPropLenType.Byte);this.memory.WriteBool(pPr.SuppressLineNumbers)}};this.WriteInd=function(Ind){if(null!=Ind.Left){this.memory.WriteByte(c_oSerProp_pPrType.Ind_LeftTwips);this.memory.WriteByte(c_oSerPropLenType.Long);this.bs.writeMmToTwips(Ind.Left)}if(null!=Ind.Right){this.memory.WriteByte(c_oSerProp_pPrType.Ind_RightTwips);this.memory.WriteByte(c_oSerPropLenType.Long);this.bs.writeMmToTwips(Ind.Right)}if(null!= Ind.FirstLine){this.memory.WriteByte(c_oSerProp_pPrType.Ind_FirstLineTwips);this.memory.WriteByte(c_oSerPropLenType.Long);this.bs.writeMmToTwips(Ind.FirstLine)}};this.WriteSpacing=function(Spacing){if(null!=Spacing.Line){var line=Asc.linerule_Auto===Spacing.LineRule?Math.round(Spacing.Line*240):this.bs.mmToTwips(Spacing.Line);this.memory.WriteByte(c_oSerProp_pPrType.Spacing_LineTwips);this.memory.WriteByte(c_oSerPropLenType.Long);this.memory.WriteLong(line)}if(null!=Spacing.LineRule){this.memory.WriteByte(c_oSerProp_pPrType.Spacing_LineRule); this.memory.WriteByte(c_oSerPropLenType.Byte);this.memory.WriteByte(Spacing.LineRule)}if(null!=Spacing.BeforeAutoSpacing){this.memory.WriteByte(c_oSerProp_pPrType.Spacing_BeforeAuto);this.memory.WriteByte(c_oSerPropLenType.Byte);this.memory.WriteBool(Spacing.BeforeAutoSpacing)}if(null!=Spacing.Before){this.memory.WriteByte(c_oSerProp_pPrType.Spacing_BeforeTwips);this.memory.WriteByte(c_oSerPropLenType.Long);this.bs.writeMmToTwips(Spacing.Before)}if(null!=Spacing.AfterAutoSpacing){this.memory.WriteByte(c_oSerProp_pPrType.Spacing_AfterAuto); this.memory.WriteByte(c_oSerPropLenType.Byte);this.memory.WriteBool(Spacing.AfterAutoSpacing)}if(null!=Spacing.After){this.memory.WriteByte(c_oSerProp_pPrType.Spacing_AfterTwips);this.memory.WriteByte(c_oSerPropLenType.Long);this.bs.writeMmToTwips(Spacing.After)}};this.WriteTabs=function(Tab){var oThis=this;var nLen=Tab.length;for(var i=0;i0)this.bs.WriteItem(c_oSerHdrFtrTypes.Header,function(){oThis.WriteHdrFtrContent(oThis.aHeaders)});if(this.aFooters.length>0)this.bs.WriteItem(c_oSerHdrFtrTypes.Footer,function(){oThis.WriteHdrFtrContent(oThis.aFooters)})};this.WriteHdrFtrContent=function(aHdrFtr){var oThis=this;for(var i=0,length=aHdrFtr.length;i=0)this.bs.WriteItem(c_oSerNumTypes.ILvl,function(){oThis.memory.WriteLong(lvlOverride.Lvl)});if(lvlOverride.StartOverride>=0)this.bs.WriteItem(c_oSerNumTypes.StartOverride,function(){oThis.memory.WriteLong(lvlOverride.StartOverride)});if(lvlOverride.NumberingLvl&&lvlOverride.Lvl>=0)this.bs.WriteItem(c_oSerNumTypes.Lvl,function(){oThis.WriteLevel(lvlOverride.NumberingLvl,lvlOverride.Lvl)})};this.WriteAbstractNums=function(ANum){var oThis= this;var i;var index=0;var ANums=this.Document.Numbering.AbstractNum;var nums=this.Document.Numbering.Num;if(null!=this.oUsedNumIdMap)for(i in this.oUsedNumIdMap){if(this.oUsedNumIdMap.hasOwnProperty(i)&&nums[i]){var ANum=ANums[nums[i].AbstractNumId];if(null!=ANum){this.bs.WriteItem(c_oSerNumTypes.AbstractNum,function(){oThis.WriteAbstractNum(ANum,index)});index++}}}else for(i in ANums)if(ANums.hasOwnProperty(i)){this.bs.WriteItem(c_oSerNumTypes.AbstractNum,function(){oThis.WriteAbstractNum(ANums[i], index)});index++}};this.WriteAbstractNum=function(num,index){var oThis=this;this.bs.WriteItem(c_oSerNumTypes.AbstractNum_Id,function(){oThis.memory.WriteLong(index)});this.oANumIdToBin[num.GetId()]=index;if(null!=num.NumStyleLink){this.memory.WriteByte(c_oSerNumTypes.NumStyleLink);this.memory.WriteString2(num.NumStyleLink)}if(null!=num.StyleLink){this.memory.WriteByte(c_oSerNumTypes.StyleLink);this.memory.WriteString2(num.StyleLink)}if(null!=num.Lvl)this.bs.WriteItem(c_oSerNumTypes.AbstractNum_Lvls, function(){oThis.WriteLevels(num.Lvl)})};this.WriteLevels=function(lvls){var oThis=this;for(var i=0,length=lvls.length;i=0){this.memory.WriteByte(c_oSerNumTypes.lvl_Restart); this.memory.WriteByte(c_oSerPropLenType.Long);this.memory.WriteLong(lvl.Restart)}if(null!=lvl.Start){this.memory.WriteByte(c_oSerNumTypes.lvl_Start);this.memory.WriteByte(c_oSerPropLenType.Long);this.memory.WriteLong(lvl.Start)}if(null!=lvl.Suff){this.memory.WriteByte(c_oSerNumTypes.lvl_Suff);this.memory.WriteByte(c_oSerPropLenType.Byte);this.memory.WriteByte(lvl.Suff)}if(null!=lvl.PStyle){this.memory.WriteByte(c_oSerNumTypes.lvl_PStyle);this.memory.WriteByte(c_oSerPropLenType.Variable);this.memory.WriteString2(lvl.PStyle)}if(null!= lvl.ParaPr){this.memory.WriteByte(c_oSerNumTypes.lvl_ParaPr);this.memory.WriteByte(c_oSerPropLenType.Variable);this.bs.WriteItemWithLength(function(){oThis.bpPrs.Write_pPr(lvl.ParaPr)})}if(null!=lvl.TextPr){this.memory.WriteByte(c_oSerNumTypes.lvl_TextPr);this.memory.WriteByte(c_oSerPropLenType.Variable);this.bs.WriteItemWithLength(function(){oThis.brPrs.Write_rPr(lvl.TextPr,null,null)})}if(null!=ILvl){this.memory.WriteByte(c_oSerNumTypes.ILvl);this.memory.WriteByte(c_oSerPropLenType.Long);this.memory.WriteLong(ILvl)}if(null!= lvl.IsLgl){this.memory.WriteByte(c_oSerNumTypes.IsLgl);this.memory.WriteByte(c_oSerPropLenType.Byte);this.memory.WriteBool(lvl.IsLgl)}if(null!=lvl.Legacy){this.memory.WriteByte(c_oSerNumTypes.LvlLegacy);this.memory.WriteByte(c_oSerPropLenType.Variable);this.bs.WriteItemWithLength(function(){oThis.WriteLvlLegacy(lvl.Legacy)})}};this.WriteLvlLegacy=function(lvlLegacy){var oThis=this;if(null!=lvlLegacy.Legacy)this.bs.WriteItem(c_oSerNumTypes.Legacy,function(){oThis.memory.WriteBool(lvlLegacy.Legacy)}); if(null!=lvlLegacy.Indent)this.bs.WriteItem(c_oSerNumTypes.LegacyIndent,function(){oThis.memory.WriteLong(lvlLegacy.Indent)});if(null!=lvlLegacy.Space)this.bs.WriteItem(c_oSerNumTypes.LegacySpace,function(){oThis.memory.WriteLong(AscFonts.FT_Common.UintToInt(lvlLegacy.Space))})};this.WriteLevelText=function(aText){var oThis=this;for(var i=0,length=aText.length;i0){var lastRun=par.Content[par.Content.length-1];if(para_Run===lastRun.Type)for(var i= 1;iParaEnd){var Temp2=ParaEnd;ParaEnd=ParaStart;ParaStart=Temp2}}if(ParaEnd<0)ParaEnd=0;if(ParaStart<0)ParaStart=0;var Content=par.Content;var oThis=this;for(var i=ParaStart;i<=ParaEnd&&i0&&sSrc.h_mm>0){var doc=this.Document;var drawing=new ParaDrawing(sSrc.w_mm,sSrc.h_mm,null,this.Document.DrawingDocument,this.Document,par);var Image=editor.WordControl.m_oLogicDocument.DrawingObjects.createImage(sSrc.ImageUrl, 0,0,sSrc.w_mm,sSrc.h_mm);Image.cachedImage=sSrc.ImageUrl;drawing.Set_GraphicObject(Image);Image.setParent(drawing);this.WriteRun2(function(){oThis.bs.WriteItem(c_oSerRunType.pptxDrawing,function(){oThis.WriteImage(drawing)})})}}else if(type_Paragraph===par.GetType()&&true===par.CheckMathPara(i))this.bs.WriteItem(c_oSerParType.OMathPara,function(){oThis.boMaths.WriteOMathPara(item)});else this.bs.WriteItem(c_oSerParType.OMath,function(){oThis.boMaths.WriteArgNodes(item.Root)})}break;case para_InlineLevelSdt:this.bs.WriteItem(c_oSerParType.Sdt, function(){oThis.WriteSdt(item,1)});break;case para_Bookmark:var typeBookmark=item.IsStart()?c_oSerParType.BookmarkStart:c_oSerParType.BookmarkEnd;this.bs.WriteItem(typeBookmark,function(){oThis.bs.WriteBookmark(item)});break;case para_RevisionMove:WiteMoveRange(this.bs,this.saveParams,item);break}}if(bLastRun&&bUseSelection&&!par.Selection_CheckParaEnd()||selectedAll!=undefined&&selectedAll===false)this.WriteRun2(function(){oThis.memory.WriteByte(c_oSerRunType._LastRun);oThis.memory.WriteLong(c_oSerPropLenType.Null)})}; this.WriteDocParts=function(docParts){var oThis=this;for(var i=0;iParaEnd){var Temp2=ParaEnd;ParaEnd=ParaStart;ParaStart=Temp2}}var nPrevIndex= ParaStart;var aRunRanges=[];for(var i=ParaStart;i>0)}};this.WriteSimplePos=function(oSimplePos){if(null!=oSimplePos.X){this.memory.WriteByte(c_oSerSimplePos.XEmu);this.memory.WriteByte(c_oSerPropLenType.Long);this.bs.writeMmToEmu(oSimplePos.X)}if(null!=oSimplePos.Y){this.memory.WriteByte(c_oSerSimplePos.YEmu);this.memory.WriteByte(c_oSerPropLenType.Long);this.bs.writeMmToEmu(oSimplePos.Y)}}; this.WriteWrapThroughTight=function(wrappingPolygon,Contour){var oThis=this;this.memory.WriteByte(c_oSerWrapThroughTight.WrapPolygon);this.memory.WriteByte(c_oSerPropLenType.Variable);this.bs.WriteItemWithLength(function(){oThis.WriteWrapPolygon(wrappingPolygon,Contour)})};this.WriteWrapPolygon=function(wrappingPolygon,Contour){var oThis=this;this.memory.WriteByte(c_oSerWrapPolygon.Edited);this.memory.WriteByte(c_oSerPropLenType.Byte);this.memory.WriteBool(true);if(Contour.length>0){this.memory.WriteByte(c_oSerWrapPolygon.Start); this.memory.WriteByte(c_oSerPropLenType.Variable);this.bs.WriteItemWithLength(function(){oThis.WritePolygonPoint(Contour[0])});if(Contour.length>1){this.memory.WriteByte(c_oSerWrapPolygon.ALineTo);this.memory.WriteByte(c_oSerPropLenType.Variable);this.bs.WriteItemWithLength(function(){oThis.WriteLineTo(Contour)})}}};this.WriteLineTo=function(Contour){var oThis=this;for(var i=1,length=Contour.length;i 0)this.bs.WriteItem(c_oSerDocTableType.Content,function(){oThis.WriteTableContent(table.Content,aRowElems)})};this.WriteTblGrid=function(grid,tableGridChange){var oThis=this;for(var i=0,length=grid.length;i0){nStart=aRowElems[0].row;nEnd=aRowElems[aRowElems.length-1].row}for(var i=nStart;i<=nEnd&&i1)vMerge=vmerge_Restart}this.bs.WriteItem(c_oSerDocTableType.Cell_Pr,function(){oThis.btblPrs.WriteCellPr(cell.Pr,vMerge,cell)})}if(null!= cell.Content){var oInnerDocument=new BinaryDocumentTableWriter(this.memory,this.Document,this.oMapCommentId,this.oNumIdMap,this.copyParams,this.saveParams,this.oBinaryHeaderFooterTableWriter);this.bs.WriteItem(c_oSerDocTableType.Cell_Content,function(){oInnerDocument.WriteDocumentContent(cell.Content)})}};this.WriteObject=function(obj){var oThis=this;oThis.bs.WriteItem(c_oSerParType.OMath,function(){oThis.boMaths.WriteArgNodes(obj.ParaMath.Root)});oThis.bs.WriteItem(c_oSerRunType.pptxDrawing,function(){oThis.WriteImage(obj)})}; this.WriteSdt=function(oSdt,type){var oThis=this;if(oSdt.Pr)oThis.bs.WriteItem(c_oSerSdt.Pr,function(){oThis.WriteSdtPr(oSdt.Pr,oSdt)});if(0===type){var oInnerDocument=new BinaryDocumentTableWriter(this.memory,this.Document,this.oMapCommentId,this.oNumIdMap,this.copyParams,this.saveParams,this.oBinaryHeaderFooterTableWriter);this.bs.WriteItem(c_oSerSdt.Content,function(){oInnerDocument.WriteDocumentContent(oSdt.Content)})}else if(1===type)this.bs.WriteItem(c_oSerSdt.Content,function(){oThis.WriteParagraphContent(oSdt, false,false)})};this.WriteSdtPr=function(val,oSdt){var oThis=this;var type;if(null!=val.Alias){this.memory.WriteByte(c_oSerSdt.Alias);this.memory.WriteString2(val.Alias)}if(null!=val.Appearance)oThis.bs.WriteItem(c_oSerSdt.Appearance,function(){oThis.memory.WriteByte(val.Appearance)});if(null!=val.Color){var rPr=new CTextPr;rPr.Color=val.Color;oThis.bs.WriteItem(c_oSerSdt.Color,function(){oThis.brPrs.Write_rPr(rPr,null,null)})}if(null!=val.Id)oThis.bs.WriteItem(c_oSerSdt.Id,function(){oThis.memory.WriteLong(val.Id)}); if(null!=val.Label)oThis.bs.WriteItem(c_oSerSdt.Label,function(){oThis.memory.WriteLong(val.Label)});if(null!=val.Lock)oThis.bs.WriteItem(c_oSerSdt.Lock,function(){oThis.memory.WriteByte(val.Lock)});var placeholder=oSdt.GetPlaceholder();if(null!=placeholder){this.saveParams.placeholders[placeholder]=1;this.memory.WriteByte(c_oSerSdt.PlaceHolder);this.memory.WriteString2(placeholder)}var rPr=oSdt.GetDefaultTextPr();if(rPr)this.bs.WriteItem(c_oSerSdt.RPr,function(){oThis.brPrs.Write_rPr(rPr,null,null)}); if(oSdt.IsShowingPlcHdr())oThis.bs.WriteItem(c_oSerSdt.ShowingPlcHdr,function(){oThis.memory.WriteBool(true)});if(null!=val.Tag){this.memory.WriteByte(c_oSerSdt.Tag);this.memory.WriteString2(val.Tag)}if(oSdt.IsContentControlTemporary())oThis.bs.WriteItem(c_oSerSdt.Temporary,function(){oThis.memory.WriteBool(true)});if(oSdt.IsComboBox()){type=ESdtType.sdttypeComboBox;oThis.bs.WriteItem(c_oSerSdt.ComboBox,function(){oThis.WriteSdtComboBox(oSdt.GetComboBoxPr())})}else if(oSdt.IsPicture()){type=ESdtType.sdttypePicture; var pictureFormPr=oSdt.GetPictureFormPr&&oSdt.GetPictureFormPr();if(pictureFormPr)oThis.bs.WriteItem(c_oSerSdt.PictureFormPr,function(){oThis.WriteSdtPictureFormPr(pictureFormPr)})}else if(oSdt.IsContentControlText())type=ESdtType.sdttypeText;else if(oSdt.IsContentControlEquation())type=ESdtType.sdttypeEquation;else if(val.IsBuiltInDocPart()){type=ESdtType.sdttypeDocPartObj;oThis.bs.WriteItem(c_oSerSdt.DocPartObj,function(){oThis.WriteDocPartList(val.DocPartObj)})}else if(oSdt.IsDropDownList()){type= ESdtType.sdttypeDropDownList;oThis.bs.WriteItem(c_oSerSdt.DropDownList,function(){oThis.WriteSdtComboBox(oSdt.GetDropDownListPr())})}else if(oSdt.IsDatePicker()){type=ESdtType.sdttypeDate;oThis.bs.WriteItem(c_oSerSdt.PrDate,function(){oThis.WriteSdtPrDate(oSdt.GetDatePickerPr())})}else if(undefined!==val.CheckBox){type=ESdtType.sdttypeCheckBox;oThis.bs.WriteItem(c_oSerSdt.Checkbox,function(){oThis.WriteSdtCheckBox(val.CheckBox)})}var formPr=oSdt.GetFormPr();if(formPr)oThis.bs.WriteItem(c_oSerSdt.FormPr, function(){oThis.WriteSdtFormPr(formPr)});var textFormPr=oSdt.GetTextFormPr&&oSdt.GetTextFormPr();if(textFormPr)oThis.bs.WriteItem(c_oSerSdt.TextFormPr,function(){oThis.WriteSdtTextFormPr(textFormPr)});if(undefined!==type)oThis.bs.WriteItem(c_oSerSdt.Type,function(){oThis.memory.WriteByte(type)})};this.WriteSdtCheckBox=function(val){var oThis=this;if(null!=val.Checked)oThis.bs.WriteItem(c_oSerSdt.CheckboxChecked,function(){oThis.memory.WriteBool(val.Checked)});if(null!=val.CheckedFont)oThis.bs.WriteItem(c_oSerSdt.CheckboxCheckedFont, function(){oThis.memory.WriteString3(val.CheckedFont)});if(null!=val.CheckedSymbol)oThis.bs.WriteItem(c_oSerSdt.CheckboxCheckedVal,function(){oThis.memory.WriteLong(val.CheckedSymbol)});if(null!=val.UncheckedFont)oThis.bs.WriteItem(c_oSerSdt.CheckboxUncheckedFont,function(){oThis.memory.WriteString3(val.UncheckedFont)});if(null!=val.UncheckedSymbol)oThis.bs.WriteItem(c_oSerSdt.CheckboxUncheckedVal,function(){oThis.memory.WriteLong(val.UncheckedSymbol)});if(null!=val.GroupKey)oThis.bs.WriteItem(c_oSerSdt.CheckboxGroupKey, function(){oThis.memory.WriteString3(val.GroupKey)})};this.WriteSdtComboBox=function(val){var oThis=this;if(null!=val.ListItems)for(var i=0;i0)this.bs.WriteItem(c_oSer_CommentsType.Replies,function(){oThis.WriteReplies(comment.m_aReplies)});if(null!=comment.m_sOOTime&&""!=comment.m_sOOTime){this.memory.WriteByte(c_oSer_CommentsType.DateUtc);this.memory.WriteString2((new Date(comment.m_sOOTime- 0)).toISOString().slice(0,19)+"Z")}if(comment.m_sUserData){this.memory.WriteByte(c_oSer_CommentsType.UserData);this.memory.WriteString2(comment.m_sUserData)}};this.WriteReplies=function(aComments){var oThis=this;var nIndex=0;for(var i=0,length=aComments.length;ioThis.saveParams.footnotesIndex)oThis.saveParams.footnotesIndex=index});this.bs.WriteItem(c_oSer_SettingsType.EndnotePr,function(){var index= oThis.WriteNotePr(oThis.Document.Endnotes,oThis.Document.Endnotes.EndnotePr,oThis.saveParams.endnotes,c_oSerNotes.PrEndPos);if(index>oThis.saveParams.endnotesIndex)oThis.saveParams.endnotesIndex=index});if(oThis.Document.Settings&&oThis.Document.Settings.DecimalSymbol)this.bs.WriteItem(c_oSer_SettingsType.DecimalSymbol,function(){oThis.memory.WriteString3(oThis.Document.Settings.DecimalSymbol)});if(oThis.Document.Settings&&oThis.Document.Settings.ListSeparator)this.bs.WriteItem(c_oSer_SettingsType.ListSeparator, function(){oThis.memory.WriteString3(oThis.Document.Settings.ListSeparator)});if(oThis.Document.IsGutterAtTop())this.bs.WriteItem(c_oSer_SettingsType.GutterAtTop,function(){oThis.memory.WriteBool(true)});if(oThis.Document.IsMirrorMargins())this.bs.WriteItem(c_oSer_SettingsType.MirrorMargins,function(){oThis.memory.WriteBool(true)});if(oThis.Document.GlossaryDocument){if(!oThis.Document.IsSdtGlobalSettingsDefault()){var rPr=new CTextPr;rPr.Color=oThis.Document.GetSdtGlobalColor();this.bs.WriteItem(c_oSer_SettingsType.SdtGlobalColor, function(){oThis.brPrs.Write_rPr(rPr,null,null)});this.bs.WriteItem(c_oSer_SettingsType.SdtGlobalShowHighlight,function(){oThis.memory.WriteBool(oThis.Document.GetSdtGlobalShowHighlight())})}if(!oThis.Document.IsSpecialFormsSettingsDefault()){var rPr=new CTextPr;rPr.Color=oThis.Document.GetSpecialFormsHighlight();this.bs.WriteItem(c_oSer_SettingsType.SpecialFormsHighlight,function(){oThis.brPrs.Write_rPr(rPr,null,null)})}}this.bs.WriteItem(c_oSer_SettingsType.Compat,function(){oThis.WriteCompat()})}; this.WriteCompat=function(){var oThis=this;var compatibilityMode=false===this.saveParams.isCompatible?AscCommon.document_compatibility_mode_Word15:oThis.Document.GetCompatibilityMode();this.bs.WriteItem(c_oSerCompat.CompatSetting,function(){oThis.WriteCompatSetting("compatibilityMode","http://schemas.microsoft.com/office/word",compatibilityMode.toString())});this.bs.WriteItem(c_oSerCompat.CompatSetting,function(){oThis.WriteCompatSetting("overrideTableStyleFontSizeAndJustification","http://schemas.microsoft.com/office/word", "1")});this.bs.WriteItem(c_oSerCompat.CompatSetting,function(){oThis.WriteCompatSetting("enableOpenTypeFeatures","http://schemas.microsoft.com/office/word","1")});this.bs.WriteItem(c_oSerCompat.CompatSetting,function(){oThis.WriteCompatSetting("doNotFlipMirrorIndents","http://schemas.microsoft.com/office/word","1")});var flags1=0;if(this.saveParams.isCompatible)flags1|=(oThis.Document.IsDoNotExpandShiftReturn()?1:0)<<10;this.bs.WriteItem(c_oSerCompat.Flags1,function(){oThis.memory.WriteULong(flags1)}); var flags2=0;if(this.saveParams.isCompatible)flags2|=(oThis.Document.IsSplitPageBreakAndParaMark()?1:0)<<27;this.bs.WriteItem(c_oSerCompat.Flags2,function(){oThis.memory.WriteULong(flags2)})};this.WriteCompatSetting=function(name,uri,value){var oThis=this;this.bs.WriteItem(c_oSerCompat.CompatName,function(){oThis.memory.WriteString3(name)});this.bs.WriteItem(c_oSerCompat.CompatUri,function(){oThis.memory.WriteString3(uri)});this.bs.WriteItem(c_oSerCompat.CompatValue,function(){oThis.memory.WriteString3(value)})}; this.WriteNotePr=function(notes,notePr,notesSaveParams,posType){var oThis=this;this.bpPrs.WriteNotePr(notePr,posType);var index=-1;if(notes.Separator){notesSaveParams[index]={type:3,content:notes.Separator};this.bs.WriteItem(c_oSerNotes.PrRef,function(){oThis.memory.WriteLong(index)});index++}if(notes.ContinuationSeparator){notesSaveParams[index]={type:1,content:notes.ContinuationSeparator};this.bs.WriteItem(c_oSerNotes.PrRef,function(){oThis.memory.WriteLong(index)});index++}if(notes.ContinuationNotice){notesSaveParams[index]= {type:0,content:notes.ContinuationNotice};this.bs.WriteItem(c_oSerNotes.PrRef,function(){oThis.memory.WriteLong(index)});index++}return index};this.WriteMathPr=function(){var oThis=this;var oMathPr=editor.WordControl.m_oLogicDocument.Settings.MathSettings.GetPr();if(null!=oMathPr.brkBin)this.bs.WriteItem(c_oSer_MathPrType.BrkBin,function(){oThis.WriteMathBrkBin(oMathPr.brkBin)});if(null!=oMathPr.brkBinSub)this.bs.WriteItem(c_oSer_MathPrType.BrkBinSub,function(){oThis.WriteMathBrkBinSub(oMathPr.brkBinSub)}); if(null!=oMathPr.defJc)this.bs.WriteItem(c_oSer_MathPrType.DefJc,function(){oThis.WriteMathDefJc(oMathPr.defJc)});if(null!=oMathPr.dispDef)this.bs.WriteItem(c_oSer_MathPrType.DispDef,function(){oThis.WriteMathDispDef(oMathPr.dispDef)});if(null!=oMathPr.interSp)this.bs.WriteItem(c_oSer_MathPrType.InterSp,function(){oThis.WriteMathInterSp(oMathPr.interSp)});if(null!=oMathPr.intLim)this.bs.WriteItem(c_oSer_MathPrType.IntLim,function(){oThis.WriteMathIntLim(oMathPr.intLim)});if(null!=oMathPr.intraSp)this.bs.WriteItem(c_oSer_MathPrType.IntraSp, function(){oThis.WriteMathIntraSp(oMathPr.intraSp)});if(null!=oMathPr.lMargin)this.bs.WriteItem(c_oSer_MathPrType.LMargin,function(){oThis.WriteMathLMargin(oMathPr.lMargin)});if(null!=oMathPr.mathFont)this.bs.WriteItem(c_oSer_MathPrType.MathFont,function(){oThis.WriteMathMathFont(oMathPr.mathFont)});if(null!=oMathPr.naryLim)this.bs.WriteItem(c_oSer_MathPrType.NaryLim,function(){oThis.WriteMathNaryLim(oMathPr.naryLim)});if(null!=oMathPr.postSp)this.bs.WriteItem(c_oSer_MathPrType.PostSp,function(){oThis.WriteMathPostSp(oMathPr.postSp)}); if(null!=oMathPr.preSp)this.bs.WriteItem(c_oSer_MathPrType.PreSp,function(){oThis.WriteMathPreSp(oMathPr.preSp)});if(null!=oMathPr.rMargin)this.bs.WriteItem(c_oSer_MathPrType.RMargin,function(){oThis.WriteMathRMargin(oMathPr.rMargin)});if(null!=oMathPr.smallFrac)this.bs.WriteItem(c_oSer_MathPrType.SmallFrac,function(){oThis.WriteMathSmallFrac(oMathPr.smallFrac)});if(null!=oMathPr.wrapIndent)this.bs.WriteItem(c_oSer_MathPrType.WrapIndent,function(){oThis.WriteMathWrapIndent(oMathPr.wrapIndent)});if(null!= oMathPr.wrapRight)this.bs.WriteItem(c_oSer_MathPrType.WrapRight,function(){oThis.WriteMathWrapRight(oMathPr.wrapRight)})};this.WriteMathBrkBin=function(BrkBin){this.memory.WriteByte(c_oSer_OMathBottomNodesValType.Val);this.memory.WriteByte(c_oSerPropLenType.Byte);var val=c_oAscBrkBin.Repeat;switch(BrkBin){case BREAK_AFTER:val=c_oAscBrkBin.After;break;case BREAK_BEFORE:val=c_oAscBrkBin.Before;break;case BREAK_REPEAT:val=c_oAscBrkBin.Repeat}this.memory.WriteByte(val)};this.WriteMathBrkBinSub=function(BrkBinSub){this.memory.WriteByte(c_oSer_OMathBottomNodesValType.Val); this.memory.WriteByte(c_oSerPropLenType.Byte);var val=c_oAscBrkBinSub.MinusMinus;switch(BrkBinSub){case BREAK_PLUS_MIN:val=c_oAscBrkBinSub.PlusMinus;break;case BREAK_MIN_PLUS:val=c_oAscBrkBinSub.MinusPlus;break;case BREAK_MIN_MIN:val=c_oAscBrkBinSub.MinusMinus}this.memory.WriteByte(val)};this.WriteMathDefJc=function(DefJc){this.memory.WriteByte(c_oSer_OMathBottomNodesValType.Val);this.memory.WriteByte(c_oSerPropLenType.Byte);var val=c_oAscMathJc.CenterGroup;switch(DefJc){case align_Center:val=c_oAscMathJc.Center; break;case align_Justify:val=c_oAscMathJc.CenterGroup;break;case align_Left:val=c_oAscMathJc.Left;break;case align_Right:val=c_oAscMathJc.Right}this.memory.WriteByte(val)};this.WriteMathDispDef=function(DispDef){this.memory.WriteByte(c_oSer_OMathBottomNodesValType.Val);this.memory.WriteByte(c_oSerPropLenType.Byte);this.memory.WriteBool(DispDef)};this.WriteMathInterSp=function(InterSp){this.memory.WriteByte(c_oSer_OMathBottomNodesValType.ValTwips);this.memory.WriteByte(c_oSerPropLenType.Long);this.bs.writeMmToTwips(InterSp)}; this.WriteMathIntLim=function(IntLim){this.memory.WriteByte(c_oSer_OMathBottomNodesValType.Val);this.memory.WriteByte(c_oSerPropLenType.Byte);var val=c_oAscLimLoc.SubSup;switch(IntLim){case NARY_SubSup:val=c_oAscLimLoc.SubSup;break;case NARY_UndOvr:val=c_oAscLimLoc.UndOvr}this.memory.WriteByte(val)};this.WriteMathIntraSp=function(IntraSp){this.memory.WriteByte(c_oSer_OMathBottomNodesValType.ValTwips);this.memory.WriteByte(c_oSerPropLenType.Long);this.bs.writeMmToTwips(IntraSp)};this.WriteMathLMargin= function(LMargin){this.memory.WriteByte(c_oSer_OMathBottomNodesValType.ValTwips);this.memory.WriteByte(c_oSerPropLenType.Long);this.bs.writeMmToTwips(LMargin)};this.WriteMathMathFont=function(MathFont){this.memory.WriteByte(c_oSer_OMathBottomNodesValType.Val);this.memory.WriteByte(c_oSerPropLenType.Variable);this.memory.WriteString2(MathFont.Name)};this.WriteMathNaryLim=function(NaryLim){this.memory.WriteByte(c_oSer_OMathBottomNodesValType.Val);this.memory.WriteByte(c_oSerPropLenType.Byte);var val= c_oAscLimLoc.SubSup;switch(NaryLim){case NARY_SubSup:val=c_oAscLimLoc.SubSup;break;case NARY_UndOvr:val=c_oAscLimLoc.UndOvr}this.memory.WriteByte(val)};this.WriteMathPostSp=function(PostSp){this.memory.WriteByte(c_oSer_OMathBottomNodesValType.ValTwips);this.memory.WriteByte(c_oSerPropLenType.Long);this.bs.writeMmToTwips(PostSp)};this.WriteMathPreSp=function(PreSp){this.memory.WriteByte(c_oSer_OMathBottomNodesValType.ValTwips);this.memory.WriteByte(c_oSerPropLenType.Long);this.bs.writeMmToTwips(PreSp)}; this.WriteMathRMargin=function(RMargin){this.memory.WriteByte(c_oSer_OMathBottomNodesValType.ValTwips);this.memory.WriteByte(c_oSerPropLenType.Long);this.bs.writeMmToTwips(RMargin)};this.WriteMathSmallFrac=function(SmallFrac){this.memory.WriteByte(c_oSer_OMathBottomNodesValType.Val);this.memory.WriteByte(c_oSerPropLenType.Byte);this.memory.WriteBool(SmallFrac)};this.WriteMathWrapIndent=function(WrapIndent){this.memory.WriteByte(c_oSer_OMathBottomNodesValType.ValTwips);this.memory.WriteByte(c_oSerPropLenType.Long); this.bs.writeMmToTwips(WrapIndent)};this.WriteMathWrapRight=function(WrapRight){this.memory.WriteByte(c_oSer_OMathBottomNodesValType.Val);this.memory.WriteByte(c_oSerPropLenType.Byte);this.memory.WriteBool(WrapRight)};this.WriteColorSchemeMapping=function(){var oThis=this;for(var i in this.Document.clrSchemeMap.color_map){var nScriptType=i-0;var nScriptVal=this.Document.clrSchemeMap.color_map[i];var nFileType=c_oSer_ClrSchemeMappingType.Accent1;var nFileVal=EWmlColorSchemeIndex.wmlcolorschemeindexAccent1; switch(nScriptType){case 0:nFileType=c_oSer_ClrSchemeMappingType.Accent1;break;case 1:nFileType=c_oSer_ClrSchemeMappingType.Accent2;break;case 2:nFileType=c_oSer_ClrSchemeMappingType.Accent3;break;case 3:nFileType=c_oSer_ClrSchemeMappingType.Accent4;break;case 4:nFileType=c_oSer_ClrSchemeMappingType.Accent5;break;case 5:nFileType=c_oSer_ClrSchemeMappingType.Accent6;break;case 6:nFileType=c_oSer_ClrSchemeMappingType.Bg1;break;case 7:nFileType=c_oSer_ClrSchemeMappingType.Bg2;break;case 10:nFileType= c_oSer_ClrSchemeMappingType.FollowedHyperlink;break;case 11:nFileType=c_oSer_ClrSchemeMappingType.Hyperlink;break;case 15:nFileType=c_oSer_ClrSchemeMappingType.T1;break;case 16:nFileType=c_oSer_ClrSchemeMappingType.T2;break}switch(nScriptVal){case 0:nFileVal=EWmlColorSchemeIndex.wmlcolorschemeindexAccent1;break;case 1:nFileVal=EWmlColorSchemeIndex.wmlcolorschemeindexAccent2;break;case 2:nFileVal=EWmlColorSchemeIndex.wmlcolorschemeindexAccent3;break;case 3:nFileVal=EWmlColorSchemeIndex.wmlcolorschemeindexAccent4; break;case 4:nFileVal=EWmlColorSchemeIndex.wmlcolorschemeindexAccent5;break;case 5:nFileVal=EWmlColorSchemeIndex.wmlcolorschemeindexAccent6;break;case 8:nFileVal=EWmlColorSchemeIndex.wmlcolorschemeindexDark1;break;case 9:nFileVal=EWmlColorSchemeIndex.wmlcolorschemeindexDark2;break;case 10:nFileVal=EWmlColorSchemeIndex.wmlcolorschemeindexFollowedHyperlink;break;case 11:nFileVal=EWmlColorSchemeIndex.wmlcolorschemeindexHyperlink;break;case 12:nFileVal=EWmlColorSchemeIndex.wmlcolorschemeindexLight1;break; case 13:nFileVal=EWmlColorSchemeIndex.wmlcolorschemeindexLight2;break}this.memory.WriteByte(nFileType);this.memory.WriteByte(c_oSerPropLenType.Byte);this.memory.WriteByte(nFileVal)}}}function BinaryNotesTableWriter(memory,doc,oNumIdMap,oMapCommentId,copyParams,saveParams,notes){this.memory=memory;this.Document=doc;this.oNumIdMap=oNumIdMap;this.oMapCommentId=oMapCommentId;this.saveParams=saveParams;this.notes=notes;this.copyParams=copyParams;this.bs=new BinaryCommonWriter(this.memory);this.Write=function(){var oThis= this;this.bs.WriteItemWithLength(function(){oThis.WriteNotes(oThis.notes)})};this.WriteNotes=function(notes){var oThis=this;var indexes=[];for(var i in notes)indexes.push(i);indexes.sort(AscCommon.fSortAscending);for(var i=0;i1){var nTempVersion=version.substring(1)-0;if(nTempVersion)AscCommon.CurFileVersion=nTempVersion}var stream; if(Asc.c_nVersionNoBase64!==AscCommon.CurFileVersion){var dstLen=parseInt(dst_len);var pointer=g_memory.Alloc(dstLen);stream=new AscCommon.FT_Stream2(pointer.data,dstLen);stream.obj=pointer.obj;var dstPx=stream.data;if(window.chrome)while(index=srcLen)break;var nCh=DecodeBase64Char(isBase64?szSrc.charCodeAt(index++):szSrc[index++]);if(nCh==-1){i--;continue}dwCurr<<=6;dwCurr|=nCh;nBits+=6}dwCurr<<=24-nBits;for(i=0;i>>16;dwCurr<<=8}}else{var p=b64_decode;while(index=srcLen)break;var nCh=p[isBase64?szSrc.charCodeAt(index++):szSrc[index++]];if(nCh==undefined){i--;continue}dwCurr<<=6;dwCurr|=nCh;nBits+=6}dwCurr<<=24-nBits;for(i=0;i>>16;dwCurr<<=8}}}}else{stream=new AscCommon.FT_Stream2(szSrc,szSrc.length);stream.EnterFrame(index);stream.Seek(index)}return stream};this.ReadFromStream= function(stream,bClearStreamOnly){try{this.stream=stream;this.PreLoadPrepare(bClearStreamOnly);this.ReadMainTable();this.PostLoadPrepare()}catch(e){if(e.message==g_sErrorCharCountMessage)return false;else throw e;}return true};this.Read=function(data){return this.ReadFromStream(this.getbase64DecodedData(data))};this.PreLoadPrepare=function(bClearStreamOnly){var styles=this.Document.Styles.Style;var stDefault=this.Document.Styles.Default;stDefault.Character=null;stDefault.Numbering=null;stDefault.Paragraph= null;stDefault.Table=null;pptx_content_loader.Clear(bClearStreamOnly)};this.ReadMainTable=function(){var res=c_oSerConstants.ReadOk;res=this.stream.EnterFrame(1);if(c_oSerConstants.ReadOk!=res)return res;var mtLen=this.stream.GetUChar();var aSeekTable=[];var nOtherTableSeek=-1;var nNumberingTableSeek=-1;var nCommentTableSeek=-1;var nDocumentCommentTableSeek=-1;var nSettingTableSeek=-1;var nDocumentTableSeek=-1;var nFootnoteTableSeek=-1;var nEndnoteTableSeek=-1;var fileStream;for(var i=0;iAsc.c_dMaxParaRunContentLength)run.Split2(run.GetElementsCount()-Asc.c_dMaxParaRunContentLength,runParent,runPos)}var setting=this.oReadResult.setting;var fInitCommentData=function(comment){var oCommentObj=new AscCommon.CCommentData;if(null!=comment.UserName)oCommentObj.m_sUserName=comment.UserName;if(null!=comment.Initials)oCommentObj.m_sInitials=comment.Initials;if(null!=comment.UserId)oCommentObj.m_sUserId= comment.UserId;if(null!=comment.ProviderId)oCommentObj.m_sProviderId=comment.ProviderId;if(null!=comment.Date)oCommentObj.m_sTime=comment.Date;if(null!=comment.OODate)oCommentObj.m_sOOTime=comment.OODate;if(null!=comment.UserData)oCommentObj.m_sUserData=comment.UserData;if(null!=comment.Text)oCommentObj.m_sText=comment.Text;if(null!=comment.Solved)oCommentObj.m_bSolved=comment.Solved;if(null!=comment.DurableId)oCommentObj.m_nDurableId=comment.DurableId;if(null!=comment.Replies)for(var i=0,length= comment.Replies.length;i=0;--i)if(oParaComment==OpenParStruct.prototype._GetFromContent(oParent,i)){OpenParStruct.prototype._removeFromContent(oParent,i,1);break}}if(null!=item.End&&null!=item.End.oParent){var oParent=item.End.oParent;var oParaComment=item.End.oParaComment; for(var i=OpenParStruct.prototype._GetContentLength(oParent)-1;i>=0;--i)if(oParaComment==OpenParStruct.prototype._GetFromContent(oParent,i)){OpenParStruct.prototype._removeFromContent(oParent,i,1);break}}}}var bSendComments=true;if(this.openParams&&this.openParams.noSendComments)bSendComments=false;if(bSendComments){var allComments=this.Document.Comments.GetAllComments();for(var i in allComments){var oNewComment=allComments[i];this.Document.DrawingDocument.m_oWordControl.m_oApi.sync_AddComment(oNewComment.Id, oNewComment.Data)}}for(var bookmarkIndex in this.oReadResult.bookmarksStarted){var elem=this.oReadResult.bookmarksStarted[bookmarkIndex];for(var i=0;iAsc.c_dMaxParaRunContentLength)run.Split2(run.GetElementsCount()-Asc.c_dMaxParaRunContentLength,runParent,runPos)}var setting=this.oReadResult.setting;var fInitCommentData=function(comment){var oCommentObj=new AscCommon.CCommentData;if(null!=comment.UserName)oCommentObj.m_sUserName=comment.UserName;if(null!= comment.Initials)oCommentObj.m_sInitials=comment.Initials;if(null!=comment.UserId)oCommentObj.m_sUserId=comment.UserId;if(null!=comment.ProviderId)oCommentObj.m_sProviderId=comment.ProviderId;if(null!=comment.Date)oCommentObj.m_sTime=comment.Date;if(null!=comment.OODate)oCommentObj.m_sOOTime=comment.OODate;if(null!=comment.m_sQuoteText)oCommentObj.m_sQuoteText=comment.m_sQuoteText;if(null!=comment.Text)oCommentObj.m_sText=comment.Text;if(null!=comment.Solved)oCommentObj.m_bSolved=comment.Solved;if(null!= comment.DurableId)oCommentObj.m_nDurableId=comment.DurableId;if(null!=comment.Replies)for(var i=0,length=comment.Replies.length;i=0;--i)if(oParaComment==OpenParStruct.prototype._GetFromContent(oParent,i)){OpenParStruct.prototype._removeFromContent(oParent,i,1);break}}if(null!=item.End&&null!=item.End.oParent){var oParent=item.End.oParent;var oParaComment=item.End.oParaComment;for(var i=OpenParStruct.prototype._GetContentLength(oParent)-1;i>=0;--i)if(oParaComment==OpenParStruct.prototype._GetFromContent(oParent, i)){OpenParStruct.prototype._removeFromContent(oParent,i,1);break}}}}if(api)for(var i in oCommentsNewId){var oNewComment=oCommentsNewId[i];oNewComment.CreateNewCommentsGuid();api.sync_AddComment(oNewComment.Id,oNewComment.Data)}for(var bookmarkIndex in this.oReadResult.bookmarksStarted){var elem=this.oReadResult.bookmarksStarted[bookmarkIndex];for(var i=0;i=0&&nIndex0){var TextOutline=pptx_content_loader.ReadShapeProperty(this.stream,0);if(null!=TextOutline)rPr.TextOutline=TextOutline}else res=c_oSerConstants.ReadUnknown;break;case c_oSerProp_rPrType.TextFill:if(length>0){var TextFill= pptx_content_loader.ReadShapeProperty(this.stream,1);if(null!=TextFill){rPr.TextFill=TextFill;if(null!=TextFill.transparent)TextFill.transparent=255-TextFill.transparent}}else res=c_oSerConstants.ReadUnknown;break;case c_oSerProp_rPrType.Del:this.trackRevision={del:new CReviewInfo};res=this.bcr.Read1(length,function(t,l){return ReadTrackRevision(t,l,oThis.stream,oThis.trackRevision.del,null)});break;case c_oSerProp_rPrType.Ins:if(this.oReadResult.checkReadRevisions()){this.trackRevision={ins:new CReviewInfo}; res=this.bcr.Read1(length,function(t,l){return ReadTrackRevision(t,l,oThis.stream,oThis.trackRevision.ins,null)})}else res=c_oSerConstants.ReadUnknown;break;case c_oSerProp_rPrType.MoveFrom:this.trackRevision={del:new CReviewInfo};this.trackRevision.del.SetMove(Asc.c_oAscRevisionsMove.MoveFrom);res=this.bcr.Read1(length,function(t,l){return ReadTrackRevision(t,l,oThis.stream,oThis.trackRevision.del,null)});break;case c_oSerProp_rPrType.MoveTo:if(this.oReadResult.checkReadRevisions()){this.trackRevision= {ins:new CReviewInfo};this.trackRevision.ins.SetMove(Asc.c_oAscRevisionsMove.MoveTo);res=this.bcr.Read1(length,function(t,l){return ReadTrackRevision(t,l,oThis.stream,oThis.trackRevision.ins,null)})}else res=c_oSerConstants.ReadUnknown;break;case c_oSerProp_rPrType.rPrChange:if(this.oReadResult.checkReadRevisions()){var rPrChange=new CTextPr;var reviewInfo=new CReviewInfo;var brPrr=new Binary_rPrReader(this.Document,this.oReadResult,this.stream);res=this.bcr.Read1(length,function(t,l){return ReadTrackRevision(t, l,oThis.stream,reviewInfo,{brPrr:brPrr,rPr:rPrChange})});if(run)run.SetPrChange(rPrChange,reviewInfo)}else res=c_oSerConstants.ReadUnknown;break;default:res=c_oSerConstants.ReadUnknown;break}return res}}function Binary_tblPrReader(doc,oReadResult,stream){this.Document=doc;this.oReadResult=oReadResult;this.stream=stream;this.bcr=new Binary_CommonReader(this.stream);this.bpPrr=new Binary_pPrReader(this.Document,this.oReadResult,this.stream)}Binary_tblPrReader.prototype={Read_tblPr:function(type,length, Pr,table){var res=c_oSerConstants.ReadOk;var oThis=this;if(c_oSerProp_tblPrType.RowBandSize===type)Pr.TableStyleRowBandSize=this.stream.GetLongLE();else if(c_oSerProp_tblPrType.ColBandSize===type)Pr.TableStyleColBandSize=this.stream.GetLongLE();else if(c_oSerProp_tblPrType.Jc===type)Pr.Jc=this.stream.GetUChar();else if(c_oSerProp_tblPrType.TableInd===type)Pr.TableInd=this.bcr.ReadDouble();else if(c_oSerProp_tblPrType.TableIndTwips===type)Pr.TableInd=g_dKoef_twips_to_mm*this.stream.GetULongLE();else if(c_oSerProp_tblPrType.TableW=== type){var oW={Type:null,W:null,WDocx:null};res=this.bcr.Read2(length,function(t,l){return oThis.ReadW(t,l,oW)});if(null==Pr.TableW)Pr.TableW=new CTableMeasurement(tblwidth_Auto,0);this.ParseW(oW,Pr.TableW)}else if(c_oSerProp_tblPrType.TableCellMar===type){if(null==Pr.TableCellMar)Pr.TableCellMar=this.GetNewMargin();res=this.bcr.Read1(length,function(t,l){return oThis.ReadCellMargins(t,l,Pr.TableCellMar)})}else if(c_oSerProp_tblPrType.TableBorders===type){if(null==Pr.TableBorders)Pr.TableBorders={Bottom:undefined, Left:undefined,Right:undefined,Top:undefined,InsideH:undefined,InsideV:undefined};res=this.bcr.Read1(length,function(t,l){return oThis.bpPrr.ReadBorders(t,l,Pr.TableBorders)})}else if(c_oSerProp_tblPrType.Shd===type){if(null==Pr.Shd)Pr.Shd=new CDocumentShd;ReadDocumentShd(length,this.bcr,Pr.Shd)}else if(c_oSerProp_tblPrType.Layout===type){var nLayout=this.stream.GetUChar();switch(nLayout){case ETblLayoutType.tbllayouttypeAutofit:Pr.TableLayout=tbllayout_AutoFit;break;case ETblLayoutType.tbllayouttypeFixed:Pr.TableLayout= tbllayout_Fixed;break}}else if(c_oSerProp_tblPrType.TableCellSpacing===type)Pr.TableCellSpacing=this.bcr.ReadDouble();else if(c_oSerProp_tblPrType.TableCellSpacingTwips===type)Pr.TableCellSpacing=2*g_dKoef_twips_to_mm*this.stream.GetULongLE();else if(c_oSerProp_tblPrType.tblCaption===type)Pr.TableCaption=this.stream.GetString2LE(length);else if(c_oSerProp_tblPrType.tblDescription===type)Pr.TableDescription=this.stream.GetString2LE(length);else if(c_oSerProp_tblPrType.tblPrChange===type&&this.oReadResult.checkReadRevisions()&& (!this.oReadResult.bCopyPaste||this.oReadResult.isDocumentPasting())){var tblPrChange=new CTablePr;var reviewInfo=new CReviewInfo;res=this.bcr.Read1(length,function(t,l){return ReadTrackRevision(t,l,oThis.stream,reviewInfo,{btblPrr:oThis,tblPr:tblPrChange})});Pr.SetPrChange(tblPrChange,reviewInfo)}else if(null!=table)if(c_oSerProp_tblPrType.tblpPr===type){table.Set_Inline(false);var oAdditionalPr={PageNum:null,X:null,Y:null,Paddings:null};res=this.bcr.Read2(length,function(t,l){return oThis.Read_tblpPr(t, l,oAdditionalPr)});if(null!=oAdditionalPr.X)table.Set_PositionH(Asc.c_oAscHAnchor.Page,false,oAdditionalPr.X);if(null!=oAdditionalPr.Y)table.Set_PositionV(Asc.c_oAscVAnchor.Page,false,oAdditionalPr.Y);if(null!=oAdditionalPr.Paddings){var Paddings=oAdditionalPr.Paddings;table.Set_Distance(Paddings.L,Paddings.T,Paddings.R,Paddings.B)}}else if(c_oSerProp_tblPrType.tblpPr2===type){table.Set_Inline(false);var oAdditionalPr={HRelativeFrom:null,HAlign:null,HValue:null,VRelativeFrom:null,VAlign:null,VValue:null, Distance:null};res=this.bcr.Read2(length,function(t,l){return oThis.Read_tblpPr2(t,l,oAdditionalPr)});if(null!=oAdditionalPr.HRelativeFrom&&null!=oAdditionalPr.HAlign&&null!=oAdditionalPr.HValue)table.Set_PositionH(oAdditionalPr.HRelativeFrom,oAdditionalPr.HAlign,oAdditionalPr.HValue);if(null!=oAdditionalPr.VRelativeFrom&&null!=oAdditionalPr.VAlign&&null!=oAdditionalPr.VValue)table.Set_PositionV(oAdditionalPr.VRelativeFrom,oAdditionalPr.VAlign,oAdditionalPr.VValue);if(null!=oAdditionalPr.Distance){var Distance= oAdditionalPr.Distance;table.Set_Distance(Distance.L,Distance.T,Distance.R,Distance.B)}}else if(c_oSerProp_tblPrType.Look===type){var nLook=this.stream.GetULongLE();var bFC=0!=(nLook&128);var bFR=0!=(nLook&32);var bLC=0!=(nLook&256);var bLR=0!=(nLook&64);var bBH=0!=(nLook&512);var bBV=0!=(nLook&1024);table.Set_TableLook(new CTableLook(bFC,bFR,bLC,bLR,!bBH,!bBV))}else if(c_oSerProp_tblPrType.Style===type)this.oReadResult.tableStyles.push({pPr:table,style:this.stream.GetString2LE(length)});else res= c_oSerConstants.ReadUnknown;else res=c_oSerConstants.ReadUnknown;return res},BordersNull:function(Borders){Borders.Left=new CDocumentBorder;Borders.Top=new CDocumentBorder;Borders.Right=new CDocumentBorder;Borders.Bottom=new CDocumentBorder;Borders.InsideV=new CDocumentBorder;Borders.InsideH=new CDocumentBorder},ReadW:function(type,length,Width){var res=c_oSerConstants.ReadOk;if(c_oSerWidthType.Type===type)Width.Type=this.stream.GetUChar();else if(c_oSerWidthType.W===type)Width.W=this.bcr.ReadDouble(); else if(c_oSerWidthType.WDocx===type)Width.WDocx=this.stream.GetULongLE();else res=c_oSerConstants.ReadUnknown;return res},ParseW:function(input,output){if(input.Type)output.Type=input.Type;if(input.W)output.W=input.W;if(input.WDocx)if(tblwidth_Mm==input.Type)output.W=g_dKoef_twips_to_mm*input.WDocx;else if(tblwidth_Pct==input.Type)output.W=2*input.WDocx/100;else output.W=input.WDocx},ReadCellMargins:function(type,length,Margins){var res=c_oSerConstants.ReadOk;var oThis=this;if(c_oSerMarginsType.left=== type){var oW={Type:null,W:null,WDocx:null};res=this.bcr.Read2(length,function(t,l){return oThis.ReadW(t,l,oW)});if(null==Margins.Left)Margins.Left=new CTableMeasurement(tblwidth_Auto,0);this.ParseW(oW,Margins.Left)}else if(c_oSerMarginsType.top===type){var oW={Type:null,W:null,WDocx:null};res=this.bcr.Read2(length,function(t,l){return oThis.ReadW(t,l,oW)});if(null==Margins.Top)Margins.Top=new CTableMeasurement(tblwidth_Auto,0);this.ParseW(oW,Margins.Top)}else if(c_oSerMarginsType.right===type){var oW= {Type:null,W:null,WDocx:null};res=this.bcr.Read2(length,function(t,l){return oThis.ReadW(t,l,oW)});if(null==Margins.Right)Margins.Right=new CTableMeasurement(tblwidth_Auto,0);this.ParseW(oW,Margins.Right)}else if(c_oSerMarginsType.bottom===type){var oW={Type:null,W:null,WDocx:null};res=this.bcr.Read2(length,function(t,l){return oThis.ReadW(t,l,oW)});if(null==Margins.Bottom)Margins.Bottom=new CTableMeasurement(tblwidth_Auto,0);this.ParseW(oW,Margins.Bottom)}else res=c_oSerConstants.ReadUnknown;return res}, Read_tblpPr:function(type,length,oAdditionalPr){var res=c_oSerConstants.ReadOk;var oThis=this;if(c_oSer_tblpPrType.Page===type)oAdditionalPr.PageNum=this.stream.GetULongLE();else if(c_oSer_tblpPrType.X===type)oAdditionalPr.X=this.bcr.ReadDouble();else if(c_oSer_tblpPrType.Y===type)oAdditionalPr.Y=this.bcr.ReadDouble();else if(c_oSer_tblpPrType.Paddings===type){if(null==oAdditionalPr.Paddings)oAdditionalPr.Paddings={L:0,T:0,R:0,B:0};res=this.bcr.Read2(length,function(t,l){return oThis.ReadPaddings(t, l,oAdditionalPr.Paddings)})}else res=c_oSerConstants.ReadUnknown;return res},Read_tblpPr2:function(type,length,oAdditionalPr){var res=c_oSerConstants.ReadOk;var oThis=this;if(c_oSer_tblpPrType2.HorzAnchor===type)oAdditionalPr.HRelativeFrom=this.stream.GetUChar();else if(c_oSer_tblpPrType2.TblpX===type){oAdditionalPr.HAlign=false;oAdditionalPr.HValue=this.bcr.ReadDouble()}else if(c_oSer_tblpPrType2.TblpXTwips===type){oAdditionalPr.HAlign=false;oAdditionalPr.HValue=g_dKoef_twips_to_mm*this.stream.GetULongLE()}else if(c_oSer_tblpPrType2.TblpXSpec=== type){oAdditionalPr.HAlign=true;oAdditionalPr.HValue=this.stream.GetUChar()}else if(c_oSer_tblpPrType2.VertAnchor===type)oAdditionalPr.VRelativeFrom=this.stream.GetUChar();else if(c_oSer_tblpPrType2.TblpY===type){oAdditionalPr.VAlign=false;oAdditionalPr.VValue=this.bcr.ReadDouble()}else if(c_oSer_tblpPrType2.TblpYTwips===type){oAdditionalPr.VAlign=false;oAdditionalPr.VValue=g_dKoef_twips_to_mm*this.stream.GetULongLE()}else if(c_oSer_tblpPrType2.TblpYSpec===type){oAdditionalPr.VAlign=true;oAdditionalPr.VValue= this.stream.GetUChar()}else if(c_oSer_tblpPrType2.Paddings===type){oAdditionalPr.Distance={L:0,T:0,R:0,B:0};res=this.bcr.Read2(length,function(t,l){return oThis.ReadPaddings2(t,l,oAdditionalPr.Distance)})}else res=c_oSerConstants.ReadUnknown;return res},Read_RowPr:function(type,length,Pr,row){var res=c_oSerConstants.ReadOk;var oThis=this;if(c_oSerProp_rowPrType.CantSplit===type)Pr.CantSplit=this.stream.GetUChar()!=0;else if(c_oSerProp_rowPrType.After===type)res=this.bcr.Read2(length,function(t,l){return oThis.ReadAfter(t, l,Pr)});else if(c_oSerProp_rowPrType.Before===type)res=this.bcr.Read2(length,function(t,l){return oThis.ReadBefore(t,l,Pr)});else if(c_oSerProp_rowPrType.Jc===type)Pr.Jc=this.stream.GetUChar();else if(c_oSerProp_rowPrType.TableCellSpacing===type)Pr.TableCellSpacing=this.bcr.ReadDouble();else if(c_oSerProp_rowPrType.TableCellSpacingTwips===type)Pr.TableCellSpacing=2*g_dKoef_twips_to_mm*this.stream.GetULongLE();else if(c_oSerProp_rowPrType.Height===type){if(null==Pr.Height)Pr.Height=new CTableRowHeight(0, Asc.linerule_Auto);res=this.bcr.Read2(length,function(t,l){return oThis.ReadHeight(t,l,Pr.Height)})}else if(c_oSerProp_rowPrType.TableHeader===type)Pr.TableHeader=this.stream.GetUChar()!=0;else if(c_oSerProp_rowPrType.Del===type&&row&&(!this.oReadResult.bCopyPaste||this.oReadResult.isDocumentPasting())){var reviewInfo=new CReviewInfo;res=this.bcr.Read1(length,function(t,l){return ReadTrackRevision(t,l,oThis.stream,reviewInfo,null)});row.SetReviewTypeWithInfo(reviewtype_Remove,reviewInfo)}else if(c_oSerProp_rowPrType.Ins=== type&&row&&this.oReadResult.checkReadRevisions()&&(!this.oReadResult.bCopyPaste||this.oReadResult.isDocumentPasting())){var reviewInfo=new CReviewInfo;res=this.bcr.Read1(length,function(t,l){return ReadTrackRevision(t,l,oThis.stream,reviewInfo,null)});row.SetReviewTypeWithInfo(reviewtype_Add,reviewInfo)}else if(c_oSerProp_rowPrType.trPrChange===type&&this.oReadResult.checkReadRevisions()&&(!this.oReadResult.bCopyPaste||this.oReadResult.isDocumentPasting())){var trPr=new CTableRowPr;var reviewInfo= new CReviewInfo;res=this.bcr.Read1(length,function(t,l){return ReadTrackRevision(t,l,oThis.stream,reviewInfo,{btblPrr:oThis,trPr:trPr})});Pr.SetPrChange(trPr,reviewInfo)}else res=c_oSerConstants.ReadUnknown;return res},ReadAfter:function(type,length,After){var res=c_oSerConstants.ReadOk;var oThis=this;if(c_oSerProp_rowPrType.GridAfter===type)After.GridAfter=this.stream.GetULongLE();else if(c_oSerProp_rowPrType.WAfter===type){var oW={Type:null,W:null,WDocx:null};res=this.bcr.Read2(length,function(t, l){return oThis.ReadW(t,l,oW)});if(null==After.WAfter)After.WAfter=new CTableMeasurement(tblwidth_Auto,0);this.ParseW(oW,After.WAfter)}else res=c_oSerConstants.ReadUnknown;return res},ReadBefore:function(type,length,Before){var res=c_oSerConstants.ReadOk;var oThis=this;if(c_oSerProp_rowPrType.GridBefore===type)Before.GridBefore=this.stream.GetULongLE();else if(c_oSerProp_rowPrType.WBefore===type){var oW={Type:null,W:null,WDocx:null};res=this.bcr.Read2(length,function(t,l){return oThis.ReadW(t,l,oW)}); if(null==Before.WBefore)Before.WBefore=new CTableMeasurement(tblwidth_Auto,0);this.ParseW(oW,Before.WBefore)}else res=c_oSerConstants.ReadUnknown;return res},ReadHeight:function(type,length,Height){var res=c_oSerConstants.ReadOk;if(c_oSerProp_rowPrType.Height_Rule===type)Height.HRule=this.stream.GetUChar();else if(c_oSerProp_rowPrType.Height_Value===type)Height.Value=this.bcr.ReadDouble();else if(c_oSerProp_rowPrType.Height_ValueTwips===type)Height.Value=g_dKoef_twips_to_mm*this.stream.GetULongLE(); else res=c_oSerConstants.ReadUnknown;return res},Read_CellPr:function(type,length,Pr){var res=c_oSerConstants.ReadOk;var oThis=this;if(c_oSerProp_cellPrType.GridSpan===type)Pr.GridSpan=this.stream.GetULongLE();else if(c_oSerProp_cellPrType.Shd===type){if(null==Pr.Shd)Pr.Shd=new CDocumentShd;var oNewShd={Value:undefined,Color:undefined,Unifill:undefined};ReadDocumentShd(length,this.bcr,oNewShd);if(undefined==oNewShd.Value&&oNewShd.Unifill)oNewShd.Value=Asc.c_oAscShdClear;Pr.Shd.Set_FromObject(oNewShd)}else if(c_oSerProp_cellPrType.TableCellBorders=== type){if(null==Pr.TableCellBorders)Pr.TableCellBorders={Bottom:undefined,Left:undefined,Right:undefined,Top:undefined};res=this.bcr.Read1(length,function(t,l){return oThis.bpPrr.ReadBorders(t,l,Pr.TableCellBorders)})}else if(c_oSerProp_cellPrType.CellMar===type){if(null==Pr.TableCellMar)Pr.TableCellMar=this.GetNewMargin();res=this.bcr.Read1(length,function(t,l){return oThis.ReadCellMargins(t,l,Pr.TableCellMar)})}else if(c_oSerProp_cellPrType.TableCellW===type){var oW={Type:null,W:null,WDocx:null}; res=this.bcr.Read2(length,function(t,l){return oThis.ReadW(t,l,oW)});if(null==Pr.TableCellW)Pr.TableCellW=new CTableMeasurement(tblwidth_Auto,0);this.ParseW(oW,Pr.TableCellW)}else if(c_oSerProp_cellPrType.VAlign===type)Pr.VAlign=this.stream.GetUChar();else if(c_oSerProp_cellPrType.VMerge===type)Pr.VMerge=this.stream.GetUChar();else if(c_oSerProp_cellPrType.HMerge===type)Pr.HMerge=this.stream.GetUChar();else if(c_oSerProp_cellPrType.CellDel===type)res=c_oSerConstants.ReadUnknown;else if(c_oSerProp_cellPrType.CellIns=== type)res=c_oSerConstants.ReadUnknown;else if(c_oSerProp_cellPrType.CellMerge===type)res=c_oSerConstants.ReadUnknown;else if(c_oSerProp_cellPrType.tcPrChange===type&&this.oReadResult.checkReadRevisions()&&(!this.oReadResult.bCopyPaste||this.oReadResult.isDocumentPasting())){var tcPr=new CTableCellPr;var reviewInfo=new CReviewInfo;res=this.bcr.Read1(length,function(t,l){return ReadTrackRevision(t,l,oThis.stream,reviewInfo,{btblPrr:oThis,tcPr:tcPr})});Pr.SetPrChange(tcPr,reviewInfo)}else if(c_oSerProp_cellPrType.textDirection=== type)Pr.TextDirection=this.stream.GetUChar();else if(c_oSerProp_cellPrType.noWrap===type)Pr.NoWrap=this.stream.GetUChar()!=0;else res=c_oSerConstants.ReadUnknown;return res},GetNewMargin:function(){return{Bottom:undefined,Left:undefined,Right:undefined,Top:undefined}},ReadPaddings:function(type,length,paddings){var res=c_oSerConstants.ReadOk;if(c_oSerPaddingType.left===type)paddings.Left=this.bcr.ReadDouble();else if(c_oSerPaddingType.top===type)paddings.Top=this.bcr.ReadDouble();else if(c_oSerPaddingType.right=== type)paddings.Right=this.bcr.ReadDouble();else if(c_oSerPaddingType.bottom===type)paddings.Bottom=this.bcr.ReadDouble();else res=c_oSerConstants.ReadUnknown;return res},ReadPaddings2:function(type,length,paddings){var res=c_oSerConstants.ReadOk;if(c_oSerPaddingType.left===type)paddings.L=this.bcr.ReadDouble();else if(c_oSerPaddingType.leftTwips===type)paddings.L=g_dKoef_twips_to_mm*this.stream.GetULongLE();else if(c_oSerPaddingType.top===type)paddings.T=this.bcr.ReadDouble();else if(c_oSerPaddingType.topTwips=== type)paddings.T=g_dKoef_twips_to_mm*this.stream.GetULongLE();else if(c_oSerPaddingType.right===type)paddings.R=this.bcr.ReadDouble();else if(c_oSerPaddingType.rightTwips===type)paddings.R=g_dKoef_twips_to_mm*this.stream.GetULongLE();else if(c_oSerPaddingType.bottom===type)paddings.B=this.bcr.ReadDouble();else if(c_oSerPaddingType.bottomTwips===type)paddings.B=g_dKoef_twips_to_mm*this.stream.GetULongLE();else res=c_oSerConstants.ReadUnknown;return res}};function Binary_NumberingTableReader(doc,oReadResult, stream){this.Document=doc;this.oReadResult=oReadResult;this.stream=stream;this.m_oANums={};this.bcr=new Binary_CommonReader(this.stream);this.brPrr=new Binary_rPrReader(this.Document,this.oReadResult,this.stream);this.bpPrr=new Binary_pPrReader(this.Document,this.oReadResult,this.stream);this.Read=function(){var oThis=this;var res=this.bcr.ReadTable(function(t,l){return oThis.ReadNumberingContent(t,l)});return res};this.ReadNumberingContent=function(type,length){var oThis=this;var res=c_oSerConstants.ReadOk; if(c_oSerNumTypes.AbstractNums===type)res=this.bcr.Read1(length,function(t,l){return oThis.ReadAbstractNums(t,l)});else if(c_oSerNumTypes.Nums===type){var tmpNum={NumId:null,Num:null};res=this.bcr.Read1(length,function(t,l){return oThis.ReadNums(t,l,tmpNum)})}else res=c_oSerConstants.ReadUnknown;return res},this.ReadNums=function(type,length,tmpNum){var oThis=this;var res=c_oSerConstants.ReadOk;if(c_oSerNumTypes.Num===type){tmpNum.NumId=null;tmpNum.Num=new CNum(this.oReadResult.logicDocument.GetNumbering()); res=this.bcr.Read2(length,function(t,l){return oThis.ReadNum(t,l,tmpNum)});if(null!=tmpNum.NumId)this.oReadResult.numToNumClass[tmpNum.NumId]=tmpNum.Num}else res=c_oSerConstants.ReadUnknown;return res},this.ReadNum=function(type,length,tmpNum){var oThis=this;var res=c_oSerConstants.ReadOk;if(c_oSerNumTypes.Num_ANumId===type){var ANum=this.m_oANums[this.stream.GetULongLE()];if(ANum){tmpNum.Num.SetAbstractNumId(ANum.GetId());this.oReadResult.numToANumClass[ANum.GetId()]=ANum}}else if(c_oSerNumTypes.Num_NumId=== type)tmpNum.NumId=this.stream.GetULongLE();else if(c_oSerNumTypes.Num_LvlOverride===type){var tmpOverride={nLvl:undefined,StartOverride:undefined,Lvl:undefined};res=this.bcr.Read1(length,function(t,l){return oThis.ReadLvlOverride(t,l,tmpOverride)});tmpNum.Num.SetLvlOverride(tmpOverride.Lvl,tmpOverride.nLvl,tmpOverride.StartOverride)}else res=c_oSerConstants.ReadUnknown;return res},this.ReadLvlOverride=function(type,length,lvlOverride){var oThis=this;var res=c_oSerConstants.ReadOk;if(c_oSerNumTypes.ILvl=== type)lvlOverride.nLvl=this.stream.GetULongLE();else if(c_oSerNumTypes.StartOverride===type)lvlOverride.StartOverride=this.stream.GetULongLE();else if(c_oSerNumTypes.Lvl===type){lvlOverride.Lvl=new CNumberingLvl;var tmp={nLevelNum:0};res=this.bcr.Read2(length,function(t,l){return oThis.ReadLevel(t,l,lvlOverride.Lvl,tmp)})}else res=c_oSerConstants.ReadUnknown;return res},this.ReadAbstractNums=function(type,length){var oThis=this;var res=c_oSerConstants.ReadOk;if(c_oSerNumTypes.AbstractNum===type){var oNewAbstractNum= new CAbstractNum;res=this.bcr.Read1(length,function(t,l){return oThis.ReadAbstractNum(t,l,oNewAbstractNum)})}else res=c_oSerConstants.ReadUnknown;return res},this.ReadAbstractNum=function(type,length,oNewNum){var oThis=this;var res=c_oSerConstants.ReadOk;if(c_oSerNumTypes.AbstractNum_Lvls===type){var nLevelNum=0;res=this.bcr.Read1(length,function(t,l){return oThis.ReadLevels(t,l,nLevelNum++,oNewNum)})}else if(c_oSerNumTypes.NumStyleLink===type)this.oReadResult.numStyleLinks.push({pPr:oNewNum,style:this.stream.GetString2LE(length)}); else if(c_oSerNumTypes.StyleLink===type)this.oReadResult.styleLinks.push({pPr:oNewNum,style:this.stream.GetString2LE(length)});else if(c_oSerNumTypes.AbstractNum_Id===type)this.m_oANums[this.stream.GetULongLE()]=oNewNum;else res=c_oSerConstants.ReadUnknown;return res};this.ReadLevels=function(type,length,nLevelNum,oNewNum){var oThis=this;var res=c_oSerConstants.ReadOk;if(c_oSerNumTypes.Lvl===type)if(nLevelNum=g_nErrorParagraphCount)throw new Error(g_sErrorCharCountMessage);}var oNewParagraph=new Paragraph(this.Document.DrawingDocument, this.Document);res=this.bcr.Read1(length,function(t,l){return oThis.ReadParagraph(t,l,oNewParagraph,Content)});if(reviewtype_Common===oNewParagraph.GetReviewType()||this.oReadResult.checkReadRevisions()){oNewParagraph.Correct_Content();if(null!=this.lastPar){oNewParagraph.Set_DocumentPrev(this.lastPar);this.lastPar.Set_DocumentNext(oNewParagraph)}this.lastPar=oNewParagraph;Content.push(oNewParagraph)}}else if(c_oSerParType.Table===type){var doc=this.Document;var oNewTable=new CTable(doc.DrawingDocument, doc,true,0,0,[]);res=this.bcr.Read1(length,function(t,l){return oThis.ReadDocTable(t,l,oNewTable)});if(oNewTable.Content.length>0){this.oReadResult.aTableCorrect.push(oNewTable);if(2==AscCommon.CurFileVersion&&false==oNewTable.Inline)if(false==oNewTable.PositionH.Align){var dx=GetTableOffsetCorrection(oNewTable);oNewTable.PositionH.Value+=dx}if(null!=this.lastPar){oNewTable.Set_DocumentPrev(this.lastPar);this.lastPar.Set_DocumentNext(oNewTable)}this.lastPar=oNewTable;Content.push(oNewTable)}}else if(c_oSerParType.sectPr=== type&&!this.oReadResult.bCopyPaste){var oSectPr=oThis.Document.SectPr;var oAdditional={EvenAndOddHeaders:null};res=this.bcr.Read1(length,function(t,l){return oThis.bpPrr.Read_SecPr(t,l,oSectPr,oAdditional)});if(null!=oAdditional.EvenAndOddHeaders)this.Document.Set_DocumentEvenAndOddHeaders(oAdditional.EvenAndOddHeaders);if(AscCommon.CurFileVersion<5){for(var i=0;i0){for(var i=0;i0)for(var i=0;iAsc.c_dMaxParaRunContentLength&&!(oParStruct.cur instanceof CInlineLevelSdt&&oParStruct.cur.IsForm()))this.oReadResult.runsToSplit.push(run)}else if(c_oSerParType.CommentStart===type){var oCommon={};res=this.bcr.Read1(length,function(t,l){return oThis.ReadComment(t,l,oCommon)});if(null!=oCommon.Id&&null!=oCurContainer){oCommon.oParent=oCurContainer;var item=this.oComments[oCommon.Id];if(item)item.Start=oCommon;else this.oComments[oCommon.Id]={Start:oCommon};if(null==this.oCurComments[oCommon.Id]){this.nCurCommentsCount++; this.oCurComments[oCommon.Id]=""}oCommon.oParaComment=new AscCommon.ParaComment(true,oCommon.Id);oParStruct.addToContent(oCommon.oParaComment)}}else if(c_oSerParType.CommentEnd===type){var oCommon={};res=this.bcr.Read1(length,function(t,l){return oThis.ReadComment(t,l,oCommon)});if(null!=oCommon.Id&&null!=oCurContainer){oCommon.oParent=oCurContainer;var item=this.oComments[oCommon.Id];if(!item){item={};this.oComments[oCommon.Id]=item}item.End=oCommon;var sQuoteText=this.oCurComments[oCommon.Id];if(null!= sQuoteText){item.QuoteText=sQuoteText;this.nCurCommentsCount--;delete this.oCurComments[oCommon.Id]}oCommon.oParaComment=new AscCommon.ParaComment(false,oCommon.Id);oParStruct.addToContent(oCommon.oParaComment)}}else if(c_oSerParType.OMathPara==type){var props={};res=this.bcr.Read1(length,function(t,l){return oThis.boMathr.ReadMathOMathPara(t,l,oParStruct,props)})}else if(c_oSerParType.OMath==type){var oMath=new ParaMath;oParStruct.addToContent(oMath);res=this.bcr.Read1(length,function(t,l){return oThis.boMathr.ReadMathArg(t, l,oMath.Root,oParStruct)});oMath.Root.Correct_Content(true)}else if(c_oSerParType.MRun==type){var props={};var oMRun=new ParaRun(oParStruct.paragraph,true);res=this.bcr.Read1(length,function(t,l){return oThis.boMathr.ReadMathMRun(t,l,oMRun,props,oParStruct,oParStruct)});oParStruct.addToContent(oMRun)}else if(c_oSerParType.Hyperlink==type){var oHyperlinkObj={Link:null,Anchor:null,Tooltip:null,History:null,DocLocation:null,TgtFrame:null};var oNewHyperlink=new ParaHyperlink;oNewHyperlink.SetParagraph(oParStruct.paragraph); res=this.bcr.Read1(length,function(t,l){return oThis.ReadHyperlink(t,l,oHyperlinkObj,oNewHyperlink,oParStruct)});if(null!=oHyperlinkObj.Link)oNewHyperlink.SetValue(oHyperlinkObj.Link);if(null!=oHyperlinkObj.Tooltip)oNewHyperlink.SetToolTip(oHyperlinkObj.Tooltip);if(null!=oHyperlinkObj.Anchor)oNewHyperlink.SetAnchor(oHyperlinkObj.Anchor);oParStruct.addToContent(oNewHyperlink);oNewHyperlink.Check_Content()}else if(c_oSerParType.FldSimple==type){var oFldSimpleObj={ParaField:null};res=this.bcr.Read1(length, function(t,l){return oThis.ReadFldSimple(t,l,oFldSimpleObj,oParStruct)});if(null!=oFldSimpleObj.ParaField){oParStruct.addElem(oFldSimpleObj.ParaField);oParStruct.commitElem()}}else if(c_oSerParType.Del==type&&this.oReadResult.checkReadRevisions()){var reviewInfo=new CReviewInfo;var startPos=oParStruct.getCurPos();res=this.bcr.Read1(length,function(t,l){return ReadTrackRevision(t,l,oThis.stream,reviewInfo,{parStruct:oParStruct,bdtr:oThis})});var endPos=oParStruct.getCurPos();for(var i=startPos;i=g_nErrorCharCount)throw new Error(g_sErrorCharCountMessage);}if(this.nCurCommentsCount>0)for(var i in this.oCurComments)this.oCurComments[i]+=text;this.ReadText(text,oParStruct,false)}else if(c_oSerRunType.tab===type)oNewElem=new ParaTab;else if(c_oSerRunType.pagenum===type)oNewElem=new ParaPageNum;else if(c_oSerRunType.pagebreak===type)oNewElem=new ParaNewLine(break_Page);else if(c_oSerRunType.linebreak===type)oNewElem=new ParaNewLine(break_Line);else if(c_oSerRunType.columnbreak=== type)oNewElem=new ParaNewLine(break_Column);else if(c_oSerRunType.image===type){var oThis=this;var image={page:null,Type:null,MediaId:null,W:null,H:null,X:null,Y:null,Paddings:null};res=this.bcr.Read2(length,function(t,l){return oThis.ReadImage(t,l,image)});if(c_oAscWrapStyle.Inline==image.Type&&null!=image.MediaId&&null!=image.W&&null!=image.H||c_oAscWrapStyle.Flow==image.Type&&null!=image.MediaId&&null!=image.W&&null!=image.H&&null!=image.X&&null!=image.Y){var doc=this.Document;var drawing=new ParaDrawing(image.W, image.H,null,doc.DrawingDocument,doc,oParStruct.paragraph);var src=this.oReadResult.ImageMap[image.MediaId];var Image=editor.WordControl.m_oLogicDocument.DrawingObjects.createImage(src,0,0,image.W,image.H);drawing.Set_GraphicObject(Image);Image.setParent(drawing);if(c_oAscWrapStyle.Flow==image.Type){drawing.Set_DrawingType(drawing_Anchor);drawing.Set_PositionH(Asc.c_oAscRelativeFromH.Page,false,image.X,false);drawing.Set_PositionV(Asc.c_oAscRelativeFromV.Page,false,image.Y,false);if(image.Paddings)drawing.Set_Distance(image.Paddings.Left, image.Paddings.Top,image.Paddings.Right,image.Paddings.Bottom)}if(null!=drawing.GraphicObj){pptx_content_loader.ImageMapChecker[src]=true;oNewElem=drawing}}}else if(c_oSerRunType.pptxDrawing===type){var oDrawing=new Object;this.ReadDrawing(type,length,oParStruct,oDrawing,res);if(null!=oDrawing.content.GraphicObj)oNewElem=oDrawing.content}else if(c_oSerRunType.fldstart_deprecated===type){var sField=this.stream.GetString2LE(length);var oField=this.parseField(sField,oParStruct.paragraph);if(null!=oField)oParStruct.addElem(oField); this.aFields.push(oField)}else if(c_oSerRunType.fldend_deprecated===type){var elem=this.aFields.pop();if(elem)oParStruct.commitElem()}else if(c_oSerRunType.fldChar===type)res=this.bcr.Read1(length,function(t,l){return oThis.ReadFldChar(t,l,oParStruct)});else if(c_oSerRunType.instrText===type||c_oSerRunType.delInstrText===type)this.ReadText(this.stream.GetString2LE(length),oParStruct,true);else if(c_oSerRunType._LastRun===type)this.oReadResult.bLastRun=true;else if(c_oSerRunType.object===type){var oDrawing= new Object;res=this.bcr.Read1(length,function(t,l){return oThis.ReadObject(t,l,oParStruct,oDrawing)});if(null!=oDrawing.content.GraphicObj){oNewElem=oDrawing.content;if(oDrawing.ParaMath&&oNewElem.GraphicObj.getImageUrl&&"image-1.jpg"===oNewElem.GraphicObj.getImageUrl())this.oReadResult.drawingToMath.push(oNewElem)}}else if(c_oSerRunType.cr===type)oNewElem=new ParaNewLine(break_Line);else if(c_oSerRunType.nonBreakHyphen===type){oNewElem=new ParaText(45);oNewElem.Set_SpaceAfter(false)}else if(c_oSerRunType.softHyphen=== type);else if(c_oSerRunType.separator===type)oNewElem=new ParaSeparator;else if(c_oSerRunType.continuationSeparator===type)oNewElem=new ParaContinuationSeparator;else if(c_oSerRunType.footnoteRef===type)if(this.curNote)oNewElem=new ParaFootnoteRef(this.curNote);else{if(this.oReadResult&&this.oReadResult.bCopyPaste&&this.openParams.oDocument)oNewElem=new ParaFootnoteRef(this.openParams.oDocument)}else if(c_oSerRunType.footnoteReference===type){var ref={id:null,customMark:null};res=this.bcr.Read1(length, function(t,l){return oThis.ReadNoteRef(t,l,ref)});var footnote=this.oReadResult.footnotes[ref.id];if(footnote&&this.oReadResult.logicDocument){this.oReadResult.logicDocument.Footnotes.AddFootnote(footnote.content);oNewElem=new ParaFootnoteReference(footnote.content,ref.customMark)}}else if(c_oSerRunType.endnoteRef===type)if(this.curNote)oNewElem=new ParaEndnoteRef(this.curNote);else{if(this.oReadResult&&this.oReadResult.bCopyPaste&&this.openParams.oDocument)oNewElem=new ParaEndnoteRef(this.openParams.oDocument)}else if(c_oSerRunType.endnoteReference=== type){var ref={id:null,customMark:null};res=this.bcr.Read1(length,function(t,l){return oThis.ReadNoteRef(t,l,ref)});var endnote=this.oReadResult.endnotes[ref.id];if(endnote&&this.oReadResult.logicDocument){this.oReadResult.logicDocument.Endnotes.AddEndnote(endnote.content);oNewElem=new ParaEndnoteReference(endnote.content,ref.customMark)}}else res=c_oSerConstants.ReadUnknown;if(null!=oNewElem)oParStruct.addElemToContent(oNewElem);return res};this.ReadNoteRef=function(type,length,ref){var res=c_oSerConstants.ReadOk; if(c_oSerNotes.RefCustomMarkFollows===type)ref.customMark=this.stream.GetBool();else if(c_oSerNotes.RefId===type)ref.id=this.stream.GetULongLE();else res=c_oSerConstants.ReadUnknown;return res};this.ReadDrawing=function(type,length,oParStruct,oDrawing,res){var oThis=this;var doc=this.Document;var graphicFramePr={locks:0};var oParaDrawing=new ParaDrawing(null,null,null,doc.DrawingDocument,doc,oParStruct.paragraph);res=this.bcr.Read2(length,function(t,l){return oThis.ReadPptxDrawing(t,l,oParaDrawing, graphicFramePr)});if(null!=oParaDrawing.SimplePos)oParaDrawing.setSimplePos(oParaDrawing.SimplePos.Use,oParaDrawing.SimplePos.X,oParaDrawing.SimplePos.Y);if(null!=oParaDrawing.Extent)oParaDrawing.setExtent(oParaDrawing.Extent.W,oParaDrawing.Extent.H);if(null!=oParaDrawing.wrappingPolygon)oParaDrawing.addWrapPolygon(oParaDrawing.wrappingPolygon);if(oDrawing.ParaMath)oParaDrawing.Set_ParaMath(oDrawing.ParaMath);if(oParaDrawing.GraphicObj){if(oParaDrawing.GraphicObj.setLocks&&graphicFramePr.locks>0)oParaDrawing.GraphicObj.setLocks(graphicFramePr.locks); if(oParaDrawing.GraphicObj.getObjectType()!==AscDFH.historyitem_type_ChartSpace)if(!oParaDrawing.GraphicObj.spPr)oParaDrawing.GraphicObj=null;if(AscCommon.isRealObject(oParaDrawing.docPr)&&oParaDrawing.docPr.isHidden)oParaDrawing.GraphicObj=null;if(oParaDrawing.GraphicObj){if(oParaDrawing.GraphicObj.bEmptyTransform){var oXfrm=new AscFormat.CXfrm;oXfrm.setOffX(0);oXfrm.setOffY(0);oXfrm.setChOffX(0);oXfrm.setChOffY(0);oXfrm.setExtX(oParaDrawing.Extent.W);oXfrm.setExtY(oParaDrawing.Extent.H);oXfrm.setChExtX(oParaDrawing.Extent.W); oXfrm.setChExtY(oParaDrawing.Extent.H);oXfrm.setParent(oParaDrawing.GraphicObj.spPr);oParaDrawing.GraphicObj.spPr.setXfrm(oXfrm);delete oParaDrawing.GraphicObj.bEmptyTransform}if(drawing_Anchor==oParaDrawing.DrawingType&&typeof AscCommon.History.RecalcData_Add==="function")AscCommon.History.RecalcData_Add({Type:AscDFH.historyitem_recalctype_Flow,Data:oParaDrawing})}}oDrawing.content=oParaDrawing};this.ReadObject=function(type,length,oParStruct,oDrawing){var res=c_oSerConstants.ReadOk;var oThis=this; if(c_oSerParType.OMath===type){if(length>0){var oMathPara=new ParaMath;oDrawing.ParaMath=oMathPara;res=this.bcr.Read1(length,function(t,l){return oThis.boMathr.ReadMathArg(t,l,oMathPara.Root,oParStruct)});oMathPara.Root.Correct_Content(true)}}else if(c_oSerRunType.pptxDrawing===type)this.ReadDrawing(type,length,oParStruct,oDrawing,res);else res=c_oSerConstants.ReadUnknown;return res};this.parseField=function(fld,paragraph){var sFieldType="";var aArguments=[];var aSwitches=[];var aParts=this.splitFieldArguments(fld); if(aParts.length>0){sFieldType=aParts[0].toUpperCase();var bSwitch=false;var sCurSwitch="";for(var i=1;i1&&"\\"==part[0]&&'"'!=part[1]&&"\\"!=part[1]){if(sCurSwitch.length>0)aSwitches.push(sCurSwitch);bSwitch=true;sCurSwitch=part.substring(1)}else if(bSwitch)sCurSwitch+=" "+part;else aArguments.push(this.parseFieldArgument(part))}if(sCurSwitch.length>0)aSwitches.push(sCurSwitch)}return this.initField(sFieldType,aArguments,aSwitches,paragraph)}; this.splitFieldArguments=function(sVal){var temp=String.fromCharCode(5);sVal=sVal.replace(/\\"/g,temp);var aMatch=sVal.match(/[^\s"]+|"[^"]*"/g);if(null!=aMatch)for(var i=0;i1&&'"'==sVal[0]&&'"'==sVal[sVal.length-1])sVal=sVal.substring(1,sVal.length-1);sVal=sVal.replace(/\\([\\"])/g,"$1");return sVal};this.initField= function(sFieldType,aArguments,aSwitches,paragraph){var oRes=null;if("HYPERLINK"==sFieldType){var sLink=null;var sLocation=null;var sTooltip=null;if(aArguments.length>0)sLink=aArguments[0];for(var i=0;i0){var cFirstChar=sSwitch[0].toLowerCase();var sFieldArgument=this.parseFieldArgument(sSwitch.substring(1));if("l"==cFirstChar)sLocation=sFieldArgument;else if("o"==cFirstChar)sTooltip=sFieldArgument}}if(!(null!=sLocation&&sLocation.length> 0)){oRes=new ParaHyperlink;oRes.SetParagraph(paragraph);if(null!=sLink&&sLink.length>0)oRes.SetValue(sLink);if(null!=sTooltip&&sTooltip.length>0)oRes.SetToolTip(sTooltip)}}else if("PAGE"==sFieldType)oRes=new ParaField(fieldtype_PAGENUM,aArguments,aSwitches);else if("NUMPAGES"==sFieldType)oRes=new ParaField(fieldtype_PAGECOUNT,aArguments,aSwitches);else if("MERGEFIELD"==sFieldType){oRes=new ParaField(fieldtype_MERGEFIELD,aArguments,aSwitches);if(editor)editor.WordControl.m_oLogicDocument.Register_Field(oRes)}else if("FORMTEXT"== sFieldType){oRes=new ParaField(fieldtype_FORMTEXT,aArguments,aSwitches);if(editor)editor.WordControl.m_oLogicDocument.Register_Field(oRes)}else if("SEQ"==sFieldType){oRes=new ParaField(fieldtype_SEQ,aArguments,aSwitches);if(editor)editor.WordControl.m_oLogicDocument.Register_Field(oRes)}else if("STYLEREF"==sFieldType){oRes=new ParaField(fieldtype_STYLEREF,aArguments,aSwitches);if(editor)editor.WordControl.m_oLogicDocument.Register_Field(oRes)}return oRes};this.ReadImage=function(type,length,img){var res= c_oSerConstants.ReadOk;if(c_oSerImageType.Page===type)img.page=this.stream.GetULongLE();else if(c_oSerImageType.MediaId===type)img.MediaId=this.stream.GetULongLE();else if(c_oSerImageType.Type===type)img.Type=this.stream.GetUChar();else if(c_oSerImageType.Width===type)img.W=this.bcr.ReadDouble();else if(c_oSerImageType.Height===type)img.H=this.bcr.ReadDouble();else if(c_oSerImageType.X===type)img.X=this.bcr.ReadDouble();else if(c_oSerImageType.Y===type)img.Y=this.bcr.ReadDouble();else if(c_oSerImageType.Padding=== type){var oThis=this;img.Paddings={Left:0,Top:0,Right:0,Bottom:0};res=this.bcr.Read2(length,function(t,l){return oThis.btblPrr.ReadPaddings(t,l,img.Paddings)})}else res=c_oSerConstants.ReadUnknown;return res};this.ReadPptxDrawing=function(type,length,oParaDrawing,graphicFramePr){var res=c_oSerConstants.ReadOk;var oThis=this;var emu;if(c_oSerImageType2.Type===type){var nDrawingType=null;switch(this.stream.GetUChar()){case c_oAscWrapStyle.Inline:nDrawingType=drawing_Inline;break;case c_oAscWrapStyle.Flow:nDrawingType= drawing_Anchor;break}if(null!=nDrawingType)oParaDrawing.Set_DrawingType(nDrawingType)}else if(c_oSerImageType2.PptxData===type)if(length>0){var grObject=pptx_content_loader.ReadDrawing(this,this.stream,this.Document,oParaDrawing);if(null!=grObject)oParaDrawing.Set_GraphicObject(grObject)}else res=c_oSerConstants.ReadUnknown;else if(c_oSerImageType2.Chart2===type){res=c_oSerConstants.ReadUnknown;var oNewChartSpace=new AscFormat.CChartSpace;var oBinaryChartReader=new AscCommon.BinaryChartReader(this.stream); res=oBinaryChartReader.ExternalReadCT_ChartSpace(length,oNewChartSpace,this.Document);oNewChartSpace.setBDeleted(false);oParaDrawing.Set_GraphicObject(oNewChartSpace);oNewChartSpace.setParent(oParaDrawing)}else if(c_oSerImageType2.AllowOverlap===type)var AllowOverlap=this.stream.GetBool();else if(c_oSerImageType2.BehindDoc===type)oParaDrawing.Set_BehindDoc(this.stream.GetBool());else if(c_oSerImageType2.DistL===type)oParaDrawing.Set_Distance(Math.abs(this.bcr.ReadDouble()),null,null,null);else if(c_oSerImageType2.DistLEmu=== type){emu=AscFonts.FT_Common.IntToUInt(this.stream.GetULongLE());oParaDrawing.Set_Distance(Math.abs(g_dKoef_emu_to_mm*emu),null,null,null)}else if(c_oSerImageType2.DistT===type)oParaDrawing.Set_Distance(null,Math.abs(this.bcr.ReadDouble()),null,null);else if(c_oSerImageType2.DistTEmu===type){emu=AscFonts.FT_Common.IntToUInt(this.stream.GetULongLE());oParaDrawing.Set_Distance(null,Math.abs(g_dKoef_emu_to_mm*emu),null,null)}else if(c_oSerImageType2.DistR===type)oParaDrawing.Set_Distance(null,null,Math.abs(this.bcr.ReadDouble()), null);else if(c_oSerImageType2.DistREmu===type){emu=AscFonts.FT_Common.IntToUInt(this.stream.GetULongLE());oParaDrawing.Set_Distance(null,null,Math.abs(g_dKoef_emu_to_mm*emu),null)}else if(c_oSerImageType2.DistB===type)oParaDrawing.Set_Distance(null,null,null,Math.abs(this.bcr.ReadDouble()));else if(c_oSerImageType2.DistBEmu===type){emu=AscFonts.FT_Common.IntToUInt(this.stream.GetULongLE());oParaDrawing.Set_Distance(null,null,null,Math.abs(g_dKoef_emu_to_mm*emu))}else if(c_oSerImageType2.Hidden=== type)var Hidden=this.stream.GetBool();else if(c_oSerImageType2.LayoutInCell===type)oParaDrawing.Set_LayoutInCell(this.stream.GetBool());else if(c_oSerImageType2.Locked===type)oParaDrawing.Set_Locked(this.stream.GetBool());else if(c_oSerImageType2.RelativeHeight===type)oParaDrawing.Set_RelativeHeight(AscFonts.FT_Common.IntToUInt(this.stream.GetULongLE()));else if(c_oSerImageType2.BSimplePos===type)oParaDrawing.SimplePos.Use=this.stream.GetBool();else if(c_oSerImageType2.EffectExtent===type){var oReadEffectExtent= {Left:null,Top:null,Right:null,Bottom:null};res=this.bcr.Read2(length,function(t,l){return oThis.ReadEffectExtent(t,l,oReadEffectExtent)});oParaDrawing.setEffectExtent(oReadEffectExtent.L,oReadEffectExtent.T,oReadEffectExtent.R,oReadEffectExtent.B)}else if(c_oSerImageType2.Extent===type)res=this.bcr.Read2(length,function(t,l){return oThis.ReadExtent(t,l,oParaDrawing.Extent)});else if(c_oSerImageType2.PositionH===type){var oNewPositionH={RelativeFrom:Asc.c_oAscRelativeFromH.Column,Align:false,Value:0, Percent:false};res=this.bcr.Read2(length,function(t,l){return oThis.ReadPositionHV(t,l,oNewPositionH)});oParaDrawing.Set_PositionH(oNewPositionH.RelativeFrom,oNewPositionH.Align,oNewPositionH.Value,oNewPositionH.Percent)}else if(c_oSerImageType2.PositionV===type){var oNewPositionV={RelativeFrom:Asc.c_oAscRelativeFromV.Paragraph,Align:false,Value:0,Percent:false};res=this.bcr.Read2(length,function(t,l){return oThis.ReadPositionHV(t,l,oNewPositionV)});oParaDrawing.Set_PositionV(oNewPositionV.RelativeFrom, oNewPositionV.Align,oNewPositionV.Value,oNewPositionV.Percent)}else if(c_oSerImageType2.SimplePos===type)res=this.bcr.Read2(length,function(t,l){return oThis.ReadSimplePos(t,l,oParaDrawing.SimplePos)});else if(c_oSerImageType2.WrapNone===type)oParaDrawing.Set_WrappingType(WRAPPING_TYPE_NONE);else if(c_oSerImageType2.SizeRelH===type){var oNewSizeRel={RelativeFrom:null,Percent:null};res=this.bcr.Read2(length,function(t,l){return oThis.ReadSizeRelHV(t,l,oNewSizeRel)});oParaDrawing.SetSizeRelH(oNewSizeRel)}else if(c_oSerImageType2.SizeRelV=== type){var oNewSizeRel={RelativeFrom:null,Percent:null};res=this.bcr.Read2(length,function(t,l){return oThis.ReadSizeRelHV(t,l,oNewSizeRel)});oParaDrawing.SetSizeRelV(oNewSizeRel)}else if(c_oSerImageType2.WrapSquare===type){oParaDrawing.Set_WrappingType(WRAPPING_TYPE_SQUARE);res=this.bcr.Read2(length,function(t,l){return oThis.ReadWrapSquare(t,l,oParaDrawing.wrappingPolygon)})}else if(c_oSerImageType2.WrapThrough===type){oParaDrawing.Set_WrappingType(WRAPPING_TYPE_THROUGH);res=this.bcr.Read2(length, function(t,l){return oThis.ReadWrapThroughTight(t,l,oParaDrawing.wrappingPolygon)})}else if(c_oSerImageType2.WrapTight===type){oParaDrawing.Set_WrappingType(WRAPPING_TYPE_TIGHT);res=this.bcr.Read2(length,function(t,l){return oThis.ReadWrapThroughTight(t,l,oParaDrawing.wrappingPolygon)})}else if(c_oSerImageType2.WrapTopAndBottom===type){oParaDrawing.Set_WrappingType(WRAPPING_TYPE_TOP_AND_BOTTOM);res=this.bcr.Read2(length,function(t,l){return oThis.ReadWrapTopBottom(t,l,oParaDrawing.wrappingPolygon)})}else if(c_oSerImageType2.GraphicFramePr=== type)res=this.bcr.Read2(length,function(t,l){return oThis.ReadNvGraphicFramePr(t,l,graphicFramePr)});else if(c_oSerImageType2.DocPr===type)res=this.bcr.Read1(length,function(t,l){return oThis.ReadDocPr(t,l,oParaDrawing.docPr,oParaDrawing)});else if(c_oSerImageType2.CachedImage===type)if(null!=oParaDrawing.GraphicObj)oParaDrawing.GraphicObj.cachedImage=this.stream.GetString2LE(length);else res=c_oSerConstants.ReadUnknown;else res=c_oSerConstants.ReadUnknown;return res};this.ReadNvGraphicFramePr=function(type, length,graphicFramePr){var res=c_oSerConstants.ReadOk;var oThis=this;var value;if(c_oSerGraphicFramePr.NoChangeAspect===type){value=this.stream.GetBool();graphicFramePr.locks|=AscFormat.LOCKS_MASKS.noChangeAspect|(value?AscFormat.LOCKS_MASKS.noChangeAspect<<1:0)}else if(c_oSerGraphicFramePr.NoDrilldown===type){value=this.stream.GetBool();graphicFramePr.locks|=AscFormat.LOCKS_MASKS.noDrilldown|(value?AscFormat.LOCKS_MASKS.noDrilldown<<1:0)}else if(c_oSerGraphicFramePr.NoGrp===type){value=this.stream.GetBool(); graphicFramePr.locks|=AscFormat.LOCKS_MASKS.noGrp|(value?AscFormat.LOCKS_MASKS.noGrp<<1:0)}else if(c_oSerGraphicFramePr.NoMove===type){value=this.stream.GetBool();graphicFramePr.locks|=AscFormat.LOCKS_MASKS.noMove|(value?AscFormat.LOCKS_MASKS.noMove<<1:0)}else if(c_oSerGraphicFramePr.NoResize===type){value=this.stream.GetBool();graphicFramePr.locks|=AscFormat.LOCKS_MASKS.noResize|(value?AscFormat.LOCKS_MASKS.noResize<<1:0)}else if(c_oSerGraphicFramePr.NoSelect===type){value=this.stream.GetBool(); graphicFramePr.locks|=AscFormat.LOCKS_MASKS.noSelect|(value?AscFormat.LOCKS_MASKS.noSelect<<1:0)}else res=c_oSerConstants.ReadUnknown;return res};this.ReadDocPr=function(type,length,docPr,oParaDrawing){var res=c_oSerConstants.ReadOk;var oThis=this;if(c_oSerDocPr.Id===type)docPr.setId(this.stream.GetLongLE());else if(c_oSerDocPr.Name===type)docPr.setName(this.stream.GetString2LE(length));else if(c_oSerDocPr.Hidden===type)docPr.setIsHidden(this.stream.GetBool());else if(c_oSerDocPr.Title===type)docPr.setTitle(this.stream.GetString2LE(length)); else if(c_oSerDocPr.Descr===type)docPr.setDescr(this.stream.GetString2LE(length));else if(c_oSerDocPr.Form===type)oParaDrawing.SetForm(this.stream.GetBool());else res=c_oSerConstants.ReadUnknown;return res};this.ReadEffectExtent=function(type,length,oEffectExtent){var res=c_oSerConstants.ReadOk;var oThis=this;if(c_oSerEffectExtent.Left===type)oEffectExtent.L=this.bcr.ReadDouble();else if(c_oSerEffectExtent.Top===type)oEffectExtent.T=this.bcr.ReadDouble();else if(c_oSerEffectExtent.Right===type)oEffectExtent.R= this.bcr.ReadDouble();else if(c_oSerEffectExtent.Bottom===type)oEffectExtent.B=this.bcr.ReadDouble();else if(c_oSerEffectExtent.LeftEmu===type)oEffectExtent.L=g_dKoef_emu_to_mm*this.stream.GetLongLE();else if(c_oSerEffectExtent.TopEmu===type)oEffectExtent.T=g_dKoef_emu_to_mm*this.stream.GetLongLE();else if(c_oSerEffectExtent.RightEmu===type)oEffectExtent.R=g_dKoef_emu_to_mm*this.stream.GetLongLE();else if(c_oSerEffectExtent.BottomEmu===type)oEffectExtent.B=g_dKoef_emu_to_mm*this.stream.GetLongLE(); else res=c_oSerConstants.ReadUnknown;return res};this.ReadExtent=function(type,length,oExtent){var res=c_oSerConstants.ReadOk;var oThis=this;if(c_oSerExtent.Cx===type)oExtent.W=this.bcr.ReadDouble();else if(c_oSerExtent.Cy===type)oExtent.H=this.bcr.ReadDouble();else if(c_oSerExtent.CxEmu===type)oExtent.W=g_dKoef_emu_to_mm*this.stream.GetULongLE();else if(c_oSerExtent.CyEmu===type)oExtent.H=g_dKoef_emu_to_mm*this.stream.GetULongLE();else res=c_oSerConstants.ReadUnknown;return res};this.ReadPositionHV= function(type,length,PositionH){var res=c_oSerConstants.ReadOk;var oThis=this;if(c_oSerPosHV.RelativeFrom===type)PositionH.RelativeFrom=this.stream.GetUChar();else if(c_oSerPosHV.Align===type){PositionH.Align=true;PositionH.Value=this.stream.GetUChar()}else if(c_oSerPosHV.PosOffset===type){PositionH.Align=false;PositionH.Value=this.bcr.ReadDouble()}else if(c_oSerPosHV.PosOffsetEmu===type){PositionH.Align=false;PositionH.Value=g_dKoef_emu_to_mm*this.stream.GetLongLE()}else if(c_oSerPosHV.PctOffset=== type){PositionH.Percent=true;PositionH.Value=this.bcr.ReadDouble()}else res=c_oSerConstants.ReadUnknown;return res};this.ReadSizeRelHV=function(type,length,SizeRel){var res=c_oSerConstants.ReadOk;var oThis=this;if(c_oSerSizeRelHV.RelativeFrom===type)SizeRel.RelativeFrom=this.stream.GetUChar();else if(c_oSerSizeRelHV.Pct===type)SizeRel.Percent=this.bcr.ReadDouble()/100;else res=c_oSerConstants.ReadUnknown;return res};this.ReadSimplePos=function(type,length,oSimplePos){var res=c_oSerConstants.ReadOk; var oThis=this;if(c_oSerSimplePos.X===type)oSimplePos.X=this.bcr.ReadDouble();else if(c_oSerSimplePos.Y===type)oSimplePos.Y=this.bcr.ReadDouble();else if(c_oSerSimplePos.XEmu===type)oSimplePos.X=g_dKoef_emu_to_mm*this.stream.GetLongLE();else if(c_oSerSimplePos.YEmu===type)oSimplePos.Y=g_dKoef_emu_to_mm*this.stream.GetLongLE();else res=c_oSerConstants.ReadUnknown;return res};this.ReadWrapSquare=function(type,length,wrappingPolygon){var res=c_oSerConstants.ReadOk;var oThis=this;if(c_oSerWrapSquare.DistL=== type)var DistL=this.bcr.ReadDouble();else if(c_oSerWrapSquare.DistT===type)var DistT=this.bcr.ReadDouble();else if(c_oSerWrapSquare.DistR===type)var DistR=this.bcr.ReadDouble();else if(c_oSerWrapSquare.DistB===type)var DistB=this.bcr.ReadDouble();else if(c_oSerWrapSquare.DistLEmu===type)var DistL=g_dKoef_emu_to_mm*this.stream.GetULongLE();else if(c_oSerWrapSquare.DistTEmu===type)var DistT=g_dKoef_emu_to_mm*this.stream.GetULongLE();else if(c_oSerWrapSquare.DistREmu===type)var DistR=g_dKoef_emu_to_mm* this.stream.GetULongLE();else if(c_oSerWrapSquare.DistBEmu===type)var DistB=g_dKoef_emu_to_mm*this.stream.GetULongLE();else if(c_oSerWrapSquare.WrapText===type)var WrapText=this.stream.GetUChar();else if(c_oSerWrapSquare.EffectExtent===type){var EffectExtent={Left:null,Top:null,Right:null,Bottom:null};res=this.bcr.Read2(length,function(t,l){return oThis.ReadEffectExtent(t,l,EffectExtent)})}else res=c_oSerConstants.ReadUnknown;return res};this.ReadWrapThroughTight=function(type,length,wrappingPolygon){var res= c_oSerConstants.ReadOk;var oThis=this;if(c_oSerWrapThroughTight.DistL===type)var DistL=this.bcr.ReadDouble();else if(c_oSerWrapThroughTight.DistR===type)var DistR=this.bcr.ReadDouble();else if(c_oSerWrapThroughTight.DistLEmu===type)var DistL=g_dKoef_emu_to_mm*this.stream.GetULongLE();else if(c_oSerWrapThroughTight.DistREmu===type)var DistR=g_dKoef_emu_to_mm*this.stream.GetULongLE();else if(c_oSerWrapThroughTight.WrapText===type)var WrapText=this.stream.GetUChar();else if(c_oSerWrapThroughTight.WrapPolygon=== type&&wrappingPolygon!==undefined){wrappingPolygon.tempArrPoints=[];var oStartRes={start:null};res=this.bcr.Read2(length,function(t,l){return oThis.ReadWrapPolygon(t,l,wrappingPolygon,oStartRes)});if(null!=oStartRes.start)wrappingPolygon.tempArrPoints.unshift(oStartRes.start);wrappingPolygon.setArrRelPoints(wrappingPolygon.tempArrPoints);delete wrappingPolygon.tempArrPoints}else res=c_oSerConstants.ReadUnknown;return res};this.ReadWrapTopBottom=function(type,length,wrappingPolygon){var res=c_oSerConstants.ReadOk; var oThis=this;if(c_oSerWrapTopBottom.DistT===type)var DistT=this.bcr.ReadDouble();else if(c_oSerWrapTopBottom.DistB===type)var DistB=this.bcr.ReadDouble();else if(c_oSerWrapTopBottom.DistTEmu===type)var DistT=g_dKoef_emu_to_mm*this.stream.GetULongLE();else if(c_oSerWrapTopBottom.DistBEmu===type)var DistB=g_dKoef_emu_to_mm*this.stream.GetULongLE();else if(c_oSerWrapTopBottom.EffectExtent===type){var EffectExtent={L:null,T:null,R:null,B:null};res=this.bcr.Read2(length,function(t,l){return oThis.ReadEffectExtent(t, l,EffectExtent)})}else res=c_oSerConstants.ReadUnknown;return res};this.ReadWrapPolygon=function(type,length,wrappingPolygon,oStartRes){var res=c_oSerConstants.ReadOk;var oThis=this;if(c_oSerWrapPolygon.Edited===type)wrappingPolygon.setEdited(this.stream.GetBool());else if(c_oSerWrapPolygon.Start===type){oStartRes.start=new CPolygonPoint;res=this.bcr.Read2(length,function(t,l){return oThis.ReadPolygonPoint(t,l,oStartRes.start)})}else if(c_oSerWrapPolygon.ALineTo===type)res=this.bcr.Read2(length,function(t, l){return oThis.ReadLineTo(t,l,wrappingPolygon.tempArrPoints)});else res=c_oSerConstants.ReadUnknown;return res};this.ReadLineTo=function(type,length,arrPoints){var res=c_oSerConstants.ReadOk;var oThis=this;if(c_oSerWrapPolygon.LineTo===type){var oPoint=new CPolygonPoint;res=this.bcr.Read2(length,function(t,l){return oThis.ReadPolygonPoint(t,l,oPoint)});arrPoints.push(oPoint)}else res=c_oSerConstants.ReadUnknown;return res};this.ReadPolygonPoint=function(type,length,oPoint){var res=c_oSerConstants.ReadOk; var oThis=this;if(c_oSerPoint2D.X===type)oPoint.x=this.bcr.ReadDouble()*36E3>>0;else if(c_oSerPoint2D.Y===type)oPoint.y=this.bcr.ReadDouble()*36E3>>0;else if(c_oSerPoint2D.XEmu===type)oPoint.x=this.stream.GetLongLE();else if(c_oSerPoint2D.YEmu===type)oPoint.y=this.stream.GetLongLE();else res=c_oSerConstants.ReadUnknown;return res};this.ReadDocTable=function(type,length,table,tableFlow){var res=c_oSerConstants.ReadOk;var oThis=this;if(c_oSerDocTableType.tblPr===type){table.Set_TableStyle2(null);var oNewTablePr= new CTablePr;res=this.bcr.Read1(length,function(t,l){return oThis.btblPrr.Read_tblPr(t,l,oNewTablePr,table)});table.Pr=oNewTablePr;this.oReadResult.aPostOpenStyleNumCallbacks.push(function(){table.Set_Pr(oNewTablePr)})}else if(c_oSerDocTableType.tblGrid===type){var aNewGrid=[];res=this.bcr.Read2(length,function(t,l){return oThis.Read_tblGrid(t,l,aNewGrid,table)});table.SetTableGrid(aNewGrid)}else if(c_oSerDocTableType.Content===type){res=this.bcr.Read1(length,function(t,l){return oThis.Read_TableContent(t, l,table)});if(table.Content.length>0)table.CurCell=table.Content[0].Get_Cell(0)}else res=c_oSerConstants.ReadUnknown;return res};this.Read_tblGrid=function(type,length,tblGrid,table){var oThis=this;var res=c_oSerConstants.ReadOk;if(c_oSerDocTableType.tblGrid_Item===type)tblGrid.push(this.bcr.ReadDouble());else if(c_oSerDocTableType.tblGrid_ItemTwips===type)tblGrid.push(g_dKoef_twips_to_mm*this.stream.GetULongLE());else if(c_oSerDocTableType.tblGridChange===type&&table&&this.oReadResult.checkReadRevisions()&& (!this.oReadResult.bCopyPaste||this.oReadResult.isDocumentPasting())){var tblGridChange=[];var reviewInfo=new CReviewInfo;res=this.bcr.Read1(length,function(t,l){return ReadTrackRevision(t,l,oThis.stream,reviewInfo,{btblPrr:oThis,grid:tblGridChange})});table.SetTableGridChange(tblGridChange)}else res=c_oSerConstants.ReadUnknown;return res};this.Read_TableContent=function(type,length,table){var res=c_oSerConstants.ReadOk;var oThis=this;var Content=table.Content;if(c_oSerDocTableType.Row===type){var row= table.private_AddRow(table.Content.length,0);res=this.bcr.Read1(length,function(t,l){return oThis.Read_Row(t,l,row)});if(!(reviewtype_Common===row.GetReviewType()||this.oReadResult.checkReadRevisions()))table.private_RemoveRow(table.Content.length-1)}else if(c_oSerDocTableType.Sdt===type)res=this.bcr.Read1(length,function(t,l){return oThis.ReadSdt(t,l,null,2,table)});else if(c_oSerDocTableType.BookmarkStart===type){this.toNextParStruct.push(c_oToNextParType.BookmarkStart,this.stream.GetCurPos(),length); res=c_oSerConstants.ReadUnknown}else if(c_oSerDocTableType.BookmarkEnd===type){if(!readBookmarkEnd(length,this.bcr,this.stream,this.oReadResult,this.lastParStruct)){this.toNextParStruct.push(c_oToNextParType.BookmarkEnd,this.stream.GetCurPos(),length);res=c_oSerConstants.ReadUnknown}}else if(c_oSerDocTableType.MoveFromRangeStart===type){this.toNextParStruct.push(c_oToNextParType.MoveFromRangeStart,this.stream.GetCurPos(),length);res=c_oSerConstants.ReadUnknown}else if(c_oSerDocTableType.MoveFromRangeEnd=== type){if(!readMoveRangeEnd(length,this.bcr,this.stream,this.oReadResult,this.lastParStruct,true,true)){this.toNextParStruct.push(c_oToNextParType.MoveFromRangeEnd,this.stream.GetCurPos(),length);res=c_oSerConstants.ReadUnknown}}else if(c_oSerDocTableType.MoveToRangeStart===type&&this.oReadResult.checkReadRevisions()){this.toNextParStruct.push(c_oToNextParType.MoveToRangeStart,this.stream.GetCurPos(),length);res=c_oSerConstants.ReadUnknown}else if(c_oSerDocTableType.MoveToRangeEnd===type&&this.oReadResult.checkReadRevisions()){if(!readMoveRangeEnd(length, this.bcr,this.stream,this.oReadResult,this.lastParStruct,false,true)){this.toNextParStruct.push(c_oToNextParType.MoveToRangeEnd,this.stream.GetCurPos(),length);res=c_oSerConstants.ReadUnknown}}else res=c_oSerConstants.ReadUnknown;return res};this.Read_Row=function(type,length,Row){var res=c_oSerConstants.ReadOk;var oThis=this;if(c_oSerDocTableType.Row_Pr===type){var oNewRowPr=new CTableRowPr;res=this.bcr.Read2(length,function(t,l){return oThis.btblPrr.Read_RowPr(t,l,oNewRowPr,Row)});Row.Set_Pr(oNewRowPr)}else if(c_oSerDocTableType.Row_Content=== type)res=this.bcr.Read1(length,function(t,l){return oThis.ReadRowContent(t,l,Row)});else res=c_oSerConstants.ReadUnknown;return res};this.ReadRowContent=function(type,length,row){var res=c_oSerConstants.ReadOk;var oThis=this;var Content=row.Content;if(c_oSerDocTableType.Cell===type){var oCell=row.Add_Cell(row.Get_CellsCount(),row,null,false);res=this.bcr.Read1(length,function(t,l){return oThis.ReadCell(t,l,oCell)})}else if(c_oSerDocTableType.Sdt===type)res=this.bcr.Read1(length,function(t,l){return oThis.ReadSdt(t, l,null,3,row)});else if(c_oSerDocTableType.BookmarkStart===type){this.toNextParStruct.push(c_oToNextParType.BookmarkStart,this.stream.GetCurPos(),length);res=c_oSerConstants.ReadUnknown}else if(c_oSerDocTableType.BookmarkEnd===type){if(!readBookmarkEnd(length,this.bcr,this.stream,this.oReadResult,this.lastParStruct)){this.toNextParStruct.push(c_oToNextParType.BookmarkEnd,this.stream.GetCurPos(),length);res=c_oSerConstants.ReadUnknown}}else if(c_oSerDocTableType.MoveFromRangeStart===type){this.toNextParStruct.push(c_oToNextParType.MoveFromRangeStart, this.stream.GetCurPos(),length);res=c_oSerConstants.ReadUnknown}else if(c_oSerDocTableType.MoveFromRangeEnd===type){if(!readMoveRangeEnd(length,this.bcr,this.stream,this.oReadResult,this.lastParStruct,true,true)){this.toNextParStruct.push(c_oToNextParType.MoveFromRangeEnd,this.stream.GetCurPos(),length);res=c_oSerConstants.ReadUnknown}}else if(c_oSerDocTableType.MoveToRangeStart===type&&this.oReadResult.checkReadRevisions()){this.toNextParStruct.push(c_oToNextParType.MoveToRangeStart,this.stream.GetCurPos(), length);res=c_oSerConstants.ReadUnknown}else if(c_oSerDocTableType.MoveToRangeEnd===type&&this.oReadResult.checkReadRevisions()){if(!readMoveRangeEnd(length,this.bcr,this.stream,this.oReadResult,this.lastParStruct,false,true)){this.toNextParStruct.push(c_oToNextParType.MoveToRangeEnd,this.stream.GetCurPos(),length);res=c_oSerConstants.ReadUnknown}}else res=c_oSerConstants.ReadUnknown;return res};this.ReadCell=function(type,length,cell){var res=c_oSerConstants.ReadOk;var oThis=this;if(c_oSerDocTableType.Cell_Pr=== type){var oNewCellPr=new CTableCellPr;res=this.bcr.Read2(length,function(t,l){return oThis.btblPrr.Read_CellPr(t,l,oNewCellPr)});cell.Set_Pr(oNewCellPr)}else if(c_oSerDocTableType.Cell_Content===type){var oCellContent=[];var oCellContentReader=new Binary_DocumentTableReader(cell.Content,this.oReadResult,this.openParams,this.stream,this.curNote,this.oComments);oCellContentReader.aFields=this.aFields;oCellContentReader.nCurCommentsCount=this.nCurCommentsCount;oCellContentReader.oCurComments=this.oCurComments; oCellContentReader.toNextParStruct=this.toNextParStruct;oCellContentReader.lastParStruct=this.lastParStruct;oCellContentReader.Read(length,oCellContent);this.nCurCommentsCount=oCellContentReader.nCurCommentsCount;if(oCellContent.length>0){for(var i=0;i0){for(var i=0;i0)arrContent.push(row)}else res=c_oSerConstants.ReadUnknown; return res};this.ReadMathMc=function(type,length,props){var res=c_oSerConstants.ReadOk;var oThis=this;if(c_oSer_OMathContentType.McPr===type)res=this.bcr.Read1(length,function(t,l){return oThis.ReadMathMcPr(t,l,props)});else res=c_oSerConstants.ReadUnknown;return res};this.ReadMathMcJc=function(type,length,props){var res=c_oSerConstants.ReadOk;var oThis=this;if(c_oSer_OMathBottomNodesValType.Val===type){var mcJc=this.stream.GetUChar(length);switch(mcJc){case c_oAscXAlign.Center:props.mcJc=MCJC_CENTER; break;case c_oAscXAlign.Inside:props.mcJc=MCJC_INSIDE;break;case c_oAscXAlign.Left:props.mcJc=MCJC_LEFT;break;case c_oAscXAlign.Outside:props.mcJc=MCJC_OUTSIDE;break;case c_oAscXAlign.Right:props.mcJc=MCJC_RIGHT;break;default:props.mcJc=MCJC_CENTER}}else res=c_oSerConstants.ReadUnknown;return res};this.ReadMathMcPr=function(type,length,props){var res=c_oSerConstants.ReadOk;var oThis=this;if(c_oSer_OMathBottomNodesType.Count===type)res=this.bcr.Read2(length,function(t,l){return oThis.ReadMathCount(t, l,props)});else if(c_oSer_OMathBottomNodesType.McJc===type)res=this.bcr.Read2(length,function(t,l){return oThis.ReadMathMcJc(t,l,props)});else res=c_oSerConstants.ReadUnknown;return res};this.ReadMathMcs=function(type,length,props){var res=c_oSerConstants.ReadOk;var oThis=this;if(c_oSer_OMathContentType.Mc===type){var mc={};res=this.bcr.Read1(length,function(t,l){return oThis.ReadMathMc(t,l,mc)});props.mcs.push(mc)}else res=c_oSerConstants.ReadUnknown;return res};this.ReadMathMJc=function(type,length, props){var res=c_oSerConstants.ReadOk;var oThis=this;if(c_oSer_OMathBottomNodesValType.Val===type){var mJc=this.stream.GetUChar(length);switch(mJc){case c_oAscMathJc.Center:props.mJc=JC_CENTER;break;case c_oAscMathJc.CenterGroup:props.mJc=JC_CENTERGROUP;break;case c_oAscMathJc.Left:props.mJc=JC_LEFT;break;case c_oAscMathJc.Right:props.mJc=JC_RIGHT;break;default:props.mJc=JC_CENTERGROUP}}else res=c_oSerConstants.ReadUnknown;return res};this.ReadMathMPr=function(type,length,props){var res=c_oSerConstants.ReadOk; var oThis=this;if(c_oSer_OMathBottomNodesType.Row===type)res=this.bcr.Read2(length,function(t,l){return oThis.ReadMathRow(t,l,props)});else if(c_oSer_OMathBottomNodesType.BaseJc===type)res=this.bcr.Read2(length,function(t,l){return oThis.ReadMathBaseJc(t,l,props)});else if(c_oSer_OMathBottomNodesType.CGp===type)res=this.bcr.Read2(length,function(t,l){return oThis.ReadMathCGp(t,l,props)});else if(c_oSer_OMathBottomNodesType.CGpRule===type)res=this.bcr.Read2(length,function(t,l){return oThis.ReadMathCGpRule(t, l,props)});else if(c_oSer_OMathBottomNodesType.CSp===type)res=this.bcr.Read2(length,function(t,l){return oThis.ReadMathCSp(t,l,props)});else if(c_oSer_OMathBottomNodesType.CtrlPr===type)res=this.bcr.Read1(length,function(t,l){return oThis.ReadMathCtrlPr(t,l,props)});else if(c_oSer_OMathBottomNodesType.Mcs===type)res=this.bcr.Read1(length,function(t,l){return oThis.ReadMathMcs(t,l,props)});else if(c_oSer_OMathBottomNodesType.PlcHide===type)res=this.bcr.Read2(length,function(t,l){return oThis.ReadMathPlcHide(t, l,props)});else if(c_oSer_OMathBottomNodesType.RSp===type)res=this.bcr.Read2(length,function(t,l){return oThis.ReadMathRSp(t,l,props)});else if(c_oSer_OMathBottomNodesType.RSpRule===type)res=this.bcr.Read2(length,function(t,l){return oThis.ReadMathRSpRule(t,l,props)});else res=c_oSerConstants.ReadUnknown;return res};this.ReadMathMr=function(type,length,arrContent){var res=c_oSerConstants.ReadOk;var oThis=this;if(c_oSer_OMathContentType.Element===type){arrContent.push({pos:this.stream.GetCurPos(), length:length});res=c_oSerConstants.ReadUnknown}else res=c_oSerConstants.ReadUnknown;return res};this.ReadMathMaxDist=function(type,length,props){var res=c_oSerConstants.ReadOk;var oThis=this;if(c_oSer_OMathBottomNodesValType.Val===type)props.maxDist=this.stream.GetBool();else res=c_oSerConstants.ReadUnknown;return res};this.ReadMathText=function(type,length,oMRun){var res=c_oSerConstants.ReadOk;var oThis=this;if(c_oSer_OMathBottomNodesValType.Val===type){var aUnicodes=[];if(length>0)aUnicodes=AscCommon.convertUTF16toUnicode(this.stream.GetString2LE(length)); for(var nPos=0,nCount=aUnicodes.length;nPos0)AscCommonWord.Default_Tab_Stop=dNewTab_Stop}else if(c_oSer_SettingsType.DefaultTabStopTwips=== type){var dNewTab_Stop=g_dKoef_twips_to_mm*this.stream.GetULongLE();if(dNewTab_Stop>0)AscCommonWord.Default_Tab_Stop=dNewTab_Stop}else if(c_oSer_SettingsType.MathPr===type){var props=new CMathPropertiesSettings;res=this.bcr.Read1(length,function(t,l){return oThis.ReadMathPr(t,l,props)});editor.WordControl.m_oLogicDocument.Settings.MathSettings.SetPr(props)}else if(c_oSer_SettingsType.TrackRevisions===type&&!this.oReadResult.disableRevisions)this.oReadResult.trackRevisions=this.stream.GetBool();else if(c_oSer_SettingsType.FootnotePr=== type){var props={Format:null,restart:null,start:null,fntPos:null,endPos:null};res=this.bcr.Read1(length,function(t,l){return oThis.bpPrr.ReadNotePr(t,l,props,oThis.oReadResult.footnoteRefs)});if(this.oReadResult.logicDocument){var footnotes=this.oReadResult.logicDocument.Footnotes;if(null!=props.Format)footnotes.SetFootnotePrNumFormat(props.Format);if(null!=props.restart)footnotes.SetFootnotePrNumRestart(props.restart);if(null!=props.start)footnotes.SetFootnotePrNumStart(props.start);if(null!=props.fntPos)footnotes.SetFootnotePrPos(props.fntPos)}}else if(c_oSer_SettingsType.EndnotePr=== type){var props={Format:null,restart:null,start:null,fntPos:null,endPos:null};res=this.bcr.Read1(length,function(t,l){return oThis.bpPrr.ReadNotePr(t,l,props,oThis.oReadResult.endnoteRefs)});if(this.oReadResult.logicDocument){var endnotes=this.oReadResult.logicDocument.Endnotes;if(null!=props.Format)endnotes.SetEndnotePrNumFormat(props.Format);if(null!=props.restart)endnotes.SetEndnotePrNumRestart(props.restart);if(null!=props.start)endnotes.SetEndnotePrNumStart(props.start);if(null!=props.endPos)endnotes.SetEndnotePrPos(props.endPos)}}else if(c_oSer_SettingsType.SdtGlobalColor=== type){var textPr=new CTextPr;res=this.brPrr.Read(length,textPr,null);if(textPr.Color&&!textPr.Color.Auto)this.Document.SetSdtGlobalColor(textPr.Color.r,textPr.Color.g,textPr.Color.b)}else if(c_oSer_SettingsType.SdtGlobalShowHighlight===type)this.Document.SetSdtGlobalShowHighlight(this.stream.GetBool());else if(c_oSer_SettingsType.SpecialFormsHighlight===type){var textPr=new CTextPr;res=this.brPrr.Read(length,textPr,null);if(textPr.Color&&!textPr.Color.Auto)this.Document.SetSpecialFormsHighlight(textPr.Color.r, textPr.Color.g,textPr.Color.b)}else if(c_oSer_SettingsType.Compat===type)res=this.bcr.Read1(length,function(t,l){return oThis.ReadCompat(t,l)});else if(c_oSer_SettingsType.DecimalSymbol===type)editor.WordControl.m_oLogicDocument.Settings.DecimalSymbol=this.stream.GetString2LE(length);else if(c_oSer_SettingsType.ListSeparator===type)editor.WordControl.m_oLogicDocument.Settings.ListSeparator=this.stream.GetString2LE(length);else if(c_oSer_SettingsType.GutterAtTop===type)editor.WordControl.m_oLogicDocument.SetGutterAtTop(this.stream.GetBool()); else if(c_oSer_SettingsType.MirrorMargins===type)editor.WordControl.m_oLogicDocument.SetMirrorMargins(this.stream.GetBool());else res=c_oSerConstants.ReadUnknown;return res};this.ReadMathPr=function(type,length,props){var res=c_oSerConstants.ReadOk;var oThis=this;if(c_oSer_MathPrType.BrkBin===type)res=this.bcr.Read2(length,function(t,l){return oThis.ReadMathBrkBin(t,l,props)});else if(c_oSer_MathPrType.BrkBinSub===type)res=this.bcr.Read2(length,function(t,l){return oThis.ReadMathBrkBinSub(t,l,props)}); else if(c_oSer_MathPrType.DefJc===type)res=this.bcr.Read2(length,function(t,l){return oThis.ReadMathDefJc(t,l,props)});else if(c_oSer_MathPrType.DispDef===type)res=this.bcr.Read2(length,function(t,l){return oThis.ReadMathDispDef(t,l,props)});else if(c_oSer_MathPrType.InterSp===type)res=this.bcr.Read2(length,function(t,l){return oThis.ReadMathInterSp(t,l,props)});else if(c_oSer_MathPrType.IntLim===type)res=this.bcr.Read2(length,function(t,l){return oThis.ReadMathIntLim(t,l,props)});else if(c_oSer_MathPrType.IntraSp=== type)res=this.bcr.Read2(length,function(t,l){return oThis.ReadMathIntraSp(t,l,props)});else if(c_oSer_MathPrType.LMargin===type)res=this.bcr.Read2(length,function(t,l){return oThis.ReadMathLMargin(t,l,props)});else if(c_oSer_MathPrType.MathFont===type)res=this.bcr.Read2(length,function(t,l){return oThis.ReadMathMathFont(t,l,props)});else if(c_oSer_MathPrType.NaryLim===type)res=this.bcr.Read2(length,function(t,l){return oThis.ReadMathNaryLim(t,l,props)});else if(c_oSer_MathPrType.PostSp===type)res= this.bcr.Read2(length,function(t,l){return oThis.ReadMathPostSp(t,l,props)});else if(c_oSer_MathPrType.PreSp===type)res=this.bcr.Read2(length,function(t,l){return oThis.ReadMathPreSp(t,l,props)});else if(c_oSer_MathPrType.RMargin===type)res=this.bcr.Read2(length,function(t,l){return oThis.ReadMathRMargin(t,l,props)});else if(c_oSer_MathPrType.SmallFrac===type){props.smallFrac=true;res=this.bcr.Read2(length,function(t,l){return oThis.ReadMathSmallFrac(t,l,props)})}else if(c_oSer_MathPrType.WrapIndent=== type)res=this.bcr.Read2(length,function(t,l){return oThis.ReadMathWrapIndent(t,l,props)});else if(c_oSer_MathPrType.WrapRight===type){props.wrapRight=true;res=this.bcr.Read2(length,function(t,l){return oThis.ReadMathWrapRight(t,l,props)})}else res=c_oSerConstants.ReadUnknown;return res};this.ReadMathBrkBin=function(type,length,props){var res=c_oSerConstants.ReadOk;var oThis=this;if(c_oSer_OMathBottomNodesValType.Val===type){var brkBin=this.stream.GetUChar(length);switch(brkBin){case c_oAscBrkBin.After:props.brkBin= BREAK_AFTER;break;case c_oAscBrkBin.Before:props.brkBin=BREAK_BEFORE;break;case c_oAscBrkBin.Repeat:props.brkBin=BREAK_REPEAT;break;default:props.brkBin=BREAK_REPEAT}}else res=c_oSerConstants.ReadUnknown;return res};this.ReadMathBrkBinSub=function(type,length,props){var res=c_oSerConstants.ReadOk;var oThis=this;if(c_oSer_OMathBottomNodesValType.Val===type){var brkBinSub=this.stream.GetUChar(length);switch(brkBinSub){case c_oAscBrkBinSub.PlusMinus:props.brkBinSub=BREAK_PLUS_MIN;break;case c_oAscBrkBinSub.MinusPlus:props.brkBinSub= BREAK_MIN_PLUS;break;case c_oAscBrkBinSub.MinusMinus:props.brkBinSub=BREAK_MIN_MIN;break;default:props.brkBinSub=BREAK_MIN_MIN}}else res=c_oSerConstants.ReadUnknown;return res};this.ReadMathDefJc=function(type,length,props){var res=c_oSerConstants.ReadOk;var oThis=this;if(c_oSer_OMathBottomNodesValType.Val===type){var defJc=this.stream.GetUChar(length);switch(defJc){case c_oAscMathJc.Center:props.defJc=align_Center;break;case c_oAscMathJc.CenterGroup:props.defJc=align_Justify;break;case c_oAscMathJc.Left:props.defJc= align_Left;break;case c_oAscMathJc.Right:props.defJc=align_Right;break;default:props.defJc=align_Justify}}else res=c_oSerConstants.ReadUnknown;return res};this.ReadMathDispDef=function(type,length,props){var res=c_oSerConstants.ReadOk;var oThis=this;if(c_oSer_OMathBottomNodesValType.Val===type)props.dispDef=this.stream.GetBool();else res=c_oSerConstants.ReadUnknown;return res};this.ReadMathInterSp=function(type,length,props){var res=c_oSerConstants.ReadOk;var oThis=this;if(c_oSer_OMathBottomNodesValType.Val=== type)props.interSp=this.bcr.ReadDouble();else if(c_oSer_OMathBottomNodesValType.ValTwips===type)props.interSp=g_dKoef_twips_to_mm*this.stream.GetULongLE();else res=c_oSerConstants.ReadUnknown;return res};this.ReadMathMathFont=function(type,length,props){var res=c_oSerConstants.ReadOk;var oThis=this;if(c_oSer_OMathBottomNodesValType.Val===type)props.mathFont={Name:this.stream.GetString2LE(length),Index:-1};else res=c_oSerConstants.ReadUnknown;return res};this.ReadMathIntLim=function(type,length,props){var res= c_oSerConstants.ReadOk;var oThis=this;if(c_oSer_OMathBottomNodesValType.Val===type){var intLim=this.stream.GetUChar(length);switch(intLim){case c_oAscLimLoc.SubSup:props.intLim=NARY_SubSup;break;case c_oAscLimLoc.UndOvr:props.intLim=NARY_UndOvr;break;default:props.intLim=NARY_SubSup}}else res=c_oSerConstants.ReadUnknown;return res};this.ReadMathIntraSp=function(type,length,props){var res=c_oSerConstants.ReadOk;var oThis=this;if(c_oSer_OMathBottomNodesValType.Val===type)props.intraSp=this.bcr.ReadDouble(); else if(c_oSer_OMathBottomNodesValType.ValTwips===type)props.intraSp=g_dKoef_twips_to_mm*this.stream.GetULongLE();else res=c_oSerConstants.ReadUnknown;return res};this.ReadMathLMargin=function(type,length,props){var res=c_oSerConstants.ReadOk;var oThis=this;if(c_oSer_OMathBottomNodesValType.Val===type)props.lMargin=this.bcr.ReadDouble();else if(c_oSer_OMathBottomNodesValType.ValTwips===type)props.lMargin=g_dKoef_twips_to_mm*this.stream.GetULongLE();else res=c_oSerConstants.ReadUnknown;return res}; this.ReadMathNaryLim=function(type,length,props){var res=c_oSerConstants.ReadOk;var oThis=this;if(c_oSer_OMathBottomNodesValType.Val===type){var naryLim=this.stream.GetUChar(length);switch(naryLim){case c_oAscLimLoc.SubSup:props.naryLim=NARY_SubSup;break;case c_oAscLimLoc.UndOvr:props.naryLim=NARY_UndOvr;break;default:props.naryLim=NARY_SubSup}}else res=c_oSerConstants.ReadUnknown;return res};this.ReadMathPostSp=function(type,length,props){var res=c_oSerConstants.ReadOk;var oThis=this;if(c_oSer_OMathBottomNodesValType.Val=== type)props.postSp=this.bcr.ReadDouble();else if(c_oSer_OMathBottomNodesValType.ValTwips===type)props.postSp=g_dKoef_twips_to_mm*this.stream.GetULongLE();else res=c_oSerConstants.ReadUnknown;return res};this.ReadMathPreSp=function(type,length,props){var res=c_oSerConstants.ReadOk;var oThis=this;if(c_oSer_OMathBottomNodesValType.Val===type)props.preSp=this.bcr.ReadDouble();else if(c_oSer_OMathBottomNodesValType.ValTwips===type)props.preSp=g_dKoef_twips_to_mm*this.stream.GetULongLE();else res=c_oSerConstants.ReadUnknown; return res};this.ReadMathRMargin=function(type,length,props){var res=c_oSerConstants.ReadOk;var oThis=this;if(c_oSer_OMathBottomNodesValType.Val===type)props.rMargin=this.bcr.ReadDouble();else if(c_oSer_OMathBottomNodesValType.ValTwips===type)props.rMargin=g_dKoef_twips_to_mm*this.stream.GetULongLE();else res=c_oSerConstants.ReadUnknown;return res};this.ReadMathSmallFrac=function(type,length,props){var res=c_oSerConstants.ReadOk;var oThis=this;if(c_oSer_OMathBottomNodesValType.Val===type)props.smallFrac= this.stream.GetBool();else res=c_oSerConstants.ReadUnknown;return res};this.ReadMathWrapIndent=function(type,length,props){var res=c_oSerConstants.ReadOk;var oThis=this;if(c_oSer_OMathBottomNodesValType.Val===type)props.wrapIndent=this.bcr.ReadDouble();else if(c_oSer_OMathBottomNodesValType.ValTwips===type)props.wrapIndent=g_dKoef_twips_to_mm*this.stream.GetULongLE();else res=c_oSerConstants.ReadUnknown;return res};this.ReadMathWrapRight=function(type,length,props){var res=c_oSerConstants.ReadOk; var oThis=this;if(c_oSer_OMathBottomNodesValType.Val===type)props.wrapRight=this.stream.GetBool();else res=c_oSerConstants.ReadUnknown;return res};this.ReadColorSchemeMapping=function(type,length){var res=c_oSerConstants.ReadOk;var oThis=this;if(c_oSer_ClrSchemeMappingType.Accent1<=type&&type<=c_oSer_ClrSchemeMappingType.T2){var val=this.stream.GetUChar();this.ApplyColorSchemeMappingItem(type,val)}else res=c_oSerConstants.ReadUnknown;return res};this.ApplyColorSchemeMappingItem=function(type,val){var nScriptType= 0;var nScriptVal=0;switch(type){case c_oSer_ClrSchemeMappingType.Accent1:nScriptType=0;break;case c_oSer_ClrSchemeMappingType.Accent2:nScriptType=1;break;case c_oSer_ClrSchemeMappingType.Accent3:nScriptType=2;break;case c_oSer_ClrSchemeMappingType.Accent4:nScriptType=3;break;case c_oSer_ClrSchemeMappingType.Accent5:nScriptType=4;break;case c_oSer_ClrSchemeMappingType.Accent6:nScriptType=5;break;case c_oSer_ClrSchemeMappingType.Bg1:nScriptType=6;break;case c_oSer_ClrSchemeMappingType.Bg2:nScriptType= 7;break;case c_oSer_ClrSchemeMappingType.FollowedHyperlink:nScriptType=10;break;case c_oSer_ClrSchemeMappingType.Hyperlink:nScriptType=11;break;case c_oSer_ClrSchemeMappingType.T1:nScriptType=15;break;case c_oSer_ClrSchemeMappingType.T2:nScriptType=16;break}switch(val){case EWmlColorSchemeIndex.wmlcolorschemeindexAccent1:nScriptVal=0;break;case EWmlColorSchemeIndex.wmlcolorschemeindexAccent2:nScriptVal=1;break;case EWmlColorSchemeIndex.wmlcolorschemeindexAccent3:nScriptVal=2;break;case EWmlColorSchemeIndex.wmlcolorschemeindexAccent4:nScriptVal= 3;break;case EWmlColorSchemeIndex.wmlcolorschemeindexAccent5:nScriptVal=4;break;case EWmlColorSchemeIndex.wmlcolorschemeindexAccent6:nScriptVal=5;break;case EWmlColorSchemeIndex.wmlcolorschemeindexDark1:nScriptVal=8;break;case EWmlColorSchemeIndex.wmlcolorschemeindexDark2:nScriptVal=9;break;case EWmlColorSchemeIndex.wmlcolorschemeindexFollowedHyperlink:nScriptVal=10;break;case EWmlColorSchemeIndex.wmlcolorschemeindexHyperlink:nScriptVal=11;break;case EWmlColorSchemeIndex.wmlcolorschemeindexLight1:nScriptVal= 12;break;case EWmlColorSchemeIndex.wmlcolorschemeindexLight2:nScriptVal=13;break}this.Document.clrSchemeMap.color_map[nScriptType]=nScriptVal};this.ReadCompat=function(type,length){var res=c_oSerConstants.ReadOk;var oThis=this;if(c_oSerCompat.CompatSetting===type){var compat={name:null,url:null,value:null};res=this.bcr.Read1(length,function(t,l){return oThis.ReadCompatSetting(t,l,compat)});if("compatibilityMode"===compat.name&&"http://schemas.microsoft.com/office/word"===compat.url)this.oReadResult.compatibilityMode= parseInt(compat.value)}else if(c_oSerCompat.Flags1===type){var flags1=this.stream.GetULong(length);this.oReadResult.DoNotExpandShiftReturn=0!=(flags1>>10&1)}else if(c_oSerCompat.Flags2===type){var flags2=this.stream.GetULong(length);this.oReadResult.SplitPageBreakAndParaMark=0!=(flags2>>27&1)}else res=c_oSerConstants.ReadUnknown;return res};this.ReadCompatSetting=function(type,length,compat){var res=c_oSerConstants.ReadOk;var oThis=this;if(c_oSerCompat.CompatName===type)compat.name=this.stream.GetString2LE(length); else if(c_oSerCompat.CompatUri===type)compat.url=this.stream.GetString2LE(length);else if(c_oSerCompat.CompatValue===type)compat.value=this.stream.GetString2LE(length);else res=c_oSerConstants.ReadUnknown;return res}}function Binary_NotesTableReader(doc,oReadResult,openParams,stream,notes,logicDocumentNotes){this.Document=doc;this.oReadResult=oReadResult;this.openParams=openParams;this.stream=stream;this.trackRevisions=null;this.notes=notes;this.logicDocumentNotes=logicDocumentNotes;this.bcr=new Binary_CommonReader(this.stream); this.Read=function(){var oThis=this;return this.bcr.ReadTable(function(t,l){return oThis.ReadNotes(t,l)})};this.ReadNotes=function(type,length){var res=c_oSerConstants.ReadOk;var oThis=this;if(c_oSerNotes.Note===type){var note={id:null,type:null,content:null};res=this.bcr.Read1(length,function(t,l){return oThis.ReadNote(t,l,note)});if(null!==note.id&&null!==note.content)this.notes[note.id]=note}else res=c_oSerConstants.ReadUnknown;return res};this.ReadNote=function(type,length,note){var res=c_oSerConstants.ReadOk; var oThis=this;if(c_oSerNotes.NoteType===type)note.type=this.stream.GetUChar();else if(c_oSerNotes.NoteId===type)note.id=this.stream.GetULongLE();else if(c_oSerNotes.NoteContent===type){var noteElem=new CFootEndnote(this.logicDocumentNotes);var noteContent=[];var bdtr=new Binary_DocumentTableReader(noteElem,this.oReadResult,this.openParams,this.stream,noteElem,this.oReadResult.oCommentsPlaces);bdtr.Read(length,noteContent);if(noteContent.length>0){for(var i=0;i0){res=run.Get_FirstTextPr();break}}return res}function OpenParStruct(oContainer,paragraph){this.paragraph=paragraph;this.cur=oContainer;this.stack=[this.cur];this.curRun=null}OpenParStruct.prototype={_GetFromContent:function(elem,nIndex){return elem.Content[nIndex]},_GetContentLength:function(elem){return elem.Content.length},_removeFromContent:function(elem,pos,count){if(elem.Remove_FromContent)elem.Remove_FromContent(pos,count)},addElemToContentStart:function(){this.curRun= new ParaRun(this.paragraph)},addElemToContent:function(elem){this.curRun.Add_ToContent(this.curRun.GetElementsCount(),elem,false)},addElemToContentFinish:function(){var res=this.curRun;this.addToContent(this.curRun);return res},addToContent:function(oItem){if(this.cur&&this.cur.Add_ToContent)this.cur.Add_ToContent(this.getCurPos(),oItem,false)},GetFromContent:function(nIndex){if(null!=this.cur)return this._GetFromContent(this.cur,nIndex);return null},GetContentLength:function(){if(null!=this.cur)return this._GetContentLength(this.cur); return null},addElem:function(oElem){if(null!=this.cur){this.cur=oElem;this.stack.push(this.cur)}},getElem:function(){return this.cur},commitElem:function(){var bRes=false;if(this.stack.length>1){var oPrevElem=this.stack.pop();this.cur=this.stack[this.stack.length-1];var elem=oPrevElem;if(null!=elem&&elem.Content)if(para_Field==elem.Get_Type()&&(fieldtype_PAGENUM==elem.Get_FieldType()||fieldtype_PAGECOUNT==elem.Get_FieldType())){var oNewRun=new ParaRun(this.paragraph);var rPr=getStyleFirstRun(elem); if(rPr)oNewRun.Set_Pr(rPr);if(fieldtype_PAGENUM==elem.Get_FieldType())oNewRun.Add_ToContent(0,new ParaPageNum);else{var pageCount=parseInt(elem.GetSelectedText(true));oNewRun.Add_ToContent(0,new ParaPageCount(isNaN(pageCount)?undefined:pageCount))}this.addToContent(oNewRun)}else if(elem.Content.length>0)this.addToContent(elem);bRes=true}return bRes},commitAll:function(){while(this.commitElem());},getCurPos:function(){if(this.cur&&type_Paragraph===this.cur.GetType())return this.GetContentLength()- 1;else return this.GetContentLength()}};function DocSaveParams(bMailMergeDocx,bMailMergeHtml,isCompatible,docParts){this.bMailMergeDocx=bMailMergeDocx;this.bMailMergeHtml=bMailMergeHtml;this.trackRevisionId=0;this.footnotes={};this.footnotesIndex=0;this.endnotes={};this.endnotesIndex=0;this.moveRangeFromNameToId={};this.moveRangeToNameToId={};this.isCompatible=isCompatible;this.placeholders={};this.docParts=docParts}function DocReadResult(doc){this.logicDocument=doc;this.ImageMap={};this.oComments= {};this.oDocumentComments={};this.oCommentsPlaces={};this.setting={titlePg:false,EvenAndOddHeaders:false};this.numToNumClass={};this.numToANumClass={};this.paraNumPrs=[];this.styles=[];this.runStyles=[];this.paraStyles=[];this.tableStyles=[];this.lvlStyles=[];this.styleLinks=[];this.numStyleLinks=[];this.DefpPr=null;this.DefrPr=null;this.DocumentContent=[];this.bLastRun=null;this.aPostOpenStyleNumCallbacks=[];this.headers=[];this.footers=[];this.trackRevisions=null;this.hasRevisions=false;this.disableRevisions= false;this.drawingToMath=[];this.aTableCorrect=[];this.footnotes={};this.footnoteRefs=[];this.endnotes={};this.endnoteRefs=[];this.bookmarkForRead=typeof CParagraphBookmark!=="undefined"?new CParagraphBookmark:{};this.bookmarksStarted={};this.moveRanges={};this.Application;this.AppVersion;this.compatibilityMode=null;this.SplitPageBreakAndParaMark=false;this.DoNotExpandShiftReturn=false;this.bdtr=null;this.runsToSplit=[];this.bCopyPaste=false}DocReadResult.prototype={isDocumentPasting:function(){var api= window["Asc"]["editor"]||editor;if(api)return this.bCopyPaste&&AscCommon.c_oEditorId.Word===api.getEditorId();return false},checkReadRevisions:function(){this.hasRevisions=true;return!this.disableRevisions}};window["AscCommonWord"]=window["AscCommonWord"]||{};window["AscCommonWord"].BinaryFileReader=BinaryFileReader;window["AscCommonWord"].BinaryFileWriter=BinaryFileWriter;window["AscCommonWord"].EThemeColor=EThemeColor;window["AscCommonWord"].DocReadResult=DocReadResult;window["AscCommonWord"].DocSaveParams= DocSaveParams;window["AscCommonWord"].CreateThemeUnifill=CreateThemeUnifill;"use strict";function CParagraphSearchElement(StartPos,EndPos,Type,Id){this.StartPos=StartPos;this.EndPos=EndPos;this.Type=Type;this.ResultStr="";this.Id=Id;this.ClassesS=[];this.ClassesE=[]}CParagraphSearchElement.prototype.RegisterClass=function(isStart,oClass){if(isStart)this.ClassesS.push(oClass);else this.ClassesE.push(oClass)};function CDocumentSearch(){this.Text="";this.MatchCase=false;this.Prefix=[];this.Id=0;this.Count= 0;this.Elements={};this.CurId=-1;this.Direction=true;this.ClearOnRecalc=true;this.Selection=false;this.Footnotes=[];this.Endnotes=[]}CDocumentSearch.prototype.Reset=function(){this.Text="";this.MatchCase=false};CDocumentSearch.prototype.Compare=function(Text,Props){return this.Text===Text&&this.MatchCase===Props.MatchCase};CDocumentSearch.prototype.Clear=function(){this.Reset();for(var Id in this.Elements)this.Elements[Id].ClearSearchResults();this.Id=0;this.Count=0;this.Elements={};this.CurId=-1; this.Direction=true};CDocumentSearch.prototype.Add=function(Paragraph){this.Count++;this.Id++;this.Elements[this.Id]=Paragraph;return this.Id};CDocumentSearch.prototype.Select=function(Id,bUpdateStates){var Paragraph=this.Elements[Id];if(Paragraph){var SearchElement=Paragraph.SearchResults[Id];if(SearchElement){Paragraph.Selection.Use=true;Paragraph.Selection.Start=false;Paragraph.Set_SelectionContentPos(SearchElement.StartPos,SearchElement.EndPos);Paragraph.Set_ParaContentPos(SearchElement.StartPos, false,-1,-1);Paragraph.Document_SetThisElementCurrent(false!==bUpdateStates)}this.CurId=Id}};CDocumentSearch.prototype.Reset_Current=function(){this.CurId=-1};CDocumentSearch.prototype.Replace=function(sReplaceString,Id,bRestorePos){var oPara=this.Elements[Id];if(oPara){var oLogicDocument=oPara.LogicDocument;var isTrackRevisions=oLogicDocument?oLogicDocument.IsTrackRevisions():false;var SearchElement=oPara.SearchResults[Id];if(SearchElement){var ContentPos,StartPos,EndPos,bSelection;if(true===bRestorePos){bSelection= oPara.IsSelectionUse();ContentPos=oPara.Get_ParaContentPos(false,false);StartPos=oPara.Get_ParaContentPos(true,true);EndPos=oPara.Get_ParaContentPos(true,false);oPara.Check_NearestPos({ContentPos:ContentPos});oPara.Check_NearestPos({ContentPos:StartPos});oPara.Check_NearestPos({ContentPos:EndPos})}if(isTrackRevisions){var oEndContentPos=SearchElement.EndPos;var oEndRun=SearchElement.ClassesE[SearchElement.ClassesE.length-1];var nRunPos=oEndContentPos.Get(SearchElement.ClassesE.length-1);if(reviewtype_Add=== oEndRun.GetReviewType()&&oEndRun.GetReviewInfo().IsCurrentUser())oEndRun.AddText(sReplaceString,nRunPos);else{var oRunParent=oEndRun.GetParent();var nRunPosInParent=oEndRun.GetPosInParent(oRunParent);var oReplaceRun=oEndRun.Split2(nRunPos,oRunParent,nRunPosInParent);if(!oReplaceRun.IsEmpty())oReplaceRun.Split2(0,oRunParent,nRunPosInParent+1);oReplaceRun.AddText(sReplaceString,0);oReplaceRun.SetReviewType(reviewtype_Add);oPara.Selection.Use=true;oPara.Set_SelectionContentPos(SearchElement.StartPos, SearchElement.EndPos);oPara.Remove()}}else{var StartContentPos=SearchElement.StartPos;var StartRun=SearchElement.ClassesS[SearchElement.ClassesS.length-1];var RunPos=StartContentPos.Get(SearchElement.ClassesS.length-1);StartRun.AddText(sReplaceString,RunPos)}oPara.Selection.Use=true;oPara.Set_SelectionContentPos(SearchElement.StartPos,SearchElement.EndPos);oPara.Remove();oPara.RemoveSelection();oPara.Set_ParaContentPos(SearchElement.StartPos,true,-1,-1);this.Count--;oPara.RemoveSearchResult(Id);delete this.Elements[Id]; if(true===bRestorePos){oPara.Set_SelectionContentPos(StartPos,EndPos);oPara.Set_ParaContentPos(ContentPos,true,-1,-1);oPara.Selection.Use=bSelection;oPara.Clear_NearestPosArray()}}}};CDocumentSearch.prototype.ReplaceAll=function(NewStr,bUpdateStates){for(var Id=this.Id;Id>=0;--Id)if(this.Elements[Id])this.Replace(NewStr,Id,true);this.Clear()};CDocumentSearch.prototype.Set=function(sText,oProps){this.Text=sText;this.MatchCase=oProps?oProps.MatchCase:false;this.private_CalculatePrefix()};CDocumentSearch.prototype.SetFootnotes= function(arrFootnotes){this.Footnotes=arrFootnotes};CDocumentSearch.prototype.SetEndnotes=function(arrEndnotes){this.Endnotes=arrEndnotes};CDocumentSearch.prototype.GetFootnotes=function(){return this.Footnotes};CDocumentSearch.prototype.GetEndnotes=function(){return this.Endnotes};CDocumentSearch.prototype.GetDirection=function(){return this.Direction};CDocumentSearch.prototype.SetDirection=function(bDirection){this.Direction=bDirection};CDocumentSearch.prototype.private_CalculatePrefix=function(){var nLen= this.Text.length;this.Prefix=new Int32Array(nLen);this.Prefix[0]=0;for(var nPos=1,nK=0;nPos0&&this.Text[nPos]!==this.Text[nK])nK=this.Prefix[nK-1];if(this.Text[nPos]===this.Text[nK])nK++;this.Prefix[nPos]=nK}};CDocumentSearch.prototype.GetPrefix=function(nIndex){return this.Prefix[nIndex]};CDocument.prototype.Search=function(sStr,oProps,bDraw){if(this.SearchEngine.Compare(sStr,oProps))return this.SearchEngine;this.SearchEngine.Clear();this.SearchEngine.Set(sStr, oProps);for(var nIndex=0,nCount=this.Content.length;nIndex0){this.StartAction(bAll?AscDFH.historydescription_Document_ReplaceAll:AscDFH.historydescription_Document_ReplaceSingle);for(var nIndex=0;nIndex=0){Id=this.Content[Pos].GetSearchElementId(false, false);if(null!=Id)return Id;Pos--}}return Id};CDocument.prototype.private_GetSearchIdInHdrFtr=function(isCurrent){return this.SectionsInfo.GetSearchElementId(this.SearchEngine.GetDirection(),isCurrent?this.HdrFtr.CurHdrFtr:null)};CDocument.prototype.private_GetSearchIdInFootnotes=function(isCurrent){var bNext=this.SearchEngine.GetDirection();var oCurFootnote=this.Footnotes.CurFootnote;var arrFootnotes=this.SearchEngine.GetFootnotes();var nCurPos=-1;var nCount=arrFootnotes.length;if(nCount<=0)return null; if(isCurrent)for(var nIndex=0;nIndex=0;--nIndex){Id=arrFootnotes[nIndex].GetSearchElementId(bNext, false);if(null!=Id)return Id}return null};CDocument.prototype.private_GetSearchIdInEndnotes=function(isCurrent){var bNext=this.SearchEngine.GetDirection();var oCurEndnote=this.Endnotes.CurEndnote;var arrEndnotes=this.SearchEngine.GetEndnotes();var nCurPos=-1;var nCount=arrEndnotes.length;if(nCount<=0)return null;if(isCurrent)for(var nIndex=0;nIndex=0;--nIndex){Id=arrEndnotes[nIndex].GetSearchElementId(bNext,false);if(null!=Id)return Id}return null};CDocumentContent.prototype.Search=function(sStr,oProps,oSearchEngine,nType){for(var nPos=0,nCount=this.Content.length;nPos=0){Id=this.Content[Pos].GetSearchElementId(false,false);if(null!=Id)return Id;Pos--}}}else{var Count=this.Content.length; if(true===bNext){var Pos=0;while(Pos=0){Id=this.Content[Pos].GetSearchElementId(false,false);if(null!=Id)return Id;Pos--}}}return null};CHeaderFooter.prototype.Search=function(sStr,oProps,oSearchEngine,nType){this.Content.Search(sStr,oProps,oSearchEngine,nType)};CHeaderFooter.prototype.GetSearchElementId=function(bNext,bCurrent){return this.Content.GetSearchElementId(bNext,bCurrent)}; CDocumentSectionsInfo.prototype.Search=function(sStr,oProps,oSearchEngine){var bEvenOdd=EvenAndOddHeaders;for(var nIndex=0,nCount=this.Elements.length;nIndex=0&&CurPos<=HdrFtrs.length-1){var Id=CurHdrFtr.GetSearchElementId(bNext,isCurrent);if(null!=Id)return Id;if(true===bNext)for(var Index=CurPos+1;Index=0;Index--){Id=HdrFtrs[Index].GetSearchElementId(bNext,false);if(null!=Id)return Id}}return null};CTable.prototype.Search=function(sStr,oProps,oSearchEngine,nType){for(var nCurRow= 0,nRowsCount=this.GetRowsCount();nCurRow=0;_CurRow--){var Row=this.Content[_CurRow];var Cells_Count=Row.Get_CellsCount();var StartCell=_CurRow===CurRow?CurCell-1:Cells_Count-1;for(var _CurCell=StartCell;_CurCell>=0;_CurCell--){var Cell=Row.Get_Cell(_CurCell);Id=Cell.Content.GetSearchElementId(false,false);if(null!=Id)return Id}}}else{var Rows_Count=this.Content.length;if(true===bNext)for(var _CurRow=0;_CurRow=0;_CurRow--){var Row=this.Content[_CurRow];var Cells_Count=Row.Get_CellsCount();for(var _CurCell=Cells_Count-1;_CurCell>=0;_CurCell--){var Cell=Row.Get_Cell(_CurCell);Id=Cell.Content.GetSearchElementId(false,false);if(null!=Id)return Id}}}return Id}; Paragraph.prototype.Search=function(sStr,oProps,oSearchEngine,nType){var oParaSearch=new CParagraphSearch(this,sStr,oProps,oSearchEngine,nType);for(var nPos=0,nContentLen=this.Content.length;nPos=MaxShowValue){ResultStr="";for(var Index= 0;Index..."}else{ResultStr=""+_Str+"";var LeaveCount=MaxShowValue-_Str.length;var RunElementsAfter=new CParagraphRunElements(EndPos,LeaveCount,[para_Text,para_Space,para_Tab]);var RunElementsBefore=new CParagraphRunElements(StartPos,LeaveCount,[para_Text,para_Space,para_Tab]);this.GetNextRunElements(RunElementsAfter);this.GetPrevRunElements(RunElementsBefore);var LeaveCount_2=LeaveCount/2;if(RunElementsAfter.Elements.length>=LeaveCount_2&& RunElementsBefore.Elements.length>=LeaveCount_2)for(var Index=0;Index0){var Temp=ESelContentPos; ESelContentPos=SSelContentPos;SSelContentPos=Temp}if(true===bNext)ContentPos=ESelContentPos;else ContentPos=SSelContentPos}else ContentPos=this.Get_ParaContentPos(false,false);else if(true===bNext)ContentPos=this.Get_StartPos();else ContentPos=this.Get_EndPos(false);if(true===bNext){var StartPos=ContentPos.Get(0);var ContentLen=this.Content.length;for(var CurPos=StartPos;CurPos=0;CurPos--){var ElementId=this.Content[CurPos].GetSearchElementId(false,CurPos===StartPos,ContentPos,1);if(null!==ElementId)return ElementId}}return null};Paragraph.prototype.AddSearchResult=function(nId,oStartPos,oEndPos,nType){if(!oStartPos||!oEndPos)return;var oSearchResult=new CParagraphSearchElement(oStartPos,oEndPos,nType,nId);this.SearchResults[nId]=oSearchResult; oSearchResult.RegisterClass(true,this);oSearchResult.RegisterClass(false,this);this.Content[oStartPos.Get(0)].AddSearchResult(oSearchResult,true,oStartPos,1);this.Content[oEndPos.Get(0)].AddSearchResult(oSearchResult,false,oEndPos,1)};Paragraph.prototype.ClearSearchResults=function(){for(var Id in this.SearchResults){var SearchResult=this.SearchResults[Id];for(var Pos=1,ClassesCount=SearchResult.ClassesS.length;Pos0&&!ParaSearch.Check(ParaSearch.SearchIndex, oItem)){ParaSearch.SearchIndex=ParaSearch.GetPrefix(ParaSearch.SearchIndex-1);if(0===ParaSearch.SearchIndex){ParaSearch.Reset();break}else if(ParaSearch.Check(ParaSearch.SearchIndex,oItem)){ParaSearch.StartPos=ParaSearch.StartPosBuf.pop();break}}if(ParaSearch.Check(ParaSearch.SearchIndex,oItem)){if(0===ParaSearch.SearchIndex)ParaSearch.StartPos={Run:this,Pos:nPos};if(1===ParaSearch.GetPrefix(ParaSearch.SearchIndex))ParaSearch.StartPosBuf.push({Run:this,Pos:nPos});ParaSearch.SearchIndex++;if(ParaSearch.SearchIndex=== Str.length){if(ParaSearch.StartPos)Para.AddSearchResult(SearchEngine.Add(Para),ParaSearch.StartPos.Run.GetParagraphContentPosFromObject(ParaSearch.StartPos.Pos),this.GetParagraphContentPosFromObject(nPos+1),Type);ParaSearch.Reset()}}}};ParaRun.prototype.AddSearchResult=function(oSearchResult,isStart,oContentPos,nDepth){oSearchResult.RegisterClass(isStart,this);this.SearchMarks.push(new CParagraphSearchMark(oSearchResult,isStart,nDepth))};ParaRun.prototype.ClearSearchResults=function(){this.SearchMarks= []};ParaRun.prototype.RemoveSearchResult=function(oSearchResult){for(var nIndex=0,nMarksCount=this.SearchMarks.length;nIndex0&&this===Mark.SearchResult.ClassesS[Mark.SearchResult.ClassesS.length-1]&&MarkPos>=StartPos&&MarkPos0&&this===Mark.SearchResult.ClassesS[Mark.SearchResult.ClassesS.length-1]&&MarkPosNearPos){NearElementId= Mark.SearchResult.Id;NearPos=MarkPos}}StartPos=Math.min(this.Content.length-1,StartPos-1);for(var CurPos=StartPos;CurPos>NearPos;CurPos--){var Item=this.Content[CurPos];if(para_Drawing===Item.Type){var TempElementId=Item.GetSearchElementId(false,false);if(null!=TempElementId)return TempElementId}}}return NearElementId};ParaMath.prototype.Search=function(oParaSearch){this.Root.Search(oParaSearch)};ParaMath.prototype.AddSearchResult=function(SearchResult,Start,ContentPos,Depth){this.Root.AddSearchResult(SearchResult, Start,ContentPos,Depth)};ParaMath.prototype.ClearSearchResults=function(){this.Root.ClearSearchResults()};ParaMath.prototype.RemoveSearchResult=function(oSearchResult){this.Root.RemoveSearchResult(oSearchResult)};ParaMath.prototype.GetSearchElementId=function(bNext,bUseContentPos,ContentPos,Depth){return this.Root.GetSearchElementId(bNext,bUseContentPos,ContentPos,Depth)};CBlockLevelSdt.prototype.Search=function(sStr,oProps,oSearchEngine,nType){this.Content.Search(sStr,oProps,oSearchEngine,nType)}; CBlockLevelSdt.prototype.GetSearchElementId=function(bNext,bCurrent){return this.Content.GetSearchElementId(bNext,bCurrent)};function CParagraphSearch(Paragraph,Str,Props,SearchEngine,Type){this.Paragraph=Paragraph;this.Str=Str;this.Props=Props;this.SearchEngine=SearchEngine;this.Type=Type;this.ContentPos=new CParagraphContentPos;this.StartPos=null;this.SearchIndex=0;this.StartPosBuf=[]}CParagraphSearch.prototype.Reset=function(){this.StartPos=null;this.SearchIndex=0;this.StartPosBuf=[]};CParagraphSearch.prototype.Check= function(nIndex,oItem){var nItemType=oItem.Type;return para_Space===nItemType&&" "===this.Str[nIndex]||para_Math_Text===nItemType&&oItem.value===this.Str.charCodeAt(nIndex)||para_Text===nItemType&&(true!==this.Props.MatchCase&&String.fromCharCode(oItem.Value).toLowerCase()===this.Str[nIndex].toLowerCase()||true===this.Props.MatchCase&&oItem.Value===this.Str.charCodeAt(nIndex))};CParagraphSearch.prototype.GetPrefix=function(nIndex){return this.SearchEngine.GetPrefix(nIndex)};function CParagraphSearchMark(SearchResult, Start,Depth){this.SearchResult=SearchResult;this.Start=Start;this.Depth=Depth}"use strict";var g_oTableId=AscCommon.g_oTableId;var DOCUMENT_SPELLING_MAX_PARAGRAPHS=50;var DOCUMENT_SPELLING_MAX_ERRORS=2E3;var DOCUMENT_SPELLING_EXCEPTIONAL_WORDS={"Teamlab":true,"teamlab":true,"OnlyOffice":true,"ONLYOFFICE":true,"API":true};function CDocumentSpelling(){this.Use=true;this.TurnOn=1;this.ErrorsExceed=false;this.Paragraphs={};this.Words={};this.CheckPara={};this.CurPara={};this.WaitingParagraphs={};this.WaitingParagraphsCount= 0;this.Words=DOCUMENT_SPELLING_EXCEPTIONAL_WORDS}CDocumentSpelling.prototype={TurnOff:function(){this.TurnOn-=1},TurnOn:function(){this.TurnOn+=1},Add_Paragraph:function(Id,Para){this.Paragraphs[Id]=Para},Remove_Paragraph:function(Id){delete this.Paragraphs[Id]},Reset:function(){this.Paragraphs={};this.CheckPara={};this.CurPara={};this.WaitingParagraphs={};this.WaitingParagraphsCount=0;this.ErrorsExceed=false},Check_Word:function(Word){if(undefined!=this.Words[Word])return true;return false},Add_Word:function(Word){this.Words[Word]= true;for(var Id in this.Paragraphs){var Para=this.Paragraphs[Id];Para.SpellChecker.Ignore(Word)}},Add_ParagraphToCheck:function(Id,Para){this.CheckPara[Id]=Para},GetErrorsCount:function(){var Count=0;for(var Id in this.Paragraphs){var Para=this.Paragraphs[Id];Count+=Para.SpellChecker.GetErrorsCount()}return Count},ContinueCheckSpelling:function(){if(0==this.TurnOn)return;if(true===this.ErrorsExceed)return;if(this.WaitingParagraphsCount<=0){var nCounter=0;for(var sId in this.CheckPara){var oParagraph= this.CheckPara[sId];if(oParagraph.IsUseInDocument()&&!oParagraph.ContinueCheckSpelling(false))break;delete this.CheckPara[sId];nCounter++;if(nCounter>DOCUMENT_SPELLING_MAX_PARAGRAPHS)break}if(this.GetErrorsCount()>DOCUMENT_SPELLING_MAX_ERRORS)this.ErrorsExceed=true}for(var Id in this.CurPara){var Para=this.CurPara[Id];delete this.CurPara[Id];Para.SpellChecker.Reset_ElementsWithCurPos();Para.SpellChecker.Check()}},Add_CurPara:function(Id,Para){this.CurPara[Id]=Para},Check_CurParas:function(){for(var Id in this.CheckPara){var Para= this.CheckPara[Id];Para.ContinueCheckSpelling(true);delete this.CheckPara[Id]}for(var Id in this.CurPara){var Para=this.CurPara[Id];delete this.CurPara[Id];Para.SpellChecker.Reset_ElementsWithCurPos();Para.SpellChecker.Check(undefined,true)}},Add_WaitingParagraph:function(Para,RecalcId,Words,Langs){var ParaId=Para.Get_Id();var WPara=this.WaitingParagraphs[ParaId];if(undefined===WPara||RecalcId!==WPara.RecalcId||true!==this.private_CompareWordsAndLangs(WPara.Words,Words,WPara.Langs,Langs)){this.WaitingParagraphs[ParaId]= {Words:Words,Langs:Langs,RecalcId:RecalcId};this.WaitingParagraphsCount++;return true}return false},Check_WaitingParagraph:function(Para){var ParaId=Para.Get_Id();if(undefined===this.WaitingParagraphs[ParaId])return false;return true},Remove_WaitingParagraph:function(Para){var ParaId=Para.Get_Id();if(undefined!==this.WaitingParagraphs[ParaId]){delete this.WaitingParagraphs[ParaId];this.WaitingParagraphsCount--}},private_CompareWordsAndLangs:function(Words1,Words2,Langs1,Langs2){if(undefined===Words1|| undefined===Words2||undefined===Langs1||undefined===Langs2||Words1.length!==Words2.length||Words1.length!==Langs1.length||Words1.length!==Langs2.length)return false;for(var nIndex=0,nCount=Words1.length;nIndex0){if("'"===Word.charAt(Word.length-1))Word=Word.substr(0,Word.length-1);if("'"===Word.charAt(0))Word=Word.substr(1)}var SpellCheckerEl=new CParaSpellCheckerElement(StartPos, EndPos,Word,Lang,Prefix,Ending);this.Paragraph.Add_SpellCheckerElement(SpellCheckerEl);this.Elements.push(SpellCheckerEl)},GetErrorsCount:function(){var ErrorsCount=0;var ElementsCount=this.Elements.length;for(var Index=0;Index=oElement.Word.length||AscCommon.private_IsAbbreviation(oElement.Word))oElement.Checked=true;else if(editor.asc_IsSpellCheckCurrentWord()!== true&&null===oElement.Checked&&-1!==CurPos&&oElement.EndPos.Compare(CurPos)>=0&&oElement.StartPos.Compare(CurPos)<=0){oElement.Checked=true;oElement.CurPos=true;editor.WordControl.m_oLogicDocument.Spelling.Add_CurPara(this.ParaId,g_oTableId.Get_ById(this.ParaId))}if(null===oElement.Checked){usrWords.push(this.Elements[nIndex].Word);usrLang.push(this.Elements[nIndex].Lang);var nPrefix=this.Elements[nIndex].GetPrefix();var nEnding=this.Elements[nIndex].GetEnding();if(nPrefix){usrWords.push(String.fromCharCode(nPrefix)+ this.Elements[nIndex].Word);usrLang.push(this.Elements[nIndex].Lang)}if(nEnding){usrWords.push(this.Elements[nIndex].Word+String.fromCharCode(nEnding));usrLang.push(this.Elements[nIndex].Lang)}if(nPrefix&&nEnding){usrWords.push(String.fromCharCode(nPrefix)+this.Elements[nIndex].Word+String.fromCharCode(nEnding));usrLang.push(this.Elements[nIndex].Lang)}}}if(0Pos)break;else if(Element.EndPos=0&&false===Element.Checked)if(null!=FoundElement){FoundElement=null;break}else{FoundIndex= Index;FoundElement=Element}}var Word="";var Variants=null;var Checked=null;if(null!=FoundElement){Word=FoundElement.Word;Variants=FoundElement.Variants;Checked=FoundElement.Checked;if(null===Variants&&false===editor.WordControl.m_oLogicDocument.Spelling.Check_WaitingParagraph(this.Paragraph)&&editor.SpellCheckApi.checkDictionary(FoundElement.Lang))editor.SpellCheckApi.spellCheck({"type":"suggest","ParagraphId":this.ParaId,"RecalcId":this.RecalcId,"ElementId":FoundIndex,"usrWords":[Word],"usrLang":[FoundElement.Lang]})}if(null=== Checked)Checked=true;editor.sync_SpellCheckCallback(Word,Checked,Variants,this.ParaId,FoundElement)},Check_CallBack2:function(RecalcId,ElementId,usrVariants){if(RecalcId==this.RecalcId&&undefined!==this.Elements[ElementId]){this.Elements[ElementId].Variants=usrVariants[0];var Count=DOCUMENT_SPELLING_EASTEGGS.length;for(var Index=0;Index=0;--nIndex){var oElement=this.Elements[nIndex];if(true===oElement.Checked&&true!==oElement.CurPos){if(!this.Words[oElement.Word])this.Words[oElement.Word]={Prefix:oElement.GetPrefix(),Ending:oElement.GetEnding()};if(undefined=== this.Words[oElement.Word][oElement.Lang])this.Words[oElement.Word][oElement.Lang]=true}else if(false===oElement.Checked){if(!this.Words[oElement.Word])this.Words[oElement.Word]={Prefix:oElement.GetPrefix(),Ending:oElement.GetEnding()};if(undefined===this.Words[oElement.Word][oElement.Lang])this.Words[oElement.Word][oElement.Lang]=oElement.Variants}}},Remove_RightWords:function(){var Count=this.Elements.length;for(var Index=Count-1;Index>=0;Index--){var Element=this.Elements[Index];if(true===Element.Checked&& true!==Element.CurPos){if(Element.StartRun!==Element.EndRun){Element.StartRun.Remove_SpellCheckerElement(Element);Element.EndRun.Remove_SpellCheckerElement(Element)}else Element.EndRun.Remove_SpellCheckerElement(Element);this.Elements.splice(Index,1)}}}};CParaSpellChecker.prototype.GetElementsCount=function(){return this.Elements.length};CParaSpellChecker.prototype.GetElement=function(nIndex){return this.Elements[nIndex]};CParaSpellChecker.prototype.Pause=function(oEngine){this.Engine=oEngine};CParaSpellChecker.prototype.IsPaused= function(){return!!this.Engine};CParaSpellChecker.prototype.GetPausedEngine=function(){return this.Engine};CParaSpellChecker.prototype.ClearPausedEngine=function(){this.Engine=null};function CParaSpellCheckerElement(StartPos,EndPos,Word,Lang,Prefix,Ending){this.StartPos=StartPos;this.EndPos=EndPos;this.Word=Word;this.Lang=Lang;this.Checked=null;this.CurPos=false;this.Variants=null;this.StartRun=null;this.EndRun=null;this.Prefix=Prefix;this.Ending=Ending}CParaSpellCheckerElement.prototype.GetStartPos= function(){return this.StartPos};CParaSpellCheckerElement.prototype.GetEndPos=function(){return this.EndPos};CParaSpellCheckerElement.prototype.GetPrefix=function(){return this.Prefix};CParaSpellCheckerElement.prototype.GetEnding=function(){return this.Ending};CDocument.prototype.Set_DefaultLanguage=function(NewLangId){var Styles=this.Styles;var OldLangId=Styles.Default.TextPr.Lang.Val;this.History.Add(new CChangesDocumentDefaultLanguage(this,OldLangId,NewLangId));Styles.Default.TextPr.Lang.Val=NewLangId; this.Restart_CheckSpelling();this.Document_UpdateInterfaceState()};CDocument.prototype.Get_DefaultLanguage=function(){var Styles=this.Styles;return Styles.Default.TextPr.Lang.Val};CDocument.prototype.Restart_CheckSpelling=function(){this.Spelling.Reset();this.SectionsInfo.Restart_CheckSpelling();var Count=this.Content.length;for(var Index=0;Index0){var bDontCheckFirstWord=true;var Element=this.SpellChecker.Elements[0];var StartPos=Element.StartPos;for(var TempPos=0;TempPos=0;Pos--){var SpellingMark=this.SpellingMarks[Pos];if(Element===SpellingMark.Element)this.SpellingMarks.splice(Pos,1)}};ParaRun.prototype.Clear_SpellingMarks=function(){this.SpellingMarks=[]};AscCommon.ParaComment.prototype.Restart_CheckSpelling=function(){};AscCommon.ParaComment.prototype.Add_SpellCheckerElement=function(Element,Start,Depth){};AscCommon.ParaComment.prototype.Remove_SpellCheckerElement=function(Element){};AscCommon.ParaComment.prototype.Clear_SpellingMarks= function(){};ParaMath.prototype.Restart_CheckSpelling=function(){};ParaMath.prototype.CheckSpelling=function(oSpellCheckerEngine,nDepth){if(oSpellCheckerEngine.IsExceedLimit())return;if(true===oSpellCheckerEngine.bWord){oSpellCheckerEngine.bWord=false;oSpellCheckerEngine.SpellChecker.Add(oSpellCheckerEngine.StartPos,oSpellCheckerEngine.EndPos,oSpellCheckerEngine.sWord,oSpellCheckerEngine.CurLcid,false)}};ParaMath.prototype.Add_SpellCheckerElement=function(Element,Start,Depth){};ParaMath.prototype.Remove_SpellCheckerElement= function(Element){};ParaMath.prototype.Clear_SpellingMarks=function(){};ParaField.prototype.Restart_CheckSpelling=function(){};ParaField.prototype.CheckSpelling=function(oSpellCheckerEngine,nDepth){if(oSpellCheckerEngine.IsExceedLimit())return;if(true===oSpellCheckerEngine.bWord){oSpellCheckerEngine.bWord=false;oSpellCheckerEngine.SpellChecker.Add(oSpellCheckerEngine.StartPos,oSpellCheckerEngine.EndPos,oSpellCheckerEngine.sWord,oSpellCheckerEngine.CurLcid,false)}};ParaField.prototype.Add_SpellCheckerElement= function(Element,Start,Depth){};ParaField.prototype.Remove_SpellCheckerElement=function(Element){};ParaField.prototype.Clear_SpellingMarks=function(){};function CParagraphSpellCheckerEngine(oSpellChecker,isForceFullCheck){this.ContentPos=new CParagraphContentPos;this.SpellChecker=oSpellChecker;this.CurLcid=-1;this.bWord=false;this.sWord="";this.StartPos=null;this.EndPos=null;this.Prefix=null;this.CheckedCounter=0;this.CheckedLimit=2E3;this.FindStart=false;this.ForceFullCheck=!!isForceFullCheck}CParagraphSpellCheckerEngine.prototype.UpdatePos= function(nPos,nDepth){this.ContentPos.Update(nPos,nDepth)};CParagraphSpellCheckerEngine.prototype.GetPos=function(nDepth){return this.ContentPos.Get(nDepth)};CParagraphSpellCheckerEngine.prototype.IsExceedLimit=function(){return!this.ForceFullCheck&&this.CheckedCounter>=this.CheckedLimit};CParagraphSpellCheckerEngine.prototype.IncreaseCheckedCounter=function(){this.CheckedCounter++};CParagraphSpellCheckerEngine.prototype.ResetCheckedCounter=function(){this.CheckedCounter=0};CParagraphSpellCheckerEngine.prototype.IsFindStart= function(){return this.FindStart};CParagraphSpellCheckerEngine.prototype.SetFindStart=function(isFind){this.FindStart=isFind};CParagraphSpellCheckerEngine.prototype.GetPrefix=function(){if(this.Prefix&&this.Prefix.IsHyphen())return this.Prefix.GetCharCode();return 0};CParagraphSpellCheckerEngine.prototype.CheckPrefix=function(oItem){this.Prefix=oItem};CParagraphSpellCheckerEngine.prototype.FlushWord=function(){if(this.bWord){this.SpellChecker.Add(this.StartPos,this.EndPos,this.sWord,this.CurLcid, this.GetPrefix(),0);this.bWord=false;this.sWord=""}};function CParagraphSpellingMark(SpellCheckerElement,Start,Depth){this.Element=SpellCheckerElement;this.Start=Start;this.Depth=Depth}var DOCUMENT_SPELLING_EASTEGGS=[String.fromCharCode(75,105,114,105,108,108,111,118,73,108,121,97),String.fromCharCode(75,105,114,105,108,108,111,118,83,101,114,103,101,121)];var DOCUMENT_SPELLING_EASTEGGS_VARIANTS=[[String.fromCharCode(75,105,114,105,108,108,111,118,32,73,108,121,97),String.fromCharCode(71,111,111, 100,32,109,97,110),String.fromCharCode(70,111,117,110,100,105,110,103,32,102,97,116,104,101,114,32,111,102,32,116,104,105,115,32,69,100,105,116,111,114,33)],[String.fromCharCode(75,105,114,105,108,108,111,118,32,83,101,114,103,101,121,32,65,108,98,101,114,116,111,118,105,99,104),String.fromCharCode(79,108,100,32,119,111,108,102),String.fromCharCode(70,111,117,110,100,101,114,32,102,97,116,104,101,114,39,115,32,102,97,116,104,101,114)]];"use strict";function CFootEndnote(DocumentController){CDocumentContent.call(this, DocumentController,DocumentController?DocumentController.Get_DrawingDocument():undefined,0,0,0,0,true,false,false);this.Number=1;this.SectPr=null;this.CurtomMarkFollows=false;this.NeedUpdateHint=true;this.Hint="";this.SectionIndex=-1;this.Ref=null;this.PositionInfo={Paragraph:null,Run:null,Line:0,Range:0,X:0,W:0}}CFootEndnote.prototype=Object.create(CDocumentContent.prototype);CFootEndnote.prototype.constructor=CFootEndnote;CFootEndnote.prototype.Copy=function(oDocumentController){var oNote=new CFootEndnote(oDocumentController); oNote.Copy2(this);return oNote};CFootEndnote.prototype.GetElementPageIndex=function(nPageAbs,nColumnAbs){var nStartPage=this.StartPage;var nStartColumn=this.StartColumn;var nColumnsCount=this.ColumnsCount;return Math.max(0,nColumnAbs-nStartColumn+(nPageAbs-nStartPage)*nColumnsCount)};CFootEndnote.prototype.Get_PageContentStartPos=function(nCurPage){var nPageAbs=this.Get_AbsolutePage(nCurPage);var nColumnAbs=this.Get_AbsoluteColumn(nCurPage);return this.Parent.Get_PageContentStartPos(nPageAbs,nColumnAbs, this.GetSectionIndex())};CFootEndnote.prototype.Refresh_RecalcData2=function(nIndex,nCurPage){this.Parent.Refresh_RecalcData2(this.Get_AbsolutePage(nCurPage))};CFootEndnote.prototype.Write_ToBinary2=function(Writer){Writer.WriteLong(AscDFH.historyitem_type_FootEndNote);CDocumentContent.prototype.Write_ToBinary2.call(this,Writer)};CFootEndnote.prototype.Read_FromBinary2=function(Reader){Reader.GetLong();CDocumentContent.prototype.Read_FromBinary2.call(this,Reader)};CFootEndnote.prototype.SetNumber= function(nNumber,oSectPr,bCustomMarkFollows){this.Number=nNumber;this.SectPr=oSectPr;this.CurtomMarkFollows=bCustomMarkFollows};CFootEndnote.prototype.GetNumber=function(){return this.Number};CFootEndnote.prototype.GetReferenceSectPr=function(){return this.SectPr};CFootEndnote.prototype.IsCustomMarkFollows=function(){return this.CurtomMarkFollows};CFootEndnote.prototype.AddDefaultFootnoteContent=function(sText){var oStyles=this.LogicDocument.GetStyles();var oParagraph=this.GetFirstParagraph();oParagraph.Style_Add(oStyles.GetDefaultFootnoteText()); var oRun=new ParaRun(oParagraph,false);oRun.SetRStyle(oStyles.GetDefaultFootnoteReference());if(sText)oRun.AddText(sText);else oRun.AddToContent(0,new ParaFootnoteRef(this));oParagraph.AddToContent(0,oRun);oRun=new ParaRun(oParagraph,false);oRun.AddToContent(0,new ParaSpace);oParagraph.AddToContent(1,oRun);this.MoveCursorToEndPos(false)};CFootEndnote.prototype.AddDefaultEndnoteContent=function(sText){var oStyles=this.LogicDocument.GetStyles();var oParagraph=this.GetFirstParagraph();oParagraph.Style_Add(oStyles.GetDefaultEndnoteText()); var oRun=new ParaRun(oParagraph,false);oRun.SetRStyle(oStyles.GetDefaultEndnoteReference());if(sText)oRun.AddText(sText);else oRun.AddToContent(0,new ParaEndnoteRef(this));oParagraph.AddToContent(0,oRun);oRun=new ParaRun(oParagraph,false);oRun.AddToContent(0,new ParaSpace);oParagraph.AddToContent(1,oRun);this.MoveCursorToEndPos(false)};CFootEndnote.prototype.Recalculate_Page=function(PageIndex,bStart){this.NeedUpdateHint=true;return CDocumentContent.prototype.Recalculate_Page.call(this,PageIndex, bStart)};CFootEndnote.prototype.GetHint=function(){if(true===this.NeedUpdateHint){var arrParagraphs=this.GetAllParagraphs({All:true});this.Hint="";for(var nIndex=0,nCount=arrParagraphs.length;nIndex0?this.Pages[nPageAbs].Columns[nColumnAbs-1]:nPageAbs>0?this.Pages[nPageAbs-1].Columns[this.Pages[nPageAbs-1].Columns.length-1]:null;if(null!==oPrevColumn){var arrElements=oPrevColumn.GetContinuesElements();if(arrElements.length>0&&null!==this.ContinuationSeparator){this.ContinuationSeparator.PrepareRecalculateObject();this.ContinuationSeparator.Reset(X,_Y,XLimit,_YLimit);this.ContinuationSeparator.Set_StartPage(nPageAbs,nColumnAbs,nColumnsCount);this.ContinuationSeparator.Recalculate_Page(0, true);oColumn.ContinuationSeparatorRecalculateObject=this.ContinuationSeparator.SaveRecalculateObject();var oBounds=this.ContinuationSeparator.Get_PageBounds(0);_Y+=oBounds.Bottom-oBounds.Top;oColumn.Height=_Y}for(var nIndex=0,nCount=arrElements.length;nIndex0)if(isLowerY){oColumn.AddContinuesElements(arrFootnotes);return true}else return false;var nColumnsCount=this.Pages[nPageAbs].Columns.length; var X=oColumn.X;var XLimit=oColumn.XLimit;var _Y=oColumn.Height;var _YLimit=oColumn.YLimit-Y;if(isLowerY)_YLimit=oColumn.YLimit-oColumn.ReferenceY;if(oColumn.Elements.length<=0&&null!==this.Separator){this.Separator.PrepareRecalculateObject();this.Separator.Reset(X,_Y,XLimit,_YLimit);this.Separator.Set_StartPage(nPageAbs,nColumnAbs,nColumnsCount);this.Separator.Recalculate_Page(0,true);oColumn.SeparatorRecalculateObject=this.Separator.SaveRecalculateObject();var oBounds=this.Separator.Get_PageBounds(0); _Y+=oBounds.Bottom-oBounds.Top;oColumn.Height=_Y}for(var nIndex=0,nCount=arrFootnotes.length;nIndex=0;--nColumnIndex){var oColumn=this.private_GetPageColumn(nPageAbs,nColumnIndex);if(nColumnIndex===nColumnAbs){var arrContinuesElements= oColumn.GetContinuesElements();for(var nTempIndex=1;nTempIndex0){var oFootnote=oColumn.Elements[oColumn.Elements.length-1];var nStartPage=oFootnote.Get_StartPage_Absolute();if(nStartPage>=nPageAbs||nStartPage===nPageAbs-1&&true!==oFootnote.IsContentOnFirstPage())return oFootnote.GetNumber()+1+nAdditional;else return 1+nAdditional}}}else if(section_footnote_RestartEachSect=== nNumRestart){var oColumn=this.private_GetPageColumn(nPageAbs,nColumnAbs);if(oColumn){var arrContinuesElements=oColumn.GetContinuesElements();if(arrContinuesElements.length>0&&oColumn.Elements.length>0){var oFootnote=oColumn.Elements[oColumn.Elements.length-1];if(oFootnote.GetReferenceSectPr()!==oSectPr)return 1;var nAdditional=0;for(var nTempIndex=0;nTempIndex=0;--nPageIndex){var nColumnStartIndex=nPageIndex===nPageAbs?nColumnAbs:this.Pages[nPageAbs].Columns.length-1;for(var nColumnIndex=nColumnStartIndex;nColumnIndex>=0;--nColumnIndex){oColumn=this.private_GetPageColumn(nPageIndex,nColumnIndex);if(oColumn&&oColumn.Elements.length>0){var oFootnote=oColumn.Elements[oColumn.Elements.length-1];if(oFootnote.GetReferenceSectPr()!==oSectPr)return 1;return oColumn.Elements[oColumn.Elements.length- 1].GetNumber()+1}}}}else{var nFootnotesCount=0;for(var nPageIndex=nPageAbs;nPageIndex>=0;--nPageIndex){var nColumnStartIndex=nPageIndex===nPageAbs?nColumnAbs:this.Pages[nPageAbs].Columns.length-1;for(var nColumnIndex=nColumnStartIndex;nColumnIndex>=0;--nColumnIndex){oColumn=this.private_GetPageColumn(nPageIndex,nColumnIndex);if(oColumn&&oColumn.Elements.length>0)for(var nFootnoteIndex=0,nTempCount=oColumn.Elements.length;nFootnoteIndex0?true:false};CFootnotesController.prototype.Is_UseInDocument= function(sFootnoteId,arrFootnotesList){if(!arrFootnotesList)arrFootnotesList=this.private_GetFootnotesLogicRange(null,null);var oFootnote=null;for(var nIndex=0,nCount=arrFootnotesList.length;nIndex= this.LogicDocument.Content.length)History.RecalcData_Add({Type:AscDFH.historyitem_recalctype_NotesEnd,PageNum:nAbsPageIndex});else this.LogicDocument.Refresh_RecalcData2(nIndex,nAbsPageIndex)}};CFootnotesController.prototype.Get_PageContentStartPos=function(nPageAbs,nColumnAbs){var oColumn=this.private_GetPageColumn(nPageAbs,nColumnAbs);if(!oColumn)return{X:0,Y:0,XLimit:0,YLimit:0};return{X:oColumn.X,Y:oColumn.Height,XLimit:oColumn.XLimit,YLimit:oColumn.YLimit-oColumn.Y}};CFootnotesController.prototype.GetCurFootnote= function(){return this.CurFootnote};CFootnotesController.prototype.IsInDrawing=function(X,Y,PageAbs){var oResult=this.private_GetFootnoteByXY(X,Y,PageAbs);if(oResult){var oFootnote=oResult.Footnote;return oFootnote.IsInDrawing(X,Y,oResult.FootnotePageIndex)}return false};CFootnotesController.prototype.IsTableBorder=function(X,Y,PageAbs){var oResult=this.private_GetFootnoteByXY(X,Y,PageAbs);if(oResult){var oFootnote=oResult.Footnote;return oFootnote.IsTableBorder(X,Y,oResult.FootnotePageIndex)}return null}; CFootnotesController.prototype.IsInText=function(X,Y,PageAbs){var oResult=this.private_GetFootnoteByXY(X,Y,PageAbs);if(oResult){var oFootnote=oResult.Footnote;return oFootnote.IsInText(X,Y,oResult.FootnotePageIndex)}return null};CFootnotesController.prototype.GetNearestPos=function(X,Y,PageAbs,bAnchor,Drawing){var oResult=this.private_GetFootnoteByXY(X,Y,PageAbs);if(oResult){var oFootnote=oResult.Footnote;return oFootnote.Get_NearestPos(oResult.FootnotePageIndex,X,Y,bAnchor,Drawing)}return null}; CFootnotesController.prototype.CheckHitInFootnote=function(X,Y,nPageAbs){if(true===this.IsEmptyPage(nPageAbs))return false;var oPage=this.Pages[nPageAbs];var oColumn=null;var nFindedColumnIndex=0,nColumnsCount=oPage.Columns.length;for(var nColumnIndex=0;nColumnIndex=nColumnsCount)return false;for(var nIndex=0,nCount=oColumn.Elements.length;nIndexthis.Selection.End.Page||this.Selection.Start.Page===this.Selection.End.Page&&(this.Selection.Start.Column>this.Selection.End.Column||this.Selection.Start.Column===this.Selection.End.Column&&this.Selection.Start.Index>this.Selection.End.Index)){this.Selection.Start.Footnote.Selection_SetEnd(-MEASUREMENT_MAX_MM_VALUE, -MEASUREMENT_MAX_MM_VALUE,0,MouseEvent);this.Selection.End.Footnote.Selection_SetStart(MEASUREMENT_MAX_MM_VALUE,MEASUREMENT_MAX_MM_VALUE,this.Selection.End.Footnote.Pages.length-1,MouseEvent);this.Selection.Direction=-1}else{this.Selection.Start.Footnote.Selection_SetEnd(MEASUREMENT_MAX_MM_VALUE,MEASUREMENT_MAX_MM_VALUE,this.Selection.Start.Footnote.Pages.length-1,MouseEvent);this.Selection.End.Footnote.Selection_SetStart(-MEASUREMENT_MAX_MM_VALUE,-MEASUREMENT_MAX_MM_VALUE,0,MouseEvent);this.Selection.Direction= 1}this.Selection.End.Footnote.Selection_SetEnd(X,Y,this.Selection.End.FootnotePageIndex,MouseEvent);var oRange=this.private_GetFootnotesRange(this.Selection.Start,this.Selection.End);for(var sFootnoteId in oRange)if(sFootnoteId!==sStartId&&sFootnoteId!==sEndId){var oFootnote=oRange[sFootnoteId];oFootnote.SelectAll()}this.Selection.Footnotes=oRange}else{this.Selection.End.Footnote.Selection_SetEnd(X,Y,this.Selection.End.FootnotePageIndex,MouseEvent);this.Selection.Footnotes={};this.Selection.Footnotes[this.Selection.Start.Footnote.Get_Id()]= this.Selection.Start.Footnote;this.Selection.Direction=0}};CFootnotesController.prototype.Set_CurrentElement=function(bUpdateStates,PageAbs,oFootnote){if(oFootnote instanceof CFootEndnote){if(oFootnote.IsSelectionUse()){this.CurFootnote=oFootnote;this.Selection.Use=true;this.Selection.Direction=0;this.Selection.Start.Footnote=oFootnote;this.Selection.End.Footnote=oFootnote;this.Selection.Footnotes={};this.Selection.Footnotes[oFootnote.Get_Id()]=oFootnote;this.LogicDocument.Selection.Use=true;this.LogicDocument.Selection.Start= false}else{this.private_SetCurrentFootnoteNoSelection(oFootnote);this.LogicDocument.Selection.Use=false;this.LogicDocument.Selection.Start=false}var bNeedRedraw=this.LogicDocument.GetDocPosType()===docpostype_HdrFtr;this.LogicDocument.SetDocPosType(docpostype_Footnotes);if(false!=bUpdateStates){this.LogicDocument.Document_UpdateInterfaceState();this.LogicDocument.Document_UpdateRulersState();this.LogicDocument.Document_UpdateSelectionState()}if(bNeedRedraw){this.LogicDocument.DrawingDocument.ClearCachePages(); this.LogicDocument.DrawingDocument.FirePaint()}}};CFootnotesController.prototype.AddFootnoteRef=function(){if(true!==this.private_IsOnFootnoteSelected()||null===this.CurFootnote)return;var oFootnote=this.CurFootnote;var oParagraph=oFootnote.Get_FirstParagraph();if(!oParagraph)return;var oStyles=this.LogicDocument.Get_Styles();var oRun=new ParaRun(oParagraph,false);oRun.Add_ToContent(0,new ParaFootnoteRef(oFootnote),false);oRun.Set_RStyle(oStyles.GetDefaultFootnoteReference());oParagraph.Add_ToContent(0, oRun)};CFootnotesController.prototype.GotoPage=function(nPageAbs){var oColumn=this.private_GetPageColumn(nPageAbs,0);if(!oColumn||oColumn.Elements.length<=0)return;var oFootnote=oColumn.Elements[0];this.private_SetCurrentFootnoteNoSelection(oFootnote);oFootnote.MoveCursorToStartPos(false)};CFootnotesController.prototype.CheckTableCoincidence=function(oTable){return false};CFootnotesController.prototype.GotoNextFootnote=function(){var oNextFootnote=this.private_GetNextFootnote(this.CurFootnote);if(oNextFootnote){oNextFootnote.MoveCursorToStartPos(false); this.private_SetCurrentFootnoteNoSelection(oNextFootnote)}};CFootnotesController.prototype.GotoPrevFootnote=function(){var oPrevFootnote=this.private_GetPrevFootnote(this.CurFootnote);if(oPrevFootnote){oPrevFootnote.MoveCursorToStartPos(false);this.private_SetCurrentFootnoteNoSelection(oPrevFootnote)}};CFootnotesController.prototype.GetNumberingInfo=function(oPara,oNumPr,oFootnote,isUseReview){var oNumberingEngine=new CDocumentNumberingInfoEngine(oPara,oNumPr,this.Get_Numbering());if(this.IsSpecialFootnote(oFootnote))oFootnote.GetNumberingInfo(oNumberingEngine, oPara,oNumPr);else{var arrFootnotes=this.LogicDocument.GetFootnotesList(null,oFootnote);for(var nIndex=0,nCount=arrFootnotes.length;nIndex=0){if(oPage.Columns[nCurColumnIndex].Elements.length>0){oColumn=oPage.Columns[nCurColumnIndex];nColumnIndex=nCurColumnIndex;break}nCurColumnIndex--}if(nCurColumnIndex<0){nCurColumnIndex=nColumnIndex+1;while(nCurColumnIndex<=oPage.Columns.length-1){if(oPage.Columns[nCurColumnIndex].Elements.length>0){oColumn=oPage.Columns[nCurColumnIndex];nColumnIndex=nCurColumnIndex; break}nCurColumnIndex++}}}if(!oColumn)return null;for(var nIndex=oColumn.Elements.length-1;nIndex>=0;--nIndex){var oFootnote=oColumn.Elements[nIndex];var nElementPageIndex=oFootnote.GetElementPageIndex(nPageAbs,nColumnIndex);var oBounds=oFootnote.Get_PageBounds(nElementPageIndex);if(oBounds.Top<=Y||0===nIndex)return{Footnote:oFootnote,Index:nIndex,Page:nPageAbs,Column:nColumnIndex,FootnotePageIndex:nElementPageIndex}}return null};CFootnotesController.prototype.private_GetFootnoteByXY=function(X,Y, PageAbs){var oResult=this.private_GetFootnoteOnPageByXY(X,Y,PageAbs);if(null!==oResult)return oResult;var nCurPage=PageAbs-1;while(nCurPage>=0){oResult=this.private_GetFootnoteOnPageByXY(MEASUREMENT_MAX_MM_VALUE,MEASUREMENT_MAX_MM_VALUE,nCurPage);if(null!==oResult)return oResult;nCurPage--}nCurPage=PageAbs+1;while(nCurPageEnd.Page||Start.Page===End.Page&&Start.Column>End.Column||Start.Page===End.Page&&Start.Column===End.Column&&Start.Index>End.Index){var Temp=Start;Start=End;End=Temp}if(Start.Page===End.Page)this.private_GetFootnotesOnPage(Start.Page,Start.Column,End.Column,Start.Index,End.Index,oResult);else{this.private_GetFootnotesOnPage(Start.Page,Start.Column,-1,Start.Index,-1,oResult);for(var CurPage=Start.Page+ 1;CurPage<=End.Page-1;++CurPage)this.private_GetFootnotesOnPage(CurPage,-1,-1,-1,-1,oResult);this.private_GetFootnotesOnPage(End.Page,-1,End.Column,-1,End.Index,oResult)}return oResult};CFootnotesController.prototype.private_GetFootnotesOnPage=function(nPageAbs,nColumnStart,nColumnEnd,nStartIndex,nEndIndex,oFootnotes){var oPage=this.Pages[nPageAbs];if(!oPage)return;var _nColumnStart=-1===nColumnStart?0:nColumnStart;var _nColumnEnd=-1===nColumnEnd?oPage.Columns.length-1:nColumnEnd;var _nStartIndex= -1===nColumnStart||-1===nStartIndex?0:nStartIndex;var _nEndIndex=-1===nColumnEnd||-1===nEndIndex?oPage.Columns[_nColumnEnd].Elements.length-1:nEndIndex;for(var nColIndex=_nColumnStart;nColIndex<=_nColumnEnd;++nColIndex){var nSIndex=nColIndex===_nColumnStart?_nStartIndex:0;var nEIndex=nColIndex===_nColumnEnd?_nEndIndex:oPage.Columns[nColIndex].Elements.length-1;this.private_GetFootnotesOnPageColumn(nPageAbs,nColIndex,nSIndex,nEIndex,oFootnotes)}};CFootnotesController.prototype.private_GetFootnotesOnPageColumn= function(nPageAbs,nColumnAbs,StartIndex,EndIndex,oFootnotes){var oColumn=this.private_GetPageColumn(nPageAbs,nColumnAbs);var _StartIndex=-1===StartIndex?0:StartIndex;var _EndIndex=-1===EndIndex?oColumn.Elements.length-1:EndIndex;for(var nIndex=_StartIndex;nIndex<=_EndIndex;++nIndex){var oFootnote=oColumn.Elements[nIndex];oFootnotes[oFootnote.Get_Id()]=oFootnote}};CFootnotesController.prototype.private_OnNotValidActionForFootnotes=function(){};CFootnotesController.prototype.private_IsOnFootnoteSelected= function(){return 0!==this.Selection.Direction?false:true};CFootnotesController.prototype.private_CheckFootnotesSelectionBeforeAction=function(){if(true!==this.private_IsOnFootnoteSelected()||null===this.CurFootnote){this.private_OnNotValidActionForFootnotes();return false}return true};CFootnotesController.prototype.private_SetCurrentFootnoteNoSelection=function(oFootnote){this.Selection.Use=false;this.CurFootnote=oFootnote;this.Selection.Start.Footnote=oFootnote;this.Selection.End.Footnote=oFootnote; this.Selection.Direction=0;this.Selection.Footnotes={};this.Selection.Footnotes[oFootnote.Get_Id()]=oFootnote};CFootnotesController.prototype.private_GetPrevFootnote=function(oFootnote){if(!oFootnote)return null;var arrList=this.LogicDocument.GetFootnotesList(null,oFootnote);if(!arrList||arrList.length<=1||arrList[arrList.length-1]!==oFootnote)return null;return arrList[arrList.length-2]};CFootnotesController.prototype.private_GetNextFootnote=function(oFootnote){if(!oFootnote)return null;var arrList= this.LogicDocument.GetFootnotesList(oFootnote,null);if(!arrList||arrList.length<=1||arrList[0]!==oFootnote)return null;return arrList[1]};CFootnotesController.prototype.private_GetDirection=function(oFootnote1,oFootnote2){if(oFootnote1==oFootnote2)return 0;var arrList=this.LogicDocument.GetFootnotesList(null,null);for(var nPos=0,nCount=arrList.length;nPos0){var arrFootnotes=this.private_GetFootnotesLogicRange(StartFootnote,oFootnote);if(arrFootnotes.length<=1)return;var oStartFootnote=arrFootnotes[0];var oEndFootnote=arrFootnotes[arrFootnotes.length-1];this.Selection.Use=true;this.Selection.Start.Footnote=oStartFootnote;this.Selection.End.Footnote=oEndFootnote;this.CurFootnote= oEndFootnote;this.Selection.Footnotes={};this.Selection.Direction=1;oStartFootnote.MoveCursorToEndPos(true,false);for(var nPos=0,nCount=arrFootnotes.length;nPos=0;--nIndex){oRes=arrFootnotes[nIndex].FindNextFillingForm(isNext,false);if(oRes)return oRes}return null};function CFootEndnotePageColumn(){this.X=0;this.Y=0;this.XLimit=0;this.YLimit=0;this.ReferenceY=0;this.Height=0;this.Elements=[];this.ContinuesElements=[];this.SeparatorRecalculateObject=null;this.ContinuationSeparatorRecalculateObject=null;this.ContinuationNoticeRecalculateObject=null}CFootEndnotePageColumn.prototype.Reset=function(){this.ReferenceY=0;this.Height=0;this.Elements= [];this.ContinuesElements=[];this.SeparatorRecalculateObject=null;this.ContinuationSeparatorRecalculateObject=null;this.ContinuationNoticeRecalculateObject=null};CFootEndnotePageColumn.prototype.GetContinuesElements=function(){return this.ContinuesElements};CFootEndnotePageColumn.prototype.SetContinuesElements=function(arrContinuesElements){this.ContinuesElements=arrContinuesElements};CFootEndnotePageColumn.prototype.AddContinuesElements=function(arrElements){for(var nIndex=0,nCount=arrElements.length;nIndex< nCount;++nIndex)this.ContinuesElements.push(arrElements[nIndex])};CFootEndnotePageColumn.prototype.SaveRecalculateObject=function(){var oColumn=new CFootEndnotePageColumn;oColumn.X=this.X;oColumn.Y=this.Y;oColumn.XLimit=this.XLimit;oColumn.YLimit=this.YLimit;oColumn.ReferenceY=this.ReferenceY;oColumn.Height=this.Height;for(var nIndex=0,nCount=this.Elements.length;nIndex=this.LogicDocument.Content.length)History.RecalcData_Add({Type:AscDFH.historyitem_recalctype_NotesEnd,PageNum:nAbsPageIndex});else this.LogicDocument.Refresh_RecalcData2(nIndex,nAbsPageIndex)}};CEndnotesController.prototype.Get_PageContentStartPos=function(nPageAbs,nColumnAbs,nSectionAbs){var oColumn=this.private_GetPageColumn(nPageAbs,nColumnAbs,nSectionAbs);if(!oColumn)return{X:0,Y:0,XLimit:0,YLimit:0};return{X:oColumn.X,Y:oColumn.Y+oColumn.Height, XLimit:oColumn.XLimit,YLimit:oColumn.YLimit}};CEndnotesController.prototype.OnContentReDraw=function(StartPageAbs,EndPageAbs){this.LogicDocument.OnContentReDraw(StartPageAbs,EndPageAbs)};CEndnotesController.prototype.GetEndnoteNumberOnPage=function(nPageAbs,nColumnAbs,oSectPr,oCurEndnote){var nNumRestart=section_footnote_RestartContinuous;var nNumStart=1;if(oSectPr){nNumRestart=oSectPr.GetEndnoteNumRestart();nNumStart=oSectPr.GetEndnoteNumStart()}if(section_footnote_RestartEachSect===nNumRestart)for(var nPageIndex= nPageAbs;nPageIndex>=0;--nPageIndex){var oPage=this.Pages[nPageIndex];if(oPage&&oPage.Endnotes.length>0){if(oEndnote===oCurEndnote)return oEndnote.GetNumber();var oEndnote=oPage.Endnotes[oPage.Endnotes.length-1];if(oEndnote.GetReferenceSectPr()!==oSectPr)return 1;return oPage.Endnotes[oPage.Endnotes.length-1].GetNumber()+1}}else{var nEndnotesCount=0;for(var nPageIndex=nPageAbs;nPageIndex>=0;--nPageIndex){var oPage=this.Pages[nPageIndex];if(oPage&&oPage.Endnotes.length>0)for(var nEndnoteIndex=0,nTempCount= oPage.Endnotes.length;nEndnoteIndex0)return true}else if(Asc.c_oAscEndnotePos.SectEnd===nEndnotesPos)for(var nCurPage=this.Pages.length-1;nCurPage>=0;--nCurPage){var oPage=this.Pages[nCurPage];if(oPage.Endnotes.length> 0)return oSectPr===oPage.Endnotes[oPage.Endnotes.length-1].GetReferenceSectPr()}return false};CEndnotesController.prototype.ClearSection=function(nSectionIndex){this.Sections.length=nSectionIndex;this.Sections[nSectionIndex]=new CEndnoteSection};CEndnotesController.prototype.FillSection=function(nPageAbs,nColumnAbs,oSectPr,nSectionIndex,isFinal){var oSection=this.private_UpdateSection(oSectPr,nSectionIndex,isFinal,nPageAbs);if(oSection.Endnotes.length<=0)return recalcresult2_End;oSection.StartPage= nPageAbs;oSection.StartColumn=nColumnAbs};CEndnotesController.prototype.Recalculate=function(X,Y,XLimit,YLimit,nPageAbs,nColumnAbs,nColumnsCount,oSectPr,nSectionIndex,isFinal){var oSection=this.Sections[nSectionIndex];if(!oSection)return recalcresult2_End;if(this.Pages[nPageAbs])this.Pages[nPageAbs].AddSection(nSectionIndex);var nStartPos=0;var isStart=true;if(nPageAbs0?oSectPr.GetColumnSpace(nColumnAbs-1):0;for(var nColumnIndex=0;nColumnIndex=nColumnsCount-1)this.Pages[nPageAbs].SetContinue(true); if(0===nPos&&!oEndnote.IsContentOnFirstPage()){oColumn.EndPos=-1;return recalcresult2_NextPage}else{oColumn.EndPos=nPos;oColumn.Elements.push(oEndnote);var oBounds=oEndnote.GetPageBounds(nRelativePage);_Y+=oBounds.Bottom-oBounds.Top;oColumn.Height=_Y-Y;return recalcresult2_NextPage}}else if(recalcresult2_CurPage===nRecalcResult);oColumn.EndPos=nPos;oColumn.Elements.push(oEndnote);var oBounds=oEndnote.GetPageBounds(nRelativePage);_Y+=oBounds.Bottom-oBounds.Top;oColumn.Height=_Y-Y;if(recalcresult2_NextPage=== nRecalcResult)return recalcresult2_NextPage}for(var nColumnIndex=nColumnAbs+1;nColumnIndexthis.Selection.End.Page||this.Selection.Start.Page===this.Selection.End.Page&&(this.Selection.Start.Section>this.Selection.End.Section||this.Selection.Start.Section===this.Selection.End.Section&&(this.Selection.Start.Column>this.Selection.End.Column|| this.Selection.Start.Column===this.Selection.End.Column&&this.Selection.Start.Index>this.Selection.End.Index))){this.Selection.Start.Endnote.Selection_SetEnd(-MEASUREMENT_MAX_MM_VALUE,-MEASUREMENT_MAX_MM_VALUE,0,oMouseEvent);this.Selection.End.Endnote.Selection_SetStart(MEASUREMENT_MAX_MM_VALUE,MEASUREMENT_MAX_MM_VALUE,this.Selection.End.Endnote.Pages.length-1,oMouseEvent);this.Selection.Direction=-1}else{this.Selection.Start.Endnote.Selection_SetEnd(MEASUREMENT_MAX_MM_VALUE,MEASUREMENT_MAX_MM_VALUE, this.Selection.Start.Endnote.Pages.length-1,oMouseEvent);this.Selection.End.Endnote.Selection_SetStart(-MEASUREMENT_MAX_MM_VALUE,-MEASUREMENT_MAX_MM_VALUE,0,oMouseEvent);this.Selection.Direction=1}this.Selection.End.Endnote.Selection_SetEnd(X,Y,this.Selection.End.EndnotePageIndex,oMouseEvent);var oRange=this.private_GetEndnotesRange(this.Selection.Start,this.Selection.End);for(var sEndnoteId in oRange)if(sEndnoteId!==sStartId&&sEndnoteId!==sEndId){var oEndnote=oRange[sEndnoteId];oEndnote.SelectAll()}this.Selection.Endnotes= oRange}else{this.Selection.End.Endnote.Selection_SetEnd(X,Y,this.Selection.End.EndnotePageIndex,oMouseEvent);this.Selection.Endnotes={};this.Selection.Endnotes[this.Selection.Start.Endnote.GetId()]=this.Selection.Start.Endnote;this.Selection.Direction=0}};CEndnotesController.prototype.Set_CurrentElement=function(bUpdateStates,PageAbs,oEndnote){if(oEndnote instanceof CFootEndnote){if(oEndnote.IsSelectionUse()){this.CurEndnote=oEndnote;this.Selection.Use=true;this.Selection.Direction=0;this.Selection.Start.Endnote= oEndnote;this.Selection.End.Endnote=oEndnote;this.Selection.Endnotes={};this.Selection.Endnotes[oEndnote.GetId()]=oEndnote;this.LogicDocument.Selection.Use=true;this.LogicDocument.Selection.Start=false}else{this.private_SetCurrentEndnoteNoSelection(oEndnote);this.LogicDocument.Selection.Use=false;this.LogicDocument.Selection.Start=false}var bNeedRedraw=this.LogicDocument.GetDocPosType()===docpostype_HdrFtr;this.LogicDocument.SetDocPosType(docpostype_Endnotes);if(false!==bUpdateStates){this.LogicDocument.UpdateInterface(); this.LogicDocument.UpdateRulers();this.LogicDocument.UpdateSelection()}if(bNeedRedraw){this.LogicDocument.DrawingDocument.ClearCachePages();this.LogicDocument.DrawingDocument.FirePaint()}}};CEndnotesController.prototype.AddEndnoteRef=function(){if(true!==this.private_IsOneEndnoteSelected()||null===this.CurEndnote)return;var oEndnote=this.CurEndnote;var oParagraph=oEndnote.GetFirstParagraph();if(!oParagraph)return;var oStyles=this.LogicDocument.GetStyles();var oRun=new ParaRun(oParagraph,false);oRun.AddToContent(0, new ParaEndnoteRef(oEndnote),false);oRun.SetRStyle(oStyles.GetDefaultEndnoteReference());oParagraph.Add_ToContent(0,oRun)};CEndnotesController.prototype.GetCurEndnote=function(){return this.CurEndnote};CEndnotesController.prototype.IsInDrawing=function(X,Y,nPageAbs){var oResult=this.private_GetEndnoteByXY(X,Y,nPageAbs);if(oResult){var oEndnote=oResult.Endnote;return oEndnote.IsInDrawing(X,Y,oResult.EndnotePageIndex)}return false};CEndnotesController.prototype.IsTableBorder=function(X,Y,nPageAbs){var oResult= this.private_GetEndnoteByXY(X,Y,nPageAbs);if(oResult){var oEndnote=oResult.Endnote;return oEndnote.IsTableBorder(X,Y,oResult.EndnotePageIndex)}return null};CEndnotesController.prototype.IsInText=function(X,Y,nPageAbs){var oResult=this.private_GetEndnoteByXY(X,Y,nPageAbs);if(oResult){var oEndnote=oResult.Endnote;return oEndnote.IsInText(X,Y,oResult.EndnotePageIndex)}return null};CEndnotesController.prototype.GetNearestPos=function(X,Y,nPageAbs,bAnchor,oDrawing){var oResult=this.private_GetEndnoteByXY(X, Y,nPageAbs);if(oResult){var oEndnote=oResult.Endnote;return oEndnote.Get_NearestPos(oResult.EndnotePageIndex,X,Y,bAnchor,oDrawing)}return null};CEndnotesController.prototype.CheckHitInEndnote=function(X,Y,nPageAbs){var isCheckBottom=this.GetEndnotePrPos()===Asc.c_oAscEndnotePos.SectEnd;if(true===this.IsEmptyPage(nPageAbs))return false;var oPage=this.Pages[nPageAbs];for(var nIndex=0,nCount=oPage.Sections.length;nIndex=nColumnsCount)return false;for(var nElementIndex=0,nElementsCount=oColumn.Elements.length;nElementIndex=Y))return true}}return false};CEndnotesController.prototype.GetAllParagraphs=function(Props,ParaArray){for(var sId in this.Endnote){var oEndnote=this.Endnote[sId];oEndnote.GetAllParagraphs(Props,ParaArray)}};CEndnotesController.prototype.GetAllTables=function(oProps,arrTables){if(!arrTables)arrTables=[];for(var sId in this.Endnote){var oEndnote=this.Endnote[sId];oEndnote.GetAllTables(oProps,ParaArray)}return arrTables};CEndnotesController.prototype.GetFirstParagraphs=function(){var aParagraphs= [];for(var sId in this.Endnote){var oEndnote=this.Endnote[sId];var oParagrpaph=oEndnote.GetFirstParagraph();if(oParagrpaph&&oParagrpaph.Is_UseInDocument())aParagraphs.push(oParagrpaph)}return aParagraphs};CEndnotesController.prototype.IsContinueRecalculateFromPrevPage=function(nPageAbs){if(nPageAbs<=0||!this.Pages[nPageAbs-1])return false;return this.Pages[nPageAbs-1].Sections.length>0&&true===this.Pages[nPageAbs-1].Continue};CEndnotesController.prototype.GotoNextEndnote=function(){var oNextEndnote= this.private_GetNextEndnote(this.CurEndnote);if(oNextEndnote){oNextEndnote.MoveCursorToStartPos(false);this.private_SetCurrentEndnoteNoSelection(oNextEndnote)}};CEndnotesController.prototype.GotoPrevEndnote=function(){var oPrevEndnote=this.private_GetPrevEndnote(this.CurEndnote);if(oPrevEndnote){oPrevEndnote.MoveCursorToStartPos(false);this.private_SetCurrentEndnoteNoSelection(oPrevEndnote)}};CEndnotesController.prototype.GetNumberingInfo=function(oPara,oNumPr,oEndnote,isUseReview){var oNumberingEngine= new CDocumentNumberingInfoEngine(oPara,oNumPr,this.Get_Numbering());if(this.IsSpecialEndnote(oEndnote))oEndnote.GetNumberingInfo(oNumberingEngine,oPara,oNumPr);else{var arrEndnotes=this.LogicDocument.GetEndnotesList(null,oEndnote);for(var nIndex=0,nCount=arrEndnotes.length;nIndex=0;--nSectionIndex){var oSection=this.Sections[oPage.Sections[nSectionIndex]]; if(!oSection)continue;var oSectionPage=oSection.Pages[nPageAbs];if(!oSectionPage)continue;var oColumn=null;var nColumnIndex=0;for(var nColumnsCount=oSectionPage.Columns.length;nColumnIndex=0){if(oSectionPage.Columns[nCurColumnIndex].Elements.length>0){oColumn=oSectionPage.Columns[nCurColumnIndex];nColumnIndex=nCurColumnIndex;break}nCurColumnIndex--}if(nCurColumnIndex<0){nCurColumnIndex=nColumnIndex+1;while(nCurColumnIndex<=oSectionPage.Columns.length-1){if(oSectionPage.Columns[nCurColumnIndex].Elements.length>0){oColumn=oSectionPage.Columns[nCurColumnIndex];nColumnIndex=nCurColumnIndex;break}nCurColumnIndex++}}}if(!oColumn)continue;for(var nIndex= oColumn.Elements.length-1;nIndex>=0;--nIndex){var oEndnote=oColumn.Elements[nIndex];var nElementPageIndex=oEndnote.GetElementPageIndex(nPageAbs,nColumnIndex);var oBounds=oEndnote.GetPageBounds(nElementPageIndex);if(oBounds.Top<=Y||0===nIndex&&0===nSectionIndex)return{Endnote:oEndnote,Index:nIndex,Section:oPage.Sections[nSectionIndex],Page:nPageAbs,Column:nColumnIndex,EndnotePageIndex:nElementPageIndex}}}return null};CEndnotesController.prototype.private_GetEndnoteByXY=function(X,Y,nPageAbs){var oResult= this.private_GetEndnoteOnPageByXY(X,Y,nPageAbs);if(null!==oResult)return oResult;var nCurPage=nPageAbs-1;while(nCurPage>=0){oResult=this.private_GetEndnoteOnPageByXY(MEASUREMENT_MAX_MM_VALUE,MEASUREMENT_MAX_MM_VALUE,nCurPage);if(null!==oResult)return oResult;nCurPage--}nCurPage=nPageAbs+1;while(nCurPageEnd.Page||Start.Page===End.Page&&(Start.Section>End.Section||Start.Section===End.Section&&(Start.Column>End.Column||Start.Column===End.Column&&Start.Index>End.Index))){var Temp=Start;Start=End;End=Temp}if(Start.Page===End.Page)this.private_GetEndnotesOnPage(Start.Page,Start.Section,Start.Column,Start.Index,End.Section,End.Column,End.Index,oResult);else{this.private_GetEndnotesOnPage(Start.Page,Start.Section,Start.Column,Start.Index,-1,-1,-1,oResult); for(var nCurPage=Start.Page+1;nCurPage<=End.Page-1;++nCurPage)this.private_GetEndnotesOnPage(nCurPage,-1,-1,-1,-1,-1,-1,oResult);this.private_GetEndnotesOnPage(End.Page,-1,-1,-1,End.Section,End.Column,End.Index,oResult)}return oResult};CEndnotesController.prototype.private_GetEndnotesOnPage=function(nPageAbs,nSectionStart,nColumnStart,nStartIndex,nSectionEnd,nColumnEnd,nEndIndex,oEndnotes){var _nSectionStart=nSectionStart;var _nSectionEnd=nSectionEnd;if(-1===nSectionStart||-1===nSectionEnd){var oPage= this.Pages[nPageAbs];if(!oPage||oPage.Sections.length<=0)return;if(-1===nSectionStart)_nSectionStart=oPage.Sections[0];if(-1===nSectionEnd)_nSectionEnd=oPage.Sections[oPage.Sections.length-1]}for(var nSectionIndex=_nSectionStart;nSectionIndex<=_nSectionEnd;++nSectionIndex){var oSection=this.Sections[nSectionIndex];if(!oSection)return;var oSectionPage=oSection.Pages[nPageAbs];if(!oSectionPage)return;var _nColumnStart=-1===nColumnStart||nSectionIndex!==_nSectionStart?0:nColumnStart;var _nColumnEnd= -1===nColumnEnd||nSectionIndex!==_nSectionEnd?oSectionPage.Columns.length-1:nColumnEnd;var _nStartIndex=-1===nColumnStart||-1===nStartIndex?0:nStartIndex;var _nEndIndex=-1===nColumnEnd||-1===nEndIndex?oSectionPage.Columns[_nColumnEnd].Elements.length-1:nEndIndex;for(var nColIndex=_nColumnStart;nColIndex<=_nColumnEnd;++nColIndex){var nSIndex=nSectionIndex===_nSectionStart&&nColIndex===_nColumnStart?_nStartIndex:0;var nEIndex=nSectionIndex===_nSectionEnd&&nColIndex===_nColumnEnd?_nEndIndex:oSectionPage.Columns[nColIndex].Elements.length- 1;this.private_GetEndnotesOnPageColumn(nPageAbs,nColIndex,nSectionIndex,nSIndex,nEIndex,oEndnotes)}}};CEndnotesController.prototype.private_GetEndnotesOnPageColumn=function(nPageAbs,nColumnAbs,nSectionAbs,nStartIndex,nEndIndex,oEndnotes){var oColumn=this.private_GetPageColumn(nPageAbs,nColumnAbs,nSectionAbs);var _StartIndex=-1===nStartIndex?0:nStartIndex;var _EndIndex=-1===nEndIndex?oColumn.Elements.length-1:nEndIndex;for(var nIndex=_StartIndex;nIndex<=_EndIndex;++nIndex){var oEndnote=oColumn.Elements[nIndex]; oEndnotes[oEndnote.GetId()]=oEndnote}};CEndnotesController.prototype.private_OnNotValidActionForEndnotes=function(){};CEndnotesController.prototype.private_IsOneEndnoteSelected=function(){return 0===this.Selection.Direction};CEndnotesController.prototype.private_CheckEndnotesSelectionBeforeAction=function(){if(true!==this.private_IsOneEndnoteSelected()||null===this.CurEndnote){this.private_OnNotValidActionForEndnotes();return false}return true};CEndnotesController.prototype.private_SetCurrentEndnoteNoSelection= function(oEndnote){this.Selection.Use=false;this.CurEndnote=oEndnote;this.Selection.Start.Endnote=oEndnote;this.Selection.End.Endnote=oEndnote;this.Selection.Direction=0;this.Selection.Endnotes={};this.Selection.Endnotes[oEndnote.GetId()]=oEndnote};CEndnotesController.prototype.private_GetPrevEndnote=function(oEndnote){if(!oEndnote)return null;var arrList=this.LogicDocument.GetEndnotesList(null,oEndnote);if(!arrList||arrList.length<=1||arrList[arrList.length-1]!==oEndnote)return null;return arrList[arrList.length- 2]};CEndnotesController.prototype.private_GetNextEndnote=function(oEndnote){if(!oEndnote)return null;var arrList=this.LogicDocument.GetEndnotesList(oEndnote,null);if(!arrList||arrList.length<=1||arrList[0]!==oEndnote)return null;return arrList[1]};CEndnotesController.prototype.private_GetDirection=function(oEndote1,oEndnote2){if(oEndote1==oEndnote2)return 0;var arrList=this.LogicDocument.GetEndnotesList(null,null);for(var nPos=0,nCount=arrList.length;nPosnSectionIndex)return true;var oSection=this.Sections[nSectionIndex];if(!oSection)return false; var nStartPos=0;if(nPageAbs-1<=oSection.StartPage||!oSection.Pages[nPageAbs-1]||!oSection.Pages[nPageAbs-1].Columns.length)return false;else nStartPos=oSection.Pages[nPageAbs-1].Columns[0].EndPos;if(oSection.Endnotes[nStartPos]===this.CurEndnote){var nEndnotePageIndex=this.CurEndnote.GetElementPageIndex(oLogicDocument.FullRecalc.PageIndex,oLogicDocument.FullRecalc.ColumnIndex);return this.CurEndnote.CanUpdateTarget(nEndnotePageIndex)}else for(var nPos=0;nPos0){var arrEndnotes=this.private_GetEndnotesLogicRange(StartEndnote,oEndnote);if(arrEndnotes.length<=1)return;var oStartEndnote=arrEndnotes[0];var oEndEndnote=arrEndnotes[arrEndnotes.length-1];this.Selection.Use= true;this.Selection.Start.Endnote=oStartEndnote;this.Selection.End.Endnote=oEndEndnote;this.CurEndnote=oEndEndnote;this.Selection.Endnotes={};this.Selection.Direction=1;oStartEndnote.MoveCursorToEndPos(true,false);for(var nPos=0,nCount=arrEndnotes.length;nPos=0;--nIndex){oRes=arrEndnotes[nIndex].FindNextFillingForm(isNext, false);if(oRes)return oRes}return null};function CEndnotePage(){this.Endnotes=[];this.Sections=[];this.Continue=false}CEndnotePage.prototype.Reset=function(){this.Endnotes=[];this.Sections=[]};CEndnotePage.prototype.AddEndnotes=function(arrEndnotes){var nStartPos=0;for(var nAddIndex=0,nAddCount=arrEndnotes.length;nAddIndex>0;this.m_lWidthPix=width_px>>0;this.m_dWidthMM=width_mm;this.m_dHeightMM=height_mm;this.m_dDpiX=25.4*this.m_lWidthPix/this.m_dWidthMM;this.m_dDpiY=25.4*this.m_lHeightPix/ this.m_dHeightMM;this.m_oCoordTransform.sx=this.m_dDpiX/25.4;this.m_oCoordTransform.sy=this.m_dDpiY/25.4;this.TextureFillTransformScaleX=1/this.m_oCoordTransform.sx;this.TextureFillTransformScaleY=1/this.m_oCoordTransform.sy;this.m_oLastFont.Clear();this.m_oContext.save();this.m_bPenColorInit=false;this.m_bBrushColorInit=false},EndDraw:function(){},setTextGlobalAlpha:function(alpha){this.textAlpha=alpha},getTextGlobalAlpha:function(){return this.textAlpha},resetTextGlobalAlpha:function(){this.textAlpha= undefined},put_GlobalAlpha:function(enable,alpha){if(false===enable){this.globalAlpha=1;this.m_oContext.globalAlpha=1}else{this.globalAlpha=alpha;this.m_oContext.globalAlpha=alpha}},Start_GlobalAlpha:function(){},End_GlobalAlpha:function(){if(false===this.m_bIntegerGrid)this.m_oContext.setTransform(1,0,0,1,0,0);this.b_color1(255,255,255,140);this.m_oContext.fillRect(0,0,this.m_lWidthPix,this.m_lHeightPix);this.m_oContext.beginPath();if(false===this.m_bIntegerGrid)this.m_oContext.setTransform(this.m_oFullTransform.sx, this.m_oFullTransform.shy,this.m_oFullTransform.shx,this.m_oFullTransform.sy,this.m_oFullTransform.tx,this.m_oFullTransform.ty)},darkModeOverride:function(r,g,b,a){this.p_color_old=this.p_color;this.p_color=function(r,g,b,a){r<10&&g<10&&b<10?this.p_color_old(255-r,255-g,255-b,a):this.p_color_old(r,g,b,a)};this.b_color1_old=this.b_color1;this.b_color1=function(r,g,b,a){r<10&&g<10&&b<10?this.b_color1_old(255-r,255-g,255-b,a):this.b_color1_old(r,g,b,a)};this.b_color2_old=this.b_color2;this.b_color2= function(r,g,b,a){r<10&&g<10&&b<10?this.b_color2_old(255-r,255-g,255-b,a):this.b_color2_old(r,g,b,a)}},p_color:function(r,g,b,a){var _c=this.m_oPen.Color;if(this.m_bPenColorInit&&_c.R===r&&_c.G===g&&_c.B===b&&_c.A===a)return;this.m_bPenColorInit=true;_c.R=r;_c.G=g;_c.B=b;_c.A=a;this.m_oContext.strokeStyle="rgba("+_c.R+","+_c.G+","+_c.B+","+_c.A/255+")"},p_width:function(w){this.m_oPen.LineWidth=w/1E3;if(!this.m_bIntegerGrid)if(0!=this.m_oPen.LineWidth)this.m_oContext.lineWidth=this.m_oPen.LineWidth; else{var _x1=this.m_oFullTransform.TransformPointX(0,0);var _y1=this.m_oFullTransform.TransformPointY(0,0);var _x2=this.m_oFullTransform.TransformPointX(1,1);var _y2=this.m_oFullTransform.TransformPointY(1,1);var _koef=Math.sqrt(((_x2-_x1)*(_x2-_x1)+(_y2-_y1)*(_y2-_y1))/2);this.m_oContext.lineWidth=1/_koef}else if(0!=this.m_oPen.LineWidth){var _m=this.m_oFullTransform;var x=_m.sx+_m.shx;var y=_m.sy+_m.shy;var koef=Math.sqrt((x*x+y*y)/2);this.m_oContext.lineWidth=this.m_oPen.LineWidth*koef}else this.m_oContext.lineWidth= 1},p_dash:function(params){if(!this.m_oContext.setLineDash)return;this.dash_no_smart=params?params.slice():null;this.m_oContext.setLineDash(params?params:[])},b_color1:function(r,g,b,a){var _c=this.m_oBrush.Color1;if(this.m_bBrushColorInit&&_c.R===r&&_c.G===g&&_c.B===b&&_c.A===a)return;this.m_bBrushColorInit=true;_c.R=r;_c.G=g;_c.B=b;_c.A=a;this.m_oContext.fillStyle="rgba("+_c.R+","+_c.G+","+_c.B+","+_c.A/255+")"},b_color2:function(r,g,b,a){var _c=this.m_oBrush.Color2;_c.R=r;_c.G=g;_c.B=b;_c.A=a}, transform:function(sx,shy,shx,sy,tx,ty){var _t=this.m_oTransform;_t.sx=sx;_t.shx=shx;_t.shy=shy;_t.sy=sy;_t.tx=tx;_t.ty=ty;this.CalculateFullTransform();if(false===this.m_bIntegerGrid){var _ft=this.m_oFullTransform;this.m_oContext.setTransform(_ft.sx,_ft.shy,_ft.shx,_ft.sy,_ft.tx,_ft.ty)}if(null!=this.m_oFontManager)this.m_oFontManager.SetTextMatrix(_t.sx,_t.shy,_t.shx,_t.sy,_t.tx,_t.ty)},CalculateFullTransform:function(isInvertNeed){var _ft=this.m_oFullTransform;var _t=this.m_oTransform;_ft.sx=_t.sx; _ft.shx=_t.shx;_ft.shy=_t.shy;_ft.sy=_t.sy;_ft.tx=_t.tx;_ft.ty=_t.ty;global_MatrixTransformer.MultiplyAppend(_ft,this.m_oCoordTransform);var _it=this.m_oInvertFullTransform;_it.sx=_ft.sx;_it.shx=_ft.shx;_it.shy=_ft.shy;_it.sy=_ft.sy;_it.tx=_ft.tx;_it.ty=_ft.ty;if(false!==isInvertNeed)global_MatrixTransformer.MultiplyAppendInvert(_it,_t)},_s:function(){this.m_oContext.beginPath()},_e:function(){this.m_oContext.beginPath()},_z:function(){this.m_oContext.closePath()},_m:function(x,y){if(false===this.m_bIntegerGrid){this.m_oContext.moveTo(x, y);if(this.ArrayPoints!=null)this.ArrayPoints[this.ArrayPoints.length]={x:x,y:y}}else{var _x=this.m_oFullTransform.TransformPointX(x,y)>>0;var _y=this.m_oFullTransform.TransformPointY(x,y)>>0;this.m_oContext.moveTo(_x+.5,_y+.5)}},_l:function(x,y){if(false===this.m_bIntegerGrid){this.m_oContext.lineTo(x,y);if(this.ArrayPoints!=null)this.ArrayPoints[this.ArrayPoints.length]={x:x,y:y}}else{var _x=this.m_oFullTransform.TransformPointX(x,y)>>0;var _y=this.m_oFullTransform.TransformPointY(x,y)>>0;this.m_oContext.lineTo(_x+ .5,_y+.5)}},_c:function(x1,y1,x2,y2,x3,y3){if(false===this.m_bIntegerGrid){this.m_oContext.bezierCurveTo(x1,y1,x2,y2,x3,y3);if(this.ArrayPoints!=null){this.ArrayPoints[this.ArrayPoints.length]={x:x1,y:y1};this.ArrayPoints[this.ArrayPoints.length]={x:x2,y:y2};this.ArrayPoints[this.ArrayPoints.length]={x:x3,y:y3}}}else{var _x1=this.m_oFullTransform.TransformPointX(x1,y1)>>0;var _y1=this.m_oFullTransform.TransformPointY(x1,y1)>>0;var _x2=this.m_oFullTransform.TransformPointX(x2,y2)>>0;var _y2=this.m_oFullTransform.TransformPointY(x2, y2)>>0;var _x3=this.m_oFullTransform.TransformPointX(x3,y3)>>0;var _y3=this.m_oFullTransform.TransformPointY(x3,y3)>>0;this.m_oContext.bezierCurveTo(_x1+.5,_y1+.5,_x2+.5,_y2+.5,_x3+.5,_y3+.5)}},_c2:function(x1,y1,x2,y2){if(false===this.m_bIntegerGrid){this.m_oContext.quadraticCurveTo(x1,y1,x2,y2);if(this.ArrayPoints!=null){this.ArrayPoints[this.ArrayPoints.length]={x:x1,y:y1};this.ArrayPoints[this.ArrayPoints.length]={x:x2,y:y2}}}else{var _x1=this.m_oFullTransform.TransformPointX(x1,y1)>>0;var _y1= this.m_oFullTransform.TransformPointY(x1,y1)>>0;var _x2=this.m_oFullTransform.TransformPointX(x2,y2)>>0;var _y2=this.m_oFullTransform.TransformPointY(x2,y2)>>0;this.m_oContext.quadraticCurveTo(_x1+.5,_y1+.5,_x2+.5,_y2+.5)}},ds:function(){this.m_oContext.stroke()},df:function(){this.m_oContext.fill()},save:function(){this.m_oContext.save()},restore:function(){this.m_oContext.restore();this.m_bPenColorInit=false;this.m_bBrushColorInit=false},clip:function(){this.m_oContext.clip()},reset:function(){this.m_oTransform.Reset(); this.CalculateFullTransform(false);if(!this.m_bIntegerGrid)this.m_oContext.setTransform(this.m_oCoordTransform.sx,0,0,this.m_oCoordTransform.sy,0,0)},transform3:function(m,isNeedInvert){var _t=this.m_oTransform;_t.sx=m.sx;_t.shx=m.shx;_t.shy=m.shy;_t.sy=m.sy;_t.tx=m.tx;_t.ty=m.ty;this.CalculateFullTransform(isNeedInvert);if(!this.m_bIntegerGrid){var _ft=this.m_oFullTransform;this.m_oContext.setTransform(_ft.sx,_ft.shy,_ft.shx,_ft.sy,_ft.tx,_ft.ty)}else this.SetIntegerGrid(false)},FreeFont:function(){this.m_oFontManager.m_pFont= null},ClearLastFont:function(){this.m_oLastFont=new AscCommon.CFontSetup;this.m_oLastFont2=null},drawImage2:function(img,x,y,w,h,alpha,srcRect){if(srcRect){if(srcRect.l>=100||srcRect.t>=100)return;if(srcRect.r<=0||srcRect.b<=0)return}var isA=undefined!==alpha&&null!=alpha&&255!=alpha;var _oldGA=0;if(isA){_oldGA=this.m_oContext.globalAlpha;this.m_oContext.globalAlpha=alpha/255}if(false===this.m_bIntegerGrid)if(!srcRect)if(!global_MatrixTransformer.IsIdentity2(this.m_oTransform))this.m_oContext.drawImage(img, x,y,w,h);else{var xx=this.m_oFullTransform.TransformPointX(x,y);var yy=this.m_oFullTransform.TransformPointY(x,y);var rr=this.m_oFullTransform.TransformPointX(x+w,y+h);var bb=this.m_oFullTransform.TransformPointY(x+w,y+h);var ww=rr-xx;var hh=bb-yy;if(Math.abs(img.width-ww)<2&&Math.abs(img.height-hh)<2){this.m_oContext.setTransform(1,0,0,1,0,0);this.m_oContext.drawImage(img,xx>>0,yy>>0);var _ft=this.m_oFullTransform;this.m_oContext.setTransform(_ft.sx,_ft.shy,_ft.shx,_ft.sy,_ft.tx,_ft.ty)}else this.m_oContext.drawImage(img, x,y,w,h)}else{var _w=img.width;var _h=img.height;if(_w>0&&_h>0){var _sx=0;var _sy=0;var _sr=_w;var _sb=_h;var _l=srcRect.l;var _t=srcRect.t;var _r=100-srcRect.r;var _b=100-srcRect.b;_sx+=_l*_w/100;_sr-=_r*_w/100;_sy+=_t*_h/100;_sb-=_b*_h/100;var naturalW=_w;naturalW-=_sx;naturalW+=_sr-_w;var naturalH=_h;naturalH-=_sy;naturalH+=_sb-_h;var tmpW=w;var tmpH=h;if(_sx<0){x+=-_sx*tmpW/naturalW;w-=-_sx*tmpW/naturalW;_sx=0}if(_sy<0){y+=-_sy*tmpH/naturalH;h-=-_sy*tmpH/naturalH;_sy=0}if(_sr>_w){w-=(_sr-_w)* tmpW/naturalW;_sr=_w}if(_sb>_h){h-=(_sb-_h)*tmpH/naturalH;_sb=_h}if(_sx>=_sr||_sx>=_w||_sr<=0||w<=0)return;if(_sy>=_sb||_sy>=_h||_sb<=0||h<=0)return;this.m_oContext.drawImage(img,_sx,_sy,_sr-_sx,_sb-_sy,x,y,w,h)}else this.m_oContext.drawImage(img,x,y,w,h)}else{var _x1=this.m_oFullTransform.TransformPointX(x,y)>>0;var _y1=this.m_oFullTransform.TransformPointY(x,y)>>0;var _x2=this.m_oFullTransform.TransformPointX(x+w,y+h)>>0;var _y2=this.m_oFullTransform.TransformPointY(x+w,y+h)>>0;x=_x1;y=_y1;w=_x2- _x1;h=_y2-_y1;if(!srcRect)if(!global_MatrixTransformer.IsIdentity2(this.m_oTransform))this.m_oContext.drawImage(img,_x1,_y1,w,h);else if(Math.abs(img.width-w)<2&&Math.abs(img.height-h)<2)this.m_oContext.drawImage(img,x,y);else this.m_oContext.drawImage(img,_x1,_y1,w,h);else{var _w=img.width;var _h=img.height;if(_w>0&&_h>0){var __w=w;var __h=h;var _delW=Math.max(0,-srcRect.l)+Math.max(0,srcRect.r-100)+100;var _delH=Math.max(0,-srcRect.t)+Math.max(0,srcRect.b-100)+100;var _sx=0;if(srcRect.l>0&&srcRect.l< 100)_sx=Math.min(_w*srcRect.l/100>>0,_w-1);else if(srcRect.l<0){var _off=-srcRect.l/_delW*__w;x+=_off;w-=_off}var _sy=0;if(srcRect.t>0&&srcRect.t<100)_sy=Math.min(_h*srcRect.t/100>>0,_h-1);else if(srcRect.t<0){var _off=-srcRect.t/_delH*__h;y+=_off;h-=_off}var _sr=_w;if(srcRect.r>0&&srcRect.r<100)_sr=Math.max(Math.min(_w*srcRect.r/100>>0,_w-1),_sx);else if(srcRect.r>100){var _off=(srcRect.r-100)/_delW*__w;w-=_off}var _sb=_h;if(srcRect.b>0&&srcRect.b<100)_sb=Math.max(Math.min(_h*srcRect.b/100>>0,_h- 1),_sy);else if(srcRect.b>100){var _off=(srcRect.b-100)/_delH*__h;h-=_off}if(_sr-_sx>0&&_sb-_sy>0&&w>0&&h>0)this.m_oContext.drawImage(img,_sx,_sy,_sr-_sx,_sb-_sy,x,y,w,h)}else this.m_oContext.drawImage(img,x,y,w,h)}}if(isA)this.m_oContext.globalAlpha=_oldGA},drawImage:function(img,x,y,w,h,alpha,srcRect,nativeImage){if(nativeImage){this.drawImage2(nativeImage,x,y,w,h,alpha,srcRect);return}var _img=editor.ImageLoader.map_image_index[img];if(_img!=undefined&&_img.Status==AscFonts.ImageLoadStatus.Loading); else if(_img!=undefined&&_img.Image!=null)this.drawImage2(_img.Image,x,y,w,h,alpha,srcRect);else{var _x=x;var _y=y;var _r=x+w;var _b=y+h;var ctx=this.m_oContext;var old_p=ctx.lineWidth;var bIsNoIntGrid=false;if(this.m_bIntegerGrid){_x=(this.m_oFullTransform.TransformPointX(x,y)>>0)+.5;_y=(this.m_oFullTransform.TransformPointY(x,y)>>0)+.5;_r=(this.m_oFullTransform.TransformPointX(x+w,y+h)>>0)+.5;_b=(this.m_oFullTransform.TransformPointY(x+w,y+h)>>0)+.5;ctx.lineWidth=1}else if(global_MatrixTransformer.IsIdentity2(this.m_oTransform)){bIsNoIntGrid= true;this.SetIntegerGrid(true);_x=(this.m_oFullTransform.TransformPointX(x,y)>>0)+.5;_y=(this.m_oFullTransform.TransformPointY(x,y)>>0)+.5;_r=(this.m_oFullTransform.TransformPointX(x+w,y+h)>>0)+.5;_b=(this.m_oFullTransform.TransformPointY(x+w,y+h)>>0)+.5;ctx.lineWidth=1}else ctx.lineWidth=1/this.m_oCoordTransform.sx;ctx.strokeStyle="#F98C76";ctx.beginPath();ctx.moveTo(_x,_y);ctx.lineTo(_r,_b);ctx.moveTo(_r,_y);ctx.lineTo(_x,_b);ctx.stroke();ctx.beginPath();ctx.moveTo(_x,_y);ctx.lineTo(_r,_y);ctx.lineTo(_r, _b);ctx.lineTo(_x,_b);ctx.closePath();ctx.stroke();ctx.beginPath();if(bIsNoIntGrid)this.SetIntegerGrid(false);ctx.lineWidth=old_p;ctx.strokeStyle="rgba("+this.m_oPen.Color.R+","+this.m_oPen.Color.G+","+this.m_oPen.Color.B+","+this.m_oPen.Color.A/255+")"}},GetFont:function(){return this.m_oCurFont},font:function(font_id,font_size){AscFonts.g_font_infos[AscFonts.g_map_font_index[font_id]].LoadFont(editor.FontLoader,this.IsUseFonts2?this.m_oFontManager2:this.m_oFontManager,Math.max(font_size,1),0,this.m_dDpiX, this.m_dDpiY,this.m_oTransform)},SetFont:function(font){if(null==font)return;this.m_oCurFont.Name=font.FontFamily.Name;this.m_oCurFont.FontSize=font.FontSize;this.m_oCurFont.Bold=font.Bold;this.m_oCurFont.Italic=font.Italic;var bItalic=true===font.Italic;var bBold=true===font.Bold;var oFontStyle=FontStyle.FontStyleRegular;if(!bItalic&&bBold)oFontStyle=FontStyle.FontStyleBold;else if(bItalic&&!bBold)oFontStyle=FontStyle.FontStyleItalic;else if(bItalic&&bBold)oFontStyle=FontStyle.FontStyleBoldItalic; var _last_font=this.IsUseFonts2?this.m_oLastFont2:this.m_oLastFont;var _font_manager=this.IsUseFonts2?this.m_oFontManager2:this.m_oFontManager;_last_font.SetUpName=font.FontFamily.Name;_last_font.SetUpSize=font.FontSize;_last_font.SetUpStyle=oFontStyle;g_fontApplication.LoadFont(_last_font.SetUpName,AscCommon.g_font_loader,_font_manager,font.FontSize,oFontStyle,this.m_dDpiX,this.m_dDpiY,this.m_oTransform,this.LastFontOriginInfo);var _mD=_last_font.SetUpMatrix;var _mS=this.m_oTransform;_mD.sx=_mS.sx; _mD.sy=_mS.sy;_mD.shx=_mS.shx;_mD.shy=_mS.shy;_mD.tx=_mS.tx;_mD.ty=_mS.ty},SetTextPr:function(textPr,theme){if(theme&&textPr&&textPr.ReplaceThemeFonts)textPr.ReplaceThemeFonts(theme.themeElements.fontScheme);this.m_oTextPr=textPr;if(theme)this.m_oGrFonts.checkFromTheme(theme.themeElements.fontScheme,this.m_oTextPr.RFonts);else this.m_oGrFonts=this.m_oTextPr.RFonts},SetFontSlot:function(slot,fontSizeKoef){var _rfonts=this.m_oGrFonts;var _lastFont=this.IsUseFonts2?this.m_oLastFont2:this.m_oLastFont; switch(slot){case fontslot_ASCII:{_lastFont.Name=_rfonts.Ascii.Name;_lastFont.Size=this.m_oTextPr.FontSize;_lastFont.Bold=this.m_oTextPr.Bold;_lastFont.Italic=this.m_oTextPr.Italic;break}case fontslot_CS:{_lastFont.Name=_rfonts.CS.Name;_lastFont.Size=this.m_oTextPr.FontSizeCS;_lastFont.Bold=this.m_oTextPr.BoldCS;_lastFont.Italic=this.m_oTextPr.ItalicCS;break}case fontslot_EastAsia:{_lastFont.Name=_rfonts.EastAsia.Name;_lastFont.Size=this.m_oTextPr.FontSize;_lastFont.Bold=this.m_oTextPr.Bold;_lastFont.Italic= this.m_oTextPr.Italic;break}case fontslot_HAnsi:default:{_lastFont.Name=_rfonts.HAnsi.Name;_lastFont.Size=this.m_oTextPr.FontSize;_lastFont.Bold=this.m_oTextPr.Bold;_lastFont.Italic=this.m_oTextPr.Italic;break}}if(undefined!==fontSizeKoef)_lastFont.Size*=fontSizeKoef;var _style=0;if(_lastFont.Italic)_style+=2;if(_lastFont.Bold)_style+=1;var _font_manager=this.IsUseFonts2?this.m_oFontManager2:this.m_oFontManager;if(_lastFont.Name!=_lastFont.SetUpName||_lastFont.Size!=_lastFont.SetUpSize||_style!=_lastFont.SetUpStyle|| !_font_manager.m_pFont){_lastFont.SetUpName=_lastFont.Name;_lastFont.SetUpSize=_lastFont.Size;_lastFont.SetUpStyle=_style;g_fontApplication.LoadFont(_lastFont.SetUpName,AscCommon.g_font_loader,_font_manager,_lastFont.SetUpSize,_lastFont.SetUpStyle,this.m_dDpiX,this.m_dDpiY,this.m_oTransform,this.LastFontOriginInfo);var _mD=_lastFont.SetUpMatrix;var _mS=this.m_oTransform;_mD.sx=_mS.sx;_mD.sy=_mS.sy;_mD.shx=_mS.shx;_mD.shy=_mS.shy;_mD.tx=_mS.tx;_mD.ty=_mS.ty}else{var _mD=_lastFont.SetUpMatrix;var _mS= this.m_oTransform;if(_mD.sx!=_mS.sx||_mD.sy!=_mS.sy||_mD.shx!=_mS.shx||_mD.shy!=_mS.shy||_mD.tx!=_mS.tx||_mD.ty!=_mS.ty){_mD.sx=_mS.sx;_mD.sy=_mS.sy;_mD.shx=_mS.shx;_mD.shy=_mS.shy;_mD.tx=_mS.tx;_mD.ty=_mS.ty;_font_manager.SetTextMatrix(_mD.sx,_mD.shy,_mD.shx,_mD.sy,_mD.tx,_mD.ty)}}},GetTextPr:function(){return this.m_oTextPr},FillText:function(x,y,text){if(this.m_bIsBreak)return;var _x=this.m_oInvertFullTransform.TransformPointX(x,y);var _y=this.m_oInvertFullTransform.TransformPointY(x,y);var _font_manager= this.IsUseFonts2?this.m_oFontManager2:this.m_oFontManager;try{var _code=text.charCodeAt(0);if(null!=this.LastFontOriginInfo.Replace)_code=g_fontApplication.GetReplaceGlyph(_code,this.LastFontOriginInfo.Replace);_font_manager.LoadString4C(_code,_x,_y)}catch(err){}if(false===this.m_bIntegerGrid)this.m_oContext.setTransform(1,0,0,1,0,0);var pGlyph=_font_manager.m_oGlyphString.m_pGlyphsBuffer[0];if(null==pGlyph)return;if(null!=pGlyph.oBitmap){var oldAlpha=undefined;if(this.textAlpha){oldAlpha=this.m_oContext.globalAlpha; this.m_oContext.globalAlpha=oldAlpha*this.textAlpha}this.private_FillGlyph(pGlyph);if(undefined!==oldAlpha)this.m_oContext.globalAlpha=oldAlpha}if(false===this.m_bIntegerGrid)this.m_oContext.setTransform(this.m_oFullTransform.sx,this.m_oFullTransform.shy,this.m_oFullTransform.shx,this.m_oFullTransform.sy,this.m_oFullTransform.tx,this.m_oFullTransform.ty)},t:function(text,x,y,isBounds){if(this.m_bIsBreak)return;var _x=this.m_oInvertFullTransform.TransformPointX(x,y);var _y=this.m_oInvertFullTransform.TransformPointY(x, y);var _font_manager=this.IsUseFonts2?this.m_oFontManager2:this.m_oFontManager;try{_font_manager.LoadString2(text,_x,_y)}catch(err){}this.m_oContext.setTransform(1,0,0,1,0,0);var _bounds=isBounds?{x:1E5,y:1E5,r:-1E5,b:-1E5}:null;while(true){var pGlyph=_font_manager.GetNextChar2();if(null==pGlyph)break;if(null!=pGlyph.oBitmap)this.private_FillGlyph(pGlyph,_bounds)}if(false===this.m_bIntegerGrid)this.m_oContext.setTransform(this.m_oFullTransform.sx,this.m_oFullTransform.shy,this.m_oFullTransform.shx, this.m_oFullTransform.sy,this.m_oFullTransform.tx,this.m_oFullTransform.ty);return _bounds},FillText2:function(x,y,text,cropX,cropW){if(this.m_bIsBreak)return;var _x=this.m_oInvertFullTransform.TransformPointX(x,y);var _y=this.m_oInvertFullTransform.TransformPointY(x,y);var _font_manager=this.IsUseFonts2?this.m_oFontManager2:this.m_oFontManager;try{var _code=text.charCodeAt(0);if(null!=this.LastFontOriginInfo.Replace)_code=g_fontApplication.GetReplaceGlyph(_code,this.LastFontOriginInfo.Replace);_font_manager.LoadString4C(_code, _x,_y)}catch(err){}this.m_oContext.setTransform(1,0,0,1,0,0);var pGlyph=_font_manager.m_oGlyphString.m_pGlyphsBuffer[0];if(null==pGlyph)return;if(null!=pGlyph.oBitmap)this.private_FillGlyphC(pGlyph,cropX,cropW);if(false===this.m_bIntegerGrid)this.m_oContext.setTransform(this.m_oFullTransform.sx,this.m_oFullTransform.shy,this.m_oFullTransform.shx,this.m_oFullTransform.sy,this.m_oFullTransform.tx,this.m_oFullTransform.ty)},t2:function(text,x,y,cropX,cropW){if(this.m_bIsBreak)return;var _x=this.m_oInvertFullTransform.TransformPointX(x, y);var _y=this.m_oInvertFullTransform.TransformPointY(x,y);var _font_manager=this.IsUseFonts2?this.m_oFontManager2:this.m_oFontManager;try{_font_manager.LoadString2(text,_x,_y)}catch(err){}this.m_oContext.setTransform(1,0,0,1,0,0);while(true){var pGlyph=_font_manager.GetNextChar2();if(null==pGlyph)break;if(null!=pGlyph.oBitmap)this.private_FillGlyphC(pGlyph,cropX,cropW)}if(false===this.m_bIntegerGrid)this.m_oContext.setTransform(this.m_oFullTransform.sx,this.m_oFullTransform.shy,this.m_oFullTransform.shx, this.m_oFullTransform.sy,this.m_oFullTransform.tx,this.m_oFullTransform.ty)},FillTextCode:function(x,y,lUnicode){if(this.m_bIsBreak)return;var _x=this.m_oInvertFullTransform.TransformPointX(x,y);var _y=this.m_oInvertFullTransform.TransformPointY(x,y);var _font_manager=this.IsUseFonts2?this.m_oFontManager2:this.m_oFontManager;try{if(null!=this.LastFontOriginInfo.Replace)lUnicode=g_fontApplication.GetReplaceGlyph(lUnicode,this.LastFontOriginInfo.Replace);_font_manager.LoadString4C(lUnicode,_x,_y)}catch(err){}if(false=== this.m_bIntegerGrid)this.m_oContext.setTransform(1,0,0,1,0,0);var pGlyph=_font_manager.m_oGlyphString.m_pGlyphsBuffer[0];if(null==pGlyph)return;if(null!=pGlyph.oBitmap){var oldAlpha=undefined;if(this.textAlpha){oldAlpha=this.m_oContext.globalAlpha;this.m_oContext.globalAlpha=oldAlpha*this.textAlpha}this.private_FillGlyph(pGlyph);if(undefined!==oldAlpha)this.m_oContext.globalAlpha=oldAlpha}if(false===this.m_bIntegerGrid)this.m_oContext.setTransform(this.m_oFullTransform.sx,this.m_oFullTransform.shy, this.m_oFullTransform.shx,this.m_oFullTransform.sy,this.m_oFullTransform.tx,this.m_oFullTransform.ty)},tg:function(text,x,y){if(this.m_bIsBreak)return;var _x=this.m_oInvertFullTransform.TransformPointX(x,y);var _y=this.m_oInvertFullTransform.TransformPointY(x,y);var _font_manager=this.IsUseFonts2?this.m_oFontManager2:this.m_oFontManager;try{_font_manager.LoadString3C(text,_x,_y)}catch(err){}if(false===this.m_bIntegerGrid)this.m_oContext.setTransform(1,0,0,1,0,0);var pGlyph=_font_manager.m_oGlyphString.m_pGlyphsBuffer[0]; if(null==pGlyph)return;if(null!=pGlyph.oBitmap){var _a=this.m_oBrush.Color1.A;if(255!=_a)this.m_oContext.globalAlpha=_a/255;this.private_FillGlyph(pGlyph);if(255!=_a)this.m_oContext.globalAlpha=1}if(false===this.m_bIntegerGrid)this.m_oContext.setTransform(this.m_oFullTransform.sx,this.m_oFullTransform.shy,this.m_oFullTransform.shx,this.m_oFullTransform.sy,this.m_oFullTransform.tx,this.m_oFullTransform.ty)},charspace:function(space){},private_FillGlyph:function(pGlyph,_bounds){var nW=pGlyph.oBitmap.nWidth; var nH=pGlyph.oBitmap.nHeight;if(0==nW||0==nH)return;var _font_manager=this.IsUseFonts2?this.m_oFontManager2:this.m_oFontManager;var nX=(_font_manager.m_oGlyphString.m_fX>>0)+(pGlyph.fX+pGlyph.oBitmap.nX)>>0;var nY=(_font_manager.m_oGlyphString.m_fY>>0)+(pGlyph.fY-pGlyph.oBitmap.nY)>>0;pGlyph.oBitmap.oGlyphData.checkColor(this.m_oBrush.Color1.R,this.m_oBrush.Color1.G,this.m_oBrush.Color1.B,nW,nH);if(null==this.TextClipRect)pGlyph.oBitmap.draw(this.m_oContext,nX,nY,this.TextClipRect);else pGlyph.oBitmap.drawCropInRect(this.m_oContext, nX,nY,this.TextClipRect);if(_bounds){var _r=nX+pGlyph.oBitmap.nWidth;var _b=nY+pGlyph.oBitmap.nHeight;if(_bounds.x>nX)_bounds.x=nX;if(_bounds.y>nY)_bounds.y=nY;if(_bounds.r<_r)_bounds.r=_r;if(_bounds.b<_b)_bounds.b=_b}},private_FillGlyphC:function(pGlyph,cropX,cropW){var nW=pGlyph.oBitmap.nWidth;var nH=pGlyph.oBitmap.nHeight;if(0==nW||0==nH)return;var _font_manager=this.IsUseFonts2?this.m_oFontManager2:this.m_oFontManager;var nX=_font_manager.m_oGlyphString.m_fX+pGlyph.fX+pGlyph.oBitmap.nX>>0;var nY= _font_manager.m_oGlyphString.m_fY+pGlyph.fY-pGlyph.oBitmap.nY>>0;var d_koef=this.m_dDpiX/25.4;var cX=Math.max(cropX*d_koef>>0,0);var cW=Math.min(cropW*d_koef>>0,nW);if(cW<=0)cW=1;pGlyph.oBitmap.oGlyphData.checkColor(this.m_oBrush.Color1.R,this.m_oBrush.Color1.G,this.m_oBrush.Color1.B,nW,nH);pGlyph.oBitmap.drawCrop(this.m_oContext,nX,nY,cW,nH,cX)},private_FillGlyph2:function(pGlyph){var i=0;var j=0;var nW=pGlyph.oBitmap.nWidth;var nH=pGlyph.oBitmap.nHeight;if(0==nW||0==nH)return;var _font_manager= this.IsUseFonts2?this.m_oFontManager2:this.m_oFontManager;var nX=_font_manager.m_oGlyphString.m_fX+pGlyph.fX+pGlyph.oBitmap.nX>>0;var nY=_font_manager.m_oGlyphString.m_fY+pGlyph.fY-pGlyph.oBitmap.nY>>0;var imageData=this.m_oContext.getImageData(nX,nY,nW,nH);var pPixels=imageData.data;var _r=this.m_oBrush.Color1.R;var _g=this.m_oBrush.Color1.G;var _b=this.m_oBrush.Color1.B;for(;j>>8;pPixels[indx+1]=(_g-g)*weight+(g<<8)>>>8;pPixels[indx+2]=(_b-b)*weight+(b<<8)>>>8;pPixels[indx+3]=weight+a-(weight*a+256>>>8)}indx+=4}}this.m_oContext.putImageData(imageData,nX,nY)},SetIntegerGrid:function(param){if(true==param){this.m_bIntegerGrid=true;this.m_oContext.setTransform(1,0,0,1,0,0)}else{this.m_bIntegerGrid= false;this.m_oContext.setTransform(this.m_oFullTransform.sx,this.m_oFullTransform.shy,this.m_oFullTransform.shx,this.m_oFullTransform.sy,this.m_oFullTransform.tx,this.m_oFullTransform.ty)}},GetIntegerGrid:function(){return this.m_bIntegerGrid},DrawStringASCII:function(name,size,bold,italic,text,x,y,bIsHeader){var _textProp={RFonts:{Ascii:{Name:name,Index:-1}},FontSize:(size*2*96/this.m_dDpiY+.5>>0)/2,Bold:false,Italic:false};this.m_oTextPr=_textProp;this.m_oGrFonts.Ascii.Name=this.m_oTextPr.RFonts.Ascii.Name; this.m_oGrFonts.Ascii.Index=-1;this.SetFontSlot(fontslot_ASCII,1);this.m_oFontManager.LoadString2(text,0,0);var measure=this.m_oFontManager.MeasureString2();var _ctx=this.m_oContext;_ctx.beginPath();_ctx.fillStyle="#E1E1E1";_ctx.strokeStyle=GlobalSkin.RulerOutline;this.m_bBrushColorInit=false;this.m_bPenColorInit=false;var _xPxOffset=10;var _yPxOffset=5;_xPxOffset=_xPxOffset*AscCommon.AscBrowser.retinaPixelRatio>>0;_yPxOffset=_yPxOffset*AscCommon.AscBrowser.retinaPixelRatio>>0;var __x=this.m_oFullTransform.TransformPointX(x, y)>>0;var __y=this.m_oFullTransform.TransformPointY(x,y)>>0;var __w=(measure.fWidth>>0)+2*_xPxOffset;var __h=(Math.abs(measure.fY)>>0)+2*_yPxOffset;if(!bIsHeader)__y-=__h;if(!AscBrowser.isCustomScalingAbove2())_ctx.rect(__x+.5,__y+.5,__w,__h);else _ctx.rect(__x,__y,__w,__h);_ctx.fill();_ctx.stroke();_ctx.beginPath();this.b_color1(68,68,68,255);var _koef_px_to_mm=25.4/this.m_dDpiY;if(bIsHeader)this.t(text,x+_xPxOffset*_koef_px_to_mm,y+(__h-_yPxOffset)*_koef_px_to_mm);else this.t(text,x+_xPxOffset* _koef_px_to_mm,y-_yPxOffset*_koef_px_to_mm)},DrawStringASCII2:function(name,size,bold,italic,text,x,y,bIsHeader){var _textProp={RFonts:{Ascii:{Name:name,Index:-1}},FontSize:(size*2*96/this.m_dDpiY+.5>>0)/2,Bold:false,Italic:false};this.m_oTextPr=_textProp;this.m_oGrFonts.Ascii.Name=this.m_oTextPr.RFonts.Ascii.Name;this.m_oGrFonts.Ascii.Index=-1;this.SetFontSlot(fontslot_ASCII,1);this.m_oFontManager.LoadString2(text,0,0);var measure=this.m_oFontManager.MeasureString2();var _ctx=this.m_oContext;_ctx.beginPath(); _ctx.fillStyle="#E1E1E1";_ctx.strokeStyle=GlobalSkin.RulerOutline;this.m_bBrushColorInit=false;this.m_bPenColorInit=false;var _xPxOffset=10;var _yPxOffset=5;_xPxOffset=_xPxOffset*AscCommon.AscBrowser.retinaPixelRatio>>0;_yPxOffset=_yPxOffset*AscCommon.AscBrowser.retinaPixelRatio>>0;var __x=this.m_oFullTransform.TransformPointX(this.m_dWidthMM-x,y)>>0;var __y=this.m_oFullTransform.TransformPointY(this.m_dWidthMM-x,y)>>0;var __w=(measure.fWidth>>0)+2*_xPxOffset;var __h=(Math.abs(measure.fY)>>0)+2*_yPxOffset; __x-=__w;if(!bIsHeader)__y-=__h;if(!AscBrowser.isCustomScalingAbove2())_ctx.rect(__x+.5,__y+.5,__w,__h);else _ctx.rect(__x,__y,__w,__h);_ctx.fill();_ctx.stroke();_ctx.beginPath();this.b_color1(68,68,68,255);var _koef_px_to_mm=25.4/this.m_dDpiY;var xPos=this.m_dWidthMM-x-(__w-_xPxOffset)*_koef_px_to_mm;if(bIsHeader)this.t(text,xPos,y+(__h-_yPxOffset)*_koef_px_to_mm);else this.t(text,xPos,y-_yPxOffset*_koef_px_to_mm)},DrawHeaderEdit:function(yPos,lock_type,sectionNum,bIsRepeat,type){var _y=this.m_oFullTransform.TransformPointY(0, yPos);_y=(_y>>0)+.5;var _x=0;var _wmax=this.m_lWidthPix;var _w1=6;var _w2=3;var _lineWidth=1;if(AscBrowser.isCustomScalingAbove2()){_y>>=0;_lineWidth=2}var ctx=this.m_oContext;switch(lock_type){case locktype_None:case locktype_Mine:{this.p_color(187,190,194,255);ctx.lineWidth=_lineWidth;break}case locktype_Other:case locktype_Other2:{this.p_color(238,53,37,255);ctx.lineWidth=_lineWidth;_w1=2;_w2=1;break}default:{this.p_color(155,187,277,255);ctx.lineWidth=_lineWidth;_w1=2;_w2=1}}_w1=_w1*AscCommon.AscBrowser.retinaPixelRatio>> 0;_w2=_w2*AscCommon.AscBrowser.retinaPixelRatio>>0;var bIsNoIntGrid=this.m_bIntegerGrid;if(false==bIsNoIntGrid)this.SetIntegerGrid(true);this._s();while(true){if(_x>_wmax)break;ctx.moveTo(_x,_y);_x+=_w1;ctx.lineTo(_x,_y);_x+=_w2}this.ds();var _header_text=AscCommon.translateManager.getValue("Header");if(-1!=sectionNum)_header_text+=AscCommon.translateManager.getValue(" -Section ")+(sectionNum+1)+"-";if(type)if(type.bFirst)_header_text=AscCommon.translateManager.getValue("First Page ")+_header_text; else if(EvenAndOddHeaders)if(type.bEven)_header_text=AscCommon.translateManager.getValue("Even Page ")+_header_text;else _header_text=AscCommon.translateManager.getValue("Odd Page ")+_header_text;var _fontSize=9*AscCommon.AscBrowser.retinaPixelRatio>>0;this.DrawStringASCII("Courier New",_fontSize,false,false,_header_text,2,yPos,true);if(bIsRepeat)this.DrawStringASCII2("Courier New",_fontSize,false,false,AscCommon.translateManager.getValue("Same as Previous"),2,yPos,true);if(false==bIsNoIntGrid)this.SetIntegerGrid(false)}, DrawFooterEdit:function(yPos,lock_type,sectionNum,bIsRepeat,type){var _y=this.m_oFullTransform.TransformPointY(0,yPos);_y=(_y>>0)+.5;var _x=0;var _w1=6;var _w2=3;var _lineWidth=1;if(AscBrowser.isCustomScalingAbove2()){_y>>=0;_lineWidth=2}var ctx=this.m_oContext;switch(lock_type){case locktype_None:case locktype_Mine:{this.p_color(187,190,194,255);ctx.lineWidth=_lineWidth;break}case locktype_Other:case locktype_Other2:{this.p_color(238,53,37,255);ctx.lineWidth=_lineWidth;_w1=2;_w2=1;break}default:{this.p_color(155, 187,277,255);ctx.lineWidth=_lineWidth;_w1=2;_w2=1}}_w1=_w1*AscCommon.AscBrowser.retinaPixelRatio>>0;_w2=_w2*AscCommon.AscBrowser.retinaPixelRatio>>0;var _wmax=this.m_lWidthPix;var bIsNoIntGrid=this.m_bIntegerGrid;if(false==bIsNoIntGrid)this.SetIntegerGrid(true);this._s();while(true){if(_x>_wmax)break;ctx.moveTo(_x,_y);_x+=_w1;ctx.lineTo(_x,_y);_x+=_w2}this.ds();var _header_text=AscCommon.translateManager.getValue("Footer");if(-1!=sectionNum)_header_text+=AscCommon.translateManager.getValue(" -Section ")+ (sectionNum+1)+"-";if(type)if(type.bFirst)_header_text=AscCommon.translateManager.getValue("First Page ")+_header_text;else if(EvenAndOddHeaders)if(type.bEven)_header_text=AscCommon.translateManager.getValue("Even Page ")+_header_text;else _header_text=AscCommon.translateManager.getValue("Odd Page ")+_header_text;var _fontSize=9*AscCommon.AscBrowser.retinaPixelRatio>>0;this.DrawStringASCII("Courier New",_fontSize,false,false,_header_text,2,yPos,false);if(bIsRepeat)this.DrawStringASCII2("Courier New", _fontSize,false,false,AscCommon.translateManager.getValue("Same as Previous"),2,yPos,false);if(false==bIsNoIntGrid)this.SetIntegerGrid(false)},DrawLockParagraph:function(lock_type,x,y1,y2){if(lock_type==locktype_None||editor.WordControl.m_oDrawingDocument.IsLockObjectsEnable===false||editor.isViewMode||lock_type===locktype_Mine&&true===AscCommon.CollaborativeEditing.Is_Fast())return;if(lock_type==locktype_Mine)this.p_color(22,156,0,255);else this.p_color(238,53,37,255);var _x=this.m_oFullTransform.TransformPointX(x, y1)>>0;var _xT=this.m_oFullTransform.TransformPointX(x,y2)>>0;var _y1=(this.m_oFullTransform.TransformPointY(x,y1)>>0)+.5;var _y2=(this.m_oFullTransform.TransformPointY(x,y2)>>0)-1.5;var ctx=this.m_oContext;if(_x!=_xT){var dKoefMMToPx=1/Math.max(this.m_oCoordTransform.sx,.001);this.p_width(1E3*dKoefMMToPx);var w_dot=2*dKoefMMToPx;var w_dist=1*dKoefMMToPx;var w_len_indent=3;var _interf=editor.WordControl.m_oDrawingDocument.AutoShapesTrack;this._s();_interf.AddLineDash(ctx,x,y1,x,y2,w_dot,w_dist);_interf.AddLineDash(ctx, x,y1,x+w_len_indent,y1,w_dot,w_dist);_interf.AddLineDash(ctx,x,y2,x+w_len_indent,y2,w_dot,w_dist);this.ds();return}var bIsInt=this.m_bIntegerGrid;if(!bIsInt)this.SetIntegerGrid(true);ctx.lineWidth=1;var w_dot=2;var w_dist=1;var w_len_indent=3*this.m_oCoordTransform.sx>>0;this._s();var y_mem=_y1-.5;while(true){if(y_mem+w_dot>_y2)break;ctx.moveTo(_x+.5,y_mem);y_mem+=w_dot;ctx.lineTo(_x+.5,y_mem);y_mem+=w_dist}var x_max=_x+w_len_indent;var x_mem=_x;while(true){if(x_mem>x_max)break;ctx.moveTo(x_mem,_y1); x_mem+=w_dot;ctx.lineTo(x_mem,_y1);x_mem+=w_dist}x_mem=_x;while(true){if(x_mem>x_max)break;ctx.moveTo(x_mem,_y2);x_mem+=w_dot;ctx.lineTo(x_mem,_y2);x_mem+=w_dist}this.ds();if(!bIsInt)this.SetIntegerGrid(false)},DrawLockObjectRect:function(lock_type,x,y,w,h){if(editor.isViewMode||this.IsThumbnail||lock_type==locktype_None||this.IsDemonstrationMode||lock_type===locktype_Mine&&true===AscCommon.CollaborativeEditing.Is_Fast())return;if(editor.WordControl.m_oDrawingDocument.IsLockObjectsEnable===false&& lock_type==locktype_Mine)return;if(lock_type==locktype_Mine)this.p_color(22,156,0,255);else this.p_color(238,53,37,255);var ctx=this.m_oContext;var _m=this.m_oTransform;if(_m.sx!=1||_m.shx!=0||_m.shy!=0||_m.sy!=1){var dKoefMMToPx=1/Math.max(this.m_oCoordTransform.sx,.001);this.p_width(1E3*dKoefMMToPx);var w_dot=2*dKoefMMToPx;var w_dist=1*dKoefMMToPx;var _interf=editor.WordControl.m_oDrawingDocument.AutoShapesTrack;var eps=5*dKoefMMToPx;var _x=x-eps;var _y=y-eps;var _r=x+w+eps;var _b=y+h+eps;this._s(); _interf.AddRectDash(ctx,_x,_y,_r,_y,_x,_b,_r,_b,w_dot,w_dist,true);this._s();return}var bIsInt=this.m_bIntegerGrid;if(!bIsInt)this.SetIntegerGrid(true);ctx.lineWidth=1;var w_dot=2;var w_dist=2;var eps=5;var _x=(this.m_oFullTransform.TransformPointX(x,y)>>0)-eps+.5;var _y=(this.m_oFullTransform.TransformPointY(x,y)>>0)-eps+.5;var _r=(this.m_oFullTransform.TransformPointX(x+w,y+h)>>0)+eps+.5;var _b=(this.m_oFullTransform.TransformPointY(x+w,y+h)>>0)+eps+.5;this._s();for(var i=_x;i<_r;i+=w_dist){ctx.moveTo(i, _y);i+=w_dot;if(i>_r)i=_r;ctx.lineTo(i,_y)}for(var i=_y;i<_b;i+=w_dist){ctx.moveTo(_r,i);i+=w_dot;if(i>_b)i=_b;ctx.lineTo(_r,i)}for(var i=_r;i>_x;i-=w_dist){ctx.moveTo(i,_b);i-=w_dot;if(i<_x)i=_x;ctx.lineTo(i,_b)}for(var i=_b;i>_y;i-=w_dist){ctx.moveTo(_x,i);i-=w_dot;if(i<_y)i=_y;ctx.lineTo(_x,i)}this.ds();if(!bIsInt)this.SetIntegerGrid(false)},DrawEmptyTableLine:function(x1,y1,x2,y2){if((!editor.isShowTableEmptyLine||editor.isViewMode)&&editor.isShowTableEmptyLineAttack===false)return;var _x1=this.m_oFullTransform.TransformPointX(x1, y1);var _y1=this.m_oFullTransform.TransformPointY(x1,y1);var _x2=this.m_oFullTransform.TransformPointX(x2,y2);var _y2=this.m_oFullTransform.TransformPointY(x2,y2);_x1=(_x1>>0)+.5;_y1=(_y1>>0)+.5;_x2=(_x2>>0)+.5;_y2=(_y2>>0)+.5;this.p_color(138,162,191,255);var ctx=this.m_oContext;if(_x1!=_x2&&_y1!=_y2){var dKoefMMToPx=1/Math.max(this.m_oCoordTransform.sx,.001);this.p_width(1E3*dKoefMMToPx);this._s();editor.WordControl.m_oDrawingDocument.AutoShapesTrack.AddLineDash(ctx,x1,y1,x2,y2,2*dKoefMMToPx,2* dKoefMMToPx);this.ds();return}ctx.lineWidth=1;var bIsInt=this.m_bIntegerGrid;if(!bIsInt)this.SetIntegerGrid(true);if(_x1==_x2){var _y=Math.min(_y1,_y2)+.5;var _w1=2;var _w2=2;var _wmax=Math.max(_y1,_y2)-.5;this._s();while(true){if(_y>_wmax)break;ctx.moveTo(_x1,_y);_y+=_w1;if(_y>_wmax)ctx.lineTo(_x1,_y-_w1+1);else ctx.lineTo(_x1,_y);_y+=_w2}this.ds()}else if(_y1==_y2){var _x=Math.min(_x1,_x2)+.5;var _w1=2;var _w2=2;var _wmax=Math.max(_x1,_x2)-.5;this._s();while(true){if(_x>_wmax)break;ctx.moveTo(_x, _y1);_x+=_w1;if(_x>_wmax)ctx.lineTo(_x-_w2+1,_y1);else ctx.lineTo(_x,_y1);_x+=_w2}this.ds()}else{this._s();editor.WordControl.m_oDrawingDocument.AutoShapesTrack.AddLineDash(ctx,_x1,_y1,_x2,_y2,2,2);this.ds()}if(!bIsInt)this.SetIntegerGrid(false)},DrawSpellingLine:function(y0,x0,x1,w){if(!editor.isViewMode)this.drawHorLine(0,y0,x0,x1,w)},drawHorLine:function(align,y,x,r,penW){var _check_transform=global_MatrixTransformer.IsIdentity2(this.m_oTransform);if(!this.m_bIntegerGrid||!_check_transform){if(_check_transform){this.SetIntegerGrid(true); this.drawHorLine(align,y,x,r,penW);this.SetIntegerGrid(false);return}this.p_width(penW*1E3);this._s();this._m(x,y);this._l(r,y);this.ds();return}var pen_w=this.m_dDpiX*penW/g_dKoef_in_to_mm+.5>>0;if(0==pen_w)pen_w=1;var _x=(this.m_oFullTransform.TransformPointX(x,y)>>0)+.5-.5;var _r=(this.m_oFullTransform.TransformPointX(r,y)>>0)+.5+.5;var ctx=this.m_oContext;ctx.setTransform(1,0,0,1,0,0);ctx.lineWidth=pen_w;switch(align){case 0:{var _top=(this.m_oFullTransform.TransformPointY(x,y)>>0)+.5;ctx.beginPath(); ctx.moveTo(_x,_top+pen_w/2-.5);ctx.lineTo(_r,_top+pen_w/2-.5);ctx.stroke();break}case 1:{var _center=(this.m_oFullTransform.TransformPointY(x,y)>>0)+.5;ctx.beginPath();if(0==pen_w%2){ctx.moveTo(_x,_center-.5);ctx.lineTo(_r,_center-.5)}else{ctx.moveTo(_x,_center);ctx.lineTo(_r,_center)}ctx.stroke();break}case 2:{var _bottom=(this.m_oFullTransform.TransformPointY(x,y)>>0)+.5;ctx.beginPath();ctx.moveTo(_x,_bottom-pen_w/2+.5);ctx.lineTo(_r,_bottom-pen_w/2+.5);ctx.stroke();break}}},drawHorLine2:function(align, y,x,r,penW){var _check_transform=global_MatrixTransformer.IsIdentity2(this.m_oTransform);if(!this.m_bIntegerGrid||!_check_transform){if(_check_transform){this.SetIntegerGrid(true);this.drawHorLine2(align,y,x,r,penW);this.SetIntegerGrid(false);return}var _y1=y-penW/2;var _y2=_y1+2*penW;this.p_width(penW*1E3);this._s();this._m(x,_y1);this._l(r,_y1);this.ds();this._s();this._m(x,_y2);this._l(r,_y2);this.ds();return}var pen_w=this.m_dDpiX*penW/g_dKoef_in_to_mm+.5>>0;if(0==pen_w)pen_w=1;var _x=(this.m_oFullTransform.TransformPointX(x, y)>>0)+.5-.5;var _r=(this.m_oFullTransform.TransformPointX(r,y)>>0)+.5+.5;var ctx=this.m_oContext;ctx.lineWidth=pen_w;switch(align){case 0:{var _top=(this.m_oFullTransform.TransformPointY(x,y)>>0)+.5;var _pos1=_top+pen_w/2-.5-pen_w;var _pos2=_pos1+pen_w*2;ctx.beginPath();ctx.moveTo(_x,_pos1);ctx.lineTo(_r,_pos1);ctx.stroke();ctx.beginPath();ctx.moveTo(_x,_pos2);ctx.lineTo(_r,_pos2);ctx.stroke();break}case 1:{break}case 2:{break}}},drawVerLine:function(align,x,y,b,penW){var _check_transform=global_MatrixTransformer.IsIdentity2(this.m_oTransform); if(!this.m_bIntegerGrid||!_check_transform){if(_check_transform){this.SetIntegerGrid(true);this.drawVerLine(align,x,y,b,penW);this.SetIntegerGrid(false);return}this.p_width(penW*1E3);this._s();this._m(x,y);this._l(x,b);this.ds();return}var pen_w=this.m_dDpiX*penW/g_dKoef_in_to_mm+.5>>0;if(0==pen_w)pen_w=1;var _y=(this.m_oFullTransform.TransformPointY(x,y)>>0)+.5-.5;var _b=(this.m_oFullTransform.TransformPointY(x,b)>>0)+.5+.5;var ctx=this.m_oContext;ctx.lineWidth=pen_w;switch(align){case 0:{var _left= (this.m_oFullTransform.TransformPointX(x,y)>>0)+.5;ctx.beginPath();ctx.moveTo(_left+pen_w/2-.5,_y);ctx.lineTo(_left+pen_w/2-.5,_b);ctx.stroke();break}case 1:{var _center=(this.m_oFullTransform.TransformPointX(x,y)>>0)+.5;ctx.beginPath();if(0==pen_w%2){ctx.moveTo(_center-.5,_y);ctx.lineTo(_center-.5,_b)}else{ctx.moveTo(_center,_y);ctx.lineTo(_center,_b)}ctx.stroke();break}case 2:{var _right=(this.m_oFullTransform.TransformPointX(x,y)>>0)+.5;ctx.beginPath();ctx.moveTo(_right-pen_w/2+.5,_y);ctx.lineTo(_right- pen_w/2+.5,_b);ctx.stroke();break}}},drawHorLineExt:function(align,y,x,r,penW,leftMW,rightMW){var _check_transform=global_MatrixTransformer.IsIdentity2(this.m_oTransform);if(!this.m_bIntegerGrid||!_check_transform){if(_check_transform){this.SetIntegerGrid(true);this.drawHorLineExt(align,y,x,r,penW,leftMW,rightMW);this.SetIntegerGrid(false);return}this.p_width(penW*1E3);this._s();this._m(x,y);this._l(r,y);this.ds();return}var pen_w=Math.max(this.m_dDpiX*penW/g_dKoef_in_to_mm+.5>>0,1);var _x=(this.m_oFullTransform.TransformPointX(x, y)>>0)+.5;var _r=(this.m_oFullTransform.TransformPointX(r,y)>>0)+.5;if(leftMW!=0){var _center=_x;var pen_mw=Math.max(this.m_dDpiX*Math.abs(leftMW)*2/g_dKoef_in_to_mm+.5>>0,1);if(leftMW<0)if(pen_mw%2==0)_x=_center-pen_mw/2;else _x=_center-(pen_mw/2>>0);else if(pen_mw%2==0)_x=_center+(pen_mw/2-1);else _x=_center+(pen_mw/2>>0)}if(rightMW!=0){var _center=_r;var pen_mw=Math.max(this.m_dDpiX*Math.abs(rightMW)*2/g_dKoef_in_to_mm+.5>>0,1);if(rightMW<0)if(pen_mw%2==0)_r=_center-pen_mw/2;else _r=_center-(pen_mw/ 2>>0);else if(pen_mw%2==0)_r=_center+pen_mw/2-1;else _r=_center+(pen_mw/2>>0)}var ctx=this.m_oContext;ctx.lineWidth=pen_w;_x-=.5;_r+=.5;switch(align){case 0:{var _top=(this.m_oFullTransform.TransformPointY(x,y)>>0)+.5;ctx.beginPath();ctx.moveTo(_x,_top+pen_w/2-.5);ctx.lineTo(_r,_top+pen_w/2-.5);ctx.stroke();break}case 1:{var _center=(this.m_oFullTransform.TransformPointY(x,y)>>0)+.5;ctx.beginPath();if(0==pen_w%2){ctx.moveTo(_x,_center-.5);ctx.lineTo(_r,_center-.5)}else{ctx.moveTo(_x,_center);ctx.lineTo(_r, _center)}ctx.stroke();break}case 2:{var _bottom=(this.m_oFullTransform.TransformPointY(x,y)>>0)+.5;ctx.beginPath();ctx.moveTo(_x,_bottom-pen_w/2+.5);ctx.lineTo(_r,_bottom-pen_w/2+.5);ctx.stroke();break}}},rect:function(x,y,w,h){var ctx=this.m_oContext;ctx.beginPath();if(this.m_bIntegerGrid){var tr=this.m_oFullTransform;if(0===tr.shx&&0===tr.shy){var _x=this.m_oFullTransform.TransformPointX(x,y)+.5>>0;var _y=this.m_oFullTransform.TransformPointY(x,y)+.5>>0;var _r=this.m_oFullTransform.TransformPointX(x+ w,y)+.5>>0;var _b=this.m_oFullTransform.TransformPointY(x,y+h)+.5>>0;ctx.rect(_x,_y,_r-_x,_b-_y)}else{var x1=this.m_oFullTransform.TransformPointX(x,y);var y1=this.m_oFullTransform.TransformPointY(x,y);var x2=this.m_oFullTransform.TransformPointX(x+w,y);var y2=this.m_oFullTransform.TransformPointY(x+w,y);var x3=this.m_oFullTransform.TransformPointX(x+w,y+h);var y3=this.m_oFullTransform.TransformPointY(x+w,y+h);var x4=this.m_oFullTransform.TransformPointX(x,y+h);var y4=this.m_oFullTransform.TransformPointY(x, y+h);ctx.moveTo(x1,y1);ctx.lineTo(x2,y2);ctx.lineTo(x3,y3);ctx.lineTo(x4,y4);ctx.closePath()}}else ctx.rect(x,y,w,h)},TableRect:function(x,y,w,h){var ctx=this.m_oContext;if(this.m_bIntegerGrid){var _x=(this.m_oFullTransform.TransformPointX(x,y)>>0)+.5;var _y=(this.m_oFullTransform.TransformPointY(x,y)>>0)+.5;var _r=(this.m_oFullTransform.TransformPointX(x+w,y)>>0)+.5;var _b=(this.m_oFullTransform.TransformPointY(x,y+h)>>0)+.5;ctx.fillRect(_x-.5,_y-.5,_r-_x+1,_b-_y+1)}else ctx.fillRect(x,y,w,h)},AddClipRect:function(x, y,w,h){var __rect=new AscCommon._rect;__rect.x=x;__rect.y=y;__rect.w=w;__rect.h=h;this.GrState.AddClipRect(__rect)},RemoveClipRect:function(){},SetClip:function(r){var ctx=this.m_oContext;ctx.save();ctx.beginPath();if(!global_MatrixTransformer.IsIdentity(this.m_oTransform))ctx.rect(r.x,r.y,r.w,r.h);else{var _x=this.m_oFullTransform.TransformPointX(r.x,r.y)+1>>0;var _y=this.m_oFullTransform.TransformPointY(r.x,r.y)+1>>0;var _r=this.m_oFullTransform.TransformPointX(r.x+r.w,r.y)-1>>0;var _b=this.m_oFullTransform.TransformPointY(r.x, r.y+r.h)-1>>0;ctx.rect(_x,_y,_r-_x+1,_b-_y+1)}this.clip();ctx.beginPath()},RemoveClip:function(){this.m_oContext.restore();this.m_oContext.save();this.m_bPenColorInit=false;this.m_bBrushColorInit=false;if(this.m_oContext.globalAlpha!=this.globalAlpha)this.m_oContext.globalAlpha=this.globalAlpha},drawCollaborativeChanges:function(x,y,w,h,Color){this.b_color1(Color.r,Color.g,Color.b,255);this.rect(x,y,w,h);this.df()},drawMailMergeField:function(x,y,w,h){this.b_color1(206,212,223,204);this.rect(x,y, w,h);this.df()},drawSearchResult:function(x,y,w,h){this.b_color1(255,238,128,255);this.rect(x,y,w,h);this.df()},drawFlowAnchor:function(x,y){var _flow_anchor=AscCommon.OverlayRasterIcons&&AscCommon.OverlayRasterIcons.Anchor?AscCommon.OverlayRasterIcons.Anchor.get():undefined;if(!_flow_anchor||(!editor||!editor.ShowParaMarks))return;if(false===this.m_bIntegerGrid)this.m_oContext.setTransform(1,0,0,1,0,0);var _x=this.m_oFullTransform.TransformPointX(x,y)>>0;var _y=this.m_oFullTransform.TransformPointY(x, y)>>0;this.m_oContext.drawImage(_flow_anchor,_x,_y);if(false===this.m_bIntegerGrid)this.m_oContext.setTransform(this.m_oFullTransform.sx,this.m_oFullTransform.shy,this.m_oFullTransform.shx,this.m_oFullTransform.sy,this.m_oFullTransform.tx,this.m_oFullTransform.ty)},SavePen:function(){this.GrState.SavePen()},RestorePen:function(){this.GrState.RestorePen()},SaveBrush:function(){this.GrState.SaveBrush()},RestoreBrush:function(){this.GrState.RestoreBrush()},SavePenBrush:function(){this.GrState.SavePenBrush()}, RestorePenBrush:function(){this.GrState.RestorePenBrush()},SaveGrState:function(){this.GrState.SaveGrState()},RestoreGrState:function(){this.GrState.RestoreGrState()},StartClipPath:function(){},EndClipPath:function(){this.m_oContext.clip()},StartCheckTableDraw:function(){if(!this.m_bIntegerGrid&&global_MatrixTransformer.IsIdentity2(this.m_oTransform)){this.SaveGrState();this.SetIntegerGrid(true);return true}return false},EndCheckTableDraw:function(bIsRestore){if(bIsRestore)this.RestoreGrState()}, SetTextClipRect:function(_l,_t,_r,_b){this.TextClipRect={l:_l*this.m_oCoordTransform.sx>>0,t:_t*this.m_oCoordTransform.sy>>0,r:_r*this.m_oCoordTransform.sx>>0,b:_b*this.m_oCoordTransform.sy>>0}},AddSmartRect:function(x,y,w,h,pen_w){if(!global_MatrixTransformer.IsIdentity2(this.m_oTransform)){var r=x+w;var b=y+h;var dx1=this.m_oFullTransform.TransformPointX(x,y);var dy1=this.m_oFullTransform.TransformPointY(x,y);var dx2=this.m_oFullTransform.TransformPointX(r,y);var dy2=this.m_oFullTransform.TransformPointY(r, y);var dx3=this.m_oFullTransform.TransformPointX(x,b);var dy3=this.m_oFullTransform.TransformPointY(x,b);var dx4=this.m_oFullTransform.TransformPointX(r,b);var dy4=this.m_oFullTransform.TransformPointY(r,b);var _eps=.001;var bIsClever=false;var _type=1;if(Math.abs(dx1-dx3)<_eps&&Math.abs(dx2-dx4)<_eps&&Math.abs(dy1-dy2)<_eps&&Math.abs(dy3-dy4)<_eps){bIsClever=true;_type=1}if(!bIsClever&&Math.abs(dx1-dx2)<_eps&&Math.abs(dx3-dx4)<_eps&&Math.abs(dy1-dy3)<_eps&&Math.abs(dy2-dy4)<_eps){_type=2;bIsClever= true}if(!bIsClever){this.ds();return}var _xI=_type==1?Math.min(dx1,dx2):Math.min(dx1,dx3);var _rI=_type==1?Math.max(dx1,dx2):Math.max(dx1,dx3);var _yI=_type==1?Math.min(dy1,dy3):Math.min(dy1,dy2);var _bI=_type==1?Math.max(dy1,dy3):Math.max(dy1,dy2);var bIsSmartAttack=false;if(!this.m_bIntegerGrid){this.SetIntegerGrid(true);bIsSmartAttack=true;if(this.dash_no_smart){for(var index=0;index>0;this.m_oContext.setLineDash(this.dash_no_smart);this.dash_no_smart=null}}var _pen_w=pen_w*this.m_oCoordTransform.sx+.5>>0;if(0>=_pen_w)_pen_w=1;this._s();if((_pen_w&1)==1){var _x=(_xI>>0)+.5;var _y=(_yI>>0)+.5;var _r=(_rI>>0)+.5;var _b=(_bI>>0)+.5;this.m_oContext.rect(_x,_y,_r-_x,_b-_y)}else{var _x=_xI+.5>>0;var _y=_yI+.5>>0;var _r=_rI+.5>>0;var _b=_bI+.5>>0;this.m_oContext.rect(_x,_y,_r-_x,_b-_y)}this.m_oContext.lineWidth=_pen_w;this.ds();if(bIsSmartAttack)this.SetIntegerGrid(false);return}var bIsSmartAttack= false;if(!this.m_bIntegerGrid){this.SetIntegerGrid(true);bIsSmartAttack=true;if(this.dash_no_smart){for(var index=0;index>0;this.m_oContext.setLineDash(this.dash_no_smart);this.dash_no_smart=null}}var _pen_w=pen_w*this.m_oCoordTransform.sx+.5>>0;if(0>=_pen_w)_pen_w=1;this._s();if((_pen_w&1)==1){var _x=(this.m_oFullTransform.TransformPointX(x,y)>>0)+.5;var _y=(this.m_oFullTransform.TransformPointY(x, y)>>0)+.5;var _r=(this.m_oFullTransform.TransformPointX(x+w,y+h)>>0)+.5;var _b=(this.m_oFullTransform.TransformPointY(x+w,y+h)>>0)+.5;this.m_oContext.rect(_x,_y,_r-_x,_b-_y)}else{var _x=this.m_oFullTransform.TransformPointX(x,y)+.5>>0;var _y=this.m_oFullTransform.TransformPointY(x,y)+.5>>0;var _r=this.m_oFullTransform.TransformPointX(x+w,y+h)+.5>>0;var _b=this.m_oFullTransform.TransformPointY(x+w,y+h)+.5>>0;this.m_oContext.rect(_x,_y,_r-_x,_b-_y)}this.m_oContext.lineWidth=_pen_w;this.ds();if(bIsSmartAttack)this.SetIntegerGrid(false)}, CheckUseFonts2:function(_transform){if(!global_MatrixTransformer.IsIdentity2(_transform)){if(!AscCommon.g_fontManager2){AscCommon.g_fontManager2=new AscFonts.CFontManager;AscCommon.g_fontManager2.Initialize(true)}this.m_oFontManager2=AscCommon.g_fontManager2;if(null==this.m_oLastFont2)this.m_oLastFont2=new AscCommon.CFontSetup;this.IsUseFonts2=true}},UncheckUseFonts2:function(){this.IsUseFonts2=false},Drawing_StartCheckBounds:function(x,y,w,h){},Drawing_EndCheckBounds:function(){},DrawPresentationComment:function(type, x,y,w,h){if(this.IsThumbnail||this.IsDemonstrationMode)return;if(this.m_bIntegerGrid){if(AscCommon.g_comment_image&&AscCommon.g_comment_image.asc_complete===true){var _x=this.m_oFullTransform.TransformPointX(x,y)>>0;var _y=this.m_oFullTransform.TransformPointY(x,y)>>0;var _index=0;if((type&2)==2)_index=2;if((type&1)==1)_index+=1;if(AscBrowser.isCustomScalingAbove2())_index+=4;var _offset=AscCommon.g_comment_image_offsets[_index];this.m_oContext.drawImage(AscCommon.g_comment_image,_offset[0],_offset[1], _offset[2],_offset[3],_x,_y,_offset[2],_offset[3])}}else{this.SetIntegerGrid(true);this.DrawPresentationComment(type,x,y,w,h);this.SetIntegerGrid(false)}},DrawPolygon:function(oPath,lineWidth,shift){this.m_oContext.lineWidth=lineWidth;this.m_oContext.beginPath();var Points=oPath.Points;var nCount=Points.length;var PrevX=Points[nCount-2].X,PrevY=Points[nCount-2].Y;var _x=Points[nCount-2].X,_y=Points[nCount-2].Y;var StartX,StartY;for(var nIndex=0;nIndexPoints[nIndex].X)_y= Points[nIndex].Y-shift;else if(PrevXPoints[nIndex].Y)_x=Points[nIndex].X+shift;PrevX=Points[nIndex].X;PrevY=Points[nIndex].Y;if(nIndex>0)if(1==nIndex){StartX=_x;StartY=_y;this._m(_x,_y)}else this._l(_x,_y)}this._l(StartX,StartY);this.m_oContext.closePath();this.m_oContext.stroke();this.m_oContext.beginPath()},DrawFootnoteRect:function(x,y,w,h){var _old=this.m_bIntegerGrid;if(!_old)this.SetIntegerGrid(true); this.p_dash([1,1]);this._s();var l=x;var t=y;var r=x+w;var b=y+h;this.drawHorLineExt(c_oAscLineDrawingRule.Top,t,l,r,0,0,0);this.drawVerLine(c_oAscLineDrawingRule.Right,l,t,b,0);this.drawVerLine(c_oAscLineDrawingRule.Left,r,t,b,0);this.drawHorLineExt(c_oAscLineDrawingRule.Top,b,l,r,0,0,0);this.ds();this._s();this.p_dash(null);if(!_old)this.SetIntegerGrid(false)}};window["AscCommon"]=window["AscCommon"]||{};window["AscCommon"].CGraphics=CGraphics})(window);"use strict";(function(window,undefined){var getFullImageSrc2= AscCommon.getFullImageSrc2;var CShapeColor=AscFormat.CShapeColor;var c_oAscFill=Asc.c_oAscFill;function DrawLineEnd(xEnd,yEnd,xPrev,yPrev,type,w,len,drawer,trans){switch(type){case AscFormat.LineEndType.None:break;case AscFormat.LineEndType.Arrow:{var _ex=xPrev-xEnd;var _ey=yPrev-yEnd;var _elen=Math.sqrt(_ex*_ex+_ey*_ey);_ex/=_elen;_ey/=_elen;var _vx=_ey;var _vy=-_ex;var tmpx=xEnd+len*_ex;var tmpy=yEnd+len*_ey;var x1=tmpx+_vx*w/2;var y1=tmpy+_vy*w/2;var x3=tmpx-_vx*w/2;var y3=tmpy-_vy*w/2;drawer._s(); drawer._m(trans.TransformPointX(x1,y1),trans.TransformPointY(x1,y1));drawer._l(trans.TransformPointX(xEnd,yEnd),trans.TransformPointY(xEnd,yEnd));drawer._l(trans.TransformPointX(x3,y3),trans.TransformPointY(x3,y3));drawer.ds();drawer._e();break}case AscFormat.LineEndType.Diamond:{var _ex=xPrev-xEnd;var _ey=yPrev-yEnd;var _elen=Math.sqrt(_ex*_ex+_ey*_ey);_ex/=_elen;_ey/=_elen;var _vx=_ey;var _vy=-_ex;var tmpx=xEnd+len/2*_ex;var tmpy=yEnd+len/2*_ey;var x1=xEnd+_vx*w/2;var y1=yEnd+_vy*w/2;var x3=xEnd- _vx*w/2;var y3=yEnd-_vy*w/2;var tmpx2=xEnd-len/2*_ex;var tmpy2=yEnd-len/2*_ey;drawer._s();drawer._m(trans.TransformPointX(tmpx,tmpy),trans.TransformPointY(tmpx,tmpy));drawer._l(trans.TransformPointX(x1,y1),trans.TransformPointY(x1,y1));drawer._l(trans.TransformPointX(tmpx2,tmpy2),trans.TransformPointY(tmpx2,tmpy2));drawer._l(trans.TransformPointX(x3,y3),trans.TransformPointY(x3,y3));drawer._z();drawer.drawStrokeFillStyle();drawer._e();drawer._s();drawer._m(trans.TransformPointX(tmpx,tmpy),trans.TransformPointY(tmpx, tmpy));drawer._l(trans.TransformPointX(x1,y1),trans.TransformPointY(x1,y1));drawer._l(trans.TransformPointX(tmpx2,tmpy2),trans.TransformPointY(tmpx2,tmpy2));drawer._l(trans.TransformPointX(x3,y3),trans.TransformPointY(x3,y3));drawer._z();drawer.ds();drawer._e();break}case AscFormat.LineEndType.Oval:{var _ex=xPrev-xEnd;var _ey=yPrev-yEnd;var _elen=Math.sqrt(_ex*_ex+_ey*_ey);_ex/=_elen;_ey/=_elen;var _vx=_ey;var _vy=-_ex;var tmpx=xEnd+len/2*_ex;var tmpy=yEnd+len/2*_ey;var tmpx2=xEnd-len/2*_ex;var tmpy2= yEnd-len/2*_ey;var cx1=tmpx+_vx*3*w/4;var cy1=tmpy+_vy*3*w/4;var cx2=tmpx2+_vx*3*w/4;var cy2=tmpy2+_vy*3*w/4;var cx3=tmpx-_vx*3*w/4;var cy3=tmpy-_vy*3*w/4;var cx4=tmpx2-_vx*3*w/4;var cy4=tmpy2-_vy*3*w/4;drawer._s();drawer._m(trans.TransformPointX(tmpx,tmpy),trans.TransformPointY(tmpx,tmpy));drawer._c(trans.TransformPointX(cx1,cy1),trans.TransformPointY(cx1,cy1),trans.TransformPointX(cx2,cy2),trans.TransformPointY(cx2,cy2),trans.TransformPointX(tmpx2,tmpy2),trans.TransformPointY(tmpx2,tmpy2));drawer._c(trans.TransformPointX(cx4, cy4),trans.TransformPointY(cx4,cy4),trans.TransformPointX(cx3,cy3),trans.TransformPointY(cx3,cy3),trans.TransformPointX(tmpx,tmpy),trans.TransformPointY(tmpx,tmpy));drawer.drawStrokeFillStyle();drawer._e();drawer._s();drawer._m(trans.TransformPointX(tmpx,tmpy),trans.TransformPointY(tmpx,tmpy));drawer._c(trans.TransformPointX(cx1,cy1),trans.TransformPointY(cx1,cy1),trans.TransformPointX(cx2,cy2),trans.TransformPointY(cx2,cy2),trans.TransformPointX(tmpx2,tmpy2),trans.TransformPointY(tmpx2,tmpy2));drawer._c(trans.TransformPointX(cx4, cy4),trans.TransformPointY(cx4,cy4),trans.TransformPointX(cx3,cy3),trans.TransformPointY(cx3,cy3),trans.TransformPointX(tmpx,tmpy),trans.TransformPointY(tmpx,tmpy));drawer.ds();drawer._e();break}case AscFormat.LineEndType.Stealth:{var _ex=xPrev-xEnd;var _ey=yPrev-yEnd;var _elen=Math.sqrt(_ex*_ex+_ey*_ey);_ex/=_elen;_ey/=_elen;var _vx=_ey;var _vy=-_ex;var tmpx=xEnd+len*_ex;var tmpy=yEnd+len*_ey;var x1=tmpx+_vx*w/2;var y1=tmpy+_vy*w/2;var x3=tmpx-_vx*w/2;var y3=tmpy-_vy*w/2;var x4=xEnd+(len-w/2)*_ex; var y4=yEnd+(len-w/2)*_ey;drawer._s();drawer._m(trans.TransformPointX(x1,y1),trans.TransformPointY(x1,y1));drawer._l(trans.TransformPointX(xEnd,yEnd),trans.TransformPointY(xEnd,yEnd));drawer._l(trans.TransformPointX(x3,y3),trans.TransformPointY(x3,y3));drawer._l(trans.TransformPointX(x4,y4),trans.TransformPointY(x4,y4));drawer._z();drawer.drawStrokeFillStyle();drawer._e();drawer._s();drawer._m(trans.TransformPointX(x1,y1),trans.TransformPointY(x1,y1));drawer._l(trans.TransformPointX(xEnd,yEnd),trans.TransformPointY(xEnd, yEnd));drawer._l(trans.TransformPointX(x3,y3),trans.TransformPointY(x3,y3));drawer._l(trans.TransformPointX(x4,y4),trans.TransformPointY(x4,y4));drawer._z();drawer.ds();drawer._e();break}case AscFormat.LineEndType.Triangle:{var _ex=xPrev-xEnd;var _ey=yPrev-yEnd;var _elen=Math.sqrt(_ex*_ex+_ey*_ey);_ex/=_elen;_ey/=_elen;var _vx=_ey;var _vy=-_ex;var tmpx=xEnd+len*_ex;var tmpy=yEnd+len*_ey;var x1=tmpx+_vx*w/2;var y1=tmpy+_vy*w/2;var x3=tmpx-_vx*w/2;var y3=tmpy-_vy*w/2;drawer._s();drawer._m(trans.TransformPointX(x1, y1),trans.TransformPointY(x1,y1));drawer._l(trans.TransformPointX(xEnd,yEnd),trans.TransformPointY(xEnd,yEnd));drawer._l(trans.TransformPointX(x3,y3),trans.TransformPointY(x3,y3));drawer._z();drawer.drawStrokeFillStyle();drawer._e();drawer._s();drawer._m(trans.TransformPointX(x1,y1),trans.TransformPointY(x1,y1));drawer._l(trans.TransformPointX(xEnd,yEnd),trans.TransformPointY(xEnd,yEnd));drawer._l(trans.TransformPointX(x3,y3),trans.TransformPointY(x3,y3));drawer._z();drawer.ds();drawer._e();break}}} function CShapeDrawer(){this.Shape=null;this.Graphics=null;this.UniFill=null;this.Ln=null;this.Transform=null;this.bIsTexture=false;this.bIsNoFillAttack=false;this.bIsNoStrokeAttack=false;this.bDrawSmartAttack=false;this.FillUniColor=null;this.StrokeUniColor=null;this.StrokeWidth=0;this.min_x=65535;this.min_y=65535;this.max_x=-65535;this.max_y=-65535;this.OldLineJoin=null;this.IsArrowsDrawing=false;this.IsCurrentPathCanArrows=true;this.bIsCheckBounds=false;this.IsRectShape=false}CShapeDrawer.prototype= {Clear:function(){this.UniFill=null;this.Ln=null;this.Transform=null;this.bIsTexture=false;this.bIsNoFillAttack=false;this.bIsNoStrokeAttack=false;this.FillUniColor=null;this.StrokeUniColor=null;this.StrokeWidth=0;this.min_x=65535;this.min_y=65535;this.max_x=-65535;this.max_y=-65535;this.OldLineJoin=null;this.IsArrowsDrawing=false;this.IsCurrentPathCanArrows=true;this.bIsCheckBounds=false;this.IsRectShape=false},CheckPoint:function(_x,_y){var x=_x;var y=_y;if(false&&this.Graphics.MaxEpsLine!==undefined){x= this.Graphics.Graphics.m_oFullTransform.TransformPointX(_x,_y);y=this.Graphics.Graphics.m_oFullTransform.TransformPointY(_x,_y)}if(xthis.max_x)this.max_x=x;if(y>this.max_y)this.max_y=y},CheckDash:function(){if(this.Ln.prstDash!=null&&AscCommon.DashPatternPresets[this.Ln.prstDash]){var _arr=AscCommon.DashPatternPresets[this.Ln.prstDash].slice();for(var indexD=0;indexD<_arr.length;indexD++)_arr[indexD]*=this.StrokeWidth;this.Graphics.p_dash(_arr)}}, fromShape2:function(shape,graphics,geom){this.fromShape(shape,graphics);if(!geom)this.IsRectShape=true;else if(geom.preset=="rect")this.IsRectShape=true},fromShape:function(shape,graphics){this.IsRectShape=false;this.Shape=shape;this.Graphics=graphics;this.UniFill=shape.brush;this.Ln=shape.pen;this.Transform=shape.TransformMatrix;this.min_x=65535;this.min_y=65535;this.max_x=-65535;this.max_y=-65535;var bIsCheckBounds=false;if(this.UniFill==null||this.UniFill.fill==null)this.bIsNoFillAttack=true;else{var _fill= this.UniFill.fill;switch(_fill.type){case c_oAscFill.FILL_TYPE_BLIP:{this.bIsTexture=true;break}case c_oAscFill.FILL_TYPE_SOLID:{if(_fill.color)this.FillUniColor=_fill.color.RGBA;else this.FillUniColor=(new AscFormat.CUniColor).RGBA;break}case c_oAscFill.FILL_TYPE_GRAD:{var _c=_fill.colors;if(_c.length==0)this.FillUniColor=(new AscFormat.CUniColor).RGBA;else if(_fill.colors[0].color)this.FillUniColor=_fill.colors[0].color.RGBA;else this.FillUniColor=(new AscFormat.CUniColor).RGBA;bIsCheckBounds=true; break}case c_oAscFill.FILL_TYPE_PATT:{bIsCheckBounds=true;break}case c_oAscFill.FILL_TYPE_NOFILL:{this.bIsNoFillAttack=true;break}default:{this.bIsNoFillAttack=true;break}}}if(this.Ln==null||this.Ln.Fill==null||this.Ln.Fill.fill==null){this.bIsNoStrokeAttack=true;if(true===graphics.IsTrack)graphics.Graphics.ArrayPoints=null;else graphics.ArrayPoints=null}else{var _fill=this.Ln.Fill.fill;switch(_fill.type){case c_oAscFill.FILL_TYPE_BLIP:{this.StrokeUniColor=(new AscFormat.CUniColor).RGBA;break}case c_oAscFill.FILL_TYPE_SOLID:{if(_fill.color)this.StrokeUniColor= _fill.color.RGBA;else this.StrokeUniColor=(new AscFormat.CUniColor).RGBA;break}case c_oAscFill.FILL_TYPE_GRAD:{var _c=_fill.colors;if(_c==0)this.StrokeUniColor=(new AscFormat.CUniColor).RGBA;else if(_fill.colors[0].color)this.StrokeUniColor=_fill.colors[0].color.RGBA;else this.StrokeUniColor=(new AscFormat.CUniColor).RGBA;break}case c_oAscFill.FILL_TYPE_PATT:{if(_fill.fgClr)this.StrokeUniColor=_fill.fgClr.RGBA;else this.StrokeUniColor=(new AscFormat.CUniColor).RGBA;break}case c_oAscFill.FILL_TYPE_NOFILL:{this.bIsNoStrokeAttack= true;break}default:{this.bIsNoStrokeAttack=true;break}}this.StrokeWidth=this.Ln.w==null?12700:parseInt(this.Ln.w);this.StrokeWidth/=36E3;this.p_width(1E3*this.StrokeWidth);this.CheckDash();if(graphics.IsSlideBoundsCheckerType&&!this.bIsNoStrokeAttack)graphics.LineWidth=this.StrokeWidth;var isUseArrayPoints=false;if(this.Ln.headEnd!=null&&this.Ln.headEnd.type!=null||this.Ln.tailEnd!=null&&this.Ln.tailEnd.type!=null)isUseArrayPoints=true;if(true===graphics.IsTrack&&graphics.Graphics!=undefined&&graphics.Graphics!= null)graphics.Graphics.ArrayPoints=isUseArrayPoints?[]:null;else graphics.ArrayPoints=isUseArrayPoints?[]:null;if(this.Graphics.m_oContext!=null&&this.Ln.Join!=null&&this.Ln.Join.type!=null)this.OldLineJoin=this.Graphics.m_oContext.lineJoin}if(this.bIsTexture||bIsCheckBounds){this.bIsCheckBounds=true;this.check_bounds();this.bIsCheckBounds=false}},draw:function(geom){if(this.bIsNoStrokeAttack&&this.bIsNoFillAttack)return;var bIsPatt=false;if(this.UniFill!=null&&this.UniFill.fill!=null&&(this.UniFill.fill.type== c_oAscFill.FILL_TYPE_PATT||this.UniFill.fill.type==c_oAscFill.FILL_TYPE_GRAD))bIsPatt=true;if(this.Graphics.RENDERER_PDF_FLAG&&(this.bIsTexture||bIsPatt)){this.Graphics.put_TextureBoundsEnabled(true);this.Graphics.put_TextureBounds(this.min_x,this.min_y,this.max_x-this.min_x,this.max_y-this.min_y)}var _old_composite=null;if(this.Graphics.ClearMode===true){_old_composite=this.Graphics.m_oContext.globalCompositeOperation;this.Graphics.m_oContext.globalCompositeOperation="destination-out"}if(geom)geom.draw(this); else{this._s();this._m(0,0);this._l(this.Shape.extX,0);this._l(this.Shape.extX,this.Shape.extY);this._l(0,this.Shape.extY);this._z();this.drawFillStroke(true,"norm",true&&!this.bIsNoStrokeAttack);this._e()}this.Graphics.ArrayPoints=null;if(this.Graphics.RENDERER_PDF_FLAG&&(this.bIsTexture||bIsPatt))this.Graphics.put_TextureBoundsEnabled(false);if(this.Graphics.IsSlideBoundsCheckerType&&this.Graphics.AutoCheckLineWidth)this.Graphics.CorrectBounds2();if(this.Graphics.ClearMode===true)this.Graphics.m_oContext.globalCompositeOperation= _old_composite;this.Graphics.p_dash(null)},p_width:function(w){this.Graphics.p_width(w)},_m:function(x,y){if(this.bIsCheckBounds){this.CheckPoint(x,y);return}this.Graphics._m(x,y)},_l:function(x,y){if(this.bIsCheckBounds){this.CheckPoint(x,y);return}this.Graphics._l(x,y)},_c:function(x1,y1,x2,y2,x3,y3){if(this.bIsCheckBounds){this.CheckPoint(x1,y1);this.CheckPoint(x2,y2);this.CheckPoint(x3,y3);return}this.Graphics._c(x1,y1,x2,y2,x3,y3)},_c2:function(x1,y1,x2,y2){if(this.bIsCheckBounds){this.CheckPoint(x1, y1);this.CheckPoint(x2,y2);return}this.Graphics._c2(x1,y1,x2,y2)},_z:function(){this.IsCurrentPathCanArrows=false;if(this.bIsCheckBounds)return;this.Graphics._z()},_s:function(){this.IsCurrentPathCanArrows=true;this.Graphics._s();if(this.Graphics.ArrayPoints!=null)this.Graphics.ArrayPoints=[]},_e:function(){this.IsCurrentPathCanArrows=true;this.Graphics._e();if(this.Graphics.ArrayPoints!=null)this.Graphics.ArrayPoints=[]},df:function(mode){if(mode=="none"||this.bIsNoFillAttack)return;if(this.Graphics.IsTrack)this.Graphics.m_oOverlay.ClearAll= true;if(this.Graphics.IsSlideBoundsCheckerType===true)return;var editorInfo=this.getEditorInfo();var bIsIntegerGridTRUE=false;if(this.bIsTexture){if(this.Graphics.m_bIntegerGrid===true){this.Graphics.SetIntegerGrid(false);bIsIntegerGridTRUE=true}if(this.Graphics.RENDERER_PDF_FLAG){if(null==this.UniFill.fill.tile||this.Graphics.m_oContext===undefined)this.Graphics.put_brushTexture(getFullImageSrc2(this.UniFill.fill.RasterImageId),0);else this.Graphics.put_brushTexture(getFullImageSrc2(this.UniFill.fill.RasterImageId), 1);if(bIsIntegerGridTRUE)this.Graphics.SetIntegerGrid(true);return}var bIsUnusePattern=false;if(AscCommon.AscBrowser.isIE)if(this.UniFill.fill.RasterImageId)if(this.UniFill.fill.RasterImageId.lastIndexOf(".svg")==this.UniFill.fill.RasterImageId.length-4)bIsUnusePattern=true;if(bIsUnusePattern||null==this.UniFill.fill.tile||this.Graphics.m_oContext===undefined)if(this.IsRectShape)if(null==this.UniFill.transparent||this.UniFill.transparent==255)this.Graphics.drawImage(getFullImageSrc2(this.UniFill.fill.RasterImageId), this.min_x,this.min_y,this.max_x-this.min_x,this.max_y-this.min_y,undefined,this.UniFill.fill.srcRect,this.UniFill.fill.canvas);else{var _old_global_alpha=this.Graphics.m_oContext.globalAlpha;this.Graphics.m_oContext.globalAlpha=this.UniFill.transparent/255;this.Graphics.drawImage(getFullImageSrc2(this.UniFill.fill.RasterImageId),this.min_x,this.min_y,this.max_x-this.min_x,this.max_y-this.min_y,undefined,this.UniFill.fill.srcRect,this.UniFill.fill.canvas);this.Graphics.m_oContext.globalAlpha=_old_global_alpha}else{this.Graphics.save(); this.Graphics.clip();if(this.Graphics.IsNoSupportTextDraw==true||true==this.Graphics.IsTrack||null==this.UniFill.transparent||this.UniFill.transparent==255)this.Graphics.drawImage(getFullImageSrc2(this.UniFill.fill.RasterImageId),this.min_x,this.min_y,this.max_x-this.min_x,this.max_y-this.min_y,undefined,this.UniFill.fill.srcRect,this.UniFill.fill.canvas);else{var _old_global_alpha=this.Graphics.m_oContext.globalAlpha;this.Graphics.m_oContext.globalAlpha=this.UniFill.transparent/255;this.Graphics.drawImage(getFullImageSrc2(this.UniFill.fill.RasterImageId), this.min_x,this.min_y,this.max_x-this.min_x,this.max_y-this.min_y,undefined,this.UniFill.fill.srcRect,this.UniFill.fill.canvas);this.Graphics.m_oContext.globalAlpha=_old_global_alpha}this.Graphics.restore()}else{var _img=editorInfo.editor.ImageLoader.map_image_index[getFullImageSrc2(this.UniFill.fill.RasterImageId)];var _img_native=this.UniFill.fill.canvas;if(!_img_native&&(_img==undefined||_img.Image==null||_img.Status==AscFonts.ImageLoadStatus.Loading)){this.Graphics.save();this.Graphics.clip(); if(this.Graphics.IsNoSupportTextDraw===true||true==this.Graphics.IsTrack||null==this.UniFill.transparent||this.UniFill.transparent==255)this.Graphics.drawImage(getFullImageSrc2(this.UniFill.fill.RasterImageId),this.min_x,this.min_y,this.max_x-this.min_x,this.max_y-this.min_y);else{var _old_global_alpha=this.Graphics.m_oContext.globalAlpha;this.Graphics.m_oContext.globalAlpha=this.UniFill.transparent/255;this.Graphics.drawImage(getFullImageSrc2(this.UniFill.fill.RasterImageId),this.min_x,this.min_y, this.max_x-this.min_x,this.max_y-this.min_y);this.Graphics.m_oContext.globalAlpha=_old_global_alpha}this.Graphics.restore()}else{var _is_ctx=false;if(this.Graphics.IsNoSupportTextDraw===true||undefined===this.Graphics.m_oContext||null==this.UniFill.transparent||this.UniFill.transparent==255)_is_ctx=false;else _is_ctx=true;var _gr=this.Graphics.IsTrack===true?this.Graphics.Graphics:this.Graphics;var _ctx=_gr.m_oContext;var patt=!_img_native?_ctx.createPattern(_img.Image,"repeat"):_ctx.createPattern(_img_native, "repeat");_ctx.save();var __graphics=this.Graphics.MaxEpsLine===undefined?this.Graphics:this.Graphics.Graphics;var bIsThumbnail=__graphics.IsThumbnail===true?true:false;var koefX=editorInfo.scale;var koefY=editorInfo.scale;if(bIsThumbnail){koefX=__graphics.m_dDpiX/AscCommon.g_dDpiX;koefY=__graphics.m_dDpiY/AscCommon.g_dDpiX;koefX/=AscCommon.AscBrowser.retinaPixelRatio;koefY/=AscCommon.AscBrowser.retinaPixelRatio}_ctx.translate(this.min_x,this.min_y);_ctx.scale(koefX*__graphics.TextureFillTransformScaleX, koefY*__graphics.TextureFillTransformScaleY);if(_is_ctx===true){var _old_global_alpha=_ctx.globalAlpha;_ctx.globalAlpha=this.UniFill.transparent/255;_ctx.fillStyle=patt;_ctx.fill();_ctx.globalAlpha=_old_global_alpha}else{_ctx.fillStyle=patt;_ctx.fill()}_ctx.restore();_gr.m_bPenColorInit=false;_gr.m_bBrushColorInit=false}}if(bIsIntegerGridTRUE)this.Graphics.SetIntegerGrid(true);return}if(this.UniFill!=null&&this.UniFill.fill!=null){var _fill=this.UniFill.fill;if(_fill.type==c_oAscFill.FILL_TYPE_PATT){if(this.Graphics.m_bIntegerGrid=== true){this.Graphics.SetIntegerGrid(false);bIsIntegerGridTRUE=true}var _is_ctx=false;if(this.Graphics.IsNoSupportTextDraw===true||undefined===this.Graphics.m_oContext||null==this.UniFill.transparent||this.UniFill.transparent==255)_is_ctx=false;else _is_ctx=true;var _gr=this.Graphics.IsTrack===true?this.Graphics.Graphics:this.Graphics;var _ctx=_gr.m_oContext;var _patt_name=AscCommon.global_hatch_names[_fill.ftype];if(undefined==_patt_name)_patt_name="cross";var _fc=_fill.fgClr&&_fill.fgClr.RGBA||{R:0, G:0,B:0,A:255};var _bc=_fill.bgClr&&_fill.bgClr.RGBA||{R:255,G:255,B:255,A:255};var __fa=null===this.UniFill.transparent?_fc.A:255;var __ba=null===this.UniFill.transparent?_bc.A:255;var _test_pattern=AscCommon.GetHatchBrush(_patt_name,_fc.R,_fc.G,_fc.B,__fa,_bc.R,_bc.G,_bc.B,__ba);var patt=_ctx.createPattern(_test_pattern.Canvas,"repeat");_ctx.save();var koefX=editorInfo.scale;var koefY=editorInfo.scale;if(this.Graphics.IsThumbnail){koefX=1;koefY=1}_ctx.translate(this.min_x,this.min_y);if(this.Graphics.MaxEpsLine=== undefined)_ctx.scale(koefX*this.Graphics.TextureFillTransformScaleX,koefY*this.Graphics.TextureFillTransformScaleY);else _ctx.scale(koefX*this.Graphics.Graphics.TextureFillTransformScaleX,koefY*this.Graphics.Graphics.TextureFillTransformScaleY);if(_is_ctx===true){var _old_global_alpha=_ctx.globalAlpha;if(null!=this.UniFill.transparent)_ctx.globalAlpha=this.UniFill.transparent/255;_ctx.fillStyle=patt;_ctx.fill();_ctx.globalAlpha=_old_global_alpha}else{_ctx.fillStyle=patt;_ctx.fill()}_ctx.restore(); _gr.m_bPenColorInit=false;_gr.m_bBrushColorInit=false;if(bIsIntegerGridTRUE)this.Graphics.SetIntegerGrid(true);return}else if(_fill.type==c_oAscFill.FILL_TYPE_GRAD){if(this.Graphics.m_bIntegerGrid===true){this.Graphics.SetIntegerGrid(false);bIsIntegerGridTRUE=true}var _is_ctx=false;if(this.Graphics.IsNoSupportTextDraw===true||undefined===this.Graphics.m_oContext||null==this.UniFill.transparent||this.UniFill.transparent==255)_is_ctx=false;else _is_ctx=true;var _gr=this.Graphics.IsTrack===true?this.Graphics.Graphics: this.Graphics;var _ctx=_gr.m_oContext;var gradObj=null;if(_fill.lin){var _angle=_fill.lin.angle;if(_fill.rotateWithShape===false){var matrix_transform=this.Graphics.IsTrack===true?this.Graphics.Graphics.m_oTransform:this.Graphics.m_oTransform;if(matrix_transform)_angle=AscCommon.GradientGetAngleNoRotate(_angle,matrix_transform)}var points=this.getGradientPoints(this.min_x,this.min_y,this.max_x,this.max_y,_angle,_fill.lin.scale);gradObj=_ctx.createLinearGradient(points.x0,points.y0,points.x1,points.y1)}else if(_fill.path){var _cx= (this.min_x+this.max_x)/2;var _cy=(this.min_y+this.max_y)/2;var _r=Math.max(this.max_x-this.min_x,this.max_y-this.min_y)/2;gradObj=_ctx.createRadialGradient(_cx,_cy,1,_cx,_cy,_r)}else{var points=this.getGradientPoints(this.min_x,this.min_y,this.max_x,this.max_y,0,false);gradObj=_ctx.createLinearGradient(points.x0,points.y0,points.x1,points.y1)}for(var i=0;i<_fill.colors.length;i++)gradObj.addColorStop(_fill.colors[i].pos/1E5,_fill.colors[i].color.getCSSColor(this.UniFill.transparent));_ctx.fillStyle= gradObj;if(null!==this.UniFill.transparent&&undefined!==this.UniFill.transparent){var _old_global_alpha=this.Graphics.m_oContext.globalAlpha;_ctx.globalAlpha=this.UniFill.transparent/255;_ctx.fill();_ctx.globalAlpha=_old_global_alpha}else _ctx.fill();_gr.m_bPenColorInit=false;_gr.m_bBrushColorInit=false;if(bIsIntegerGridTRUE)this.Graphics.SetIntegerGrid(true);return}}var rgba=this.FillUniColor;if(mode=="darken"){var _color1=new CShapeColor(rgba.R,rgba.G,rgba.B);var rgb=_color1.darken();rgba={R:rgb.r, G:rgb.g,B:rgb.b,A:rgba.A}}else if(mode=="darkenLess"){var _color1=new CShapeColor(rgba.R,rgba.G,rgba.B);var rgb=_color1.darkenLess();rgba={R:rgb.r,G:rgb.g,B:rgb.b,A:rgba.A}}else if(mode=="lighten"){var _color1=new CShapeColor(rgba.R,rgba.G,rgba.B);var rgb=_color1.lighten();rgba={R:rgb.r,G:rgb.g,B:rgb.b,A:rgba.A}}else if(mode=="lightenLess"){var _color1=new CShapeColor(rgba.R,rgba.G,rgba.B);var rgb=_color1.lightenLess();rgba={R:rgb.r,G:rgb.g,B:rgb.b,A:rgba.A}}if(rgba){if(this.UniFill!=null&&this.UniFill.transparent!= null&&this.Graphics.ClearMode!==true)rgba.A=this.UniFill.transparent;this.Graphics.b_color1(rgba.R,rgba.G,rgba.B,rgba.A)}this.Graphics.df()},ds:function(){if(this.bIsNoStrokeAttack)return;if(this.Graphics.IsTrack)this.Graphics.m_oOverlay.ClearAll=true;if(null!=this.OldLineJoin&&!this.IsArrowsDrawing)switch(this.Ln.Join.type){case AscFormat.LineJoinType.Round:{this.Graphics.m_oContext.lineJoin="round";break}case AscFormat.LineJoinType.Bevel:{this.Graphics.m_oContext.lineJoin="bevel";break}case AscFormat.LineJoinType.Empty:{this.Graphics.m_oContext.lineJoin= "miter";break}case AscFormat.LineJoinType.Miter:{this.Graphics.m_oContext.lineJoin="miter";break}}var arr=this.Graphics.IsTrack===true?this.Graphics.Graphics.ArrayPoints:this.Graphics.ArrayPoints;var isArrowsPresent=arr!=null&&arr.length>1&&this.IsCurrentPathCanArrows===true?true:false;var rgba=this.StrokeUniColor;if(this.Ln&&this.Ln.Fill!=null&&this.Ln.Fill.transparent!=null&&!isArrowsPresent)rgba.A=this.Ln.Fill.transparent;this.Graphics.p_color(rgba.R,rgba.G,rgba.B,rgba.A);if(this.IsRectShape&& this.Graphics.AddSmartRect!==undefined)if(undefined!==this.Shape.extX)this.Graphics.AddSmartRect(0,0,this.Shape.extX,this.Shape.extY,this.StrokeWidth);else this.Graphics.ds();else this.Graphics.ds();if(null!=this.OldLineJoin&&!this.IsArrowsDrawing)this.Graphics.m_oContext.lineJoin=this.OldLineJoin;if(isArrowsPresent){this.IsArrowsDrawing=true;this.Graphics.p_dash(null);var _graphicsCtx=this.Graphics.IsTrack===true?this.Graphics.Graphics:this.Graphics;var trans=_graphicsCtx.m_oFullTransform;var trans1= AscCommon.global_MatrixTransformer.Invert(trans);var x1=trans.TransformPointX(0,0);var y1=trans.TransformPointY(0,0);var x2=trans.TransformPointX(1,1);var y2=trans.TransformPointY(1,1);var dKoef=Math.sqrt(((x2-x1)*(x2-x1)+(y2-y1)*(y2-y1))/2);var _pen_w=this.Graphics.IsTrack===true?this.Graphics.Graphics.m_oContext.lineWidth*dKoef:this.Graphics.m_oContext.lineWidth*dKoef;var _max_w=undefined;if(_graphicsCtx.IsThumbnail===true)_max_w=2;var _max_delta_eps2=.001;var arrKoef=this.isArrPix?1/AscCommon.g_dKoef_mm_to_pix: 1;if(this.Ln.headEnd!=null){var _x1=trans.TransformPointX(arr[0].x,arr[0].y);var _y1=trans.TransformPointY(arr[0].x,arr[0].y);var _x2=trans.TransformPointX(arr[1].x,arr[1].y);var _y2=trans.TransformPointY(arr[1].x,arr[1].y);var _max_delta_eps=Math.max(this.Ln.headEnd.GetLen(_pen_w),5);var _max_delta=Math.max(Math.abs(_x1-_x2),Math.abs(_y1-_y2));var cur_point=2;while(_max_delta<_max_delta_eps&&cur_point_max_delta_eps2){_graphicsCtx.ArrayPoints=null;DrawLineEnd(_x1,_y1,_x2,_y2,this.Ln.headEnd.type,arrKoef*this.Ln.headEnd.GetWidth(_pen_w,_max_w),arrKoef*this.Ln.headEnd.GetLen(_pen_w,_max_w),this,trans1);_graphicsCtx.ArrayPoints=arr}}if(this.Ln.tailEnd!=null){var _1=arr.length-1;var _2=arr.length-2;var _x1=trans.TransformPointX(arr[_1].x,arr[_1].y);var _y1=trans.TransformPointY(arr[_1].x,arr[_1].y); var _x2=trans.TransformPointX(arr[_2].x,arr[_2].y);var _y2=trans.TransformPointY(arr[_2].x,arr[_2].y);var _max_delta_eps=Math.max(this.Ln.tailEnd.GetLen(_pen_w),5);var _max_delta=Math.max(Math.abs(_x1-_x2),Math.abs(_y1-_y2));var cur_point=_2-1;while(_max_delta<_max_delta_eps&&cur_point>=0){_x2=trans.TransformPointX(arr[cur_point].x,arr[cur_point].y);_y2=trans.TransformPointY(arr[cur_point].x,arr[cur_point].y);_max_delta=Math.max(Math.abs(_x1-_x2),Math.abs(_y1-_y2));cur_point--}if(_max_delta>_max_delta_eps2){_graphicsCtx.ArrayPoints= null;DrawLineEnd(_x1,_y1,_x2,_y2,this.Ln.tailEnd.type,arrKoef*this.Ln.tailEnd.GetWidth(_pen_w,_max_w),arrKoef*this.Ln.tailEnd.GetLen(_pen_w,_max_w),this,trans1);_graphicsCtx.ArrayPoints=arr}}this.IsArrowsDrawing=false;this.CheckDash()}},drawFillStroke:function(bIsFill,fill_mode,bIsStroke){if(this.Graphics.IsTrack)this.Graphics.m_oOverlay.ClearAll=true;if(this.Graphics.IsSlideBoundsCheckerType)return;if(this.Graphics.RENDERER_PDF_FLAG===undefined){if(bIsFill)this.df(fill_mode);if(bIsStroke)this.ds()}else{if(this.bIsNoStrokeAttack)bIsStroke= false;var arr=this.Graphics.ArrayPoints;var isArrowsPresent=arr!=null&&arr.length>1&&this.IsCurrentPathCanArrows===true?true:false;if(bIsStroke){if(null!=this.OldLineJoin&&!this.IsArrowsDrawing)this.Graphics.put_PenLineJoin(AscFormat.ConvertJoinAggType(this.Ln.Join.type));var rgba=this.StrokeUniColor;if(this.Ln&&this.Ln.Fill!=null&&this.Ln.Fill.transparent!=null&&!isArrowsPresent)rgba.A=this.Ln.Fill.transparent;this.Graphics.p_color(rgba.R,rgba.G,rgba.B,rgba.A)}if(fill_mode=="none"||this.bIsNoFillAttack)bIsFill= false;var bIsPattern=false;if(bIsFill)if(this.bIsTexture){if(null==this.UniFill.fill.tile)if(null==this.UniFill.fill.srcRect)if(this.UniFill.fill.RasterImageId&&this.UniFill.fill.RasterImageId.indexOf(".svg")!=0)this.Graphics.put_brushTexture(getFullImageSrc2(this.UniFill.fill.RasterImageId),0);else if(this.UniFill.fill.canvas)this.Graphics.put_brushTexture(this.UniFill.fill.canvas.toDataURL("image/png"),0);else this.Graphics.put_brushTexture(getFullImageSrc2(this.UniFill.fill.RasterImageId),0);else if(this.IsRectShape){this.Graphics.drawImage(getFullImageSrc2(this.UniFill.fill.RasterImageId), this.min_x,this.min_y,this.max_x-this.min_x,this.max_y-this.min_y,undefined,this.UniFill.fill.srcRect);bIsFill=false}else this.Graphics.put_brushTexture(getFullImageSrc2(this.UniFill.fill.RasterImageId),0);else if(this.UniFill.fill.canvas)this.Graphics.put_brushTexture(this.UniFill.fill.canvas.toDataURL("image/png"),1);else this.Graphics.put_brushTexture(getFullImageSrc2(this.UniFill.fill.RasterImageId),1);this.Graphics.put_BrushTextureAlpha(this.UniFill.transparent)}else{var _fill=this.UniFill.fill; if(_fill.type==c_oAscFill.FILL_TYPE_PATT){var _patt_name=AscCommon.global_hatch_names[_fill.ftype];if(undefined==_patt_name)_patt_name="cross";var _fc=_fill.fgClr&&_fill.fgClr.RGBA||{R:0,G:0,B:0,A:255};var _bc=_fill.bgClr&&_fill.bgClr.RGBA||{R:255,G:255,B:255,A:255};var __fa=null===this.UniFill.transparent?_fc.A:255;var __ba=null===this.UniFill.transparent?_bc.A:255;var _pattern=AscCommon.GetHatchBrush(_patt_name,_fc.R,_fc.G,_fc.B,__fa,_bc.R,_bc.G,_bc.B,__ba);var _url64="";try{_url64=_pattern.toDataURL()}catch(err){_url64= ""}this.Graphics.put_brushTexture(_url64,1);if(null!=this.UniFill.transparent)this.Graphics.put_BrushTextureAlpha(this.UniFill.transparent);else this.Graphics.put_BrushTextureAlpha(255);bIsPattern=true}else if(_fill.type==c_oAscFill.FILL_TYPE_GRAD){var points=null;if(_fill.lin){var _angle=_fill.lin.angle;if(_fill.rotateWithShape===false&&this.Graphics.m_oTransform)_angle=AscCommon.GradientGetAngleNoRotate(_angle,this.Graphics.m_oTransform);points=this.getGradientPoints(this.min_x,this.min_y,this.max_x, this.max_y,_angle,_fill.lin.scale)}else if(_fill.path){var _cx=(this.min_x+this.max_x)/2;var _cy=(this.min_y+this.max_y)/2;var _r=Math.max(this.max_x-this.min_x,this.max_y-this.min_y)/2;points={x0:_cx,y0:_cy,x1:_cx,y1:_cy,r0:1,r1:_r}}else points=this.getGradientPoints(this.min_x,this.min_y,this.max_x,this.max_y,0,false);this.Graphics.put_BrushGradient(_fill,points,this.UniFill.transparent)}else{var rgba=this.FillUniColor;if(fill_mode=="darken"){var _color1=new CShapeColor(rgba.R,rgba.G,rgba.B);var rgb= _color1.darken();rgba={R:rgb.r,G:rgb.g,B:rgb.b,A:rgba.A}}else if(fill_mode=="darkenLess"){var _color1=new CShapeColor(rgba.R,rgba.G,rgba.B);var rgb=_color1.darkenLess();rgba={R:rgb.r,G:rgb.g,B:rgb.b,A:rgba.A}}else if(fill_mode=="lighten"){var _color1=new CShapeColor(rgba.R,rgba.G,rgba.B);var rgb=_color1.lighten();rgba={R:rgb.r,G:rgb.g,B:rgb.b,A:rgba.A}}else if(fill_mode=="lightenLess"){var _color1=new CShapeColor(rgba.R,rgba.G,rgba.B);var rgb=_color1.lightenLess();rgba={R:rgb.r,G:rgb.g,B:rgb.b,A:rgba.A}}if(rgba){if(this.UniFill!= null&&this.UniFill.transparent!=null&&this.Graphics.ClearMode!==true)rgba.A=this.UniFill.transparent;this.Graphics.b_color1(rgba.R,rgba.G,rgba.B,rgba.A)}}}if(bIsFill&&bIsStroke)if(this.bIsTexture||bIsPattern){this.Graphics.drawpath(256);this.Graphics.drawpath(1)}else this.Graphics.drawpath(256+1);else if(bIsFill)this.Graphics.drawpath(256);else if(bIsStroke)this.Graphics.drawpath(1);else if(false){this.Graphics.b_color1(0,0,0,0);this.Graphics.drawpath(256)}if(isArrowsPresent){this.IsArrowsDrawing= true;this.Graphics.p_dash(null);var trans=this.Graphics.RENDERER_PDF_FLAG===undefined?this.Graphics.m_oFullTransform:this.Graphics.GetTransform();var trans1=AscCommon.global_MatrixTransformer.Invert(trans);var lineSize=this.Graphics.RENDERER_PDF_FLAG===undefined?this.Graphics.m_oContext.lineWidth:this.Graphics.GetLineWidth();var x1=trans.TransformPointX(0,0);var y1=trans.TransformPointY(0,0);var x2=trans.TransformPointX(1,1);var y2=trans.TransformPointY(1,1);var dKoef=Math.sqrt(((x2-x1)*(x2-x1)+(y2- y1)*(y2-y1))/2);var _pen_w=lineSize*dKoef;var _pen_w_max=2.5/AscCommon.g_dKoef_mm_to_pix;if(this.Ln.headEnd!=null){var _x1=trans.TransformPointX(arr[0].x,arr[0].y);var _y1=trans.TransformPointY(arr[0].x,arr[0].y);var _x2=trans.TransformPointX(arr[1].x,arr[1].y);var _y2=trans.TransformPointY(arr[1].x,arr[1].y);var _max_delta=Math.max(Math.abs(_x1-_x2),Math.abs(_y1-_y2));var cur_point=2;while(_max_delta<.001&&cur_point.001){this.Graphics.ArrayPoints=null;DrawLineEnd(_x1,_y1,_x2,_y2,this.Ln.headEnd.type,this.Ln.headEnd.GetWidth(_pen_w,_pen_w_max),this.Ln.headEnd.GetLen(_pen_w,_pen_w_max),this,trans1);this.Graphics.ArrayPoints=arr}}if(this.Ln.tailEnd!=null){var _1=arr.length-1;var _2=arr.length-2;var _x1=trans.TransformPointX(arr[_1].x,arr[_1].y);var _y1=trans.TransformPointY(arr[_1].x,arr[_1].y);var _x2=trans.TransformPointX(arr[_2].x, arr[_2].y);var _y2=trans.TransformPointY(arr[_2].x,arr[_2].y);var _max_delta=Math.max(Math.abs(_x1-_x2),Math.abs(_y1-_y2));var cur_point=_2-1;while(_max_delta<.001&&cur_point>=0){_x2=trans.TransformPointX(arr[cur_point].x,arr[cur_point].y);_y2=trans.TransformPointY(arr[cur_point].x,arr[cur_point].y);_max_delta=Math.max(Math.abs(_x1-_x2),Math.abs(_y1-_y2));cur_point--}if(_max_delta>.001){this.Graphics.ArrayPoints=null;DrawLineEnd(_x1,_y1,_x2,_y2,this.Ln.tailEnd.type,this.Ln.tailEnd.GetWidth(_pen_w, _pen_w_max),this.Ln.tailEnd.GetLen(_pen_w,_pen_w_max),this,trans1);this.Graphics.ArrayPoints=arr}}this.IsArrowsDrawing=false;this.CheckDash()}}},drawStrokeFillStyle:function(){if(this.Graphics.RENDERER_PDF_FLAG===undefined){var gr=this.Graphics.IsTrack==true?this.Graphics.Graphics:this.Graphics;var tmp=gr.m_oBrush.Color1;var p_c=gr.m_oPen.Color;gr.b_color1(p_c.R,p_c.G,p_c.B,p_c.A);gr.df();gr.b_color1(tmp.R,tmp.G,tmp.B,tmp.A)}else{var tmp=this.Graphics.GetBrush().Color1;var p_c=this.Graphics.GetPen().Color; this.Graphics.b_color1(p_c.R,p_c.G,p_c.B,p_c.A);this.Graphics.df();this.Graphics.b_color1(tmp.R,tmp.G,tmp.B,tmp.A)}},check_bounds:function(){this.Shape.check_bounds(this)},getNormalPoint:function(x0,y0,angle,x1,y1){var ex1=Math.cos(angle);var ey1=Math.sin(angle);var ex2=-ey1;var ey2=ex1;var a=ex1/ey1;var b=ex2/ey2;var x=(a*b*y1-a*b*y0-(a*x1-b*x0))/(b-a);var y=(x-x0)/a+y0;return{X:x,Y:y}},getGradientPoints:function(min_x,min_y,max_x,max_y,_angle,scale){var points={x0:0,y0:0,x1:0,y1:0};var angle=_angle/ 6E4;while(angle<0)angle+=360;while(angle>=360)angle-=360;if(Math.abs(angle)<1){points.x0=min_x;points.y0=min_y;points.x1=max_x;points.y1=min_y;return points}else if(Math.abs(angle-90)<1){points.x0=min_x;points.y0=min_y;points.x1=min_x;points.y1=max_y;return points}else if(Math.abs(angle-180)<1){points.x0=max_x;points.y0=min_y;points.x1=min_x;points.y1=min_y;return points}else if(Math.abs(angle-270)<1){points.x0=min_x;points.y0=max_y;points.x1=min_x;points.y1=min_y;return points}var grad_a=AscCommon.deg2rad(angle); if(!scale){if(angle>0&&angle<90){var p=this.getNormalPoint(min_x,min_y,grad_a,max_x,max_y);points.x0=min_x;points.y0=min_y;points.x1=p.X;points.y1=p.Y;return points}if(angle>90&&angle<180){var p=this.getNormalPoint(max_x,min_y,grad_a,min_x,max_y);points.x0=max_x;points.y0=min_y;points.x1=p.X;points.y1=p.Y;return points}if(angle>180&&angle<270){var p=this.getNormalPoint(max_x,max_y,grad_a,min_x,min_y);points.x0=max_x;points.y0=max_y;points.x1=p.X;points.y1=p.Y;return points}if(angle>270&&angle<360){var p= this.getNormalPoint(min_x,max_y,grad_a,max_x,min_y);points.x0=min_x;points.y0=max_y;points.x1=p.X;points.y1=p.Y;return points}return points}var _grad_45=Math.PI/2-Math.atan2(max_y-min_y,max_x-min_x);var _grad_90_45=Math.PI/2-_grad_45;if(angle>0&&angle<90){if(angle<=45)grad_a=_grad_45*angle/45;else grad_a=_grad_45+_grad_90_45*(angle-45)/45;var p=this.getNormalPoint(min_x,min_y,grad_a,max_x,max_y);points.x0=min_x;points.y0=min_y;points.x1=p.X;points.y1=p.Y;return points}if(angle>90&&angle<180){if(angle<= 135)grad_a=Math.PI/2+_grad_90_45*(angle-90)/45;else grad_a=Math.PI/2+_grad_90_45+_grad_45*(angle-135)/45;var p=this.getNormalPoint(max_x,min_y,grad_a,min_x,max_y);points.x0=max_x;points.y0=min_y;points.x1=p.X;points.y1=p.Y;return points}if(angle>180&&angle<270){if(angle<=225)grad_a=Math.PI+_grad_45*(angle-180)/45;else grad_a=Math.PI+_grad_45+_grad_90_45*(angle-225)/45;var p=this.getNormalPoint(max_x,max_y,grad_a,min_x,min_y);points.x0=max_x;points.y0=max_y;points.x1=p.X;points.y1=p.Y;return points}if(angle> 270&&angle<360){if(angle<=315)grad_a=3*Math.PI/2+_grad_90_45*(angle-270)/45;else grad_a=3*Math.PI/2+_grad_90_45+_grad_45*(angle-315)/45;var p=this.getNormalPoint(min_x,max_y,grad_a,max_x,min_y);points.x0=min_x;points.y0=max_y;points.x1=p.X;points.y1=p.Y;return points}return points},DrawPresentationComment:function(type,x,y,w,h){},getEditorInfo:function(){var _ret={};_ret.editor=Asc.editor||window.editor;switch(_ret.editor.editorId){case AscCommon.c_oEditorId.Word:case AscCommon.c_oEditorId.Presentation:{_ret.scale= _ret.editor.WordControl.m_nZoomValue/100;break}case AscCommon.c_oEditorId.Spreadsheet:{_ret.scale=_ret.editor.asc_getZoom();break}default:break}return _ret}};function ShapeToImageConverter(shape,pageIndex){AscCommon.IsShapeToImageConverter=true;var _bounds_cheker=new AscFormat.CSlideBoundsChecker;var dKoef=AscCommon.g_dKoef_mm_to_pix;var w_mm=210;var h_mm=297;var w_px=w_mm*dKoef>>0;var h_px=h_mm*dKoef>>0;_bounds_cheker.init(w_px,h_px,w_mm,h_mm);_bounds_cheker.transform(1,0,0,1,0,0);_bounds_cheker.AutoCheckLineWidth= true;_bounds_cheker.CheckLineWidth(shape);shape.draw(_bounds_cheker,0);_bounds_cheker.CorrectBounds2();var _need_pix_width=_bounds_cheker.Bounds.max_x-_bounds_cheker.Bounds.min_x+1;var _need_pix_height=_bounds_cheker.Bounds.max_y-_bounds_cheker.Bounds.min_y+1;if(_need_pix_width<=0||_need_pix_height<=0)return null;var _canvas=null;if(window["NATIVE_EDITOR_ENJINE"]===true&&window["IS_NATIVE_EDITOR"]!==true){_need_pix_width=_need_pix_width>>0;_need_pix_height=_need_pix_height>>0;_canvas=new CNativeGraphics; _canvas.width=_need_pix_width;_canvas.height=_need_pix_height;_canvas.create(window["native"],_need_pix_width,_need_pix_height,_need_pix_width/dKoef,_need_pix_height/dKoef);_canvas.CoordTransformOffset(-_bounds_cheker.Bounds.min_x,-_bounds_cheker.Bounds.min_y);_canvas.transform(1,0,0,1,0,0);shape.draw(_canvas,0)}else{_canvas=document.createElement("canvas");_canvas.width=_need_pix_width>>0;_canvas.height=_need_pix_height>>0;var _ctx=_canvas.getContext("2d");var g=new AscCommon.CGraphics;g.init(_ctx, w_px,h_px,w_mm,h_mm);g.m_oFontManager=AscCommon.g_fontManager;g.m_oCoordTransform.tx=-_bounds_cheker.Bounds.min_x;g.m_oCoordTransform.ty=-_bounds_cheker.Bounds.min_y;g.transform(1,0,0,1,0,0);shape.draw(g,0)}if(AscCommon.g_fontManager)AscCommon.g_fontManager.m_pFont=null;if(AscCommon.g_fontManager2)AscCommon.g_fontManager2.m_pFont=null;AscCommon.IsShapeToImageConverter=false;var _ret={ImageNative:_canvas,ImageUrl:""};try{_ret.ImageUrl=_canvas.toDataURL("image/png")}catch(err){if(shape.brush!=null&& shape.brush.fill&&shape.brush.fill.RasterImageId)_ret.ImageUrl=getFullImageSrc2(shape.brush.fill.RasterImageId);else _ret.ImageUrl=""}return _ret}window["AscCommon"]=window["AscCommon"]||{};window["AscCommon"].CShapeDrawer=CShapeDrawer;window["AscCommon"].ShapeToImageConverter=ShapeToImageConverter;window["AscCommon"].IsShapeToImageConverter=false})(window);"use strict";(function(window,undefined){var AscCommon=window["AscCommon"];function StorageBaseImageCtrl(){this.controls=[];this.updateIndex= 0;this.isNeedUpdate=false}StorageBaseImageCtrl.prototype.register=function(image){this.controls.push(image)};StorageBaseImageCtrl.prototype.updateLater=function(){this.updateIndex++};StorageBaseImageCtrl.prototype.needUpdate=function(){this.isNeedUpdate=true};StorageBaseImageCtrl.prototype.updateOverlay=function(){if(this.updateIndex==0)return;this.updateIndex--;if(this.updateIndex<0)this.updateIndex=0;if(this.updateIndex!=0)return;if(!this.isNeedUpdate)return;this.isNeedUpdate=false;var wordControl= window.editor?window.editor.WordControl:undefined;if(wordControl){wordControl.ShowOverlay();wordControl.StartUpdateOverlay();wordControl.OnUpdateOverlay();wordControl.EndUpdateOverlay()}};StorageBaseImageCtrl.prototype.resize=function(){for(var i=0,len=this.controls.length;i0)this.controls[i]._loadActiveIndex(undefined)}};AscCommon.g_imageControlsStorage=new StorageBaseImageCtrl;function BaseImageCtrl(){AscCommon.g_imageControlsStorage.register(this); this.images=[];this.images_active=[];this.url="";this.baseUrl=""}BaseImageCtrl.prototype.support=[1,1.25,1.5,1.75,2];BaseImageCtrl.prototype.isLoadAllSizes=false;BaseImageCtrl.prototype.getAddon=function(val){val=val*100>>0;if(100===val)return"";while(0===val%10)val=val/10>>0;if(val<10)return"@"+val+"x";var str=""+val;return"@"+str.substring(0,1)+"."+str.substr(1)+"x"};BaseImageCtrl.prototype.getIndex=function(){var scale=AscCommon.AscBrowser.retinaPixelRatio;var index=0;var len=this.support.length; while(indexscale+.01)break;++index}--index;if(index<0)return 0;if(index>=len)return len-1;return index};BaseImageCtrl.prototype.load=function(type,url){this.url=url;if(!this.isLoadAllSizes){this._loadIndex();return}for(var i=0,len=this.support.length;i>0,y:.5+pixelsRect.top+cy*(pixelsRect.bottom-pixelsRect.top)/ pageHeightMM>>0}};Placeholder.prototype.getButtonRects=function(pointCenter,scale,isDraw){var ButtonSize=ButtonSize1x;var ButtonBetweenSize=ButtonBetweenSize1x;if(isDraw){ButtonSize=AscCommon.AscBrowser.convertToRetinaValue(ButtonSize,true);ButtonBetweenSize=AscCommon.AscBrowser.convertToRetinaValue(ButtonBetweenSize,true)}var buttonsCount=this.buttons.length;var countColumn=buttonsCount<3?buttonsCount:this.buttons.length+1>>1;var countColumn2=buttonsCount-countColumn;var sizeAllHor=countColumn*ButtonSize+ (countColumn-1)*ButtonBetweenSize;var sizeAllHor2=countColumn2*ButtonSize+(countColumn2-1)*ButtonBetweenSize;var sizeAllVer=buttonsCount>0?ButtonSize:0;if(buttonsCount>countColumn)sizeAllVer+=ButtonSize+ButtonBetweenSize;var parentW=this.anchor.rect.w*scale.x>>0;var parentH=this.anchor.rect.h*scale.y>>0;if(sizeAllHor+(ButtonBetweenSize<<1)>parentW||sizeAllVer+(ButtonBetweenSize<<1)>parentH)return[];var xStart=pointCenter.x-(sizeAllHor>>1);var yStart=pointCenter.y-((buttonsCount==countColumn?ButtonSize: 2*ButtonSize+ButtonBetweenSize)>>1);var ret=[];var x=xStart;var y=yStart;var i=0;while(i>1);y=yStart+ButtonSize+ButtonBetweenSize;while(i>0;var py=.5+pixelsRect.top+y*(pixelsRect.bottom-pixelsRect.top)/pageHeightMM>>0;var rect;for(var i=0;i=rect.x&&px<=rect.x+ButtonSize&&py>=rect.y&&py<=rect.y+ButtonSize){if(pointMenu){pointMenu.x=rect.x;pointMenu.y=rect.y}return i}}return-1}; Placeholder.prototype.onPointerDown=function(x,y,pixelsRect,pageWidthMM,pageHeightMM){var pointMenu={x:0,y:0};var indexButton=this.isInside(x,y,pixelsRect,pageWidthMM,pageHeightMM,pointMenu);if(-1==indexButton)return false;if(this.states[indexButton]==AscCommon.PlaceholderButtonState.Active){this.states[indexButton]=AscCommon.PlaceholderButtonState.Over;this.events.document.m_oWordControl.OnUpdateOverlay();this.events.document.m_oWordControl.EndUpdateOverlay();this.events.closeCallback(this.buttons[indexButton], this);return true}else if(this.events.mapActive[this.buttons[indexButton]]){for(var i=0;i>0;yCoord+=7*g_dKoef_mm_to_pix>>0}break;case AscCommon.c_oEditorId.Presentation:xCoord+=(word_control.m_oMainParent.AbsolutePosition.L+word_control.m_oMainView.AbsolutePosition.L)*g_dKoef_mm_to_pix>>0;yCoord+=(word_control.m_oMainParent.AbsolutePosition.T+word_control.m_oMainView.AbsolutePosition.T)*g_dKoef_mm_to_pix>>0;yCoord+=ButtonSize1x;break;default:break}this.events.callCallback(this.buttons[indexButton],this,xCoord,yCoord); return true};Placeholder.prototype.onPointerMove=function(x,y,pixelsRect,pageWidthMM,pageHeightMM,checker){var indexButton=this.isInside(x,y,pixelsRect,pageWidthMM,pageHeightMM);var isUpdate=false;for(var i=0;i>1;var ctx=overlay.m_oContext;for(var i=0;i.001||Math.abs(t1.y-t2.y)>.001||Math.abs(t1.w-t2.w)>.001||Math.abs(t1.h-t2.h)>.001)return this._onUpdate(objects);t1=this.objects[i].anchor.transform; t2=objects[i].anchor.transform;if(!t1&&!t2)continue;if(t1&&!t2||!t1&&t2)return this._onUpdate(objects);if(Math.abs(t1.sx-t2.sx)>.001||Math.abs(t1.sy-t2.sy)>.001||Math.abs(t1.shx-t2.shx)>.001||Math.abs(t1.shy-t2.shy)>.001||Math.abs(t1.tx-t2.tx)>.001||Math.abs(t1.ty-t2.ty)>.001)return this._onUpdate(objects)}};Placeholders.prototype._onUpdate=function(objects){this.objects=objects?objects:[];for(var i=0;i>1;var isActive=1===(1&i);var size=sizes[index];var image=document.createElement("canvas");image.width=size;image.height=size;var ctx=image.getContext("2d");var data=ctx.createImageData(size,size);var px=data.data;var len=(size>>1)-1;var count=len+1>>1;var x=size-len>>1;var y=size-count>>1;var color=isActive?255:0;while(len>0){var ind=4*(size*y+x);for(var j=0;j=0;indexA--)if(Math.abs(x-arr[indexA])<1E-5)return;arr.push(x)};CContentControlTrack.prototype.GetPosition=function(){var eps=1E-5;var i,j,count,curRect,curSavedRect;var arrY=[];var countY=0;var counter2=0; if(this.rects){count=this.rects.length;for(i=0;icurRect.X)curSavedRect.X=curRect.X;if(curSavedRect.RcurRect.X)curSavedRect.X=curRect.X;if(curSavedRect.Reps){arrY.push({X:curRect.X,R:curRect.R,Y:curRect.B,Page:curRect.Page,allX:[curRect.X,curRect.R]});++countY}}}if(this.paths){count=this.paths.length; var k,page;for(i=0;icurRect.X)curSavedRect.X=curRect.X;if(curSavedRect.R0){this.Pos.X=arrY[0].X;this.Pos.Y=arrY[0].Y;this.Pos.Page=arrY[0].Page}if(!this.IsNoUseButtons())switch(this.type){case Asc.c_oAscContentControlSpecificType.ComboBox:case Asc.c_oAscContentControlSpecificType.DropDownList:case Asc.c_oAscContentControlSpecificType.DateTime:{var len=arrY.length;if(len>0){this.ComboRect={X:arrY[len-1].R,Y:arrY[len-1].Y,B:arrY[len-1].Y,Page:arrY[len-1].Page};for(i=len-2;i>=0;i--)if(this.ComboRect.Page!= arrY[i].Page||Math.abs(this.ComboRect.X-arrY[i].R)>eps||arrY[i].allX.length>2)break;if(i==len-1)i--;if(i<0)i=0;if(i>=0)this.ComboRect.Y=arrY[i].Y}break}default:break}if(this.isForm){this.formInfo={};var _geom,_polygonDrawer;if(this.rects){_geom=this.rects[0];_polygonDrawer=new CPolygonCC;_polygonDrawer.init(this,AscCommon.g_dKoef_mm_to_pix,0,1);_polygonDrawer.moveTo(_geom.R,_geom.Y);_polygonDrawer.lineTo(_geom.X,_geom.Y);_polygonDrawer.lineTo(_geom.X,_geom.B);_polygonDrawer.lineTo(_geom.R,_geom.B); _polygonDrawer.closePath();this.formInfo.MoveRectH=_polygonDrawer.rectMove?_polygonDrawer.rectMove.h:0;this.formInfo.bounds=_polygonDrawer.bounds}else if(this.paths){_geom=this.paths[0];_polygonDrawer=new CPolygonCC;_polygonDrawer.init(this,AscCommon.g_dKoef_mm_to_pix,0,1);for(var pointIndex=0,pointCount=_geom.Points.length;pointIndex=0&&indexButton>0;if(size&1)return(size>>1)+".5px Helvetica, Arial, sans-serif";return(size>>1)+"px Helvetica, Arial, sans-serif"};this.measure=function(text){if(!this.measures[text]){var ctx=this.document.CanvasHitContext;ctx.font="11px Helvetica, Arial, sans-serif";this.measures[text]=ctx.measureText(text).width}return this.measures[text]}; this.ContentControlsSaveLast=function(){this.ContentControlObjectsLast=[];for(var i=0;i1E-5||Math.abs(_obj1.rects[j].Y-_obj2.rects[j].Y)>1E-5||Math.abs(_obj1.rects[j].R-_obj2.rects[j].R)>1E-5||Math.abs(_obj1.rects[j].B-_obj2.rects[j].B)>1E-5||_obj1.rects[j].Page!=_obj2.rects[j].Page)return true}else if(_obj1.path&&_obj2.path){count1= _obj1.paths.length;count2=_obj2.paths.length;if(count1!=count2)return true;var _points1,_points2;for(var j=0;j1E-5||Math.abs(_points1[k].Y-_points2[k].Y)>1E-5)return true}}else return true}return false};this.DrawContentControlsTrack=function(overlay){var ctx= overlay.m_oContext;var _object;var _pages=this.document.m_arrPages;var _drawingPage;var _pageStart=this.document.m_lDrawingFirst;var _pageEnd=this.document.m_lDrawingEnd;var _geom;if(_pageStart<0)return;var _x,_y,_r,_b;var _koefX=(_pages[_pageStart].drawingPage.right-_pages[_pageStart].drawingPage.left)/_pages[_pageStart].width_mm;var _koefY=(_pages[_pageStart].drawingPage.bottom-_pages[_pageStart].drawingPage.top)/_pages[_pageStart].height_mm;var rPR=AscCommon.AscBrowser.retinaPixelRatio;for(var nIndexContentControl= 0;nIndexContentControlthis._pageEnd)continue;_drawingPage=_pages[_geom.Page].drawingPage;ctx.beginPath();_x=(_drawingPage.left+_koefX*(_geom.X+_object.OffsetX))*rPR;_y=(_drawingPage.top+ _koefY*(_geom.Y+_object.OffsetY))*rPR;_r=(_drawingPage.left+_koefX*(_geom.R+_object.OffsetX))*rPR;_b=(_drawingPage.top+_koefY*(_geom.B+_object.OffsetY))*rPR;overlay.CheckRect(_x,_y,_r-_x,_b-_y);ctx.rect((_x>>0)+.5*Math.round(rPR),(_y>>0)+.5*Math.round(rPR),_r-_x>>0,_b-_y>>0);if(_object.state==AscCommon.ContentControlTrack.Hover)ctx.fill();ctx.stroke();ctx.beginPath()}else{if(_object.paths)for(var j=0;j<_object.paths.length;j++){_geom=_object.paths[j];if(_geom.Page<_pageStart||_geom.Page>this._pageEnd)continue; _drawingPage=_pages[_geom.Page].drawingPage;ctx.beginPath();for(var pointIndex=0,pointCount=_geom.Points.length;pointIndex>0)+.5*Math.round(rPR);_y=(_y>>0)+.5*Math.round(rPR);if(0==pointCount)ctx.moveTo(_x,_y);else ctx.lineTo(_x,_y)}ctx.closePath();if(_object.state==AscCommon.ContentControlTrack.Hover)ctx.fill(); ctx.stroke();ctx.beginPath()}}else if(_object.rects)for(var j=0;j<_object.rects.length;j++){_geom=_object.rects[j];if(_geom.Page<_pageStart||_geom.Page>this._pageEnd)continue;_drawingPage=_pages[_geom.Page].drawingPage;var x1=_object.transform.TransformPointX(_geom.X,_geom.Y);var y1=_object.transform.TransformPointY(_geom.X,_geom.Y);var x2=_object.transform.TransformPointX(_geom.R,_geom.Y);var y2=_object.transform.TransformPointY(_geom.R,_geom.Y);var x3=_object.transform.TransformPointX(_geom.R,_geom.B); var y3=_object.transform.TransformPointY(_geom.R,_geom.B);var x4=_object.transform.TransformPointX(_geom.X,_geom.B);var y4=_object.transform.TransformPointY(_geom.X,_geom.B);x1=(_drawingPage.left+_koefX*x1)*rPR;x2=(_drawingPage.left+_koefX*x2)*rPR;x3=(_drawingPage.left+_koefX*x3)*rPR;x4=(_drawingPage.left+_koefX*x4)*rPR;y1=(_drawingPage.top+_koefY*y1)*rPR;y2=(_drawingPage.top+_koefY*y2)*rPR;y3=(_drawingPage.top+_koefY*y3)*rPR;y4=(_drawingPage.top+_koefY*y4)*rPR;ctx.beginPath();overlay.CheckPoint(x1, y1);overlay.CheckPoint(x2,y2);overlay.CheckPoint(x3,y3);overlay.CheckPoint(x4,y4);ctx.moveTo(x1,y1);ctx.lineTo(x2,y2);ctx.lineTo(x3,y3);ctx.lineTo(x4,y4);ctx.closePath();if(_object.state==AscCommon.ContentControlTrack.Hover)ctx.fill();ctx.stroke();ctx.beginPath()}else{if(_object.paths)for(var j=0;j<_object.paths.length;j++){_geom=_object.paths[j];if(_geom.Page<_pageStart||_geom.Page>this._pageEnd)continue;_drawingPage=_pages[_geom.Page].drawingPage;ctx.beginPath();for(var pointIndex=0,pointCount= _geom.Points.length;pointIndexthis._pageEnd)continue;_drawingPage=_pages[_geom.Page].drawingPage;var _polygonDrawer=new CPolygonCC;_polygonDrawer.init(_object,(_koefX+_koefY)/2,j,_object.rects.length);_polygonDrawer.moveTo(_geom.R,_geom.Y);_polygonDrawer.lineTo(_geom.X,_geom.Y);_polygonDrawer.lineTo(_geom.X,_geom.B);_polygonDrawer.lineTo(_geom.R,_geom.B);_polygonDrawer.closePath();_polygonDrawer.draw(overlay,_object,_drawingPage,_koefX,_koefY, this.icons)}else if(_object.paths)for(var j=0;j<_object.paths.length;j++){_geom=_object.paths[j];if(_geom.Page<_pageStart||_geom.Page>this._pageEnd)continue;_drawingPage=_pages[_geom.Page].drawingPage;var _polygonDrawer=new CPolygonCC;_polygonDrawer.init(_object,(_koefX+_koefY)/2,j,_object.paths.length);for(var pointIndex=0,pointCount=_geom.Points.length;pointIndex=_pageStart&&_object.Pos.Page<=_pageEnd){_drawingPage=_pages[_object.Pos.Page].drawingPage;if(!_object.transform){_x=((_drawingPage.left+_koefX*(_object.Pos.X+_object.OffsetX))*rPR>>0)+.5*Math.round(rPR);_y=((_drawingPage.top+_koefY*(_object.Pos.Y+_object.OffsetY))*rPR>>0)+.5*Math.round(rPR);if(_object.Name!=""||0!=_object.Buttons.length)_y-=Math.round(20*rPR);else _x-= Math.round(15*rPR);var widthName=0;if(_object.Name!="")widthName=_object.CalculateNameRect(_koefX,_koefY).W*_koefX*rPR>>0;var widthHeader=widthName+20*_object.Buttons.length*rPR>>0;var xText=_x;if(_object.IsUseMoveRect()){widthHeader+=Math.round(15*rPR);xText+=Math.round(15*rPR)}if(0!=widthHeader){overlay.CheckRect(_x,_y,widthHeader,Math.round(20*rPR));ctx.fillStyle=AscCommon.GlobalSkin.ContentControlsBack;ctx.rect(_x,_y,widthHeader,Math.round(20*rPR));ctx.fill();ctx.beginPath();if(_object.IsUseMoveRect()){ctx.rect(_x, _y,Math.round(15*rPR),Math.round(20*rPR));ctx.fillStyle=1==this.ContentControlObjectState?AscCommon.GlobalSkin.ContentControlsAnchorActive:AscCommon.GlobalSkin.ContentControlsBack;ctx.fill();ctx.beginPath();if(1==this.ContentControlObjectState){ctx.fillStyle=AscCommon.GlobalSkin.ContentControlsAnchorActive;ctx.rect(_x,_y,Math.round(15*rPR),Math.round(20*rPR));ctx.fill();ctx.beginPath()}var cx=_x-.5*Math.round(rPR)+Math.round(5*rPR);var cy=_y-.5*Math.round(rPR)+Math.round(5*rPR);var px3=Math.round(2* rPR);var px5=Math.round(4*rPR);var px10=Math.round(8*rPR);var _color="#ADADAD";if(0==this.ContentControlObjectState||1==this.ContentControlObjectState)_color="#444444";overlay.AddRect(cx,cy,px3,px3);overlay.AddRect(cx,cy+px5,px3,px3);overlay.AddRect(cx,cy+px10,px3,px3);overlay.AddRect(cx+px5,cy,px3,px3);overlay.AddRect(cx+px5,cy+px5,px3,px3);overlay.AddRect(cx+px5,cy+px10,px3,px3);ctx.fillStyle=_color;ctx.fill();ctx.beginPath()}if(_object.Name!=""){if(_object.ActiveButtonIndex==-1)ctx.fillStyle=AscCommon.GlobalSkin.ContentControlsActive; else if(_object.HoverButtonIndex==-1)ctx.fillStyle=AscCommon.GlobalSkin.ContentControlsHover;else ctx.fillStyle=AscCommon.GlobalSkin.ContentControlsBack;ctx.rect(xText,_y,widthName,Math.round(20*rPR));ctx.fill();ctx.beginPath();ctx.fillStyle=_object.ActiveButtonIndex==-1?AscCommon.GlobalSkin.ContentControlsTextActive:AscCommon.GlobalSkin.ContentControlsText;ctx.font=Math.round(11*rPR)+"px Helvetica, Arial, sans-serif";_object.fillText(ctx,_object.Name,xText+Math.round(3*rPR),_y+Math.round(20*rPR)- Math.round(6*rPR),_object.CalculateNameRectNatural()*rPR);if(_object.IsNameAdvanced()&&!_object.IsNoUseButtons()){var nY=_y-.5*Math.round(rPR);nY+=Math.round(10*rPR);nY-=Math.round(rPR);var plus=AscCommon.AscBrowser.isCustomScalingAbove2()?.5*(rPR>>0):rPR>>0;ctx.lineWidth=Math.round(rPR);var nX=xText+widthName-(7*rPR>>0)>>0;for(var i=0;i<=2*rPR>>0;i+=plus)ctx.rect(nX+i,nY+i,Math.round(rPR),Math.round(rPR));for(var i=0;i<=2*rPR>>0;i+=plus)ctx.rect(nX+Math.round(4*rPR)-i,nY+i,Math.round(rPR),Math.round(rPR)); ctx.fill();ctx.beginPath()}}for(var nIndexB=0;nIndexB<_object.Buttons.length;nIndexB++){var isFill=false;if(_object.ActiveButtonIndex==nIndexB){ctx.fillStyle=AscCommon.GlobalSkin.ContentControlsActive;isFill=true}else if(_object.HoverButtonIndex==nIndexB){ctx.fillStyle=AscCommon.GlobalSkin.ContentControlsHover;isFill=true}if(isFill){ctx.rect(xText+widthName+20*nIndexB,_y,Math.round(20*rPR),Math.round(20*rPR));ctx.fill();ctx.beginPath()}var image=this.icons.getImage(_object.Buttons[nIndexB],nIndexB== _object.ActiveButtonIndex);if(image)ctx.drawImage(image,xText+widthName+rPR*20*nIndexB>>0,_y>>0,Math.round(20*rPR),Math.round(20*rPR))}_object.SetColor(ctx);ctx.beginPath();ctx.rect(_x,_y,widthHeader,Math.round(20*rPR));ctx.stroke();ctx.beginPath()}if(_object.ComboRect){_x=((_drawingPage.left+_koefX*(_object.ComboRect.X+_object.OffsetX))*rPR>>0)+.5*Math.round(rPR);_y=((_drawingPage.top+_koefY*(_object.ComboRect.Y+_object.OffsetY))*rPR>>0)+.5*Math.round(rPR);_b=((_drawingPage.top+_koefY*(_object.ComboRect.B+ _object.OffsetY))*rPR>>0)+.5*Math.round(rPR);var nIndexB=_object.Buttons.length;ctx.beginPath();ctx.rect(_x,_y,Math.round(20*rPR),_b-_y);overlay.CheckRect(_x,_y,Math.round(20*rPR),_b-_y);if(_object.ActiveButtonIndex==nIndexB)ctx.fillStyle=AscCommon.GlobalSkin.ContentControlsActive;else if(_object.HoverButtonIndex==nIndexB)ctx.fillStyle=AscCommon.GlobalSkin.ContentControlsHover;else ctx.fillStyle=AscCommon.GlobalSkin.ContentControlsBack;ctx.fill();ctx.stroke();ctx.beginPath();var image=this.icons.getImage(AscCommon.CCButtonType.Combo, _object.Buttons.length==_object.ActiveButtonIndex);if(image&&Math.round(7*rPR)<_b-_y)ctx.drawImage(image,_x+.5*Math.round(rPR),_y+1.5*Math.round(rPR)+(_b-_y-Math.round(20*rPR)>>1),Math.round(20*rPR),Math.round(20*rPR))}}else{var _ft=_object.transform.CreateDublicate();var coords=new AscCommon.CMatrix;coords.sx=_koefX*rPR;coords.sy=_koefY*rPR;coords.tx=_drawingPage.left*rPR;coords.ty=_drawingPage.top*rPR;global_MatrixTransformer.MultiplyAppend(_ft,coords);ctx.transform(_ft.sx,_ft.shy,_ft.shx,_ft.sy, _ft.tx,_ft.ty);var scaleX_15=15/_koefX;var scaleX_20=20/_koefX;var scaleY_20=20/_koefY;_x=_object.Pos.X-scaleX_15;_y=_object.Pos.Y;if(_object.Name!=""||0!=_object.Buttons.length){_x=_object.Pos.X;_y=_object.Pos.Y-scaleY_20}var widthName=0;if(_object.Name!="")widthName=_object.CalculateNameRect(_koefX,_koefY).W;var widthHeader=widthName+scaleX_20*_object.Buttons.length;var xText=_x;if(_object.IsUseMoveRect()){widthHeader+=scaleX_15;xText+=scaleX_15}if(widthHeader>.001){_r=_x+widthHeader;_b=_y+scaleY_20; var x1=_ft.TransformPointX(_x,_y);var y1=_ft.TransformPointY(_x,_y);var x2=_ft.TransformPointX(_r,_y);var y2=_ft.TransformPointY(_r,_y);var x3=_ft.TransformPointX(_r,_b);var y3=_ft.TransformPointY(_r,_b);var x4=_ft.TransformPointX(_x,_b);var y4=_ft.TransformPointY(_x,_b);x1=_drawingPage.left+_koefX*x1;x2=_drawingPage.left+_koefX*x2;x3=_drawingPage.left+_koefX*x3;x4=_drawingPage.left+_koefX*x4;y1=_drawingPage.top+_koefY*y1;y2=_drawingPage.top+_koefY*y2;y3=_drawingPage.top+_koefY*y3;y4=_drawingPage.top+ _koefY*y4;overlay.CheckPoint(x1,y1);overlay.CheckPoint(x2,y2);overlay.CheckPoint(x3,y3);overlay.CheckPoint(x4,y4);ctx.fillStyle=AscCommon.GlobalSkin.ContentControlsBack;ctx.rect(_x,_y,widthHeader,scaleY_20);ctx.fill();ctx.beginPath();if(_object.IsUseMoveRect()){ctx.rect(_x,_y,scaleX_15,scaleY_20);ctx.fillStyle=1==this.ContentControlObjectState?AscCommon.GlobalSkin.ContentControlsAnchorActive:AscCommon.GlobalSkin.ContentControlsBack;ctx.fill();ctx.beginPath();if(1==this.ContentControlObjectState){ctx.fillStyle= AscCommon.GlobalSkin.ContentControlsAnchorActive;ctx.rect(_x,_y,scaleX_15,scaleY_20);ctx.fill();ctx.beginPath()}var cx1=_x+5/_koefX;var cy1=_y+5/_koefY;var cx2=_x+10/_koefX;var cy2=_y+5/_koefY;var cx3=_x+5/_koefX;var cy3=_y+10/_koefY;var cx4=_x+10/_koefX;var cy4=_y+10/_koefY;var cx5=_x+5/_koefX;var cy5=_y+15/_koefY;var cx6=_x+10/_koefX;var cy6=_y+15/_koefY;var rad=1.5/_koefX;overlay.AddEllipse2(cx1,cy1,rad);overlay.AddEllipse2(cx2,cy2,rad);overlay.AddEllipse2(cx3,cy3,rad);overlay.AddEllipse2(cx4, cy4,rad);overlay.AddEllipse2(cx5,cy5,rad);overlay.AddEllipse2(cx6,cy6,rad);var _color1="#ADADAD";if(0==this.ContentControlObjectState||1==this.ContentControlObjectState)_color1="#444444";ctx.fillStyle=_color1;ctx.fill();ctx.beginPath()}if(_object.Name!=""){if(_object.ActiveButtonIndex==-1)ctx.fillStyle=AscCommon.GlobalSkin.ContentControlsActive;else if(_object.HoverButtonIndex==-1)ctx.fillStyle=AscCommon.GlobalSkin.ContentControlsHover;else ctx.fillStyle=AscCommon.GlobalSkin.ContentControlsBack;ctx.rect(_x+ (_object.IsNoUseButtons()?0:scaleX_15),_y,widthName,scaleY_20);ctx.fill();ctx.beginPath();ctx.fillStyle=_object.ActiveButtonIndex==-1?AscCommon.GlobalSkin.ContentControlsTextActive:AscCommon.GlobalSkin.ContentControlsText;ctx.font=this.getFont(_koefY);_object.fillText(ctx,_object.Name,xText+3/_koefX,_y+(20-6)/_koefY,_object.CalculateNameRectNatural()/_koefX);if(_object.IsNameAdvanced()&&!_object.IsNoUseButtons()){var nY=_y+9/_koefY;var nX=xText+widthName-6/_koefX;for(var i=0;i<3;i++)ctx.rect(_x+nX+ i/_koefX,nY+i/_koefY,1/_koefX,1/_koefY);for(var i=0;i<2;i++)ctx.rect(_x+nX+(4-i)/_koefX,nY+i/_koefY,1/_koefX,1/_koefY);ctx.fill();ctx.beginPath()}}for(var nIndexB=0;nIndexB<_object.Buttons.length;nIndexB++){var isFill=false;if(_object.ActiveButtonIndex==nIndexB){ctx.fillStyle=AscCommon.GlobalSkin.ContentControlsActive;isFill=true}else if(_object.HoverButtonIndex==nIndexB){ctx.fillStyle=AscCommon.GlobalSkin.ContentControlsHover;isFill=true}if(isFill){ctx.rect(xText+widthName+scaleX_20*nIndexB,_y,scaleX_20, scaleY_20);ctx.fill();ctx.beginPath()}var image=this.icons.getImage(_object.Buttons[nIndexB],nIndexB==_object.ActiveButtonIndex);if(image)ctx.drawImage(image,xText+widthName+scaleX_20*nIndexB,_y,scaleX_20,scaleY_20)}}if(_object.ComboRect){_x=_object.ComboRect.X;_y=_object.ComboRect.Y;_b=_object.ComboRect.B;var nIndexB=_object.Buttons.length;ctx.beginPath();ctx.rect(_x,_y,scaleX_20,_b-_y);overlay.CheckRect(_x,_y,scaleX_20,_b-_y);if(_object.ActiveButtonIndex==nIndexB)ctx.fillStyle=AscCommon.GlobalSkin.ContentControlsActive; else if(_object.HoverButtonIndex==nIndexB)ctx.fillStyle=AscCommon.GlobalSkin.ContentControlsHover;else ctx.fillStyle=AscCommon.GlobalSkin.ContentControlsBack;ctx.fill();ctx.lineWidth=1/_koefY;ctx.stroke();ctx.lineWidth=1;ctx.beginPath();var image=this.icons.getImage(AscCommon.CCButtonType.Combo,_object.Buttons.length==_object.ActiveButtonIndex);var scaleY_7=7/_koefY;if(image&&scaleY_7<_b-_y)ctx.drawImage(image,_x,_y+(_b-_y-scaleY_20)/2,scaleX_20,scaleY_20)}_object.SetColor(ctx);overlay.SetBaseTransform(); ctx.beginPath();ctx.moveTo(x1,y1);ctx.lineTo(x2,y2);ctx.lineTo(x3,y3);ctx.lineTo(x4,y4);ctx.closePath();ctx.stroke();ctx.beginPath()}}}this.ContentControlsSaveLast()};this.OnDrawContentControl=function(obj,state,geom){var isActiveRemove=false;for(var i=0;ithis.ContentControlSmallChangesCheck.Min||Math.abs(pos.Y-this.ContentControlSmallChangesCheck.Y)>this.ContentControlSmallChangesCheck.Min)this.ContentControlSmallChangesCheck.IsSmall=false};this.isInlineTrack=function(){return this.ContentControlObjectState==1?true:false};this.checkPointerInButtons= function(pos){for(var i=0;i.001&&xPos>rectMove.X&&xPosrectMove.Y&&yPos0){var indexButton=-1;var xCC,yCC;var x,y,w,h;if(_object.formInfo){w=20/koefX;h=20/koefY;x=_object.formInfo.bounds.x+(_object.formInfo.bounds.w-w)/2;y=_object.formInfo.bounds.y+ (_object.formInfo.bounds.h-h)/2;if(xPos>x&&xPosy&&yPosx&&xPosy&&yPosrectCombo.X&&xPosrectCombo.Y&&yPos.001&&xPos>rectMove.X&&xPosrectMove.Y&&yPosrectName.X&&xPosrectName.Y&&yPos0){var indexButton=-1;var xCC,yCC;var x, y,w,h;if(_object.formInfo){w=20/koefX;h=20/koefY;x=_object.formInfo.bounds.x+(_object.formInfo.bounds.w-w)/2;y=_object.formInfo.bounds.y+(_object.formInfo.bounds.h-h)/2;if(xPos>x&&xPosy&&yPosx&&xPosy&&yPosrectCombo.X&&xPosrectCombo.Y&&yPos.001&&xPos>rectMove.X&&xPosrectMove.Y&&yPosrectName.X&&xPosrectName.Y&&yPos0&&isWithoutCoords!==true){var indexButton=-1;var x,y,w,h;if(_object.formInfo){w=20/koefX;h=20/koefY;x=_object.formInfo.bounds.x+(_object.formInfo.bounds.w-w)/2;y=_object.formInfo.bounds.y+(_object.formInfo.bounds.h-h)/2;if(xPos>x&&xPosy&&yPosx&&xPosy&&yPosrectCombo.X&&xPosrectCombo.Y&&yPos=this.points.length)return index- this.points.length;return index};CPolygonCC.prototype.widePoint=function(point,x,y){if(x!==0)point.x+=x===1?this.wideOutlineX:-this.wideOutlineX;if(y!==0)point.y+=y===1?this.wideOutlineY:-this.wideOutlineY};CPolygonCC.prototype.wideRects=function(){if(this.rectMove){this.rectMove.x-=this.wideOutlineX;this.rectMove.y-=this.wideOutlineY;this.rectMove.w+=this.wideOutlineX;this.rectMove.h+=this.wideOutlineY}if(this.rectCombo){this.rectCombo.w+=this.wideOutlineX;this.rectCombo.h+=this.wideOutlineY}};CPolygonCC.prototype.init= function(object,koef,indexPath,countPaths){switch(object.type){case Asc.c_oAscContentControlSpecificType.ComboBox:case Asc.c_oAscContentControlSpecificType.DropDownList:case Asc.c_oAscContentControlSpecificType.DateTime:{this.isCombobox=true;break}case Asc.c_oAscContentControlSpecificType.Picture:{this.isImage=true;break}default:break}if(object.parent.document.m_oWordControl.m_oApi.isViewMode){this.isUseMoveRect=false;this.isCombobox=false}else if(object.parent.document.m_oLogicDocument&&object.parent.document.m_oLogicDocument.IsFillingFormMode())this.isUseMoveRect= false;if(object.isFixedForm)this.isUseMoveRect=false;if(object.state===AscCommon.ContentControlTrack.In)this.isActive=true;if(!this.isActive){this.isUseMoveRect=false;this.isCombobox=false}if(0!==indexPath)this.isUseMoveRect=false;if(indexPath!==countPaths-1)this.isCombobox=false;this.roundSizePx=this.isActive?AscCommon.GlobalSkin.FormsContentControlsOutlineBorderRadiusActive:AscCommon.GlobalSkin.FormsContentControlsOutlineBorderRadiusHover;this.rectMoveWidth=this.rectMoveWidthPx/koef;this.rectComboWidth= this.rectComboWidthPx/koef;this.roundSize=this.roundSizePx/koef;if(!object.transform)this.wideOutlineY=1/koef;this.koef=koef};CPolygonCC.prototype.moveTo=function(x,y){if(this.points.length>0)this.points=[];this.indexMin=0;this.indexMax=0;this.points.push(new CPointCC(x,y))};CPolygonCC.prototype.lineTo=function(x,y){if(this.points.length==0){this.moveTo(x,y);return}var lastPoint=this.points[this.points.length-1];var isEqualX=isEqualFloat(lastPoint.x,x);var isEqualY=isEqualFloat(lastPoint.y,y);if(isEqualX&& isEqualY)return;var firstPoint=this.points[0];if(isEqualFloat(firstPoint.x,x)&&isEqualFloat(firstPoint.y,y))return;var newPoint=new CPointCC(x,y);var pointCheck=this.points[this.indexMin];if(isEqualFloat(pointCheck.y,newPoint.y))if(pointCheck.x>newPoint.x)this.indexMin=this.points.length;if(pointCheck.y>newPoint.y)this.indexMin=this.points.length;pointCheck=this.points[this.indexMax];if(isEqualFloat(pointCheck.y,newPoint.y))if(pointCheck.xyMax)yMax=this.points[indexMinFriend].y;if(this.isImage){var yMaxLimit=minPoint.y+this.rectMoveImageMaxH/this.koef;if(yMax>yMaxLimit){var x1=this.points[indexMinFriend].x; var x2=this.points[indexMinFriend].x+this.rectMoveWidth;this.points[indexMinFriend].x+=this.rectMoveWidth;this.points.splice(indexMinFriend,0,new CPointCC(x1,yMaxLimit));this.points.splice(indexMinFriend+1,0,new CPointCC(x2,yMaxLimit));yMax=yMaxLimit;break}}indexMinFriend=this.nextIndex(indexMinFriend,direction===1)}minPoint.x-=this.rectMoveWidth;this.rectMove={x:minPoint.x,y:minPoint.y,w:this.rectMoveWidth,h:yMax-minPoint.y}}if(this.isCombobox){direction=-1;var indexMaxFriend=this.nextIndex(this.indexMax); if(isEqualFloat(maxPoint.x,this.points[indexMaxFriend].x))direction=1;var indexMaxFriend=this.nextIndex(this.indexMax,direction===1);var yMin=maxPoint.y;while(isEqualFloat(this.points[indexMaxFriend].x,maxPoint.x)){this.points[indexMaxFriend].x+=this.rectComboWidth;if(this.points[indexMaxFriend].y1&&null===this.rectMove&&null===this.rectCombo)countIteration=1;while(true){++currentIteration;if(currentIteration===countIteration){var _x1,_x2, _y1,_y2,_x3,_y3,_x4,_y4;var lineH=koefY*object.base.GetBoundingPolygonFirstLineH();if(this.rectMove){if(this.isImage)lineH=koefY*this.rectMove.h;_x1=(drPage.left+koefX*(this.rectMove.x+object.OffsetX))*rPR>>0;_y1=(drPage.top+koefY*(this.rectMove.y+object.OffsetY))*rPR>>0;_x2=(drPage.left+koefX*(this.rectMove.x+this.rectMove.w+object.OffsetX))*rPR>>0;_y2=_y1;_x3=_x2;_y3=(drPage.top+koefY*(this.rectMove.y+this.rectMove.h+object.OffsetY))*rPR>>0;_x4=_x1;_y4=_y3;ctx.moveTo(_x1,_y1);ctx.lineTo(_x2,_y2); ctx.lineTo(_x3,_y3);ctx.lineTo(_x4,_y4);ctx.closePath();ctx.fill();ctx.beginPath();var yCenterPos=(_y1+.5*lineH*rPR>>0)+indent;var xCenter=_x1+this.rectMoveWidthPx/2*rPR;var wCenter=this.rectMoveWidthPx*rPR/3+Math.round(rPR)>>0;xCenter-=wCenter/2;xCenter=xCenter>>0;xCenter+=Math.round(rPR);if(!this.isActive)ctx.strokeStyle=AscCommon.GlobalSkin.FormsContentControlsOutlineHover;else switch(object.parent.ContentControlObjectState){case 0:ctx.strokeStyle=AscCommon.GlobalSkin.FormsContentControlsOutlineMoverHover; break;case 1:ctx.strokeStyle=AscCommon.GlobalSkin.FormsContentControlsOutlineMoverActive;break;default:ctx.strokeStyle=AscCommon.GlobalSkin.FormsContentControlsOutlineActive;break}ctx.moveTo(xCenter,yCenterPos);ctx.lineTo(xCenter+wCenter,yCenterPos);ctx.moveTo(xCenter,yCenterPos-Math.round(2*rPR));ctx.lineTo(xCenter+wCenter,yCenterPos-Math.round(2*rPR));ctx.moveTo(xCenter,yCenterPos+Math.round(2*rPR));ctx.lineTo(xCenter+wCenter,yCenterPos+Math.round(2*rPR));ctx.lineWidth=Math.round(rPR);ctx.stroke(); ctx.beginPath()}if(this.rectCombo){_x1=(drPage.left+koefX*(this.rectCombo.x+object.OffsetX))*rPR>>0;_y1=(drPage.top+koefY*(this.rectCombo.y+object.OffsetY))*rPR>>0;_x2=(drPage.left+koefX*(this.rectCombo.x+this.rectCombo.w+object.OffsetX))*rPR>>0;_y2=_y1;_x3=_x2;_y3=(drPage.top+koefY*(this.rectCombo.y+this.rectCombo.h+object.OffsetY))*rPR>>0;_x4=_x1;_y4=_y3;ctx.moveTo(_x1,_y1);ctx.lineTo(_x2,_y2);ctx.lineTo(_x3,_y3);ctx.lineTo(_x4,_y4);ctx.closePath();var indexButton=object.Buttons.length;if(object.ActiveButtonIndex=== indexButton)ctx.fillStyle=AscCommon.GlobalSkin.FormsContentControlsMarkersBackgroundActive;else if(object.HoverButtonIndex===indexButton)ctx.fillStyle=AscCommon.GlobalSkin.FormsContentControlsMarkersBackgroundHover;else ctx.fillStyle=AscCommon.GlobalSkin.FormsContentControlsMarkersBackground;ctx.fill();ctx.beginPath();var image=icons.getImage(AscCommon.CCButtonType.Combo,false);if(image){var canvas=document.createElement("canvas"),context=canvas.getContext("2d");var len=Math.floor(9*rPR);var width= Math.round(18*rPR),height=Math.round(18*rPR);if(0==(len&1))len+=1;var countPart=len+1>>1,_data,px,_x=width-len>>1,_y=height-2*countPart,r,g,b;r=0;g=0;b=0;_data=context.createImageData(width,height);px=_data.data;while(len>0){var ind=4*(width*_y+_x);for(var i=0;i>0;g=g>>0;b=b>>0;_x+=1;_y+=1;len-=2}var yPos=_y4-height-.5*(lineH*rPR-height)>>0;var xPos=_x1+(.5*(this.rectComboWidthPx*rPR-width)>>0)+Math.round(rPR);context.putImageData(_data, 0,0);ctx.drawImage(canvas,xPos,yPos)}}if(this.isImage){_x1=(drPage.left+koefX*(this.bounds.x+object.OffsetX))*rPR;_y1=(drPage.top+koefY*(this.bounds.y+object.OffsetY))*rPR;_x4=(drPage.left+koefX*(this.bounds.x+this.bounds.w+object.OffsetX))*rPR;_y4=(drPage.top+koefY*(this.bounds.y+this.bounds.h+object.OffsetY))*rPR;var imageW=AscCommon.AscBrowser.convertToRetinaValue(20,true);var imageH=AscCommon.AscBrowser.convertToRetinaValue(20,true);var xPos=_x1+_x4-imageW>>1;var yPos=_y1+_y4-imageH>>1;var isFill= false;if(object.ActiveButtonIndex===0){ctx.fillStyle=AscCommon.GlobalSkin.ContentControlsActive;isFill=true}else if(object.HoverButtonIndex===0){ctx.fillStyle=AscCommon.GlobalSkin.ContentControlsHover;isFill=true}if(isFill){ctx.rect(xPos,yPos,imageW,imageH);ctx.fill();ctx.beginPath()}var image=icons.getImage(AscCommon.CCButtonType.Image,0===object.ActiveButtonIndex);if(image)ctx.drawImage(image,xPos,yPos,imageW,imageH)}if(2===currentIteration)ctx.restore()}for(var i=0;i>0)+.5*Math.round(rPR);_y=(_y>>0)+.5*Math.round(rPR);if(point.round!==PointRound.True)if(0===i)ctx.moveTo(_x,_y);else ctx.lineTo(_x,_y);else{var x1,y1,x2,y2,xCP,yCP;var isX=true;switch(point.inDir){case PointDirection.Left:{x1=_x+this.roundSizePx;y1=_y;break}case PointDirection.Right:{x1=_x-this.roundSizePx;y1=_y;break}case PointDirection.Up:{x1=_x;y1=_y+this.roundSizePx; isX=false;break}case PointDirection.Down:{x1=_x;y1=_y-this.roundSizePx;isX=false;break}default:break}switch(point.outDir){case PointDirection.Left:{x2=_x-this.roundSizePx;y2=_y;break}case PointDirection.Right:{x2=_x+this.roundSizePx;y2=_y;break}case PointDirection.Up:{x2=_x;y2=_y-this.roundSizePx;break}case PointDirection.Down:{x2=_x;y2=_y+this.roundSizePx;break}default:break}if(isX){xCP=x1+(x2-x1)*const_rad;yCP=y1+(y2-y1)*(1-const_rad)}else{xCP=x1+(x2-x1)*(1-const_rad);yCP=y1+(y2-y1)*const_rad}if(0=== i)ctx.moveTo(x1,y1);else ctx.lineTo(x1,y1);ctx.quadraticCurveTo(xCP,yCP,x2,y2)}}ctx.closePath();if(currentIteration===countIteration){if(!this.isActive)ctx.strokeStyle=AscCommon.GlobalSkin.FormsContentControlsOutlineHover;else ctx.strokeStyle=AscCommon.GlobalSkin.FormsContentControlsOutlineActive;ctx.lineWidth=Math.round(rPR);ctx.stroke();ctx.beginPath();break}else{ctx.save();ctx.clip();ctx.fillStyle=AscCommon.GlobalSkin.FormsContentControlsMarkersBackground;ctx.beginPath()}}}else{var point;var _x, _y;var countIteration=0===this.roundSizePx?1:2;var currentIteration=0;if(countIteration>1&&null===this.rectMove&&null===this.rectCombo)countIteration=1;var matrix=object.transform;var coordMatrix=new AscCommon.CMatrix;coordMatrix.sx=koefX*rPR;coordMatrix.sy=koefY*rPR;coordMatrix.tx=drPage.left*rPR;coordMatrix.ty=drPage.top*rPR;AscCommon.global_MatrixTransformer.MultiplyPrepend(coordMatrix,matrix);while(true){++currentIteration;if(currentIteration===countIteration){ctx.transform(coordMatrix.sx,coordMatrix.shy, coordMatrix.shx,coordMatrix.sy,coordMatrix.tx,coordMatrix.ty);var lineH=object.base.GetBoundingPolygonFirstLineH();if(this.rectMove){if(this.isImage)lineH=this.rectMove.h;ctx.moveTo(this.rectMove.x,this.rectMove.y);ctx.lineTo(this.rectMove.x+this.rectMove.w,this.rectMove.y);ctx.lineTo(this.rectMove.x+this.rectMove.w,this.rectMove.y+this.rectMove.h);ctx.lineTo(this.rectMove.x,this.rectMove.y+this.rectMove.h);ctx.closePath();ctx.fill();ctx.beginPath();var xLine=this.rectMove.x+this.rectMove.w/3;var wLine= this.rectMove.w/3;var yLine=this.rectMove.y+.5*lineH;var hLine=2/koefY;if(!this.isActive)ctx.strokeStyle=AscCommon.GlobalSkin.FormsContentControlsOutlineHover;else switch(object.parent.ContentControlObjectState){case 0:ctx.strokeStyle=AscCommon.GlobalSkin.FormsContentControlsOutlineMoverHover;break;case 1:ctx.strokeStyle=AscCommon.GlobalSkin.FormsContentControlsOutlineMoverActive;break;default:ctx.strokeStyle=AscCommon.GlobalSkin.FormsContentControlsOutlineActive;break}ctx.moveTo(xLine,yLine-hLine); ctx.lineTo(xLine+wLine,yLine-hLine);ctx.moveTo(xLine,yLine);ctx.lineTo(xLine+wLine,yLine);ctx.moveTo(xLine,yLine+hLine);ctx.lineTo(xLine+wLine,yLine+hLine);ctx.lineWidth=1/koefY;ctx.stroke();ctx.beginPath()}if(this.rectCombo){ctx.moveTo(this.rectCombo.x,this.rectCombo.y);ctx.lineTo(this.rectCombo.x+this.rectCombo.w,this.rectCombo.y);ctx.lineTo(this.rectCombo.x+this.rectCombo.w,this.rectCombo.y+this.rectCombo.h);ctx.lineTo(this.rectCombo.x,this.rectCombo.y+this.rectCombo.h);ctx.closePath();var indexButton= object.Buttons.length;if(object.ActiveButtonIndex===indexButton)ctx.fillStyle=AscCommon.GlobalSkin.FormsContentControlsMarkersBackgroundActive;else if(object.HoverButtonIndex===indexButton)ctx.fillStyle=AscCommon.GlobalSkin.FormsContentControlsMarkersBackgroundHover;else ctx.fillStyle=AscCommon.GlobalSkin.FormsContentControlsMarkersBackground;ctx.fill();ctx.beginPath();var image=icons.getImage(AscCommon.CCButtonType.Combo,false);if(image){var imageW=20/koefX;var imageH=20/koefY;var yPos=this.rectCombo.y+ this.rectCombo.h-imageH-.5*(lineH-imageH);var xPos=this.rectCombo.x+.5*(this.rectCombo.w-imageW);ctx.drawImage(image,xPos,yPos,imageW,imageH)}}if(this.isImage){var imageW=20/koefX;var imageH=20/koefY;var xPos=this.bounds.x+(this.bounds.w-imageW)/2;var yPos=this.bounds.y+(this.bounds.h-imageH)/2;var isFill=false;if(object.ActiveButtonIndex===0){ctx.fillStyle=AscCommon.GlobalSkin.ContentControlsActive;isFill=true}else if(object.HoverButtonIndex===0){ctx.fillStyle=AscCommon.GlobalSkin.ContentControlsHover; isFill=true}if(isFill){ctx.rect(xPos,yPos,imageW,imageH);ctx.fill();ctx.beginPath()}var image=icons.getImage(AscCommon.CCButtonType.Image,0===object.ActiveButtonIndex);if(image)ctx.drawImage(image,xPos,yPos,imageW,imageH)}overlay.SetBaseTransform();if(2===currentIteration)ctx.restore()}for(var i=0;i=_pagesCount)return _bounds;var _boundsTmp=this.TableOutline.Table.Get_PageBounds(_pagesCount-1);_bounds.Page=this.TableOutline.Table.Get_AbsolutePage(_pagesCount-1);_bounds.X=_boundsTmp.Left;_bounds.Y=_boundsTmp.Top;_bounds.W=_boundsTmp.Right-_boundsTmp.Left;_bounds.H=_boundsTmp.Bottom-_boundsTmp.Top;return _bounds};this.getFullHeight=function(){var _height=0;if(!this.TableOutline||!this.TableOutline.Table)return _height; var _pagesCount=this.TableOutline.Table.GetPagesCount();var _boundsTmp;for(var i=0;i<_pagesCount;i++){_boundsTmp=this.TableOutline.Table.Get_PageBounds(i);_height+=_boundsTmp.Bottom-_boundsTmp.Top}return _height};this.getFullTopPosition=function(_lastBounds){if(_lastBounds.Page==this.TableOutline.PageNum)return this.TableOutline.Y;var _height=this.getFullHeight();var _top=_lastBounds.Y+_lastBounds.H-_height;if(_top<0)_top=0;return _top};this.checkMouseDown=function(pos,word_control){if(null==this.TableOutline)return false; var _table_track=this.TableOutline;var _d=13*g_dKoef_pix_to_mm*100/word_control.m_nZoomValue;this.IsChangeSmall=true;this.ChangeSmallPoint=pos;this.CurPos={X:this.ChangeSmallPoint.X,Y:this.ChangeSmallPoint.Y,Page:this.ChangeSmallPoint.Page};this.TrackOffsetX=0;this.TrackOffsetY=0;if(!this.TableMatrix||global_MatrixTransformer.IsIdentity(this.TableMatrix)){if(word_control.MobileTouchManager){var _move_point=word_control.MobileTouchManager.TableMovePoint;if(_move_point==null||pos.Page!=_table_track.PageNum)return false; var _pos1=word_control.m_oDrawingDocument.ConvertCoordsToCursorWR(pos.X,pos.Y,pos.Page);var _pos2=word_control.m_oDrawingDocument.ConvertCoordsToCursorWR(_move_point.X,_move_point.Y,pos.Page);var _eps=word_control.MobileTouchManager.TrackTargetEps;var _offset1=word_control.MobileTouchManager.TableRulersRectOffset;var _offset2=_offset1+word_control.MobileTouchManager.TableRulersRectSize;if(_pos1.X>=_pos2.X-_offset2-_eps&&_pos1.X<=_pos2.X-_offset1+_eps&&_pos1.Y>=_pos2.Y-_offset2-_eps&&_pos1.Y<=_pos2.Y- _offset1+_eps){this.TrackTablePos=0;return true}return false}switch(this.TrackTablePos){case 1:{var _x=_table_track.X+_table_track.W;var _b=_table_track.Y;var _y=_b-_d;var _r=_x+_d;if(pos.X>_x&&pos.X<_r&&pos.Y>_y&&pos.Y<_b){this.TrackOffsetX=pos.X-_x;this.TrackOffsetY=pos.Y-_b;this.CurPos.X-=this.TrackOffsetX;this.CurPos.Y-=this.TrackOffsetY;return true}break}case 2:{var _x=_table_track.X+_table_track.W;var _y=_table_track.Y+_table_track.H;var _r=_x+_d;var _b=_y+_d;if(pos.X>_x&&pos.X<_r&&pos.Y>_y&& pos.Y<_b){this.TrackOffsetX=pos.X-_x;this.TrackOffsetY=pos.Y-_y;return true}break}case 3:{var _r=_table_track.X;var _x=_r-_d;var _y=_table_track.Y+_table_track.H;var _b=_y+_d;if(pos.X>_x&&pos.X<_r&&pos.Y>_y&&pos.Y<_b){this.TrackOffsetX=pos.X-_r;this.TrackOffsetY=pos.Y-_y;this.CurPos.X-=this.TrackOffsetX;this.CurPos.Y-=this.TrackOffsetY;return true}break}case 0:default:{var _r=_table_track.X;var _b=_table_track.Y;var _x=_r-_d;var _y=_b-_d;if(pos.X>_x&&pos.X<_r&&pos.Y>_y&&pos.Y<_b){this.TrackOffsetX= pos.X-_r;this.TrackOffsetY=pos.Y-_b;this.CurPos.X-=this.TrackOffsetX;this.CurPos.Y-=this.TrackOffsetY;return true}break}}if(true){var _lastBounds=this.getLastPageBounds();var _x=_lastBounds.X+_lastBounds.W;var _y=_lastBounds.Y+_lastBounds.H;_d=6*g_dKoef_pix_to_mm*100/word_control.m_nZoomValue;var _r=_x+_d;var _b=_y+_d;if(_lastBounds.Page==pos.Page&&pos.X>_x&&pos.X<_r&&pos.Y>_y&&pos.Y<_b){this.TrackOffsetX=pos.X-_x;this.TrackOffsetY=pos.Y-_y;this.CurPos.X=global_mouseEvent.X;this.CurPos.Y=global_mouseEvent.Y; this.AddResizeCurrentW=0;this.AddResizeCurrentH=0;this.IsResizeTableTrack=true;var _table=this.TableOutline.Table;if(_lastBounds.Page==this.PageNum){this.AddResizeMinH=_table.GetMinHeight()-this.TableOutline.H;this.AddResizeMinW=_table.GetMinWidth()-this.TableOutline.W}else{var _fullTop=this.getFullTopPosition(_lastBounds);if(0==_fullTop)this.AddResizeMinH=_fullTop-(_lastBounds.Y+_lastBounds.H);else this.AddResizeMinH=_fullTop+_table.GetMinHeight()-(_lastBounds.Y+_lastBounds.H);this.AddResizeMinW= _table.GetMinWidth()-_lastBounds.W}word_control.m_oDrawingDocument.LockCursorType("se-resize");return true}}return false}else{if(word_control.MobileTouchManager){var _invert=global_MatrixTransformer.Invert(this.TableMatrix);var _posx=_invert.TransformPointX(pos.X,pos.Y);var _posy=_invert.TransformPointY(pos.X,pos.Y);var _move_point=word_control.MobileTouchManager.TableMovePoint;if(_move_point==null||pos.Page!=_table_track.PageNum)return false;var _koef=g_dKoef_pix_to_mm*100/word_control.m_nZoomValue; var _eps=word_control.MobileTouchManager.TrackTargetEps*_koef;var _offset1=word_control.MobileTouchManager.TableRulersRectOffset*_koef;var _offset2=_offset1+word_control.MobileTouchManager.TableRulersRectSize*_koef;if(_posx>=_move_point.X-_offset2-_eps&&_posx<=_move_point.X-_offset1+_eps&&_posy>=_move_point.Y-_offset2-_eps&&_posy<=_move_point.Y-_offset1+_eps){this.TrackTablePos=0;return true}return false}var _invert=global_MatrixTransformer.Invert(this.TableMatrix);var _posx=_invert.TransformPointX(pos.X, pos.Y);var _posy=_invert.TransformPointY(pos.X,pos.Y);switch(this.TrackTablePos){case 1:{var _x=_table_track.X+_table_track.W;var _b=_table_track.Y;var _y=_b-_d;var _r=_x+_d;if(_posx>_x&&_posx<_r&&_posy>_y&&_posy<_b){this.TrackOffsetX=_posx-_x;this.TrackOffsetY=_posy-_b;this.CurPos.X-=this.TrackOffsetX;this.CurPos.Y-=this.TrackOffsetY;return true}break}case 2:{var _x=_table_track.X+_table_track.W;var _y=_table_track.Y+_table_track.H;var _r=_x+_d;var _b=_y+_d;if(_posx>_x&&_posx<_r&&_posy>_y&&_posy< _b){this.TrackOffsetX=_posx-_x;this.TrackOffsetY=_posy-_y;this.CurPos.X-=this.TrackOffsetX;this.CurPos.Y-=this.TrackOffsetY;return true}break}case 3:{var _r=_table_track.X;var _x=_r-_d;var _y=_table_track.Y+_table_track.H;var _b=_y+_d;if(_posx>_x&&_posx<_r&&_posy>_y&&_posy<_b){this.TrackOffsetX=_posx-_r;this.TrackOffsetY=_posy-_y;this.CurPos.X-=this.TrackOffsetX;this.CurPos.Y-=this.TrackOffsetY;return true}break}case 0:default:{var _r=_table_track.X;var _b=_table_track.Y;var _x=_r-_d;var _y=_b-_d; if(_posx>_x&&_posx<_r&&_posy>_y&&_posy<_b){this.TrackOffsetX=_posx-_r;this.TrackOffsetY=_posy-_b;this.CurPos.X-=this.TrackOffsetX;this.CurPos.Y-=this.TrackOffsetY;return true}break}}if(true){var _lastBounds=this.getLastPageBounds();var _x=_lastBounds.X+_lastBounds.W;var _y=_lastBounds.Y+_lastBounds.H;_d=6*g_dKoef_pix_to_mm*100/word_control.m_nZoomValue;var _r=_x+_d;var _b=_y+_d;if(_posx>_x&&_posx<_r&&_posy>_y&&_posy<_b){this.TrackOffsetX=_posx-_x;this.TrackOffsetY=_posy-_b;this.CurPos.X=global_mouseEvent.X; this.CurPos.Y=global_mouseEvent.Y;this.AddResizeCurrentW=0;this.AddResizeCurrentH=0;this.IsResizeTableTrack=true;word_control.m_oDrawingDocument.LockCursorType("se-resize");return true}}return false}return false};this.checkMouseMoveTrack=function(pos,word_control){if(null==this.TableOutline)return false;var _table_track=this.TableOutline;var _d=13*g_dKoef_pix_to_mm*100/word_control.m_nZoomValue;var _x,_y,_r,_b;if(!this.TableMatrix||global_MatrixTransformer.IsIdentity(this.TableMatrix))switch(this.TrackTablePos){case 1:{_x= _table_track.X+_table_track.W;_b=_table_track.Y;_y=_b-_d;_r=_x+_d;if(pos.X>_x&&pos.X<_r&&pos.Y>_y&&pos.Y<_b)return true;break}case 2:{_x=_table_track.X+_table_track.W;_y=_table_track.Y+_table_track.H;_r=_x+_d;_b=_y+_d;if(pos.X>_x&&pos.X<_r&&pos.Y>_y&&pos.Y<_b)return true;break}case 3:{_r=_table_track.X;_x=_r-_d;_y=_table_track.Y+_table_track.H;_b=_y+_d;if(pos.X>_x&&pos.X<_r&&pos.Y>_y&&pos.Y<_b)return true;break}case 0:default:{_r=_table_track.X;_b=_table_track.Y;_x=_r-_d;_y=_b-_d;if(pos.X>_x&&pos.X< _r&&pos.Y>_y&&pos.Y<_b)return true;break}}else{var _invert=global_MatrixTransformer.Invert(this.TableMatrix);var _posx=_invert.TransformPointX(pos.X,pos.Y);var _posy=_invert.TransformPointY(pos.X,pos.Y);switch(this.TrackTablePos){case 1:{_x=_table_track.X+_table_track.W;_b=_table_track.Y;_y=_b-_d;_r=_x+_d;if(_posx>_x&&_posx<_r&&_posy>_y&&_posy<_b)return true;break}case 2:{_x=_table_track.X+_table_track.W;_y=_table_track.Y+_table_track.H;_r=_x+_d;_b=_y+_d;if(_posx>_x&&_posx<_r&&_posy>_y&&_posy<_b)return true; break}case 3:{_r=_table_track.X;_x=_r-_d;_y=_table_track.Y+_table_track.H;_b=_y+_d;if(_posx>_x&&_posx<_r&&_posy>_y&&_posy<_b)return true;break}case 0:default:{_r=_table_track.X;_b=_table_track.Y;_x=_r-_d;_y=_b-_d;if(_posx>_x&&_posx<_r&&_posy>_y&&_posy<_b)return true;break}}}return false};this.checkMouseUp=function(X,Y,word_control){this.bIsTracked=false;if(null==this.TableOutline||true===this.IsChangeSmall||word_control.m_oApi.isViewMode)return false;var _koef=g_dKoef_pix_to_mm*100/word_control.m_nZoomValue; var _d=13*_koef;var _outline=this.TableOutline;var _table=_outline.Table;_table.MoveCursorToStartPos();_table.Document_SetThisElementCurrent(true);if(this.IsResizeTableTrack){var _addW=(X-this.CurPos.X)*_koef-this.TrackOffsetX;var _addH=(Y-this.CurPos.Y)*_koef-this.TrackOffsetY;_table.ResizeTableInDocument(this.TableOutline.W+_addW,this.TableOutline.H+_addH);this.AddResizeCurrentW=0;this.AddResizeCurrentH=0;this.IsResizeTableTrack=false;word_control.m_oDrawingDocument.UnlockCursorType();word_control.m_oDrawingDocument.SetCursorType("default"); return}if(!_table.Is_Inline()){var pos;switch(this.TrackTablePos){case 1:{var _w_pix=this.TableOutline.W*g_dKoef_mm_to_pix*word_control.m_nZoomValue/100;pos=word_control.m_oDrawingDocument.ConvertCoordsFromCursor2(X-_w_pix,Y);break}case 2:{var _w_pix=this.TableOutline.W*g_dKoef_mm_to_pix*word_control.m_nZoomValue/100;var _h_pix=this.TableOutline.H*g_dKoef_mm_to_pix*word_control.m_nZoomValue/100;pos=word_control.m_oDrawingDocument.ConvertCoordsFromCursor2(X-_w_pix,Y-_h_pix);break}case 3:{var _h_pix= this.TableOutline.H*g_dKoef_mm_to_pix*word_control.m_nZoomValue/100;pos=word_control.m_oDrawingDocument.ConvertCoordsFromCursor2(X,Y-_h_pix);break}case 0:default:{pos=word_control.m_oDrawingDocument.ConvertCoordsFromCursor2(X,Y);break}}var NearestPos=word_control.m_oLogicDocument.Get_NearestPos(pos.Page,pos.X-this.TrackOffsetX,pos.Y-this.TrackOffsetY);_table.Move(pos.X-this.TrackOffsetX,pos.Y-this.TrackOffsetY,pos.Page,NearestPos);_outline.X=pos.X-this.TrackOffsetX;_outline.Y=pos.Y-this.TrackOffsetY; _outline.PageNum=pos.Page}else if(null!=this.InlinePos)_table.Move(this.InlinePos.X,this.InlinePos.Y,this.InlinePos.Page,this.InlinePos)};this.checkMouseMove=function(X,Y,word_control){if(null==this.TableOutline)return false;if(true===this.IsChangeSmall){var _pos=word_control.m_oDrawingDocument.ConvertCoordsFromCursor2(X,Y);var _dist=15*g_dKoef_pix_to_mm*100/word_control.m_nZoomValue;if(Math.abs(_pos.X-this.ChangeSmallPoint.X)<_dist&&Math.abs(_pos.Y-this.ChangeSmallPoint.Y)<_dist&&_pos.Page==this.ChangeSmallPoint.Page){if(this.IsResizeTableTrack)return; this.CurPos={X:this.ChangeSmallPoint.X,Y:this.ChangeSmallPoint.Y,Page:this.ChangeSmallPoint.Page};switch(this.TrackTablePos){case 1:{this.CurPos.X-=this.TableOutline.W;break}case 2:{this.CurPos.X-=this.TableOutline.W;this.CurPos.Y-=this.TableOutline.H;break}case 3:{this.CurPos.Y-=this.TableOutline.H;break}case 0:default:{break}}this.CurPos.X-=this.TrackOffsetX;this.CurPos.Y-=this.TrackOffsetY;return}this.IsChangeSmall=false;this.TableOutline.Table.RemoveSelection();this.TableOutline.Table.MoveCursorToStartPos(); word_control.m_oLogicDocument.Document_UpdateSelectionState()}if(this.IsResizeTableTrack){var _koef=g_dKoef_pix_to_mm*100/word_control.m_nZoomValue;this.AddResizeCurrentW=Math.max(this.AddResizeMinW,(X-this.CurPos.X)*_koef-this.TrackOffsetX);this.AddResizeCurrentH=Math.max(this.AddResizeMinH,(Y-this.CurPos.Y)*_koef-this.TrackOffsetY);return true}var _d=13*g_dKoef_pix_to_mm*100/word_control.m_nZoomValue;switch(this.TrackTablePos){case 1:{var _w_pix=this.TableOutline.W*g_dKoef_mm_to_pix*word_control.m_nZoomValue/ 100;this.CurPos=word_control.m_oDrawingDocument.ConvertCoordsFromCursor2(X-_w_pix,Y);break}case 2:{var _w_pix=this.TableOutline.W*g_dKoef_mm_to_pix*word_control.m_nZoomValue/100;var _h_pix=this.TableOutline.H*g_dKoef_mm_to_pix*word_control.m_nZoomValue/100;this.CurPos=word_control.m_oDrawingDocument.ConvertCoordsFromCursor2(X-_w_pix,Y-_h_pix);break}case 3:{var _h_pix=this.TableOutline.H*g_dKoef_mm_to_pix*word_control.m_nZoomValue/100;this.CurPos=word_control.m_oDrawingDocument.ConvertCoordsFromCursor2(X, Y-_h_pix);break}case 0:default:{this.CurPos=word_control.m_oDrawingDocument.ConvertCoordsFromCursor2(X,Y);break}}this.CurPos.X-=this.TrackOffsetX;this.CurPos.Y-=this.TrackOffsetY};this.checkMouseMove2=function(X,Y,word_control){if(null==this.TableOutline)return;if(word_control.MobileTouchManager)return;var _table_track=this.TableOutline;var pos=null;if(word_control.m_oDrawingDocument.AutoShapesTrackLockPageNum==-1)pos=word_control.m_oDrawingDocument.ConvertCoordsFromCursor2(global_mouseEvent.X,global_mouseEvent.Y); else pos=word_control.m_oDrawingDocument.ConvetToPageCoords(global_mouseEvent.X,global_mouseEvent.Y,word_control.m_oDrawingDocument.AutoShapesTrackLockPageNum);var _lastBounds=word_control.m_oDrawingDocument.TableOutlineDr.getLastPageBounds();if(_lastBounds.Page!=pos.Page)return false;if(!this.TableMatrix||global_MatrixTransformer.IsIdentity(this.TableMatrix)){var _x=_lastBounds.X+_lastBounds.W;var _y=_lastBounds.Y+_lastBounds.H;var _d=6*g_dKoef_pix_to_mm*100/word_control.m_nZoomValue;var _r=_x+_d; var _b=_y+_d;if(pos.X>_x&&pos.X<_r&&pos.Y>_y&&pos.Y<_b){word_control.m_oDrawingDocument.SetCursorType("se-resize");return true}}else{var _invert=global_MatrixTransformer.Invert(this.TableMatrix);var _posx=_invert.TransformPointX(pos.X,pos.Y);var _posy=_invert.TransformPointY(pos.X,pos.Y);var _x=_lastBounds.X+_lastBounds.W;var _y=_lastBounds.Y+_lastBounds.H;_d=6*g_dKoef_pix_to_mm*100/word_control.m_nZoomValue;var _r=_x+_d;var _b=_y+_d;if(_posx>_x&&_posx<_r&&_posy>_y&&_posy<_b){word_control.m_oDrawingDocument.SetCursorType("se-resize"); return true}}return false};this.CheckStartTrack=function(word_control,transform){this.TableMatrix=null;if(transform)this.TableMatrix=transform.CreateDublicate();if(!this.TableMatrix||global_MatrixTransformer.IsIdentity(this.TableMatrix)){var pos=word_control.m_oDrawingDocument.ConvertCoordsToCursor(this.TableOutline.X,this.TableOutline.Y,this.TableOutline.PageNum,true);var _x0=word_control.m_oEditor.AbsolutePosition.L;var _y0=word_control.m_oEditor.AbsolutePosition.T;if(pos.X<_x0&&pos.Y<_y0)this.TrackTablePos= 2;else if(pos.X<_x0)this.TrackTablePos=1;else if(pos.Y<_y0)this.TrackTablePos=3;else this.TrackTablePos=0}else{var _x=this.TableOutline.X;var _y=this.TableOutline.Y;var _r=_x+this.TableOutline.W;var _b=_y+this.TableOutline.H;var x0=transform.TransformPointX(_x,_y);var y0=transform.TransformPointY(_x,_y);var x1=transform.TransformPointX(_r,_y);var y1=transform.TransformPointY(_r,_y);var x2=transform.TransformPointX(_r,_b);var y2=transform.TransformPointY(_r,_b);var x3=transform.TransformPointX(_x, _b);var y3=transform.TransformPointY(_x,_b);var _x0=word_control.m_oEditor.AbsolutePosition.L*g_dKoef_mm_to_pix;var _y0=word_control.m_oEditor.AbsolutePosition.T*g_dKoef_mm_to_pix;var _x1=word_control.m_oEditor.AbsolutePosition.R*g_dKoef_mm_to_pix;var _y1=word_control.m_oEditor.AbsolutePosition.B*g_dKoef_mm_to_pix;var pos0=word_control.m_oDrawingDocument.ConvertCoordsToCursor(x0,y0,this.TableOutline.PageNum,true);if(pos0.X>_x0&&pos0.X<_x1&&pos0.Y>_y0&&pos0.Y<_y1){this.TrackTablePos=0;return}pos0= word_control.m_oDrawingDocument.ConvertCoordsToCursor(x1,y1,this.TableOutline.PageNum,true);if(pos0.X>_x0&&pos0.X<_x1&&pos0.Y>_y0&&pos0.Y<_y1){this.TrackTablePos=1;return}pos0=word_control.m_oDrawingDocument.ConvertCoordsToCursor(x3,y3,this.TableOutline.PageNum,true);if(pos0.X>_x0&&pos0.X<_x1&&pos0.Y>_y0&&pos0.Y<_y1){this.TrackTablePos=3;return}pos0=word_control.m_oDrawingDocument.ConvertCoordsToCursor(x2,y2,this.TableOutline.PageNum,true);if(pos0.X>_x0&&pos0.X<_x1&&pos0.Y>_y0&&pos0.Y<_y1){this.TrackTablePos= 2;return}this.TrackTablePos=0}};this.checkMover=function(){if(this.mover&&Math.abs(this.mover.scale-AscCommon.AscBrowser.retinaPixelRatio)<.001)return;var rPR=AscCommon.AscBrowser.retinaPixelRatio;var rectSize=Math.round(12*rPR);var halfRSize=Math.round(rectSize/2);var indent=.5*Math.round(rPR);var lineW=Math.round(rPR);var size=rectSize+lineW;if(0!==(rectSize&1))size+=1;this.mover=document.createElement("canvas");this.mover.scale=AscCommon.AscBrowser.retinaPixelRatio;this.mover.width=size;this.mover.height= size;var ctx=this.mover.getContext("2d");ctx.fillStyle="#FFFFFF";ctx.fillRect(0,0,size,size);var tmpImage=document.createElement("canvas");tmpImage.width=Math.round(13*rPR);tmpImage.height=Math.round(13*rPR);var tmpContext=tmpImage.getContext("2d");AscCommon.COverlay.prototype.drawArrow(tmpContext,0,-Math.round(3*rPR),3*Math.round(rPR),{r:68,g:68,b:68});ctx.drawImage(tmpImage,0,0);tmpContext.translate(Math.round(rectSize/2),Math.round(rectSize/2));tmpContext.rotate(Math.PI);tmpContext.translate(-Math.round(rectSize/ 2),-Math.round(rectSize/2));tmpContext.drawImage(tmpImage,-Math.round(rPR),-Math.round(rPR));ctx.drawImage(tmpImage,0,0);tmpContext.setTransform(1,0,0,1,0,0);tmpContext.translate(Math.round(rectSize/2),Math.round(rectSize/2));tmpContext.rotate(Math.PI/2);tmpContext.translate(-Math.round(rectSize/2),-Math.round(rectSize/2));tmpContext.drawImage(tmpImage,0,-Math.round(rPR));ctx.drawImage(tmpImage,0,0);ctx.lineWidth=lineW;ctx.strokeStyle="rgb(140, 140, 140)";if(0!==(rectSize&1))rectSize+=1;ctx.strokeRect(.5* lineW,.5*lineW,rectSize,rectSize);ctx.strokeStyle="rgb(68, 68, 68)";ctx.moveTo(halfRSize-Math.round(Math.round(6*rPR)/2)+indent,halfRSize+indent);ctx.lineTo(halfRSize+Math.round(Math.round(6*rPR)/2)+indent,halfRSize+.5*Math.round(rPR));ctx.moveTo(halfRSize+indent,halfRSize-Math.round(Math.round(6*rPR)/2)+indent);ctx.lineTo(halfRSize+indent,halfRSize+Math.round(Math.round(6*rPR)/2)+indent);ctx.stroke()}}function CCacheImage(){this.image=null;this.image_locked=0;this.image_unusedCount=0}function CCacheManager(){this.arrayImages= [];this.arrayCount=0;this.countValidImage=1;this.CheckImagesForNeed=function(){for(var i=0;i=this.countValidImage){delete this.arrayImages[i].image;this.arrayImages.splice(i,1);--i;--this.arrayCount}};this.UnLock=function(_cache_image){if(null==_cache_image)return;_cache_image.image_locked=0;_cache_image.image_unusedCount=0};this.Lock=function(_w,_h){for(var i=0;i>0)-.5;var _y=(yDst+dKoefY*r.y>>0)-.5;var _w=dKoefX*r.w+1>>0;var _h=dKoefY*r.h+1>>0;if(_xoverlay.max_x)overlay.max_x=_x+_w;if(_yoverlay.max_y)overlay.max_y=_y+_h;overlay.m_oContext.rect(_x,_y,_w,_h)}else for(var i=0;i>0)-.5;var _y=(yDst+dKoefY*place.Y>>0)-.5;var _w=(dKoefX*place.W>>0)+1;var _h=(dKoefY*place.H>>0)+1;if(_xoverlay.max_x)overlay.max_x=_x+_w;if(_yoverlay.max_y)overlay.max_y=_y+_h;ctx.rect(_x,_y,_w,_h)}else{var _x1=xDst+dKoefX*place.X>>0;var _y1=yDst+dKoefY*place.Y>>0;var x2=place.X+ place.W*place.Ex;var y2=place.Y+place.W*place.Ey;var _x2=xDst+dKoefX*x2>>0;var _y2=yDst+dKoefY*y2>>0;var x3=x2-place.H*place.Ey;var y3=y2+place.H*place.Ex;var _x3=xDst+dKoefX*x3>>0;var _y3=yDst+dKoefY*y3>>0;var x4=place.X-place.H*place.Ey;var y4=place.Y+place.H*place.Ex;var _x4=xDst+dKoefX*x4>>0;var _y4=yDst+dKoefY*y4>>0;overlay.CheckPoint(_x1,_y1);overlay.CheckPoint(_x2,_y2);overlay.CheckPoint(_x3,_y3);overlay.CheckPoint(_x4,_y4);ctx.moveTo(_x1,_y1);ctx.lineTo(_x2,_y2);ctx.lineTo(_x3,_y3);ctx.lineTo(_x4, _y4);ctx.lineTo(_x1,_y1)}else{var _tr=place.Transform;if(undefined===place.Ex){var _x1=xDst+dKoefX*_tr.TransformPointX(place.X,place.Y);var _y1=yDst+dKoefY*_tr.TransformPointY(place.X,place.Y);var _x2=xDst+dKoefX*_tr.TransformPointX(place.X+place.W,place.Y);var _y2=yDst+dKoefY*_tr.TransformPointY(place.X+place.W,place.Y);var _x3=xDst+dKoefX*_tr.TransformPointX(place.X+place.W,place.Y+place.H);var _y3=yDst+dKoefY*_tr.TransformPointY(place.X+place.W,place.Y+place.H);var _x4=xDst+dKoefX*_tr.TransformPointX(place.X, place.Y+place.H);var _y4=yDst+dKoefY*_tr.TransformPointY(place.X,place.Y+place.H);overlay.CheckPoint(_x1,_y1);overlay.CheckPoint(_x2,_y2);overlay.CheckPoint(_x3,_y3);overlay.CheckPoint(_x4,_y4);ctx.moveTo(_x1,_y1);ctx.lineTo(_x2,_y2);ctx.lineTo(_x3,_y3);ctx.lineTo(_x4,_y4);ctx.lineTo(_x1,_y1)}else{var x2=place.X+place.W*place.Ex;var y2=place.Y+place.W*place.Ey;var x3=x2-place.H*place.Ey;var y3=y2+place.H*place.Ex;var x4=place.X-place.H*place.Ey;var y4=place.Y+place.H*place.Ex;var _x1=xDst+dKoefX* _tr.TransformPointX(place.X,place.Y);var _y1=yDst+dKoefY*_tr.TransformPointY(place.X,place.Y);var _x2=xDst+dKoefX*_tr.TransformPointX(x2,y2);var _y2=yDst+dKoefY*_tr.TransformPointY(x2,y2);var _x3=xDst+dKoefX*_tr.TransformPointX(x3,y3);var _y3=yDst+dKoefY*_tr.TransformPointY(x3,y3);var _x4=xDst+dKoefX*_tr.TransformPointX(x4,y4);var _y4=yDst+dKoefY*_tr.TransformPointY(x4,y4);overlay.CheckPoint(_x1,_y1);overlay.CheckPoint(_x2,_y2);overlay.CheckPoint(_x3,_y3);overlay.CheckPoint(_x4,_y4);ctx.moveTo(_x1, _y1);ctx.lineTo(_x2,_y2);ctx.lineTo(_x3,_y3);ctx.lineTo(_x4,_y4);ctx.lineTo(_x1,_y1)}}}};this.DrawSearch2=function(overlay,xDst,yDst,wDst,hDst,_searching){var dKoefX=wDst/this.width_mm;var dKoefY=hDst/this.height_mm;var rPR=AscCommon.AscBrowser.retinaPixelRatio;var ctx=overlay.m_oContext;for(var i=0;i<_searching.length;i++){var _find_count=_searching[i].length;for(var j=0;j<_find_count;j++){var place=_searching[i][j];if(!place.Transform)if(undefined===place.Ex){var _x=rPR*(xDst+dKoefX*place.X)>>0; var _y=rPR*(yDst+dKoefY*place.Y)>>0;var _w=rPR*(dKoefX*place.W)>>0;var _h=rPR*(dKoefY*place.H)>>0;if(_xoverlay.max_x)overlay.max_x=_x+_w;if(_yoverlay.max_y)overlay.max_y=_y+_h;ctx.rect(_x,_y,_w,_h)}else{var _x1=rPR*(xDst+dKoefX*place.X)>>0;var _y1=rPR*(yDst+dKoefY*place.Y)>>0;var x2=place.X+place.W*place.Ex;var y2=place.Y+place.W*place.Ey;var _x2=rPR*(xDst+dKoefX*x2)>>0;var _y2=rPR*(yDst+dKoefY*y2)>>0;var x3=x2-place.H* place.Ey;var y3=y2+place.H*place.Ex;var _x3=rPR*(xDst+dKoefX*x3)>>0;var _y3=rPR*(yDst+dKoefY*y3)>>0;var x4=place.X-place.H*place.Ey;var y4=place.Y+place.H*place.Ex;var _x4=rPR*(xDst+dKoefX*x4)>>0;var _y4=rPR*(yDst+dKoefY*y4)>>0;overlay.CheckPoint(_x1,_y1);overlay.CheckPoint(_x2,_y2);overlay.CheckPoint(_x3,_y3);overlay.CheckPoint(_x4,_y4);ctx.moveTo(_x1,_y1);ctx.lineTo(_x2,_y2);ctx.lineTo(_x3,_y3);ctx.lineTo(_x4,_y4);ctx.lineTo(_x1,_y1)}}}};this.drawInHdrFtr=function(overlay,xDst,yDst,wDst,hDst,dKoefX, dKoefY,arr){var _c=arr.length;if(0==_c)return false;var ctx=overlay.m_oContext;for(var i=0;i<_c;i++){var place=arr[i];if(!place.Transform)if(undefined===place.Ex){var _x=(xDst+dKoefX*place.X>>0)-.5;var _y=(yDst+dKoefY*place.Y>>0)-.5;var _w=(dKoefX*place.W>>0)+1;var _h=(dKoefY*place.H>>0)+1;if(_xoverlay.max_x)overlay.max_x=_x+_w;if(_yoverlay.max_y)overlay.max_y=_y+_h;ctx.rect(_x,_y,_w,_h)}else{var _x1=xDst+dKoefX*place.X>> 0;var _y1=yDst+dKoefY*place.Y>>0;var x2=place.X+place.W*place.Ex;var y2=place.Y+place.W*place.Ey;var _x2=xDst+dKoefX*x2>>0;var _y2=yDst+dKoefY*y2>>0;var x3=x2-place.H*place.Ey;var y3=y2+place.H*place.Ex;var _x3=xDst+dKoefX*x3>>0;var _y3=yDst+dKoefY*y3>>0;var x4=place.X-place.H*place.Ey;var y4=place.Y+place.H*place.Ex;var _x4=xDst+dKoefX*x4>>0;var _y4=yDst+dKoefY*y4>>0;overlay.CheckPoint(_x1,_y1);overlay.CheckPoint(_x2,_y2);overlay.CheckPoint(_x3,_y3);overlay.CheckPoint(_x4,_y4);ctx.moveTo(_x1,_y1); ctx.lineTo(_x2,_y2);ctx.lineTo(_x3,_y3);ctx.lineTo(_x4,_y4);ctx.lineTo(_x1,_y1)}else{var _tr=place.Transform;if(undefined===place.Ex){var _x1=xDst+dKoefX*_tr.TransformPointX(place.X,place.Y);var _y1=yDst+dKoefY*_tr.TransformPointY(place.X,place.Y);var _x2=xDst+dKoefX*_tr.TransformPointX(place.X+place.W,place.Y);var _y2=yDst+dKoefY*_tr.TransformPointY(place.X+place.W,place.Y);var _x3=xDst+dKoefX*_tr.TransformPointX(place.X+place.W,place.Y+place.H);var _y3=yDst+dKoefY*_tr.TransformPointY(place.X+place.W, place.Y+place.H);var _x4=xDst+dKoefX*_tr.TransformPointX(place.X,place.Y+place.H);var _y4=yDst+dKoefY*_tr.TransformPointY(place.X,place.Y+place.H);overlay.CheckPoint(_x1,_y1);overlay.CheckPoint(_x2,_y2);overlay.CheckPoint(_x3,_y3);overlay.CheckPoint(_x4,_y4);ctx.moveTo(_x1,_y1);ctx.lineTo(_x2,_y2);ctx.lineTo(_x3,_y3);ctx.lineTo(_x4,_y4);ctx.lineTo(_x1,_y1)}else{var x2=place.X+place.W*place.Ex;var y2=place.Y+place.W*place.Ey;var x3=x2-place.H*place.Ey;var y3=y2+place.H*place.Ex;var x4=place.X-place.H* place.Ey;var y4=place.Y+place.H*place.Ex;var _x1=xDst+dKoefX*_tr.TransformPointX(place.X,place.Y);var _y1=yDst+dKoefY*_tr.TransformPointY(place.X,place.Y);var _x2=xDst+dKoefX*_tr.TransformPointX(x2,y2);var _y2=yDst+dKoefY*_tr.TransformPointY(x2,y2);var _x3=xDst+dKoefX*_tr.TransformPointX(x3,y3);var _y3=yDst+dKoefY*_tr.TransformPointY(x3,y3);var _x4=xDst+dKoefX*_tr.TransformPointX(x4,y4);var _y4=yDst+dKoefY*_tr.TransformPointY(x4,y4);overlay.CheckPoint(_x1,_y1);overlay.CheckPoint(_x2,_y2);overlay.CheckPoint(_x3, _y3);overlay.CheckPoint(_x4,_y4);ctx.moveTo(_x1,_y1);ctx.lineTo(_x2,_y2);ctx.lineTo(_x3,_y3);ctx.lineTo(_x4,_y4);ctx.lineTo(_x1,_y1)}}}return true};this.DrawSearchCur=function(overlay,xDst,yDst,wDst,hDst,places){var dKoefX=wDst/this.width_mm;var dKoefY=hDst/this.height_mm;var rPR=AscCommon.AscBrowser.retinaPixelRatio;var len=places.length;var ctx=overlay.m_oContext;ctx.fillStyle="rgba(51,102,204,255)";for(var i=0;i> 0;var _y=rPR*(yDst+dKoefY*place.Y)>>0;var _w=rPR*(dKoefX*place.W)>>0;var _h=rPR*(dKoefY*place.H)>>0;if(_xoverlay.max_x)overlay.max_x=_x+_w;if(_yoverlay.max_y)overlay.max_y=_y+_h;ctx.rect(_x,_y,_w,_h)}else{var _x1=rPR*(xDst+dKoefX*place.X)>>0;var _y1=rPR*(yDst+dKoefY*place.Y)>>0;var x2=place.X+place.W*place.Ex;var y2=place.Y+place.W*place.Ey;var _x2=rPR*(xDst+dKoefX*x2)>>0;var _y2=rPR*(yDst+dKoefY*y2)>>0;var x3=x2-place.H* place.Ey;var y3=y2+place.H*place.Ex;var _x3=rPR*(xDst+dKoefX*x3)>>0;var _y3=rPR*(yDst+dKoefY*y3)>>0;var x4=place.X-place.H*place.Ey;var y4=place.Y+place.H*place.Ex;var _x4=rPR*(xDst+dKoefX*x4)>>0;var _y4=rPR*(yDst+dKoefY*y4)>>0;overlay.CheckPoint(_x1,_y1);overlay.CheckPoint(_x2,_y2);overlay.CheckPoint(_x3,_y3);overlay.CheckPoint(_x4,_y4);ctx.moveTo(_x1,_y1);ctx.lineTo(_x2,_y2);ctx.lineTo(_x3,_y3);ctx.lineTo(_x4,_y4);ctx.lineTo(_x1,_y1)}}ctx.fill();ctx.beginPath()};this.DrawTableOutline=function(overlay, xDst,yDst,wDst,hDst,table_outline_dr,lastBounds){var transform=table_outline_dr.TableMatrix;var rPR=AscCommon.AscBrowser.retinaPixelRatio;xDst*=rPR;yDst*=rPR;wDst*=rPR;hDst*=rPR;if(null==transform||transform.IsIdentity2()){var dKoefX=wDst/this.width_mm;var dKoefY=hDst/this.height_mm;var _offX=null==transform?0:transform.tx;var _offY=null==transform?0:transform.ty;if(!lastBounds){var _x=0;var _y=0;switch(table_outline_dr.TrackTablePos){case 1:{_x=xDst+dKoefX*(table_outline_dr.TableOutline.X+table_outline_dr.TableOutline.W+ _offX)>>0;_y=(yDst+dKoefY*(table_outline_dr.TableOutline.Y+_offY)>>0)-Math.round(13*rPR);break}case 2:{_x=xDst+dKoefX*(table_outline_dr.TableOutline.X+table_outline_dr.TableOutline.W+_offX)>>0;_y=yDst+dKoefY*(table_outline_dr.TableOutline.Y+table_outline_dr.TableOutline.H+_offY)>>0;break}case 3:{_x=(xDst+dKoefX*(table_outline_dr.TableOutline.X+_offX)>>0)-Math.round(13*rPR);_y=yDst+dKoefY*(table_outline_dr.TableOutline.Y+table_outline_dr.TableOutline.H+_offY)>>0;break}case 0:default:{_x=(xDst+dKoefX* (table_outline_dr.TableOutline.X+_offX)>>0)-Math.round(13*rPR);_y=(yDst+dKoefY*(table_outline_dr.TableOutline.Y+_offY)>>0)-Math.round(13*rPR);break}}var _w=Math.round(13*rPR);var _h=Math.round(13*rPR);if(_xoverlay.max_x)overlay.max_x=_x+_w;if(_yoverlay.max_y)overlay.max_y=_y+_h;table_outline_dr.checkMover();overlay.m_oContext.drawImage(table_outline_dr.mover,_x,_y)}else{var _xLast=xDst+dKoefX*(lastBounds.X+lastBounds.W+ _offX)+.5*Math.round(rPR)>>0;var _yLast=yDst+dKoefY*(lastBounds.Y+lastBounds.H+_offY)+.5*Math.round(rPR)>>0;var ctx=overlay.m_oContext;ctx.strokeStyle="rgb(140, 140, 140)";ctx.lineWidth=Math.round(rPR);ctx.beginPath();overlay.AddRect(_xLast-.5*Math.round(rPR),_yLast-.5*Math.round(rPR),Math.round(6*rPR),Math.round(6*rPR));ctx.stroke();ctx.beginPath()}}else{var ctx=overlay.m_oContext;var _ft=new AscCommon.CMatrix;_ft.sx=transform.sx;_ft.shx=transform.shx;_ft.shy=transform.shy;_ft.sy=transform.sy;_ft.tx= transform.tx;_ft.ty=transform.ty;var coords=new AscCommon.CMatrix;coords.sx=wDst/this.width_mm;coords.sy=hDst/this.height_mm;coords.tx=xDst;coords.ty=yDst;global_MatrixTransformer.MultiplyAppend(_ft,coords);if(!lastBounds){ctx.transform(_ft.sx,_ft.shy,_ft.shx,_ft.sy,_ft.tx,_ft.ty);var _x=0;var _y=0;var _w=13/coords.sx;var _h=13/coords.sy;switch(table_outline_dr.TrackTablePos){case 1:{_x=table_outline_dr.TableOutline.X+table_outline_dr.TableOutline.W;_y=table_outline_dr.TableOutline.Y-_h;break}case 2:{_x= table_outline_dr.TableOutline.X+table_outline_dr.TableOutline.W;_y=table_outline_dr.TableOutline.Y+table_outline_dr.TableOutline.H;break}case 3:{_x=table_outline_dr.TableOutline.X-_w;_y=table_outline_dr.TableOutline.Y+table_outline_dr.TableOutline.H;break}case 0:default:{_x=table_outline_dr.TableOutline.X-_w;_y=table_outline_dr.TableOutline.Y-_h;break}}overlay.CheckPoint(_ft.TransformPointX(_x,_y),_ft.TransformPointY(_x,_y));overlay.CheckPoint(_ft.TransformPointX(_x+_w,_y),_ft.TransformPointY(_x+ _w,_y));overlay.CheckPoint(_ft.TransformPointX(_x+_w,_y+_h),_ft.TransformPointY(_x+_w,_y+_h));overlay.CheckPoint(_ft.TransformPointX(_x,_y+_h),_ft.TransformPointY(_x,_y+_h));table_outline_dr.checkMover();overlay.m_oContext.drawImage(table_outline_dr.mover,_x,_y,_w,_h);overlay.SetBaseTransform()}else{var _xLast=lastBounds.X+lastBounds.W;var _yLast=lastBounds.Y+lastBounds.H;var ctx=overlay.m_oContext;ctx.strokeStyle="rgb(140, 140, 140)";ctx.fillStyle="#FFFFFF";ctx.lineWidth=1;ctx.beginPath();var _dist= 6/_ft.GetScaleValue();var _arr=[_ft.TransformPointX(_xLast,_yLast),_ft.TransformPointY(_xLast,_yLast),_ft.TransformPointX(_xLast+_dist,_yLast),_ft.TransformPointY(_xLast+_dist,_yLast),_ft.TransformPointX(_xLast+_dist,_yLast+_dist),_ft.TransformPointY(_xLast+_dist,_yLast+_dist),_ft.TransformPointX(_xLast,_yLast+_dist),_ft.TransformPointY(_xLast,_yLast+_dist)];overlay.CheckPoint(_arr[0],_arr[1]);overlay.CheckPoint(_arr[2],_arr[3]);overlay.CheckPoint(_arr[4],_arr[5]);overlay.CheckPoint(_arr[6],_arr[7]); ctx.moveTo(_arr[0],_arr[1]);ctx.lineTo(_arr[2],_arr[3]);ctx.lineTo(_arr[4],_arr[5]);ctx.lineTo(_arr[6],_arr[7]);ctx.closePath();ctx.fill();ctx.stroke();ctx.beginPath()}}}}function CDrawingCollaborativeTarget(){this.Id="";this.ShortId="";this.X=0;this.Y=0;this.Size=0;this.Page=-1;this.Color=null;this.Transform=null;this.HtmlElement=null;this.HtmlElementX=0;this.HtmlElementY=0;this.Color=null;this.Style="";this.IsInsertToDOM=false}CDrawingCollaborativeTarget.prototype={CheckPosition:function(_drawing_doc, _x,_y,_size,_page,_transform){var bIsHtmlElementCreate=false;if(this.HtmlElement==null){bIsHtmlElementCreate=true;this.HtmlElement=document.createElement("canvas");this.HtmlElement.style.cssText="pointer-events: none;position:absolute;padding:0;margin:0;-webkit-user-select:none;width:1px;height:1px;display:block;z-index:3;";this.HtmlElement.width=1;this.HtmlElement.height=1;this.Color=AscCommon.getUserColorById(this.ShortId,null,true);this.Style="rgb("+this.Color.r+","+this.Color.g+","+this.Color.b+ ")"}this.Transform=_transform;this.Size=_size;var _old_x=this.X;var _old_y=this.Y;var _old_page=this.Page;this.X=_x;this.Y=_y;this.Page=_page;var _oldW=this.HtmlElement.width;var _oldH=this.HtmlElement.height;var _newW=2;var _newH=this.Size*_drawing_doc.m_oWordControl.m_nZoomValue*g_dKoef_mm_to_pix/100>>0;if(null!=this.Transform&&!global_MatrixTransformer.IsIdentity2(this.Transform)){var _x1=this.Transform.TransformPointX(_x,_y);var _y1=this.Transform.TransformPointY(_x,_y);var _x2=this.Transform.TransformPointX(_x, _y+this.Size);var _y2=this.Transform.TransformPointY(_x,_y+this.Size);var pos1=_drawing_doc.ConvertCoordsToCursor2(_x1,_y1,this.Page);var pos2=_drawing_doc.ConvertCoordsToCursor2(_x2,_y2,this.Page);_newW=(Math.abs(pos1.X-pos2.X)>>0)+1;_newH=(Math.abs(pos1.Y-pos2.Y)>>0)+1;if(2>_newW)_newW=2;if(2>_newH)_newH=2;if(_oldW==_newW&&_oldH==_newH){if(_newW!=2&&_newH!=2)this.HtmlElement.width=_newW}else{this.HtmlElement.style.width=_newW+"px";this.HtmlElement.style.height=_newH+"px";this.HtmlElement.width= _newW;this.HtmlElement.height=_newH}var ctx=this.HtmlElement.getContext("2d");if(_newW==2||_newH==2){ctx.fillStyle=this.Style;ctx.fillRect(0,0,_newW,_newH)}else{ctx.beginPath();ctx.strokeStyle=this.Style;ctx.lineWidth=2;if((pos1.X-pos2.X)*(pos1.Y-pos2.Y)>=0){ctx.moveTo(0,0);ctx.lineTo(_newW,_newH)}else{ctx.moveTo(0,_newH);ctx.lineTo(_newW,0)}ctx.stroke()}this.HtmlElementX=Math.min(pos1.X,pos2.X)>>0;this.HtmlElementY=Math.min(pos1.Y,pos2.Y)>>0;if(!_drawing_doc.m_oWordControl.MobileTouchManager&&!AscCommon.AscBrowser.isSafariMacOs|| !AscCommon.AscBrowser.isWebkit){this.HtmlElement.style.left=this.HtmlElementX+"px";this.HtmlElement.style.top=this.HtmlElementY+"px"}else{this.HtmlElement.style.left="0px";this.HtmlElement.style.top="0px";this.HtmlElement.style["webkitTransform"]="matrix(1, 0, 0, 1, "+this.HtmlElementX+","+this.HtmlElementY+")"}}else{if(_oldW==_newW&&_oldH==_newH)this.HtmlElement.width=_newW;else{this.HtmlElement.style.width=_newW+"px";this.HtmlElement.style.height=_newH+"px";this.HtmlElement.width=_newW;this.HtmlElement.height= _newH}var ctx=this.HtmlElement.getContext("2d");ctx.fillStyle=this.Style;ctx.fillRect(0,0,_newW,_newH);if(null!=this.Transform){_x+=this.Transform.tx;_y+=this.Transform.ty}var pos=_drawing_doc.ConvertCoordsToCursor2(_x,_y,this.Page);this.HtmlElementX=pos.X>>0;this.HtmlElementY=pos.Y>>0;if(!_drawing_doc.m_oWordControl.MobileTouchManager&&!AscCommon.AscBrowser.isSafariMacOs||!AscCommon.AscBrowser.isWebkit){this.HtmlElement.style.left=this.HtmlElementX+"px";this.HtmlElement.style.top=this.HtmlElementY+ "px"}else{this.HtmlElement.style.left="0px";this.HtmlElement.style.top="0px";this.HtmlElement.style["webkitTransform"]="matrix(1, 0, 0, 1, "+this.HtmlElementX+","+this.HtmlElementY+")"}}if(AscCommon.CollaborativeEditing)AscCommon.CollaborativeEditing.Update_ForeignCursorLabelPosition(this.Id,this.HtmlElementX,this.HtmlElementY,this.Color);if(bIsHtmlElementCreate){_drawing_doc.m_oWordControl.m_oMainView.HtmlElement.appendChild(this.HtmlElement);this.IsInsertToDOM=true}},Remove:function(_drawing_doc){if(this.IsInsertToDOM){_drawing_doc.m_oWordControl.m_oMainView.HtmlElement.removeChild(this.HtmlElement); this.IsInsertToDOM=false}},Update:function(_drawing_doc){this.CheckPosition(_drawing_doc,this.X,this.Y,this.Size,this.Page,this.Transform)}};function CDrawingDocument(){this.IsLockObjectsEnable=false;AscCommon.g_oHtmlCursor.register("de-markerformat","marker_format","14 8","pointer");AscCommon.g_oHtmlCursor.register("select-table-row","select_row","10 5","default");AscCommon.g_oHtmlCursor.register("select-table-column","select_column","5 10","default");AscCommon.g_oHtmlCursor.register("select-table-cell", "select_cell","9 0","default");AscCommon.g_oHtmlCursor.register("de-tablepen","pen","1 16","pointer");AscCommon.g_oHtmlCursor.register("de-tableeraser","eraser","8 19","pointer");this.m_oWordControl=null;this.m_oLogicDocument=null;this.m_oDocumentRenderer=null;this.m_arrPages=[];this.m_lPagesCount=0;this.m_lDrawingFirst=-1;this.m_lDrawingEnd=-1;this.m_lCurrentPage=-1;this.FrameRect={IsActive:false,Rect:{X:0,Y:0,R:0,B:0},Frame:null,Track:{X:0,Y:0,L:0,T:0,R:0,B:0,PageIndex:0,Type:-1},IsTracked:false, PageIndex:0};this.MathTrack=new AscCommon.CMathTrack;this.FieldTrack={IsActive:false,Rects:[]};this.m_oCacheManager=new CCacheManager;this.m_lCountCalculatePages=0;this.m_bIsDocumentCalculating=true;this.m_arPrintingWaitEndRecalculate=null;this.m_lTimerTargetId=-1;this.m_dTargetX=-1;this.m_dTargetY=-1;this.m_lTargetPage=-1;this.m_dTargetSize=1;this.NeedScrollToTargetFlag=false;this.TargetHtmlElement=null;this.TargetHtmlElementBlock=false;this.TargetHtmlElementLeft=0;this.TargetHtmlElementTop=0;this.CollaborativeTargets= [];this.CollaborativeTargetsUpdateTasks=[];this.m_bIsBreakRecalculate=false;this.m_bIsSelection=false;this.m_bIsSearching=false;this.m_lCountRect=0;this.CurrentSearchNavi=null;this.SearchTransform=null;this.m_lTimerUpdateTargetID=-1;this.m_tempX=0;this.m_tempY=0;this.m_tempPageIndex=0;var oThis=this;this.m_sLockedCursorType="";this.TableOutlineDr=new CTableOutlineDr;this.m_lCurrentRendererPage=-1;this.m_oDocRenderer=null;this.m_bOldShowMarks=false;this.UpdateTargetFromPaint=false;this.UpdateTargetCheck= false;this.NeedTarget=true;this.TextMatrix=null;this.TargetShowFlag=false;this.TargetShowNeedFlag=false;this.SelectionMatrix=null;this.CanvasHit=document.createElement("canvas");this.CanvasHit.width=10;this.CanvasHit.height=10;this.CanvasHitContext=this.CanvasHit.getContext("2d");this.TargetCursorColor={R:0,G:0,B:0};this.GuiControlColorsMap=null;this.IsSendStandartColors=false;this.GuiCanvasFillTextureParentId="";this.GuiCanvasFillTexture=null;this.GuiCanvasFillTextureCtx=null;this.LastDrawingUrl= "";this.GuiCanvasTextProps=null;this.GuiLastTextProps=null;this.GuiCanvasFillTOCParentId="";this.GuiCanvasFillTOC=null;this.GuiCanvasFillTOFParentId="";this.GuiCanvasFillTOF=null;this.TableStylesLastLook=null;this.TableStylesLastClrScheme=null;this.LastParagraphMargins=null;this.TableStylesCheckLook=null;this.TableStylesCheckLookFlag=false;this.InlineTextTrackEnabled=false;this.InlineTextTrack=null;this.InlineTextTrackPage=-1;this.AutoShapesTrack=null;this.AutoShapesTrackLockPageNum=-1;this.Overlay= null;this.IsTextMatrixUse=false;this.IsTextSelectionOutline=false;this.OverlaySelection2={};this.HorVerAnchors=[];this.MathMenuLoad=false;this.UpdateRulerStateFlag=false;this.UpdateRulerStateParams=[];this._search_HdrFtr_All=[];this._search_HdrFtr_All_no_First=[];this._search_HdrFtr_First=[];this._search_HdrFtr_Even=[];this._search_HdrFtr_Odd=[];this._search_HdrFtr_Odd_no_First=[];this.isFirstStartRecalculate=false;this.isDisableEditBeforeCalculateLA=false;this.isFirstRecalculate=false;this.isFirstFullRecalculate= false;this.isScrollToTargetAttack=false;this.printedDocument=null;this.contentControls=new AscCommon.DrawingContentControls(this);this.placeholders=new AscCommon.DrawingPlaceholders(this);this.showTarget=function(isShow){if(this.TargetHtmlElementBlock)this.TargetHtmlElement.style.display=isShow?"display":"none";else this.TargetHtmlElement.style.visibility=isShow?"visible":"hidden"};this.isShowTarget=function(){if(this.TargetHtmlElementBlock)return this.TargetHtmlElement.style.display=="display"?true: false;else return this.TargetHtmlElement.style.visibility=="visible"?true:false};this.Start_CollaborationEditing=function(){this.IsLockObjectsEnable=true;this.m_oWordControl.OnRePaintAttack()};this.SetCursorType=function(sType,Data){if(""==this.m_sLockedCursorType)if("text"==sType)if(AscCommon.c_oAscFormatPainterState.kOff!==this.m_oWordControl.m_oApi.isPaintFormat)this.m_oWordControl.m_oMainContent.HtmlElement.style.cursor=AscCommon.g_oHtmlCursor.value(AscCommon.kCurFormatPainterWord);else if(this.m_oWordControl.m_oApi.isMarkerFormat)this.m_oWordControl.m_oMainContent.HtmlElement.style.cursor= AscCommon.g_oHtmlCursor.value("de-markerformat");else if(this.m_oWordControl.m_oApi.isDrawTablePen)this.m_oWordControl.m_oMainContent.HtmlElement.style.cursor=AscCommon.g_oHtmlCursor.value("de-tablepen");else if(this.m_oWordControl.m_oApi.isDrawTableErase)this.m_oWordControl.m_oMainContent.HtmlElement.style.cursor=AscCommon.g_oHtmlCursor.value("de-tableeraser");else this.m_oWordControl.m_oMainContent.HtmlElement.style.cursor=AscCommon.g_oHtmlCursor.value(sType);else this.m_oWordControl.m_oMainContent.HtmlElement.style.cursor= AscCommon.g_oHtmlCursor.value(sType);else this.m_oWordControl.m_oMainContent.HtmlElement.style.cursor=AscCommon.g_oHtmlCursor.value(this.m_sLockedCursorType);if("undefined"===typeof Data||null===Data)Data=new AscCommon.CMouseMoveData;editor.sync_MouseMoveCallback(Data)};this.LockCursorType=function(sType){this.m_sLockedCursorType=sType;this.m_oWordControl.m_oMainContent.HtmlElement.style.cursor=AscCommon.g_oHtmlCursor.value(this.m_sLockedCursorType)};this.LockCursorTypeCur=function(){this.m_sLockedCursorType= this.m_oWordControl.m_oMainContent.HtmlElement.style.cursor};this.UnlockCursorType=function(){this.m_sLockedCursorType=""};this.scrollToTargetOnRecalculate=function(pageCountOld,pageCountNew){if(this.m_lTargetPage>pageCountOld&&this.m_lTargetPage=this.m_lDrawingFirst&&index<=this.m_lDrawingEnd)this.m_oWordControl.OnScroll()};this.OnRecalculatePage=function(index,pageObject){this.m_bIsDocumentCalculating=true;editor.sendEvent("asc_onDocumentChanged");if(true===this.m_bIsSearching){this.SearchClear();this.m_oWordControl.OnUpdateOverlay()}if(this.m_bIsBreakRecalculate){this.m_bIsBreakRecalculate= false;this.m_lCountCalculatePages=index}this.m_lCountCalculatePages=index+1;if(undefined===this.m_arrPages[index])this.m_arrPages[index]=new CPage;var page=this.m_arrPages[index];page.width_mm=pageObject.Width;page.height_mm=pageObject.Height;page.margin_left=pageObject.Margins.Left;page.margin_top=pageObject.Margins.Top;page.margin_right=pageObject.Margins.Right;page.margin_bottom=pageObject.Margins.Bottom;page.index=index;page.drawingPage.SetRepaint(this.m_oCacheManager);if(index>=this.m_lDrawingFirst&& index<=this.m_lDrawingEnd)this.m_oWordControl.OnScroll();if(this.m_lCountCalculatePages>this.m_lPagesCount+50||0==this.m_lPagesCount&&0!=this.m_lCountCalculatePages)this.OnEndRecalculate(false)};this.OnEndRecalculate=function(isFull,isBreak){if(this.m_oWordControl)this.m_oWordControl.m_oApi.checkLastWork();if(undefined!=isBreak)this.m_lCountCalculatePages=this.m_lPagesCount;for(var index=this.m_lCountCalculatePages;indexthis.m_lCountCalculatePages)this.m_arrPages.splice(this.m_lCountCalculatePages,this.m_lPagesCount-this.m_lCountCalculatePages);this.m_lPagesCount=this.m_lCountCalculatePages;this.m_oWordControl.CalculateDocumentSize()}else if(this.m_lPagesCount+50this.m_lDrawingEnd)return;this.StopRenderingPage(pageIndex);this.m_oWordControl.OnScroll()};this.CheckPagesSizeMaximum=function(_w,_h){var w=_w;var h=_h;if(g_bIsMobile){var _mobile_max=2500;if(w>_mobile_max||h>_mobile_max)if(w>h){h=h*_mobile_max/w>>0;w=_mobile_max}else{w= w*_mobile_max/h>>0;h=_mobile_max}}return[w,h]};this.CheckRecalculatePage=function(width,height,pageIndex){var _drawingPage=this.m_arrPages[pageIndex].drawingPage;var isUnlock=false;if(_drawingPage.cachedImage!=null&&_drawingPage.cachedImage.image!=null){var _check=this.CheckPagesSizeMaximum(width,height);if(_check[0]!=_drawingPage.cachedImage.image.width||_check[1]!=_drawingPage.cachedImage.image.height)isUnlock=true}if(_drawingPage.IsRecalculate)if(this.IsFreezePage(pageIndex));else isUnlock=true; if(isUnlock)_drawingPage.UnLock(this.m_oCacheManager)};this.StartRenderingPage=function(pageIndex){if(true===this.IsFreezePage(pageIndex))return;var page=this.m_arrPages[pageIndex];var dKoef=this.m_oWordControl.m_nZoomValue*g_dKoef_mm_to_pix/100;var w=page.width_mm*dKoef+.5>>0;var h=page.height_mm*dKoef+.5>>0;w=AscCommon.AscBrowser.convertToRetinaValue(w,true);h=AscCommon.AscBrowser.convertToRetinaValue(h,true);var _check=this.CheckPagesSizeMaximum(w,h);w=_check[0];h=_check[1];page.drawingPage.UnLock(this.m_oCacheManager); page.drawingPage.cachedImage=this.m_oCacheManager.Lock(w,h);var g=new AscCommon.CGraphics;g.init(page.drawingPage.cachedImage.image.ctx,w,h,page.width_mm,page.height_mm);g.m_oFontManager=AscCommon.g_fontManager;g.transform(1,0,0,1,0,0);if(null==this.m_oDocumentRenderer)this.m_oLogicDocument.DrawPage(pageIndex,g);else this.m_oDocumentRenderer.drawPage(pageIndex,g);if(g_page_outline_inner){var context=page.drawingPage.cachedImage.image.ctx;context.strokeStyle=GlobalSkin.PageOutline;context.lineWidth= 1;context.beginPath();context.moveTo(.5,.5);context.lineTo(w-.5,.5);context.lineTo(w-.5,h-.5);context.lineTo(.5,h-.5);context.closePath();context.stroke();context.beginPath()}if(this.m_oWordControl.m_oApi.watermarkDraw&&this.m_oWordControl.m_oLogicDocument)this.m_oWordControl.m_oApi.watermarkDraw.Draw(page.drawingPage.cachedImage.image.ctx,w,h)};this.IsFreezePage=function(pageIndex){if(pageIndex>=0&&pageIndex= this.m_oLogicDocument.Pages.length)return true;else if(!this.m_oLogicDocument.CanDrawPage(pageIndex))return true;return false}return true};this.RenderDocument=function(Renderer){var _this=this.printedDocument?this.printedDocument.DrawingDocument:this;for(var i=0;i<_this.m_lPagesCount;i++){var page=_this.m_arrPages[i];Renderer.BeginPage(page.width_mm,page.height_mm);_this.m_oLogicDocument.DrawPage(i,Renderer);Renderer.EndPage()}};this.ToRenderer=function(){var Renderer=new AscCommon.CDocumentRenderer; Renderer.InitPicker(AscCommon.g_oTextMeasurer.m_oManager);Renderer.VectorMemoryForPrint=new AscCommon.CMemory;var old_marks=this.m_oWordControl.m_oApi.ShowParaMarks;this.m_oWordControl.m_oApi.ShowParaMarks=false;this.RenderDocument(Renderer);this.m_oWordControl.m_oApi.ShowParaMarks=old_marks;this.printedDocument=null;var ret=Renderer.Memory.GetBase64Memory();return ret};this.CheckPrint=function(params){if(!this.m_oWordControl.m_oLogicDocument)return false;if(this.m_arPrintingWaitEndRecalculate){this.m_oWordControl.m_oApi.sync_EndAction(Asc.c_oAscAsyncActionType.BlockInteraction, params[0]);this.m_arPrintingWaitEndRecalculate=null;return false}if(!this.m_bIsDocumentCalculating)return false;this.m_arPrintingWaitEndRecalculate=params;this.m_oWordControl.m_oApi.sync_StartAction(Asc.c_oAscAsyncActionType.BlockInteraction,params[0]);return true};this.ToRenderer2=function(document){var _this=this.printedDocument?this.printedDocument.DrawingDocument:this;var Renderer=new AscCommon.CDocumentRenderer;Renderer.InitPicker(AscCommon.g_oTextMeasurer.m_oManager);var old_marks=this.m_oWordControl.m_oApi.ShowParaMarks; this.m_oWordControl.m_oApi.ShowParaMarks=false;var ret="";for(var i=0;i<_this.m_lPagesCount;i++){var page=_this.m_arrPages[i];Renderer.BeginPage(page.width_mm,page.height_mm);_this.m_oLogicDocument.DrawPage(i,Renderer);Renderer.EndPage();ret+=Renderer.Memory.GetBase64Memory();Renderer.Memory.Seek(0)}this.m_oWordControl.m_oApi.ShowParaMarks=old_marks;this.printedDocument=null;return ret};this.ToRendererPart=function(noBase64){var _this=this.printedDocument?this.printedDocument.DrawingDocument:this; var watermark=this.m_oWordControl.m_oApi.watermarkDraw;var pagescount=Math.min(_this.m_lPagesCount,_this.m_lCountCalculatePages);if(-1==this.m_lCurrentRendererPage){if(watermark)watermark.StartRenderer();this.m_oDocRenderer=new AscCommon.CDocumentRenderer;this.m_oDocRenderer.InitPicker(AscCommon.g_oTextMeasurer.m_oManager);this.m_oDocRenderer.VectorMemoryForPrint=new AscCommon.CMemory;this.m_lCurrentRendererPage=0;this.m_bOldShowMarks=this.m_oWordControl.m_oApi.ShowParaMarks;this.m_oWordControl.m_oApi.ShowParaMarks= false}var start=this.m_lCurrentRendererPage;var end=pagescount-1;var renderer=this.m_oDocRenderer;renderer.Memory.Seek(0);renderer.VectorMemoryForPrint.ClearNoAttack();for(var i=start;i<=end;i++){var page=_this.m_arrPages[i];renderer.BeginPage(page.width_mm,page.height_mm);_this.m_oLogicDocument.DrawPage(i,renderer);if(watermark)watermark.DrawOnRenderer(renderer,page.width_mm,page.height_mm);renderer.EndPage()}this.m_lCurrentRendererPage=end+1;if(this.m_lCurrentRendererPage>=pagescount){if(watermark)watermark.EndRenderer(); this.m_lCurrentRendererPage=-1;this.m_oDocRenderer=null;this.m_oWordControl.m_oApi.ShowParaMarks=this.m_bOldShowMarks;this.printedDocument=null}if(noBase64)return renderer.Memory.GetData();else return renderer.Memory.GetBase64Memory()};this.StopRenderingPage=function(pageIndex){if(null!=this.m_oDocumentRenderer)this.m_oDocumentRenderer.stopRenderingPage(pageIndex);this.m_arrPages[pageIndex].drawingPage.UnLock(this.m_oCacheManager)};this.ClearCachePages=function(){for(var i=0;i=this.m_lPagesCount)return{X:0,Y:0,Page:-1,DrawPage:-1};var rect=this.m_arrPages[page].drawingPage;var x_mm=(_x-rect.left)*dKoef;var y_mm=(_y-rect.top)*dKoef;return{X:x_mm,Y:y_mm,Page:rect.pageIndex,DrawPage:page}};this.ConvertCoordsToAnotherPage=function(x,y,pageCoord,pageNeed){if(pageCoord<0||pageCoord>=this.m_lPagesCount||pageNeed< 0||pageNeed>=this.m_lPagesCount)return{X:0,Y:0,Error:true};var dKoef1=this.m_oWordControl.m_nZoomValue*g_dKoef_mm_to_pix/100;var dKoef2=100*g_dKoef_pix_to_mm/this.m_oWordControl.m_nZoomValue;var page1=this.m_arrPages[pageCoord].drawingPage;var page2=this.m_arrPages[pageNeed].drawingPage;var xCursor=page1.left+x*dKoef1;var yCursor=page1.top+y*dKoef1;var _x=(xCursor-page2.left)*dKoef2;var _y=(yCursor-page2.top)*dKoef2;return{X:_x,Y:_y,Error:false}};this.ConvertCoordsFromCursor2=function(x,y,bIsRul, bIsNoNormalize,_zoomVal){var _x=x;var _y=y;var dKoef=100*g_dKoef_pix_to_mm/this.m_oWordControl.m_nZoomValue;if(undefined!==_zoomVal)dKoef=100*g_dKoef_pix_to_mm/_zoomVal;if(undefined==bIsRul){var _xOffset=this.m_oWordControl.X;var _yOffset=this.m_oWordControl.Y;if(true==this.m_oWordControl.m_bIsRuler){_xOffset+=5*g_dKoef_mm_to_pix;_yOffset+=7*g_dKoef_mm_to_pix}_x=x-_xOffset;_y=y-_yOffset}if(-1==this.m_lDrawingFirst||-1==this.m_lDrawingEnd)return{X:0,Y:0,Page:-1,DrawPage:-1};for(var i=this.m_lDrawingFirst;i<= this.m_lDrawingEnd;i++){var rect=this.m_arrPages[i].drawingPage;if(rect.left<=_x&&_x<=rect.right&&rect.top<=_y&&_y<=rect.bottom){var x_mm=(_x-rect.left)*dKoef;var y_mm=(_y-rect.top)*dKoef;if(x_mm>this.m_arrPages[i].width_mm+10)x_mm=this.m_arrPages[i].width_mm+10;if(x_mm<-10)x_mm=-10;return{X:x_mm,Y:y_mm,Page:rect.pageIndex,DrawPage:i}}}var _start=Math.max(this.m_lDrawingFirst-1,0);var _end=Math.min(this.m_lDrawingEnd+1,this.m_lPagesCount-1);for(var i=_start;i<=_end;i++){var rect=this.m_arrPages[i].drawingPage; var bIsCurrent=false;if(i==this.m_lDrawingFirst&&rect.top>_y)bIsCurrent=true;else if(rect.top<=_y&&_y<=rect.bottom)bIsCurrent=true;else if(i!=this.m_lPagesCount-1){if(_y>rect.bottom&&_yrect.bottom)bIsCurrent=true;if(bIsCurrent){var x_mm=(_x-rect.left)*dKoef;var y_mm=(_y-rect.top)*dKoef;if(true===bIsNoNormalize){if(x_mm>this.m_arrPages[i].width_mm+10)x_mm=this.m_arrPages[i].width_mm+ 10;if(x_mm<-10)x_mm=-10}return{X:x_mm,Y:y_mm,Page:rect.pageIndex,DrawPage:i}}}return{X:0,Y:0,Page:-1,DrawPage:-1}};this.ConvetToPageCoords=function(x,y,pageIndex){if(pageIndex<0||pageIndex>=this.m_lPagesCount)return{X:0,Y:0,Page:pageIndex,Error:true};var dKoef=100*g_dKoef_pix_to_mm/this.m_oWordControl.m_nZoomValue;var rect=this.m_arrPages[pageIndex].drawingPage;var _x=(x-rect.left)*dKoef;var _y=(y-rect.top)*dKoef;return{X:_x,Y:_y,Page:pageIndex,Error:false}};this.IsCursorInTableCur=function(x,y,page){var _table= this.TableOutlineDr.TableOutline;if(_table==null)return false;if(page!=_table.PageNum)return false;var _dist=this.TableOutlineDr.mover_size*g_dKoef_pix_to_mm;_dist*=100/this.m_oWordControl.m_nZoomValue;var _x=_table.X;var _y=_table.Y;var _r=_x+_table.W;var _b=_y+_table.H;if(x>_x-_dist&&x<_r&&y>_y-_dist&&y<_b)if(x<_x||y<_y){this.TableOutlineDr.Counter=0;this.TableOutlineDr.bIsNoTable=false;return true}return false};this.ConvertCoordsToCursorWR=function(x,y,pageIndex,transform,id_ruler_no_use){var dKoef= this.m_oWordControl.m_nZoomValue*g_dKoef_mm_to_pix/100;var _x=0;var _y=0;if(true==this.m_oWordControl.m_bIsRuler&&id_ruler_no_use!==false){_x=5*g_dKoef_mm_to_pix;_y=7*g_dKoef_mm_to_pix}if(pageIndex<0||pageIndex>=this.m_lPagesCount)return{X:0,Y:0,Error:true};var __x=x;var __y=y;if(transform){__x=transform.TransformPointX(x,y);__y=transform.TransformPointY(x,y)}var x_pix=this.m_arrPages[pageIndex].drawingPage.left+__x*dKoef+_x>>0;var y_pix=this.m_arrPages[pageIndex].drawingPage.top+__y*dKoef+_y>>0; return{X:x_pix,Y:y_pix,Error:false}};this.ConvertCoordsToCursor=function(x,y,pageIndex,bIsRul){var dKoef=this.m_oWordControl.m_nZoomValue*g_dKoef_mm_to_pix/100;var _x=0;var _y=0;if(true==this.m_oWordControl.m_bIsRuler)if(undefined==bIsRul);if(pageIndex<0||pageIndex>=this.m_lPagesCount)return{X:0,Y:0,Error:true};var x_pix=this.m_arrPages[pageIndex].drawingPage.left+x*dKoef+_x>>0;var y_pix=this.m_arrPages[pageIndex].drawingPage.top+y*dKoef+_y>>0;return{X:x_pix,Y:y_pix,Error:false};for(var i=this.m_lDrawingFirst;i<= this.m_lDrawingEnd;i++){var rect=this.m_arrPages[i].drawingPage;if(this.m_arrPages[i].pageIndex==pageIndex){var x_pix=rect.left+x*dKoef+_x>>0;var y_pix=rect.top+y*dKoef+_y>>0;return{X:x_pix,Y:y_pix,Error:false}}}return{X:0,Y:0,Error:true}};this.ConvertCoordsToCursor2=function(x,y,pageIndex,bIsRul){var dKoef=this.m_oWordControl.m_nZoomValue*g_dKoef_mm_to_pix/100;var _x=0;var _y=0;if(true==this.m_oWordControl.m_bIsRuler)if(undefined==bIsRul);if(pageIndex<0||pageIndex>=this.m_lPagesCount)return{X:0, Y:0,Error:true};var x_pix=this.m_arrPages[pageIndex].drawingPage.left+x*dKoef+_x-.5>>0;var y_pix=this.m_arrPages[pageIndex].drawingPage.top+y*dKoef+_y-.5>>0;return{X:x_pix,Y:y_pix,Error:false}};this.ConvertCoordsToCursor3=function(x,y,pageIndex,isGlobal){if(pageIndex<0||pageIndex>=this.m_lPagesCount)return{X:0,Y:0,Error:true};var dKoef=this.m_oWordControl.m_nZoomValue*g_dKoef_mm_to_pix/100;var _x=0;var _y=0;if(isGlobal){_x=this.m_oWordControl.X;_y=this.m_oWordControl.Y;if(true==this.m_oWordControl.m_bIsRuler){_x+= 5*g_dKoef_mm_to_pix;_y+=7*g_dKoef_mm_to_pix}}var x_pix=this.m_arrPages[pageIndex].drawingPage.left+x*dKoef+_x+.5>>0;var y_pix=this.m_arrPages[pageIndex].drawingPage.top+y*dKoef+_y+.5>>0;return{X:x_pix,Y:y_pix,Error:false}};this.ConvertCoordsToCursor4=function(x,y,pageIndex){if(pageIndex<0||pageIndex>=this.m_lPagesCount)return{X:0,Y:0,Error:true};var dKoef=this.m_oWordControl.m_nZoomValue*g_dKoef_mm_to_pix/100;var x_pix=this.m_arrPages[pageIndex].drawingPage.left+x*dKoef+.5>>0;var y_pix=this.m_arrPages[pageIndex].drawingPage.top+ y*dKoef+.5>>0;return{X:x_pix,Y:y_pix,Error:false}};this.InitViewer=function(){};this.TargetStart=function(){if(this.m_lTimerTargetId!=-1)clearInterval(this.m_lTimerTargetId);this.m_lTimerTargetId=setInterval(oThis.DrawTarget,500)};this.TargetEnd=function(){this.TargetShowFlag=false;this.TargetShowNeedFlag=false;if(this.m_lTimerTargetId!=-1){clearInterval(this.m_lTimerTargetId);this.m_lTimerTargetId=-1}this.showTarget(false)};this.UpdateTargetNoAttack=function(){if(null==this.m_oWordControl)return; this.CheckTargetDraw(this.m_dTargetX,this.m_dTargetY)};this.GetTargetStyle=function(){return"rgb("+this.TargetCursorColor.R+","+this.TargetCursorColor.G+","+this.TargetCursorColor.B+")"};this.SetTargetColor=function(r,g,b){this.TargetCursorColor.R=r;this.TargetCursorColor.G=g;this.TargetCursorColor.B=b};this.CheckTargetDraw=function(x,y){var _oldW=this.TargetHtmlElement.width;var _oldH=this.TargetHtmlElement.height;var _newW=2;var _newH=this.m_dTargetSize*this.m_oWordControl.m_nZoomValue*g_dKoef_mm_to_pix/ 100>>0;if(null!=this.TextMatrix&&!global_MatrixTransformer.IsIdentity2(this.TextMatrix)){var _x1=this.TextMatrix.TransformPointX(x,y);var _y1=this.TextMatrix.TransformPointY(x,y);var _x2=this.TextMatrix.TransformPointX(x,y+this.m_dTargetSize);var _y2=this.TextMatrix.TransformPointY(x,y+this.m_dTargetSize);var pos1=this.ConvertCoordsToCursor2(_x1,_y1,this.m_lCurrentPage);var pos2=this.ConvertCoordsToCursor2(_x2,_y2,this.m_lCurrentPage);_newW=(Math.abs(pos1.X-pos2.X)>>0)+1;_newH=(Math.abs(pos1.Y-pos2.Y)>> 0)+1;if(2>_newW)_newW=2;if(2>_newH)_newH=2;if(_oldW==_newW&&_oldH==_newH){if(_newW!=2&&_newH!=2)this.TargetHtmlElement.width=_newW}else{this.TargetHtmlElement.style.width=_newW+"px";this.TargetHtmlElement.style.height=_newH+"px";this.TargetHtmlElement.width=_newW;this.TargetHtmlElement.height=_newH}var ctx=this.TargetHtmlElement.getContext("2d");if(_newW==2||_newH==2){ctx.fillStyle=this.GetTargetStyle();ctx.fillRect(0,0,_newW,_newH)}else{ctx.beginPath();ctx.strokeStyle=this.GetTargetStyle();ctx.lineWidth= 2;if((pos1.X-pos2.X)*(pos1.Y-pos2.Y)>=0){ctx.moveTo(0,0);ctx.lineTo(_newW,_newH)}else{ctx.moveTo(0,_newH);ctx.lineTo(_newW,0)}ctx.stroke()}oThis.TargetHtmlElementLeft=Math.min(pos1.X,pos2.X)>>0;oThis.TargetHtmlElementTop=Math.min(pos1.Y,pos2.Y)>>0;if(!oThis.m_oWordControl.MobileTouchManager&&!AscCommon.AscBrowser.isSafariMacOs||!AscCommon.AscBrowser.isWebkit){oThis.TargetHtmlElement.style.left=oThis.TargetHtmlElementLeft+"px";oThis.TargetHtmlElement.style.top=oThis.TargetHtmlElementTop+"px"}else{oThis.TargetHtmlElement.style.left= "0px";oThis.TargetHtmlElement.style.top="0px";oThis.TargetHtmlElement.style["webkitTransform"]="matrix(1, 0, 0, 1, "+oThis.TargetHtmlElementLeft+","+oThis.TargetHtmlElementTop+")"}}else{if(_oldW==_newW&&_oldH==_newH)this.TargetHtmlElement.width=_newW;else{this.TargetHtmlElement.style.width=_newW+"px";this.TargetHtmlElement.style.height=_newH+"px";this.TargetHtmlElement.width=_newW;this.TargetHtmlElement.height=_newH}var ctx=this.TargetHtmlElement.getContext("2d");ctx.fillStyle=this.GetTargetStyle(); ctx.fillRect(0,0,_newW,_newH);if(null!=this.TextMatrix){x+=this.TextMatrix.tx;y+=this.TextMatrix.ty}var pos=this.ConvertCoordsToCursor2(x,y,this.m_lCurrentPage);this.TargetHtmlElementLeft=pos.X>>0;this.TargetHtmlElementTop=pos.Y>>0;if(!oThis.m_oWordControl.MobileTouchManager&&!AscCommon.AscBrowser.isSafariMacOs||!AscCommon.AscBrowser.isWebkit){this.TargetHtmlElement.style.left=this.TargetHtmlElementLeft+"px";this.TargetHtmlElement.style.top=this.TargetHtmlElementTop+"px"}else{oThis.TargetHtmlElement.style.left= "0px";oThis.TargetHtmlElement.style.top="0px";oThis.TargetHtmlElement.style["webkitTransform"]="matrix(1, 0, 0, 1, "+oThis.TargetHtmlElementLeft+","+oThis.TargetHtmlElementTop+")"}}this.MoveTargetInInputContext()};this.MoveTargetInInputContext=function(){if(AscCommon.g_inputContext)AscCommon.g_inputContext.move(this.TargetHtmlElementLeft,this.TargetHtmlElementTop)};this.UpdateTargetTransform=function(matrix){this.TextMatrix=matrix};this.MultiplyTargetTransform=function(matrix){if(!this.TextMatrix)this.TextMatrix= matrix;else if(matrix)this.TextMatrix.Multiply(matrix,AscCommon.MATRIX_ORDER_PREPEND)};this.UpdateTarget=function(x,y,pageIndex){if(this.m_oWordControl)this.m_oWordControl.m_oApi.checkLastWork();this.m_oWordControl.m_oLogicDocument.Set_TargetPos(x,y,pageIndex);if(window["NATIVE_EDITOR_ENJINE"])return;if(this.UpdateTargetFromPaint===false&&this.m_lCurrentPage!=-1){this.UpdateTargetCheck=true;return}var bNeedScrollToTarget=true;if(!this.isScrollToTargetAttack&&this.m_dTargetX==x&&this.m_dTargetY==y&& this.m_lTargetPage==pageIndex)bNeedScrollToTarget=false;this.isScrollToTargetAttack=false;if(-1!=this.m_lTimerUpdateTargetID){clearTimeout(this.m_lTimerUpdateTargetID);this.m_lTimerUpdateTargetID=-1}if(pageIndex>=this.m_arrPages.length)return;var bIsPageChanged=false;if(this.m_lCurrentPage!=pageIndex){this.m_lCurrentPage=pageIndex;this.m_oWordControl.SetCurrentPage2();this.m_oWordControl.OnScroll();bIsPageChanged=true}var targetSize=Number(this.m_dTargetSize*this.m_oWordControl.m_nZoomValue*g_dKoef_mm_to_pix/ 100);var pos=null;var __x=x;var __y=y;if(!this.TextMatrix)pos=this.ConvertCoordsToCursor2(x,y,this.m_lCurrentPage);else{__x=this.TextMatrix.TransformPointX(x,y);__y=this.TextMatrix.TransformPointY(x,y);pos=this.ConvertCoordsToCursor2(__x,__y,this.m_lCurrentPage)}if(true==pos.Error&&false==bIsPageChanged)return;var _ww=this.m_oWordControl.m_oEditor.HtmlElement.width;var _hh=this.m_oWordControl.m_oEditor.HtmlElement.height;_ww/=AscCommon.AscBrowser.retinaPixelRatio;_hh/=AscCommon.AscBrowser.retinaPixelRatio; var boxX=0;var boxY=0;var boxR=_ww-2;var boxB=_hh-targetSize;var nValueScrollHor=0;if(pos.XboxR){var _mem=__x+5-g_dKoef_pix_to_mm*_ww*100/this.m_oWordControl.m_nZoomValue;nValueScrollHor=this.m_oWordControl.GetHorizontalScrollTo(_mem,pageIndex)}var nValueScrollVer=0;if(pos.YboxB){var _mem=__y+targetSize+5-g_dKoef_pix_to_mm* _hh*100/this.m_oWordControl.m_nZoomValue;nValueScrollVer=this.m_oWordControl.GetVerticalScrollTo(_mem,pageIndex)}if(!bNeedScrollToTarget){nValueScrollHor=0;nValueScrollVer=0}if(0!=nValueScrollHor||0!=nValueScrollVer)if(this.m_oWordControl.m_bIsMouseUpSend===true&&AscCommon.global_keyboardEvent.ClickCount!=1){this.m_tempX=x;this.m_tempY=y;this.m_tempPageIndex=pageIndex;var oThis=this;this.m_lTimerUpdateTargetID=setTimeout(this.UpdateTargetTimer,100);return}this.m_dTargetX=x;this.m_dTargetY=y;this.m_lTargetPage= pageIndex;var isNeedScroll=false;if(0!=nValueScrollHor){isNeedScroll=true;this.m_oWordControl.m_bIsUpdateTargetNoAttack=true;var temp=nValueScrollHor*this.m_oWordControl.m_dScrollX_max/(this.m_oWordControl.m_dDocumentWidth-_ww);this.m_oWordControl.m_oScrollHorApi.scrollToX(parseInt(temp),false)}if(0!=nValueScrollVer){isNeedScroll=true;this.m_oWordControl.m_bIsUpdateTargetNoAttack=true;var temp=nValueScrollVer*this.m_oWordControl.m_dScrollY_max/(this.m_oWordControl.m_dDocumentHeight-_hh);this.m_oWordControl.m_oScrollVerApi.scrollToY(parseInt(temp), false)}if(true==isNeedScroll){this.m_oWordControl.m_bIsUpdateTargetNoAttack=true;this.m_oWordControl.OnScroll();return}this.CheckTargetDraw(x,y)};this.UpdateTarget2=function(x,y,pageIndex){if(pageIndex>=this.m_arrPages.length)return;this.m_oWordControl.m_oLogicDocument.Set_TargetPos(x,y,pageIndex);var bIsPageChanged=false;if(this.m_lCurrentPage!=pageIndex){this.m_lCurrentPage=pageIndex;this.m_oWordControl.SetCurrentPage2();this.m_oWordControl.OnScroll();bIsPageChanged=true}this.m_dTargetX=x;this.m_dTargetY= y;this.m_lTargetPage=pageIndex;var pos=this.ConvertCoordsToCursor(x,y,this.m_lCurrentPage);if(true==pos.Error&&false==bIsPageChanged)return;var _ww=this.m_oWordControl.m_oEditor.HtmlElement.width;var _hh=this.m_oWordControl.m_oEditor.HtmlElement.height;_ww/=AscCommon.AscBrowser.retinaPixelRatio;_hh/=AscCommon.AscBrowser.retinaPixelRatio;var boxX=0;var boxY=0;var boxR=_ww;var boxB=_hh;var nValueScrollHor=0;if(pos.X boxR){var _mem=x+5-g_dKoef_pix_to_mm*_ww*100/this.m_oWordControl.m_nZoomValue;nValueScrollHor=this.m_oWordControl.GetHorizontalScrollTo(_mem,pageIndex)}var nValueScrollVer=0;if(pos.YboxB){var _mem=y+this.m_dTargetSize+5-g_dKoef_pix_to_mm*_hh*100/this.m_oWordControl.m_nZoomValue;nValueScrollVer=this.m_oWordControl.GetVerticalScrollTo(_mem,pageIndex)}var isNeedScroll=false;if(0!=nValueScrollHor){isNeedScroll=true; var temp=nValueScrollHor*this.m_oWordControl.m_dScrollX_max/(this.m_oWordControl.m_dDocumentWidth-_ww);this.m_oWordControl.m_oScrollHorApi.scrollToX(parseInt(temp),false)}if(0!=nValueScrollVer){isNeedScroll=true;var temp=nValueScrollVer*this.m_oWordControl.m_dScrollY_max/(this.m_oWordControl.m_dDocumentHeight-_hh);this.m_oWordControl.m_oScrollVerApi.scrollToY(parseInt(temp),false)}if(true==isNeedScroll){this.m_oWordControl.OnScroll();return}};this.UpdateTargetTimer=function(){var x=oThis.m_tempX; var y=oThis.m_tempY;var pageIndex=oThis.m_tempPageIndex;oThis.m_lTimerUpdateTargetID=-1;if(pageIndex>=oThis.m_arrPages.length)return;var oWordControl=oThis.m_oWordControl;var bIsPageChanged=false;if(oThis.m_lCurrentPage!=pageIndex){oThis.m_lCurrentPage=pageIndex;oWordControl.SetCurrentPage2();oWordControl.OnScroll();bIsPageChanged=true}oThis.m_dTargetX=x;oThis.m_dTargetY=y;oThis.m_lTargetPage=pageIndex;var targetSize=Number(oThis.m_dTargetSize*oWordControl.m_nZoomValue*g_dKoef_mm_to_pix/100);var pos= oThis.ConvertCoordsToCursor2(x,y,oThis.m_lCurrentPage);if(true===pos.Error&&false===bIsPageChanged)return;var boxX=0;var boxY=0;var boxR=oWordControl.m_oEditor.HtmlElement.width-2;var boxB=oWordControl.m_oEditor.HtmlElement.height-targetSize;var nValueScrollHor=0;if(pos.XboxR)nValueScrollHor=boxR-pos.X;var nValueScrollVer=0;if(pos.YboxB)nValueScrollVer=boxB-pos.Y;var isNeedScroll=false;if(0!=nValueScrollHor){isNeedScroll= true;oWordControl.m_bIsUpdateTargetNoAttack=true;oWordControl.m_oScrollHorApi.scrollByX(-nValueScrollHor,false)}if(0!=nValueScrollVer){isNeedScroll=true;oWordControl.m_bIsUpdateTargetNoAttack=true;oWordControl.m_oScrollVerApi.scrollByY(-nValueScrollVer,false)}if(true===isNeedScroll){oWordControl.m_bIsUpdateTargetNoAttack=true;oWordControl.OnScroll();return}oThis.TargetHtmlElementLeft=pos.X>>0;oThis.TargetHtmlElementTop=pos.Y>>0;oThis.TargetHtmlElement.style.left=oThis.TargetHtmlElementLeft+"px";oThis.TargetHtmlElement.style.top= oThis.TargetHtmlElementTop+"px"};this.SetTargetSize=function(size){this.m_dTargetSize=size};this.DrawTarget=function(){if(oThis.NeedTarget&&oThis.m_oWordControl.IsFocus)oThis.showTarget(!oThis.isShowTarget())};this.TargetShow=function(){this.TargetShowNeedFlag=true};this.CheckTargetShow=function(){if(this.TargetShowFlag&&this.TargetShowNeedFlag){this.showTarget(true);this.TargetShowNeedFlag=false;return}if(!this.TargetShowNeedFlag)return;this.TargetShowNeedFlag=false;if(-1==this.m_lTimerTargetId)this.TargetStart(); if(oThis.NeedTarget)this.showTarget(true);this.TargetShowFlag=true};this.StartTrackImage=function(obj,x,y,w,h,type,pagenum){};this.StartTrackTable=function(obj,transform){if(this.m_oWordControl.MobileTouchManager)if(!this.m_oWordControl.MobileTouchManager.TableStartTrack_Check)return;this.TableOutlineDr.TableOutline=obj;this.TableOutlineDr.Counter=0;this.TableOutlineDr.bIsNoTable=false;this.TableOutlineDr.CheckStartTrack(this.m_oWordControl,transform);if(this.m_oWordControl.MobileTouchManager)this.m_oWordControl.OnUpdateOverlay()}; this.EndTrackTable=function(pointer,bIsAttack){if(this.TableOutlineDr.TableOutline!=null)if(pointer==this.TableOutlineDr.TableOutline.Table||bIsAttack){this.TableOutlineDr.TableOutline=null;this.TableOutlineDr.Counter=0}};this.CheckTrackTable=function(){if(null==this.TableOutlineDr.TableOutline)return;if(this.TableOutlineDr.bIsNoTable&&this.TableOutlineDr.bIsTracked===false){this.TableOutlineDr.Counter++;if(this.TableOutlineDr.Counter>100){this.TableOutlineDr.TableOutline=null;this.m_oWordControl.OnUpdateOverlay()}}}; this.DrawFrameTrack=function(overlay){if(!this.FrameRect.IsActive)return;var _page=this.m_arrPages[this.FrameRect.PageIndex];var drPage=_page.drawingPage;var dKoefX=(drPage.right-drPage.left)/_page.width_mm;var dKoefY=(drPage.bottom-drPage.top)/_page.height_mm;var rPR=AscCommon.AscBrowser.retinaPixelRatio;var _x=(drPage.left+dKoefX*this.FrameRect.Rect.X)*rPR;var _y=(drPage.top+dKoefY*this.FrameRect.Rect.Y)*rPR;var _r=(drPage.left+dKoefX*this.FrameRect.Rect.R)*rPR;var _b=(drPage.top+dKoefY*this.FrameRect.Rect.B)* rPR;var ctx=overlay.m_oContext;ctx.strokeStyle="#939393";ctx.lineWidth=Math.round(rPR);ctx.beginPath();this.AutoShapesTrack.AddRectDashClever(ctx,_x>>0,_y>>0,_r>>0,_b>>0,2,2,true);ctx.beginPath();var _w=Math.round(4*rPR);var _wc=Math.round(5*rPR);var _x1=(_x>>0)+Math.round(rPR);var _y1=(_y>>0)+Math.round(rPR);var _x2=(_r>>0)-_w;var _y2=(_b>>0)-_w;var _xc=(_x+_r-_wc)/2>>0;var _yc=(_y+_b-_wc)/2>>0;ctx.rect(_x1,_y1,_w,_w);ctx.rect(_xc,_y1,_wc,_w);ctx.rect(_x2,_y1,_w,_w);ctx.rect(_x1,_yc,_w,_wc);ctx.rect(_x2, _yc,_w,_wc);ctx.rect(_x1,_y2,_w,_w);ctx.rect(_xc,_y2,_wc,_w);ctx.rect(_x2,_y2,_w,_w);ctx.fillStyle="#777777";ctx.fill();ctx.beginPath();overlay.CheckPoint(_x-_wc,_y-_wc);overlay.CheckPoint(_r+_wc,_b+_wc);if(this.FrameRect.IsTracked){_page=this.m_arrPages[this.FrameRect.Track.PageIndex];drPage=_page.drawingPage;dKoefX=(drPage.right-drPage.left)/_page.width_mm;dKoefY=(drPage.bottom-drPage.top)/_page.height_mm;var __x=(drPage.left+dKoefX*this.FrameRect.Track.L)*rPR>>0;var __y=(drPage.top+dKoefY*this.FrameRect.Track.T)* rPR>>0;var __r=(drPage.left+dKoefX*this.FrameRect.Track.R)*rPR>>0;var __b=(drPage.top+dKoefY*this.FrameRect.Track.B)*rPR>>0;if(__xoverlay.max_x)overlay.max_x=__r;if(__yoverlay.max_y)overlay.max_y=__b;ctx.strokeStyle="#FFFFFF";ctx.beginPath();ctx.rect(__x+.5*Math.round(rPR),__y+.5*Math.round(rPR),__r-__x,__b-__y);ctx.stroke();ctx.strokeStyle="#000000";ctx.beginPath();this.AutoShapesTrack.AddRectDashClever(ctx,__x,__y,__r, __b,3,3,true);ctx.beginPath()}};this.OnDrawContentControl=function(obj,state,geom){return this.contentControls.OnDrawContentControl(obj,state,geom)};this.DrawMathTrack=function(overlay){if(!this.MathTrack.IsActive())return;overlay.Show();var nIndex,nCount;var oPath;var _page,drPage,dKoefX,dKoefY;var PathLng=this.MathTrack.GetPolygonsCount();var textMatrix=null==this.TextMatrix||global_MatrixTransformer.IsIdentity(this.TextMatrix)?null:this.TextMatrix;for(nIndex=0;nIndexoverlay.max_x)overlay.max_x=_r;if(_yoverlay.max_y)overlay.max_y=_b;var ctx=overlay.m_oContext; ctx.fillStyle="#375082";ctx.beginPath();this.AutoShapesTrack.AddRect(ctx,_x>>0,_y>>0,_r>>0,_b>>0);ctx.globalAlpha=.2;ctx.fill();ctx.globalAlpha=1;ctx.beginPath()}else{var _arrSelect=TransformRectByMatrix(this.TextMatrix,[FieldRect.X0,FieldRect.Y0,FieldRect.X1,FieldRect.Y1],drPage.left,drPage.top,dKoefX,dKoefY);overlay.CheckPoint(_arrSelect[0],_arrSelect[1]);overlay.CheckPoint(_arrSelect[2],_arrSelect[3]);overlay.CheckPoint(_arrSelect[4],_arrSelect[5]);overlay.CheckPoint(_arrSelect[6],_arrSelect[7]); var ctx=overlay.m_oContext;ctx.fillStyle="#375082";ctx.beginPath();ctx.moveTo(_arrSelect[0],_arrSelect[1]);ctx.lineTo(_arrSelect[2],_arrSelect[3]);ctx.lineTo(_arrSelect[4],_arrSelect[5]);ctx.lineTo(_arrSelect[6],_arrSelect[7]);ctx.closePath();ctx.globalAlpha=.2;ctx.fill();ctx.globalAlpha=1;ctx.beginPath()}}};this.DrawTableTrack=function(overlay){if(null==this.TableOutlineDr.TableOutline)return;var _table=this.TableOutlineDr.TableOutline.Table;if(!_table.Is_Inline()||this.TableOutlineDr.IsResizeTableTrack){if(null== this.TableOutlineDr.CurPos)return;var _page=this.m_arrPages[this.TableOutlineDr.CurPos.Page];var drPage=_page.drawingPage;var rPR=AscCommon.AscBrowser.retinaPixelRatio;var dKoefX=(drPage.right-drPage.left)/_page.width_mm;var dKoefY=(drPage.bottom-drPage.top)/_page.height_mm;var indent=.5*Math.round(rPR);if(!this.TableOutlineDr.TableMatrix||global_MatrixTransformer.IsIdentity(this.TableOutlineDr.TableMatrix)){var _x=((drPage.left+dKoefX*this.TableOutlineDr.CurPos.X)*rPR>>0)+indent;var _y=(drPage.top+ dKoefY*this.TableOutlineDr.CurPos.Y>>0)*rPR+indent;var _r=_x+(dKoefX*this.TableOutlineDr.TableOutline.W*rPR>>0);var _b=_y+(dKoefY*this.TableOutlineDr.TableOutline.H*rPR>>0);if(this.TableOutlineDr.IsResizeTableTrack){var _lastBounds=this.TableOutlineDr.getLastPageBounds();var _lastX=_lastBounds.X;var _lastY=this.TableOutlineDr.getFullTopPosition(_lastBounds);var _lastYStart=_lastBounds.Y;_x=((drPage.left+dKoefX*_lastX)*rPR>>0)+indent;_y=((drPage.top+dKoefY*_lastY)*rPR>>0)+indent;var _yStart=((drPage.top+ dKoefY*_lastYStart)*rPR>>0)+indent;_r=_x+(dKoefX*(_lastBounds.W+this.TableOutlineDr.AddResizeCurrentW)*rPR>>0);_b=_yStart+(dKoefY*(_lastBounds.H+this.TableOutlineDr.AddResizeCurrentH)*rPR>>0)}overlay.CheckPoint(_x,_y);overlay.CheckPoint(_x,_b);overlay.CheckPoint(_r,_y);overlay.CheckPoint(_r,_b);var ctx=overlay.m_oContext;ctx.strokeStyle="#FFFFFF";ctx.beginPath();ctx.rect(_x,_y,_r-_x,_b-_y);ctx.lineWidth=Math.round(rPR);ctx.stroke();ctx.strokeStyle="#000000";ctx.beginPath();var dot_size=3*Math.round(rPR); for(var i=_x;i<_r;i+=dot_size){ctx.moveTo(i,_y);i+=dot_size;if(i>_r)i=_r;ctx.lineTo(i,_y)}for(var i=_y;i<_b;i+=dot_size){ctx.moveTo(_r,i);i+=dot_size;if(i>_b)i=_b;ctx.lineTo(_r,i)}for(var i=_r;i>_x;i-=dot_size){ctx.moveTo(i,_b);i-=dot_size;if(i<_x)i=_x;ctx.lineTo(i,_b)}for(var i=_b;i>_y;i-=dot_size){ctx.moveTo(_x,i);i-=dot_size;if(i<_y)i=_y;ctx.lineTo(_x,i)}ctx.stroke();ctx.beginPath()}else{var _x=this.TableOutlineDr.CurPos.X+_table.GetTableOffsetCorrection();var _y=this.TableOutlineDr.CurPos.Y;var _r= _x+this.TableOutlineDr.TableOutline.W;var _b=_y+this.TableOutlineDr.TableOutline.H;if(this.TableOutlineDr.IsResizeTableTrack){_x=this.TableOutlineDr.TableOutline.X;_y=this.TableOutlineDr.TableOutline.Y;_r=_x+(this.TableOutlineDr.TableOutline.W+this.TableOutlineDr.AddResizeCurrentW);_b=_y+(this.TableOutlineDr.TableOutline.H+this.TableOutlineDr.AddResizeCurrentH)}var transform=this.TableOutlineDr.TableMatrix;var x1=transform.TransformPointX(_x,_y);var y1=transform.TransformPointY(_x,_y);var x2=transform.TransformPointX(_r, _y);var y2=transform.TransformPointY(_r,_y);var x3=transform.TransformPointX(_r,_b);var y3=transform.TransformPointY(_r,_b);var x4=transform.TransformPointX(_x,_b);var y4=transform.TransformPointY(_x,_b);x1=drPage.left+dKoefX*x1;y1=drPage.top+dKoefY*y1;x2=drPage.left+dKoefX*x2;y2=drPage.top+dKoefY*y2;x3=drPage.left+dKoefX*x3;y3=drPage.top+dKoefY*y3;x4=drPage.left+dKoefX*x4;y4=drPage.top+dKoefY*y4;overlay.CheckPoint(x1,y1);overlay.CheckPoint(x2,y2);overlay.CheckPoint(x3,y3);overlay.CheckPoint(x4,y4); var ctx=overlay.m_oContext;ctx.strokeStyle="#FFFFFF";ctx.beginPath();ctx.moveTo(x1,y1);ctx.lineTo(x2,y2);ctx.lineTo(x3,y3);ctx.lineTo(x4,y4);ctx.closePath();ctx.stroke();ctx.strokeStyle="#000000";ctx.beginPath();this.AutoShapesTrack.AddRectDash(ctx,x1,y1,x2,y2,x4,y4,x3,y3,3,3,true);ctx.beginPath()}}else{this.LockCursorType("default");var _x=global_mouseEvent.X;var _y=global_mouseEvent.Y;var posMouse=this.ConvertCoordsFromCursor2(_x,_y);this.TableOutlineDr.InlinePos=this.m_oWordControl.m_oLogicDocument.Get_NearestPos(posMouse.Page, posMouse.X,posMouse.Y);this.TableOutlineDr.InlinePos.Page=posMouse.Page;var _near=this.TableOutlineDr.InlinePos;this.AutoShapesTrack.SetCurrentPage(_near.Page);this.AutoShapesTrack.DrawInlineMoveCursor(_near.X,_near.Y,_near.Height,_near.transform)}};this.SetCurrentPage=function(PageIndex){if(PageIndex>=this.m_arrPages.length)return;if(this.m_lCurrentPage==PageIndex)return;this.m_lCurrentPage=PageIndex;this.m_oWordControl.SetCurrentPage()};this.SelectEnabled=function(bIsEnabled){this.m_bIsSelection= bIsEnabled;if(false===this.m_bIsSelection){this.SelectClear();this.m_oWordControl.OnUpdateOverlay();this.m_oWordControl.m_oOverlayApi.m_oContext.globalAlpha=1}};this.SelectClear=function(){if(this.m_oWordControl.MobileTouchManager){this.m_oWordControl.MobileTouchManager.RectSelect1=null;this.m_oWordControl.MobileTouchManager.RectSelect2=null}};this.SearchClear=function(){for(var i=0;i=this.m_lDrawingFirst&&r.PageNum<=this.m_lDrawingEnd)is_update=true}break}case search_HdrFtr_All:{for(var i=0;i<_len;i++){if(this.SearchTransform)rects[i].Transform=this.SearchTransform;this._search_HdrFtr_All[this._search_HdrFtr_All.length]=rects[i]}is_update=true;break}case search_HdrFtr_All_no_First:{for(var i=0;i<_len;i++){if(this.SearchTransform)rects[i].Transform= this.SearchTransform;this._search_HdrFtr_All_no_First[this._search_HdrFtr_All_no_First.length]=rects[i]}if(this.m_lDrawingEnd>0)is_update=true;break}case search_HdrFtr_First:{for(var i=0;i<_len;i++){if(this.SearchTransform)rects[i].Transform=this.SearchTransform;this._search_HdrFtr_First[this._search_HdrFtr_First.length]=rects[i]}if(this.m_lDrawingFirst==0)is_update=true;break}case search_HdrFtr_Even:{for(var i=0;i<_len;i++){if(this.SearchTransform)rects[i].Transform=this.SearchTransform;this._search_HdrFtr_Even[this._search_HdrFtr_Even.length]= rects[i]}var __c=this.m_lDrawingEnd-this.m_lDrawingFirst;if(__c>1)is_update=true;else if(__c==1&&(this.m_lDrawingFirst&1)==1)is_update=true;break}case search_HdrFtr_Odd:{for(var i=0;i<_len;i++){if(this.SearchTransform)rects[i].Transform=this.SearchTransform;this._search_HdrFtr_Odd[this._search_HdrFtr_Odd.length]=rects[i]}var __c=this.m_lDrawingEnd-this.m_lDrawingFirst;if(__c>1)is_update=true;else if(__c==1&&(this.m_lDrawingFirst&1)==0)is_update=true;break}case search_HdrFtr_Odd_no_First:{for(var i= 0;i<_len;i++){if(this.SearchTransform)rects[i].Transform=this.SearchTransform;this._search_HdrFtr_Odd_no_First[this._search_HdrFtr_Odd_no_First.length]=rects[i]}if(this.m_lDrawingEnd>1){var __c=this.m_lDrawingEnd-this.m_lDrawingFirst;if(__c>1)is_update=true;else if(__c==1&&(this.m_lDrawingFirst&1)==0)is_update=true}break}default:break}if(is_update)this.m_oWordControl.OnUpdateOverlay()};this.StartSearchTransform=function(transform){this.SearchTransform=transform.CreateDublicate()};this.EndSearchTransform= function(){this.SearchTransform=null};this.StartSearch=function(){this.SearchClear();if(this.m_bIsSelection)this.m_oWordControl.OnUpdateOverlay();this.m_bIsSearching=true};this.EndSearch=function(bIsChange){if(bIsChange){this.SearchClear();this.m_bIsSearching=false;this.m_oWordControl.OnUpdateOverlay()}else{this.m_bIsSearching=true;this.m_oWordControl.OnUpdateOverlay()}this.m_oWordControl.m_oApi.sync_SearchEndCallback()};this.SetTextSelectionOutline=function(isSelectionOutline){this.IsTextSelectionOutline= isSelectionOutline};this.private_StartDrawSelection=function(overlay,isSelect2){this.Overlay=overlay;this.IsTextMatrixUse=null!=this.TextMatrix&&!global_MatrixTransformer.IsIdentity(this.TextMatrix);this.Overlay.m_oContext.fillStyle="rgba(51,102,204,255)";this.Overlay.m_oContext.beginPath();if(this.m_oWordControl.MobileTouchManager&&true!==isSelect2){this.m_oWordControl.MobileTouchManager.RectSelect1=null;this.m_oWordControl.MobileTouchManager.RectSelect2=null}};this.private_EndDrawSelection=function(){var ctx= this.Overlay.m_oContext;ctx.globalAlpha=.2;ctx.fill();if(this.IsTextMatrixUse&&this.IsTextSelectionOutline){ctx.strokeStyle="#9ADBFE";ctx.lineWidth=Math.round(AscCommon.AscBrowser.retinaPixelRatio);ctx.globalAlpha=1;ctx.stroke()}ctx.beginPath();ctx.globalAlpha=1;this.IsTextMatrixUse=false;this.Overlay=null};this.AddPageSelection=function(pageIndex,x,y,w,h){if(null==this.SelectionMatrix)this.SelectionMatrix=this.TextMatrix;this.IsTextMatrixUse=null!=this.TextMatrix&&!global_MatrixTransformer.IsIdentity(this.TextMatrix); var rPR=AscCommon.AscBrowser.retinaPixelRatio;var page=this.m_arrPages[pageIndex];var drawPage=page.drawingPage;var dKoefX=(drawPage.right-drawPage.left)/page.width_mm;var dKoefY=(drawPage.bottom-drawPage.top)/page.height_mm;if(!this.IsTextMatrixUse){var _x=drawPage.left+dKoefX*x>>0;var _y=drawPage.top+dKoefY*y>>0;var _r=drawPage.left+dKoefX*(x+w)>>0;var _b=drawPage.top+dKoefY*(y+h)>>0;var _w=_r-_x+1;var _h=_b-_y+1;this.Overlay.CheckRect(rPR*_x,rPR*_y,rPR*_w,rPR*_h);this.Overlay.m_oContext.rect(rPR* _x>>0,rPR*_y>>0,_w*rPR>>0,_h*rPR>>0)}else{var _x1=this.TextMatrix.TransformPointX(x,y);var _y1=this.TextMatrix.TransformPointY(x,y);var _x2=this.TextMatrix.TransformPointX(x+w,y);var _y2=this.TextMatrix.TransformPointY(x+w,y);var _x3=this.TextMatrix.TransformPointX(x+w,y+h);var _y3=this.TextMatrix.TransformPointY(x+w,y+h);var _x4=this.TextMatrix.TransformPointX(x,y+h);var _y4=this.TextMatrix.TransformPointY(x,y+h);var x1=(drawPage.left+dKoefX*_x1)*rPR;var y1=(drawPage.top+dKoefY*_y1)*rPR;var x2=(drawPage.left+ dKoefX*_x2)*rPR;var y2=(drawPage.top+dKoefY*_y2)*rPR;var x3=(drawPage.left+dKoefX*_x3)*rPR;var y3=(drawPage.top+dKoefY*_y3)*rPR;var x4=(drawPage.left+dKoefX*_x4)*rPR;var y4=(drawPage.top+dKoefY*_y4)*rPR;if(global_MatrixTransformer.IsIdentity2(this.TextMatrix)){var indent=.5*Math.round(rPR);x1=(x1>>0)+indent;y1=(y1>>0)+indent;x2=(x2>>0)+indent;y2=(y2>>0)+indent;x3=(x3>>0)+indent;y3=(y3>>0)+indent;x4=(x4>>0)+indent;y4=(y4>>0)+indent}this.Overlay.CheckPoint(x1,y1);this.Overlay.CheckPoint(x2,y2);this.Overlay.CheckPoint(x3, y3);this.Overlay.CheckPoint(x4,y4);var ctx=this.Overlay.m_oContext;ctx.moveTo(x1,y1);ctx.lineTo(x2,y2);ctx.lineTo(x3,y3);ctx.lineTo(x4,y4);ctx.closePath()}};this.AddPageSelection2=function(pageIndex,x,y,w,h){if(!this.OverlaySelection2.Data)this.OverlaySelection2.Data=[];this.OverlaySelection2.Data.push([pageIndex,x,y,w,h])};this.DrawPageSelection2=function(overlay){if(this.OverlaySelection2.Data){this.private_StartDrawSelection(overlay,true);var len=this.OverlaySelection2.Data.length;var value;for(var i= 0;i>0,pos1.Y>>0);ctx.lineTo(pos2.X>>0,pos2.Y>>0);ctx.moveTo(pos3.X>>0,pos3.Y>>0);ctx.lineTo(pos4.X>>0,pos4.Y>> 0);ctx.lineWidth=2;ctx.stroke();ctx.beginPath();ctx.fillStyle="#1B63BA";overlay.AddEllipse(pos1.X,pos1.Y-5,5);overlay.AddEllipse(pos4.X,pos4.Y+5,5);ctx.fill()}else{var _xx11=_matrix.TransformPointX(_rect1.X,_rect1.Y);var _yy11=_matrix.TransformPointY(_rect1.X,_rect1.Y);var _xx12=_matrix.TransformPointX(_rect1.X,_rect1.Y+_rect1.H);var _yy12=_matrix.TransformPointY(_rect1.X,_rect1.Y+_rect1.H);var _xx21=_matrix.TransformPointX(_rect2.X+_rect2.W,_rect2.Y);var _yy21=_matrix.TransformPointY(_rect2.X+_rect2.W, _rect2.Y);var _xx22=_matrix.TransformPointX(_rect2.X+_rect2.W,_rect2.Y+_rect2.H);var _yy22=_matrix.TransformPointY(_rect2.X+_rect2.W,_rect2.Y+_rect2.H);pos1=this.ConvertCoordsToCursorWR(_xx11,_yy11,_rect1.Page,undefined,false);pos2=this.ConvertCoordsToCursorWR(_xx12,_yy12,_rect1.Page,undefined,false);pos3=this.ConvertCoordsToCursorWR(_xx21,_yy21,_rect2.Page,undefined,false);pos4=this.ConvertCoordsToCursorWR(_xx22,_yy22,_rect2.Page,undefined,false);ctx.strokeStyle="#1B63BA";ctx.moveTo(pos1.X,pos1.Y); ctx.lineTo(pos2.X,pos2.Y);ctx.moveTo(pos3.X,pos3.Y);ctx.lineTo(pos4.X,pos4.Y);ctx.lineWidth=2;ctx.stroke();ctx.beginPath();ctx.fillStyle="#1B63BA";overlay.AddEllipse(pos1.X,pos1.Y-5,5);overlay.AddEllipse(pos4.X,pos4.Y+5,5);ctx.fill()}};this.SelectShow=function(){this.m_oWordControl.OnUpdateOverlay()};this.OnUpdateOverlay=function(){this.m_oWordControl.OnUpdateOverlay()};this.Set_RulerState_Start=function(){this.UpdateRulerStateFlag=true};this.Set_RulerState_End=function(){if(this.UpdateRulerStateFlag){this.UpdateRulerStateFlag= false;if(this.UpdateRulerStateParams.length>0){switch(this.UpdateRulerStateParams[0]){case 0:{this.Set_RulerState_Table(this.UpdateRulerStateParams[1],this.UpdateRulerStateParams[2]);break}case 1:{this.Set_RulerState_Paragraph(this.UpdateRulerStateParams[1],this.UpdateRulerStateParams[2]);break}case 2:{this.Set_RulerState_HdrFtr(this.UpdateRulerStateParams[1],this.UpdateRulerStateParams[2],this.UpdateRulerStateParams[3]);break}case 3:{this.Set_RulerState_Columns(this.UpdateRulerStateParams[1]);break}default:break}this.UpdateRulerStateParams= []}}};this.Set_RulerState_Table=function(markup,transform){if(this.UpdateRulerStateFlag){this.UpdateRulerStateParams.splice(0,this.UpdateRulerStateParams.length);this.UpdateRulerStateParams.push(0);this.UpdateRulerStateParams.push(markup);this.UpdateRulerStateParams.push(transform);return}this.FrameRect.IsActive=false;var hor_ruler=this.m_oWordControl.m_oHorRuler;var ver_ruler=this.m_oWordControl.m_oVerRuler;hor_ruler.CurrentObjectType=RULER_OBJECT_TYPE_TABLE;hor_ruler.m_oTableMarkup=markup.CreateDublicate(); ver_ruler.CurrentObjectType=RULER_OBJECT_TYPE_TABLE;ver_ruler.m_oTableMarkup=markup.CreateDublicate();this.TableOutlineDr.TableMatrix=null;this.TableOutlineDr.CurrentPageIndex=this.m_lCurrentPage;if(transform){hor_ruler.m_oTableMarkup.TransformX=transform.tx;hor_ruler.m_oTableMarkup.TransformY=transform.ty;ver_ruler.m_oTableMarkup.TransformX=transform.tx;ver_ruler.m_oTableMarkup.TransformY=transform.ty;hor_ruler.m_oTableMarkup.CorrectFrom();ver_ruler.m_oTableMarkup.CorrectFrom();this.TableOutlineDr.TableMatrix= transform.CreateDublicate()}hor_ruler.CalculateMargins();if(0<=this.m_lCurrentPage&&this.m_lCurrentPage>0)*2.5};this.UpdateTableRuler=function(isCols,index,position){var dKoef_mm_to_pix=g_dKoef_mm_to_pix*this.m_oWordControl.m_nZoomValue/100;if(false=== isCols){var markup=this.m_oWordControl.m_oVerRuler.m_oTableMarkup;if(markup==null)return;position+=markup.TransformY;if(0==index){var delta=position-markup.Rows[0].Y;markup.Rows[0].Y=position;markup.Rows[0].H-=delta}else{var delta=markup.Rows[index-1].Y+markup.Rows[index-1].H-position;markup.Rows[index-1].H-=delta;if(index!=markup.Rows.length){markup.Rows[index].Y-=delta;markup.Rows[index].H+=delta}}if("none"==this.m_oWordControl.m_oOverlay.HtmlElement.style.display)this.m_oWordControl.ShowOverlay(); this.m_oWordControl.UpdateVerRulerBack();this.m_oWordControl.m_oOverlayApi.HorLine(this.m_arrPages[this.m_lCurrentPage].drawingPage.top+position*dKoef_mm_to_pix)}else{var markup=this.m_oWordControl.m_oHorRuler.m_oTableMarkup;if(markup==null)return;position+=markup.TransformX;if(0==index){var _add=markup.X-position;markup.X=position;if(markup.Cols.length>0)markup.Cols[0]+=_add}else{var _start=markup.X;for(var i=0;i=dAspect2){_w=dAspect2*_height;_x=(_width-_w)/2}else{_h=_w/dAspect2;_y=(_height-_h)/2}this.GuiCanvasFillTextureCtx.drawImage(_img.Image,_x,_y,_w,_h)}else if(!_img||!_img.Image){this.GuiCanvasFillTextureCtx.lineWidth=1;this.GuiCanvasFillTextureCtx.beginPath();this.GuiCanvasFillTextureCtx.moveTo(0,0);this.GuiCanvasFillTextureCtx.lineTo(_width,_height);this.GuiCanvasFillTextureCtx.moveTo(_width,0);this.GuiCanvasFillTextureCtx.lineTo(0,_height);this.GuiCanvasFillTextureCtx.strokeStyle= "#FF0000";this.GuiCanvasFillTextureCtx.stroke();this.GuiCanvasFillTextureCtx.beginPath();this.GuiCanvasFillTextureCtx.moveTo(0,0);this.GuiCanvasFillTextureCtx.lineTo(_width,0);this.GuiCanvasFillTextureCtx.lineTo(_width,_height);this.GuiCanvasFillTextureCtx.lineTo(0,_height);this.GuiCanvasFillTextureCtx.closePath();this.GuiCanvasFillTextureCtx.strokeStyle="#000000";this.GuiCanvasFillTextureCtx.stroke();this.GuiCanvasFillTextureCtx.beginPath()}};this.InitGuiCanvasShape=function(div_id){if(null!=this.GuiCanvasFillTexture){var _div_elem= document.getElementById(this.GuiCanvasFillTextureParentId);if(_div_elem)_div_elem.removeChild(this.GuiCanvasFillTexture);this.GuiCanvasFillTexture=null;this.GuiCanvasFillTextureCtx=null}this.GuiCanvasFillTextureParentId=div_id;var _div_elem=document.getElementById(this.GuiCanvasFillTextureParentId);if(!_div_elem)return;this.GuiCanvasFillTexture=document.createElement("canvas");this.GuiCanvasFillTexture.width=parseInt(_div_elem.style.width);this.GuiCanvasFillTexture.height=parseInt(_div_elem.style.height); this.LastDrawingUrl="";this.GuiCanvasFillTextureCtx=this.GuiCanvasFillTexture.getContext("2d");_div_elem.appendChild(this.GuiCanvasFillTexture)};this.InitGuiCanvasTextProps=function(div_id){var _div_elem=document.getElementById(div_id);if(null!=this.GuiCanvasTextProps){var elem=_div_elem.getElementsByTagName("canvas");if(elem.length==0)_div_elem.appendChild(this.GuiCanvasTextProps);else{var _width=parseInt(_div_elem.offsetWidth);var _height=parseInt(_div_elem.offsetHeight);if(0==_width)_width=300; if(0==_height)_height=80;this.GuiCanvasTextProps.style.width=_width+"px";this.GuiCanvasTextProps.style.height=_height+"px"}var old_width=this.GuiCanvasTextProps.width;var old_height=this.GuiCanvasTextProps.height;AscCommon.calculateCanvasSize(this.GuiCanvasTextProps);if(old_width!==this.GuiCanvasTextProps.width||old_height!==this.GuiCanvasTextProps.height)this.GuiLastTextProps=null}else{this.GuiCanvasTextProps=document.createElement("canvas");this.GuiCanvasTextProps.style.position="absolute";this.GuiCanvasTextProps.style.left= "0px";this.GuiCanvasTextProps.style.top="0px";var _width=parseInt(_div_elem.offsetWidth);var _height=parseInt(_div_elem.offsetHeight);if(0==_width)_width=300;if(0==_height)_height=80;this.GuiCanvasTextProps.style.width=_width+"px";this.GuiCanvasTextProps.style.height=_height+"px";AscCommon.calculateCanvasSize(this.GuiCanvasTextProps);_div_elem.appendChild(this.GuiCanvasTextProps)}};this.DrawGuiCanvasTextProps=function(props){var bIsChange=false;if(null==this.GuiLastTextProps){bIsChange=true;this.GuiLastTextProps= new Asc.asc_CParagraphProperty;this.GuiLastTextProps.Subscript=props.Subscript;this.GuiLastTextProps.Superscript=props.Superscript;this.GuiLastTextProps.SmallCaps=props.SmallCaps;this.GuiLastTextProps.AllCaps=props.AllCaps;this.GuiLastTextProps.Strikeout=props.Strikeout;this.GuiLastTextProps.DStrikeout=props.DStrikeout;this.GuiLastTextProps.TextSpacing=props.TextSpacing;this.GuiLastTextProps.Position=props.Position}else{if(this.GuiLastTextProps.Subscript!=props.Subscript){this.GuiLastTextProps.Subscript= props.Subscript;bIsChange=true}if(this.GuiLastTextProps.Superscript!=props.Superscript){this.GuiLastTextProps.Superscript=props.Superscript;bIsChange=true}if(this.GuiLastTextProps.SmallCaps!=props.SmallCaps){this.GuiLastTextProps.SmallCaps=props.SmallCaps;bIsChange=true}if(this.GuiLastTextProps.AllCaps!=props.AllCaps){this.GuiLastTextProps.AllCaps=props.AllCaps;bIsChange=true}if(this.GuiLastTextProps.Strikeout!=props.Strikeout){this.GuiLastTextProps.Strikeout=props.Strikeout;bIsChange=true}if(this.GuiLastTextProps.DStrikeout!= props.DStrikeout){this.GuiLastTextProps.DStrikeout=props.DStrikeout;bIsChange=true}if(this.GuiLastTextProps.TextSpacing!=props.TextSpacing){this.GuiLastTextProps.TextSpacing=props.TextSpacing;bIsChange=true}if(this.GuiLastTextProps.Position!=props.Position){this.GuiLastTextProps.Position=props.Position;bIsChange=true}}if(undefined!==this.GuiLastTextProps.Position&&isNaN(this.GuiLastTextProps.Position))this.GuiLastTextProps.Position=undefined;if(undefined!==this.GuiLastTextProps.TextSpacing&&isNaN(this.GuiLastTextProps.TextSpacing))this.GuiLastTextProps.TextSpacing= undefined;if(!bIsChange)return;History.TurnOff();var _oldTurn=editor.isViewMode;editor.isViewMode=true;var par=new Paragraph(this,this.m_oWordControl.m_oLogicDocument);par.MoveCursorToStartPos();var _paraPr=new CParaPr;par.Pr=_paraPr;var _textPr=new CTextPr;_textPr.FontFamily={Name:"Arial",Index:-1};_textPr.FontSize=(AscCommon.AscBrowser.convertToRetinaValue(11<<1,true)>>0)*.5;_textPr.RFonts.SetAll("Arial");_textPr.Strikeout=this.GuiLastTextProps.Strikeout;if(true===this.GuiLastTextProps.Subscript)_textPr.VertAlign= AscCommon.vertalign_SubScript;else if(true===this.GuiLastTextProps.Superscript)_textPr.VertAlign=AscCommon.vertalign_SuperScript;else _textPr.VertAlign=AscCommon.vertalign_Baseline;_textPr.DStrikeout=this.GuiLastTextProps.DStrikeout;_textPr.Caps=this.GuiLastTextProps.AllCaps;_textPr.SmallCaps=this.GuiLastTextProps.SmallCaps;_textPr.Spacing=this.GuiLastTextProps.TextSpacing;_textPr.Position=this.GuiLastTextProps.Position;var parRun=new ParaRun(par);parRun.Set_Pr(_textPr);parRun.AddText("Hello World"); par.AddToContent(0,parRun);par.Reset(0,0,1E3,1E3,0,0,1);par.Recalculate_Page(0);var baseLineOffset=par.Lines[0].Y;var _bounds=par.Get_PageBounds(0);var ctx=this.GuiCanvasTextProps.getContext("2d");var _wPx=this.GuiCanvasTextProps.width;var _hPx=this.GuiCanvasTextProps.height;var _wMm=_wPx*g_dKoef_pix_to_mm;var _hMm=_hPx*g_dKoef_pix_to_mm;ctx.fillStyle="#FFFFFF";ctx.fillRect(0,0,_wPx,_hPx);var _pxBoundsW=par.Lines[0].Ranges[0].W*g_dKoef_mm_to_pix;var _pxBoundsH=(_bounds.Bottom-_bounds.Top)*g_dKoef_mm_to_pix; if(this.GuiLastTextProps.Position!==undefined&&this.GuiLastTextProps.Position!=null&&this.GuiLastTextProps.Position!=0);if(_pxBoundsH<_hPx&&_pxBoundsW<_wPx){var _lineY=((_hPx+_pxBoundsH)/2>>0)+.5;var _lineW=(_wPx-_pxBoundsW)/4>>0;ctx.strokeStyle="#000000";ctx.lineWidth=1;ctx.beginPath();ctx.moveTo(0,_lineY);ctx.lineTo(_lineW,_lineY);ctx.moveTo(_wPx-_lineW,_lineY);ctx.lineTo(_wPx,_lineY);ctx.stroke();ctx.beginPath()}var _yOffset=(_hPx+_pxBoundsH)/2-baseLineOffset*g_dKoef_mm_to_pix>>0;var _xOffset= (_wPx-_pxBoundsW)/2>>0;var graphics=new AscCommon.CGraphics;graphics.init(ctx,_wPx,_hPx,_wMm,_hMm);graphics.m_oFontManager=AscCommon.g_fontManager;graphics.m_oCoordTransform.tx=_xOffset;graphics.m_oCoordTransform.ty=_yOffset;graphics.transform(1,0,0,1,0,0);var old_marks=this.m_oWordControl.m_oApi.ShowParaMarks;this.m_oWordControl.m_oApi.ShowParaMarks=false;par.Draw(0,graphics);this.m_oWordControl.m_oApi.ShowParaMarks=old_marks;History.TurnOn();editor.isViewMode=_oldTurn};this.SetDrawImagePlaceContents= function(id,props){var _div_elem=null;if(null==id||""==id){if(""!=this.GuiCanvasFillTOCParentId){_div_elem=document.getElementById(this.GuiCanvasFillTOCParentId);if(this.GuiCanvasFillTOC&&_div_elem)_div_elem.removeChild(this.GuiCanvasFillTOC);this.GuiCanvasFillTOCParentId="";this.GuiCanvasFillTOC=null}return}if(id!=this.GuiCanvasFillTOCParentId){_div_elem=document.getElementById(this.GuiCanvasFillTOCParentId);if(this.GuiCanvasFillTOC&&_div_elem)_div_elem.removeChild(this.GuiCanvasFillTOC);this.GuiCanvasFillTOCParentId= "";this.GuiCanvasFillTOC=null}this.GuiCanvasFillTOCParentId=id;_div_elem=document.getElementById(this.GuiCanvasFillTOCParentId);if(!_div_elem)return;var widthPx=_div_elem.offsetWidth;var heightPx=_div_elem.offsetHeight;if(null==this.GuiCanvasFillTOC){this.GuiCanvasFillTOC=document.createElement("canvas");_div_elem.appendChild(this.GuiCanvasFillTOC)}var wPx=AscBrowser.convertToRetinaValue(widthPx,true);var hPx=AscBrowser.convertToRetinaValue(heightPx,true);var wMm=wPx*g_dKoef_pix_to_mm/AscCommon.AscBrowser.retinaPixelRatio; var hMm=hPx*g_dKoef_pix_to_mm/AscCommon.AscBrowser.retinaPixelRatio;var wPxOffset=AscBrowser.convertToRetinaValue(8,true);var wMmOffset=wPxOffset*g_dKoef_pix_to_mm/AscCommon.AscBrowser.retinaPixelRatio;this.GuiCanvasFillTOC.style.width=widthPx+"px";this.GuiCanvasFillTOC.width=wPx;History.TurnOff();var oLogicDocument=this.m_oWordControl.m_oLogicDocument;var bTrackRevisions=false;if(oLogicDocument.IsTrackRevisions()){bTrackRevisions=oLogicDocument.GetLocalTrackRevisions();oLogicDocument.SetLocalTrackRevisions(false)}var _oldTurn= editor.isViewMode;editor.isViewMode=true;var ctx=this.GuiCanvasFillTOC.getContext("2d");var old_marks=this.m_oWordControl.m_oApi.ShowParaMarks;this.m_oWordControl.m_oApi.ShowParaMarks=false;var oStyles=oLogicDocument.GetStyles();var oHeader=new CHeaderFooter(oLogicDocument.HdrFtr,oLogicDocument,this,AscCommon.hdrftr_Header);var oDocumentContent=oHeader.GetContent();var nOutlineStart=props.get_OutlineStart();var nOutlineEnd=props.get_OutlineEnd();var nStylesType=props.get_StylesType();var isShowPageNum= props.get_ShowPageNumbers();var isRightTab=props.get_RightAlignTab();var nTabLeader=props.get_TabLeader();if(undefined===nTabLeader||null===nTabLeader)nTabLeader=Asc.c_oAscTabLeader.Dot;var arrLevels=[];var arrStylesToDelete=[];var nStyle,nStylesCount,nAddStyle,nAddStyleCount;var nLvl,sName,sStyleId,oStyle,isAddStyle;for(nStyle=0,nStylesCount=props.get_StylesCount();nStyle>0;if(nContentHeightPx>hPx){hPx=nContentHeightPx;hMm=nContentHeight}this.GuiCanvasFillTOC.style.height=AscBrowser.convertToRetinaValue(hPx, false)+"px";this.GuiCanvasFillTOC.height=hPx;var ctx=this.GuiCanvasFillTOC.getContext("2d");ctx.fillStyle="#FFFFFF";ctx.fillRect(0,0,wPx,hPx);var graphics=new AscCommon.CGraphics;graphics.init(ctx,wPx,hPx,wMm,hMm);graphics.m_oFontManager=AscCommon.g_fontManager;graphics.m_oCoordTransform.tx=graphics.m_oCoordTransform.ty=wPxOffset;graphics.transform(1,0,0,1,0,0);oDocumentContent.Draw(0,graphics);this.m_oWordControl.m_oApi.ShowParaMarks=old_marks;History.TurnOn();if(false!==bTrackRevisions)oLogicDocument.SetLocalTrackRevisions(bTrackRevisions); editor.isViewMode=_oldTurn};this.GetTOC_Buttons=function(idDiv1,idDiv2){var div1=document.getElementById(idDiv1);var div2=document.getElementById(idDiv2);var canvas1=div1.childNodes[0];var canvas2=div2.childNodes[0];var isAdd=false;if(!canvas1||!canvas2){canvas1&&div1.removeChild(canvas1);canvas2&&div1.removeChild(canvas2);canvas1=document.createElement("canvas");canvas2=document.createElement("canvas");canvas1.style.margins=canvas2.style.margins="0px";canvas1.style.padding=canvas2.style.padding= "0px";isAdd=true}var scaleAttribute=AscCommon.AscBrowser.retinaPixelRatio;var scaleAttributeText=""+(scaleAttribute*100>>0);if(canvas1.scaleAttributeText===scaleAttributeText&&canvas2.scaleAttributeText===scaleAttributeText)return;canvas1.scaleAttributeText=scaleAttributeText;canvas2.scaleAttributeText=scaleAttributeText;var pixW=248;var pixW_natural=AscCommon.AscBrowser.convertToRetinaValue(pixW,true);var pixH=0;var pixH_natural=0;var mmW=pixW_natural*g_dKoef_pix_to_mm/AscCommon.AscBrowser.retinaPixelRatio; var mmH=pixH_natural*g_dKoef_pix_to_mm/AscCommon.AscBrowser.retinaPixelRatio;var wPxOffset=AscBrowser.convertToRetinaValue(8,true);var wMmOffset=wPxOffset*g_dKoef_pix_to_mm/AscCommon.AscBrowser.retinaPixelRatio;var oLogicDocument=this.m_oWordControl.m_oLogicDocument;var oStyles=oLogicDocument.GetStyles();History.TurnOff();var oldTrack=false;if(oLogicDocument.IsTrackRevisions()){oldTrack=oLogicDocument.GetLocalTrackRevisions();oLogicDocument.SetLocalTrackRevisions(false)}var oldTurn=editor.isViewMode; editor.isViewMode=true;var oldMarks=this.m_oWordControl.m_oApi.ShowParaMarks;this.m_oWordControl.m_oApi.ShowParaMarks=false;var props=[{OutlineStart:1,OutlineEnd:3,Hyperlink:false,StylesType:Asc.c_oAscTOCStylesType.Simple,RightTab:true,PageNumbers:true,TabLeader:Asc.c_oAscTabLeader.Dot,Pages:[2,5,15]},{OutlineStart:1,OutlineEnd:3,Hyperlink:true,StylesType:Asc.c_oAscTOCStylesType.Web,RightTab:true,PageNumbers:false,TabLeader:Asc.c_oAscTabLeader.None}];for(var i=0;i<2;i++){var oStyles=oLogicDocument.GetStyles(); var oHeader=new CHeaderFooter(oLogicDocument.HdrFtr,oLogicDocument,this,AscCommon.hdrftr_Header);var oDocumentContent=oHeader.GetContent();var arrLevels=[];var arrStylesToDelete=[];var prop=props[i];for(var nCurrentLevel=prop.OutlineStart;nCurrentLevel<=prop.OutlineEnd;++nCurrentLevel){var sName="Heading "+nCurrentLevel;var nLvl=nCurrentLevel-1;var oStyle=new CStyle("",null,null,styletype_Paragraph,true);oStyle.CreateTOC(nLvl,prop.StylesType);oStyle.ParaPr.Spacing.Line=1.2;oStyle.ParaPr.Spacing.LineRule= linerule_Auto;oStyle.ParaPr.Spacing.Before=0;oStyle.ParaPr.Spacing.After=0;oStyle.ParaPr.ContextualSpacing=true;oStyle.ParaPr.Ind.Left=15*(nCurrentLevel-1)*g_dKoef_pt_to_mm;oStyle.TextPr.FontFamily={Name:"Arial",Index:-1};oStyle.TextPr.FontSize=10;oStyles.Add(oStyle);arrLevels[nLvl]={Styles:[sName],StyleId:oStyle.GetId()};arrStylesToDelete.push(oStyle.GetId())}for(var nCurrentLevel=prop.OutlineStart;nCurrentLevel<=prop.OutlineEnd;++nCurrentLevel){var sStyleId=arrLevels[nCurrentLevel-1].StyleId;for(var nStyle= 0,nStylesCount=arrLevels[nCurrentLevel-1].Styles.length;nStyle>2<<2;pixH_natural=AscCommon.AscBrowser.convertToRetinaValue(pixH,true);var canvas=i===0?canvas1:canvas2;canvas.style.width=pixW+"px";canvas.style.height=pixH+"px";canvas.width=pixW_natural;canvas.height=pixH_natural;var ctx=canvas.getContext("2d");ctx.fillStyle="#FFFFFF";ctx.fillRect(0,0,pixW_natural,pixH_natural);var graphics=new AscCommon.CGraphics;graphics.init(ctx,pixW_natural,pixH_natural,mmW,mmH);graphics.m_oFontManager=AscCommon.g_fontManager; graphics.m_oCoordTransform.tx=graphics.m_oCoordTransform.ty=wPxOffset;graphics.transform(1,0,0,1,0,0);oDocumentContent.Draw(0,graphics)}this.m_oWordControl.m_oApi.ShowParaMarks=oldMarks;History.TurnOn();if(false!==oldTrack)oLogicDocument.SetLocalTrackRevisions(oldTrack);editor.isViewMode=oldTurn;if(isAdd){div1.appendChild(canvas1);div2.appendChild(canvas2)}};this.SetDrawImagePlaceTableOfFigures=function(id,props){var _div_elem=null;if(null==id||""==id){if(""!=this.GuiCanvasFillTOFParentId){_div_elem= document.getElementById(this.GuiCanvasFillTOFParentId);if(this.GuiCanvasFillTOF&&_div_elem)_div_elem.removeChild(this.GuiCanvasFillTOF);this.GuiCanvasFillTOFParentId="";this.GuiCanvasFillTOF=null}return}if(id!=this.GuiCanvasFillTOFParentId){_div_elem=document.getElementById(this.GuiCanvasFillTOFParentId);if(this.GuiCanvasFillTOF&&_div_elem)_div_elem.removeChild(this.GuiCanvasFillTOF);this.GuiCanvasFillTOFParentId="";this.GuiCanvasFillTOF=null}this.GuiCanvasFillTOFParentId=id;_div_elem=document.getElementById(this.GuiCanvasFillTOFParentId); if(!_div_elem)return;var widthPx=_div_elem.offsetWidth;var heightPx=_div_elem.offsetHeight;if(null==this.GuiCanvasFillTOF){this.GuiCanvasFillTOF=document.createElement("canvas");_div_elem.appendChild(this.GuiCanvasFillTOF)}var wPx=AscBrowser.convertToRetinaValue(widthPx,true);var hPx=AscBrowser.convertToRetinaValue(heightPx,true);var wMm=wPx*g_dKoef_pix_to_mm/AscCommon.AscBrowser.retinaPixelRatio;var hMm=hPx*g_dKoef_pix_to_mm/AscCommon.AscBrowser.retinaPixelRatio;var wPxOffset=AscBrowser.convertToRetinaValue(8, true);var wMmOffset=wPxOffset*g_dKoef_pix_to_mm/AscCommon.AscBrowser.retinaPixelRatio;this.GuiCanvasFillTOF.style.width=widthPx+"px";this.GuiCanvasFillTOF.width=wPx;History.TurnOff();var oLogicDocument=this.m_oWordControl.m_oLogicDocument;var _oldTurn=editor.isViewMode;editor.isViewMode=true;var bTrackRevisions=false;if(oLogicDocument.IsTrackRevisions()){bTrackRevisions=oLogicDocument.GetLocalTrackRevisions();oLogicDocument.SetLocalTrackRevisions(false)}var ctx=this.GuiCanvasFillTOF.getContext("2d"); var old_marks=this.m_oWordControl.m_oApi.ShowParaMarks;this.m_oWordControl.m_oApi.ShowParaMarks=false;var oStyles=oLogicDocument.GetStyles();var oHeader=new CHeaderFooter(oLogicDocument.HdrFtr,oLogicDocument,this,AscCommon.hdrftr_Header);var oDocumentContent=oHeader.GetContent();var nStylesType=props.get_StylesType();var isShowPageNum=props.get_ShowPageNumbers();var isRightTab=props.get_RightAlignTab();var nTabLeader=props.get_TabLeader();if(undefined===nTabLeader||null===nTabLeader)nTabLeader=Asc.c_oAscTabLeader.Dot; var sStyleId=null;var sStyleToDelete=null;var oStyle;if(Asc.c_oAscTOCStylesType.Current===nStylesType)sStyleId=oStyles.GetDefaultTOF();else{oStyle=new CStyle("",null,null,styletype_Paragraph,true);oStyle.CreateTOF(nStylesType);sStyleId=oStyle.GetId();oStyles.Add(oStyle);sStyleToDelete=oStyle.GetId()}var oParaIndex=0;var nPageIndex=1;var nCount=5;var sCaption=props.get_Caption();if(!sCaption)sCaption=AscCommon.translateManager.getValue("Caption");var sText;var bIncludeLabel=props.get_IncludeLabelAndNumber(); for(var nIndex=0;nIndex>0;if(nContentHeightPx>hPx){hPx=nContentHeightPx; hMm=nContentHeight}this.GuiCanvasFillTOF.style.height=AscBrowser.convertToRetinaValue(hPx,false)+"px";this.GuiCanvasFillTOF.height=hPx;var ctx=this.GuiCanvasFillTOF.getContext("2d");ctx.fillStyle="#FFFFFF";ctx.fillRect(0,0,wPx,hPx);var graphics=new AscCommon.CGraphics;graphics.init(ctx,wPx,hPx,wMm,hMm);graphics.m_oFontManager=AscCommon.g_fontManager;graphics.m_oCoordTransform.tx=graphics.m_oCoordTransform.ty=wPxOffset;graphics.transform(1,0,0,1,0,0);oDocumentContent.Draw(0,graphics);this.m_oWordControl.m_oApi.ShowParaMarks= old_marks;History.TurnOn();if(false!==bTrackRevisions)oLogicDocument.SetLocalTrackRevisions(bTrackRevisions);editor.isViewMode=_oldTurn};this.SetDrawImagePreviewMargins=function(id,props){var parent=document.getElementById(id);if(!parent)return;var width_px=parent.clientWidth;var height_px=parent.clientHeight;var canvas=parent.firstChild;if(!canvas){canvas=document.createElement("canvas");canvas.style.cssText="pointer-events: none;padding:0;margin:0;user-select:none;";canvas.style.width=width_px+ "px";canvas.style.height=height_px+"px";if(width_px>0&&height_px>0)parent.appendChild(canvas)}AscCommon.calculateCanvasSize(canvas,undefined,true);canvas.width=canvas.width;var ctx=canvas.getContext("2d");var rPR=AscCommon.AscBrowser.retinaPixelRatio;var offset=10;var page_width_mm=props.W;var page_height_mm=props.H;var isMirror=props.MirrorMargins;var pageRects=[];var w_px=width_px-(offset<<1);var h_px=height_px-(offset<<1);var aspectParent=w_px/h_px;var aspectPage=page_width_mm/page_height_mm;if(!isMirror)if(aspectPage> aspectParent){pageRects.push({X:offset,Y:0,W:w_px,H:0});pageRects[0].H=pageRects[0].W/aspectPage>>0;pageRects[0].Y=offset+(h_px-pageRects[0].H>>1)}else{pageRects.push({X:0,Y:offset,W:0,H:h_px});pageRects[0].W=pageRects[0].H*aspectPage>>0;pageRects[0].X=offset+(w_px-pageRects[0].W>>1)}else{var w_px_2=w_px-offset>>1;aspectParent=w_px_2/h_px;if(aspectPage>aspectParent){pageRects.push({X:offset,Y:0,W:w_px_2,H:0});pageRects[0].H=pageRects[0].W/aspectPage>>0;pageRects[0].Y=offset+(h_px-pageRects[0].H>> 1);pageRects.push({X:offset+(w_px+offset>>1),Y:0,W:w_px_2,H:0});pageRects[1].H=pageRects[0].H;pageRects[1].Y=pageRects[0].Y}else{pageRects.push({X:0,Y:offset,W:0,H:h_px});pageRects[0].W=pageRects[0].H*aspectPage>>0;pageRects[0].X=offset+(w_px_2-pageRects[0].W>>1);pageRects.push({X:0,Y:offset,W:0,H:h_px});pageRects[1].W=pageRects[0].W;pageRects[1].X=offset+(w_px+offset>>1)+(w_px_2-pageRects[0].W>>1)}}var gutterSize=props.Gutter*pageRects[0].W/page_width_mm>>0;var gutterPos=0;if(props.GutterRTL)gutterPos= 1;if(props.GutterAtTop)gutterPos=2;if(isMirror)gutterPos=1;ctx.fillStyle="#FFFFFF";ctx.strokeStyle="#000000";var lineW=Math.round(rPR);ctx.lineWidth=lineW;var indent=.5*Math.round(rPR);var __move=function(ctx,x,y,is_vert){ctx.moveTo((x*rPR>>0)+(is_vert?indent:0),(y*rPR>>0)+(is_vert?0:indent))};var __line=function(ctx,x,y,is_vert){ctx.lineTo((x*rPR>>0)+(is_vert?indent:0),(y*rPR>>0)+(is_vert?0:indent))};var __rect=function(ctx,x,y,w,h,indent){indent=undefined===indent?0:indent;ctx.rect((x*rPR>>0)+indent, (y*rPR>>0)+indent,w*rPR>>0,h*rPR>>0)};for(var page=0;page0){ctx.setLineDash([Math.round(2*rPR),Math.round(2*rPR)]);var gutterEvenOdd=0;switch(gutterPos){case 0:{var x=pageRects[page].X;for(var i=0;i>0)+i+indent,(pageRects[page].Y+gutterEvenOdd)*rPR>>0);ctx.lineTo((x*rPR>>0)+i+indent,(pageRects[page].Y+pageRects[page].H)*rPR>>0);ctx.stroke();ctx.beginPath();gutterEvenOdd=0===gutterEvenOdd?2:0}break}case 1:{var x=pageRects[page].X+pageRects[page].W;for(var i=0;i>0)-i-indent,(pageRects[page].Y+gutterEvenOdd)*rPR>>0);ctx.lineTo((x*rPR>>0)-i-indent,(pageRects[page].Y+pageRects[page].H)*rPR>>0);ctx.stroke();ctx.beginPath();gutterEvenOdd=0===gutterEvenOdd? 2:0}break}case 2:{var y=pageRects[page].Y;for(var i=0;i>0,(y*rPR>>0)+i+indent);ctx.lineTo((pageRects[page].X+pageRects[page].W)*rPR>>0,(y*rPR>>0)+i+indent);ctx.stroke();ctx.beginPath();gutterEvenOdd=0===gutterEvenOdd?2:0}break}default:break}ctx.setLineDash([])}var left=props.Left;var top=props.Top;var right=props.Right;var bottom=props.Bottom;if(left<0)left=-left;if(top<0)top=-top;if(right<0)right=-right;if(bottom<0)bottom=-bottom; if(0==page&&isMirror){var tmp=left;left=right;right=tmp}switch(gutterPos){case 0:{left+=props.Gutter;break}case 1:{right+=props.Gutter;break}case 2:{top+=props.Gutter;break}default:break}var l=pageRects[page].X+(left*pageRects[page].W/page_width_mm>>0);var t=pageRects[page].Y+(top*pageRects[page].H/page_height_mm>>0);var r=pageRects[page].X+(pageRects[page].W-(right*pageRects[page].W/page_width_mm>>0));var b=pageRects[page].Y+(pageRects[page].H-(bottom*pageRects[page].H/page_height_mm>>0));if(l>= r||t>=b)continue;var lf=l+((r-l)/8>>0);var rf=l+((r-l)/3>>0);l=l*rPR>>0;r=r*rPR>>0;b=b*rPR>>0;lf=lf*rPR>>0;rf=rf*rPR>>0;var cur=(t*rPR>>0)+indent;var cur_offset=2*lineW;var cur_offset_end=6*lineW;while(cur=b)break;ctx.moveTo(l,cur);ctx.lineTo(r,cur);cur+=cur_offset;if(cur>=b)break;ctx.moveTo(l,cur);ctx.lineTo(r,cur);cur+=cur_offset;if(cur>=b)break;ctx.moveTo(l,cur);ctx.lineTo(rf,cur);cur+=cur_offset_end}ctx.stroke();ctx.beginPath();gutterPos= 0}};this.privateGetParagraphByString=function(level,levelNum,counterCurrent,x,y,lineHeight,ctx,w,h){var text="";for(var i=0;i>0)/2;var parRun=new ParaRun(par);parRun.Set_Pr(textPr);parRun.AddText(text);par.AddToContent(0,parRun);par.Reset(0,0,1E3,1E3,0,0,1);par.Recalculate_Page(0);par.LineNumbersInfo= null;var baseLineOffset=par.Lines[0].Y;var bounds=par.Get_PageBounds(0);var parW=par.Lines[0].Ranges[0].W*AscCommon.g_dKoef_mm_to_pix;var parH=(bounds.Bottom-bounds.Top)*AscCommon.g_dKoef_mm_to_pix;var yOffset=y-(baseLineOffset*g_dKoef_mm_to_pix>>0);var xOffset=x;switch(level.Align){case AscCommon.align_Right:xOffset-=parW;break;case AscCommon.align_Center:xOffset-=parW>>1;break;default:break}var backTextWidth=parW+4;switch(level.Suff){case Asc.c_oAscNumberingSuff.Space:case Asc.c_oAscNumberingSuff.None:backTextWidth+= 4;break;case Asc.c_oAscNumberingSuff.Tab:break;default:break}ctx.fillStyle="#FFFFFF";var rPR=AscCommon.AscBrowser.retinaPixelRatio;ctx.fillRect(Math.round(rPR*xOffset),Math.round((y-lineHeight)*rPR),Math.round(backTextWidth*rPR),Math.round((lineHeight+(lineHeight>>1))*rPR));ctx.beginPath();ctx.save();ctx.setTransform(1,0,0,1,0,0);var graphics=new AscCommon.CGraphics;graphics.init(ctx,AscCommon.AscBrowser.convertToRetinaValue(w,true),AscCommon.AscBrowser.convertToRetinaValue(h,true),w*AscCommon.g_dKoef_pix_to_mm, h*AscCommon.g_dKoef_pix_to_mm);graphics.m_oFontManager=AscCommon.g_fontManager;graphics.m_oCoordTransform.tx=AscCommon.AscBrowser.convertToRetinaValue(xOffset,true);graphics.m_oCoordTransform.ty=AscCommon.AscBrowser.convertToRetinaValue(yOffset,true);graphics.transform(1,0,0,1,0,0);par.Draw(0,graphics);ctx.restore();ctx.restore();api.isViewMode=oldViewMode;api.ShowParaMarks=oldMarks};this.SetDrawImagePreviewBullet=function(id,props,level,is_multi_level,isNoCheckFonts){if(!isNoCheckFonts){var fontsDict= {};for(var i=0,count=props.Lvl.length;i0&&height_px>0)parent.appendChild(canvas)}AscCommon.calculateCanvasSize(canvas,undefined,true);canvas.width=canvas.width;var ctx=canvas.getContext("2d");var rPR=AscCommon.AscBrowser.retinaPixelRatio;canvas.is_multi_level=is_multi_level;canvas.level=level;AscCommon.addMouseEvent(canvas,"down",function(e){AscCommon.stopEvent(e);if(true!==this.is_multi_level)return;var offsetBase=10;var line_w=4;var height=parseInt(this.style.height); var line_distance=(height-(offsetBase<<1)-line_w*10)/9>>0;var offset=height-(line_w*10+line_distance*9)>>1;var current=this.currentLevel;var yPos=e.pageY;if(undefined===yPos)yPos=e.clientY;yPos=yPos*AscCommon.AscBrowser.zoom;var clientRect=this.getBoundingClientRect();if(undefined!=clientRect.y)yPos-=clientRect.y;else if(undefined!=clientRect.top)yPos-=clientRect.top;var level=8;var y=offset+2;for(var i=0;i<9;i++){y+=line_w+line_distance;if(i==current)y+=line_w+line_distance;if(yPos> 1)){level=i;break}}editor.sendEvent("asc_onPreviewLevelChange",level)});var oDocState=null;if(this.m_oLogicDocument)oDocState=this.m_oLogicDocument.StartNoHistoryMode();if(!is_multi_level){var offsetBase=10;var line_w=4;var line_distance=(height_px-(offsetBase<<1)-line_w*10)/9>>0;var offset=height_px-(line_w*10+line_distance*9)>>1;var textYs=[];ctx.lineWidth=4*Math.round(rPR);ctx.strokeStyle="#CBCBCB";var y=offset+2+2*(line_w+line_distance);var text_base_offset_x=offset+(6.25+6.25*(level+1)*AscCommon.g_dKoef_mm_to_pix)>> 0;if(text_base_offset_x>width_px-offsetBase-20)text_base_offset_x=width_px-offsetBase-20;textYs.push(y+line_w);y+=2*(line_w+line_distance);textYs.push(y+line_w);y+=2*(line_w+line_distance);textYs.push(y+line_w);for(var i=0;i>0,textYs[i],line_distance,ctx,width_px,height_px);y=Math.round((offset+2)*rPR);var left_offset=Math.round(text_base_offset_x*rPR),right_offset=Math.round((width_px- offsetBase)*rPR),y_dist=Math.round((line_w+line_distance)*rPR);var left_offset2=Math.round(offsetBase*rPR);var right_offset2=Math.round((width_px-offsetBase)*rPR);ctx.moveTo(left_offset2,y);ctx.lineTo(right_offset2,y);y+=y_dist;ctx.moveTo(left_offset2,y);ctx.lineTo(right_offset2,y);y+=y_dist;ctx.stroke();ctx.beginPath();ctx.strokeStyle="#000000";ctx.moveTo(left_offset,y);ctx.lineTo(right_offset,y);y+=y_dist;ctx.moveTo(left_offset,y);ctx.lineTo(right_offset,y);y+=y_dist;ctx.moveTo(left_offset,y);ctx.lineTo(right_offset, y);y+=y_dist;ctx.moveTo(left_offset,y);ctx.lineTo(right_offset,y);y+=y_dist;ctx.moveTo(left_offset,y);ctx.lineTo(right_offset,y);y+=y_dist;ctx.moveTo(left_offset,y);ctx.lineTo(right_offset,y);y+=y_dist;ctx.stroke();ctx.beginPath();ctx.strokeStyle="#CBCBCB";ctx.moveTo(left_offset2,y);ctx.lineTo(right_offset2,y);y+=y_dist;ctx.moveTo(left_offset2,y);ctx.lineTo(right_offset2,y);ctx.stroke();ctx.beginPath()}else{var offsetBase=10;var line_w=4;var line_distance=(height_px-(offsetBase<<1)-line_w*10)/9>> 0;var offset=height_px-(line_w*10+line_distance*9)>>1;var current=level;canvas.currentLevel=level;ctx.lineWidth=4*Math.round(rPR);ctx.strokeStyle="#CBCBCB";var y=offset+2;var text_base_offset_x=offset+(6.25*AscCommon.g_dKoef_mm_to_pix>>0);var text_base_offset_dist=6.25*AscCommon.g_dKoef_mm_to_pix>>0;var textYs=[];for(var i=0;i<9;i++){textYs.push({x:text_base_offset_x-(6.25*AscCommon.g_dKoef_mm_to_pix>>0),y:y+line_w});if(i==current){ctx.strokeStyle="#000000";ctx.moveTo(Math.round(text_base_offset_x* rPR),Math.round(y*rPR));ctx.lineTo(Math.round((width_px-offsetBase)*rPR),Math.round(y*rPR));y+=line_w+line_distance;ctx.moveTo(Math.round(text_base_offset_x*rPR),Math.round(y*rPR));ctx.lineTo(Math.round((width_px-offsetBase)*rPR),Math.round(y*rPR));ctx.stroke();ctx.strokeStyle="#CBCBCB"}else{ctx.moveTo(Math.round(text_base_offset_x*rPR),Math.round(y*rPR));ctx.lineTo(Math.round((width_px-offsetBase)*rPR),Math.round(y*rPR));ctx.stroke()}ctx.beginPath();text_base_offset_x+=text_base_offset_dist;y+=line_w+ line_distance}for(var i=0;i<9;i++)this.privateGetParagraphByString(props.Lvl[i],level,1,textYs[i].x,textYs[i].y,line_distance,ctx,width_px,height_px)}if(oDocState)this.m_oLogicDocument.EndNoHistoryMode(oDocState)};this.SetDrawImagePreviewBulletChangeListLevel=function(id,props,isNoCheckFonts){if(!isNoCheckFonts){var fontsDict={};for(var i=0,count=props.Lvl.length;i>1;var y=(height_px_p>>1)-(line_w>>1);var text_base_offset_x=offset+(3.25*AscCommon.g_dKoef_mm_to_pix>>0);var text_base_offset_dist=(props.IsOnes?2.25:3.25)*AscCommon.g_dKoef_mm_to_pix>>0;var oDocState=null;if(this.m_oLogicDocument)oDocState=this.m_oLogicDocument.StartNoHistoryMode();for(var k=0;k<9;k++){props.Lvl[k].Align= 1;var parent=document.getElementById(id[k]);if(!parent)return;var width_px=parent.clientWidth;var height_px=parent.clientHeight;var canvas=parent.firstChild;if(!canvas){canvas=document.createElement("canvas");canvas.style.cssText="padding:0;margin:0;user-select:none;";canvas.style.width=width_px+"px";canvas.style.height=height_px+"px";if(width_px>0&&height_px>0)parent.appendChild(canvas)}canvas.width=AscCommon.AscBrowser.convertToRetinaValue(width_px,true);canvas.height=AscCommon.AscBrowser.convertToRetinaValue(height_px, true);var ctx=canvas.getContext("2d");var rPR=AscCommon.AscBrowser.retinaPixelRatio;ctx.lineWidth=2*Math.round(rPR);ctx.strokeStyle="#CBCBCB";var textYs={x:text_base_offset_x-(4.25*AscCommon.g_dKoef_mm_to_pix>>0),y:y+(line_w<<1)};ctx.moveTo(Math.round(text_base_offset_x*rPR),Math.round(y*rPR));ctx.lineTo(Math.round((width_px-offsetBase)*rPR),Math.round(y*rPR));ctx.stroke();ctx.beginPath();text_base_offset_x+=text_base_offset_dist;this.privateGetParagraphByString(props.Lvl[k],k,1,textYs.x,textYs.y, height_px>>1,ctx,width_px,height_px)}if(oDocState)this.m_oLogicDocument.EndNoHistoryMode(oDocState)};this.SetDrawImagePreviewBulletForMenu=function(id,type,props,isNoCheckFonts){var text=AscCommon.translateManager.getValue("None");if(!props){props=[];var olvl=new Asc.CAscNumberingLvl(0);var level=new CNumberingLvl;var arr=[];for(var i=0;i0&&height_px>0)elNone.appendChild(canvas)}canvas.width=AscCommon.AscBrowser.convertToRetinaValue(width_px,true);canvas.height=AscCommon.AscBrowser.convertToRetinaValue(height_px,true);var ctx=canvas.getContext("2d");ctx.fillStyle="#FFFFFF";ctx.fillRect(0,0,canvas.width,canvas.height);ctx.beginPath();var line_distance=height_px==80?height_px/5-1:(height_px>>2)+ (text.length>6?0:2);var par=new Paragraph(this,this.m_oWordControl.m_oLogicDocument);par.MoveCursorToStartPos();par.Pr=new CParaPr;var lvl=type==2?props[0][0]:props[0];var textPr=lvl.TextPr.Copy();textPr.FontSize=(2*line_distance*72/96>>0)/2;var parRun=new ParaRun(par);parRun.Set_Pr(textPr);parRun.AddText(text);par.AddToContent(0,parRun);par.Reset(0,0,1E3,1E3,0,0,1);par.Recalculate_Page(0);var bounds=par.Get_PageBounds(0);var parW=par.Lines[0].Ranges[0].W*AscCommon.g_dKoef_mm_to_pix;var parH=bounds.Bottom- bounds.Top;var x=width_px-(parW>>0)>>1;var y=(height_px>>1)+(parH>>1);this.privateGetParagraphByString(lvl,0,0,x,y,line_distance,ctx,width_px,height_px)}for(var i=1;i0&&height_px>0)parent.appendChild(canvas)}canvas.width=AscCommon.AscBrowser.convertToRetinaValue(width_px,true);canvas.height=AscCommon.AscBrowser.convertToRetinaValue(height_px,true);var ctx=canvas.getContext("2d");ctx.fillStyle="#FFFFFF";ctx.fillRect(0,0,canvas.width,canvas.height);ctx.beginPath();var rPR=AscCommon.AscBrowser.retinaPixelRatio;if(!type){var line_distance=32,x=0,y=0;var text="";for(var k=0;k>0)/2;if(1===text.length){g_oTextMeasurer.SetTextPr(textPr);g_oTextMeasurer.SetFontSlot(fontslot_ASCII,1);var oInfo=g_oTextMeasurer.Measure2Code(text.charCodeAt(0));x=(width_px>>1)- Math.round((oInfo.WidthG/2+oInfo.rasterOffsetX)*AscCommon.g_dKoef_mm_to_pix);y=(width_px>>1)+Math.round((oInfo.Height/2+(oInfo.Ascent-oInfo.Height+oInfo.rasterOffsetY))*AscCommon.g_dKoef_mm_to_pix)}else{var par=new Paragraph(this,this.m_oWordControl.m_oLogicDocument);par.MoveCursorToStartPos();par.Pr=new CParaPr;var parRun=new ParaRun(par);parRun.Set_Pr(textPr);parRun.AddText(text);par.AddToContent(0,parRun);par.Reset(0,0,1E3,1E3,0,0,1);par.Recalculate_Page(0);var parW=par.Lines[0].Ranges[0].W*AscCommon.g_dKoef_mm_to_pix; x=(width_px>>1)-Math.round(parW/2);y=par.Lines[0].Y*AscCommon.g_dKoef_mm_to_pix}this.privateGetParagraphByString(props[i],0,0,x,y,line_distance,ctx,width_px,height_px)}else{var offsetBase=4;var line_w=2;var line_distance=(height_px-(offsetBase<<2)-line_w*3)/3>>0;var offset=height_px-(line_w*3+line_distance*3)>>1;ctx.lineWidth=2*Math.round(rPR);ctx.strokeStyle="#CBCBCB";var y=offset+11;var text_base_offset_x=offset+(2.25*AscCommon.g_dKoef_mm_to_pix>>0);var text_base_offset_dist=2.25*AscCommon.g_dKoef_mm_to_pix>> 0;for(var j=0;j<3;j++){ctx.moveTo(Math.round(text_base_offset_x*rPR),Math.round(y*rPR));ctx.lineTo(Math.round((width_px-offsetBase)*rPR),Math.round(y*rPR));ctx.stroke();ctx.beginPath();var textYx=text_base_offset_x-(3.25*AscCommon.g_dKoef_mm_to_pix>>0),textYy=y+line_w*2.5;this.privateGetParagraphByString(type==2?props[i][j]:props[i],0,1+(type==1?j:0),textYx,textYy,line_distance-4,ctx,width_px,height_px);y+=line_w+line_distance;if(type==2)text_base_offset_x+=text_base_offset_dist}}}if(this.m_oLogicDocument)this.m_oLogicDocument.EndNoHistoryMode(oDocState)}; this.StartTableStylesCheck=function(){this.TableStylesCheckLookFlag=true};this.EndTableStylesCheck=function(){this.TableStylesCheckLookFlag=false;if(this.TableStylesCheckLook!=null){this.CheckTableStyles(this.TableStylesCheckLook);this.TableStylesCheckLook=null}};this.CheckTableStyles=function(tableLook){if(this.TableStylesCheckLookFlag){this.TableStylesCheckLook=tableLook;return}if(!this.m_oWordControl.m_oApi.asc_checkNeedCallback("asc_onInitTableTemplates"))return;var logicDoc=this.m_oWordControl.m_oLogicDocument; var newClrScheme=null;if(logicDoc&&logicDoc.theme&&logicDoc.theme.themeElements)newClrScheme=logicDoc.theme.themeElements.clrScheme;var bIsChanged=false;if(null==this.TableStylesLastLook){this.TableStylesLastLook=new Asc.CTablePropLook;this.TableStylesLastLook.FirstCol=tableLook.FirstCol;this.TableStylesLastLook.FirstRow=tableLook.FirstRow;this.TableStylesLastLook.LastCol=tableLook.LastCol;this.TableStylesLastLook.LastRow=tableLook.LastRow;this.TableStylesLastLook.BandHor=tableLook.BandHor;this.TableStylesLastLook.BandVer= tableLook.BandVer;bIsChanged=true;this.TableStylesLastClrScheme=newClrScheme}else{if(this.TableStylesLastLook.FirstCol!=tableLook.FirstCol){this.TableStylesLastLook.FirstCol=tableLook.FirstCol;bIsChanged=true}if(this.TableStylesLastLook.FirstRow!=tableLook.FirstRow){this.TableStylesLastLook.FirstRow=tableLook.FirstRow;bIsChanged=true}if(this.TableStylesLastLook.LastCol!=tableLook.LastCol){this.TableStylesLastLook.LastCol=tableLook.LastCol;bIsChanged=true}if(this.TableStylesLastLook.LastRow!=tableLook.LastRow){this.TableStylesLastLook.LastRow= tableLook.LastRow;bIsChanged=true}if(this.TableStylesLastLook.BandHor!=tableLook.BandHor){this.TableStylesLastLook.BandHor=tableLook.BandHor;bIsChanged=true}if(this.TableStylesLastLook.BandVer!=tableLook.BandVer){this.TableStylesLastLook.BandVer=tableLook.BandVer;bIsChanged=true}if(this.TableStylesLastClrScheme!==newClrScheme){this.TableStylesLastClrScheme=newClrScheme;bIsChanged=true}}if(!bIsChanged)return;var _dst_styles=[];var _styles=logicDoc.Styles.Get_AllTableStyles();var _styles_len=_styles.length; if(_styles_len==0)return _dst_styles;var _x_mar=10;var _y_mar=10;var _r_mar=10;var _b_mar=10;var _pageW=297;var _pageH=210;var W=_pageW-_x_mar-_r_mar;var H=_pageH-_y_mar-_b_mar;if(_canvas_tables==null){_canvas_tables=document.createElement("canvas");_canvas_tables.width=TABLE_STYLE_WIDTH_PIX*AscCommon.AscBrowser.retinaPixelRatio>>0;_canvas_tables.height=TABLE_STYLE_HEIGHT_PIX*AscCommon.AscBrowser.retinaPixelRatio>>0}var _canvas=_canvas_tables;var ctx=_canvas.getContext("2d");var Rows=5;History.TurnOff(); g_oTableId.m_bTurnOff=true;var isTrackRevision=false;if(logicDoc&&logicDoc.IsTrackRevisions()){isTrackRevision=logicDoc.GetLocalTrackRevisions();logicDoc.SetLocalTrackRevisions(false)}for(var i1=0;i1<_styles_len;i1++){var i=_styles[i1];var _style=logicDoc.Styles.Style[i];if(!_style||_style.Type!=styletype_Table)continue;if(_table_styles==null){var Cols=5;var Grid=[];for(var ii=0;ii>0;y1=rPR*(drawingPage.top+koefY*logicObj.StartY)>>0;x2=rPR*(drawingPage.left+koefX*logicObj.EndX)>>0;y2=rPR*(drawingPage.top+koefY*logicObj.EndY)>>0;overlay.CheckPoint(x1,y1);overlay.CheckPoint(x2,y2);this.AutoShapesTrack.AddRectDashClever(ctx,x1,y1,x2,y2,2,2,true);ctx.beginPath();return}if(isPen)for(var i=0;i>0;y1=rPR*(drawingPage.top+koefY*elem.Y1)>>0;x2=rPR*(drawingPage.left+koefX*elem.X2)>>0;y2=rPR*(drawingPage.top+koefY*elem.Y2)>>0;if(!elem.Bold){x1+=.5;y1+=.5;x2+=.5;y2+=.5}overlay.CheckPoint(x1,y1);overlay.CheckPoint(x2,y2);ctx.moveTo(x1,y1);ctx.lineTo(x2,y2);ctx.stroke();ctx.beginPath()}else{ctx.strokeStyle="rgba(255, 123, 123, 0.75)";ctx.lineWidth=1;x1=rPR*(drawingPage.left+koefX*logicObj.StartX)>> 0;y1=rPR*(drawingPage.top+koefY*logicObj.StartY)>>0;x2=rPR*(drawingPage.left+koefX*logicObj.EndX)>>0;y2=rPR*(drawingPage.top+koefY*logicObj.EndY)>>0;overlay.CheckPoint(x1,y1);overlay.CheckPoint(x2,y2);this.AutoShapesTrack.AddRectDashClever(ctx,x1,y1,x2,y2,2,2,true);ctx.beginPath();ctx.lineWidth=2;for(var i=0;i>0;y1=rPR*(drawingPage.top+koefY*drawObj[i].Y1)>>0;x2=rPR*(drawingPage.left+koefX*drawObj[i].X2)>>0;y2=rPR*(drawingPage.top+ koefY*drawObj[i].Y2)>>0;overlay.CheckPoint(x1,y1);overlay.CheckPoint(x2,y2);ctx.moveTo(x1,y1);ctx.lineTo(x2,y2)}ctx.stroke();ctx.beginPath();ctx.lineWidth=1}};this.checkMouseDown_Drawing=function(pos){var oWordControl=this.m_oWordControl;var _ret=this.TableOutlineDr.checkMouseDown(pos,oWordControl);if(_ret===true){oWordControl.m_oLogicDocument.RemoveSelection(true);this.TableOutlineDr.bIsTracked=true;if(!this.TableOutlineDr.IsResizeTableTrack)this.LockCursorType("move");else this.LockCursorType("default"); this.TableOutlineDr.TableOutline.Table.SelectAll();this.TableOutlineDr.TableOutline.Table.Document_SetThisElementCurrent(true);if(-1==oWordControl.m_oTimerScrollSelect)oWordControl.m_oTimerScrollSelect=setInterval(oWordControl.SelectWheel,20);oWordControl.EndUpdateOverlay();return true}if(this.FrameRect.IsActive){var eps=10*g_dKoef_pix_to_mm*100/oWordControl.m_nZoomValue;var _check=this.checkCursorOnTrackRect(pos.X,pos.Y,eps,this.FrameRect.Rect);if(-1!=_check){this.FrameRect.IsTracked=true;this.FrameRect.Track.X= pos.X;this.FrameRect.Track.Y=pos.Y;this.FrameRect.Track.Type=_check;switch(_check){case 0:{this.LockCursorType("nw-resize");break}case 1:{this.LockCursorType("n-resize");break}case 2:{this.LockCursorType("ne-resize");break}case 3:{this.LockCursorType("e-resize");break}case 4:{this.LockCursorType("se-resize");break}case 5:{this.LockCursorType("s-resize");break}case 6:{this.LockCursorType("sw-resize");break}case 7:{this.LockCursorType("w-resize");break}default:{this.LockCursorType("move");break}}if(-1== oWordControl.m_oTimerScrollSelect)oWordControl.m_oTimerScrollSelect=setInterval(oWordControl.SelectWheel,20);oWordControl.EndUpdateOverlay();return true}}if(this.contentControls.onPointerDown(pos))return true;var _page=this.m_arrPages[pos.Page];if(this.placeholders.onPointerDown(pos,_page.drawingPage,_page.width_mm,_page.height_mm))return true;return false};this.checkMouseMove_Drawing=function(pos,isWithoutCoords){var oWordControl=this.m_oWordControl;if(this.TableOutlineDr.bIsTracked){this.TableOutlineDr.checkMouseMove(global_mouseEvent.X, global_mouseEvent.Y,oWordControl);oWordControl.ShowOverlay();oWordControl.OnUpdateOverlay();oWordControl.EndUpdateOverlay();return true}if(this.TableOutlineDr.checkMouseMoveTrack)if(this.TableOutlineDr.checkMouseMoveTrack(pos,oWordControl)){this.SetCursorType("default");return true}if(this.TableOutlineDr.checkMouseMove2)if(this.TableOutlineDr.checkMouseMove2(global_mouseEvent.X,global_mouseEvent.Y,oWordControl))return true;if(this.InlineTextTrackEnabled){this.contentControls.checkSmallChanges(pos); this.InlineTextTrack=oWordControl.m_oLogicDocument.Get_NearestPos(pos.Page,pos.X,pos.Y);this.InlineTextTrackPage=pos.Page;oWordControl.ShowOverlay();oWordControl.OnUpdateOverlay();oWordControl.EndUpdateOverlay();return true}if(this.FrameRect.IsActive)if(!this.FrameRect.IsTracked&&this.FrameRect.PageIndex==pos.Page){var eps=10*g_dKoef_pix_to_mm*100/oWordControl.m_nZoomValue;var _check=this.checkCursorOnTrackRect(pos.X,pos.Y,eps,this.FrameRect.Rect);if(_check!=-1){switch(_check){case 0:{this.SetCursorType("nw-resize"); break}case 1:{this.SetCursorType("n-resize");break}case 2:{this.SetCursorType("ne-resize");break}case 3:{this.SetCursorType("e-resize");break}case 4:{this.SetCursorType("se-resize");break}case 5:{this.SetCursorType("s-resize");break}case 6:{this.SetCursorType("sw-resize");break}case 7:{this.SetCursorType("w-resize");break}default:{this.SetCursorType("move");break}}oWordControl.EndUpdateOverlay();return true}}else{this.checkTrackRect(pos);oWordControl.ShowOverlay();oWordControl.OnUpdateOverlay();oWordControl.EndUpdateOverlay(); return true}if(this.contentControls.onPointerMove(pos,isWithoutCoords))return true;var _page=this.m_arrPages[pos.Page];if(this.placeholders.onPointerMove(pos,_page.drawingPage,_page.width_mm,_page.height_mm))return true;return false};this.checkMouseUp_Drawing=function(pos){var oWordControl=this.m_oWordControl;if(this.TableOutlineDr.bIsTracked){this.TableOutlineDr.checkMouseUp(global_mouseEvent.X,global_mouseEvent.Y,oWordControl);oWordControl.m_oLogicDocument.Document_UpdateInterfaceState();oWordControl.m_oLogicDocument.Document_UpdateRulersState(); if(-1!=oWordControl.m_oTimerScrollSelect){clearInterval(oWordControl.m_oTimerScrollSelect);oWordControl.m_oTimerScrollSelect=-1}oWordControl.OnUpdateOverlay();oWordControl.EndUpdateOverlay();return true}if(this.InlineTextTrackEnabled&&!this.contentControls.isInlineTrack()){this.InlineTextTrack=oWordControl.m_oLogicDocument.Get_NearestPos(pos.Page,pos.X,pos.Y);this.InlineTextTrackPage=pos.Page;this.EndTrackText();oWordControl.ShowOverlay();oWordControl.OnUpdateOverlay();oWordControl.EndUpdateOverlay(); return true}if(this.FrameRect.IsActive&&this.FrameRect.IsTracked){this.FrameRect.IsTracked=false;this.checkTrackRect(pos);var _track=this.FrameRect.Track;this.FrameRect.Frame.Change_Frame(_track.L,_track.T,_track.R-_track.L,_track.B-_track.T,_track.PageIndex);if(-1!=oWordControl.m_oTimerScrollSelect){clearInterval(oWordControl.m_oTimerScrollSelect);oWordControl.m_oTimerScrollSelect=-1}oWordControl.OnUpdateOverlay();oWordControl.EndUpdateOverlay();return true}if(this.contentControls.onPointerUp(pos))return true; var _page=this.m_arrPages[pos.Page];if(this.placeholders.onPointerUp(pos,_page.drawingPage,_page.width_mm,_page.height_mm))return true;return false};this.checkCursorOnTrackRect=function(X,Y,eps,rect){var __x_dist1=Math.abs(X-rect.X);var __x_dist2=Math.abs(X-(rect.X+rect.R)/2);var __x_dist3=Math.abs(X-rect.R);var __y_dist1=Math.abs(Y-rect.Y);var __y_dist2=Math.abs(Y-(rect.Y+rect.B)/2);var __y_dist3=Math.abs(Y-rect.B);if(__y_dist1rect.R+eps)return-1;if(__x_dist1<=__x_dist2&& __x_dist1<=__x_dist3)return __x_dist1rect.R+eps)return-1;if(__x_dist1<=__x_dist2&&__x_dist1<=__x_dist3)return __x_dist1rect.B+eps)return-1;if(__y_dist1<=__y_dist2&&__y_dist1<=__y_dist3)return __y_dist1rect.B+eps)return-1;if(__y_dist1<=__y_dist2&&__y_dist1<=__y_dist3)return __y_dist1_track.R-_min_dist)_track.L=_track.R-_min_dist;if(_track.T>_track.B-_min_dist)_track.T=_track.B-_min_dist;break}case 1:{_track.L=_rect.X;_track.T=_rect.Y+(pos.Y-_track.Y);_track.R= _rect.R;_track.B=_rect.B;if(_track.T>_track.B-_min_dist)_track.T=_track.B-_min_dist;break}case 2:{_track.L=_rect.X;_track.T=_rect.Y+(pos.Y-_track.Y);_track.R=_rect.R+(pos.X-_track.X);_track.B=_rect.B;if(_track.R<_track.L+_min_dist)_track.R=_track.L+_min_dist;if(_track.T>_track.B-_min_dist)_track.T=_track.B-_min_dist;break}case 3:{_track.L=_rect.X;_track.T=_rect.Y;_track.R=_rect.R+(pos.X-_track.X);_track.B=_rect.B;if(_track.R<_track.L+_min_dist)_track.R=_track.L+_min_dist;break}case 4:{_track.L=_rect.X; _track.T=_rect.Y;_track.R=_rect.R+(pos.X-_track.X);_track.B=_rect.B+(pos.Y-_track.Y);if(_track.R<_track.L+_min_dist)_track.R=_track.L+_min_dist;if(_track.B<_track.T+_min_dist)_track.B=_track.T+_min_dist;break}case 5:{_track.L=_rect.X;_track.T=_rect.Y;_track.R=_rect.R;_track.B=_rect.B+(pos.Y-_track.Y);if(_track.B<_track.T+_min_dist)_track.B=_track.T+_min_dist;break}case 6:{_track.L=_rect.X+(pos.X-_track.X);_track.T=_rect.Y;_track.R=_rect.R;_track.B=_rect.B+(pos.Y-_track.Y);if(_track.L>_track.R-_min_dist)_track.L= _track.R-_min_dist;if(_track.B<_track.T+_min_dist)_track.B=_track.T+_min_dist;break}case 7:{_track.L=_rect.X+(pos.X-_track.X);_track.T=_rect.Y;_track.R=_rect.R;_track.B=_rect.B;if(_track.L>_track.R-_min_dist)_track.L=_track.R-_min_dist;break}default:{_track.L=pos.X-(_track.X-_rect.X);_track.T=pos.Y-(_track.Y-_rect.Y);_track.R=_track.L+_rect.R-_rect.X;_track.B=_track.T+_rect.B-_rect.Y;_track.PageIndex=pos.Page;break}}};this.DrawVerAnchor=function(pageNum,xPos,bIsFromDrawings){if(undefined===bIsFromDrawings){if(this.m_oWordControl.m_oApi.ShowSnapLines)this.HorVerAnchors.push({Type:0, Page:pageNum,Pos:xPos});return}var _pos=this.ConvertCoordsToCursor4(xPos,0,pageNum);if(_pos.Error===false){this.m_oWordControl.m_oOverlayApi.DashLineColor="#C8C8C8";this.m_oWordControl.m_oOverlayApi.VertLine2(_pos.X);this.m_oWordControl.m_oOverlayApi.DashLineColor="#000000"}};this.DrawHorAnchor=function(pageNum,yPos,bIsFromDrawings){if(undefined===bIsFromDrawings){if(this.m_oWordControl.m_oApi.ShowSnapLines)this.HorVerAnchors.push({Type:1,Page:pageNum,Pos:yPos});return}var _pos=this.ConvertCoordsToCursor4(0, yPos,pageNum);if(_pos.Error===false){this.m_oWordControl.m_oOverlayApi.DashLineColor="#C8C8C8";this.m_oWordControl.m_oOverlayApi.HorLine2(_pos.Y);this.m_oWordControl.m_oOverlayApi.DashLineColor="#000000"}};this.DrawHorVerAnchor=function(){for(var i=0;ib.Name)return 1;else return 0});for(var i=0,length=aSubArray.length;i>0;ctx.beginPath(); ctx.moveTo(_x,_b-_h);ctx.lineTo(_x+_w,_b-_h);ctx.lineTo(_x+_w,_b);ctx.lineTo(_x,_b);ctx.closePath();ctx.fill();ctx.lineWidth=1;ctx.strokeStyle="#D8D8D8";ctx.beginPath();ctx.rect(.5,.5,this.STYLE_THUMBNAIL_WIDTH-1,this.STYLE_THUMBNAIL_HEIGHT-1);ctx.stroke();graphics.restore()}else{g_oTableId.m_bTurnOff=true;History.TurnOff();var oldDefTabStop=AscCommonWord.Default_Tab_Stop;AscCommonWord.Default_Tab_Stop=1;var isShowParaMarks=false;if(_api){isShowParaMarks=_api.get_ShowParaMarks();_api.put_ShowParaMarks(false)}var hdr= new CHeaderFooter(editor.WordControl.m_oLogicDocument.HdrFtr,editor.WordControl.m_oLogicDocument,editor.WordControl.m_oDrawingDocument,AscCommon.hdrftr_Header);var _dc=hdr.Content;var par=new Paragraph(editor.WordControl.m_oDrawingDocument,_dc,false);var run=new ParaRun(par,false);run.AddText(styleName);_dc.Internal_Content_Add(0,par,false);par.Add_ToContent(0,run);par.Style_Add(style.Id,false);par.Set_Align(AscCommon.align_Left);par.Set_Tabs(new CParaTabs);if(!textPr.Color||255===textPr.Color.r&& 255===textPr.Color.g&&255===textPr.Color.b)run.Set_Color(new CDocumentColor(0,0,0,false));var _brdL=style.ParaPr.Brd.Left;if(undefined!==_brdL&&null!==_brdL){var brdL=new CDocumentBorder;brdL.Set_FromObject(_brdL);brdL.Space=0;par.Set_Border(brdL,AscDFH.historyitem_Paragraph_Borders_Left)}var _brdT=style.ParaPr.Brd.Top;if(undefined!==_brdT&&null!==_brdT){var brd=new CDocumentBorder;brd.Set_FromObject(_brdT);brd.Space=0;par.Set_Border(brd,AscDFH.historyitem_Paragraph_Borders_Top)}var _brdB=style.ParaPr.Brd.Bottom; if(undefined!==_brdB&&null!==_brdB){var brd=new CDocumentBorder;brd.Set_FromObject(_brdB);brd.Space=0;par.Set_Border(brd,AscDFH.historyitem_Paragraph_Borders_Bottom)}var _brdR=style.ParaPr.Brd.Right;if(undefined!==_brdR&&null!==_brdR){var brd=new CDocumentBorder;brd.Set_FromObject(_brdR);brd.Space=0;par.Set_Border(brd,AscDFH.historyitem_Paragraph_Borders_Right)}var _ind=new CParaInd;_ind.FirstLine=0;_ind.Left=0;_ind.Right=0;par.Set_Ind(_ind,false);var _sp=new CParaSpacing;_sp.Line=1;_sp.LineRule= Asc.linerule_Auto;_sp.Before=0;_sp.BeforeAutoSpacing=false;_sp.After=0;_sp.AfterAutoSpacing=false;par.Set_Spacing(_sp,false);_dc.Reset(0,0,1E4,1E4);_dc.Recalculate_Page(0,true);_dc.Reset(0,0,par.Lines[0].Ranges[0].W+.001,1E4);_dc.Recalculate_Page(0,true);var y=0;var b=dKoefToMM*this.STYLE_THUMBNAIL_HEIGHT;var w=dKoefToMM*this.STYLE_THUMBNAIL_WIDTH;var off=10*dKoefToMM;var off2=5*dKoefToMM;var off3=1*dKoefToMM;graphics.transform(1,0,0,1,0,0);graphics.save();graphics._s();graphics._m(off2,y+off3);graphics._l(w- off,y+off3);graphics._l(w-off,b-off3);graphics._l(off2,b-off3);graphics._z();graphics.clip();var baseline=par.Lines[0].Y;par.Shift(0,off+.5,y+.75*(b-y)-baseline);par.Draw(0,graphics);graphics.restore();if(_api)_api.put_ShowParaMarks(isShowParaMarks);AscCommonWord.Default_Tab_Stop=oldDefTabStop;g_oTableId.m_bTurnOff=false;History.TurnOn()}}};CStylesPainter.prototype.get_MergedStyles=function(){return this.mergedStyles};function TransformRectByMatrix(m,arr,offX,offY,koefX,koefY){var ret=[];ret.push(offX+ koefX*m.TransformPointX(arr[0],arr[1]));ret.push(offY+koefY*m.TransformPointY(arr[0],arr[1]));ret.push(offX+koefX*m.TransformPointX(arr[2],arr[1]));ret.push(offY+koefY*m.TransformPointY(arr[2],arr[1]));ret.push(offX+koefX*m.TransformPointX(arr[2],arr[3]));ret.push(offY+koefY*m.TransformPointY(arr[2],arr[3]));ret.push(offX+koefX*m.TransformPointX(arr[0],arr[3]));ret.push(offY+koefY*m.TransformPointY(arr[0],arr[3]));return ret}window["AscCommon"]=window["AscCommon"]||{};window["AscCommonWord"]=window["AscCommonWord"]|| {};window["AscCommon"].CPage=CPage;window["AscCommon"].CDrawingDocument=CDrawingDocument;window["AscCommonWord"].CStylesPainter=CStylesPainter;CStylesPainter.prototype["get_MergedStyles"]=CStylesPainter.prototype.get_MergedStyles;"use strict";function scrollUpHover(elem){elem.style.backgroundPosition="0px -19px"}function scrollUpOut(elem){elem.style.backgroundPosition="0px 0px"}function scrollUpDown(elem){elem.style.backgroundPosition="0px -38px"}function scrollDownHover(elem){elem.style.backgroundPosition= "0px -19px"}function scrollDownOut(elem){elem.style.backgroundPosition="0px -38px"}function scrollDownDown(elem){elem.style.backgroundPosition="0px 0px"}function scrollLeftHover(elem){elem.style.backgroundPosition="-19px 0px"}function scrollLeftOut(elem){elem.style.backgroundPosition="0px 0px"}function scrollLeftDown(elem){elem.style.backgroundPosition="-38px 0px"}function scrollRightHover(elem){elem.style.backgroundPosition="-19px 0px"}function scrollRightOut(elem){elem.style.backgroundPosition= "-38px 0px"}function scrollRightDown(elem){elem.style.backgroundPosition="0px 0px"}function scrollDragHover(elem){elem.style.backgroundColor="#DDDDDD"}function scrollDragOut(elem){elem.style.backgroundColor="#D3D3D3"}function scrollDragDown(elem){elem.style.backgroundColor="#CCCCCC"}"use strict";var c_oAscDocumentUnits=Asc.c_oAscDocumentUnits;var global_mouseEvent=AscCommon.global_mouseEvent;var g_dKoef_pix_to_mm=AscCommon.g_dKoef_pix_to_mm;var g_dKoef_mm_to_pix=AscCommon.g_dKoef_mm_to_pix;function CTab(pos, type,leader){this.pos=pos;this.type=type;this.leader=leader}var g_array_objects_length=1;var RULER_OBJECT_TYPE_PARAGRAPH=1;var RULER_OBJECT_TYPE_HEADER=2;var RULER_OBJECT_TYPE_FOOTER=4;var RULER_OBJECT_TYPE_TABLE=8;var RULER_OBJECT_TYPE_COLUMNS=16;function CHorRulerRepaintChecker(){this.Width=0;this.Height=0;this.Type=0;this.MarginLeft=0;this.MarginRight=0;this.tableCols=[];this.marginsLeft=[];this.marginsRight=[];this.columns=null;this.BlitAttack=false;this.BlitLeft=0;this.BlitIndentLeft=0;this.BlitIndentLeftFirst= 0;this.BlitIndentRight=0;this.BlitDefaultTab=0;this.BlitTabs=null;this.BlitMarginLeftInd=0;this.BlitMarginRightInd=0}function CVerRulerRepaintChecker(){this.Width=0;this.Height=0;this.Type=0;this.MarginTop=0;this.MarginBottom=0;this.HeaderTop=0;this.HeaderBottom=0;this.rowsY=[];this.rowsH=[];this.BlitAttack=false;this.BlitTop=0}function RulerCorrectPosition(_ruler,val,margin){if(AscCommon.global_keyboardEvent.AltKey)return val;var mm_1_4=10/4;if(_ruler.Units==c_oAscDocumentUnits.Inch)mm_1_4=25.4/ 16;else if(_ruler.Units==c_oAscDocumentUnits.Point)mm_1_4=25.4/12;var mm_1_8=mm_1_4/2;if(undefined===margin)return((val+mm_1_8)/mm_1_4>>0)*mm_1_4;if(val>=margin)return margin+((val-margin+mm_1_8)/mm_1_4>>0)*mm_1_4;return margin+((val-margin-mm_1_8)/mm_1_4>>0)*mm_1_4}function RulerCheckSimpleChanges(){this.X=-1;this.Y=-1;this.IsSimple=true;this.IsDown=false}RulerCheckSimpleChanges.prototype={Clear:function(){this.X=-1;this.Y=-1;this.IsSimple=true;this.IsDown=false},Reinit:function(){this.X=global_mouseEvent.X; this.Y=global_mouseEvent.Y;this.IsSimple=true;this.IsDown=true},CheckMove:function(){if(!this.IsDown)return;if(!this.IsSimple)return;if(Math.abs(global_mouseEvent.X-this.X)>0||Math.abs(global_mouseEvent.Y-this.Y)>0)this.IsSimple=false}};function CHorRuler(){this.m_oPage=null;this.m_nTop=0;this.m_nBottom=0;this.m_dDefaultTab=12.5;this.m_arrTabs=[];this.m_lCurrentTab=-1;this.m_dCurrentTabNewPosition=-1;this.m_dMaxTab=0;this.IsDrawingCurTab=true;this.m_dMarginLeft=20;this.m_dMarginRight=190;this.m_dIndentLeft= 10;this.m_dIndentRight=20;this.m_dIndentLeftFirst=20;this.m_oCanvas=null;this.m_dZoom=1;this.DragType=0;this.DragTypeMouseDown=0;this.m_dIndentLeft_old=-1E4;this.m_dIndentLeftFirst_old=-1E4;this.m_dIndentRight_old=-1E4;this.CurrentObjectType=RULER_OBJECT_TYPE_PARAGRAPH;this.m_oTableMarkup=null;this.m_oColumnMarkup=null;this.DragTablePos=-1;this.TableMarginLeft=0;this.TableMarginLeftTrackStart=0;this.TableMarginRight=0;this.m_oWordControl=null;this.RepaintChecker=new CHorRulerRepaintChecker;this.m_bIsMouseDown= false;this.IsCanMoveMargins=true;this.IsCanMoveAnyMarkers=true;this.IsDrawAnyMarkers=true;this.SimpleChanges=new RulerCheckSimpleChanges;this.Units=c_oAscDocumentUnits.Millimeter;this.DrawTablePict=function(){var ctx=g_memory.ctx;var dPR=AscCommon.AscBrowser.retinaPixelRatio;var isNeedRedraw=dPR-Math.floor(dPR)>=.5?true:false;var roundDPR=isNeedRedraw?Math.floor(dPR):Math.round(dPR);var canvasWidth=isNeedRedraw&&dPR>=1?Math.round(7*(Math.floor(dPR)+.5)):7*(isNeedRedraw?dPR:dPR>=1?Math.round(dPR): dPR),canvasHeight=isNeedRedraw&&dPR>=1?Math.round(8*(Math.floor(dPR)+.5)):8*(isNeedRedraw?dPR:dPR>=1?Math.round(dPR):dPR);if(null!=this.tableSprite)if(ctx.canvas.width==canvasWidth)return;ctx.canvas.width=canvasWidth;ctx.canvas.height=canvasHeight;ctx.beginPath();ctx.fillStyle="#ffffff";ctx.strokeStyle="#ffffff";ctx.stroke();ctx.rect(0,0,ctx.canvas.width,ctx.canvas.height);ctx.fill();ctx.beginPath();ctx.strokeStyle="#646464";ctx.lineWidth=roundDPR;var step=isNeedRedraw?Math.round(dPR):ctx.lineWidth; for(var i=0;i<7*ctx.canvas.width;i+=step+ctx.lineWidth){ctx.moveTo(0,.5*ctx.lineWidth+step+i);ctx.lineTo(ctx.canvas.width,.5*ctx.lineWidth+step+i);ctx.stroke()}for(var i=0;i<8*ctx.canvas.height;i+=step+ctx.lineWidth){ctx.moveTo(.5*ctx.lineWidth+step+i,0);ctx.lineTo(.5*ctx.lineWidth+step+i,ctx.canvas.height);ctx.stroke()}return ctx.canvas};this.tableSprite=null;this.CheckCanvas=function(){this.m_dZoom=this.m_oWordControl.m_nZoomValue/100;var dPR=AscCommon.AscBrowser.retinaPixelRatio;var tablePict= this.DrawTablePict();if(tablePict)this.tableSprite=tablePict;var dKoef_mm_to_pix=g_dKoef_mm_to_pix*this.m_dZoom;dKoef_mm_to_pix*=dPR;var widthNew=dKoef_mm_to_pix*this.m_oPage.width_mm;var _width=10*Math.round(dPR)+widthNew;if(dPR>1)_width+=Math.round(dPR);var _height=8*g_dKoef_mm_to_pix*dPR;var intW=_width>>0;var intH=_height>>0;if(null==this.m_oCanvas){this.m_oCanvas=document.createElement("canvas");this.m_oCanvas.width=intW;this.m_oCanvas.height=intH}else{var oldW=this.m_oCanvas.width;var oldH= this.m_oCanvas.height;if(oldW!=intW||oldH!=intH){delete this.m_oCanvas;this.m_oCanvas=document.createElement("canvas");this.m_oCanvas.width=intW;this.m_oCanvas.height=intH}}return widthNew};this.CreateBackground=function(cachedPage,isattack){if(window["NATIVE_EDITOR_ENJINE"])return;if(null==cachedPage||undefined==cachedPage)return;this.m_oPage=cachedPage;var width=this.CheckCanvas();if(0==this.DragType){this.m_dMarginLeft=cachedPage.margin_left;this.m_dMarginRight=cachedPage.margin_right}var checker= this.RepaintChecker;var markup=this.m_oTableMarkup;if(this.CurrentObjectType==RULER_OBJECT_TYPE_COLUMNS)markup=this.m_oColumnMarkup;if(isattack!==true&&this.CurrentObjectType==checker.Type&&width==checker.Width)if(this.CurrentObjectType==RULER_OBJECT_TYPE_PARAGRAPH){if(this.m_dMarginLeft==checker.MarginLeft&&this.m_dMarginRight==checker.MarginRight)return}else if(this.CurrentObjectType==RULER_OBJECT_TYPE_TABLE){var oldcount=checker.tableCols.length;var newcount=1+markup.Cols.length;if(oldcount==newcount){var arr1= checker.tableCols;var arr2=markup.Cols;if(arr1[0]==markup.X){var _break=false;for(var i=1;i>0;right_margin=this.m_dMarginRight*dKoef_mm_to_pix>>0;checker.MarginLeft= this.m_dMarginLeft;checker.MarginRight=this.m_dMarginRight}else if(this.CurrentObjectType==RULER_OBJECT_TYPE_TABLE&&null!=markup){var _cols=checker.tableCols;if(0!=_cols.length)_cols.splice(0,_cols.length);_cols[0]=markup.X;var _ml=checker.marginsLeft;if(0!=_ml.length)_ml.splice(0,_ml.length);var _mr=checker.marginsRight;if(0!=_mr.length)_mr.splice(0,_mr.length);var _count_=markup.Cols.length;for(var i=0;i<_count_;i++){_cols[i+1]=markup.Cols[i];_ml[i]=markup.Margins[i].Left;_mr[i]=markup.Margins[i].Right}if(0!= _count_){var _start=0;for(var i=0;i<_count_;i++)_start+=markup.Cols[i];left_margin=(markup.X+markup.Margins[0].Left)*dKoef_mm_to_pix>>0;right_margin=(markup.X+_start-markup.Margins[markup.Margins.length-1].Right)*dKoef_mm_to_pix>>0}}else if(this.CurrentObjectType==RULER_OBJECT_TYPE_COLUMNS&&null!=markup){left_margin=markup.X*dKoef_mm_to_pix>>0;right_margin=markup.R*dKoef_mm_to_pix>>0;checker.MarginLeft=this.m_dMarginLeft;checker.MarginRight=this.m_dMarginRight;checker.columns=this.m_oColumnMarkup.CreateDuplicate()}var indent= .5*Math.round(dPR);context.fillStyle=GlobalSkin.RulerLight;context.fillRect(left_margin+indent,this.m_nTop+indent,right_margin-left_margin,this.m_nBottom-this.m_nTop);var intW=width>>0;if(true){context.beginPath();context.fillStyle=GlobalSkin.RulerDark;context.fillRect(indent,this.m_nTop+indent,left_margin,this.m_nBottom-this.m_nTop);context.fillRect(right_margin+indent,this.m_nTop+indent,Math.max(intW-right_margin,1),this.m_nBottom-this.m_nTop);context.beginPath()}context.beginPath();context.lineWidth= Math.round(dPR);context.strokeStyle=GlobalSkin.RulerTextColor;context.fillStyle=GlobalSkin.RulerTextColor;var mm_1_4=10*dKoef_mm_to_pix/4;var inch_1_8=25.4*dKoef_mm_to_pix/8;var isDraw1_4=mm_1_4>7?true:false;var middleVert=(this.m_nTop+this.m_nBottom)/2;var part1=1.5*Math.round(dPR);var part2=2.5*Math.round(dPR);context.font=Math.round(7*dPR)+"pt Arial";if(this.Units==c_oAscDocumentUnits.Millimeter){var lCount1=(width-left_margin)/mm_1_4>>0;var lCount2=left_margin/mm_1_4>>0;var index=0;var num=0; for(var i=1;i>0)+indent;index++;if(index==4)index=0;if(0==index){num++;var strNum=""+num;var lWidthText=context.measureText(strNum).width;lXPos-=lWidthText/2;context.fillText(strNum,lXPos,this.m_nBottom-Math.round(3*dPR))}else if(1==index&&isDraw1_4){context.beginPath();context.moveTo(lXPos,middleVert-part1);context.lineTo(lXPos,middleVert+part1);context.stroke()}else if(2==index){context.beginPath();context.moveTo(lXPos,middleVert-part2);context.lineTo(lXPos, middleVert+part2);context.stroke()}else if(isDraw1_4){context.beginPath();context.moveTo(lXPos,middleVert-part1);context.lineTo(lXPos,middleVert+part1);context.stroke()}}index=0;num=0;for(var i=1;i<=lCount2;i++){var lXPos=(left_margin-i*mm_1_4>>0)+indent;index++;if(index==4)index=0;if(0==index){num++;var strNum=""+num;var lWidthText=context.measureText(strNum).width;lXPos-=lWidthText/2;context.fillText(strNum,lXPos,this.m_nBottom-Math.round(3*dPR))}else if(1==index&&isDraw1_4){context.beginPath(); context.moveTo(lXPos,middleVert-part1);context.lineTo(lXPos,middleVert+part1);context.stroke()}else if(2==index){context.beginPath();context.moveTo(lXPos,middleVert-part2);context.lineTo(lXPos,middleVert+part2);context.stroke()}else if(isDraw1_4){context.beginPath();context.moveTo(lXPos,middleVert-part1);context.lineTo(lXPos,middleVert+part1);context.stroke()}}}else if(this.Units==c_oAscDocumentUnits.Inch){var lCount1=(width-left_margin)/inch_1_8>>0;var lCount2=left_margin/inch_1_8>>0;var index=0; var num=0;for(var i=1;i>0)+indent;index++;if(index==8)index=0;if(0==index){num++;var strNum=""+num;var lWidthText=context.measureText(strNum).width;lXPos-=lWidthText/2;context.fillText(strNum,lXPos,this.m_nBottom-Math.round(3*dPR))}else if(4==index){context.beginPath();context.moveTo(lXPos,middleVert-part2);context.lineTo(lXPos,middleVert+part2);context.stroke()}else if(inch_1_8>8){context.beginPath();context.moveTo(lXPos,middleVert-part1);context.lineTo(lXPos, middleVert+part1);context.stroke()}}index=0;num=0;for(var i=1;i<=lCount2;i++){var lXPos=(left_margin-i*inch_1_8>>0)+indent;index++;if(index==8)index=0;if(0==index){num++;var strNum=""+num;var lWidthText=context.measureText(strNum).width;lXPos-=lWidthText/2;context.fillText(strNum,lXPos,this.m_nBottom-Math.round(3*dPR))}else if(4==index){context.beginPath();context.moveTo(lXPos,middleVert-part2);context.lineTo(lXPos,middleVert+part2);context.stroke()}else if(inch_1_8>8){context.beginPath();context.moveTo(lXPos, middleVert-part1);context.lineTo(lXPos,middleVert+part1);context.stroke()}}}else if(this.Units==c_oAscDocumentUnits.Point){var point_1_12=25.4*dKoef_mm_to_pix/12;var lCount1=(width-left_margin)/point_1_12>>0;var lCount2=left_margin/point_1_12>>0;var index=0;var num=0;for(var i=1;i>0)+indent;index++;if(index==12)index=0;if(0==index||6==index){num++;var strNum=""+num*36;var lWidthText=context.measureText(strNum).width;lXPos-=lWidthText/2;context.fillText(strNum, lXPos,this.m_nBottom-Math.round(3*dPR))}else if(point_1_12>5){context.beginPath();context.moveTo(lXPos,middleVert-part1);context.lineTo(lXPos,middleVert+part1);context.stroke()}}index=0;num=0;for(var i=1;i<=lCount2;i++){var lXPos=(left_margin-i*point_1_12>>0)+indent;index++;if(index==12)index=0;if(0==index||6==index){num++;var strNum=""+num*36;var lWidthText=context.measureText(strNum).width;lXPos-=lWidthText/2;context.fillText(strNum,lXPos,this.m_nBottom-Math.round(3*dPR))}else if(point_1_12>5){context.beginPath(); context.moveTo(lXPos,middleVert-part1);context.lineTo(lXPos,middleVert+part1);context.stroke()}}}if(null!=markup&&this.CurrentObjectType==RULER_OBJECT_TYPE_TABLE){var _count=markup.Cols.length;if(0!=_count){context.fillStyle=GlobalSkin.RulerDark;context.strokeStyle=GlobalSkin.RulerOutline;var _offset=markup.X;for(var i=0;i<=_count;i++){var __xID=0;__xID=-2.5*dPR+_offset*dKoef_mm_to_pix>>0;var __yID=this.m_nBottom-Math.round(10*dPR);if(0==i){context.drawImage(this.tableSprite,__xID,__yID);_offset+= markup.Cols[i];continue}if(i==_count){context.drawImage(this.tableSprite,__xID,__yID);break}var __x=((_offset-markup.Margins[i-1].Right)*dKoef_mm_to_pix>>0)+indent;var __r=((_offset+markup.Margins[i].Left)*dKoef_mm_to_pix>>0)+indent;context.fillRect(__x,this.m_nTop+indent,__r-__x,this.m_nBottom-this.m_nTop);context.strokeRect(__x,this.m_nTop+indent,__r-__x,this.m_nBottom-this.m_nTop);context.drawImage(this.tableSprite,__xID,__yID);_offset+=markup.Cols[i]}}}if(null!=markup&&this.CurrentObjectType== RULER_OBJECT_TYPE_COLUMNS){var _array=markup.EqualWidth?[]:markup.Cols;if(markup.EqualWidth){var _w=(markup.R-markup.X-markup.Space*(markup.Num-1))/markup.Num;for(var i=0;i>0;var __yID=this.m_nBottom-Math.round(10*dPR);var __x=(__xTmp*dKoef_mm_to_pix>>0)+indent;var __r=(__rTmp*dKoef_mm_to_pix>>0)+indent;context.fillRect(__x,this.m_nTop+indent,__r-__x,this.m_nBottom-this.m_nTop);context.strokeRect(__x,this.m_nTop+indent,__r-__x,this.m_nBottom-this.m_nTop);if(!markup.EqualWidth)context.drawImage(this.tableSprite,__xID,__yID);if(__r-__x>10){context.fillStyle=GlobalSkin.RulerLight; context.strokeStyle=GlobalSkin.RulerMarkersOutlineColor;var roundV1=Math.round(3*dPR);var roundV2=Math.round(6*dPR);context.fillRect(__x+roundV1,this.m_nTop+indent+roundV1,roundV1,this.m_nBottom-this.m_nTop-roundV2);context.fillRect(__r-roundV2,this.m_nTop+indent+roundV1,roundV1,this.m_nBottom-this.m_nTop-roundV2);context.strokeRect(__x+roundV1,this.m_nTop+indent+roundV1,roundV1,this.m_nBottom-this.m_nTop-roundV2);context.strokeRect(__r-roundV2,this.m_nTop+indent+roundV1,roundV1,this.m_nBottom-this.m_nTop- roundV2);context.fillStyle=GlobalSkin.RulerDark;context.strokeStyle=GlobalSkin.RulerOutline}_offsetX+=_array[i].W+_array[i].Space}}}context.beginPath();context.strokeStyle=GlobalSkin.RulerOutline;context.strokeRect(indent,this.m_nTop+indent,Math.max(intW-1,1),this.m_nBottom-this.m_nTop);context.beginPath();context.moveTo(left_margin+indent,this.m_nTop+indent);context.lineTo(left_margin+indent,this.m_nBottom-indent);context.moveTo(right_margin+indent,this.m_nTop+indent);context.lineTo(right_margin+ indent,this.m_nBottom-indent);context.stroke()};this.CorrectTabs=function(){this.m_dMaxTab=0;var _old_c=this.m_arrTabs.length;if(0==_old_c)return;var _old=this.m_arrTabs;var _new=[];for(var i=0;i<_old_c;i++)for(var j=i+1;j<_old_c;j++)if(_old[j].pos<_old[i].pos){var temp=_old[i];_old[i]=_old[j];_old[j]=temp}var _new_len=0;_new[_new_len++]=_old[0];for(var i=1;i<_old_c;i++)if(_new[_new_len-1].pos!=_old[i].pos)_new[_new_len++]=_old[i];this.m_arrTabs=null;this.m_arrTabs=_new;this.m_dMaxTab=this.m_arrTabs[_new_len- 1].pos};this.CalculateMargins=function(){if(this.CurrentObjectType==RULER_OBJECT_TYPE_TABLE){this.TableMarginLeft=0;this.TableMarginRight=0;var markup=this.m_oTableMarkup;var margin_left=markup.X;var _col=markup.CurCol;for(var i=0;i<_col;i++)margin_left+=markup.Cols[i];this.TableMarginLeft=margin_left+markup.Margins[_col].Left;this.TableMarginRight=margin_left+markup.Cols[_col]-markup.Margins[_col].Right}else if(this.CurrentObjectType==RULER_OBJECT_TYPE_COLUMNS){this.TableMarginLeft=0;this.TableMarginRight= 0;var markup=this.m_oColumnMarkup;if(markup.EqualWidth){var _w=(markup.R-markup.X-markup.Space*(markup.Num-1))/markup.Num;this.TableMarginLeft=markup.X+(_w+markup.Space)*markup.CurCol;this.TableMarginRight=this.TableMarginLeft+_w}else{var margin_left=markup.X;var _col=markup.CurCol;for(var i=0;i<_col;i++)margin_left+=markup.Cols[i].W+markup.Cols[i].Space;this.TableMarginLeft=margin_left;this.TableMarginRight=margin_left+markup.Cols[_col].W;var _x=markup.X;var _len=markup.Cols.length;for(var i=0;i< _len;i++){_x+=markup.Cols[i].W;if(i!=_len-1)_x+=markup.Cols[i].Space}markup.R=_x}}};this.OnMouseMove=function(left,top,e){var word_control=this.m_oWordControl;AscCommon.check_MouseMoveEvent(e);this.SimpleChanges.CheckMove();var hor_ruler=word_control.m_oTopRuler_horRuler;var dKoefPxToMM=100*g_dKoef_pix_to_mm/word_control.m_nZoomValue;var _x=global_mouseEvent.X-5*g_dKoef_mm_to_pix-left-word_control.X-word_control.GetMainContentBounds().L*g_dKoef_mm_to_pix;_x*=dKoefPxToMM;var _y=(global_mouseEvent.Y- word_control.Y)*g_dKoef_pix_to_mm;var dKoef_mm_to_pix=g_dKoef_mm_to_pix*this.m_dZoom;var mm_1_4=10/4;var mm_1_8=mm_1_4/2;var _margin_left=this.m_dMarginLeft;var _margin_right=this.m_dMarginRight;if(this.CurrentObjectType==RULER_OBJECT_TYPE_TABLE||this.CurrentObjectType==RULER_OBJECT_TYPE_COLUMNS){_margin_left=this.TableMarginLeft;_margin_right=this.TableMarginRight}var _presentations=false;if(word_control.EditorType==="presentations")_presentations=true;switch(this.DragType){case 0:{var position= this.CheckMouseType(_x,_y);if(1==position||2==position||8==position||9==position||10==position)word_control.m_oDrawingDocument.SetCursorType("w-resize");else word_control.m_oDrawingDocument.SetCursorType("default");break}case 1:{var newVal=RulerCorrectPosition(this,_x,_margin_left);if(newVal<0)newVal=0;var max=this.m_dMarginRight-20;if(0max)newVal=max;var _max_ind=Math.max(this.m_dIndentLeft,this.m_dIndentLeftFirst);if(newVal+ _max_ind>max)newVal=max-_max_ind;this.m_dMarginLeft=newVal;word_control.UpdateHorRulerBack();var pos=left+this.m_dMarginLeft*dKoef_mm_to_pix;word_control.m_oOverlayApi.VertLine(pos);word_control.m_oDrawingDocument.SetCursorType("w-resize");break}case 2:{var newVal=RulerCorrectPosition(this,_x,_margin_left);var min=this.m_dMarginLeft;if(this.m_dMarginLeft+this.m_dIndentLeft>min)min=this.m_dMarginLeft+this.m_dIndentLeft;if(this.m_dMarginLeft+this.m_dIndentLeftFirst>min)min=this.m_dMarginLeft+this.m_dIndentLeftFirst; min+=20;if(newValthis.m_oPage.width_mm)newVal=this.m_oPage.width_mm;if(newVal-this.m_dIndentRightthis.m_dIndentLeft)max=max+(this.m_dIndentLeft-this.m_dIndentLeftFirst);if(newVal>max-20)newVal=Math.max(max-20,this.m_dIndentLeft_old+_margin_left);var newIndent=newVal-_margin_left;this.m_dIndentLeftFirst= this.m_dIndentLeftFirst-this.m_dIndentLeft+newIndent;this.m_dIndentLeft=newIndent;word_control.UpdateHorRulerBack();var pos=left+(_margin_left+this.m_dIndentLeft)*dKoef_mm_to_pix;word_control.m_oOverlayApi.VertLine(pos);break}case 4:{var newVal=RulerCorrectPosition(this,_x,_margin_left);if(newVal<0)newVal=0;var max=_margin_right-20;if(0max)newVal=Math.max(max,_margin_left+this.m_dIndentLeft_old); this.m_dIndentLeft=newVal-_margin_left;word_control.UpdateHorRulerBack();var pos=left+(_margin_left+this.m_dIndentLeft)*dKoef_mm_to_pix;word_control.m_oOverlayApi.VertLine(pos);break}case 5:{var newVal=RulerCorrectPosition(this,_x,_margin_left);if(newVal<0)newVal=0;var max=_margin_right-20;if(0max)newVal=Math.max(max,_margin_left+this.m_dIndentLeftFirst_old);this.m_dIndentLeftFirst= newVal-_margin_left;word_control.UpdateHorRulerBack();var pos=left+(_margin_left+this.m_dIndentLeftFirst)*dKoef_mm_to_pix;word_control.m_oOverlayApi.VertLine(pos);break}case 6:{var newVal=RulerCorrectPosition(this,_x,_margin_left);if(newVal>this.m_oPage.width_mm)newVal=this.m_oPage.width_mm;var min=_margin_left;if(_margin_left+this.m_dIndentLeft>min)min=_margin_left+this.m_dIndentLeft;if(_margin_left+this.m_dIndentLeftFirst>min)min=_margin_left+this.m_dIndentLeftFirst;min+=20;if(newVal_margin_right)newVal=_margin_right;this.m_dIndentRight=_margin_right-newVal;word_control.UpdateHorRulerBack();var pos=left+(_margin_right-this.m_dIndentRight)*dKoef_mm_to_pix;word_control.m_oOverlayApi.VertLine(pos);break}case 7:{var newVal=RulerCorrectPosition(this,_x,_margin_left);this.m_dCurrentTabNewPosition=newVal-_margin_left;var pos=left+(_margin_left+this.m_dCurrentTabNewPosition)*dKoef_mm_to_pix;if(_y<=3||_y> 5.6){this.IsDrawingCurTab=false;word_control.OnUpdateOverlay()}else this.IsDrawingCurTab=true;word_control.UpdateHorRulerBack();if(this.IsDrawingCurTab)word_control.m_oOverlayApi.VertLine(pos);break}case 8:{var newVal=RulerCorrectPosition(this,_x,this.TableMarginLeftTrackStart);var _min=0;var _max=this.m_oPage.width_mm;var markup=this.m_oTableMarkup;var _left=0;if(this.DragTablePos>0){var start=markup.X;for(var i=1;i_max)newVal=_max;if(0==this.DragTablePos)markup.X=newVal;else markup.Cols[this.DragTablePos-1]=newVal-_left;this.CalculateMargins();word_control.UpdateHorRulerBack();var pos=left+newVal*dKoef_mm_to_pix;word_control.m_oOverlayApi.VertLine(pos);break}case 9:{var newVal=RulerCorrectPosition(this,_x,this.TableMarginLeftTrackStart);var markup=this.m_oColumnMarkup;if(markup.EqualWidth)if(0==this.DragTablePos){var _min= 0;var _max=markup.R-markup.Num*10-(markup.Num-1)*markup.Space;if(newVal<_min)newVal=_min;if(newVal>_max)newVal=_max;markup.X=newVal}else if(2*markup.Num-1==this.DragTablePos){var _min=markup.X+markup.Num*10+(markup.Num-1)*markup.Space;var _max=this.m_oPage.width_mm;if(newVal<_min)newVal=_min;if(newVal>_max)newVal=_max;markup.R=newVal}else{var bIsLeftSpace=(this.DragTablePos&1)==1;var _spaceMax=(markup.R-markup.X-10*markup.Num)/(markup.Num-1);var _col=this.DragTablePos+1>>1;var _center=_col*(markup.R- markup.X+markup.Space)/markup.Num-markup.Space/2;newVal-=markup.X;if(bIsLeftSpace){var _min=_center-_spaceMax/2;var _max=_center;if(newVal<_min)newVal=_min;if(newVal>_max)newVal=_max;markup.Space=Math.abs((newVal-_center)*2)}else{var _min=_center;var _max=_center+_spaceMax/2;if(newVal<_min)newVal=_min;if(newVal>_max)newVal=_max;markup.Space=Math.abs((newVal-_center)*2)}newVal+=markup.X}else{var bIsLeftSpace=(this.DragTablePos&1)==1;var nSpaceNumber=this.DragTablePos+1>>1;var _min=0;var _max=this.m_oPage.width_mm; if(0==nSpaceNumber){_max=markup.X+markup.Cols[0].W-10;if(newVal<_min)newVal=_min;if(newVal>_max)newVal=_max;var _delta=markup.X-newVal;markup.X-=_delta;markup.Cols[0].W+=_delta}else{var _offsetX=markup.X;for(var i=0;i_max)newVal=_max;markup.Cols[nSpaceNumber-1].W=newVal-_min;markup.Cols[nSpaceNumber-1].Space=_max-newVal;if(nSpaceNumber==markup.Num)markup.R=newVal}else{_max=_min+markup.Cols[nSpaceNumber-1].Space+markup.Cols[nSpaceNumber].W;var _natMax=_max-10;if(newVal<_min)newVal=_min;if(newVal>_natMax)newVal=_natMax;markup.Cols[nSpaceNumber-1].Space=newVal-_min;markup.Cols[nSpaceNumber].W=_max-newVal}}}this.CalculateMargins();word_control.UpdateHorRulerBack();var pos=left+newVal* dKoef_mm_to_pix;word_control.m_oOverlayApi.VertLine(pos);break}case 10:{var newVal=RulerCorrectPosition(this,_x,this.TableMarginLeftTrackStart);var markup=this.m_oColumnMarkup;var _min=markup.X;for(var i=0;i_natMax)newVal=_natMax;var _delta=newVal-(_min+markup.Cols[this.DragTablePos].W+markup.Cols[this.DragTablePos].Space/2);markup.Cols[this.DragTablePos].W+=_delta;markup.Cols[this.DragTablePos+1].W-=_delta;this.CalculateMargins();word_control.UpdateHorRulerBack();var pos=left+newVal*dKoef_mm_to_pix;word_control.m_oOverlayApi.VertLine(pos);break}}};this.CheckMouseType=function(x,y,isMouseDown,isNegative){var _top=1.8;var _bottom=5.2;var _margin_left=this.m_dMarginLeft; var _margin_right=this.m_dMarginRight;if(this.CurrentObjectType==RULER_OBJECT_TYPE_TABLE||this.CurrentObjectType==RULER_OBJECT_TYPE_COLUMNS){_margin_left=this.TableMarginLeft;_margin_right=this.TableMarginRight}var posL=_margin_left;if(_margin_left+this.m_dIndentLeft>posL)posL=_margin_left+this.m_dIndentLeft;if(_margin_left+this.m_dIndentLeftFirst>posL)posL=_margin_left+this.m_dIndentLeftFirst;var posR=_margin_right;if(this.m_dIndentRight>0)posR=_margin_right-this.m_dIndentRight;if(this.IsCanMoveAnyMarkers&& posL=3&&y<=_bottom){var _count_tabs=this.m_arrTabs.length;for(var i=0;i<_count_tabs;i++){var _pos=_margin_left+this.m_arrTabs[i].pos;if(x>=_pos-1&&x<=_pos+1){if(true===isMouseDown)this.m_lCurrentTab=i;return 7}}}var dCenterX=_margin_left+this.m_dIndentLeft;var var1=dCenterX-1;var var2=1.4;var var3=1.5;var var4=dCenterX+1;if(x>=var1&&x<=var4)if(y>=_bottom&&y<_bottom+var2)return 3;else if(y>_bottom-var3&&y<_bottom)return 4;dCenterX=_margin_right-this.m_dIndentRight;var1=dCenterX-1;var4= dCenterX+1;if(x>=var1&&x<=var4)if(y>_bottom-var3&&y<_bottom)return 6;dCenterX=_margin_left+this.m_dIndentLeftFirst;var1=dCenterX-1;var4=dCenterX+1;if(x>=var1&&x<=var4)if(y>_top-1&&y<_top+1.68){if(0==this.m_dIndentLeftFirst&&0==this.m_dIndentLeft&&this.CurrentObjectType==RULER_OBJECT_TYPE_PARAGRAPH&&this.IsCanMoveMargins)if(y>_top+1)return 1;return 5}}var isColumnsInside=false;var isColumnsInside2=false;var isTableInside=false;if(this.CurrentObjectType==RULER_OBJECT_TYPE_PARAGRAPH&&this.IsCanMoveMargins){if(y>= _top&&y<=_bottom){if(Math.abs(x-this.m_dMarginLeft)<1)return 1;else if(Math.abs(x-this.m_dMarginRight)<1)return 2;if(isNegative){if(xthis.m_dMarginRight)return-2}}}else if(this.CurrentObjectType==RULER_OBJECT_TYPE_TABLE){var nTI_x=0;var nTI_r=0;if(y>=_top&&y<=_bottom){var markup=this.m_oTableMarkup;var pos=markup.X;var _count=markup.Cols.length;for(var i=0;i<=_count;i++){if(Math.abs(x-pos)<1){this.DragTablePos=i;return 8}if(i==_count){nTI_r=pos;break}if(i==0)nTI_x= pos;pos+=markup.Cols[i]}}if(x>nTI_x&&x=_top&&y<=_bottom){var markup=this.m_oColumnMarkup;var nCI_x=markup.X;var nCI_r=nCI_x;if(markup.EqualWidth){var _w=(markup.R-markup.X-markup.Space*(markup.Num-1))/markup.Num;var _x=markup.X;var _index=0;for(var i=0;i_x-2){this.DragTablePos=_index;return 9}++_index;_x+=_w;nCI_r= _x;if(i==markup.Num-1){if(Math.abs(x-_x)<1){this.DragTablePos=_index;return 9}}else{if(x<_x+2&&x>_x-1){this.DragTablePos=_index;return 9}if(x>_x&&x<_x+markup.Space)isColumnsInside=true}++_index;_x+=markup.Space}}else{var _x=markup.X;var _index=0;for(var i=0;i_x-2){this.DragTablePos=_index;return 9}++_index;_x+=markup.Cols[i].W;nCI_r=_x;if(i==markup.Num-1){if(Math.abs(x-_x)<1){this.DragTablePos= _index;return 9}}else if(x<_x+2&&x>_x-1){this.DragTablePos=_index;return 9}if(i!=markup.Cols.length-1){if(Math.abs(x-(_x+markup.Cols[i].Space/2))<1){this.DragTablePos=i;return 10}if(x>_x&&x<_x+markup.Cols[i].Space)isColumnsInside=true}++_index;_x+=markup.Cols[i].Space}}if(x>nCI_x&&x=_top&&y<=_bottom&&!isTableInside){if(x<_margin_left)return-1;if(x>_margin_right)return-2}}return 0};this.OnMouseDown= function(left,top,e){var word_control=this.m_oWordControl;if(true===word_control.m_oApi.isStartAddShape){word_control.m_oApi.sync_EndAddShape();word_control.m_oApi.sync_StartAddShapeCallback(false)}AscCommon.check_MouseDownEvent(e,true);global_mouseEvent.LockMouse();this.SimpleChanges.Reinit();var dKoefPxToMM=100*g_dKoef_pix_to_mm/word_control.m_nZoomValue;var dKoef_mm_to_pix=g_dKoef_mm_to_pix*this.m_dZoom;var _x=global_mouseEvent.X-5*g_dKoef_mm_to_pix-left-word_control.X-word_control.GetMainContentBounds().L* g_dKoef_mm_to_pix;_x*=dKoefPxToMM;var _y=(global_mouseEvent.Y-word_control.Y)*g_dKoef_pix_to_mm;this.DragType=this.CheckMouseType(_x,_y,true,true);if(this.DragType<0){this.DragTypeMouseDown=-this.DragType;this.DragType=0}else this.DragTypeMouseDown=this.DragType;if(global_mouseEvent.ClickCount>1){var eventType="";switch(this.DragTypeMouseDown){case 1:case 2:{eventType="margins";break}case 3:case 4:case 5:case 6:{eventType="indents";break}case 7:{eventType="tabs";break}case 8:{eventType="tables";break}case 9:case 10:{eventType= "columns";break}default:break}if(eventType!=""){word_control.m_oApi.sendEvent("asc_onRulerDblClick",eventType);this.DragType=0;this.OnMouseUp(left,top,e);return}}var _margin_left=this.m_dMarginLeft;var _margin_right=this.m_dMarginRight;if(this.CurrentObjectType==RULER_OBJECT_TYPE_TABLE||this.CurrentObjectType==RULER_OBJECT_TYPE_COLUMNS){_margin_left=this.TableMarginLeft;_margin_right=this.TableMarginRight}this.m_bIsMouseDown=true;switch(this.DragType){case 1:{var pos=left+_margin_left*dKoef_mm_to_pix; word_control.m_oOverlayApi.VertLine(pos);break}case 2:{var pos=left+_margin_right*dKoef_mm_to_pix;word_control.m_oOverlayApi.VertLine(pos);break}case 3:{var pos=left+(_margin_left+this.m_dIndentLeft)*dKoef_mm_to_pix;word_control.m_oOverlayApi.VertLine(pos);this.m_dIndentLeft_old=this.m_dIndentLeft;this.m_dIndentLeftFirst_old=this.m_dIndentLeftFirst;break}case 4:{var pos=left+(_margin_left+this.m_dIndentLeft)*dKoef_mm_to_pix;word_control.m_oOverlayApi.VertLine(pos);this.m_dIndentLeft_old=this.m_dIndentLeft; break}case 5:{var pos=left+(_margin_left+this.m_dIndentLeftFirst)*dKoef_mm_to_pix;word_control.m_oOverlayApi.VertLine(pos);this.m_dIndentLeftFirst_old=this.m_dIndentLeftFirst;break}case 6:{var pos=left+(_margin_right-this.m_dIndentRight)*dKoef_mm_to_pix;word_control.m_oOverlayApi.VertLine(pos);this.m_dIndentRight_old=this.m_dIndentRight;break}case 7:{var pos=left+(_margin_left+this.m_arrTabs[this.m_lCurrentTab].pos)*dKoef_mm_to_pix;this.m_dCurrentTabNewPosition=this.m_arrTabs[this.m_lCurrentTab].pos; word_control.m_oOverlayApi.VertLine(pos);break}case 8:{var markup=this.m_oTableMarkup;var pos=markup.X;var _count=markup.Cols.length;for(var i=0;i>1)*(_w+markup.Space); if(this.DragTablePos&1==1)_x+=_w;pos=_x}else{var _x=markup.X;var _index=0;for(var i=0;i=3&&_y<=_bottom&&_x>=_margin_left+this.m_dIndentLeft&&_x<=_margin_right-this.m_dIndentRight){var mm_1_4= 10/4;var mm_1_8=mm_1_4/2;var _new_tab_pos=RulerCorrectPosition(this,_x,_margin_left);_new_tab_pos-=_margin_left;this.m_arrTabs[this.m_arrTabs.length]=new CTab(_new_tab_pos,word_control.m_nTabsType);word_control.UpdateHorRuler();this.m_lCurrentTab=this.m_arrTabs.length-1;this.DragType=7;this.m_dCurrentTabNewPosition=_new_tab_pos;var pos=left+(_margin_left+_new_tab_pos)*dKoef_mm_to_pix;word_control.m_oOverlayApi.VertLine(pos)}}word_control.m_oDrawingDocument.LockCursorTypeCur()};this.OnMouseUp=function(left, top,e){var word_control=this.m_oWordControl;this.m_oWordControl.OnUpdateOverlay();var lockedElement=AscCommon.check_MouseUpEvent(e);this.m_dIndentLeft_old=-1E4;this.m_dIndentLeftFirst_old=-1E4;this.m_dIndentRight_old=-1E4;if(7!=this.DragType)word_control.UpdateHorRuler();var _margin_left=this.m_dMarginLeft;var _margin_right=this.m_dMarginRight;if(this.CurrentObjectType==RULER_OBJECT_TYPE_TABLE||this.CurrentObjectType==RULER_OBJECT_TYPE_COLUMNS){_margin_left=this.TableMarginLeft;_margin_right=this.TableMarginRight}switch(this.DragType){case 1:case 2:{if(!this.SimpleChanges.IsSimple)this.SetMarginProperties(); break}case 3:case 4:case 5:case 6:{if(!this.SimpleChanges.IsSimple)this.SetPrProperties();else word_control.OnUpdateOverlay();break}case 7:{var _y=(global_mouseEvent.Y-word_control.Y)*g_dKoef_pix_to_mm;if(_y<=3||_y>5.6||this.m_dCurrentTabNewPosition_margin_right-this.m_dIndentRight){if(-1!=this.m_lCurrentTab)this.m_arrTabs.splice(this.m_lCurrentTab,1)}else if(this.m_lCurrentTab5.6||this.m_dCurrentTabNewPosition_margin_right-this.m_dIndentRight){if(-1!=this.m_lCurrentTab)this.m_arrTabs.splice(this.m_lCurrentTab,1)}else if(this.m_lCurrentTab< this.m_arrTabs.length)this.m_arrTabs[this.m_lCurrentTab].pos=this.m_dCurrentTabNewPosition;this.m_lCurrentTab=-1;this.CorrectTabs();this.m_oWordControl.UpdateHorRuler();this.SetTabsProperties();break}case 8:{if(!this.SimpleChanges.IsSimple)this.SetTableProperties();this.DragTablePos=-1;break}case 9:case 10:{if(!this.SimpleChanges.IsSimple)this.SetColumnsProperties();this.DragTablePos=-1;break}}if(7==this.DragType)word_control.UpdateHorRuler();this.IsDrawingCurTab=true;this.DragType=0;this.m_bIsMouseDown= false;this.m_oWordControl.m_oDrawingDocument.UnlockCursorType();this.SimpleChanges.Clear()};this.SetTabsProperties=function(){var _arr=new CParaTabs;var _c=this.m_arrTabs.length;for(var i=0;i<_c;i++)if(this.m_arrTabs[i].type==tab_Left||this.m_arrTabs[i].type==tab_Right||this.m_arrTabs[i].type==tab_Center)_arr.Add(new CParaTab(this.m_arrTabs[i].type,this.m_arrTabs[i].pos,this.m_arrTabs[i].leader));if(false===this.m_oWordControl.m_oLogicDocument.Document_Is_SelectionLocked(AscCommon.changestype_Paragraph_Properties)){this.m_oWordControl.m_oLogicDocument.StartAction(AscDFH.historydescription_Document_SetParagraphTabs); this.m_oWordControl.m_oLogicDocument.SetParagraphTabs(_arr);this.m_oWordControl.m_oLogicDocument.FinalizeAction()}};this.SetPrProperties=function(){if(false===this.m_oWordControl.m_oLogicDocument.Document_Is_SelectionLocked(AscCommon.changestype_Paragraph_Properties)){this.m_oWordControl.m_oLogicDocument.StartAction(AscDFH.historydescription_Document_SetParagraphIndentFromRulers);this.m_oWordControl.m_oLogicDocument.SetParagraphIndent({Left:this.m_dIndentLeft,Right:this.m_dIndentRight,FirstLine:this.m_dIndentLeftFirst- this.m_dIndentLeft});this.m_oWordControl.m_oLogicDocument.Document_UpdateInterfaceState();this.m_oWordControl.m_oLogicDocument.FinalizeAction()}};this.SetMarginProperties=function(){if(false===this.m_oWordControl.m_oLogicDocument.Document_Is_SelectionLocked(AscCommon.changestype_Document_SectPr)){this.m_oWordControl.m_oLogicDocument.StartAction(AscDFH.historydescription_Document_SetDocumentMargin_Hor);this.m_oWordControl.m_oLogicDocument.SetDocumentMargin({Left:this.m_dMarginLeft,Right:this.m_dMarginRight}, true);this.m_oWordControl.m_oLogicDocument.FinalizeAction()}};this.SetTableProperties=function(){if(false===this.m_oWordControl.m_oLogicDocument.Document_Is_SelectionLocked(AscCommon.changestype_Table_Properties)){this.m_oWordControl.m_oLogicDocument.StartAction(AscDFH.historydescription_Document_SetTableMarkup_Hor);this.m_oTableMarkup.CorrectTo();this.m_oTableMarkup.Table.Update_TableMarkupFromRuler(this.m_oTableMarkup,true,this.DragTablePos);if(this.m_oTableMarkup)this.m_oTableMarkup.CorrectFrom(); this.m_oWordControl.m_oLogicDocument.UpdateInterface();this.m_oWordControl.m_oLogicDocument.UpdateRulers();this.m_oWordControl.m_oLogicDocument.FinalizeAction()}};this.SetColumnsProperties=function(){this.m_oWordControl.m_oLogicDocument.Update_ColumnsMarkupFromRuler(this.m_oColumnMarkup)};this.BlitToMain=function(left,top,htmlElement){var dPR=AscCommon.AscBrowser.retinaPixelRatio;left=Math.round(dPR*left);var _margin_left=this.m_dMarginLeft;var _margin_right=this.m_dMarginRight;if(this.CurrentObjectType== RULER_OBJECT_TYPE_TABLE||this.CurrentObjectType==RULER_OBJECT_TYPE_COLUMNS){_margin_left=this.TableMarginLeft;_margin_right=this.TableMarginRight}var checker=this.RepaintChecker;if(!checker.BlitAttack&&left==checker.BlitLeft&&!this.m_bIsMouseDown)if(checker.BlitIndentLeft==this.m_dIndentLeft&&checker.BlitIndentLeftFirst==this.m_dIndentLeftFirst&&checker.BlitIndentRight==this.m_dIndentRight&&checker.BlitDefaultTab==this.m_dDefaultTab&&_margin_left==checker.BlitMarginLeftInd&&_margin_right==checker.BlitMarginRightInd){var _count1= 0;if(null!=checker.BlitTabs)_count1=checker.BlitTabs.length;var _count2=this.m_arrTabs.length;if(_count1==_count2){var bIsBreak=false;for(var ii=0;ii<_count1;ii++)if(checker.BlitTabs[ii].type!=this.m_arrTabs[ii].type||checker.BlitTabs[ii].pos!=this.m_arrTabs[ii].pos){bIsBreak=true;break}if(false===bIsBreak)return}}checker.BlitAttack=false;htmlElement.width=htmlElement.width;var context=htmlElement.getContext("2d");context.setTransform(1,0,0,1,0,0);if(null!=this.m_oCanvas){checker.BlitLeft=left;checker.BlitIndentLeft= this.m_dIndentLeft;checker.BlitIndentLeftFirst=this.m_dIndentLeftFirst;checker.BlitIndentRight=this.m_dIndentRight;checker.BlitDefaultTab=this.m_dDefaultTab;checker.BlitTabs=null;if(0!=this.m_arrTabs.length){checker.BlitTabs=[];var _len=this.m_arrTabs.length;for(var ii=0;ii<_len;ii++)checker.BlitTabs[ii]={type:this.m_arrTabs[ii].type,pos:this.m_arrTabs[ii].pos}}var roundDPR=Math.round(dPR);var indent=.5*roundDPR;context.drawImage(this.m_oCanvas,5*roundDPR,0,this.m_oCanvas.width-10*roundDPR,this.m_oCanvas.height, left,0,this.m_oCanvas.width-10*roundDPR,this.m_oCanvas.height);if(!this.IsDrawAnyMarkers)return;var dKoef_mm_to_pix=g_dKoef_mm_to_pix*this.m_dZoom*dPR;var dCenterX=0;var var1=0;var var2=0;var var3=0;var var4=0;var _positon_y=this.m_nBottom-5*dPR;var2=5*dPR;var3=3*dPR;checker.BlitMarginLeftInd=_margin_left;checker.BlitMarginRightInd=_margin_right;var _1mm_to_pix=g_dKoef_mm_to_pix*dPR;context.strokeStyle=GlobalSkin.RulerMarkersOutlineColorOld;context.fillStyle=GlobalSkin.RulerMarkersFillColorOld;if(-1E4!= this.m_dIndentLeft_old&&this.m_dIndentLeft_old!=this.m_dIndentLeft){dCenterX=left+(_margin_left+this.m_dIndentLeft_old)*dKoef_mm_to_pix;var1=parseInt(dCenterX-_1mm_to_pix)-indent+Math.round(dPR)-1;var4=parseInt(dCenterX+_1mm_to_pix)+indent+Math.round(dPR)-1;if(0!=(var1-var4+Math.round(dPR)&1))var4+=1;context.beginPath();context.lineWidth=Math.round(dPR);context.moveTo(var1,this.m_nBottom+indent);context.lineTo(var4,this.m_nBottom+indent);context.lineTo(var4,this.m_nBottom+indent+Math.round(var2)); context.lineTo(var1,this.m_nBottom+indent+Math.round(var2));context.lineTo(var1,this.m_nBottom+indent);context.lineTo(var1,this.m_nBottom+indent-Math.round(var3));context.lineTo((var1+var4)/2,this.m_nBottom-Math.round(var2*1.2));context.lineTo(var4,this.m_nBottom+indent-Math.round(var3));context.lineTo(var4,this.m_nBottom+indent);context.fill();context.stroke()}if(-1E4!=this.m_dIndentLeftFirst_old&&this.m_dIndentLeftFirst_old!=this.m_dIndentLeftFirst){dCenterX=left+(_margin_left+this.m_dIndentLeftFirst_old)* dKoef_mm_to_pix;var1=parseInt(dCenterX-_1mm_to_pix)-indent+Math.round(dPR)-1;var4=parseInt(dCenterX+_1mm_to_pix)+indent+Math.round(dPR)-1;if(0!=(var1-var4+Math.round(dPR)&1))var4+=1;context.beginPath();context.lineWidth=Math.round(dPR);context.moveTo(var1,this.m_nTop+indent);context.lineTo(var1,this.m_nTop+indent-Math.round(var3));context.lineTo(var4,this.m_nTop+indent-Math.round(var3));context.lineTo(var4,this.m_nTop+indent);context.lineTo((var1+var4)/2,this.m_nTop+Math.round(var2*1.2));context.closePath(); context.fill();context.stroke()}if(-1E4!=this.m_dIndentRight_old&&this.m_dIndentRight_old!=this.m_dIndentRight){dCenterX=left+(_margin_right-this.m_dIndentRight_old)*dKoef_mm_to_pix;var1=parseInt(dCenterX-_1mm_to_pix)-indent+Math.round(dPR)-1;var4=parseInt(dCenterX+_1mm_to_pix)+indent+Math.round(dPR)-1;if(0!=(var1-var4+Math.round(dPR)&1))var4+=1;context.beginPath();context.lineWidth=Math.round(dPR);context.moveTo(var1,this.m_nBottom+indent);context.lineTo(var4,this.m_nBottom+indent);context.lineTo(var4, this.m_nBottom+indent-Math.round(var3));context.lineTo((var1+var4)/2,this.m_nBottom-Math.round(var2*1.2));context.lineTo(var1,this.m_nBottom+indent-Math.round(var3));context.closePath();context.fill();context.stroke()}context.strokeStyle=GlobalSkin.RulerTabsColorOld;if(-1!=this.m_lCurrentTab&&this.m_lCurrentTabposL)posL=_margin_left+this.m_dIndentLeft;if(_margin_left+this.m_dIndentLeftFirst>posL)posL=_margin_left+this.m_dIndentLeftFirst;var posR=_margin_right;if(this.m_dIndentRight>0)posR=_margin_right-this.m_dIndentRight;if(posL.01)while(true){if(_margin_left+position_default_tab>this.m_dMarginRight)break;if(position_default_tab<_min_default_value){position_default_tab+=this.m_dDefaultTab;continue}var _x=parseInt((_margin_left+position_default_tab)*dKoef_mm_to_pix)+left+indent;context.beginPath();context.moveTo(_x,_positon_y);context.lineTo(_x, _positon_y+Math.round(3*dPR));context.stroke();position_default_tab+=this.m_dDefaultTab}var _len_tabs=this.m_arrTabs.length;if(0!=_len_tabs){context.strokeStyle=GlobalSkin.RulerTabsColor;context.lineWidth=2*roundDPR;_positon_y=this.m_nBottom-Math.round(5*dPR);for(var i=0;i<_len_tabs;i++){var tab=this.m_arrTabs[i];var _x=0;if(i==this.m_lCurrentTab){if(!this.IsDrawingCurTab)continue;_x=parseInt((_margin_left+this.m_dCurrentTabNewPosition)*dKoef_mm_to_pix)+left}else{if(tab.pos_margin_right-this.m_dIndentRight)continue;_x=parseInt((_margin_left+tab.pos)*dKoef_mm_to_pix)+left}switch(tab.type){case tab_Left:{context.beginPath();context.moveTo(_x,_positon_y);context.lineTo(_x,_positon_y+Math.round(5*dPR));context.lineTo(_x+Math.round(5*dPR),_positon_y+Math.round(5*dPR));context.stroke();break}case tab_Right:{context.beginPath();context.moveTo(_x,_positon_y);context.lineTo(_x,_positon_y+Math.round(5*dPR));context.lineTo(_x-Math.round(5*dPR),_positon_y+Math.round(5* dPR));context.stroke();break}case tab_Center:{context.beginPath();context.moveTo(_x,_positon_y);context.lineTo(_x,_positon_y+Math.round(5*dPR));context.moveTo(_x-Math.round(5*dPR),_positon_y+Math.round(5*dPR));context.lineTo(_x+Math.round(5*dPR),_positon_y+Math.round(5*dPR));context.stroke();break}default:break}}}}}}function CVerRuler(){this.m_oPage=null;this.m_nLeft=0;this.m_nRight=0;this.m_dMarginTop=20;this.m_dMarginBottom=250;this.m_oCanvas=null;this.m_dZoom=1;this.DragType=0;this.CurrentObjectType= RULER_OBJECT_TYPE_PARAGRAPH;this.m_oTableMarkup=null;this.header_top=0;this.header_bottom=0;this.DragTablePos=-1;this.RepaintChecker=new CVerRulerRepaintChecker;this.IsCanMoveMargins=true;this.m_oWordControl=null;this.IsRetina=false;this.SimpleChanges=new RulerCheckSimpleChanges;this.Units=c_oAscDocumentUnits.Millimeter;this.CheckCanvas=function(){this.m_dZoom=this.m_oWordControl.m_nZoomValue/100;var dPR=AscCommon.AscBrowser.retinaPixelRatio;var dKoef_mm_to_pix=g_dKoef_mm_to_pix*this.m_dZoom*dPR; var heightNew=dKoef_mm_to_pix*this.m_oPage.height_mm;var _height=Math.round(10*dPR)+heightNew;if(dPR>1)_height+=Math.round(dPR);var _width=5*g_dKoef_mm_to_pix*dPR;var intW=_width>>0;var intH=_height>>0;if(null==this.m_oCanvas){this.m_oCanvas=document.createElement("canvas");this.m_oCanvas.width=intW;this.m_oCanvas.height=intH}else{var oldW=this.m_oCanvas.width;var oldH=this.m_oCanvas.height;if(oldW!=intW||oldH!=intH){delete this.m_oCanvas;this.m_oCanvas=document.createElement("canvas");this.m_oCanvas.width= intW;this.m_oCanvas.height=intH}}return heightNew};this.CreateBackground=function(cachedPage,isattack){if(window["NATIVE_EDITOR_ENJINE"])return;if(null==cachedPage||undefined==cachedPage)return;this.m_oPage=cachedPage;var height=this.CheckCanvas();if(0==this.DragType){this.m_dMarginTop=cachedPage.margin_top;this.m_dMarginBottom=cachedPage.margin_bottom}var checker=this.RepaintChecker;var markup=this.m_oTableMarkup;if(isattack!==true&&this.CurrentObjectType==checker.Type&&height==checker.Height)if(this.CurrentObjectType== RULER_OBJECT_TYPE_PARAGRAPH){if(this.m_dMarginTop==checker.MarginTop&&this.m_dMarginBottom==checker.MarginBottom)return}else if(this.CurrentObjectType==RULER_OBJECT_TYPE_HEADER||this.CurrentObjectType==RULER_OBJECT_TYPE_FOOTER){if(this.header_top==checker.HeaderTop&&this.header_bottom==checker.HeaderBottom)return}else if(this.CurrentObjectType==RULER_OBJECT_TYPE_TABLE){var oldcount=checker.rowsY.length;var newcount=markup.Rows.length;if(oldcount==newcount){var arr1=checker.rowsY;var arr2=checker.rowsH; var rows=markup.Rows;var _break=false;for(var i=0;i>0;bottom_margin=this.m_dMarginBottom*dKoef_mm_to_pix>>0;checker.MarginTop=this.m_dMarginTop;checker.MarginBottom=this.m_dMarginBottom}else if(RULER_OBJECT_TYPE_HEADER==this.CurrentObjectType||RULER_OBJECT_TYPE_FOOTER==this.CurrentObjectType){top_margin=this.header_top*dKoef_mm_to_pix>> 0;bottom_margin=this.header_bottom*dKoef_mm_to_pix>>0;checker.HeaderTop=this.header_top;checker.HeaderBottom=this.header_bottom}else if(RULER_OBJECT_TYPE_TABLE==this.CurrentObjectType){var _arr1=checker.rowsY;var _arr2=checker.rowsH;if(0!=_arr1.length)_arr1.splice(0,_arr1.length);if(0!=_arr2.length)_arr2.splice(0,_arr2.length);var _count=this.m_oTableMarkup.Rows.length;for(var i=0;i<_count;i++){_arr1[i]=markup.Rows[i].Y;_arr2[i]=markup.Rows[i].H}if(_count!=0){top_margin=markup.Rows[0].Y*dKoef_mm_to_pix>> 0;bottom_margin=(markup.Rows[_count-1].Y+markup.Rows[_count-1].H)*dKoef_mm_to_pix>>0}}var indent=.5*Math.round(dPR);if(bottom_margin>top_margin){context.fillStyle=GlobalSkin.RulerLight;context.fillRect(this.m_nLeft+indent,top_margin+indent,this.m_nRight-this.m_nLeft,bottom_margin-top_margin)}var intH=height>>0;if(true){context.beginPath();context.fillStyle=GlobalSkin.RulerDark;context.fillRect(this.m_nLeft+indent,indent,this.m_nRight-this.m_nLeft,top_margin);context.fillRect(this.m_nLeft+indent,bottom_margin+ indent,this.m_nRight-this.m_nLeft,Math.max(intH-bottom_margin,1));context.beginPath()}context.beginPath();context.lineWidth=Math.round(dPR);context.strokeStyle=GlobalSkin.RulerTextColor;context.fillStyle=GlobalSkin.RulerTextColor;var mm_1_4=10*dKoef_mm_to_pix/4;var isDraw1_4=mm_1_4>7?true:false;var inch_1_8=25.4*dKoef_mm_to_pix/8;var middleHor=(this.m_nLeft+this.m_nRight)/2;var part1=dPR;var part2=2.5*dPR;var l_part1=Math.floor(middleHor-part1);var r_part1=Math.ceil(middleHor+part1);var l_part2=Math.floor(middleHor- part2);var r_part2=Math.ceil(middleHor+part2);context.font=Math.round(7*dPR)+"pt Arial";if(this.Units==c_oAscDocumentUnits.Millimeter){var lCount1=(height-top_margin)/mm_1_4>>0;var lCount2=top_margin/mm_1_4>>0;var index=0;var num=0;for(var i=1;i>0)+indent;index++;if(index==4)index=0;if(0==index){num++;var strNum=""+num;var lWidthText=context.measureText(strNum).width;context.translate(middleHor,lYPos);context.rotate(-Math.PI/2);context.fillText(strNum, -lWidthText/2,Math.round(4*dPR));context.setTransform(1,0,0,1,0,Math.round(5*dPR))}else if(1==index&&isDraw1_4){context.beginPath();context.moveTo(l_part1,lYPos);context.lineTo(r_part1,lYPos);context.stroke()}else if(2==index){context.beginPath();context.moveTo(l_part2,lYPos);context.lineTo(r_part2,lYPos);context.stroke()}else if(isDraw1_4){context.beginPath();context.moveTo(l_part1,lYPos);context.lineTo(r_part1,lYPos);context.stroke()}}index=0;num=0;for(var i=1;i<=lCount2;i++){var lYPos=(top_margin- i*mm_1_4>>0)+indent;index++;if(index==4)index=0;if(0==index){num++;var strNum=""+num;var lWidthText=context.measureText(strNum).width;context.translate(middleHor,lYPos);context.rotate(-Math.PI/2);context.fillText(strNum,-lWidthText/2,Math.round(4*dPR));context.setTransform(1,0,0,1,0,Math.round(5*dPR))}else if(1==index&&isDraw1_4){context.beginPath();context.moveTo(l_part1,lYPos);context.lineTo(r_part1,lYPos);context.stroke()}else if(2==index){context.beginPath();context.moveTo(l_part2,lYPos);context.lineTo(r_part2, lYPos);context.stroke()}else if(isDraw1_4){context.beginPath();context.moveTo(l_part1,lYPos);context.lineTo(r_part1,lYPos);context.stroke()}}}else if(this.Units==c_oAscDocumentUnits.Inch){var lCount1=(height-top_margin)/inch_1_8>>0;var lCount2=top_margin/inch_1_8>>0;var index=0;var num=0;for(var i=1;i>0)+indent;index++;if(index==8)index=0;if(0==index){num++;var strNum=""+num;var lWidthText=context.measureText(strNum).width;context.translate(middleHor, lYPos);context.rotate(-Math.PI/2);context.fillText(strNum,-lWidthText/2,Math.round(4*dPR));context.setTransform(1,0,0,1,0,Math.round(5*dPR))}else if(4==index){context.beginPath();context.moveTo(l_part2,lYPos);context.lineTo(r_part2,lYPos);context.stroke()}else if(inch_1_8>8){context.beginPath();context.moveTo(l_part1,lYPos);context.lineTo(r_part1,lYPos);context.stroke()}}index=0;num=0;for(var i=1;i<=lCount2;i++){var lYPos=(top_margin-i*inch_1_8>>0)+indent;index++;if(index==8)index=0;if(0==index){num++; var strNum=""+num;var lWidthText=context.measureText(strNum).width;context.translate(middleHor,lYPos);context.rotate(-Math.PI/2);context.fillText(strNum,-lWidthText/2,Math.round(4*dPR));context.setTransform(1,0,0,1,0,Math.round(5*dPR))}else if(4==index){context.beginPath();context.moveTo(middleHor-part2,lYPos);context.lineTo(middleHor+part2,lYPos);context.stroke()}else if(inch_1_8>8){context.beginPath();context.moveTo(middleHor-part1,lYPos);context.lineTo(middleHor+part1,lYPos);context.stroke()}}}else if(this.Units== c_oAscDocumentUnits.Point){var point_1_12=25.4*dKoef_mm_to_pix/12;var lCount1=(height-top_margin)/point_1_12>>0;var lCount2=top_margin/point_1_12>>0;var index=0;var num=0;for(var i=1;i>0)+indent;index++;if(index==12)index=0;if(0==index||6==index){num++;var strNum=""+num*36;var lWidthText=context.measureText(strNum).width;context.translate(middleHor,lYPos);context.rotate(-Math.PI/2);context.fillText(strNum,-lWidthText/2,Math.round(4*dPR));context.setTransform(1, 0,0,1,0,Math.round(5*dPR))}else if(point_1_12>5){context.beginPath();context.moveTo(l_part1,lYPos);context.lineTo(r_part1,lYPos);context.stroke()}}index=0;num=0;for(var i=1;i<=lCount2;i++){var lYPos=(top_margin-i*point_1_12>>0)+indent;index++;if(index==12)index=0;if(0==index||6==index){num++;var strNum=""+num*36;var lWidthText=context.measureText(strNum).width;context.translate(middleHor,lYPos);context.rotate(-Math.PI/2);context.fillText(strNum,-lWidthText/2,Math.round(4*dPR));context.setTransform(1, 0,0,1,0,Math.round(5*dPR))}else if(point_1_12>5){context.beginPath();context.moveTo(l_part1,lYPos);context.lineTo(r_part1,lYPos);context.stroke()}}}if(this.CurrentObjectType==RULER_OBJECT_TYPE_TABLE&&null!=markup){var dPR=AscCommon.AscBrowser.retinaPixelRatio;var dKoef_mm_to_pix=g_dKoef_mm_to_pix*this.m_dZoom*dPR;var _count=markup.Rows.length;if(0==_count)return;var start_dark=((markup.Rows[0].Y+markup.Rows[0].H)*dKoef_mm_to_pix>>0)+indent;var end_dark=0;context.fillStyle=GlobalSkin.RulerDark;context.strokeStyle= GlobalSkin.RulerOutline;var _x=this.m_nLeft+indent;var _w=this.m_nRight-this.m_nLeft;for(var i=1;i<_count;i++){end_dark=(markup.Rows[i].Y*dKoef_mm_to_pix>>0)+indent;context.fillRect(_x,start_dark,_w,Math.max(end_dark-start_dark,Math.round(7*dPR)));context.strokeRect(_x,start_dark,_w,Math.max(end_dark-start_dark,Math.round(7*dPR)));start_dark=((markup.Rows[i].Y+markup.Rows[i].H)*dKoef_mm_to_pix>>0)+indent}}context.beginPath();context.strokeStyle=GlobalSkin.RulerOutline;context.strokeRect(this.m_nLeft+ indent,indent,this.m_nRight-this.m_nLeft,Math.max(intH-1,1));context.beginPath();context.moveTo(this.m_nLeft+indent,top_margin+indent);context.lineTo(this.m_nRight-indent,top_margin+indent);context.moveTo(this.m_nLeft+indent,bottom_margin+indent);context.lineTo(this.m_nRight-indent,bottom_margin+indent);context.stroke()};this.OnMouseMove=function(left,top,e){var word_control=this.m_oWordControl;AscCommon.check_MouseMoveEvent(e);this.SimpleChanges.CheckMove();var ver_ruler=word_control.m_oLeftRuler_vertRuler; var dKoefPxToMM=100*g_dKoef_pix_to_mm/word_control.m_nZoomValue;var _y=global_mouseEvent.Y-7*g_dKoef_mm_to_pix-top-word_control.Y;_y*=dKoefPxToMM;var _x=left*g_dKoef_pix_to_mm;var dKoef_mm_to_pix=g_dKoef_mm_to_pix*this.m_dZoom;var mm_1_4=10/4;var mm_1_8=mm_1_4/2;switch(this.DragType){case 0:{if(this.CurrentObjectType==RULER_OBJECT_TYPE_PARAGRAPH)if(this.IsCanMoveMargins&&(Math.abs(_y-this.m_dMarginTop)<1||Math.abs(_y-this.m_dMarginBottom)<1))word_control.m_oDrawingDocument.SetCursorType("s-resize"); else word_control.m_oDrawingDocument.SetCursorType("default");else if(this.CurrentObjectType==RULER_OBJECT_TYPE_HEADER)if(Math.abs(_y-this.header_top)<1||Math.abs(_y-this.header_bottom)<1)word_control.m_oDrawingDocument.SetCursorType("s-resize");else word_control.m_oDrawingDocument.SetCursorType("default");else if(this.CurrentObjectType==RULER_OBJECT_TYPE_FOOTER)if(Math.abs(_y-this.header_top)<1)word_control.m_oDrawingDocument.SetCursorType("s-resize");else word_control.m_oDrawingDocument.SetCursorType("default"); else if(this.CurrentObjectType==RULER_OBJECT_TYPE_TABLE){var type=this.CheckMouseType(2,_y);if(type==5)word_control.m_oDrawingDocument.SetCursorType("s-resize");else word_control.m_oDrawingDocument.SetCursorType("default")}break}case 1:{var newVal=RulerCorrectPosition(this,_y,this.m_dMarginTop);if(newVal>this.m_dMarginBottom-30)newVal=this.m_dMarginBottom-30;if(newVal<0)newVal=0;this.m_dMarginTop=newVal;word_control.UpdateVerRulerBack();var pos=top+this.m_dMarginTop*dKoef_mm_to_pix;word_control.m_oOverlayApi.HorLine(pos); word_control.m_oDrawingDocument.SetCursorType("s-resize");break}case 2:{var newVal=RulerCorrectPosition(this,_y,this.m_dMarginTop);if(newValthis.m_oPage.height_mm)newVal=this.m_oPage.height_mm;this.m_dMarginBottom=newVal;word_control.UpdateVerRulerBack();var pos=top+this.m_dMarginBottom*dKoef_mm_to_pix;word_control.m_oOverlayApi.HorLine(pos);word_control.m_oDrawingDocument.SetCursorType("s-resize");break}case 3:{var newVal=RulerCorrectPosition(this, _y,this.m_dMarginTop);if(newVal>this.header_bottom)newVal=this.header_bottom;if(newVal<0)newVal=0;this.header_top=newVal;word_control.UpdateVerRulerBack();var pos=top+this.header_top*dKoef_mm_to_pix;word_control.m_oOverlayApi.HorLine(pos);word_control.m_oDrawingDocument.SetCursorType("s-resize");break}case 4:{var newVal=RulerCorrectPosition(this,_y,this.m_dMarginTop);if(newVal<0)newVal=0;if(newVal>this.m_oPage.height_mm)newVal=this.m_oPage.height_mm;this.header_bottom=newVal;word_control.UpdateVerRulerBack(); var pos=top+this.header_bottom*dKoef_mm_to_pix;word_control.m_oOverlayApi.HorLine(pos);word_control.m_oDrawingDocument.SetCursorType("s-resize");break}case 5:{var _min=0;var _max=this.m_oPage.height_mm;if(0_max)newVal=_max;if(0==this.DragTablePos){var _bottom=this.m_oTableMarkup.Rows[0].Y+this.m_oTableMarkup.Rows[0].H;this.m_oTableMarkup.Rows[0].Y=newVal;this.m_oTableMarkup.Rows[0].H=_bottom-newVal}else{var oldH=this.m_oTableMarkup.Rows[this.DragTablePos-1].H;this.m_oTableMarkup.Rows[this.DragTablePos-1].H=newVal-this.m_oTableMarkup.Rows[this.DragTablePos-1].Y;var delta=this.m_oTableMarkup.Rows[this.DragTablePos-1].H-oldH;for(var i=this.DragTablePos;i=.8&&x<=4.2)if(this.CurrentObjectType==RULER_OBJECT_TYPE_PARAGRAPH)if(Math.abs(y-this.m_dMarginTop)<1)return 1;else{if(Math.abs(y-this.m_dMarginBottom)<1)return 2}else if(this.CurrentObjectType==RULER_OBJECT_TYPE_HEADER)if(Math.abs(y-this.header_top)< 1)return 3;else{if(Math.abs(y-this.header_bottom)<1)return 4}else if(this.CurrentObjectType==RULER_OBJECT_TYPE_FOOTER){if(Math.abs(y-this.header_top)<1)return 3}else if(this.CurrentObjectType==RULER_OBJECT_TYPE_TABLE&&null!=this.m_oTableMarkup){var markup=this.m_oTableMarkup;var _count=markup.Rows.length;if(0==_count)return 0;var _start=markup.Rows[0].Y;var _end=_start-2;for(var i=0;i<=_count;i++){if(i==_count){_end=markup.Rows[i-1].Y+markup.Rows[i-1].H;_start=_end+2}else if(i!=0){_end=markup.Rows[i- 1].Y+markup.Rows[i-1].H;_start=markup.Rows[i].Y}if(_end-11){var eventType="";switch(this.DragTypeMouseDown){case 5:eventType="tables";break;default:eventType="margins";break}if(eventType!=""){word_control.m_oApi.sendEvent("asc_onRulerDblClick", eventType);this.DragType=0;this.OnMouseUp(left,top,e);return}}switch(this.DragType){case 1:{var pos=top+this.m_dMarginTop*dKoef_mm_to_pix;word_control.m_oOverlayApi.HorLine(pos);break}case 2:{var pos=top+this.m_dMarginBottom*dKoef_mm_to_pix;word_control.m_oOverlayApi.HorLine(pos);break}case 3:{var pos=top+this.header_top*dKoef_mm_to_pix;word_control.m_oOverlayApi.HorLine(pos);break}case 4:{var pos=top+this.header_bottom*dKoef_mm_to_pix;word_control.m_oOverlayApi.HorLine(pos);break}case 5:{var pos= 0;if(0==this.DragTablePos){pos=top+this.m_oTableMarkup.Rows[0].Y*dKoef_mm_to_pix;word_control.m_oOverlayApi.HorLine(pos)}else{pos=top+(this.m_oTableMarkup.Rows[this.DragTablePos-1].Y+this.m_oTableMarkup.Rows[this.DragTablePos-1].H)*dKoef_mm_to_pix;word_control.m_oOverlayApi.HorLine(pos)}}}word_control.m_oDrawingDocument.LockCursorTypeCur()};this.OnMouseUp=function(left,top,e){var lockedElement=AscCommon.check_MouseUpEvent(e);this.m_oWordControl.OnUpdateOverlay();switch(this.DragType){case 1:case 2:{if(!this.SimpleChanges.IsSimple)this.SetMarginProperties(); break}case 3:case 4:{if(!this.SimpleChanges.IsSimple)this.SetHeaderProperties();break}case 5:{if(!this.SimpleChanges.IsSimple)this.SetTableProperties();this.DragTablePos=-1;break}}this.DragType=0;this.m_oWordControl.m_oDrawingDocument.UnlockCursorType();this.SimpleChanges.Clear()};this.OnMouseUpExternal=function(){this.m_oWordControl.OnUpdateOverlay();switch(this.DragType){case 1:case 2:{if(!this.SimpleChanges.IsSimple)this.SetMarginProperties();break}case 3:case 4:{if(!this.SimpleChanges.IsSimple)this.SetHeaderProperties(); break}case 5:{if(!this.SimpleChanges.IsSimple)this.SetTableProperties();this.DragTablePos=-1;break}}this.DragType=0;this.m_oWordControl.m_oDrawingDocument.UnlockCursorType();this.SimpleChanges.Clear()};this.BlitToMain=function(left,top,htmlElement){if(!this.RepaintChecker.BlitAttack&&top==this.RepaintChecker.BlitTop)return;var dPR=AscCommon.AscBrowser.retinaPixelRatio;top=Math.round(top*dPR);this.RepaintChecker.BlitTop=top;this.RepaintChecker.BlitAttack=false;htmlElement.width=htmlElement.width;var context= htmlElement.getContext("2d");if(null!=this.m_oCanvas)context.drawImage(this.m_oCanvas,0,Math.round(5*dPR),this.m_oCanvas.width,this.m_oCanvas.height-Math.round(10*dPR),0,top,this.m_oCanvas.width,this.m_oCanvas.height-Math.round(10*dPR))};this.SetMarginProperties=function(){if(false===this.m_oWordControl.m_oLogicDocument.Document_Is_SelectionLocked(AscCommon.changestype_Document_SectPr)){this.m_oWordControl.m_oLogicDocument.StartAction(AscDFH.historydescription_Document_SetDocumentMargin_Ver);this.m_oWordControl.m_oLogicDocument.SetDocumentMargin({Top:this.m_dMarginTop, Bottom:this.m_dMarginBottom},true);this.m_oWordControl.m_oLogicDocument.FinalizeAction()}};this.SetHeaderProperties=function(){if(false===this.m_oWordControl.m_oLogicDocument.Document_Is_SelectionLocked(AscCommon.changestype_HdrFtr)){this.m_oWordControl.m_oLogicDocument.StartAction(AscDFH.historydescription_Document_SetHdrFtrBounds);this.m_oWordControl.m_oLogicDocument.Document_SetHdrFtrBounds(this.header_top,this.header_bottom);this.m_oWordControl.m_oLogicDocument.FinalizeAction()}};this.SetTableProperties= function(){if(false===this.m_oWordControl.m_oLogicDocument.Document_Is_SelectionLocked(AscCommon.changestype_Table_Properties)){this.m_oWordControl.m_oLogicDocument.StartAction(AscDFH.historydescription_Document_SetTableMarkup_Ver);this.m_oTableMarkup.CorrectTo();this.m_oTableMarkup.Table.Update_TableMarkupFromRuler(this.m_oTableMarkup,false,this.DragTablePos);if(this.m_oTableMarkup)this.m_oTableMarkup.CorrectFrom();this.m_oWordControl.m_oLogicDocument.FinalizeAction()}}}"use strict";var g_fontApplication= AscFonts.g_fontApplication;var AscBrowser=AscCommon.AscBrowser;var g_anchor_left=AscCommon.g_anchor_left;var g_anchor_top=AscCommon.g_anchor_top;var g_anchor_right=AscCommon.g_anchor_right;var g_anchor_bottom=AscCommon.g_anchor_bottom;var CreateControlContainer=AscCommon.CreateControlContainer;var CreateControl=AscCommon.CreateControl;var global_keyboardEvent=AscCommon.global_keyboardEvent;var global_mouseEvent=AscCommon.global_mouseEvent;var History=AscCommon.History;var g_dKoef_pix_to_mm=AscCommon.g_dKoef_pix_to_mm; var g_dKoef_mm_to_pix=AscCommon.g_dKoef_mm_to_pix;var g_bIsMobile=AscBrowser.isMobile;var Page_Width=210;var Page_Height=297;var X_Left_Margin=30;var X_Right_Margin=15;var Y_Bottom_Margin=20;var Y_Top_Margin=20;var X_Right_Field=Page_Width-X_Right_Margin;var Y_Bottom_Field=Page_Height-Y_Bottom_Margin;var tableSpacingMinValue=.02;function CEditorPage(api){this.Name="";this.X=0;this.Y=0;this.Width=10;this.Height=10;this.m_oBody=null;this.m_oMenu=null;this.m_oPanelRight=null;this.m_oScrollHor=null;this.m_oMainContent= null;this.m_oLeftRuler=null;this.m_oTopRuler=null;this.m_oMainView=null;this.m_oEditor=null;this.m_oOverlay=null;this.TextBoxBackground=null;this.ReaderModeDivWrapper=null;this.ReaderModeDiv=null;this.m_oOverlayApi=new AscCommon.COverlay;this.m_bIsIE=AscBrowser.isIE||window.opera?true:false;this.m_oPanelRight_buttonRulers=null;this.m_oPanelRight_vertScroll=null;this.m_oPanelRight_buttonPrevPage=null;this.m_oPanelRight_buttonNextPage=null;this.m_oLeftRuler_buttonsTabs=null;this.m_oLeftRuler_vertRuler= null;this.m_oTopRuler_horRuler=null;this.m_bIsHorScrollVisible=false;this.m_bIsRuler=api.isMobileVersion===true?false:true;this.m_bDocumentPlaceChangedEnabled=false;this.m_nZoomValue=100;this.m_oBoundsController=new AscFormat.CBoundsController;this.m_nTabsType=tab_Left;this.m_dScrollY=0;this.m_dScrollX=0;this.m_dScrollY_max=1;this.m_dScrollX_max=1;this.m_bIsRePaintOnScroll=true;this.m_dDocumentWidth=0;this.m_dDocumentHeight=0;this.m_dDocumentPageWidth=0;this.m_dDocumentPageHeight=0;this.NoneRepaintPages= false;this.m_bIsScroll=false;this.ScrollsWidthPx=14;this.m_oHorRuler=new CHorRuler;this.m_oVerRuler=new CVerRuler;this.m_oDrawingDocument=new AscCommon.CDrawingDocument;this.m_oLogicDocument=null;this.m_oDrawingDocument.m_oWordControl=this;this.m_oDrawingDocument.m_oLogicDocument=this.m_oLogicDocument;this.m_bIsUpdateHorRuler=false;this.m_bIsUpdateVerRuler=false;this.m_bIsUpdateTargetNoAttack=false;this.m_bIsFullRepaint=false;this.m_oScrollHor_=null;this.m_oScrollVer_=null;this.m_oScrollHorApi=null; this.m_oScrollVerApi=null;this.arrayEventHandlers=[];this.m_oTimerScrollSelect=-1;this.IsFocus=true;this.m_bIsMouseLock=false;this.DrawingFreeze=false;this.m_oHorRuler.m_oWordControl=this;this.m_oVerRuler.m_oWordControl=this;this.IsKeyDownButNoPress=false;this.MouseDownDocumentCounter=0;this.bIsUseKeyPress=true;this.bIsEventPaste=false;this.bIsDoublePx=true;var oTestSpan=document.createElement("span");oTestSpan.setAttribute("style","font-size:8pt");document.body.appendChild(oTestSpan);var defaultView= oTestSpan.ownerDocument.defaultView;var computedStyle=defaultView.getComputedStyle(oTestSpan,null);if(null!=computedStyle){var fontSize=computedStyle.getPropertyValue("font-size");if(-1!=fontSize.indexOf("px")&&parseFloat(fontSize)==parseInt(fontSize))this.bIsDoublePx=false}document.body.removeChild(oTestSpan);this.m_nPaintTimerId=-1;this.m_nTimerScrollInterval=40;this.m_nCurrentTimeClearCache=0;this.m_bIsMouseUpSend=false;this.retinaScaling=AscCommon.AscBrowser.retinaPixelRatio;this.zoom_values= [50,60,70,80,90,100,110,120,130,140,150,160,170,180,190,200];this.m_nZoomType=0;this.MobileTouchManager=null;this.ReaderTouchManager=null;this.ReaderModeCurrent=0;this.ReaderFontSizeCur=2;this.ReaderFontSizes=[12,14,16,18,22,28,36,48,72];this.IsUpdateOverlayOnlyEnd=false;this.IsUpdateOverlayOnlyEndReturn=false;this.IsUpdateOverlayOnEndCheck=false;this.m_oApi=api;var oThis=this;this.MouseHandObject=null;this.UseRequestAnimationFrame=AscCommon.AscBrowser.isChrome;this.RequestAnimationFrame=function(){return window.requestAnimationFrame|| window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.oRequestAnimationFrame||window.msRequestAnimationFrame||null}();this.CancelAnimationFrame=function(){return window.cancelRequestAnimationFrame||window.webkitCancelAnimationFrame||window.webkitCancelRequestAnimationFrame||window.mozCancelRequestAnimationFrame||window.oCancelRequestAnimationFrame||window.msCancelRequestAnimationFrame||null}();if(this.UseRequestAnimationFrame)if(null==this.RequestAnimationFrame)this.UseRequestAnimationFrame= false;this.RequestAnimationOldTime=-1;this.IsInitControl=false;this.checkBodyOffset=function(){var off=jQuery("#"+this.Name).offset();if(off){this.X=off.left;this.Y=off.top}};this.checkBodySize=function(){this.checkBodyOffset();var el=document.getElementById(this.Name);var _newW=el.offsetWidth;var _newH=el.offsetHeight;var _left_border_w=0;if(window.getComputedStyle){var _computed_style=window.getComputedStyle(el,null);if(_computed_style){var _value=_computed_style.getPropertyValue("border-left-width"); if(typeof _value=="string")_left_border_w=parseInt(_value)}}_newW-=_left_border_w;if(this.Width!=_newW||this.Height!=_newH){this.Width=_newW;this.Height=_newH;return true}return false};this.Init=function(){this.m_oBody=CreateControlContainer(this.Name);var scrollWidthMm=this.ScrollsWidthPx*g_dKoef_pix_to_mm;this.m_oScrollHor=CreateControlContainer("id_horscrollpanel");this.m_oScrollHor.Bounds.SetParams(0,0,scrollWidthMm,0,false,false,true,true,-1,scrollWidthMm);this.m_oScrollHor.Anchor=g_anchor_left| g_anchor_right|g_anchor_bottom;this.m_oBody.AddControl(this.m_oScrollHor);this.m_oPanelRight=CreateControlContainer("id_panel_right");this.m_oPanelRight.Bounds.SetParams(0,0,1E3,0,false,true,false,true,scrollWidthMm,-1);this.m_oPanelRight.Anchor=g_anchor_top|g_anchor_right|g_anchor_bottom;this.m_oBody.AddControl(this.m_oPanelRight);if(this.m_oApi.isMobileVersion){this.m_oPanelRight.HtmlElement.style.zIndex=-1;var hor_scroll=document.getElementById("id_horscrollpanel");hor_scroll.style.zIndex=-1}this.m_oPanelRight_buttonRulers= CreateControl("id_buttonRulers");this.m_oPanelRight_buttonRulers.Bounds.SetParams(0,0,1E3,1E3,false,false,false,false,-1,scrollWidthMm);this.m_oPanelRight_buttonRulers.Anchor=g_anchor_left|g_anchor_top|g_anchor_right;this.m_oPanelRight.AddControl(this.m_oPanelRight_buttonRulers);var _vertScrollTop=scrollWidthMm;if(GlobalSkin.RulersButton===false){this.m_oPanelRight_buttonRulers.HtmlElement.style.display="none";_vertScrollTop=0}this.m_oPanelRight_buttonNextPage=CreateControl("id_buttonNextPage");this.m_oPanelRight_buttonNextPage.Bounds.SetParams(0, 0,1E3,1E3,false,false,false,false,-1,scrollWidthMm);this.m_oPanelRight_buttonNextPage.Anchor=g_anchor_left|g_anchor_bottom|g_anchor_right;this.m_oPanelRight.AddControl(this.m_oPanelRight_buttonNextPage);this.m_oPanelRight_buttonPrevPage=CreateControl("id_buttonPrevPage");this.m_oPanelRight_buttonPrevPage.Bounds.SetParams(0,0,1E3,scrollWidthMm,false,false,false,true,-1,scrollWidthMm);this.m_oPanelRight_buttonPrevPage.Anchor=g_anchor_left|g_anchor_bottom|g_anchor_right;this.m_oPanelRight.AddControl(this.m_oPanelRight_buttonPrevPage); var _vertScrollBottom=2*scrollWidthMm;if(GlobalSkin.NavigationButtons==false){this.m_oPanelRight_buttonNextPage.HtmlElement.style.display="none";this.m_oPanelRight_buttonPrevPage.HtmlElement.style.display="none";_vertScrollBottom=0}this.m_oPanelRight_vertScroll=CreateControl("id_vertical_scroll");this.m_oPanelRight_vertScroll.Bounds.SetParams(0,_vertScrollTop,1E3,_vertScrollBottom,false,true,false,true,-1,-1);this.m_oPanelRight_vertScroll.Anchor=g_anchor_left|g_anchor_top|g_anchor_right|g_anchor_bottom; this.m_oPanelRight.AddControl(this.m_oPanelRight_vertScroll);this.m_oMainContent=CreateControlContainer("id_main");if(!this.m_oApi.isMobileVersion)this.m_oMainContent.Bounds.SetParams(0,0,scrollWidthMm,0,false,true,true,true,-1,-1);else this.m_oMainContent.Bounds.SetParams(0,0,0,0,false,true,true,true,-1,-1);this.m_oMainContent.Anchor=g_anchor_left|g_anchor_top|g_anchor_right|g_anchor_bottom;this.m_oBody.AddControl(this.m_oMainContent);this.m_oLeftRuler=CreateControlContainer("id_panel_left");this.m_oLeftRuler.Bounds.SetParams(0, 0,1E3,1E3,false,false,false,false,5,-1);this.m_oLeftRuler.Anchor=g_anchor_left|g_anchor_top|g_anchor_bottom;this.m_oMainContent.AddControl(this.m_oLeftRuler);this.m_oLeftRuler_buttonsTabs=CreateControl("id_buttonTabs");this.m_oLeftRuler_buttonsTabs.Bounds.SetParams(0,.8,1E3,1E3,false,true,false,false,-1,5);this.m_oLeftRuler_buttonsTabs.Anchor=g_anchor_left|g_anchor_top|g_anchor_right;this.m_oLeftRuler.AddControl(this.m_oLeftRuler_buttonsTabs);this.m_oLeftRuler_vertRuler=CreateControl("id_vert_ruler"); this.m_oLeftRuler_vertRuler.Bounds.SetParams(0,7,1E3,1E3,false,true,false,false,-1,-1);this.m_oLeftRuler_vertRuler.Anchor=g_anchor_left|g_anchor_right|g_anchor_top|g_anchor_bottom;this.m_oLeftRuler.AddControl(this.m_oLeftRuler_vertRuler);this.m_oTopRuler=CreateControlContainer("id_panel_top");this.m_oTopRuler.Bounds.SetParams(5,0,1E3,1E3,true,false,false,false,-1,7);this.m_oTopRuler.Anchor=g_anchor_left|g_anchor_top|g_anchor_right;this.m_oMainContent.AddControl(this.m_oTopRuler);this.m_oTopRuler_horRuler= CreateControl("id_hor_ruler");this.m_oTopRuler_horRuler.Bounds.SetParams(0,0,1E3,1E3,false,false,false,false,-1,-1);this.m_oTopRuler_horRuler.Anchor=g_anchor_left|g_anchor_right|g_anchor_top|g_anchor_bottom;this.m_oTopRuler.AddControl(this.m_oTopRuler_horRuler);this.m_oMainView=CreateControlContainer("id_main_view");this.m_oMainView.Bounds.SetParams(5,7,1E3,1E3,true,true,false,false,-1,-1);this.m_oMainView.Anchor=g_anchor_left|g_anchor_right|g_anchor_top|g_anchor_bottom;this.m_oMainContent.AddControl(this.m_oMainView); this.m_oEditor=CreateControl("id_viewer");this.m_oEditor.Bounds.SetParams(0,0,1E3,1E3,false,false,false,false,-1,-1);this.m_oEditor.Anchor=g_anchor_left|g_anchor_top|g_anchor_right|g_anchor_bottom;this.m_oMainView.AddControl(this.m_oEditor);this.m_oOverlay=CreateControl("id_viewer_overlay");this.m_oOverlay.Bounds.SetParams(0,0,1E3,1E3,false,false,false,false,-1,-1);this.m_oOverlay.Anchor=g_anchor_left|g_anchor_top|g_anchor_right|g_anchor_bottom;this.m_oMainView.AddControl(this.m_oOverlay);this.m_oDrawingDocument.TargetHtmlElement= document.getElementById("id_target_cursor");if(this.m_oApi.isMobileVersion){this.MobileTouchManager=new AscCommon.CMobileTouchManager({eventsElement:"word_mobile_element"});this.MobileTouchManager.Init(this.m_oApi)}this.checkNeedRules();this.initEvents2();this.m_oOverlayApi.m_oControl=this.m_oOverlay;this.m_oOverlayApi.m_oHtmlPage=this;this.m_oOverlayApi.Clear();this.ShowOverlay();this.m_oDrawingDocument.AutoShapesTrack=new AscCommon.CAutoshapeTrack;this.m_oDrawingDocument.AutoShapesTrack.init2(this.m_oOverlayApi); this.OnResize(true);if(this.m_oApi.isMobileVersion){var _t=this;document.addEventListener&&document.addEventListener("transitionend",function(){_t.OnResize(false)},false);document.addEventListener&&document.addEventListener("transitioncancel",function(){_t.OnResize(false)},false)}this.checkMouseHandMode()};this.CheckRetinaDisplay=function(){if(this.retinaScaling!=AscCommon.AscBrowser.retinaPixelRatio){this.retinaScaling=AscCommon.AscBrowser.retinaPixelRatio;this.onButtonTabsDraw()}};this.ShowOverlay= function(){this.m_oOverlay.HtmlElement.style.display="block";if(null==this.m_oOverlayApi.m_oContext)this.m_oOverlayApi.m_oContext=this.m_oOverlayApi.m_oControl.HtmlElement.getContext("2d")};this.UnShowOverlay=function(){this.m_oOverlay.HtmlElement.style.display="none"};this.CheckUnShowOverlay=function(){var drDoc=this.m_oDrawingDocument;if(!drDoc.m_bIsSearching&&!drDoc.m_bIsSelection&&!this.MobileTouchManager){this.UnShowOverlay();return false}return true};this.CheckShowOverlay=function(){var drDoc= this.m_oDrawingDocument;if(drDoc.m_bIsSearching||drDoc.m_bIsSelection||this.MobileTouchManager)this.ShowOverlay()};this.initEvents2=function(){this.arrayEventHandlers[0]=new AscCommon.button_eventHandlers("","0px 0px","0px -16px","0px -32px",this.m_oPanelRight_buttonRulers,this.onButtonRulersClick);this.arrayEventHandlers[1]=new AscCommon.button_eventHandlers("","0px 0px","0px -16px","0px -32px",this.m_oPanelRight_buttonPrevPage,this.onPrevPage);this.arrayEventHandlers[2]=new AscCommon.button_eventHandlers("", "0px -48px","0px -64px","0px -80px",this.m_oPanelRight_buttonNextPage,this.onNextPage);this.m_oLeftRuler_buttonsTabs.HtmlElement.onclick=this.onButtonTabsClick;AscCommon.addMouseEvent(this.m_oEditor.HtmlElement,"down",this.onMouseDown);AscCommon.addMouseEvent(this.m_oEditor.HtmlElement,"move",this.onMouseMove);AscCommon.addMouseEvent(this.m_oEditor.HtmlElement,"up",this.onMouseUp);AscCommon.addMouseEvent(this.m_oOverlay.HtmlElement,"down",this.onMouseDown);AscCommon.addMouseEvent(this.m_oOverlay.HtmlElement, "move",this.onMouseMove);AscCommon.addMouseEvent(this.m_oOverlay.HtmlElement,"up",this.onMouseUp);document.getElementById("id_target_cursor").style.pointerEvents="none";this.m_oMainContent.HtmlElement.onmousewheel=this.onMouseWhell;if(this.m_oMainContent.HtmlElement.addEventListener)this.m_oMainContent.HtmlElement.addEventListener("DOMMouseScroll",this.onMouseWhell,false);AscCommon.addMouseEvent(this.m_oTopRuler_horRuler.HtmlElement,"down",this.horRulerMouseDown);AscCommon.addMouseEvent(this.m_oTopRuler_horRuler.HtmlElement, "move",this.horRulerMouseMove);AscCommon.addMouseEvent(this.m_oTopRuler_horRuler.HtmlElement,"up",this.horRulerMouseUp);AscCommon.addMouseEvent(this.m_oLeftRuler_vertRuler.HtmlElement,"down",this.verRulerMouseDown);AscCommon.addMouseEvent(this.m_oLeftRuler_vertRuler.HtmlElement,"move",this.verRulerMouseMove);AscCommon.addMouseEvent(this.m_oLeftRuler_vertRuler.HtmlElement,"up",this.verRulerMouseUp);this.m_oBody.HtmlElement.oncontextmenu=function(e){if(AscCommon.AscBrowser.isVivaldiLinux)AscCommon.Window_OnMouseUp(e); AscCommon.stopEvent(e);return false};this.initEvents2MobileAdvances()};this.initEvents2MobileAdvances=function(){this.m_oTopRuler_horRuler.HtmlElement["ontouchstart"]=function(e){oThis.horRulerMouseDown(e.touches[0]);return false};this.m_oTopRuler_horRuler.HtmlElement["ontouchmove"]=function(e){oThis.horRulerMouseMove(e.touches[0]);return false};this.m_oTopRuler_horRuler.HtmlElement["ontouchend"]=function(e){oThis.horRulerMouseUp(e.changedTouches[0]);return false};this.m_oLeftRuler_vertRuler.HtmlElement["ontouchstart"]= function(e){oThis.verRulerMouseDown(e.touches[0]);return false};this.m_oLeftRuler_vertRuler.HtmlElement["ontouchmove"]=function(e){oThis.verRulerMouseMove(e.touches[0]);return false};this.m_oLeftRuler_vertRuler.HtmlElement["ontouchend"]=function(e){oThis.verRulerMouseUp(e.changedTouches[0]);return false};if(!this.m_oApi.isMobileVersion&&false){var _check_e=function(e){if(e.touches&&e.touches[0])return e.touches[0];if(e.changedTouches&&e.changedTouches[0])return e.changedTouches[0];return e};var _cur= document.getElementById("id_target_cursor");_cur["ontouchstart"]=this.m_oEditor.HtmlElement["ontouchstart"]=this.m_oOverlay.HtmlElement["ontouchstart"]=function(e){if(AscCommon.isTouch)return;var _old=global_mouseEvent.KoefPixToMM;global_mouseEvent.KoefPixToMM=5;AscCommon.isTouch=true;AscCommon.isTouchMove=false;AscCommon.TouchStartTime=(new Date).getTime();AscCommon.stopEvent(e);var _mouse_down=AscCommon.getMouseEvent(this,"down");var _ret=_mouse_down?_mouse_down.call(this,_check_e(e),true):false; global_mouseEvent.KoefPixToMM=_old;if(document.activeElement!==undefined&&AscCommon.g_inputContext!=null&&document.activeElement!=AscCommon.g_inputContext.HtmlArea)AscCommon.g_inputContext.HtmlArea.focus();return _ret};_cur["ontouchmove"]=this.m_oEditor.HtmlElement["ontouchmove"]=this.m_oOverlay.HtmlElement["ontouchmove"]=function(e){var _old=global_mouseEvent.KoefPixToMM;global_mouseEvent.KoefPixToMM=5;AscCommon.isTouch=true;AscCommon.isTouchMove=true;AscCommon.stopEvent(e);var _mouse_move=AscCommon.getMouseEvent(this, "move");var _ret=_mouse_move?_mouse_move.call(this,_check_e(e),true):false;global_mouseEvent.KoefPixToMM=_old;return _ret};_cur["ontouchend"]=this.m_oEditor.HtmlElement["ontouchend"]=this.m_oOverlay.HtmlElement["ontouchend"]=function(e){if(!AscCommon.isTouch)return;var _old=global_mouseEvent.KoefPixToMM;global_mouseEvent.KoefPixToMM=5;AscCommon.isTouch=false;AscCommon.stopEvent(e);var _natE=_check_e(e);var _mouse_up=AscCommon.getMouseEvent(this,"up");var _ret=_mouse_up?_mouse_up.call(this,_natE,undefined, true):false;global_mouseEvent.KoefPixToMM=_old;if(!AscCommon.isTouchMove&&-1!=AscCommon.TouchStartTime&&Math.abs(AscCommon.TouchStartTime-(new Date).getTime())>900){var _eContextMenu={pageX:_natE.pageX,pageY:_natE.pageY,clientX:_natE.clientX,clientY:_natE.clientY,altKey:_natE.altKey,shiftKey:_natE.shiftKey,ctrlKey:_natE.ctrlKey,metaKey:_natE.metaKey,button:AscCommon.g_mouse_button_right,target:e.target,srcElement:e.srcElement};AscCommon.isTouch=true;this.onmousedown(_eContextMenu,true);this.onmouseup(_eContextMenu, undefined,true);AscCommon.isTouch=false}AscCommon.isTouchMove=false;AscCommon.TouchStartTime=-1;return _ret};_cur["ontouchcancel"]=this.m_oEditor.HtmlElement["ontouchcancel"]=this.m_oOverlay.HtmlElement["ontouchcancel"]=function(e){if(!AscCommon.isTouch)return;var _old=global_mouseEvent.KoefPixToMM;global_mouseEvent.KoefPixToMM=5;AscCommon.isTouch=false;AscCommon.stopEvent(e);var _natE=_check_e(e);var _ret=this.onmouseup(_natE,undefined,true);global_mouseEvent.KoefPixToMM=_old;if(!AscCommon.isTouchMove&& -1!=AscCommon.TouchStartTime&&Math.abs(AscCommon.TouchStartTime-(new Date).getTime())>900){var _eContextMenu={pageX:_natE.pageX,pageY:_natE.pageY,clientX:_natE.clientX,clientY:_natE.clientY,altKey:_natE.altKey,shiftKey:_natE.shiftKey,ctrlKey:_natE.ctrlKey,metaKey:_natE.metaKey,button:AscCommon.g_mouse_button_right,target:e.target,srcElement:e.srcElement};AscCommon.isTouch=true;this.onmousedown(_eContextMenu,true);this.onmouseup(_eContextMenu,undefined,true);AscCommon.isTouch=false}AscCommon.isTouchMove= false;AscCommon.TouchStartTime=-1;return _ret}}};this.initEventsMobile=function(){if(this.m_oApi.isMobileVersion){this.TextBoxBackground=CreateControl(AscCommon.g_inputContext.HtmlArea.id);this.TextBoxBackground.HtmlElement.parentNode.parentNode.style.zIndex=10;this.MobileTouchManager.initEvents(AscCommon.g_inputContext.HtmlArea.id);if(AscBrowser.isAndroid){this.TextBoxBackground.HtmlElement["oncontextmenu"]=function(e){if(e.preventDefault)e.preventDefault();e.returnValue=false;return false};this.TextBoxBackground.HtmlElement["onselectstart"]= function(e){oThis.m_oLogicDocument.SelectAll();if(e.preventDefault)e.preventDefault();e.returnValue=false;return false}}}};this.checkMouseHandMode=function(){if(!this.m_oApi||!this.m_oApi.isRestrictionForms()){this.MouseHandObject=null;return}this.MouseHandObject={check:function(_this,_pos){var logicDoc=_this.m_oLogicDocument;if(!logicDoc)return true;var isForms=logicDoc.IsInForm(_pos.X,_pos.Y,_pos.Page)||logicDoc.IsInContentControl(_pos.X,_pos.Y,_pos.Page)?true:false;var isButtons=_this.m_oDrawingDocument.contentControls.checkPointerInButtons(_pos); if(isForms||isButtons)return false;return true}}};this.onButtonRulersClick=function(){if(false===oThis.m_oApi.bInit_word_control||true===oThis.m_oApi.isViewMode)return;oThis.m_bIsRuler=!oThis.m_bIsRuler;oThis.checkNeedRules();oThis.OnResize(true)};this.HideRulers=function(){if(oThis.m_bIsRuler===false)return;oThis.m_bIsRuler=!oThis.m_bIsRuler;oThis.checkNeedRules();oThis.OnResize(true)};this.calculate_zoom_FitToWidth=function(){var w=this.m_oEditor.AbsolutePosition.R-this.m_oEditor.AbsolutePosition.L; var Zoom=100;if(0!=this.m_dDocumentPageWidth){Zoom=100*(w-10)/this.m_dDocumentPageWidth;if(Zoom<5)Zoom=5;if(this.m_oApi.isMobileVersion){var _w=this.m_oEditor.HtmlElement.width;_w/=AscCommon.AscBrowser.retinaPixelRatio;Zoom=100*_w*g_dKoef_pix_to_mm/this.m_dDocumentPageWidth}}return Zoom-.5>>0};this.zoom_FitToWidth=function(){var _new_value=this.calculate_zoom_FitToWidth();this.m_nZoomType=1;if(_new_value!=this.m_nZoomValue){var _old_val=this.m_nZoomValue;this.m_nZoomValue=_new_value;this.zoom_Fire(1, _old_val);if(this.MobileTouchManager)this.MobileTouchManager.CheckZoomCriticalValues(this.m_nZoomValue);return true}else this.m_oApi.sync_zoomChangeCallback(this.m_nZoomValue,1);return false};this.zoom_FitToPage=function(){var w=parseInt(this.m_oEditor.HtmlElement.width)*g_dKoef_pix_to_mm;var h=parseInt(this.m_oEditor.HtmlElement.height)*g_dKoef_pix_to_mm;w=AscCommon.AscBrowser.convertToRetinaValue(w);h=AscCommon.AscBrowser.convertToRetinaValue(h);var _hor_Zoom=100;if(0!=this.m_dDocumentPageWidth)_hor_Zoom= 100*(w-10)/this.m_dDocumentPageWidth;var _ver_Zoom=100;if(0!=this.m_dDocumentPageHeight)_ver_Zoom=100*(h-10)/this.m_dDocumentPageHeight;var _new_value=parseInt(Math.min(_hor_Zoom,_ver_Zoom)-.5);if(_new_value<5)_new_value=5;this.m_nZoomType=2;if(_new_value!=this.m_nZoomValue){var _old_val=this.m_nZoomValue;this.m_nZoomValue=_new_value;this.zoom_Fire(2,_old_val);return true}else this.m_oApi.sync_zoomChangeCallback(this.m_nZoomValue,2);return false};this.zoom_Fire=function(type,old_zoom){if(false=== oThis.m_oApi.bInit_word_control)return;AscCommon.g_fontManager.ClearRasterMemory();if(AscCommon.g_fontManager2)AscCommon.g_fontManager2.ClearRasterMemory();var oWordControl=oThis;oWordControl.m_bIsRePaintOnScroll=false;var xScreen1=oWordControl.m_oEditor.AbsolutePosition.R-oWordControl.m_oEditor.AbsolutePosition.L;var yScreen1=oWordControl.m_oEditor.AbsolutePosition.B-oWordControl.m_oEditor.AbsolutePosition.T;xScreen1*=g_dKoef_mm_to_pix;yScreen1*=g_dKoef_mm_to_pix;xScreen1>>=1;yScreen1>>=1;var posDoc= oWordControl.m_oDrawingDocument.ConvertCoordsFromCursor2(xScreen1,yScreen1,true,undefined,old_zoom);oWordControl.CheckZoom();oWordControl.CalculateDocumentSize();var lCurPage=oWordControl.m_oDrawingDocument.m_lCurrentPage;if(-1!=lCurPage){oWordControl.m_oHorRuler.CreateBackground(oWordControl.m_oDrawingDocument.m_arrPages[lCurPage]);oWordControl.m_bIsUpdateHorRuler=true;oWordControl.m_oVerRuler.CreateBackground(oWordControl.m_oDrawingDocument.m_arrPages[lCurPage]);oWordControl.m_bIsUpdateVerRuler= true}oWordControl.OnCalculatePagesPlace();var posScreenNew=oWordControl.m_oDrawingDocument.ConvertCoordsToCursor(posDoc.X,posDoc.Y,posDoc.Page);var _x_pos=oWordControl.m_oScrollHorApi.getCurScrolledX()+posScreenNew.X-xScreen1;var _y_pos=oWordControl.m_oScrollVerApi.getCurScrolledY()+posScreenNew.Y-yScreen1;_x_pos=Math.max(0,Math.min(_x_pos,oWordControl.m_dScrollX_max));_y_pos=Math.max(0,Math.min(_y_pos,oWordControl.m_dScrollY_max));if(oWordControl.m_dScrollY==0)_y_pos=0;oWordControl.m_oScrollVerApi.scrollToY(_y_pos); oWordControl.m_oScrollHorApi.scrollToX(_x_pos);if(this.MobileTouchManager)this.MobileTouchManager.Resize();oWordControl.m_oApi.sync_zoomChangeCallback(this.m_nZoomValue,type);oWordControl.m_bIsUpdateTargetNoAttack=true;oWordControl.m_bIsRePaintOnScroll=true;oWordControl.OnScroll();if(this.MobileTouchManager)this.MobileTouchManager.Resize_After();if(this.m_oApi.watermarkDraw){this.m_oApi.watermarkDraw.zoom=this.m_nZoomValue/100;this.m_oApi.watermarkDraw.Generate()}};this.zoom_Out=function(){if(false=== oThis.m_oApi.bInit_word_control)return;oThis.m_nZoomType=0;var _zooms=oThis.zoom_values;var _count=_zooms.length;var _Zoom=_zooms[0];for(var i=_count-1;i>=0;i--)if(this.m_nZoomValue>_zooms[i]){_Zoom=_zooms[i];break}if(oThis.m_nZoomValue<=_Zoom)return;var _old_val=oThis.m_nZoomValue;oThis.m_nZoomValue=_Zoom;oThis.zoom_Fire(0,_old_val)};this.zoom_In=function(){if(false===oThis.m_oApi.bInit_word_control)return;oThis.m_nZoomType=0;var _zooms=oThis.zoom_values;var _count=_zooms.length;var _Zoom=_zooms[_count- 1];for(var i=0;i<_count;i++)if(this.m_nZoomValue<_zooms[i]){_Zoom=_zooms[i];break}if(oThis.m_nZoomValue>=_Zoom)return;var _old_val=oThis.m_nZoomValue;oThis.m_nZoomValue=_Zoom;oThis.zoom_Fire(0,_old_val)};this.ToSearchResult=function(){var naviG=this.m_oDrawingDocument.CurrentSearchNavi;var navi=naviG[0];var x=navi.X;var y=navi.Y;var type=naviG.Type&255;var PageNum=navi.PageNum;if(navi.Transform){var xx=navi.Transform.TransformPointX(x,y);var yy=navi.Transform.TransformPointY(x,y);x=xx;y=yy}var rectH= navi.H*this.m_nZoomValue*g_dKoef_mm_to_pix/100;var pos=this.m_oDrawingDocument.ConvertCoordsToCursor2(x,y,PageNum);if(true===pos.Error)return;var boxX=0;var boxY=0;var boxR=(this.m_oEditor.HtmlElement.width/AscCommon.AscBrowser.retinaPixelRatio>>0)-2;var boxB=(this.m_oEditor.HtmlElement.height/AscCommon.AscBrowser.retinaPixelRatio>>0)-rectH;var offsetBorder=20;var nValueScrollHor=0;if(pos.XboxR)nValueScrollHor=pos.X-boxR+offsetBorder;var nValueScrollVer= 0;if(pos.YboxB)nValueScrollVer=pos.Y-boxB+offsetBorder;var isNeedScroll=false;if(0!=nValueScrollHor){isNeedScroll=true;this.m_bIsUpdateTargetNoAttack=true;this.m_oScrollHorApi.scrollByX(nValueScrollHor)}if(0!=nValueScrollVer){isNeedScroll=true;this.m_bIsUpdateTargetNoAttack=true;this.m_oScrollVerApi.scrollByY(nValueScrollVer)}if(true===isNeedScroll){this.OnScroll();return}this.OnUpdateOverlay()};this.ScrollToPosition=function(x,y,PageNum,height){if(PageNum< 0||PageNum>=this.m_oDrawingDocument.m_lCountCalculatePages)return;var _h=undefined===height?5:height;var rectSize=_h*this.m_nZoomValue*g_dKoef_mm_to_pix/100;var pos=this.m_oDrawingDocument.ConvertCoordsToCursor2(x,y,PageNum);if(true===pos.Error)return;var _ww=this.m_oEditor.HtmlElement.width;var _hh=this.m_oEditor.HtmlElement.height;_ww/=AscCommon.AscBrowser.retinaPixelRatio;_hh/=AscCommon.AscBrowser.retinaPixelRatio;var boxX=0;var boxY=0;var boxR=_ww-2;var boxB=_hh-rectSize;var nValueScrollHor=0; if(pos.XboxR){var _mem=x-g_dKoef_pix_to_mm*_ww*100/this.m_nZoomValue;nValueScrollHor=this.GetHorizontalScrollTo(_mem,PageNum)}var nValueScrollVer=0;if(pos.YboxB){var _mem=y+_h+10-g_dKoef_pix_to_mm*_hh*100/this.m_nZoomValue;nValueScrollVer=this.GetVerticalScrollTo(_mem,PageNum)}var isNeedScroll=false;if(0!=nValueScrollHor){isNeedScroll=true;this.m_bIsUpdateTargetNoAttack= true;var temp=nValueScrollHor*this.m_dScrollX_max/(this.m_dDocumentWidth-_ww);this.m_oScrollHorApi.scrollToX(parseInt(temp),false)}if(0!=nValueScrollVer){isNeedScroll=true;this.m_bIsUpdateTargetNoAttack=true;var temp=nValueScrollVer*this.m_dScrollY_max/(this.m_dDocumentHeight-_hh);this.m_oScrollVerApi.scrollToY(parseInt(temp),false)}if(true===isNeedScroll){this.OnScroll();return}};this.onButtonTabsClick=function(){var oWordControl=oThis;if(oWordControl.m_nTabsType==tab_Left){oWordControl.m_nTabsType= tab_Center;oWordControl.onButtonTabsDraw()}else if(oWordControl.m_nTabsType==tab_Center){oWordControl.m_nTabsType=tab_Right;oWordControl.onButtonTabsDraw()}else{oWordControl.m_nTabsType=tab_Left;oWordControl.onButtonTabsDraw()}};this.onButtonTabsDraw=function(){var _ctx=this.m_oLeftRuler_buttonsTabs.HtmlElement.getContext("2d");_ctx.setTransform(1,0,0,1,0,0);var dPR=AscCommon.AscBrowser.retinaPixelRatio;var _width=Math.round(19*dPR);var _height=Math.round(19*dPR);_ctx.clearRect(0,0,_width,_height); _ctx.lineWidth=Math.round(dPR);_ctx.strokeStyle=GlobalSkin.RulerOutline;var rectSize=Math.round(14*dPR);var lineWidth=_ctx.lineWidth;_ctx.strokeRect(2.5*lineWidth,3.5*lineWidth,Math.round(14*dPR),Math.round(14*dPR));_ctx.beginPath();_ctx.strokeStyle=GlobalSkin.RulerTabsColor;_ctx.lineWidth=dPR-Math.floor(dPR)===.5?2*Math.round(dPR)-1:2*Math.round(dPR);var tab_width=Math.round(5*dPR);var offset=_ctx.lineWidth%2===1?.5:0;var dx=Math.round((rectSize-2*Math.round(dPR)-tab_width)/7*4);var dy=Math.round((rectSize- 2*Math.round(dPR)-tab_width)/7*4);var x=4*Math.round(dPR)+dx;var y=4*Math.round(dPR)+dy;if(this.m_nTabsType==tab_Left){_ctx.moveTo(x+offset,y);_ctx.lineTo(x+offset,y+tab_width+offset);_ctx.lineTo(x+tab_width,y+tab_width+offset)}else if(this.m_nTabsType==tab_Center){tab_width=Math.round(8*dPR);tab_width=tab_width%2===1?tab_width-1:tab_width;var dx=Math.round((rectSize-Math.round(dPR)-tab_width)/2);var x=3*Math.round(dPR)+dx;var vert_tab_width=Math.round(5*dPR);_ctx.moveTo(x,y+vert_tab_width+offset); _ctx.lineTo(x+tab_width,y+vert_tab_width+offset);_ctx.moveTo(x-offset+tab_width/2,y);_ctx.lineTo(x-offset+tab_width/2,y+vert_tab_width)}else{var x=3*Math.round(dPR)+dx;_ctx.moveTo(x,tab_width+y+offset);_ctx.lineTo(x+tab_width+offset,tab_width+y+offset);_ctx.lineTo(x+tab_width+offset,y)}_ctx.stroke();_ctx.beginPath()};this.onPrevPage=function(){if(false===oThis.m_oApi.bInit_word_control)return;var oWordControl=oThis;if(0oWordControl.m_oDrawingDocument.m_lCurrentPage)oWordControl.GoToPage(oWordControl.m_oDrawingDocument.m_lCurrentPage+1);else if(oWordControl.m_oDrawingDocument.m_lPagesCount>0)oWordControl.GoToPage(oWordControl.m_oDrawingDocument.m_lPagesCount-1)};this.horRulerMouseDown=function(e){if(false===oThis.m_oApi.bInit_word_control)return; if(e.preventDefault)e.preventDefault();else e.returnValue=false;var oWordControl=oThis;var _cur_page=oWordControl.m_oDrawingDocument.m_lCurrentPage;if(_cur_page<0||_cur_page>=oWordControl.m_oDrawingDocument.m_lPagesCount)return;oWordControl.m_oHorRuler.OnMouseDown(oWordControl.m_oDrawingDocument.m_arrPages[_cur_page].drawingPage.left,0,e)};this.horRulerMouseUp=function(e){if(false===oThis.m_oApi.bInit_word_control)return;if(e.preventDefault)e.preventDefault();else e.returnValue=false;var oWordControl= oThis;var _cur_page=oWordControl.m_oDrawingDocument.m_lCurrentPage;if(_cur_page<0||_cur_page>=oWordControl.m_oDrawingDocument.m_lPagesCount)return;oWordControl.m_oHorRuler.OnMouseUp(oWordControl.m_oDrawingDocument.m_arrPages[_cur_page].drawingPage.left,0,e)};this.horRulerMouseMove=function(e){if(false===oThis.m_oApi.bInit_word_control)return;if(e.preventDefault)e.preventDefault();else e.returnValue=false;var oWordControl=oThis;var _cur_page=oWordControl.m_oDrawingDocument.m_lCurrentPage;if(_cur_page< 0||_cur_page>=oWordControl.m_oDrawingDocument.m_lPagesCount)return;oWordControl.m_oHorRuler.OnMouseMove(oWordControl.m_oDrawingDocument.m_arrPages[_cur_page].drawingPage.left,0,e)};this.verRulerMouseDown=function(e){if(false===oThis.m_oApi.bInit_word_control)return;if(e.preventDefault)e.preventDefault();else e.returnValue=false;var oWordControl=oThis;var _cur_page=oWordControl.m_oDrawingDocument.m_lCurrentPage;if(_cur_page<0||_cur_page>=oWordControl.m_oDrawingDocument.m_lPagesCount)return;oWordControl.m_oVerRuler.OnMouseDown(0, oWordControl.m_oDrawingDocument.m_arrPages[_cur_page].drawingPage.top,e)};this.verRulerMouseUp=function(e){if(false===oThis.m_oApi.bInit_word_control)return;if(e.preventDefault)e.preventDefault();else e.returnValue=false;var oWordControl=oThis;var _cur_page=oWordControl.m_oDrawingDocument.m_lCurrentPage;if(_cur_page<0||_cur_page>=oWordControl.m_oDrawingDocument.m_lPagesCount)return;oWordControl.m_oVerRuler.OnMouseUp(0,oWordControl.m_oDrawingDocument.m_arrPages[_cur_page].drawingPage.top,e)};this.verRulerMouseMove= function(e){if(false===oThis.m_oApi.bInit_word_control)return;if(e.preventDefault)e.preventDefault();else e.returnValue=false;var oWordControl=oThis;var _cur_page=oWordControl.m_oDrawingDocument.m_lCurrentPage;if(_cur_page<0||_cur_page>=oWordControl.m_oDrawingDocument.m_lPagesCount)return;oWordControl.m_oVerRuler.OnMouseMove(0,oWordControl.m_oDrawingDocument.m_arrPages[_cur_page].drawingPage.top,e)};this.SelectWheel=function(){if(false===oThis.m_oApi.bInit_word_control)return;var oWordControl=oThis; var positionMinY=oWordControl.m_oMainContent.AbsolutePosition.T*g_dKoef_mm_to_pix+oWordControl.Y;if(oWordControl.m_bIsRuler)positionMinY=(oWordControl.m_oMainContent.AbsolutePosition.T+oWordControl.m_oTopRuler_horRuler.AbsolutePosition.B)*g_dKoef_mm_to_pix+oWordControl.Y;var minPosY=20;minPosY*=AscCommon.AscBrowser.retinaPixelRatio;if(positionMinYpositionMinY-global_mouseEvent.Y)delta=10;scrollYVal=-delta}else if(global_mouseEvent.Y>positionMaxY){var delta=30;if(20>global_mouseEvent.Y-positionMaxY)delta=10;scrollYVal=delta}var scrollXVal=0;if(oWordControl.m_bIsHorScrollVisible){var positionMinX=oWordControl.m_oMainContent.AbsolutePosition.L*g_dKoef_mm_to_pix+oWordControl.X;if(oWordControl.m_bIsRuler)positionMinX+=oWordControl.m_oLeftRuler.AbsolutePosition.R*g_dKoef_mm_to_pix;var positionMaxX=oWordControl.m_oMainContent.AbsolutePosition.R* g_dKoef_mm_to_pix+oWordControl.X;if(global_mouseEvent.XpositionMinX-global_mouseEvent.X)delta=10;scrollXVal=-delta}else if(global_mouseEvent.X>positionMaxX){var delta=30;if(20>global_mouseEvent.X-positionMaxX)delta=10;scrollXVal=delta}}if(0!=scrollYVal)oWordControl.m_oScrollVerApi.scrollByY(scrollYVal,false);if(0!=scrollXVal)oWordControl.m_oScrollHorApi.scrollByX(scrollXVal,false);if(scrollXVal!=0||scrollYVal!=0)oWordControl.onMouseMove2()};this.onMouseDown=function(e, isTouch){oThis.m_oApi.checkInterfaceElementBlur();oThis.m_oApi.checkLastWork();if(false===oThis.m_oApi.bInit_word_control||AscCommon.isTouch&&undefined===isTouch||oThis.m_oApi.isLongAction())return;if(!oThis.m_bIsIE)if(e.preventDefault)e.preventDefault();else e.returnValue=false;if(AscCommon.g_inputContext&&AscCommon.g_inputContext.externalChangeFocus())return;var oWordControl=oThis;if(this.id=="id_viewer"&&oThis.m_oOverlay.HtmlElement.style.display=="block")return;var _xOffset=oWordControl.X;var _yOffset= oWordControl.Y;if(true===oWordControl.m_bIsRuler){_xOffset+=5*g_dKoef_mm_to_pix;_yOffset+=7*g_dKoef_mm_to_pix}if(window["closeDialogs"]!=undefined)window["closeDialogs"]();AscCommon.check_MouseDownEvent(e,true);global_mouseEvent.LockMouse();if(0==global_mouseEvent.Button||undefined==global_mouseEvent.Button)oWordControl.m_bIsMouseLock=true;var pos=null;if(oWordControl.MouseHandObject){pos=oWordControl.m_oDrawingDocument.ConvertCoordsFromCursor2(global_mouseEvent.X,global_mouseEvent.Y);if(oWordControl.MouseHandObject.check(oWordControl, pos)){oWordControl.MouseHandObject.X=global_mouseEvent.X;oWordControl.MouseHandObject.Y=global_mouseEvent.Y;oWordControl.MouseHandObject.Active=true;oWordControl.MouseHandObject.ScrollX=oWordControl.m_dScrollX;oWordControl.MouseHandObject.ScrollY=oWordControl.m_dScrollY;oWordControl.m_oDrawingDocument.SetCursorType("grabbing");return}}oWordControl.StartUpdateOverlay();var bIsSendSelectWhell=false;if(0==global_mouseEvent.Button||undefined==global_mouseEvent.Button){if(oWordControl.m_oDrawingDocument.AutoShapesTrackLockPageNum== -1)pos=oWordControl.m_oDrawingDocument.ConvertCoordsFromCursor2(global_mouseEvent.X,global_mouseEvent.Y);else pos=oWordControl.m_oDrawingDocument.ConvetToPageCoords(global_mouseEvent.X,global_mouseEvent.Y,oWordControl.m_oDrawingDocument.AutoShapesTrackLockPageNum);if(pos.Page==-1){oWordControl.EndUpdateOverlay();return}if(oWordControl.m_oDrawingDocument.IsFreezePage(pos.Page)){oWordControl.EndUpdateOverlay();return}if(null==oWordControl.m_oDrawingDocument.m_oDocumentRenderer){var ret=oWordControl.m_oDrawingDocument.checkMouseDown_Drawing(pos); if(ret===true){if(-1==oWordControl.m_oTimerScrollSelect&&AscCommon.global_mouseEvent.IsLocked)oWordControl.m_oTimerScrollSelect=setInterval(oWordControl.SelectWheel,20);AscCommon.stopEvent(e);return}if(-1==oWordControl.m_oTimerScrollSelect&&AscCommon.global_mouseEvent.IsLocked){oWordControl.m_oTimerScrollSelect=setInterval(oWordControl.SelectWheel,20);bIsSendSelectWhell=true}oWordControl.m_oDrawingDocument.NeedScrollToTargetFlag=true;oWordControl.m_oLogicDocument.OnMouseDown(global_mouseEvent,pos.X, pos.Y,pos.Page);oWordControl.m_oDrawingDocument.NeedScrollToTargetFlag=false;oWordControl.MouseDownDocumentCounter++}else{oWordControl.m_oDrawingDocument.m_oDocumentRenderer.OnMouseDown(pos.Page,pos.X,pos.Y);oWordControl.MouseDownDocumentCounter++}}else if(global_mouseEvent.Button==2)oWordControl.MouseDownDocumentCounter++;if(!bIsSendSelectWhell&&-1==oWordControl.m_oTimerScrollSelect&&AscCommon.global_mouseEvent.IsLocked)oWordControl.m_oTimerScrollSelect=setInterval(oWordControl.SelectWheel,20);oWordControl.EndUpdateOverlay()}; this.onMouseMove=function(e,isTouch){oThis.m_oApi.checkLastWork();if(false===oThis.m_oApi.bInit_word_control||AscCommon.isTouch&&undefined===isTouch||oThis.m_oApi.isLongAction())return;if(e){if(e.preventDefault)e.preventDefault();else e.returnValue=false;AscCommon.check_MouseMoveEvent(e)}var oWordControl=oThis;var pos=null;if(oWordControl.MouseHandObject)if(oWordControl.MouseHandObject.Active){oWordControl.m_oDrawingDocument.SetCursorType("grabbing");var scrollX=global_mouseEvent.X-oWordControl.MouseHandObject.X; var scrollY=global_mouseEvent.Y-oWordControl.MouseHandObject.Y;if(0!=scrollX&&oWordControl.m_bIsHorScrollVisible)oWordControl.m_oScrollHorApi.scrollToX(oWordControl.MouseHandObject.ScrollX-scrollX);if(0!=scrollY)oWordControl.m_oScrollVerApi.scrollToY(oWordControl.MouseHandObject.ScrollY-scrollY);return}else if(!global_mouseEvent.IsLocked){pos=oWordControl.m_oDrawingDocument.ConvertCoordsFromCursor2(global_mouseEvent.X,global_mouseEvent.Y);if(oWordControl.MouseHandObject.check(oWordControl,pos)){oThis.m_oApi.sync_MouseMoveStartCallback(); oThis.m_oApi.sync_MouseMoveCallback(new AscCommon.CMouseMoveData);oThis.m_oApi.sync_MouseMoveEndCallback();oWordControl.m_oDrawingDocument.SetCursorType("grab");return}}if(oWordControl.m_oDrawingDocument.AutoShapesTrackLockPageNum==-1)pos=oWordControl.m_oDrawingDocument.ConvertCoordsFromCursor2(global_mouseEvent.X,global_mouseEvent.Y);else pos=oWordControl.m_oDrawingDocument.ConvetToPageCoords(global_mouseEvent.X,global_mouseEvent.Y,oWordControl.m_oDrawingDocument.AutoShapesTrackLockPageNum);if(pos.Page== -1)return;if(oWordControl.m_oDrawingDocument.IsFreezePage(pos.Page))return;if(oWordControl.m_oDrawingDocument.m_sLockedCursorType!="")oWordControl.m_oDrawingDocument.SetCursorType("default");if(oWordControl.m_oDrawingDocument.m_oDocumentRenderer!=null){oWordControl.m_oDrawingDocument.m_oDocumentRenderer.OnMouseMove(pos.Page,pos.X,pos.Y);return}oWordControl.StartUpdateOverlay();var is_drawing=oWordControl.m_oDrawingDocument.checkMouseMove_Drawing(pos,e===undefined?true:false);if(is_drawing===true)return; oWordControl.m_oDrawingDocument.TableOutlineDr.bIsNoTable=true;oWordControl.m_oLogicDocument.OnMouseMove(global_mouseEvent,pos.X,pos.Y,pos.Page);if(oWordControl.m_oDrawingDocument.TableOutlineDr.bIsNoTable===false){oWordControl.ShowOverlay();oWordControl.OnUpdateOverlay()}if(!oWordControl.IsUpdateOverlayOnEndCheck)if(oWordControl.m_oDrawingDocument.contentControls&&oWordControl.m_oDrawingDocument.contentControls.ContentControlsCheckLast())oWordControl.OnUpdateOverlay();oWordControl.EndUpdateOverlay()}; this.onMouseMove2=function(){if(false===oThis.m_oApi.bInit_word_control)return;var oWordControl=oThis;var pos=null;if(oWordControl.m_oDrawingDocument.AutoShapesTrackLockPageNum==-1)pos=oWordControl.m_oDrawingDocument.ConvertCoordsFromCursor2(global_mouseEvent.X,global_mouseEvent.Y);else pos=oWordControl.m_oDrawingDocument.ConvetToPageCoords(global_mouseEvent.X,global_mouseEvent.Y,oWordControl.m_oDrawingDocument.AutoShapesTrackLockPageNum);if(pos.Page==-1)return;if(null!=oWordControl.m_oDrawingDocument.m_oDocumentRenderer){oWordControl.m_oDrawingDocument.m_oDocumentRenderer.OnMouseMove(pos.Page, pos.X,pos.Y);return}if(oWordControl.m_oDrawingDocument.IsFreezePage(pos.Page))return;oWordControl.StartUpdateOverlay();var is_drawing=oWordControl.m_oDrawingDocument.checkMouseMove_Drawing(pos);if(is_drawing===true)return;oWordControl.m_oLogicDocument.OnMouseMove(global_mouseEvent,pos.X,pos.Y,pos.Page);oWordControl.EndUpdateOverlay()};this.UnlockCursorTypeOnMouseUp=function(){if(this.m_oApi.isDrawTablePen||this.m_oApi.isDrawTableErase)return;this.m_oDrawingDocument.UnlockCursorType()};this.onMouseUp= function(e,bIsWindow,isTouch){oThis.m_oApi.checkLastWork();if(false===oThis.m_oApi.bInit_word_control||AscCommon.isTouch&&undefined===isTouch||oThis.m_oApi.isLongAction())return;var oWordControl=oThis;if(oWordControl.MouseHandObject&&oWordControl.MouseHandObject.Active){AscCommon.check_MouseUpEvent(e);oWordControl.MouseHandObject.Active=false;oWordControl.m_oDrawingDocument.SetCursorType("grab");oWordControl.m_bIsMouseLock=false;return}if(!global_mouseEvent.IsLocked&&0==oWordControl.MouseDownDocumentCounter)return; if(this.id=="id_viewer"&&oThis.m_oOverlay.HtmlElement.style.display=="block"&&undefined==bIsWindow)return;if(global_mouseEvent.Sender!=oThis.m_oEditor.HtmlElement&&global_mouseEvent.Sender!=oThis.m_oOverlay.HtmlElement&&global_mouseEvent.Sender!=oThis.m_oDrawingDocument.TargetHtmlElement&&(oThis.TextBoxBackground&&oThis.TextBoxBackground.HtmlElement!=global_mouseEvent.Sender))return;if(-1!=oWordControl.m_oTimerScrollSelect){clearInterval(oWordControl.m_oTimerScrollSelect);oWordControl.m_oTimerScrollSelect= -1}if(oWordControl.m_oHorRuler.m_bIsMouseDown)oWordControl.m_oHorRuler.OnMouseUpExternal();if(oWordControl.m_oVerRuler.DragType!=0)oWordControl.m_oVerRuler.OnMouseUpExternal();if(oWordControl.m_oScrollVerApi.getIsLockedMouse())oWordControl.m_oScrollVerApi.evt_mouseup(e);if(oWordControl.m_oScrollHorApi.getIsLockedMouse())oWordControl.m_oScrollHorApi.evt_mouseup(e);AscCommon.check_MouseUpEvent(e);var pos=null;if(oWordControl.m_oDrawingDocument.AutoShapesTrackLockPageNum==-1)pos=oWordControl.m_oDrawingDocument.ConvertCoordsFromCursor2(global_mouseEvent.X, global_mouseEvent.Y);else pos=oWordControl.m_oDrawingDocument.ConvetToPageCoords(global_mouseEvent.X,global_mouseEvent.Y,oWordControl.m_oDrawingDocument.AutoShapesTrackLockPageNum);if(pos.Page==-1)return;if(oWordControl.m_oDrawingDocument.IsFreezePage(pos.Page))return;oWordControl.UnlockCursorTypeOnMouseUp();oWordControl.StartUpdateOverlay();oWordControl.m_bIsMouseLock=false;var is_drawing=oWordControl.m_oDrawingDocument.checkMouseUp_Drawing(pos);if(is_drawing===true)return;if(null!=oWordControl.m_oDrawingDocument.m_oDocumentRenderer){oWordControl.m_oDrawingDocument.m_oDocumentRenderer.OnMouseUp(); oWordControl.MouseDownDocumentCounter--;if(oWordControl.MouseDownDocumentCounter<0)oWordControl.MouseDownDocumentCounter=0;oWordControl.EndUpdateOverlay();return}oWordControl.m_bIsMouseUpSend=true;if(2==global_mouseEvent.Button);oWordControl.m_oDrawingDocument.NeedScrollToTargetFlag=true;oWordControl.m_oLogicDocument.OnMouseUp(global_mouseEvent,pos.X,pos.Y,pos.Page);oWordControl.m_oDrawingDocument.NeedScrollToTargetFlag=false;oWordControl.MouseDownDocumentCounter--;if(oWordControl.MouseDownDocumentCounter< 0)oWordControl.MouseDownDocumentCounter=0;oWordControl.m_bIsMouseUpSend=false;oWordControl.m_oLogicDocument.Document_UpdateInterfaceState();oWordControl.m_oLogicDocument.Document_UpdateRulersState();oWordControl.EndUpdateOverlay();if(AscCommon.check_MouseClickOnUp())if(window.g_asc_plugins)window.g_asc_plugins.onPluginEvent("onClick",oWordControl.m_oLogicDocument.IsSelectionUse())};this.onMouseUpMainSimple=function(){if(false===oThis.m_oApi.bInit_word_control)return;var oWordControl=oThis;global_mouseEvent.Type= AscCommon.g_mouse_event_type_up;AscCommon.MouseUpLock.MouseUpLockedSend=true;global_mouseEvent.Sender=null;global_mouseEvent.UnLockMouse();global_mouseEvent.IsPressed=false;if(oWordControl.MouseHandObject&&oWordControl.MouseHandObject.Active){oWordControl.MouseHandObject.Active=false;oWordControl.m_oDrawingDocument.SetCursorType("grab");return}if(-1!=oWordControl.m_oTimerScrollSelect){clearInterval(oWordControl.m_oTimerScrollSelect);oWordControl.m_oTimerScrollSelect=-1}};this.onMouseUpExternal=function(x, y){if(false===oThis.m_oApi.bInit_word_control)return;var oWordControl=oThis;global_mouseEvent.X=x;global_mouseEvent.Y=y;global_mouseEvent.Type=AscCommon.g_mouse_event_type_up;AscCommon.MouseUpLock.MouseUpLockedSend=true;if(oWordControl.m_oHorRuler.m_bIsMouseDown)oWordControl.m_oHorRuler.OnMouseUpExternal();if(oWordControl.m_oVerRuler.DragType!=0)oWordControl.m_oVerRuler.OnMouseUpExternal();if(oWordControl.m_oScrollVerApi.getIsLockedMouse()){var __e={clientX:x,clientY:y};oWordControl.m_oScrollVerApi.evt_mouseup(__e)}if(oWordControl.m_oScrollHorApi.getIsLockedMouse()){var __e= {clientX:x,clientY:y};oWordControl.m_oScrollHorApi.evt_mouseup(__e)}if(window.g_asc_plugins)window.g_asc_plugins.onExternalMouseUp();global_mouseEvent.Sender=null;global_mouseEvent.UnLockMouse();global_mouseEvent.IsPressed=false;if(oWordControl.MouseHandObject&&oWordControl.MouseHandObject.Active){oWordControl.MouseHandObject.Active=false;oWordControl.m_oDrawingDocument.SetCursorType("grab");return}if(-1!=oWordControl.m_oTimerScrollSelect){clearInterval(oWordControl.m_oTimerScrollSelect);oWordControl.m_oTimerScrollSelect= -1}var pos=null;if(oWordControl.m_oDrawingDocument.AutoShapesTrackLockPageNum==-1)pos=oWordControl.m_oDrawingDocument.ConvertCoordsFromCursor2(global_mouseEvent.X,global_mouseEvent.Y);else pos=oWordControl.m_oDrawingDocument.ConvetToPageCoords(global_mouseEvent.X,global_mouseEvent.Y,oWordControl.m_oDrawingDocument.AutoShapesTrackLockPageNum);if(pos.Page==-1)return;if(oWordControl.m_oDrawingDocument.IsFreezePage(pos.Page))return;oWordControl.UnlockCursorTypeOnMouseUp();oWordControl.StartUpdateOverlay(); oWordControl.m_bIsMouseLock=false;var is_drawing=oWordControl.m_oDrawingDocument.checkMouseUp_Drawing(pos);if(is_drawing===true)return;if(null!=oWordControl.m_oDrawingDocument.m_oDocumentRenderer){oWordControl.m_oDrawingDocument.m_oDocumentRenderer.OnMouseUp();oWordControl.MouseDownDocumentCounter--;if(oWordControl.MouseDownDocumentCounter<0)oWordControl.MouseDownDocumentCounter=0;oWordControl.EndUpdateOverlay();return}oWordControl.m_bIsMouseUpSend=true;if(2==global_mouseEvent.Button);oWordControl.m_oLogicDocument.OnMouseUp(global_mouseEvent, pos.X,pos.Y,pos.Page);oWordControl.MouseDownDocumentCounter--;if(oWordControl.MouseDownDocumentCounter<0)oWordControl.MouseDownDocumentCounter=0;oWordControl.m_bIsMouseUpSend=false;oWordControl.m_oLogicDocument.Document_UpdateInterfaceState();oWordControl.m_oLogicDocument.Document_UpdateRulersState();oWordControl.EndUpdateOverlay()};this.onMouseWhell=function(e){if(false===oThis.m_oApi.bInit_word_control)return;if(undefined!==window["AscDesktopEditor"])if(false===window["AscDesktopEditor"]["CheckNeedWheel"]())return; if(oThis.MouseHandObject&&oThis.MouseHandObject.IsActive)return;var _ctrl=false;if(e.metaKey!==undefined)_ctrl=e.ctrlKey||e.metaKey;else _ctrl=e.ctrlKey;if(true===_ctrl){if(e.preventDefault)e.preventDefault();else e.returnValue=false;return false}var delta=0;var deltaX=0;var deltaY=0;if(undefined!=e.wheelDelta&&e.wheelDelta!=0)delta=-45*e.wheelDelta/120;else if(undefined!=e.detail&&e.detail!=0)delta=45*e.detail/3;deltaY=delta;if(oThis.m_bIsHorScrollVisible){if(e.axis!==undefined&&e.axis===e.HORIZONTAL_AXIS){deltaY= 0;deltaX=delta}if(undefined!==e.wheelDeltaY&&0!==e.wheelDeltaY)deltaY=-45*e.wheelDeltaY/120;if(undefined!==e.wheelDeltaX&&0!==e.wheelDeltaX)deltaX=-45*e.wheelDeltaX/120}deltaX>>=0;deltaY>>=0;if(0!=deltaX)oThis.m_oScrollHorApi.scrollBy(deltaX,0,false);else if(0!=deltaY)oThis.m_oScrollVerApi.scrollBy(0,deltaY,false);var _e={};_e.pageX=global_mouseEvent.X;_e.pageY=global_mouseEvent.Y;_e.clientX=global_mouseEvent.X;_e.clientY=global_mouseEvent.Y;_e.altKey=global_mouseEvent.AltKey;_e.shiftKey=global_mouseEvent.ShiftKey; _e.ctrlKey=global_mouseEvent.CtrlKey;_e.metaKey=global_mouseEvent.CtrlKey;_e.srcElement=global_mouseEvent.Sender;oThis.onMouseMove(_e);if(e.preventDefault)e.preventDefault();else e.returnValue=false;return false};this.checkViewerModeKeys=function(e){var isSendEditor=false;if(e.KeyCode==33);else if(e.KeyCode==34);else if(e.KeyCode==35){if(true===e.CtrlKey)oThis.m_oScrollVerApi.scrollTo(0,oThis.m_dScrollY_max)}else if(e.KeyCode==36){if(true===e.CtrlKey)oThis.m_oScrollVerApi.scrollTo(0,0)}else if(e.KeyCode== 37){if(oThis.m_bIsHorScrollVisible)oThis.m_oScrollHorApi.scrollBy(-30,0,false)}else if(e.KeyCode==38)oThis.m_oScrollVerApi.scrollBy(0,-30,false);else if(e.KeyCode==39){if(oThis.m_bIsHorScrollVisible)oThis.m_oScrollHorApi.scrollBy(30,0,false)}else if(e.KeyCode==40)oThis.m_oScrollVerApi.scrollBy(0,30,false);else if(e.KeyCode==65&&true===e.CtrlKey)isSendEditor=true;else if(e.KeyCode==67&&true===e.CtrlKey)if(false===e.ShiftKey)AscCommon.Editor_Copy(oThis.m_oApi);return isSendEditor};this.ChangeReaderMode= function(){if(this.ReaderModeCurrent)this.DisableReaderMode();else this.EnableReaderMode()};this.IncreaseReaderFontSize=function(){if(null==this.ReaderModeDiv)return;if(this.ReaderFontSizeCur>=this.ReaderFontSizes.length-1){this.ReaderFontSizeCur=this.ReaderFontSizes.length-1;return}this.ReaderFontSizeCur++;this.ReaderModeDiv.style.fontSize=this.ReaderFontSizes[this.ReaderFontSizeCur]+"pt";this.ReaderTouchManager.ChangeFontSize()};this.DecreaseReaderFontSize=function(){if(null==this.ReaderModeDiv)return; if(this.ReaderFontSizeCur<=0){this.ReaderFontSizeCur=0;return}this.ReaderFontSizeCur--;this.ReaderModeDiv.style.fontSize=this.ReaderFontSizes[this.ReaderFontSizeCur]+"pt";this.ReaderTouchManager.ChangeFontSize()};this.IsReaderMode=function(){return this.ReaderModeCurrent==1};this.UpdateReaderContent=function(){if(this.ReaderModeCurrent==1&&this.ReaderModeDivWrapper!=null)this.ReaderModeDivWrapper.innerHTML='
'+this.m_oApi.ContentToHTML(true)+"
"};this.EnableReaderMode=function(){this.ReaderModeCurrent=1;if(this.ReaderTouchManager){this.TransformDivUseAnimation(this.ReaderModeDivWrapper,0);return}this.ReaderModeDivWrapper=document.createElement("div");this.ReaderModeDivWrapper.setAttribute("style", "z-index:11;font-family:arial;font-size:12pt;position:absolute; resize:none;padding:0px;display:block; margin:0px;left:0px;top:0px;background-color:#FFFFFF");var _c_h=parseInt(oThis.m_oMainView.HtmlElement.style.height);this.ReaderModeDivWrapper.style.top=_c_h+"px";this.ReaderModeDivWrapper.style.width=this.m_oMainView.HtmlElement.style.width;this.ReaderModeDivWrapper.style.height=this.m_oMainView.HtmlElement.style.height;this.ReaderModeDivWrapper.id="wrapper_reader_id";this.ReaderModeDivWrapper.innerHTML= '
'+this.m_oApi.ContentToHTML(true)+"
";this.m_oMainView.HtmlElement.appendChild(this.ReaderModeDivWrapper);this.ReaderModeDiv=document.getElementById("reader_id");if(this.MobileTouchManager){this.MobileTouchManager.Destroy(); this.MobileTouchManager=null}this.ReaderTouchManager=new AscCommon.CReaderTouchManager;this.ReaderTouchManager.Init(this.m_oApi);this.TransformDivUseAnimation(this.ReaderModeDivWrapper,0);var __hasTouch="ontouchstart"in window;if(__hasTouch){this.ReaderModeDivWrapper["ontouchcancel"]=function(e){return oThis.ReaderTouchManager.onTouchEnd(e)};this.ReaderModeDivWrapper["ontouchstart"]=function(e){return oThis.ReaderTouchManager.onTouchStart(e)};this.ReaderModeDivWrapper["ontouchmove"]=function(e){return oThis.ReaderTouchManager.onTouchMove(e)}; this.ReaderModeDivWrapper["ontouchend"]=function(e){return oThis.ReaderTouchManager.onTouchEnd(e)}}else{this.ReaderModeDivWrapper["onmousedown"]=function(e){return oThis.ReaderTouchManager.onTouchStart(e)};this.ReaderModeDivWrapper["onmousemove"]=function(e){return oThis.ReaderTouchManager.onTouchMove(e)};this.ReaderModeDivWrapper["onmouseup"]=function(e){return oThis.ReaderTouchManager.onTouchEnd(e)}}};this.DisableReaderMode=function(){this.ReaderModeCurrent=0;if(null==this.ReaderModeDivWrapper)return; this.TransformDivUseAnimation(this.ReaderModeDivWrapper,parseInt(this.ReaderModeDivWrapper.style.height)+10);setTimeout(this.CheckDestroyReader,500);return};this.CheckDestroyReader=function(){if(oThis.ReaderModeDivWrapper!=null){if(parseInt(oThis.ReaderModeDivWrapper.style.top)>parseInt(oThis.ReaderModeDivWrapper.style.height)){oThis.m_oMainView.HtmlElement.removeChild(oThis.ReaderModeDivWrapper);oThis.ReaderModeDivWrapper=null;oThis.ReaderModeDiv=null;oThis.ReaderTouchManager.Destroy();oThis.ReaderTouchManager= null;oThis.ReaderModeCurrent=0;if(oThis.m_oApi.isMobileVersion){oThis.MobileTouchManager=new AscCommon.CMobileTouchManager({eventsElement:"word_mobile_element"});oThis.MobileTouchManager.Init(oThis.m_oApi);if(AscCommon.g_inputContext&&AscCommon.g_inputContext.HtmlArea)oThis.MobileTouchManager.initEvents(AscCommon.g_inputContext.HtmlArea.id);oThis.MobileTouchManager.Resize();oThis.MobileTouchManager.scrollTo(oThis.m_dScrollX,oThis.m_dScrollY)}return}if(oThis.ReaderModeCurrent==0)setTimeout(oThis.CheckDestroyReader, 200)}};this.TransformDivUseAnimation=function(_div,topPos){_div.style[window.asc_sdk_transitionProperty]="top";_div.style[window.asc_sdk_transitionDuration]="1000ms";_div.style.top=topPos+"px"};this.onKeyDown=function(e){oThis.m_oApi.checkLastWork();if(oThis.m_oApi.isLongAction()){e.preventDefault();return}var oWordControl=oThis;if(false===oWordControl.m_oApi.bInit_word_control){AscCommon.check_KeyboardEvent2(e);e.preventDefault();return}if(oWordControl.m_bIsRuler&&oWordControl.m_oHorRuler.m_bIsMouseDown){AscCommon.check_KeyboardEvent2(e); e.preventDefault();return}if(oWordControl.m_bIsMouseLock===true&&(27!==e.keyCode||true===oWordControl.m_oLogicDocument.Is_TrackingDrawingObjects())){if(!window.USER_AGENT_MACOS){AscCommon.check_KeyboardEvent2(e);e.preventDefault();return}oWordControl.onMouseUpExternal(global_mouseEvent.X,global_mouseEvent.Y)}AscCommon.check_KeyboardEvent(e);if(oWordControl.IsFocus===false)if(!oWordControl.onKeyDownNoActiveControl(global_keyboardEvent))return;if(null==oWordControl.m_oLogicDocument){var bIsPrev=oWordControl.m_oDrawingDocument.m_oDocumentRenderer.OnKeyDown(global_keyboardEvent)=== true?false:true;if(false===bIsPrev)e.preventDefault();return}oWordControl.StartUpdateOverlay();oWordControl.IsKeyDownButNoPress=true;var _ret_mouseDown=oWordControl.m_oLogicDocument.OnKeyDown(global_keyboardEvent);oWordControl.bIsUseKeyPress=(_ret_mouseDown&keydownresult_PreventKeyPress)!=0?false:true;oWordControl.EndUpdateOverlay();if((_ret_mouseDown&keydownresult_PreventDefault)!=0)e.preventDefault()};this.onKeyDownNoActiveControl=function(e){var bSendToEditor=false;if(e.CtrlKey&&!e.ShiftKey)switch(e.KeyCode){case 80:case 83:bSendToEditor= true;break;default:break}return bSendToEditor};this.onKeyUp=function(e){global_keyboardEvent.AltKey=false;global_keyboardEvent.CtrlKey=false;global_keyboardEvent.ShiftKey=false;global_keyboardEvent.AltGr=false};this.onKeyPress=function(e){if(AscCommon.g_clipboardBase.IsWorking())return;if(oThis.m_oApi.isLongAction()){e.preventDefault();return}var oWordControl=oThis;if(false===oWordControl.m_oApi.bInit_word_control||oWordControl.IsFocus===false||oWordControl.m_bIsMouseLock===true)return;if(window.opera&& !oWordControl.IsKeyDownButNoPress){oWordControl.StartUpdateOverlay();oWordControl.onKeyDown(e);oWordControl.EndUpdateOverlay()}oWordControl.IsKeyDownButNoPress=false;if(false===oWordControl.bIsUseKeyPress)return;if(null==oWordControl.m_oLogicDocument)return;AscCommon.check_KeyboardEvent(e);oWordControl.StartUpdateOverlay();var retValue=oWordControl.m_oLogicDocument.OnKeyPress(global_keyboardEvent);oWordControl.EndUpdateOverlay();if(true===retValue)e.preventDefault()};this.verticalScroll=function(sender, scrollPositionY,maxY,isAtTop,isAtBottom){if(false===oThis.m_oApi.bInit_word_control)return;var oWordControl=oThis;oWordControl.m_dScrollY=Math.max(0,Math.min(scrollPositionY,maxY));oWordControl.m_dScrollY_max=maxY;oWordControl.m_bIsUpdateVerRuler=true;oWordControl.m_bIsUpdateTargetNoAttack=true;if(oWordControl.m_bIsRePaintOnScroll===true)oWordControl.OnScroll();if(oWordControl.MobileTouchManager&&oWordControl.MobileTouchManager.iScroll)oWordControl.MobileTouchManager.iScroll.y=-oWordControl.m_dScrollY}; this.CorrectSpeedVerticalScroll=function(newScrollPos){var res={isChange:false,Pos:newScrollPos};if(newScrollPos<=0||newScrollPos>=this.m_dScrollY_max)return res;var _heightPageMM=Page_Height;if(this.m_oDrawingDocument.m_arrPages.length>0)_heightPageMM=this.m_oDrawingDocument.m_arrPages[0].height_mm;var del=20+(g_dKoef_mm_to_pix*_heightPageMM*this.m_nZoomValue/100+.5)>>0;var delta=Math.abs(newScrollPos-this.m_dScrollY);if(this.m_oDrawingDocument.m_lPagesCount<=10)return res;else if(this.m_oDrawingDocument.m_lPagesCount<= 100&&deltathis.m_dScrollY_max)res.Pos=this.m_dScrollY_max; return res};this.horizontalScroll=function(sender,scrollPositionX,maxX,isAtLeft,isAtRight){if(false===oThis.m_oApi.bInit_word_control)return;var oWordControl=oThis;oWordControl.m_dScrollX=Math.max(0,Math.min(scrollPositionX,maxX));oWordControl.m_dScrollX_max=maxX;oWordControl.m_bIsUpdateHorRuler=true;oWordControl.m_bIsUpdateTargetNoAttack=true;if(oWordControl.m_bIsRePaintOnScroll===true)oWordControl.OnScroll();if(oWordControl.MobileTouchManager&&oWordControl.MobileTouchManager.iScroll)oWordControl.MobileTouchManager.iScroll.x= -oWordControl.m_dScrollX};this.CreateScrollSettings=function(){var settings=new AscCommon.ScrollSettings;settings.screenW=this.m_oEditor.HtmlElement.width;settings.screenH=this.m_oEditor.HtmlElement.height;settings.vscrollStep=45;settings.hscrollStep=45;settings.isNeedInvertOnActive=GlobalSkin.isNeedInvertOnActive;settings.scrollBackgroundColor=GlobalSkin.ScrollBackgroundColor;settings.scrollBackgroundColorHover=GlobalSkin.ScrollBackgroundColor;settings.scrollBackgroundColorActive=GlobalSkin.ScrollBackgroundColor; settings.scrollerColor=GlobalSkin.ScrollerColor;settings.scrollerHoverColor=GlobalSkin.ScrollerHoverColor;settings.scrollerActiveColor=GlobalSkin.ScrollerActiveColor;settings.arrowColor=GlobalSkin.ScrollArrowColor;settings.arrowHoverColor=GlobalSkin.ScrollArrowHoverColor;settings.arrowActiveColor=GlobalSkin.ScrollArrowActiveColor;settings.strokeStyleNone=GlobalSkin.ScrollOutlineColor;settings.strokeStyleOver=GlobalSkin.ScrollOutlineHoverColor;settings.strokeStyleActive=GlobalSkin.ScrollOutlineActiveColor; settings.targetColor=GlobalSkin.ScrollerTargetColor;settings.targetHoverColor=GlobalSkin.ScrollerTargetHoverColor;settings.targetActiveColor=GlobalSkin.ScrollerTargetActiveColor;settings.screenW=AscCommon.AscBrowser.convertToRetinaValue(settings.screenW);settings.screenH=AscCommon.AscBrowser.convertToRetinaValue(settings.screenH);return settings};this.UpdateScrolls=function(){var settings;if(window["NATIVE_EDITOR_ENJINE"])return;settings=this.CreateScrollSettings();settings.isHorizontalScroll=true; settings.isVerticalScroll=false;settings.contentW=this.m_dDocumentWidth;if(this.m_oScrollHor_)this.m_oScrollHor_.Repos(settings,this.m_bIsHorScrollVisible);else{this.m_oScrollHor_=new AscCommon.ScrollObject("id_horizontal_scroll",settings);this.m_oScrollHor_.onLockMouse=function(evt){AscCommon.check_MouseDownEvent(evt,true);global_mouseEvent.LockMouse()};this.m_oScrollHor_.offLockMouse=function(evt){AscCommon.check_MouseUpEvent(evt)};this.m_oScrollHor_.bind("scrollhorizontal",function(evt){oThis.horizontalScroll(this, evt.scrollD,evt.maxScrollX)});this.m_oScrollHorApi=this.m_oScrollHor_}settings=this.CreateScrollSettings();settings.isHorizontalScroll=false;settings.isVerticalScroll=true;settings.contentH=this.m_dDocumentHeight;if(this.m_oScrollVer_)this.m_oScrollVer_.Repos(settings,undefined,true);else{this.m_oScrollVer_=new AscCommon.ScrollObject("id_vertical_scroll",settings);this.m_oScrollVer_.onLockMouse=function(evt){AscCommon.check_MouseDownEvent(evt,true);global_mouseEvent.LockMouse()};this.m_oScrollVer_.offLockMouse= function(evt){AscCommon.check_MouseUpEvent(evt)};this.m_oScrollVer_.bind("scrollvertical",function(evt){oThis.verticalScroll(this,evt.scrollD,evt.maxScrollY)});this.m_oScrollVer_.bind("correctVerticalScroll",function(yPos){return oThis.CorrectSpeedVerticalScroll(yPos)});this.m_oScrollVerApi=this.m_oScrollVer_}this.m_oApi.sendEvent("asc_onUpdateScrolls",this.m_dDocumentWidth,this.m_dDocumentHeight);this.m_dScrollX_max=this.m_oScrollHorApi.getMaxScrolledX();this.m_dScrollY_max=this.m_oScrollVerApi.getMaxScrolledY(); if(this.m_dScrollX>=this.m_dScrollX_max)this.m_dScrollX=this.m_dScrollX_max;if(this.m_dScrollY>=this.m_dScrollY_max)this.m_dScrollY=this.m_dScrollY_max};this.private_RefreshAll=function(){AscCommon.g_fontManager.ClearFontsRasterCache();if(AscCommon.g_fontManager2)AscCommon.g_fontManager2.ClearFontsRasterCache();this.OnRePaintAttack()};this.OnRePaintAttack=function(){this.m_bIsFullRepaint=true;this.OnScroll()};this.OnResize=function(isAttack){AscBrowser.checkZoom();var isNewSize=this.checkBodySize(); if(!isNewSize&&false===isAttack)return;if(this.MobileTouchManager)this.MobileTouchManager.Resize_Before();this.CheckRetinaDisplay();this.m_oBody.Resize(this.Width*g_dKoef_pix_to_mm,this.Height*g_dKoef_pix_to_mm,this);this.onButtonTabsDraw();if(AscCommon.g_inputContext)AscCommon.g_inputContext.onResize("id_main_view");if(this.TextBoxBackground!=null)this.TextBoxBackground.HtmlElement.style.top="10px";if(this.checkNeedHorScroll())return;if(1==this.m_nZoomType)if(true===this.zoom_FitToWidth()){this.m_oBoundsController.ClearNoAttack(); this.onTimerScroll2_sync();return}if(2==this.m_nZoomType)if(true===this.zoom_FitToPage()){this.m_oBoundsController.ClearNoAttack();this.onTimerScroll2_sync();return}this.m_bIsUpdateHorRuler=true;this.m_bIsUpdateVerRuler=true;if(this.m_bIsRuler){this.UpdateHorRulerBack(true);this.UpdateVerRulerBack(true)}this.m_oHorRuler.RepaintChecker.BlitAttack=true;this.m_oVerRuler.RepaintChecker.BlitAttack=true;this.UpdateScrolls();if(this.MobileTouchManager)this.MobileTouchManager.Resize();if(this.ReaderTouchManager)this.ReaderTouchManager.Resize(); this.m_bIsUpdateTargetNoAttack=true;this.m_bIsRePaintOnScroll=true;this.m_oBoundsController.ClearNoAttack();this.OnScroll();this.onTimerScroll2_sync();if(this.MobileTouchManager)this.MobileTouchManager.Resize_After();if(AscCommon.g_imageControlsStorage)AscCommon.g_imageControlsStorage.resize()};this.checkNeedRules=function(){if(this.m_bIsRuler){this.m_oLeftRuler.HtmlElement.style.display="block";this.m_oTopRuler.HtmlElement.style.display="block";this.m_oMainView.Bounds.L=5;this.m_oMainView.Bounds.T= 7}else{this.m_oLeftRuler.HtmlElement.style.display="none";this.m_oTopRuler.HtmlElement.style.display="none";this.m_oMainView.Bounds.L=0;this.m_oMainView.Bounds.T=0}};this.checkNeedHorScroll=function(){if(this.m_oApi.isMobileVersion){this.m_oPanelRight.Bounds.B=0;this.m_oMainContent.Bounds.B=0;this.m_bIsHorScrollVisible=false;return false}var _editor_width=this.m_oEditor.HtmlElement.width;_editor_width/=AscCommon.AscBrowser.retinaPixelRatio;var oldVisible=this.m_bIsHorScrollVisible;if(this.m_dDocumentWidth<= _editor_width)this.m_bIsHorScrollVisible=false;else this.m_bIsHorScrollVisible=true;if(this.m_bIsHorScrollVisible){this.m_oScrollHor.HtmlElement.style.display="block";this.m_oPanelRight.Bounds.B=this.ScrollsWidthPx*g_dKoef_pix_to_mm;this.m_oMainContent.Bounds.B=this.ScrollsWidthPx*g_dKoef_pix_to_mm}else{this.m_oPanelRight.Bounds.B=0;this.m_oMainContent.Bounds.B=0;this.m_oScrollHor.HtmlElement.style.display="none"}if(this.m_bIsHorScrollVisible!=oldVisible){this.m_dScrollX=0;this.OnResize(true);return true}return false}; this.getScrollMaxX=function(size){if(size>=this.m_dDocumentWidth)return 1;return this.m_dDocumentWidth-size};this.getScrollMaxY=function(size){if(size>=this.m_dDocumentHeight)return 1;return this.m_dDocumentHeight-size};this.StartUpdateOverlay=function(){this.IsUpdateOverlayOnlyEnd=true};this.EndUpdateOverlay=function(){if(this.IsUpdateOverlayOnlyEndReturn)return;this.IsUpdateOverlayOnlyEnd=false;if(this.IsUpdateOverlayOnEndCheck)this.OnUpdateOverlay();this.IsUpdateOverlayOnEndCheck=false};this.OnUpdateOverlay= function(){if(this.IsUpdateOverlayOnlyEnd){this.IsUpdateOverlayOnEndCheck=true;return false}this.m_oApi.checkLastWork();var overlay=this.m_oOverlayApi;overlay.Clear();var ctx=overlay.m_oContext;var drDoc=this.m_oDrawingDocument;drDoc.SelectionMatrix=null;if(drDoc.m_lDrawingFirst<0||drDoc.m_lDrawingEnd<0)return true;if(drDoc.m_bIsSearching){ctx.fillStyle="rgba(255,200,0,1)";ctx.beginPath();var drDoc=this.m_oDrawingDocument;for(var i=drDoc.m_lDrawingFirst;i<=drDoc.m_lDrawingEnd;i++){var drawPage=drDoc.m_arrPages[i].drawingPage; drDoc.m_arrPages[i].pageIndex=i;drDoc.m_arrPages[i].DrawSearch(overlay,drawPage.left,drawPage.top,drawPage.right-drawPage.left,drawPage.bottom-drawPage.top,drDoc)}ctx.globalAlpha=.5;ctx.fill();ctx.beginPath();ctx.globalAlpha=1}if(null==drDoc.m_oDocumentRenderer){if(drDoc.m_bIsSelection){this.CheckShowOverlay();drDoc.private_StartDrawSelection(overlay);if(!this.MobileTouchManager)for(var i=drDoc.m_lDrawingFirst;i<=drDoc.m_lDrawingEnd;i++){if(!drDoc.IsFreezePage(i))this.m_oLogicDocument.DrawSelectionOnPage(i)}else for(var i= 0;i<=drDoc.m_lPagesCount;i++)if(!drDoc.IsFreezePage(i))this.m_oLogicDocument.DrawSelectionOnPage(i);drDoc.private_EndDrawSelection();drDoc.DrawPageSelection2(overlay);if(this.MobileTouchManager)this.MobileTouchManager.CheckSelect(overlay)}if(this.MobileTouchManager)this.MobileTouchManager.CheckTableRules(overlay);ctx.globalAlpha=1;if(this.m_oLogicDocument.DrawingObjects){for(var indP=drDoc.m_lDrawingFirst;indP<=drDoc.m_lDrawingEnd;indP++){this.m_oDrawingDocument.AutoShapesTrack.PageIndex=indP;this.m_oLogicDocument.DrawingObjects.drawSelect(indP)}if(this.m_oLogicDocument.DrawingObjects.needUpdateOverlay()){overlay.Show(); this.m_oDrawingDocument.AutoShapesTrack.PageIndex=-1;this.m_oLogicDocument.DrawingObjects.drawOnOverlay(this.m_oDrawingDocument.AutoShapesTrack);this.m_oDrawingDocument.AutoShapesTrack.CorrectOverlayBounds()}}var _table_outline=drDoc.TableOutlineDr.TableOutline;if(_table_outline!=null&&!this.MobileTouchManager){var _page=_table_outline.PageNum;if(_page>=drDoc.m_lDrawingFirst&&_page<=drDoc.m_lDrawingEnd){var drawPage=drDoc.m_arrPages[_page].drawingPage;drDoc.m_arrPages[_page].DrawTableOutline(overlay, drawPage.left,drawPage.top,drawPage.right-drawPage.left,drawPage.bottom-drawPage.top,drDoc.TableOutlineDr)}if(true){var _lastBounds=drDoc.TableOutlineDr.getLastPageBounds();_page=_lastBounds.Page;if(_page>=drDoc.m_lDrawingFirst&&_page<=drDoc.m_lDrawingEnd){var drawPage=drDoc.m_arrPages[_page].drawingPage;drDoc.m_arrPages[_page].DrawTableOutline(overlay,drawPage.left,drawPage.top,drawPage.right-drawPage.left,drawPage.bottom-drawPage.top,drDoc.TableOutlineDr,_lastBounds)}}}drDoc.contentControls&&drDoc.contentControls.DrawContentControlsTrack(overlay); if(drDoc.placeholders.objects.length>0)for(var indP=drDoc.m_lDrawingFirst;indP<=drDoc.m_lDrawingEnd;indP++){var _page=drDoc.m_arrPages[indP];drDoc.placeholders.draw(overlay,indP,_page.drawingPage,_page.width_mm,_page.height_mm)}if(drDoc.TableOutlineDr.bIsTracked)drDoc.DrawTableTrack(overlay);if(drDoc.FrameRect.IsActive)drDoc.DrawFrameTrack(overlay);if(drDoc.MathTrack.IsActive())drDoc.DrawMathTrack(overlay);if(drDoc.FieldTrack.IsActive)drDoc.DrawFieldTrack(overlay);if(drDoc.InlineTextTrackEnabled&& null!=drDoc.InlineTextTrack){var _oldPage=drDoc.AutoShapesTrack.PageIndex;var _oldCurPageInfo=drDoc.AutoShapesTrack.CurrentPageInfo;drDoc.AutoShapesTrack.PageIndex=drDoc.InlineTextTrackPage;drDoc.AutoShapesTrack.DrawInlineMoveCursor(drDoc.InlineTextTrack.X,drDoc.InlineTextTrack.Y,drDoc.InlineTextTrack.Height,drDoc.InlineTextTrack.transform);drDoc.AutoShapesTrack.PageIndex=_oldPage;drDoc.AutoShapesTrack.CurrentPageInfo=_oldCurPageInfo}if(this.m_oApi.isDrawTablePen||this.m_oApi.isDrawTableErase){var logicObj= this.m_oLogicDocument.DrawTableMode;if(logicObj.Start){var drObject=null;if(logicObj.Table)drObject=logicObj.Table.GetDrawLine(logicObj.StartX,logicObj.StartY,logicObj.EndX,logicObj.EndY,logicObj.TablePageStart,logicObj.TablePageEnd,this.m_oApi.isDrawTablePen);drDoc.DrawCustomTableMode(overlay,drObject,logicObj,this.m_oApi.isDrawTablePen)}}drDoc.DrawHorVerAnchor()}else{ctx.globalAlpha=.2;if(drDoc.m_oDocumentRenderer.SearchResults.IsSearch){this.m_oOverlayApi.Show();if(drDoc.m_oDocumentRenderer.SearchResults.Show){ctx.globalAlpha= .5;ctx.fillStyle="rgba(255,200,0,1)";ctx.beginPath();for(var i=drDoc.m_lDrawingFirst;i<=drDoc.m_lDrawingEnd;i++){var _searching=drDoc.m_oDocumentRenderer.SearchResults.Pages[i];if(0!=_searching.length){var drawPage=drDoc.m_arrPages[i].drawingPage;drDoc.m_arrPages[i].DrawSearch2(overlay,drawPage.left,drawPage.top,drawPage.right-drawPage.left,drawPage.bottom-drawPage.top,_searching)}}ctx.fill();ctx.globalAlpha=.2}ctx.beginPath();if(drDoc.CurrentSearchNavi&&drDoc.m_oDocumentRenderer.SearchResults.Show){var _pageNum= drDoc.CurrentSearchNavi[0].PageNum;ctx.fillStyle="rgba(51,102,204,255)";if(_pageNum>=drDoc.m_lDrawingFirst&&_pageNum<=drDoc.m_lDrawingEnd){var drawPage=drDoc.m_arrPages[_pageNum].drawingPage;drDoc.m_arrPages[_pageNum].DrawSearchCur(overlay,drawPage.left,drawPage.top,drawPage.right-drawPage.left,drawPage.bottom-drawPage.top,drDoc.CurrentSearchNavi)}}}ctx.fillStyle="rgba(51,102,204,255)";ctx.beginPath();for(var i=drDoc.m_lDrawingFirst;i<=drDoc.m_lDrawingEnd;i++){var drawPage=drDoc.m_arrPages[i].drawingPage; drDoc.m_oDocumentRenderer.DrawSelection(i,overlay,drawPage.left,drawPage.top,drawPage.right-drawPage.left,drawPage.bottom-drawPage.top)}ctx.fill();ctx.beginPath();ctx.globalAlpha=1}return true};this.OnUpdateSelection=function(){if(this.m_oDrawingDocument.m_bIsSelection){this.m_oOverlayApi.Clear();this.m_oOverlayApi.m_oContext.beginPath();this.m_oOverlayApi.m_oContext.fillStyle="rgba(51,102,204,255)"}for(var i=0;ithis.m_oDrawingDocument.m_lDrawingEnd)continue;var drawPage=this.m_oDrawingDocument.m_arrPages[i].drawingPage;if(this.m_oDrawingDocument.m_bIsSelection)this.m_oDrawingDocument.m_arrPages[i].DrawSelection(this.m_oOverlayApi,drawPage.left,drawPage.top,drawPage.right-drawPage.left,drawPage.bottom-drawPage.top)}if(this.m_oDrawingDocument.m_bIsSelection){this.m_oOverlayApi.m_oContext.globalAlpha=.2;this.m_oOverlayApi.m_oContext.fill();this.m_oOverlayApi.m_oContext.globalAlpha=1;this.m_oOverlayApi.m_oContext.beginPath()}}; this.OnCalculatePagesPlace=function(){if(this.MobileTouchManager&&!this.MobileTouchManager.IsWorkedPosition())this.MobileTouchManager.ClearContextMenu();var canvas=this.m_oEditor.HtmlElement;if(null==canvas)return;var _width=canvas.width;var _height=canvas.height;_width=AscCommon.AscBrowser.convertToRetinaValue(_width);_height=AscCommon.AscBrowser.convertToRetinaValue(_height);var bIsFoundFirst=false;var bIsFoundEnd=false;var hor_pos_median=parseInt(_width/2);if(0!=this.m_dScrollX||this.m_dDocumentWidth> _width)hor_pos_median=parseInt(this.m_dDocumentWidth/2-this.m_dScrollX);var lCurrentTopInDoc=parseInt(this.m_dScrollY);var dKoef=this.m_nZoomValue*g_dKoef_mm_to_pix/100;var lStart=0;for(var i=0;i>0;var _pageHeight=this.m_oDrawingDocument.m_arrPages[i].height_mm*dKoef+.5>>0;if(false===bIsFoundFirst)if(lStart+20+_pageHeight>lCurrentTopInDoc){this.m_oDrawingDocument.m_lDrawingFirst=i;bIsFoundFirst= true}var xDst=hor_pos_median-parseInt(_pageWidth/2);var wDst=_pageWidth;var yDst=lStart+20-lCurrentTopInDoc;var hDst=_pageHeight;if(false===bIsFoundEnd)if(yDst>_height){this.m_oDrawingDocument.m_lDrawingEnd=i-1;bIsFoundEnd=true}var drawRect=this.m_oDrawingDocument.m_arrPages[i].drawingPage;drawRect.left=xDst;drawRect.top=yDst;drawRect.right=xDst+wDst;drawRect.bottom=yDst+hDst;drawRect.pageIndex=i;lStart+=20+_pageHeight}if(false===bIsFoundEnd)this.m_oDrawingDocument.m_lDrawingEnd=this.m_oDrawingDocument.m_lPagesCount- 1;if(-1==this.m_oDrawingDocument.m_lPagesCount&&0!=this.m_oDrawingDocument.m_lPagesCount){this.m_oDrawingDocument.m_lCurrentPage=0;this.SetCurrentPage()}if((this.m_oApi.isMobileVersion||this.m_oApi.isViewMode)&&!window["NATIVE_EDITOR_ENJINE"]){var lPage=this.m_oApi.GetCurrentVisiblePage();this.m_oApi.sendEvent("asc_onCurrentVisiblePage",this.m_oApi.GetCurrentVisiblePage());if(null!=this.m_oDrawingDocument.m_oDocumentRenderer){this.m_oDrawingDocument.m_lCurrentPage=lPage;this.m_oApi.sendEvent("asc_onCurrentPage", lPage)}}if(this.m_bDocumentPlaceChangedEnabled)this.m_oApi.sendEvent("asc_onDocumentPlaceChanged")};this.OnPaint=function(){var isNoPaint=this.m_oApi.isLongAction();if(isNoPaint&&this.m_oDrawingDocument&&this.m_oDrawingDocument.isDisableEditBeforeCalculateLA)isNoPaint=false;if(isNoPaint)return;if(this.DrawingFreeze||true===window["DisableVisibleComponents"]){this.m_oApi.checkLastWork();return}var canvas=this.m_oEditor.HtmlElement;if(null==canvas){this.m_oApi.checkLastWork();return}var context=canvas.getContext("2d"); context.fillStyle=GlobalSkin.BackgroundColor;if(AscCommon.AscBrowser.isSailfish)context.fillRect(0,0,canvas.width,canvas.height);else if(true===canvas.fullRepaint){context.fillRect(0,0,canvas.width,canvas.height);delete canvas.fullRepaint}if(this.m_oDrawingDocument.m_lDrawingFirst<0||this.m_oDrawingDocument.m_lDrawingEnd<0)return;var rectsPages=[];for(var i=this.m_oDrawingDocument.m_lDrawingFirst;i<=this.m_oDrawingDocument.m_lDrawingEnd;i++){var drawPage=this.m_oDrawingDocument.m_arrPages[i].drawingPage; var _cur_page_rect=new AscCommon._rect;_cur_page_rect.x=drawPage.left*AscCommon.AscBrowser.retinaPixelRatio>>0;_cur_page_rect.y=drawPage.top*AscCommon.AscBrowser.retinaPixelRatio>>0;_cur_page_rect.w=(drawPage.right*AscCommon.AscBrowser.retinaPixelRatio>>0)-_cur_page_rect.x;_cur_page_rect.h=(drawPage.bottom*AscCommon.AscBrowser.retinaPixelRatio>>0)-_cur_page_rect.y;rectsPages.push(_cur_page_rect)}this.m_oBoundsController.CheckPageRects(rectsPages,context);if(this.m_oDrawingDocument.m_bIsSelection){this.m_oOverlayApi.Clear(); this.m_oOverlayApi.m_oContext.beginPath();this.m_oOverlayApi.m_oContext.fillStyle="rgba(51,102,204,255)";this.m_oOverlayApi.m_oContext.globalAlpha=.2}if(this.NoneRepaintPages){this.m_bIsFullRepaint=false;for(var i=this.m_oDrawingDocument.m_lDrawingFirst;i<=this.m_oDrawingDocument.m_lDrawingEnd;i++){var drawPage=this.m_oDrawingDocument.m_arrPages[i].drawingPage;if(!AscCommon.AscBrowser.isCustomScaling())this.m_oDrawingDocument.m_arrPages[i].Draw(context,drawPage.left,drawPage.top,drawPage.right-drawPage.left, drawPage.bottom-drawPage.top);else{var __x=drawPage.left*AscCommon.AscBrowser.retinaPixelRatio>>0;var __y=drawPage.top*AscCommon.AscBrowser.retinaPixelRatio>>0;var __w=(drawPage.right*AscCommon.AscBrowser.retinaPixelRatio>>0)-__x;var __h=(drawPage.bottom*AscCommon.AscBrowser.retinaPixelRatio>>0)-__y;this.m_oDrawingDocument.m_arrPages[i].Draw(context,__x,__y,__w,__h)}}}else{for(var i=0;i750){_c.m_nCurrentTimeClearCache=0;_c.m_oDrawingDocument.CheckFontCache()}oThis.m_oLogicDocument.ContinueCheckSpelling();oThis.m_oLogicDocument.ContinueTrackRevisions()};this.OnScroll=function(){this.OnCalculatePagesPlace();this.m_bIsScroll=true};this.CheckZoom=function(){if(!this.NoneRepaintPages)this.m_oDrawingDocument.ClearCachePages()}; this.ChangeHintProps=function(){var bFlag=false;if(global_keyboardEvent.CtrlKey)if(null!=this.m_oLogicDocument)if(49==global_keyboardEvent.KeyCode){AscCommon.g_fontManager.SetHintsProps(false,false);bFlag=true}else if(50==global_keyboardEvent.KeyCode){AscCommon.g_fontManager.SetHintsProps(true,false);bFlag=true}else if(51==global_keyboardEvent.KeyCode){AscCommon.g_fontManager.SetHintsProps(true,true);bFlag=true}if(bFlag){this.m_oDrawingDocument.ClearCachePages();if(AscCommon.g_fontManager2)AscCommon.g_fontManager2.ClearFontsRasterCache()}return bFlag}; this.CalculateDocumentSize=function(){this.m_dDocumentWidth=0;this.m_dDocumentHeight=0;this.m_dDocumentPageWidth=0;this.m_dDocumentPageHeight=0;var dKoef=this.m_nZoomValue*g_dKoef_mm_to_pix/100;for(var i=0;ithis.m_dDocumentPageWidth)this.m_dDocumentPageWidth=mm_w;if(mm_h>this.m_dDocumentPageHeight)this.m_dDocumentPageHeight=mm_h;var _pageWidth= mm_w*dKoef>>0;var _pageHeight=mm_h*dKoef+.5>>0;if(_pageWidth>this.m_dDocumentWidth)this.m_dDocumentWidth=_pageWidth;this.m_dDocumentHeight+=20;this.m_dDocumentHeight+=_pageHeight}this.m_dDocumentHeight+=20;if(!this.m_oApi.isMobileVersion)this.m_dDocumentWidth+=40;if(1==this.m_nZoomType)if(true===this.zoom_FitToWidth())return;if(2==this.m_nZoomType)if(true===this.zoom_FitToPage())return;this.checkNeedHorScroll();this.UpdateScrolls();if(this.MobileTouchManager)this.MobileTouchManager.Resize();if(this.ReaderTouchManager)this.ReaderTouchManager.Resize(); if(this.m_bIsRePaintOnScroll===true)this.OnScroll()};this.InitDocument=function(bIsEmpty){this.m_oDrawingDocument.m_oWordControl=this;this.m_oDrawingDocument.m_oLogicDocument=this.m_oLogicDocument;if(false===bIsEmpty)this.m_oLogicDocument.LoadTestDocument();this.CalculateDocumentSize();this.StartMainTimer();this.m_oHorRuler.CreateBackground(this.m_oDrawingDocument.m_arrPages[0]);this.m_oVerRuler.CreateBackground(this.m_oDrawingDocument.m_arrPages[0]);this.UpdateHorRuler();this.UpdateVerRuler()};this.InitControl= function(){if(this.IsInitControl)return;this.CalculateDocumentSize();if(window["AscDesktopEditor"]&&this.m_oDrawingDocument.m_oDocumentRenderer){var _new_value=this.calculate_zoom_FitToWidth();if(_new_value>0)*10-1;for(var _test_param=10;_test_param=oThis.RequestAnimationOldTime+40||now=drDoc.m_lPagesCount)return;var dKoef=g_dKoef_mm_to_pix*this.m_nZoomValue/100;var lYPos=0;for(var i=0;ithis.m_oEditor.HtmlElement.height+10){var y=lYPos*this.m_dScrollY_max/(this.m_dDocumentHeight-this.m_oEditor.HtmlElement.height);this.m_oScrollVerApi.scrollTo(0,y+1)}if(this.m_oApi.isViewMode===false&&null!=this.m_oLogicDocument){if(false===drDoc.IsFreezePage(drDoc.m_lCurrentPage)){this.m_oLogicDocument.SetDocPosType(docpostype_Content);this.m_oLogicDocument.Set_CurPage(drDoc.m_lCurrentPage);this.m_oLogicDocument.MoveCursorToXY(0,0,false); this.m_oLogicDocument.RecalculateCurPos();this.m_oLogicDocument.Document_UpdateSelectionState();this.m_oApi.sync_currentPageCallback(drDoc.m_lCurrentPage)}}else this.m_oApi.sync_currentPageCallback(drDoc.m_lCurrentPage)};this.GetVerticalScrollTo=function(y,page){var dKoef=g_dKoef_mm_to_pix*this.m_nZoomValue/100;var lYPos=0;for(var i=0;i>0;lYPos+=y*dKoef;return lYPos};this.GetHorizontalScrollTo=function(x,page){var dKoef= g_dKoef_mm_to_pix*this.m_nZoomValue/100;return 5+dKoef*x};this.GetMainContentBounds=function(){return this.m_oMainContent.AbsolutePosition}}var _message_update="zero_delay_update";window["AscCommon"]=window["AscCommon"]||{};window["AscCommonWord"]=window["AscCommonWord"]||{};window["AscCommonWord"].CEditorPage=CEditorPage;window["AscCommon"].Page_Width=Page_Width;window["AscCommon"].Page_Height=Page_Height;window["AscCommon"].X_Left_Margin=X_Left_Margin;window["AscCommon"].X_Right_Margin=X_Right_Margin; window["AscCommon"].Y_Bottom_Margin=Y_Bottom_Margin;window["AscCommon"].Y_Top_Margin=Y_Top_Margin;"use strict";var g_memory=AscFonts.g_memory;var DecodeBase64Char=AscFonts.DecodeBase64Char;var b64_decode=AscFonts.b64_decode;function CPageMeta(){this.width_mm=0;this.height_mm=0;this.start=0;this.end=0}function CStream(data,size){this.obj=null;this.data=data;this.size=size;this.pos=0;this.cur=0;this.Seek=function(_pos){if(_pos>this.size)return 1;this.pos=_pos;return 0};this.Skip=function(_skip){if(_skip< 0)return 1;return this.Seek(this.pos+_skip)};this.GetUChar=function(){if(this.pos>=this.size)return 0;return this.data[this.pos++]};this.GetChar=function(){if(this.pos>=this.size)return 0;var m=this.data[this.pos++];if(m>127)m-=256;return m};this.GetString=function(len){len*=2;if(this.pos+len>this.size)return"";var t="";for(var i=0;ithis.size)return"";var t="";for(var i=0;i=this.size)return 0;return this.data[this.pos++]|this.data[this.pos++]<<8};this.GetShort=function(){if(this.pos+1>=this.size)return 0;var _c=this.data[this.pos++]|this.data[this.pos++]<<8;if(_c>32767)return _c-65536;return _c};this.GetULong=function(){if(this.pos+3>=this.size)return 0;var s=this.data[this.pos++]| this.data[this.pos++]<<8|this.data[this.pos++]<<16|this.data[this.pos++]<<24;if(s<0)s+=4294967295+1;return s};this.GetLong=function(){return this.data[this.pos++]|this.data[this.pos++]<<8|this.data[this.pos++]<<16|this.data[this.pos++]<<24};this.GetDouble=function(){return this.GetLong()/1E4};this.GetDouble2=function(){return this.GetShort()/100};this.SkipImage=function(){var _type=this.GetUChar();switch(_type){case 2:{this.Skip(4);break}case 3:{var _lenA=this.GetULong();this.Skip(_lenA);break}case 10:case 11:{this.Skip(44); break}default:{this.Skip(20);break}}}}function CreateDocumentData(szSrc){var isBase64=false;if(typeof szSrc=="string"||szSrc instanceof String)isBase64=true;var stream=null;if(!isBase64){stream=new CStream(szSrc,szSrc.length);return stream}var srcLen=szSrc.length;var nWritten=0;var index=0;var dst_len="";while(true){var _c=szSrc.charCodeAt(index);if(_c==";".charCodeAt(0))break;dst_len+=String.fromCharCode(_c);index++}index++;var dstLen=parseInt(dst_len);if(0==dstLen)return null;var pointer=g_memory.Alloc(dstLen); stream=new CStream(pointer.data,dstLen);stream.obj=pointer.obj;var dstPx=stream.data;if(window.chrome)while(index=srcLen)break;var nCh=DecodeBase64Char(szSrc.charCodeAt(index++));if(nCh==-1){i--;continue}dwCurr<<=6;dwCurr|=nCh;nBits+=6}dwCurr<<=24-nBits;for(i=0;i>>16;dwCurr<<=8}}else{var p=b64_decode;while(index=srcLen)break; var nCh=p[szSrc.charCodeAt(index++)];if(nCh==undefined){i--;continue}dwCurr<<=6;dwCurr|=nCh;nBits+=6}dwCurr<<=24-nBits;for(i=0;i>>16;dwCurr<<=8}}}return stream}function CDrawingObject(metaDoc){this.Page=-1;this.StreamPos=-1;this.BreakDrawing=0;this.Graphics=null;this.fontId=-1;this.fontSize=-1;this.tm_sx=0;this.tm_sy=0;this.tm_shx=0;this.tm_shy=0;this.LastTimeDrawing=-1;this.MetaDoc=metaDoc}CDrawingObject.prototype={CheckOnScroll:function(){if(-1== this.LastTimeDrawing){this.LastTimeDrawing=(new Date).getTime();return false}var newTime=(new Date).getTime();if(newTime-this.LastTimeDrawing>3E3){this.LastTimeDrawing=newTime;return true}}};function CDocMetaSelection(){this.Page1=0;this.Line1=0;this.Glyph1=0;this.Page2=0;this.Line2=0;this.Glyph2=0;this.IsSelection=false}function CSpan(){this.fontName=0;this.fontSize=0;this.colorR=0;this.colorG=0;this.colorB=0;this.inner="";this.CreateDublicate=function(){var ret=new CSpan;ret.fontName=this.fontName; ret.fontSize=this.fontSize;ret.colorR=this.colorR;ret.colorG=this.colorG;ret.colorB=this.colorB;ret.inner=this.inner;return ret}}function CLineInfo(){this.X=0;this.Y=0;this.W=0;this.H=0;this.Ex=1;this.Ey=0;this.text=""}function CDocMeta(){this.Fonts=[];this.ImageMap={};this.Pages=null;this.PagesCount=0;this.LockObject=null;this.stream=null;this.CountParagraphs=0;this.CountWords=0;this.CountSymbols=0;this.CountSpaces=0;this.Drawings=[];this.Selection=new CDocMetaSelection;this.TextMatrix=new AscCommon.CMatrix; this.SearchInfo={Id:null,Page:0,Text:null};this.SearchResults={IsSearch:false,Text:"",MachingCase:false,Pages:[],CurrentPage:-1,Current:-1,Show:false,Count:0};this.pagestreams=[];this.waitSelectAll=false;this.CachedImagesCount=5;this.CachedImages=[]}CDocMeta.prototype={Init:function(){if(!window["AscDesktopEditor"]||!window["AscDesktopEditor"]["IsNativeViewer"]||!window["AscDesktopEditor"]["IsNativeViewer"]())return;CDocMeta.prototype.Load=function(url,doc_bin_base64){var stream=CreateDocumentData(doc_bin_base64); this.PagesCount=stream.GetLong();this.Pages=new Array(this.PagesCount);this.CountParagraphs=0;this.CountWords=0;this.CountSymbols=0;this.CountSpaces=0;for(var i=0;i=_drDoc.m_lDrawingFirst&&_page<=_drDoc.m_lDrawingEnd){_drDoc.StopRenderingPage(_page);editor.WordControl.OnScroll()}}for(var i=0;i<_countTextTasks;++i){var _stream=CreateDocumentData(_ret[_current++]);var _page=_ret[_current++];this.pagestreams[_page]=_stream;this.Pages[_page].end=this.pagestreams[_page]?this.pagestreams[_page].size:0;this.CountParagraphs=_ret[_current++];this.CountWords=_ret[_current++]; this.CountSpaces=_ret[_current++];this.CountSymbols=_ret[_current++];if(_page==this.PagesCount-1)this.selectAllCheckEnd()}};CDocMeta.prototype.getStreamPage=function(pageNum){return this.pagestreams[pageNum]?this.pagestreams[pageNum]:new CStream(null,0)};CDocMeta.prototype.OnImageLoad=function(obj){if(obj.BreakDrawing==1)return;var page=this.Pages[obj.Page];var g=obj.Graphics;g.SetIntegerGrid(true);var _url=window["AscDesktopEditor"]["NativeViewerGetPageUrl"](obj.Page,g.m_lWidthPix,g.m_lHeightPix, editor.WordControl.m_oDrawingDocument.m_lDrawingFirst,editor.WordControl.m_oDrawingDocument.m_lDrawingEnd);if(_url=="")return;var img=new Image;img.onload=function(){if(1!=obj.BreakDrawing){var _ctx=g.m_oContext;_ctx.drawImage(img,0,0,img.width,img.height)}obj.MetaDoc.stopRenderingPage(obj.Page);editor.WordControl.OnScroll()};img.onerror=function(){obj.MetaDoc.stopRenderingPage(obj.Page)};img.src="ascdesktop://fonts/"+_url};CDocMeta.prototype.selectAllCheckStart=function(){if(this.pagestreams[this.PagesCount- 1]!==undefined){this.waitSelectAll=false;return true}this.waitSelectAll=true;editor.sync_StartAction(window["Asc"].c_oAscAsyncActionType.BlockInteraction,window["Asc"].c_oAscAsyncAction.SlowOperation)};CDocMeta.prototype.selectAllCheckEnd=function(){if(this.waitSelectAll){this.waitSelectAll=false;editor.sync_EndAction(window["Asc"].c_oAscAsyncActionType.BlockInteraction,window["Asc"].c_oAscAsyncAction.SlowOperation);this.selectAll()}}},Load:function(url,doc_bin_base64){var stream=CreateDocumentData(doc_bin_base64); this.PagesCount=stream.GetLong();this.Pages=new Array(this.PagesCount);this.CountParagraphs=stream.GetLong();this.CountWords=stream.GetLong();this.CountSymbols=stream.GetLong();this.CountSpaces=stream.GetLong();var fontsCount=stream.GetLong();for(var i=0;i255)g.df();if((type&255)!=0)g.ds();break}case 110:{var _type=s.GetUChar();if(2==_type){var _src=AscCommon.g_oDocumentUrls.getImageUrl("image"+s.GetLong()+".svg");obj.StreamPos=s.pos;_cachedImage= this.GetCachedImage(_src);if(null!=_cachedImage){try{g.drawImage2(_cachedImage,0,0,page.width_mm,page.height_mm)}catch(err){}break}else{var img=new Image;img.onload=function(){obj.MetaDoc.SetCachedImage(_src,img);if(1!=obj.BreakDrawing)try{g.drawImage2(img,0,0,page.width_mm,page.height_mm)}catch(err$4){}obj.MetaDoc.OnImageLoad(obj)};img.onerror=function(){obj.MetaDoc.OnImageLoad(obj)};img.src=_src;return}}else if(3==_type){var _lenA=s.GetULong();var _src="data:image/svg+xml;base64,"+s.GetStringA(_lenA); obj.StreamPos=s.pos;_cachedImage=this.GetCachedImage(_src);if(null!=_cachedImage){try{g.drawImage2(_cachedImage,0,0,page.width_mm,page.height_mm)}catch(err$5){}break}else{var img=new Image;img.onload=function(){obj.MetaDoc.SetCachedImage(_src,img);if(1!=obj.BreakDrawing)try{g.drawImage2(img,0,0,page.width_mm,page.height_mm)}catch(err$6){}obj.MetaDoc.OnImageLoad(obj)};img.onerror=function(){obj.MetaDoc.OnImageLoad(obj)};img.src=_src;return}}var _src=0==_type||10==_type?AscCommon.g_oDocumentUrls.getImageUrl("image"+ s.GetLong()+".jpg"):AscCommon.g_oDocumentUrls.getImageUrl("image"+s.GetLong()+".png");var __x=s.GetDouble();var __y=s.GetDouble();var __w=s.GetDouble();var __h=s.GetDouble();var _tr=null;if(10==_type||11==_type){_tr=new AscCommon.CMatrix;_tr.sx=s.GetDouble();_tr.shy=s.GetDouble();_tr.shx=s.GetDouble();_tr.sy=s.GetDouble();_tr.tx=s.GetDouble();_tr.ty=s.GetDouble()}obj.StreamPos=s.pos;_cachedImage=this.GetCachedImage(_src);if(null!=_cachedImage){if(1!=obj.BreakDrawing){var _ctx=g.m_oContext;if(_tr){var _dX= g.m_oCoordTransform.sx;var _dY=g.m_oCoordTransform.sy;_ctx.save();_ctx.setTransform(_tr.sx*_dX,_tr.shy*_dY,_tr.shx*_dX,_tr.sy*_dY,_tr.tx*_dX,_tr.ty*_dY)}try{g.drawImage2(_cachedImage,__x,__y,__w,__h)}catch(err$7){}if(_tr)_ctx.restore()}break}else{var img=new Image;img.onload=function(){obj.MetaDoc.SetCachedImage(_src,img);if(1!=obj.BreakDrawing){var _ctx=g.m_oContext;if(_tr){var _dX=g.m_oCoordTransform.sx;var _dY=g.m_oCoordTransform.sy;_ctx.save();_ctx.setTransform(_tr.sx*_dX,_tr.shy*_dY,_tr.shx* _dX,_tr.sy*_dY,_tr.tx*_dX,_tr.ty*_dY)}try{g.drawImage2(img,__x,__y,__w,__h)}catch(err$8){}if(_tr)_ctx.restore()}obj.MetaDoc.OnImageLoad(obj)};img.onerror=function(){obj.MetaDoc.OnImageLoad(obj)};img.src=_src;return}break}case 160:{_linePrevCharX=0;_lineCharCount=0;var mask=s.GetUChar();_lineX=s.GetDouble();_lineY=s.GetDouble();if((mask&1)!=0){_lineEx=1;_lineEy=0}else{_lineEx=s.GetDouble();_lineEy=s.GetDouble()}_lineAscent=s.GetDouble();_lineDescent=s.GetDouble();if((mask&4)!=0)_lineWidth=s.GetDouble(); if((mask&2)!=0)_lineGidExist=true;else _lineGidExist=false;break}case 162:{break}case 161:{g.transform(s.GetDouble(),s.GetDouble(),s.GetDouble(),s.GetDouble(),0,0);break}case 163:{g.TextClipRect=null;break}case 164:{g.SetTextClipRect(s.GetDouble(),s.GetDouble(),s.GetDouble(),s.GetDouble());break}case 121:{var _command_type=s.GetLong();if(32==_command_type){if(!g.IsClipContext)g.m_oContext.save();g.IsClipContext=true}else if(64==_command_type&&g.IsClipContext){g.m_oContext.restore();g.IsClipContext= false}break}case 122:{var _command_type=s.GetLong();if(32==_command_type)g.m_oContext.clip();else if(33==_command_type){var mode=s.GetLong();g.m_oContext.clip(0===mode?"nonzero":"evenodd")}break}default:{s.pos=page.end}}}this.stopRenderingPage(obj.Page);if(editor.watermarkDraw){g.m_oContext.setTransform(1,0,0,1,0,0);editor.watermarkDraw.Draw(g.m_oContext,g.m_oContext.canvas.width,g.m_oContext.canvas.height)}if(bIsFromPaint==0)editor.WordControl.OnScroll()},GetNearestPos:function(pageNum,x,y){var page= this.Pages[pageNum];var s=this.getStreamPage(pageNum);s.Seek(page.start);var _line=-1;var _glyph=-1;var _minDist=16777215;var _lineX=0;var _lineY=0;var _lineEx=0;var _lineEy=0;var _lineAscent=0;var _lineDescent=0;var _lineWidth=0;var _lineGidExist=false;var _linePrevCharX=0;var _lineCharCount=0;var _lineLastGlyphWidth=0;var _arrayGlyphOffsets=[];var _numLine=-1;var _lenGls=0;var tmp=0;while(s.pos=_lineY-_lineAscent&&y<=_lineY+_lineDescent&&_distX>=0&&_distX<=_lineWidth){_line=_numLine;_lenGls=_arrayGlyphOffsets.length;for(_glyph=0;_glyph<_lenGls;_glyph++)if(_arrayGlyphOffsets[_glyph]>_distX)break;if(_glyph>0)--_glyph;return{Line:_line,Glyph:_glyph}}if(_distX>=0&&_distX<=_lineWidth)tmp=Math.abs(y-_lineY);else if(_distX<0)tmp=Math.sqrt((x-_lineX)*(x-_lineX)+(y-_lineY)*(y-_lineY));else{var _xx1=_lineX+_lineWidth;tmp=Math.sqrt((x-_xx1)*(x-_xx1)+(y-_lineY)*(y-_lineY))}if(tmp< _minDist){_minDist=tmp;_line=_numLine;if(_distX<0)_glyph=-2;else if(_distX>_lineWidth)_glyph=-1;else{_lenGls=_arrayGlyphOffsets.length;for(_glyph=0;_glyph<_lenGls;_glyph++)if(_arrayGlyphOffsets[_glyph]>_distX)break;if(_glyph>0)_glyph--}}}else{var ortX=-_lineEy;var ortY=_lineEx;var _dx=_lineX+ortX*_lineDescent;var _dy=_lineY+ortY*_lineDescent;var h=-((x-_dx)*ortX+(y-_dy)*ortY);var w=(x-_dx)*_lineEx+(y-_dy)*_lineEy;if(w>=0&&w<=_lineWidth&&h>=0&&h<=_lineDescent+_lineAscent){_line=_numLine;_lenGls=_arrayGlyphOffsets.length; for(_glyph=0;_glyph<_lenGls;_glyph++)if(_arrayGlyphOffsets[_glyph]>w)break;if(_glyph>0)_glyph--;return{Line:_line,Glyph:_glyph}}if(w>=0&&w<=_lineWidth)tmp=Math.abs(h-_lineDescent);else if(w<0)tmp=Math.sqrt((x-_lineX)*(x-_lineX)+(y-_lineY)*(y-_lineY));else{var _tmpX=_lineX+_lineWidth*_lineEx;var _tmpY=_lineY+_lineWidth*_lineEy;tmp=Math.sqrt((x-_tmpX)*(x-_tmpX)+(y-_tmpY)*(y-_tmpY))}if(tmp<_minDist){_minDist=tmp;_line=_numLine;if(w<0)_glyph=-2;else if(w>_lineWidth)_glyph=-1;else{_lenGls=_arrayGlyphOffsets.length; for(_glyph=0;_glyph<_lenGls;_glyph++)if(_arrayGlyphOffsets[_glyph]>w)break;if(_glyph>0)_glyph--}}}break}case 161:{s.Skip(16);break}case 163:{break}case 164:{s.Skip(16);break}case 121:case 122:{var _command_type=s.GetLong();if(33==_command_type)s.Skip(4);break}default:{s.pos=page.end}}}return{Line:_line,Glyph:_glyph}},GetCountLines:function(pageNum){var page=this.Pages[pageNum];var s=this.getStreamPage(pageNum);s.Seek(page.start);var _lineGidExist=false;var _lineCharCount=0;var _numLine=-1;while(s.pos< page.end){var command=s.GetUChar();switch(command){case 41:{s.Skip(12);break}case 22:{s.Skip(4);break}case 1:{s.Skip(4);break}case 3:{s.Skip(4);break}case 131:{break}case 130:{s.Skip(24);break}case 80:{if(0!=_lineCharCount)s.Skip(2);_lineCharCount++;if(_lineGidExist)s.Skip(4);else s.Skip(2);s.Skip(2);break}case 98:case 100:{break}case 91:{s.Skip(8);break}case 92:{s.Skip(8);break}case 94:{s.Skip(24);break}case 97:{break}case 99:{s.Skip(4);break}case 110:{s.SkipImage();break}case 160:{_lineCharCount= 0;++_numLine;var mask=s.GetUChar();s.Skip(8);if((mask&1)==0)s.Skip(8);s.Skip(8);if((mask&4)!=0)s.Skip(4);if((mask&2)!=0)_lineGidExist=true;else _lineGidExist=false;break}case 162:{break}case 161:{s.Skip(16);break}case 163:{break}case 164:{s.Skip(16);break}case 121:case 122:{var _command_type=s.GetLong();if(33==_command_type)s.Skip(4);break}default:{s.pos=page.end}}}return _numLine},DrawSelection:function(pageNum,overlay,xDst,yDst,width,height){var sel=this.Selection;var Page1=0;var Page2=0;var Line1= 0;var Line2=0;var Glyph1=0;var Glyph2=0;if(sel.Page2>sel.Page1){Page1=sel.Page1;Page2=sel.Page2;Line1=sel.Line1;Line2=sel.Line2;Glyph1=sel.Glyph1;Glyph2=sel.Glyph2}else if(sel.Page2pageNum||Page2pageNum)bIsFillToEnd=true;var page=this.Pages[pageNum];var s=this.getStreamPage(pageNum); s.Seek(page.start);var _lineX=0;var _lineY=0;var _lineEx=0;var _lineEy=0;var _lineAscent=0;var _lineDescent=0;var _lineWidth=0;var _lineGidExist=false;var _linePrevCharX=0;var _lineCharCount=0;var _lineLastGlyphWidth=0;var _arrayGlyphOffsets=[];var _numLine=-1;var dKoefX=width/page.width_mm;var dKoefY=height/page.height_mm;while(s.posLine2&&!bIsFillToEnd)return;if(0==_lineWidth)_lineWidth=_linePrevCharX+_lineLastGlyphWidth; if(Line1==_numLine)if(-2==Glyph1)off1=0;else if(-1==Glyph1)off1=_lineWidth;else off1=_arrayGlyphOffsets[Glyph1];if(bIsFillToEnd||Line2!=_numLine)off2=_lineWidth;else if(Glyph2==-2)off2=0;else if(Glyph2==-1)off2=_lineWidth;else off2=_arrayGlyphOffsets[Glyph2];if(off2<=off1)break;var rPR=AscCommon.AscBrowser.retinaPixelRatio;if(_lineEx==1&&_lineEy==0){var _x=rPR*(xDst+dKoefX*(_lineX+off1))>>0;var _r=rPR*(xDst+dKoefX*(_lineX+off2))>>0;var _y=rPR*(yDst+dKoefY*(_lineY-_lineAscent))>>0;var _b=rPR*(yDst+ dKoefY*(_lineY+_lineDescent))>>0;if(_xoverlay.max_x)overlay.max_x=_r;if(_yoverlay.max_y)overlay.max_y=_b;overlay.m_oContext.rect(_x,_y,_r-_x,_b-_y)}else{var ortX=-_lineEy;var ortY=_lineEx;var _dx=_lineX+ortX*_lineDescent;var _dy=_lineY+ortY*_lineDescent;var _x1=_dx+off1*_lineEx;var _y1=_dy+off1*_lineEy;var _x2=_x1-ortX*(_lineAscent+_lineDescent);var _y2=_y1-ortY*(_lineAscent+_lineDescent);var _x3=_x2+(off2-off1)*_lineEx;var _y3= _y2+(off2-off1)*_lineEy;var _x4=_x3+ortX*(_lineAscent+_lineDescent);var _y4=_y3+ortY*(_lineAscent+_lineDescent);_x1=rPR*(xDst+dKoefX*_x1);_x2=rPR*(xDst+dKoefX*_x2);_x3=rPR*(xDst+dKoefX*_x3);_x4=rPR*(xDst+dKoefX*_x4);_y1=rPR*(yDst+dKoefY*_y1);_y2=rPR*(yDst+dKoefY*_y2);_y3=rPR*(yDst+dKoefY*_y3);_y4=rPR*(yDst+dKoefY*_y4);overlay.CheckPoint(_x1,_y1);overlay.CheckPoint(_x2,_y2);overlay.CheckPoint(_x3,_y3);overlay.CheckPoint(_x4,_y4);var ctx=overlay.m_oContext;ctx.moveTo(_x1,_y1);ctx.lineTo(_x2,_y2);ctx.lineTo(_x3, _y3);ctx.lineTo(_x4,_y4);ctx.closePath()}break}case 161:{s.Skip(16);break}case 163:{break}case 164:{s.Skip(16);break}case 121:case 122:{var _command_type=s.GetLong();if(33==_command_type)s.Skip(4);break}default:{s.pos=page.end}}}},CopySelection:function(pageNum,_text_format){var ret="";var sel=this.Selection;var Page1=0;var Page2=0;var Line1=0;var Line2=0;var Glyph1=0;var Glyph2=0;if(sel.Page2>sel.Page1){Page1=sel.Page1;Page2=sel.Page2;Line1=sel.Line1;Line2=sel.Line2;Glyph1=sel.Glyph1;Glyph2=sel.Glyph2}else if(sel.Page2< sel.Page1){Page1=sel.Page2;Page2=sel.Page1;Line1=sel.Line2;Line2=sel.Line1;Glyph1=sel.Glyph2;Glyph2=sel.Glyph1}else if(sel.Page1==sel.Page2){Page1=sel.Page1;Page2=sel.Page2;if(sel.Line1pageNum||Page2pageNum)bIsFillToEnd=true;var page=this.Pages[pageNum];var s=this.getStreamPage(pageNum);s.Seek(page.start);var lineSpans=[];var curSpan=new CSpan;var isChangeSpan=false;var _lineCharCount=0;var _lineGidExist=false;var _numLine=-1;while(s.pos=_numLine||bIsFillToEnd)){var _g1=-2;var _g2=-1;if(Line1==_numLine)_g1=Glyph1;if(bIsFillToEnd||Line2!=_numLine)_g2=-1;else _g2=Glyph2;if(_g1!=-1&&_g2!=-2){var textLine="

";if(-2==_g1&&-1==_g2){var countSpans=lineSpans.length;for(var i=0;i";textLine+=lineSpans[i].inner;textLine+="";if(_text_format)_text_format.Text+=lineSpans[i].inner}}else{var curIndex=0;var countSpans=lineSpans.length;for(var i=0;istart)start=_g1;if(_g2!=-1&&_g2end)continue;start-=old;end-=old;textLine+="";textLine+=lineSpans[i].inner.substring(start,end);textLine+="";if(_text_format)_text_format.Text+=lineSpans[i].inner.substring(start,end)}}textLine+="

";if(_text_format)_text_format.Text+="\n";ret+=textLine}}break}case 161:{s.Skip(16);break}case 163:{break}case 164:{s.Skip(16);break}case 121:case 122:{var _command_type= s.GetLong();if(33==_command_type)s.Skip(4);break}default:{s.pos=page.end}}}return ret},SearchPage:function(pageNum,text){var page=this.Pages[pageNum];var s=this.getStreamPage(pageNum);s.Seek(page.start);var glyphsEqualFound=0;var glyphsFindCount=text.length;if(0==glyphsFindCount)return;var _numLine=-1;var _lineGidExist=false;var _linePrevCharX=0;var _lineCharCount=0;var _lineLastGlyphWidth=0;var _findLine=0;var _findLineOffsetX=0;var _findLineOffsetR=0;var _findGlyphIndex=0;var _SeekToNextPoint=0; var _SeekLinePrevCharX=0;var arrayLines=[];var curLine=null;while(s.pos";_text+=_l.text.substring(_lineCharCount)}else if(i==_findLine){_text=_l.text.substring(0,_findGlyphIndex-1);_text+="";_text+=_l.text.substring(_findGlyphIndex-1)}else if(i==_numLine){_text+=_l.text.substring(0,_lineCharCount);_text+="";_text+=_l.text.substring(_lineCharCount)}else _text+=_l.text;if(_l.Ex==1&&_l.Ey==0)_rects[_rects.length]={PageNum:pageNum,X:_l.X+ps,Y:_l.Y,W:pe-ps,H:_l.H}; else _rects[_rects.length]={PageNum:pageNum,X:_l.X+ps*_l.Ex,Y:_l.Y+ps*_l.Ey,W:pe-ps,H:_l.H,Ex:_l.Ex,Ey:_l.Ey}}editor.WordControl.m_oDrawingDocument.AddPageSearch(_text,_rects,search_Common);glyphsEqualFound=0;s.pos=_SeekToNextPoint;_linePrevCharX=_SeekLinePrevCharX;_lineCharCount=_findGlyphIndex;_numLine=_findLine}}else if(0!=glyphsEqualFound){glyphsEqualFound=0;s.pos=_SeekToNextPoint;_linePrevCharX=_SeekLinePrevCharX;_lineCharCount=_findGlyphIndex;_numLine=_findLine}break}case 98:case 100:{break}case 91:{s.Skip(8); break}case 92:{s.Skip(8);break}case 94:{s.Skip(24);break}case 97:{break}case 99:{s.Skip(4);break}case 110:{s.SkipImage();break}case 160:{_linePrevCharX=0;_lineCharCount=0;var mask=s.GetUChar();s.Skip(8);if((mask&1)==0)s.Skip(8);s.Skip(8);if((mask&4)!=0)s.Skip(4);if((mask&2)!=0)_lineGidExist=true;else _lineGidExist=false;break}case 162:{++_numLine;break}case 161:{s.Skip(16);break}case 163:{break}case 164:{s.Skip(16);break}case 121:case 122:{var _command_type=s.GetLong();if(33==_command_type)s.Skip(4); break}default:{s.pos=page.end}}}},SearchPage2:function(pageNum){var page=this.Pages[pageNum];var s=this.getStreamPage(pageNum);s.Seek(page.start);var _searchResults=this.SearchResults;var _navRects=_searchResults.Pages[pageNum];var glyphsEqualFound=0;var text=_searchResults.Text;var glyphsFindCount=text.length;if(!_searchResults.MachingCase)text=text.toLowerCase();if(0==glyphsFindCount)return;var _numLine=-1;var _lineGidExist=false;var _linePrevCharX=0;var _lineCharCount=0;var _lineLastGlyphWidth= 0;var _findLine=0;var _findLineOffsetX=0;var _findLineOffsetR=0;var _findGlyphIndex=0;var _SeekToNextPoint=0;var _SeekLinePrevCharX=0;var arrayLines=[];var curLine=null;while(s.pos";return ret},OnKeyDown:function(e){if(!editor.bInit_word_control)return false;var bRetValue=false;if(e.KeyCode==33)editor.WordControl.m_oScrollVerApi.scrollByY(-editor.WordControl.m_oEditor.HtmlElement.height,false);else if(e.KeyCode== 34)editor.WordControl.m_oScrollVerApi.scrollByY(editor.WordControl.m_oEditor.HtmlElement.height,false);else if(e.KeyCode==35){if(true===e.CtrlKey)editor.WordControl.m_oScrollVerApi.scrollToY(editor.WordControl.m_dScrollY_max,false);bRetValue=true}else if(e.KeyCode==36){if(true===e.CtrlKey)editor.WordControl.m_oScrollVerApi.scrollToY(0,false);bRetValue=true}else if(e.KeyCode==37)bRetValue=true;else if(e.KeyCode==38)bRetValue=true;else if(e.KeyCode==39)bRetValue=true;else if(e.KeyCode==40)bRetValue= true;else if(e.KeyCode==65&&true===e.CtrlKey){bRetValue=true;if(this.selectAllCheckStart())this.selectAll()}else if(e.KeyCode==80&&true===e.CtrlKey){editor.onPrint();bRetValue=true}else if(e.KeyCode==83&&true===e.CtrlKey)bRetValue=true;return bRetValue},selectAll:function(){var sel=this.Selection;sel.Page1=0;sel.Line1=0;sel.Glyph1=0;sel.Page2=0;sel.Line2=0;sel.Glyph2=0;sel.IsSelection=false;if(0!=this.PagesCount){var lLinesLastPage=this.GetCountLines(this.PagesCount-1);if(1!=this.PagesCount||0!=lLinesLastPage){sel.Glyph1= -2;sel.Page2=this.PagesCount-1;sel.Line2=lLinesLastPage;sel.Glyph2=-1;this.OnUpdateSelection()}}editor.sendEvent("asc_onSelectionEnd")},selectAllCheckStart:function(){this.waitSelectAll=false;return true},selectAllCheckEnd:function(){},StartSearch:function(text){editor.WordControl.m_oDrawingDocument.StartSearch();this.SearchInfo.Text=text;this.SearchInfo.Page=0;var oThis=this;this.SearchInfo.Id=setTimeout(function(){oThis.OnSearchPage()},1)},OnSearchPage:function(){this.SearchPage(this.SearchInfo.Page, this.SearchInfo.Text);this.SearchInfo.Page++;if(this.SearchInfo.Page>=this.PagesCount){this.StopSearch();return}var oThis=this;this.SearchInfo.Id=setTimeout(function(){oThis.OnSearchPage()},1)},StopSearch:function(){if(null!=this.SearchInfo.Id){clearTimeout(this.SearchInfo.Id);this.SearchInfo.Id=null}editor.WordControl.m_oDrawingDocument.EndSearch(false)},findText:function(text,isMachingCase,isNext){this.SearchResults.IsSearch=true;if(text==this.SearchResults.Text&&isMachingCase==this.SearchResults.MachingCase){if(this.SearchResults.Count== 0){editor.WordControl.m_oDrawingDocument.CurrentSearchNavi=null;this.SearchResults.CurrentPage=-1;this.SearchResults.Current=-1;return}if(isNext)if(this.SearchResults.Current+10)this.SearchResults.Current--;else{var _pageFind=this.SearchResults.CurrentPage-1;var _bIsFound=false;for(var i=_pageFind;i>=0;i--)if(0_pageFind;i--)if(064&&code<91,bSmall=code>96&&code<123,bDigit=code>47&&code<58;var bCapGreek=code>912&&code<938,bSmallGreek=code>944&&code<970; var Scr=Compiled_MPrp.scr,Sty=Compiled_MPrp.sty;if(code==42)code=8727;else if(code==45)code=8722;else if(!bNormal&&code==39)code=8242;else if(Scr==TXT_ROMAN)if(Sty==STY_ITALIC)if(code==104)code=8462;else if(code==105&&bAccent)code=2835;else if(code==106&&bAccent)code=2836;else if(bCapitale)code=code+119795;else if(bSmall)code=code+119789;else if(code==1012)code=120563;else if(code==8711)code=120571;else if(bCapGreek)code=code+119633;else if(bSmallGreek)code=code+119627;else if(code==8706)code=120597; else if(code==1013)code=120598;else if(code==977)code=120599;else if(code==1008)code=120600;else if(code==981)code=120601;else if(code==1009)code=120602;else{if(code==982)code=120603}else if(Sty==STY_BI)if(code==105&&bAccent)code=2841;else if(code==106&&bAccent)code=2842;else if(bCapitale)code=code+119847;else if(bSmall)code=code+119841;else if(bDigit)code=code+120734;else if(code==1012)code=120621;else if(code==8711)code=120629;else if(bCapGreek)code=code+119691;else if(bSmallGreek)code=code+119685; else if(code==8706)code=120655;else if(code==1013)code=120656;else if(code==977)code=120657;else if(code==1008)code=120658;else if(code==981)code=120659;else if(code==1009)code=120660;else{if(code==982)code=120661}else if(Sty==STY_BOLD)if(code==105&&bAccent)code=2829;else if(code==106&&bAccent)code=2830;else if(bCapitale)code=code+119743;else if(bSmall)code=code+119737;else if(bDigit)code=code+120734;else if(code==1012)code=120505;else if(code==8711)code=120513;else if(bCapGreek)code=code+119575; else if(bSmallGreek)code=code+119569;else if(code==8706)code=120539;else if(code==1013)code=120540;else if(code==977)code=120541;else if(code==1008)code=120542;else if(code==981)code=120543;else if(code==1009)code=120544;else if(code==982)code=120545;else if(code==988)code=120778;else{if(code==989)code=120779}else{if(bAccent)if(code==105&&bAccent)code=199;else if(code==106&&bAccent)code=2828}else if(Scr==TXT_DOUBLE_STRUCK)if(code==105&&bAccent)code=2851;else if(code==106&&bAccent)code=2852;else if(code== 67)code=8450;else if(code==72)code=8461;else if(code==78)code=8469;else if(code==80)code=8473;else if(code==81)code=8474;else if(code==82)code=8477;else if(code==90)code=8484;else if(bCapitale)code=code+120055;else if(bSmall)code=code+120049;else if(bDigit)code=code+120744;else if(code==1576)code=126625;else if(code==1580)code=126626;else if(code==1583)code=126627;else if(code==1608)code=126629;else if(code==1586)code=126630;else if(code==1581)code=126631;else if(code==1591)code=126632;else if(code== 1610)code=126633;else if(code==1604)code=126635;else if(code==1605)code=126636;else if(code==1606)code=126637;else if(code==1587)code=126638;else if(code==1593)code=126639;else if(code==1601)code=126640;else if(code==1589)code=126641;else if(code==1602)code=126642;else if(code==1585)code=126643;else if(code==1588)code=126644;else if(code==1578)code=126645;else if(code==1579)code=126646;else if(code==1582)code=126647;else if(code==1584)code=126648;else if(code==1590)code=126649;else if(code==1592)code= 126650;else{if(code==1594)code=126651}else if(Scr==TXT_MONOSPACE)if(code==105&&bAccent)code=4547;else if(code==106&&bAccent)code=4548;else if(bCapitale)code=code+120367;else if(bSmall)code=code+120361;else{if(bDigit)code=code+120774}else if(Scr==TXT_FRAKTUR)if(Sty==STY_BOLD||Sty==STY_BI)if(code==105&&bAccent)code=2849;else if(code==106&&bAccent)code=2850;else if(bCapitale)code=code+120107;else{if(bSmall)code=code+120101}else if(code==105&&bAccent)code=2847;else if(code==106&&bAccent)code=2848;else if(code== 67)code=8493;else if(code==72)code=8460;else if(code==73)code=8465;else if(code==82)code=8476;else if(code==90)code=8488;else if(bCapitale)code=code+120003;else{if(bSmall)code=code+119997}else if(Scr==TXT_SANS_SERIF)if(Sty==STY_ITALIC)if(code==105&&bAccent)code=2857;else if(code==106&&bAccent)code=2858;else if(bCapitale)code=code+120263;else if(bSmall)code=code+120257;else{if(bDigit)code=code+120754}else if(Sty==STY_BOLD)if(code==105&&bAccent)code=2855;else if(code==106&&bAccent)code=2856;else if(bCapitale)code= code+120211;else if(bSmall)code=code+120205;else if(bDigit)code=code+120764;else if(code==1012)code=120679;else if(code==8711)code=120687;else if(bCapGreek)code=code+119749;else if(bSmallGreek)code=code+119743;else if(code==8706)code=120713;else if(code==1013)code=120714;else if(code==977)code=120715;else if(code==1008)code=120716;else if(code==981)code=120717;else if(code==1009)code=120718;else{if(code==982)code=120719}else if(Sty==STY_BI)if(code==105&&bAccent)code=2859;else if(code==106&&bAccent)code= 2860;else if(bCapitale)code=code+120315;else if(bSmall)code=code+120309;else if(bDigit)code=code+120764;else if(code==1012)code=120737;else if(code==8711)code=120745;else if(bCapGreek)code=code+119807;else if(bSmallGreek)code=code+119801;else if(code==8706)code=120771;else if(code==1013)code=120772;else if(code==977)code=1169349;else if(code==1008)code=120774;else if(code==981)code=120775;else if(code==1009)code=120776;else{if(code==982)code=120777}else if(code==105&&bAccent)code=2853;else if(code== 106&&bAccent)code=2854;else if(bCapitale)code=code+120159;else if(bSmall)code=code+120153;else{if(bDigit)code=code+120754}else if(Scr==TXT_SCRIPT)if(Sty==STY_ITALIC||Sty==STY_PLAIN)if(code==105&&bAccent)code=2843;else if(code==106&&bAccent)code=2844;else if(code==66)code=8492;else if(code==69)code=8496;else if(code==70)code=8497;else if(code==72)code=8459;else if(code==73)code=8464;else if(code==76)code=8466;else if(code==77)code=8499;else if(code==82)code=8475;else if(code==101)code=8495;else if(code== 103)code=8458;else if(code==111)code=8500;else if(bCapitale)code=code+119899;else{if(bSmall)code=code+119893}else if(code==105&&bAccent)code=2845;else if(code==106&&bAccent)code=2846;else if(bCapitale)code=code+119951;else if(bSmall)code=code+119945;return code};CMathText.prototype.SetPlaceholder=function(){this.Type=para_Math_Placeholder;this.value=StartTextElement};CMathText.prototype.Measure=function(oMeasure,TextPr,InfoMathText){var metricsTxt;if(this.bJDraw){this.RecalcInfo.StyleCode=this.value; metricsTxt=oMeasure.Measure2Code(this.value)}else{var ascent,width,height,descent;var letter=this.private_getCode();this.FontSlot=InfoMathText.GetFontSlot(letter);var bAccentIJ=!InfoMathText.bNormalText&&this.Parent.IsAccent()&&(this.value==105||this.value==106);this.RecalcInfo.StyleCode=letter;this.RecalcInfo.bAccentIJ=bAccentIJ;var bApostrophe=1==q_Math_Apostrophe[letter]&&this.bJDraw==false;if(bAccentIJ)oMeasure.SetStringGid(true);if(InfoMathText.NeedUpdateFont(letter,this.FontSlot,this.IsPlaceholder(), bApostrophe))g_oTextMeasurer.SetFont(InfoMathText.Font);else if(InfoMathText.CurrType==MathTextInfo_NormalText){letter=this.value;this.RecalcInfo.StyleCode=letter;InfoMathText.bApostrophe=false;var FontKoef=InfoMathText.GetFontKoef(this.FontSlot);g_oTextMeasurer.SetFontSlot(this.FontSlot,FontKoef)}this.RecalcInfo.bApostrophe=InfoMathText.bApostrophe;this.RecalcInfo.bSpaceSpecial=letter==8289;metricsTxt=oMeasure.MeasureCode(letter);if(bAccentIJ)oMeasure.SetStringGid(false)}if(this.RecalcInfo.bApostrophe){width= metricsTxt.Width;height=metricsTxt.Height;InfoMathText.NeedUpdateFont(119886,this.FontSlot,false,false);g_oTextMeasurer.SetFont(InfoMathText.Font);var metricsA=oMeasure.MeasureCode(119886);this.rasterOffsetY=metricsA.Height-metricsTxt.Ascent;ascent=metricsA.Height}else if(this.RecalcInfo.bSpaceSpecial){width=0;height=0;ascent=0}else{this.rasterOffsetX=metricsTxt.rasterOffsetX;this.rasterOffsetY=metricsTxt.rasterOffsetY;ascent=metricsTxt.Ascent;descent=metricsTxt.Height-metricsTxt.Ascent;height=ascent+ descent;if(this.bJDraw)width=metricsTxt.WidthG;else width=metricsTxt.Width}this.size.width=width;this.size.height=height;this.size.ascent=ascent;this.Width=this.size.width*TEXTWIDTH_DIVIDER|0};CMathText.prototype.PreRecalc=function(Parent,ParaMath){this.ParaMath=ParaMath;if(!this.bJDraw)this.Parent=Parent;else this.Parent=null;this.bUpdateGaps=false};CMathText.prototype.Draw=function(x,y,pGraphics,InfoTextPr){var X=this.pos.x+x,Y=this.pos.y+y;if(this.bEmptyGapLeft==false)X+=this.GapLeft;if(this.bJDraw)pGraphics.FillTextCode(X, Y,this.RecalcInfo.StyleCode);else if(this.RecalcInfo.bSpaceSpecial==false){if(InfoTextPr.NeedUpdateFont(this.RecalcInfo.StyleCode,this.FontSlot,this.IsPlaceholder(),this.RecalcInfo.bApostrophe))pGraphics.SetFont(InfoTextPr.Font);else if(InfoTextPr.CurrType==MathTextInfo_NormalText){var FontKoef=InfoTextPr.GetFontKoef(this.FontSlot);pGraphics.SetFontSlot(this.FontSlot,FontKoef)}if(this.RecalcInfo.bAccentIJ)pGraphics.tg(this.RecalcInfo.StyleCode,X,Y);else pGraphics.FillTextCode(X,Y,this.RecalcInfo.StyleCode)}}; CMathText.prototype.setPosition=function(pos){if(this.RecalcInfo.bApostrophe==true){this.pos.x=pos.x;this.pos.y=pos.y-this.rasterOffsetY}else if(this.bJDraw==false){this.pos.x=pos.x;this.pos.y=pos.y}else{this.pos.x=pos.x-this.rasterOffsetX;this.pos.y=pos.y-this.rasterOffsetY+this.size.ascent}};CMathText.prototype.GetLocationOfLetter=function(){var pos=new CMathPosition;if(this.RecalcInfo.bApostrophe){pos.x=this.pos.x;pos.y=this.pos.y-this.size.ascent}else{pos.x=this.pos.x;pos.y=this.pos.y}return pos}; CMathText.prototype.Is_InclineLetter=function(){var code=this.value;var bCapitale=code>64&&code<91,bSmall=code>96&&code<123||code==305||code==567;var bCapGreek=code>912&&code<938,bSmallGreek=code>944&&code<970;var bAlphabet=bCapitale||bSmall||bCapGreek||bSmallGreek;var MPrp=this.Parent.GetCompiled_ScrStyles();var bRomanSerif=(MPrp.sty==STY_BI||MPrp.sty==STY_ITALIC)&&(MPrp.scr==TXT_ROMAN||MPrp.scr==TXT_SANS_SERIF),bScript=MPrp.scr==TXT_SCRIPT;return bAlphabet&&(bRomanSerif||bScript)};CMathText.prototype.IsJustDraw= function(){return this.bJDraw};CMathText.prototype.relate=function(Parent){this.Parent=Parent};CMathText.prototype.IsAlignPoint=function(){return false};CMathText.prototype.IsText=function(){return true};CMathText.prototype.private_Is_BreakOperator=function(val){var rOper=q_Math_BreakOperators[val];return rOper==1||rOper==2};CMathText.prototype.Is_CompareOperator=function(){return q_Math_BreakOperators[this.value]==2};CMathText.prototype.Is_LeftBracket=function(){return this.value==40||this.value== 123||this.value==91||this.value==10216||this.value==8970||this.value==8968||this.value==10214||this.value==9001};CMathText.prototype.Is_RightBracket=function(){return this.value==41||this.value==125||this.value==93||this.value==10217||this.value==8971||this.value==8969||this.value==10215||this.value==9002};CMathText.prototype.setCoeffTransform=function(sx,shx,shy,sy){this.transform={sx:sx,shx:shx,shy:shy,sy:sy};this.applyTransformation()};CMathText.prototype.applyTransformation=function(){var sx= this.transform.sx,shx=this.transform.shx,shy=this.transform.shy,sy=this.transform.sy;sy=sy<0?-sy:sy;this.size.width=this.size.width*sx+-1*this.size.width*shx;this.size.height=this.size.height*sy+this.size.height*shy;this.size.ascent=this.size.ascent*(sy+shy);this.size.descent=this.size.descent*(sy+shy);this.size.center=this.size.center*(sy+shy)};CMathText.prototype.Copy=function(){var NewLetter=new CMathText(this.bJDraw);NewLetter.Type=this.Type;NewLetter.value=this.value;return NewLetter};CMathText.prototype.Write_ToBinary= function(Writer){Writer.WriteLong(this.Type);Writer.WriteLong(this.Type);Writer.WriteLong(this.value)};CMathText.prototype.Read_FromBinary=function(Reader){this.Type=Reader.GetLong();this.value=Reader.GetLong();if(AscFonts.IsCheckSymbols)AscFonts.FontPickerByCharacter.getFontBySymbol(this.value)};CMathText.prototype.Is_LetterCS=function(){return this.FontSlot==fontslot_CS};function CMathAmp(){CMathBaseText.call(this);this.bAlignPoint=false;this.Type=para_Math_Ampersand;this.value=38;if(AscFonts.IsCheckSymbols)AscFonts.FontPickerByCharacter.getFontBySymbol(this.value); this.AmpText=new CMathText(false);this.AmpText.add(this.value)}CMathAmp.prototype=Object.create(CMathBaseText.prototype);CMathAmp.prototype.constructor=CMathAmp;CMathAmp.prototype.Measure=function(oMeasure,TextPr,InfoMathText){this.bAlignPoint=InfoMathText.bEqArray==true&&InfoMathText.bNormalText==false;this.AmpText.Measure(oMeasure,TextPr,InfoMathText);if(this.bAlignPoint){this.size.width=0;this.size.ascent=0;this.size.height=0}else{this.size.width=this.AmpText.size.width;this.size.height=this.AmpText.size.height; this.size.ascent=this.AmpText.size.ascent}this.Width=this.size.width*TEXTWIDTH_DIVIDER|0};CMathAmp.prototype.PreRecalc=function(Parent,ParaMath,ArgSize,RPI){this.Parent=Parent;this.AmpText.PreRecalc(Parent,ParaMath,ArgSize,RPI);this.bUpdateGaps=false};CMathAmp.prototype.getCodeChr=function(){var code=null;if(!this.bAlignPoint)code=this.AmpText.getCodeChr();return code};CMathAmp.prototype.IsText=function(){return!this.bAlignPoint};CMathAmp.prototype.setPosition=function(pos){this.pos.x=pos.x;this.pos.y= pos.y;if(this.bAlignPoint==false)this.AmpText.setPosition(pos)};CMathAmp.prototype.relate=function(Parent){this.Parent=Parent;this.AmpText.relate(Parent)};CMathAmp.prototype.Draw=function(x,y,pGraphics,InfoTextPr){if(this.bAlignPoint==false)this.AmpText.Draw(x+this.GapLeft,y,pGraphics,InfoTextPr);else if(editor.ShowParaMarks){var X=x+this.pos.x+this.Get_WidthVisible(),Y=y+this.pos.y,Y2=y+this.pos.y-this.AmpText.size.height;pGraphics.drawVerLine(0,X,Y,Y2,.1)}};CMathAmp.prototype.Is_InclineLetter=function(){return false}; CMathAmp.prototype.IsAlignPoint=function(){return this.bAlignPoint};CMathAmp.prototype.Copy=function(){return new CMathAmp};CMathAmp.prototype.Write_ToBinary=function(Writer){Writer.WriteLong(this.Type)};CMathAmp.prototype.Read_FromBinary=function(Reader){};function CMathInfoTextPr(InfoTextPr){this.CurrType=-1;this.TextPr=InfoTextPr.TextPr;this.ArgSize=InfoTextPr.ArgSize;this.bApostrophe=false;this.Font={FontFamily:{Name:"Cambria Math",Index:-1},FontSize:this.TextPr.FontSize,Italic:false,Bold:false}; this.bNormalText=InfoTextPr.bNormalText;this.bEqArray=InfoTextPr.bEqArray;this.RFontsCompare=[];this.RFontsCompare[fontslot_ASCII]=undefined!==this.TextPr.RFonts.Ascii&&this.TextPr.RFonts.Ascii.Name=="Cambria Math";this.RFontsCompare[fontslot_HAnsi]=undefined!==this.TextPr.RFonts.HAnsi&&this.TextPr.RFonts.HAnsi.Name=="Cambria Math";this.RFontsCompare[fontslot_CS]=undefined!==this.TextPr.RFonts.CS&&this.TextPr.RFonts.CS.Name=="Cambria Math";this.RFontsCompare[fontslot_EastAsia]=undefined!==this.TextPr.RFonts.EastAsia&& this.TextPr.RFonts.EastAsia.Name=="Cambria Math"}CMathInfoTextPr.prototype.NeedUpdateFont=function(code,fontSlot,IsPlaceholder,IsApostrophe){var NeedUpdateFont=false;var bMathText=this.bNormalText==false||IsPlaceholder===true;var Type;if(bMathText&&(this.RFontsCompare[fontSlot]==true||IsPlaceholder))Type=MathTextInfo_MathText;else if(bMathText&&this.RFontsCompare[fontSlot]==false&&true===this.IsSpecilalOperator(code))Type=MathTextInfo_SpecialOperator;else Type=MathTextInfo_NormalText;var ArgSize= this.ArgSize;if(this.CurrType!==MathTextInfo_MathText&&this.CurrType!==MathTextInfo_SpecialOperator&&Type!==MathTextInfo_NormalText)NeedUpdateFont=true;this.CurrType=Type;if(this.bApostrophe!==IsApostrophe&&this.ArgSize<0&&Type!==MathTextInfo_NormalText){ArgSize=IsApostrophe==true?1:this.ArgSize;this.bApostrophe=IsApostrophe;NeedUpdateFont=true}if(NeedUpdateFont==true){var FontSize=this.private_GetFontSize(fontSlot);var coeff=MatGetKoeffArgSize(FontSize,ArgSize);this.Font.FontSize=FontSize*coeff}return NeedUpdateFont}; CMathInfoTextPr.prototype.private_GetFontSize=function(fontSlot){return fontSlot==fontslot_CS?this.TextPr.FontSizeCS:this.TextPr.FontSize};CMathInfoTextPr.prototype.GetFontKoef=function(fontSlot){var FontSize=this.private_GetFontSize(fontSlot);return MatGetKoeffArgSize(FontSize,this.ArgSize)};CMathInfoTextPr.prototype.GetFontSlot=function(code){var Hint=this.TextPr.RFonts.Hint;var bCS=this.TextPr.CS;var bRTL=this.TextPr.RTL;var lcid=this.TextPr.Lang.EastAsia;return g_font_detector.Get_FontClass(code, Hint,lcid,bCS,bRTL)};CMathInfoTextPr.prototype.IsSpecilalOperator=function(val){var bSpecialOperator=false;if(val>=8592&&val<=8681)bSpecialOperator=q_Math_Arrows[val]!==0;else if(val>=8692&&val<=8959)bSpecialOperator=q_Math_SpecialEquals[val]!==0;else if(val>=9985&&val<=10650)bSpecialOperator=val!==10625;else if(val>=10740&&val<=11007)bSpecialOperator=val!==10977&&val!==10993;else bSpecialOperator=q_Math_SpecialSymbols[val]==1;return bSpecialOperator};var q_Math_Arrows={8628:0,8629:0,8632:0,8633:0}; var q_Math_SpecialEquals={8709:0,8718:0,8735:0,8736:0,8737:0,8738:0,8767:0,8894:0,8895:0,8868:0};var q_Math_SpecialSymbols={33:1,35:1,40:1,41:1,42:1,43:1,44:1,45:1,46:1,47:1,58:1,59:1,60:1,61:1,62:1,63:1,91:1,92:1,93:1,94:1,95:1,123:1,124:1,125:1,126:1,161:1,172:1,177:1,183:1,191:1,215:1,247:1,8208:1,8210:1,8211:1,8212:1,8214:1,8224:1,8225:1,8226:1,8230:1,8512:1,8517:1,8518:1,8519:1,8520:1,8521:1,8965:1,8966:1,8968:1,8969:1,8970:1,8971:1,8988:1,8989:1,8990:1,8991:1,8994:1,8995:1,9001:1,9002:1,9021:1, 9023:1,9136:1,9137:1,10678:1,10679:1,10680:1,10681:1,10688:1,10689:1,10692:1,10693:1,10694:1,10695:1,10696:1,10702:1,10703:1,10704:1,10705:1,10706:1,10707:1,10708:1,10709:1,10710:1,10711:1,10712:1,10713:1,10714:1,10715:1,10719:1,10721:1,10722:1,10723:1,10724:1,10725:1,10726:1,10731:1,12308:1,12309:1,12310:1,12311:1,7616:1,7617:1,7618:1,7619:1};var q_Math_Apostrophe={8242:1,8243:1,8244:1,8279:1};var q_Math_BreakOperators={42:1,43:1,45:1,47:1,60:2,61:2,62:2,92:1,177:1,8592:2,8593:2,8594:2,8595:2,8596:2, 8597:2,8598:2,8599:2,8600:2,8601:2,8602:2,8603:2,8604:2,8605:2,8606:2,8607:2,8608:2,8609:2,8610:2,8611:2,8612:2,8613:2,8614:2,8615:2,8616:2,8617:2,8618:2,8619:2,8620:2,8621:2,8622:2,8623:2,8624:2,8625:2,8626:2,8627:2,8630:2,8631:2,8634:2,8635:2,8636:2,8637:2,8638:2,8639:2,8640:2,8641:2,8642:2,8643:2,8644:2,8645:2,8646:2,8647:2,8648:2,8649:2,8650:2,8651:2,8652:2,8653:2,8654:2,8655:2,8656:2,8657:2,8658:2,8659:2,8660:2,8661:2,8662:2,8663:2,8664:2,8665:2,8666:2,8667:2,8668:2,8669:2,8670:2,8671:2,8672:2, 8673:2,8674:2,8675:2,8676:2,8677:2,8678:2,8679:2,8680:2,8681:2,8692:2,8693:2,8694:2,8695:2,8696:2,8697:2,8698:2,8699:2,8700:2,8701:2,8702:2,8703:2,8712:2,8713:2,8714:2,8715:2,8716:2,8717:2,8722:1,8723:1,8724:1,8725:1,8726:1,8727:1,8728:1,8729:1,8733:2,8739:2,8740:2,8741:2,8742:2,8743:1,8744:1,8745:1,8746:1,8756:2,8757:2,8758:2,8759:2,8760:1,8761:2,8762:1,8763:2,8764:2,8765:2,8766:2,8768:1,8769:2,8770:2,8771:2,8772:2,8773:2,8774:2,8775:2,8776:2,8777:2,8778:2,8779:2,8780:2,8781:2,8782:2,8783:2,8784:2, 8785:2,8786:2,8787:2,8788:2,8789:2,8790:2,8791:2,8792:2,8793:2,8794:2,8795:2,8796:2,8797:2,8798:2,8799:2,8800:2,8801:2,8802:2,8803:2,8804:2,8805:2,8806:2,8807:2,8808:2,8809:2,8810:2,8811:2,8812:2,8813:2,8814:2,8815:2,8816:2,8817:2,8818:2,8819:2,8820:2,8821:2,8822:2,8823:2,8824:2,8825:2,8826:2,8827:2,8828:2,8829:2,8830:2,8831:2,8832:2,8833:2,8834:2,8835:2,8836:2,8837:2,8838:2,8839:2,8840:2,8841:2,8842:2,8843:2,8844:1,8845:1,8846:1,8847:2,8848:2,8849:2,8850:2,8851:1,8852:1,8853:1,8854:1,8855:1,8856:1, 8857:1,8858:1,8859:1,8860:1,8861:1,8862:1,8863:1,8864:1,8865:1,8866:2,8867:2,8869:2,8870:2,8871:2,8872:2,8873:2,8874:2,8875:2,8876:2,8877:2,8878:2,8879:2,8880:2,8881:2,8882:2,8883:2,8884:2,8885:2,8886:2,8887:2,8888:2,8889:2,8890:1,8891:1,8892:1,8893:1,8900:1,8901:1,8902:1,8903:1,8904:2,8905:1,8906:1,8907:1,8908:1,8909:2,8910:1,8911:1,8912:2,8913:2,8914:1,8915:1,8916:2,8917:2,8918:2,8919:2,8920:2,8921:2,8922:2,8923:2,8924:2,8925:2,8926:2,8927:2,8928:2,8929:2,8930:2,8931:2,8932:2,8933:2,8934:2,8935:2, 8936:2,8937:2,8938:2,8939:2,8940:2,8941:2,8942:2,8943:2,8944:2,8945:2,8946:2,8947:2,8948:2,8949:2,8950:2,8951:2,8952:2,8953:2,8954:2,8955:2,8956:2,8957:2,8958:2,8959:2,8965:1,8966:1,8994:2,8995:2,9021:1,9023:2,9136:2,9137:2,9651:1,9674:1,9675:1,10193:1,10194:2,10195:2,10196:2,10202:2,10203:2,10204:2,10205:2,10206:2,10207:2,10208:1,10209:1,10210:1,10211:1,10212:1,10213:1,10224:2,10225:2,10226:2,10227:2,10228:2,10229:2,10230:2,10231:2,10232:2,10233:2,10234:2,10235:2,10236:2,10237:2,10238:2,10239:2, 10496:2,10497:2,10498:2,10499:2,10500:2,10501:2,10502:2,10503:2,10504:2,10505:2,10506:2,10507:2,10508:2,10509:2,10510:2,10511:2,10512:2,10513:2,10514:2,10515:2,10516:2,10517:2,10518:2,10519:2,10520:2,10521:2,10522:2,10523:2,10524:2,10525:2,10526:2,10527:2,10528:2,10529:2,10530:2,10531:2,10532:2,10533:2,10534:2,10535:2,10536:2,10537:2,10538:2,10539:2,10540:2,10541:2,10542:2,10543:2,10544:2,10545:2,10546:2,10547:2,10548:2,10549:2,10550:2,10551:2,10552:2,10553:2,10554:2,10555:2,10556:2,10557:2,10558:2, 10559:2,10560:2,10561:2,10562:2,10563:2,10564:2,10565:2,10566:2,10567:2,10568:2,10569:2,10570:2,10571:2,10572:2,10573:2,10574:2,10575:2,10576:2,10577:2,10578:2,10579:2,10580:2,10581:2,10582:2,10583:2,10584:2,10585:2,10586:2,10587:2,10588:2,10589:2,10590:2,10591:2,10592:2,10593:2,10594:2,10595:2,10596:2,10597:2,10598:2,10599:2,10600:2,10601:2,10602:2,10603:2,10604:2,10605:2,10606:2,10607:2,10608:2,10609:2,10610:2,10611:2,10612:2,10613:2,10614:2,10615:2,10616:2,10617:2,10618:2,10619:2,10834:1,10835:1, 10836:1,10837:1,10838:1,10839:1,10840:1,10841:1,10842:1,10843:1,10844:1,10845:1,10846:1,10847:1,10848:1,10849:1,10850:1,10851:1,10852:1,10853:1,10854:2,10855:2,10856:2,10857:2,10858:2,10859:2,10860:2,10861:2,10862:2,10863:2,10864:2,10865:1,10866:1,10867:2,10868:2,10869:2,10870:2,10871:2,10872:2,10873:2,10874:2,10875:2,10876:2,10877:2,10878:2,10879:2,10880:2,10881:2,10882:2,10883:2,10884:2,10885:2,10886:2,10887:2,10888:2,10889:2,10890:2,10891:2,10892:2,10893:2,10894:2,10895:2,10896:2,10897:2,10898:2, 10899:2,10900:2,10901:2,10902:2,10903:2,10904:2,10905:2,10906:2,10907:2,10908:2,10909:2,10910:2,10911:2,10912:2,10913:2,10914:2,10915:2,10916:2,10917:2,10918:2,10919:2,10920:2,10921:2,10922:2,10923:2,10924:2,10925:2,10926:2,10927:2,10928:2,10929:2,10930:2,10931:2,10932:2,10933:2,10934:2,10935:2,10936:2,10937:2,10938:2,10939:2,10940:2,10941:2,10942:2,10943:2,10944:2,10945:2,10946:2,10947:2,10948:2,10949:2,10950:2,10951:2,10952:2,10953:2,10954:2,10955:2,10956:2,10957:2,10958:2,10959:2,10960:2,10961:2, 10962:2,10963:2,10964:2,10965:2,10966:2,10967:2,10968:2,10969:2,10970:2,10971:2,10972:2,10973:2,215:1,247:1};"use strict";var History=AscCommon.History;var c_oAscMathType={Symbol_pm:0,Symbol_infinity:1,Symbol_equals:2,Symbol_neq:3,Symbol_about:4,Symbol_times:5,Symbol_div:6,Symbol_factorial:7,Symbol_propto:8,Symbol_less:9,Symbol_ll:10,Symbol_greater:11,Symbol_gg:12,Symbol_leq:13,Symbol_geq:14,Symbol_mp:15,Symbol_cong:16,Symbol_approx:17,Symbol_equiv:18,Symbol_forall:19,Symbol_additional:20,Symbol_partial:21, Symbol_sqrt:22,Symbol_cbrt:23,Symbol_qdrt:24,Symbol_cup:25,Symbol_cap:26,Symbol_emptyset:27,Symbol_percent:28,Symbol_degree:29,Symbol_fahrenheit:30,Symbol_celsius:31,Symbol_inc:32,Symbol_nabla:33,Symbol_exists:34,Symbol_notexists:35,Symbol_in:36,Symbol_ni:37,Symbol_leftarrow:38,Symbol_uparrow:39,Symbol_rightarrow:40,Symbol_downarrow:41,Symbol_leftrightarrow:42,Symbol_therefore:43,Symbol_plus:44,Symbol_minus:45,Symbol_not:46,Symbol_ast:47,Symbol_bullet:48,Symbol_vdots:49,Symbol_cdots:50,Symbol_rddots:51, Symbol_ddots:52,Symbol_aleph:53,Symbol_beth:54,Symbol_QED:55,Symbol_alpha:65536,Symbol_beta:65537,Symbol_gamma:65538,Symbol_delta:65539,Symbol_varepsilon:65540,Symbol_epsilon:65541,Symbol_zeta:65542,Symbol_eta:65543,Symbol_theta:65544,Symbol_vartheta:65545,Symbol_iota:65546,Symbol_kappa:65547,Symbol_lambda:65548,Symbol_mu:65549,Symbol_nu:65550,Symbol_xsi:65551,Symbol_o:65552,Symbol_pi:65553,Symbol_varpi:65554,Symbol_rho:65555,Symbol_varrho:65556,Symbol_sigma:65557,Symbol_varsigma:65558,Symbol_tau:65559, Symbol_upsilon:65560,Symbol_varphi:65561,Symbol_phi:65562,Symbol_chi:65563,Symbol_psi:65564,Symbol_omega:65565,Symbol_Alpha:131072,Symbol_Beta:131073,Symbol_Gamma:131074,Symbol_Delta:131075,Symbol_Epsilon:131076,Symbol_Zeta:131077,Symbol_Eta:131078,Symbol_Theta:131079,Symbol_Iota:131080,Symbol_Kappa:131081,Symbol_Lambda:131082,Symbol_Mu:131083,Symbol_Nu:131084,Symbol_Xsi:131085,Symbol_O:131086,Symbol_Pi:131087,Symbol_Rho:131088,Symbol_Sigma:131089,Symbol_Tau:131090,Symbol_Upsilon:131091,Symbol_Phi:131092, Symbol_Chi:131093,Symbol_Psi:131094,Symbol_Omega:131095,FractionVertical:16777216,FractionDiagonal:16777217,FractionHorizontal:16777218,FractionSmall:16777219,FractionDifferential_1:16842752,FractionDifferential_2:16842753,FractionDifferential_3:16842754,FractionDifferential_4:16842755,FractionPi_2:16842756,ScriptSup:33554432,ScriptSub:33554433,ScriptSubSup:33554434,ScriptSubSupLeft:33554435,ScriptCustom_1:33619968,ScriptCustom_2:33619969,ScriptCustom_3:33619970,ScriptCustom_4:33619971,RadicalSqrt:50331648, RadicalRoot_n:50331649,RadicalRoot_2:50331650,RadicalRoot_3:50331651,RadicalCustom_1:50397184,RadicalCustom_2:50397185,Integral:67108864,IntegralSubSup:67108865,IntegralCenterSubSup:67108866,IntegralDouble:67108867,IntegralDoubleSubSup:67108868,IntegralDoubleCenterSubSup:67108869,IntegralTriple:67108870,IntegralTripleSubSup:67108871,IntegralTripleCenterSubSup:67108872,IntegralOriented:67174400,IntegralOrientedSubSup:67174401,IntegralOrientedCenterSubSup:67174402,IntegralOrientedDouble:67174403,IntegralOrientedDoubleSubSup:67174404, IntegralOrientedDoubleCenterSubSup:67174405,IntegralOrientedTriple:67174406,IntegralOrientedTripleSubSup:67174407,IntegralOrientedTripleCenterSubSup:67174408,Integral_dx:67239936,Integral_dy:67239937,Integral_dtheta:67239938,LargeOperator_Sum:83886080,LargeOperator_Sum_CenterSubSup:83886081,LargeOperator_Sum_SubSup:83886082,LargeOperator_Sum_CenterSub:83886083,LargeOperator_Sum_Sub:83886084,LargeOperator_Prod:83951616,LargeOperator_Prod_CenterSubSup:83951617,LargeOperator_Prod_SubSup:83951618,LargeOperator_Prod_CenterSub:83951619, LargeOperator_Prod_Sub:83951620,LargeOperator_CoProd:83951621,LargeOperator_CoProd_CenterSubSup:83951622,LargeOperator_CoProd_SubSup:83951623,LargeOperator_CoProd_CenterSub:83951624,LargeOperator_CoProd_Sub:83951625,LargeOperator_Union:84017152,LargeOperator_Union_CenterSubSup:84017153,LargeOperator_Union_SubSup:84017154,LargeOperator_Union_CenterSub:84017155,LargeOperator_Union_Sub:84017156,LargeOperator_Intersection:84017157,LargeOperator_Intersection_CenterSubSup:84017158,LargeOperator_Intersection_SubSup:84017159, LargeOperator_Intersection_CenterSub:84017160,LargeOperator_Intersection_Sub:84017161,LargeOperator_Disjunction:84082688,LargeOperator_Disjunction_CenterSubSup:84082689,LargeOperator_Disjunction_SubSup:84082690,LargeOperator_Disjunction_CenterSub:84082691,LargeOperator_Disjunction_Sub:84082692,LargeOperator_Conjunction:84082693,LargeOperator_Conjunction_CenterSubSup:84082694,LargeOperator_Conjunction_SubSup:84082695,LargeOperator_Conjunction_CenterSub:84082696,LargeOperator_Conjunction_Sub:84082697, LargeOperator_Custom_1:84148224,LargeOperator_Custom_2:84148225,LargeOperator_Custom_3:84148226,LargeOperator_Custom_4:84148227,LargeOperator_Custom_5:84148228,Bracket_Round:100663296,Bracket_Square:100663297,Bracket_Curve:100663298,Bracket_Angle:100663299,Bracket_LowLim:100663300,Bracket_UppLim:100663301,Bracket_Line:100663302,Bracket_LineDouble:100663303,Bracket_Square_OpenOpen:100663304,Bracket_Square_CloseClose:100663305,Bracket_Square_CloseOpen:100663306,Bracket_SquareDouble:100663307,Bracket_Round_Delimiter_2:100728832, Bracket_Curve_Delimiter_2:100728833,Bracket_Angle_Delimiter_2:100728834,Bracket_Angle_Delimiter_3:100728835,Bracket_Round_OpenNone:100794368,Bracket_Round_NoneOpen:100794369,Bracket_Square_OpenNone:100794370,Bracket_Square_NoneOpen:100794371,Bracket_Curve_OpenNone:100794372,Bracket_Curve_NoneOpen:100794373,Bracket_Angle_OpenNone:100794374,Bracket_Angle_NoneOpen:100794375,Bracket_LowLim_OpenNone:100794376,Bracket_LowLim_NoneNone:100794377,Bracket_UppLim_OpenNone:100794378,Bracket_UppLim_NoneOpen:100794379, Bracket_Line_OpenNone:100794380,Bracket_Line_NoneOpen:100794381,Bracket_LineDouble_OpenNone:100794382,Bracket_LineDouble_NoneOpen:100794383,Bracket_SquareDouble_OpenNone:100794384,Bracket_SquareDouble_NoneOpen:100794385,Bracket_Custom_1:100859904,Bracket_Custom_2:100859905,Bracket_Custom_3:100859906,Bracket_Custom_4:100859907,Bracket_Custom_5:100925440,Bracket_Custom_6:100925441,Bracket_Custom_7:100925442,Function_Sin:117440512,Function_Cos:117440513,Function_Tan:117440514,Function_Csc:117440515, Function_Sec:117440516,Function_Cot:117440517,Function_1_Sin:117506048,Function_1_Cos:117506049,Function_1_Tan:117506050,Function_1_Csc:117506051,Function_1_Sec:117506052,Function_1_Cot:117506053,Function_Sinh:117571584,Function_Cosh:117571585,Function_Tanh:117571586,Function_Csch:117571587,Function_Sech:117571588,Function_Coth:117571589,Function_1_Sinh:117637120,Function_1_Cosh:117637121,Function_1_Tanh:117637122,Function_1_Csch:117637123,Function_1_Sech:117637124,Function_1_Coth:117637125,Function_Custom_1:117702656, Function_Custom_2:117702657,Function_Custom_3:117702658,Accent_Dot:134217728,Accent_DDot:134217729,Accent_DDDot:134217730,Accent_Hat:134217731,Accent_Check:134217732,Accent_Accent:134217733,Accent_Grave:134217734,Accent_Smile:134217735,Accent_Tilde:134217736,Accent_Bar:134217737,Accent_DoubleBar:134217738,Accent_CurveBracketTop:134217739,Accent_CurveBracketBot:134217740,Accent_GroupTop:134217741,Accent_GroupBot:134217742,Accent_ArrowL:134217743,Accent_ArrowR:134217744,Accent_ArrowD:134217745,Accent_HarpoonL:134217746, Accent_HarpoonR:134217747,Accent_BorderBox:134283264,Accent_BorderBoxCustom:134283265,Accent_BarTop:134348800,Accent_BarBot:134348801,Accent_Custom_1:134414336,Accent_Custom_2:134414337,Accent_Custom_3:134414338,LimitLog_LogBase:150994944,LimitLog_Log:150994945,LimitLog_Lim:150994946,LimitLog_Min:150994947,LimitLog_Max:150994948,LimitLog_Ln:150994949,LimitLog_Custom_1:151060480,LimitLog_Custom_2:151060481,Operator_ColonEquals:167772160,Operator_EqualsEquals:167772161,Operator_PlusEquals:167772162, Operator_MinusEquals:167772163,Operator_Definition:167772164,Operator_UnitOfMeasure:167772165,Operator_DeltaEquals:167772166,Operator_ArrowL_Top:167837696,Operator_ArrowR_Top:167837697,Operator_ArrowL_Bot:167837698,Operator_ArrowR_Bot:167837699,Operator_DoubleArrowL_Top:167837700,Operator_DoubleArrowR_Top:167837701,Operator_DoubleArrowL_Bot:167837702,Operator_DoubleArrowR_Bot:167837703,Operator_ArrowD_Top:167837704,Operator_ArrowD_Bot:167837705,Operator_DoubleArrowD_Top:167837706,Operator_DoubleArrowD_Bot:167837707, Operator_Custom_1:167903232,Operator_Custom_2:167903233,Matrix_1_2:184549376,Matrix_2_1:184549377,Matrix_1_3:184549378,Matrix_3_1:184549379,Matrix_2_2:184549380,Matrix_2_3:184549381,Matrix_3_2:184549382,Matrix_3_3:184549383,Matrix_Dots_Center:184614912,Matrix_Dots_Baseline:184614913,Matrix_Dots_Vertical:184614914,Matrix_Dots_Diagonal:184614915,Matrix_Identity_2:184680448,Matrix_Identity_2_NoZeros:184680449,Matrix_Identity_3:184680450,Matrix_Identity_3_NoZeros:184680451,Matrix_2_2_RoundBracket:184745984, Matrix_2_2_SquareBracket:184745985,Matrix_2_2_LineBracket:184745986,Matrix_2_2_DLineBracket:184745987,Matrix_Flat_Round:184811520,Matrix_Flat_Square:184811521,Default_Text:201326592};function CRPI(){this.bDecreasedComp=false;this.bInline=false;this.bChangeInline=false;this.bNaryInline=false;this.bEqArray=false;this.bMathFunc=false;this.bRecalcCtrPrp=false;this.bCorrect_ConvertFontSize=false;this.bSmallFraction=false}CRPI.prototype.MergeMathInfo=function(MathInfo){this.bInline=MathInfo.bInline||MathInfo.bInternalRanges== true&&MathInfo.bStartRanges==false;this.bRecalcCtrPrp=MathInfo.bRecalcCtrPrp;this.bChangeInline=MathInfo.bChangeInline;this.bCorrect_ConvertFontSize=MathInfo.bCorrect_ConvertFontSize};function CMathPointInfo(){this.x=0;this.y=0;this.bEven=true;this.CurrPoint=0;this.InfoPoints={}}CMathPointInfo.prototype.SetInfoPoints=function(InfoPoints){this.InfoPoints.GWidths=InfoPoints.GWidths;this.InfoPoints.GPoints=InfoPoints.GPoints;this.InfoPoints.ContentPoints=InfoPoints.ContentPoints.Widths;this.InfoPoints.GMaxDimWidths= InfoPoints.GMaxDimWidths};CMathPointInfo.prototype.NextAlignRange=function(){if(this.bEven)this.bEven=false;else{this.CurrPoint++;this.bEven=true}};CMathPointInfo.prototype.GetAlign=function(){var align=0;if(this.bEven){var alignEven,alignGeneral,alignOdd;var Len=this.InfoPoints.ContentPoints.length,Point=this.InfoPoints.ContentPoints[this.CurrPoint];var GWidth=this.InfoPoints.GWidths[this.CurrPoint],GPoint=this.InfoPoints.GPoints[this.CurrPoint];if(this.CurrPoint==Len-1&&Point.odd==-1){var GMaxDimWidth= this.InfoPoints.GMaxDimWidths[this.CurrPoint];alignGeneral=(GMaxDimWidth-Point.even)/2;alignEven=0}else{alignGeneral=(GWidth-GPoint.even-GPoint.odd)/2;alignEven=GPoint.even-Point.even}if(this.CurrPoint>0){var PrevGenPoint=this.InfoPoints.GPoints[this.CurrPoint-1],PrevGenWidth=this.InfoPoints.GWidths[this.CurrPoint-1],PrevPoint=this.InfoPoints.ContentPoints[this.CurrPoint-1];var alignPrevGen=(PrevGenWidth-PrevGenPoint.even-PrevGenPoint.odd)/2;alignOdd=alignPrevGen+PrevGenPoint.odd-PrevPoint.odd}else alignOdd= 0;align=alignGeneral+alignEven+alignOdd}return align};function CInfoPoints(){this.GWidths=null;this.GPoints=null;this.GMaxDimWidths=null;this.ContentPoints=new AmperWidths}CInfoPoints.prototype.SetDefault=function(){this.GWidths=null;this.GPoints=null;this.GMaxDimWidths=null;this.ContentPoints.SetDefault()};function CMathPosInfo(){this.CurRange=-1;this.CurLine=-1;this.DispositionOpers=null}function CMathPosition(){this.x=0;this.y=0}CMathPosition.prototype.Set=function(Pos){this.x=Pos.x;this.y=Pos.y}; function AmperWidths(){this.bEven=true;this.Widths=[]}AmperWidths.prototype.UpdatePoint=function(value){var len=this.Widths.length;if(len==0){var NewPoint=new CMathPoint;NewPoint.even=value;this.Widths.push(NewPoint);this.bEven=true}else if(this.bEven)this.Widths[len-1].even+=value;else this.Widths[len-1].odd+=value};AmperWidths.prototype.AddNewAlignRange=function(){var len=this.Widths.length;if(!this.bEven||len==0){var NewPoint=new CMathPoint;NewPoint.even=0;this.Widths.push(NewPoint)}if(this.bEven){len= this.Widths.length;this.Widths[len-1].odd=0}this.bEven=!this.bEven};AmperWidths.prototype.SetDefault=function(){this.bEven=true;this.Widths.length=0};function CGeneralObjectGaps(Left,Right){this.left=Left;this.right=Right}function CGaps(oSign,oEqual,oZeroOper,oLett){this.sign=oSign;this.equal=oEqual;this.zeroOper=oZeroOper;this.letters=oLett}function CCoeffGaps(){var LeftSign=new CGaps(.52,.26,0,.52),RightSign=new CGaps(.49,0,0,.49);this.Sign=new CGeneralObjectGaps(LeftSign,RightSign);var LeftMult= new CGaps(0,0,0,.46),RightMult=new CGaps(0,0,0,.49);this.Mult=new CGeneralObjectGaps(LeftMult,RightMult);var LeftEqual=new CGaps(0,0,0,.7),RightEqual=new CGaps(0,0,0,.5);this.Equal=new CGeneralObjectGaps(LeftEqual,RightEqual);var LeftDefault=new CGaps(0,0,0,0),RightDefault=new CGaps(0,0,0,0);this.Default=new CGeneralObjectGaps(LeftDefault,RightDefault)}CCoeffGaps.prototype={getCoeff:function(codeCurr,codeLR,direct){var operator=null;if(this.checkEqualSign(codeCurr))operator=this.Equal;else if(this.checkOperSign(codeCurr))operator= this.Sign;else if(codeCurr==42)operator=this.Mult;else operator=this.Default;var part=direct==-1?operator.left:operator.right;var coeff=0;if(codeLR==-1)coeff=part.letters;else if(this.checkOperSign(codeLR))coeff=part.sign;else if(this.checkEqualSign(codeLR))coeff=part.equal;else if(this.checkZeroSign(codeLR,direct))coeff=part.zeroOper;else coeff=part.letters;return coeff},checkOperSign:function(code){var PLUS=43,MINUS=45,PLUS_MINUS=177,MINUS_PLUS=8723,MULTIPLICATION=215,DIVISION=247;return code== PLUS||code==MINUS||code==PLUS_MINUS||code==MINUS_PLUS||code==MULTIPLICATION||code==DIVISION},checkEqualSign:function(code){var COMPARE=code==60||code==62;var ARROWS=code>=8592&&code<=8627||code==8630||code==8631||code>=8634&&code<=8681||code>=8692&&code<=8703;var INTERSECTION=code>=8739&&code<=8746;var EQUALS=code==61||code>=8756&&code<=8893||code>=8900&&code<=8959;var ARR_FISHES=code>=10202&&code<=10213||code>=10220&&code<=10623;var TRIANGLE_SYMB=code>=10702&&code<=10711;var OTH_SYMB=code==10719|| code>=10721&&code<=10727||code>=10740&&code<=10744||code>=10786&&code<=10992||code>=10994&&code<=11003||code==11005||code==11006;return COMPARE||ARROWS||INTERSECTION||EQUALS||ARR_FISHES||TRIANGLE_SYMB||OTH_SYMB},checkZeroSign:function(code,direct){var MULT=42,DIVISION=47,B_SLASH=92;var bOper=code==MULT||code==DIVISION||code==B_SLASH;var bLeftBracket=direct==-1&&(code==40||code==91||code==123);var bRightBracket=direct==1&&(code==41||code==93||code==125);return bOper||bLeftBracket||bRightBracket}}; var COEFF_GAPS=new CCoeffGaps;function CMathArgSize(){this.value=undefined}CMathArgSize.prototype={Decrease:function(){if(this.value==undefined)this.value=0;if(this.value>-2)this.value--;return this.value},Increase:function(){if(this.value==undefined)this.value=0;if(this.value<2)this.value++;return this.value},Set:function(ArgSize){this.value=ArgSize.value},GetValue:function(){return this.value},SetValue:function(val){if(val===null||val===undefined)this.value=undefined;else if(val<-2)this.value=-2; else if(val>2)this.value=2;else this.value=val},Copy:function(){var ArgSize=new CMathArgSize;ArgSize.value=this.value;return ArgSize},Merge:function(ArgSize){if(this.value==undefined)this.value=0;if(ArgSize.value==undefined)ArgSize.value=0;this.SetValue(this.value+ArgSize.value)},Can_Decrease:function(){return this.value!==-2},Can_Increase:function(){return this.value==-1||this.value==-2},Can_SimpleIncrease:function(){return this.value!==2},Write_ToBinary:function(Writer){if(this.value==undefined)Writer.WriteBool(true); else{Writer.WriteBool(false);Writer.WriteLong(this.value)}},Read_FromBinary:function(Reader){if(Reader.GetBool()==false)this.value=Reader.GetLong();else this.value=undefined}};function CMathGapsInfo(argSize){this.argSize=argSize;this.Left=null;this.Current=null;this.LeftFontSize=null;this.CurrentFontSize=null;this.bUpdate=false}CMathGapsInfo.prototype={setGaps:function(Current,CurrentFontSize){this.updateCurrentObject(Current,CurrentFontSize);this.updateGaps()},updateCurrentObject:function(Current, CurrentFontSize){this.Left=this.Current;this.LeftFontSize=this.CurrentFontSize;this.Current=Current;this.CurrentFontSize=CurrentFontSize},updateGaps:function(){if(this.argSize<0){this.Current.GapLeft=0;if(this.Left!==null)this.Left.GapRight=0}else{var leftCoeff=0,rightCoeff=0;var leftCode;if(this.Current.IsText()){var currCode=this.Current.getCodeChr();if(this.Left!==null)if(this.Left.Type==para_Math_Composition){rightCoeff=this.getGapsMComp(this.Left,1);leftCoeff=COEFF_GAPS.getCoeff(currCode,-1, -1);if(leftCoeff>rightCoeff)leftCoeff-=rightCoeff}else{if(this.Left.IsText()){leftCode=this.Left.getCodeChr();leftCoeff=COEFF_GAPS.getCoeff(currCode,leftCode,-1);rightCoeff=COEFF_GAPS.getCoeff(leftCode,currCode,1)}}else this.Current.GapLeft=0}else if(this.Current.Type==para_Math_Composition){leftCoeff=this.getGapsMComp(this.Current,-1);if(this.Left!==null)if(this.Left.Type==para_Math_Composition){rightCoeff=this.getGapsMComp(this.Left,1);if(rightCoeff/2>leftCoeff)rightCoeff-=leftCoeff;else rightCoeff/= 2;if(leftCoeffleftCoeff)rightCoeff-=leftCoeff}}else leftCoeff=0}var LGapSign=.1513*this.CurrentFontSize;this.Current.GapLeft=(leftCoeff*LGapSign*100|0)/100;if(this.Left!==null){var RGapSign=.1513*this.LeftFontSize;this.Left.GapRight=(rightCoeff*RGapSign*100|0)/100}}},getGapsMComp:function(MComp,direct){var kind=MComp.kind; var checkGap=this.checkGapKind(MComp);var bNeedGap=!checkGap.bEmptyGaps&&!checkGap.bChildGaps;var coeffLeft=.001,coeffRight=0;var bDegree=kind==MATH_DEGREE;if(checkGap.bChildGaps){if(bDegree){coeffLeft=.03;if(MComp.IsPlhIterator())coeffRight=.12;else coeffRight=.16}var gapsChild=MComp.getGapsInside(this);coeffLeft=coeffLeft0&&StartPos!==EndPos){var EndPosPrev=this.protected_GetRangeEndPos(CurLine-1,CurRange);this.Content[EndPosPrev].UpdLastElementForGaps(_CurLine-1,_CurRange,GapsInfo)}for(var Pos=StartPos;Pos<=EndPos;Pos++)this.Content[Pos].Math_UpdateGaps(_CurLine,_CurRange,GapsInfo)}};CMathContent.prototype.IsEqArray=function(){return this.RecalcInfo.bEqArray};CMathContent.prototype.Get_WidthPoints=function(){return this.InfoPoints.ContentPoints}; CMathContent.prototype.ShiftPage=function(Dx){this.Bounds.ShiftPage(Dx);for(var Pos=0;Pos1){var bFRunEmpty=this.Content[0].Is_Empty();bFirstComp=bFRunEmpty&& this.Content[1].Type==para_Math_Composition;var bLastRunEmpty=this.Content[len-1].Is_Empty();bLastComp=bLastRunEmpty&&this.Content[len-2].Type==para_Math_Composition}var checkGap;if(bFirstComp){checkGap=GapsInfo.checkGapKind(this.Content[1]);if(!checkGap.bChildGaps)gaps.left=GapsInfo.getGapsMComp(this.Content[1],-1)}if(bLastComp){checkGap=GapsInfo.checkGapKind(this.Content[len-1]);if(!checkGap.bChildGaps)gaps.right=GapsInfo.getGapsMComp(this.Content[len-2],1)}return gaps};CMathContent.prototype.draw= function(x,y,pGraphics,PDSE){var StartPos,EndPos;if(this.bRoot){var CurLine=PDSE.Line-this.StartLine;var CurRange=0===CurLine?PDSE.Range-this.StartRange:PDSE.Range;StartPos=this.protected_GetRangeStartPos(CurLine,CurRange);EndPos=this.protected_GetRangeEndPos(CurLine,CurRange)}else{StartPos=0;EndPos=this.Content.length-1}var bHidePlh=this.plhHide&&this.IsPlaceholder();if(!bHidePlh)for(var i=StartPos;i<=EndPos;i++)if(this.Content[i].Type==para_Math_Composition)this.Content[i].draw(x,y,pGraphics,PDSE); else this.Content[i].Draw_Elements(PDSE)};CMathContent.prototype.Draw_Elements=function(PDSE){var StartPos,EndPos;if(this.protected_GetLinesCount()>0){var CurLine=PDSE.Line-this.StartLine;var CurRange=0===CurLine?PDSE.Range-this.StartRange:PDSE.Range;StartPos=this.protected_GetRangeStartPos(CurLine,CurRange);EndPos=this.protected_GetRangeEndPos(CurLine,CurRange)}else{StartPos=0;EndPos=this.Content.length-1}var bHidePlh=this.plhHide&&this.IsPlaceholder();if(!bHidePlh)for(var CurPos=StartPos;CurPos<= EndPos;CurPos++)this.Content[CurPos].Draw_Elements(PDSE)};CMathContent.prototype.setCtrPrp=function(){};CMathContent.prototype.Is_InclineLetter=function(){var result=false;if(this.Content.length==1)result=this.Content[0].Math_Is_InclineLetter();return result};CMathContent.prototype.IsPlaceholder=function(){var bPlh=false;if(this.Content.length==1)bPlh=this.Content[0].IsPlaceholder();return bPlh};CMathContent.prototype.Can_GetSelection=function(){var bPlh=false;if(this.Content.length==1)bPlh=this.Content[0].IsPlaceholder(); return bPlh||this.bRoot==false};CMathContent.prototype.IsJustDraw=function(){return false};CMathContent.prototype.ApplyPoints=function(WidthsPoints,Points,MaxDimWidths){this.InfoPoints.GWidths=WidthsPoints;this.InfoPoints.GPoints=Points;this.InfoPoints.GMaxDimWidths=MaxDimWidths;var PosInfo=new CMathPointInfo;PosInfo.SetInfoPoints(this.InfoPoints);this.size.width=0;for(var i=0;i0?this.Content[CurrPos-1].Type==para_Math_Run:false,bRightRun=CurrPos1)if(this.Content[len-1].Type==para_Math_Composition){EmptyRun=new ParaRun(null,true);EmptyRun.Set_RFont_ForMathRun();RPr=this.Content[len-1].Get_CtrPrp(false);EmptyRun.Apply_Pr(RPr);this.Internal_Content_Add(CurrPos,EmptyRun)}};CMathContent.prototype.Correct_Content=function(bInnerCorrection){if(true===bInnerCorrection)for(var nPos=0,nCount= this.Content.length;nPos=this.Content.length)this.CurPos=this.Content.length-1;if(this.CurPos<0)this.CurPos=0};CMathContent.prototype.Correct_ContentPos=function(nDirection){var nCurPos=this.CurPos;if(nCurPos<0){this.CurPos=0;this.Content[0].MoveCursorToStartPos()}else if(nCurPos> this.Content.length-1){this.CurPos=this.Content.length-1;this.Content[this.CurPos].MoveCursorToEndPos()}else if(para_Math_Run!==this.Content[nCurPos].Type)if(nDirection>0){this.CurPos=nCurPos+1;this.Content[this.CurPos].MoveCursorToStartPos()}else{this.CurPos=nCurPos-1;this.Content[this.CurPos].MoveCursorToEndPos()}};CMathContent.prototype.Cursor_Is_Start=function(){var result=false;if(!this.Is_Empty())if(this.CurPos==0)result=this.Content[0].Cursor_Is_Start();return result};CMathContent.prototype.Cursor_Is_End= function(){var result=false;if(!this.Is_Empty()){var len=this.Content.length-1;if(this.CurPos==len)result=this.Content[len].Cursor_Is_End()}return result};CMathContent.prototype.Get_TextPr=function(ContentPos,Depth){var pos=ContentPos.Get(Depth);var TextPr;if(true!==this.bRoot&&this.IsPlaceholder())TextPr=this.Parent.Get_CtrPrp(true);else TextPr=this.Content[pos].Get_TextPr(ContentPos,Depth+1);return TextPr};CMathContent.prototype.Get_ParentCtrRunPr=function(bCopy){return this.Parent.Get_CtrPrp(bCopy)}; CMathContent.prototype.Get_CompiledTextPr=function(Copy,bAll){var TextPr=null;if(true!==this.bRoot&&this.IsPlaceholder())TextPr=this.Parent.Get_CompiledCtrPrp_2();else if(this.Selection.Use||bAll==true){var StartPos,EndPos;if(bAll==true){StartPos=0;EndPos=this.Content.length-1}else{StartPos=this.Selection.StartPos;EndPos=this.Selection.EndPos;if(StartPos>EndPos){StartPos=this.Selection.EndPos;EndPos=this.Selection.StartPos}}while(null===TextPr&&StartPos<=EndPos){var bComp=this.Content[StartPos].Type== para_Math_Composition,bEmptyRun=this.Content[StartPos].Type==para_Math_Run&&true===this.Content[StartPos].IsSelectionEmpty();if(bComp||!bEmptyRun||bAll)TextPr=this.Content[StartPos].Get_CompiledTextPr(true);StartPos++}while(this.Content[EndPos].Type==para_Math_Run&&true===this.Content[EndPos].IsSelectionEmpty()&&StartPos=0&&CurPosEndPos){var temp=StartPos;StartPos=EndPos;EndPos=temp}for(var i=StartPos+1;ithis.Content.length-1)return;for(var pos=StartPos;pos<=StartPos+Count;pos++)this.Content[pos].Set_MathTextPr2(TextPr,MathPr,true)};CMathContent.prototype.IsNormalTextInRuns=function(){var flag=true;if(this.Selection.Use){var StartPos=this.Selection.StartPos,EndPos=this.Selection.EndPos;if(StartPos>EndPos){StartPos=this.Selection.EndPos;EndPos= this.Selection.StartPos}for(var i=StartPos;i=Pos)this.CurPos++;if(this.Selection.StartPos>=Pos)this.Selection.StartPos++;if(this.Selection.EndPos>=Pos)this.Selection.EndPos++;this.private_CorrectSelectionPos();this.private_CorrectCurPos()}var NearPosLen=this.NearPosArray.length;for(var Index=0;Index=Pos)ContentPos.Data[Depth]++}};CMathContent.prototype.private_CorrectSelectionPos=function(){this.Selection.StartPos=Math.max(0,Math.min(this.Content.length-1,this.Selection.StartPos));this.Selection.EndPos=Math.max(0,Math.min(this.Content.length-1,this.Selection.EndPos))};CMathContent.prototype.private_CorrectCurPos=function(){if(this.Content.length<=0){this.CurPos=0;return}if(this.CurPos> this.Content.length-1){this.CurPos=this.Content.length-1;if(para_Math_Run===this.Content[this.CurPos].Type)this.Content[this.CurPos].MoveCursorToEndPos(false)}if(this.CurPos<0){this.CurPos=this.Content.length-1;if(para_Math_Run===this.Content[this.CurPos].Type)this.Content[this.CurPos].MoveCursorToStartPos()}};CMathContent.prototype.Correct_ContentCurPos=function(){this.private_CorrectCurPos();for(var Pos=0;Pos0){var Count=NewItems.length;for(var i=0;iPos+Count)this.CurPos-=Count;else if(this.CurPos>Pos)this.CurPos=Pos;this.private_CorrectCurPos();this.private_UpdatePosOnRemove(Pos,Count)};CMathContent.prototype.Remove_Content= function(Pos,Count){var DeletedItems=this.Content.splice(Pos,Count);History.Add(new CChangesMathContentRemoveItem(this,Pos,DeletedItems));if(this.CurPos>Pos+Count)this.CurPos-=Count;else if(this.CurPos>Pos)this.CurPos=Pos;else if(this.CurPos>this.Content.length-1)this.CurPos=this.Content.length-1};CMathContent.prototype.private_UpdatePosOnRemove=function(Pos,Count){if(true===this.Selection.Use){if(this.Selection.StartPos<=this.Selection.EndPos){if(this.Selection.StartPos>Pos+Count)this.Selection.StartPos-= Count;else if(this.Selection.StartPos>Pos)this.Selection.StartPos=Pos;if(this.Selection.EndPos>=Pos+Count)this.Selection.EndPos-=Count;else if(this.Selection.EndPos>=Pos)this.Selection.EndPos=Math.max(0,Pos-1)}else{if(this.Selection.StartPos>=Pos+Count)this.Selection.StartPos-=Count;else if(this.Selection.StartPos>=Pos)this.Selection.StartPos=Math.max(0,Pos-1);if(this.Selection.EndPos>Pos+Count)this.Selection.EndPos-=Count;else if(this.Selection.EndPos>Pos)this.Selection.EndPos=Pos}this.Selection.StartPos= Math.min(this.Content.length-1,Math.max(0,this.Selection.StartPos));this.Selection.EndPos=Math.min(this.Content.length-1,Math.max(0,this.Selection.EndPos))}var NearPosLen=this.NearPosArray.length;for(var Index=0;IndexPos+Count)ContentPos.Data[Depth]-=Count;else if(ContentPos.Data[Depth]>Pos)ContentPos.Data[Depth]=Math.max(0,Pos)}};CMathContent.prototype.Get_Default_TPrp= function(){return this.ParaMath.Get_Default_TPrp()};CMathContent.prototype.Is_Empty=function(){return this.Content.length==0};CMathContent.prototype.Copy=function(Selected,oPr){var NewContent=new CMathContent;this.CopyTo(NewContent,Selected,oPr);return NewContent};CMathContent.prototype.CopyTo=function(OtherContent,Selected,oPr){var nStartPos,nEndPos;if(true===Selected)if(this.Selection.StartPos0)pos--;var last=this.Content[pos].Type==para_Math_Run?this.Content[pos]:this.Content[pos].GetLastElement();return last};CMathContent.prototype.GetFirstElement=function(){var pos=0;while(this.Content[pos].Type==para_Math_Run&&this.Content[pos].Is_Empty()&& pos>24;if(MainType===c_oAscMathMainType.Symbol)this.private_LoadFromMenuSymbol(Type,Pr,oSelectedContent);else if(MainType===c_oAscMathMainType.Fraction)this.private_LoadFromMenuFraction(Type,Pr,oSelectedContent);else if(MainType===c_oAscMathMainType.Script)this.private_LoadFromMenuScript(Type,Pr,oSelectedContent);else if(MainType===c_oAscMathMainType.Radical)this.private_LoadFromMenuRadical(Type,Pr,oSelectedContent); else if(MainType===c_oAscMathMainType.Integral)this.private_LoadFromMenuIntegral(Type,Pr,oSelectedContent);else if(MainType===c_oAscMathMainType.LargeOperator)this.private_LoadFromMenuLargeOperator(Type,Pr,oSelectedContent);else if(MainType===c_oAscMathMainType.Bracket)this.private_LoadFromMenuBracket(Type,Pr,oSelectedContent);else if(MainType===c_oAscMathMainType.Function)this.private_LoadFromMenuFunction(Type,Pr,oSelectedContent);else if(MainType===c_oAscMathMainType.Accent)this.private_LoadFromMenuAccent(Type, Pr,oSelectedContent);else if(MainType===c_oAscMathMainType.LimitLog)this.private_LoadFromMenuLimitLog(Type,Pr,oSelectedContent);else if(MainType===c_oAscMathMainType.Operator)this.private_LoadFromMenuOperator(Type,Pr,oSelectedContent);else if(MainType===c_oAscMathMainType.Matrix)this.private_LoadFromMenuMatrix(Type,Pr,oSelectedContent);else if(MainType==c_oAscMathMainType.Empty_Content)this.private_LoadFromMenuDefaultText(Type,Pr,oSelectedContent)};CMathContent.prototype.private_LoadFromMenuSymbol= function(Type,Pr){var Code=-1;switch(Type){case c_oAscMathType.Symbol_pm:Code=177;break;case c_oAscMathType.Symbol_infinity:Code=8734;break;case c_oAscMathType.Symbol_equals:Code=61;break;case c_oAscMathType.Symbol_neq:Code=8800;break;case c_oAscMathType.Symbol_about:Code=126;break;case c_oAscMathType.Symbol_times:Code=215;break;case c_oAscMathType.Symbol_div:Code=247;break;case c_oAscMathType.Symbol_factorial:Code=33;break;case c_oAscMathType.Symbol_propto:Code=8733;break;case c_oAscMathType.Symbol_less:Code= 60;break;case c_oAscMathType.Symbol_ll:Code=8810;break;case c_oAscMathType.Symbol_greater:Code=62;break;case c_oAscMathType.Symbol_gg:Code=8811;break;case c_oAscMathType.Symbol_leq:Code=8804;break;case c_oAscMathType.Symbol_geq:Code=8805;break;case c_oAscMathType.Symbol_mp:Code=8723;break;case c_oAscMathType.Symbol_cong:Code=8773;break;case c_oAscMathType.Symbol_approx:Code=8776;break;case c_oAscMathType.Symbol_equiv:Code=8801;break;case c_oAscMathType.Symbol_forall:Code=8704;break;case c_oAscMathType.Symbol_additional:Code= 8705;break;case c_oAscMathType.Symbol_partial:Code=120597;break;case c_oAscMathType.Symbol_sqrt:this.Add_Radical(Pr,null,null);break;case c_oAscMathType.Symbol_cbrt:this.Add_Radical({ctrPrp:Pr.ctrPrp,type:DEGREE_RADICAL},null,"3");break;case c_oAscMathType.Symbol_qdrt:this.Add_Radical({ctrPrp:Pr.ctrPrp,type:DEGREE_RADICAL},null,"4");break;case c_oAscMathType.Symbol_cup:Code=8746;break;case c_oAscMathType.Symbol_cap:Code=8745;break;case c_oAscMathType.Symbol_emptyset:Code=8709;break;case c_oAscMathType.Symbol_percent:Code= 37;break;case c_oAscMathType.Symbol_degree:Code=176;break;case c_oAscMathType.Symbol_fahrenheit:Code=8457;break;case c_oAscMathType.Symbol_celsius:Code=8451;break;case c_oAscMathType.Symbol_inc:Code=8710;break;case c_oAscMathType.Symbol_nabla:Code=8711;break;case c_oAscMathType.Symbol_exists:Code=8707;break;case c_oAscMathType.Symbol_notexists:Code=8708;break;case c_oAscMathType.Symbol_in:Code=8712;break;case c_oAscMathType.Symbol_ni:Code=8715;break;case c_oAscMathType.Symbol_leftarrow:Code=8592; break;case c_oAscMathType.Symbol_uparrow:Code=8593;break;case c_oAscMathType.Symbol_rightarrow:Code=8594;break;case c_oAscMathType.Symbol_downarrow:Code=8595;break;case c_oAscMathType.Symbol_leftrightarrow:Code=8596;break;case c_oAscMathType.Symbol_therefore:Code=8756;break;case c_oAscMathType.Symbol_plus:Code=43;break;case c_oAscMathType.Symbol_minus:Code=8722;break;case c_oAscMathType.Symbol_not:Code=172;break;case c_oAscMathType.Symbol_ast:Code=8727;break;case c_oAscMathType.Symbol_bullet:Code= 8729;break;case c_oAscMathType.Symbol_vdots:Code=8942;break;case c_oAscMathType.Symbol_cdots:Code=8943;break;case c_oAscMathType.Symbol_rddots:Code=8944;break;case c_oAscMathType.Symbol_ddots:Code=8945;break;case c_oAscMathType.Symbol_aleph:Code=8501;break;case c_oAscMathType.Symbol_beth:Code=8502;break;case c_oAscMathType.Symbol_QED:Code=8718;break;case c_oAscMathType.Symbol_alpha:Code=945;break;case c_oAscMathType.Symbol_beta:Code=946;break;case c_oAscMathType.Symbol_gamma:Code=947;break;case c_oAscMathType.Symbol_delta:Code= 948;break;case c_oAscMathType.Symbol_varepsilon:Code=949;break;case c_oAscMathType.Symbol_epsilon:Code=1013;break;case c_oAscMathType.Symbol_zeta:Code=950;break;case c_oAscMathType.Symbol_eta:Code=951;break;case c_oAscMathType.Symbol_theta:Code=952;break;case c_oAscMathType.Symbol_vartheta:Code=977;break;case c_oAscMathType.Symbol_iota:Code=953;break;case c_oAscMathType.Symbol_kappa:Code=954;break;case c_oAscMathType.Symbol_lambda:Code=955;break;case c_oAscMathType.Symbol_mu:Code=956;break;case c_oAscMathType.Symbol_nu:Code= 957;break;case c_oAscMathType.Symbol_xsi:Code=958;break;case c_oAscMathType.Symbol_o:Code=959;break;case c_oAscMathType.Symbol_pi:Code=960;break;case c_oAscMathType.Symbol_varpi:Code=982;break;case c_oAscMathType.Symbol_rho:Code=961;break;case c_oAscMathType.Symbol_varrho:Code=1009;break;case c_oAscMathType.Symbol_sigma:Code=963;break;case c_oAscMathType.Symbol_varsigma:Code=962;break;case c_oAscMathType.Symbol_tau:Code=964;break;case c_oAscMathType.Symbol_upsilon:Code=965;break;case c_oAscMathType.Symbol_varphi:Code= 966;break;case c_oAscMathType.Symbol_phi:Code=981;break;case c_oAscMathType.Symbol_chi:Code=967;break;case c_oAscMathType.Symbol_psi:Code=968;break;case c_oAscMathType.Symbol_omega:Code=969;break;case c_oAscMathType.Symbol_Alpha:Code=913;break;case c_oAscMathType.Symbol_Beta:Code=914;break;case c_oAscMathType.Symbol_Gamma:Code=915;break;case c_oAscMathType.Symbol_Delta:Code=916;break;case c_oAscMathType.Symbol_Epsilon:Code=917;break;case c_oAscMathType.Symbol_Zeta:Code=918;break;case c_oAscMathType.Symbol_Eta:Code= 919;break;case c_oAscMathType.Symbol_Theta:Code=920;break;case c_oAscMathType.Symbol_Iota:Code=921;break;case c_oAscMathType.Symbol_Kappa:Code=922;break;case c_oAscMathType.Symbol_Lambda:Code=923;break;case c_oAscMathType.Symbol_Mu:Code=924;break;case c_oAscMathType.Symbol_Nu:Code=925;break;case c_oAscMathType.Symbol_Xsi:Code=926;break;case c_oAscMathType.Symbol_O:Code=927;break;case c_oAscMathType.Symbol_Pi:Code=928;break;case c_oAscMathType.Symbol_Rho:Code=929;break;case c_oAscMathType.Symbol_Sigma:Code= 931;break;case c_oAscMathType.Symbol_Tau:Code=932;break;case c_oAscMathType.Symbol_Upsilon:Code=933;break;case c_oAscMathType.Symbol_Phi:Code=934;break;case c_oAscMathType.Symbol_Chi:Code=935;break;case c_oAscMathType.Symbol_Psi:Code=936;break;case c_oAscMathType.Symbol_Omega:Code=937;break}if(-1!==Code){var TextPr,MathPr;if(this.Content.length<=0)this.Correct_Content();if(this.Content.length>0&&this.Content[this.CurPos].Type==para_Math_Run&&this.IsSelectionEmpty()==true){TextPr=this.Content[this.CurPos].Get_TextPr(); TextPr.RFonts.SetAll("Cambria Math",-1);MathPr=this.Content[this.CurPos].Get_MathPr()}this.Add_Symbol(Code,TextPr,MathPr)}};CMathContent.prototype.private_LoadFromMenuFraction=function(Type,Pr,oSelectedContent){var oFraction=null;switch(Type){case c_oAscMathType.FractionVertical:oFraction=this.Add_Fraction(Pr,null,null);break;case c_oAscMathType.FractionDiagonal:oFraction=this.Add_Fraction({ctrPrp:Pr.ctrPrp,type:SKEWED_FRACTION},null,null);break;case c_oAscMathType.FractionHorizontal:oFraction=this.Add_Fraction({ctrPrp:Pr.ctrPrp, type:LINEAR_FRACTION},null,null);break;case c_oAscMathType.FractionSmall:var oBox=new CBox(Pr);this.Add_Element(oBox);var BoxMathContent=oBox.getBase();BoxMathContent.SetArgSize(-1);oFraction=BoxMathContent.Add_Fraction(Pr,null,null);break;case c_oAscMathType.FractionDifferential_1:this.Add_Fraction(Pr,"dx","dy");break;case c_oAscMathType.FractionDifferential_2:this.Add_Fraction(Pr,String.fromCharCode(916)+"y",String.fromCharCode(916)+"x");break;case c_oAscMathType.FractionDifferential_3:this.Add_Fraction(Pr, String.fromCharCode(8706)+"y",String.fromCharCode(8706)+"x");break;case c_oAscMathType.FractionDifferential_4:this.Add_Fraction(Pr,String.fromCharCode(948)+"y",String.fromCharCode(948)+"x");break;case c_oAscMathType.FractionPi_2:this.Add_Fraction(Pr,String.fromCharCode(960),"2");break}if(oFraction&&oSelectedContent)oFraction.getNumeratorMathContent().private_FillSelectedContent(oSelectedContent)};CMathContent.prototype.private_LoadFromMenuScript=function(Type,Pr,oSelectedContent){var oScript=null; switch(Type){case c_oAscMathType.ScriptSup:oScript=this.Add_Script(false,{ctrPrp:Pr.ctrPrp,type:DEGREE_SUPERSCRIPT},null,null,null);break;case c_oAscMathType.ScriptSub:oScript=this.Add_Script(false,{ctrPrp:Pr.ctrPrp,type:DEGREE_SUBSCRIPT},null,null,null);break;case c_oAscMathType.ScriptSubSup:oScript=this.Add_Script(true,{ctrPrp:Pr.ctrPrp,type:DEGREE_SubSup},null,null,null);break;case c_oAscMathType.ScriptSubSupLeft:oScript=this.Add_Script(true,{ctrPrp:Pr.ctrPrp,type:DEGREE_PreSubSup},null,null,null); break;case c_oAscMathType.ScriptCustom_1:Pr.type=DEGREE_SUBSCRIPT;var Script=this.Add_Script(false,Pr,"x",null,null);var SubMathContent=Script.getLowerIterator();Pr.type=DEGREE_SUPERSCRIPT;SubMathContent.Add_Script(false,Pr,"y","2",null);break;case c_oAscMathType.ScriptCustom_2:this.Add_Script(false,{ctrPrp:Pr.ctrPrp,type:DEGREE_SUPERSCRIPT},"e","-i"+String.fromCharCode(969)+"t",null);break;case c_oAscMathType.ScriptCustom_3:this.Add_Script(false,{ctrPrp:Pr.ctrPrp,type:DEGREE_SUPERSCRIPT},"x","2", null);break;case c_oAscMathType.ScriptCustom_4:this.Add_Script(true,{ctrPrp:Pr.ctrPrp,type:DEGREE_PreSubSup},"Y","n","1");break}if(oScript&&oSelectedContent)oScript.getBase().private_FillSelectedContent(oSelectedContent)};CMathContent.prototype.private_LoadFromMenuRadical=function(Type,Pr,oSelectedContent){var oRadical=null;switch(Type){case c_oAscMathType.RadicalSqrt:Pr.type=SQUARE_RADICAL;Pr.degHide=true;oRadical=this.Add_Radical(Pr,null,null);break;case c_oAscMathType.RadicalRoot_n:Pr.type=DEGREE_RADICAL; oRadical=this.Add_Radical(Pr,null,null);break;case c_oAscMathType.RadicalRoot_2:Pr.type=DEGREE_RADICAL;oRadical=this.Add_Radical(Pr,null,"2");break;case c_oAscMathType.RadicalRoot_3:Pr.type=DEGREE_RADICAL;oRadical=this.Add_Radical(Pr,null,"3");break;case c_oAscMathType.RadicalCustom_1:var Fraction=this.Add_Fraction(Pr,null,null);var NumMathContent=Fraction.getNumeratorMathContent();var DenMathContent=Fraction.getDenominatorMathContent();NumMathContent.Add_Text("-b"+String.fromCharCode(177),this.Paragraph); Pr.type=SQUARE_RADICAL;Pr.degHide=true;var Radical=NumMathContent.Add_Radical(Pr,null,null);var RadicalBaseMathContent=Radical.getBase();RadicalBaseMathContent.Add_Script(false,{ctrPrp:Pr.ctrPrp,type:DEGREE_SUPERSCRIPT},"b","2",null);RadicalBaseMathContent.Add_Text("-4ac",this.Paragraph);DenMathContent.Add_Text("2a",this.Paragraph);break;case c_oAscMathType.RadicalCustom_2:Pr.type=SQUARE_RADICAL;Pr.degHide=true;var Radical=this.Add_Radical(Pr,null,null);var BaseMathContent=Radical.getBase();var ScriptPr= {ctrPrp:Pr.ctrPrp,type:DEGREE_SUPERSCRIPT};BaseMathContent.Add_Script(false,ScriptPr,"a","2",null);BaseMathContent.Add_Text("+",this.Paragraph);BaseMathContent.Add_Script(false,ScriptPr,"b","2",null);break}if(oRadical&&oSelectedContent)oRadical.getBase().private_FillSelectedContent(oSelectedContent)};CMathContent.prototype.private_LoadFromMenuIntegral=function(Type,Pr,oSelectedContent){var oIntegral=null;switch(Type){case c_oAscMathType.Integral:oIntegral=this.Add_Integral(1,false,NARY_UndOvr,true, true,Pr.ctrPrp,null,null,null);break;case c_oAscMathType.IntegralSubSup:oIntegral=this.Add_Integral(1,false,NARY_SubSup,false,false,Pr.ctrPrp,null,null,null);break;case c_oAscMathType.IntegralCenterSubSup:oIntegral=this.Add_Integral(1,false,NARY_UndOvr,false,false,Pr.ctrPrp,null,null,null);break;case c_oAscMathType.IntegralDouble:oIntegral=this.Add_Integral(2,false,NARY_UndOvr,true,true,Pr.ctrPrp,null,null,null);break;case c_oAscMathType.IntegralDoubleSubSup:oIntegral=this.Add_Integral(2,false,NARY_SubSup, false,false,Pr.ctrPrp,null,null,null);break;case c_oAscMathType.IntegralDoubleCenterSubSup:oIntegral=this.Add_Integral(2,false,NARY_UndOvr,false,false,Pr.ctrPrp,null,null,null);break;case c_oAscMathType.IntegralTriple:oIntegral=this.Add_Integral(3,false,NARY_UndOvr,true,true,Pr.ctrPrp,null,null,null);break;case c_oAscMathType.IntegralTripleSubSup:oIntegral=this.Add_Integral(3,false,NARY_SubSup,false,false,Pr.ctrPrp,null,null,null);break;case c_oAscMathType.IntegralTripleCenterSubSup:oIntegral=this.Add_Integral(3, false,NARY_UndOvr,false,false,Pr.ctrPrp,null,null,null);break;case c_oAscMathType.IntegralOriented:oIntegral=this.Add_Integral(1,true,NARY_UndOvr,true,true,Pr.ctrPrp,null,null,null);break;case c_oAscMathType.IntegralOrientedSubSup:oIntegral=this.Add_Integral(1,true,NARY_SubSup,false,false,Pr.ctrPrp,null,null,null);break;case c_oAscMathType.IntegralOrientedCenterSubSup:oIntegral=this.Add_Integral(1,true,NARY_UndOvr,false,false,Pr.ctrPrp,null,null,null);break;case c_oAscMathType.IntegralOrientedDouble:oIntegral= this.Add_Integral(2,true,NARY_UndOvr,true,true,Pr.ctrPrp,null,null,null);break;case c_oAscMathType.IntegralOrientedDoubleSubSup:oIntegral=this.Add_Integral(2,true,NARY_SubSup,false,false,Pr.ctrPrp,null,null,null);break;case c_oAscMathType.IntegralOrientedDoubleCenterSubSup:oIntegral=this.Add_Integral(2,true,NARY_UndOvr,false,false,Pr.ctrPrp,null,null,null);break;case c_oAscMathType.IntegralOrientedTriple:oIntegral=this.Add_Integral(3,true,NARY_UndOvr,true,true,Pr.ctrPrp,null,null,null);break;case c_oAscMathType.IntegralOrientedTripleSubSup:oIntegral= this.Add_Integral(3,true,NARY_SubSup,false,false,Pr.ctrPrp,null,null,null);break;case c_oAscMathType.IntegralOrientedTripleCenterSubSup:oIntegral=this.Add_Integral(3,true,NARY_UndOvr,false,false,Pr.ctrPrp,null,null,null);break;case c_oAscMathType.Integral_dx:Pr.diff=1;this.Add_Box(Pr,"dx");break;case c_oAscMathType.Integral_dy:Pr.diff=1;this.Add_Box(Pr,"dy");break;case c_oAscMathType.Integral_dtheta:Pr.diff=1;this.Add_Box(Pr,"d"+String.fromCharCode(952));break}if(oIntegral&&oSelectedContent)oIntegral.getBase().private_FillSelectedContent(oSelectedContent)}; CMathContent.prototype.private_LoadFromMenuLargeOperator=function(Type,Pr,oSelectedContent){var oOperator=null;switch(Type){case c_oAscMathType.LargeOperator_Sum:oOperator=this.Add_LargeOperator(1,NARY_UndOvr,true,true,Pr.ctrPrp,null,null,null);break;case c_oAscMathType.LargeOperator_Sum_CenterSubSup:oOperator=this.Add_LargeOperator(1,NARY_UndOvr,false,false,Pr.ctrPrp,null,null,null);break;case c_oAscMathType.LargeOperator_Sum_SubSup:oOperator=this.Add_LargeOperator(1,NARY_SubSup,false,false,Pr.ctrPrp, null,null,null);break;case c_oAscMathType.LargeOperator_Sum_CenterSub:oOperator=this.Add_LargeOperator(1,NARY_UndOvr,true,false,Pr.ctrPrp,null,null,null);break;case c_oAscMathType.LargeOperator_Sum_Sub:oOperator=this.Add_LargeOperator(1,NARY_SubSup,true,false,Pr.ctrPrp,null,null,null);break;case c_oAscMathType.LargeOperator_Prod:oOperator=this.Add_LargeOperator(2,NARY_UndOvr,true,true,Pr.ctrPrp,null,null,null);break;case c_oAscMathType.LargeOperator_Prod_CenterSubSup:oOperator=this.Add_LargeOperator(2, NARY_UndOvr,false,false,Pr.ctrPrp,null,null,null);break;case c_oAscMathType.LargeOperator_Prod_SubSup:oOperator=this.Add_LargeOperator(2,NARY_SubSup,false,false,Pr.ctrPrp,null,null,null);break;case c_oAscMathType.LargeOperator_Prod_CenterSub:oOperator=this.Add_LargeOperator(2,NARY_UndOvr,true,false,Pr.ctrPrp,null,null,null);break;case c_oAscMathType.LargeOperator_Prod_Sub:oOperator=this.Add_LargeOperator(2,NARY_SubSup,true,false,Pr.ctrPrp,null,null,null);break;case c_oAscMathType.LargeOperator_CoProd:oOperator= this.Add_LargeOperator(3,NARY_UndOvr,true,true,Pr.ctrPrp,null,null,null);break;case c_oAscMathType.LargeOperator_CoProd_CenterSubSup:oOperator=this.Add_LargeOperator(3,NARY_UndOvr,false,false,Pr.ctrPrp,null,null,null);break;case c_oAscMathType.LargeOperator_CoProd_SubSup:oOperator=this.Add_LargeOperator(3,NARY_SubSup,false,false,Pr.ctrPrp,null,null,null);break;case c_oAscMathType.LargeOperator_CoProd_CenterSub:oOperator=this.Add_LargeOperator(3,NARY_UndOvr,true,false,Pr.ctrPrp,null,null,null);break; case c_oAscMathType.LargeOperator_CoProd_Sub:oOperator=this.Add_LargeOperator(3,NARY_SubSup,true,false,Pr.ctrPrp,null,null,null);break;case c_oAscMathType.LargeOperator_Union:oOperator=this.Add_LargeOperator(4,NARY_UndOvr,true,true,Pr.ctrPrp,null,null,null);break;case c_oAscMathType.LargeOperator_Union_CenterSubSup:oOperator=this.Add_LargeOperator(4,NARY_UndOvr,false,false,Pr.ctrPrp,null,null,null);break;case c_oAscMathType.LargeOperator_Union_SubSup:oOperator=this.Add_LargeOperator(4,NARY_SubSup, false,false,Pr.ctrPrp,null,null,null);break;case c_oAscMathType.LargeOperator_Union_CenterSub:oOperator=this.Add_LargeOperator(4,NARY_UndOvr,true,false,Pr.ctrPrp,null,null,null);break;case c_oAscMathType.LargeOperator_Union_Sub:oOperator=this.Add_LargeOperator(4,NARY_SubSup,true,false,Pr.ctrPrp,null,null,null);break;case c_oAscMathType.LargeOperator_Intersection:oOperator=this.Add_LargeOperator(5,NARY_UndOvr,true,true,Pr.ctrPrp,null,null,null);break;case c_oAscMathType.LargeOperator_Intersection_CenterSubSup:oOperator= this.Add_LargeOperator(5,NARY_UndOvr,false,false,Pr.ctrPrp,null,null,null);break;case c_oAscMathType.LargeOperator_Intersection_SubSup:oOperator=this.Add_LargeOperator(5,NARY_SubSup,false,false,Pr.ctrPrp,null,null,null);break;case c_oAscMathType.LargeOperator_Intersection_CenterSub:oOperator=this.Add_LargeOperator(5,NARY_UndOvr,true,false,Pr.ctrPrp,null,null,null);break;case c_oAscMathType.LargeOperator_Intersection_Sub:oOperator=this.Add_LargeOperator(5,NARY_SubSup,true,false,Pr.ctrPrp,null,null, null);break;case c_oAscMathType.LargeOperator_Disjunction:oOperator=this.Add_LargeOperator(6,NARY_UndOvr,true,true,Pr.ctrPrp,null,null,null);break;case c_oAscMathType.LargeOperator_Disjunction_CenterSubSup:oOperator=this.Add_LargeOperator(6,NARY_UndOvr,false,false,Pr.ctrPrp,null,null,null);break;case c_oAscMathType.LargeOperator_Disjunction_SubSup:oOperator=this.Add_LargeOperator(6,NARY_SubSup,false,false,Pr.ctrPrp,null,null,null);break;case c_oAscMathType.LargeOperator_Disjunction_CenterSub:oOperator= this.Add_LargeOperator(6,NARY_UndOvr,true,false,Pr.ctrPrp,null,null,null);break;case c_oAscMathType.LargeOperator_Disjunction_Sub:oOperator=this.Add_LargeOperator(6,NARY_SubSup,true,false,Pr.ctrPrp,null,null,null);break;case c_oAscMathType.LargeOperator_Conjunction:oOperator=this.Add_LargeOperator(7,NARY_UndOvr,true,true,Pr.ctrPrp,null,null,null);break;case c_oAscMathType.LargeOperator_Conjunction_CenterSubSup:oOperator=this.Add_LargeOperator(7,NARY_UndOvr,false,false,Pr.ctrPrp,null,null,null);break; case c_oAscMathType.LargeOperator_Conjunction_SubSup:oOperator=this.Add_LargeOperator(7,NARY_SubSup,false,false,Pr.ctrPrp,null,null,null);break;case c_oAscMathType.LargeOperator_Conjunction_CenterSub:oOperator=this.Add_LargeOperator(7,NARY_UndOvr,true,false,Pr.ctrPrp,null,null,null);break;case c_oAscMathType.LargeOperator_Conjunction_Sub:oOperator=this.Add_LargeOperator(7,NARY_SubSup,true,false,Pr.ctrPrp,null,null,null);break;case c_oAscMathType.LargeOperator_Custom_1:var Sum=this.Add_LargeOperator(1, NARY_UndOvr,true,false,Pr.ctrPrp,null,null,"k");var BaseMathContent=Sum.getBaseMathContent();var Delimiter=BaseMathContent.Add_Delimiter({ctrPrp:Pr.ctrPrp,column:1},1,[null]);var DelimiterMathContent=Delimiter.getElementMathContent(0);DelimiterMathContent.Add_Fraction({ctrPrp:Pr.ctrPrp,type:NO_BAR_FRACTION},"n","k");break;case c_oAscMathType.LargeOperator_Custom_2:this.Add_LargeOperator(1,NARY_UndOvr,false,false,Pr.ctrPrp,null,"n","i=0");break;case c_oAscMathType.LargeOperator_Custom_3:var Sum=this.Add_LargeOperator(1, NARY_UndOvr,true,false,Pr.ctrPrp,null,null,null);var SubMathContent=Sum.getSubMathContent();SubMathContent.Add_EqArray({ctrPrp:Pr.ctrPrp,row:2},2,["0\u2264 i \u2264 m","0< j < n"]);var BaseMathContent=Sum.getBaseMathContent();BaseMathContent.Add_Text("P",this.Paragraph);BaseMathContent.Add_Delimiter({ctrPrp:Pr.ctrPrp,column:1},1,["i, j"]);break;case c_oAscMathType.LargeOperator_Custom_4:var Prod=this.Add_LargeOperator(2,NARY_UndOvr,false,false,Pr.ctrPrp,null,"n","k=1");var BaseMathContent=Prod.getBaseMathContent(); BaseMathContent.Add_Script(false,{ctrPrp:Pr.ctrPrp,type:DEGREE_SUBSCRIPT},"A",null,"k");break;case c_oAscMathType.LargeOperator_Custom_5:var Union=this.Add_LargeOperator(4,NARY_UndOvr,false,false,Pr.ctrPrp,null,"m","n=1");var BaseMathContent=Union.getBaseMathContent();var Delimiter=BaseMathContent.Add_Delimiter({ctrPrp:Pr.ctrPrp,column:1},1,[null]);BaseMathContent=Delimiter.getElementMathContent(0);BaseMathContent.Add_Script(false,{ctrPrp:Pr.ctrPrp,type:DEGREE_SUBSCRIPT},"X",null,"n");BaseMathContent.Add_Text(String.fromCharCode(8745), this.Paragraph);BaseMathContent.Add_Script(false,{ctrPrp:Pr.ctrPrp,type:DEGREE_SUBSCRIPT},"Y",null,"n");break}if(oOperator&&oSelectedContent)oOperator.getBase().private_FillSelectedContent(oSelectedContent)};CMathContent.prototype.private_LoadFromMenuBracket=function(Type,Pr,oSelectedContent){var oBracket=null;var oFraction=null;switch(Type){case c_oAscMathType.Bracket_Round:oBracket=this.Add_DelimiterEx(Pr.ctrPrp,1,[null],null,null);break;case c_oAscMathType.Bracket_Square:oBracket=this.Add_DelimiterEx(Pr.ctrPrp, 1,[null],91,93);break;case c_oAscMathType.Bracket_Curve:oBracket=this.Add_DelimiterEx(Pr.ctrPrp,1,[null],123,125);break;case c_oAscMathType.Bracket_Angle:oBracket=this.Add_DelimiterEx(Pr.ctrPrp,1,[null],10216,10217);break;case c_oAscMathType.Bracket_LowLim:oBracket=this.Add_DelimiterEx(Pr.ctrPrp,1,[null],8970,8971);break;case c_oAscMathType.Bracket_UppLim:oBracket=this.Add_DelimiterEx(Pr.ctrPrp,1,[null],8968,8969);break;case c_oAscMathType.Bracket_Line:oBracket=this.Add_DelimiterEx(Pr.ctrPrp,1,[null], 124,124);break;case c_oAscMathType.Bracket_LineDouble:oBracket=this.Add_DelimiterEx(Pr.ctrPrp,1,[null],8214,8214);break;case c_oAscMathType.Bracket_Square_OpenOpen:oBracket=this.Add_DelimiterEx(Pr.ctrPrp,1,[null],91,91);break;case c_oAscMathType.Bracket_Square_CloseClose:oBracket=this.Add_DelimiterEx(Pr.ctrPrp,1,[null],93,93);break;case c_oAscMathType.Bracket_Square_CloseOpen:oBracket=this.Add_DelimiterEx(Pr.ctrPrp,1,[null],93,91);break;case c_oAscMathType.Bracket_SquareDouble:oBracket=this.Add_DelimiterEx(Pr.ctrPrp, 1,[null],10214,10215);break;case c_oAscMathType.Bracket_Round_Delimiter_2:oBracket=this.Add_DelimiterEx(Pr.ctrPrp,2,[null,null],null,null);break;case c_oAscMathType.Bracket_Curve_Delimiter_2:oBracket=this.Add_DelimiterEx(Pr.ctrPrp,2,[null,null],123,125);break;case c_oAscMathType.Bracket_Angle_Delimiter_2:oBracket=this.Add_DelimiterEx(Pr.ctrPrp,2,[null,null],10216,10217);break;case c_oAscMathType.Bracket_Angle_Delimiter_3:oBracket=this.Add_DelimiterEx(Pr.ctrPrp,3,[null,null,null],10216,10217);break; case c_oAscMathType.Bracket_Round_OpenNone:oBracket=this.Add_DelimiterEx(Pr.ctrPrp,1,[null],null,-1);break;case c_oAscMathType.Bracket_Round_NoneOpen:oBracket=this.Add_DelimiterEx(Pr.ctrPrp,1,[null],-1,null);break;case c_oAscMathType.Bracket_Square_OpenNone:oBracket=this.Add_DelimiterEx(Pr.ctrPrp,1,[null],91,-1);break;case c_oAscMathType.Bracket_Square_NoneOpen:oBracket=this.Add_DelimiterEx(Pr.ctrPrp,1,[null],-1,93);break;case c_oAscMathType.Bracket_Curve_OpenNone:oBracket=this.Add_DelimiterEx(Pr.ctrPrp, 1,[null],123,-1);break;case c_oAscMathType.Bracket_Curve_NoneOpen:oBracket=this.Add_DelimiterEx(Pr.ctrPrp,1,[null],-1,125);break;case c_oAscMathType.Bracket_Angle_OpenNone:oBracket=this.Add_DelimiterEx(Pr.ctrPrp,1,[null],10216,-1);break;case c_oAscMathType.Bracket_Angle_NoneOpen:oBracket=this.Add_DelimiterEx(Pr.ctrPrp,1,[null],-1,10217);break;case c_oAscMathType.Bracket_LowLim_OpenNone:oBracket=this.Add_DelimiterEx(Pr.ctrPrp,1,[null],8970,-1);break;case c_oAscMathType.Bracket_LowLim_NoneNone:oBracket= this.Add_DelimiterEx(Pr.ctrPrp,1,[null],-1,8971);break;case c_oAscMathType.Bracket_UppLim_OpenNone:oBracket=this.Add_DelimiterEx(Pr.ctrPrp,1,[null],8968,-1);break;case c_oAscMathType.Bracket_UppLim_NoneOpen:oBracket=this.Add_DelimiterEx(Pr.ctrPrp,1,[null],-1,8969);break;case c_oAscMathType.Bracket_Line_OpenNone:oBracket=this.Add_DelimiterEx(Pr.ctrPrp,1,[null],124,-1);break;case c_oAscMathType.Bracket_Line_NoneOpen:oBracket=this.Add_DelimiterEx(Pr.ctrPrp,1,[null],-1,124);break;case c_oAscMathType.Bracket_LineDouble_OpenNone:oBracket= this.Add_DelimiterEx(Pr.ctrPrp,1,[null],8214,-1);break;case c_oAscMathType.Bracket_LineDouble_NoneOpen:oBracket=this.Add_DelimiterEx(Pr.ctrPrp,1,[null],-1,8214);break;case c_oAscMathType.Bracket_SquareDouble_OpenNone:oBracket=this.Add_DelimiterEx(Pr.ctrPrp,1,[null],10214,-1);break;case c_oAscMathType.Bracket_SquareDouble_NoneOpen:oBracket=this.Add_DelimiterEx(Pr.ctrPrp,1,[null],-1,10215);break;case c_oAscMathType.Bracket_Custom_1:var Delimiter=this.Add_DelimiterEx(Pr.ctrPrp,1,[null],123,-1);var BaseMathContent= Delimiter.getElementMathContent(0);oBracket=BaseMathContent.Add_EqArray({ctrPrp:Pr.ctrPrp,row:2},2,[null,null]);break;case c_oAscMathType.Bracket_Custom_2:var Delimiter=this.Add_DelimiterEx(Pr.ctrPrp,1,[null],123,-1);var BaseMathContent=Delimiter.getElementMathContent(0);oBracket=BaseMathContent.Add_EqArray({ctrPrp:Pr.ctrPrp,row:3},3,[null,null,null]);break;case c_oAscMathType.Bracket_Custom_3:oFraction=this.Add_Fraction({ctrPrp:Pr.ctrPrp,type:NO_BAR_FRACTION},null,null);break;case c_oAscMathType.Bracket_Custom_4:var Delimiter= this.Add_DelimiterEx(Pr.ctrPrp,1,[null],null,null);var BaseMathContent=Delimiter.getElementMathContent(0);oFraction=BaseMathContent.Add_Fraction({ctrPrp:Pr.ctrPrp,type:NO_BAR_FRACTION},null,null);break;case c_oAscMathType.Bracket_Custom_5:this.Add_Text("f",this.Paragraph);this.Add_DelimiterEx(Pr.ctrPrp,1,["x"],null,null);this.Add_Text("=",this.Paragraph);var Delimiter=this.Add_DelimiterEx(Pr.ctrPrp,1,[null],123,-1);var BaseMathContent=Delimiter.getElementMathContent(0);oBracket=BaseMathContent.Add_EqArray({ctrPrp:Pr.ctrPrp, row:2},2,["-x, &x<0","x, &x"+String.fromCharCode(8805)+"0"]);break;case c_oAscMathType.Bracket_Custom_6:var Delimiter=this.Add_DelimiterEx(Pr.ctrPrp,1,[null],null,null);var BaseMathContent=Delimiter.getElementMathContent(0);BaseMathContent.Add_Fraction({ctrPrp:Pr.ctrPrp,type:NO_BAR_FRACTION},"n","k");break;case c_oAscMathType.Bracket_Custom_7:var Delimiter=this.Add_DelimiterEx(Pr.ctrPrp,1,[null],10216,10217);var BaseMathContent=Delimiter.getElementMathContent(0);BaseMathContent.Add_Fraction({ctrPrp:Pr.ctrPrp, type:NO_BAR_FRACTION},"n","k");break}if(oBracket&&oSelectedContent)oBracket.getElementMathContent(0).private_FillSelectedContent(oSelectedContent);else if(oFraction&&oSelectedContent)oFraction.getNumeratorMathContent().private_FillSelectedContent(oSelectedContent)};CMathContent.prototype.private_LoadFromMenuFunction=function(Type,Pr,oSelectedContent){var oFunction=null;switch(Type){case c_oAscMathType.Function_Sin:oFunction=this.Add_Function(Pr,"sin",null);break;case c_oAscMathType.Function_Cos:oFunction= this.Add_Function(Pr,"cos",null);break;case c_oAscMathType.Function_Tan:oFunction=this.Add_Function(Pr,"tan",null);break;case c_oAscMathType.Function_Csc:oFunction=this.Add_Function(Pr,"csc",null);break;case c_oAscMathType.Function_Sec:oFunction=this.Add_Function(Pr,"sec",null);break;case c_oAscMathType.Function_Cot:oFunction=this.Add_Function(Pr,"cot",null);break;case c_oAscMathType.Function_1_Sin:oFunction=this.Add_Function_1(Pr,"sin",null);break;case c_oAscMathType.Function_1_Cos:oFunction=this.Add_Function_1(Pr, "cos",null);break;case c_oAscMathType.Function_1_Tan:oFunction=this.Add_Function_1(Pr,"tan",null);break;case c_oAscMathType.Function_1_Csc:oFunction=this.Add_Function_1(Pr,"csc",null);break;case c_oAscMathType.Function_1_Sec:oFunction=this.Add_Function_1(Pr,"sec",null);break;case c_oAscMathType.Function_1_Cot:oFunction=this.Add_Function_1(Pr,"cot",null);break;case c_oAscMathType.Function_Sinh:oFunction=this.Add_Function(Pr,"sinh",null);break;case c_oAscMathType.Function_Cosh:oFunction=this.Add_Function(Pr, "cosh",null);break;case c_oAscMathType.Function_Tanh:oFunction=this.Add_Function(Pr,"tanh",null);break;case c_oAscMathType.Function_Csch:oFunction=this.Add_Function(Pr,"csch",null);break;case c_oAscMathType.Function_Sech:oFunction=this.Add_Function(Pr,"sech",null);break;case c_oAscMathType.Function_Coth:oFunction=this.Add_Function(Pr,"coth",null);break;case c_oAscMathType.Function_1_Sinh:oFunction=this.Add_Function_1(Pr,"sinh",null);break;case c_oAscMathType.Function_1_Cosh:oFunction=this.Add_Function_1(Pr, "cosh",null);break;case c_oAscMathType.Function_1_Tanh:oFunction=this.Add_Function_1(Pr,"tanh",null);break;case c_oAscMathType.Function_1_Csch:oFunction=this.Add_Function_1(Pr,"csch",null);break;case c_oAscMathType.Function_1_Sech:oFunction=this.Add_Function_1(Pr,"sech",null);break;case c_oAscMathType.Function_1_Coth:oFunction=this.Add_Function_1(Pr,"coth",null);break;case c_oAscMathType.Function_Custom_1:this.Add_Function(Pr,"sin",String.fromCharCode(952));break;case c_oAscMathType.Function_Custom_2:this.Add_Function(Pr, "cos","2x");break;case c_oAscMathType.Function_Custom_3:var Theta=String.fromCharCode(952);this.Add_Function(Pr,"tan",Theta);this.Add_Text("=",this.Paragraph);var Fraction=this.Add_Fraction(Pr,null,null);var NumMathContent=Fraction.getNumeratorMathContent();var DenMathContent=Fraction.getDenominatorMathContent();NumMathContent.Add_Function(Pr,"sin",Theta);DenMathContent.Add_Function(Pr,"cos",Theta);break}if(oFunction&&oSelectedContent)oFunction.getArgument().private_FillSelectedContent(oSelectedContent)}; CMathContent.prototype.private_LoadFromMenuAccent=function(Type,Pr,oSelectedContent){var oAccent=null;switch(Type){case c_oAscMathType.Accent_Dot:oAccent=this.Add_Accent(Pr.ctrPrp,775,null);break;case c_oAscMathType.Accent_DDot:oAccent=this.Add_Accent(Pr.ctrPrp,776,null);break;case c_oAscMathType.Accent_DDDot:oAccent=this.Add_Accent(Pr.ctrPrp,8411,null);break;case c_oAscMathType.Accent_Hat:oAccent=this.Add_Accent(Pr.ctrPrp,null,null);break;case c_oAscMathType.Accent_Check:oAccent=this.Add_Accent(Pr.ctrPrp, 780,null);break;case c_oAscMathType.Accent_Accent:oAccent=this.Add_Accent(Pr.ctrPrp,769,null);break;case c_oAscMathType.Accent_Grave:oAccent=this.Add_Accent(Pr.ctrPrp,768,null);break;case c_oAscMathType.Accent_Smile:oAccent=this.Add_Accent(Pr.ctrPrp,774,null);break;case c_oAscMathType.Accent_Tilde:oAccent=this.Add_Accent(Pr.ctrPrp,771,null);break;case c_oAscMathType.Accent_Bar:oAccent=this.Add_Accent(Pr.ctrPrp,773,null);break;case c_oAscMathType.Accent_DoubleBar:oAccent=this.Add_Accent(Pr.ctrPrp, 831,null);break;case c_oAscMathType.Accent_CurveBracketTop:oAccent=this.Add_GroupCharacter({ctrPrp:Pr.ctrPrp,chr:9182,pos:VJUST_TOP,vertJc:VJUST_BOT},null);break;case c_oAscMathType.Accent_CurveBracketBot:oAccent=this.Add_GroupCharacter({ctrPrp:Pr.ctrPrp},null);break;case c_oAscMathType.Accent_GroupTop:var Limit=this.Add_Limit({ctrPrp:Pr.ctrPrp,type:LIMIT_UP},null,null);var MathContent=Limit.getFName();oAccent=MathContent.Add_GroupCharacter({ctrPrp:Pr.ctrPrp,chr:9182,pos:VJUST_TOP,vertJc:VJUST_BOT}, null);break;case c_oAscMathType.Accent_GroupBot:var Limit=this.Add_Limit({ctrPrp:Pr.ctrPrp,type:LIMIT_LOW},null,null);var MathContent=Limit.getFName();oAccent=MathContent.Add_GroupCharacter({ctrPrp:Pr.ctrPrp},null);break;case c_oAscMathType.Accent_ArrowL:oAccent=this.Add_Accent(Pr.ctrPrp,8406,null);break;case c_oAscMathType.Accent_ArrowR:oAccent=this.Add_Accent(Pr.ctrPrp,8407,null);break;case c_oAscMathType.Accent_ArrowD:oAccent=this.Add_Accent(Pr.ctrPrp,8417,null);break;case c_oAscMathType.Accent_HarpoonL:oAccent= this.Add_Accent(Pr.ctrPrp,8400,null);break;case c_oAscMathType.Accent_HarpoonR:oAccent=this.Add_Accent(Pr.ctrPrp,8401,null);break;case c_oAscMathType.Accent_BorderBox:oAccent=this.Add_BorderBox(Pr,null);break;case c_oAscMathType.Accent_BorderBoxCustom:var BorderBox=this.Add_BorderBox(Pr,null);var MathContent=BorderBox.getBase();MathContent.Add_Script(false,{ctrPrp:Pr.ctrPrp,type:DEGREE_SUPERSCRIPT},"a","2",null);MathContent.Add_Text("=",this.Paragraph);MathContent.Add_Script(false,{ctrPrp:Pr.ctrPrp, type:DEGREE_SUPERSCRIPT},"b","2",null);MathContent.Add_Text("+",this.Paragraph);MathContent.Add_Script(false,{ctrPrp:Pr.ctrPrp,type:DEGREE_SUPERSCRIPT},"c","2",null);break;case c_oAscMathType.Accent_BarTop:oAccent=this.Add_Bar({ctrPrp:Pr.ctrPrp,pos:LOCATION_TOP},null);break;case c_oAscMathType.Accent_BarBot:oAccent=this.Add_Bar({ctrPrp:Pr.ctrPrp,pos:LOCATION_BOT},null);break;case c_oAscMathType.Accent_Custom_1:this.Add_Bar({ctrPrp:Pr.ctrPrp,pos:LOCATION_TOP},"A");break;case c_oAscMathType.Accent_Custom_2:this.Add_Bar({ctrPrp:Pr.ctrPrp, pos:LOCATION_TOP},"ABC");break;case c_oAscMathType.Accent_Custom_3:this.Add_Bar({ctrPrp:Pr.ctrPrp,pos:LOCATION_TOP},"x"+String.fromCharCode(8853)+"y");break}if(oAccent&&oSelectedContent)oAccent.getBase().private_FillSelectedContent(oSelectedContent)};CMathContent.prototype.private_LoadFromMenuLimitLog=function(Type,Pr,oSelectedContent){var oFunction=null;switch(Type){case c_oAscMathType.LimitLog_LogBase:oFunction=this.Add_Function(Pr,null,null);var MathContent=oFunction.getFName();var Script=MathContent.Add_Script(false, {ctrPrp:Pr.ctrPrp,type:DEGREE_SUBSCRIPT},null,null,null);MathContent=Script.getBase();MathContent.Add_Text("log",this.Paragraph,STY_PLAIN);break;case c_oAscMathType.LimitLog_Log:oFunction=this.Add_Function(Pr,"log",null);break;case c_oAscMathType.LimitLog_Lim:oFunction=this.Add_FunctionWithLimit(Pr,"lim",null,null);break;case c_oAscMathType.LimitLog_Min:oFunction=this.Add_FunctionWithLimit(Pr,"min",null,null);break;case c_oAscMathType.LimitLog_Max:oFunction=this.Add_FunctionWithLimit(Pr,"max",null, null);break;case c_oAscMathType.LimitLog_Ln:oFunction=this.Add_Function(Pr,"ln",null);break;case c_oAscMathType.LimitLog_Custom_1:var Function=this.Add_FunctionWithLimit(Pr,"lim","n"+String.fromCharCode(8594,8734),null);var MathContent=Function.getArgument();var Script=MathContent.Add_Script(false,{ctrPrp:Pr.ctrPrp,type:DEGREE_SUPERSCRIPT},null,"n",null);MathContent=Script.getBase();var Delimiter=MathContent.Add_Delimiter({ctrPrp:Pr.ctrPrp,column:1},1,[null]);MathContent=Delimiter.getElementMathContent(0); MathContent.Add_Text("1+",this.Paragraph);MathContent.Add_Fraction({ctrPrp:Pr.ctrPrp},"1","n");break;case c_oAscMathType.LimitLog_Custom_2:var Function=this.Add_FunctionWithLimit(Pr,"max","0"+String.fromCharCode(8804)+"x"+String.fromCharCode(8804)+"1",null);var MathContent=Function.getArgument();MathContent.Add_Text("x",this.Paragraph);var Script=MathContent.Add_Script(false,{ctrPrp:Pr.ctrPrp,type:DEGREE_SUPERSCRIPT},"e",null,null);MathContent=Script.getUpperIterator();MathContent.Add_Text("-",this.Paragraph); MathContent.Add_Script(false,{ctrPrp:Pr.ctrPrp,type:DEGREE_SUPERSCRIPT},"x","2",null);break}if(oFunction&&oSelectedContent)oFunction.getArgument().private_FillSelectedContent(oSelectedContent)};CMathContent.prototype.private_LoadFromMenuOperator=function(Type,Pr,oSelectedContent){var oAccent=null;switch(Type){case c_oAscMathType.Operator_ColonEquals:this.Add_Box({ctrPrp:Pr.ctrPrp,opEmu:1},String.fromCharCode(8788));break;case c_oAscMathType.Operator_EqualsEquals:this.Add_Box({ctrPrp:Pr.ctrPrp,opEmu:1}, "==");break;case c_oAscMathType.Operator_PlusEquals:this.Add_Box({ctrPrp:Pr.ctrPrp,opEmu:1},"+=");break;case c_oAscMathType.Operator_MinusEquals:this.Add_Box({ctrPrp:Pr.ctrPrp,opEmu:1},"-=");break;case c_oAscMathType.Operator_Definition:this.Add_Box({ctrPrp:Pr.ctrPrp,opEmu:1},String.fromCharCode(8797));break;case c_oAscMathType.Operator_UnitOfMeasure:this.Add_Box({ctrPrp:Pr.ctrPrp,opEmu:1},String.fromCharCode(8798));break;case c_oAscMathType.Operator_DeltaEquals:this.Add_Box({ctrPrp:Pr.ctrPrp,opEmu:1}, String.fromCharCode(8796));break;case c_oAscMathType.Operator_ArrowL_Top:oAccent=this.Add_BoxWithGroupChar({ctrPrp:Pr.ctrPrp,opEmu:1},VJUST_TOP,8592,null);break;case c_oAscMathType.Operator_ArrowR_Top:oAccent=this.Add_BoxWithGroupChar({ctrPrp:Pr.ctrPrp,opEmu:1},VJUST_TOP,8594,null);break;case c_oAscMathType.Operator_ArrowL_Bot:oAccent=this.Add_BoxWithGroupChar({ctrPrp:Pr.ctrPrp,opEmu:1},VJUST_BOT,8592,null);break;case c_oAscMathType.Operator_ArrowR_Bot:oAccent=this.Add_BoxWithGroupChar({ctrPrp:Pr.ctrPrp, opEmu:1},VJUST_BOT,8594,null);break;case c_oAscMathType.Operator_DoubleArrowL_Top:oAccent=this.Add_BoxWithGroupChar({ctrPrp:Pr.ctrPrp,opEmu:1},VJUST_TOP,8656,null);break;case c_oAscMathType.Operator_DoubleArrowR_Top:oAccent=this.Add_BoxWithGroupChar({ctrPrp:Pr.ctrPrp,opEmu:1},VJUST_TOP,8658,null);break;case c_oAscMathType.Operator_DoubleArrowL_Bot:oAccent=this.Add_BoxWithGroupChar({ctrPrp:Pr.ctrPrp,opEmu:1},VJUST_BOT,8656,null);break;case c_oAscMathType.Operator_DoubleArrowR_Bot:oAccent=this.Add_BoxWithGroupChar({ctrPrp:Pr.ctrPrp, opEmu:1},VJUST_BOT,8658,null);break;case c_oAscMathType.Operator_ArrowD_Top:oAccent=this.Add_BoxWithGroupChar({ctrPrp:Pr.ctrPrp,opEmu:1},VJUST_TOP,8596,null);break;case c_oAscMathType.Operator_ArrowD_Bot:oAccent=this.Add_BoxWithGroupChar({ctrPrp:Pr.ctrPrp,opEmu:1},VJUST_BOT,8596,null);break;case c_oAscMathType.Operator_DoubleArrowD_Top:oAccent=this.Add_BoxWithGroupChar({ctrPrp:Pr.ctrPrp,opEmu:1},VJUST_TOP,8660,null);break;case c_oAscMathType.Operator_DoubleArrowD_Bot:oAccent=this.Add_BoxWithGroupChar({ctrPrp:Pr.ctrPrp, opEmu:1},VJUST_BOT,8660,null);break;case c_oAscMathType.Operator_Custom_1:this.Add_BoxWithGroupChar({ctrPrp:Pr.ctrPrp,opEmu:1},VJUST_BOT,8594,"yields");break;case c_oAscMathType.Operator_Custom_2:this.Add_BoxWithGroupChar({ctrPrp:Pr.ctrPrp,opEmu:1},VJUST_BOT,8594,String.fromCharCode(8710));break}if(oAccent&&oSelectedContent)oAccent.getBase().private_FillSelectedContent(oSelectedContent)};CMathContent.prototype.private_LoadFromMenuMatrix=function(Type,Pr,oSelectedContent){var oMatrix=null;switch(Type){case c_oAscMathType.Matrix_1_2:oMatrix= this.Add_Matrix(Pr.ctrPrp,1,2,false,[]);break;case c_oAscMathType.Matrix_2_1:oMatrix=this.Add_Matrix(Pr.ctrPrp,2,1,false,[]);break;case c_oAscMathType.Matrix_1_3:oMatrix=this.Add_Matrix(Pr.ctrPrp,1,3,false,[]);break;case c_oAscMathType.Matrix_3_1:oMatrix=this.Add_Matrix(Pr.ctrPrp,3,1,false,[]);break;case c_oAscMathType.Matrix_2_2:oMatrix=this.Add_Matrix(Pr.ctrPrp,2,2,false,[]);break;case c_oAscMathType.Matrix_2_3:oMatrix=this.Add_Matrix(Pr.ctrPrp,2,3,false,[]);break;case c_oAscMathType.Matrix_3_2:oMatrix= this.Add_Matrix(Pr.ctrPrp,3,2,false,[]);break;case c_oAscMathType.Matrix_3_3:oMatrix=this.Add_Matrix(Pr.ctrPrp,3,3,false,[]);break;case c_oAscMathType.Matrix_Dots_Center:this.Add_Text(String.fromCharCode(8943),this.Paragraph);break;case c_oAscMathType.Matrix_Dots_Baseline:this.Add_Text(String.fromCharCode(8230),this.Paragraph);break;case c_oAscMathType.Matrix_Dots_Vertical:this.Add_Text(String.fromCharCode(8942),this.Paragraph);break;case c_oAscMathType.Matrix_Dots_Diagonal:this.Add_Text(String.fromCharCode(8945), this.Paragraph);break;case c_oAscMathType.Matrix_Identity_2:this.Add_Matrix(Pr.ctrPrp,2,2,false,["1","0","0","1"]);break;case c_oAscMathType.Matrix_Identity_2_NoZeros:this.Add_Matrix(Pr.ctrPrp,2,2,true,["1",null,null,"1"]);break;case c_oAscMathType.Matrix_Identity_3:this.Add_Matrix(Pr.ctrPrp,3,3,false,["1","0","0","0","1","0","0","0","1"]);break;case c_oAscMathType.Matrix_Identity_3_NoZeros:this.Add_Matrix(Pr.ctrPrp,3,3,true,["1",null,null,null,"1",null,null,null,"1"]);break;case c_oAscMathType.Matrix_2_2_RoundBracket:oMatrix= this.Add_MatrixWithBrackets(null,null,Pr.ctrPrp,2,2,false,[]);break;case c_oAscMathType.Matrix_2_2_SquareBracket:oMatrix=this.Add_MatrixWithBrackets(91,93,Pr.ctrPrp,2,2,false,[]);break;case c_oAscMathType.Matrix_2_2_LineBracket:oMatrix=this.Add_MatrixWithBrackets(124,124,Pr.ctrPrp,2,2,false,[]);break;case c_oAscMathType.Matrix_2_2_DLineBracket:oMatrix=this.Add_MatrixWithBrackets(8214,8214,Pr.ctrPrp,2,2,false,[]);break;case c_oAscMathType.Matrix_Flat_Round:this.Add_MatrixWithBrackets(null,null,Pr.ctrPrp, 3,3,false,[null,String.fromCharCode(8943),null,String.fromCharCode(8942),String.fromCharCode(8945),String.fromCharCode(8942),null,String.fromCharCode(8943),null]);break;case c_oAscMathType.Matrix_Flat_Square:this.Add_MatrixWithBrackets(91,93,Pr.ctrPrp,3,3,false,[null,String.fromCharCode(8943),null,String.fromCharCode(8942),String.fromCharCode(8945),String.fromCharCode(8942),null,String.fromCharCode(8943),null]);break}if(oMatrix)oMatrix.getContentElement(0,0).private_FillSelectedContent(oSelectedContent)}; CMathContent.prototype.private_LoadFromMenuDefaultText=function(Type,Pr,oSelectedContent){if(oSelectedContent)this.private_FillSelectedContent(oSelectedContent)};CMathContent.prototype.private_FillSelectedContent=function(oSelectedContent){if(oSelectedContent instanceof ParaMath)oSelectedContent.Root.CopyTo(this,false);else if(oSelectedContent)this.Add_Text(oSelectedContent,this.Paragraph)};CMathContent.prototype.Add_Element=function(Element){this.Internal_Content_Add(this.CurPos,Element,false);this.CurPos++}; CMathContent.prototype.Add_Text=function(sText,Paragraph,MathStyle){this.Paragraph=Paragraph;if(sText){var MathRun=new ParaRun(this.Paragraph,true);for(var nCharPos=0,nTextLen=sText.length;nCharPos=0&&this.CurPos0||true!==bStart&&nPos0){ContentPos.Add(nPos-1);this.Content[nPos-1].Get_EndPos(false,ContentPos,ContentPos.Get_Depth()+1)}else{ContentPos.Add(nPos+1);this.Content[nPos+ 1].Get_StartPos(ContentPos,ContentPos.Get_Depth()+1)}else{ContentPos.Add(nPos);if(undefined!==this.Content[nPos])this.Content[nPos].Get_ParaContentPos(bSelection,bStart,ContentPos,bUseCorrection)}}else{var nPos=true!==bSelection?this.CurPos:false!==bStart?this.Selection.StartPos:this.Selection.EndPos;nPos=Math.max(0,Math.min(nPos,this.Content.length-1));ContentPos.Add(nPos);if(undefined!==this.Content[nPos])this.Content[nPos].Get_ParaContentPos(bSelection,bStart,ContentPos,bUseCorrection)}};CMathContent.prototype.Set_ParaContentPos= function(ContentPos,Depth){var CurPos=ContentPos.Get(Depth);if(undefined===CurPos||CurPos<0){this.CurPos=0;if(this.Content[this.CurPos])this.Content[this.CurPos].MoveCursorToStartPos()}else if(CurPos>this.Content.length-1){this.CurPos=this.Content.length-1;if(this.Content[this.CurPos])this.Content[this.CurPos].MoveCursorToEndPos(false)}else{this.CurPos=CurPos;if(this.Content[this.CurPos])this.Content[this.CurPos].Set_ParaContentPos(ContentPos,Depth+1)}};CMathContent.prototype.IsSelectionEmpty=function(){if(true!== this.Selection.Use)return true;if(this.Selection.StartPos===this.Selection.EndPos)return this.Content[this.Selection.StartPos].IsSelectionEmpty();return false};CMathContent.prototype.GetSelectContent=function(isAll){if(true===isAll)return{Content:this,Start:0,End:this.Content.length-1};else if(false===this.Selection.Use)if(para_Math_Composition===this.Content[this.CurPos].Type)return this.Content[this.CurPos].GetSelectContent();else return{Content:this,Start:this.CurPos,End:this.CurPos};else{var StartPos= this.Selection.StartPos;var EndPos=this.Selection.EndPos;if(StartPos>EndPos){StartPos=this.Selection.EndPos;EndPos=this.Selection.StartPos}if(StartPos===EndPos&¶_Math_Composition===this.Content[StartPos].Type&&true===this.Content[StartPos].Is_InnerSelection())return this.Content[StartPos].GetSelectContent();return{Content:this,Start:StartPos,End:EndPos}}};CMathContent.prototype.Get_LeftPos=function(SearchPos,ContentPos,Depth,UseContentPos){if(true!==this.ParentElement.Is_ContentUse(this))return false; if(false===UseContentPos&¶_Math_Run===this.Content[this.Content.length-1].Type){var CurPos=this.Content.length-1;this.Content[CurPos].Get_EndPos(false,SearchPos.Pos,Depth+1);SearchPos.Pos.Update(CurPos,Depth);SearchPos.Found=true;return true}var CurPos=UseContentPos?ContentPos.Get(Depth):this.Content.length-1;var bStepStart=false;if(CurPos>0||!this.Content[0].Cursor_Is_Start())bStepStart=true;this.Content[CurPos].Get_LeftPos(SearchPos,ContentPos,Depth+1,UseContentPos);SearchPos.Pos.Update(CurPos, Depth);if(true===SearchPos.Found)return true;CurPos--;if(true===UseContentPos&¶_Math_Composition===this.Content[CurPos+1].Type){this.Content[CurPos].Get_EndPos(false,SearchPos.Pos,Depth+1);SearchPos.Pos.Update(CurPos,Depth);SearchPos.Found=true;return true}while(CurPos>=0){this.Content[CurPos].Get_LeftPos(SearchPos,ContentPos,Depth+1,false);SearchPos.Pos.Update(CurPos,Depth);if(true===SearchPos.Found)return true;CurPos--}if(true===bStepStart){this.Content[0].Get_StartPos(SearchPos.Pos,Depth+1); SearchPos.Pos.Update(0,Depth);SearchPos.Found=true;return true}return false};CMathContent.prototype.Get_RightPos=function(SearchPos,ContentPos,Depth,UseContentPos,StepEnd){if(true!==this.ParentElement.Is_ContentUse(this))return false;if(false===UseContentPos&¶_Math_Run===this.Content[0].Type){this.Content[0].Get_StartPos(SearchPos.Pos,Depth+1);SearchPos.Pos.Update(0,Depth);SearchPos.Found=true;return true}var CurPos=true===UseContentPos?ContentPos.Get(Depth):0;var Count=this.Content.length;var bStepEnd= false;if(CurPos0||!this.Content[0].Cursor_Is_Start())bStepStart=true;this.Content[CurPos].Get_WordStartPos(SearchPos,ContentPos,Depth+1,UseContentPos);if(true===SearchPos.UpdatePos)SearchPos.Pos.Update(CurPos,Depth); if(true===SearchPos.Found)return;CurPos--;var bStepStartRun=false;if(true===UseContentPos&¶_Math_Composition===this.Content[CurPos+1].Type){this.Content[CurPos].Get_EndPos(false,SearchPos.Pos,Depth+1);SearchPos.Pos.Update(CurPos,Depth);SearchPos.Found=true;SearchPos.UpdatePos=true;return true}else if(para_Math_Run===this.Content[CurPos+1].Type&&true===SearchPos.Shift)bStepStartRun=true;while(CurPos>=0){if(true!==bStepStartRun||para_Math_Run===this.Content[CurPos].Type){var OldUpdatePos=SearchPos.UpdatePos; this.Content[CurPos].Get_WordStartPos(SearchPos,ContentPos,Depth+1,false);if(true===SearchPos.UpdatePos)SearchPos.Pos.Update(CurPos,Depth);else SearchPos.UpdatePos=OldUpdatePos;if(true===SearchPos.Found)return;if(true===SearchPos.Shift)bStepStartRun=true}else{this.Content[CurPos+1].Get_StartPos(SearchPos.Pos,Depth+1);SearchPos.Pos.Update(CurPos+1,Depth);SearchPos.Found=true;SearchPos.UpdatePos=true;return true}CurPos--}if(true===bStepStart){this.Content[0].Get_StartPos(SearchPos.Pos,Depth+1);SearchPos.Pos.Update(0, Depth);SearchPos.Found=true;SearchPos.UpdatePos=true;return true}};CMathContent.prototype.Get_WordEndPos=function(SearchPos,ContentPos,Depth,UseContentPos,StepEnd){if(true!==this.ParentElement.Is_ContentUse(this))return false;if(false===UseContentPos&¶_Math_Run===this.Content[0].Type){this.Content[0].Get_StartPos(SearchPos.Pos,Depth+1);SearchPos.Pos.Update(0,Depth);SearchPos.Found=true;SearchPos.UpdatePos=true;return true}var CurPos=true===UseContentPos?ContentPos.Get(Depth):0;var Count=this.Content.length; var bStepEnd=false;if(CurPos0&&this.Content[StartPos].IsShade()==false;if(FirstRunInRootNotShd||this.bRoot==false){Y0=Bound.Y;Y1=Bound.Y+Bound.H}for(var CurPos=StartPos;CurPos<=EndPos;CurPos++){PDSH.Y0=Y0;PDSH.Y1=Y1;if(bAll&&this.Content[CurPos].Type==para_Math_Run)this.Content[CurPos].SelectAll();this.Content[CurPos].Draw_HighLights(PDSH, bAll)}};CMathContent.prototype.Draw_Lines=function(PDSL){var CurLine=PDSL.Line-this.StartLine;var CurRange=0===CurLine?PDSL.Range-this.StartRange:PDSL.Range;var StartPos=this.protected_GetRangeStartPos(CurLine,CurRange);var EndPos=this.protected_GetRangeEndPos(CurLine,CurRange);var Bound=this.Get_LineBound(PDSL.Line,PDSL.Range);var Baseline=Bound.Y+Bound.Asc;PDSL.Baseline=Baseline;PDSL.X=Bound.X;for(var CurPos=StartPos;CurPos<=EndPos;CurPos++){this.Content[CurPos].Draw_Lines(PDSL);PDSL.Baseline=Baseline}}; CMathContent.prototype.RemoveSelection=function(){var StartPos=this.Selection.StartPos;var EndPos=this.Selection.EndPos;if(StartPos>EndPos){StartPos=this.Selection.EndPos;EndPos=this.Selection.StartPos}StartPos=Math.max(0,StartPos);EndPos=Math.min(this.Content.length-1,EndPos);for(var nPos=StartPos;nPos<=EndPos;nPos++)this.Content[nPos].RemoveSelection();this.Selection.Use=false;this.Selection.StartPos=0;this.Selection.EndPos=0};CMathContent.prototype.SelectAll=function(Direction){this.Selection.Use= true;this.Selection.StartPos=0;this.Selection.EndPos=this.Content.length-1;for(var nPos=0,nCount=this.Content.length;nPosSelectionEndPos){SelectionStartPos=this.Selection.EndPos;SelectionEndPos=this.Selection.StartPos}var SelectionUse=this.Selection.Use; var CurLine=_CurLine-this.StartLine;var CurRange=0===CurLine?_CurRange-this.StartRange:_CurRange;var StartPos=this.protected_GetRangeStartPos(CurLine,CurRange);var EndPos=this.protected_GetRangeEndPos(CurLine,CurRange);if(this.bRoot==false){var Bound=this.Get_LineBound(_CurLine,_CurRange);SelectionDraw.StartY=Bound.Y;SelectionDraw.H=Bound.H}for(var CurPos=StartPos;CurPos<=EndPos;CurPos++){var Item=this.Content[CurPos];var bSelectAll=SelectionUse&&SelectionStartPos<=CurPos&&CurPos<=SelectionEndPos&& SelectionStartPos!==SelectionEndPos;if(Item.Type==para_Math_Composition&&bSelectAll){SelectionDraw.FindStart=false;SelectionDraw.W+=Item.Get_Width(_CurLine,_CurRange)}else Item.Selection_DrawRange(_CurLine,_CurRange,SelectionDraw)}};CMathContent.prototype.Select_ElementByPos=function(nPos,bWhole){this.Selection.Use=true;this.Selection.StartPos=nPos;this.Selection.EndPos=nPos;this.Content[nPos].SelectAll();if(bWhole)this.Correct_Selection();if(!this.bRoot)this.ParentElement.Select_MathContent(this); else this.ParaMath.bSelectionUse=true};CMathContent.prototype.Select_Element=function(Element,bWhole){var nPos=-1;for(var nCurPos=0,nCount=this.Content.length;nCurPosnEndPos){var nTemp=nStartPos;nStartPos=nEndPos;nEndPos=nTemp}var oStartElement=this.Content[nStartPos];if(para_Math_Run!==oStartElement.Type){this.Selection.StartPos=nStartPos-1;this.Content[this.Selection.StartPos].Set_SelectionAtEndPos()}var oEndElement=this.Content[nEndPos]; if(para_Math_Run!==oEndElement.Type){this.Selection.EndPos=nEndPos+1;this.Content[this.Selection.EndPos].Set_SelectionAtStartPos()}};CMathContent.prototype.Create_FontMap=function(Map){for(var nIndex=0,nCount=this.Content.length;nIndexbEndPos){var temp=bStartPos;bStartPos=bEndPos;bEndPos=temp}if(bStartPosPRS.XEnd){PRS.NewRange=true;PRS.MoveToLBP=true}}else{var _Depth=PRS.PosEndRun.Depth;var PrevLastPos=PRS.PosEndRun.Get(_Depth- 1),LastPos=PRS.PosEndRun.Get(_Depth);var PrevWord=PRS.Word,MathFirstItem=PRS.MathFirstItem;PRS.bInsideOper=false;Item.Recalculate_Range(PRS,ParaPr,Depth+1);if(Type==para_Math_Composition){if(Item.kind==MATH_BOX){PRS.MathFirstItem=MathFirstItem;if(true==Item.IsForcedBreak()){this.private_ForceBreakBox(PRS,Item,_Depth,PrevLastPos,LastPos);PRS.bBreakBox=true}else if(true==Item.IsOperatorEmulator()){this.private_BoxOperEmulator(PRS,Item,_Depth,PrevLastPos,LastPos);PRS.bBreakBox=true}else{PRS.WordLen+= Item.size.width;PRS.Word=true;if(PRS.X+PRS.SpaceLen+PRS.WordLen>PRS.XEnd)if(PRS.FirstItemOnLine==false){PRS.MoveToLBP=true;PRS.NewRange=true;this.ParaMath.UpdateWidthLine(PRS,PRS.X-PRS.XRange)}else PRS.bMathWordLarge=true}PRS.MathFirstItem=false}else{if(PRS.X+PRS.SpaceLen+PRS.WordLen>PRS.XEnd)if(PRS.FirstItemOnLine==false){PRS.MoveToLBP=true;PRS.NewRange=true;this.ParaMath.UpdateWidthLine(PRS,PRS.X-PRS.XRange)}else PRS.bMathWordLarge=true;if(bCurInsideOper==true&&PrevWord==false&&bOperBefore==false&& bNoOneBreakOperator==false&&PRS.bInsideOper==false){PRS.Update_CurPos(PrevLastPos,_Depth-1);PRS.Set_LineBreakPos(LastPos);if(PRS.NewRange==true)PRS.MoveToLBP=true}PRS.Word=true}if(PRS.NewRange==false&&0===CurRange&&0===CurLine){var PrevRecalcInfo=PRS.RunRecalcInfoLast,NumberingAdd;if(null===PrevRecalcInfo)NumberingAdd=true;else NumberingAdd=PrevRecalcInfo.NumberingAdd;if(NumberingAdd){PRS.X=PRS.Recalculate_Numbering(Item,this,ParaPr,PRS.X);PRS.RunRecalcInfoLast.NumberingAdd=false;PRS.RunRecalcInfoLast.NumberingUse= true;PRS.RunRecalcInfoLast.NumberingItem=PRS.Paragraph.Numbering}}}else{if(PRS.MathFirstItem==true&&false==Item.IsEmptyRange(PRS.Line,PRS.Range))PRS.MathFirstItem=false;var CheckWrapIndent=PRS.bFirstLine==true?PRS.X-PRS.XRange>PRS.WrapIndent:true;if(PRS.bInsideOper==true&&CheckWrapIndent==true)PRS.bOnlyForcedBreak=true}bCurInsideOper=bCurInsideOper||PRS.bInsideOper}if(true===PRS.NewRange){RangeEndPos=Pos;break}}PRS.bInsideOper=PRS.bInsideOper||bCurInsideOper;PRS.bOnlyForcedBreak=bOnlyForcedBreak; if(Pos>=ContentLen)RangeEndPos=Pos-1;var bSingleBarFraction=false;for(var Pos=0;PosPRS.WrapIndent:true;var bOperBefore=this.ParaMath.Is_BrkBinBefore()==true;var bOnlyForcedBreakBefore=bOperBefore==true&&PRS.MathFirstItem==false,bOnlyforcedBreakAfter=bOperBefore==false;if(CheckWrapIndent==true&&(bOnlyForcedBreakBefore||bOnlyforcedBreakAfter))PRS.bOnlyForcedBreak=true;var bOverXEnd;if(bOperBefore){bOverXEnd=PRS.X+PRS.WordLen+PRS.SpaceLen>PRS.XEnd;if(true==PRS.MathFirstItem)PRS.WordLen+= PRS.SpaceLen+PRS.WordLen+BoxLen;else if(PRS.FirstItemOnLine==false&&bOverXEnd){PRS.MoveToLBP=true;PRS.NewRange=true;this.ParaMath.UpdateWidthLine(PRS,PRS.X-PRS.XRange)}else{PRS.X+=PRS.SpaceLen+PRS.WordLen;PRS.bInsideOper=true;PRS.FirstItemOnLine=false;PRS.Update_CurPos(PrevLastPos,_Depth-1);PRS.Set_LineBreakPos(LastPos);PRS.SpaceLen=BoxLen;PRS.WordLen=0;PRS.Word=true}}else{bOverXEnd=PRS.X+PRS.SpaceLen+PRS.WordLen+BoxLen-BoxGapRight>PRS.XEnd;PRS.OperGapRight=BoxGapRight;if(PRS.FirstItemOnLine==false&& bOverXEnd){PRS.MoveToLBP=true;PRS.NewRange=true;this.ParaMath.UpdateWidthLine(PRS,PRS.X-PRS.XRange)}else PRS.bInsideOper=true;PRS.X+=PRS.SpaceLen+PRS.WordLen+BoxLen;PRS.SpaceLen=0;PRS.WordLen=0;PRS.Word=false;PRS.FirstItemOnLine=false}};CMathContent.prototype.Math_Set_EmptyRange=function(_CurLine,_CurRange){var CurLine=_CurLine-this.StartLine;var CurRange=0===CurLine?_CurRange-this.StartRange:_CurRange;var RangeStartPos=this.protected_AddRange(CurLine,CurRange);var RangeEndPos=RangeStartPos;this.protected_FillRange(CurLine, CurRange,RangeStartPos,RangeEndPos);this.Content[RangeStartPos].Math_Set_EmptyRange(_CurLine,_CurRange)};CMathContent.prototype.Recalculate_Reset=function(StartRange,StartLine,PRS){var bNotUpdate=PRS!==null&&PRS!==undefined&&PRS.bFastRecalculate==true;if(bNotUpdate==false){this.StartLine=StartLine;this.StartRange=StartRange;if(this.Content.length>0)this.Content[0].Recalculate_Reset(StartRange,StartLine,PRS);this.protected_ClearLines()}};CMathContent.prototype.IsEmptyRange=function(_CurLine,_CurRange){var CurLine= _CurLine-this.StartLine;var CurRange=0===CurLine?_CurRange-this.StartRange:_CurRange;var StartPos=this.protected_GetRangeStartPos(CurLine,CurRange);var EndPos=this.protected_GetRangeEndPos(CurLine,CurRange);var bEmpty=true;if(StartPos==EndPos)bEmpty=this.Content[StartPos].IsEmptyRange(_CurLine,_CurRange);else{var Pos=StartPos;while(Pos<=EndPos){if(false==this.Content[Pos].IsEmptyRange(_CurLine,_CurRange)){bEmpty=false;break}Pos++}}return bEmpty};CMathContent.prototype.Displace_BreakOperator=function(isForward, bBrkBefore,CountOperators){var Pos=this.CurPos;if(this.Content[Pos].Type==para_Math_Run){var bApplyBreak=this.Content[Pos].Displace_BreakOperator(isForward,bBrkBefore,CountOperators);var NewPos=bBrkBefore?Pos+1:Pos-1;if(this.Content[NewPos]&&bApplyBreak==false&&(this.Content[NewPos].Type==para_Math_Run||this.Content[NewPos].kind==MATH_BOX))this.Content[NewPos].Displace_BreakOperator(isForward,bBrkBefore,CountOperators)}else this.Content[Pos].Displace_BreakOperator(isForward,bBrkBefore,CountOperators)}; CMathContent.prototype.Recalculate_Range_Width=function(PRSC,_CurLine,_CurRange){var RangeW=PRSC.Range.W;var CurLine=_CurLine-this.StartLine;var CurRange=0===CurLine?_CurRange-this.StartRange:_CurRange;var StartPos=this.protected_GetRangeStartPos(CurLine,CurRange);var EndPos=this.protected_GetRangeEndPos(CurLine,CurRange);for(var CurPos=StartPos;CurPos<=EndPos;CurPos++)this.Content[CurPos].Recalculate_Range_Width(PRSC,_CurLine,_CurRange);this.Bounds.SetWidth(CurLine,CurRange,PRSC.Range.W-RangeW)}; CMathContent.prototype.RecalculateMinMaxContentWidth=function(MinMax){if(this.RecalcInfo.bEqArray)this.InfoPoints.SetDefault();var ascent=0,descent=0;this.size.width=0;var Lng=this.Content.length;for(var Pos=0;Pos0&&this.Content[EndPos-1].kind==MATH_BOX;var bCheckPrevNextBox=bRunEmptyRange==true&&bPrevBox==true&&bBrkBefore==false;if(bCheckPrevNextBox)AlnAt=this.Content[EndPos-1].Get_AlignBrk(_CurLine,bBrkBefore);else if(bCheckNextBox)AlnAt=this.Content[EndPos+1].Get_AlignBrk(_CurLine,bBrkBefore);else AlnAt=this.Content[EndPos].Get_AlignBrk(_CurLine,bBrkBefore)}return AlnAt}; CMathContent.prototype.IsStartRange=function(Line,Range){return Line-this.StartLine==0&&Range-this.StartRange==0};CMathContent.prototype.IsStartLine=function(Line){return Line==this.StartLine};CMathContent.prototype.GetSelectDirection=function(){if(true!==this.Selection.Use)return 0;if(this.Selection.StartPosthis.Selection.EndPos)return-1;return this.Content[this.Selection.StartPos].GetSelectDirection()};CMathContent.prototype.MoveCursorToStartPos= function(){this.CurPos=0;this.Content[0].MoveCursorToStartPos()};CMathContent.prototype.MoveCursorToEndPos=function(SelectFromEnd){this.CurPos=this.Content.length-1;this.Content[this.CurPos].MoveCursorToEndPos(SelectFromEnd)};CMathContent.prototype.Check_Composition=function(){var Pos=this.private_FindCurrentPosInContent();return Pos!==null&&this.Content[Pos].Type==para_Math_Composition};CMathContent.prototype.Can_ModifyForcedBreak=function(Pr){var Pos=this.private_GetPosRunForForcedBreak();if(Pos!== null&&this.bOneLine==false){var bBreakOperator=this.Content[Pos].Check_ForcedBreak();var CurrentRun=this.Content[Pos];var bCanCheckNearsRun=bBreakOperator==false&&false==CurrentRun.IsSelectionUse();var bPrevItem=bCanCheckNearsRun&&Pos>0&&true==CurrentRun.Cursor_Is_Start(),bNextItem=bCanCheckNearsRun&&PosEndPos){StartPos=this.Selection.EndPos;EndPos=this.Selection.StartPos}var bHaveSelectedItem=false;for(var CurPos=StartPos;CurPos<=EndPos;CurPos++){var Item= this.Content[CurPos];var bSelect=true!==Item.IsSelectionEmpty(),bSelectRun=bSelect==true&&Item.Type==para_Math_Run,bSelectComp=bSelect==true&&Item.Type==para_Math_Composition;var bSelectManyRuns=bSelectRun&&bHaveSelectedItem;if(bSelectComp||bSelectManyRuns){Pos=null;break}if(bSelectRun){bHaveSelectedItem=true;Pos=CurPos}}}else Pos=this.CurPos;return Pos};CMathContent.prototype.private_FindCurrentPosInContent=function(){var Pos=null;if(true===this.Selection.Use){var StartPos=this.Selection.StartPos, EndPos=this.Selection.EndPos;if(StartPos>EndPos){StartPos=this.Selection.EndPos;EndPos=this.Selection.StartPos}var bComposition=false;for(var CurPos=StartPos;CurPos<=EndPos;CurPos++){var Item=this.Content[CurPos];if(Item.Type==para_Math_Run&&true!==Item.IsSelectionEmpty()){Pos=bComposition==true?null:CurPos;break}else if(Item.Type==para_Math_Composition)if(bComposition==true){Pos=null;break}else{Pos=CurPos;bComposition=true}}}else Pos=this.CurPos;return Pos};CMathContent.prototype.Is_CurrentContent= function(){var Pos=this.private_FindCurrentPosInContent();return Pos==null||this.Content[Pos].Type==para_Math_Run};CMathContent.prototype.Set_MenuProps=function(Props){var Pos=this.private_FindCurrentPosInContent();if(true==this.Is_CurrentContent())this.Apply_MenuProps(Props,Pos);else if(false==this.private_IsMenuPropsForContent(Props.Action)&&true==this.Content[Pos].Can_ApplyMenuPropsToObject()){if(false===this.Delete_ItemToContentThroughInterface(Props,Pos))this.Content[Pos].Apply_MenuProps(Props)}else this.Content[Pos].Set_MenuProps(Props)}; CMathContent.prototype.Apply_MenuProps=function(Props,Pos){var ArgSize,NewArgSize;if(Props.Action&c_oMathMenuAction.IncreaseArgumentSize){if(true===this.Parent.Can_ModifyArgSize()&&true==this.Compiled_ArgSz.Can_Increase()&&true==this.ArgSize.Can_SimpleIncrease()){ArgSize=this.ArgSize.GetValue();NewArgSize=this.ArgSize.Increase();History.Add(new CChangesMathContentArgSize(this,ArgSize,NewArgSize));this.Recalc_RunsCompiledPr()}}else if(Props.Action&c_oMathMenuAction.DecreaseArgumentSize)if(true===this.Parent.Can_ModifyArgSize()&& true==this.Compiled_ArgSz.Can_Decrease()&&true==this.ArgSize.Can_Decrease()){ArgSize=this.ArgSize.GetValue();NewArgSize=this.ArgSize.Decrease();History.Add(new CChangesMathContentArgSize(this,ArgSize,NewArgSize));this.Recalc_RunsCompiledPr()}var Run;if(Pos!==null&&Props.Action&c_oMathMenuAction.InsertForcedBreak){Run=this.private_Get_RunForForcedBreak(Pos);Run.Set_MathForcedBreak(true)}else if(Pos!==null&&Props.Action&c_oMathMenuAction.DeleteForcedBreak){Run=this.private_Get_RunForForcedBreak(Pos); Run.Set_MathForcedBreak(false)}};CMathContent.prototype.private_Get_RunForForcedBreak=function(Pos){var CurrentRun=this.Content[Pos];var bCurrentForcedBreak=this.Content[Pos].Type==para_Math_Run&&true==CurrentRun.Check_ForcedBreak(),bPrevForcedBreak=Pos>0&&true==CurrentRun.Cursor_Is_Start(),bNextForcedBreak=Pos0){AutoCorrectEngine.StartHystory=true;var oParagraph=this.GetParagraph();var oLogicDocument=oParagraph?oParagraph.LogicDocument: null;if(oLogicDocument)oLogicDocument.StartAction(AscDFH.historydescription_Document_MathAutoCorrect);else History.Create_NewPoint(AscDFH.historydescription_Document_MathAutoCorrect);var MathRun=new ParaRun(this.Paragraph,true);MathRun.Set_Pr(AutoCorrectEngine.TextPr.Copy());MathRun.Set_MathPr(AutoCorrectEngine.MathPr);for(var i=0,Count=ReplaceChars.length;i0){LastEl=Elements[ElCount-nStringPos-2];if(LastEl.IsText()&&LastEl.value!==32)Found=false}}if(Found===true){var Start=ElCount-nStringPos;Elements.splice(Start+1,CheckStringLen);var Pr={ctrPrp:new CTextPr};var MathFunc=new CMathFunc(Pr);var MathContent=MathFunc.getFName();var MathRun=new ParaRun(this.Paragraph,true);for(var nCharPos=0,nTextLen=AutoCorrectElement.length;nCharPos< nTextLen;nCharPos++){var oText=null;if(38==AutoCorrectElement.charCodeAt(nCharPos))oText=new CMathAmp;else{oText=new CMathText(false);oText.addTxt(AutoCorrectElement[nCharPos])}MathRun.Add(oText,true)}MathRun.Math_Apply_Style(STY_PLAIN);MathContent.Internal_Content_Add(0,MathRun);Elements[Start]=MathFunc;return}}};CMathAutoCorrectEngine.prototype.private_FindBracketsSkip=function(Elements){var Pos=Elements.length-1;var BracketsR=[];var BracketsL=[];while(Pos>=0){var Elem=Elements[Pos].value;if(g_MathRightBracketAutoCorrectCharCodes[Elem]){BracketsR.push(Pos); Pos--;continue}else if(g_MathLeftBracketAutoCorrectCharCodes[Elem]){if(BracketsR.length=0&&g_aMathAutoCorrectSkipBrackets[Elements[Pos-1].value])BracketsL.push(Pos);else BracketsR.pop();Pos--;continue}Pos--}return[BracketsL,BracketsR]};CMathAutoCorrectEngine.prototype.private_AutoCorrectEquation=function(Elements){var Brackets=[];var CurPos=Elements.length-1;var Param={Type:null,Kind:null,Props:null,Bracket:this.private_FindBracketsSkip(Elements),bOff:false};var ElPos= [];var End=CurPos;while(CurPos>=0){var Elem=Elements[CurPos];if(Elem.value===undefined){CurPos--;continue}else if(Elem.value===47){if(Param.Type!==null){var tmp=null;if(Param.Type===MATH_DEGREESubSup)tmp=[Elements.splice(ElPos[1]+1,End-ElPos[1]),Elements.splice(ElPos[0]+1,ElPos[1]-ElPos[0]),Elements.splice(CurPos+1,ElPos[0]+1)];else tmp=[Elements.splice(ElPos[0]+1,End-ElPos[0]),Elements.splice(CurPos+1,ElPos[0]-CurPos)];this.private_CorrectEquation(Param,tmp);End=CurPos+1;Elements.splice(End,0,tmp[0])}if(CurPos- 1>0){var tmp=Elements[CurPos-1];if(tmp.Type===para_Math_BreakOperator&&tmp.value===92){ElPos[0]=CurPos;if(!Brackets[0]){Param.Type=MATH_FRACTION;Param.Props={type:LINEAR_FRACTION};CurPos-=2;continue}}}if(!Brackets[0]){Param.Type=MATH_FRACTION;Param.Props={}}ElPos[0]=CurPos;CurPos--;continue}else if(Elem.value===8260){if(Param.Type!==null){var tmp=null;if(Param.Type===MATH_DEGREESubSup)tmp=[Elements.splice(ElPos[1]+1,End-ElPos[1]),Elements.splice(ElPos[0]+1,ElPos[1]-ElPos[0]),Elements.splice(CurPos+ 1,ElPos[0]+1)];else tmp=[Elements.splice(ElPos[0]+1,End-ElPos[0]),Elements.splice(CurPos+1,ElPos[0]-CurPos)];this.private_CorrectEquation(Param,tmp);End=CurPos+1;Elements.splice(End,0,tmp[0])}if(!Brackets[0]){Param.Type=MATH_FRACTION;Param.Props={type:SKEWED_FRACTION}}ElPos[0]=CurPos;CurPos--;continue}else if(166===Elem.value){if(Param.Type!==null){var tmp=null;if(Param.Type===MATH_DEGREESubSup)tmp=[Elements.splice(ElPos[1]+1,End-ElPos[1]),Elements.splice(ElPos[0]+1,ElPos[1]-ElPos[0]),Elements.splice(CurPos+ 1,ElPos[0]+1)];else tmp=[Elements.splice(ElPos[0]+1,End-ElPos[0]),Elements.splice(CurPos+1,ElPos[0]-CurPos)];this.private_CorrectEquation(Param,tmp);End=CurPos+1;Elements.splice(End,0,tmp[0])}if(!Brackets[0]){Param.Type=MATH_FRACTION;Param.Props={type:NO_BAR_FRACTION}}ElPos[0]=CurPos;CurPos--;continue}else if(g_MathRightBracketAutoCorrectCharCodes[Elem.value]){if(Param.Type==MATH_DEGREE||Param.Type==MATH_DEGREESubSup)if(Elements[CurPos+1]&&(Elements[CurPos+1].value!=94&&Elements[CurPos+1].value!= 95)){var tmp=null;if(Param.Type==MATH_DEGREE)tmp=[Elements.splice(ElPos[0]+1,End-ElPos[0]),Elements.splice(CurPos+1,ElPos[0]-CurPos+1)];else tmp=[Elements.splice(ElPos[1]+1,End-ElPos[1]),Elements.splice(ElPos[0]+1,ElPos[1]-ElPos[0]),Elements.splice(CurPos+1,ElPos[0]-CurPos+1)];this.private_CorrectEquation(Param,tmp);Param.Type=null;Param.Props={};Param.Kind=null;ElPos=[];End=CurPos+1;Elements.splice(End,0,tmp[0])}Brackets.splice(0,0,CurPos);CurPos--;continue}else if(g_MathLeftBracketAutoCorrectCharCodes[Elem.value]){if(!Brackets[0])break; var fSkip=false;for(var i=Brackets[0]+1;i=0&&Param.Type!=MATH_DEGREESubSup){var tmp=Elements[CurPos-1];if(tmp.value=== 8289){bSkip=true;if(Param.Type==MATH_DEGREE&&Param.Kind!=DEGREE_SUPERSCRIPT){Param.Type=null;ElPos.unshift(CurPos)}else{Param.Kind=DEGREE_SUPERSCRIPT;ElPos[0]=CurPos}}}if(Param.Type==MATH_FRACTION||bSkip){CurPos--;continue}if(Param.Type!==null&&Param.Type!==MATH_DEGREE){var tmp=null;if(Param.Type==MATH_DEGREESubSup)tmp=[Elements.splice(ElPos[1]+1,End-ElPos[1]),Elements.splice(ElPos[0]+1,ElPos[1]-ElPos[0]),Elements.splice(CurPos+1,ElPos[0]-CurPos)];else tmp=[Elements.splice(ElPos[0]+1,End-ElPos[0]), Elements.splice(CurPos+1,ElPos[0]-CurPos)];this.private_CorrectEquation(Param,tmp);End=CurPos+1;+Elements.splice(End,0,tmp[0]);Param.Type=null;Param.Kind=null;Param.Props={};ElPos=[]}if(Param.Type==MATH_DEGREE&&Param.Kind==DEGREE_SUBSCRIPT){Param.Kind=DEGREE_SubSup;Param.Type=MATH_DEGREESubSup;ElPos[1]=ElPos[0]}else if(!Brackets[0]){Param.Kind=DEGREE_SUPERSCRIPT;Param.Type=MATH_DEGREE}ElPos[0]=CurPos;CurPos--;continue}else if(Elem.value===95){var bSkip=false;if(CurPos-1>=0&&Param.Type!=MATH_DEGREESubSup){var tmp= Elements[CurPos-1];if(tmp.value===8289){bSkip=true;if(Param.Type==MATH_DEGREE&&Param.Kind!=DEGREE_SUBSCRIPT){Param.Type=null;ElPos.unshift(CurPos)}else{Param.Kind=DEGREE_SUBSCRIPT;ElPos[0]=CurPos}}}if(Param.Type==MATH_FRACTION||bSkip){CurPos--;continue}if(Param.Type!==null&&Param.Type!==MATH_DEGREE){var tmp=null;if(Param.Type==MATH_DEGREESubSup)tmp=[Elements.splice(ElPos[1]+1,End-ElPos[1]),Elements.splice(ElPos[0]+1,ElPos[1]-ElPos[0]),Elements.splice(CurPos+1,ElPos[0]-CurPos)];else tmp=[Elements.splice(ElPos[0]+ 1,End-ElPos[0]),Elements.splice(CurPos+1,ElPos[0]-CurPos)];this.private_CorrectEquation(Param,tmp);End=CurPos+1;Elements.splice(End,0,tmp[0]);Param.Type=null;Param.Kind=null;Param.Props={};ElPos=[]}if(Param.Type==MATH_DEGREE&&Param.Kind==DEGREE_SUPERSCRIPT){Param.Kind=DEGREE_SubSup;Param.Type=MATH_DEGREESubSup;ElPos[1]=ElPos[0]}else if(!Brackets[0]){Param.Kind=DEGREE_SUBSCRIPT;Param.Type=MATH_DEGREE}ElPos[0]=CurPos;CurPos--;continue}else if(q_aMathAutoCorrectControlAggregationCodes[Elem.value]){if(Param.Type== MATH_FRACTION){CurPos--;continue}if(Param.Type!==null&&Param.Type!==MATH_DEGREESubSup&&Param.Type!==MATH_DEGREE){var tmp=[Elements.splice(ElPos[0]+1,End-ElPos[0]),Elements.splice(CurPos+1,ElPos[0]-CurPos)];this.private_CorrectEquation(Param,tmp);End=CurPos+1;Elements.splice(End,0,tmp[0])}if(!Brackets[0]){var tmp=null;if(Param.Type==MATH_DEGREE)tmp=[Elements.splice(ElPos[0],End-ElPos[0]+1),Elements.splice(CurPos,ElPos[0]-CurPos)];else if(Param.Type==MATH_DEGREESubSup)tmp=[Elements.splice(ElPos[1], End-ElPos[1]+1),Elements.splice(ElPos[0],ElPos[1]-ElPos[0]),Elements.splice(CurPos,ElPos[0]-CurPos)];else tmp=[Elements.splice(CurPos+1,End-CurPos),Elements.splice(CurPos,ElPos[0]-CurPos)];Param.Type=MATH_NARY;this.private_CorrectEquation(Param,tmp);End=CurPos;Elements.splice(End,0,tmp[0]);Param.Type=null;Param.Props={};Param.Kind=null;Param.bOff=false}CurPos--;continue}else if(g_aMathAutoCorrectRadicalCharCode[Elem.value]){if(Param.Type==MATH_FRACTION){CurPos--;continue}if(Param.Type!==null&&Param.Type!== MATH_DEGREE&&Param.Type!==MATH_DEGREESubSup){var tmp=[Elements.splice(ElPos[0]+1,End-ElPos[0]),Elements.splice(CurPos+1,ElPos[0]-CurPos)];this.private_CorrectEquation(Param,tmp);End=CurPos+1;Elements.splice(End,0,tmp[0])}if(!Brackets[0]){var tmp=[Elements.splice(CurPos+1,End-CurPos),Elements.splice(CurPos,1)];Param.Type=MATH_RADICAL;Param.Bracket[0][0]-=CurPos+1;Param.Bracket[1][0]-=CurPos+1;this.private_CorrectEquation(Param,tmp);End=CurPos;Elements.splice(End,0,tmp[0]);Param.Type=null;Param.Props= {};Param.Kind=null}CurPos--;continue}else if(Elem.value==9633||Elem.value==9645){if(Param.Type==MATH_FRACTION){CurPos--;continue}if(Param.Type!==null&&Param.Type!==MATH_DEGREE&&Param.Type!==MATH_DEGREESubSup){var tmp=[Elements.splice(ElPos[0]+1,End-ElPos[0]),Elements.splice(CurPos+1,ElPos[0]-CurPos)];this.private_CorrectEquation(Param,tmp);End=CurPos+1;Elements.splice(End,0,tmp[0])}if(!Brackets[0]){var tmp=[Elements.splice(CurPos+1,End-CurPos),Elements.splice(CurPos,1)];Param.Type=MATH_BOX;Param.Bracket[0][0]-= CurPos+1;Param.Bracket[1][0]-=CurPos+1;this.private_CorrectEquation(Param,tmp);End=CurPos;Elements.splice(End,0,tmp[0]);Param.Type=null;Param.Props={};Param.Kind=null}CurPos--;continue}else if(g_aMathAutoCorrectGroupChar[Elem.value]){if(Param.Type==MATH_FRACTION){CurPos--;continue}if(Param.Type!==null){var fSkip=false;var tmp=null;if(Param.Type===MATH_DEGREESubSup){tmp=[Elements.splice(ElPos[1]+1,End-ElPos[1]),Elements.splice(ElPos[0]+1,ElPos[1]-ElPos[0]),Elements.splice(CurPos,ElPos[0]-CurPos+1)]; fSkip=true}else if(Param.Type===MATH_DEGREE){tmp=[Elements.splice(ElPos[0],End-ElPos[0]+1),Elements.splice(CurPos+1,ElPos[0]-CurPos-1),Elements.splice(CurPos,1)];Param.Type=MATH_GROUP_CHARACTER;Param.Bracket[0][0]-=CurPos+1;Param.Bracket[1][0]-=CurPos+1;fSkip=true}else tmp=[Elements.splice(ElPos[0]+1,End-ElPos[0]),Elements.splice(CurPos+1,ElPos[0]-CurPos)];this.private_CorrectEquation(Param,tmp);if(fSkip){End=CurPos;Elements.splice(End,0,tmp[0]);CurPos--;Param.Type=null;Param.Props={};Param.Kind= null;continue}End=CurPos+1;Elements.splice(End,0,tmp[0])}if(!Brackets[0]){var tmp=[Elements.splice(CurPos+1,End-CurPos),Elements.splice(CurPos,1)];Param.Type=MATH_GROUP_CHARACTER;Param.Bracket[0][0]-=CurPos+1;Param.Bracket[1][0]-=CurPos+1;this.private_CorrectEquation(Param,tmp);End=CurPos;Elements.splice(End,0,tmp[0]);Param.Type=null;Param.Props={};Param.Kind=null}CurPos--;continue}else if(Elem.value===175||Elem.value===9601){if(Param.Type==MATH_FRACTION){CurPos--;continue}if(Param.Type!==null){var fSkip= false;var tmp=null;if(Param.Type===MATH_DEGREESubSup){tmp=[Elements.splice(ElPos[1]+1,End-ElPos[1]),Elements.splice(ElPos[0]+1,ElPos[1]-ElPos[0]),Elements.splice(CurPos,ElPos[0]-CurPos+1)];fSkip=true}else if(Param.Type===MATH_DEGREE){tmp=[Elements.splice(ElPos[0]+1,End-ElPos[0]),Elements.splice(CurPos,ElPos[0]-CurPos+1)];fSkip=true}else tmp=[Elements.splice(ElPos[0]+1,End-ElPos[0]),Elements.splice(CurPos+1,ElPos[0]-CurPos)];this.private_CorrectEquation(Param,tmp);if(fSkip){End=CurPos;Elements.splice(End, 0,tmp[0]);CurPos--;Param.Type=null;Param.Props={};Param.Kind=null;continue}End=CurPos+1;Elements.splice(End,0,tmp[0])}if(!Brackets[0]){var tmp=[Elements.splice(CurPos+1,End-CurPos),Elements.splice(CurPos,1)];Param.Type=MATH_BAR;Param.Bracket[0][0]-=CurPos+1;Param.Bracket[1][0]-=CurPos+1;this.private_CorrectEquation(Param,tmp);End=CurPos;Elements.splice(End,0,tmp[0]);Param.Type=null;Param.Props={};Param.Kind=null}CurPos--;continue}else if(g_aMathAutoCorrectEqArrayMatrix[Elem.value]){if(Param.Type== MATH_FRACTION){CurPos--;continue}if(Param.Type!==null){var fSkip=false;var tmp=null;if(Param.Type===MATH_DEGREESubSup){tmp=[Elements.splice(ElPos[1]+1,End-ElPos[1]),Elements.splice(ElPos[0]+1,ElPos[1]-ElPos[0]),Elements.splice(CurPos,ElPos[0]-CurPos+1)];fSkip=true}else if(Param.Type===MATH_DEGREE){tmp=[Elements.splice(ElPos[0]+1,End-ElPos[0]),Elements.splice(CurPos,ElPos[0]-CurPos+1)];fSkip=true}else if(Param.Type==MATH_LIMIT){tmp=[Elements.splice(ElPos[0]+1,End-ElPos[0]),Elements.splice(CurPos,ElPos[0]- CurPos+1)];fSkip=true}else tmp=[Elements.splice(ElPos[0]+1,End-ElPos[0]),Elements.splice(CurPos+1,ElPos[0]-CurPos)];this.private_CorrectEquation(Param,tmp);if(fSkip){End=CurPos;Elements.splice(End,0,tmp[0]);CurPos--;Param.Type=null;Param.Props={};Param.Kind=null;continue}End=CurPos+1;Elements.splice(End,0,tmp[0])}if(!Brackets[0]){tmp=[Elements.splice(CurPos+1,Param.Bracket[1][0]-CurPos),Elements.splice(CurPos,1)];Param.Type=MATH_MATRIX;Param.Bracket[0][0]-=CurPos+1;Param.Bracket[1][0]-=CurPos+1;this.private_CorrectEquation(Param, tmp);End=CurPos;Elements.splice(End,0,tmp[0]);Param.Type=null;Param.Props={};Param.Kind=null}CurPos--;continue}else if(q_aMathAutoCorrectAccentCharCodes[Elem.value]){if(Param.Type==MATH_FRACTION){CurPos--;continue}if(Param.Type!==null&&Param.Type!==MATH_DEGREE&&Param.Type!==MATH_DEGREESubSup){var tmp=[Elements.splice(ElPos[0]+1,End-ElPos[0]),Elements.splice(CurPos+1,ElPos[0]-CurPos)];this.private_CorrectEquation(Param,tmp);End=CurPos+1;Elements.splice(End,0,tmp[0])}if(!Brackets[0]){if(CurPos>=1){var tmpPos= CurPos;var tmpEl=Elements[CurPos-1];if(g_MathRightBracketAutoCorrectCharCodes[tmpEl.value]){var countR=1;tmpPos--;for(var i=CurPos-2;i>=0;i--){tmpEl=Elements[i];tmpPos--;if(g_MathRightBracketAutoCorrectCharCodes[tmpEl.value])countR++;if(g_MathLeftBracketAutoCorrectCharCodes[tmpEl.value]){countR--;if(!countR)break}}}else tmpPos--;if(tmpEl!==Elements[CurPos-1]&&countR){CurPos--;continue}}var fSkip=false;var tmp=null;if(Param.Type===MATH_DEGREESubSup){tmp=[Elements.splice(ElPos[1]+1,End-ElPos[1]),Elements.splice(ElPos[0]+ 1,ElPos[1]-ElPos[0]),Elements.splice(tmpPos,ElPos[0]-tmpPos+1)];fSkip=true}else if(Param.Type===MATH_DEGREE){tmp=[Elements.splice(ElPos[0]+1,End-ElPos[0]),Elements.splice(tmpPos,ElPos[0]-tmpPos+1)];fSkip=true}else tmp=[Elements.splice(CurPos,1),Elements.splice(tmpPos,CurPos-tmpPos)];if(fSkip){this.private_CorrectEquation(Param,tmp);CurPos=End=tmpPos;Elements.splice(End,0,tmp[0]);CurPos--;Param.Type=null;Param.Props={};Param.Kind=null;continue}Param.Type=MATH_ACCENT;this.private_CorrectEquation(Param, tmp);End=tmpPos;Elements.splice(End,0,tmp[0]);CurPos=End;Param.Type=null;Param.Props={};Param.Kind=null}CurPos--;continue}else if(Elem.value===9524||Elem.value===9516){if(Param.Type==MATH_FRACTION){CurPos--;continue}if(Param.Type!==null&&Param.Type!==MATH_DEGREESubSup&&Param.Type!==MATH_DEGREE){var tmp=[Elements.splice(ElPos[0]+1,End-ElPos[0]),Elements.splice(CurPos+1,ElPos[0]-CurPos)];this.private_CorrectEquation(Param,tmp);End=CurPos+1;Elements.splice(End,0,tmp[0])}if(!Brackets[0]){Param.Type=MATH_LIMIT; ElPos[0]=CurPos;Param.Props=Elem.value===9524?{type:LIMIT_UP}:{type:LIMIT_LOW}}CurPos--;continue}else if(Elem.value===8289){if(Param.Type!==MATH_FRACTION&&!Brackets[0]){if(Param.Type==MATH_DELIMITER)Param.Type=null;if(Param.Type!==null&&Param.Type!==MATH_DEGREE){var tmp=null;if(Param.Type===MATH_DEGREESubSup)tmp=[Elements.splice(ElPos[1]+1,End-ElPos[1]),Elements.splice(ElPos[0]+1,ElPos[1]-ElPos[0]),Elements.splice(CurPos,ElPos[0]-CurPos+1)];else tmp=[Elements.splice(ElPos[0]+1,End-ElPos[0]),Elements.splice(CurPos+ 1,ElPos[0]-CurPos)];this.private_CorrectEquation(Param,tmp);End=CurPos+1;Elements.splice(End,0,tmp[0])}var tmpPos=CurPos;CurPos--;while(CurPos>=0){Elem=Elements[CurPos];if(g_aMathAutoCorrectLatinAlph[Elem.value])CurPos--;else break}var tmp={arrName:null,arrSup:null,arrSub:null,arrArg:null};if(ElPos.length>1)if(Param.Kind==1){tmp.arrSup=Elements.splice(ElPos[1],End-ElPos[1]+1);tmp.arrSub=Elements.splice(ElPos[0],ElPos[1]-ElPos[0])}else{tmp.arrSub=Elements.splice(ElPos[1],End-ElPos[1]+1);tmp.arrSup= Elements.splice(ElPos[0],ElPos[1]-ElPos[0])}else if(ElPos.length)if(Param.Kind==1)tmp.arrSup=Elements.splice(ElPos[0],End-ElPos[0]+1);else tmp.arrSub=Elements.splice(ElPos[0],End-ElPos[0]+1);else tmp.arrArg=Elements.splice(tmpPos+1,End-tmpPos);tmp.arrName=Elements.splice(CurPos+1,tmpPos-CurPos);Param.Type=MATH_FUNCTION;this.private_CorrectEquation(Param,tmp);End=CurPos<0?0:CurPos+1;Elements.splice(End,0,tmp.arrName);Param.Type=null;Param.Props={};Param.Kind=null}else CurPos--;continue}else if(Elem.value=== 9618){if(Param.Type!==null){var tmp=null;if(Param.Type===MATH_DEGREESubSup)tmp=[Elements.splice(ElPos[1]+1,End-ElPos[1]),Elements.splice(ElPos[0]+1,ElPos[1]-ElPos[0]),Elements.splice(CurPos+1,ElPos[0]+1)];else tmp=[Elements.splice(ElPos[0]+1,End-ElPos[0]),Elements.splice(CurPos+1,ElPos[0]-CurPos)];this.private_CorrectEquation(Param,tmp);End=CurPos+1;Elements.splice(End,0,tmp[0]);Param.Type=null;Param.Props={};Param.Kind=null}Param.bOff=true;CurPos--;continue}else if(g_aMathAutoCorrectFracCharCodes[Elem.value]&& !Brackets[0]){if(Elem.value==92&&Param.Type==MATH_FRACTION){CurPos--;continue}if(Param.Type!==null){var tmp=null;if(Param.Type===MATH_DEGREESubSup)tmp=[Elements.splice(ElPos[1]+1,End-ElPos[1]),Elements.splice(ElPos[0]+1,ElPos[1]-ElPos[0]),Elements.splice(CurPos+1,ElPos[0]-CurPos)];else tmp=[Elements.splice(ElPos[0]+1,End-ElPos[0]),Elements.splice(CurPos+1,ElPos[0]-CurPos)];this.private_CorrectEquation(Param,tmp);Elements.splice(CurPos+1,0,tmp[0]);Param.Type=null;Param.Props={};Param.Kind=null;ElPos= []}End=CurPos-1}CurPos--}if(Brackets[0])return;if(Param.Type!==null){var tmp=null;if(Param.Type===MATH_DEGREESubSup)tmp=[Elements.splice(ElPos[1]+1,End-ElPos[1]),Elements.splice(ElPos[0]+1,ElPos[1]-ElPos[0]),Elements.splice(0,ElPos[0]+1)];else tmp=[Elements.splice(ElPos[0]+1,End-ElPos[0]),Elements.splice(0,ElPos[0]-CurPos)];this.private_CorrectEquation(Param,tmp);Elements.splice(0,0,tmp[0])}};CMathAutoCorrectEngine.prototype.private_CorrectEquation=function(Param,Elements){switch(Param.Type){case MATH_FRACTION:this.private_CorrectBuffForFrac(Elements, Param.Props);var props=new CMathFractionPr;props.Set_FromObject(Param.Props);props.ctrPrp=this.TextPr.Copy();var Fraction=new CFraction(props);var DenMathContent=Fraction.getDenominatorMathContent();var NumMathContent=Fraction.getNumeratorMathContent();this.private_PackTextToContent(DenMathContent,Elements[0],true);this.private_PackTextToContent(NumMathContent,Elements[1],true);Elements.splice(0,Elements.length,Fraction);break;case MATH_DEGREE:Elements[1].splice(Elements[1].length-1,1);var props= new CMathDegreePr;props.ctrPrp=this.TextPr.Copy();props.type=Param.Kind;var oDegree=new CDegree(props);var BaseContent=oDegree.Content[0];var IterContent=oDegree.Content[1];this.private_PackTextToContent(BaseContent,Elements[1],false);this.private_PackTextToContent(IterContent,Elements[0],true);Elements.splice(0,Elements.length,oDegree);break;case MATH_DEGREESubSup:var flag=Elements[1][Elements[1].length-1].value==94?true:false;Elements[1].splice(Elements[1].length-1,1);Elements[2].splice(Elements[2].length- 1,1);var props=new CMathDegreePr;props.ctrPrp=this.TextPr.Copy();props.type=Param.Kind;var oDegree=new CDegreeSubSup(props);var BaseContent=oDegree.Content[0];var IterDnContent=oDegree.Content[1];var IterUpContent=oDegree.Content[2];if(flag){this.private_PackTextToContent(IterUpContent,Elements[1],true);this.private_PackTextToContent(IterDnContent,Elements[0],true)}else{this.private_PackTextToContent(IterUpContent,Elements[0],true);this.private_PackTextToContent(IterDnContent,Elements[1],true)}this.private_PackTextToContent(BaseContent, Elements[2],false);Elements.splice(0,Elements.length,oDegree);break;case MATH_DELIMITER:var props=new CMathDelimiterPr;props.column=1;props.begChr=Elements.splice(0,1)[0].value;props.endChr=Elements.splice(Elements.length-1,1)[0].value;var oDelimiter=new CDelimiter(props);var oBase=oDelimiter.getBase();this.private_PackTextToContent(oBase,Elements,false);Elements.splice(0,Elements.length,oDelimiter);break;case MATH_NARY:var props={};props.supHide=true;props.subHide=true;props.chr=Elements.length== 1?Elements[0][0].value:Elements[Elements.length-1][0].value;this.private_CorrectBuffForNary(Elements);var arrBase=[];if(Param.bOff)for(var i=Elements[0].length-1;i>=0;i--){if(Elements[0][i].value==9618){Elements[0].pop();break}arrBase.unshift(Elements[0].pop())}if(Elements[0].Type){if(Elements[0].Type==DEGREE_SUPERSCRIPT&&Elements[0].length)props.supHide=false;if(Elements[0].Type==DEGREE_SUBSCRIPT&&Elements[0].length)props.subHide=false}if(Elements[1]){if(Elements[1].Type==DEGREE_SUPERSCRIPT&&Elements[1].length)props.supHide= false;if(Elements[1].Type==DEGREE_SUBSCRIPT&&Elements[1].length)props.subHide=false}props.ctrPrp=this.TextPr.Copy();var oNary=new CNary(props);var oSub=oNary.getLowerIterator();var oSup=oNary.getUpperIterator();var oBase=oNary.getBase();if(!props.supHide)if(Elements[0].Type==DEGREE_SUPERSCRIPT)this.private_PackTextToContent(oSup,Elements[0],true);else if(Elements[1].Type&&Elements[1].Type==DEGREE_SUPERSCRIPT)this.private_PackTextToContent(oSup,Elements[1],true);if(!props.subHide)if(Elements[0].Type== DEGREE_SUBSCRIPT)this.private_PackTextToContent(oSub,Elements[0],true);else if(Elements[1].Type&&Elements[1].Type==DEGREE_SUBSCRIPT)this.private_PackTextToContent(oSub,Elements[1],true);this.private_PackTextToContent(oBase,arrBase,true);Elements.splice(0,Elements.length,oNary);break;case MATH_RADICAL:Elements.splice(0,2,Elements[1].concat(Elements[0]));var props=new CMathRadicalPr;props.degHide=this.private_CorrectBuffForRadical(Elements,true,[Param.Bracket[0][0],Param.Bracket[1][0]]);props.ctrPrp= this.TextPr.Copy();var Radical=new CRadical(props);var Base=Radical.getBase();var Degree=Radical.getDegree();if(!props.degHide){this.private_PackTextToContent(Degree,Elements[0][1],false);this.private_PackTextToContent(Base,Elements[0][0],true)}else this.private_PackTextToContent(Base,Elements[0],true);Elements.splice(0,Elements.length,Radical);Param.Bracket[0].splice(0,1);Param.Bracket[1].splice(0,1);break;case MATH_BOX:var symbol=Elements.splice(1,1)[0][0].value;var props={};props.ctrPrp=this.TextPr.Copy(); var Box=symbol==9633?new CBox(props):new CBorderBox(props);var Base=Box.getBase();this.private_PackTextToContent(Base,Elements[0],true);Elements.splice(0,Elements.length,Box);Param.Bracket[0].splice(0,1);Param.Bracket[1].splice(0,1);break;case MATH_GROUP_CHARACTER:var degree=[];if(Param.Kind){degree=Elements.splice(0,1)[0];degree.splice(0,1)}var base=Elements.splice(0,1)[0];var symbol=Elements.splice(0,1)[0][0].value;var props={};switch(symbol){case 9184:case 9180:case 9182:props={chr:symbol,pos:LOCATION_TOP, vertJc:VJUST_BOT};break;case 9181:props={chr:symbol};break}props.ctrPrp=this.TextPr.Copy();var oGroupChr=new CGroupCharacter(props);var oBase=oGroupChr.getBase();this.private_PackTextToContent(oBase,base,true);if(degree.length){props={ctrPrp:this.TextPr.Copy(),type:Param.Kind==1?1:0};var Limit=new CLimit(props);var MathContent=Limit.getFName();MathContent.Add_Element(oGroupChr);MathContent=Limit.getIterator();this.private_PackTextToContent(MathContent,degree,true);Elements.splice(0,Elements.length, Limit)}else Elements.splice(0,Elements.length,oGroupChr);Param.Bracket[0].splice(0,1);Param.Bracket[1].splice(0,1);break;case MATH_BAR:var symbol=Elements.splice(1,1)[0][0].value;var props=symbol===175?{pos:LOCATION_TOP}:{};props.ctrPrp=this.TextPr.Copy();var oBar=new CBar(props);var oBase=oBar.getBase();this.private_PackTextToContent(oBase,Elements[0],true);Elements.splice(0,Elements.length,oBar);Param.Bracket[0].splice(0,1);Param.Bracket[1].splice(0,1);break;case MATH_MATRIX:var bEqArray=false; var symbol=Elements.splice(1,1)[0][0];if(symbol.value==9400||symbol.value==9608)bEqArray=true;var Del=null;switch(symbol.value){case 9400:var props=new CMathDelimiterPr;props.begChr=123;props.endChr=-1;props.column=1;Del=new CDelimiter(props);break;case 9384:var props=new CMathDelimiterPr;props.column=1;Del=new CDelimiter(props);break;case 9385:var props=new CMathDelimiterPr;props.column=1;props.begChr=8214;props.endChr=8214;Del=new CDelimiter(props);break}var Element=null;if(bEqArray){var arrContent= [];var row=0;arrContent[row]=[];if(Param.Bracket[0].length)for(var i=Param.Bracket[0][0]+1;imcs[0].count)mcs[0]={count:col+1,mcJc:0};arrContent[row][col]=[]}else if(oCurElem.value==64){row++;col=0;arrContent[row]= [];arrContent[row][col]=[]}else arrContent[row][col].push(oCurElem)}if(row<1&&Del&&bEqArray||row<1&&!bEqArray){Elements.splice(0,0,symbol);Param.Bracket[0].splice(0,1);Param.Bracket[1].splice(0,1);break}var props=new CMathMatrixPr;props.row=row+1;props.mcs=mcs;props.ctrPrp=this.TextPr.Copy();Element=new CMathMatrix(props);for(var i=0;i=2&&bReplaceBrackets)if(g_MathLeftBracketAutoCorrectCharCodes[TempElements[0].value]&&g_MathRightBracketAutoCorrectCharCodes[TempElements[len].value]){TempElements.splice(0,1);TempElements.length--}this.private_AutoCorrectEquation(TempElements);var bNewRun=true;var MathRun=null;var PosElemnt=0;var PosInRun=0;for(var nPos=0;nPosthis.Brackets[1]["left"][j].pos;i--)if(Elements[i])TempElements.splice(0, 0,Elements[i].Element);this.private_PackTextToContent(oBase,TempElements,false);this.Shift=Elements.length-1-this.Brackets[1]["right"][j].pos;if(this.ActionElement.value==32)this.Shift--;var nRemoveCount=this.Brackets[1]["right"][j].pos-this.Brackets[1]["left"][j].pos+1;if(CanMakeAutoCorrect)nRemoveCount+=this.Remove[0].Count;else if(this.ActionElement.value==32&&!this.Remove[0]&&this.Brackets[1]["right"][j].pos>=Elements.length-2)nRemoveCount++;this.Remove["total"]+=nRemoveCount;var Start=this.Brackets[1]["left"][j].pos; this.Remove.unshift({Count:nRemoveCount,Start:Start});this.ReplaceContent.unshift(oDelimiter)}};CMathAutoCorrectEngine.prototype.private_AutoCorrectPackDelimiter=function(data,Elements){for(var j=0;j=0){var Elem=Elements[Pos].Element.value;if(g_aMathAutoCorrectSkipBrackets[Elem])fSkip=true;else if(g_MathLeftBracketAutoCorrectCharCodes[Elem]){Pos--;continue}break}Pos=data["right"][j].pos+1;var len=Elements.length;while(Pos< len){var Elem=Elements[Pos].Element.value;if(q_aMathAutoCorrectAccentCharCodes[Elem]||Elem==94||Elem==95)fSkip=true;else if(g_MathRightBracketAutoCorrectCharCodes[Elem]){Pos++;continue}break}if(fSkip)continue;var props=new CMathDelimiterPr;props.column=1;props.begChr=data["left"][j].bracket.value;props.endChr=data["right"][j].bracket.value;var oDelimiter=new CDelimiter(props);var oBase=oDelimiter.getBase();var TempElements=[];for(var i=data["right"][j].pos-1;i>data["left"][j].pos;i--)if(Elements[i]){TempElements.splice(0, 0,Elements[i].Element);Elements[i]=null}Elements[data["right"][j].pos]=null;Elements[data["left"][j].pos]=null;this.private_PackTextToContent(oBase,TempElements,false);Elements[data["left"][j].pos]={Element:oDelimiter}}};CMathAutoCorrectEngine.prototype.private_AutoCorrectFraction=function(buff){this.private_CorrectBuffForFrac(buff);var Fraction=buff[0];var RemoveCount=buff[0].length;for(var i=1;i=0?buff[i].length-1:0;if(!buff[i][end])continue;if(buff[i][end].value===47||buff[i][end].value===8260&&props.type===1||buff[i][end].value===166&&props.type===3)if(buff[i][end-1]&&(buff[i][end-1].value===92&&props.type===2))buff[i].splice(end-1,2);else buff[i].splice(end,1)}};CMathAutoCorrectEngine.prototype.private_CorrectBuffForNary= function(buff){for(var i=0;i=0;i--){if(buff[0][i].value==9618){buff[0].pop();break}arrBase.unshift(buff[0].pop())}var props={};props.supHide=true;props.subHide=true;props.chr=buff.length==1?buff[0][0].value:buff[buff.length-1][0].value;if(buff[0].Type){if(buff[0].Type==DEGREE_SUPERSCRIPT&&buff[0].length)props.supHide=false;if(buff[0].Type==DEGREE_SUBSCRIPT&&buff[0].length)props.subHide=false}if(buff[1]){if(buff[1].Type==DEGREE_SUPERSCRIPT&&buff[1].length)props.supHide= false;if(buff[1].Type==DEGREE_SUBSCRIPT&&buff[1].length)props.subHide=false}props.ctrPrp=this.TextPr.Copy();var oNary=new CNary(props);var oSub=oNary.getLowerIterator();var oSup=oNary.getUpperIterator();var oBase=oNary.getBase();if(!props.supHide)if(buff[0].Type==DEGREE_SUPERSCRIPT)this.private_PackTextToContent(oSup,buff[0],true);else if(buff[1].Type&&buff[1].Type==DEGREE_SUPERSCRIPT)this.private_PackTextToContent(oSup,buff[1],true);if(!props.subHide)if(buff[0].Type==DEGREE_SUBSCRIPT)this.private_PackTextToContent(oSub, buff[0],true);else if(buff[1].Type&&buff[1].Type==DEGREE_SUBSCRIPT)this.private_PackTextToContent(oSub,buff[1],true);this.private_PackTextToContent(oBase,arrBase,true);if(this.ActionElement.value==32)RemoveCount++;var Start=this.Elements.length-RemoveCount-this.Shift;this.Remove.push({Count:RemoveCount,Start:Start});this.ReplaceContent.unshift(oNary)};CMathAutoCorrectEngine.prototype.private_AutoCorrectCRadical=function(buff){var props=new CMathRadicalPr;var RemoveCount=buff[0].length;props.degHide= this.private_CorrectBuffForRadical(buff,false);props.ctrPrp=this.TextPr.Copy();var Radical=new CRadical(props);var Base=Radical.getBase();var Degree=Radical.getDegree();buff=buff[0];if(!props.degHide){this.private_PackTextToContent(Degree,buff[1],false);this.private_PackTextToContent(Base,buff[0],true)}else this.private_PackTextToContent(Base,buff,true);if(this.ActionElement.value==32)RemoveCount++;var Start=this.Elements.length-RemoveCount-this.Shift;this.Remove.push({Count:RemoveCount,Start:Start}); this.ReplaceContent.unshift(Radical)};CMathAutoCorrectEngine.prototype.private_CorrectBuffForRadical=function(buff,inside,bracket){var radical=buff[0].splice(0,1)[0].value;switch(radical){case 8730:if(inside){if(!bracket.length)return true;var bOpenBrk=0;var ampPos=null;for(var i=bracket[0]+1;i1){for(var i=1;i1){for(var i=1;imcs[0].count)mcs[0]= {count:col+1,mcJc:0};arrContent[row][col]=[]}else if(oCurElem.value==64){row++;col=0;arrContent[row]=[];arrContent[row][col]=[]}else arrContent[row][col].push(oCurElem)}RemoveCount++}if(row<1)return;var props=new CMathMatrixPr;props.row=row+1;props.mcs=mcs;props.ctrPrp=this.TextPr.Copy();Element=new CMathMatrix(props);for(var i=0;i=0){var Elem=this.Elements[this.CurPos].Element;if(Elem.value===undefined)buffer[CurLvBuf].splice(0,0,Elem);else if(Elem.value===47){if(this.Type== MATH_LIMIT||bOff)break;if(Elem==this.ActionElement){this.CurPos--;this.Shift=1;continue}if(g_aMathAutoCorrectNotDoFraction[this.ActionElement.value]){this.CurPos--;buffer[CurLvBuf].splice(0,0,Elem);continue}if((this.Type==MATH_DEGREE||this.Type==MATH_DEGREESubSup)&&!bBrackOpen)break;if(this.CurPos-1>0){var tmp=this.Elements[this.CurPos-1].Element;if(tmp.Type===para_Math_BreakOperator&&tmp.value===92&&!bBrackOpen){this.CurPos--;CurLvBuf++;buffer[CurLvBuf]=[];buffer[CurLvBuf].splice(0,0,Elem);if(this.Type!== MATH_FRACTION||this.Type===MATH_FRACTION&&this.props.type===LINEAR_FRACTION){this.Type=MATH_FRACTION;this.props={type:LINEAR_FRACTION};this.CurPos--;buffer[CurLvBuf].splice(0,0,tmp)}else this.props={};continue}}if(!bBrackOpen){this.Type=MATH_FRACTION;this.props={}}this.CurPos--;if(!bBrackOpen){CurLvBuf++;buffer[CurLvBuf]=[]}buffer[CurLvBuf].splice(0,0,Elem);continue}else if(Elem.value===8260){if(this.Type==MATH_LIMIT||bOff)break;if(g_aMathAutoCorrectNotDoFraction[this.ActionElement.value]){this.CurPos--; buffer[CurLvBuf].splice(0,0,Elem);continue}if(!bBrackOpen){this.Type=MATH_FRACTION;this.props={type:SKEWED_FRACTION}}this.CurPos--;CurLvBuf++;buffer[CurLvBuf]=[];buffer[CurLvBuf].splice(0,0,Elem);continue}else if(166===Elem.value){if(this.Type==MATH_LIMIT||bOff)break;if(g_aMathAutoCorrectNotDoFraction[this.ActionElement.value]){this.CurPos--;buffer[CurLvBuf].splice(0,0,Elem);continue}if(!bBrackOpen){this.Type=MATH_FRACTION;this.props={type:NO_BAR_FRACTION};CurLvBuf++;buffer[CurLvBuf]=[]}buffer[CurLvBuf].splice(0, 0,Elem);this.CurPos--;continue}else if(g_MathRightBracketAutoCorrectCharCodes[Elem.value]){if(this.Type==MATH_DEGREE||this.Type==MATH_DEGREESubSup){var tmp=this.Elements[this.CurPos+1].Element;if(tmp&&tmp.value!=94&&tmp.value!=95)break}if(!this.Brackets[lvBrackets]){this.Brackets[lvBrackets]={};this.Brackets[lvBrackets]["left"]=[];this.Brackets[lvBrackets]["right"]=[]}this.Brackets[lvBrackets]["right"].push({bracket:Elem,pos:this.CurPos});lvBrackets++;buffer[CurLvBuf].splice(0,0,Elem);bBrackOpen= true;if(this.Type===null&&!g_aMathAutoCorrectDoNotDelimiter[this.ActionElement.value]){if(bOff)break;this.Type=MATH_DELIMITER}}else if(g_MathLeftBracketAutoCorrectCharCodes[Elem.value]){if(lvBrackets>1)lvBrackets--;if(!this.Brackets[lvBrackets]||lvBrackets==1&&this.Brackets[1]["left"].length==this.Brackets[1]["right"].length)break;if(this.Brackets[lvBrackets]["left"].length===this.Brackets[lvBrackets]["right"].length&&this.Brackets[lvBrackets]["right"].length){buffer[CurLvBuf].splice(0,0,Elem);this.CurPos--}else if(this.Brackets[lvBrackets]["left"].length< this.Brackets[lvBrackets]["right"].length){this.Brackets[lvBrackets]["left"].push({bracket:Elem,pos:this.CurPos});if(lvBrackets==1)bBrackOpen=false;buffer[CurLvBuf].splice(0,0,Elem);this.CurPos--}continue}else if(Elem.value===94){if(this.Type==MATH_DEGREE&&(buffer[CurLvBuf-1]&&buffer[CurLvBuf-1].Type==DEGREE_SUPERSCRIPT))break;if(Elem===this.ActionElement){this.Shift=1;this.CurPos--;continue}var bSkip=false;if(this.CurPos-1>=0&&this.Type!=MATH_DEGREESubSup){var tmp=this.Elements[this.CurPos-1].Element; if(tmp.value===8289)bSkip=true;if(this.Type==MATH_DEGREE)this.Type=null;buffer[CurLvBuf].Type=DEGREE_SUPERSCRIPT}if(this.Type==MATH_FRACTION||g_aMathAutoCorrectDoNotDegree[this.ActionElement.value]||bSkip){if(!bSkip)buffer[CurLvBuf].splice(0,0,Elem);this.CurPos--;continue}if(this.Type==MATH_RADICAL||this.Type==MATH_NARY||this.Type==MATH_DELIMITER||this.Type==MATH_EQ_ARRAY||this.Type==MATH_MATRIX||!this.Type)if(!bBrackOpen){this.Kind=DEGREE_SUPERSCRIPT;this.Type=MATH_DEGREE}if(this.Type==MATH_DEGREE&& (buffer[CurLvBuf-1]&&buffer[CurLvBuf-1].Type==DEGREE_SUBSCRIPT))if(!bBrackOpen){this.Kind=DEGREE_SubSup;this.Type=MATH_DEGREESubSup}buffer[CurLvBuf].Type=DEGREE_SUPERSCRIPT;this.CurPos--;if(!bBrackOpen){CurLvBuf++;buffer[CurLvBuf]=[]}else buffer[CurLvBuf].splice(0,0,Elem);continue}else if(Elem.value===95){if(this.Type==MATH_DEGREE&&(buffer[CurLvBuf-1]&&buffer[CurLvBuf-1].Type==DEGREE_SUBSCRIPT));if(Elem===this.ActionElement){this.Shift=1;this.CurPos--;continue}var bSkip=false;if(this.CurPos-1>=0&& this.Type!=MATH_DEGREESubSup){var tmp=this.Elements[this.CurPos-1].Element;if(tmp.value===8289)bSkip=true;if(this.Type==MATH_DEGREE)this.Type=null;buffer[CurLvBuf].Type=DEGREE_SUBSCRIPT}if(this.Type==MATH_FRACTION||g_aMathAutoCorrectDoNotDegree[this.ActionElement.value]||bSkip){if(!bSkip)buffer[CurLvBuf].splice(0,0,Elem);this.CurPos--;continue}if(this.Type==MATH_RADICAL||this.Type==MATH_NARY||this.Type==MATH_DELIMITER||this.Type==MATH_EQ_ARRAY||this.Type==MATH_MATRIX||!this.Type)if(!bBrackOpen){this.Kind= DEGREE_SUBSCRIPT;this.Type=MATH_DEGREE}if(this.Type==MATH_DEGREE&&(buffer[CurLvBuf-1]&&buffer[CurLvBuf-1].Type==DEGREE_SUPERSCRIPT))if(!bBrackOpen){this.Kind=DEGREE_SubSup;this.Type=MATH_DEGREESubSup}buffer[CurLvBuf].Type=DEGREE_SUBSCRIPT;this.CurPos--;if(!bBrackOpen){CurLvBuf++;buffer[CurLvBuf]=[]}else buffer[CurLvBuf].splice(0,0,Elem);continue}else if(q_aMathAutoCorrectControlAggregationCodes[Elem.value]){if(this.Type==MATH_LIMIT)break;buffer[CurLvBuf].splice(0,0,Elem);if(g_aMathAutoCorrectNotDoCNary[this.ActionElement.value]){this.CurPos--; continue}if(!bBrackOpen&&this.Type!==MATH_FRACTION){this.Type=MATH_NARY;break}else{this.CurPos--;continue}}else if(g_aMathAutoCorrectRadicalCharCode[Elem.value]){if((this.Type==MATH_DEGREE||this.Type==MATH_DEGREESubSup||this.Type==MATH_LIMIT)&&!bBrackOpen||bOff)break;buffer[CurLvBuf].splice(0,0,Elem);if(g_aMathAutoCorrectDoNotRadical[this.ActionElement.value]){this.CurPos--;continue}if(!bBrackOpen&&this.Type!==MATH_FRACTION){this.Type=MATH_RADICAL;break}this.CurPos--;continue}else if(Elem.value== 9633||Elem.value==9645){if((this.Type==MATH_DEGREE||this.Type==MATH_DEGREESubSup||this.Type==MATH_LIMIT)&&!bBrackOpen||bOff)break;buffer[CurLvBuf].splice(0,0,Elem);if(this.Type==MATH_FRACTION&&!bBrackOpen)break;if(g_aMathAutoCorrectDoNotBox[this.ActionElement.value]){this.CurPos--;continue}if(!bBrackOpen&&this.Type!==MATH_FRACTION){this.Type=MATH_BOX;break}this.CurPos--;continue}else if(g_aMathAutoCorrectGroupChar[Elem.value]){if(this.Type==MATH_GROUP_CHARACTER&&!bBrackOpen||bOff)break;buffer[CurLvBuf].splice(0, 0,Elem);if(this.Type==MATH_LIMIT)break;if((this.Type==MATH_DEGREE||this.Type==MATH_DEGREESubSup)&&!bBrackOpen){if(this.Type==MATH_DEGREE)this.Type=MATH_GROUP_CHARACTER;break}if(g_aMathAutoCorrectDoNotGroupChar[this.ActionElement.value]){this.CurPos--;continue}if(!bBrackOpen&&this.Type!==MATH_FRACTION){this.Type=MATH_GROUP_CHARACTER;break}this.CurPos--;continue}else if(Elem.value===175||Elem.value===9601){if(this.Type==MATH_BAR&&!bBrackOpen||bOff)break;buffer[CurLvBuf].splice(0,0,Elem);if(this.Type== MATH_LIMIT)break;if((this.Type==MATH_DEGREE||this.Type==MATH_DEGREESubSup)&&!bBrackOpen)break;if(g_aMathAutoCorrectDoNotGroupChar[this.ActionElement.value]){this.CurPos--;continue}if(!bBrackOpen&&this.Type!==MATH_FRACTION){this.Type=MATH_BAR;break}this.CurPos--;continue}else if(g_aMathAutoCorrectEqArrayMatrix[Elem.value]){buffer[CurLvBuf].splice(0,0,Elem);if(this.Type==MATH_LIMIT||bOff)break;if((this.Type==MATH_MATRIX||this.Type===null||this.Type==MATH_DELIMITER)&&!bBrackOpen){CurLvBuf++;buffer[CurLvBuf]= []}if(g_aMathAutoCorrectDoNotMatrix[this.ActionElement.value]){this.CurPos--;continue}if(!bBrackOpen&&(this.Type===null||this.Type==MATH_DELIMITER))this.Type=MATH_MATRIX;this.CurPos--;continue}else if(q_aMathAutoCorrectAccentCharCodes[Elem.value]){if((this.Type==MATH_DEGREE||this.Type==MATH_DEGREESubSup)&&!bBrackOpen||bOff)break;buffer[CurLvBuf].splice(0,0,Elem);if(this.Type==MATH_LIMIT){this.CurPos--;continue}if(g_aMathAutoCorrectDoNotAccentNotClose[this.ActionElement.value]){this.CurPos--;continue}if(!bBrackOpen&& this.Type!==MATH_FRACTION){if(this.CurPos>=1){var tmp=this.Elements[this.CurPos-1].Element;if(g_MathRightBracketAutoCorrectCharCodes[tmp.value]){var countR=1;buffer[CurLvBuf].splice(0,0,tmp);for(var i=this.CurPos-2;i>=0;i--){tmp=this.Elements[i].Element;buffer[CurLvBuf].splice(0,0,tmp);if(g_MathRightBracketAutoCorrectCharCodes[tmp.value])countR++;if(g_MathLeftBracketAutoCorrectCharCodes[tmp.value]){countR--;if(!countR)break}}}else buffer[CurLvBuf].splice(0,0,tmp);if(tmp!==this.Elements[this.CurPos- 1].Element&&countR)break}this.props={skip:this.Elements.length-this.CurPos};this.Type=MATH_ACCENT;break}this.CurPos--;continue}else if(Elem.value===9524||Elem.value===9516){if(this.Type==MATH_FRACTION||this.Type==MATH_MATRIX||this.Type==MATH_ACCENT||g_aMathAutoCorrectDoNotAbove[this.ActionElement.value]){buffer[CurLvBuf].splice(0,0,Elem);this.CurPos--;continue}if(this.Type!==null&&!bBrackOpen||bOff)break;if(!bBrackOpen){CurLvBuf++;buffer[CurLvBuf]=[];this.props=Elem.value===9524?{type:LIMIT_UP}:{type:LIMIT_LOW}; this.Type=MATH_LIMIT}this.CurPos--;continue}else if(Elem.value===8289)if(this.Type==MATH_FRACTION||bBrackOpen||g_aMathAutoCorrectDoNotMathFunc[this.ActionElement.value]){buffer[CurLvBuf].splice(0,0,Elem);this.CurPos--;continue}else{if(this.Type==MATH_DELIMITER)this.Type=null;if(this.Type!==null||bOff)break;this.Type=MATH_FUNCTION;CurLvBuf++;buffer[CurLvBuf]=[];this.CurPos--;while(this.CurPos>=0){Elem=this.Elements[this.CurPos].Element;if(g_aMathAutoCorrectLatinAlph[Elem.value])buffer[CurLvBuf].splice(0, 0,Elem);else break;this.CurPos--}break}else if(Elem.value===9618){this.CurPos--;var skip=false;if(this.CurPos>=0){var tmp=this.Elements[this.CurPos].Element;if(tmp.value==94||tmp.value==95||tmp.value==9524||tmp.value==9516)skip=true}if(!bBrackOpen&&!skip){if(this.Type!==null){if(this.Type==MATH_DEGREE||this.Type==MATH_DEGREESubSup||this.Type==MATH_LIMIT)buffer[CurLvBuf].splice(0,0,Elem);break}bOff=true}buffer[CurLvBuf].splice(0,0,Elem);continue}else if(g_aMathAutoCorrectFracCharCodes[Elem.value]){if(Elem=== this.ActionElement){if(Elem.value!==32)this.Shift=1;else if(this.CurPos-1>0&&this.Elements[this.CurPos-1].Element.value==32)break;this.CurPos--;continue}if(bBrackOpen||!bSecSpace&&this.Type==null){buffer[CurLvBuf].splice(0,0,Elem);this.CurPos--;if(!bBrackOpen){this.Shift+=buffer[CurLvBuf].length;bSecSpace=true;buffer=[];CurLvBuf=0;buffer[CurLvBuf]=[]}continue}break}else buffer[CurLvBuf].splice(0,0,Elem);this.CurPos--}if(bBrackOpen||this.Type===null)return false;else if(!this.StartHystory&&((this.Type!== MATH_DEGREE||this.Type!==MATH_DEGREESubSup)&&!bOff)){this.StartHystory=true;var oLogicDocument=this.Paragraph?this.Paragraph.LogicDocument:null;if(oLogicDocument)oLogicDocument.StartAction(AscDFH.historydescription_Document_MathAutoCorrect);else History.Create_NewPoint(AscDFH.historydescription_Document_MathAutoCorrect)}var result=false;switch(this.Type){case MATH_DELIMITER:if(!bBrackOpen&&lvBrackets===1){this.private_AutoCorrectDelimiter(CanMakeAutoCorrect);result=true}else result=false;break;case MATH_FRACTION:this.private_AutoCorrectFraction(buffer); result=true;break;case MATH_DEGREE:if(bOff)result=false;else{this.private_AutoCorrectDegree(buffer);result=true}break;case MATH_DEGREESubSup:if(bOff)result=false;else{result=true;this.private_AutoCorrectDegreeSubSup(buffer)}break;case MATH_NARY:this.private_AutoCorrectCNary(buffer,bOff);result=true;break;case MATH_RADICAL:this.private_AutoCorrectCRadical(buffer);result=true;break;case MATH_BOX:this.private_AutoCorrectBox(buffer);result=true;break;case MATH_GROUP_CHARACTER:this.private_AutoCorrectGroupCharacter(buffer); result=true;break;case MATH_BAR:this.private_AutoCorrectBar(buffer);result=true;break;case MATH_MATRIX:this.private_AutoCorrectMatrix(buffer);result=true;break;case MATH_ACCENT:this.private_AutoCorrectAccent(buffer);result=true;break;case MATH_LIMIT:this.private_AutoCorrectAboveBelow(buffer);result=true;break;case MATH_FUNCTION:this.private_AutoCorrectFunction(buffer);result=true;break;default:result=false}return result};CMathContent.prototype.private_ReplaceAutoCorrect=function(AutoCorrectEngine){for(var i= AutoCorrectEngine.Remove.length-1;i>=0;i--){var LastEl=null;var Start=AutoCorrectEngine.Remove[i].Start;var End=AutoCorrectEngine.Remove[i].Start+AutoCorrectEngine.Remove[i].Count-1;var FirstEl=AutoCorrectEngine.Elements[Start];var bDelete=false;var counter=0;var contPos=null;if(i==AutoCorrectEngine.Remove.length-1&&this.Content[FirstEl.ElPos].Type==para_Math_Run)contPos=this.Content[FirstEl.ElPos].State.ContentPos;for(var nPos=End;nPos>=Start;nPos--){LastEl=AutoCorrectEngine.Elements[nPos];if(undefined!== LastEl.Element.Parent&&LastEl.Element.kind===undefined){this.Content[LastEl.ElPos].Remove_FromContent(LastEl.ContPos,1,true);counter++;if(this.Content[LastEl.ElPos].Is_Empty()){this.Remove_FromContent(LastEl.ElPos,1);bDelete=true;counter=0;if(FirstEl.ElPos==LastEl.ElPos)FirstEl.ElPos--}}else{this.Remove_FromContent(LastEl.ElPos,1);bDelete=true;if(FirstEl.ElPos==LastEl.ElPos)FirstEl.ElPos--}}if(AutoCorrectEngine.ReplaceContent[i]){if(FirstEl.Element.Type!=para_Math_Composition){if(!bDelete){var NewRun= this.Content[FirstEl.ElPos].Split2(FirstEl.ContPos);if(!NewRun.Is_Empty()){this.Internal_Content_Add(FirstEl.ElPos+1,NewRun,false);NewRun.State.ContentPos=contPos-counter-FirstEl.ContPos>=0?contPos-counter-FirstEl.ContPos:0;this.CurPos++}if(this.Content[FirstEl.ElPos].Is_Empty()){this.Remove_FromContent(FirstEl.ElPos,1);FirstEl.ElPos--}}this.Internal_Content_Add(FirstEl.ElPos+1,AutoCorrectEngine.ReplaceContent[i],false);this.CurPos++}else{this.Internal_Content_Add(FirstEl.ElPos,AutoCorrectEngine.ReplaceContent[i], false);this.CurPos++}if(AutoCorrectEngine.ReplaceContent[i].kind&&i==AutoCorrectEngine.Remove.length-1&&(AutoCorrectEngine.ReplaceContent[i].kind==MATH_NARY||AutoCorrectEngine.ReplaceContent[i].kind==MATH_FUNCTION)){var oContentElem=this.Content[FirstEl.ElPos+1];this.Correct_Content(true);for(var k=this.Content.length-1;k>=0;k--)if(AutoCorrectEngine.ReplaceContent[i]===this.Content[k]){this.CurPos=k;break}var index=AutoCorrectEngine.ReplaceContent[i].kind==4?2:1;oContentElem.CurPos=index;oContentElem.Content[index].MoveCursorToEndPos()}else{this.Correct_Content(true); if(this.Content[this.CurPos].kind!==undefined&&this.Content[this.CurPos+1]&&this.Content[this.CurPos+1].Type==para_Math_Run){this.CurPos++;this.Content[this.CurPos].MoveCursorToStartPos()}}}}};CMathContent.prototype.GetTextContent=function(bSelectedText){var arr=[],str="",bIsContainsOperator=false,paraRunArr=[];var addText=function(value,bIsAddParenthesis,paraRun){if(bIsAddParenthesis){arr.push("(");str+="(";paraRunArr.push("(")}arr.push(value);str+=value;if(undefined===paraRun)paraRunArr.push(value); else paraRunArr.push(paraRun);if(bIsAddParenthesis){arr.push(")");str+=")";paraRunArr.push(")")}};var getAndPushTextContent=function(elem,bAddBrackets){var tempStr=elem.GetTextContent();if(tempStr.str)addText(tempStr.str,tempStr.bIsContainsOperator||bAddBrackets,tempStr.paraRunArr)};var checkBracket=function(str){var result=false;var MathLeftRighBracketsCharCodes=[40,41,91,93,123,125,10216,10217,9001,9002,10214,10215,10218,10219,8968,8969,8970,8971,12310,12311,9508,9500];for(var i=0;i=0;i--)if(Content[i].Type===49){var kStart=i=== nCount?Content[i].State.ContentPos:Content[i].Content.length;for(var k=kStart-1;k>=0;k--)this.Elements.unshift({Element:Content[i].Content[k],ElPos:i,ContPos:k})}else this.Elements.unshift({Element:Content[i],ElPos:i})};var g_DefaultAutoCorrectMathFuncs=["arcsin","asin","sin","arcsinh","asinh","sinh","arcsec","sec","asec","arcsech","asech","sech","arccos","acos","cos","arccosh","acosh","cosh","arccsc","acsc","csc","arccsch","acsch","csch","arctan","atan","tan","arctanh","atanh","tanh","arccot","acot", "cot","arccoth","acoth","coth","arg","det","exp","inf","lim","min","def","dim","gcd","ker","log","Pr","deg","erf","hom","lg","ln","max","sup"];var g_DefaultAutoCorrectMathSymbolsList=[["!!",8252],["...",8230],["::",8759],[":=",8788],["/<",8814],["/>",8815],["/=",8800],["\\above",9524],["\\acute",769],["\\aleph",8501],["\\alpha",945],["\\Alpha",913],["\\amalg",8720],["\\angle",8736],["\\aoint",8750],["\\approx",8776],["\\asmash",11014],["\\ast",8727],["\\asymp",8781],["\\atop",166],["\\bar",773],["\\Bar", 831],["\\because",8757],["\\begin",12310],["\\below",9516],["\\bet",8502],["\\beta",946],["\\Beta",914],["\\beth",8502],["\\bigcap",8898],["\\bigcup",8899],["\\bigodot",10752],["\\bigoplus",10753],["\\bigotimes",10754],["\\bigsqcup",10758],["\\biguplus",10756],["\\bigvee",8897],["\\bigwedge",8896],["\\binomial",[40,97,43,98,41,94,94,61,8721,95,40,107,61,48,41,94,110,32,9618,40,110,166,107,41,97,94,107,32,98,94,40,110,45,107,41]],["\\bot",8869],["\\bowtie",8904],["\\box",9633],["\\boxdot",8865],["\\boxminus", 8863],["\\boxplus",8862],["\\bra",10216],["\\break",10550],["\\breve",774],["\\bullet",8729],["\\cap",8745],["\\cbrt",8731],["\\cases",9400],["\\cdot",8901],["\\cdots",8943],["\\check",780],["\\chi",967],["\\Chi",935],["\\circ",8728],["\\close",9508],["\\clubsuit",9827],["\\coint",8754],["\\cong",8773],["\\coprod",8720],["\\cup",8746],["\\dalet",8504],["\\daleth",8504],["\\dashv",8867],["\\dd",8518],["\\Dd",8517],["\\ddddot",8412],["\\dddot",8411],["\\ddot",776],["\\ddots",8945],["\\defeq",8797], ["\\degc",8451],["\\degf",8457],["\\degree",176],["\\delta",948],["\\Delta",916],["\\Deltaeq",8796],["\\diamond",8900],["\\diamondsuit",9826],["\\div",247],["\\dot",775],["\\doteq",8784],["\\dots",8230],["\\doublea",120146],["\\doubleA",120120],["\\doubleb",120147],["\\doubleB",120121],["\\doublec",120148],["\\doubleC",8450],["\\doubled",120149],["\\doubleD",120123],["\\doublee",120150],["\\doubleE",120124],["\\doublef",120151],["\\doubleF",120125],["\\doubleg",120152],["\\doubleG",120126],["\\doubleh", 120153],["\\doubleH",8461],["\\doublei",120154],["\\doubleI",120128],["\\doublej",120155],["\\doubleJ",120129],["\\doublek",120156],["\\doubleK",120130],["\\doublel",120157],["\\doubleL",120131],["\\doublem",120158],["\\doubleM",120132],["\\doublen",120159],["\\doubleN",8469],["\\doubleo",120160],["\\doubleO",120134],["\\doublep",120161],["\\doubleP",8473],["\\doubleq",120162],["\\doubleQ",8474],["\\doubler",120163],["\\doubleR",8477],["\\doubles",120164],["\\doubleS",120138],["\\doublet",120165], ["\\doubleT",120139],["\\doubleu",120166],["\\doubleU",120140],["\\doublev",120167],["\\doubleV",120141],["\\doublew",120168],["\\doubleW",120142],["\\doublex",120169],["\\doubleX",120143],["\\doubley",120170],["\\doubleY",120144],["\\doublez",120171],["\\doubleZ",8484],["\\downarrow",8595],["\\Downarrow",8659],["\\dsmash",11015],["\\ee",8519],["\\ell",8467],["\\emptyset",8709],["\\emsp",8195],["\\end",12311],["\\ensp",8194],["\\epsilon",1013],["\\Epsilon",917],["\\eqarray",9608],["\\equiv",8801], ["\\eta",951],["\\Eta",919],["\\exists",8707],["\\forall",8704],["\\fraktura",120094],["\\frakturA",120068],["\\frakturb",120095],["\\frakturB",120069],["\\frakturc",120096],["\\frakturC",8493],["\\frakturd",120097],["\\frakturD",120071],["\\frakture",120098],["\\frakturE",120072],["\\frakturf",120099],["\\frakturF",120073],["\\frakturg",120100],["\\frakturG",120074],["\\frakturh",120101],["\\frakturH",8460],["\\frakturi",120102],["\\frakturI",8465],["\\frakturj",120103],["\\frakturJ",120077],["\\frakturk", 120104],["\\frakturK",120078],["\\frakturl",120105],["\\frakturL",120079],["\\frakturm",120106],["\\frakturM",120080],["\\frakturn",120107],["\\frakturN",120081],["\\frakturo",120108],["\\frakturO",120082],["\\frakturp",120109],["\\frakturP",120083],["\\frakturq",120110],["\\frakturQ",120084],["\\frakturr",120111],["\\frakturR",8476],["\\frakturs",120112],["\\frakturS",120086],["\\frakturt",120113],["\\frakturT",120087],["\\frakturu",120114],["\\frakturU",120088],["\\frakturv",120115],["\\frakturV", 120089],["\\frakturw",120116],["\\frakturW",120090],["\\frakturx",120117],["\\frakturX",120091],["\\fraktury",120118],["\\frakturY",120092],["\\frakturz",120119],["\\frakturZ",8488],["\\frown",8977],["\\funcapply",8289],["\\G",915],["\\gamma",947],["\\Gamma",915],["\\ge",8805],["\\geq",8805],["\\gets",8592],["\\gg",8811],["\\gimel",8503],["\\grave",768],["\\hairsp",8202],["\\hat",770],["\\hbar",8463],["\\heartsuit",9825],["\\hookleftarrow",8617],["\\hookrightarrow",8618],["\\hphantom",11012],["\\hsmash", 11020],["\\hvec",8401],["\\identitymatrix",[40,9632,40,49,38,48,38,48,64,48,38,49,38,48,64,48,38,48,38,49,41,41]],["\\ii",8520],["\\iiint",8749],["\\iint",8748],["\\iiiint",10764],["\\Im",8465],["\\imath",305],["\\in",8712],["\\inc",8710],["\\infty",8734],["\\int",8747],["\\integral",[49,47,50,960,8747,95,48,94,50,960,9618,8518,952,32,40,97,43,98,115,105,110,32,952,41,61,49,47,8730,40,97,94,50,45,98,94,50,41]],["\\iota",953],["\\Iota",921],["\\itimes",8290],["\\j",[74,97,121]],["\\jj",8521],["\\jmath", 567],["\\kappa",954],["\\Kappa",922],["\\ket",10217],["\\lambda",955],["\\Lambda",923],["\\langle",9001],["\\lbbrack",10214],["\\lbrace",123],["\\lbrack",91],["\\lceil",8968],["\\ldiv",8725],["\\ldivide",8725],["\\ldots",8230],["\\le",8804],["\\left",9500],["\\leftarrow",8592],["\\Leftarrow",8656],["\\leftharpoondown",8637],["\\leftharpoonup",8636],["\\leftrightarrow",8596],["\\Leftrightarrow",8660],["\\leq",8804],["\\lfloor",8970],["\\lhvec",8400],["\\limit",[108,105,109,95,40,110,8594,8734,41,8289, 12310,40,49,43,49,47,110,41,94,110,12311,61,101]],["\\ll",8810],["\\lmoust",9136],["\\Longleftarrow",10232],["\\Longleftrightarrow",10234],["\\Longrightarrow",10233],["\\lrhar",8651],["\\lvec",8406],["\\mapsto",8614],["\\matrix",9632],["\\medsp",8287],["\\mid",8739],["\\middle",9436],["\\models",8872],["\\mp",8723],["\\mu",956],["\\Mu",924],["\\nabla",8711],["\\naryand",9618],["\\nbsp",160],["\\ne",8800],["\\nearrow",8599],["\\neq",8800],["\\ni",8715],["\\norm",8214],["\\notcontain",8716],["\\notelement", 8713],["\\notin",8713],["\\nu",957],["\\Nu",925],["\\nwarrow",8598],["\\o",959],["\\O",927],["\\odot",8857],["\\of",9618],["\\oiiint",8752],["\\oiint",8751],["\\oint",8750],["\\omega",969],["\\Omega",937],["\\ominus",8854],["\\open",9500],["\\oplus",8853],["\\otimes",8855],["\\over",47],["\\overbar",175],["\\overbrace",9182],["\\overbracket",9140],["\\overline",175],["\\overparen",9180],["\\overshell",9184],["\\parallel",8741],["\\partial",8706],["\\pmatrix",9384],["\\perp",8869],["\\phantom",10209], ["\\phi",981],["\\Phi",934],["\\pi",960],["\\Pi",928],["\\pm",177],["\\pppprime",8279],["\\ppprime",8244],["\\pprime",8243],["\\prec",8826],["\\preceq",8828],["\\prime",8242],["\\prod",8719],["\\propto",8733],["\\psi",968],["\\Psi",936],["\\qdrt",8732],["\\quadratic",[120,61,40,45,98,177,8730,40,98,94,50,45,52,97,99,41,41,47,50,97]],["\\rangle",9002],["\\Rangle",10219],["\\ratio",8758],["\\rbrace",125],["\\rbrack",93],["\\Rbrack",10215],["\\rceil",8969],["\\rddots",8944],["\\Re",8476],["\\rect",9645], ["\\rfloor",8971],["\\rho",961],["\\Rho",929],["\\rhvec",8401],["\\right",9508],["\\rightarrow",8594],["\\Rightarrow",8658],["\\rightharpoondown",8641],["\\rightharpoonup",8640],["\\rmoust",9137],["\\root",9389],["\\scripta",119990],["\\scriptA",119964],["\\scriptb",119991],["\\scriptB",8492],["\\scriptc",119992],["\\scriptC",119966],["\\scriptd",119993],["\\scriptD",119967],["\\scripte",8495],["\\scriptE",8496],["\\scriptf",119995],["\\scriptF",8497],["\\scriptg",8458],["\\scriptG",119970],["\\scripth", 119997],["\\scriptH",8459],["\\scripti",119998],["\\scriptI",8464],["\\scriptj",119999],["\\scriptJ",119973],["\\scriptk",12E4],["\\scriptK",119974],["\\scriptl",8467],["\\scriptL",8466],["\\scriptm",120002],["\\scriptM",8499],["\\scriptn",120003],["\\scriptN",119977],["\\scripto",8500],["\\scriptO",119978],["\\scriptp",120005],["\\scriptP",119979],["\\scriptq",120006],["\\scriptQ",119980],["\\scriptr",120007],["\\scriptR",8475],["\\scripts",120008],["\\scriptS",119982],["\\scriptt",120009],["\\scriptT", 119983],["\\scriptu",120010],["\\scriptU",119984],["\\scriptv",120011],["\\scriptV",119985],["\\scriptw",120012],["\\scriptW",119986],["\\scriptx",120013],["\\scriptX",119987],["\\scripty",120014],["\\scriptY",119988],["\\scriptz",120015],["\\scriptZ",119989],["\\sdiv",8260],["\\sdivide",8260],["\\searrow",8600],["\\setminus",8726],["\\sigma",963],["\\Sigma",931],["\\sim",8764],["\\simeq",8771],["\\smash",11021],["\\smile",8995],["\\spadesuit",9824],["\\sqcap",8851],["\\sqcup",8852],["\\sqrt",8730], ["\\sqsubseteq",8849],["\\sqsuperseteq",8850],["\\star",8902],["\\subset",8834],["\\subseteq",8838],["\\succ",8827],["\\succeq",8829],["\\sum",8721],["\\superset",8835],["\\superseteq",8839],["\\swarrow",8601],["\\tau",964],["\\Tau",932],["\\therefore",8756],["\\theta",952],["\\Theta",920],["\\thicksp",8197],["\\thinsp",8198],["\\tilde",771],["\\times",215],["\\to",8594],["\\top",8868],["\\tvec",8417],["\\ubar",818],["\\Ubar",819],["\\underbar",9601],["\\underbrace",9183],["\\underbracket",9141], ["\\underline",9649],["\\underparen",9181],["\\uparrow",8593],["\\Uparrow",8657],["\\updownarrow",8597],["\\Updownarrow",8661],["\\uplus",8846],["\\upsilon",965],["\\Upsilon",933],["\\varepsilon",949],["\\varphi",966],["\\varpi",982],["\\varrho",1009],["\\varsigma",962],["\\vartheta",977],["\\vbar",9474],["\\vdash",8866],["\\vdots",8942],["\\vec",8407],["\\vee",8744],["\\vert",124],["\\Vert",8214],["\\Vmatrix",9385],["\\vphantom",8691],["\\vthicksp",8196],["\\wedge",8743],["\\wp",8472],["\\wr",8768], ["\\xi",958],["\\Xi",926],["\\zeta",950],["\\Zeta",918],["\\zwnj",8204],["\\zwsp",8203],["~=",8773],["-+",8723],["+-",177],["<<",8810],["<=",8804],["->",8594],[">=",8805],[">>",8811]];var g_AutoCorrectMathSymbols=JSON.parse(JSON.stringify(g_DefaultAutoCorrectMathSymbolsList));var g_AutoCorrectMathFuncs=JSON.parse(JSON.stringify(g_DefaultAutoCorrectMathFuncs));var g_AutoCorrectMathsList={DefaultAutoCorrectMathSymbolsList:g_DefaultAutoCorrectMathSymbolsList,AutoCorrectMathSymbols:g_AutoCorrectMathSymbols, DefaultAutoCorrectMathFuncs:g_DefaultAutoCorrectMathFuncs,AutoCorrectMathFuncs:g_AutoCorrectMathFuncs};var q_aMathAutoCorrectControlAggregationCodes={8721:1,8719:1,8720:1,8896:1,8750:1,8897:1,8898:1,8899:1,10758:1,10756:1,10752:1,10753:1,10754:1,8747:1,8748:1,8749:1,10764:1,8751:1,8752:1,8754:1};var q_aMathAutoCorrectAccentCharCodes={773:1,831:1,818:1,819:1,769:1,768:1,8407:1,774:1,770:1,8417:1,8401:1,780:1,771:1,8406:1,8400:1,775:1,776:1,8411:1,8412:1,8242:1,8243:1,8244:1,8279:1};var g_MathLeftBracketAutoCorrectCharCodes= {40:1,91:1,123:1,10216:1,9001:1,10214:1,10218:1,8968:1,8970:1,12310:1,9500:1};var g_MathRightBracketAutoCorrectCharCodes={41:1,93:1,125:1,10217:1,9002:1,10215:1,10219:1,8969:1,8971:1,12311:1,9508:1};var g_aMathAutoCorrectFracCharCodes={32:1,33:1,34:1,35:1,36:1,37:1,38:1,39:1,40:1,41:1,42:1,43:1,44:1,45:1,46:1,47:1,58:1,59:1,60:1,61:1,62:1,63:1,64:1,91:1,93:1,94:1,95:1,96:1,123:1,124:1,125:1,126:1,215:1};var g_aMathAutoCorrectTriggerCharCodes={32:1,33:1,34:1,35:1,36:1,37:1,38:1,39:1,40:1,41:1,42:1, 43:1,44:1,45:1,46:1,47:1,58:1,59:1,60:1,61:1,62:1,63:1,64:1,91:1,93:1,92:1,94:1,95:1,96:1,123:1,125:1,124:1,126:1};var g_aMathAutoCorrectTextFunc={32:1,40:1,41:1,91:1,94:1,95:1,123:1};var g_aMathAutoCorrectNotDoFraction={33:1,34:1,39:1,36:1,40:1,41:1,91:1,93:1,123:1,125:1,92:1,94:1,95:1,124:1};var g_aMathAutoCorrectDoNotDegree={33:1,34:1,39:1,36:1,40:1,41:1,91:1,93:1,123:1,125:1,44:1,46:1,92:1,94:1,95:1,124:1};var g_aMathAutoCorrectNotDoCNary={34:1,36:1,39:1,40:1,41:1,46:1,91:1,92:1,93:1,94:1,95:1, 123:1,125:1,124:1};var g_aMathAutoCorrectDoNotDelimiter={34:1,39:1,40:1,41:1,47:1,91:1,92:1,94:1,95:1,123:1};var g_aMathAutoCorrectDoNotRadical={34:1,39:1,40:1,41:1,92:1,94:1,95:1,93:1,125:1};var g_aMathAutoCorrectDoNotBox={33:1,34:1,36:1,39:1,40:1,41:1,91:1,93:1,123:1,125:1,92:1,94:1,95:1,124:1};var g_aMathAutoCorrectDoNotGroupChar={33:1,34:1,36:1,39:1,40:1,41:1,44:1,46:1,91:1,93:1,123:1,125:1,92:1,124:1};var g_aMathAutoCorrectDoNotMatrix={34:1,39:1,40:1,41:1,92:1,93:1,94:1,95:1,125:1};var g_aMathAutoCorrectDoNotAccentNotClose= {34:1,39:1,40:1,41:1,92:1,93:1,94:1,95:1,125:1};var g_aMathAutoCorrectDoNotAccentClose={34:1,41:1,93:1,125:1};var g_aMathAutoCorrectDoNotAbove={33:1,34:1,36:1,39:1,40:1,41:1,44:1,46:1,91:1,92:1,93:1,94:1,95:1,123:1,124:1,125:1};var g_aMathAutoCorrectDoNotMathFunc={33:1,34:1,36:1,39:1,40:1,41:1,44:1,46:1,91:1,92:1,93:1,94:1,95:1,123:1,124:1,125:1};var g_aMathAutoCorrectRadicalCharCode={8730:1,8731:1,8732:1};var g_aMathAutoCorrectSkipBrackets={8730:1,9633:1,9645:1,9182:1,9180:1,9184:1,9183:1,9181:1, 175:1,9601:1,9400:1,9608:1,9632:1,9384:1,9385:1};var g_aMathAutoCorrectGroupChar={9182:1,9180:1,9184:1,9183:1,9181:1};var g_aMathAutoCorrectEqArrayMatrix={9400:1,9608:1,9632:1,9384:1,9385:1};var g_aMathAutoCorrectLatinAlph={65:1,66:1,67:1,68:1,69:1,70:1,71:1,72:1,73:1,74:1,75:1,76:1,77:1,78:1,79:1,80:1,81:1,82:1,83:1,84:1,85:1,86:1,87:1,88:1,89:1,90:1,96:1,97:1,98:1,99:1,100:1,101:1,102:1,103:1,104:1,105:1,106:1,107:1,108:1,109:1,110:1,111:1,112:1,113:1,114:1,115:1,116:1,117:1,118:1,119:1,120:1,121:1, 122:1};var g_aMathAutoCorrectSpecSymb=["!!","...","::",":=","/<","/>","/=","~=","-+","+-","<<","<=","->",">=",">>"];window["AscCommonWord"]=window["AscCommonWord"]||{};window["AscCommonWord"].CMathContent=CMathContent;window["AscCommonWord"].g_AutoCorrectMathsList=g_AutoCorrectMathsList;"use strict";var g_oTextMeasurer=AscCommon.g_oTextMeasurer;var History=AscCommon.History;var c_oAscRevisionsChangeType=Asc.c_oAscRevisionsChangeType;var c_oAscMathInterfaceMatrixRowRule={Single:0,OneAndHalf:1,Double:2, Exactly:3,Multiple:4};var c_oAscMathInterfaceMatrixColumnRule={Single:0,OneAndHalf:1,Double:2,Exactly:3,Multiple:4};var c_oAscMathInterfaceEqArrayLineRule={Single:0,OneAndHalf:1,Double:2,Exactly:3,Multiple:4};var c_oAscMathInterfaceSettingsBrkBin={BreakRepeat:0,BreakBefore:1,BreakAfter:2};var c_oAscMathInterfaceSettingsAlign={Left:0,Center:1,Right:2,Justify:3};var c_oAscMathMainType={Symbol:0,Fraction:1,Script:2,Radical:3,Integral:4,LargeOperator:5,Bracket:6,Function:7,Accent:8,LimitLog:9,Operator:10, Matrix:11,Empty_Content:12};function CMathBase(bInside){CParagraphContentWithParagraphLikeContent.call(this);this.Type=para_Math_Composition;this.pos=new CMathPosition;this.size=new CMathSize;this.Parent=null;this.ParaMath=null;this.CtrPrp=new CTextPr;this.CompiledCtrPrp=new CTextPr;this.TextPrControlLetter=new CTextPr;this.ArgSize=new CMathArgSize;this.nRow=0;this.nCol=0;this.bInside=bInside===true;this.bOneLine=true;this.bCanBreak=false;this.NumBreakContent=-1;this.elements=[];this.Bounds=new CMathBounds; this.dW=0;this.dH=0;this.alignment={hgt:null,wdt:null};this.GapLeft=0;this.GapRight=0;this.BrGapLeft=0;this.BrGapRight=0;this.RecalcInfo={bCtrPrp:true,bProps:true};this.Content=[];this.CurPos=0;this.Selection={StartPos:0,EndPos:0,Use:false};this.NearPosArray=[];this.ReviewType=reviewtype_Common;this.ReviewInfo=new CReviewInfo;var Api=editor;if(Api&&!Api.isPresentationEditor&&Api.WordControl&&Api.WordControl.m_oLogicDocument&&true===Api.WordControl.m_oLogicDocument.IsTrackRevisions()){this.ReviewType= reviewtype_Add;this.ReviewInfo.Update()}this.m_oContentChanges=new AscCommon.CContentChanges;return this}CMathBase.prototype=Object.create(CParagraphContentWithParagraphLikeContent.prototype);CMathBase.prototype.constructor=CMathBase;CMathBase.prototype.setContent=function(){for(var i=0;isize.width?Widths[j]:size.width;Ascents[i]=Ascents[i]>size.ascent?Ascents[i]:size.ascent;Descents[i]=Descents[i]>size.height-size.ascent?Descents[i]:size.height-size.ascent}var Heights=[];for(tt=0;tt_ascent?maxAsc:_ascent}PosAlign.y=maxAsc-this.elements[pos_x][pos_y].size.ascent}else if(this.alignment.hgt[pos_x]==MCJC_LEFT)PosAlign.y=0;else{var maxH=0;for(var j=0;j_h?maxH:_h}PosAlign.y=maxH-this.elements[pos_x][pos_y].size.height}var maxW=0;for(var i=0;i_w?maxW:_w}if(this.alignment.wdt[pos_y]== MCJC_CENTER)PosAlign.x=(maxW-this.elements[pos_x][pos_y].size.width)*.5;else if(this.alignment.wdt[pos_y]==MCJC_LEFT)PosAlign.x=0;else PosAlign.x=maxW-this.elements[pos_x][pos_y].size.width;return PosAlign};CMathBase.prototype.setPosition=function(pos,PosInfo){this.UpdatePosBound(pos,PosInfo);if(this.bOneLine){this.pos.x=pos.x;if(this.bInside===true)this.pos.y=pos.y;else this.pos.y=pos.y-this.size.ascent;var maxWH=this.getWidthsHeights();var Widths=maxWH.widths;var Heights=maxWH.heights;var h=0,w= 0;for(var i=0;i1){Ascent=_height;Ascent/=2;var MergedCtrPrp=this.Get_CompiledCtrPrp();Ascent+=this.ParaMath.GetShiftCenter(oMeasure,MergedCtrPrp)}else for(var i=0;i Ascent?this.elements[0][i].size.ascent:Ascent;return Ascent};CMathBase.prototype.alignHor=function(pos,coeff){if(pos!=-1)this.alignment.wdt[pos]=coeff;else for(var j=0;j=this.Content.length)this.CurPos=this.Content.length-1;if(this.CurPos<0)this.CurPos=0};CMathBase.prototype.Undo=function(Data){Data.Undo(this)};CMathBase.prototype.Redo=function(Data){Data.Redo(this)};CMathBase.prototype.Get_AllFontNames=function(AllFonts){this.CtrPrp.Document_Get_AllFontNames(AllFonts);for(var nIndex=0,nCount=this.Content.length;nIndex< nCount;nIndex++)this.Content[nIndex].Get_AllFontNames(AllFonts)};CMathBase.prototype.Create_FontMap=function(Map){if(null===this.ParaMath)return;var CtrPrp=this.Get_CompiledCtrPrp();CtrPrp.Document_CreateFontMap(Map,this.ParaMath.Paragraph.Get_Theme().themeElements.fontScheme);for(var nIndex=0,nCount=this.Content.length;nIndexEndPos)aBounds.push(null);else{var oBounds=this.Content[nIndex].Get_LineBound(_CurLine,_CurRange);if(oBounds==undefined)aBounds.push(null);else if(oBounds.W>.001&&oBounds.H>.001)aBounds.push(oBounds);else aBounds.push(null)}var X=SearchPos.X;var Y=SearchPos.Y;var dDiff=null;var nCurIndex=0;var nFindIndex=0;while(nCurIndexdCurDiff){dDiff=dCurDiff;nFindIndex=nCurIndex}}}nCurIndex++}if(null===aBounds[nFindIndex])return false;SearchPos.CurX=aBounds[nFindIndex].X;SearchPos.CurY=aBounds[nFindIndex].Y;if(false===SearchPos.InText)SearchPos.InTextPos.Update2(nFindIndex, Depth);var bResult=false;if(true===this.Content[nFindIndex].Get_ParaContentPosByXY(SearchPos,Depth+1,_CurLine,_CurRange,StepEnd)){SearchPos.Pos.Update2(nFindIndex,Depth);bResult=true}return bResult};CMathBase.prototype.Get_ParaContentPos=function(bSelection,bStart,ContentPos,bUseCorrection){var nPos=true!==bSelection?this.CurPos:false!==bStart?this.Selection.StartPos:this.Selection.EndPos;ContentPos.Add(nPos);if(undefined!==this.Content[nPos])this.Content[nPos].Get_ParaContentPos(bSelection,bStart, ContentPos,bUseCorrection)};CMathBase.prototype.Set_ParaContentPos=function(ContentPos,Depth){var CurPos=ContentPos.Get(Depth);if(undefined===CurPos||this.CurPos<0){this.CurPos=0;this.Content[this.CurPos].MoveCursorToStartPos()}else if(CurPos>this.Content.length-1){this.CurPos=this.Content.length-1;this.Content[this.CurPos].MoveCursorToEndPos(false)}else{this.CurPos=CurPos;this.Content[this.CurPos].Set_ParaContentPos(ContentPos,Depth+1)}};CMathBase.prototype.Selection_DrawRange=function(_CurLine, _CurRange,SelectionDraw){var CurLine=_CurLine-this.StartLine;var CurRange=0===CurLine?_CurRange-this.StartRange:_CurRange;var SelectionStartPos=this.Selection.StartPos;var SelectionEndPos=this.Selection.EndPos;var SelectionUse=this.Selection.Use;var ContentSelect=true;if(this.bOneLine==false){var StartPos=this.protected_GetRangeStartPos(CurLine,CurRange);var EndPos=this.protected_GetRangeEndPos(CurLine,CurRange);ContentSelect=SelectionStartPos>=StartPos&&SelectionEndPos<=EndPos}if(SelectionUse==true&& SelectionStartPos!==SelectionEndPos){var Bound=this.Bounds.Get_LineBound(CurLine,CurRange);SelectionDraw.FindStart=false;SelectionDraw.W+=Bound.W}else if(SelectionUse==true&&ContentSelect==true){var Item=this.Content[SelectionStartPos];var BoundItem=Item.Get_LineBound(_CurLine,_CurRange);SelectionDraw.StartX=BoundItem.X;Item.Selection_DrawRange(_CurLine,_CurRange,SelectionDraw)}else if(SelectionDraw.FindStart==true)SelectionDraw.StartX+=this.Bounds.Get_Width(CurLine,CurRange)};CMathBase.prototype.IsSelectionEmpty= function(){if(true!==this.Selection.Use)return true;if(this.Selection.StartPos===this.Selection.EndPos)return this.Content[this.Selection.StartPos].IsSelectionEmpty();return false};CMathBase.prototype.GetSelectContent=function(){var nPos=true===this.Selection.Use?this.Selection.StartPos:this.CurPos;return this.Content[nPos].GetSelectContent()};CMathBase.prototype.Is_InnerSelection=function(){if(true===this.Selection.Use&&this.Selection.StartPos===this.Selection.EndPos)return true;return false};CMathBase.prototype.Select_WholeElement= function(){if(null!==this.Parent)this.Parent.Select_Element(this,true)};CMathBase.prototype.Select_MathContent=function(MathContent){for(var nPos=0,nCount=this.Content.length;nPosPos+Count)this.CurPos-=Count;else if(this.CurPos>Pos)this.CurPos=Pos;this.private_CorrectCurPos();this.private_UpdatePosOnRemove(Pos,Count)};CMathBase.prototype.raw_AddToContent=function(Pos,Items,bUpdatePosition){for(var Index=0,Count= Items.length;Index0)this.Pr.Set_Column(Value)};CMathBase.prototype.Recalc_RunsCompiledPr=function(){this.RecalcInfo.bCtrPrp= true;for(var i=0;ithis.Content.length-1){this.CurPos=this.Content.length-1;this.Content[this.CurPos].MoveCursorToEndPos(false)}if(this.CurPos<0){this.CurPos=this.Content.length-1;this.Content[this.CurPos].MoveCursorToStartPos()}}; CMathBase.prototype.Selection_CheckParaContentPos=function(ContentPos,Depth,bStart,bEnd){if(true!==this.Selection.Use)return false;var CurPos=ContentPos.Get(Depth);if(this.Selection.StartPos===this.Selection.EndPos&&this.Selection.StartPos===CurPos)return this.Content[CurPos].Selection_CheckParaContentPos(ContentPos,Depth+1,bStart,bEnd);if(this.Selection.StartPos!==this.Selection.EndPos)return true;return false};CMathBase.prototype.Is_ContentUse=function(MathContent){for(var Pos=0,Count=this.Content.length;Pos< Count;Pos++)if(MathContent===this.Content[Pos])return true;return false};CMathBase.prototype.Is_FromDocument=function(){return this.ParaMath&&this.ParaMath.Paragraph&&this.ParaMath.Paragraph.bFromDocument};CMathBase.prototype.Clear_ContentChanges=function(){this.m_oContentChanges.Clear()};CMathBase.prototype.Add_ContentChanges=function(Changes){this.m_oContentChanges.Add(Changes)};CMathBase.prototype.Refresh_ContentChanges=function(){this.m_oContentChanges.Refresh()};function CMathBasePr(){}CMathBasePr.prototype.Set_FromObject= function(Obj){};CMathBasePr.prototype.Copy=function(){return new CMathBasePr};CMathBasePr.prototype.Write_ToBinary=function(Writer){};CMathBasePr.prototype.Read_FromBinary=function(Reader){};function CMathBounds(){this.Bounds=[]}CMathBounds.prototype.Reset=function(CurLine,CurRange){if(CurRange==0)this.Bounds.length=CurLine};CMathBounds.prototype.CheckLineBound=function(Line,Range){if(this.Bounds.length<=Line)this.Bounds[Line]=[];if(this.Bounds[Line].length<=Range)this.Bounds[Line][Range]=new CMathBoundsMeasures}; CMathBounds.prototype.UpdateMetrics=function(Line,Range,Metric){this.CheckLineBound(Line,Range);this.Bounds[Line][Range].UpdateMetrics(Metric)};CMathBounds.prototype.SetWidth=function(Line,Range,Width){this.CheckLineBound(Line,Range);this.Bounds[Line][Range].SetWidth(Width)};CMathBounds.prototype.SetPage=function(Line,Range,Page){this.CheckLineBound(Line);this.Bounds[Line][Range].SetPage(Page)};CMathBounds.prototype.Get_Width=function(Line,Range){this.CheckLineBound(Line);return this.Bounds[Line][Range].W}; CMathBounds.prototype.GetAscent=function(Line,Range){this.CheckLineBound(Line);return this.Bounds[Line][Range].Asc};CMathBounds.prototype.GetDescent=function(Line,Range){this.CheckLineBound(Line);return this.Bounds[Line][Range].H-this.Bounds[Line][Range].Asc};CMathBounds.prototype.ShiftPage=function(Dx){var CountLines=this.Bounds.length;for(var CurLine=0;CurLinemaxVal)shift=maxVal;var y0= this.elements[0][0].size.height-shift;b=this.elements[0][0].size.height-tg*(this.elements[0][0].size.width+gap);y1=y0;y2=y0+heightSlash;x1=(y1-b)/tg;x2=(y2-b)/tg;xx1=X+x1;xx2=X+x2;yy1=Y+y1;yy2=Y+y2}this.drawFractionalLine(PDSE,xx1,yy1,xx2,yy2);CMathBase.prototype.Draw_Elements.call(this,PDSE)};CFraction.prototype.drawLinearFraction=function(PDSE){var shift=.1*this.dW;var PosLine=this.ParaMath.GetLinePosition(PDSE.Line,PDSE.Range);var X=this.pos.x+PosLine.x+this.GapLeft,Y=this.pos.y+PosLine.y;var x1= X+this.elements[0][0].size.width+this.dW-shift,y1=Y,x2=X+this.elements[0][0].size.width+shift,y2=Y+this.size.height;this.drawFractionalLine(PDSE,x1,y1,x2,y2);CMathBase.prototype.Draw_Elements.call(this,PDSE)};CFraction.prototype.drawFractionalLine=function(PDSE,x1,y1,x2,y2){var mgCtrPrp=this.Get_TxtPrControlLetter();var penW=mgCtrPrp.FontSize*.0211;PDSE.Graphics.SetFont(mgCtrPrp);PDSE.Graphics.p_width(penW*1E3);this.Make_ShdColor(PDSE,this.Get_CompiledCtrPrp());PDSE.Graphics._s();if(PDSE.Graphics.Start_Command){var sideY= y2-y1,sideX=x1-x2;var hypoth=Math.sqrt(sideY*sideY+sideX*sideX);var sin=sideY/hypoth,cos=sideX/hypoth;var dx=sin*penW/2,dy=cos*penW/2;var xx1=x1-dx,yy1=y1-dy,xx2=x1+dx,yy2=y1+dy,xx3=x2+dx,yy3=y2+dy,xx4=x2-dx,yy4=y2-dy;PDSE.Graphics._m(xx1,yy1);PDSE.Graphics._l(xx2,yy2);PDSE.Graphics._l(xx3,yy3);PDSE.Graphics._l(xx4,yy4);PDSE.Graphics._l(xx1,yy1);PDSE.Graphics.df()}else{var intGrid=PDSE.Graphics.GetIntegerGrid();PDSE.Graphics.SetIntegerGrid(true);PDSE.Graphics._s();PDSE.Graphics._m(x1,y1);PDSE.Graphics._l(x2, y2);PDSE.Graphics.ds();PDSE.Graphics.SetIntegerGrid(intGrid)}PDSE.Graphics._s()};CFraction.prototype.getNumerator=function(){var numerator;if(this.Pr.type==BAR_FRACTION||this.Pr.type==NO_BAR_FRACTION)numerator=this.elements[0][0].getElement();else numerator=this.elements[0][0];return numerator};CFraction.prototype.getDenominator=function(){var denominator;if(this.Pr.type==BAR_FRACTION||this.Pr.type==NO_BAR_FRACTION)denominator=this.elements[1][0].getElement();else denominator=this.elements[0][1]; return denominator};CFraction.prototype.getNumeratorMathContent=function(){return this.Content[0]};CFraction.prototype.getDenominatorMathContent=function(){return this.Content[1]};CFraction.prototype.PreRecalc=function(Parent,ParaMath,ArgSize,RPI,GapsInfo){this.Parent=Parent;this.ParaMath=ParaMath;var ArgSzNumDen=ArgSize.Copy();var oMathSettings=Get_WordDocumentDefaultMathSettings();var bInlineBarFaction=RPI.bInline==true&&(this.Pr.type===BAR_FRACTION||this.Pr.type==NO_BAR_FRACTION),bReduceSize=(RPI.bSmallFraction|| RPI.bDecreasedComp==true)&&true==oMathSettings.Get_SmallFrac();if(bInlineBarFaction||bReduceSize){ArgSzNumDen.Decrease();this.ArgSize.SetValue(-1)}else if(RPI.bDecreasedComp==true)this.ArgSize.SetValue(-1);else this.ArgSize.SetValue(0);this.Set_CompiledCtrPrp(Parent,ParaMath,RPI);this.ApplyProperties(RPI);var bDecreasedComp=RPI.bDecreasedComp,bSmallFraction=RPI.bSmallFraction;if(this.Pr.type!==LINEAR_FRACTION)RPI.bDecreasedComp=true;RPI.bSmallFraction=true;if(this.bInside==false)GapsInfo.setGaps(this, this.TextPrControlLetter.FontSize);this.Numerator.PreRecalc(this,ParaMath,ArgSzNumDen,RPI);this.Denominator.PreRecalc(this,ParaMath,ArgSzNumDen,RPI);RPI.bDecreasedComp=bDecreasedComp;RPI.bSmallFraction=bSmallFraction};CFraction.prototype.Recalculate_Range=function(PRS,ParaPr,Depth){var WordLen=PRS.WordLen;var bContainCompareOper=PRS.bContainCompareOper;var bOneLine=PRS.bMath_OneLine;this.bOneLine=this.bCanBreak==false||PRS.bMath_OneLine==true;this.BrGapLeft=this.GapLeft;this.BrGapRight=this.GapRight; PRS.bMath_OneLine=this.bOneLine;this.Numerator.Recalculate_Reset(PRS.Range,PRS.Line,PRS);this.Numerator.Recalculate_Range(PRS,ParaPr,Depth);var bNumBarFraction=PRS.bSingleBarFraction;this.Denominator.Recalculate_Reset(PRS.Range,PRS.Line,PRS);this.Denominator.Recalculate_Range(PRS,ParaPr,Depth);var bDenBarFraction=PRS.bSingleBarFraction;if(this.Pr.type==BAR_FRACTION||this.Pr.type==NO_BAR_FRACTION)this.recalculateBarFraction(g_oTextMeasurer,bNumBarFraction,bDenBarFraction);else if(this.Pr.type==SKEWED_FRACTION)this.recalculateSkewed(g_oTextMeasurer); else if(this.Pr.type==LINEAR_FRACTION)this.recalculateLinear(g_oTextMeasurer);this.UpdatePRS_OneLine(PRS,WordLen,PRS.MathFirstItem);this.Bounds.SetWidth(0,0,this.size.width);this.Bounds.UpdateMetrics(0,0,this.size);PRS.bMath_OneLine=bOneLine;PRS.bContainCompareOper=bContainCompareOper};CFraction.prototype.recalculateBarFraction=function(oMeasure,bNumBarFraction,bDenBarFraction){var Plh=new CMathText(true);Plh.add(11034);this.MeasureJustDraw(Plh);var num=this.elements[0][0].size,den=this.elements[1][0].size; var NumWidth=bNumBarFraction?num.width+.25*Plh.size.width:num.width;var DenWidth=bDenBarFraction?den.width+.25*Plh.size.width:den.width;var mgCtrPrp=this.Get_TxtPrControlLetter();var width=NumWidth>DenWidth?NumWidth:DenWidth;var height=num.height+den.height;var ascent=num.height+this.ParaMath.GetShiftCenter(oMeasure,mgCtrPrp);width+=this.GapLeft+this.GapRight;this.size.height=height;this.size.width=width;this.size.ascent=ascent};CFraction.prototype.recalculateSkewed=function(oMeasure){var mgCtrPrp= this.Get_TxtPrControlLetter();this.dW=5.011235894097222*mgCtrPrp.FontSize/36;var width=this.elements[0][0].size.width+this.dW+this.elements[0][1].size.width;var height=this.elements[0][0].size.height+this.elements[0][1].size.height;var ascent=this.elements[0][0].size.height+this.ParaMath.GetShiftCenter(oMeasure,mgCtrPrp);width+=this.GapLeft+this.GapRight;this.size.height=height;this.size.width=width;this.size.ascent=ascent};CFraction.prototype.recalculateLinear=function(){var AscentFirst=this.elements[0][0].size.ascent, DescentFirst=this.elements[0][0].size.height-this.elements[0][0].size.ascent,AscentSecond=this.elements[0][1].size.ascent,DescentSecond=this.elements[0][1].size.height-this.elements[0][1].size.ascent;var H=AscentFirst+DescentSecond;var mgCtrPrp=this.Get_TxtPrControlLetter();var gap=5.011235894097222*mgCtrPrp.FontSize/36;var H3=gap*4.942252165543792,H4=gap*7.913378248315688,H5=gap*9.884504331087584;if(HAscentSecond?AscentFirst:AscentSecond;var descent=DescentFirst>DescentSecond?DescentFirst:DescentSecond;var height=ascent+descent;var width=this.elements[0][0].size.width+this.dW+this.elements[0][1].size.width;width+=this.GapLeft+this.GapRight;this.size.height=height;this.size.width=width;this.size.ascent=ascent};CFraction.prototype.setPosition=function(pos,PosInfo){if(this.Pr.type==SKEWED_FRACTION){this.UpdatePosBound(pos,PosInfo);var Numerator=this.Content[0],Denominator=this.Content[1]; this.pos.x=pos.x;this.pos.y=pos.y-this.size.ascent;var X=this.pos.x+this.GapLeft,Y=this.pos.y;var PosNum=new CMathPosition;PosNum.x=X;PosNum.y=Y+Numerator.size.ascent;var PosDen=new CMathPosition;PosDen.x=X+Numerator.size.width+this.dW;PosDen.y=Y+Numerator.size.height+Denominator.size.ascent;Numerator.setPosition(PosNum,PosInfo);Denominator.setPosition(PosDen,PosInfo);pos.x+=this.size.width}else CMathBase.prototype.setPosition.call(this,pos,PosInfo)};CFraction.prototype.align=function(pos_x,pos_y){var PosAlign= new CMathPosition;if(this.Pr.type==BAR_FRACTION||this.Pr.type==NO_BAR_FRACTION){var width=this.size.width-this.GapLeft-this.GapRight;if(pos_x==0)PosAlign.x=(width-this.Numerator.size.width)*.5;else PosAlign.x=(width-this.Denominator.size.width)*.5}else if(this.Pr.type==LINEAR_FRACTION)PosAlign.y=this.size.ascent-this.elements[pos_x][pos_y].size.ascent;return PosAlign};CFraction.prototype.fillContent=function(){this.Numerator=new CNumerator(this.Content[0]);this.Denominator=new CDenominator(this.Content[1]); if(this.Pr.type==BAR_FRACTION||this.Pr.type==NO_BAR_FRACTION){this.setDimension(2,1);this.elements[0][0]=this.Numerator;this.elements[1][0]=this.Denominator}else if(this.Pr.type==SKEWED_FRACTION){this.setDimension(1,2);this.elements[0][0]=this.Numerator.getElement();this.elements[0][1]=this.Denominator.getElement()}else if(this.Pr.type==LINEAR_FRACTION){this.setDimension(1,2);this.elements[0][0]=this.Numerator.getElement();this.elements[0][1]=this.Denominator.getElement()}};CFraction.prototype.Apply_MenuProps= function(Props){if(Props.Type==Asc.c_oAscMathInterfaceType.Fraction&&Props.FractionType!==undefined){var FractionType=this.Pr.type;switch(Props.FractionType){case Asc.c_oAscMathInterfaceFraction.Bar:FractionType=BAR_FRACTION;break;case Asc.c_oAscMathInterfaceFraction.Skewed:FractionType=SKEWED_FRACTION;break;case Asc.c_oAscMathInterfaceFraction.Linear:FractionType=LINEAR_FRACTION;break;case Asc.c_oAscMathInterfaceFraction.NoBar:FractionType=NO_BAR_FRACTION;break}if(FractionType!==this.Pr.type){AscCommon.History.Add(new CChangesMathFractionType(this, this.Pr.type,FractionType));this.raw_SetFractionType(FractionType)}}};CFraction.prototype.Get_InterfaceProps=function(){return new CMathMenuFraction(this)};CFraction.prototype.raw_SetFractionType=function(FractionType){this.Pr.type=FractionType;this.fillContent()};function CMathMenuFraction(Fraction){CMathMenuBase.call(this,Fraction);this.Type=Asc.c_oAscMathInterfaceType.Fraction;if(undefined!==Fraction){this.FractionType=Asc.c_oAscMathInterfaceFraction.Bar;switch(Fraction.Pr.type){case BAR_FRACTION:this.FractionType= Asc.c_oAscMathInterfaceFraction.Bar;break;case SKEWED_FRACTION:this.FractionType=Asc.c_oAscMathInterfaceFraction.Skewed;break;case LINEAR_FRACTION:this.FractionType=Asc.c_oAscMathInterfaceFraction.Linear;break;case NO_BAR_FRACTION:this.FractionType=Asc.c_oAscMathInterfaceFraction.NoBar;break}}else this.FractionType=undefined}CMathMenuFraction.prototype=Object.create(CMathMenuBase.prototype);CMathMenuFraction.prototype.constructor=CMathMenuFraction;CMathMenuFraction.prototype.get_FractionType=function(){return this.FractionType}; CMathMenuFraction.prototype.put_FractionType=function(Type){this.FractionType=Type};window["CMathMenuFraction"]=CMathMenuFraction;CMathMenuFraction.prototype["get_FractionType"]=CMathMenuFraction.prototype.get_FractionType;CMathMenuFraction.prototype["put_FractionType"]=CMathMenuFraction.prototype.put_FractionType;function CFractionBase(bInside,MathContent){CMathBase.call(this,bInside);this.gap=0;this.init(MathContent)}CFractionBase.prototype=Object.create(CMathBase.prototype);CFractionBase.prototype.constructor= CFractionBase;CFractionBase.prototype.init=function(MathContent){this.setDimension(1,1);this.elements[0][0]=MathContent};CFractionBase.prototype.getElement=function(){return this.elements[0][0]};CFractionBase.prototype.setElement=function(Element){this.elements[0][0]=Element};CFractionBase.prototype.getPropsForWrite=function(){return{}};CFractionBase.prototype.Get_Id=function(){return this.elements[0][0].Get_Id()};function CNumerator(MathContent){CFractionBase.call(this,true,MathContent)}CNumerator.prototype= Object.create(CFractionBase.prototype);CNumerator.prototype.constructor=CNumerator;CNumerator.prototype.recalculateSize=function(){var arg=this.elements[0][0].size;var mgCtrPrp=this.Get_TxtPrControlLetter();var Descent=arg.height-arg.ascent;g_oTextMeasurer.SetFont(mgCtrPrp);var Height=g_oTextMeasurer.GetHeight();var gapNum,minGap;if(this.Parent.kind==MATH_LIMIT||this.Parent.kind==MATH_GROUP_CHARACTER){gapNum=Height/4.14;minGap=Height/13.8;var delta=gapNum-Descent;this.gap=delta>minGap?delta:minGap}else{gapNum= Height/3.05;minGap=Height/9.77;var delta=gapNum-Descent;this.gap=delta>minGap?delta:minGap}var width=arg.width;var height=arg.height+this.gap;var ascent=arg.ascent;this.size.height=height;this.size.width=width;this.size.ascent=ascent};function CDenominator(MathContent){CFractionBase.call(this,true,MathContent)}CDenominator.prototype=Object.create(CFractionBase.prototype);CDenominator.prototype.constructor=CDenominator;CDenominator.prototype.recalculateSize=function(){var arg=this.elements[0][0].size; var mgCtrPrp=this.Get_TxtPrControlLetter();var Ascent=arg.ascent-4.939*mgCtrPrp.FontSize/36;g_oTextMeasurer.SetFont(mgCtrPrp);var Height=g_oTextMeasurer.GetHeight();var gapDen,minGap;if(this.Parent.kind==MATH_PRIMARY_LIMIT||this.Parent.kind==MATH_GROUP_CHARACTER){gapDen=Height/2.6;minGap=Height/10}else{gapDen=Height/2.03;minGap=Height/6.1}var delta=gapDen-Ascent;this.gap=delta>minGap?delta:minGap;var width=arg.width;var height=arg.height+this.gap;var ascent=arg.ascent+this.gap;this.size.height=height; this.size.width=width;this.size.ascent=ascent};CDenominator.prototype.setPosition=function(pos,PosInfo){pos.y+=this.gap;CFractionBase.prototype.setPosition.call(this,pos,PosInfo)};window["AscCommonWord"]=window["AscCommonWord"]||{};window["AscCommonWord"].CFraction=CFraction;"use strict";var g_oTextMeasurer=AscCommon.g_oTextMeasurer;function CMathDegreePr(){this.type=DEGREE_SUPERSCRIPT}CMathDegreePr.prototype.Set_FromObject=function(Obj){if(DEGREE_SUPERSCRIPT===Obj.type||DEGREE_SUBSCRIPT===Obj.type)this.type= Obj.type;else this.type=DEGREE_SUPERSCRIPT};CMathDegreePr.prototype.Copy=function(){var NewPr=new CMathDegreePr;NewPr.type=this.type;return NewPr};CMathDegreePr.prototype.Write_ToBinary=function(Writer){Writer.WriteLong(this.type)};CMathDegreePr.prototype.Read_FromBinary=function(Reader){this.type=Reader.GetLong(Reader)};function CDegreeBase(props,bInside){CMathBase.call(this,bInside);this.upBase=0;this.upIter=0;this.Pr=new CMathDegreePr;this.baseContent=null;this.iterContent=null;this.bNaryInline= false;if(props!==null&&typeof props!=="undefined")this.init(props)}CDegreeBase.prototype=Object.create(CMathBase.prototype);CDegreeBase.prototype.constructor=CDegreeBase;CDegreeBase.prototype.init=function(props){this.setProperties(props);this.setDimension(1,2)};CDegreeBase.prototype.fillContent=function(){this.setDimension(1,2);this.elements[0][0]=this.baseContent;this.elements[0][1]=this.iterContent};CDegreeBase.prototype.PreRecalc=function(Parent,ParaMath,ArgSize,RPI,GapsInfo){this.Parent=Parent; this.ParaMath=ParaMath;this.Set_CompiledCtrPrp(Parent,ParaMath,RPI);this.ApplyProperties(RPI);if(this.bInside==false)GapsInfo.setGaps(this,this.TextPrControlLetter.FontSize);this.baseContent.PreRecalc(this,ParaMath,ArgSize,RPI);var ArgSzDegr=ArgSize.Copy();ArgSzDegr.Decrease();this.bNaryInline=RPI.bNaryInline;var bDecreasedComp=RPI.bDecreasedComp;RPI.bDecreasedComp=true;this.iterContent.PreRecalc(this,ParaMath,ArgSzDegr,RPI);RPI.bDecreasedComp=bDecreasedComp};CDegreeBase.prototype.Resize=function(oMeasure, RPI){this.baseContent.Resize(oMeasure,RPI);this.iterContent.Resize(oMeasure,RPI);this.setDistance();if(this.Pr.type===DEGREE_SUPERSCRIPT)this.GetSizeSup(oMeasure);else if(this.Pr.type===DEGREE_SUBSCRIPT)this.GetSizeSubScript(oMeasure)};CDegreeBase.prototype.recalculateSize=function(oMeasure){var Metric=new CMathBoundsMeasures;Metric.UpdateMetrics(this.baseContent.size);Metric.SetWidth(this.baseContent.size.width);this.setDistance();var ResultSize;if(this.Pr.type===DEGREE_SUPERSCRIPT)ResultSize=this.GetSizeSup(oMeasure, Metric);else if(this.Pr.type===DEGREE_SUBSCRIPT)ResultSize=this.GetSizeSubScript(oMeasure,Metric);this.size.Set(ResultSize)};CDegreeBase.prototype.GetSizeSup=function(oMeasure,Metric){var iter=this.iterContent.size,baseAsc=Metric.Asc,baseHeight=Metric.H,baseWidth=Metric.W;var mgCtrPrp=this.Get_TxtPrControlLetter();this.upBase=0;this.upIter=0;var bTextElement=false,lastElem;if(!this.baseContent.IsJustDraw()){lastElem=this.baseContent.GetLastElement();var bSameFontSize=lastElem.Type==para_Math_Run&& lastElem.Math_CompareFontSize(mgCtrPrp.FontSize,false);bTextElement=bSameFontSize||lastElem.Type!==para_Math_Run&&lastElem.IsJustDraw()}var PlH=.64*this.ParaMath.GetPlh(oMeasure,mgCtrPrp);var UpBaseline=.75*PlH;if(bTextElement){var last=lastElem.size,upBaseLast=0,upBaseIter=0;if(last.ascent-UpBaseline+(iter.height-iter.ascent)>last.ascent-2/9*PlH)upBaseLast=iter.height-(last.ascent-2/9*PlH);else if(UpBaseline+iter.ascent>last.ascent)upBaseLast=UpBaseline+iter.ascent-last.ascent;else upBaseIter=last.ascent- UpBaseline-iter.ascent;if(upBaseLast+last.ascent>baseAsc){this.upBase=upBaseLast-(baseAsc-last.ascent);this.upIter=upBaseIter}else{this.upBase=0;this.upIter=baseAsc-upBaseLast-last.ascent+upBaseIter}}else{var shCenter=this.ParaMath.GetShiftCenter(oMeasure,mgCtrPrp);if(iter.height-iter.ascent+shCenter>baseAsc)this.upBase=iter.height-(baseAsc-shCenter);else if(iter.ascent>shCenter)this.upBase=iter.ascent-shCenter;else this.upIter=shCenter-iter.ascent}var height=this.upBase+baseHeight;var ascent=this.upBase+ baseAsc;this.upIter-=ascent;var width=baseWidth+iter.width+this.dW;width+=this.GapLeft+this.GapRight;var ResultSize=new CMathSize;ResultSize.height=height;ResultSize.width=width;ResultSize.ascent=ascent;return ResultSize};CDegreeBase.prototype.GetSizeSubScript=function(oMeasure,Metric){var iter=this.iterContent.size,baseAsc=Metric.Asc,baseHeight=Metric.H,baseWidth=Metric.W;var mgCtrPrp=this.Get_TxtPrControlLetter();var shCenter=this.ParaMath.GetShiftCenter(oMeasure,mgCtrPrp);var bTextElement=false; if(!this.baseContent.IsJustDraw()){var lastElem=this.baseContent.GetLastElement();var bSameFontSize=lastElem.Type==para_Math_Run&&lastElem.Math_CompareFontSize(mgCtrPrp.FontSize,false);bTextElement=bSameFontSize||lastElem.Type!==para_Math_Run&&lastElem.IsJustDraw()}var height,ascent,descent;var PlH=.64*this.ParaMath.GetPlh(oMeasure,mgCtrPrp);if(bTextElement){var DownBaseline=.9*shCenter;if(iter.ascent-DownBaseline>3/4*PlH)this.upIter=1/4*PlH;else this.upIter=PlH+DownBaseline-iter.ascent;if(baseAsc> PlH)this.upIter+=baseAsc-PlH;var descentBase=baseHeight-baseAsc,descentIter=this.upIter+iter.height-baseAsc;descent=descentBase>descentIter?descentBase:descentIter;ascent=baseAsc;height=ascent+descent}else{this.upIter=baseHeight+shCenter-iter.ascent;if(baseAsc-1.5*shCenter>this.upIter)this.upIter=baseAsc-1.5*shCenter;height=this.upIter+iter.height;ascent=baseAsc}this.upIter-=ascent;var width=baseWidth+iter.width+this.dW;width+=this.GapLeft+this.GapRight;var ResultSize=new CMathSize;ResultSize.height= height;ResultSize.width=width;ResultSize.ascent=ascent;return ResultSize};CDegreeBase.prototype.setDistance=function(){var mgCtrPrp=this.Get_TxtPrControlLetter();var PlH=.64*this.ParaMath.GetPlh(g_oTextMeasurer,mgCtrPrp);if(this.bNaryInline)this.dW=.17*PlH;else this.dW=.056*PlH};CDegreeBase.prototype.setPosition=function(pos,PosInfo){this.UpdatePosBound(pos,PosInfo);var Line=PosInfo.CurLine,Range=PosInfo.CurRange;var CurLine=Line-this.StartLine;var CurRange=0===CurLine?Range-this.StartRange:Range; var X,Y;if(this.bOneLine){this.pos.x=pos.x;if(this.bInside===true)this.pos.y=pos.y;else this.pos.y=pos.y-this.size.ascent;X=this.pos.x+this.BrGapLeft;Y=this.pos.y;var PosBase=new CMathPosition;PosBase.y=Y;PosBase.x=X;PosBase.y+=this.size.ascent-this.baseContent.size.ascent;if(!this.baseContent.IsJustDraw())PosBase.y+=this.baseContent.size.ascent;this.baseContent.setPosition(PosBase,PosInfo);var PosIter=new CMathPosition;PosIter.x=X+this.baseContent.size.width+this.dW;PosIter.y=Y+this.size.ascent+ this.upIter+this.iterContent.size.ascent;this.iterContent.setPosition(PosIter,PosInfo);pos.x+=this.size.width}else{if(CurLine==0&&CurRange==0)pos.x+=this.BrGapLeft;Y=pos.y;this.baseContent.setPosition(pos,PosInfo);var EndPos=this.protected_GetRangeEndPos(CurLine,CurRange);var Lng=this.Content.length;if(EndPos==Lng-1){pos.x+=this.dW;pos.y+=this.upIter+this.iterContent.size.ascent;this.iterContent.setPosition(pos,PosInfo);pos.x+=this.BrGapRight}pos.y=Y}};CDegreeBase.prototype.getIterator=function(){return this.iterContent}; CDegreeBase.prototype.getUpperIterator=function(){return this.iterContent};CDegreeBase.prototype.getLowerIterator=function(){return this.iterContent};CDegreeBase.prototype.getBase=function(){return this.baseContent};CDegreeBase.prototype.IsPlhIterator=function(){return this.iterContent.IsPlaceholder()};CDegreeBase.prototype.setBase=function(base){this.baseContent=base};CDegreeBase.prototype.setIterator=function(iterator){this.iterContent=iterator};function CDegree(props,bInside){CDegreeBase.call(this, props,bInside);this.Id=AscCommon.g_oIdCounter.Get_NewId();if(props!==null&&typeof props!=="undefined")this.init(props);AscCommon.g_oTableId.Add(this,this.Id)}CDegree.prototype=Object.create(CDegreeBase.prototype);CDegree.prototype.constructor=CDegree;CDegree.prototype.ClassType=AscDFH.historyitem_type_deg;CDegree.prototype.kind=MATH_DEGREE;CDegree.prototype.init=function(props){this.Fill_LogicalContent(2);this.setProperties(props);this.fillContent()};CDegree.prototype.fillContent=function(){this.NeedBreakContent(0); this.iterContent=this.Content[1];this.baseContent=this.Content[0];CDegreeBase.prototype.fillContent.call(this)};CDegree.prototype.Recalculate_LineMetrics=function(PRS,ParaPr,_CurLine,_CurRange,ContentMetrics){var CurLine=_CurLine-this.StartLine;var CurRange=0===CurLine?_CurRange-this.StartRange:_CurRange;if(PRS.bFastRecalculate===false)this.Bounds.Reset(CurLine,CurRange);if(this.bOneLine==false&&this.baseContent.Math_Is_End(_CurLine,_CurRange)){var NewContentMetrics=new CMathBoundsMeasures;this.iterContent.Recalculate_LineMetrics(PRS, ParaPr,_CurLine,_CurRange,NewContentMetrics);this.baseContent.Recalculate_LineMetrics(PRS,ParaPr,_CurLine,_CurRange,NewContentMetrics);var BoundBase=this.baseContent.Get_LineBound(_CurLine,_CurRange);var Bound;if(this.Pr.type===DEGREE_SUPERSCRIPT)Bound=this.GetSizeSup(g_oTextMeasurer,BoundBase);else Bound=this.GetSizeSubScript(g_oTextMeasurer,BoundBase);this.Bounds.UpdateMetrics(CurLine,CurRange,Bound);ContentMetrics.UpdateMetrics(Bound);this.UpdatePRS(PRS,Bound)}else CDegreeBase.prototype.Recalculate_LineMetrics.call(this, PRS,ParaPr,_CurLine,_CurRange,ContentMetrics)};CDegree.prototype.setPosition=function(pos,PosInfo){var Line=PosInfo.CurLine,Range=PosInfo.CurRange;var CurLine=Line-this.StartLine;var CurRange=0===CurLine?Range-this.StartRange:Range;var EndPos=this.protected_GetRangeEndPos(CurLine,CurRange);var Len=this.Content.length;if(this.bOneLine||EndPos==Len-1)CDegreeBase.prototype.setPosition.call(this,pos,PosInfo);else CMathBase.prototype.setPosition.call(this,pos,PosInfo)};CDegree.prototype.Get_InterfaceProps= function(){var Type=this.Pr.type==DEGREE_SUBSCRIPT?Asc.c_oAscMathInterfaceScript.Sub:Asc.c_oAscMathInterfaceScript.Sup;return new CMathMenuScript(this,Type)};CDegree.prototype.Can_ModifyArgSize=function(){return this.CurPos==1&&false===this.Is_SelectInside()};function CIterators(iterUp,iterDn){CMathBase.call(this,true);this.iterUp=iterUp;this.iterDn=iterDn}CIterators.prototype=Object.create(CMathBase.prototype);CIterators.prototype.constructor=CIterators;CIterators.prototype.init=function(){this.setDimension(2, 1);this.elements[0][0]=this.iterUp;this.elements[1][0]=this.iterDn};CIterators.prototype.PreRecalc=function(Parent,ParaMath,ArgSize,RPI,GapsInfo){this.Parent=Parent;this.ParaMath=ParaMath;this.ArgSize.SetValue(-1);var ArgSzIters=ArgSize.Copy();ArgSzIters.Merge(this.ArgSize);this.Set_CompiledCtrPrp(Parent,ParaMath,RPI);var bDecreasedComp=RPI.bDecreasedComp;RPI.bDecreasedComp=true;this.iterUp.PreRecalc(this,ParaMath,ArgSzIters,RPI);this.iterDn.PreRecalc(this,ParaMath,ArgSzIters,RPI);RPI.bDecreasedComp= bDecreasedComp};CIterators.prototype.recalculateSize=function(oMeasure,dH,ascent){this.dH=dH;var iterUp=this.iterUp.size,iterDown=this.iterDn.size;this.size.ascent=ascent;this.size.height=iterUp.height+dH+iterDown.height;this.size.width=iterUp.width>iterDown.width?iterUp.width:iterDown.width};CIterators.prototype.getUpperIterator=function(){return this.elements[0][0]};CIterators.prototype.getLowerIterator=function(){return this.elements[1][0]};CIterators.prototype.setUpperIterator=function(iterator){this.elements[0][0]= iterator};CIterators.prototype.setLowerIterator=function(iterator){this.elements[1][0]=iterator};CIterators.prototype.alignIterators=function(mcJc){this.alignment.wdt[0]=mcJc};CIterators.prototype.setPosition=function(pos,PosInfo){this.pos.x=pos.x;this.pos.y=pos.y;var UpIterPos=new CMathPosition;var al=this.align(0,0);UpIterPos.x=this.pos.x+this.GapLeft+al.x;UpIterPos.y=this.pos.y+this.iterUp.size.ascent;var DownIterPos=new CMathPosition;al=this.align(1,0);DownIterPos.x=this.pos.x+this.GapLeft+al.x; DownIterPos.y=this.pos.y+this.dH+this.iterUp.size.height+this.iterDn.size.ascent;this.iterDn.setPosition(DownIterPos,PosInfo);this.iterUp.setPosition(UpIterPos,PosInfo);pos.x+=this.size.width};function CMathDegreeSubSupPr(){this.type=DEGREE_SubSup;this.alnScr=false}CMathDegreeSubSupPr.prototype.Set_FromObject=function(Obj){if(true===Obj.alnScr||1===Obj.alnScr)this.alnScr=true;else this.alnScr=false;if(DEGREE_SubSup===Obj.type||DEGREE_PreSubSup===Obj.type)this.type=Obj.type};CMathDegreeSubSupPr.prototype.Copy= function(){var NewPr=new CMathDegreeSubSupPr;NewPr.type=this.type;NewPr.alnScr=this.alnScr;return NewPr};CMathDegreeSubSupPr.prototype.Write_ToBinary=function(Writer){Writer.WriteLong(this.type);Writer.WriteBool(this.alnScr)};CMathDegreeSubSupPr.prototype.Read_FromBinary=function(Reader){this.type=Reader.GetLong();this.alnScr=Reader.GetBool()};function CDegreeSubSupBase(props,bInside){CMathBase.call(this,bInside);this.bNaryInline=false;this.Pr=new CMathDegreeSubSupPr;this.baseContent=null;this.iters= new CIterators(null,null);if(props!==null&&typeof props!=="undefined")this.init(props)}CDegreeSubSupBase.prototype=Object.create(CMathBase.prototype);CDegreeSubSupBase.prototype.constructor=CDegreeSubSupBase;CDegreeSubSupBase.prototype.init=function(props){this.setProperties(props);this.setDimension(1,2)};CDegreeSubSupBase.prototype.fillContent=function(){var oBase=this.baseContent;var oIters=this.iters;this.setDimension(1,2);oIters.init();if(this.Pr.type==DEGREE_SubSup){oIters.alignIterators(MCJC_LEFT); this.addMCToContent([oBase,oIters])}else if(this.Pr.type==DEGREE_PreSubSup){this.addMCToContent([oIters,oBase]);oIters.alignIterators(MCJC_RIGHT)}};CDegreeSubSupBase.prototype.PreRecalc=function(Parent,ParaMath,ArgSize,RPI,GapsInfo){this.bNaryInline=RPI.bNaryInline;CMathBase.prototype.PreRecalc.call(this,Parent,ParaMath,ArgSize,RPI,GapsInfo)};CDegreeSubSupBase.prototype.recalculateSize=function(oMeasure){var Metric=new CMathBoundsMeasures;Metric.UpdateMetrics(this.baseContent.size);Metric.SetWidth(this.baseContent.size.width); var ResultSize=this.GetSize(oMeasure,Metric);this.size.Set(ResultSize)};CDegreeSubSupBase.prototype.GetSize=function(oMeasure,Metric){var mgCtrPrp=this.Get_CompiledCtrPrp();var iterUp=this.iters.iterUp.size,iterDown=this.iters.iterDn.size;var baseAsc=Metric.Asc,baseHeight=Metric.H,baseWidth=Metric.W;var shCenter=1.4*this.ParaMath.GetShiftCenter(oMeasure,mgCtrPrp);var PlH=.26*this.ParaMath.GetPlh(oMeasure,mgCtrPrp);var height,width,ascent,descent;var dH;var minGap;var TextElement=false;if(!this.baseContent.IsJustDraw()){var bFirstItem= this.Pr.type==DEGREE_SubSup;var BaseItem=bFirstItem?this.baseContent.GetLastElement():this.baseContent.GetFirstElement();var bSameFontSize=BaseItem.Type==para_Math_Run&&BaseItem.Math_CompareFontSize(mgCtrPrp.FontSize,bFirstItem);TextElement=bSameFontSize||BaseItem.Type!==para_Math_Run&&BaseItem.IsJustDraw()}if(TextElement){minGap=.5*PlH;var DivBaseline=3.034*PlH;var ascIters,dgrHeight;if(DivBaseline>minGap+iterDown.ascent+(iterUp.height-iterUp.ascent))dH=DivBaseline-iterDown.ascent-(iterUp.height- iterUp.ascent);else dH=minGap;var GapDown=PlH;ascIters=iterUp.height+dH+GapDown;dgrHeight=iterDown.height+iterUp.height+dH;ascent=ascIters>baseAsc?ascIters:baseAsc;var dscIter=dgrHeight-ascIters,dscBase=baseHeight-baseAsc;descent=dscIter>dscBase?dscIter:dscBase;height=ascent+descent;this.iters.recalculateSize(oMeasure,dH,ascIters)}else{minGap=.7*PlH;var lUpBase=baseAsc-shCenter;var lDownBase=baseHeight-lUpBase;var DescUpIter=iterUp.height-iterUp.ascent+PlH;var AscDownIter=iterDown.ascent-PlH;var UpGap, DownGap;if(this.bNaryInline){UpGap=0;DownGap=0}else{UpGap=lUpBase>DescUpIter?lUpBase-DescUpIter:0;DownGap=lDownBase>AscDownIter?lDownBase-AscDownIter:0}if(UpGap+DownGap>minGap)dH=UpGap+DownGap;else dH=minGap;height=iterUp.height+dH+iterDown.height;ascent=iterUp.height+UpGap+shCenter;this.iters.recalculateSize(oMeasure,dH,ascent)}if(this.bNaryInline)this.dW=.42*PlH;else this.dW=.14*PlH;width=this.iters.size.width+baseWidth+this.dW;width+=this.GapLeft+this.GapRight;var ResultSize=new CMathSize;ResultSize.height= height;ResultSize.width=width;ResultSize.ascent=ascent;return ResultSize};CDegreeSubSupBase.prototype.getBase=function(){return this.baseContent};CDegreeSubSupBase.prototype.getUpperIterator=function(){return this.iters.iterUp};CDegreeSubSupBase.prototype.getLowerIterator=function(){return this.iters.iterDn};CDegreeSubSupBase.prototype.setBase=function(base){this.baseContent=base};CDegreeSubSupBase.prototype.setUpperIterator=function(iterator){this.iters.iterUp=iterator};CDegreeSubSupBase.prototype.setLowerIterator= function(iterator){this.iters.iterDn=iterator};function CDegreeSubSup(props,bInside){CDegreeSubSupBase.call(this,props,bInside);this.Id=AscCommon.g_oIdCounter.Get_NewId();if(props!==null&&typeof props!=="undefined")this.init(props);AscCommon.g_oTableId.Add(this,this.Id)}CDegreeSubSup.prototype=Object.create(CDegreeSubSupBase.prototype);CDegreeSubSup.prototype.constructor=CDegreeSubSup;CDegreeSubSup.prototype.ClassType=AscDFH.historyitem_type_deg_subsup;CDegreeSubSup.prototype.kind=MATH_DEGREESubSup; CDegreeSubSup.prototype.init=function(props){this.Fill_LogicalContent(3);this.setProperties(props);this.fillContent()};CDegreeSubSup.prototype.fillContent=function(){if(this.Pr.type==DEGREE_SubSup){this.bCanBreak=true;this.NumBreakContent=0}else this.bCanBreak=false;this.baseContent=this.Content[0];this.iters=new CIterators(this.Content[1],this.Content[2]);CDegreeSubSupBase.prototype.fillContent.call(this)};CDegreeSubSup.prototype.Recalculate_LineMetrics=function(PRS,ParaPr,_CurLine,_CurRange,ContentMetrics){var CurLine= _CurLine-this.StartLine;var CurRange=0===CurLine?_CurRange-this.StartRange:_CurRange;if(PRS.bFastRecalculate===false)this.Bounds.Reset(CurLine,CurRange);if(this.bOneLine===false&&true===this.Need_Iters(_CurLine,_CurRange)){var NewContentMetrics=new CMathBoundsMeasures;this.Content[1].Recalculate_LineMetrics(PRS,ParaPr,_CurLine,_CurRange,NewContentMetrics);this.Content[2].Recalculate_LineMetrics(PRS,ParaPr,_CurLine,_CurRange,NewContentMetrics);this.Content[0].Recalculate_LineMetrics(PRS,ParaPr,_CurLine, _CurRange,NewContentMetrics);var BoundBase=this.baseContent.Get_LineBound(_CurLine,_CurRange);var Bound=this.GetSize(g_oTextMeasurer,BoundBase);this.Bounds.UpdateMetrics(CurLine,CurRange,Bound);ContentMetrics.UpdateMetrics(Bound);this.iters.Recalculate_Reset(PRS.Range,PRS.Line,PRS);this.iters.Bounds.Reset(0,0);this.iters.Bounds.UpdateMetrics(0,0,this.iters.size);this.UpdatePRS(PRS,Bound)}else CDegreeSubSupBase.prototype.Recalculate_LineMetrics.call(this,PRS,ParaPr,_CurLine,_CurRange,ContentMetrics)}; CDegreeSubSup.prototype.Recalculate_Range=function(PRS,ParaPr,Depth){this.bOneLine=this.bCanBreak==false||PRS.bMath_OneLine==true;if(this.bOneLine===true)CDegreeSubSupBase.prototype.Recalculate_Range.call(this,PRS,ParaPr,Depth);else{var CurLine=PRS.Line-this.StartLine;var CurRange=0===CurLine?PRS.Range-this.StartRange:PRS.Range;var bContainCompareOper=PRS.bContainCompareOper;var iterUp=this.iters.iterUp,iterDn=this.iters.iterDn;this.setDistance();var RangeStartPos=this.protected_AddRange(CurLine, CurRange),RangeEndPos=0;if(CurLine==0&&CurRange==0){PRS.WordLen+=this.BrGapLeft;this.baseContent.Recalculate_Reset(PRS.Range,PRS.Line,PRS)}PRS.Update_CurPos(0,Depth);PRS.bMath_OneLine=false;if(this.Pr.type==DEGREE_SubSup)this.baseContent.Recalculate_Range(PRS,ParaPr,Depth+1);var bNeedUpdateIter=this.Pr.type==DEGREE_SubSup&&PRS.NewRange==false||CurLine==0&&CurRange==0&&this.Pr.type==DEGREE_PreSubSup;if(bNeedUpdateIter){var PRS_Pos=PRS.CurPos.Copy();PRS.bMath_OneLine=true;var WordLen=PRS.WordLen;this.iters.Recalculate_Range(PRS, ParaPr,Depth);var itersW=iterUp.size.width>iterDn.size.width?iterUp.size.width:iterDn.size.width;PRS.CurPos.Set(PRS_Pos);PRS.WordLen=WordLen+itersW+this.dW;PRS.Word=true}PRS.bMath_OneLine=false;if(this.Pr.type==DEGREE_PreSubSup)this.baseContent.Recalculate_Range(PRS,ParaPr,Depth+1);if(PRS.NewRange==false)PRS.WordLen+=this.BrGapRight;this.protected_FillRange(CurLine,CurRange,RangeStartPos,RangeEndPos);PRS.bContainCompareOper=bContainCompareOper}};CDegreeSubSup.prototype.Recalculate_Range_Width=function(PRSC, _CurLine,_CurRange){if(this.bOneLine==true)CDegreeSubSupBase.prototype.Recalculate_Range_Width.call(this,PRSC,_CurLine,_CurRange);else{var CurLine=_CurLine-this.StartLine;var CurRange=0===CurLine?_CurRange-this.StartRange:_CurRange;var RangeW=PRSC.Range.W;if(CurLine==0&&CurRange==0)PRSC.Range.W+=this.BrGapLeft;if(this.Pr.type==DEGREE_SubSup)this.baseContent.Recalculate_Range_Width(PRSC,_CurLine,_CurRange);if(this.Need_Iters(_CurLine,_CurRange)){var RangeW2=PRSC.Range.W;this.iters.iterUp.Recalculate_Range_Width(PRSC, _CurLine,_CurRange);this.iters.iterDn.Recalculate_Range_Width(PRSC,_CurLine,_CurRange);this.iters.Bounds.SetWidth(0,0,this.iters.size.width);PRSC.Range.W=RangeW2+this.iters.size.width+this.dW}if(this.Pr.type==DEGREE_PreSubSup)this.baseContent.Recalculate_Range_Width(PRSC,_CurLine,_CurRange);if(this.baseContent.Math_Is_End(_CurLine,_CurRange))PRSC.Range.W+=this.BrGapRight;this.Bounds.SetWidth(CurLine,CurRange,PRSC.Range.W-RangeW)}};CDegreeSubSup.prototype.setPosition=function(pos,PosInfo){if(this.bOneLine)CDegreeSubSupBase.prototype.setPosition.call(this, pos,PosInfo);else{var Line=PosInfo.CurLine,Range=PosInfo.CurRange;var CurLine=Line-this.StartLine;var CurRange=0===CurLine?Range-this.StartRange:Range;this.UpdatePosBound(pos,PosInfo);if(CurLine==0&&CurRange==0)pos.x+=this.BrGapLeft;var PosIters=new CMathPosition;if(this.Pr.type==DEGREE_SubSup){this.baseContent.setPosition(pos,PosInfo);if(this.baseContent.Math_Is_End(Line,Range)){PosIters.x=pos.x;PosIters.y=pos.y-this.iters.size.ascent;this.iters.setPosition(PosIters,PosInfo);pos.x+=this.iters.size.width+ this.dW+this.BrGapRight}}else{if(CurLine==0&&CurRange==0){PosIters.x=pos.x;PosIters.y=pos.y-this.iters.size.ascent;this.iters.setPosition(PosIters,PosInfo);pos.x+=this.iters.size.width+this.dW}this.baseContent.setPosition(pos,PosInfo);if(this.baseContent.Math_Is_End(Line,Range))pos.x+=this.BrGapRight}}};CDegreeSubSup.prototype.Draw_Elements=function(PDSE){this.baseContent.Draw_Elements(PDSE);if(this.Need_Iters(PDSE.Line,PDSE.Range))this.iters.Draw_Elements(PDSE)};CDegreeSubSup.prototype.Need_Iters= function(_CurLine,_CurRange){var CurLine=_CurLine-this.StartLine;var CurRange=0===CurLine?_CurRange-this.StartRange:_CurRange;return this.Pr.type==DEGREE_SubSup&&this.baseContent.Math_Is_End(_CurLine,_CurRange)||CurLine==0&&CurRange==0&&this.Pr.type==DEGREE_PreSubSup};CDegreeSubSup.prototype.protected_GetRangeEndPos=function(CurLine,CurRange){var _CurLine=CurLine+this.StartLine;var _CurRange=0===CurLine?CurRange+this.StartRange:CurRange;return this.Need_Iters(_CurLine,_CurRange)?2:0};CDegreeSubSup.prototype.Apply_MenuProps= function(Props){if(Props.Type==Asc.c_oAscMathInterfaceType.Script){if(Props.ScriptType==Asc.c_oAscMathInterfaceScript.PreSubSup&&this.Pr.type==DEGREE_SubSup){AscCommon.History.Add(new CChangesMathDegreeSubSupType(this,this.Pr.type,DEGREE_PreSubSup));this.raw_SetType(DEGREE_PreSubSup)}if(Props.ScriptType==Asc.c_oAscMathInterfaceScript.SubSup&&this.Pr.type==DEGREE_PreSubSup){AscCommon.History.Add(new CChangesMathDegreeSubSupType(this,this.Pr.type,DEGREE_SubSup));this.raw_SetType(DEGREE_SubSup)}}};CDegreeSubSup.prototype.raw_SetType= function(type){this.Pr.type=type;this.fillContent()};CDegreeSubSup.prototype.Get_InterfaceProps=function(){var Type=this.Pr.type==DEGREE_PreSubSup?Asc.c_oAscMathInterfaceScript.PreSubSup:Asc.c_oAscMathInterfaceScript.SubSup;return new CMathMenuScript(this,Type)};CDegreeSubSup.prototype.Can_ModifyArgSize=function(){return this.CurPos!==0&&false===this.Is_SelectInside()};function CMathMenuScript(Script,Type){CMathMenuBase.call(this,Script);this.Type=Asc.c_oAscMathInterfaceType.Script;if(undefined!== Type)this.ScriptType=Type;else this.ScriptType=undefined}CMathMenuScript.prototype=Object.create(CMathMenuBase.prototype);CMathMenuScript.prototype.constructor=CMathMenuScript;CMathMenuScript.prototype.get_ScriptType=function(){return this.ScriptType};CMathMenuScript.prototype.put_ScriptType=function(Type){this.ScriptType=Type};window["AscCommonWord"]=window["AscCommonWord"]||{};window["AscCommonWord"].CDegreeSubSup=CDegreeSubSup;window["AscCommonWord"].CDegree=CDegree;window["CMathMenuScript"]=CMathMenuScript; CMathMenuScript.prototype["get_ScriptType"]=CMathMenuScript.prototype.get_ScriptType;CMathMenuScript.prototype["put_ScriptType"]=CMathMenuScript.prototype.put_ScriptType;"use strict";var History=AscCommon.History;var MATH_MC_JC=MCJC_CENTER;function CMathMatrixColumnPr(){this.count=1;this.mcJc=MCJC_CENTER}CMathMatrixColumnPr.prototype.Set_FromObject=function(Obj){if(undefined!==Obj.count&&null!==Obj.count)this.count=Obj.count;else this.count=1;if(MCJC_LEFT===Obj.mcJc||MCJC_RIGHT===Obj.mcJc||MCJC_CENTER=== Obj.mcJc)this.mcJc=Obj.mcJc;else this.mcJc=MCJC_CENTER};CMathMatrixColumnPr.prototype.Copy=function(){var NewPr=new CMathMatrixColumnPr;NewPr.count=this.count;NewPr.mcJc=this.mcJc;return NewPr};CMathMatrixColumnPr.prototype.Write_ToBinary=function(Writer){Writer.WriteLong(this.count);Writer.WriteLong(this.mcJc)};CMathMatrixColumnPr.prototype.Read_FromBinary=function(Reader){this.count=Reader.GetLong();this.mcJc=Reader.GetLong()};function CMathMatrixPr(){this.row=1;this.cGp=0;this.cGpRule=0;this.cSp= 0;this.rSp=0;this.rSpRule=0;this.mcs=[];this.baseJc=BASEJC_CENTER;this.plcHide=false}CMathMatrixPr.prototype.Set_FromObject=function(Obj){if(undefined!==Obj.row&&null!==Obj.row)this.row=Obj.row;if(undefined!==Obj.cGp&&null!==Obj.cGp)this.cGp=Obj.cGp;if(undefined!==Obj.cGpRule&&null!==Obj.cGpRule)this.cGpRule=Obj.cGpRule;if(undefined!==Obj.cSp&&null!==Obj.cSp)this.cSp=Obj.cSp;if(undefined!==Obj.rSpRule&&null!==Obj.rSpRule)this.rSpRule=Obj.rSpRule;if(undefined!==Obj.rSp&&null!==Obj.rSp)this.rSp=Obj.rSp; if(true===Obj.plcHide||1===Obj.plcHide)this.plcHide=true;else this.plcHide=false;if(BASEJC_CENTER===Obj.baseJc||BASEJC_TOP===Obj.baseJc||BASEJC_BOTTOM===Obj.baseJc)this.baseJc=Obj.baseJc;var nColumnsCount=0;if(undefined!==Obj.mcs.length){var nMcsCount=Obj.mcs.length;if(0!==nMcsCount){this.mcs.length=nMcsCount;for(var nMcsIndex=0;nMcsIndex 1)this.Set_RuleGap(this.SpaceRow,this.Pr.rSpRule,this.Pr.rSp);if(this.nCol>1)this.Set_RuleGap(this.SpaceColumn,this.Pr.cGpRule,this.Pr.cGp,this.Pr.cSp);if(this.kind==MATH_MATRIX){if(this.Pr.mcs!==undefined){var lng=this.Pr.mcs.length;var col=0;this.alignment.wdt.length=0;for(var j=0;j1){var gapsCol=this.Get_ColumnGap(this.SpaceColumn,FontSize);for(var i=0;i1){var intervalRow=this.Get_RowSpace(this.SpaceRow,FontSize);var divCenter=0;var plH=.2743827160493827*FontSize;var minGp=this.SpaceRow.MinGap*FontSize*g_dKoef_pt_to_mm;minGp-=plH;for(var j=0;j divCenter?minGp:divCenter}}this.gaps.row[this.nRow-1]=0;var height=0,width=0;for(var i=0;iascent?this.elements[0][j].size.ascent:ascent;else if(this.Pr.baseJc==BASEJC_BOTTOM){var descent=0,currDsc;for(var j=0;jdescent?currDsc:descent;ascent=height-descent}}else ascent=this.getAscent(oMeasure,height);width+=this.GapLeft+this.GapRight;this.size.height=height;this.size.width=width;this.size.ascent=ascent};CMatrixBase.prototype.Set_DefaultSpace=function(){this.SpaceRow.Set_DefaultSpace(0,0,13/12);this.SpaceColumn.Set_DefaultSpace(0,0,0)};CMatrixBase.prototype.Set_RuleGap=function(oSpace,Rule,Gap,MinGap){var bInt=Rule==Rule-0&&Rule== Rule^0,bRule=Rule>=0&&Rule<=4;if(bInt&&bRule)oSpace.Rule=Rule;if(Gap==Gap-0&&Gap==Gap^0)oSpace.Gap=Gap;if(MinGap==MinGap-0&&MinGap==MinGap^0)oSpace.MinGap=MinGap};CMatrixBase.prototype.Get_ColumnGap=function(SpaceColumn,FontSize){var ColumnGap=this.Get_Gap(SpaceColumn,FontSize,1);var wPlh=.324*FontSize;var MinGap=SpaceColumn.MinGap/20*g_dKoef_pt_to_mm-wPlh;return ColumnGap>MinGap?ColumnGap:MinGap};CMatrixBase.prototype.Get_RowSpace=function(SpaceRow,FontSize){var LineGap=this.Get_Gap(SpaceRow,FontSize, 7/6);var MinGap=SpaceRow.MinGap*FontSize*g_dKoef_pt_to_mm;return LineGap>MinGap?LineGap:MinGap};CMatrixBase.prototype.Get_Gap=function(oSpace,FontSize,coeff){var Space,Gap;if(oSpace.Rule==0)Space=coeff;else if(oSpace.Rule==1)Space=coeff*1.5;else if(oSpace.Rule==2)Space=coeff*2;else if(oSpace.Rule==3)Space=oSpace.Gap/20;else if(oSpace.Rule==4)Space=coeff*oSpace.Gap/2;else Space=coeff;if(oSpace.Rule==3)Gap=Space*g_dKoef_pt_to_mm;else Gap=Space*FontSize*g_dKoef_pt_to_mm;return Gap};CMatrixBase.prototype.getRowsCount= function(){return this.Pr.row};CMatrixBase.prototype.Add_Row=function(Pos){var Items=[],CountColumn=this.getColsCount();for(var CurPos=0;CurPosPos+Count)this.CurPos-=Count;else if(this.CurPos>Pos)this.CurPos=Pos;this.private_CorrectCurPos();this.private_UpdatePosOnRemove(Pos,Count)};CMatrixBase.prototype.Remove_Row=function(RowPos){if(this.Pr.row>1){var ColumnCount=this.getColsCount();var NextPos=RowPos*ColumnCount;var Items=this.Content.slice(NextPos,NextPos+ColumnCount);History.Add(new CChangesMathMatrixRemoveRow(this, NextPos,Items));this.raw_RemoveRow(NextPos,Items.length)}};CMatrixBase.prototype.SetBaseJc=function(Value){if(this.Pr.baseJc!==Value){History.Add(new CChangesMathMatrixBaseJc(this,this.Pr.baseJc,Value));this.raw_SetBaseJc(Value)}};CMatrixBase.prototype.raw_SetBaseJc=function(Value){this.Pr.Set_BaseJc(Value)};CMatrixBase.prototype.Modify_Interval=function(Item,NewRule,NewGap){var OldRule,OldGap;if(Item.Type==MATH_MATRIX_ROW){OldRule=this.Pr.rSpRule;OldGap=this.Pr.rSp}else{OldRule=this.Pr.cGpRule;OldGap= this.Pr.cGp}if(NewRule!==OldRule||NewGap!==OldGap){History.Add(new CChangesMathMatrixInterval(this,Item.Type,OldRule,OldGap,NewRule,NewGap));this.raw_SetInterval(Item.Type,NewRule,NewGap)}};CMatrixBase.prototype.raw_SetInterval=function(Item,Rule,Gap){if(Item==MATH_MATRIX_ROW){this.Pr.rSpRule=Rule;this.Pr.rSp=Gap;this.Set_RuleGap(this.SpaceRow,Rule,Gap)}else if(Item==MATH_MATRIX_COLUMN){this.Pr.cGpRule=Rule;this.Pr.cGp=Gap;this.Set_RuleGap(this.SpaceColumn,Rule,Gap,this.Pr.cSp)}};function CMathMatrix(props){CMatrixBase.call(this); this.Id=AscCommon.g_oIdCounter.Get_NewId();this.Pr=new CMathMatrixPr;this.column=0;if(props!==null&&props!==undefined)this.init(props);AscCommon.g_oTableId.Add(this,this.Id)}CMathMatrix.prototype=Object.create(CMatrixBase.prototype);CMathMatrix.prototype.constructor=CMathMatrix;CMathMatrix.prototype.ClassType=AscDFH.historyitem_type_matrix;CMathMatrix.prototype.kind=MATH_MATRIX;CMathMatrix.prototype.init=function(props){this.setProperties(props);this.column=this.Pr.Get_ColumnsCount();var nRowsCount= this.getRowsCount();var nColsCount=this.getColsCount();this.Fill_LogicalContent(nRowsCount*nColsCount);this.fillContent()};CMathMatrix.prototype.setPosition=function(pos,PosInfo){this.pos.x=pos.x;if(this.bInside===true)this.pos.y=pos.y;else this.pos.y=pos.y-this.size.ascent;this.UpdatePosBound(pos,PosInfo);var maxWH=this.getWidthsHeights();var Widths=maxWH.widths;var Heights=maxWH.heights;var NewPos=new CMathPosition;var h=0,w=0;for(var i=0;i0&&Widths[j]>size.width?Widths[j]: size.width;Ascents[i]=Ascents[i]>size.ascent?Ascents[i]:size.ascent;Descents[i]=Descents[i]>size.height-size.ascent?Descents[i]:size.height-size.ascent}}return{ascents:Ascents,descents:Descents,widths:Widths}};CMathMatrix.prototype.getContentElement=function(nRowIndex,nColIndex){return this.Content[nRowIndex*this.getColsCount()+nColIndex]};CMathMatrix.prototype.fillContent=function(){this.column=this.Pr.Get_ColumnsCount();var nRowsCount=this.getRowsCount();var nColsCount=this.getColsCount();this.setDimension(nRowsCount, nColsCount);for(var nRowIndex=0;nRowIndex>0};CMathMatrix.prototype.Get_ColumnPos=function(Pos){var ColumnCount=this.getColsCount();var RowPos=Pos/ColumnCount>>0;return Pos- ColumnCount*RowPos};CMathMatrix.prototype.Apply_MenuProps=function(Props){if(Props.Type==Asc.c_oAscMathInterfaceType.Matrix){var ColumnCount=this.getColsCount(),RowPos=this.Get_RowPos(this.CurPos),ColumnPos=this.Get_ColumnPos(this.CurPos);var bGapWholeNumber,bGapNumber;var NextPos;if(Props.BaseJc!==undefined){var BaseJc=this.Pr.baseJc;if(Props.BaseJc===Asc.c_oAscMathInterfaceMatrixMatrixAlign.Center)BaseJc=BASEJC_CENTER;else if(Props.BaseJc===Asc.c_oAscMathInterfaceMatrixMatrixAlign.Bottom)BaseJc= BASEJC_BOTTOM;else if(Props.BaseJc===Asc.c_oAscMathInterfaceMatrixMatrixAlign.Top)BaseJc=BASEJC_TOP;this.SetBaseJc(BaseJc)}if(Props.ColumnJc!==undefined){var CurrentMcJc=this.Pr.Get_ColumnMcJc(ColumnPos);var McJc=CurrentMcJc;if(Props.ColumnJc===Asc.c_oAscMathInterfaceMatrixColumnAlign.Center)McJc=MCJC_CENTER;else if(Props.ColumnJc===Asc.c_oAscMathInterfaceMatrixColumnAlign.Left)McJc=MCJC_LEFT;else if(Props.ColumnJc===Asc.c_oAscMathInterfaceMatrixColumnAlign.Right)McJc=MCJC_RIGHT;if(CurrentMcJc!== McJc){History.Add(new CChangesMathMatrixColumnJc(this,CurrentMcJc,McJc,ColumnPos));this.raw_SetColumnJc(McJc,ColumnPos)}}if(Props.RowRule!==undefined)switch(Props.RowRule){case c_oAscMathInterfaceMatrixRowRule.Single:{this.Modify_Interval(this.SpaceRow,0,0);break}case c_oAscMathInterfaceMatrixRowRule.OneAndHalf:{this.Modify_Interval(this.SpaceRow,1,0);break}case c_oAscMathInterfaceMatrixRowRule.Double:{this.Modify_Interval(this.SpaceRow,2,0);break}case c_oAscMathInterfaceMatrixRowRule.Exactly:{bGapWholeNumber= Props.Gap!==undefined&&Props.Gap+0==Props.Gap&&Props.Gap>>0==Props.Gap;if(bGapWholeNumber==true&&Props.Gap>=0&&Props.Gap<=31680)this.Modify_Interval(this.SpaceRow,3,Props.Gap*20);break}case c_oAscMathInterfaceMatrixRowRule.Multiple:{bGapNumber=Props.Gap!==undefined&&Props.Gap+0==Props.Gap;if(bGapNumber==true&&Props.Gap>=0&&Props.Gap<=111){var Gap=Props.Gap*2+.5>>0;this.Modify_Interval(this.SpaceRow,4,Gap)}break}}if(Props.ColumnRule!==undefined)switch(Props.ColumnRule){case c_oAscMathInterfaceMatrixColumnRule.Single:{this.Modify_Interval(this.SpaceColumn, 0,0);break}case c_oAscMathInterfaceMatrixColumnRule.OneAndHalf:{this.Modify_Interval(this.SpaceColumn,1,0);break}case c_oAscMathInterfaceMatrixColumnRule.Double:{this.Modify_Interval(this.SpaceColumn,2,0);break}case c_oAscMathInterfaceMatrixColumnRule.Exactly:{bGapWholeNumber=Props.Gap!==undefined&&Props.Gap+0==Props.Gap&&Props.Gap>>0==Props.Gap;if(bGapWholeNumber==true&&Props.Gap>=0&&Props.Gap<=31680)this.Modify_Interval(this.SpaceColumn,3,Props.Gap*20);break}case c_oAscMathInterfaceMatrixColumnRule.Multiple:{bGapNumber= Props.Gap!==undefined&&Props.Gap+0==Props.Gap;if(bGapNumber==true&&Props.Gap>=0&&Props.Gap<=55.87){var Gap=Props.Gap/.21163>>0,NextMenuGap=(.21163*(Gap+1)*100+.5>>0)/100;if(Props.Gap>=NextMenuGap)Gap++;this.Modify_Interval(this.SpaceColumn,4,Gap)}break}}if(Props.Action&c_oMathMenuAction.DeleteMatrixRow&&this.getRowsCount()>1)this.Remove_Row(RowPos);if(Props.Action&c_oMathMenuAction.DeleteMatrixColumn&&ColumnCount>1)this.Remove_Column(ColumnPos);if(Props.Action&c_oMathMenuAction.InsertMatrixRow)if(Props.Action& c_oMathMenuAction.InsertBefore){NextPos=RowPos*ColumnCount;this.Add_Row(NextPos)}else{NextPos=(RowPos+1)*ColumnCount;this.Add_Row(NextPos)}if(Props.Action&c_oMathMenuAction.InsertMatrixColumn)if(Props.Action&c_oMathMenuAction.InsertBefore)this.Add_Column(ColumnPos);else this.Add_Column(ColumnPos+1);if(Props.bHidePlh!==undefined)if(Props.bHidePlh!==this.Pr.plcHide){History.Add(new CChangesMathMatrixPlh(this,this.Pr.plcHide,Props.bHidePlh));this.raw_HidePlh(Props.bHidePlh)}}};CMathMatrix.prototype.Get_InterfaceProps= function(){return new CMathMenuMatrix(this)};CMathMatrix.prototype.Add_Column=function(ColumnPos){var Items=[],CountRow=this.getRowsCount();for(var CurPos=0;CurPos> 0;for(var CurPos=0;CurPos>0;for(var CurPos=0;CurPosPos-RowPos)this.CurPos-=RowPos;else if(this.CurPos>Pos)this.CurPos= Pos;this.private_CorrectCurPos();this.private_UpdatePosOnRemove(Pos,RowPos)};CMathMatrix.prototype.Modify_ColumnCount=function(Pos,Count){this.Pr.Modify_ColumnCount(Pos,Count);this.column=this.Pr.Get_ColumnsCount()};CMathMatrix.prototype.raw_SetColumnJc=function(Value,ColumnPos){this.RecalcInfo.bProps=true;this.Pr.Set_ColumnJc(Value,ColumnPos)};CMathMatrix.prototype.raw_HidePlh=function(Value){this.Pr.plcHide=Value;this.hidePlaceholder(Value)};CMathMatrix.prototype.raw_Set_MinColumnWidth=function(Value){this.Pr.cSp= Value;this.Set_RuleGap(this.SpaceColumn,this.Pr.cGpRule,this.Pr.cGp,Value)};CMathMatrix.prototype.Is_DeletedItem=function(Action){var bDeleteMatrix=false;if(c_oMathMenuAction.DeleteMatrixRow==Action&&1==this.getRowsCount())bDeleteMatrix=true;else if(c_oMathMenuAction.DeleteMatrixColumn==Action&&1==this.getColsCount())bDeleteMatrix=true;return bDeleteMatrix};CMathMatrix.prototype.Get_DeletedItemsThroughInterface=function(){return[]};function CMathMenuMatrix(MathMatrix){CMathMenuBase.call(this,MathMatrix); this.Type=Asc.c_oAscMathInterfaceType.Matrix;if(undefined!==MathMatrix){var ColumnPos=MathMatrix.Get_ColumnPos(MathMatrix.CurPos);var RowRule,RowGap,ColumnRule,ColumnGap;switch(MathMatrix.SpaceRow.Rule){default:case 0:{RowRule=c_oAscMathInterfaceMatrixRowRule.Single;break}case 1:{RowRule=c_oAscMathInterfaceMatrixRowRule.OneAndHalf;break}case 2:{RowRule=c_oAscMathInterfaceMatrixRowRule.Double;break}case 3:{RowRule=c_oAscMathInterfaceMatrixRowRule.Exactly;RowGap=MathMatrix.SpaceRow.Gap/20;break}case 4:{RowRule= c_oAscMathInterfaceMatrixRowRule.Multiple;RowGap=MathMatrix.SpaceRow.Gap*.5;break}}switch(MathMatrix.SpaceColumn.Rule){default:case 0:{ColumnRule=c_oAscMathInterfaceMatrixColumnRule.Single;break}case 1:{ColumnRule=c_oAscMathInterfaceMatrixColumnRule.OneAndHalf;break}case 2:{ColumnRule=c_oAscMathInterfaceMatrixColumnRule.Double;break}case 3:{ColumnRule=c_oAscMathInterfaceMatrixColumnRule.Exactly;ColumnGap=MathMatrix.SpaceColumn.Gap/20;break}case 4:{ColumnRule=c_oAscMathInterfaceMatrixColumnRule.Multiple; ColumnGap=(.21163*MathMatrix.SpaceColumn.Gap*100+.5>>0)/100;break}}var ColumnJc=MathMatrix.Pr.Get_ColumnMcJc(ColumnPos);this.BaseJc=MathMatrix.Pr.baseJc===BASEJC_CENTER?Asc.c_oAscMathInterfaceMatrixMatrixAlign.Center:MathMatrix.Pr.baseJc===BASEJC_BOTTOM?Asc.c_oAscMathInterfaceMatrixMatrixAlign.Bottom:Asc.c_oAscMathInterfaceMatrixMatrixAlign.Top;this.ColumnJc=ColumnJc===MCJC_CENTER?Asc.c_oAscMathInterfaceMatrixColumnAlign.Center:ColumnJc===MCJC_RIGHT?Asc.c_oAscMathInterfaceMatrixColumnAlign.Right: Asc.c_oAscMathInterfaceMatrixColumnAlign.Left;this.RowRule=RowRule;this.RowGap=RowGap;this.ColumnRule=ColumnRule;this.ColumnGap=ColumnGap;this.MinColumnWidth=MathMatrix.Pr.cSp/20;this.bHidePlh=MathMatrix.Pr.plcHide}else{this.BaseJc=undefined;this.ColumnJc=undefined;this.RowRule=undefined;this.RowGap=undefined;this.ColumnRule=undefined;this.ColumnGap=undefined;this.MinColumnWidth=undefined;this.bHidePlh=undefined}}CMathMenuMatrix.prototype=Object.create(CMathMenuBase.prototype);CMathMenuMatrix.prototype.constructor= CMathMenuMatrix;CMathMenuMatrix.prototype.get_MatrixAlign=function(){return this.BaseJc};CMathMenuMatrix.prototype.put_MatrixAlign=function(Align){this.BaseJc=Align};CMathMenuMatrix.prototype.get_ColumnAlign=function(){return this.ColumnJc};CMathMenuMatrix.prototype.put_ColumnAlign=function(Align){this.ColumnJc=Align};CMathMenuMatrix.prototype.get_RowRule=function(){return this.RowRule};CMathMenuMatrix.prototype.put_RowRule=function(RowRule){this.RowRule=RowRule};CMathMenuMatrix.prototype.get_RowGap= function(){return this.RowGap};CMathMenuMatrix.prototype.put_RowGap=function(RowGap){this.RowGap=RowGap};CMathMenuMatrix.prototype.get_ColumnRule=function(){return this.ColumnRule};CMathMenuMatrix.prototype.put_ColumnRule=function(ColumnRule){this.ColumnRule=ColumnRule};CMathMenuMatrix.prototype.get_ColumnGap=function(){return this.ColumnGap};CMathMenuMatrix.prototype.put_ColumnGap=function(ColumnGap){this.ColumnGap=ColumnGap};CMathMenuMatrix.prototype.get_MinColumnSpace=function(){return this.MinColumnWidth}; CMathMenuMatrix.prototype.put_MinColumnSpace=function(MinSpace){this.MinColumnWidth=MinSpace};CMathMenuMatrix.prototype.get_HidePlaceholder=function(){return this.bHidePlh};CMathMenuMatrix.prototype.put_HidePlaceholder=function(Hide){this.bHidePlh=Hide};window["CMathMenuMatrix"]=CMathMenuMatrix;CMathMenuMatrix.prototype["get_MatrixAlign"]=CMathMenuMatrix.prototype.get_MatrixAlign;CMathMenuMatrix.prototype["put_MatrixAlign"]=CMathMenuMatrix.prototype.put_MatrixAlign;CMathMenuMatrix.prototype["get_ColumnAlign"]= CMathMenuMatrix.prototype.get_ColumnAlign;CMathMenuMatrix.prototype["put_ColumnAlign"]=CMathMenuMatrix.prototype.put_ColumnAlign;CMathMenuMatrix.prototype["get_RowRule"]=CMathMenuMatrix.prototype.get_RowRule;CMathMenuMatrix.prototype["put_RowRule"]=CMathMenuMatrix.prototype.put_RowRule;CMathMenuMatrix.prototype["get_RowGap"]=CMathMenuMatrix.prototype.get_RowGap;CMathMenuMatrix.prototype["put_RowGap"]=CMathMenuMatrix.prototype.put_RowGap;CMathMenuMatrix.prototype["get_ColumnRule"]=CMathMenuMatrix.prototype.get_ColumnRule; CMathMenuMatrix.prototype["put_ColumnRule"]=CMathMenuMatrix.prototype.put_ColumnRule;CMathMenuMatrix.prototype["get_ColumnGap"]=CMathMenuMatrix.prototype.get_ColumnGap;CMathMenuMatrix.prototype["put_ColumnGap"]=CMathMenuMatrix.prototype.put_ColumnGap;CMathMenuMatrix.prototype["get_MinColumnSpace"]=CMathMenuMatrix.prototype.get_MinColumnSpace;CMathMenuMatrix.prototype["put_MinColumnSpace"]=CMathMenuMatrix.prototype.put_MinColumnSpace;CMathMenuMatrix.prototype["get_HidePlaceholder"]=CMathMenuMatrix.prototype.get_HidePlaceholder; CMathMenuMatrix.prototype["put_HidePlaceholder"]=CMathMenuMatrix.prototype.put_HidePlaceholder;function CMathPoint(){this.even=-1;this.odd=-1}function CMathEqArrPr(){this.maxDist=0;this.objDist=0;this.rSp=0;this.rSpRule=0;this.baseJc=BASEJC_CENTER;this.row=1}CMathEqArrPr.prototype.Set_FromObject=function(Obj){if(undefined!==Obj.maxDist&&null!==Obj.maxDist)this.maxDist=Obj.maxDist;if(undefined!==Obj.objDist&&null!==Obj.objDist)this.objDist=Obj.objDist;if(undefined!==Obj.rSp&&null!==Obj.rSp)this.rSp= Obj.rSp;if(undefined!==Obj.rSpRule&&null!==Obj.rSpRule)this.rSpRule=Obj.rSpRule;if(undefined!==Obj.baseJc&&null!==Obj.baseJc)this.baseJc=Obj.baseJc;this.row=Obj.row};CMathEqArrPr.prototype.Copy=function(){var NewPr=new CMathEqArrPr;NewPr.maxDist=this.maxDist;NewPr.objDist=this.objDist;NewPr.rSp=this.rSp;NewPr.rSpRule=this.rSpRule;NewPr.baseJc=this.baseJc;NewPr.row=this.row;return NewPr};CMathEqArrPr.prototype.Set_Row=function(Value){this.row=Value};CMathEqArrPr.prototype.Set_BaseJc=function(Value){this.baseJc= Value};CMathEqArrPr.prototype.Write_ToBinary=function(Writer){Writer.WriteLong(this.maxDist);Writer.WriteLong(this.objDist);Writer.WriteLong(this.rSp);Writer.WriteLong(this.rSpRule);Writer.WriteLong(this.baseJc);Writer.WriteLong(this.row)};CMathEqArrPr.prototype.Read_FromBinary=function(Reader){this.maxDist=Reader.GetLong();this.objDist=Reader.GetLong();this.rSp=Reader.GetLong();this.rSpRule=Reader.GetLong();this.baseJc=Reader.GetLong();this.row=Reader.GetLong()};function CEqArray(props){CMatrixBase.call(this); this.Id=AscCommon.g_oIdCounter.Get_NewId();this.Pr=new CMathEqArrPr;this.WidthsPoints=[];this.Points=[];this.MaxDimWidths=[];if(props!==null&&props!==undefined)this.init(props);AscCommon.g_oTableId.Add(this,this.Id)}CEqArray.prototype=Object.create(CMatrixBase.prototype);CEqArray.prototype.constructor=CEqArray;CEqArray.prototype.ClassType=AscDFH.historyitem_type_eqArr;CEqArray.prototype.kind=MATH_EQ_ARRAY;CEqArray.prototype.init=function(props){var nRowsCount=props.row;this.Fill_LogicalContent(nRowsCount); this.setProperties(props);this.fillContent()};CEqArray.prototype.fillContent=function(){var nRowsCount=this.Content.length;this.setDimension(nRowsCount,1);for(var nIndex=0;nIndexWidthsRow[Pos].even?even:WidthsRow[Pos].even;odd=odd>WidthsRow[Pos].odd?odd:WidthsRow[Pos].odd}else{if(maxDimWidthsRow[Pos].even?last:WidthsRow[Pos].even}if(Pos==len-1)EndWidths++}}var w=even+odd>last?even+odd:last;var NewPoint=new CMathPoint; NewPoint.even=even;NewPoint.odd=odd;this.WidthsPoints.push(w);this.MaxDimWidths.push(maxDimWidth);this.Points.push(NewPoint);WidthsMetrics[0]+=w;Pos++}for(var i=0;i>0==Props.Gap;if(bGapWholeNumber==true&&Props.Gap>=0&&Props.Gap<=31680)this.Modify_Interval(this.SpaceRow,3,Props.Gap*20);break}case c_oAscMathInterfaceEqArrayLineRule.Multiple:{var bGapNumber= Props.Gap!==undefined&&Props.Gap+0==Props.Gap;if(bGapNumber==true&&Props.Gap>=0&&Props.Gap<=111){var Gap=Props.Gap*2+.5>>0;this.Modify_Interval(this.SpaceRow,4,Gap)}break}}if(Props.Action&c_oMathMenuAction.DeleteEquation&&this.getRowsCount()>1)this.Remove_Row(this.CurPos);if(Props.Action&c_oMathMenuAction.InsertEquation)if(Props.Action&c_oMathMenuAction.InsertBefore)this.Add_Row(this.CurPos);else this.Add_Row(this.CurPos+1)}};CEqArray.prototype.Get_InterfaceProps=function(){return new CMathMenuEqArray(this)}; CEqArray.prototype.Is_DeletedItem=function(Action){return Action&c_oMathMenuAction.DeleteEquation&&1==this.getRowsCount()};CEqArray.prototype.Get_DeletedItemsThroughInterface=function(){return[]};CEqArray.prototype.IsEqArray=function(){return true};function CMathMenuEqArray(EqArray){CMathMenuBase.call(this,EqArray);this.Type=Asc.c_oAscMathInterfaceType.EqArray;if(undefined!==EqArray){var RowRule,RowGap;switch(EqArray.SpaceRow.Rule){default:case 0:{RowRule=c_oAscMathInterfaceEqArrayLineRule.Single; break}case 1:{RowRule=c_oAscMathInterfaceEqArrayLineRule.OneAndHalf;break}case 2:{RowRule=c_oAscMathInterfaceEqArrayLineRule.Double;break}case 3:{RowRule=c_oAscMathInterfaceEqArrayLineRule.Exactly;RowGap=EqArray.SpaceRow.Gap/20;break}case 4:{RowRule=c_oAscMathInterfaceEqArrayLineRule.Multiple;RowGap=EqArray.SpaceRow.Gap*.5;break}}this.BaseJc=EqArray.Pr.baseJc===BASEJC_CENTER?Asc.c_oAscMathInterfaceEqArrayAlign.Center:EqArray.Pr.baseJc===BASEJC_BOTTOM?Asc.c_oAscMathInterfaceEqArrayAlign.Bottom:Asc.c_oAscMathInterfaceEqArrayAlign.Top; this.RowRule=RowRule;this.RowGap=RowGap}else{this.BaseJc=undefined;this.RowRule=undefined;this.RowGap=undefined}}CMathMenuEqArray.prototype=Object.create(CMathMenuBase.prototype);CMathMenuEqArray.prototype.constructor=CMathMenuEqArray;CMathMenuEqArray.prototype.get_Align=function(){return this.BaseJc};CMathMenuEqArray.prototype.put_Align=function(Align){this.BaseJc=Align};CMathMenuEqArray.prototype.get_LineRule=function(){return this.RowRule};CMathMenuEqArray.prototype.put_LineRule=function(Rule){this.RowRule= Rule};CMathMenuEqArray.prototype.get_LineGap=function(){return this.RowGap};CMathMenuEqArray.prototype.put_LineGap=function(Gap){this.RowGap=Gap};window["AscCommonWord"]=window["AscCommonWord"]||{};window["AscCommonWord"].CEqArray=CEqArray;window["AscCommonWord"].CMathMatrix=CMathMatrix;window["CMathMenuEqArray"]=CMathMenuEqArray;CMathMenuEqArray.prototype["get_Align"]=CMathMenuEqArray.prototype.get_Align;CMathMenuEqArray.prototype["put_Align"]=CMathMenuEqArray.prototype.put_Align;CMathMenuEqArray.prototype["get_LineRule"]= CMathMenuEqArray.prototype.get_LineRule;CMathMenuEqArray.prototype["put_LineRule"]=CMathMenuEqArray.prototype.put_LineRule;CMathMenuEqArray.prototype["get_LineGap"]=CMathMenuEqArray.prototype.get_LineGap;CMathMenuEqArray.prototype["put_LineGap"]=CMathMenuEqArray.prototype.put_LineGap;"use strict";function CMathLimitPr(){this.type=LIMIT_LOW}CMathLimitPr.prototype.Set_FromObject=function(Obj){if(undefined!==Obj.type&&null!==Obj.type)this.type=Obj.type};CMathLimitPr.prototype.Copy=function(){var NewPr= new CMathLimitPr;NewPr.type=this.type;return NewPr};CMathLimitPr.prototype.Write_ToBinary=function(Writer){Writer.WriteLong(this.type)};CMathLimitPr.prototype.Read_FromBinary=function(Reader){this.type=Reader.GetLong()};function CLimitPrimary(bInside,Type,FName,Iterator){CMathBase.call(this,bInside);this.Type=Type;this.FName=null;this.Iterator=null;this.init(FName,Iterator)}CLimitPrimary.prototype=Object.create(CMathBase.prototype);CLimitPrimary.prototype.constructor=CLimitPrimary;CLimitPrimary.prototype.kind= MATH_PRIMARY_LIMIT;CLimitPrimary.prototype.init=function(FName,Iterator){this.setDimension(2,1);if(this.Type==LIMIT_LOW){this.FName=FName;this.Iterator=new CDenominator(Iterator);this.elements[0][0]=this.FName;this.elements[1][0]=this.Iterator}else{this.Iterator=Iterator;this.FName=FName;this.elements[0][0]=this.Iterator;this.elements[1][0]=this.FName}};CLimitPrimary.prototype.PreRecalc=function(Parent,ParaMath,ArgSize,RPI,GapsInfo){this.Parent=Parent;this.ParaMath=ParaMath;this.Set_CompiledCtrPrp(Parent, ParaMath,RPI);if(this.bInside==false)GapsInfo.setGaps(this,this.TextPrControlLetter.FontSize);this.FName.PreRecalc(this,ParaMath,ArgSize,RPI);var ArgSzIter=ArgSize.Copy();ArgSzIter.Decrease();var bDecreasedComp=RPI.bDecreasedComp;RPI.bDecreasedComp=true;this.Iterator.PreRecalc(this,ParaMath,ArgSzIter,RPI);RPI.bDecreasedComp=bDecreasedComp};CLimitPrimary.prototype.Resize=function(oMeasure,RPI){this.FName.Resize(oMeasure,RPI);this.Iterator.Resize(oMeasure,RPI);this.recalculateSize(oMeasure)};CLimitPrimary.prototype.recalculateSize= function(oMeasure){if(this.Type==LIMIT_LOW)this.dH=0;else this.dH=.06*this.Get_TxtPrControlLetter().FontSize;var SizeFName=this.FName.size,SizeIter=this.Iterator.size;var width=SizeFName.width>SizeIter.width?SizeFName.width:SizeIter.width,height=SizeFName.height+SizeIter.height+this.dH,ascent;if(this.Type==LIMIT_LOW)ascent=SizeFName.ascent;else ascent=SizeIter.height+this.dH+SizeFName.ascent;width+=this.GapLeft+this.GapRight;this.size.height=height;this.size.width=width;this.size.ascent=ascent};CLimitPrimary.prototype.setPosition= function(pos,PosInfo){this.pos.x=pos.x;this.pos.y=pos.y;var maxW=this.FName.size.width>this.Iterator.size.width?this.FName.size.width:this.Iterator.size.width;var alignFNameX=(maxW-this.FName.size.width)/2;var alignIterX=(maxW-this.Iterator.size.width)/2;var FNamePos=new CMathPosition;var IterPos=new CMathPosition;if(this.Type==LIMIT_LOW){FNamePos.x=this.pos.x+this.GapLeft+alignFNameX;FNamePos.y=this.pos.y+this.FName.size.ascent;IterPos.x=this.pos.x+this.GapLeft+alignIterX;IterPos.y=this.pos.y+this.dH+ this.FName.size.height}else{IterPos.x=this.pos.x+this.GapLeft+alignIterX;IterPos.y=this.pos.y+this.Iterator.size.ascent;FNamePos.x=this.pos.x+this.GapLeft+alignFNameX;FNamePos.y=this.pos.y+this.FName.size.ascent+this.dH+this.Iterator.size.height}this.FName.setPosition(FNamePos,PosInfo);this.Iterator.setPosition(IterPos,PosInfo);pos.x+=this.size.width};function CLimit(props){CMathBase.call(this);this.Id=AscCommon.g_oIdCounter.Get_NewId();this.Pr=new CMathLimitPr;if(props!==null&&typeof props!=="undefined")this.init(props); AscCommon.g_oTableId.Add(this,this.Id)}CLimit.prototype=Object.create(CMathBase.prototype);CLimit.prototype.constructor=CLimit;CLimit.prototype.ClassType=AscDFH.historyitem_type_lim;CLimit.prototype.kind=MATH_LIMIT;CLimit.prototype.init=function(props){this.Fill_LogicalContent(2);this.setProperties(props);this.fillContent()};CLimit.prototype.fillContent=function(){};CLimit.prototype.getFName=function(){return this.Content[0]};CLimit.prototype.getIterator=function(){return this.Content[1]};CLimit.prototype.getBase= function(){return this.getFName()};CLimit.prototype.ApplyProperties=function(RPI){if(this.RecalcInfo.bProps==true||RPI!=undefined&&RPI.bChangeInline==true){this.setDimension(1,1);this.elements[0][0]=new CLimitPrimary(true,this.Pr.type,this.getFName(),this.getIterator());this.RecalcInfo.bProps=false}};CLimit.prototype.Apply_MenuProps=function(Props){if(Props.Type==Asc.c_oAscMathInterfaceType.Limit&&Props.Pos!==undefined){var Type=Props.Pos==Asc.c_oAscMathInterfaceLimitPos.Bottom?LIMIT_LOW:LIMIT_UP; if(this.Pr.type!==Type){AscCommon.History.Add(new CChangesMathLimitType(this,this.Pr.type,Type));this.raw_SetType(Type)}}};CLimit.prototype.Get_InterfaceProps=function(){return new CMathMenuLimit(this)};CLimit.prototype.raw_SetType=function(Value){if(this.Pr.type!==Value){this.Pr.type=Value;this.RecalcInfo.bProps=true;this.ApplyProperties()}};CLimit.prototype.Can_ModifyArgSize=function(){return this.CurPos==1&&false===this.Is_SelectInside()};function CMathMenuLimit(Limit){CMathMenuBase.call(this, Limit);this.Type=Asc.c_oAscMathInterfaceType.Limit;if(undefined!==Limit)this.Pos=LIMIT_LOW===Limit.Pr.type?Asc.c_oAscMathInterfaceLimitPos.Bottom:Asc.c_oAscMathInterfaceLimitPos.Top;else this.Pos=undefined}CMathMenuLimit.prototype=Object.create(CMathMenuBase.prototype);CMathMenuLimit.prototype.constructor=CMathMenuLimit;CMathMenuLimit.prototype.get_Pos=function(){return this.Pos};CMathMenuLimit.prototype.put_Pos=function(Pos){this.Pos=Pos};window["CMathMenuLimit"]=CMathMenuLimit;CMathMenuLimit.prototype["get_Pos"]= CMathMenuLimit.prototype.get_Pos;CMathMenuLimit.prototype["put_Pos"]=CMathMenuLimit.prototype.put_Pos;function CMathFunc(props){CMathBase.call(this);this.Id=AscCommon.g_oIdCounter.Get_NewId();this.Pr=new CMathBasePr;if(props!==null&&typeof props!=="undefined")this.init(props);AscCommon.g_oTableId.Add(this,this.Id)}CMathFunc.prototype=Object.create(CMathBase.prototype);CMathFunc.prototype.constructor=CMathFunc;CMathFunc.prototype.ClassType=AscDFH.historyitem_type_mathFunc;CMathFunc.prototype.kind= MATH_FUNCTION;CMathFunc.prototype.init=function(props){this.Fill_LogicalContent(2);this.setProperties(props);this.fillContent()};CMathFunc.prototype.PreRecalc=function(Parent,ParaMath,ArgSize,RPI,GapsInfo){var bMathFunc=RPI.bMathFunc;RPI.bMathFunc=true;CMathBase.prototype.PreRecalc.call(this,Parent,ParaMath,ArgSize,RPI,GapsInfo);RPI.bMathFunc=bMathFunc};CMathFunc.prototype.GetLastElement=function(){return this.Content[1].GetFirstElement()};CMathFunc.prototype.GetFirstElement=function(){return this.Content[0].GetFirstElement()}; CMathFunc.prototype.setDistance=function(){this.dW=this.Get_TxtPrControlLetter().FontSize*.044};CMathFunc.prototype.getFName=function(){return this.Content[0]};CMathFunc.prototype.getArgument=function(){return this.Content[1]};CMathFunc.prototype.fillContent=function(){this.NeedBreakContent(1);this.setDimension(1,2);this.elements[0][0]=this.getFName();this.elements[0][1]=this.getArgument()};window["AscCommonWord"]=window["AscCommonWord"]||{};window["AscCommonWord"].CMathFunc=CMathFunc;window["AscCommonWord"].CLimit= CLimit;"use strict";function CMathNaryPr(){this.chr=undefined;this.chrType=NARY_INTEGRAL;this.grow=false;this.limLoc=undefined;this.subHide=false;this.supHide=false}CMathNaryPr.prototype.Set_FromObject=function(Obj){this.chr=Obj.chr;this.chrType=Obj.chrType;if(true===Obj.grow===true||1===Obj.grow)this.grow=true;if(NARY_UndOvr===Obj.limLoc||NARY_SubSup===Obj.limLoc)this.limLoc=Obj.limLoc;if(true===Obj.subHide===true||1===Obj.subHide)this.subHide=true;if(true===Obj.supHide===true||1===Obj.supHide)this.supHide= true};CMathNaryPr.prototype.Copy=function(){var NewPr=new CMathNaryPr;NewPr.chr=this.chr;NewPr.chrType=this.chrType;NewPr.grow=this.grow;NewPr.limLoc=this.limLoc;NewPr.subHide=this.subHide;NewPr.supHide=this.supHide;return NewPr};CMathNaryPr.prototype.Write_ToBinary=function(Writer){var StartPos=Writer.GetCurPosition();Writer.Skip(4);var Flags=0;if(undefined!==this.chr){Writer.WriteLong(this.chr);Flags|=1}if(undefined!==this.chrType){Writer.WriteLong(this.chrType);Flags|=2}if(undefined!==this.limLoc){Writer.WriteLong(this.limLoc); Flags|=4}var EndPos=Writer.GetCurPosition();Writer.Seek(StartPos);Writer.WriteLong(Flags);Writer.Seek(EndPos);Writer.WriteBool(this.grow);Writer.WriteBool(this.subHide);Writer.WriteBool(this.supHide)};CMathNaryPr.prototype.Read_FromBinary=function(Reader){var Flags=Reader.GetLong();if(Flags&1)this.chr=Reader.GetLong();else this.chr=undefined;if(Flags&2)this.chrType=Reader.GetLong();else this.chrType=undefined;if(Flags&4)this.limLoc=Reader.GetLong();else this.limLoc=undefined;this.grow=Reader.GetBool(); this.subHide=Reader.GetBool();this.supHide=Reader.GetBool()};function CNary(props){CMathBase.call(this);this.Id=AscCommon.g_oIdCounter.Get_NewId();this.Pr=new CMathNaryPr;this.Base=null;this.Sign=null;this.LowerIterator=null;this.UpperIterator=null;this.Arg=null;this.CurrentLimLoc=null;if(props!==null&&props!==undefined)this.init(props);AscCommon.g_oTableId.Add(this,this.Id)}CNary.prototype=Object.create(CMathBase.prototype);CNary.prototype.constructor=CNary;CNary.prototype.ClassType=AscDFH.historyitem_type_nary; CNary.prototype.kind=MATH_NARY;CNary.prototype.init=function(props){this.Fill_LogicalContent(3);this.setProperties(props);this.fillContent()};CNary.prototype.fillContent=function(){this.NeedBreakContent(2);this.LowerIterator=this.Content[0];this.UpperIterator=this.Content[1];this.Arg=this.Content[2]};CNary.prototype.fillBase=function(PropsInfo){this.setDimension(1,2);var base;var Sign=PropsInfo.sign;var ctrPrp=this.CtrPrp.Copy();if(PropsInfo.limLoc===NARY_UndOvr)if(PropsInfo.supHide&&PropsInfo.subHide)base= Sign;else if(PropsInfo.supHide&&!PropsInfo.subHide){base=new CNaryOvr(true);base.setBase(Sign);base.setLowerIterator(this.LowerIterator)}else if(!PropsInfo.supHide&&PropsInfo.subHide){base=new CNaryUnd(true);base.setBase(Sign);base.setUpperIterator(this.UpperIterator)}else{base=new CNaryUndOvr(true);base.setBase(Sign);base.setUpperIterator(this.UpperIterator);base.setLowerIterator(this.LowerIterator)}else{var prp;if(PropsInfo.supHide&&!PropsInfo.subHide){prp={type:DEGREE_SUBSCRIPT,ctrPrp:ctrPrp}; base=new CDegreeBase(prp,true);base.setBase(Sign);base.setIterator(this.LowerIterator);base.fillContent()}else if(!PropsInfo.supHide&&PropsInfo.subHide){prp={type:DEGREE_SUPERSCRIPT,ctrPrp:ctrPrp};base=new CDegreeBase(prp,true);base.setBase(Sign);base.setIterator(this.UpperIterator);base.fillContent()}else if(PropsInfo.supHide&&PropsInfo.subHide)base=Sign;else{prp={type:DEGREE_SubSup,ctrPrp:ctrPrp};base=new CDegreeSubSupBase(prp,true);base.setBase(Sign);base.setLowerIterator(this.LowerIterator);base.setUpperIterator(this.UpperIterator); base.fillContent()}}this.Base=base;this.addMCToContent([base,this.Arg])};CNary.prototype.ApplyProperties=function(RPI){var bSimpleNarySubSup=RPI.bInline==true||RPI.bDecreasedComp==true;var limLoc=bSimpleNarySubSup==true?NARY_SubSup:this.private_GetLimLoc();if(this.RecalcInfo.bProps==true||RPI.bChangeInline==true||limLoc!==this.CurrentLimLoc){var oSign=this.getSign(this.Pr.chr,this.Pr.chrType);if(bSimpleNarySubSup){this.Sign=new CMathText(true);this.Sign.add(oSign.chrCode)}else this.Sign=oSign.operator; var PropsInfo={limLoc:limLoc,sign:this.Sign,supHide:this.Pr.supHide,subHide:this.Pr.subHide};this.Pr.chrType=oSign.chrType;this.fillBase(PropsInfo);this.RecalcInfo.bProps=false}this.CurrentLimLoc=limLoc};CNary.prototype.private_GetLimLoc=function(){var limLoc=this.Pr.limLoc;if(limLoc===null||limLoc===undefined){var bIntegral=this.Pr.chr>8746&&this.Pr.chr<8753||this.Pr.chr===null||this.Pr.chr===undefined;var oMathSettings=Get_WordDocumentDefaultMathSettings();if(bIntegral)limLoc=oMathSettings.Get_IntLim(); else limLoc=oMathSettings.Get_NaryLim()}return limLoc};CNary.prototype.PreRecalc=function(Parent,ParaMath,ArgSize,RPI,GapsInfo){var bNaryInline=RPI.bNaryInline;if(RPI.bInline||RPI.bDecreasedComp)RPI.bNaryInline=true;CMathBase.prototype.PreRecalc.call(this,Parent,ParaMath,ArgSize,RPI,GapsInfo);RPI.bNaryInline=bNaryInline};CNary.prototype.getSign=function(chrCode,chrType){var result={chrCode:null,chrType:null,operator:null};var bChr=chrCode!==null&&chrCode==chrCode+0;if(chrCode==8747||chrType==NARY_INTEGRAL){result.chrCode= 8747;result.chrType=NARY_INTEGRAL;result.operator=new CIntegral}else if(chrCode==8748||chrType==NARY_DOUBLE_INTEGRAL){result.chrCode=8748;result.chrType=NARY_DOUBLE_INTEGRAL;result.operator=new CDoubleIntegral}else if(chrCode==8749||chrType==NARY_TRIPLE_INTEGRAL){result.chrCode=8749;result.chrType=NARY_TRIPLE_INTEGRAL;result.operator=new CTripleIntegral}else if(chrCode==8750||chrType==NARY_CONTOUR_INTEGRAL){result.chrCode=8750;result.chrType=NARY_CONTOUR_INTEGRAL;result.operator=new CContourIntegral}else if(chrCode== 8751||chrType==NARY_SURFACE_INTEGRAL){result.chrCode=8751;result.chrType=NARY_SURFACE_INTEGRAL;result.operator=new CSurfaceIntegral}else if(chrCode==8752||chrType==NARY_VOLUME_INTEGRAL){result.chrCode=8752;result.chrType=NARY_VOLUME_INTEGRAL;result.operator=new CVolumeIntegral}else if(chrCode==8721||chrType==NARY_SIGMA){result.chrCode=8721;result.chrType=NARY_SIGMA;result.operator=new CSigma}else if(chrCode==8719||chrType==NARY_PRODUCT){result.chrCode=8719;result.chrType=NARY_PRODUCT;result.operator= new CProduct}else if(chrCode==8720||chrType==NARY_COPRODUCT){result.chrCode=8720;result.chrType=NARY_COPRODUCT;result.operator=new CProduct(-1)}else if(chrCode==8899||chrType==NARY_UNION){result.chrCode=8899;result.chrType=NARY_UNION;result.operator=new CUnion}else if(chrCode==8898||chrType==NARY_INTERSECTION){result.chrCode=8898;result.chrType=NARY_INTERSECTION;result.operator=new CUnion(-1)}else if(chrCode==8897||chrType==NARY_LOGICAL_OR){result.chrCode=8897;result.chrType=NARY_LOGICAL_OR;result.operator= new CLogicalOr}else if(chrCode==8896||chrType==NARY_LOGICAL_AND){result.chrCode=8896;result.chrType=NARY_LOGICAL_AND;result.operator=new CLogicalOr(-1)}else if(bChr){result.chrCode=chrCode;result.chrType=NARY_TEXT_OPER;result.operator=new CMathText(true);result.operator.add(chrCode)}else{result.chrCode=8747;result.chrType=NARY_INTEGRAL;result.operator=new CIntegral}return result};CNary.prototype.setCtrPrp=function(txtPrp){this.CtrPrp.Merge(txtPrp);if(this.elements.length>0&&!this.elements[0][0].IsJustDraw())this.elements[0][0].setCtrPrp(this.CtrPrp)}; CNary.prototype.setDistance=function(){this.dW=this.Get_TxtPrControlLetter().FontSize/36*2.45};CNary.prototype.getBase=function(){return this.Arg};CNary.prototype.getUpperIterator=function(){if(!this.Pr.supHide)return this.UpperIterator};CNary.prototype.getLowerIterator=function(){if(!this.Pr.subHide)return this.LowerIterator};CNary.prototype.getBaseMathContent=function(){return this.Arg};CNary.prototype.getSupMathContent=function(){return this.UpperIterator};CNary.prototype.getSubMathContent=function(){return this.LowerIterator}; CNary.prototype.Apply_MenuProps=function(Props){if(Props.Type==Asc.c_oAscMathInterfaceType.LargeOperator){if(Props.LimLoc!==undefined&&false==this.ParaMath.Is_Inline()&&this.Pr.limLoc!==Props.LimLoc){var LimLoc=Props.LimLoc==Asc.c_oAscMathInterfaceNaryLimitLocation.SubSup?NARY_SubSup:NARY_UndOvr;AscCommon.History.Add(new CChangesMathNaryLimLoc(this,this.Pr.limLoc,LimLoc));this.raw_SetLimLoc(LimLoc)}if(Props.HideUpper!==undefined&&Props.HideUpper!==this.Pr.supHide){AscCommon.History.Add(new CChangesMathNaryUpperLimit(this, this.Pr.supHide,!this.Pr.supHide));this.raw_HideUpperIterator(!this.Pr.supHide)}if(Props.HideLower!==undefined&&Props.HideLower!==this.Pr.subHide){AscCommon.History.Add(new CChangesMathNaryLowerLimit(this,this.Pr.subHide,!this.Pr.subHide));this.raw_HideLowerIterator(!this.Pr.subHide)}}};CNary.prototype.Get_InterfaceProps=function(){return new CMathMenuNary(this)};CNary.prototype.raw_SetLimLoc=function(Value){if(this.Pr.limLoc!==Value){this.Pr.limLoc=Value;this.RecalcInfo.bProps=true}};CNary.prototype.raw_HideUpperIterator= function(Value){if(this.Pr.supHide!==Value){this.Pr.supHide=Value;this.RecalcInfo.bProps=true;this.CurPos=2;this.Arg.MoveCursorToStartPos()}};CNary.prototype.raw_HideLowerIterator=function(Value){if(this.Pr.subHide!==Value){this.Pr.subHide=Value;this.RecalcInfo.bProps=true;this.CurPos=2;this.Arg.MoveCursorToStartPos()}};CNary.prototype.Is_ContentUse=function(MathContent){if(MathContent===this.getBaseMathContent())return true;if(true!==this.Pr.subHide&&MathContent===this.getSubMathContent())return true; if(true!==this.Pr.supHide&&MathContent===this.getSupMathContent())return true;return false};CNary.prototype.Recalculate_Range=function(PRS,ParaPr,Depth){this.bOneLine=PRS.bMath_OneLine;if(this.bOneLine===true)CMathBase.prototype.Recalculate_Range.call(this,PRS,ParaPr,Depth);else{var CurLine=PRS.Line-this.StartLine;var CurRange=0===CurLine?PRS.Range-this.StartRange:PRS.Range;this.setDistance();var bContainCompareOper=PRS.bContainCompareOper;var RangeStartPos=this.protected_AddRange(CurLine,CurRange), RangeEndPos=2;if(CurLine==0&&CurRange==0){PRS.WordLen+=this.BrGapLeft;var WordLen=PRS.WordLen;if(this.Base.IsJustDraw())this.MeasureJustDraw(this.Base);else{PRS.bMath_OneLine=true;this.Base.Recalculate_Reset(PRS.Range,PRS.Line,PRS);this.LowerIterator.Recalculate_Reset(PRS.Range,PRS.Line,PRS);this.UpperIterator.Recalculate_Reset(PRS.Range,PRS.Line,PRS);this.Base.Recalculate_Range(PRS,ParaPr,Depth)}PRS.WordLen=WordLen+this.Base.size.width;if(false===PRS.Word&&false===PRS.FirstItemOnLine)PRS.Word=true; PRS.WordLen+=this.dW;this.Arg.Recalculate_Reset(PRS.Range,PRS.Line,PRS)}PRS.Update_CurPos(2,Depth);PRS.bMath_OneLine=false;this.Arg.Recalculate_Range(PRS,ParaPr,Depth+1);if(PRS.NewRange==false)PRS.WordLen+=this.BrGapRight;this.protected_FillRange(CurLine,CurRange,RangeStartPos,RangeEndPos);PRS.bMath_OneLine=false;PRS.bContainCompareOper=bContainCompareOper}};CNary.prototype.Recalculate_Range_Width=function(PRSC,_CurLine,_CurRange){if(this.bOneLine==true)CMathBase.prototype.Recalculate_Range_Width.call(this, PRSC,_CurLine,_CurRange);else{var CurLine=_CurLine-this.StartLine;var CurRange=0===CurLine?_CurRange-this.StartRange:_CurRange;var RangeW=PRSC.Range.W;if(CurLine==0&&CurRange==0){PRSC.Range.W+=this.BrGapLeft;var RangeW2=PRSC.Range.W;if(this.Base.IsJustDraw()==false){this.LowerIterator.Recalculate_Range_Width(PRSC,_CurLine,_CurRange);this.UpperIterator.Recalculate_Range_Width(PRSC,_CurLine,_CurRange);this.Base.Bounds.SetWidth(CurLine,CurRange,this.Base.size.width)}PRSC.Range.W=RangeW2+this.Base.size.width+ this.dW}this.Arg.Recalculate_Range_Width(PRSC,_CurLine,_CurRange);if(this.Arg.Math_Is_End(_CurLine,_CurRange))PRSC.Range.W+=this.BrGapRight;this.Bounds.SetWidth(CurLine,CurRange,PRSC.Range.W-RangeW)}};CNary.prototype.Draw_Elements=function(PDSE){var CurLine=PDSE.Line-this.StartLine;var CurRange=0===CurLine?PDSE.Range-this.StartRange:PDSE.Range;if(CurLine==0&&CurRange==0){if(this.Base.IsJustDraw()){var ctrPrp=this.Get_TxtPrControlLetter();var Font={FontSize:ctrPrp.FontSize,FontFamily:{Name:ctrPrp.FontFamily.Name, Index:ctrPrp.FontFamily.Index},Italic:false,Bold:false};PDSE.Graphics.SetFont(Font)}this.Base.Draw_Elements(PDSE)}this.Arg.Draw_Elements(PDSE)};CNary.prototype.UpdateBoundsPosInfo=function(PRSA,_CurLine,_CurRange,_CurPage){if(this.bOneLine==false){var CurLine=_CurLine-this.StartLine;var CurRange=0===CurLine?_CurRange-this.StartRange:_CurRange;this.Bounds.SetGenPos(CurLine,CurRange,PRSA);this.Bounds.SetPage(CurLine,CurRange,_CurPage);if(false==this.Base.IsJustDraw())this.Base.UpdateBoundsPosInfo(PRSA, _CurLine,_CurRange,_CurPage);this.Arg.UpdateBoundsPosInfo(PRSA,_CurLine,_CurRange,_CurPage)}else CMathBase.prototype.UpdateBoundsPosInfo.call(this,PRSA,_CurLine,_CurRange,_CurPage)};CNary.prototype.Recalculate_LineMetrics=function(PRS,ParaPr,_CurLine,_CurRange,ContentMetrics){if(this.bOneLine)CMathBase.prototype.Recalculate_LineMetrics.call(this,PRS,ParaPr,_CurLine,_CurRange,ContentMetrics);else{var CurLine=_CurLine-this.StartLine;var CurRange=0===CurLine?_CurRange-this.StartRange:_CurRange;if(PRS.bFastRecalculate=== false)this.Bounds.Reset(CurLine,CurRange);this.Arg.Recalculate_LineMetrics(PRS,ParaPr,_CurLine,_CurRange,ContentMetrics);var BoundArg=this.Arg.Get_LineBound(_CurLine,_CurRange);this.Bounds.UpdateMetrics(CurLine,CurRange,BoundArg);this.UpdatePRS(PRS,BoundArg);if(CurLine==0&&CurRange==0)if(this.Base.IsJustDraw()){this.Bounds.UpdateMetrics(CurLine,CurRange,this.Base.size);ContentMetrics.UpdateMetrics(this.Base.size);this.UpdatePRS(PRS,this.Base.size)}else{var NewContentMetrics=new CMathBoundsMeasures; this.LowerIterator.Recalculate_LineMetrics(PRS,ParaPr,_CurLine,_CurRange,NewContentMetrics);this.UpperIterator.Recalculate_LineMetrics(PRS,ParaPr,_CurLine,_CurRange,NewContentMetrics);this.Base.Recalculate_LineMetrics(PRS,ParaPr,_CurLine,_CurRange,ContentMetrics);this.Bounds.UpdateMetrics(CurLine,CurRange,this.Base.size);this.UpdatePRS(PRS,this.Base.size)}}};CNary.prototype.setPosition=function(pos,PosInfo){if(this.bOneLine)CMathBase.prototype.setPosition.call(this,pos,PosInfo);else{var Line=PosInfo.CurLine, Range=PosInfo.CurRange;var CurLine=Line-this.StartLine;var CurRange=0===CurLine?Range-this.StartRange:Range;this.UpdatePosBound(pos,PosInfo);if(CurLine==0&&CurRange==0){pos.x+=this.BrGapLeft;var PosBase=new CMathPosition;PosBase.x=pos.x;PosBase.y=pos.y-this.Base.size.ascent;this.Base.setPosition(PosBase,PosInfo);pos.x+=this.Base.size.width+this.dW}this.Arg.setPosition(pos,PosInfo);if(this.Arg.Math_Is_End(Line,Range))pos.x+=this.BrGapRight}};CNary.prototype.Can_ModifyArgSize=function(){return this.CurPos!== 2&&false===this.Is_SelectInside()};function CMathMenuNary(Nary){CMathMenuBase.call(this,Nary);this.Type=Asc.c_oAscMathInterfaceType.LargeOperator;if(undefined!==Nary){var HideUpper=undefined,HideLower=undefined;if(true===Nary.UpperIterator.IsPlaceholder())HideUpper=Nary.Pr.supHide==true;if(true===Nary.LowerIterator.IsPlaceholder())HideLower=Nary.Pr.subHide==true;this.bCanChangeLimLoc=false==Nary.ParaMath.Is_Inline();this.LimLoc=Nary.Pr.limLoc===NARY_SubSup?Asc.c_oAscMathInterfaceNaryLimitLocation.SubSup: Asc.c_oAscMathInterfaceNaryLimitLocation.UndOvr;this.HideUpper=HideUpper;this.HideLower=HideLower}else{this.LimLoc=undefined;this.HideUpper=undefined;this.HideLower=undefined;this.bCanChangeLimLoc=false}}CMathMenuNary.prototype=Object.create(CMathMenuBase.prototype);CMathMenuNary.prototype.constructor=CMathMenuNary;CMathMenuNary.prototype.can_ChangeLimitLocation=function(){return this.bCanChangeLimLoc};CMathMenuNary.prototype.get_LimitLocation=function(){return this.LimLoc};CMathMenuNary.prototype.put_LimitLocation= function(LimLoc){this.LimLoc=LimLoc};CMathMenuNary.prototype.get_HideUpper=function(){return this.HideUpper};CMathMenuNary.prototype.put_HideUpper=function(Hide){this.HideUpper=Hide};CMathMenuNary.prototype.get_HideLower=function(){return this.HideLower};CMathMenuNary.prototype.put_HideLower=function(Hide){this.HideLower=Hide};window["CMathMenuNary"]=CMathMenuNary;CMathMenuNary.prototype["can_ChangeLimitLocation"]=CMathMenuNary.prototype.can_ChangeLimitLocation;CMathMenuNary.prototype["get_LimitLocation"]= CMathMenuNary.prototype.get_LimitLocation;CMathMenuNary.prototype["put_LimitLocation"]=CMathMenuNary.prototype.put_LimitLocation;CMathMenuNary.prototype["get_HideUpper"]=CMathMenuNary.prototype.get_HideUpper;CMathMenuNary.prototype["put_HideUpper"]=CMathMenuNary.prototype.put_HideUpper;CMathMenuNary.prototype["get_HideLower"]=CMathMenuNary.prototype.get_HideLower;CMathMenuNary.prototype["put_HideLower"]=CMathMenuNary.prototype.put_HideLower;function CNaryUnd(bInside){CMathBase.call(this,bInside); this.setDimension(2,1)}CNaryUnd.prototype=Object.create(CMathBase.prototype);CNaryUnd.prototype.constructor=CNaryUnd;CNaryUnd.prototype.setDistance=function(){var zetta=this.Get_TxtPrControlLetter().FontSize*25.4/96;this.dH=zetta*.25};CNaryUnd.prototype.getAscent=function(){return this.elements[0][0].size.height+this.dH+this.elements[1][0].size.ascent};CNaryUnd.prototype.getUpperIterator=function(){return this.elements[0][0]};CNaryUnd.prototype.PreRecalc=function(Parent,ParaMath,ArgSize,RPI){this.Parent= Parent;this.ParaMath=ParaMath;this.Set_CompiledCtrPrp(Parent,ParaMath,RPI);var ArgSzUnd=ArgSize.Copy();ArgSzUnd.Decrease();this.elements[1][0].PreRecalc(this,ParaMath,ArgSize,RPI);var bDecreasedComp=RPI.bDecreasedComp;RPI.bDecreasedComp=true;this.elements[0][0].PreRecalc(this,ParaMath,ArgSzUnd,RPI);RPI.bDecreasedComp=bDecreasedComp};CNaryUnd.prototype.setBase=function(base){this.elements[1][0]=base};CNaryUnd.prototype.setUpperIterator=function(iterator){this.elements[0][0]=iterator};function CNaryOvr(bInside){CMathBase.call(this, bInside);this.setDimension(2,1)}CNaryOvr.prototype=Object.create(CMathBase.prototype);CNaryOvr.prototype.constructor=CNaryOvr;CNaryOvr.prototype.PreRecalc=function(Parent,ParaMath,ArgSize,RPI){this.Parent=Parent;this.ParaMath=ParaMath;this.Set_CompiledCtrPrp(Parent,ParaMath,RPI);var ArgSzOvr=ArgSize.Copy();ArgSzOvr.Decrease();this.elements[0][0].PreRecalc(this,ParaMath,ArgSize,RPI);var bDecreasedComp=RPI.bDecreasedComp;RPI.bDecreasedComp=true;this.elements[1][0].PreRecalc(this,ParaMath,ArgSzOvr,RPI); RPI.bDecreasedComp=bDecreasedComp};CNaryOvr.prototype.recalculateSize=function(){var FontSize=this.Get_TxtPrControlLetter().FontSize;var zetta=FontSize*25.4/96;var minGapBottom=zetta*.1,DownBaseline=FontSize*.23;var nOper=this.elements[0][0].size,iter=this.elements[1][0].size;this.dH=DownBaseline>iter.ascent+minGapBottom?DownBaseline-iter.ascent:minGapBottom;var ascent=nOper.ascent;var width=nOper.width>iter.width?nOper.width:iter.width;width+=this.GapLeft+this.GapRight;var height=nOper.height+this.dH+ iter.height;this.size.height=height;this.size.width=width;this.size.ascent=ascent};CNaryOvr.prototype.getLowerIterator=function(){return this.elements[1][0]};CNaryOvr.prototype.setBase=function(base){this.elements[0][0]=base};CNaryOvr.prototype.setLowerIterator=function(iterator){this.elements[1][0]=iterator};function CNaryUndOvr(bInside){this.gapTop=0;this.gapBottom=0;CMathBase.call(this,bInside);this.setDimension(3,1)}CNaryUndOvr.prototype=Object.create(CMathBase.prototype);CNaryUndOvr.prototype.constructor= CNaryUndOvr;CNaryUndOvr.prototype.PreRecalc=function(Parent,ParaMath,ArgSize,RPI){this.Parent=Parent;this.ParaMath=ParaMath;this.Set_CompiledCtrPrp(Parent,ParaMath,RPI);var ArgSzIter=ArgSize.Copy();ArgSzIter.Decrease();this.elements[1][0].PreRecalc(this,ParaMath,ArgSize,RPI);var bDecreasedComp=RPI.bDecreasedComp;RPI.bDecreasedComp=true;this.elements[0][0].PreRecalc(this,ParaMath,ArgSzIter,RPI);this.elements[2][0].PreRecalc(this,ParaMath,ArgSzIter,RPI);RPI.bDecreasedComp=bDecreasedComp};CNaryUndOvr.prototype.recalculateSize= function(){var FontSize=this.Get_TxtPrControlLetter().FontSize;var zetta=FontSize*25.4/96;this.gapTop=zetta*.25;var minGapBottom=zetta*.1,DownBaseline=FontSize*.23;var ascLIter=this.elements[2][0].size.ascent;this.gapBottom=DownBaseline>ascLIter+minGapBottom?DownBaseline-ascLIter:minGapBottom;var ascent=this.elements[0][0].size.height+this.gapTop+this.elements[1][0].size.ascent;var width=0,height=0;for(var i=0;i<3;i++){width=width>this.elements[i][0].size.width?width:this.elements[i][0].size.width; height+=this.elements[i][0].size.height}width+=this.GapLeft+this.GapRight;height+=this.gapTop+this.gapBottom;this.size.height=height;this.size.width=width;this.size.ascent=ascent};CNaryUndOvr.prototype.setPosition=function(pos,PosInfo){this.pos.x=pos.x;this.pos.y=pos.y;var UpIter=this.elements[0][0],Sign=this.elements[1][0],LowIter=this.elements[2][0];var PosUpIter=new CMathPosition;PosUpIter.x=pos.x+this.GapLeft+this.align(0,0).x;PosUpIter.y=pos.y+UpIter.size.ascent;var PosSign=new CMathPosition; PosSign.x=pos.x+this.GapLeft+this.align(1,0).x;PosSign.y=pos.y+UpIter.size.height+this.gapTop;var PosLowIter=new CMathPosition;PosLowIter.x=pos.x+this.GapLeft+this.align(2,0).x;PosLowIter.y=PosSign.y+Sign.size.height+this.gapBottom+LowIter.size.ascent;LowIter.setPosition(PosLowIter,PosInfo);Sign.setPosition(PosSign,PosInfo);UpIter.setPosition(PosUpIter,PosInfo)};CNaryUndOvr.prototype.setBase=function(base){this.elements[1][0]=base};CNaryUndOvr.prototype.setUpperIterator=function(iterator){this.elements[0][0]= iterator};CNaryUndOvr.prototype.setLowerIterator=function(iterator){this.elements[2][0]=iterator};CNaryUndOvr.prototype.getLowerIterator=function(){return this.elements[2][0]};CNaryUndOvr.prototype.getUpperIterator=function(){return this.elements[0][0]};function CNaryOperator(flip){this.size=new CMathSize;this.pos=new CMathPosition;this.bFlip=flip==-1;this.Parent=null;this.ParaMath=null;this.sizeGlyph=null}CNaryOperator.prototype.Draw_Elements=function(PDSE){this.Parent.Make_ShdColor(PDSE,this.Parent.Get_CompiledCtrPrp()); var PosLine=this.ParaMath.GetLinePosition(PDSE.Line,PDSE.Range);if(this.Type==para_Math_Text)this.drawTextElem(PosLine.x,PosLine.y,PDSE.Graphics);else this.drawGlyph(PosLine.x,PosLine.y,PDSE.Graphics,PDSE)};CNaryOperator.prototype.drawGlyph=function(x,y,pGraphics,PDSE){var coord=this.getCoord();var X=coord.X,Y=coord.Y;var XX=[],YY=[];var textScale=this.Get_TxtPrControlLetter().FontSize/850;var alpha=textScale*25.4/96/64;var a,b;if(this.bFlip){a=-1;b=this.sizeGlyph.height}else{a=1;b=0}for(var i=0;i< X.length;i++){XX[i]=this.pos.x+x+X[i]*alpha;YY[i]=this.pos.y+y+(a*Y[i]*alpha+b)}var intGrid=pGraphics.GetIntegerGrid();pGraphics.SetIntegerGrid(false);pGraphics.p_width(0);pGraphics._s();this.drawPath(pGraphics,XX,YY);pGraphics.df();pGraphics._s();pGraphics.SetIntegerGrid(intGrid)};CNaryOperator.prototype.drawTextElem=function(x,y,pGraphics){var ctrPrp=this.Get_TxtPrControlLetter();var Font={FontSize:ctrPrp.FontSize,FontFamily:{Name:ctrPrp.FontFamily.Name,Index:ctrPrp.FontFamily.Index},Italic:false, Bold:false};pGraphics.SetFont(Font)};CNaryOperator.prototype.IsJustDraw=function(){return true};CNaryOperator.prototype.setPosition=function(pos){this.pos.x=pos.x;this.pos.y=pos.y};CNaryOperator.prototype.recalculateSize=function(){this.sizeGlyph=this.calculateSizeGlyph();var height=this.sizeGlyph.height,width=this.sizeGlyph.width,ascent=this.sizeGlyph.height/2+DIV_CENT*this.Get_TxtPrControlLetter().FontSize;this.size.height=height;this.size.width=width;this.size.ascent=ascent};CNaryOperator.prototype.PreRecalc= function(Parent,ParaMath,ArgSize,RPI){this.Parent=Parent;this.ParaMath=ParaMath};CNaryOperator.prototype.Measure=function(oMeasure,RPI){this.recalculateSize()};CNaryOperator.prototype.Get_TxtPrControlLetter=function(){return this.Parent.Get_TxtPrControlLetter()};function CSigma(){CNaryOperator.call(this)}CSigma.prototype=Object.create(CNaryOperator.prototype);CSigma.prototype.constructor=CSigma;CSigma.prototype.drawPath=function(pGraphics,XX,YY){pGraphics._m(XX[0],YY[0]);pGraphics._l(XX[1],YY[1]); pGraphics._l(XX[2],YY[2]);pGraphics._l(XX[3],YY[3]);pGraphics._l(XX[4],YY[4]);pGraphics._c(XX[4],YY[4],XX[5],YY[5],XX[6],YY[6]);pGraphics._c(XX[6],YY[6],XX[7],YY[7],XX[8],YY[8]);pGraphics._c(XX[8],YY[8],XX[9],YY[9],XX[10],YY[10]);pGraphics._c(XX[10],YY[10],XX[11],YY[11],XX[12],YY[12]);pGraphics._c(XX[12],YY[12],XX[13],YY[13],XX[14],YY[14]);pGraphics._l(XX[15],YY[15]);pGraphics._l(XX[16],YY[16]);pGraphics._l(XX[17],YY[17]);pGraphics._l(XX[18],YY[18]);pGraphics._l(XX[19],YY[19]);pGraphics._l(XX[20], YY[20]);pGraphics._l(XX[21],YY[21]);pGraphics._l(XX[22],YY[22]);pGraphics._l(XX[23],YY[23]);pGraphics._l(XX[24],YY[24]);pGraphics._c(XX[24],YY[24],XX[25],YY[25],XX[26],YY[26]);pGraphics._c(XX[26],YY[26],XX[27],YY[27],XX[28],YY[28]);pGraphics._c(XX[28],YY[28],XX[29],YY[29],XX[30],YY[30]);pGraphics._c(XX[30],YY[30],XX[31],YY[31],XX[32],YY[32]);pGraphics._c(XX[32],YY[32],XX[33],YY[33],XX[34],YY[34]);pGraphics._l(XX[35],YY[35])};CSigma.prototype.getCoord=function(){var X=[],Y=[];X[0]=16252;Y[0]=5200; X[1]=40602;Y[1]=42154;X[2]=40602;Y[2]=45954;X[3]=13302;Y[3]=83456;X[4]=46202;Y[4]=83456;X[5]=49302;Y[5]=83456;X[6]=50877;Y[6]=83056;X[7]=52452;Y[7]=82656;X[8]=53577;Y[8]=81831;X[9]=54702;Y[9]=81006;X[10]=55627;Y[10]=79531;X[11]=56552;Y[11]=78056;X[12]=57402;Y[12]=75456;X[13]=58252;Y[13]=72856;X[14]=59002;Y[14]=68656;X[15]=64850;Y[15]=68656;X[16]=63400;Y[16]=93056;X[17]=0;Y[17]=93056;X[18]=0;Y[18]=90256;X[19]=30902;Y[19]=47804;X[20]=1902;Y[20]=2850;X[21]=1902;Y[21]=0;X[22]=63652;Y[22]=0;X[23]=63652; Y[23]=22252;X[24]=58252;Y[24]=22252;X[25]=57002;Y[25]=17501;X[26]=55877;Y[26]=14501;X[27]=54752;Y[27]=11501;X[28]=53577;Y[28]=9751;X[29]=52402;Y[29]=8E3;X[30]=51177;Y[30]=7075;X[31]=49952;Y[31]=6150;X[32]=48352;Y[32]=5675;X[33]=46752;Y[33]=5200;X[34]=44102;Y[34]=5200;X[35]=16252;Y[35]=5200;var textScale=this.Get_TxtPrControlLetter().FontSize/850;var alpha=textScale*25.4/96/64;var h1=Y[0]-Y[21],h2=Y[17]-Y[3],h3=Y[2]-Y[1],h4=Y[20]-Y[21],h5=Y[17]-Y[18];var H1=this.sizeGlyph.height/alpha-h1-h2-h3;var h_middle1= Y[3]-Y[0]-h3,coeff1=(Y[1]-Y[0])/h_middle1,coeff2=(Y[3]-Y[2])/h_middle1;var y3=Y[3],y2=Y[2];Y[1]=Y[0]+H1*coeff1;Y[2]=Y[1]+h3;Y[3]=Y[2]+H1*coeff2;Y[19]=Y[2]+Y[19]-y2;Y[18]=Y[3]+Y[18]-y3;for(var i=4;i<18;i++)Y[i]=Y[3]+(Y[i]-y3);var W=(this.sizeGlyph.width-this.gap)/alpha;var c1=(X[21]-X[17])/X[15],c2=(X[22]-X[21])/X[15];var x22=X[22];X[21]=X[20]=X[17]+c1*W;X[22]=X[23]=X[21]+c2*W;for(var i=24;i<35;i++)X[i]=X[22]+X[i]-x22;var c3=(X[4]-X[3])/X[15],c4=(X[15]-X[16])/X[15],c5=(X[15]-X[2])/X[15];var x15=X[15], x2=X[2];X[4]=X[3]+c3*W;X[15]=W;X[16]=X[15]-c4*W;X[2]=X[1]=X[15]-c5*W;X[19]=X[2]-(x2-X[19]);for(var i=5;i<15;i++)X[i]=X[15]-(x15-X[i]);return{X:X,Y:Y}};CSigma.prototype.calculateSizeGlyph=function(){var betta=this.Get_TxtPrControlLetter().FontSize/36;var _width=8.997900390624999*betta,_height=11.994444444444444*betta;this.gap=.93*betta;var width=1.76*_width+this.gap,height=2*_height;return{width:width,height:height}};function CProduct(bFlip){CNaryOperator.call(this,bFlip)}CProduct.prototype=Object.create(CNaryOperator.prototype); CProduct.prototype.constructor=CProduct;CProduct.prototype.drawPath=function(pGraphics,XX,YY){pGraphics._m(XX[0],YY[0]);pGraphics._l(XX[1],YY[1]);pGraphics._c(XX[1],YY[1],XX[2],YY[2],XX[3],YY[3]);pGraphics._c(XX[3],YY[3],XX[4],YY[4],XX[5],YY[5]);pGraphics._c(XX[5],YY[5],XX[6],YY[6],XX[7],YY[7]);pGraphics._c(XX[7],YY[7],XX[8],YY[8],XX[9],YY[9]);pGraphics._l(XX[10],YY[10]);pGraphics._c(XX[10],YY[10],XX[11],YY[11],XX[12],YY[12]);pGraphics._c(XX[12],YY[12],XX[13],YY[13],XX[14],YY[14]);pGraphics._c(XX[14], YY[14],XX[15],YY[15],XX[16],YY[16]);pGraphics._c(XX[16],YY[16],XX[17],YY[17],XX[18],YY[18]);pGraphics._l(XX[19],YY[19]);pGraphics._l(XX[20],YY[20]);pGraphics._l(XX[21],YY[21]);pGraphics._c(XX[21],YY[21],XX[22],YY[22],XX[23],YY[23]);pGraphics._c(XX[23],YY[23],XX[24],YY[24],XX[25],YY[25]);pGraphics._c(XX[25],YY[25],XX[26],YY[26],XX[27],YY[27]);pGraphics._c(XX[27],YY[27],XX[28],YY[28],XX[29],YY[29]);pGraphics._l(XX[30],YY[30]);pGraphics._l(XX[31],YY[31]);pGraphics._l(XX[32],YY[32]);pGraphics._c(XX[32], YY[32],XX[33],YY[33],XX[34],YY[34]);pGraphics._c(XX[34],YY[34],XX[35],YY[35],XX[36],YY[36]);pGraphics._c(XX[36],YY[36],XX[37],YY[37],XX[38],YY[38]);pGraphics._c(XX[38],YY[38],XX[39],YY[39],XX[40],YY[40]);pGraphics._l(XX[41],YY[41]);pGraphics._l(XX[42],YY[42]);pGraphics._l(XX[43],YY[43]);pGraphics._c(XX[43],YY[43],XX[44],YY[44],XX[45],YY[45]);pGraphics._c(XX[45],YY[45],XX[46],YY[46],XX[47],YY[47]);pGraphics._c(XX[47],YY[47],XX[48],YY[48],XX[49],YY[49]);pGraphics._c(XX[49],YY[49],XX[50],YY[50],XX[51], YY[51]);pGraphics._l(XX[52],YY[52]);pGraphics._c(XX[52],YY[52],XX[53],YY[53],XX[54],YY[54]);pGraphics._c(XX[54],YY[54],XX[55],YY[55],XX[56],YY[56]);pGraphics._c(XX[56],YY[56],XX[57],YY[57],XX[58],YY[58]);pGraphics._c(XX[58],YY[58],XX[59],YY[59],XX[60],YY[60]);pGraphics._l(XX[61],YY[61]);pGraphics._l(XX[62],YY[62])};CProduct.prototype.getCoord=function(){var X=[],Y=[];X[0]=67894;Y[0]=0;X[1]=67894;Y[1]=2245;X[2]=65100;Y[2]=3024;X[3]=63955;Y[3]=3666;X[4]=62810;Y[4]=4307;X[5]=62100;Y[5]=5338;X[6]=61390; Y[6]=6368;X[7]=61092;Y[7]=8338;X[8]=60794;Y[8]=10308;X[9]=60794;Y[9]=14706;X[10]=60794;Y[10]=70551;X[11]=60794;Y[11]=74674;X[12]=61069;Y[12]=76666;X[13]=61345;Y[13]=78659;X[14]=61987;Y[14]=79736;X[15]=62629;Y[15]=80813;X[16]=63798;Y[16]=81523;X[17]=64968;Y[17]=82233;X[18]=67904;Y[18]=83012;X[19]=67904;Y[19]=85257;X[20]=43623;Y[20]=85257;X[21]=43623;Y[21]=83012;X[22]=46368;Y[22]=82279;X[23]=47512;Y[23]=81614;X[24]=48657;Y[24]=80950;X[25]=49343;Y[25]=79896;X[26]=50029;Y[26]=78843;X[27]=50326;Y[27]= 76850;X[28]=50624;Y[28]=74857;X[29]=50624;Y[29]=70551;X[30]=50624;Y[30]=4856;X[31]=17165;Y[31]=4856;X[32]=17165;Y[32]=70551;X[33]=17165;Y[33]=74994;X[34]=17463;Y[34]=76918;X[35]=17761;Y[35]=78843;X[36]=18450;Y[36]=79873;X[37]=19139;Y[37]=80904;X[38]=20332;Y[38]=81591;X[39]=21526;Y[39]=82279;X[40]=24326;Y[40]=83012;X[41]=24326;Y[41]=85257;X[42]=0;Y[42]=85257;X[43]=0;Y[43]=83012;X[44]=2743;Y[44]=82279;X[45]=3931;Y[45]=81614;X[46]=5120;Y[46]=80950;X[47]=5783;Y[47]=79873;X[48]=6446;Y[48]=78797;X[49]= 6743;Y[49]=76827;X[50]=7040;Y[50]=74857;X[51]=7040;Y[51]=70551;X[52]=7040;Y[52]=14706;X[53]=7040;Y[53]=10400;X[54]=6743;Y[54]=8430;X[55]=6446;Y[55]=6460;X[56]=5806;Y[56]=5429;X[57]=5166;Y[57]=4398;X[58]=4E3;Y[58]=3711;X[59]=2834;Y[59]=3024;X[60]=0;Y[60]=2245;X[61]=0;Y[61]=0;X[62]=67894;Y[62]=0;var textScale=this.Get_TxtPrControlLetter().FontSize/850,alpha=textScale*25.4/96/64;var h1=Y[9],h2=Y[19]-Y[10],w1=X[31];var Height=this.sizeGlyph.height/alpha-h1-h2,Width=(this.sizeGlyph.width-this.gap)/alpha- 2*w1;var hh=Height-(Y[10]-Y[9]),ww=Width-(X[30]-X[31]);for(var i=0;i<20;i++){Y[10+i]+=hh;Y[32+i]+=hh}for(var i=0;i<31;i++)X[i]+=ww;X[62]+=ww;return{X:X,Y:Y}};CProduct.prototype.calculateSizeGlyph=function(){var betta=this.Get_TxtPrControlLetter().FontSize/36;var _width=10.312548828125*betta,_height=11.994444444444444*betta;this.gap=.93*betta;var width=1.76*_width+this.gap,height=2*_height;return{width:width,height:height}};function CUnion(bFlip){CNaryOperator.call(this,bFlip)}CUnion.prototype=Object.create(CNaryOperator.prototype); CUnion.prototype.constructor=CUnion;CUnion.prototype.drawPath=function(pGraphics,XX,YY){pGraphics._m(XX[0],YY[0]);pGraphics._c(XX[0],YY[0],XX[1],YY[1],XX[2],YY[2]);pGraphics._c(XX[2],YY[2],XX[3],YY[3],XX[4],YY[4]);pGraphics._l(XX[5],YY[5]);pGraphics._l(XX[6],YY[6]);pGraphics._l(XX[7],YY[7]);pGraphics._c(XX[7],YY[7],XX[8],YY[8],XX[9],YY[9]);pGraphics._c(XX[9],YY[9],XX[10],YY[10],XX[11],YY[11]);pGraphics._c(XX[11],YY[11],XX[12],YY[12],XX[13],YY[13]);pGraphics._c(XX[13],YY[13],XX[14],YY[14],XX[15],YY[15]); pGraphics._l(XX[16],YY[16]);pGraphics._l(XX[17],YY[17]);pGraphics._l(XX[18],YY[18]);pGraphics._c(XX[18],YY[18],XX[19],YY[19],XX[20],YY[20]);pGraphics._c(XX[20],YY[20],XX[21],YY[21],XX[22],YY[22])};CUnion.prototype.getCoord=function(){var X=[],Y=[];X[0]=49526.184566929136;Y[0]=127087.84;X[1]=33974.37429971653;Y[1]=127877.20000000001;X[2]=25226.481024409448;Y[2]=120034.20000000001;X[3]=15996.016171708661;Y[3]=113190.09;X[4]=15301.25;Y[4]=95025.84;X[5]=15301.25;Y[5]=0;X[6]=7100;Y[6]=0;X[7]=7100;Y[7]= 94775.84;X[8]=7100;Y[8]=117815.09;X[9]=21524.90275275591;Y[9]=127165.84;X[10]=31605.36420585827;Y[10]=135801.88;X[11]=49526.184566929136;Y[11]=135775.84;X[12]=67447.00492800001;Y[12]=135801.88;X[13]=77527.46638110236;Y[13]=127165.84;X[14]=91952.36913385827;Y[14]=117815.09;X[15]=91952.36913385827;Y[15]=94775.84;X[16]=91952.36913385827;Y[16]=0;X[17]=83751.11913385827;Y[17]=0;X[18]=83751.11913385827;Y[18]=95025.84;X[19]=83056.35296214961;Y[19]=113190.09;X[20]=73825.88810944883;Y[20]=120034.20000000001; X[21]=65077.99483414174;Y[21]=127877.20000000001;X[22]=49526.184566929136;Y[22]=127087.84;return{X:X,Y:Y}};CUnion.prototype.calculateSizeGlyph=function(){var betta=this.Get_TxtPrControlLetter().FontSize/36;this.gap=.93*betta;var _width=9.38*betta,_height=11.994444444444444*betta;var width=1.76*_width+this.gap,height=2*_height;return{width:width,height:height}};function CLogicalOr(bFlip){CNaryOperator.call(this,bFlip)}CLogicalOr.prototype=Object.create(CNaryOperator.prototype);CLogicalOr.prototype.constructor= CLogicalOr;CLogicalOr.prototype.drawPath=function(pGraphics,XX,YY){pGraphics._m(XX[0],YY[0]);pGraphics._l(XX[1],YY[1]);pGraphics._l(XX[2],YY[2]);pGraphics._l(XX[3],YY[3]);pGraphics._l(XX[4],YY[4]);pGraphics._l(XX[5],YY[5]);pGraphics._l(XX[6],YY[6]);pGraphics._l(XX[7],YY[7])};CLogicalOr.prototype.getCoord=function(){var X=[],Y=[];X[0]=0;Y[0]=0;X[1]=34812;Y[1]=89801;X[2]=43792;Y[2]=89801;X[3]=73240;Y[3]=0;X[4]=63269;Y[4]=0;X[5]=38719;Y[5]=77322;X[6]=10613;Y[6]=0;X[7]=0;Y[7]=0;var textScale=this.Get_TxtPrControlLetter().FontSize/ 850,alpha=textScale*25.4/96/64;var w1=X[1],w2=X[2]-X[1],w4=X[5]-X[1],w5=X[3]-X[4];var Height=this.sizeGlyph.height/alpha,Width=(this.sizeGlyph.width-this.gap)/alpha-w2;var _W=X[3]-w2,k1=w1/_W;X[1]=k1*Width;X[2]=X[1]+w2;X[5]=X[1]+w4;X[3]=Width+w2;X[4]=Width+w2-w5;var hh=Height-Y[2];Y[1]+=hh;Y[2]+=hh;Y[5]+=hh;return{X:X,Y:Y}};CLogicalOr.prototype.calculateSizeGlyph=function(){var betta=this.Get_TxtPrControlLetter().FontSize/36;var _width=9.6159*betta,_height=11.994444444444444*betta;this.gap=.55*betta; var width=1.76*_width+this.gap,height=2*_height;return{width:width,height:height}};function CIntegral(){CNaryOperator.call(this)}CIntegral.prototype=Object.create(CNaryOperator.prototype);CIntegral.prototype.constructor=CIntegral;CIntegral.prototype.getCoord=function(){var X=[],Y=[];X[0]=20407;Y[0]=65723;X[1]=20407;Y[1]=60840;X[2]=20407;Y[2]=37013;X[3]=24333;Y[3]=18507;X[4]=28260;Y[4]=0;X[5]=40590;Y[5]=0;X[6]=42142;Y[6]=0;X[7]=43604;Y[7]=383;X[8]=45067;Y[8]=765;X[9]=46215;Y[9]=1305;X[10]=45180;Y[10]= 9225;X[11]=41760;Y[11]=9225;X[12]=41512;Y[12]=7335;X[13]=40724;Y[13]=6064;X[14]=39937;Y[14]=4793;X[15]=37935;Y[15]=4793;X[16]=30465;Y[16]=4793;X[17]=28406;Y[17]=23086;X[18]=26347;Y[18]=41378;X[19]=26347;Y[19]=60840;X[20]=26347;Y[20]=65723;X[22]=26347;Y[22]=0;X[23]=26347;Y[23]=4883;X[24]=26325;Y[24]=33368;X[25]=21622;Y[25]=49681;X[26]=16920;Y[26]=65993;X[27]=5467;Y[27]=65993;X[28]=4387;Y[28]=65993;X[29]=2947;Y[29]=65633;X[30]=1507;Y[30]=65273;X[31]=0;Y[31]=64553;X[32]=1147;Y[32]=55665;X[33]=4770;Y[33]= 55665;X[34]=4927;Y[34]=58050;X[35]=5782;Y[35]=59412;X[36]=6637;Y[36]=60773;X[37]=8775;Y[37]=60773;X[38]=13365;Y[38]=60773;X[39]=16886;Y[39]=50783;X[40]=20407;Y[40]=40793;X[41]=20407;Y[41]=4883;X[42]=20407;Y[42]=0;var shX=X[9]*.025;for(var i=0;i<21;i++)X[i]+=shX;var shY=Y[26]*.3377;for(var i=0;i<21;i++)Y[22+i]+=shY+Y[20];X[21]=(X[20]+X[22])/2;Y[21]=(Y[20]+Y[22])/2;X[44]=X[0];Y[44]=Y[0];X[43]=(X[42]+X[44])/2;Y[43]=(Y[44]+Y[42])/2;var W=X[9],H=Y[27];return{X:X,Y:Y,W:W,H:H}};CIntegral.prototype.drawPath= function(pGraphics,XX,YY){pGraphics._m(XX[0],YY[0]);pGraphics._l(XX[1],YY[1]);pGraphics._c(XX[1],YY[1],XX[2],YY[2],XX[3],YY[3]);pGraphics._c(XX[3],YY[3],XX[4],YY[4],XX[5],YY[5]);pGraphics._c(XX[5],YY[5],XX[6],YY[6],XX[7],YY[7]);pGraphics._c(XX[7],YY[7],XX[8],YY[8],XX[9],YY[9]);pGraphics._l(XX[10],YY[10]);pGraphics._l(XX[11],YY[11]);pGraphics._c(XX[11],YY[11],XX[12],YY[12],XX[13],YY[13]);pGraphics._c(XX[13],YY[13],XX[14],YY[14],XX[15],YY[15]);pGraphics._c(XX[15],YY[15],XX[16],YY[16],XX[17],YY[17]); pGraphics._c(XX[17],YY[17],XX[18],YY[18],XX[19],YY[19]);pGraphics._l(XX[20],YY[20]);pGraphics._c(XX[20],YY[20],XX[21],YY[21],XX[22],YY[22]);pGraphics._l(XX[22],YY[22]);pGraphics._l(XX[23],YY[23]);pGraphics._c(XX[23],YY[23],XX[24],YY[24],XX[25],YY[25]);pGraphics._c(XX[25],YY[25],XX[26],YY[26],XX[27],YY[27]);pGraphics._c(XX[27],YY[27],XX[28],YY[28],XX[29],YY[29]);pGraphics._c(XX[29],YY[29],XX[30],YY[30],XX[31],YY[31]);pGraphics._l(XX[32],YY[32]);pGraphics._l(XX[33],YY[33]);pGraphics._c(XX[33],YY[33], XX[34],YY[34],XX[35],YY[35]);pGraphics._c(XX[35],YY[35],XX[36],YY[36],XX[37],YY[37]);pGraphics._c(XX[37],YY[37],XX[38],YY[38],XX[39],YY[39]);pGraphics._c(XX[39],YY[39],XX[40],YY[40],XX[41],YY[41]);pGraphics._l(XX[42],YY[42]);pGraphics._c(XX[42],YY[42],XX[43],YY[43],XX[44],YY[44])};CIntegral.prototype.calculateSizeGlyph=function(){var betta=this.Get_TxtPrControlLetter().FontSize/36;var _width=8.624*betta,_height=13.7*betta;this.gap=.93*betta;var width=_width+this.gap,height=2*_height;return{width:width, height:height}};function CDoubleIntegral(){CIntegral.call(this)}CDoubleIntegral.prototype=Object.create(CIntegral.prototype);CDoubleIntegral.prototype.constructor=CDoubleIntegral;CDoubleIntegral.prototype.drawPath=function(pGraphics,XX,YY,Width){var XX2=[],YY2=[];var w=Width==undefined?(XX[9]-XX[29])*.6:Width*.36;for(var i=0;iExtY[i]){ExtX[i]+=WidthLine;InsideX[CircleLng-i-1]-=WidthLine}else if(PrevY< ExtY[i]){ExtX[i]-=WidthLine;InsideX[CircleLng-i-1]+=WidthLine}if(PrevX>ExtX[i]){ExtY[i]-=WidthLine;InsideY[CircleLng-i-1]+=WidthLine}else if(PrevXIntegralY[j])IntegralX[j]+=WidthLine;else if(PrevYIntegralX[j])IntegralY[j]-=WidthLine;else if(PrevX.9*Descent;if(heightArgmaxHgtRad){heightTick=maxHgtTick;widthSlash=.67*measureTick;gapLeft=.2*measureTick}else{var zetta;if(height< H1)zetta=.75;else if(heightArg2*g_dKoef_pt_to_mm?this.signRadical.gapArg:2*g_dKoef_pt_to_mm;var gapBase=gSign+gArg;if(this.Pr.type==SQUARE_RADICAL){shTop= (sign.height-gSign-this.RealBase.size.height)/2;shTop=shTop>0?shTop:0;ascent=gapBase+shTop+this.RealBase.size.ascent;this.size.ascent=ascent;this.size.height=sign.height>ascent-this.RealBase.size.ascent+this.RealBase.size.height?sign.height:ascent-this.RealBase.size.ascent+this.RealBase.size.height;this.size.width=sign.width+this.GapLeft+this.GapRight}else if(this.Pr.type==DEGREE_RADICAL){var wTick=this.signRadical.measure.widthTick,hTick=this.signRadical.measure.heightTick;var gapHeight=.011*txtPrp.FontSize; this.gapWidth=.011*txtPrp.FontSize;var wDegree=this.Iterator.size.width>wTick?this.Iterator.size.width-wTick:0;width=wDegree+sign.width+this.gapWidth;this.size.width=width+this.GapLeft+this.GapRight;shTop=(sign.height-gSign-this.RealBase.size.height)/2;var h1=this.Iterator.size.height+(.65*sign.height+.5>>0),h2=sign.height;if(h1>h2){this.size.height=h1;this.size.ascent=h1-sign.height+gapBase+shTop+this.RealBase.size.ascent}else{this.size.height=h2;this.size.ascent=gapBase+shTop+this.RealBase.size.ascent}this.gapDegree= this.size.height-h1}};CRadical.prototype.Resize=function(oMeasure,RPI){if(this.Pr.type==SQUARE_RADICAL)this.RealBase.Resize(oMeasure,RPI);else{this.Iterator.Resize(oMeasure,RPI);this.RealBase.Resize(oMeasure,RPI)}this.recalculateSize(oMeasure)};CRadical.prototype.setPosition=function(pos,PosInfo){this.pos.x=pos.x;this.pos.y=pos.y-this.size.ascent;this.UpdatePosBound(pos,PosInfo);var PosBase=new CMathPosition,PosRadical=new CMathPosition;if(this.Pr.type==SQUARE_RADICAL){var gapLeft=this.size.width- this.RealBase.size.width-this.GapRight;var gapTop=this.size.ascent-this.RealBase.size.ascent;PosRadical.x=this.pos.x+this.GapLeft;PosRadical.y=this.pos.y;PosBase.x=this.pos.x+gapLeft;PosBase.y=this.pos.y+gapTop+this.RealBase.size.ascent;this.signRadical.setPosition(PosRadical);this.RealBase.setPosition(PosBase,PosInfo)}else if(this.Pr.type==DEGREE_RADICAL){var wTick=this.signRadical.measure.widthTick;var PosDegree=new CMathPosition;PosDegree.x=this.pos.x+this.GapLeft+this.gapWidth;PosDegree.y=this.pos.y+ this.gapDegree+this.Iterator.size.ascent;this.Iterator.setPosition(PosDegree,PosInfo);var wDegree=this.Iterator.size.width>wTick?this.Iterator.size.width-wTick:0;PosRadical.x=this.pos.x+this.GapLeft+wDegree;PosRadical.y=this.pos.y+this.size.height-this.signRadical.size.height;this.signRadical.setPosition(PosRadical);PosBase.x=this.pos.x+this.size.width-this.RealBase.size.width-this.GapRight;PosBase.y=this.pos.y+this.size.ascent;this.RealBase.setPosition(PosBase,PosInfo)}pos.x+=this.size.width};CRadical.prototype.Get_ParaContentPosByXY= function(SearchPos,Depth,_CurLine,_CurRange,StepEnd){var bResult;if(this.Pr.type==DEGREE_RADICAL)bResult=CMathBase.prototype.Get_ParaContentPosByXY.call(this,SearchPos,Depth,_CurLine,_CurRange,StepEnd);else if(true===this.Content[1].Get_ParaContentPosByXY(SearchPos,Depth+1,_CurLine,_CurRange,StepEnd)){SearchPos.Pos.Update2(1,Depth);bResult=true}return bResult};CRadical.prototype.Draw_LinesForContent=function(PDSL){if(this.Pr.type==SQUARE_RADICAL)this.RealBase.Draw_Lines(PDSL);else{this.RealBase.Draw_Lines(PDSL); this.Iterator.Draw_Lines(PDSL)}};CRadical.prototype.Draw_Elements=function(PDSE){var X=PDSE.X;var PosLine=this.ParaMath.GetLinePosition(PDSE.Line,PDSE.Range);this.signRadical.draw(PosLine.x,PosLine.y,PDSE.Graphics,PDSE);CMathBase.prototype.Draw_Elements.call(this,PDSE);PDSE.X=X+this.size.width};CRadical.prototype.getBase=function(){return this.Content[1]};CRadical.prototype.getDegree=function(){return this.Content[0]};CRadical.prototype.Apply_TextPr=function(TextPr,IncFontSize,ApplyToAll){this.Apply_TextPrToCtrPr(TextPr, IncFontSize,ApplyToAll);this.Iterator.Apply_TextPr(TextPr,IncFontSize,ApplyToAll);this.Base.Apply_TextPr(TextPr,IncFontSize,ApplyToAll)};CRadical.prototype.Apply_MenuProps=function(Props){if(Props.Type==Asc.c_oAscMathInterfaceType.Radical&&Props.HideDegree!==undefined)if(true==this.Iterator.IsPlaceholder()&&Props.HideDegree!==this.Pr.degHide){AscCommon.History.Add(new CChangesMathRadicalHideDegree(this,this.Pr.degHide,Props.HideDegree));this.raw_SetHideDegree(Props.HideDegree)}};CRadical.prototype.Get_InterfaceProps= function(){return new CMathMenuRadical(this)};CRadical.prototype.raw_SetHideDegree=function(Value){if(this.Pr.degHide!==Value){this.Pr.ChangeType();this.RecalcInfo.bProps=true;this.ApplyProperties();if(this.Pr.type===SQUARE_RADICAL&&this.CurPos==0){this.CurPos=1;this.Base.MoveCursorToStartPos()}}};CRadical.prototype.Can_ModifyArgSize=function(){return this.CurPos==0&&false===this.Is_SelectInside()};CRadical.prototype.Is_ContentUse=function(MathContent){if(MathContent===this.Content[1])return true; if(DEGREE_RADICAL===this.Pr.type&&MathContent===this.Content[0])return true;return false};function CMathMenuRadical(Radical){CMathMenuBase.call(this,Radical);if(undefined!==Radical){var HideDegree=undefined;if(Radical.Iterator.IsPlaceholder())HideDegree=Radical.Pr.degHide==true;this.Type=Asc.c_oAscMathInterfaceType.Radical;this.HideDegree=HideDegree}else{this.Type=Asc.c_oAscMathInterfaceType.Radical;this.HideDegree=undefined}}CMathMenuRadical.prototype=Object.create(CMathMenuBase.prototype);CMathMenuRadical.prototype.constructor= CMathMenuRadical;CMathMenuRadical.prototype.get_HideDegree=function(){return this.HideDegree};CMathMenuRadical.prototype.put_HideDegree=function(Hide){this.HideDegree=Hide};window["AscCommonWord"]=window["AscCommonWord"]||{};window["AscCommonWord"].CRadical=CRadical;window["CMathMenuRadical"]=CMathMenuRadical;CMathMenuRadical.prototype["get_HideDegree"]=CMathMenuRadical.prototype.get_HideDegree;CMathMenuRadical.prototype["put_HideDegree"]=CMathMenuRadical.prototype.put_HideDegree;"use strict";var g_oTextMeasurer= AscCommon.g_oTextMeasurer;var History=AscCommon.History;function CGlyphOperator(){this.loc=null;this.turn=null;this.size=new CMathSize;this.stretch=0;this.bStretch=true;this.penW=1}CGlyphOperator.prototype.init=function(props){this.loc=props.location;this.turn=props.turn;this.bStretch=props.bStretch==true||props.bStretch==false?props.bStretch:true};CGlyphOperator.prototype.fixSize=function(stretch){var sizeGlyph=this.calcSize(stretch);var width,height,ascent;var bHor=this.loc==LOCATION_TOP||this.loc== LOCATION_BOT;if(bHor){width=sizeGlyph.width;height=sizeGlyph.height;ascent=height/2;if(this.bStretch)this.stretch=stretch>width?stretch:width;else this.stretch=width}else{width=sizeGlyph.height;height=sizeGlyph.width;ascent=height/2;this.stretch=stretch>height?stretch:height}this.size.width=width;this.size.ascent=ascent;this.size.height=height};CGlyphOperator.prototype.getCoordinateGlyph=function(){var coord=this.calcCoord(this.stretch);var X=coord.XX,Y=coord.YY,W=this.size.width,H=this.size.height; var bHor=this.loc==LOCATION_TOP||this.loc==LOCATION_BOT;var glW=0,glH=0;if(bHor){glW=coord.W;glH=coord.H}else{glW=coord.H;glH=coord.W}var bLine=this.Parent.typeOper==DELIMITER_LINE||this.Parent.typeOper==DELIMITER_DOUBLE_LINE,bArrow=this.Parent.typeOper==ARROW_LEFT||this.Parent.typeOper==ARROW_RIGHT||this.Parent.typeOper==ARROW_LR,bDoubleArrow=this.Parent.typeOper==DOUBLE_LEFT_ARROW||this.Parent.typeOper==DOUBLE_RIGHT_ARROW||this.Parent.typeOper==DOUBLE_ARROW_LR;var a1,a2,b1,b2,c1,c2;if(bLine)if(this.loc== LOCATION_TOP){a1=1;b1=0;c1=0;a2=0;b2=1;c2=(H-glH)/2}else if(this.loc==LOCATION_BOT){a1=1;b1=0;c1=0;a2=0;b2=1;c2=(H-glH)/2}else if(this.loc==LOCATION_LEFT){a1=0;b1=1;c1=(W-glW)/2;a2=1;b2=0;c2=0}else if(this.loc==LOCATION_RIGHT){a1=0;b1=1;c1=(W-glW)/2;a2=1;b2=0;c2=0}else{if(this.loc==LOCATION_SEP){a1=0;b1=1;c1=(W-glW)/2;a2=1;b2=0;c2=0}}else if(this.loc==LOCATION_TOP){a1=1;b1=0;c1=0;a2=0;b2=1;c2=0}else if(this.loc==LOCATION_BOT){a1=1;b1=0;c1=0;a2=0;b2=1;c2=H-glH}else if(this.loc==LOCATION_LEFT){a1=0; b1=1;c1=0;a2=1;b2=0;c2=0}else if(this.loc==LOCATION_RIGHT){a1=0;b1=1;c1=W-glW;a2=1;b2=0;c2=0}else if(this.loc==LOCATION_SEP){a1=0;b1=1;c1=0;a2=1;b2=0;c2=0}if(this.turn==1){a1*=-1;b1*=-1;c1+=glW}else if(this.turn==2){a2*=-1;b2*=-1;c2+=glH}else if(this.turn==3){a1*=-1;b1*=-1;c1+=glW;a2*=-1;b2*=-1;c2+=glH}var gpX=0,gpY=0;if(this.loc==3)gpX=-this.penW*25.4/96;var XX=[],YY=[];for(var i=0;imaxBoxH?maxBoxH:heightBr}return{width:widthBr,height:heightBr}};COperatorBracket.prototype.calcCoord=function(stretch){var X=[],Y=[];X[0]=26467;Y[0]=18871;X[1]=25967;Y[1]=18871;X[2]=25384;Y[2]=16830;X[3]=24737;Y[3]=15476;X[4]=24091;Y[4]=14122;X[5]=23341;Y[5]=13309;X[6]=22591;Y[6]= 12497;X[7]=21778;Y[7]=12164;X[8]=20965;Y[8]=11831;X[9]=20089;Y[9]=11831;X[10]=19214;Y[10]=11831;X[11]=18317;Y[11]=12083;X[12]=17421;Y[12]=12336;X[13]=16441;Y[13]=12652;X[14]=15462;Y[14]=12969;X[15]=14357;Y[15]=13243;X[16]=13253;Y[16]=13518;X[17]=11961;Y[17]=13518;X[18]=9835;Y[18]=13518;X[19]=8292;Y[19]=12621;X[20]=6750;Y[20]=11724;X[21]=5750;Y[21]=10055;X[22]=4750;Y[22]=8386;X[23]=4270;Y[23]=5987;X[24]=3791;Y[24]=3589;X[25]=3791;Y[25]=626;X[26]=3791;Y[26]=0;X[27]=0;Y[27]=0;X[28]=0;Y[28]=1084;X[29]= 83;Y[29]=5963;X[30]=1021;Y[30]=9612;X[31]=1959;Y[31]=13261;X[32]=3543;Y[32]=15700;X[33]=5127;Y[33]=18139;X[34]=7232;Y[34]=19369;X[35]=9337;Y[35]=20599;X[36]=11796;Y[36]=20599;X[37]=13338;Y[37]=20599;X[38]=14588;Y[38]=20283;X[39]=15839;Y[39]=19968;X[40]=16860;Y[40]=19610;X[41]=17882;Y[41]=19252;X[42]=18736;Y[42]=18936;X[43]=19590;Y[43]=18621;X[44]=20340;Y[44]=18621;X[45]=21091;Y[45]=18621;X[46]=21820;Y[46]=18995;X[47]=22550;Y[47]=19370;X[48]=23133;Y[48]=20266;X[49]=23717;Y[49]=21162;X[50]=24092;Y[50]= 22703;X[51]=24467;Y[51]=24245;X[52]=24551;Y[52]=26578;X[53]=28133;Y[53]=26578;var textScale=this.getCtrPrp().FontSize/1E3;var alpha=textScale*25.4/96/64;var augm=stretch/((X[52]+(X[0]-X[1])/2+X[1]-X[52])*alpha*2);if(augm<1)augm=1;var YY=[],XX=[];var hh1=[],hh2=[];var c1=[],c2=[];var delta=augm<7?augm:7;if(augm<7){var RX=[],RX1,RX2;if(delta<5.1){hh1[0]=1.89;hh2[0]=2.58;hh1[1]=1.55;hh2[1]=1.72;hh1[2]=1.5;hh2[2]=1.64;hh1[3]=1.92;hh2[3]=1.97;hh1[4]=1;hh2[4]=1;hh1[5]=2.5;hh2[5]=2.5;hh1[6]=2.1;hh2[6]=2.1; hh1[7]=1;hh2[7]=1;RX1=.033*delta+.967;RX2=.033*delta+.967}else{hh1[0]=1.82;hh2[0]=2.09;hh1[1]=1.64;hh2[1]=1.65;hh1[2]=1.57;hh2[2]=1.92;hh1[3]=1.48;hh2[3]=2.16;hh1[4]=1;hh2[4]=1;hh1[5]=2.5;hh2[5]=2.5;hh1[6]=2.1;hh2[6]=2.1;hh1[7]=1;hh2[7]=1;RX1=.22*delta+.78;RX2=.17*delta+.83}for(var i=0;i<27;i++)RX[i]=RX1;for(var i=27;i<54;i++)RX[i]=RX2;RX[1]=(Y[52]*RX[52]-(Y[52]-Y[1]))/Y[1];RX[0]=RX[1]*Y[1]/Y[0];RX[27]=1;RX[26]=1;for(var i=0;i<8;i++)RX[26-i]=1+i*((RX2+RX1)/2-1)/7;for(var i=0;i<4;i++){c1[i]=X[30+2* i]-X[28+2*i];c2[i]=X[23-2*i]-X[25-2*i]}c1[5]=X[48]-X[44];c2[5]=X[5]-X[9];c1[6]=X[52]-X[48];c2[6]=X[1]-X[5];c1[7]=(X[0]-X[1])/2+X[1]-X[52];c2[7]=(X[0]-X[1])/2;c1[4]=X[44]-X[36];c2[4]=X[9]-X[17];var rest1=0,rest2=0;for(var i=0;i<8;i++){if(i==4)continue;hh1[i]=(hh1[i]-1)*(delta-1)+1;hh2[i]=(hh2[i]-1)*(delta-1)+1;rest1+=hh1[i]*c1[i];rest2+=hh2[i]*c2[i]}var H1=delta*(X[52]+c1[7]),H2=H1-(X[26]-X[27]);hh1[4]=(H1-rest1)/c1[4];hh2[4]=(H2-rest2)/c2[4];XX[27]=X[27];XX[26]=X[26];XX[28]=X[27];XX[25]=X[26];for(var i= 0;i<4;i++)for(var j=1;j<3;j++){var t=j+i*2;XX[28+t]=XX[27+t]+(X[28+t]-X[27+t])*hh1[i];XX[25-t]=XX[26-t]+(X[25-t]-X[26-t])*hh2[i]}for(var i=1;i<9;i++){XX[36+i]=XX[35+i]+(X[36+i]-X[35+i])*hh1[4];XX[17-i]=XX[18-i]+(X[17-i]-X[18-i])*hh2[4]}for(var i=0;i<4;i++){XX[45+i]=XX[44+i]+(X[45+i]-X[44+i])*hh1[5];XX[8-i]=XX[9-i]+(X[8-i]-X[9-i])*hh2[5]}for(var i=0;i<4;i++){XX[49+i]=XX[48+i]+(X[49+i]-X[48+i])*hh1[6];XX[4-i]=XX[5-i]+(X[4-i]-X[5-i])*hh2[6]}XX[53]=XX[52]+2*c1[7]*hh1[7];XX[0]=XX[1]+2*c2[7]*hh2[7]}else{hh1[0]= 1.75;hh2[0]=2.55;hh1[1]=1.62;hh2[1]=1.96;hh1[2]=1.97;hh2[2]=1.94;hh1[3]=1.53;hh2[3]=1;hh1[4]=2.04;hh2[4]=3.17;hh1[5]=2;hh2[5]=2.58;hh1[6]=2.3;hh2[6]=1.9;hh1[7]=2.3;hh2[7]=1.9;hh1[8]=1;hh2[8]=1;hh1[9]=2.5;hh2[9]=2.5;hh1[10]=2.1;hh2[10]=2.1;hh1[11]=1;hh2[11]=1;var rest1=0,rest2=0;for(var i=0;i<8;i++){c1[i]=X[30+i]-X[29+i];c2[i]=X[24-i]-X[25-i]}c1[9]=X[48]-X[44];c2[9]=X[5]-X[9];c1[10]=X[52]-X[48];c2[10]=X[1]-X[5];c1[11]=(X[0]-X[1])/2+X[1]-X[52];c2[11]=(X[0]-X[1])/2;c1[8]=X[44]-X[36];c2[8]=X[9]-X[17]; for(var i=0;i<12;i++){if(i==8)continue;hh1[i]=(hh1[i]-1)*(delta-1)+1;hh2[i]=(hh2[i]-1)*(delta-1)+1;rest1+=hh1[i]*c1[i];rest2+=hh2[i]*c2[i]}var H1=delta*(X[52]+c1[11]),H2=H1-(X[26]-X[27]);hh1[8]=(H1-rest1)/c1[8];hh2[8]=(H2-rest2)/c2[8];XX[27]=X[27];XX[26]=X[26];XX[28]=X[27];XX[25]=X[26];for(var i=0;i<9;i++){XX[28+i]=XX[27+i]+(X[28+i]-X[27+i])*hh1[i];XX[25-i]=XX[26-i]+(X[25-i]-X[26-i])*hh2[i]}for(var i=1;i<9;i++){XX[36+i]=XX[35+i]+(X[36+i]-X[35+i])*hh1[8];XX[17-i]=XX[18-i]+(X[17-i]-X[18-i])*hh2[8]}for(var i= 0;i<4;i++){XX[45+i]=XX[44+i]+(X[45+i]-X[44+i])*hh1[9];XX[8-i]=XX[9-i]+(X[8-i]-X[9-i])*hh2[9]}for(var i=0;i<4;i++){XX[49+i]=XX[48+i]+(X[49+i]-X[48+i])*hh1[10];XX[4-i]=XX[5-i]+(X[4-i]-X[5-i])*hh2[10]}XX[53]=XX[52]+2*c1[11]*hh1[11];XX[0]=XX[1]+2*c2[11]*hh2[11];var RX=[];for(var i=0;i<27;i++)RX[i]=.182*delta+.818;for(var i=27;i<54;i++)RX[i]=.145*delta+.855;RX[1]=(Y[52]*RX[52]-(Y[52]-Y[1]))/Y[1];RX[0]=RX[1]*Y[1]/Y[0];RX[27]=1;RX[26]=1;for(var i=0;i<7;i++)RX[28-i]=1+i*(.145*delta+.855-1)/8;var w=Y[33]* RX[33],w2=Y[9]*RX[9]+.15*(Y[9]*RX[9]-Y[19]*RX[19]);for(var i=0;i<11;i++){RX[34+i]=w/Y[34+i];RX[19-i]=w2/Y[19-i]}var _H1=augm*(X[52]+c1[11]),_H2=_H1-(X[26]-X[27]);var w3=_H1-(XX[52]+c1[11]),w4=_H2-(XX[1]-XX[26]+c2[11]);for(var i=0;i<10;i++){XX[53-i]=XX[53-i]+w3;XX[i]=XX[i]+w4}}for(var i=0;i<54;i++){if(this.Parent.type==OPER_GROUP_CHAR)YY[i]=(Y[53]-Y[i])*alpha;else YY[i]=(Y[53]*RX[53]-Y[i]*RX[i])*alpha;XX[i]=XX[i]*alpha}for(var i=0;i<50;i++)YY[54+i]=YY[51-i];for(var i=0;i<50;i++)XX[54+i]=XX[53]+XX[52]- XX[51-i];var W=XX[77],H=YY[26];return{XX:XX,YY:YY,W:W,H:H}};COperatorBracket.prototype.drawPath=function(pGraphics,XX,YY){pGraphics._m(XX[0],YY[0]);pGraphics._l(XX[1],YY[1]);pGraphics._c(XX[1],YY[1],XX[2],YY[2],XX[3],YY[3]);pGraphics._c(XX[3],YY[3],XX[4],YY[4],XX[5],YY[5]);pGraphics._c(XX[5],YY[5],XX[6],YY[6],XX[7],YY[7]);pGraphics._c(XX[7],YY[7],XX[8],YY[8],XX[9],YY[9]);pGraphics._c(XX[9],YY[9],XX[10],YY[10],XX[11],YY[11]);pGraphics._c(XX[11],YY[11],XX[12],YY[12],XX[13],YY[13]);pGraphics._c(XX[13], YY[13],XX[14],YY[14],XX[15],YY[15]);pGraphics._c(XX[15],YY[15],XX[16],YY[16],XX[17],YY[17]);pGraphics._c(XX[17],YY[17],XX[18],YY[18],XX[19],YY[19]);pGraphics._c(XX[19],YY[19],XX[20],YY[20],XX[21],YY[21]);pGraphics._c(XX[21],YY[21],XX[22],YY[22],XX[23],YY[23]);pGraphics._c(XX[23],YY[23],XX[24],YY[24],XX[25],YY[25]);pGraphics._l(XX[26],YY[26]);pGraphics._l(XX[27],YY[27]);pGraphics._l(XX[28],YY[28]);pGraphics._c(XX[28],YY[28],XX[29],YY[29],XX[30],YY[30]);pGraphics._c(XX[30],YY[30],XX[31],YY[31],XX[32], YY[32]);pGraphics._c(XX[32],YY[32],XX[33],YY[33],XX[34],YY[34]);pGraphics._c(XX[34],YY[34],XX[35],YY[35],XX[36],YY[36]);pGraphics._c(XX[36],YY[36],XX[37],YY[37],XX[38],YY[38]);pGraphics._c(XX[38],YY[38],XX[39],YY[39],XX[40],YY[40]);pGraphics._c(XX[40],YY[40],XX[41],YY[41],XX[42],YY[42]);pGraphics._c(XX[42],YY[42],XX[43],YY[43],XX[44],YY[44]);pGraphics._c(XX[44],YY[44],XX[45],YY[45],XX[46],YY[46]);pGraphics._c(XX[46],YY[46],XX[47],YY[47],XX[48],YY[48]);pGraphics._c(XX[48],YY[48],XX[49],YY[49],XX[50], YY[50]);pGraphics._c(XX[50],YY[50],XX[51],YY[51],XX[52],YY[52]);pGraphics._l(XX[53],YY[53]);pGraphics._c(XX[53],YY[53],XX[54],YY[54],XX[55],YY[55]);pGraphics._c(XX[55],YY[55],XX[56],YY[56],XX[57],YY[57]);pGraphics._c(XX[57],YY[57],XX[58],YY[58],XX[59],YY[59]);pGraphics._c(XX[59],YY[59],XX[60],YY[60],XX[61],YY[61]);pGraphics._c(XX[61],YY[61],XX[62],YY[62],XX[63],YY[63]);pGraphics._c(XX[63],YY[63],XX[64],YY[64],XX[65],YY[65]);pGraphics._c(XX[65],YY[65],XX[66],YY[66],XX[67],YY[67]);pGraphics._c(XX[67], YY[67],XX[68],YY[68],XX[69],YY[69]);pGraphics._c(XX[69],YY[69],XX[70],YY[70],XX[71],YY[71]);pGraphics._c(XX[71],YY[71],XX[72],YY[72],XX[73],YY[73]);pGraphics._c(XX[73],YY[73],XX[74],YY[74],XX[75],YY[75]);pGraphics._c(XX[75],YY[75],XX[76],YY[76],XX[77],YY[77]);pGraphics._l(XX[78],YY[78]);pGraphics._l(XX[79],YY[79]);pGraphics._l(XX[80],YY[80]);pGraphics._c(XX[80],YY[80],XX[81],YY[81],XX[82],YY[82]);pGraphics._c(XX[82],YY[82],XX[83],YY[83],XX[84],YY[84]);pGraphics._c(XX[84],YY[84],XX[85],YY[85],XX[86], YY[86]);pGraphics._c(XX[86],YY[86],XX[87],YY[87],XX[88],YY[88]);pGraphics._c(XX[88],YY[88],XX[89],YY[89],XX[90],YY[90]);pGraphics._c(XX[90],YY[90],XX[91],YY[91],XX[92],YY[92]);pGraphics._c(XX[92],YY[92],XX[93],YY[93],XX[94],YY[94]);pGraphics._c(XX[94],YY[94],XX[95],YY[95],XX[96],YY[96]);pGraphics._c(XX[96],YY[96],XX[97],YY[97],XX[98],YY[98]);pGraphics._c(XX[98],YY[98],XX[99],YY[99],XX[100],YY[100]);pGraphics._c(XX[100],YY[100],XX[101],YY[101],XX[102],YY[102]);pGraphics._c(XX[102],YY[102],XX[103], YY[103],XX[0],YY[0])};function COperatorParenthesis(){CGlyphOperator.call(this)}COperatorParenthesis.prototype=Object.create(CGlyphOperator.prototype);COperatorParenthesis.prototype.constructor=COperatorParenthesis;COperatorParenthesis.prototype.calcSize=function(stretch){var betta=this.getCtrPrp().FontSize/36;var heightBr,widthBr;var minBoxH=5.27099609375*betta;if(this.Parent.type==OPER_GROUP_CHAR){widthBr=6.99444444444*betta;heightBr=minBoxH}else{var maxBoxH=9.63041992187*betta;widthBr=11.99444444444* betta;var ry=stretch/widthBr,delta=maxBoxH-minBoxH;heightBr=delta/4.3*(ry-1)+minBoxH;heightBr=heightBr>maxBoxH?maxBoxH:heightBr}return{height:heightBr,width:widthBr}};COperatorParenthesis.prototype.calcCoord=function(stretch){var X=[],Y=[];X[0]=39887;Y[0]=18995;X[1]=25314;Y[1]=18995;X[2]=15863;Y[2]=14309;X[3]=6412;Y[3]=9623;X[4]=3206;Y[4]=0;X[5]=0;Y[5]=1E3;X[6]=3206;Y[6]=13217;X[7]=13802;Y[7]=19722;X[8]=24398;Y[8]=26227;X[9]=39470;Y[9]=26227;var textScale=this.getCtrPrp().FontSize/1E3;var alpha=textScale* 25.4/96/64;var aug=stretch/(X[9]*alpha)/2;var RX,RY;var MIN_AUG=this.Parent.type==OPER_GROUP_CHAR?.5:1;if(aug>6.53){RX=6.53;RY=2.05}else if(aug3.768)heightBr=5.3578125*betta;else heightBr=4.828645833333333*betta;return{width:widthBr,height:heightBr}};COperatorAngleBracket.prototype.calcCoord=function(stretch){var X=[],Y=[];X[0]=38990;Y[0]=7665;X[1]=1583;Y[1]=21036;X[2]=0;Y[2]=16621;X[3]=37449;Y[3]=0;X[4]=40531;Y[4]=0;X[5]=77938;Y[5]=16621;X[6]=76439;Y[6]=21036;X[7]=38990;Y[7]=7665;var textScale=this.getCtrPrp().FontSize/ 1E3;var alpha=textScale*25.4/96/64;var augm=stretch/(X[5]*alpha);if(augm<1)augm=1;else if(augm>4.7)augm=4.7;var c1=1,c2=1;var ww1=Y[0]-Y[3],ww2=Y[1]-Y[2],ww3=Y[1]-Y[0],ww4=Y[2]-Y[3];if(augm>3.768){var WW=(Y[1]-Y[3])*1.3;c1=(WW-ww1)/ww3;c2=(WW-ww2)/ww4}Y[1]=Y[6]=Y[0]+ww3*c1;Y[2]=Y[5]=Y[3]+ww4*c2;var k1=.01*augm;var hh1=(X[0]-X[3])*k1,hh2=X[1]-X[2],hh3=X[3]-X[2],hh4=X[0]-X[1],HH=augm*X[5]/2;var k2=(HH-hh1)/hh3,k3=(HH-hh2)/hh4;X[7]=X[0]=X[1]+k3*hh4;X[3]=X[2]+k2*hh3;for(var i=0;i<3;i++)X[4+i]=2*HH-X[3- i];var XX=[],YY=[];for(var i=0;iXX[9]){XX[0]=lng;XX[9]=lng;XX[10]=lng}var W=XX[9],H=YY[6];return{XX:XX,YY:YY,W:W,H:H}};CSingleArrow.prototype.drawPath=function(pGraphics,XX,YY){pGraphics._m(XX[0],YY[0]);pGraphics._l(XX[1], YY[1]);pGraphics._l(XX[2],YY[2]);pGraphics._l(XX[3],YY[3]);pGraphics._l(XX[4],YY[4]);pGraphics._l(XX[5],YY[5]);pGraphics._l(XX[6],YY[6]);pGraphics._l(XX[7],YY[7]);pGraphics._l(XX[8],YY[8]);pGraphics._l(XX[9],YY[9]);pGraphics._l(XX[10],YY[10])};function CLeftRightArrow(){CGlyphOperator.call(this)}CLeftRightArrow.prototype=Object.create(CGlyphOperator.prototype);CLeftRightArrow.prototype.constructor=CLeftRightArrow;CLeftRightArrow.prototype.calcSize=function(){var betta=this.getCtrPrp().FontSize/36; var height=5.946923828125*betta;var width=11.695410156249999*betta;return{width:width,height:height}};CLeftRightArrow.prototype.calcCoord=function(stretch){var X=[],Y=[];X[0]=16950;Y[0]=28912;X[1]=14738;Y[1]=30975;X[2]=0;Y[2]=16687;X[3]=0;Y[3]=14287;X[4]=14738;Y[4]=0;X[5]=16950;Y[5]=2062;X[6]=8363;Y[6]=12975;X[7]=53738;Y[7]=12975;X[8]=45150;Y[8]=2062;X[9]=47363;Y[9]=0;X[10]=62100;Y[10]=14287;X[11]=62100;Y[11]=16687;X[12]=47363;Y[12]=30975;X[13]=45150;Y[13]=28912;X[14]=53738;Y[14]=17962;X[15]=8363; Y[15]=17962;X[16]=16950;Y[16]=28912;var textScale=this.getCtrPrp().FontSize/1E3;var alpha=textScale*25.4/96/64;var XX=[],YY=[];for(var i=0;i0)for(var i=0;i<8;i++)XX[7+i]+=lng;var W=XX[10],H=YY[1];return{XX:XX,YY:YY,W:W,H:H}};CLeftRightArrow.prototype.drawPath=function(pGraphics,XX,YY){pGraphics._m(XX[0],YY[0]);pGraphics._l(XX[1],YY[1]);pGraphics._l(XX[2],YY[2]);pGraphics._l(XX[3],YY[3]);pGraphics._l(XX[4], YY[4]);pGraphics._l(XX[5],YY[5]);pGraphics._l(XX[6],YY[6]);pGraphics._l(XX[7],YY[7]);pGraphics._l(XX[8],YY[8]);pGraphics._l(XX[9],YY[9]);pGraphics._l(XX[10],YY[10]);pGraphics._l(XX[11],YY[11]);pGraphics._l(XX[12],YY[12]);pGraphics._l(XX[13],YY[13]);pGraphics._l(XX[14],YY[14]);pGraphics._l(XX[15],YY[15]);pGraphics._l(XX[16],YY[16])};function CDoubleArrow(){CGlyphOperator.call(this)}CDoubleArrow.prototype=Object.create(CGlyphOperator.prototype);CDoubleArrow.prototype.constructor=CDoubleArrow;CDoubleArrow.prototype.calcSize= function(){var betta=this.getCtrPrp().FontSize/36;var height=6.7027777777777775*betta;var width=10.994677734375*betta;return{width:width,height:height}};CDoubleArrow.prototype.calcCoord=function(stretch){var X=[],Y=[];X[0]=14738;Y[0]=29764;X[1]=20775;Y[1]=37002;X[2]=18338;Y[2]=39064;X[3]=0;Y[3]=20731;X[4]=0;Y[4]=18334;X[5]=18338;Y[5]=0;X[6]=20775;Y[6]=2063;X[7]=14775;Y[7]=9225;X[8]=57600;Y[8]=9225;X[9]=57600;Y[9]=14213;X[10]=10950;Y[10]=14213;X[11]=6638;Y[11]=19532;X[12]=10875;Y[12]=24777;X[13]=57600; Y[13]=24777;X[14]=57600;Y[14]=29764;X[15]=14738;Y[15]=29764;X[16]=58950;Y[16]=19495;X[17]=58950;Y[17]=19495;var textScale=this.getCtrPrp().FontSize/1E3;var alpha=textScale*25.4/96/64;var XX=[],YY=[];for(var i=0;iXX[16]){XX[8]=lng;XX[9]=lng;XX[13]=lng;XX[14]=lng;XX[16]=lng;XX[17]=lng}var W=XX[16],H=YY[2];return{XX:XX,YY:YY,W:W,H:H}};CDoubleArrow.prototype.drawPath=function(pGraphics,XX,YY){pGraphics._m(XX[0],YY[0]);pGraphics._l(XX[1], YY[1]);pGraphics._l(XX[2],YY[2]);pGraphics._l(XX[3],YY[3]);pGraphics._l(XX[4],YY[4]);pGraphics._l(XX[5],YY[5]);pGraphics._l(XX[6],YY[6]);pGraphics._l(XX[7],YY[7]);pGraphics._l(XX[8],YY[8]);pGraphics._l(XX[9],YY[9]);pGraphics._l(XX[10],YY[10]);pGraphics._l(XX[11],YY[11]);pGraphics._l(XX[12],YY[12]);pGraphics._l(XX[13],YY[13]);pGraphics._l(XX[14],YY[14]);pGraphics._l(XX[15],YY[15]);pGraphics.df();pGraphics._s();pGraphics._m(XX[16],YY[16]);pGraphics._l(XX[17],YY[17])};function CLR_DoubleArrow(){CGlyphOperator.call(this)} CLR_DoubleArrow.prototype=Object.create(CGlyphOperator.prototype);CLR_DoubleArrow.prototype.constructor=CLR_DoubleArrow;CLR_DoubleArrow.prototype.calcSize=function(){var betta=this.getCtrPrp().FontSize/36;var height=6.7027777777777775*betta;var width=13.146484375*betta;return{width:width,height:height}};CLR_DoubleArrow.prototype.calcCoord=function(stretch){var X=[],Y=[];X[0]=14775;Y[0]=9225;X[1]=56063;Y[1]=9225;X[2]=50100;Y[2]=2063;X[3]=52538;Y[3]=0;X[4]=70875;Y[4]=18334;X[5]=70875;Y[5]=20731;X[6]= 52538;Y[6]=39064;X[7]=50100;Y[7]=37002;X[8]=56138;Y[8]=29764;X[9]=14738;Y[9]=29764;X[10]=20775;Y[10]=37002;X[11]=18338;Y[11]=39064;X[12]=0;Y[12]=20731;X[13]=0;Y[13]=18334;X[14]=18338;Y[14]=0;X[15]=20775;Y[15]=2063;X[16]=14775;Y[16]=9225;X[17]=10950;Y[17]=14213;X[18]=6638;Y[18]=19532;X[19]=10875;Y[19]=24777;X[20]=59963;Y[20]=24777;X[21]=64238;Y[21]=19532;X[22]=59925;Y[22]=14213;X[23]=59925;Y[23]=14213;X[24]=10950;Y[24]=14213;var textScale=this.getCtrPrp().FontSize/1E3;var alpha=textScale*25.4/96/64; var XX=[],YY=[];for(var i=0;i1;if(this.bOneLine==false){var CurLine=PRS.Line-this.StartLine;var CurRange=0===CurLine?PRS.Range-this.StartRange:PRS.Range;var bContainCompareOper=PRS.bContainCompareOper;this.protected_AddRange(CurLine,CurRange);this.NumBreakContent=0;var Content=this.Content[0]; if(CurLine==0&&CurRange==0){PRS.bMath_OneLine=true;var WordLen=PRS.WordLen,SpaceLen=PRS.SpaceLen;Content.Recalculate_Reset(PRS.Range,PRS.Line,PRS);Content.Recalculate_Range(PRS,ParaPr,Depth+1);this.RecalculateGeneralSize(g_oTextMeasurer,Content.size.height,Content.size.ascent);this.BrGapLeft=this.GapLeft+this.begOper.size.width;this.BrGapRight=this.GapRight+this.endOper.size.width;PRS.WordLen=WordLen+this.BrGapLeft;PRS.SpaceLen=SpaceLen}PRS.bMath_OneLine=false;PRS.Update_CurPos(0,Depth);Content.Recalculate_Range(PRS, ParaPr,Depth+1);if(PRS.NewRange==false)PRS.WordLen+=this.BrGapRight;this.protected_FillRange(CurLine,CurRange,0,0);PRS.bMath_OneLine=false;PRS.bContainCompareOper=bContainCompareOper}else{PRS.bMath_OneLine=true;this.NumBreakContent=-1;CMathBase.prototype.Recalculate_Range.call(this,PRS,ParaPr,Depth);this.BrGapLeft=this.GapLeft+this.begOper.size.width;this.BrGapRight=this.GapRight+this.endOper.size.width}};CDelimiter.prototype.RecalculateMinMaxContentWidth=function(MinMax){this.BrGapLeft=this.GapLeft+ this.begOper.size.width;this.BrGapRight=this.GapRight+this.endOper.size.width;CMathBase.prototype.RecalculateMinMaxContentWidth.call(this,MinMax)};CDelimiter.prototype.Is_EmptyGaps=function(){var Height=g_oTextMeasurer.GetHeight();var result=this.GeneralMetrics.heightdescent+ShCenter?ascent-ShCenter:descent+ShCenter;var plH=this.ParaMath.GetPlh(oMeasure,mgCtrPrp);this.TextInContent=ascent<1.01*plH&&descent<.4*plH;var bCentered=this.Pr.shp==DELIMITER_SHAPE_CENTERED,b2Max=bCentered&&2*maxAD-height>.001;var heightStretch=b2Max&&!this.TextInContent?2*maxAD:height;this.begOper.fixSize(oMeasure,heightStretch);this.endOper.fixSize(oMeasure, heightStretch);this.sepOper.fixSize(oMeasure,heightStretch);var HeigthMaxOper=Math.max(this.begOper.size.height,this.endOper.size.height,this.sepOper.size.height);var AscentMaxOper=HeigthMaxOper/2+ShCenter;g_oTextMeasurer.SetFont(mgCtrPrp);var Height=g_oTextMeasurer.GetHeight();if(this.Pr.shp==DELIMITER_SHAPE_CENTERED){var deltaHeight=height-HeigthMaxOper;if(deltaHeight<0)deltaHeight=-deltaHeight;var bEqualOper=deltaHeight<.001,bLText=heightAscentMaxOper?ascent:AscentMaxOper;DimHeight=HeigthMaxOper}else{DimHeight=HeigthMaxOper/2+maxAD>height?HeigthMaxOper/2+maxAD:height;DimAscent=ascent>AscentMaxOper?ascent:AscentMaxOper}}else if(heightAscentMaxOper?ascent:AscentMaxOper;DimHeight=HeigthMaxOper}else{DimAscent=ascent;DimHeight=height}this.GeneralMetrics.ascent=DimAscent;this.GeneralMetrics.height=DimHeight};CDelimiter.prototype.recalculateSize= function(oMeasure){var widthG=0,ascentG=0,descentG=0;for(var j=0;jascentG?content.ascent:ascentG;descentG=content.height-content.ascent>descentG?content.height-content.ascent:descentG}this.RecalculateGeneralSize(oMeasure,ascentG+descentG,ascentG);var width=widthG+this.begOper.size.width+this.endOper.size.width+(this.Pr.column-1)*this.sepOper.size.width;width+=this.GapLeft+this.GapRight;this.size.ascent= this.GeneralMetrics.ascent;this.size.height=this.GeneralMetrics.height;this.size.width=width};CDelimiter.prototype.GetAscentOperator=function(operator){var GeneralAscent=this.GeneralMetrics.ascent,GeneralHeight=this.GeneralMetrics.height;var OperHeight=operator.size.height,OperAscent=operator.size.ascent;var Ascent;if(this.Pr.shp==DELIMITER_SHAPE_CENTERED)Ascent=OperAscent;else{var shCenter=OperAscent-OperHeight/2;var k=(GeneralAscent-shCenter)/GeneralHeight;Ascent=k*OperHeight+shCenter}return Ascent}; CDelimiter.prototype.setPosition=function(pos,PosInfo){this.UpdatePosBound(pos,PosInfo);var Line=PosInfo.CurLine,Range=PosInfo.CurRange;if(this.bOneLine==false){var PosOper=new CMathPosition;if(true===this.IsStartRange(Line,Range)){PosOper.x=pos.x;PosOper.y=pos.y-this.begOper.size.ascent;this.UpdatePosOperBeg(pos,Line)}this.Content[0].setPosition(pos,PosInfo);if(true===this.Content[0].Math_Is_End(Line,Range)){PosOper.x=pos.x;PosOper.y=pos.y-this.endOper.size.ascent;this.UpdatePosOperEnd(pos,Line)}}else{this.pos.x= pos.x;this.pos.y=pos.y-this.size.ascent;var CurrPos=new CMathPosition;CurrPos.x=pos.x;CurrPos.y=pos.y;this.UpdatePosOperBeg(CurrPos,Line);this.Content[0].setPosition(CurrPos,PosInfo);var PosSep=new CMathPosition;PosSep.x=CurrPos.x;PosSep.y=CurrPos.y-this.GetAscentOperator(this.sepOper);this.sepOper.setPosition(PosSep);for(var j=1;j1){History.Add(new CChangesMathDelimiterSetColumn(this,this.Pr.column,this.Pr.column-1));this.raw_SetColumn(this.Pr.column-1);this.protected_RemoveItems(this.CurPos,[this.Content[this.CurPos]],true)}if(Props.Action&c_oMathMenuAction.InsertDelimiterArgument)if(Props.Action&c_oMathMenuAction.InsertBefore){History.Add(new CChangesMathDelimiterSetColumn(this,this.Pr.column,this.Pr.column+1));this.raw_SetColumn(this.Pr.column+1);NewContent=new CMathContent; NewContent.Correct_Content(true);this.protected_AddToContent(this.CurPos,[NewContent],true)}else{History.Add(new CChangesMathDelimiterSetColumn(this,this.Pr.column,this.Pr.column+1));this.raw_SetColumn(this.Pr.column+1);NewContent=new CMathContent;NewContent.Correct_Content(true);this.protected_AddToContent(this.CurPos+1,[NewContent],true)}}};CDelimiter.prototype.Get_InterfaceProps=function(){return new CMathMenuDelimiter(this)};CDelimiter.prototype.raw_SetGrow=function(Value){this.Pr.grow=Value; this.RecalcInfo.bProps=true;this.ApplyProperties()};CDelimiter.prototype.raw_SetShape=function(Value){if(this.Pr.grow==true&&(Value==DELIMITER_SHAPE_MATCH||Value==DELIMITER_SHAPE_CENTERED)){this.Pr.shp=Value;this.RecalcInfo.bProps=true;this.ApplyProperties()}};CDelimiter.prototype.raw_SetColumn=function(Value){if(this.Pr.column==1&&Value>1||Value==1&&this.Pr.column>1){this.Pr.Set_Column(Value);this.sepOper=new COperator(OPER_SEPARATOR);this.RecalcInfo.bProps=true;this.ApplyProperties()}else this.Pr.Set_Column(Value)}; CDelimiter.prototype.raw_HideBegOperator=function(Value){this.Pr.begChr=Value;this.begOper=new COperator(OPER_DELIMITER);this.RecalcInfo.bProps=true;this.ApplyProperties()};CDelimiter.prototype.raw_HideEndOperator=function(Value){this.Pr.endChr=Value;this.endOper=new COperator(OPER_DELIMITER);this.RecalcInfo.bProps=true;this.ApplyProperties()};CDelimiter.prototype.Get_DeletedItemsThroughInterface=function(){var DeletedItems=null;if(this.Content.length>0){DeletedItems=this.Content[0].Content;for(var Pos= 1;Posthis.operator.size.width?Base.size.width:this.operator.size.width,height=Base.size.height+this.operator.size.height,ascent=this.getAscent(oMeasure);width+=this.GapLeft+this.GapRight;this.size.height=height;this.size.width=width;this.size.ascent=ascent};CCharacter.prototype.setPosition= function(pos,PosInfo){this.pos.x=pos.x;this.pos.y=pos.y-this.size.ascent;this.UpdatePosBound(pos,PosInfo);var width=this.size.width-this.GapLeft-this.GapRight;var alignOp=(width-this.operator.size.width)/2,alignCnt=(width-this.elements[0][0].size.width)/2;var PosOper=new CMathPosition,PosBase=new CMathPosition;var Base=this.elements[0][0];if(this.Pr.pos===LOCATION_TOP){PosOper.x=this.pos.x+this.GapLeft+alignOp;PosOper.y=this.pos.y;PosBase.x=this.pos.x+this.GapLeft+alignCnt;PosBase.y=this.pos.y+this.operator.size.height}else if(this.Pr.pos=== LOCATION_BOT){PosBase.x=this.pos.x+this.GapLeft+alignCnt;PosBase.y=this.pos.y;PosOper.x=this.pos.x+this.GapLeft+alignOp;PosOper.y=this.pos.y+Base.size.height}this.operator.setPosition(PosOper);if(Base.Type==para_Math_Content)PosBase.y+=Base.size.ascent;Base.setPosition(PosBase,PosInfo);pos.x+=this.size.width};CCharacter.prototype.Draw_Elements=function(PDSE){var X=PDSE.X;this.Content[0].Draw_Elements(PDSE);var ctrPrp=this.Get_TxtPrControlLetter();var Font={FontSize:ctrPrp.FontSize,FontFamily:{Name:ctrPrp.FontFamily.Name, Index:ctrPrp.FontFamily.Index},Italic:false,Bold:false};PDSE.Graphics.SetFont(Font);var PosLine=this.ParaMath.GetLinePosition(PDSE.Line,PDSE.Range);this.operator.draw(PosLine.x,PosLine.y,PDSE.Graphics,PDSE);PDSE.X=X+this.size.width};CCharacter.prototype.getBase=function(){return this.elements[0][0]};function CMathGroupChrPr(){this.chr=undefined;this.chrType=undefined;this.pos=LOCATION_BOT;this.vertJc=VJUST_TOP}CMathGroupChrPr.prototype.Set=function(Pr){this.chr=Pr.chr;this.chrType=Pr.chrType;this.pos= Pr.pos;this.vertJc=Pr.vertJc};CMathGroupChrPr.prototype.Set_FromObject=function(Obj){this.chr=Obj.chr;this.chrType=Obj.chrType;if(VJUST_TOP===Obj.vertJc||VJUST_BOT===Obj.vertJc)this.vertJc=Obj.vertJc;if(LOCATION_TOP===Obj.pos||LOCATION_BOT===Obj.pos)this.pos=Obj.pos};CMathGroupChrPr.prototype.Copy=function(){var NewPr=new CMathGroupChrPr;NewPr.chr=this.chr;NewPr.chrType=this.chrType;NewPr.vertJc=this.vertJc;NewPr.pos=this.pos;return NewPr};CMathGroupChrPr.prototype.Write_ToBinary=function(Writer){var StartPos= Writer.GetCurPosition();Writer.Skip(4);var Flags=0;if(undefined!==this.chr){Writer.WriteLong(this.chr);Flags|=1}if(undefined!==this.chrType){Writer.WriteLong(this.chrType);Flags|=2}var EndPos=Writer.GetCurPosition();Writer.Seek(StartPos);Writer.WriteLong(Flags);Writer.Seek(EndPos);Writer.WriteLong(this.vertJc);Writer.WriteLong(this.pos)};CMathGroupChrPr.prototype.Read_FromBinary=function(Reader){var Flags=Reader.GetLong();if(Flags&1)this.chr=Reader.GetLong();else this.chr=undefined;if(Flags&2)this.chrType= Reader.GetLong();else this.chrType=undefined;this.vertJc=Reader.GetLong();this.pos=Reader.GetLong()};function CGroupCharacter(props){CCharacter.call(this);this.Id=AscCommon.g_oIdCounter.Get_NewId();this.Pr=new CMathGroupChrPr;if(props!==null&&props!==undefined)this.init(props);AscCommon.g_oTableId.Add(this,this.Id)}CGroupCharacter.prototype=Object.create(CCharacter.prototype);CGroupCharacter.prototype.constructor=CGroupCharacter;CGroupCharacter.prototype.ClassType=AscDFH.historyitem_type_groupChr; CGroupCharacter.prototype.kind=MATH_GROUP_CHARACTER;CGroupCharacter.prototype.init=function(props){this.Fill_LogicalContent(1);this.setProperties(props);this.fillContent()};CGroupCharacter.prototype.ApplyProperties=function(RPI){if(this.RecalcInfo.bProps==true){var operDefaultPrp={type:BRACKET_CURLY_BOTTOM,loc:LOCATION_BOT};var operProps={type:this.Pr.chrType,chr:this.Pr.chr,loc:this.Pr.pos};this.setCharacter(operProps,operDefaultPrp);this.RecalcInfo.bProps=false;if(this.Pr.pos==this.Pr.vertJc){var Iterator; if(this.Pr.pos==LOCATION_TOP)Iterator=new CDenominator(this.getBase());else Iterator=new CNumerator(this.getBase());this.elements[0][0]=Iterator}else this.elements[0][0]=this.getBase()}};CGroupCharacter.prototype.PreRecalc=function(Parent,ParaMath,ArgSize,RPI,GapsInfo){this.ApplyProperties(RPI);this.operator.PreRecalc(this,ParaMath);var ArgSz=ArgSize.Copy();if(this.Pr.pos==this.Pr.vertJc)ArgSz.Decrease();CCharacter.prototype.PreRecalc.call(this,Parent,ParaMath,ArgSz,RPI,GapsInfo)};CGroupCharacter.prototype.getBase= function(){return this.Content[0]};CGroupCharacter.prototype.fillContent=function(){this.setDimension(1,1);this.elements[0][0]=this.getBase()};CGroupCharacter.prototype.getAscent=function(oMeasure){var ascent;var ctrPrp=this.Get_TxtPrControlLetter();var shCent=this.ParaMath.GetShiftCenter(oMeasure,ctrPrp);if(this.Pr.vertJc===VJUST_TOP&&this.Pr.pos===LOCATION_TOP)ascent=this.operator.size.ascent;else if(this.Pr.vertJc===VJUST_BOT&&this.Pr.pos===LOCATION_TOP)ascent=this.operator.size.height+this.elements[0][0].size.ascent; else if(this.Pr.vertJc===VJUST_TOP&&this.Pr.pos===LOCATION_BOT)ascent=this.elements[0][0].size.ascent;else if(this.Pr.vertJc===VJUST_BOT&&this.Pr.pos===LOCATION_BOT)ascent=this.elements[0][0].size.height+this.operator.size.height;return ascent};CGroupCharacter.prototype.Apply_MenuProps=function(Props){if(Props.Type==Asc.c_oAscMathInterfaceType.GroupChar)if(Props.Pos!==undefined&&true==this.Can_ChangePos()){var Pos=Props.Pos==Asc.c_oAscMathInterfaceGroupCharPos.Bottom?LOCATION_BOT:LOCATION_TOP;if(Pos!== this.Pr.pos)this.private_InversePr()}};CGroupCharacter.prototype.private_GetInversePr=function(Pr){var InversePr=new CMathGroupChrPr;if(Pr.pos==LOCATION_TOP){InversePr.pos=LOCATION_BOT;InversePr.vertJc=VJUST_TOP;if(Pr.chr==9180||Pr.chr==9181)InversePr.chr=9181;else if(Pr.chr==9182||Pr.chr==9183)InversePr.chr=9183;else InversePr.chr=Pr.chr}else{InversePr.pos=LOCATION_TOP;InversePr.vertJc=VJUST_BOT;if(Pr.chr==9180||Pr.chr==9181)InversePr.chr=9180;else if(Pr.chr==9182||Pr.chr==9183)InversePr.chr=9182; else InversePr.chr=Pr.chr}return InversePr};CGroupCharacter.prototype.private_InversePr=function(){var NewPr=this.private_GetInversePr(this.Pr);var OldPr=this.Pr.Copy();History.Add(new CChangesMathGroupCharPr(this,OldPr,NewPr));this.raw_SetPr(NewPr)};CGroupCharacter.prototype.raw_SetPr=function(Pr){this.Pr.Set(Pr);this.RecalcInfo.bProps=true;this.ApplyProperties()};CGroupCharacter.prototype.Get_InterfaceProps=function(){return new CMathMenuGroupCharacter(this)};CGroupCharacter.prototype.Can_ModifyArgSize= function(){return false===this.Is_SelectInside()};CGroupCharacter.prototype.Can_ChangePos=function(){return this.Pr.chr==9180||this.Pr.chr==9181||this.Pr.chr==9182||this.Pr.chr==9183};function CMathMenuGroupCharacter(GroupChr){CMathMenuBase.call(this,GroupChr);this.Type=Asc.c_oAscMathInterfaceType.GroupChar;if(undefined!==GroupChr){this.Pos=GroupChr.Pr.pos==LOCATION_BOT?Asc.c_oAscMathInterfaceGroupCharPos.Bottom:Asc.c_oAscMathInterfaceGroupCharPos.Top;this.bCanChangePos=GroupChr.Can_ChangePos()}else{this.Pos= undefined;this.bCanChangePos=undefined}}CMathMenuGroupCharacter.prototype=Object.create(CMathMenuBase.prototype);CMathMenuGroupCharacter.prototype.constructor=CMathMenuGroupCharacter;CMathMenuGroupCharacter.prototype.get_Pos=function(){return this.Pos};CMathMenuGroupCharacter.prototype.put_Pos=function(Pos){this.Pos=Pos};CMathMenuGroupCharacter.prototype.can_ChangePos=function(){return this.bCanChangePos};window["AscCommonWord"]=window["AscCommonWord"]||{};window["AscCommonWord"].CDelimiter=CDelimiter; window["AscCommonWord"].CGroupCharacter=CGroupCharacter;window["CMathMenuGroupCharacter"]=CMathMenuGroupCharacter;CMathMenuGroupCharacter.prototype["get_Pos"]=CMathMenuGroupCharacter.prototype.get_Pos;CMathMenuGroupCharacter.prototype["put_Pos"]=CMathMenuGroupCharacter.prototype.put_Pos;CMathMenuGroupCharacter.prototype["can_ChangePos"]=CMathMenuGroupCharacter.prototype.can_ChangePos;"use strict";var g_oTextMeasurer=AscCommon.g_oTextMeasurer;function CAccentCircumflex(){CGlyphOperator.call(this)} CAccentCircumflex.prototype=Object.create(CGlyphOperator.prototype);CAccentCircumflex.prototype.constructor=CAccentCircumflex;CAccentCircumflex.prototype.calcSize=function(stretch){var alpha=this.Parent.Get_TxtPrControlLetter().FontSize/36;var width=3.88*alpha;var height=3.175*alpha;var augm=.8*stretch/width;if(augm<1)augm=1;else if(augm>5)augm=5;width*=augm;return{width:width,height:height}};CAccentCircumflex.prototype.calcCoord=function(stretch){var fontSize=this.Parent.Get_TxtPrControlLetter().FontSize; var textScale=fontSize/1E3,alpha=textScale*25.4/96/64;var X=[],Y=[];X[0]=0;Y[0]=2373;X[1]=9331;Y[1]=15494;X[2]=14913;Y[2]=15494;X[3]=23869;Y[3]=2373;X[4]=20953;Y[4]=0;X[5]=12122;Y[5]=10118;X[6]=11664;Y[6]=10118;X[7]=2833;Y[7]=0;X[8]=0;Y[8]=2373;var XX=[],YY=[];var W=stretch/alpha;var a1=X[3]-X[0],b1=W,c1=X[2]-X[1],a2=X[4]-X[7],b2=W-2*X[7],c2=X[5]-X[6];var RX=[];for(var i=0;iwidth?stretch:width;return{width:width,height:height}};CAccentLine.prototype.draw=function(x, y,pGraphics){var fontSize=this.Parent.Get_TxtPrControlLetter().FontSize;var penW=fontSize*.0166;var x1=x+.26458,x2=x+this.stretch-.26458;pGraphics.drawHorLine(0,y,x1,x2,penW)};function CAccentDoubleLine(){CGlyphOperator.call(this)}CAccentDoubleLine.prototype=Object.create(CGlyphOperator.prototype);CAccentDoubleLine.prototype.constructor=CAccentDoubleLine;CAccentDoubleLine.prototype.calcSize=function(stretch){var alpha=this.Parent.Get_TxtPrControlLetter().FontSize/36;var height=2.843*alpha;var width= 4.938*alpha;width=stretch>width?stretch:width;var Line=new CMathText(true);Line.add(773);Line.Measure(g_oTextMeasurer);var DoubleLine=new CMathText(true);DoubleLine.add(831);DoubleLine.Measure(g_oTextMeasurer);return{width:width,height:height}};CAccentDoubleLine.prototype.draw=function(x,y,pGraphics){var fontSize=this.Parent.Get_TxtPrControlLetter().FontSize;var diff=fontSize*.05;var penW=fontSize*.0166;var x1=x+.26458,x2=x+this.stretch-.26458,y1=y,y2=y+diff;pGraphics.drawHorLine(0,y1,x1,x2,penW); pGraphics.drawHorLine(0,y2,x1,x2,penW)};function CAccentTilde(){CGlyphOperator.call(this)}CAccentTilde.prototype=Object.create(CGlyphOperator.prototype);CAccentTilde.prototype.constructor=CAccentTilde;CAccentTilde.prototype.calcSize=function(stretch){var betta=this.Parent.Get_TxtPrControlLetter().FontSize/36;var width=9.047509765625*betta;var height=2.469444444444444*betta;var augm=.9*stretch/width;if(augm<1)augm=1;else if(augm>2)augm=2;width*=augm;return{width:width,height:height}};CAccentTilde.prototype.calcCoord= function(stretch){var X=[],Y=[];X[0]=0;Y[0]=3066;X[1]=2125;Y[1]=7984;X[2]=5624;Y[2]=11256;X[3]=9123;Y[3]=14528;X[4]=13913;Y[4]=14528;X[5]=18912;Y[5]=14528;X[6]=25827;Y[6]=10144;X[7]=32742;Y[7]=5760;X[8]=36324;Y[8]=5760;X[9]=39865;Y[9]=5760;X[10]=42239;Y[10]=7641;X[11]=44614;Y[11]=9522;X[12]=47030;Y[12]=13492;X[13]=50362;Y[13]=11254;X[14]=48571;Y[14]=7544;X[15]=44697;Y[15]=3772;X[16]=40823;Y[16]=0;X[17]=35283;Y[17]=0;X[18]=29951;Y[18]=0;X[19]=23098;Y[19]=4384;X[20]=16246;Y[20]=8768;X[21]=12622;Y[21]= 8768;X[22]=9581;Y[22]=8768;X[23]=7290;Y[23]=6845;X[24]=4999;Y[24]=4922;X[25]=3249;Y[25]=1243;X[26]=0;Y[26]=3066;var XX=[],YY=[];var fontSize=this.Parent.Get_TxtPrControlLetter().FontSize;var textScale=fontSize/1E3,alpha=textScale*25.4/96/64;var Width=stretch/alpha;var augm=Width/X[13]*.5;for(var i=0;i=768&&this.Pr.chr<=789||this.Pr.chr== 8411){var ascent=this.elements[0][0].size.ascent;x+=ascent*.1}}this.operator.draw(x,y,pGraphics,PDSE)};CAccent.prototype.Draw_Elements=function(PDSE){var X=PDSE.X;var oBase=this.Content[0];oBase.Draw_Elements(PDSE);var PosLine=this.ParaMath.GetLinePosition(PDSE.Line,PDSE.Range);var x=PosLine.x,y=PosLine.y;if(oBase.Is_InclineLetter())if(this.Pr.chr!=773&&this.Pr.chr>=768&&this.Pr.chr<=789||this.Pr.chr==8411){var ascent=this.elements[0][0].size.ascent;x+=ascent*.1}this.operator.draw(x,y,PDSE.Graphics, PDSE);PDSE.X=X+this.size.width};CAccent.prototype.GetLastElement=function(){return this.Content[0].GetLastElement()};CAccent.prototype.Get_InterfaceProps=function(){return new CMathMenuAccent(this)};function CMathMenuAccent(Accent){CMathMenuBase.call(this,Accent);this.Type=Asc.c_oAscMathInterfaceType.Accent}CMathMenuAccent.prototype=Object.create(CMathMenuBase.prototype);CMathMenuAccent.prototype.constructor=CMathMenuAccent;window["AscCommonWord"]=window["AscCommonWord"]||{};window["AscCommonWord"].CAccent= CAccent;window["CMathMenuAccent"]=CMathMenuAccent;"use strict";var History=AscCommon.History;function CMathBreak(){this.alnAt=undefined}CMathBreak.prototype.Set_FromObject=function(Obj){if(Obj.alnAt!==undefined&&Obj.alnAt!==null&&Obj.alnAt-0==Obj.alnAt)if(Obj.alnAt>=1&&Obj.alnAt<=255)this.alnAt=Obj.alnAt};CMathBreak.prototype.Copy=function(){var NewMBreak=new CMathBreak;NewMBreak.alnAt=this.alnAt;return NewMBreak};CMathBreak.prototype.Get_AlignBrk=function(){return this.alnAt!==undefined?this.alnAt: 0};CMathBreak.prototype.Get_AlnAt=function(){return this.alnAt};CMathBreak.prototype.Displace=function(isForward){if(isForward==false)if(this.alnAt==1)this.alnAt=undefined;else{if(this.alnAt!==undefined)this.alnAt--}else if(this.alnAt==undefined)this.alnAt=1;else if(this.alnAt<255)this.alnAt++};CMathBreak.prototype.Apply_AlnAt=function(alnAt){if(alnAt==undefined)this.alnAt=undefined;else if(alnAt>=1&&alnAt<=255)this.alnAt=alnAt};CMathBreak.prototype.Write_ToBinary=function(Writer){if(this.alnAt!== undefined){Writer.WriteBool(false);Writer.WriteByte(this.alnAt)}else Writer.WriteBool(true)};CMathBreak.prototype.Read_FromBinary=function(Reader){if(Reader.GetBool()==false)this.alnAt=Reader.GetByte();else this.alnAt=undefined};function CMathBorderBoxPr(){this.hideBot=false;this.hideLeft=false;this.hideRight=false;this.hideTop=false;this.strikeBLTR=false;this.strikeH=false;this.strikeTLBR=false;this.strikeV=false}CMathBorderBoxPr.prototype.Set_FromObject=function(Obj){if(undefined!==Obj.hideBot&& null!==Obj.hideBot)this.hideBot=Obj.hideBot;if(undefined!==Obj.hideLeft&&null!==Obj.hideLeft)this.hideLeft=Obj.hideLeft;if(undefined!==Obj.hideRight&&null!==Obj.hideRight)this.hideRight=Obj.hideRight;if(undefined!==Obj.hideTop&&null!==Obj.hideTop)this.hideTop=Obj.hideTop;if(undefined!==Obj.strikeBLTR&&null!==Obj.strikeBLTR)this.strikeBLTR=Obj.strikeBLTR;if(undefined!==Obj.strikeH&&null!==Obj.strikeH)this.strikeH=Obj.strikeH;if(undefined!==Obj.strikeTLBR&&null!==Obj.strikeTLBR)this.strikeTLBR=Obj.strikeTLBR; if(undefined!==Obj.strikeV&&null!==Obj.strikeV)this.strikeV=Obj.strikeV};CMathBorderBoxPr.prototype.Copy=function(){var NewPr=new CMathBorderBoxPr;NewPr.hideLeft=this.hideLeft;NewPr.hideRight=this.hideRight;NewPr.hideTop=this.hideTop;NewPr.strikeBLTR=this.strikeBLTR;NewPr.strikeH=this.strikeH;NewPr.strikeTLBR=this.strikeTLBR;NewPr.strikeV=this.strikeV;return NewPr};CMathBorderBoxPr.prototype.Write_ToBinary=function(Writer){Writer.WriteBool(this.hideBot);Writer.WriteBool(this.hideLeft);Writer.WriteBool(this.hideRight); Writer.WriteBool(this.hideTop);Writer.WriteBool(this.strikeBLTR);Writer.WriteBool(this.strikeH);Writer.WriteBool(this.strikeTLBR);Writer.WriteBool(this.strikeV)};CMathBorderBoxPr.prototype.Read_FromBinary=function(Reader){this.hideBot=Reader.GetBool();this.hideLeft=Reader.GetBool();this.hideRight=Reader.GetBool();this.hideTop=Reader.GetBool();this.strikeBLTR=Reader.GetBool();this.strikeH=Reader.GetBool();this.strikeTLBR=Reader.GetBool();this.strikeV=Reader.GetBool()};function CBorderBox(props){CMathBase.call(this); this.Id=AscCommon.g_oIdCounter.Get_NewId();this.gapBrd=0;this.Pr=new CMathBorderBoxPr;if(props!==null&&typeof props!=="undefined")this.init(props);AscCommon.g_oTableId.Add(this,this.Id)}CBorderBox.prototype=Object.create(CMathBase.prototype);CBorderBox.prototype.constructor=CBorderBox;CBorderBox.prototype.ClassType=AscDFH.historyitem_type_borderBox;CBorderBox.prototype.kind=MATH_BORDER_BOX;CBorderBox.prototype.init=function(props){this.Fill_LogicalContent(1);this.setProperties(props);this.fillContent()}; CBorderBox.prototype.getBase=function(){return this.Content[0]};CBorderBox.prototype.fillContent=function(){this.setDimension(1,1);this.elements[0][0]=this.getBase()};CBorderBox.prototype.recalculateSize=function(){var base=this.elements[0][0].size;var width=base.width;var height=base.height;var ascent=base.ascent;this.gapBrd=this.Get_TxtPrControlLetter().FontSize*.08104587131076388;if(this.Pr.hideTop==false){height+=this.gapBrd;ascent+=this.gapBrd}if(this.Pr.hideBot==false)height+=this.gapBrd;if(this.Pr.hideLeft== false)width+=this.gapBrd;if(this.Pr.hideRight==false)width+=this.gapBrd;width+=this.GapLeft+this.GapRight;this.size.width=width;this.size.height=height;this.size.ascent=ascent};CBorderBox.prototype.Draw_Elements=function(PDSE){var _X=PDSE.X;this.Content[0].Draw_Elements(PDSE);var penW=this.Get_TxtPrControlLetter().FontSize*.02;var Width=this.size.width-this.GapLeft-this.GapRight,Height=this.size.height;var PosLine=this.ParaMath.GetLinePosition(PDSE.Line,PDSE.Range);var X=this.pos.x+PosLine.x+this.GapLeft, Y=this.pos.y+PosLine.y;var oCompiledPr=this.Get_CompiledCtrPrp();this.Make_ShdColor(PDSE,oCompiledPr);if(!this.Pr.hideTop){var x1=X,x2=X+Width,y1=Y;PDSE.Graphics.drawHorLine(0,y1,x1,x2,penW,true)}if(!this.Pr.hideBot){var x1=X,x2=X+Width,y1=Y+Height;PDSE.Graphics.drawHorLine(2,y1,x1,x2,penW,true)}if(!this.Pr.hideLeft){var x1=X,y1=Y,y2=Y+Height;PDSE.Graphics.drawVerLine(0,x1,y1,y2,penW,true)}if(!this.Pr.hideRight){var x1=X+Width,y1=Y,y2=Y+Height;PDSE.Graphics.drawVerLine(2,x1,y1,y2,penW,true)}if(this.Pr.strikeTLBR)if(penW< .3){var x1=X,y1=Y,x2=X+Width,y2=Y+Height;PDSE.Graphics.p_width(180);PDSE.Graphics._s();PDSE.Graphics._m(x1,y1);PDSE.Graphics._l(x2,y2);PDSE.Graphics.ds()}else{var pW=penW*.8;var x1=X,y1=Y,x2=X+pW,y2=Y,x3=X+Width,y3=Y+Height-pW,x4=X+Width,y4=Y+Height,x5=X+Width-pW,y5=Y+Height,x6=X,y6=Y+pW,x7=X,y7=Y;PDSE.Graphics.p_width(1E3);PDSE.Graphics._s();PDSE.Graphics._m(x1,y1);PDSE.Graphics._l(x2,y2);PDSE.Graphics._l(x3,y3);PDSE.Graphics._l(x4,y4);PDSE.Graphics._l(x5,y5);PDSE.Graphics._l(x6,y6);PDSE.Graphics._l(x7, y7);PDSE.Graphics.df()}if(this.Pr.strikeBLTR)if(penW<.3){var x1=X+Width,y1=Y,x2=X,y2=Y+Height;PDSE.Graphics.p_width(180);PDSE.Graphics._s();PDSE.Graphics._m(x1,y1);PDSE.Graphics._l(x2,y2);PDSE.Graphics.ds()}else{var pW=.8*penW;var x1=X+Width,y1=Y,x2=X+Width-pW,y2=Y,x3=X,y3=Y+Height-pW,x4=X,y4=Y+Height,x5=X+pW,y5=Y+Height,x6=X+Width,y6=Y+pW,x7=X+Width,y7=Y;PDSE.Graphics.p_width(1E3);PDSE.Graphics._s();PDSE.Graphics._m(x1,y1);PDSE.Graphics._l(x2,y2);PDSE.Graphics._l(x3,y3);PDSE.Graphics._l(x4,y4);PDSE.Graphics._l(x5, y5);PDSE.Graphics._l(x6,y6);PDSE.Graphics._l(x7,y7);PDSE.Graphics.df()}if(this.Pr.strikeH){var x1=X,x2=X+Width,y1=Y+Height/2-penW/2;PDSE.Graphics.drawHorLine(0,y1,x1,x2,penW)}if(this.Pr.strikeV){var x1=X+Width/2-penW/2,y1=Y,y2=Y+Height;PDSE.Graphics.drawVerLine(0,x1,y1,y2,penW,true)}PDSE.X=_X+this.size.width};CBorderBox.prototype.setPosition=function(pos,PosInfo){this.pos.x=pos.x;this.pos.y=pos.y-this.size.ascent;this.UpdatePosBound(pos,PosInfo);var NewPos=new CMathPosition;var Base=this.Content[0]; if(this.Pr.hideLeft==false)NewPos.x=this.pos.x+this.GapLeft+this.gapBrd;else NewPos.x=this.pos.x+this.GapLeft;if(this.Pr.hideTop==false)NewPos.y=this.pos.y+this.gapBrd+Base.size.ascent;else NewPos.y=this.pos.y+Base.size.ascent;Base.setPosition(NewPos,PosInfo);pos.x+=this.size.width};CBorderBox.prototype.Apply_MenuProps=function(Props){if(Props.Type==Asc.c_oAscMathInterfaceType.BorderBox){if(Props.HideTop!==undefined&&Props.HideTop!==this.Pr.hideTop){History.Add(new CChangesMathBorderBoxTop(this,this.Pr.hideTop, Props.HideTop));this.raw_SetTop(Props.HideTop)}if(Props.HideBottom!==undefined&&Props.HideBottom!==this.Pr.hideBot){History.Add(new CChangesMathBorderBoxBot(this,this.Pr.hideBot,Props.HideBottom));this.raw_SetBot(Props.HideBottom)}if(Props.HideLeft!==undefined&&Props.HideLeft!==this.Pr.hideLeft){History.Add(new CChangesMathBorderBoxLeft(this,this.Pr.hideLeft,Props.HideLeft));this.raw_SetLeft(Props.HideLeft)}if(Props.HideRight!==undefined&&Props.HideRight!==this.Pr.hideRight){History.Add(new CChangesMathBorderBoxRight(this, this.Pr.hideRight,Props.HideRight));this.raw_SetRight(Props.HideRight)}if(Props.HideHor!==undefined&&Props.HideHor==this.Pr.strikeH){History.Add(new CChangesMathBorderBoxHor(this,this.Pr.strikeH,!Props.HideHor));this.raw_SetHor(!Props.HideHor)}if(Props.HideVer!==undefined&&Props.HideVer==this.Pr.strikeV){History.Add(new CChangesMathBorderBoxVer(this,this.Pr.strikeV,!Props.HideVer));this.raw_SetVer(!Props.HideVer)}if(Props.HideTopLTR!==undefined&&Props.HideTopLTR==this.Pr.strikeTLBR){History.Add(new CChangesMathBorderBoxTopLTR(this, this.Pr.strikeTLBR,!Props.HideTopLTR));this.raw_SetTopLTR(!Props.HideTopLTR)}if(Props.HideTopRTL!==undefined&&Props.HideTopRTL==this.Pr.strikeBLTR){History.Add(new CChangesMathBorderBoxTopRTL(this,this.Pr.strikeBLTR,!Props.HideTopRTL));this.raw_SetTopRTL(!Props.HideTopRTL)}}};CBorderBox.prototype.raw_SetTop=function(Value){this.Pr.hideTop=Value};CBorderBox.prototype.raw_SetBot=function(Value){this.Pr.hideBot=Value};CBorderBox.prototype.raw_SetLeft=function(Value){this.Pr.hideLeft=Value};CBorderBox.prototype.raw_SetRight= function(Value){this.Pr.hideRight=Value};CBorderBox.prototype.raw_SetHor=function(Value){this.Pr.strikeH=Value};CBorderBox.prototype.raw_SetVer=function(Value){this.Pr.strikeV=Value};CBorderBox.prototype.raw_SetTopLTR=function(Value){this.Pr.strikeTLBR=Value};CBorderBox.prototype.raw_SetTopRTL=function(Value){this.Pr.strikeBLTR=Value};CBorderBox.prototype.Get_InterfaceProps=function(){return new CMathMenuBorderBox(this)};function CMathMenuBorderBox(BorderBox){CMathMenuBase.call(this,BorderBox);this.Type= Asc.c_oAscMathInterfaceType.BorderBox;if(undefined!==BorderBox){this.HideTop=BorderBox.Pr.hideTop;this.HideBottom=BorderBox.Pr.hideBot;this.HideLeft=BorderBox.Pr.hideLeft;this.HideRight=BorderBox.Pr.hideRight;this.HideHor=BorderBox.Pr.strikeH==false;this.HideVer=BorderBox.Pr.strikeV==false;this.HideTopLTR=BorderBox.Pr.strikeTLBR==false;this.HideTopRTL=BorderBox.Pr.strikeBLTR==false}else{this.HideTop=undefined;this.HideBottom=undefined;this.HideLeft=undefined;this.HideRight=undefined;this.HideHor= undefined;this.HideVer=undefined;this.HideTopLTR=undefined;this.HideTopRTL=undefined}}CMathMenuBorderBox.prototype=Object.create(CMathMenuBase.prototype);CMathMenuBorderBox.prototype.constructor=CMathMenuBorderBox;CMathMenuBorderBox.prototype.get_HideTop=function(){return this.HideTop};CMathMenuBorderBox.prototype.put_HideTop=function(bHideTop){this.HideTop=bHideTop};CMathMenuBorderBox.prototype.get_HideBottom=function(){return this.HideBottom};CMathMenuBorderBox.prototype.put_HideBottom=function(bHideBottom){this.HideBottom= bHideBottom};CMathMenuBorderBox.prototype.get_HideLeft=function(){return this.HideLeft};CMathMenuBorderBox.prototype.put_HideLeft=function(bHideLeft){this.HideLeft=bHideLeft};CMathMenuBorderBox.prototype.get_HideRight=function(){return this.HideRight};CMathMenuBorderBox.prototype.put_HideRight=function(bHideRight){this.HideRight=bHideRight};CMathMenuBorderBox.prototype.get_HideHor=function(){return this.HideHor};CMathMenuBorderBox.prototype.put_HideHor=function(bHideHor){this.HideHor=bHideHor};CMathMenuBorderBox.prototype.get_HideVer= function(){return this.HideVer};CMathMenuBorderBox.prototype.put_HideVer=function(bHideVer){this.HideVer=bHideVer};CMathMenuBorderBox.prototype.get_HideTopLTR=function(){return this.HideTopLTR};CMathMenuBorderBox.prototype.put_HideTopLTR=function(bHideTopLTR){this.HideTopLTR=bHideTopLTR};CMathMenuBorderBox.prototype.get_HideTopRTL=function(){return this.HideTopRTL};CMathMenuBorderBox.prototype.put_HideTopRTL=function(bHideTopRTL){this.HideTopRTL=bHideTopRTL};window["CMathMenuBorderBox"]=CMathMenuBorderBox; CMathMenuBorderBox.prototype["get_HideTop"]=CMathMenuBorderBox.prototype.get_HideTop;CMathMenuBorderBox.prototype["put_HideTop"]=CMathMenuBorderBox.prototype.put_HideTop;CMathMenuBorderBox.prototype["get_HideBottom"]=CMathMenuBorderBox.prototype.get_HideBottom;CMathMenuBorderBox.prototype["put_HideBottom"]=CMathMenuBorderBox.prototype.put_HideBottom;CMathMenuBorderBox.prototype["get_HideLeft"]=CMathMenuBorderBox.prototype.get_HideLeft;CMathMenuBorderBox.prototype["put_HideLeft"]=CMathMenuBorderBox.prototype.put_HideLeft; CMathMenuBorderBox.prototype["get_HideRight"]=CMathMenuBorderBox.prototype.get_HideRight;CMathMenuBorderBox.prototype["put_HideRight"]=CMathMenuBorderBox.prototype.put_HideRight;CMathMenuBorderBox.prototype["get_HideHor"]=CMathMenuBorderBox.prototype.get_HideHor;CMathMenuBorderBox.prototype["put_HideHor"]=CMathMenuBorderBox.prototype.put_HideHor;CMathMenuBorderBox.prototype["get_HideVer"]=CMathMenuBorderBox.prototype.get_HideVer;CMathMenuBorderBox.prototype["put_HideVer"]=CMathMenuBorderBox.prototype.put_HideVer; CMathMenuBorderBox.prototype["get_HideTopLTR"]=CMathMenuBorderBox.prototype.get_HideTopLTR;CMathMenuBorderBox.prototype["put_HideTopLTR"]=CMathMenuBorderBox.prototype.put_HideTopLTR;CMathMenuBorderBox.prototype["get_HideTopRTL"]=CMathMenuBorderBox.prototype.get_HideTopRTL;CMathMenuBorderBox.prototype["put_HideTopRTL"]=CMathMenuBorderBox.prototype.put_HideTopRTL;function CMathBoxPr(){this.brk=undefined;this.aln=false;this.diff=false;this.noBreak=false;this.opEmu=false}CMathBoxPr.prototype.Set_FromObject= function(Obj){if(true===Obj.aln||1===Obj.aln)this.aln=true;else this.aln=false;if(Obj.brk!==null&&Obj.brk!==undefined){this.brk=new CMathBreak;this.brk.Set_FromObject(Obj.brk)}if(true===Obj.diff||1===Obj.diff)this.diff=true;else this.diff=false;if(true===Obj.noBreak||1===Obj.noBreak)this.noBreak=true;else this.noBreak=false;if(true===Obj.opEmu||1===Obj.opEmu||Obj.opEmu===null)this.opEmu=true;else this.opEmu=false};CMathBoxPr.prototype.Get_AlnAt=function(){return this.brk!=undefined?this.brk.Get_AlnAt(): undefined};CMathBoxPr.prototype.Get_AlignBrk=function(){return this.brk==undefined?null:this.brk.Get_AlignBrk()};CMathBoxPr.prototype.Displace_Break=function(isForward){if(this.brk!==undefined)this.brk.Displace(isForward)};CMathBoxPr.prototype.Apply_AlnAt=function(alnAt){if(this.brk!==undefined)this.brk.Apply_AlnAt(alnAt)};CMathBoxPr.prototype.IsForcedBreak=function(){return this.opEmu==true&&this.brk!==undefined};CMathBoxPr.prototype.Insert_ForcedBreak=function(){if(false==this.IsForcedBreak())this.brk= new CMathBreak};CMathBoxPr.prototype.Delete_ForcedBreak=function(){if(true==this.IsForcedBreak())this.brk=undefined};CMathBoxPr.prototype.Copy=function(){var NewPr=new CMathBoxPr;NewPr.aln=this.aln;NewPr.diff=this.diff;NewPr.noBreak=this.noBreak;NewPr.opEmu=this.opEmu;if(this.brk!==undefined)NewPr.brk=this.brk.Copy();return NewPr};CMathBoxPr.prototype.Write_ToBinary=function(Writer){Writer.WriteBool(this.aln);Writer.WriteBool(this.diff);Writer.WriteBool(this.noBreak);Writer.WriteBool(this.opEmu); if(undefined!==this.brk){Writer.WriteBool(false);this.brk.Write_ToBinary(Writer)}else Writer.WriteBool(true)};CMathBoxPr.prototype.Read_FromBinary=function(Reader){this.aln=Reader.GetBool();this.diff=Reader.GetBool();this.noBreak=Reader.GetBool();this.opEmu=Reader.GetBool();if(Reader.GetBool()==false){this.brk=new CMathBreak;this.brk.Read_FromBinary(Reader)}else this.brk=undefined};function CBox(props){CMathBase.call(this);this.Id=AscCommon.g_oIdCounter.Get_NewId();this.Pr=new CMathBoxPr;this.baseContent= new CMathContent;if(props!==null&&typeof props!=="undefined")this.init(props);AscCommon.g_oTableId.Add(this,this.Id)}CBox.prototype=Object.create(CMathBase.prototype);CBox.prototype.constructor=CBox;CBox.prototype.ClassType=AscDFH.historyitem_type_box;CBox.prototype.kind=MATH_BOX;CBox.prototype.init=function(props){this.Fill_LogicalContent(1);this.setProperties(props);this.fillContent()};CBox.prototype.fillContent=function(){if(this.Pr.opEmu==false&&this.Pr.noBreak==false)this.NeedBreakContent(0); else this.bCanBreak=false;this.setDimension(1,1);this.elements[0][0]=this.getBase()};CBox.prototype.getBase=function(){return this.Content[0]};CBox.prototype.UpdatePRS_OneLine=function(PRS,WordLen,MathFirstItem){PRS.WordLen=WordLen;PRS.MathFirstItem=MathFirstItem};CBox.prototype.IsOperatorEmulator=function(){return this.Pr.opEmu==true};CBox.prototype.private_CanUseForcedBreak=function(){var bInline=this.ParaMath.Is_Inline();return bInline==false&&true==this.IsOperatorEmulator()};CBox.prototype.IsForcedBreak= function(){return true==this.private_CanUseForcedBreak()&&true==this.Pr.IsForcedBreak()};CBox.prototype.Get_AlignBrk=function(){return false==this.private_CanUseForcedBreak()?null:this.Pr.Get_AlignBrk()};CBox.prototype.Displace_BreakOperator=function(isForward,bBrkBefore,CountOperators){if(this.Pr.brk!==undefined){var AlnAt=this.Pr.Get_AlnAt();var NotIncrease=AlnAt==CountOperators&&isForward==true;if(NotIncrease==false){this.Pr.Displace_Break(isForward);var NewAlnAt=this.Pr.Get_AlnAt();if(AlnAt!== NewAlnAt)History.Add(new CChangesMathBoxAlnAt(this,AlnAt,NewAlnAt))}}};CBox.prototype.raw_setAlnAt=function(Value){this.Pr.Apply_AlnAt(Value)};CBox.prototype.Can_ModifyArgSize=function(){return false===this.Is_SelectInside()};CBox.prototype.Apply_MenuProps=function(Props){if(Props.Action&c_oMathMenuAction.InsertForcedBreak&&true==this.Can_InsertForcedBreak()){History.Add(new CChangesMathBoxForcedBreak(this,false,true));this.raw_ForcedBreak(true)}if(Props.Action&c_oMathMenuAction.DeleteForcedBreak&& true==this.Can_DeleteForcedBreak()){History.Add(new CChangesMathBoxForcedBreak(this,true,false));this.raw_ForcedBreak(false)}};CBox.prototype.Get_InterfaceProps=function(){return new CMathMenuBox(this)};CBox.prototype.Can_InsertForcedBreak=function(){var bCanModifyForcedBreak=this.private_CanUseForcedBreak();return bCanModifyForcedBreak==true&&false===this.IsForcedBreak()};CBox.prototype.Can_DeleteForcedBreak=function(){var bCanModifyForcedBreak=this.private_CanUseForcedBreak();return bCanModifyForcedBreak== true&&true==this.IsForcedBreak()};CBox.prototype.raw_ForcedBreak=function(InsertBreak,AlnAt){if(InsertBreak){this.Pr.Insert_ForcedBreak();this.Pr.Apply_AlnAt(AlnAt)}else this.Pr.Delete_ForcedBreak()};CBox.prototype.Can_ModifyForcedBreak=function(Pr){if(true==this.Can_InsertForcedBreak())Pr.Set_InsertForcedBreak();else if(true==this.Can_DeleteForcedBreak())Pr.Set_DeleteForcedBreak()};CBox.prototype.Apply_ForcedBreak=function(Props){this.Apply_MenuProps(Props);if(Props.Action&c_oMathMenuAction.InsertForcedBreak)Props.Action^= c_oMathMenuAction.InsertForcedBreak;if(Props.Action&c_oMathMenuAction.DeleteForcedBreak)Props.Action^=c_oMathMenuAction.DeleteForcedBreak};function CMathMenuBox(Box){CMathMenuBase.call(this,Box);this.Type=Asc.c_oAscMathInterfaceType.Box}CMathMenuBox.prototype=Object.create(CMathMenuBase.prototype);CMathMenuBox.prototype.constructor=CMathMenuBox;window["CMathMenuBox"]=CMathMenuBox;function CMathBarPr(){this.pos=LOCATION_BOT}CMathBarPr.prototype.Set_FromObject=function(Obj){if(LOCATION_TOP===Obj.pos|| LOCATION_BOT===Obj.pos)this.pos=Obj.pos};CMathBarPr.prototype.Copy=function(){var NewPr=new CMathBarPr;NewPr.pos=this.pos;return NewPr};CMathBarPr.prototype.Write_ToBinary=function(Writer){Writer.WriteLong(this.pos)};CMathBarPr.prototype.Read_FromBinary=function(Reader){this.pos=Reader.GetLong()};function CBar(props){CCharacter.call(this);this.Id=AscCommon.g_oIdCounter.Get_NewId();this.Pr=new CMathBarPr;this.operator=new COperator(OPER_BAR);if(props!==null&&typeof props!=="undefined")this.init(props); AscCommon.g_oTableId.Add(this,this.Id)}CBar.prototype=Object.create(CCharacter.prototype);CBar.prototype.constructor=CBar;CBar.prototype.ClassType=AscDFH.historyitem_type_bar;CBar.prototype.kind=MATH_BAR;CBar.prototype.init=function(props){this.Fill_LogicalContent(1);this.setProperties(props);this.fillContent()};CBar.prototype.getBase=function(){return this.Content[0]};CBar.prototype.fillContent=function(){this.setDimension(1,1);this.elements[0][0]=this.getBase()};CBar.prototype.ApplyProperties=function(RPI){if(this.RecalcInfo.bProps== true){var prp={loc:this.Pr.pos,type:DELIMITER_LINE};var defaultProps={loc:LOCATION_BOT};this.setCharacter(prp,defaultProps);this.RecalcInfo.bProps=false}};CBar.prototype.PreRecalc=function(Parent,ParaMath,ArgSize,RPI,GapsInfo){this.ApplyProperties(RPI);this.operator.PreRecalc(this,ParaMath);CCharacter.prototype.PreRecalc.call(this,Parent,ParaMath,ArgSize,RPI,GapsInfo)};CBar.prototype.getAscent=function(){var ascent;if(this.Pr.pos===LOCATION_TOP)ascent=this.operator.size.height+this.elements[0][0].size.ascent; else if(this.Pr.pos===LOCATION_BOT)ascent=this.elements[0][0].size.ascent;return ascent};CBar.prototype.Apply_MenuProps=function(Props){if(Props.Type==Asc.c_oAscMathInterfaceType.Bar&&Props.Pos!==undefined){var Pos=Props.Pos==Asc.c_oAscMathInterfaceBarPos.Bottom?LOCATION_BOT:LOCATION_TOP;if(Pos!==this.Pr.pos){History.Add(new CChangesMathBarLinePos(this,this.Pr.pos,Pos));this.raw_SetLinePos(Pos)}}};CBar.prototype.Get_InterfaceProps=function(){return new CMathMenuBar(this)};CBar.prototype.raw_SetLinePos= function(Value){this.Pr.pos=Value;this.RecalcInfo.bProps=true;this.ApplyProperties()};function CMathMenuBar(Bar){CMathMenuBase.call(this,Bar);this.Type=Asc.c_oAscMathInterfaceType.Bar;if(undefined!==Bar)this.Pos=Bar.Pr.pos==LOCATION_BOT?Asc.c_oAscMathInterfaceBarPos.Bottom:Asc.c_oAscMathInterfaceBarPos.Top;else this.Pos=undefined}CMathMenuBar.prototype=Object.create(CMathMenuBase.prototype);CMathMenuBar.prototype.constructor=CMathMenuBar;CMathMenuBar.prototype.get_Pos=function(){return this.Pos}; CMathMenuBar.prototype.put_Pos=function(Pos){this.Pos=Pos};window["CMathMenuBar"]=CMathMenuBar;CMathMenuBar.prototype["get_Pos"]=CMathMenuBar.prototype.get_Pos;CMathMenuBar.prototype["put_Pos"]=CMathMenuBar.prototype.put_Pos;function CMathPhantomPr(){this.show=true;this.transp=false;this.zeroAsc=false;this.zeroDesc=false;this.zeroWid=false}CMathPhantomPr.prototype.Set_FromObject=function(Obj){if(true===Obj.show||1===Obj.show)this.show=true;else this.show=false;if(true===Obj.transp||1===Obj.transp)this.transp= true;else this.transp=false;if(true===Obj.zeroAsc||1===Obj.zeroAsc)this.zeroAsc=true;else this.zeroAsc=false;if(true===Obj.zeroDesc||1===Obj.zeroDesc)this.zeroDesc=true;else this.zeroDesc=false;if(true===Obj.zeroWid||1===Obj.zeroWid)this.zeroWid=true;else this.zeroWid=false};CMathPhantomPr.prototype.Copy=function(){var NewPr=new CMathPhantomPr;NewPr.show=this.show;NewPr.transp=this.transp;NewPr.zeroAsc=this.zeroAsc;NewPr.zeroDesc=this.zeroDesc;NewPr.zeroWid=this.zeroWid;return NewPr};CMathPhantomPr.prototype.Write_ToBinary= function(Writer){Writer.WriteBool(this.show);Writer.WriteBool(this.transp);Writer.WriteBool(this.zeroAsc);Writer.WriteBool(this.zeroDesc);Writer.WriteBool(this.zeroWid)};CMathPhantomPr.prototype.Read_FromBinary=function(Reader){this.show=Reader.GetBool();this.transp=Reader.GetBool();this.zeroAsc=Reader.GetBool();this.zeroDesc=Reader.GetBool();this.zeroWid=Reader.GetBool()};function CPhantom(props){CMathBase.call(this);this.Id=AscCommon.g_oIdCounter.Get_NewId();this.Pr=new CMathPhantomPr;if(props!== null&&typeof props!=="undefined")this.init(props);AscCommon.g_oTableId.Add(this,this.Id)}CPhantom.prototype=Object.create(CMathBase.prototype);CPhantom.prototype.constructor=CPhantom;CPhantom.prototype.ClassType=AscDFH.historyitem_type_phant;CPhantom.prototype.kind=MATH_PHANTOM;CPhantom.prototype.init=function(props){this.Fill_LogicalContent(1);this.setProperties(props);this.fillContent()};CPhantom.prototype.getBase=function(){return this.Content[0]};CPhantom.prototype.fillContent=function(){this.setDimension(1, 1);this.elements[0][0]=this.getBase()};window["AscCommonWord"]=window["AscCommonWord"]||{};window["AscCommonWord"].CBar=CBar;window["AscCommonWord"].CBox=CBox;window["AscCommonWord"].CBorderBox=CBorderBox;window["AscCommonWord"].CPhantom=CPhantom;"use strict";(function(window,builder){var Api=window["Asc"]["asc_docs_api"]||window["Asc"]["spreadsheet_api"];var c_oAscRevisionsChangeType=Asc.c_oAscRevisionsChangeType;var c_oAscSectionBreakType=Asc.c_oAscSectionBreakType;var c_oAscSdtLockType=Asc.c_oAscSdtLockType; var c_oAscAlignH=Asc.c_oAscAlignH;var c_oAscAlignV=Asc.c_oAscAlignV;var arrApiRanges=[];function private_RemoveEmptyRanges(){function ckeck_equal(firstDocPos,secondDocPos){if(firstDocPos.length===secondDocPos.length){for(var nPos=0;nPosMinPos[Pos].Position)break}return arrRuns[min_pos_Index]}function private_GetLastRunInArray(arrRuns){if(!Array.isArray(arrRuns))return false;var max_pos_Index= 0;var MaxPos=arrRuns[0].Run.GetDocumentPositionFromObject();for(var Index=1;IndexMaxPos[Pos].Position){MaxPos=TempPos;max_pos_Index=Index;break}else if(TempPos[Pos].Position===MaxPos[Pos].Position)continue;else if(TempPos[Pos].Position< MaxPos[Pos].Position)break}return arrRuns[max_pos_Index]}function ApiDocumentContent(Document){this.Document=Document}function ApiRange(oElement,Start,End){this.Element=oElement;this.Controller=null;this.Start=undefined;this.End=undefined;this.isEmpty=true;this.Paragraphs=[];this.Text=undefined;this.oDocument=editor.GetDocument();this.EndPos=null;this.StartPos=null;this.TextPr=new CTextPr;this.private_SetRangePos(Start,End);this.private_CalcDocPos();if(this.StartPos===null||this.EndPos===null)return false; else this.isEmpty=false;this.private_SetController();this.Text=this.GetText();this.Paragraphs=this.GetAllParagraphs();private_RefreshRangesPosition();arrApiRanges.push(this);this.private_RemoveEqual();private_TrackRangesPositions(true)}ApiRange.prototype.constructor=ApiRange;ApiRange.prototype.private_SetRangePos=function(Start,End){function calcSumChars(oRun){var nRangePos=0;var nCurPos=oRun.Content.length;for(var nPos=0;nPosEnd){var temp=Start;Start=End;End=temp}if(Start===undefined)this.Start=0;else if(typeof Start==="number")this.Start=Start;else if(Array.isArray(Start)===true)this.StartPos=Start;if(End===undefined){this.End=0;var charsCount=0;this.Element.CheckRunContent(calcSumChars);this.End=charsCount;if(this.End>0)this.End--}else if(typeof End==="number")this.End=End;else if(Array.isArray(End)===true)this.EndPos=End}; ApiRange.prototype.private_CalcDocPos=function(){if(this.StartPos||this.EndPos)return;var isStartDocPosFinded=false;var isEndDocPosFinded=false;var StartChar=this.Start;var EndChar=this.End;var StartPos=null;var EndPos=null;var charsCount=0;function callback(oRun){var nRangePos=0;var nCurPos=oRun.Content.length;for(var nPos=0;nPosthis.Paragraphs.length-1||nPos<0)return null;if(this.Paragraphs[nPos])return this.Paragraphs[nPos];else return null};ApiRange.prototype.AddText=function(sText,sPosition){private_RefreshRangesPosition();private_RemoveEmptyRanges();var Document=private_GetLogicDocument();Document.RemoveSelection();if(this.isEmpty|| this.isEmpty===undefined||typeof sText!=="string")return false;if(sPosition!=="after"&&sPosition!=="before")sPosition="after";if(sPosition==="after"){var lastRun=this.EndPos[this.EndPos.length-1].Class;var lastRunPos=this.EndPos[this.EndPos.length-1].Position;var lastRunPosInParent=this.EndPos[this.EndPos.length-2].Position;var lastRunParent=lastRun.GetParent();var newRunPos=lastRunPos;if(lastRunPos===0){if(lastRunPosInParent-1>=0){lastRunPosInParent--;lastRun=lastRunParent.GetElement(lastRunPosInParent); lastRunPos=lastRun.Content.length}}else for(var oIterator=sText.getUnicodeIterator();oIterator.check();oIterator.next())newRunPos++;lastRun.AddText(sText,lastRunPos);this.EndPos[this.EndPos.length-1].Class=lastRun;this.EndPos[this.EndPos.length-1].Position=newRunPos;this.EndPos[this.EndPos.length-2].Position=lastRunPosInParent;private_TrackRangesPositions(true)}else if(sPosition==="before"){var firstRun=this.StartPos[this.StartPos.length-1].Class;var firstRunPos=this.StartPos[this.StartPos.length- 1].Position;firstRun.AddText(sText,firstRunPos)}return true};ApiRange.prototype.AddBookmark=function(sName){private_RefreshRangesPosition();private_RemoveEmptyRanges();var Document=private_GetLogicDocument();var oldSelectionInfo=Document.SaveDocumentState();this.Select(false);if(this.isEmpty||this.isEmpty===undefined||typeof sName!=="string"){Document.LoadDocumentState(oldSelectionInfo);return false}private_TrackRangesPositions();Document.RemoveBookmark(sName);Document.AddBookmark(sName);Document.LoadDocumentState(oldSelectionInfo); Document.UpdateSelection();return true};ApiRange.prototype.AddHyperlink=function(sLink,sScreenTipText){if(typeof sLink!=="string"||sLink===""||sLink.length>Asc.c_nMaxHyperlinkLength)return null;if(typeof sScreenTipText!=="string")sScreenTipText="";this.GetAllParagraphs();if(this.Paragraphs.length>1)return null;var Document=editor.private_GetLogicDocument();var hyperlinkPr=new Asc.CHyperlinkProperty;var urlType=AscCommon.getUrlType(sLink);var oHyperlink=null;if(!/(((^https?)|(^ftp)):\/\/)|(^mailto:)/i.test(sLink))sLink= urlType===0?null:(urlType===2?"mailto:":"http://")+sLink;sLink=sLink.replace(new RegExp("%20","g")," ");hyperlinkPr.put_Value(sLink);hyperlinkPr.put_ToolTip(sScreenTipText);hyperlinkPr.put_Bookmark(null);this.Select(false);oHyperlink=new ApiHyperlink(this.Paragraphs[0].Paragraph.AddHyperlink(hyperlinkPr));Document.RemoveSelection();return oHyperlink};ApiRange.prototype.GetText=function(){private_RefreshRangesPosition();private_RemoveEmptyRanges();var Document=private_GetLogicDocument();var oldSelectionInfo= Document.SaveDocumentState();this.Select(false);if(this.isEmpty||this.isEmpty===undefined){Document.LoadDocumentState(oldSelectionInfo);return""}private_TrackRangesPositions();var Text=this.Controller.GetSelectedText(false);Document.LoadDocumentState(oldSelectionInfo);Document.UpdateSelection();return Text};ApiRange.prototype.GetAllParagraphs=function(){private_RefreshRangesPosition();private_RemoveEmptyRanges();if(this.isEmpty||this.isEmpty===undefined)return false;var done=false;var AllParagraphsListOfElement= [];var RangeParagraphsList=[];var startPara=this.StartPos[this.StartPos.length-1].Class.GetParagraph();var endPara=this.EndPos[this.EndPos.length-1].Class.GetParagraph();if(startPara instanceof ParaHyperlink)startPara=startPara.Paragraph;if(endPara instanceof ParaHyperlink)endPara=endPara.Paragraph;if(startPara.Id===endPara.Id){RangeParagraphsList.push(new ApiParagraph(startPara));return RangeParagraphsList}if(this.Element instanceof CDocument||this.Element instanceof CTable||this.Element instanceof CBlockLevelSdt){AllParagraphsListOfElement=this.Element.GetAllParagraphs({All:true});for(var Index1=0;Index1secondPos[nPos].Position)return-1}return 1}var newRangeStartPos=null;var newRangeEndPos=null;if(check_pos(firstStartPos,secondStartPos)===1)newRangeStartPos=firstStartPos;else newRangeStartPos=secondStartPos;if(check_pos(firstEndPos,secondEndPos)===1)newRangeEndPos=secondEndPos;else newRangeEndPos=firstEndPos;return new ApiRange(newRangeStartPos[0].Class,newRangeStartPos,newRangeEndPos)};ApiRange.prototype.IntersectWith= function(oRange){private_RefreshRangesPosition();private_RemoveEmptyRanges();if(!(oRange instanceof ApiRange)||this.isEmpty||this.isEmpty===undefined||oRange.isEmpty||oRange.isEmpty===undefined)return null;var firstStartPos=this.StartPos;var firstEndPos=this.EndPos;var secondStartPos=oRange.StartPos;var secondEndPos=oRange.EndPos;if(this.Controller!==oRange.Controller)return null;function check_direction(firstPos,secondPos){for(var nPos=0,nLen=Math.min(firstPos.length,secondPos.length);nPossecondPos[nPos].Position)return-1}return 1}var newRangeStartPos=null;var newRangeEndPos=null;var AC=check_direction(firstStartPos,secondStartPos);var AD=check_direction(firstStartPos,secondEndPos);var BC=check_direction(firstEndPos,secondStartPos);var BD=check_direction(firstEndPos,secondEndPos);if(AC===AD&&AC===BC&&AC===BD)return null; else if(AC===BD&&AD!==BC)if(AC===1){newRangeStartPos=secondStartPos;newRangeEndPos=firstEndPos}else{if(AC===-1){newRangeStartPos=firstStartPos;newRangeEndPos=secondEndPos}}else if(AC!==BD&&AD!==BC)if(AC===1){newRangeStartPos=secondStartPos;newRangeEndPos=secondEndPos}else if(AC===-1){newRangeStartPos=firstStartPos;newRangeEndPos=firstEndPos}return new ApiRange(newRangeStartPos[0].Class,newRangeStartPos,newRangeEndPos)};ApiRange.prototype.SetBold=function(isBold){private_RefreshRangesPosition();private_RemoveEmptyRanges(); var Document=private_GetLogicDocument();var oldSelectionInfo=Document.SaveDocumentState();this.Select(false);if(this.isEmpty||this.isEmpty===undefined){Document.LoadDocumentState(oldSelectionInfo);return null}private_TrackRangesPositions();var SelectedContent=Document.GetSelectedElementsInfo({CheckAllSelection:true});if(!SelectedContent.CanEditBlockSdts()||!SelectedContent.CanDeleteInlineSdts()){Document.LoadDocumentState(oldSelectionInfo);Document.UpdateSelection();return null}var ParaTextPr=new AscCommonWord.ParaTextPr({Bold:isBold}); this.Controller.AddToParagraph(ParaTextPr);this.TextPr.Merge(ParaTextPr.Value);Document.LoadDocumentState(oldSelectionInfo);Document.UpdateSelection();return this};ApiRange.prototype.SetCaps=function(isCaps){private_RefreshRangesPosition();private_RemoveEmptyRanges();var Document=private_GetLogicDocument();var oldSelectionInfo=Document.SaveDocumentState();this.Select(false);if(this.isEmpty||this.isEmpty===undefined){Document.LoadDocumentState(oldSelectionInfo);return null}private_TrackRangesPositions(); var SelectedContent=Document.GetSelectedElementsInfo({CheckAllSelection:true});if(!SelectedContent.CanEditBlockSdts()||!SelectedContent.CanDeleteInlineSdts()){Document.LoadDocumentState(oldSelectionInfo);Document.UpdateSelection();return null}var ParaTextPr=new AscCommonWord.ParaTextPr({Caps:isCaps});Document.AddToParagraph(ParaTextPr);this.TextPr.Merge(ParaTextPr.Value);Document.LoadDocumentState(oldSelectionInfo);Document.UpdateSelection();return this};ApiRange.prototype.SetColor=function(r,g,b, isAuto){private_RefreshRangesPosition();private_RemoveEmptyRanges();var Document=private_GetLogicDocument();var oldSelectionInfo=Document.SaveDocumentState();this.Select(false);if(this.isEmpty||this.isEmpty===undefined){Document.LoadDocumentState(oldSelectionInfo);return null}private_TrackRangesPositions();var color=new Asc.asc_CColor;color.r=r;color.g=g;color.b=b;color.Auto=isAuto;var SelectedContent=Document.GetSelectedElementsInfo({CheckAllSelection:true});if(!SelectedContent.CanEditBlockSdts()|| !SelectedContent.CanDeleteInlineSdts()){Document.LoadDocumentState(oldSelectionInfo);Document.UpdateSelection();return null}var ParaTextPr=null;if(true===color.Auto){ParaTextPr=new AscCommonWord.ParaTextPr({Color:{Auto:true,r:0,g:0,b:0},Unifill:undefined});Document.AddToParagraph(ParaTextPr)}else{var Unifill=new AscFormat.CUniFill;Unifill.fill=new AscFormat.CSolidFill;Unifill.fill.color=AscFormat.CorrectUniColor(color,Unifill.fill.color,1);ParaTextPr=new AscCommonWord.ParaTextPr({Unifill:Unifill}); Document.AddToParagraph(ParaTextPr)}this.TextPr.Merge(ParaTextPr.Value);Document.LoadDocumentState(oldSelectionInfo);Document.UpdateSelection();return this};ApiRange.prototype.SetDoubleStrikeout=function(isDoubleStrikeout){private_RefreshRangesPosition();private_RemoveEmptyRanges();var Document=private_GetLogicDocument();var oldSelectionInfo=Document.SaveDocumentState();this.Select(false);if(this.isEmpty||this.isEmpty===undefined){Document.LoadDocumentState(oldSelectionInfo);return null}private_TrackRangesPositions(); var SelectedContent=Document.GetSelectedElementsInfo({CheckAllSelection:true});if(!SelectedContent.CanEditBlockSdts()||!SelectedContent.CanDeleteInlineSdts()){Document.LoadDocumentState(oldSelectionInfo);Document.UpdateSelection();return null}var ParaTextPr=new AscCommonWord.ParaTextPr({DStrikeout:isDoubleStrikeout});Document.AddToParagraph(ParaTextPr);this.TextPr.Merge(ParaTextPr.Value);Document.LoadDocumentState(oldSelectionInfo);Document.UpdateSelection();return this};ApiRange.prototype.SetHighlight= function(r,g,b,isNone){private_RefreshRangesPosition();private_RemoveEmptyRanges();var Document=private_GetLogicDocument();var oldSelectionInfo=Document.SaveDocumentState();this.Select(false);if(this.isEmpty||this.isEmpty===undefined){Document.LoadDocumentState(oldSelectionInfo);return null}private_TrackRangesPositions();var SelectedContent=Document.GetSelectedElementsInfo({CheckAllSelection:true});if(!SelectedContent.CanEditBlockSdts()||!SelectedContent.CanDeleteInlineSdts()){Document.LoadDocumentState(oldSelectionInfo); Document.UpdateSelection();return null}var TextPr=null;if(true===isNone){TextPr=new ParaTextPr({HighLight:highlight_None});Document.AddToParagraph(TextPr)}else{var color=new CDocumentColor(r,g,b);TextPr=new ParaTextPr({HighLight:color});Document.AddToParagraph(TextPr)}this.TextPr.Merge(TextPr.Value);Document.LoadDocumentState(oldSelectionInfo);Document.UpdateSelection();return this};ApiRange.prototype.SetShd=function(sType,r,g,b){private_RefreshRangesPosition();private_RemoveEmptyRanges();var Document= private_GetLogicDocument();var oldSelectionInfo=Document.SaveDocumentState();this.Select(false);if(this.isEmpty||this.isEmpty===undefined){Document.LoadDocumentState(oldSelectionInfo);return null}private_TrackRangesPositions();var color=new Asc.asc_CColor;color.r=r;color.g=g;color.b=b;color.Auto=false;var SelectedContent=Document.GetSelectedElementsInfo({CheckAllSelection:true});if(!SelectedContent.CanEditBlockSdts()||!SelectedContent.CanDeleteInlineSdts()){Document.LoadDocumentState(oldSelectionInfo); Document.UpdateSelection();return null}var Shd=new CDocumentShd;if(sType==="nil"){var _Shd={Value:Asc.c_oAscShdNil};Shd.Set_FromObject(_Shd);Document.SetParagraphShd(_Shd)}else if(sType==="clear"){var Unifill=new AscFormat.CUniFill;Unifill.fill=new AscFormat.CSolidFill;Unifill.fill.color=AscFormat.CorrectUniColor(color,Unifill.fill.color,1);var _Shd={Value:Asc.c_oAscShdClear,Color:{r:color.asc_getR(),g:color.asc_getG(),b:color.asc_getB()},Unifill:Unifill};Shd.Set_FromObject(_Shd);Document.SetParagraphShd(_Shd)}this.TextPr.Shd= Shd;Document.LoadDocumentState(oldSelectionInfo);Document.UpdateSelection();return this};ApiRange.prototype.SetItalic=function(isItalic){private_RefreshRangesPosition();private_RemoveEmptyRanges();var Document=private_GetLogicDocument();var oldSelectionInfo=Document.SaveDocumentState();this.Select(false);if(this.isEmpty||this.isEmpty===undefined){Document.LoadDocumentState(oldSelectionInfo);return null}private_TrackRangesPositions();var SelectedContent=Document.GetSelectedElementsInfo({CheckAllSelection:true}); if(!SelectedContent.CanEditBlockSdts()||!SelectedContent.CanDeleteInlineSdts()){Document.LoadDocumentState(oldSelectionInfo);Document.UpdateSelection();return null}var ParaTextPr=new AscCommonWord.ParaTextPr({Italic:isItalic});Document.AddToParagraph(ParaTextPr);this.TextPr.Merge(ParaTextPr.Value);Document.LoadDocumentState(oldSelectionInfo);Document.UpdateSelection();return this};ApiRange.prototype.SetStrikeout=function(isStrikeout){private_RefreshRangesPosition();private_RemoveEmptyRanges();var Document= private_GetLogicDocument();var oldSelectionInfo=Document.SaveDocumentState();this.Select(false);if(this.isEmpty||this.isEmpty===undefined){Document.LoadDocumentState(oldSelectionInfo);return null}private_TrackRangesPositions();var SelectedContent=Document.GetSelectedElementsInfo({CheckAllSelection:true});if(!SelectedContent.CanEditBlockSdts()||!SelectedContent.CanDeleteInlineSdts()){Document.LoadDocumentState(oldSelectionInfo);Document.UpdateSelection();return null}var ParaTextPr=new AscCommonWord.ParaTextPr({Strikeout:isStrikeout, DStrikeout:false});Document.AddToParagraph(ParaTextPr);this.TextPr.Merge(ParaTextPr.Value);Document.LoadDocumentState(oldSelectionInfo);Document.UpdateSelection();return this};ApiRange.prototype.SetSmallCaps=function(isSmallCaps){private_RefreshRangesPosition();private_RemoveEmptyRanges();var Document=private_GetLogicDocument();var oldSelectionInfo=Document.SaveDocumentState();this.Select(false);if(this.isEmpty||this.isEmpty===undefined){Document.LoadDocumentState(oldSelectionInfo);return null}private_TrackRangesPositions(); var SelectedContent=Document.GetSelectedElementsInfo({CheckAllSelection:true});if(!SelectedContent.CanEditBlockSdts()||!SelectedContent.CanDeleteInlineSdts()){Document.LoadDocumentState(oldSelectionInfo);Document.UpdateSelection();return null}var ParaTextPr=new AscCommonWord.ParaTextPr({SmallCaps:isSmallCaps,Caps:false});Document.AddToParagraph(ParaTextPr);this.TextPr.Merge(ParaTextPr.Value);Document.LoadDocumentState(oldSelectionInfo);Document.UpdateSelection();return this};ApiRange.prototype.SetSpacing= function(nSpacing){private_RefreshRangesPosition();private_RemoveEmptyRanges();var Document=private_GetLogicDocument();var oldSelectionInfo=Document.SaveDocumentState();this.Select(false);if(this.isEmpty||this.isEmpty===undefined){Document.LoadDocumentState(oldSelectionInfo);return null}private_TrackRangesPositions();var SelectedContent=Document.GetSelectedElementsInfo({CheckAllSelection:true});if(!SelectedContent.CanEditBlockSdts()||!SelectedContent.CanDeleteInlineSdts()){Document.LoadDocumentState(oldSelectionInfo); Document.UpdateSelection();return null}var ParaTextPr=new AscCommonWord.ParaTextPr({Spacing:nSpacing});Document.AddToParagraph(ParaTextPr);this.TextPr.Merge(ParaTextPr.Value);Document.LoadDocumentState(oldSelectionInfo);Document.UpdateSelection();return this};ApiRange.prototype.SetUnderline=function(isUnderline){private_RefreshRangesPosition();private_RemoveEmptyRanges();var Document=private_GetLogicDocument();var oldSelectionInfo=Document.SaveDocumentState();this.Select(false);if(this.isEmpty||this.isEmpty=== undefined){Document.LoadDocumentState(oldSelectionInfo);return null}private_TrackRangesPositions();var SelectedContent=Document.GetSelectedElementsInfo({CheckAllSelection:true});if(!SelectedContent.CanEditBlockSdts()||!SelectedContent.CanDeleteInlineSdts()){Document.LoadDocumentState(oldSelectionInfo);Document.UpdateSelection();return null}var ParaTextPr=new AscCommonWord.ParaTextPr({Underline:isUnderline});Document.AddToParagraph(ParaTextPr);this.TextPr.Merge(ParaTextPr.Value);Document.LoadDocumentState(oldSelectionInfo); Document.UpdateSelection();return this};ApiRange.prototype.SetVertAlign=function(sType){private_RefreshRangesPosition();private_RemoveEmptyRanges();var Document=private_GetLogicDocument();var oldSelectionInfo=Document.SaveDocumentState();this.Select(false);if(this.isEmpty||this.isEmpty===undefined){Document.LoadDocumentState(oldSelectionInfo);return null}private_TrackRangesPositions();var value=undefined;if(sType==="baseline")value=0;else if(sType==="subscript")value=2;else if(sType==="superscript")value= 1;else return null;var SelectedContent=Document.GetSelectedElementsInfo({CheckAllSelection:true});if(!SelectedContent.CanEditBlockSdts()||!SelectedContent.CanDeleteInlineSdts()){Document.LoadDocumentState(oldSelectionInfo);Document.UpdateSelection();return null}var ParaTextPr=new AscCommonWord.ParaTextPr({VertAlign:value});Document.AddToParagraph(ParaTextPr);this.TextPr.Merge(ParaTextPr.Value);Document.LoadDocumentState(oldSelectionInfo);Document.UpdateSelection();return this};ApiRange.prototype.SetPosition= function(nPosition){private_RefreshRangesPosition();private_RemoveEmptyRanges();var Document=private_GetLogicDocument();var oldSelectionInfo=Document.SaveDocumentState();this.Select(false);if(this.isEmpty||this.isEmpty===undefined){Document.LoadDocumentState(oldSelectionInfo);return null}private_TrackRangesPositions();if(typeof nPosition!=="number")return null;var SelectedContent=Document.GetSelectedElementsInfo({CheckAllSelection:true});if(!SelectedContent.CanEditBlockSdts()||!SelectedContent.CanDeleteInlineSdts()){Document.LoadDocumentState(oldSelectionInfo); Document.UpdateSelection();return null}var ParaTextPr=new AscCommonWord.ParaTextPr({Position:nPosition});Document.AddToParagraph(ParaTextPr);this.TextPr.Merge(ParaTextPr.Value);Document.LoadDocumentState(oldSelectionInfo);Document.UpdateSelection();return this};ApiRange.prototype.SetFontSize=function(FontSize){private_RefreshRangesPosition();private_RemoveEmptyRanges();var Document=private_GetLogicDocument();var oldSelectionInfo=Document.SaveDocumentState();this.Select(false);if(this.isEmpty||this.isEmpty=== undefined){Document.LoadDocumentState(oldSelectionInfo);return null}private_TrackRangesPositions();var SelectedContent=Document.GetSelectedElementsInfo({CheckAllSelection:true});if(!SelectedContent.CanEditBlockSdts()||!SelectedContent.CanDeleteInlineSdts()){Document.LoadDocumentState(oldSelectionInfo);Document.UpdateSelection();return null}var ParaTextPr=new AscCommonWord.ParaTextPr({FontSize:FontSize});Document.AddToParagraph(ParaTextPr);this.TextPr.Merge(ParaTextPr.Value);Document.LoadDocumentState(oldSelectionInfo); Document.UpdateSelection();return this};ApiRange.prototype.SetFontFamily=function(sFontFamily){private_RefreshRangesPosition();private_RemoveEmptyRanges();if(typeof sFontFamily!=="string")return null;var loader=AscCommon.g_font_loader;var fontinfo=g_fontApplication.GetFontInfo(sFontFamily);var isasync=loader.LoadFont(fontinfo);var Document=null;var oldSelectionInfo=undefined;if(isasync===false){Document=private_GetLogicDocument();oldSelectionInfo=Document.SaveDocumentState();this.Select(false);if(this.isEmpty|| this.isEmpty===undefined){Document.LoadDocumentState(oldSelectionInfo);return null}private_TrackRangesPositions();var FontFamily={Name:sFontFamily,Index:-1};var SelectedContent=Document.GetSelectedElementsInfo({CheckAllSelection:true});if(!SelectedContent.CanEditBlockSdts()||!SelectedContent.CanDeleteInlineSdts()){Document.LoadDocumentState(oldSelectionInfo);Document.UpdateSelection();return null}var ParaTextPr=new AscCommonWord.ParaTextPr({FontFamily:FontFamily});Document.AddToParagraph(ParaTextPr); this.TextPr.Merge(ParaTextPr.Value);Document.LoadDocumentState(oldSelectionInfo);Document.UpdateSelection();return this}};ApiRange.prototype.SetStyle=function(oStyle){private_RefreshRangesPosition();private_RemoveEmptyRanges();var Document=private_GetLogicDocument();var oldSelectionInfo=Document.SaveDocumentState();this.Select(false);if(this.isEmpty||this.isEmpty===undefined||!(oStyle instanceof ApiStyle)){Document.LoadDocumentState(oldSelectionInfo);return null}private_TrackRangesPositions();var SelectedContent= Document.GetSelectedElementsInfo({CheckAllSelection:true});if(!SelectedContent.CanEditBlockSdts()||!SelectedContent.CanDeleteInlineSdts()){Document.LoadDocumentState(oldSelectionInfo);Document.UpdateSelection();return null}Document.SetParagraphStyle(oStyle.GetName(),true);Document.LoadDocumentState(oldSelectionInfo);Document.UpdateSelection();return this};ApiRange.prototype.SetTextPr=function(oTextPr){private_RefreshRangesPosition();private_RemoveEmptyRanges();var Document=private_GetLogicDocument(); var oldSelectionInfo=Document.SaveDocumentState();this.Select(false);if(this.isEmpty||this.isEmpty===undefined||!(oTextPr instanceof ApiTextPr)){Document.LoadDocumentState(oldSelectionInfo);return null}private_TrackRangesPositions();var SelectedContent=Document.GetSelectedElementsInfo({CheckAllSelection:true});if(!SelectedContent.CanEditBlockSdts()||!SelectedContent.CanDeleteInlineSdts()){Document.LoadDocumentState(oldSelectionInfo);Document.UpdateSelection();return null}var ParaTextPr=new AscCommonWord.ParaTextPr(oTextPr.TextPr); Document.AddToParagraph(ParaTextPr);this.TextPr.Set_FromObject(oTextPr.TextPr);Document.LoadDocumentState(oldSelectionInfo);Document.UpdateSelection();return this};ApiRange.prototype.Delete=function(){private_RefreshRangesPosition();private_RemoveEmptyRanges();var Document=private_GetLogicDocument();var oldSelectionInfo=Document.SaveDocumentState();this.Select(false);if(this.isEmpty||this.isEmpty===undefined){Document.LoadDocumentState(oldSelectionInfo);return false}private_TrackRangesPositions(); this.Controller.Remove(1,true,false,false,false);this.isEmpty=true;Document.LoadDocumentState(oldSelectionInfo);Document.UpdateSelection();return true};function ApiDocument(Document){ApiDocumentContent.call(this,Document)}ApiDocument.prototype=Object.create(ApiDocumentContent.prototype);ApiDocument.prototype.constructor=ApiDocument;function ApiParaPr(Parent,ParaPr){this.Parent=Parent;this.ParaPr=ParaPr}function ApiBullet(Bullet){this.Bullet=Bullet}function ApiParagraph(Paragraph){ApiParaPr.call(this, this,Paragraph.Pr.Copy());this.Paragraph=Paragraph}ApiParagraph.prototype=Object.create(ApiParaPr.prototype);ApiParagraph.prototype.constructor=ApiParagraph;function ApiTablePr(Parent,TablePr){this.Parent=Parent;this.TablePr=TablePr}function ApiTable(Table){ApiTablePr.call(this,this,Table.Pr.Copy());this.Table=Table}ApiTable.prototype=Object.create(ApiTablePr.prototype);ApiTable.prototype.constructor=ApiTable;function ApiTextPr(Parent,TextPr){this.Parent=Parent;this.TextPr=TextPr}function ApiRun(Run){ApiTextPr.call(this, this,Run.Pr.Copy());this.Run=Run}ApiRun.prototype=Object.create(ApiTextPr.prototype);ApiRun.prototype.constructor=ApiRun;function ApiHyperlink(ParaHyperlink){this.ParaHyperlink=ParaHyperlink}ApiHyperlink.prototype.constructor=ApiHyperlink;ApiHyperlink.prototype.GetClassType=function(){return"hyperlink"};ApiHyperlink.prototype.SetLink=function(sLink){if(typeof sLink!=="string"||sLink.length>Asc.c_nMaxHyperlinkLength)return false;if(sLink==undefined)sLink="";var urlType=undefined;if(sLink!==""){urlType= AscCommon.getUrlType(sLink);if(!/(((^https?)|(^ftp)):\/\/)|(^mailto:)/i.test(sLink))sLink=urlType===0?null:(urlType===2?"mailto:":"http://")+sLink;sLink=sLink.replace(new RegExp("%20","g")," ")}this.ParaHyperlink.SetValue(sLink);return true};ApiHyperlink.prototype.SetDisplayedText=function(sDisplay){if(typeof sDisplay!=="string")return false;if(sDisplay==undefined)sDisplay="";var HyperRun=null;var Styles=editor.WordControl.m_oLogicDocument.Get_Styles();if(this.ParaHyperlink.Content.length===0){HyperRun= editor.CreateRun();HyperRun.AddText(sDisplay);this.ParaHyperlink.Add_ToContent(0,HyperRun.Run,false);HyperRun.Run.Set_RStyle(Styles.GetDefaultHyperlink())}else{HyperRun=this.GetElement(0);if(this.ParaHyperlink.Content.length>1)this.ParaHyperlink.RemoveFromContent(1,this.ParaHyperlink.Content.length-1);HyperRun.ClearContent();HyperRun.AddText(sDisplay)}return true};ApiHyperlink.prototype.SetScreenTipText=function(sScreenTipText){if(typeof sScreenTipText!=="string")return false;if(sScreenTipText==undefined)sScreenTipText= "";this.ParaHyperlink.SetToolTip(sScreenTipText);return true};ApiHyperlink.prototype.GetLinkedText=function(){var sText=null;if(this.ParaHyperlink.Content.length!==0)sText=this.ParaHyperlink.GetValue();return sText};ApiHyperlink.prototype.GetDisplayedText=function(){var oText={Text:""};if(this.ParaHyperlink.Content.length!==0)this.ParaHyperlink.Get_Text(oText);return oText.Text};ApiHyperlink.prototype.GetScreenTipText=function(){var sText=null;if(this.ParaHyperlink.Content.length!==0)sText=this.ParaHyperlink.GetToolTip(); return sText};ApiHyperlink.prototype.GetElement=function(nPos){if(nPos<0||nPos>=this.ParaHyperlink.Content.length)return null;if(this.ParaHyperlink.Content[nPos]instanceof ParaRun)return new ApiRun(this.ParaHyperlink.Content[nPos])};ApiHyperlink.prototype.GetElementsCount=function(){return this.ParaHyperlink.GetElementsCount()};ApiHyperlink.prototype.SetDefaultStyle=function(){var HyperRun=null;var Styles=editor.WordControl.m_oLogicDocument.Get_Styles();for(var nRun=0;nRun0){oBullet.bulletType.type=AscFormat.BULLET_TYPE_BULLET_CHAR;oBullet.bulletType.Char=sSymbol[0]}else oBullet.bulletType.type=AscFormat.BULLET_TYPE_BULLET_NONE;return new ApiBullet(oBullet)};Api.prototype.CreateNumbering=function(sType, nStartAt){var oBullet=new AscFormat.CBullet;oBullet.bulletType=new AscFormat.CBulletType;oBullet.bulletType.type=AscFormat.BULLET_TYPE_BULLET_AUTONUM;switch(sType){case "ArabicPeriod":{oBullet.bulletType.AutoNumType=12;break}case "ArabicParenR":{oBullet.bulletType.AutoNumType=11;break}case "RomanUcPeriod":{oBullet.bulletType.AutoNumType=34;break}case "RomanLcPeriod":{oBullet.bulletType.AutoNumType=31;break}case "AlphaLcParenR":{oBullet.bulletType.AutoNumType=1;break}case "AlphaLcPeriod":{oBullet.bulletType.AutoNumType= 2;break}case "AlphaUcParenR":{oBullet.bulletType.AutoNumType=4;break}case "AlphaUcPeriod":{oBullet.bulletType.AutoNumType=5;break}case "None":{oBullet.bulletType.type=AscFormat.BULLET_TYPE_BULLET_NONE;break}}if(oBullet.bulletType.type===AscFormat.BULLET_TYPE_BULLET_AUTONUM)if(AscFormat.isRealNumber(nStartAt))oBullet.bulletType.startAt=nStartAt;return new ApiBullet(oBullet)};Api.prototype.CreateInlineLvlSdt=function(){var oSdt=new CInlineLevelSdt;oSdt.Add_ToContent(0,new ParaRun(null,false));return new ApiInlineLvlSdt(oSdt)}; Api.prototype.CreateBlockLvlSdt=function(){return new ApiBlockLvlSdt(new CBlockLevelSdt(editor.private_GetLogicDocument()))};Api.prototype.Save=function(){this.SaveAfterMacros=true};Api.prototype.LoadMailMergeData=function(aList){if(!aList||aList.length===0)return false;editor.asc_StartMailMergeByList(aList);return true};Api.prototype.GetMailMergeTemplateDocContent=function(){var oDocument=editor.private_GetLogicDocument();AscCommon.History.TurnOff();AscCommon.g_oTableId.TurnOff();var LogicDocument= new CDocument(undefined,false);AscCommon.History.Document=oDocument;LogicDocument.Styles=oDocument.Styles.Copy();LogicDocument.Numbering.Clear();LogicDocument.DrawingDocument=oDocument.DrawingDocument;LogicDocument.theme=oDocument.theme.createDuplicate();LogicDocument.clrSchemeMap=oDocument.clrSchemeMap.createDuplicate();var FieldsManager=oDocument.FieldsManager;var ContentCount=oDocument.Content.length;var OverallIndex=0;oDocument.ForceCopySectPr=true;oDocument.FieldsManager=LogicDocument.FieldsManager; var NewNumbering=oDocument.Numbering.CopyAllNums(LogicDocument.Numbering);LogicDocument.Numbering.AppendAbstractNums(NewNumbering.AbstractNum);LogicDocument.Numbering.AppendNums(NewNumbering.Num);oDocument.CopyNumberingMap=NewNumbering.NumMap;for(var ContentIndex=0;ContentIndex=this.GetElementsCount())return;this.Document.Internal_Content_Remove(nPos, 1,true)};ApiDocumentContent.prototype.GetRange=function(Start,End){var Range=new ApiRange(this.Document,Start,End);return Range};ApiDocument.prototype.GetClassType=function(){return"document"};ApiDocument.prototype.CreateNewHistoryPoint=function(){this.Document.Create_NewHistoryPoint(AscDFH.historydescription_Document_ApiBuilder)};ApiDocument.prototype.GetStyle=function(sStyleName){var oStyles=this.Document.Get_Styles();var oStyleId=oStyles.GetStyleIdByName(sStyleName,true);return new ApiStyle(oStyles.Get(oStyleId))}; ApiDocument.prototype.CreateStyle=function(sStyleName,sType){var nStyleType=styletype_Paragraph;if("paragraph"===sType)nStyleType=styletype_Paragraph;else if("table"===sType)nStyleType=styletype_Table;else if("run"===sType)nStyleType=styletype_Character;else if("numbering"===sType)nStyleType=styletype_Numbering;var oStyle=new CStyle(sStyleName,null,null,nStyleType,false);oStyle.qFormat=true;oStyle.uiPriority=1;var oStyles=this.Document.Get_Styles();var sOldId=oStyles.GetStyleIdByName(sStyleName); var oOldStyle=oStyles.Get(sOldId);if(null!=sOldId&&oOldStyle){oStyles.Remove(sOldId);oStyles.RemapIdReferences(sOldId,oStyle.Get_Id())}oStyles.Add(oStyle);return new ApiStyle(oStyle)};ApiDocument.prototype.GetDefaultStyle=function(sStyleType){var oStyles=this.Document.Get_Styles();if("paragraph"===sStyleType)return new ApiStyle(oStyles.Get(oStyles.Get_Default_Paragraph()));else if("table"===sStyleType)return new ApiStyle(oStyles.Get(oStyles.Get_Default_Table()));else if("run"===sStyleType)return new ApiStyle(oStyles.Get(oStyles.Get_Default_Character())); else if("numbering"===sStyleType)return new ApiStyle(oStyles.Get(oStyles.Get_Default_Numbering()));return null};ApiDocument.prototype.GetDefaultTextPr=function(){var oStyles=this.Document.Get_Styles();return new ApiTextPr(this,oStyles.Get_DefaultTextPr().Copy())};ApiDocument.prototype.GetDefaultParaPr=function(){var oStyles=this.Document.Get_Styles();return new ApiParaPr(this,oStyles.Get_DefaultParaPr().Copy())};ApiDocument.prototype.GetFinalSection=function(){return new ApiSection(this.Document.SectPr)}; ApiDocument.prototype.CreateSection=function(oParagraph){if(!(oParagraph instanceof ApiParagraph))return null;var oSectPr=new CSectionPr(this.Document);oParagraph.private_GetImpl().Set_SectionPr(oSectPr);return new ApiSection(oSectPr)};ApiDocument.prototype.SetEvenAndOddHdrFtr=function(isEvenAndOdd){this.Document.Set_DocumentEvenAndOddHeaders(isEvenAndOdd)};ApiDocument.prototype.CreateNumbering=function(sType){var oGlobalNumbering=this.Document.GetNumbering();var oNum=oGlobalNumbering.CreateNum(); if("numbered"===sType)oNum.CreateDefault(c_oAscMultiLevelNumbering.Numbered);else oNum.CreateDefault(c_oAscMultiLevelNumbering.Bullet);return new ApiNumbering(oNum)};ApiDocument.prototype.InsertContent=function(arrContent,isInline,oPr){var oSelectedContent=new CSelectedContent;for(var nIndex=0,nCount=arrContent.length;nIndex=this.Paragraph.Content.length-1)return null;return private_GetSupportedParaElement(this.Paragraph.Content[nPos])}; ApiParagraph.prototype.RemoveElement=function(nPos){if(nPos<0||nPos>=this.Paragraph.Content.length-1)return;this.Paragraph.RemoveFromContent(nPos,1);this.Paragraph.CorrectContent()};ApiParagraph.prototype.RemoveAllElements=function(){if(this.Paragraph.Content.length>1){this.Paragraph.RemoveFromContent(0,this.Paragraph.Content.length-1);this.Paragraph.CorrectContent()}};ApiParagraph.prototype.Delete=function(){var parentOfElement=this.Paragraph.GetParent();var PosInDocument=parentOfElement.Content.indexOf(this.Paragraph); if(PosInDocument!==-1){this.Paragraph.PreDelete();parentOfElement.Remove_FromContent(PosInDocument,1,true);return true}else return false};ApiParagraph.prototype.GetNext=function(){var nextPara=this.Paragraph.GetNextParagraph();if(nextPara!==null)return new ApiParagraph(nextPara);return null};ApiParagraph.prototype.GetPrevious=function(){var prevPara=this.Paragraph.GetPrevParagraph();if(prevPara!==null)return new ApiParagraph(prevPara);return null};ApiParagraph.prototype.Copy=function(){var oParagraph= this.Paragraph.Copy(undefined,private_GetDrawingDocument(),{SkipComments:true,SkipAnchors:true,SkipFootnoteReference:true,SkipComplexFields:true});return new ApiParagraph(oParagraph)};ApiParagraph.prototype.AddElement=function(oElement,nPos){if(!private_IsSupportedParaElement(oElement)||nPos<0||nPos>this.Paragraph.Content.length-1)return false;var oParaElement=oElement.private_GetImpl();if(undefined!==nPos)this.Paragraph.Add_ToContent(nPos,oParaElement);else private_PushElementToParagraph(this.Paragraph, oParaElement);return true};ApiParagraph.prototype.AddTabStop=function(){var oRun=new ParaRun(this.Paragraph,false);oRun.Add_ToContent(0,new ParaTab);private_PushElementToParagraph(this.Paragraph,oRun);return new ApiRun(oRun)};ApiParagraph.prototype.AddDrawing=function(oDrawing){var oRun=new ParaRun(this.Paragraph,false);if(!(oDrawing instanceof ApiDrawing))return new ApiRun(oRun);oRun.Add_ToContent(0,oDrawing.Drawing);private_PushElementToParagraph(this.Paragraph,oRun);oDrawing.Drawing.Set_Parent(oRun); return new ApiRun(oRun)};ApiParagraph.prototype.AddInlineLvlSdt=function(oSdt){if(!oSdt||!(oSdt instanceof ApiInlineLvlSdt)){var _oSdt=new CInlineLevelSdt;_oSdt.Add_ToContent(0,new ParaRun(null,false));oSdt=new ApiInlineLvlSdt(_oSdt)}private_PushElementToParagraph(this.Paragraph,oSdt.Sdt);return oSdt};ApiParagraph.prototype.AddComment=function(Comment,Autor){if(!Comment||typeof Comment!=="string")return false;if(typeof Autor!=="string")Autor="";var CommentData=new AscCommon.CCommentData;CommentData.SetText(Comment); CommentData.SetUserName(Autor);var oDocument=private_GetLogicDocument();var oFirstun=this.Paragraph.GetFirstRun();var StartPos=oFirstun.GetDocumentPositionFromObject();var oEndRun=this.Paragraph.Content[this.Paragraph.Content.length-2];var EndPos=oEndRun.GetDocumentPositionFromObject();StartPos.push({Class:oFirstun,Position:0});EndPos.push({Class:oEndRun,Position:oEndRun.Content.length});oDocument.Selection.Use=true;oDocument.SetContentSelection(StartPos,EndPos,0,0,0);var COMENT=oDocument.AddComment(CommentData, false);oDocument.RemoveSelection();if(null!=COMENT)editor.sync_AddComment(COMENT.Get_Id(),CommentData);return true};ApiParagraph.prototype.AddHyperlink=function(sLink,sScreenTipText){if(typeof sLink!=="string"||sLink===""||sLink.length>Asc.c_nMaxHyperlinkLength)return null;if(typeof sScreenTipText!=="string")sScreenTipText="";var oDocument=editor.private_GetLogicDocument();var hyperlinkPr=new Asc.CHyperlinkProperty;var urlType=AscCommon.getUrlType(sLink);var oHyperlink=null;this.Paragraph.SelectAll(1); if(!/(((^https?)|(^ftp)):\/\/)|(^mailto:)/i.test(sLink))sLink=urlType===0?null:(urlType===2?"mailto:":"http://")+sLink;sLink=sLink.replace(new RegExp("%20","g")," ");hyperlinkPr.put_Value(sLink);hyperlinkPr.put_ToolTip(sScreenTipText);hyperlinkPr.put_Bookmark(null);oHyperlink=new ApiHyperlink(this.Paragraph.AddHyperlink(hyperlinkPr));oDocument.RemoveSelection();return oHyperlink};ApiParagraph.prototype.GetRange=function(Start,End){var Range=new ApiRange(this.Paragraph,Start,End);return Range};ApiParagraph.prototype.Push= function(oElement){if(oElement instanceof ApiRun||ApiInlineLvlSdt)this.AddElement(oElement);else if(typeof oElement==="string"){var LastTextPrInParagraph=undefined;if(this.GetLastRunWithText()!==null)LastTextPrInParagraph=this.GetLastRunWithText().GetTextPr().TextPr;else LastTextPrInParagraph=this.Paragraph.TextPr.Value;var oRun=editor.CreateRun();oRun.AddText(oElement);oRun.Run.Apply_TextPr(LastTextPrInParagraph,undefined,true);this.AddElement(oRun)}else return false};ApiParagraph.prototype.GetLastRunWithText= function(){for(var curElement=this.GetElementsCount()-1;curElement>=0;curElement--){var Element=this.GetElement(curElement);if(Element instanceof ApiRun)for(var Index=0;Index=0;Index--){LastNoEmptyElement=this.GetElement(Index);if(!LastNoEmptyElement||LastNoEmptyElement instanceof ApiUnsupported)continue;return LastNoEmptyElement}return null};ApiParagraph.prototype.GetAllContentControls= function(){var arrApiContentControls=[];var ContentControls=this.Paragraph.GetAllContentControls();for(var Index=0;Index=1;Index--)if(ParaPosition[Index].Class)if(ParaPosition[Index].Class instanceof CBlockLevelSdt)return new ApiBlockLvlSdt(ParaPosition[Index].Class);return null};ApiParagraph.prototype.GetParentTable=function(){var ParaPosition=this.Paragraph.GetDocumentPositionFromObject();for(var Index=ParaPosition.length-1;Index>=1;Index--)if(ParaPosition[Index].Class instanceof CTable)return new ApiTable(ParaPosition[Index].Class);return null};ApiParagraph.prototype.GetParentTableCell= function(){var ParaPosition=this.Paragraph.GetDocumentPositionFromObject();for(var Index=ParaPosition.length-1;Index>=1;Index--)if(ParaPosition[Index].Class.Parent&&this.Paragraph.IsTableCellContent())if(ParaPosition[Index].Class.Parent instanceof CTableCell)return new ApiTableCell(ParaPosition[Index].Class.Parent);return null};ApiParagraph.prototype.GetText=function(){var ParaText=this.Paragraph.GetText({ParaEndToSpace:false});return ParaText};ApiParagraph.prototype.GetTextPr=function(){var TextPr= this.Paragraph.TextPr.Value;return new ApiTextPr(this,TextPr)};ApiParagraph.prototype.SetTextPr=function(oTextPr){if(!(oTextPr instanceof ApiTextPr))return false;this.Paragraph.SetApplyToAll(true);this.Paragraph.Add(new AscCommonWord.ParaTextPr(oTextPr.TextPr));this.Paragraph.SetApplyToAll(false);return true};ApiParagraph.prototype.InsertInContentControl=function(nType){var Document=private_GetLogicDocument();var ContentControl=null;var paraIndex=this.Paragraph.Index;if(paraIndex>=0){this.Select(false); ContentControl=new ApiBlockLvlSdt(Document.AddContentControl(1));Document.RemoveSelection()}else{ContentControl=new ApiBlockLvlSdt(new CBlockLevelSdt(Document,Document));ContentControl.Sdt.SetDefaultTextPr(Document.GetDirectTextPr());ContentControl.Sdt.Content.RemoveFromContent(0,ContentControl.Sdt.Content.GetElementsCount(),false);ContentControl.Sdt.Content.AddToContent(0,this.Paragraph);ContentControl.Sdt.SetShowingPlcHdr(false)}if(nType===1)return ContentControl;else return this};ApiParagraph.prototype.InsertParagraph= function(paragraph,sPosition,beRNewPara){var paraParent=this.Paragraph.GetParent();var paraIndex=paraParent.Content.indexOf(this.Paragraph);var oNewPara=null;if(sPosition!=="before"&&sPosition!=="after")sPosition="after";if(paragraph instanceof ApiParagraph){oNewPara=paragraph;if(sPosition==="before")paraParent.Internal_Content_Add(paraIndex,oNewPara.private_GetImpl());else if(sPosition==="after")paraParent.Internal_Content_Add(paraIndex+1,oNewPara.private_GetImpl())}else if(typeof paragraph==="string"){oNewPara= editor.CreateParagraph();oNewPara.AddText(paragraph);if(sPosition==="before")paraParent.Internal_Content_Add(paraIndex,oNewPara.private_GetImpl());else if(sPosition==="after")paraParent.Internal_Content_Add(paraIndex+1,oNewPara.private_GetImpl())}else return null;if(beRNewPara===true)return oNewPara;else return this};ApiParagraph.prototype.Select=function(){var Document=private_GetLogicDocument();var StartRun=this.Paragraph.GetFirstRun();var StartPos=StartRun.GetDocumentPositionFromObject();var EndRun= this.Paragraph.Content[this.Paragraph.Content.length-1];var EndPos=EndRun.GetDocumentPositionFromObject();StartPos.push({Class:StartRun,Position:0});EndPos.push({Class:EndRun,Position:1});if(StartPos[0].Position===-1)return false;StartPos[0].Class.SetSelectionByContentPositions(StartPos,EndPos);var controllerType=null;if(StartPos[0].Class.IsHdrFtr())controllerType=docpostype_HdrFtr;else if(StartPos[0].Class.IsFootnote())controllerType=docpostype_Footnotes;else if(StartPos[0].Class.Is_DrawingShape())controllerType= docpostype_DrawingObjects;else controllerType=docpostype_Content;Document.SetDocPosType(controllerType);Document.UpdateSelection();return true};ApiParagraph.prototype.Search=function(sText,isMatchCase){if(isMatchCase===undefined)isMatchCase=false;var arrApiRanges=[];var Api=editor;var oDocument=Api.GetDocument();var SearchEngine=null;if(!oDocument.Document.SearchEngine.Compare(sText,{MatchCase:isMatchCase})){SearchEngine=new CDocumentSearch;SearchEngine.Set(sText,{MatchCase:isMatchCase});this.Paragraph.Search(sText, {MatchCase:isMatchCase},SearchEngine,0)}else SearchEngine=oDocument.Document.SearchEngine;var SearchResults=this.Paragraph.SearchResults;for(var FoundId in SearchResults){var StartSearchContentPos=SearchResults[FoundId].StartPos;var EndSearchContentPos=SearchResults[FoundId].EndPos;var StartChar=this.Paragraph.ConvertParaContentPosToRangePos(StartSearchContentPos);var EndChar=this.Paragraph.ConvertParaContentPosToRangePos(EndSearchContentPos);if(EndChar>0)EndChar--;arrApiRanges.push(this.GetRange(StartChar, EndChar))}return arrApiRanges};ApiParagraph.prototype.WrapInMailMergeField=function(){var oDocument=private_GetLogicDocument();var fieldName=this.GetText();var oField=new ParaField(fieldtype_MERGEFIELD,[fieldName],[]);var leftQuote=new ParaRun;var rightQuote=new ParaRun;leftQuote.AddText("\u00ab");rightQuote.AddText("\u00bb");oField.Add_ToContent(0,leftQuote);for(var nElement=0;nElementAsc.c_nMaxHyperlinkLength)return null;if(typeof sScreenTipText!=="string")sScreenTipText="";var Document=editor.private_GetLogicDocument(); var parentPara=this.Run.GetParagraph();if(!parentPara||this.Run.Content.length===0)return null;if(this.GetParentContentControl()instanceof ApiInlineLvlSdt)return null;function find_parentParaDepth(DocPos){for(var nPos=0;nPos=1;Index--)if(RunPosition[Index].Class)if(RunPosition[Index].Class instanceof CBlockLevelSdt)return new ApiBlockLvlSdt(RunPosition[Index].Class);else if(RunPosition[Index].Class instanceof CInlineLevelSdt)return new ApiInlineLvlSdt(RunPosition[Index].Class);return null};ApiRun.prototype.GetParentTable=function(){var documentPos=this.Run.GetDocumentPositionFromObject();for(var Index=documentPos.length-1;Index>=1;Index--)if(documentPos[Index].Class)if(documentPos[Index].Class instanceof CTable)return new ApiTable(documentPos[Index].Class);return null};ApiRun.prototype.GetParentTableCell=function(){var documentPos=this.Run.GetDocumentPositionFromObject();for(var Index=documentPos.length-1;Index>=1;Index--)if(documentPos[Index].Class.Parent)if(documentPos[Index].Class.Parent instanceof CTableCell)return new ApiTableCell(documentPos[Index].Class.Parent);return null};ApiRun.prototype.SetTextPr=function(oTextPr){var runTextPr=this.GetTextPr();runTextPr.TextPr.Merge(oTextPr.TextPr);runTextPr.private_OnChange(); return runTextPr};ApiRun.prototype.SetBold=function(isBold){var oTextPr=this.GetTextPr();oTextPr.SetBold(isBold);return oTextPr};ApiRun.prototype.SetCaps=function(isCaps){var oTextPr=this.GetTextPr();oTextPr.SetCaps(isCaps);return oTextPr};ApiRun.prototype.SetColor=function(r,g,b,isAuto){var oTextPr=this.GetTextPr();oTextPr.SetColor(r,g,b,isAuto);return oTextPr};ApiRun.prototype.SetDoubleStrikeout=function(isDoubleStrikeout){var oTextPr=this.GetTextPr();oTextPr.SetDoubleStrikeout(isDoubleStrikeout); return oTextPr};ApiRun.prototype.SetFill=function(oApiFill){var oTextPr=this.GetTextPr();oTextPr.SetFill(oApiFill);return oTextPr};ApiRun.prototype.SetFontFamily=function(sFontFamily){var oTextPr=this.GetTextPr();oTextPr.SetFontFamily(sFontFamily);return oTextPr};ApiRun.prototype.SetFontSize=function(nSize){var oTextPr=this.GetTextPr();oTextPr.SetFontSize(nSize);return oTextPr};ApiRun.prototype.SetHighlight=function(r,g,b,isNone){var oTextPr=this.GetTextPr();oTextPr.SetHighlight(r,g,b,isNone);return oTextPr}; ApiRun.prototype.SetItalic=function(isItalic){var oTextPr=this.GetTextPr();oTextPr.SetItalic(isItalic);return oTextPr};ApiRun.prototype.SetLanguage=function(sLangId){var oTextPr=this.GetTextPr();oTextPr.SetLanguage(sLangId);return oTextPr};ApiRun.prototype.SetPosition=function(nPosition){var oTextPr=this.GetTextPr();oTextPr.SetPosition(nPosition);return oTextPr};ApiRun.prototype.SetShd=function(sType,r,g,b){var oTextPr=this.GetTextPr();oTextPr.SetShd(sType,r,g,b);return oTextPr};ApiRun.prototype.SetSmallCaps= function(isSmallCaps){var oTextPr=this.GetTextPr();oTextPr.SetSmallCaps(isSmallCaps);return oTextPr};ApiRun.prototype.SetSpacing=function(SetSpacing){var oTextPr=this.GetTextPr();oTextPr.SetSpacing(SetSpacing);return oTextPr};ApiRun.prototype.SetStrikeout=function(isStrikeout){var oTextPr=this.GetTextPr();oTextPr.SetStrikeout(isStrikeout);return oTextPr};ApiRun.prototype.SetStyle=function(oStyle){var oTextPr=this.GetTextPr();oTextPr.SetStyle(oStyle);return oTextPr};ApiRun.prototype.SetUnderline=function(isUnderline){var oTextPr= this.GetTextPr();oTextPr.SetUnderline(isUnderline);return oTextPr};ApiRun.prototype.SetVertAlign=function(sType){var oTextPr=this.GetTextPr();oTextPr.SetVertAlign(sType);return oTextPr};ApiRun.prototype.WrapInMailMergeField=function(){var oDocument=private_GetLogicDocument();var fieldName=this.Run.GetText();var oField=new ParaField(fieldtype_MERGEFIELD,[fieldName],[]);var runParent=this.Run.GetParent();var leftQuote=new ParaRun;var rightQuote=new ParaRun;leftQuote.AddText("\u00ab");rightQuote.AddText("\u00bb"); oField.Add_ToContent(0,leftQuote);oField.Add_ToContent(1,this.Run);oField.Add_ToContent(oField.Content.length,rightQuote);if(runParent){var indexInParent=runParent.Content.indexOf(this.Run);runParent.Remove_FromContent(indexInParent,1);runParent.Add_ToContent(indexInParent,oField)}oDocument.Register_Field(oField)};ApiSection.prototype.GetClassType=function(){return"section"};ApiSection.prototype.SetType=function(sType){if("oddPage"===sType)this.Section.Set_Type(c_oAscSectionBreakType.OddPage);else if("evenPage"=== sType)this.Section.Set_Type(c_oAscSectionBreakType.EvenPage);else if("continuous"===sType)this.Section.Set_Type(c_oAscSectionBreakType.Continuous);else if("nextColumn"===sType)this.Section.Set_Type(c_oAscSectionBreakType.Column);else if("nextPage"===sType)this.Section.Set_Type(c_oAscSectionBreakType.NextPage)};ApiSection.prototype.SetEqualColumns=function(nCount,nSpace){this.Section.Set_Columns_EqualWidth(true);this.Section.Set_Columns_Num(nCount);this.Section.Set_Columns_Space(private_Twips2MM(nSpace))}; ApiSection.prototype.SetNotEqualColumns=function(aWidths,aSpaces){if(!aWidths||!aWidths.length||aWidths.length<=1||aSpaces.length!==aWidths.length-1)return;this.Section.Set_Columns_EqualWidth(false);var aCols=[];for(var nPos=0,nCount=aWidths.length;nPos=this.Table.Content.length)return null;return new ApiTableRow(this.Table.Content[nPos])};ApiTable.prototype.GetCell=function(nRow,nCell){var Row=this.Table.GetRow(nRow);if(Row&&nCell>=0&&nCell<=Row.Content.length)return new ApiTableCell(Row.GetCell(nCell));else return null};ApiTable.prototype.MergeCells=function(aCells){private_StartSilentMode();this.private_PrepareTableForActions(); var oTable=this.Table;oTable.Selection.Use=true;oTable.Selection.Type=table_Selection_Cell;oTable.Selection.Data=[];for(var nPos=0,nCount=aCells.length;nPosoPos.Row)break;else if(oCurPos.Cell< oPos.Cell)continue;else break}oTable.Selection.Data.splice(nResultPos,0,oPos)}var isMerged=this.Table.MergeTableCells(true);var oMergedCell=this.Table.CurCell;oTable.RemoveSelection();private_EndSilentMode();if(true===isMerged)return new ApiTableCell(oMergedCell);return null};ApiTable.prototype.SetStyle=function(oStyle){if(!oStyle||!(oStyle instanceof ApiStyle)||styletype_Table!==oStyle.Style.Get_Type())return false;this.Table.Set_TableStyle(oStyle.Style.Get_Id(),true);return true};ApiTable.prototype.SetTableLook= function(isFirstColumn,isFirstRow,isLastColumn,isLastRow,isHorBand,isVerBand){var oTableLook=new CTableLook(private_GetBoolean(isFirstColumn),private_GetBoolean(isFirstRow),private_GetBoolean(isLastColumn),private_GetBoolean(isLastRow),private_GetBoolean(isHorBand),private_GetBoolean(isVerBand));this.Table.Set_TableLook(oTableLook)};ApiTable.prototype.Split=function(oCell,nRow,nCol){if(nRow==undefined)nRow=1;if(nCol==undefined)nCol=1;if(!(oCell instanceof ApiTableCell)||nCol<=0||nRow<=0)return null; this.Table.RemoveSelection();this.Table.Set_CurCell(oCell.Cell);this.Table.SelectTable(c_oAscTableSelectionType.Cell);if(!this.Table.CanSplitTableCells())return null;if(!this.Table.IsRecalculated()){this.Table.Reset(0,0,100,100,0,0,1);this.Table.Recalculate_Grid()}if(!this.Table.SplitTableCells(nCol,nRow,false))return null;return this};ApiTable.prototype.AddRow=function(oCell,isBefore){private_StartSilentMode();this.private_PrepareTableForActions();var _isBefore=private_GetBoolean(isBefore,false); var _oCell=oCell instanceof ApiTableCell?oCell.Cell:undefined;if(_oCell&&this.Table!==_oCell.Row.Table)_oCell=undefined;if(!_oCell){_oCell=this.Table.Content[this.Table.Content.length-1].Get_Cell(0);_isBefore=false}var nRowIndex=true===_isBefore?_oCell.Row.Index:_oCell.Row.Index+1;this.Table.RemoveSelection();this.Table.CurCell=_oCell;this.Table.AddTableRow(_isBefore);private_EndSilentMode();return new ApiTableRow(this.Table.Content[nRowIndex])};ApiTable.prototype.AddRows=function(oCell,nCount,isBefore){for(var Index= 0;Index=1;Index--)if(TablePosition[Index].Class)if(TablePosition[Index].Class instanceof CBlockLevelSdt)return new ApiBlockLvlSdt(TablePosition[Index].Class); return null};ApiTable.prototype.InsertInContentControl=function(nType){var Document=private_GetLogicDocument();var ContentControl=null;var tableIndex=this.Table.Index;if(tableIndex>=0){this.Select();ContentControl=new ApiBlockLvlSdt(Document.AddContentControl(1));Document.RemoveSelection()}else{ContentControl=new ApiBlockLvlSdt(new CBlockLevelSdt(Document,Document));ContentControl.Sdt.SetDefaultTextPr(Document.GetDirectTextPr());ContentControl.Sdt.Content.RemoveFromContent(0,ContentControl.Sdt.Content.GetElementsCount(), false);ContentControl.Sdt.Content.AddToContent(0,this.Table);ContentControl.Sdt.SetShowingPlcHdr(false)}if(nType===1)return ContentControl;else return this};ApiTable.prototype.GetParentTable=function(){var documentPos=this.Table.GetDocumentPositionFromObject();for(var Index=documentPos.length-1;Index>=1;Index--)if(documentPos[Index].Class)if(documentPos[Index].Class instanceof CTable)return new ApiTable(documentPos[Index].Class);return null};ApiTable.prototype.GetTables=function(){var arrTables=[]; var viewRow=undefined;var viewAbsPage=undefined;for(var nCurPage=0,nPagesCount=this.Table.Pages.length;nCurPage=0;curPage--){var curPageTables=oDocument.Document.GetAllTablesOnPage(curPage);for(var Index=curPageTables.length-1;Index>=0;Index--)if(curPageTables[Index].Table.Id===this.Table.Id)if(curPageTables[Index-1])return new ApiTable(curPageTables[Index-1].Table);else continue;else return new ApiTable(curPageTables[Index].Table)}return null};ApiTable.prototype.GetParentTableCell=function(){var documentPos=this.Table.GetDocumentPositionFromObject();for(var Index=documentPos.length-1;Index>= 1;Index--)if(documentPos[Index].Class.Parent)if(documentPos[Index].Class.Parent instanceof CTableCell)return new ApiTableCell(documentPos[Index].Class.Parent);return null};ApiTable.prototype.Delete=function(){var tableParent=this.Table.Parent;if(tableParent){this.Table.PreDelete();tableParent.Remove_FromContent(this.Table.Index,1,true);return true}else return false};ApiTable.prototype.Clear=function(){for(var curRow=0,rowsCount=this.Table.GetRowsCount();curRow=this.Row.Content.length)return null;return new ApiTableCell(this.Row.Content[nPos])};ApiTableRow.prototype.GetIndex=function(){return this.Row.GetIndex()};ApiTableRow.prototype.GetParentTable=function(){var Table=this.Row.GetTable();if(!Table)return null;return new ApiTable(Table)};ApiTableRow.prototype.GetNext=function(){var Next=this.Row.Next;if(!Next)return null; return new ApiTableRow(Next)};ApiTableRow.prototype.GetPrevious=function(){var Prev=this.Row.Prev;if(!Prev)return null;return new ApiTableRow(Prev)};ApiTableRow.prototype.AddRows=function(nCount,isBefore){var oTable=this.GetParentTable();if(!oTable)return null;var oCell=this.GetCell(0);if(!oCell)return null;oTable.AddRows(oCell,nCount,isBefore);return oTable};ApiTableRow.prototype.MergeCells=function(){var oTable=this.GetParentTable();if(!oTable)return null;var cellsArr=[];var tempCell=null;var tempGridSpan= undefined;var tempStartGridCol=undefined;var tempVMergeCount=undefined;for(var curCell=0,cellsCount=this.GetCellsCount();curCell1)tempCell=new ApiTableCell(oTable.Table.GetCellByStartGridCol(this.GetIndex()-(tempVMergeCount- 1),tempStartGridCol));cellsArr.push(tempCell)}return oTable.MergeCells(cellsArr)};ApiTableRow.prototype.Clear=function(){var oTable=this.GetParentTable();if(!oTable)return false;var tempCell=null;var tempGridSpan=undefined;var tempStartGridCol=undefined;var tempVMergeCount=undefined;for(var curCell=0,cellsCount=this.Row.GetCellsCount();curCell1)tempCell=oTable.Table.GetCellByStartGridCol(this.GetIndex()-(tempVMergeCount-1),tempStartGridCol);tempCell.GetContent().Clear_Content()}return true};ApiTableRow.prototype.Remove=function(){var oTable=this.GetParentTable();if(!oTable)return false;var oCell=this.GetCell(0);oTable.RemoveRow(oCell);return true};ApiTableRow.prototype.SetTextPr=function(oTextPr){var oTable=this.GetParentTable(); if(!oTable)return false;if(!oTextPr||!oTextPr.GetClassType||oTextPr.GetClassType()!=="textPr")return false;var tempCell=null;var tempGridSpan=undefined;var tempStartGridCol=undefined;var tempVMergeCount=undefined;for(var curCell=0,cellsCount=this.Row.GetCellsCount();curCell1)tempCell=new ApiTableCell(oTable.Table.GetCellByStartGridCol(this.GetIndex()-(tempVMergeCount-1),tempStartGridCol));tempCell.SetTextPr(oTextPr)}return true};ApiTableRow.prototype.Search=function(sText,isMatchCase){if(isMatchCase===undefined)isMatchCase=false;var oTable=this.GetParentTable();if(!oTable)return false;var arrApiRanges=[];var tempResult=[];var tempCell=null;var tempGridSpan=undefined;var tempStartGridCol=undefined;var tempVMergeCount= undefined;for(var curCell=0,cellsCount=this.GetCellsCount();curCell1)tempCell=new ApiTableCell(oTable.Table.GetCellByStartGridCol(this.GetIndex()-(tempVMergeCount-1),tempStartGridCol));tempResult=tempCell.Search(sText,isMatchCase); for(var nRange=0;nRange=0){this.Select();ContentControl=new ApiBlockLvlSdt(Document.AddContentControl(1));Document.RemoveSelection()}else{ContentControl=new ApiBlockLvlSdt(new CBlockLevelSdt(Document,Document));ContentControl.Sdt.SetDefaultTextPr(Document.GetDirectTextPr());paragraphInControl=ContentControl.Sdt.GetFirstParagraph(); if(paragraphInControl.Content.length>1){paragraphInControl.RemoveFromContent(0,paragraphInControl.Content.length-1);paragraphInControl.CorrectContent()}paragraphInControl.Add(this.Drawing);ContentControl.Sdt.SetShowingPlcHdr(false)}if(nType===1)return ContentControl;else return this};ApiDrawing.prototype.InsertParagraph=function(paragraph,sPosition,beRNewPara){var parentParagraph=this.GetParentParagraph();if(parentParagraph)if(beRNewPara)return parentParagraph.InsertParagraph(paragraph,sPosition, true);else{parentParagraph.InsertParagraph(paragraph,sPosition,true);return this}else return null};ApiDrawing.prototype.Select=function(){var Api=editor;var oDocument=Api.GetDocument();this.Drawing.SelectAsText();oDocument.Document.UpdateSelection()};ApiDrawing.prototype.AddBreak=function(breakType,position){var ParentRun=new ApiRun(this.Drawing.GetRun());if(!ParentRun||position!=="before"&&position!=="after"||breakType!==1&&breakType!==0)return false;if(breakType===0)if(position==="before")ParentRun.Run.Add_ToContent(ParentRun.Run.Content.indexOf(this.Drawing), new ParaNewLine(break_Page));else{if(position==="after")ParentRun.Run.Add_ToContent(ParentRun.Run.Content.indexOf(this.Drawing)+1,new ParaNewLine(break_Page))}else if(breakType===1)if(position==="before")ParentRun.Run.Add_ToContent(ParentRun.Run.Content.indexOf(this.Drawing),new ParaNewLine(break_Line));else if(position==="after")ParentRun.Run.Add_ToContent(ParentRun.Run.Content.indexOf(this.Drawing)+1,new ParaNewLine(break_Line));return true};ApiDrawing.prototype.SetHorFlip=function(bFlip){if(this.Drawing.GraphicObj&& this.Drawing.GraphicObj.spPr&&this.Drawing.GraphicObj.spPr.xfrm)this.Drawing.GraphicObj.spPr.xfrm.setFlipH(bFlip)};ApiDrawing.prototype.SetVertFlip=function(bFlip){if(typeof bFlip!=="boolean")return false;if(this.Drawing.GraphicObj&&this.Drawing.GraphicObj.spPr&&this.Drawing.GraphicObj.spPr.xfrm)this.Drawing.GraphicObj.spPr.xfrm.setFlipV(bFlip);return true};ApiDrawing.prototype.ScaleHeight=function(coefficient){if(typeof coefficient!=="number")return false;var currentHeight=this.Drawing.getXfrmExtY(); var currentWidth=this.Drawing.getXfrmExtX();this.Drawing.setExtent(currentWidth,currentHeight*coefficient);if(this.Drawing.GraphicObj&&this.Drawing.GraphicObj.spPr&&this.Drawing.GraphicObj.spPr.xfrm)this.Drawing.GraphicObj.spPr.xfrm.setExtY(currentHeight*coefficient);return true};ApiDrawing.prototype.ScaleWidth=function(coefficient){if(typeof coefficient!=="number")return false;var currentHeight=this.Drawing.getXfrmExtY();var currentWidth=this.Drawing.getXfrmExtX();this.Drawing.setExtent(currentWidth* coefficient,currentHeight);if(this.Drawing.GraphicObj&&this.Drawing.GraphicObj.spPr&&this.Drawing.GraphicObj.spPr.xfrm)this.Drawing.GraphicObj.spPr.xfrm.setExtX(currentWidth*coefficient);return true};ApiDrawing.prototype.Fill=function(oFill){if(!oFill||!oFill.GetClassType||oFill.GetClassType()!=="fill")return false;this.Drawing.GraphicObj.spPr.setFill(oFill.UniFill);return true};ApiDrawing.prototype.SetOutLine=function(oStroke){if(!oStroke||!oStroke.GetClassType||oStroke.GetClassType()!=="stroke")return false; this.Drawing.GraphicObj.spPr.setLn(oStroke.Ln);return true};ApiDrawing.prototype.GetNextDrawing=function(){var oDocument=editor.GetDocument();var GetAllDrawingObjects=oDocument.GetAllDrawingObjects();var drawingIndex=null;for(var Index=0;Index0){var oTitle=new AscFormat.CTitle;oTitle.setOverlay(false);oTitle.setTx(new AscFormat.CChartText); var oTextBody=AscFormat.CreateTextBodyFromString(sTitle,this.Chart.getDrawingDocument(),oTitle.tx);if(AscFormat.isRealNumber(nFontSize)){oTextBody.content.SetApplyToAll(true);oTextBody.content.AddToParagraph(new ParaTextPr({FontSize:nFontSize}));oTextBody.content.SetApplyToAll(false)}oTitle.tx.setRich(oTextBody);return oTitle}return null};ApiChart.prototype.SetTitle=function(sTitle,nFontSize,bIsBold){AscFormat.builder_SetChartTitle(this.Chart,sTitle,nFontSize,bIsBold)};ApiChart.prototype.SetHorAxisTitle= function(sTitle,nFontSize,bIsBold){AscFormat.builder_SetChartHorAxisTitle(this.Chart,sTitle,nFontSize,bIsBold)};ApiChart.prototype.SetVerAxisTitle=function(sTitle,nFontSize,bIsBold){AscFormat.builder_SetChartVertAxisTitle(this.Chart,sTitle,nFontSize,bIsBold)};ApiChart.prototype.SetVerAxisOrientation=function(bIsMinMax){AscFormat.builder_SetChartVertAxisOrientation(this.Chart,bIsMinMax)};ApiChart.prototype.SetHorAxisOrientation=function(bIsMinMax){AscFormat.builder_SetChartHorAxisOrientation(this.Chart, bIsMinMax)};ApiChart.prototype.SetLegendPos=function(sLegendPos){if(this.Chart&&this.Chart.chart)if(sLegendPos==="none"){if(this.Chart.chart.legend)this.Chart.chart.setLegend(null)}else{var nLegendPos=null;switch(sLegendPos){case "left":{nLegendPos=Asc.c_oAscChartLegendShowSettings.left;break}case "top":{nLegendPos=Asc.c_oAscChartLegendShowSettings.top;break}case "right":{nLegendPos=Asc.c_oAscChartLegendShowSettings.right;break}case "bottom":{nLegendPos=Asc.c_oAscChartLegendShowSettings.bottom;break}}if(null!== nLegendPos){if(!this.Chart.chart.legend)this.Chart.chart.setLegend(new AscFormat.CLegend);if(this.Chart.chart.legend.legendPos!==nLegendPos)this.Chart.chart.legend.setLegendPos(nLegendPos);if(this.Chart.chart.legend.overlay!==false)this.Chart.chart.legend.setOverlay(false)}}};ApiChart.prototype.SetLegendFontSize=function(nFontSize){AscFormat.builder_SetLegendFontSize(this.Chart,nFontSize)};ApiChart.prototype.SetShowDataLabels=function(bShowSerName,bShowCatName,bShowVal,bShowPercent){AscFormat.builder_SetShowDataLabels(this.Chart, bShowSerName,bShowCatName,bShowVal,bShowPercent)};ApiChart.prototype.SetShowPointDataLabel=function(nSeriesIndex,nPointIndex,bShowSerName,bShowCatName,bShowVal,bShowPercent){AscFormat.builder_SetShowPointDataLabel(this.Chart,nSeriesIndex,nPointIndex,bShowSerName,bShowCatName,bShowVal,bShowPercent)};ApiChart.prototype.SetVertAxisTickLabelPosition=function(sTickLabelPosition){AscFormat.builder_SetChartVertAxisTickLablePosition(this.Chart,sTickLabelPosition)};ApiChart.prototype.SetHorAxisTickLabelPosition= function(sTickLabelPosition){AscFormat.builder_SetChartHorAxisTickLablePosition(this.Chart,sTickLabelPosition)};ApiChart.prototype.SetHorAxisMajorTickMark=function(sTickMark){AscFormat.builder_SetChartHorAxisMajorTickMark(this.Chart,sTickMark)};ApiChart.prototype.SetHorAxisMinorTickMark=function(sTickMark){AscFormat.builder_SetChartHorAxisMinorTickMark(this.Chart,sTickMark)};ApiChart.prototype.SetVertAxisMajorTickMark=function(sTickMark){AscFormat.builder_SetChartVerAxisMajorTickMark(this.Chart,sTickMark)}; ApiChart.prototype.SetVertAxisMinorTickMark=function(sTickMark){AscFormat.builder_SetChartVerAxisMinorTickMark(this.Chart,sTickMark)};ApiChart.prototype.SetMajorVerticalGridlines=function(oStroke){AscFormat.builder_SetVerAxisMajorGridlines(this.Chart,oStroke?oStroke.Ln:null)};ApiChart.prototype.SetMinorVerticalGridlines=function(oStroke){AscFormat.builder_SetVerAxisMinorGridlines(this.Chart,oStroke?oStroke.Ln:null)};ApiChart.prototype.SetMajorHorizontalGridlines=function(oStroke){AscFormat.builder_SetHorAxisMajorGridlines(this.Chart, oStroke?oStroke.Ln:null)};ApiChart.prototype.SetMinorHorizontalGridlines=function(oStroke){AscFormat.builder_SetHorAxisMinorGridlines(this.Chart,oStroke?oStroke.Ln:null)};ApiChart.prototype.SetHorAxisLablesFontSize=function(nFontSize){AscFormat.builder_SetHorAxisFontSize(this.Chart,nFontSize)};ApiChart.prototype.SetVertAxisLablesFontSize=function(nFontSize){AscFormat.builder_SetVerAxisFontSize(this.Chart,nFontSize)};ApiChart.prototype.GetNextChart=function(){var oDocument=editor.GetDocument();var AllCharts= oDocument.GetAllCharts();var chartIndex=null;for(var Index=0;Index=this.Sdt.Content.length)return null;return private_GetSupportedParaElement(this.Sdt.Content[nPos])};ApiInlineLvlSdt.prototype.RemoveElement= function(nPos){if(nPos<0||nPos>=this.Sdt.Content.length)return;this.Sdt.RemoveFromContent(nPos,1);this.Sdt.CorrectContent()};ApiInlineLvlSdt.prototype.RemoveAllElements=function(){if(this.Sdt.Content.length>0){this.Sdt.RemoveFromContent(0,this.Sdt.Content.length);this.Sdt.CorrectContent();return true}return false};ApiInlineLvlSdt.prototype.AddElement=function(oElement,nPos){if(!private_IsSupportedParaElement(oElement)||nPos<0||nPos>this.Sdt.Content.length)return false;var oParaElement=oElement.private_GetImpl(); if(undefined!==nPos)this.Sdt.AddToContent(nPos,oParaElement);else private_PushElementToParagraph(this.Sdt,oParaElement);return true};ApiInlineLvlSdt.prototype.Push=function(oElement){if(!private_IsSupportedParaElement(oElement))return false;if(this.Sdt.IsShowingPlcHdr()){this.Sdt.RemoveFromContent(0,this.Sdt.GetElementsCount(),false);this.Sdt.SetShowingPlcHdr(false)}var oParaElement=oElement.private_GetImpl();this.Sdt.AddToContent(this.Sdt.GetElementsCount(),oParaElement);return true};ApiInlineLvlSdt.prototype.AddText= function(sText){if(typeof sText==="string"){var newRun=editor.CreateRun();newRun.AddText(sText);this.AddElement(newRun,this.GetElementsCount());return true}return false};ApiInlineLvlSdt.prototype.Delete=function(keepContent){if(this.Sdt.Paragraph){if(keepContent)this.Sdt.RemoveContentControlWrapper();else{this.Sdt.PreDelete();var controlIndex=this.Sdt.Paragraph.Content.indexOf(this.Sdt);this.Sdt.Paragraph.RemoveFromContent(controlIndex,1)}return true}return false};ApiInlineLvlSdt.prototype.SetTextPr= function(oTextPr){for(var Index=0;Index=1;Index--)if(documentPos[Index].Class)if(documentPos[Index].Class instanceof CTable)return new ApiTable(documentPos[Index].Class);return null};ApiInlineLvlSdt.prototype.GetParentTableCell= function(){var documentPos=this.Sdt.GetDocumentPositionFromObject();for(var Index=documentPos.length-1;Index>=1;Index--)if(documentPos[Index].Class.Parent)if(documentPos[Index].Class.Parent instanceof CTableCell)return new ApiTableCell(documentPos[Index].Class.Parent);return null};ApiInlineLvlSdt.prototype.GetRange=function(Start,End){var Range=new ApiRange(this.Sdt,Start,End);return Range};ApiInlineLvlSdt.prototype.Copy=function(){var oInlineSdt=this.Sdt.Copy(false,{SkipComments:true,SkipAnchors:true, SkipFootnoteReference:true,SkipComplexFields:true});return new ApiInlineLvlSdt(oInlineSdt)};ApiBlockLvlSdt.prototype.GetClassType=function(){return"blockLvlSdt"};ApiBlockLvlSdt.prototype.SetLock=function(sLockType){var nLock=c_oAscSdtLockType.Unlocked;if("contentLocked"===sLockType)nLock=c_oAscSdtLockType.ContentLocked;else if("sdtContentLocked"===sLockType)nLock=c_oAscSdtLockType.SdtContentLocked;else if("sdtLocked"===sLockType)nLock=c_oAscSdtLockType.SdtLocked;this.Sdt.SetContentControlLock(nLock)}; ApiBlockLvlSdt.prototype.GetLock=function(){var nLock=this.Sdt.GetContentControlLock();var sResult="unlocked";if(c_oAscSdtLockType.ContentLocked===nLock)sResult="contentLocked";else if(c_oAscSdtLockType.SdtContentLocked===nLock)sResult="sdtContentLocked";else if(c_oAscSdtLockType.SdtLocked===nLock)sResult="sdtLocked";return sResult};ApiBlockLvlSdt.prototype.SetTag=function(sTag){this.Sdt.SetTag(sTag)};ApiBlockLvlSdt.prototype.GetTag=function(){return this.Sdt.GetTag()};ApiBlockLvlSdt.prototype.SetLabel= function(sLabel){this.Sdt.SetLabel(sLabel)};ApiBlockLvlSdt.prototype.GetLabel=function(){return this.Sdt.GetLabel()};ApiBlockLvlSdt.prototype.SetAlias=function(sAlias){this.Sdt.SetAlias(sAlias)};ApiBlockLvlSdt.prototype.GetAlias=function(){return this.Sdt.GetAlias()};ApiBlockLvlSdt.prototype.GetContent=function(){return new ApiDocumentContent(this.Sdt.GetContent())};ApiBlockLvlSdt.prototype.GetAllContentControls=function(){var arrContentControls=[];var arrApiContentControls=[];this.Sdt.Content.GetAllContentControls(arrContentControls); for(var Index=0,nCount=arrContentControls.length;Index=0){if(keepContent)this.Sdt.RemoveContentControlWrapper();else{this.Sdt.PreDelete();this.Sdt.Parent.RemoveFromContent(this.Sdt.Index,1,true)}return true}return false};ApiBlockLvlSdt.prototype.SetTextPr=function(oTextPr){var ParaTextPr=new AscCommonWord.ParaTextPr(oTextPr.TextPr);this.Sdt.Content.SetApplyToAll(true); this.Sdt.Add(ParaTextPr);this.Sdt.Content.SetApplyToAll(false)};ApiBlockLvlSdt.prototype.GetAllDrawingObjects=function(){var arrAllDrawing=this.Sdt.GetAllDrawingObjects();var arrApiDrawings=[];for(var Index=0;Index=1;Index--)if(documentPos[Index].Class)if(documentPos[Index].Class instanceof CBlockLevelSdt)return new ApiBlockLvlSdt(documentPos[Index].Class);return null};ApiBlockLvlSdt.prototype.GetParentTable=function(){var documentPos=this.Sdt.GetDocumentPositionFromObject();for(var Index=documentPos.length-1;Index>=1;Index--)if(documentPos[Index].Class)if(documentPos[Index].Class instanceof CTable)return new ApiTable(documentPos[Index].Class);return null};ApiBlockLvlSdt.prototype.GetParentTableCell=function(){var documentPos=this.Sdt.GetDocumentPositionFromObject();for(var Index=documentPos.length- 1;Index>=1;Index--)if(documentPos[Index].Class.Parent)if(documentPos[Index].Class.Parent instanceof CTableCell)return new ApiTableCell(documentPos[Index].Class.Parent);return null};ApiBlockLvlSdt.prototype.Push=function(oElement){if(oElement instanceof ApiParagraph||oElement instanceof ApiTable||ApiBlockLvlSdt){if(this.Sdt.IsShowingPlcHdr()){this.Sdt.Content.RemoveFromContent(0,this.Sdt.Content.GetElementsCount(),false);this.Sdt.SetShowingPlcHdr(false)}this.Sdt.Content.Internal_Content_Add(this.Sdt.Content.Content.length, oElement.private_GetImpl());return true}return false};ApiBlockLvlSdt.prototype.AddElement=function(oElement,nPos){if(oElement instanceof ApiParagraph||oElement instanceof ApiTable||ApiBlockLvlSdt){if(this.Sdt.IsShowingPlcHdr()){this.Sdt.Content.RemoveFromContent(0,this.Sdt.Content.GetElementsCount(),false);this.Sdt.SetShowingPlcHdr(false)}this.Sdt.Content.Internal_Content_Add(nPos,oElement.private_GetImpl());return true}return false};ApiBlockLvlSdt.prototype.AddText=function(sText){if(typeof sText=== "string"){var oParagraph=editor.CreateParagraph();oParagraph.AddText(sText);this.Sdt.Content.Internal_Content_Add(this.Sdt.Content.Content.length,oParagraph.private_GetImpl());return true}return false};ApiBlockLvlSdt.prototype.GetRange=function(Start,End){var Range=new ApiRange(this.Sdt,Start,End);return Range};ApiBlockLvlSdt.prototype.Search=function(sText,isMatchCase){if(isMatchCase===undefined)isMatchCase=false;var arrApiRanges=[];var allParagraphs=[];this.Sdt.GetAllParagraphs({All:true},allParagraphs); for(var para in allParagraphs){var oParagraph=new ApiParagraph(allParagraphs[para]);var arrOfParaApiRanges=oParagraph.Search(sText,isMatchCase);for(var itemRange=0;itemRangeEndPos){var Temp=EndPos;EndPos=StartPos;StartPos=Temp}runInfo.StartPos=StartPos;runInfo.GlobStartPos=StartPos;runInfo.GlobEndPos= EndPos}var posToSplit=[StartPos];for(var Pos=StartPos;Pos= 0;nChange--){var oChange=textDelta[nChange];var DelCount=oChange.deleteCount;var infoToAdd=null;for(var nInfo=0;nInfo=oInfo.GlobStartPos||oChange.pos+DelCount>oInfo.GlobStartPos){var nPosToDel=Math.max(0,oChange.pos-oInfo.GlobStartPos+oInfo.StartPos);var nPosToAdd=nPosToDel;var nCharsToDel=Math.min(oChange.deleteCount,oInfo.StringCount);if(nPosToDel>=oInfo.Run.Content.length&&nCharsToDel!==0||nCharsToDel===0&&oChange.deleteCount!== 0||nPosToAdd>oInfo.Run.Content.length)continue;for(var nChar=0;nCharnewObj.currentChangeId;if(bUpdate){this.docId=newObj.docId;this.url=newObj.url;this.urlChanges=newObj.urlChanges;this.currentChangeId=-1; this.changes=null;this.token=newObj.token}this.colors=newObj.colors;this.newChangeId=newObj.currentChangeId;this.isRequested=newObj.isRequested;this.serverVersion=newObj.serverVersion;return bUpdate};asc_CVersionHistory.prototype.applyChanges=function(editor){if(!this.changes)return;var color;this.newChangeId=null==this.newChangeId?this.changes.length-1:this.newChangeId;for(var i=this.currentChangeId+1;i<=this.newChangeId&&i>16&255,color>>8&255,color&255):new CDocumentColor(191,255,199))}this.currentChangeId=this.newChangeId};asc_CVersionHistory.prototype.asc_setDocId=function(val){this.docId=val};asc_CVersionHistory.prototype.asc_setUrl=function(val){this.url=val};asc_CVersionHistory.prototype.asc_setUrlChanges=function(val){this.urlChanges=val};asc_CVersionHistory.prototype.asc_setCurrentChangeId=function(val){this.currentChangeId=val};asc_CVersionHistory.prototype.asc_setArrColors= function(val){this.colors=val};asc_CVersionHistory.prototype.asc_setToken=function(val){this.token=val};asc_CVersionHistory.prototype.asc_setIsRequested=function(val){this.isRequested=val};asc_CVersionHistory.prototype.asc_setServerVersion=function(val){this.serverVersion=val};window["Asc"].asc_CVersionHistory=window["Asc"]["asc_CVersionHistory"]=asc_CVersionHistory;prot=asc_CVersionHistory.prototype;prot["asc_setDocId"]=prot.asc_setDocId;prot["asc_setUrl"]=prot.asc_setUrl;prot["asc_setUrlChanges"]= prot.asc_setUrlChanges;prot["asc_setCurrentChangeId"]=prot.asc_setCurrentChangeId;prot["asc_setArrColors"]=prot.asc_setArrColors;prot["asc_setToken"]=prot.asc_setToken;prot["asc_setIsRequested"]=prot.asc_setIsRequested;prot["asc_setServerVersion"]=prot.asc_setServerVersion})(window);"use strict";(function(window,undefined){var AscBrowser=AscCommon.AscBrowser;var c_oAscClipboardDataFormat={Text:1,Html:2,Internal:4,HtmlElement:8};var c_oClipboardPastedFrom={Word:0,Excel:1,PowerPoint:2};AscCommon.c_oAscClipboardDataFormat= c_oAscClipboardDataFormat;AscCommon.c_oClipboardPastedFrom=c_oClipboardPastedFrom;function CClipboardBase(){this.PasteFlag=false;this.CopyFlag=false;this.Api=null;this.IsNeedDivOnCopy=AscBrowser.isIE;this.IsNeedDivOnPaste=AscBrowser.isIE;this.IsCopyCutOnlyInEditable=AscBrowser.isIE||AscBrowser.isMozilla;this.IsPasteOnlyInEditable=AscBrowser.isIE||AscBrowser.isMozilla||AscBrowser.isSafari;this.CommonDivClassName="sdk-element";this.CommonDivIdParent="";this.CommonDivId="asc_pasteBin";this.CommonDiv= null;this.CommonIframeId="asc_pasteFrame";this.CommonIframe=null;this.ClosureParams={};this.CopyPasteFocus=false;this.CopyPasteFocusTimer=-1;this.inputContext=null;this.LastCopyBinary=null;this.PasteImagesCount=0;this.PasteImagesCounter=0;this.PasteImagesBody="";this.DivOnCopyHtmlPresent=false;this.DivOnCopyText="";this.bSaveFormat=false;this.bCut=false;this.pastedFrom=null;this.clearBufferTimerId=-1;this.needClearBuffer=false}CClipboardBase.prototype={_console_log:function(_obj){},checkCopy:function(formats){if(-1!= this.clearBufferTimerId){if(formats&AscCommon.c_oAscClipboardDataFormat.Text)this.pushData(AscCommon.c_oAscClipboardDataFormat.Text,"");if(formats&AscCommon.c_oAscClipboardDataFormat.Html)this.pushData(AscCommon.c_oAscClipboardDataFormat.Html,"");if(formats&AscCommon.c_oAscClipboardDataFormat.Internal)this.pushData(AscCommon.c_oAscClipboardDataFormat.Internal,"");clearTimeout(this.clearBufferTimerId);this.clearBufferTimerId=-1;return}return this.Api.asc_CheckCopy(this,formats)},_private_oncopy:function(e){this._console_log("oncopy"); if(!this.Api.asc_IsFocus(true))return;this.ClosureParams._e=e;if(this.IsNeedDivOnCopy)this.CommonDiv_Copy();else{this.LastCopyBinary=null;this.checkCopy(AscCommon.c_oAscClipboardDataFormat.Text|AscCommon.c_oAscClipboardDataFormat.Html|AscCommon.c_oAscClipboardDataFormat.Internal);setTimeout(function(){g_clipboardBase.CommonDiv_End()},0);e.preventDefault();return false}},_private_oncut:function(e){this._console_log("oncut");if(!this.Api.asc_IsFocus(true))return;this.bCut=true;this.ClosureParams._e= e;if(this.IsNeedDivOnCopy)this.CommonDiv_Copy();else{this.LastCopyBinary=null;this.checkCopy(AscCommon.c_oAscClipboardDataFormat.Text|AscCommon.c_oAscClipboardDataFormat.Html|AscCommon.c_oAscClipboardDataFormat.Internal)}this.Api.asc_SelectionCut();this.bCut=false;if(!this.IsNeedDivOnCopy){setTimeout(function(){g_clipboardBase.CommonDiv_End()},0);e.preventDefault();return false}},_private_onpaste:function(e){this._console_log("onpaste");if(!this.Api.asc_IsFocus(true))return;if(!this.IsNeedDivOnPaste)e.preventDefault(); this.ClosureParams._e=e;if(this.Api.isLongAction())return false;this.PasteFlag=true;this.Api.incrementCounterLongAction();this.pastedFrom=null;if(this.IsNeedDivOnPaste){window.setTimeout(function(){g_clipboardBase.Api.asc_PasteData(AscCommon.c_oAscClipboardDataFormat.HtmlElement,g_clipboardBase.CommonDiv);g_clipboardBase.CommonDiv_End();g_clipboardBase.Paste_End()},0);return}else{var _clipboard=e&&e.clipboardData?e.clipboardData:window.clipboardData;if(!_clipboard||!_clipboard.getData)return false; var _text_format=this.ClosureParams.getData("text/plain");var _internal=this.ClosureParams.getData("text/x-custom");if(_internal&&_internal!=""&&_internal.indexOf("asc_internalData2;")==0){this.Api.asc_PasteData(AscCommon.c_oAscClipboardDataFormat.Internal,_internal.substr("asc_internalData2;".length),null,_text_format);g_clipboardBase.Paste_End();return false}var _html_format=this.ClosureParams.getData("text/html");if(_html_format&&_html_format!=""){var nIndex=_html_format.indexOf("");if(-1!= nIndex)_html_format=_html_format.substring(0,nIndex+"".length);this.CommonIframe_PasteStart(_html_format,_text_format);return false}if(_text_format&&_text_format!=""){this.Api.asc_PasteData(AscCommon.c_oAscClipboardDataFormat.Text,_text_format);g_clipboardBase.Paste_End();return false}var items=_clipboard.items;if(null!=items&&0!=items.length){g_clipboardBase.PasteImagesBody="";g_clipboardBase.PasteImagesCount=items.length;g_clipboardBase.PasteImagesCounter=0;for(var i=0;i';if(g_clipboardBase.PasteImagesCounter==g_clipboardBase.PasteImagesCount){g_clipboardBase.CommonIframe_PasteStart(""+g_clipboardBase.PasteImagesBody+"");g_clipboardBase.PasteImagesBody="";g_clipboardBase.PasteImagesCounter=0;g_clipboardBase.PasteImagesCount= 0}};reader.onabort=reader.onerror=function(e){g_clipboardBase.PasteImagesCounter++;if(g_clipboardBase.PasteImagesCounter==g_clipboardBase.PasteImagesCount){g_clipboardBase.CommonIframe_PasteStart(""+g_clipboardBase.PasteImagesBody+"");g_clipboardBase.PasteImagesBody="";g_clipboardBase.PasteImagesCounter=0;g_clipboardBase.PasteImagesCount=0}};try{reader.readAsDataURL(blob)}catch(err){g_clipboardBase.PasteImagesCounter++}}else g_clipboardBase.PasteImagesCounter++;if(g_clipboardBase.PasteImagesCounter== g_clipboardBase.PasteImagesCount)g_clipboardBase.Paste_End();return false}}g_clipboardBase.Paste_End();return false},_private_onbeforepaste:function(e,isAttackEmulate){this._console_log("onbeforepaste");if(!this.Api.asc_IsFocus(true))return;{this.CommonDiv=this.CommonDiv_Check();this.CommonDiv_Start();this.CommonDiv.focus();this.StartFocus();this.CommonDiv_Select();return}return false},_private_onbeforecopy_select:function(){if(AscBrowser.isIE){this._console_log("onbeforecopy_select");this.CommonDiv= this.CommonDiv_Check();this.CommonDiv_Start();this.CommonDiv.innerHTML=" ";this.CommonDiv.focus();this.StartFocus();this.CommonDiv_Select()}},_private_onbeforecopy:function(e,isAttackEmulate){this._console_log("onbeforecopy");if(!this.Api.asc_IsFocus(true))return;{this.CommonDiv=this.CommonDiv_Check();this.CommonDiv_Start();this.CommonDiv.innerHTML=" ";this.CommonDiv.focus();this.StartFocus();this.CommonDiv_Select()}return false},Init:function(_api){this.Api=_api;window["AscCommon"].g_specialPasteHelper.Init(_api); this.ClosureParams.getData=function(type){var _clipboard=this._e&&this._e.clipboardData?this._e.clipboardData:window.clipboardData;if(!_clipboard||!_clipboard.getData)return null;var _type=type;if(AscBrowser.isIE&&(type=="text"||type=="text/plain"))_type="Text";try{return _clipboard.getData(_type)}catch(e){}return null};this.ClosureParams.setData=function(type,_data){var _clipboard=this._e&&this._e.clipboardData?this._e.clipboardData:window.clipboardData;if(!_clipboard||!_clipboard.setData)return null; var _type=type;if(AscBrowser.isIE&&(type=="text"||type=="text/plain"))_type="Text";try{_clipboard.setData(_type,_data)}catch(e){}};if(!AscBrowser.isIE){document.oncopy=function(e){return g_clipboardBase._private_oncopy(e)};document.oncut=function(e){return g_clipboardBase._private_oncut(e)};document.onpaste=function(e){return g_clipboardBase._private_onpaste(e)};document["onbeforecopy"]=function(e){return g_clipboardBase._private_onbeforecopy(e)};document["onbeforecut"]=function(e){return g_clipboardBase._private_onbeforecopy(e)}; document["onbeforepaste"]=function(e){return g_clipboardBase._private_onbeforepaste(e)}}else{document.addEventListener("copy",function(e){return g_clipboardBase._private_oncopy(e)});document.addEventListener("cut",function(e){return g_clipboardBase._private_oncut(e)});document.addEventListener("paste",function(e){return g_clipboardBase._private_onpaste(e)});document.addEventListener("beforepaste",function(e){return g_clipboardBase._private_onbeforepaste(e)});document.addEventListener("beforecopy", function(e){return g_clipboardBase._private_onbeforecopy(e)});document.addEventListener("beforecut",function(e){return g_clipboardBase._private_onbeforecopy(e)})}if(this.IsCopyCutOnlyInEditable||this.IsPasteOnlyInEditable)document.onkeydown=function(e){if(!g_clipboardBase.Api.asc_IsFocus(true)||g_clipboardBase.Api.isLongAction())return;var isAltGr=AscCommon.getAltGr(e);if(isAltGr)return;var isCtrl=e.ctrlKey===true||e.metaKey===true;var isShift=e.shiftKey;var keyCode=e.keyCode;if(g_clipboardBase.IsCopyCutOnlyInEditable){var bIsBeforeCopyCutEmulate= false;var _cut=false;if(isCtrl&&!isShift&&(keyCode==67||keyCode==88))bIsBeforeCopyCutEmulate=true;if(!isCtrl&&isShift&&keyCode==45){bIsBeforeCopyCutEmulate=true;_cut=true}if(bIsBeforeCopyCutEmulate){g_clipboardBase._console_log("emulate_beforecopycut");var isEmulate=false;try{isEmulate=_cut?document.execCommand("beforecut"):document.execCommand("beforecopy")}catch(err){}g_clipboardBase._private_onbeforecopy(undefined,!isEmulate)}}if(g_clipboardBase.IsPasteOnlyInEditable){var bIsBeforePasteEmulate= false;if(isCtrl&&!isShift&&keyCode==86)bIsBeforePasteEmulate=true;if(!isCtrl&&isShift&&keyCode==45)bIsBeforePasteEmulate=true;if(bIsBeforePasteEmulate){g_clipboardBase._console_log("emulate_beforepaste");var isEmulate=false;try{isEmulate=document.execCommand("beforepaste")}catch(err$9){}g_clipboardBase._private_onbeforepaste(undefined,!isEmulate)}}};if(AscBrowser.isSafari&&false){this.CommonDiv=this.CommonDiv_Check();setInterval(function(){if(g_clipboardBase.Api.asc_IsFocus(true))g_clipboardBase.CommonDiv.focus()}, 100)}},IsWorking:function(){return this.CopyFlag||this.PasteFlag?true:false},StartFocus:function(){this.EndFocus(false);this.CopyPasteFocus=true;this.CopyPasteFocusTimer=setTimeout(function(){g_clipboardBase.EndFocus()},1E3)},EndFocus:function(isFocusToEditor){this.CopyPasteFocus=false;if(-1!=this.CopyPasteFocusTimer){clearTimeout(this.CopyPasteFocusTimer);this.CopyPasteFocusTimer=-1;if(false!==isFocusToEditor&&null!=this.inputContext)if(this.inputContext.HtmlArea)this.inputContext.HtmlArea.focus()}}, IsFocus:function(){return this.CopyPasteFocus},CommonDiv_Check:function(){var ElemToSelect=document.getElementById(this.CommonDivId);if(!ElemToSelect){ElemToSelect=document.createElement("div");ElemToSelect.id=this.CommonDivId;ElemToSelect.className=this.CommonDivClassName;ElemToSelect.style.position="fixed";ElemToSelect.style.left="0px";ElemToSelect.style.top="-100px";ElemToSelect.style.width="10000px";ElemToSelect.style.height="100px";ElemToSelect.style.overflow="hidden";ElemToSelect.style.zIndex= -1E3;ElemToSelect.style.MozUserSelect="text";ElemToSelect.style.fontFamily="onlyofficeDefaultFont";ElemToSelect.style.fontSize="11pt";ElemToSelect.style.color="black";ElemToSelect.style["-khtml-user-select"]="text";ElemToSelect.style["-o-user-select"]="text";ElemToSelect.style["user-select"]="text";ElemToSelect.style["-webkit-user-select"]="text";ElemToSelect.setAttribute("contentEditable",this.isCopyOutEnabled());var _parent=""==this.CommonDivIdParent?document.body:document.getElementById(this.CommonDivIdParent); _parent.appendChild(ElemToSelect)}else ElemToSelect.setAttribute("contentEditable",this.isCopyOutEnabled());return ElemToSelect},CommonDiv_Select:function(){var ElemToSelect=this.CommonDiv;if(window.getSelection){var selection=window.getSelection();var rangeToSelect=document.createRange();var is_gecko=AscBrowser.isGecko;if(is_gecko){ElemToSelect.appendChild(document.createTextNode("\u00a0"));ElemToSelect.insertBefore(document.createTextNode("\u00a0"),ElemToSelect.firstChild);rangeToSelect.setStartAfter(ElemToSelect.firstChild); rangeToSelect.setEndBefore(ElemToSelect.lastChild)}else{var aChildNodes=ElemToSelect.childNodes;if(aChildNodes.length==1){var elem=aChildNodes[0];var wrap=document.createElement("b");wrap.setAttribute("style","font-weight:normal; background-color: transparent; color: transparent;");elem=ElemToSelect.removeChild(elem);wrap.appendChild(elem);ElemToSelect.appendChild(wrap)}rangeToSelect.selectNodeContents(ElemToSelect)}selection.removeAllRanges();selection.addRange(rangeToSelect)}else if(document.body.createTextRange){var rangeToSelect= document.body.createTextRange();rangeToSelect.moveToElementText(ElemToSelect);rangeToSelect.select()}},CommonDiv_Start:function(){this.ClosureParams.overflowBody=document.body.style.overflow;document.body.style.overflow="hidden";this.ClosureParams.backgroundcolorBody=document.body.style["background-color"];document.body.style["background-color"]="transparent";var ElemToSelect=this.CommonDiv;ElemToSelect.style.display="block";while(ElemToSelect.hasChildNodes())ElemToSelect.removeChild(ElemToSelect.lastChild); document.body.style.MozUserSelect="text";delete document.body.style["-khtml-user-select"];delete document.body.style["-o-user-select"];delete document.body.style["user-select"];document.body.style["-webkit-user-select"]="text";ElemToSelect.style.MozUserSelect="all"},CommonDiv_End:function(){var ElemToSelect=this.CommonDiv;if(ElemToSelect){ElemToSelect.style.display=AscBrowser.isSafari?"block":"none";ElemToSelect.style.MozUserSelect="none"}document.body.style.MozUserSelect="none";document.body.style["-khtml-user-select"]= "none";document.body.style["-o-user-select"]="none";document.body.style["user-select"]="none";document.body.style["-webkit-user-select"]="none";document.body.style["background-color"]=this.ClosureParams.backgroundcolorBody;document.body.style.overflow=this.ClosureParams.overflowBody;this.CopyFlag=false;this.bCut=false;this.EndFocus()},CommonDiv_Copy:function(){this.CopyFlag=true;this.CommonDiv=this.CommonDiv_Check();this.CommonDiv_Start();this.ClosureParams.isDivCopy=true;this.DivOnCopyHtmlPresent= false;this.DivOnCopyText="";this.LastCopyBinary=null;this.checkCopy(AscCommon.c_oAscClipboardDataFormat.Text|AscCommon.c_oAscClipboardDataFormat.Html|AscCommon.c_oAscClipboardDataFormat.Internal);this.ClosureParams.isDivCopy=false;if(!this.DivOnCopyHtmlPresent&&this.DivOnCopyText!="")this.CommonDiv.innerHTML=this.DivOnCopyText;this.DivOnCopyHtmlPresent=false;this.DivOnCopyText="";this.CommonDiv_Select();window.setTimeout(function(){g_clipboardBase.CommonDiv_End()},0)},CommonDiv_Execute_CopyCut:function(){if(this.IsCopyCutOnlyInEditable)this._private_onbeforecopy(undefined, true)},CommonIframe_PasteStart:function(_html_data,text_data){var ifr=document.getElementById(this.CommonIframeId);if(!ifr){ifr=document.createElement("iframe");ifr.name=this.CommonIframeId;ifr.id=this.CommonIframeId;ifr.style.position="absolute";ifr.style.top="-100px";ifr.style.left="0px";ifr.style.width="10000px";ifr.style.height="100px";ifr.style.overflow="hidden";ifr.style.zIndex=-1E3;ifr.setAttribute("sandbox","allow-same-origin");document.body.appendChild(ifr);this.CommonIframe=ifr}else ifr.style.width= "10000px";var frameWindow=window.frames[this.CommonIframeId];if(frameWindow){frameWindow.document.open();frameWindow.document.write(_html_data);frameWindow.document.close();if(null!=frameWindow.document&&null!=frameWindow.document.body){ifr.style.display="block";this.pastedFrom=definePastedFrom(frameWindow.document);this.Api.asc_PasteData(AscCommon.c_oAscClipboardDataFormat.HtmlElement,frameWindow.document.body,ifr,text_data)}}ifr.style.width="100px";g_clipboardBase.Paste_End()},CommonIframe_PasteEnd:function(){if(this.CommonIframe&& this.CommonIframe.style.display!="none"){this.CommonIframe.blur();this.CommonIframe.style.display="none"}},Paste_End:function(){this.CommonIframe_PasteEnd();this.Api.decrementCounterLongAction();this.PasteFlag=false;this.EndFocus();if(this.needClearBuffer){this.ClearBuffer();this.needClearBuffer=false}},pushData:function(_format,_data){if(null==this.LastCopyBinary)this.LastCopyBinary=[];this.LastCopyBinary.push({type:_format,data:_data});if(this.ClosureParams.isDivCopy===true){if(!this.isCopyOutEnabled())return; if(_format==AscCommon.c_oAscClipboardDataFormat.Html){this.CommonDiv.innerHTML=_data;this.DivOnCopyHtmlPresent=true}if(_format==AscCommon.c_oAscClipboardDataFormat.Text)this.DivOnCopyText=_data;return}var _data_format="";switch(_format){case AscCommon.c_oAscClipboardDataFormat.Html:_data_format="text/html";break;case AscCommon.c_oAscClipboardDataFormat.Text:_data_format="text/plain";break;case AscCommon.c_oAscClipboardDataFormat.Internal:_data_format="text/x-custom";break;default:break}if(_data_format!= ""&&_data!==null&&this.isCopyOutEnabled())if(_data_format=="text/x-custom")this.ClosureParams.setData(_data_format,"asc_internalData2;"+_data);else this.ClosureParams.setData(_data_format,_data)},Button_Copy:function(){if(this.inputContext){if(this.inputContext.isHardCheckKeyboard)this.inputContext.enableVirtualKeyboard_Hard();this.inputContext.HtmlArea.focus()}this.Api.asc_enableKeyEvents(true,true);this.CommonDiv_Execute_CopyCut();var _ret=false;try{_ret=document.execCommand("copy")}catch(err){_ret= false}if(!_ret){this.LastCopyBinary=null;this.checkCopy(AscCommon.c_oAscClipboardDataFormat.Text|AscCommon.c_oAscClipboardDataFormat.Html|AscCommon.c_oAscClipboardDataFormat.Internal)}return _ret},Button_Cut:function(){if(this.inputContext){if(this.inputContext.isHardCheckKeyboard)this.inputContext.enableVirtualKeyboard_Hard();this.inputContext.HtmlArea.focus()}this.Api.asc_enableKeyEvents(true,true);this.CommonDiv_Execute_CopyCut();var _ret=false;try{_ret=document.execCommand("cut")}catch(err){_ret= false}if(!_ret){this.LastCopyBinary=null;this.bCut=true;this.checkCopy(AscCommon.c_oAscClipboardDataFormat.Text|AscCommon.c_oAscClipboardDataFormat.Html|AscCommon.c_oAscClipboardDataFormat.Internal);this.Api.asc_SelectionCut();this.bCut=false}return _ret},Button_Paste:function(){if(this.inputContext){if(this.inputContext.isHardCheckKeyboard)this.inputContext.enableVirtualKeyboard_Hard();this.inputContext.HtmlArea.focus()}this.Api.asc_enableKeyEvents(true,true);var _ret=false;try{_ret=document.execCommand("paste")}catch(err){_ret= false}if(!_ret&&null!=this.LastCopyBinary){var _data=null;var _isInternal=false;for(var i=0;i0)this.Api.asc_PasteData(this.LastCopyBinary[0].type,this.LastCopyBinary[0].data)}return _ret},ClearBuffer:function(){if(-1!=this.clearBufferTimerId)clearTimeout(this.clearBufferTimerId); this.clearBufferTimerId=setTimeout(function(){if(AscCommon.g_clipboardBase)AscCommon.g_clipboardBase.clearBufferTimerId=-1},500);this.Button_Copy()},isCopyOutEnabled:function(){if(this.Api&&this.Api.isCopyOutEnabled)return this.Api.isCopyOutEnabled();return true}};function definePastedFrom(doc){if(!doc)return null;var res=null;var metaTags=doc.getElementsByTagName("meta");for(var i=0;i>1)+"px;top:"+-this.HtmlAreaOffset+"px;";_style+="background:transparent;border:none;position:absolute;text-shadow:0 0 0 #000;outline:none;color:transparent;width:"+this.HtmlAreaWidth+"px;height:50px;";_style+="overflow:hidden;padding:0px;margin:0px;font-family:arial;resize:none;font-weight:normal;box-sizing:content-box;-moz-box-sizing:content-box;-webkit-box-sizing:content-box;"; _style+="touch-action: none;-webkit-touch-callout: none;color:transparent;caret-color:transparent;";_style+=AscCommon.AscBrowser.isAppleDevices?"font-size:0px;":"font-size:8px;";this.HtmlArea.setAttribute("style",_style);this.HtmlArea.setAttribute("spellcheck",false);this.HtmlArea.setAttribute("autocapitalize","none");this.HtmlArea.setAttribute("autocomplete","off");this.HtmlArea.setAttribute("autocorrect","off");this.HtmlDiv.appendChild(this.HtmlArea);if(true){var oHtmlDivScrollable=document.createElement("div"); oHtmlDivScrollable.id="area_id_main";oHtmlDivScrollable.setAttribute("style","background:transparent;border:none;position:absolute;padding:0px;margin:0px;z-index:0;pointer-events:none;");var parentStyle=getComputedStyle(oHtmlParent);oHtmlDivScrollable.style.left=parentStyle.left;oHtmlDivScrollable.style.top=parentStyle.top;oHtmlDivScrollable.style.width=parentStyle.width;oHtmlDivScrollable.style.height=parentStyle.height;oHtmlDivScrollable.style.overflow="hidden";oHtmlDivScrollable.appendChild(this.HtmlDiv); oHtmlParent.parentNode.appendChild(oHtmlDivScrollable)}else oHtmlParent.appendChild(this.HtmlDiv);var oThis=this;this.HtmlArea["onkeydown"]=function(e){if(AscCommon.AscBrowser.isSafariMacOs){var cmdButton=e.ctrlKey||e.metaKey?true:false;var buttonCode=e.keyCode==67||e.keyCode==88||e.keyCode==86;if(cmdButton&&buttonCode)oThis.IsDisableKeyPress=true;else oThis.IsDisableKeyPress=false}return oThis.onKeyDown(e)};this.HtmlArea["onkeypress"]=function(e){if(oThis.IsDisableKeyPress==true){oThis.IsDisableKeyPress= false;var cmdButton=e.ctrlKey||e.metaKey?true:false;if(cmdButton)return}return oThis.onKeyPress(e)};this.HtmlArea["onkeyup"]=function(e){oThis.IsDisableKeyPress=false;return oThis.onKeyUp(e)};this.HtmlArea.addEventListener("input",function(e){return oThis.onInput(e)},false);this.HtmlArea.addEventListener("compositionstart",function(e){return oThis.onCompositionStart(e)},false);this.HtmlArea.addEventListener("compositionupdate",function(e){return oThis.onCompositionUpdate(e)},false);this.HtmlArea.addEventListener("compositionend", function(e){return oThis.onCompositionEnd(e)},false);this.show();this.Api.Input_UpdatePos();if(AscCommon.AscBrowser.isAndroid)this.HtmlArea.onclick=function(e){var _this=AscCommon.g_inputContext;if(-1!=_this.virtualKeyboardClickTimeout){clearTimeout(_this.virtualKeyboardClickTimeout);_this.virtualKeyboardClickTimeout=-1}_this.apiCompositeEnd();if(!_this.virtualKeyboardClickPrevent)return;_this.setReadOnlyWrapper(true);_this.virtualKeyboardClickPrevent=false;AscCommon.stopEvent(e);_this.virtualKeyboardClickTimeout= setTimeout(function(){_this.setReadOnlyWrapper(false);_this.virtualKeyboardClickTimeout=-1},1);return false}},onResize:function(_editorContainerId){var _elem=document.getElementById("area_id_main");var _elemSrc=document.getElementById(_editorContainerId);if(!_elem||!_elemSrc)return;if(AscCommon.AscBrowser.isChrome){var rectObject=_elemSrc.getBoundingClientRect();this.FixedPosCheckElementX=rectObject.left;this.FixedPosCheckElementY=rectObject.top}var _width=_elemSrc.style.width;if((null==_width||""== _width)&&window.getComputedStyle){var _s=window.getComputedStyle(_elemSrc);_elem.style.left=_s.left;_elem.style.top=_s.top;_elem.style.width=_s.width;_elem.style.height=_s.height}else{_elem.style.left=_elemSrc.style.left;_elem.style.top=_elemSrc.style.top;_elem.style.width=_width;_elem.style.height=_elemSrc.style.height}if(this.Api.isMobileVersion){var _elem1=document.getElementById("area_id_parent");var _elem2=document.getElementById("area_id");_elem1.parentNode.style.pointerEvents="";_elem1.style.left= "0px";_elem1.style.top="-1000px";_elem1.style.right="0px";_elem1.style.bottom="-100px";_elem1.style.width="auto";_elem1.style.height="auto";_elem2.style.left="0px";_elem2.style.top="0px";_elem2.style.right="0px";_elem2.style.bottom="0px";_elem2.style.width="100%";_elem2.style.height="100%";if(AscCommon.AscBrowser.isIE){document.body.style["msTouchAction"]="none";document.body.style["touchAction"]="none"}}var _editorSdk=document.getElementById("editor_sdk");this.editorSdkW=_editorSdk.clientWidth;this.editorSdkH= _editorSdk.clientHeight},checkFocus:function(){if(this.Api.asc_IsFocus()&&!AscCommon.g_clipboardBase.IsFocus()&&!AscCommon.g_clipboardBase.IsWorking())if(document.activeElement!=this.HtmlArea)this.HtmlArea.focus()},move:function(x,y){if(this.Api.isMobileVersion)return;var oTarget=document.getElementById(this.TargetId);if(!oTarget)return;var xPos=x?x:parseInt(oTarget.style.left);var yPos=(y?y:parseInt(oTarget.style.top))+parseInt(oTarget.style.height);if(AscCommon.AscBrowser.isSafari&&AscCommon.AscBrowser.isMobile)xPos= -100;if(!this.isDebug&&!this.isSystem){this.HtmlDiv.style.left=xPos+this.FixedPosCheckElementX+"px";this.HtmlDiv.style.top=yPos+this.FixedPosCheckElementY+this.TargetOffsetY+this.HtmlAreaOffset+"px";this.HtmlArea.scrollTop=this.HtmlArea.scrollHeight}else this.debugCalculatePlace(xPos+this.FixedPosCheckElementX,yPos+this.FixedPosCheckElementY+this.TargetOffsetY);if(window.g_asc_plugins)window.g_asc_plugins.onPluginEvent("onTargetPositionChanged")},emulateKeyDownApi:function(code){var _e={altKey:false, ctrlKey:false,shiftKey:false,target:null,charCode:0,which:code,keyCode:code,code:"",preventDefault:function(){},stopPropagation:function(){}};this.Api.onKeyDown(_e);this.Api.onKeyUp(_e)},clear:function(isFromFocus){if(!this.TextArea_Not_ContentEditableDiv)this.HtmlArea.innerHTML="";else this.HtmlArea.value="";if(isFromFocus!==true)this.HtmlArea.focus();this.TextBeforeComposition="";this.Text="";this.Target=0;this.CompositionStart=0;this.CompositionEnd=0;this.IsComposition=false;this.keyPressInput= "";if(window.g_asc_plugins)window.g_asc_plugins.onPluginEvent("onInputHelperClear")},getAreaValue:function(){return this.TextArea_Not_ContentEditableDiv?this.HtmlArea.value:this.HtmlArea.innerText},setReadOnly:function(isLock){if(isLock)this.ReadOnlyCounter++;else this.ReadOnlyCounter--;this.setReadOnlyWrapper(0>=this.ReadOnlyCounter?false:true)},setReadOnlyWrapper:function(val){this.HtmlArea.readOnly=this.Api.isViewMode?true:val},show:function(){if(this.isDebug||this.isSystem){this.log("ti: show"); document.getElementById("area_id_main").style.zIndex=10;this.HtmlArea.style.top="0px";this.HtmlArea.style.width="100%";this.HtmlArea.style.height="100%";this.HtmlArea.style.background="#FFFFFF";this.HtmlArea.style.color="black";this.HtmlDiv.style.zIndex=90;this.HtmlDiv.style.border="2px solid #4363A4";this.isShow=true}},unshow:function(isAttack){if(this.isDebug||this.isSystem||true==isAttack){this.log("ti: unshow");document.getElementById("area_id_main").style.zIndex=0;this.HtmlArea.style.top=-this.HtmlAreaOffset+ "px";this.HtmlArea.style.width="1000px";this.HtmlArea.style.height="50px";this.HtmlArea.style.background="transparent";this.HtmlArea.style.color="transparent";this.HtmlDiv.style.zIndex=0;this.HtmlDiv.style.border="none";this.isShow=false}},debugCalculatePlace:function(x,y){var _left=x;var _top=y;if(undefined==_left)_left=parseInt(this.HtmlDiv.style.left);if(undefined==_top)_top=parseInt(this.HtmlDiv.style.top);var _r_max=this.editorSdkW;var _b_max=this.editorSdkH;_r_max-=60;if(_r_max-_left>50)this.debugTexBoxMaxW= _r_max-_left;else{_left=_r_max-50;this.debugTexBoxMaxW=50}_b_max-=40;if(_b_max-_top>50)this.debugTexBoxMaxH=_b_max-_top;else{_top=_b_max-50;this.debugTexBoxMaxH=50}if(AscCommon.AscBrowser.isSafari&&AscCommon.AscBrowser.isMobile)_left=-100;this.HtmlDiv.style.left=_left+"px";this.HtmlDiv.style.top=_top+"px";var _height=22;var _t=this.getAreaValue();if(0!=_t.length){var _editorSdk=document.getElementById("editor_sdk");var _p=document.createElement("p");_p.style.zIndex="-1";_p.style.position="absolute"; _p.style.fontFamily="arial";_p.style.fontSize="12pt";_p.style.left="0px";_p.style.width=this.debugTexBoxMaxW+"px";_editorSdk.appendChild(_p);_t=_t.replace(/ /g," ");_p.innerHTML=""+_t+"";var _width=_p.firstChild.offsetWidth;_width=Math.min(_width+20,this.debugTexBoxMaxW);if(AscCommon.AscBrowser.isIE)_width+=10;var area=document.createElement("textarea");area.style.zIndex="-1";area.id="area2_id";area.rows=1;area.setAttribute("style","font-family:arial;font-size:12pt;position:absolute;resize:none;padding:0px;margin:0px;font-weight:normal;box-sizing:content-box;-moz-box-sizing:content-box;-webkit-box-sizing:content-box;"); area.style.overflow="hidden";area.style.width=_width+"px";_editorSdk.appendChild(area);area.value=this.getAreaValue();_height=area.clientHeight;if(area.scrollHeight>_height)_height=area.scrollHeight;_editorSdk.removeChild(_p);_editorSdk.removeChild(area)}if(_height>this.debugTexBoxMaxH)_height=this.debugTexBoxMaxH;this.HtmlDiv.style.width=_width+"px";this.HtmlDiv.style.height=_height+"px";var oldZindex=parseInt(this.HtmlDiv.style.zIndex);var newZindex=oldZindex==90?"89":"90";this.HtmlDiv.style.zIndex= newZindex},onInput:function(e,isFromCompositionUpdate){if(this.Api.isLongAction()||this.Api.isViewMode){AscCommon.stopEvent(e);return false}if(this.isSystem){if(!this.isShow)this.show();this.debugCalculatePlace(undefined,undefined);return}if(this.isKeyPressOnUp&&this.keyPressOnUpCodes.length>0){if(!this.TextArea_Not_ContentEditableDiv)this.HtmlArea.innerHTML="";else this.HtmlArea.value="";this.TextBeforeComposition="";this.Text="";AscCommon.stopEvent(e);return false}this.log("ti: onInput");this.Text= this.getAreaValue();this.Text=this.Text.split(" ").join(" ");var codes=[];if(this.IsComposition||this.ApiIsComposition){var ieStart=-1;var ieEnd=-1;if(true){var target=e.target;if(target["msGetInputContext"]){var ctx=target["msGetInputContext"]();if(ctx){ieStart=ctx["compositionStartOffset"];ieEnd=ctx["compositionEndOffset"]}}}this.CompositionEnd=this.Text.length;this.CompositionStart=this.TextBeforeComposition.length;var textReplace=this.Text.substr(this.CompositionStart);var iter;for(iter= textReplace.getUnicodeIterator();iter.check();iter.next())codes.push(iter.value());var isAsync=AscFonts.FontPickerByCharacter.checkTextLight(codes,true);if(!isAsync){if(ieStart>this.CompositionStart){textReplace=textReplace.substr(0,ieStart-this.CompositionStart);codes=[];for(iter=textReplace.getUnicodeIterator();iter.check();iter.next())codes.push(iter.value());this.apiCompositeReplace(codes);this.apiCompositeEnd();this.TextBeforeComposition=this.Text.substr(0,ieStart);this.apiCompositeStart();this.CompositionStart= ieStart;codes=[];textReplace=this.Text.substr(this.CompositionStart);for(iter=textReplace.getUnicodeIterator();iter.check();iter.next())codes.push(iter.value());this.apiCompositeReplace(codes)}else this.apiCompositeReplace(codes);if(!this.IsComposition){this.apiCompositeEnd();this.TextBeforeComposition=this.Text}}else{AscFonts.FontPickerByCharacter.loadFonts(this,function(){this.apiCompositeReplace(codes);this.apiCompositeEnd();this.clear();this.setReadOnly(false)});AscCommon.stopEvent(e);this.setReadOnly(true); return false}}else{var textToApi=this.Text.substr(this.TextBeforeComposition.length);for(var iter=textToApi.getUnicodeIterator();iter.check();iter.next())codes.push(iter.value());if(codes.length>0)this.apiInputText(codes);this.TextBeforeComposition=this.Text}if(!this.IsComposition)if(this.Text.length>0){var _lastCode=this.Text.charCodeAt(this.Text.length-1);if(_lastCode==12290||_lastCode==46){AscCommon.stopEvent(e);if(AscCommon.AscBrowser.isIE&&!AscCommon.AscBrowser.isIeEdge)setTimeout(function(){window["AscCommon"].g_inputContext.clear(); window["AscCommon"].g_inputContext.HtmlArea.focus()},0);else this.clear();return false}}},emulateNativeKeyDown:function(e,target){var oEvent=document.createEvent("KeyboardEvent");Object.defineProperty(oEvent,"keyCode",{get:function(){return this.keyCodeVal}});Object.defineProperty(oEvent,"which",{get:function(){return this.keyCodeVal}});Object.defineProperty(oEvent,"shiftKey",{get:function(){return this.shiftKeyVal}});Object.defineProperty(oEvent,"altKey",{get:function(){return this.altKeyVal}}); Object.defineProperty(oEvent,"metaKey",{get:function(){return this.metaKeyVal}});Object.defineProperty(oEvent,"ctrlKey",{get:function(){return this.ctrlKeyVal}});if(AscCommon.AscBrowser.isIE)oEvent.preventDefault=function(){try{Object.defineProperty(this,"defaultPrevented",{get:function(){return true}})}catch(err){}};var k=e.keyCode;if(oEvent.initKeyboardEvent)oEvent.initKeyboardEvent("keydown",true,true,window,false,false,false,false,k,k);else oEvent.initKeyEvent("keydown",true,true,window,false, false,false,false,k,0);oEvent.keyCodeVal=k;oEvent.shiftKeyVal=e.shiftKey;oEvent.altKeyVal=e.altKey;oEvent.metaKeyVal=e.metaKey;oEvent.ctrlKeyVal=e.ctrlKey;var _elem=target?target:_getElementKeyboardDown(this.nativeFocusElement,3);_elem.dispatchEvent(oEvent);return oEvent.defaultPrevented},isSpaceSymbol:function(e){if(e.keyCode==32)return true;if(e.keyCode==229&&(e.code=="space"||e.code=="Space"||e.key=="Spacebar"))return true;return false},systemInputEnable:function(isEnabled){if(this.isSystem==isEnabled)return; this.isSystem=isEnabled;this.HtmlArea.style.left=this.isSystem?"0px":"-"+(this.HtmlAreaWidth>>1)+"px";this.clear();if(this.isShow)this.unshow(true);if(this.Api.WordControl&&this.Api.WordControl.m_oLogicDocument&&this.Api.WordControl.m_oLogicDocument.Document_UpdateSelectionState)this.Api.WordControl.m_oLogicDocument.Document_UpdateSelectionState()},debugInputEnable:function(isEnabled){if(this.isDebug==isEnabled)return;this.isDebug=isEnabled;this.HtmlArea.style.left=this.isDebug?"0px":"-"+(this.HtmlAreaWidth>> 1)+"px"},apiInputText:function(codes){var isAsync=AscFonts.FontPickerByCharacter.checkTextLight(codes,true);if(!isAsync){this.apiCompositeStart();this.apiCompositeReplace(codes);this.apiCompositeEnd()}else{AscFonts.FontPickerByCharacter.loadFonts(this,function(){this.apiCompositeStart();this.apiCompositeReplace(codes);this.apiCompositeEnd();this.setReadOnly(false)});this.setReadOnly(true);return false}},onKeyDown:function(e){if(this.Api.isLongAction()){AscCommon.stopEvent(e);return false}if(this.isInputHelpersPresent)switch(e.keyCode){case 9:case 13:case 38:case 40:case 33:case 34:case 35:case 36:case 27:{window.g_asc_plugins.onPluginEvent2("onKeyDown", {"keyCode":e.keyCode},this.isInputHelpers);AscCommon.stopEvent(e);return false}case 32:{if(window.g_asc_plugins)window.g_asc_plugins.onPluginEvent("onInputHelperInput",{"text":this.keyPressInput})}default:break}else if(32==e.keyCode);if(this.isSystem&&this.isShow){if(e.keyCode==13){var text=this.getAreaValue();var codes=[];for(var iter=text.getUnicodeIterator();iter.check();iter.next())codes.push(iter.value());this.apiInputText(codes);this.clear();this.unshow();AscCommon.stopEvent(e);return false}else if(e.keyCode== 27){this.clear();this.unshow();AscCommon.stopEvent(e);return false}return}if(null!=this.nativeFocusElement)if(this.emulateNativeKeyDown(e)){e.preventDefault();return false}var _code=e.keyCode;if(_code!=8&&_code!=46)this.KeyDownFlag=true;AscCommon.check_KeyboardEvent(e);var arrCodes=this.Api.getAddedTextOnKeyDown(AscCommon.global_keyboardEvent);var isAsync=AscFonts.FontPickerByCharacter.checkTextLight(arrCodes,true);if(isAsync){AscFonts.FontPickerByCharacter.loadFonts(this,function(){this.onKeyDown(e); this.onKeyUp(e);this.setReadOnly(false)});AscCommon.stopEvent(e);this.setReadOnly(true);return false}var ret=this.Api.onKeyDown(e);switch(e.keyCode){case 8:{var oldKeyPressInput=this.keyPressInput;this.clear();if(oldKeyPressInput.length>1){this.keyPressInput=oldKeyPressInput.substr(0,oldKeyPressInput.length-1);if(window.g_asc_plugins)window.g_asc_plugins.onPluginEvent("onInputHelperInput",{"text":this.keyPressInput})}return false}case 9:case 13:case 37:case 38:case 39:case 40:case 33:case 34:case 35:case 36:{this.clear(); return false}case 46:case 45:{if(!AscCommon.global_keyboardEvent.CtrlKey&&!AscCommon.global_keyboardEvent.ShiftKey){this.clear();return false}}default:break}if(e.keyCode==32&&AscCommon.global_keyboardEvent.CtrlKey&&!AscCommon.global_keyboardEvent.ShiftKey)if(window.g_asc_plugins)window.g_asc_plugins.onPluginEvent("onClick");return ret},onKeyPress:function(e){if(this.Api.isLongAction()||!this.Api.asc_IsFocus()||this.Api.isViewMode){AscCommon.stopEvent(e);return false}if(this.isSystem)return;if(this.KeyDownFlag)this.KeyPressFlag= true;if(this.IsComposition)return;if(e.which==13&&e.keyCode==13||e.which==10&&e.keyCode==10){AscCommon.stopEvent(e);return false}var c=e.which||e.keyCode;var isAsync=c>=32?AscFonts.FontPickerByCharacter.checkTextLight([c],true):false;if(isAsync){AscFonts.FontPickerByCharacter.loadFonts(this,function(){this.apiCompositeStart();this.apiCompositeReplace([c]);this.apiCompositeEnd();this.setReadOnly(false)});AscCommon.stopEvent(e);this.setReadOnly(true);return false}if(this.isKeyPressOnUp){var isSaveCode= true;switch(e.which){case 46:{isSaveCode=false;break}default:break}if(isSaveCode){if(this.isKeyPressOnUpStackedMode)this.keyPressOnUpCodes.push({which:e.which,charCode:e.charCode,keyCode:e.keyCode,shiftKey:e.shiftKey,ctrlKey:e.ctrlKey,metaKey:e.metaKey,altKey:e.altKey,preventDefault:function(){}});return}}var ret=this.Api.onKeyPress(e);switch(e.which){case 46:{AscCommon.stopEvent(e);this.clear();return false}default:break}this.keyPressInput+=String.fromCharCode(e.which);if(window.g_asc_plugins)window.g_asc_plugins.onPluginEvent("onInputHelperInput", {"text":this.keyPressInput});AscCommon.stopEvent(e);return ret},onKeyUp:function(e){if(this.Api.isLongAction()){AscCommon.stopEvent(e);return false}if(this.isSystem&&this.isShow)return;if(this.isKeyPressOnUp&&this.keyPressOnUpCodes.length>0){this.isKeyPressOnUp=false;for(var i=0;i0){var range=sel.getRangeAt(0);_offset=range.endOffset}}return _offset},checkTargetPosition:function(isCorrect){var _offset=this.getAreaPos();if(false!==isCorrect){var _value=this.getAreaValue();_offset-=_value.length-this.compositionValue.length}if(!this.IsLockTargetMode)if(_offset==0&&this.compositionValue.length==1)_offset=1;this.Api.Set_CursorPosInCompositeText(_offset); this.unlockTarget()},lockTarget:function(){if(!this.IsLockTargetMode)return;if(-1!=this.LockerTargetTimer)clearTimeout(this.LockerTargetTimer);this.Api.asc_LockTargetUpdate(true);var oThis=this;this.LockerTargetTimer=setTimeout(function(){oThis.unlockTarget()},1E3)},unlockTarget:function(){if(!this.IsLockTargetMode)return;if(-1!=this.LockerTargetTimer)clearTimeout(this.LockerTargetTimer);this.LockerTargetTimer=-1;this.Api.asc_LockTargetUpdate(false)},clearLastCompositeText:function(){this.LastReplaceText= [];this.IsLastReplaceFlag=false},apiCompositeStart:function(){},apiCompositeReplace:function(_value){if(this.Api.isLongAction())return false;if(!this.ApiIsComposition){this.Api.Begin_CompositeInput();this.clearLastCompositeText()}this.ApiIsComposition=true;if(this.IsLastReplaceFlag)if(_value.length==this.LastReplaceText.length){var isEqual=true;for(var nC=0;nC<_value.length;nC++)if(_value[nC]!=this.LastReplaceText[nC]){isEqual=false;break}if(isEqual)return}this.Api.Replace_CompositeText(_value);if(window.g_asc_plugins){this.keyPressInput= String.fromCodePoint.apply(this,_value);window.g_asc_plugins.onPluginEvent("onInputHelperInput",{"text":this.keyPressInput})}this.LastReplaceText=_value.slice();this.IsLastReplaceFlag=true},apiCompositeEnd:function(){if(!this.ApiIsComposition)return;this.ApiIsComposition=false;this.Api.End_CompositeInput();this.clearLastCompositeText()},onCompositionStart:function(e){if(this.isSystem)return;this.IsComposition=true;this.keyPressOnUpCodes=[]},onCompositionUpdate:function(e){if(this.isSystem)return; this.IsComposition=true;this.keyPressOnUpCodes=[];this.onInput(e,true)},onCompositionEnd:function(e){if(this.isSystem)return;this.IsComposition=false;this.onInput(e,true)},setInterfaceEnableKeyEvents:function(value){this.InterfaceEnableKeyEvents=value;if(true==this.InterfaceEnableKeyEvents){if(document.activeElement){var _id=document.activeElement.id;if(_id=="area_id"||window.g_asc_plugins&&window.g_asc_plugins.checkRunnedFrameId(_id))return}this.HtmlArea.focus()}},externalEndCompositeInput:function(){this.clear()}, externalChangeFocus:function(){if(!this.IsComposition)return false;setTimeout(function(){window["AscCommon"].g_inputContext.clear()},10);return true},isCompositionProcess:function(){return this.IsComposition},preventVirtualKeyboard:function(e){if(this.isHardCheckKeyboard)return;if(AscCommon.AscBrowser.isAndroid){this.setReadOnlyWrapper(true);this.virtualKeyboardClickPrevent=true;this.virtualKeyboardClickTimeout=setTimeout(function(){window["AscCommon"].g_inputContext.setReadOnlyWrapper(false);window["AscCommon"].g_inputContext.virtualKeyboardClickTimeout= -1},1)}},enableVirtualKeyboard:function(){if(this.isHardCheckKeyboard)return;if(AscCommon.AscBrowser.isAndroid){if(-1!=this.virtualKeyboardClickTimeout){clearTimeout(this.virtualKeyboardClickTimeout);this.virtualKeyboardClickTimeout=-1}this.setReadOnlyWrapper(false);this.virtualKeyboardClickPrevent=false}},preventVirtualKeyboard_Hard:function(){this.setReadOnlyWrapper(true)},enableVirtualKeyboard_Hard:function(){this.setReadOnlyWrapper(false)}};function _getAttirbute(_elem,_attr,_depth){var _elemTest= _elem;for(var _level=0;_elemTest&&_level<_depth;++_level,_elemTest=_elemTest.parentNode){var _res=_elemTest.getAttribute?_elemTest.getAttribute(_attr):null;if(null!=_res)return _res}return null}function _getElementKeyboardDown(_elem,_depth){var _elemTest=_elem;for(var _level=0;_elemTest&&_level<_depth;++_level,_elemTest=_elemTest.parentNode){var _res=_elemTest.getAttribute?_elemTest.getAttribute("oo_editor_keyboard"):null;if(null!=_res)return _elemTest}return null}function _getDefaultKeyboardInput(_elem, _depth){var _elemTest=_elem;for(var _level=0;_elemTest&&_level<_depth;++_level,_elemTest=_elemTest.parentNode){var _name=" "+_elemTest.className+" ";if(_name.indexOf(" dropdown-menu")>-1||_name.indexOf(" dropdown-toggle ")>-1||_name.indexOf(" dropdown-submenu ")>-1||_name.indexOf(" canfocused ")>-1)return"true"}return null}window["AscCommon"]=window["AscCommon"]||{};window["AscCommon"].CTextInput=CTextInput;window["AscCommon"].InitBrowserInputContext=function(api,target_id,parent_id){if(window["AscCommon"].g_inputContext)return; window["AscCommon"].g_inputContext=new CTextInput(api);window["AscCommon"].g_inputContext.init(target_id,parent_id);window["AscCommon"].g_clipboardBase.Init(api);window["AscCommon"].g_clipboardBase.inputContext=window["AscCommon"].g_inputContext;if(window["AscCommon"].TextBoxInputMode===true)window["AscCommon"].g_inputContext.systemInputEnable(true);document.addEventListener("focus",function(e){var t=window["AscCommon"].g_inputContext;var _oldNativeFE=t.nativeFocusElement;t.nativeFocusElement=e.target; if(t.IsComposition){t.apiCompositeEnd();t.externalEndCompositeInput()}if(!t.isSystem&&!t.isNoClearOnFocus)t.clear(true);t.isNoClearOnFocus=false;var _nativeFocusElementNoRemoveOnElementFocus=t.nativeFocusElementNoRemoveOnElementFocus;t.nativeFocusElementNoRemoveOnElementFocus=false;if(t.InterfaceEnableKeyEvents==false){t.nativeFocusElement=null;return}if(t.nativeFocusElement&&t.nativeFocusElement.id==t.HtmlArea.id){t.Api.asc_enableKeyEvents(true,true);if(_nativeFocusElementNoRemoveOnElementFocus)t.nativeFocusElement= _oldNativeFE;else t.nativeFocusElement=null;return}if(t.nativeFocusElement&&t.nativeFocusElement.id==window["AscCommon"].g_clipboardBase.CommonDivId){t.nativeFocusElement=null;return}t.nativeFocusElementNoRemoveOnElementFocus=false;var _isElementEditable=false;if(t.nativeFocusElement){var _name=t.nativeFocusElement.nodeName;if(_name)_name=_name.toUpperCase();if("INPUT"==_name||"TEXTAREA"==_name)_isElementEditable=true;else if("DIV"==_name)if(t.nativeFocusElement.getAttribute("contenteditable")=="true")_isElementEditable= true}if("IFRAME"==_name){t.Api.asc_enableKeyEvents(false,true);t.nativeFocusElement=null;return}var _oo_editor_input=_getAttirbute(t.nativeFocusElement,"oo_editor_input",3);var _oo_editor_keyboard=_getAttirbute(t.nativeFocusElement,"oo_editor_keyboard",3);if(!_oo_editor_input&&!_oo_editor_keyboard)_oo_editor_input=_getDefaultKeyboardInput(t.nativeFocusElement,3);if(_oo_editor_keyboard=="true")_oo_editor_input=undefined;if(_oo_editor_input=="true"){t.Api.asc_enableKeyEvents(false,true);t.nativeFocusElement= null;return}if(_isElementEditable&&_oo_editor_input!="false"){t.Api.asc_enableKeyEvents(false,true);t.nativeFocusElement=null;return}if(_oo_editor_keyboard!="true")t.nativeFocusElement=null;var _elem=t.nativeFocusElement;t.nativeFocusElementNoRemoveOnElementFocus=true;AscCommon.AscBrowser.isMozilla?setTimeout(function(){t.HtmlArea.focus()},0):t.HtmlArea.focus();t.nativeFocusElement=_elem;t.Api.asc_enableKeyEvents(true,true)},true);if(!api.isMobileVersion&&!api.isEmbedVersion)window["AscCommon"].g_inputContext.HtmlArea.focus()}; window["SetInputDebugMode"]=function(){if(!window["AscCommon"].g_inputContext)return;window["AscCommon"].g_inputContext.debugInputEnable(true);window["AscCommon"].g_inputContext.show()}})(window);"use strict";(function(window,undefined){function COleSize(w,h){this.w=w;this.h=h}COleSize.prototype.Write_ToBinary=function(Writer){Writer.WriteLong(this.w);Writer.WriteLong(this.h)};COleSize.prototype.Read_FromBinary=function(Reader){this.w=Reader.GetLong();this.h=Reader.GetLong()};AscDFH.changesFactory[AscDFH.historyitem_ImageShapeSetData]= AscDFH.CChangesDrawingsString;AscDFH.changesFactory[AscDFH.historyitem_ImageShapeSetApplicationId]=AscDFH.CChangesDrawingsString;AscDFH.changesFactory[AscDFH.historyitem_ImageShapeSetPixSizes]=AscDFH.CChangesDrawingsObjectNoId;AscDFH.changesFactory[AscDFH.historyitem_ImageShapeSetObjectFile]=AscDFH.CChangesDrawingsString;AscDFH.changesFactory[AscDFH.historyitem_ImageShapeSetOleType]=AscDFH.CChangesDrawingsLong;AscDFH.drawingsConstructorsMap[AscDFH.historyitem_ChartStyleEntryDefRPr]=AscCommonWord.CTextPr; function CChangesOleObjectBinary(Class,Old,New,Color){AscDFH.CChangesBaseProperty.call(this,Class,Old,New,Color)}CChangesOleObjectBinary.prototype=Object.create(AscDFH.CChangesBaseProperty.prototype);CChangesOleObjectBinary.prototype.Type=AscDFH.historyitem_ImageShapeSetBinaryData;CChangesOleObjectBinary.prototype.private_SetValue=function(Value){this.Class.m_aBinaryData=Value};CChangesOleObjectBinary.prototype.WriteToBinary=function(Writer){Writer.WriteBool(this.New!==null);if(this.New!==null){Writer.WriteLong(this.New.length); Writer.WriteBuffer(this.New,0,this.New.length)}};CChangesOleObjectBinary.prototype.ReadFromBinary=function(Reader){if(Reader.GetBool()){var length=Reader.GetLong();this.New=Reader.GetBuffer(length)}};AscDFH.changesFactory[AscDFH.historyitem_ImageShapeSetBinaryData]=CChangesOleObjectBinary;AscDFH.drawingsChangesMap[AscDFH.historyitem_ImageShapeSetData]=function(oClass,value){oClass.m_sData=value};AscDFH.drawingsChangesMap[AscDFH.historyitem_ImageShapeSetApplicationId]=function(oClass,value){oClass.m_sApplicationId= value};AscDFH.drawingsChangesMap[AscDFH.historyitem_ImageShapeSetPixSizes]=function(oClass,value){if(value){oClass.m_nPixWidth=value.w;oClass.m_nPixHeight=value.h}};AscDFH.drawingsConstructorsMap[AscDFH.historyitem_ImageShapeSetPixSizes]=COleSize;AscDFH.drawingsChangesMap[AscDFH.historyitem_ImageShapeSetObjectFile]=function(oClass,value){oClass.m_sObjectFile=value};AscDFH.drawingsChangesMap[AscDFH.historyitem_ImageShapeSetOleType]=function(oClass,value){oClass.m_nOleType=value};function COleObject(){AscFormat.CImageShape.call(this); this.m_sData=null;this.m_sApplicationId=null;this.m_nPixWidth=null;this.m_nPixHeight=null;this.m_fDefaultSizeX=null;this.m_fDefaultSizeY=null;this.m_sObjectFile=null;this.m_nOleType=null;this.m_aBinaryData=null}COleObject.prototype=Object.create(AscFormat.CImageShape.prototype);COleObject.prototype.constructor=COleObject;COleObject.prototype.getObjectType=function(){return AscDFH.historyitem_type_OleObject};COleObject.prototype.setData=function(sData){AscCommon.History.Add(new AscDFH.CChangesDrawingsString(this, AscDFH.historyitem_ImageShapeSetData,this.m_sData,sData));this.m_sData=sData};COleObject.prototype.setApplicationId=function(sApplicationId){AscCommon.History.Add(new AscDFH.CChangesDrawingsString(this,AscDFH.historyitem_ImageShapeSetApplicationId,this.m_sApplicationId,sApplicationId));this.m_sApplicationId=sApplicationId};COleObject.prototype.setPixSizes=function(nPixWidth,nPixHeight){AscCommon.History.Add(new AscDFH.CChangesDrawingsObjectNoId(this,AscDFH.historyitem_ImageShapeSetPixSizes,new COleSize(this.m_nPixWidth, this.m_nPixHeight),new COleSize(nPixWidth,nPixHeight)));this.m_nPixWidth=nPixWidth;this.m_nPixHeight=nPixHeight};COleObject.prototype.setObjectFile=function(sObjectFile){AscCommon.History.Add(new AscDFH.CChangesDrawingsString(this,AscDFH.historyitem_ImageShapeSetObjectFile,this.m_sObjectFile,sObjectFile));this.m_sObjectFile=sObjectFile};COleObject.prototype.setOleType=function(nOleType){AscCommon.History.Add(new AscDFH.CChangesDrawingsLong(this,AscDFH.historyitem_ImageShapeSetOleType,this.m_nOleType, nOleType));this.m_nOleType=nOleType};COleObject.prototype.setBinaryData=function(aBinaryData){AscCommon.History.Add(new CChangesOleObjectBinary(this,this.m_aBinaryData,aBinaryData,false));this.m_aBinaryData=aBinaryData};COleObject.prototype.canRotate=function(){return false};COleObject.prototype.copy=function(){var copy=new COleObject;if(this.nvPicPr)copy.setNvPicPr(this.nvPicPr.createDuplicate());if(this.spPr){copy.setSpPr(this.spPr.createDuplicate());copy.spPr.setParent(copy)}if(this.blipFill)copy.setBlipFill(this.blipFill.createDuplicate()); if(this.style)copy.setStyle(this.style.createDuplicate());copy.setBDeleted(this.bDeleted);copy.setData(this.m_sData);copy.setApplicationId(this.m_sApplicationId);copy.setPixSizes(this.m_nPixWidth,this.m_nPixHeight);copy.setObjectFile(this.m_sObjectFile);copy.setOleType(this.m_nOleType);if(this.m_aBinaryData!==null)copy.setBinaryData(this.m_aBinaryData.slice(0,this.m_aBinaryData.length));if(this.macro!==null)copy.setMacro(this.macro);if(this.textLink!==null)copy.setTextLink(this.textLink);copy.cachedImage= this.getBase64Img();copy.cachedPixH=this.cachedPixH;copy.cachedPixW=this.cachedPixW;return copy};COleObject.prototype.handleUpdateExtents=function(){if(!AscFormat.isRealNumber(this.m_fDefaultSizeX)||!AscFormat.isRealNumber(this.m_fDefaultSizeY))if(this.spPr&&this.spPr.xfrm&&AscFormat.isRealNumber(this.spPr.xfrm.extX)&&AscFormat.isRealNumber(this.spPr.xfrm.extY)&&this.spPr.xfrm.extX>0&&this.spPr.xfrm.extY>0){this.m_fDefaultSizeX=this.spPr.xfrm.extX;this.m_fDefaultSizeY=this.spPr.xfrm.extY}AscFormat.CImageShape.prototype.handleUpdateExtents.call(this, [])};COleObject.prototype.checkTypeCorrect=function(){var bCorrectData=false;if(this.m_sData)bCorrectData=true;else if(this.m_sObjectFile)bCorrectData=true;if(!bCorrectData)return false;if(this.m_sApplicationId===null)return false;return true};window["AscFormat"]=window["AscFormat"]||{};window["AscFormat"].COleObject=COleObject})(window);"use strict";(function(window,undefined){function CDrawingDocContent(Parent,DrawingDocument,X,Y,XLimit,YLimit){CDocumentContent.call(this,Parent,DrawingDocument, X,Y,XLimit,YLimit,false,false,true);this.FullRecalc=new CDocumentRecalculateState;this.AllFields=[]}CDrawingDocContent.prototype=Object.create(CDocumentContent.prototype);CDrawingDocContent.prototype.constructor=CDrawingDocContent;CDrawingDocContent.prototype.CalculateAllFields=function(){var aParagraphs=this.Content;this.AllFields.length=0;for(var i=0;i0){var aColumns=oPage.Sections[0].Columns;for(var j=0;j1&&oBodyPr){var fSpace=AscFormat.isRealNumber(oBodyPr.spcCol)?oBodyPr.spcCol:0;fSpace=Math.min(fSpace,this.XLimit/(nNumCol-1));var fColumnWidth=Math.max((this.XLimit-this.X-(nNumCol-1)*fSpace)/nNumCol,0);X+=nColumnIndex*(fColumnWidth+fSpace);XLimit=X+fColumnWidth;if(nColumnIndex>0)ColumnSpaceBefore=fSpace;if(nColumnIndex1){var fSummaryHeight=this.GetSummaryHeight();var fLow=fHeight,fHigh=fSummaryHeight;this.Start_Recalculate(fWidth,fHigh);var nItCount=0;while(this.Pages.length>1&&nItCount<5){fHigh+=fSummaryHeight;this.Start_Recalculate(fWidth, fHigh);++nItCount}var fNeedHeight=fHigh;if(this.Get_ColumnsCount()>1)while(fHigh-fLow>.1){var fCheckHeight=fLow+(fHigh-fLow)/2;this.Start_Recalculate(fWidth,fCheckHeight);if(this.Pages.length>1)fLow=fCheckHeight;else{fHigh=fCheckHeight;fNeedHeight=fCheckHeight}}this.Start_Recalculate(fWidth,fNeedHeight+.01)}}};CDrawingDocContent.prototype.Start_Recalculate=function(fWidth,fHeight){this.FullRecalc.PageIndex=0;this.FullRecalc.SectionIndex=0;this.FullRecalc.ColumnIndex=0;this.FullRecalc.StartIndex=0; this.FullRecalc.Start=true;this.FullRecalc.StartPage=0;this.Reset(0,0,fWidth,fHeight);this.Recalculate_PageDrawing()};CDrawingDocContent.prototype.Recalculate_PageDrawing=function(){var nColumnsCount=this.Get_ColumnsCount();var nPageIndex=this.FullRecalc.PageIndex;this.Pages.length=nPageIndex+1;if(0===this.FullRecalc.ColumnIndex&&true===this.FullRecalc.Start){var oPage=new CDocumentPage;oPage.Pos=this.FullRecalc.StartIndex;oPage.Sections[0]=new CDocumentPageSection;for(var i=0;i=nColumnsCount){this.FullRecalc.ColumnIndex= 0;this.FullRecalc.PageIndex=nPageIndex+1}break}else if(nRecalcResult&recalcresultflags_LastFromNewPage){oColumn.EndPos=i-1;oSection.EndPos=i-1;oPage.EndPos=i-1;bContinue=true;this.FullRecalc.SectionIndex=0;this.FullRecalc.ColumnIndex=0;this.FullRecalc.PageIndex=nPageIndex+1;this.FullRecalc.StartIndex=i;this.FullRecalc.Start=true;if(oColumn.EndPos===oColumn.Pos){var Element=this.Content[oColumn.Pos];var ElementPageIndex=this.private_GetElementPageIndex(i,nPageIndex,nColumnIndex,nColumnsCount);if(true=== Element.IsEmptyPage(ElementPageIndex))oColumn.Empty=true}for(var TempColumnIndex=nColumnIndex+1;TempColumnIndex=nColumnsCount){this.FullRecalc.SectionIndex=0;this.FullRecalc.ColumnIndex=0;this.FullRecalc.PageIndex=nPageIndex+1}this.FullRecalc.StartIndex=i;this.FullRecalc.Start=true;if(oColumn.EndPos===oColumn.Pos){var Element=this.Content[oColumn.Pos]; var ElementPageIndex=this.private_GetElementPageIndex(i,nPageIndex,nColumnIndex,nColumnsCount);if(true===Element.IsEmptyPage(ElementPageIndex))oColumn.Empty=true}break}}if(i===nCount){oPage.EndPos=nCount-1;oSection.EndPos=nCount-1;oColumn.EndPos=nCount-1}if(bContinue)this.Recalculate_PageDrawing()};CDrawingDocContent.prototype.Draw=function(nPageIndex,pGraphics){if(this.Pages.length>0){var oSection=this.Pages[0].Sections[0];if(oSection){if(pGraphics.Start_Command)pGraphics.Start_Command(AscFormat.DRAW_COMMAND_CONTENT); for(var ColumnIndex=0,ColumnsCount=oSection.Columns.length;ColumnIndex1)var X=ColumnIndex===0?0:Column.X-Column.SpaceBefore/2;for(var ContentPos=ColumnStartPos;ContentPos<=ColumnEndPos;++ContentPos){var ElementPageIndex=this.private_GetElementPageIndex(ContentPos,0,ColumnIndex,ColumnsCount);this.Content[ContentPos].Draw(ElementPageIndex, pGraphics)}}if(pGraphics.End_Command)pGraphics.End_Command()}else CDocumentContent.prototype.Draw.call(this,nPageIndex,pGraphics)}};CDrawingDocContent.prototype.Write_ToBinary2=function(oWriter){oWriter.WriteLong(AscDFH.historyitem_type_DrawingContent);CDocumentContent.prototype.Write_ToBinary2.call(this,oWriter)};CDrawingDocContent.prototype.Read_FromBinary2=function(oReader){oReader.GetLong();CDocumentContent.prototype.Read_FromBinary2.call(this,oReader)};CDrawingDocContent.prototype.IsTableCellContent= function(isReturnCell){if(true===isReturnCell)return null;return false};CDrawingDocContent.prototype.Is_ChartTitleContent=function(){if(this.Parent instanceof AscFormat.CTextBody&&this.Parent.parent instanceof AscFormat.CTitle)return true;return false};CDrawingDocContent.prototype.DrawSelectionOnPage=function(PageIndex){var CurPage=PageIndex;if(CurPage<0||CurPage>=this.Pages.length)return;var Pos_start=this.Pages[CurPage].Pos;var Pos_end=this.Pages[CurPage].EndPos;if(true===this.Selection.Use)if(this.Selection.Flag=== selectionflag_Common){var Start=this.Selection.StartPos;var End=this.Selection.EndPos;if(Start>End){Start=this.Selection.EndPos;End=this.Selection.StartPos}var Start=Math.max(Start,Pos_start);var End=Math.min(End,Pos_end);var Page=this.Pages[PageIndex];if(this.Pages[PageIndex].Sections.length===0)for(var Index=Start;Index<=End;Index++){var ElementPageIndex=this.private_GetElementPageIndex(Index,CurPage,0,1);this.Content[Index].DrawSelectionOnPage(ElementPageIndex)}else{var PageSection=Page.Sections[0]; for(var ColumnIndex=0,ColumnsCount=PageSection.Columns.length;ColumnIndexEnd){Start=this.Selection.EndPos;End=this.Selection.StartPos}var Start=Math.max(Start,Pos_start);var End=Math.min(End,Pos_end);for(var Index=Start;Index<=End;++Index){var ElementPage=this.private_GetElementPageIndex(Index,0,ColumnIndex,ColumnsCount);this.Content[Index].DrawSelectionOnPage(ElementPage)}}}}}; CDrawingDocContent.prototype.Internal_GetContentPosByXY=function(X,Y,PageNum,ColumnsInfo){if(!ColumnsInfo)ColumnsInfo={Column:0,ColumnsCount:1};if(undefined===PageNum||null===PageNum)PageNum=this.CurPage;var SectCount=this.Pages[PageNum].EndSectionParas.length;if(this.Pages[PageNum].Sections.length===0)return CDocumentContent.prototype.Internal_GetContentPosByXY.call(this,X,Y,PageNum,ColumnsInfo);for(var Index=0;IndexBounds.Top&&X>Bounds.Left&&X0&&true===PageSection.Columns[ColumnIndex].Empty)ColumnIndex--;ColumnsInfo.Column=ColumnIndex;ColumnsInfo.ColumnsCount=ColumnsCount;var Column=PageSection.Columns[ColumnIndex];var StartPos=Column.Pos;var EndPos=Column.EndPos;for(var Pos=StartPos;Pos0)if(this.Pages[0].Sections.length>0)return CDocument_prototype_private_GetElementPageIndexByXY.call(this,ElementPos,X,Y,PageIndex);return CDocumentContent.prototype.private_GetElementPageIndexByXY.call(this,ElementPos,X,Y,PageIndex)};CDrawingDocContent.prototype.Copy=function(Parent,DrawingDocument){var DC=new CDrawingDocContent(Parent, DrawingDocument?DrawingDocument:this.DrawingDocument,0,0,0,0,this.Split,this.TurnOffInnerWrap,this.bPresentation);DC.Internal_Content_RemoveAll();var Count=this.Content.length;for(var Index=0;Index0)this.Recalculate_PageDrawing()}};CDrawingDocContent.prototype.ClearParagraphFormatting=function(isClearParaPr,isClearTextPr){if(true===this.ApplyToAll){for(var Index=0;IndexEndPos){var Temp=StartPos;StartPos=EndPos;EndPos=Temp}for(var Index=StartPos;Index<=EndPos;Index++){var Item=this.Content[Index];Item.ClearParagraphFormatting(isClearParaPr,isClearTextPr)}}}else{var Item=this.Content[this.CurPos.ContentPos]; Item.ClearParagraphFormatting(isClearParaPr,isClearTextPr)}};function CDocument_prototype_private_GetElementPageIndexByXY(ElementPos,X,Y,PageIndex){var Element=this.Content[ElementPos];if(!Element)return 0;var Page=this.Pages[PageIndex];if(!Page)return 0;var PageSection=null;for(var SectionIndex=0,SectionsCount=Page.Sections.length;SectionIndexStartColumn)EndColumn--;var ResultColumn=EndColumn;for(var ColumnIndex=StartColumn;ColumnIndex=0;i--)if(_array[i].guid==guid)return _array[i];return null},isWorked:function(){for(var i in this.runnedPluginsMap)if(this.pluginsMap[i]&& !this.pluginsMap[i].isSystem)return true;return false},stopWorked:function(){for(var i in this.runnedPluginsMap)if(this.pluginsMap[i]&&!this.pluginsMap[i].isSystem)this.close(i)},isRunned:function(guid){return undefined!==this.runnedPluginsMap[guid]},checkEditorSupport:function(plugin,variation){var typeEditor=this.api.getEditorId();var typeEditorString="";switch(typeEditor){case AscCommon.c_oEditorId.Word:typeEditorString="word";break;case AscCommon.c_oEditorId.Presentation:typeEditorString="slide"; break;case AscCommon.c_oEditorId.Spreadsheet:typeEditorString="cell";break;default:break}var runnedVariation=variation?variation:0;if(!plugin.variations[runnedVariation]||!plugin.variations[runnedVariation].EditorsSupport||!plugin.variations[runnedVariation].EditorsSupport.includes(typeEditorString))return false;return true},run:function(guid,variation,data,isNoUse_isNoSystemPluginsOnlyOne){var isEnabled=this.api.DocInfo?this.api.DocInfo.get_IsEnabledPlugins():true;if(false===isEnabled)return;if(this.runAndCloseData)return; if(this.pluginsMap[guid]===undefined)return;var plugin=this.getPluginByGuid(guid);if(!plugin)return;if(!this.checkEditorSupport(plugin,variation))return;var isSystem=this.pluginsMap[guid].isSystem;var isRunned=this.runnedPluginsMap[guid]!==undefined?true:false;if(isRunned&&(variation==null||variation==this.runnedPluginsMap[guid].currentVariation)){this.close(guid);return false}if(isNoUse_isNoSystemPluginsOnlyOne!==true&&!isSystem&&this.isNoSystemPluginsOnlyOne){var guidOther="";for(var i in this.runnedPluginsMap)if(this.pluginsMap[i]&& !this.pluginsMap[i].isSystem){guidOther=i;break}if(guidOther!=""){this.runAndCloseData={};this.runAndCloseData.guid=guid;this.runAndCloseData.variation=variation;this.runAndCloseData.data=data;this.close(guidOther);return}}var _startData=data==null||data==""?new CPluginData:data;_startData.setAttribute("guid",guid);this.correctData(_startData);_startData.setAttribute("theme",AscCommon.GlobalSkin);this.runnedPluginsMap[guid]={frameId:"iframe_"+guid,currentVariation:Math.min(variation,plugin.variations.length- 1),currentInit:false,isSystem:isSystem,startData:_startData,closeAttackTimer:-1,methodReturnAsync:false};this.show(guid)},runResize:function(data){var guid=data.getAttribute("guid");var plugin=this.getPluginByGuid(guid);if(!plugin)return;if(true!==plugin.variations[0].isUpdateOleOnResize)return;data.setAttribute("resize",true);return this.run(guid,0,data,true)},close:function(guid){var plugin=this.getPluginByGuid(guid);var runObject=this.runnedPluginsMap[guid];if(!plugin||!runObject)return;if(runObject.startData&& runObject.startData.getAttribute("resize")===true)this.endLongAction();runObject.startData=null;if(true){if(this.sendsToInterface[plugin.guid]){this.api.sendEvent("asc_onPluginClose",plugin,runObject.currentVariation);delete this.sendsToInterface[plugin.guid]}var _div=document.getElementById(runObject.frameId);if(_div)_div.parentNode.removeChild(_div)}delete this.runnedPluginsMap[guid];if(this.runAndCloseData){var _tmp=this.runAndCloseData;this.runAndCloseData=null;this.run(_tmp.guid,_tmp.variation, _tmp.data)}},show:function(guid){var plugin=this.getPluginByGuid(guid);var runObject=this.runnedPluginsMap[guid];if(!plugin||!runObject)return;for(var mainEventType in this.mainEvents)if(plugin.variations[runObject.currentVariation].eventsMap[mainEventType]){if(!runObject.waitEvents)runObject.waitEvents=[];runObject.waitEvents.push({n:mainEventType,d:this.mainEvents[mainEventType]})}if(runObject.startData.getAttribute("resize")===true)this.startLongAction();if(this.api.WordControl&&this.api.WordControl.m_oTimerScrollSelect!= -1){clearInterval(this.api.WordControl.m_oTimerScrollSelect);this.api.WordControl.m_oTimerScrollSelect=-1}if(plugin.variations[runObject.currentVariation].isVisual&&runObject.startData.getAttribute("resize")!==true){this.api.sendEvent("asc_onPluginShow",plugin,runObject.currentVariation,runObject.frameId,"?lang="+this.language);this.sendsToInterface[plugin.guid]=true}else{var ifr=document.createElement("iframe");ifr.name=runObject.frameId;ifr.id=runObject.frameId;var _add=plugin.baseUrl==""?this.path: plugin.baseUrl;ifr.src=_add+plugin.variations[runObject.currentVariation].url+"?lang="+this.language;ifr.style.position=AscCommon.AscBrowser.isIE||AscCommon.AscBrowser.isMozilla?"fixed":"absolute";ifr.style.top="-100px";ifr.style.left="0px";ifr.style.width="10000px";ifr.style.height="100px";ifr.style.overflow="hidden";ifr.style.zIndex=-1E3;ifr.setAttribute("frameBorder","0");ifr.setAttribute("allow","autoplay");document.body.appendChild(ifr);if(runObject.startData.getAttribute("resize")!==true){this.api.sendEvent("asc_onPluginShow", plugin,runObject.currentVariation);this.sendsToInterface[plugin.guid]=true}}runObject.currentInit=false;if(AscCommon.AscBrowser.isIE&&!AscCommon.AscBrowser.isIeEdge){var ie_frame_id=runObject.frameId;var ie_frame_message={data:JSON.stringify({"type":"initialize","guid":guid})};document.getElementById(runObject.frameId).addEventListener("load",function(){setTimeout(function(){var channel=new MessageChannel;channel["port1"]["onmessage"]=onMessage;onMessage(ie_frame_message,channel)},500)})}},buttonClick:function(id, guid){if(guid===undefined)for(var i in this.runnedPluginsMap){if(this.runnedPluginsMap[i].isSystem)continue;if(this.pluginsMap[i]){guid=i;break}}if(undefined===guid)return;var plugin=this.getPluginByGuid(guid);var runObject=this.runnedPluginsMap[guid];if(!plugin||!runObject)return;if(runObject.closeAttackTimer!=-1){clearTimeout(runObject.closeAttackTimer);runObject.closeAttackTimer=-1}if(-1==id){if(!runObject.currentInit)this.close(guid);runObject.closeAttackTimer=setTimeout(function(){window.g_asc_plugins.close()}, 5E3)}var _iframe=document.getElementById(runObject.frameId);if(_iframe){var pluginData=new CPluginData;pluginData.setAttribute("guid",plugin.guid);pluginData.setAttribute("type","button");pluginData.setAttribute("button",""+id);_iframe.contentWindow.postMessage(pluginData.serialize(),"*")}},init:function(guid,raw_data){var plugin=this.getPluginByGuid(guid);var runObject=this.runnedPluginsMap[guid];if(!plugin||!runObject||!runObject.startData)return;if(undefined===raw_data)switch(plugin.variations[runObject.currentVariation].initDataType){case Asc.EPluginDataType.text:{var text_data= {data:"",pushData:function(format,value){this.data=value}};this.api.asc_CheckCopy(text_data,1);if(text_data.data==null)text_data.data="";runObject.startData.setAttribute("data",text_data.data);break}case Asc.EPluginDataType.html:{var text_data={data:"",pushData:function(format,value){this.data=value}};this.api.asc_CheckCopy(text_data,2);if(text_data.data==null)text_data.data="";runObject.startData.setAttribute("data",text_data.data);break}case Asc.EPluginDataType.ole:{break}case Asc.EPluginDataType.desktop:{if(plugin.variations[runObject.currentVariation].initData== "encryption"){if(this.api.isReporterMode){this.sendEncryptionDataCounter++;if(2<=this.sendEncryptionDataCounter)runObject.startData.setAttribute("data",{"type":"setPassword","password":this.api.currentPassword,"hash":this.api.currentDocumentHash,"docinfo":this.api.currentDocumentInfo})}if(this.api.asc_initAdvancedOptions_params){window["asc_initAdvancedOptions"].apply(window,this.api.asc_initAdvancedOptions_params);delete this.api.asc_initAdvancedOptions_params;return}}break}}else runObject.startData.setAttribute("data", raw_data);var _iframe=document.getElementById(runObject.frameId);if(_iframe){runObject.startData.setAttribute("type","init");_iframe.contentWindow.postMessage(runObject.startData.serialize(),"*")}runObject.currentInit=true},correctData:function(pluginData){pluginData.setAttribute("editorType",this.api._editorNameById());var _mmToPx=AscCommon.g_dKoef_mm_to_pix;if(this.api.WordControl&&this.api.WordControl.m_nZoomValue)_mmToPx*=this.api.WordControl.m_nZoomValue/100;pluginData.setAttribute("mmToPx", _mmToPx);if(undefined==pluginData.getAttribute("data"))pluginData.setAttribute("data","");pluginData.setAttribute("isViewMode",this.api.isViewMode);pluginData.setAttribute("isMobileMode",this.api.isMobileVersion);pluginData.setAttribute("isEmbedMode",this.api.isEmbedVersion);pluginData.setAttribute("lang",this.language);pluginData.setAttribute("documentId",this.api.documentId);pluginData.setAttribute("documentTitle",this.api.documentTitle);pluginData.setAttribute("documentCallbackUrl",this.api.documentCallbackUrl); if(this.api.User){pluginData.setAttribute("userId",this.api.User.id);pluginData.setAttribute("userName",this.api.User.userName)}},loadExtensionPlugins:function(_plugins){if(!_plugins||_plugins.length<1)return;var _map={};for(var i=0;ib-1E-4);l++)m=Math.abs(g[l]-b),mMath.abs(d.zoom-e)||(e=d.zoom,document.firstElementChild.style.zoom=.001>Math.abs(e-1)?"normal":1/e)}})(window);(function(a,h){function g(c){this.plugin=c;this.ps;this.items=[];this.isCurrentVisible=this.isVisible=!1}g.prototype.createWindow=function(){var c=document.body,e=document.getElementsByTagName("head")[0];c&&e&&(c=document.createElement("style"),c.type="text/css",c.innerHTML=\'.ih_main { margin: 0px; padding: 0px; width: 100%; height: 100%; display: inline-block; overflow: hidden; box-sizing: border-box; user-select: none; position: fixed; border: 1px solid #cfcfcf; } ul { margin: 0px; padding: 0px; width: 100%; height: 100%; list-style-type: none; outline:none; } li { padding: 5px; font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; font-size: 12px; font-weight: 400; color: #373737; } li:hover { background-color: #D8DADC; } .li_selected { background-color: #D8DADC; color: #373737; }.li_selected:hover { background-color: #D8DADC; color: #373737; }\',e.appendChild(c),document.body.style.background="#FFFFFF",document.body.style.width="100%",document.body.style.height="100%",document.body.style.margin="0",document.body.style.padding="0",document.body.innerHTML=\'
    \',this.ps=new PerfectScrollbar(document.getElementById("ih_area"),{minScrollbarLength:20}),this.updateScrolls(),this.createDefaultEvents())};g.prototype.setItems=function(c){this.items=c;for(var e="",d=c.length,b=0;b\',e+=c[b].text,e+="";document.getElementById("ih_elements_id").innerHTML=e;this.updateScrolls();this.scrollToSelected()};g.prototype.createDefaultEvents=function(){this.plugin.onExternalMouseUp=function(){var e=document.createEvent("MouseEvents");e.initMouseEvent("mouseup",!0,!0,a,1,0,0,0,0,!1,!1,!1,!1,0,null);document.dispatchEvent(e)};var c=this;a.onkeydown=function(e){switch(e.keyCode){case 27:c.isVisible&&(c.isVisible=!1,c.plugin.executeMethod("UnShowInputHelper",[c.plugin.info.guid,!0]));break;case 38:case 40:case 9:case 36:case 35:case 33:case 34:for(var d=document.getElementsByTagName("li"),b=-1,f=0;fb&&(b=0);break;case 40:b++;b>=d.length&&(b=d.length-1);break;case 9:b++;b>=d.length&&(b=0);break;case 36:b=0;break;case 35:b=d.length-1;break;case 33:case 34:f=1;var k=document.getElementById("ih_area").clientHeight/24>>0;1b&&(b=0)):(b+=f,b>=d.length&&(b=b=d.length-1))}b .ps__thumb-y":{"border-color":"canvas-scroll-thumb-hover","background-color":"canvas-scroll-thumb-hover !important"},".ps .ps__rail-x:hover":{"background-color":"background-toolbar"},".ps .ps__rail-x.ps--clicking":{"background-color":"background-toolbar"},".ps__thumb-x":{"background-color":"background-normal","border-color":"Border !important"},".ps__rail-x:hover > .ps__thumb-x":{"border-color":"canvas-scroll-thumb-hover"},a:{color:"text-link !important"},"a:hover":{color:"text-link-hover !important"},"a:active":{color:"text-link-active !important"},"a:visited":{color:"text-link-visited !important"},"*::-webkit-scrollbar-track":{background:"background-normal"},"*::-webkit-scrollbar-track:hover":{background:"background-toolbar-additional"},"*::-webkit-scrollbar-thumb":{"background-color":"background-toolbar","border-color":"border-regular-control"},"*::-webkit-scrollbar-thumb:hover":{"background-color":"canvas-scroll-thumb-hover"}},e=!1,d="";a.plugin_sendMessage=function(b){a.Asc.plugin.ie_channel?a.Asc.plugin.ie_channel.postMessage(b):a.parent.postMessage(b,"*")};a.plugin_onMessage=function(b){if(a.Asc.plugin&&"string"==typeof b.data){var f={};try{f=JSON.parse(b.data)}catch(l){f={}}b=f.type;if(f.guid!=a.Asc.plugin.guid){if(h!==f.guid)return;switch(b){case "onExternalPluginMessage":break;default:return}}"init"==b&&(a.Asc.plugin.info=f);if(h!==f.theme&&(!a.Asc.plugin.theme||"onThemeChanged"===b))if(a.Asc.plugin.theme=f.theme,a.Asc.plugin.onThemeChangedBase||(a.Asc.plugin.onThemeChangedBase=function(l){var n="",q;for(q in c){n+=q+" {";var u=c[q],r;for(r in u){var p=u[r],t=p.indexOf(" !important");-1=0){_pos1+=5;if(_pos2<0)_pos2=_langSearch.length;var _lang=_langSearch.substr(_pos1,_pos2-_pos1);if(_lang.length==2)_lang=_lang.toLowerCase()+"-"+_lang.toUpperCase();if(5==_lang.length)window.g_asc_plugins.language=_lang}}if(window["AscDesktopEditor"]&&window["UpdateSystemPlugins"])window["UpdateSystemPlugins"]();return window.g_asc_plugins};window["Asc"].CPluginData=CPluginData; window["Asc"].CPluginData_wrap=function(obj){if(!obj.getAttribute)obj.getAttribute=function(name){return this[name]};if(!obj.setAttribute)obj.setAttribute=function(name,value){return this[name]=value}};window["Asc"].loadConfigAsInterface=function(url){if(url)try{var xhrObj=new XMLHttpRequest;if(xhrObj){xhrObj.open("GET",url,false);xhrObj.send("");return JSON.parse(xhrObj.responseText)}}catch(e){}return null};window["Asc"].loadPluginsAsInterface=function(api){if(window.g_asc_plugins.srcPluginsLoaded)return; window.g_asc_plugins.srcPluginsLoaded=true;var configs=window["Asc"].loadConfigAsInterface("../../../../plugins.json");if(!configs)return;var pluginsData=configs["pluginsData"];if(!pluginsData||pluginsData.length<1)return;var arrPluginsConfigs=[];pluginsData.forEach(function(item){var value=window["Asc"].loadConfigAsInterface(item);if(value){value["baseUrl"]=item.substring(0,item.lastIndexOf("config.json"));arrPluginsConfigs.push(value)}});var arrPlugins=[];arrPluginsConfigs.forEach(function(item){var plugin= new Asc.CPlugin;plugin["set_Name"](item["name"]);plugin["set_Guid"](item["guid"]);plugin["set_BaseUrl"](item["baseUrl"]);var variations=item["variations"];var variationsArr=[];variations.forEach(function(itemVar){var variation=new Asc.CPluginVariation;variation["set_Description"](itemVar["description"]);variation["set_Url"](itemVar["url"]);variation["set_Icons"](itemVar["icons"]);variation["set_Visual"](itemVar["isVisual"]);variation["set_CustomWindow"](itemVar["'isCustomWindow"]);variation["set_System"](itemVar["isSystem"]); variation["set_Viewer"](itemVar["isViewer"]);variation["set_EditorsSupport"](itemVar["EditorsSupport"]);variation["set_Modal"](itemVar["isModal"]);variation["set_InsideMode"](itemVar["isInsideMode"]);variation["set_InitDataType"](itemVar["initDataType"]);variation["set_InitData"](itemVar["initData"]);variation["set_UpdateOleOnResize"](itemVar["isUpdateOleOnResize"]);variation["set_Buttons"](itemVar["buttons"]);variation["set_Size"](itemVar["size"]);variation["set_InitOnSelectionChanged"](itemVar["initOnSelectionChanged"]); variation["set_Events"](itemVar["events"]);variationsArr.push(variation)});plugin["set_Variations"](variationsArr);arrPlugins.push(plugin)});window.g_asc_plugins.srcPlugins=arrPluginsConfigs;api.asc_pluginsRegister("",arrPlugins);api.asc_registerCallback("asc_onPluginShow",function(plugin,variationIndex,frameId){var _t=window.g_asc_plugins;var srcPlugin=null;for(var i=0;i<_t.srcPlugins.length;i++)if(plugin.guid==_t.srcPlugins[i]["guid"]){srcPlugin=_t.srcPlugins[i];break}var variation=plugin.get_Variations()[variationIndex]; var _elem=document.createElement("div");_elem.id="parent_"+frameId;_elem.setAttribute("style","user-select:none;z-index:5000;position:fixed;left:10px;top:10px;right:10px;bottom:10px;box-sizing:border-box;z-index:5000;box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);border-radius: 5px;background-color: #fff;border: solid 1px #cbcbcb;");var _elemBody="";_elemBody+='
    '; _elemBody+="";var lang=_t.language;var lang2=_t.language.substr(0,2);var _name=plugin.name;if(srcPlugin&&srcPlugin["nameLocale"])if(srcPlugin["nameLocale"][lang])_name=srcPlugin["nameLocale"][lang];else if(srcPlugin["nameLocale"][lang2])_name=srcPlugin["nameLocale"][lang2];_elemBody+=_name; _elemBody+="
    ";_elemBody+='
    ';var _add=plugin.baseUrl==""?_t.path:plugin.baseUrl;_elemBody+='