+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
"+ item.getStyleValue(ds) +""; } else { td.innerHTML=item.getStyleValue(ds); } } else { if (__ubi_isIE && __ubi_ieVersion < 8) { td.innerHTML="
"+ underIE8StyleStart.join('') + item.value + underIE8StyleEnd.join('') + ""; } else { if(item.htmlcodeproc=='1'){ td.innerHTML=item.value; }else{ var changedColor=false; var addSpan=false; var spanobj=null; var lastobj=null; if (item.highlight != null) { addSpan=true; spanobj=document.createElement("span"); spanobj.style.backgroundColor="#" + item.highlight; lastobj=spanobj; } if( item.underlined ) { if (addSpan) { spanobj.style.textDecoration="underline"; } else { addSpan=true; spanobj=document.createElement("span"); spanobj.style.textDecoration="underline"; lastobj=spanobj; } if (item.underlinecolor && item.underlinecolor != '') { changedColor=true; spanobj.style.color="#"+ item.underlinecolor; } } if (item.strike) { var strikespanobj=null; if (item.underlined) { strikespanobj=document.createElement("span"); spanobj.appendChild(strikespanobj); lastobj=strikespanobj; } else { if (addSpan) { strikespanobj=spanobj; } else { strikespanobj=document.createElement("span"); spanobj=strikespanobj; lastobj=strikespanobj; } } strikespanobj.style.textDecoration="line-through"; if (item.strikecolor && item.strikecolor != '') { changedColor=true; strikespanobj.style.color="#"+ item.strikecolor; } } if (changedColor) { var textspanobj=document.createElement("span"); textspanobj.style.color="#"+ getForegroundColor(doc,item); lastobj.appendChild(textspanobj); lastobj=textspanobj; } if (item.superscript) { var supobj=document.createElement("sup"); if (lastobj) { lastobj.appendChild(supobj); } lastobj=supobj; } if (item.subscript) { var subobj=document.createElement("sub"); if (lastobj) { lastobj.appendChild(subobj); } lastobj=subobj; } var textnode=document.createTextNode(item.value); if (lastobj) { lastobj.appendChild(textnode); if (spanobj) { td.appendChild(spanobj); } else { td.appendChild(lastobj); } } else { td.appendChild(textnode); } if (item.value.indexOf("^totalpage^") >= 0) { doc.totalpageNodes.push(textnode); doc.totalpageItems.push(item); } } } } } tr.appendChild(td); tbody.appendChild(tr); table.appendChild(tbody); div.appendChild(table); divid.appendChild(div); }; function DrawLineItem(divid, doc, item, ds) { if ( item.ispreview == false ) return; var x=Math.round(item.x * ds); var y=Math.round(item.y * ds); var width=Math.round((item.x+item.width) * ds) - x; var height=Math.round((item.y+item.height) * ds)- y; if( width == 0 || height == 0 ) { var div=document.createElement("div"); div.id=item.id; divid.appendChild(div); div.style.position="absolute"; div.style.top=y + "px"; div.style.left=x + "px"; div.style.width=((width == 0)?getLineThickness(doc, item):(width + 1)) + "px"; div.style.height=((height == 0)?getLineThickness(doc, item):(height + 1)) + "px"; if( __ubi_isIE && __ubi_ieVersion == 6 ) { div.style.lineHeight='0px'; div.style.fontSize='0px'; } if( (__ubi_isIE && __ubi_ieVersion == 6) && parseInt(div.style.height) == 1 ) { div.style.border="0px"; div.style.borderTop="1px solid #" + getLineColor(doc, item); } else { div.style.backgroundColor="#" + getLineColor(doc, item); } } else { var canvas=document.createElement("canvas"); canvas.id=item.id + (_ubi_cindex++)+ "cv"; divid.appendChild(canvas); if( !canvas.getContext ) G_vmlCanvasManager.initElement(canvas); canvas.style.position="absolute"; canvas.style.left=x + "px"; canvas.style.top=y + "px"; canvas.width=width + 1; canvas.height=height + 1; var ctx=canvas.getContext("2d"); ctx.save(); ctx.lineWidth=getLineThickness(doc, item); ctx.strokeStyle="#" + getLineColor(doc, item); ctx.beginPath(); if( item.linedir == 1 ) { ctx.moveTo(0, canvas.height); ctx.lineTo(canvas.width, 0); } else { ctx.moveTo(0, 0); ctx.lineTo(canvas.width, canvas.height); } ctx.closePath(); ctx.stroke(); ctx.restore(); } }; function DrawRectangleItem(divid, doc, item, ds) { if( item.width == 0 && item.height == 0 ) return; if ( item.ispreview == false ) return; var x=Math.round(item.x * ds); var y=Math.round(item.y * ds); var width=Math.round((item.x+item.width) * ds) - x; var height=Math.round((item.y+item.height) * ds)- y; var canvas=document.createElement("canvas"); canvas.id=item.id + (_ubi_cindex++)+ "cv"; divid.appendChild(canvas); if( !canvas.getContext ) G_vmlCanvasManager.initElement(canvas); canvas.style.position="absolute"; canvas.style.left=x + "px"; canvas.style.top=y + "px"; canvas.width=width + 1; canvas.height=height + 1; if (isPrint) { var canvasobj=new UbiCanvasObject(); if( item.edgetype == 1 ) { canvasobj.type="ROUNDRECT"; canvasobj.radius=item.edgewidth; } else { canvasobj.type="RECT"; } canvasobj.canvasid=canvas.id; canvasobj.linewidth=getLineThickness(doc, item); canvasobj.strokestyle="#" + getLineColor(doc, item); if( !item.transparent ) { canvasobj.fillstyle="#" + getBackgroundColor(doc, item); } drawcanvaslist[drawcanvaslist.length]=canvasobj; } else { var ctx=canvas.getContext("2d"); ctx.save(); ctx.lineWidth=getLineThickness(doc, item); ctx.strokeStyle="#" + getLineColor(doc, item); ctx.beginPath(); if( item.edgetype == 1 ) { roundedRect(ctx, ctx.lineWidth / 2, ctx.lineWidth / 2, canvas.width - ctx.lineWidth, canvas.height - ctx.lineWidth, item.edgewidth); } else { ctx.rect(ctx.lineWidth / 2, ctx.lineWidth / 2, canvas.width - ctx.lineWidth, canvas.height - ctx.lineWidth); } ctx.closePath(); if( !item.transparent ) { ctx.fillStyle="#" + getBackgroundColor(doc, item); ctx.fill(); } ctx.stroke(); ctx.restore(); } }; function roundedRect(ctx, x, y, width, height, radius){ ctx.beginPath(); ctx.moveTo(x,y+radius); ctx.lineTo(x,y+height-radius); ctx.quadraticCurveTo(x,y+height,x+radius,y+height); ctx.lineTo(x+width-radius,y+height); ctx.quadraticCurveTo(x+width,y+height,x+width,y+height-radius); ctx.lineTo(x+width,y+radius); ctx.quadraticCurveTo(x+width,y,x+width-radius,y); ctx.lineTo(x+radius,y); ctx.quadraticCurveTo(x,y,x,y+radius); }; function DrawCircleItem(divid, doc, item, ds) { if( item.width == 0 && item.height == 0 ) return; if ( item.ispreview == false ) return; var x=Math.round(item.x * ds); var y=Math.round(item.y * ds); var width=Math.round((item.x+item.width) * ds) - x; var height=Math.round((item.y+item.height) * ds)- y; var canvas=document.createElement("canvas"); canvas.id=item.id + (_ubi_cindex++)+ "cv"; divid.appendChild(canvas); if( !canvas.getContext ) G_vmlCanvasManager.initElement(canvas); canvas.style.position="absolute"; canvas.style.left=x + "px"; canvas.style.top=y + "px"; canvas.width=width + 1; canvas.height=height + 1; if (isPrint) { var canvasobj=new UbiCanvasObject(); canvasobj.type="CIRCLE"; canvasobj.canvasid=canvas.id; canvasobj.linewidth=getLineThickness(doc, item); canvasobj.strokestyle="#" + getLineColor(doc, item); if( !item.transparent ) { canvasobj.fillstyle="#" + getBackgroundColor(doc, item); } drawcanvaslist[drawcanvaslist.length]=canvasobj; } else { var ctx=canvas.getContext("2d"); ctx.save(); ctx.lineWidth=getLineThickness(doc, item); ctx.strokeStyle="#" + getLineColor(doc, item); var KAPPA=4 * ((Math.sqrt(2) - 1) / 3); var cx=canvas.width / 2; var cy=canvas.height / 2; var rx=cx * KAPPA; var ry=cy * KAPPA; ctx.beginPath(); ctx.moveTo(cx, ctx.lineWidth); ctx.bezierCurveTo(cx + rx, ctx.lineWidth, canvas.width - ctx.lineWidth, cy - ry, canvas.width - ctx.lineWidth, cy); ctx.bezierCurveTo(canvas.width - ctx.lineWidth, cy + ry, cx + rx, canvas.height - ctx.lineWidth, cx, canvas.height - ctx.lineWidth); ctx.bezierCurveTo(cx - rx, canvas.height - ctx.lineWidth, ctx.lineWidth, cy + ry, ctx.lineWidth, cy); ctx.bezierCurveTo(ctx.lineWidth, cy - ry, cx - rx, ctx.lineWidth, cx, ctx.lineWidth); ctx.closePath(); if( !item.transparent ) { ctx.fillStyle="#" + getBackgroundColor(doc, item); ctx.fill(); } ctx.stroke(); ctx.restore(); } }; function DrawImageItem(divid, doc, item, keyurl, ds, vid) { if( item.width == 0 || item.height == 0 ) return; if ( item.ispreview == false ) return; if (item.imageid.indexOf("voiceye") != -1) return; var imageDiv=getImageDiv(doc, item, ds); var alink=null; if (item.linked) { var alink=document.createElement("a"); if (__ubi_viewers[vid] && __ubi_viewers[vid].events.linkButtonDown) { alink.onmouseover=function() { this.style.cursor="pointer";}; alink.onmouseout=function() { this.style.cursor="default";}; alink.onclick=function() {__ubi_viewers[vid]._linkButtonDown(item.linkfilename, item.linkargs); }; } else { if (item.linkstyle == "SCRIPT") { alink.href="javascript:"+item.linkfilename; } else if (item.linkstyle == "REPORT"){ alink.href="javascript:refreshFrame('"+ divid.parentNode.parentNode.parentNode.id +"','"+ item.linkfilename +"','"+ item.linkargs +"')"; } else if (item.linkstyle == "WEBPAGE"){ var url=item.linkfilename; if (item.linkfilename.indexOf(":/"+"/") == -1 && item.linkfilename.indexOf("mailto:") == -1) { url="http:/"+"/"+ item.linkfilename; } alink.href="javascript:window.open(\""+ url + item.linkargs +"\"); void 0;"; } } alink.appendChild(imageDiv); divid.appendChild(alink); } else { divid.appendChild(imageDiv); } var imageobj=doc.objects.Lookup(item.imageid); if( imageobj.loadtype == 1 && imageobj.loadsrc != "" ) { if( __ubi_isMobile ) { var image=getImage2(doc, item, keyurl, imageobj, ds); imageDiv.appendChild(image); } else { var canvas=getCanvas(doc, item, ds); imageDiv.appendChild(canvas); var canvasobj=null; drawCanvas2(doc, canvas, item, keyurl, imageobj, ds); } } else if ((imageobj.loadtype == 2 || imageobj.loadtype == 3) && imageobj.loadsrc != "" ) { getImageType2(imageDiv, doc, item, keyurl, imageobj, ds); } var borderDiv=getBorderDiv(doc, item, ds); if (item.linked) { alink.appendChild(borderDiv); } else { divid.appendChild(borderDiv); } }; function DrawBarcodeItem(divid, doc, item, keyurl, ds) { if( item.width == 0 || item.height == 0 ) return; if ( item.ispreview == false ) return; var imageDiv=getImageDiv(doc, item, ds); divid.appendChild(imageDiv); if( item.loadtype == 1 && item.loadsrc != "" ) { if( __ubi_isMobile ) { var image=getImage(doc, item, keyurl, ds); imageDiv.appendChild(image); } else { var canvas=getCanvas(doc, item); imageDiv.appendChild(canvas); drawCanvas(doc, canvas, item, keyurl, ds); } } var borderDiv=getBorderDiv(doc, item, ds); divid.appendChild(borderDiv); }; function DrawChartComponent(divid, doc, chart, keyurl, ds) { if( chart.width == 0 || chart.height == 0 ) return; var imageDiv=getImageDiv(doc, chart, ds); divid.appendChild(imageDiv); if( (chart.loadtype == 1 || chart.loadtype == 2) && chart.loadsrc != "" ) { if( __ubi_isMobile ) { var image=getImage(doc, chart, keyurl, ds); imageDiv.appendChild(image); } else { var image=getChartImage(doc, chart, keyurl, ds); imageDiv.innerHTML=image; } } }; function getBorderColor(tp, doc, item) { if( tp == "top") return doc.colors.Lookup(doc.lines.Lookup(doc.borders.Lookup(item.borderid).top).colorid).color; else if( tp == "right" ) return doc.colors.Lookup(doc.lines.Lookup(doc.borders.Lookup(item.borderid).right).colorid).color; else if( tp == "bottom" ) return doc.colors.Lookup(doc.lines.Lookup(doc.borders.Lookup(item.borderid).bottom).colorid).color; else if( tp == "left" ) return doc.colors.Lookup(doc.lines.Lookup(doc.borders.Lookup(item.borderid).left).colorid).color; else if( tp == "dd" ) return doc.colors.Lookup(doc.lines.Lookup(doc.borders.Lookup(item.borderid).diagonaldown).colorid).color; else if( tp == "du" ) return doc.colors.Lookup(doc.lines.Lookup(doc.borders.Lookup(item.borderid).diagonalup).colorid).color; }; function getBorderStyle(tp, doc, item) { if( tp == "top") return doc.lines.Lookup(doc.borders.Lookup(item.borderid).top).getStyle(); else if( tp == "right" ) return doc.lines.Lookup(doc.borders.Lookup(item.borderid).right).getStyle(); else if( tp == "bottom" ) return doc.lines.Lookup(doc.borders.Lookup(item.borderid).bottom).getStyle(); else if( tp == "left" ) return doc.lines.Lookup(doc.borders.Lookup(item.borderid).left).getStyle(); else if( tp == "dd" ) return doc.lines.Lookup(doc.borders.Lookup(item.borderid).diagonaldown).getStyle(); else if( tp == "du" ) return doc.lines.Lookup(doc.borders.Lookup(item.borderid).diagonalup).getStyle(); }; function getBorderWidth(tp, doc, item) { var width; var style=getBorderStyle(tp, doc, item); if( tp == "top") width=doc.lines.Lookup(doc.borders.Lookup(item.borderid).top).getWidth(); else if( tp == "right" ) width=doc.lines.Lookup(doc.borders.Lookup(item.borderid).right).getWidth(); else if( tp == "bottom" ) width=doc.lines.Lookup(doc.borders.Lookup(item.borderid).bottom).getWidth(); else if( tp == "left" ) width=doc.lines.Lookup(doc.borders.Lookup(item.borderid).left).getWidth(); else if( tp == "dd" ) width=doc.lines.Lookup(doc.borders.Lookup(item.borderid).diagonaldown).getWidth(); else if( tp == "du" ) width=doc.lines.Lookup(doc.borders.Lookup(item.borderid).diagonalup).getWidth(); if( style == "none" ) width=0; else { if( width % 2 == 1 ) width=parseInt(width / 2) + 1; else width=parseInt(width / 2); } return width; }; function getLineThickness(doc, item) { var width=doc.lines.Lookup(item.lineid).thickness; if( width != 0 ) { if( width % 2 == 1 ) width=parseInt(width / 2) + 1; else width=parseInt(width / 2); } return width; }; function getLineColor(doc, item) { return doc.colors.Lookup(doc.lines.Lookup(item.lineid).colorid).color; }; function getBackgroundColor(doc, item) { return doc.colors.Lookup(item.backgroundid).color; }; function getFont(doc, item, ds) { if( typeof ds == "undefined" ) ds=1.0; return doc.fonts.Lookup(item.fontid).getFont(ds); }; function getFontSize(doc, item, ds) { if( typeof ds == "undefined" ) ds=1.0; return doc.fonts.Lookup(item.fontid).getFontSize(ds); }; function getForegroundColor(doc, item) { return doc.colors.Lookup(item.foregroundid).color; }; function getImageDiv(doc, item, ds) { var x=Math.round(item.x * ds); var y=Math.round(item.y * ds); var width=Math.round((item.x+item.width) * ds) - x; var height=Math.round((item.y+item.height) * ds)- y; var div=document.createElement("div"); div.id=item.id; div.style.overflow="hidden"; div.style.position="absolute"; div.style.left=x + "px"; div.style.top=y + "px"; div.style.width=(width + 1) + "px"; div.style.height=(height + 1) + "px"; return div; }; function getBorderDiv(doc, item, ds) { var x=Math.round(item.x * ds); var y=Math.round(item.y * ds); var width=Math.round((item.x+item.width) * ds) - x; var height=Math.round((item.y+item.height) * ds)- y; var div=document.createElement("div"); div.style.backgroundColor="transparent"; div.style.position="absolute"; div.style.left=x + "px"; div.style.top=y + "px"; div.style.width=(width + 1) - (getBorderWidth("left", doc, item) + getBorderWidth("right", doc, item)) + "px"; div.style.height=(height + 1) - (getBorderWidth("top", doc, item) + getBorderWidth("bottom", doc, item)) + "px"; div.style.borderTop=getBorderWidth("top", doc, item) + "px " + getBorderStyle("top", doc, item) + " #" + getBorderColor("top", doc, item); div.style.borderRight=getBorderWidth("right", doc, item) + "px " + getBorderStyle("right", doc, item) + " #" + getBorderColor("right", doc, item); div.style.borderBottom=getBorderWidth("bottom", doc, item) + "px " + getBorderStyle("bottom", doc, item) + " #" + getBorderColor("bottom", doc, item); div.style.borderLeft=getBorderWidth("left", doc, item) + "px " + getBorderStyle("left", doc, item) + " #" + getBorderColor("left", doc, item); return div; }; function getCanvas(doc, item, ctx) { var canvas=document.createElement("canvas"); canvas.id=item.id + (_ubi_cindex++)+ "cv"; return canvas; }; function getImage(doc, item, keyurl, ds) { var x=Math.round(item.x * ds); var y=Math.round(item.y * ds); var width=Math.round((item.x+item.width) * ds) - x; var height=Math.round((item.y+item.height) * ds)- y; var image=document.createElement("img"); image.id=item.id + (_ubi_iindex++)+ "img"; image.src=keyurl + "&cHJvY2lk=GATEWAY&reqtype=3&serviceid="+doc.serviceid+"&imageid=" + item.loadsrc; image.style.position="absolute"; image.style.left=0 + "px"; image.style.top=0 + "px"; image.style.width=(width + 1) + "px"; image.style.height=(height + 1) + "px"; return image; }; function getImage2(doc, item, keyurl, imageobj, ds) { var x=Math.round(item.x * ds); var y=Math.round(item.y * ds); var width=Math.round((item.x+item.width) * ds) - x; var height=Math.round((item.y+item.height) * ds)- y; var image=document.createElement("img"); image.id=item.id + (_ubi_iindex++)+ "img"; image.src=keyurl + "&cHJvY2lk=GATEWAY&reqtype=3&serviceid="+doc.serviceid+"&imageid=" + imageobj.loadsrc; if( imageobj.fixedrate || imageobj.originalsize ) { var imgleft=0; var imgtop=0; var imgwidth=(Math.round(imageobj.width*ds) / 3) + 1; var imgheight=(Math.round(imageobj.height*ds) / 3) + 1; if( imgwidth < (width + 1) && item.halign != 0 ) { if( item.halign == 1 ) imgleft=((width + 1) - imgwidth) / 2; else if( item.halign == 2 ) imgleft=((width + 1) - imgwidth); } if( imgheight < (height + 1) && item.valign != 0 ) { if( item.valign == 1 ) imgtop=((height + 1) - imgheight) / 2; else if( item.valign == 2 ) imgtop=((height + 1) - imgheight); } image.style.position="absolute"; image.style.left=imgleft + "px"; image.style.top=imgtop + "px"; image.style.width=imgwidth + "px"; image.style.height=imgheight + "px"; } else { image.style.position="absolute"; image.style.left=0 + "px"; image.style.top=0 + "px"; image.style.width=(width + 1) + "px"; image.style.height=(height + 1) + "px"; } return image; }; function getImageType2(imageDiv, doc, item, keyurl, imageobj, ds) { var x=Math.round(item.x * ds); var y=Math.round(item.y * ds); var width=Math.round((item.x+item.width) * ds) - x; var height=Math.round((item.y+item.height) * ds)- y; _ubi_imgcount++; newImg=new Image(); newImg.onload=function(){ var imgWidth=Math.floor(this.width*ds*0.75); var imgHeight=Math.floor(this.height*ds*0.75); var innerhtml=""; var imgsrc=""; if (imageobj.loadtype == 3) { imgsrc=imageobj.loadsrc; if (imgsrc.length > 11 && imgsrc.substr(0,11) != 'data:image/') { var srcarray=[]; srcarray.push('data:image/png;base64,'); srcarray.push(imgsrc); imgsrc=srcarray.join(''); } } else { imgsrc=imageobj.loadsrc; } if (item.valign != 0) { innerhtml += "| "; } if (item.halign != 1) { imageDiv.style.textAlign=item.getHAlign(); } if (imageobj.originalsize) { innerhtml += ""; } else { innerhtml += " |
"; divLoadImage.innerHTML=loadImg; divMain.appendChild(divLoadImage); divMain.appendChild(this._createErrorDialog()); divMain.appendChild(this._createProgress()); divMain.appendChild(this._createStatusBar()); }, resize : function() { try{ if(this.params) { this.divPreviewFrame.style.height=(parseInt(document .getElementById(this.params.divid).style.height) - parseInt(document.getElementById(this.params.divid + "_toolbar").style.height)) + 'px'; if (this.toolbar) { var scale=this.toolbar.getCurrScale(); if (scale == "PageWidth" || scale == "WholePage") { var viewer=this; setTimeout(function(){viewer._changeScale();},5); } } } }catch(e){} }, destroy : function() { _ubi_RemoveAddEvent(this.divPreviewFrame, "scroll", this._scrollUpdate); this.toolbar.destroy(); }, _enableViewer : function() { this.divDisable.style.display="none"; }, _disableViewer : function() { this.divDisable.style.width=this.divMain.style.width; this.divDisable.style.height=this.divMain.style.height; this.divDisable.style.display=""; }, _jobStart : function() { this._disableViewer(); this.divLoadImage.style.display=""; this.divMain.style.cursor="progress"; }, _jobEnd : function() { this.divLoadImage.style.display="none"; this.divMain.style.cursor="default"; this._enableViewer(); }, _showErrorDialog : function(title, msg) { document.getElementById(this.vid+'UbiToolbarPop_Error_Title').innerText=title; document.getElementById(this.vid+'UbiToolbarPop_Error_Contents').innerHTML=msg; document.getElementById(this.vid+'UbiToolbarPop_Error').style.display=''; }, _showStatusBar : function(msg) { document.getElementById(this.vid+'_UbiStatus_Msg').innerText=msg; document.getElementById(this.vid+'_UbiStatus').style.display=''; }, _closeStatusBar : function() { var statusobj=document.getElementById(this.vid+'_UbiStatus'); if (statusobj) { statusobj.style.display='none'; } }, _setStatusBar : function(msg, pagemsg) { document.getElementById(this.vid+'_UbiStatus_Msg').innerText=msg; document.getElementById(this.vid+'_UbiStatus_PageMsg').innerText=pagemsg; }, _showProgress : function(msg) { this._disableViewer(); document.getElementById(this.vid+'_UbiProgress_Msg').innerText=msg; document.getElementById(this.vid+'_UbiProgress_Position').style.width=0 + "px"; document.getElementById(this.vid+'_UbiProgress').style.display=''; }, _closeProgress : function() { document.getElementById(this.vid+'_UbiProgress').style.display='none'; this._enableViewer(); }, _setProgress : function(msg, page, totalpage) { var pos=0; if (page != undefined && _ubi_isNumber(page)) { var barwidth=196; var edgewidth=7*2; pos=Math.floor((barwidth - edgewidth) * (parseInt(page) / totalpage)); msg += " ("+ page +"/"+ totalpage +")"; } document.getElementById(this.vid+'_UbiProgress_Msg').innerText=msg; document.getElementById(this.vid+'_UbiProgress_Position').style.width=pos + "px"; }, _createErrorDialog : function() { var str=[]; var i=0; var obj=document.createElement("div"); obj.id=this.vid+"UbiToolbarPop_Error"; obj.className="dialog"; obj.style.cssText='display:none;position:absolute;z-index:999999104;left:50%;top:50%;width:450px;height:300px;margin-left:-225px;margin-top:-150px;border:1px solid #555555; background:#fff;'; str[i++]="| " + _ubi_getMessage(this.params.language, "ExportMsg") + " | "); str.push("
| "); str.push(" | "); str.push(" | "); str.push(" |
| " + _ubi_getMessage(this.params.language, "StreamingMsg") + " | "); str.push("
| " + _ubi_getMessage(this.params.language, "StatusWaitMsg") + " | "); str.push("
"; divPreview.appendChild(divLoadImage); this.divPreviewFrame.appendChild(divPreview); return divPreview; }, _drawPage : function(preview, page) { var isSvg=_ubi_strToBool(this.params.issvg); var scale=this.toolbar.getCurrScale(); var frame=document.getElementById(this.vid+"_previewframe"); var frameWidth=frame.clientWidth; if (page == 1 && (scale == "PageWidth" || scale == "WholePage")) { frameWidth -= 17; } var frameHeight=frame.clientHeight; var framemargin=2; var isloaded=preview.getAttribute("isloaded"); var baseScale=1.0; if (isSvg) { baseScale=2.0; } var ds=1.0; if (scale != "PageWidth" && scale != "WholePage") { ds=parseInt(scale)/100; this.ds=ds; } if (_ubi_strToInt(this.styles.margin) > 0) { framemargin += parseInt(this.styles.margin) * 2; } if (isSvg && isloaded == "true") { var children=preview.children; var svgObj=null; if (children) { svgObj=children[0]; var svgWidth=parseInt(svgObj.getAttribute("orgwidth")); var svgHeight=parseInt(svgObj.getAttribute("orgheight")); if (page == 1) { this.totalPage=parseInt(svgObj.getAttribute("totalpage")); this.params.serviceid=svgObj.getAttribute("serviceid"); this.pageOrientation=svgObj.getAttribute("orientation"); this.pageWidth=svgWidth; this.pageHeight=svgHeight; if (page == this.totalPage) { preview.style.marginBottom=this.styles.margin + "px"; } } preview.setAttribute("orgwidth", svgWidth); preview.setAttribute("orgheight", svgHeight); if (scale == "PageWidth") { ds=(frameWidth-framemargin) / (svgWidth / baseScale); var height=svgHeight / baseScale * ds; if ((height+framemargin) > frameHeight && page == 1) { if (__ubi_isIE && __ubi_ieVersion < 8) { frameWidth=frame.clientWidth - 17; } else { preview.style.height=(height) +"px"; preview.style.display=""; frameWidth=frame.clientWidth; } frameWidth=frame.clientWidth; ds=(frameWidth-framemargin) / (svgWidth / baseScale); } } else if (scale == "WholePage") { ds=Math.min((frameHeight-framemargin) / (svgHeight / baseScale), (frameWidth-framemargin) / (svgWidth / baseScale)); } svgWidth=svgWidth / baseScale * ds; svgHeight=svgHeight / baseScale * ds; var conscale=ds / baseScale; svgObj.setAttribute("width", svgWidth); svgObj.setAttribute("height", svgHeight); if (__ubi_isIE) { svgObj.setAttribute("letter-spacing", (-0.15*baseScale*2)+"px"); } else { svgObj.setAttribute("letter-spacing", (-0.15*baseScale)+"px"); } var gObj=svgObj.childNodes; if (gObj) { for (var i=0; i
"; divLoadImage.innerHTML=loadImg; divMain.appendChild(divLoadImage); divMain.appendChild(this._createErrorDialog()); divMain.appendChild(this._createProgress()); divMain.appendChild(this._createStatusBar()); }, resize : function() { try{ if(this.params) { this.divPreviewFrame.style.height=(parseInt(document .getElementById(this.params.divid).style.height) - parseInt(document.getElementById(this.params.divid + "_toolbar").style.height)) + 'px'; if (this.toolbar) { var scale=this.toolbar.getCurrScale(); if (scale == "PageWidth" || scale == "WholePage") { var viewer=this; setTimeout(function(){viewer._changeScale();},5); } } } }catch(e){} }, destroy : function() { _ubi_RemoveAddEvent(this.divPreviewFrame, "scroll", this._scrollUpdate); this.toolbar.destroy(); }, _enableViewer : function() { this.divDisable.style.display="none"; }, _disableViewer : function() { this.divDisable.style.width=this.divMain.style.width; this.divDisable.style.height=this.divMain.style.height; this.divDisable.style.display=""; }, _jobStart : function() { this._disableViewer(); this.divLoadImage.style.display=""; this.divMain.style.cursor="progress"; }, _jobEnd : function() { this.divLoadImage.style.display="none"; this.divMain.style.cursor="default"; this._enableViewer(); }, _showErrorDialog : function(title, msg) { document.getElementById(this.vid+'UbiToolbarPop_Error_Title').innerText=title; document.getElementById(this.vid+'UbiToolbarPop_Error_Contents').innerHTML=msg; document.getElementById(this.vid+'UbiToolbarPop_Error').style.display=''; }, _showStatusBar : function(msg) { document.getElementById(this.vid+'_UbiStatus_Msg').innerText=msg; document.getElementById(this.vid+'_UbiStatus').style.display=''; }, _closeStatusBar : function() { var statusobj=document.getElementById(this.vid+'_UbiStatus'); if (statusobj) { statusobj.style.display='none'; } }, _setStatusBar : function(msg, pagemsg) { document.getElementById(this.vid+'_UbiStatus_Msg').innerText=msg; document.getElementById(this.vid+'_UbiStatus_PageMsg').innerText=pagemsg; }, _showProgress : function(msg) { this._disableViewer(); document.getElementById(this.vid+'_UbiProgress_Msg').innerText=msg; document.getElementById(this.vid+'_UbiProgress_Position').style.width=0 + "px"; document.getElementById(this.vid+'_UbiProgress').style.display=''; }, _closeProgress : function() { document.getElementById(this.vid+'_UbiProgress').style.display='none'; this._enableViewer(); }, _setProgress : function(msg, page, totalpage) { var pos=0; if (page != undefined && _ubi_isNumber(page)) { var barwidth=196; var edgewidth=7*2; pos=Math.floor((barwidth - edgewidth) * (parseInt(page) / totalpage)); msg += " ("+ page +"/"+ totalpage +")"; } document.getElementById(this.vid+'_UbiProgress_Msg').innerText=msg; document.getElementById(this.vid+'_UbiProgress_Position').style.width=pos + "px"; }, _createErrorDialog : function() { var str=[]; var i=0; var obj=document.createElement("div"); obj.id=this.vid+"UbiToolbarPop_Error"; obj.className="dialog"; obj.style.cssText='display:none;position:absolute;z-index:999999104;left:50%;top:50%;width:450px;height:300px;margin-left:-225px;margin-top:-150px;border:1px solid #555555; background:#fff;'; str[i++]="
"; divPreview.appendChild(divLoadImage); this.divPreviewFrame.appendChild(divPreview); return divPreview; }, _drawPage : function(preview, page) { var isSvg=_ubi_strToBool(this.params.issvg); var scale=this.toolbar.getCurrScale(); var frame=document.getElementById(this.vid+"_previewframe"); var frameWidth=frame.clientWidth; if (page == 1 && (scale == "PageWidth" || scale == "WholePage")) { frameWidth -= 17; } var frameHeight=frame.clientHeight; var framemargin=2; var isloaded=preview.getAttribute("isloaded"); var baseScale=1.0; if (isSvg) { baseScale=2.0; } var ds=1.0; if (scale != "PageWidth" && scale != "WholePage") { ds=parseInt(scale)/100; this.ds=ds; } if (_ubi_strToInt(this.styles.margin) > 0) { framemargin += parseInt(this.styles.margin) * 2; } if (isSvg && isloaded == "true") { var children=preview.children; var svgObj=null; if (children) { svgObj=children[0]; var svgWidth=parseInt(svgObj.getAttribute("orgwidth")); var svgHeight=parseInt(svgObj.getAttribute("orgheight")); if (page == 1) { this.totalPage=parseInt(svgObj.getAttribute("totalpage")); this.params.serviceid=svgObj.getAttribute("serviceid"); this.pageOrientation=svgObj.getAttribute("orientation"); this.pageWidth=svgWidth; this.pageHeight=svgHeight; if (page == this.totalPage) { preview.style.marginBottom=this.styles.margin + "px"; } } preview.setAttribute("orgwidth", svgWidth); preview.setAttribute("orgheight", svgHeight); if (scale == "PageWidth") { ds=(frameWidth-framemargin) / (svgWidth / baseScale); var height=svgHeight / baseScale * ds; if ((height+framemargin) > frameHeight && page == 1) { if (__ubi_isIE && __ubi_ieVersion < 8) { frameWidth=frame.clientWidth - 17; } else { preview.style.height=(height) +"px"; preview.style.display=""; frameWidth=frame.clientWidth; } frameWidth=frame.clientWidth; ds=(frameWidth-framemargin) / (svgWidth / baseScale); } } else if (scale == "WholePage") { ds=Math.min((frameHeight-framemargin) / (svgHeight / baseScale), (frameWidth-framemargin) / (svgWidth / baseScale)); } svgWidth=svgWidth / baseScale * ds; svgHeight=svgHeight / baseScale * ds; var conscale=ds / baseScale; svgObj.setAttribute("width", svgWidth); svgObj.setAttribute("height", svgHeight); if (__ubi_isIE) { svgObj.setAttribute("letter-spacing", (-0.15*baseScale*2)+"px"); } else { svgObj.setAttribute("letter-spacing", (-0.15*baseScale)+"px"); } var gObj=svgObj.childNodes; if (gObj) { for (var i=0; i