Commit 08b13508 authored by Anna.Pavlova's avatar Anna.Pavlova

1. убрала текстовые настройки для отрисовки мат объектов (вместо этого запрос ctrPrp) для "чтения"

2. переделала remove_internal для удаления объектов


git-svn-id: svn://192.168.3.15/activex/AVS/Sources/TeamlabOffice/trunk/OfficeWeb@51899 954022d7-b5bf-4e40-9824-e11837661b57
parent b1c0aac9
...@@ -17,6 +17,7 @@ ...@@ -17,6 +17,7 @@
function CCircumflex() function CCircumflex()
{ {
//this.incline = 0; //this.incline = 0;
this.Parent = null;
this.turn = TURN_0; this.turn = TURN_0;
} }
CCircumflex.prototype.setTurn = function(turn) CCircumflex.prototype.setTurn = function(turn)
...@@ -25,7 +26,7 @@ CCircumflex.prototype.setTurn = function(turn) ...@@ -25,7 +26,7 @@ CCircumflex.prototype.setTurn = function(turn)
} }
CCircumflex.prototype.fixSize = function(mesure, bIncl) CCircumflex.prototype.fixSize = function(mesure, bIncl)
{ {
var alpha = this.txtPrp.FontSize/36; var alpha = this.Parent.getCtrPrp().FontSize/36;
var width = 3.88*alpha; var width = 3.88*alpha;
var height = 3.175*alpha; var height = 3.175*alpha;
...@@ -77,9 +78,9 @@ CCircumflex.prototype.draw = function(pGraphics) ...@@ -77,9 +78,9 @@ CCircumflex.prototype.draw = function(pGraphics)
var x = this.pos.x, var x = this.pos.x,
y = this.pos.y; y = this.pos.y;
var fontSize = this.txtPrp.FontSize; var fontSize = this.Parent.getCtrPrp().FontSize;
var penW = fontSize*g_dKoef_pt_to_mm*this.PEN_W; var penW = fontSize*g_dKoef_pt_to_mm*this.PEN_W;
penW *= 96/25.4; penW *= 96/25.4;
// g_dKoef_px_to_mm = 25.4/96 // g_dKoef_px_to_mm = 25.4/96
...@@ -173,23 +174,24 @@ CCircumflex.prototype.draw = function(pGraphics) ...@@ -173,23 +174,24 @@ CCircumflex.prototype.draw = function(pGraphics)
pGraphics.SetIntegerGrid(intGrid); pGraphics.SetIntegerGrid(intGrid);
} }
CCircumflex.prototype.setTxtPrp = function(txtPrp)
{
this.txtPrp = txtPrp;
}
CCircumflex.prototype.setPosition = function(pos) CCircumflex.prototype.setPosition = function(pos)
{ {
this.pos = pos; this.pos = pos;
} }
CCircumflex.prototype.relate = function(parent)
{
this.Parent = parent;
}
function CLine() function CLine()
{ {
this.PEN_W = 0.04; this.PEN_W = 0.04;
this.Parent = null;
} }
CLine.prototype.fixSize = function(measure) CLine.prototype.fixSize = function(measure)
{ {
var alpha = this.txtPrp.FontSize/36; var alpha = this.Parent.getCtrPrp().FontSize/36;
var height = 1.68*alpha; var height = 1.68*alpha;
var width = 4.938*alpha; var width = 4.938*alpha;
...@@ -200,7 +202,8 @@ CLine.prototype.fixSize = function(measure) ...@@ -200,7 +202,8 @@ CLine.prototype.fixSize = function(measure)
} }
CLine.prototype.draw = function(pGraphics) CLine.prototype.draw = function(pGraphics)
{ {
var penW = this.txtPrp.FontSize*g_dKoef_pt_to_mm*this.PEN_W; var fontSize = this.Parent.getCtrPrp().FontSize;
var penW = fontSize*g_dKoef_pt_to_mm*this.PEN_W;
//penW *= 96/25.4; //penW *= 96/25.4;
//var penY = penW/2*25.4/96; //для того чтобы линии совпадали (для одинарной и двойной черты) //var penY = penW/2*25.4/96; //для того чтобы линии совпадали (для одинарной и двойной черты)
...@@ -227,18 +230,19 @@ CLine.prototype.setPosition = function(pos) ...@@ -227,18 +230,19 @@ CLine.prototype.setPosition = function(pos)
{ {
this.pos = pos; this.pos = pos;
} }
CLine.prototype.setTxtPrp = function(txtPrp) CLine.prototype.relate = function(parent)
{ {
this.txtPrp = txtPrp; this.Parent = parent;
} }
function CDoubleLine() function CDoubleLine()
{ {
this.PEN_W = 0.04; this.PEN_W = 0.04;
this.Parent = null;
} }
CDoubleLine.prototype.fixSize = function(measure) CDoubleLine.prototype.fixSize = function(measure)
{ {
var alpha = this.txtPrp.FontSize/36; var alpha = this.Parent.getCtrPrp().FontSize/36;
var height = 2.843*alpha; var height = 2.843*alpha;
var width = 4.938*alpha; var width = 4.938*alpha;
...@@ -251,13 +255,10 @@ CDoubleLine.prototype.setPosition = function(pos) ...@@ -251,13 +255,10 @@ CDoubleLine.prototype.setPosition = function(pos)
{ {
this.pos = pos; this.pos = pos;
} }
CDoubleLine.prototype.setTxtPrp = function(txtPrp)
{
this.txtPrp = txtPrp;
}
CDoubleLine.prototype.draw = function(pGraphics) CDoubleLine.prototype.draw = function(pGraphics)
{ {
var penW = this.txtPrp.FontSize*g_dKoef_pt_to_mm*this.PEN_W; var fontSize = this.Parent.getCtrPrp().FontSize;
var penW = fontSize*g_dKoef_pt_to_mm*this.PEN_W;
//penW *= 96/25.4; //penW *= 96/25.4;
//var penY = penW/2*25.4/96; //для того чтобы линии совпадали (для одинарной и двойной черты) //var penY = penW/2*25.4/96; //для того чтобы линии совпадали (для одинарной и двойной черты)
...@@ -282,13 +283,17 @@ CDoubleLine.prototype.draw = function(pGraphics) ...@@ -282,13 +283,17 @@ CDoubleLine.prototype.draw = function(pGraphics)
pGraphics.ds(); pGraphics.ds();
} }
CDoubleLine.prototype.relate = function(parent)
{
this.Parent = parent;
}
function CTilde() function CTilde()
{ {
} }
CTilde.prototype.fixSize = function() CTilde.prototype.fixSize = function()
{ {
var betta = this.txtPrp.FontSize/36; var betta = this.Parent.getCtrPrp().FontSize/36;
var width = 9.047509765625*betta; // реальная на отрисовке width 7.495282031249999 var width = 9.047509765625*betta; // реальная на отрисовке width 7.495282031249999
var height = 2.469444444444444*betta; var height = 2.469444444444444*betta;
...@@ -332,8 +337,7 @@ CTilde.prototype.draw = function(pGraphics) ...@@ -332,8 +337,7 @@ CTilde.prototype.draw = function(pGraphics)
var XX = new Array(), var XX = new Array(),
YY = new Array(); YY = new Array();
var fontSize = this.txtPrp.FontSize; var fontSize = this.Parent.getCtrPrp().FontSize;
var textScale = fontSize/1000, // 1000 pt var textScale = fontSize/1000, // 1000 pt
alpha = textScale*25.4/96 /64 ; // g_dKoef_px_to_mm = 25.4/96 alpha = textScale*25.4/96 /64 ; // g_dKoef_px_to_mm = 25.4/96
...@@ -383,9 +387,9 @@ CTilde.prototype.setPosition = function(pos) ...@@ -383,9 +387,9 @@ CTilde.prototype.setPosition = function(pos)
{ {
this.pos = pos; this.pos = pos;
} }
CTilde.prototype.setTxtPrp = function(txtPrp) CTilde.prototype.relate = function(parent)
{ {
this.txtPrp = txtPrp; this.Parent = parent;
} }
function CBreve() function CBreve()
...@@ -398,7 +402,7 @@ CBreve.prototype.setTurn = function(tturn) ...@@ -398,7 +402,7 @@ CBreve.prototype.setTurn = function(tturn)
} }
CBreve.prototype.fixSize = function() CBreve.prototype.fixSize = function()
{ {
var betta = this.txtPrp.FontSize/36; var betta = this.Parent.getCtrPrp().FontSize/36;
var width = 4.2333333333333325*betta; var width = 4.2333333333333325*betta;
var height = 2.469444444444445*betta; var height = 2.469444444444445*betta;
...@@ -442,8 +446,7 @@ CBreve.prototype.draw = function(pGraphics) ...@@ -442,8 +446,7 @@ CBreve.prototype.draw = function(pGraphics)
var XX = new Array(), var XX = new Array(),
YY = new Array(); YY = new Array();
var fontSize = this.txtPrp.FontSize; var fontSize = this.Parent.getCtrPrp().FontSize;
var textScale = fontSize/1000, // 1000 pt var textScale = fontSize/1000, // 1000 pt
alpha = textScale*25.4/96 /64 ; // g_dKoef_px_to_mm = 25.4/96 alpha = textScale*25.4/96 /64 ; // g_dKoef_px_to_mm = 25.4/96
...@@ -500,15 +503,16 @@ CBreve.prototype.draw = function(pGraphics) ...@@ -500,15 +503,16 @@ CBreve.prototype.draw = function(pGraphics)
pGraphics.SetIntegerGrid(intGrid); pGraphics.SetIntegerGrid(intGrid);
} }
CBreve.prototype.setTxtPrp = function(txtPrp) CBreve.prototype.relate = function(parent)
{ {
this.txtPrp = txtPrp; this.Parent = parent;
} }
function CSign() function CSign()
{ {
this.sign = new CMathText(); this.sign = new CMathText();
this.type = null; this.type = null;
this.Parent = null;
} }
CSign.prototype.setSign = function(props) CSign.prototype.setSign = function(props)
{ {
...@@ -575,7 +579,7 @@ CSign.prototype.fixSize = function(bIncline) ...@@ -575,7 +579,7 @@ CSign.prototype.fixSize = function(bIncline)
{ {
this.sign.recalculateSize(); this.sign.recalculateSize();
this.dH = 0.7*this.txtPrp.FontSize/36; this.dH = 0.7*this.Parent.getCtrPrp().FontSize/36;
var height = this.sign.size.height + this.dH, var height = this.sign.size.height + this.dH,
width = this.sign.size.widthG; width = this.sign.size.widthG;
...@@ -589,10 +593,9 @@ CSign.prototype.draw = function(pGraphics) ...@@ -589,10 +593,9 @@ CSign.prototype.draw = function(pGraphics)
{ {
this.sign.draw(pGraphics); this.sign.draw(pGraphics);
} }
CSign.prototype.setTxtPrp = function(txtPrp) CSign.prototype.relate = function(parent)
{ {
this.txtPrp = txtPrp; this.Parent = parent;
//this.sign.setTxtPrp(txtPrp);
} }
function old_CAccent() function old_CAccent()
...@@ -1083,7 +1086,4 @@ CAccent.prototype.getCenter = function() ...@@ -1083,7 +1086,4 @@ CAccent.prototype.getCenter = function()
CAccent.prototype.getProps = function() CAccent.prototype.getProps = function()
{ {
var prps = {}; var prps = {};
} }
...@@ -80,6 +80,9 @@ CMathBase.prototype = ...@@ -80,6 +80,9 @@ CMathBase.prototype =
this.alignment.wdt[u] = CENTER; this.alignment.wdt[u] = CENTER;
}, },
///////// RunPrp, CtrPrp
setCtrPrp: function(runPrp) setCtrPrp: function(runPrp)
{ {
this.CtrPrp.Merge(runPrp); // only runPrp for paragraph this.CtrPrp.Merge(runPrp); // only runPrp for paragraph
...@@ -89,9 +92,19 @@ CMathBase.prototype = ...@@ -89,9 +92,19 @@ CMathBase.prototype =
var ctrPrp = new CTextPr(); var ctrPrp = new CTextPr();
ctrPrp.Merge(DEFAULT_RUN_PRP); ctrPrp.Merge(DEFAULT_RUN_PRP);
ctrPrp.Merge(this.CtrPrp); ctrPrp.Merge(this.CtrPrp);
ctrPrp.Merge(this.Composition.GetFirstPrp() );
return ctrPrp;
},
getCtrPrp_2: function()
{
var ctrPrp = new CTextPr();
ctrPrp.Merge(DEFAULT_RUN_PRP);
ctrPrp.Merge(this.CtrPrp);
return ctrPrp; return ctrPrp;
}, },
getPrpToControlLetter: function() // getPrpToControlLetter => getCtrPrp
old_getPrpToControlLetter: function()
{ {
var rPrp = new CTextPr(); var rPrp = new CTextPr();
//rPrp.Merge(DEFAULT_RUN_PRP); //rPrp.Merge(DEFAULT_RUN_PRP);
...@@ -100,6 +113,18 @@ CMathBase.prototype = ...@@ -100,6 +113,18 @@ CMathBase.prototype =
return rPrp; return rPrp;
}, },
addRPrp: function(rPrp)
{
for(var i=0; i < this.nRow; i++)
for(var j = 0; j < this.nCol; j++)
{
if( !this.elements[i][j].IsJustDraw())
this.elements[i][j].addRPrp(rPrp);
}
},
/////////
setComposition: function(composition) setComposition: function(composition)
{ {
this.Composition = composition; this.Composition = composition;
......
...@@ -53,8 +53,7 @@ CBorderBox.prototype.recalculateSize = function() ...@@ -53,8 +53,7 @@ CBorderBox.prototype.recalculateSize = function()
var height = ss.height; var height = ss.height;
var center = ss.center; var center = ss.center;
//this.gapBrd = this.getTxtPrp().FontSize*0.08104587131076388; this.gapBrd = this.getCtrPrp().FontSize*0.08104587131076388;
this.gapBrd = this.getPrpToControlLetter().FontSize*0.08104587131076388;
if(this.bTop) if(this.bTop)
{ {
...@@ -74,9 +73,7 @@ CBorderBox.prototype.recalculateSize = function() ...@@ -74,9 +73,7 @@ CBorderBox.prototype.recalculateSize = function()
CBorderBox.prototype.draw = function(pGraphics) CBorderBox.prototype.draw = function(pGraphics)
{ {
this.elements[0][0].draw(pGraphics); this.elements[0][0].draw(pGraphics);
var penW = this.getCtrPrp().FontSize* 25.4/96 * 0.08 ;
//var penW = this.getTxtPrp().FontSize* 25.4/96 * 0.08 ;
var penW = this.getPrpToControlLetter().FontSize* 25.4/96 * 0.08 ;
if(this.bTop) if(this.bTop)
{ {
......
...@@ -51,6 +51,9 @@ function CDocInfo (obj){ ...@@ -51,6 +51,9 @@ function CDocInfo (obj){
if (typeof obj.UserName != 'undefined'){ if (typeof obj.UserName != 'undefined'){
this.UserName = obj.UserName; this.UserName = obj.UserName;
} }
if (typeof obj.Options != 'undefined'){
this.Options = obj.Options;
}
if (obj.OfflineApp === true) if (obj.OfflineApp === true)
this.OfflineApp = true; this.OfflineApp = true;
} }
...@@ -62,6 +65,7 @@ function CDocInfo (obj){ ...@@ -62,6 +65,7 @@ function CDocInfo (obj){
this.VKey = null; this.VKey = null;
this.UserId = null; this.UserId = null;
this.UserName = null; this.UserName = null;
this.Options = null;
} }
} }
CDocInfo.prototype.get_Id = function(){return this.Id} CDocInfo.prototype.get_Id = function(){return this.Id}
...@@ -80,6 +84,8 @@ CDocInfo.prototype.get_UserId = function(){return this.UserId;} ...@@ -80,6 +84,8 @@ CDocInfo.prototype.get_UserId = function(){return this.UserId;}
CDocInfo.prototype.put_UserId = function(v){this.UserId = v;} CDocInfo.prototype.put_UserId = function(v){this.UserId = v;}
CDocInfo.prototype.get_UserName = function(){return this.UserName;} CDocInfo.prototype.get_UserName = function(){return this.UserName;}
CDocInfo.prototype.put_UserName = function(v){this.UserName = v;} CDocInfo.prototype.put_UserName = function(v){this.UserName = v;}
CDocInfo.prototype.get_Options = function(){return this.Options;}
CDocInfo.prototype.put_Options = function(v){this.Options = v;}
function CListType(obj) function CListType(obj)
{ {
...@@ -449,6 +455,7 @@ CStylesPainter.prototype.get_DocStylesImage = function() { return this.docStyles ...@@ -449,6 +455,7 @@ CStylesPainter.prototype.get_DocStylesImage = function() { return this.docStyles
CStylesPainter.prototype.get_MergedStyles = function() { return this.mergedStyles; } CStylesPainter.prototype.get_MergedStyles = function() { return this.mergedStyles; }
CStylesPainter.prototype.get_STYLE_THUMBNAIL_WIDTH = function() { return this.STYLE_THUMBNAIL_WIDTH; } CStylesPainter.prototype.get_STYLE_THUMBNAIL_WIDTH = function() { return this.STYLE_THUMBNAIL_WIDTH; }
CStylesPainter.prototype.get_STYLE_THUMBNAIL_HEIGHT = function() { return this.STYLE_THUMBNAIL_HEIGHT; } CStylesPainter.prototype.get_STYLE_THUMBNAIL_HEIGHT = function() { return this.STYLE_THUMBNAIL_HEIGHT; }
CStylesPainter.prototype.get_IsRetinaEnabled = function() { return this.IsRetinaEnabled; }
CStyleImage.prototype.get_ThumbnailOffset = function() { return this.ThumbnailOffset; } CStyleImage.prototype.get_ThumbnailOffset = function() { return this.ThumbnailOffset; }
CStyleImage.prototype.get_Type = function() { return this.Type; } CStyleImage.prototype.get_Type = function() { return this.Type; }
...@@ -461,7 +468,7 @@ CFont.prototype.asc_getFontType = function() { return this.type; } ...@@ -461,7 +468,7 @@ CFont.prototype.asc_getFontType = function() { return this.type; }
var DocumentPageSize = new function() { var DocumentPageSize = new function() {
this.oSizes = [{name:"US Letter", w_mm: 215.9, h_mm: 279.4, w_tw: 12240, h_tw: 15840}, this.oSizes = [{name:"US Letter", w_mm: 215.9, h_mm: 279.4, w_tw: 12240, h_tw: 15840},
{name:"US Letter", w_mm: 215.9, h_mm: 355.6, w_tw: 12240, h_tw: 20160}, {name:"US Legal", w_mm: 215.9, h_mm: 355.6, w_tw: 12240, h_tw: 20160},
{name:"A4", w_mm: 210, h_mm: 297, w_tw: 11907, h_tw: 16839}, {name:"A4", w_mm: 210, h_mm: 297, w_tw: 11907, h_tw: 16839},
{name:"A5", w_mm: 148.1, h_mm: 209.9, w_tw: 8391, h_tw: 11907}, {name:"A5", w_mm: 148.1, h_mm: 209.9, w_tw: 8391, h_tw: 11907},
{name:"B5", w_mm: 176, h_mm: 250.1, w_tw: 9979, h_tw: 14175}, {name:"B5", w_mm: 176, h_mm: 250.1, w_tw: 9979, h_tw: 14175},
...@@ -495,6 +502,9 @@ var DocumentPageSize = new function() { ...@@ -495,6 +502,9 @@ var DocumentPageSize = new function() {
function asc_docs_api(name) function asc_docs_api(name)
{ {
History = new CHistory();
g_oTableId = new CTableId();
/************ private!!! **************/ /************ private!!! **************/
this.HtmlElementName = name; this.HtmlElementName = name;
...@@ -529,11 +539,13 @@ function asc_docs_api(name) ...@@ -529,11 +539,13 @@ function asc_docs_api(name)
this.isStartAddShape = false; this.isStartAddShape = false;
this.addShapePreset = ""; this.addShapePreset = "";
this.isShowTableEmptyLine = true; this.isShowTableEmptyLine = true;
this.isShowTableEmptyLineAttack = false;
// CoAuthoring and Chat // CoAuthoring and Chat
this.User = undefined; this.User = undefined;
this.CoAuthoringApi = new CDocsCoApi(); this.CoAuthoringApi = new CDocsCoApi();
this.isCoAuthoringEnable = true; this.isCoAuthoringEnable = true;
this.isCoMarksDraw = false;
// Spell Checking // Spell Checking
this.SpellCheckApi = new CSpellCheckApi(); this.SpellCheckApi = new CSpellCheckApi();
...@@ -542,6 +554,9 @@ function asc_docs_api(name) ...@@ -542,6 +554,9 @@ function asc_docs_api(name)
// Chart // Chart
this.chartTranslate = new asc_CChartTranslate(); this.chartTranslate = new asc_CChartTranslate();
// это чтобы сразу показать ридер, без возможности вернуться в редактор/вьюер
this.isOnlyReaderMode = false;
/**************************************/ /**************************************/
// AutoSave // AutoSave
...@@ -582,6 +597,8 @@ function asc_docs_api(name) ...@@ -582,6 +597,8 @@ function asc_docs_api(name)
this.SelectedObjectsStack = new Array(); this.SelectedObjectsStack = new Array();
this.noCreatePoint = false;
this.OpenDocumentProgress = new CDocOpenProgress(); this.OpenDocumentProgress = new CDocOpenProgress();
this._lastConvertProgress = 0; this._lastConvertProgress = 0;
...@@ -604,12 +621,70 @@ function asc_docs_api(name) ...@@ -604,12 +621,70 @@ function asc_docs_api(name)
this.chartPreviewManager = new ChartPreviewManager(); this.chartPreviewManager = new ChartPreviewManager();
this.IsLongActionCurrent = false; this.IsLongActionCurrent = false;
this.ParcedDocument = false;
this.isStartCoAuthoringOnEndLoad = false; // Подсоединились раньше, чем документ загрузился
this.TrackFile = null;
var oThis = this; var oThis = this;
if(window.addEventListener) if(window.addEventListener)
window.addEventListener("message", function(){ window.addEventListener("message", function(){
oThis.OnHandleMessage.apply(oThis, arguments); oThis.OnHandleMessage.apply(oThis, arguments);
}, false); }, false);
if ("undefined" != typeof(FileReader) && "undefined" != typeof(FormData)) {
//var element = document.body;
var element = document.getElementById(this.HtmlElementName);
if(null != element)
{
element["ondragover"] = function(e) {
e.preventDefault();
if(CanDropFiles(e))
e.dataTransfer.dropEffect = 'copy';
else
e.dataTransfer.dropEffect = 'none';
return false;
};
element["ondrop"] = function(e) {
e.preventDefault();
var files = e.dataTransfer.files;
var nError = ValidateUploadImage(files);
if(c_oAscServerError.NoError == nError)
{
oThis.sync_StartAction(c_oAscAsyncActionType.BlockInteraction, c_oAscAsyncAction.UploadImage);
var file = files[0];
var xhr = new XMLHttpRequest();
var fd = new FormData();
fd.append('file', file);
xhr.open('POST', g_sUploadServiceLocalUrl+'?key='+documentId);
xhr.onreadystatechange = function(){
if(4 == this.readyState)
{
if((this.status == 200 || this.status == 1223))
{
var frameWindow = GetUploadIFrame();
var content = this.responseText;
frameWindow.document.open();
frameWindow.document.write(content);
frameWindow.document.close();
}
else
oThis.asc_fireCallback("asc_onError",c_oAscError.ID.Unknown,c_oAscError.Level.NoCritical);
oThis.sync_EndAction(c_oAscAsyncActionType.BlockInteraction, c_oAscAsyncAction.UploadImage);
}
};
xhr.send(fd);
}
else
oThis.asc_fireCallback("asc_onError",_mapAscServerErrorToAscError(nError),c_oAscError.Level.NoCritical);
};
}
}
if (window.editor == undefined)
{
window.editor = this;
window['editor'] = window.editor;
}
} }
asc_docs_api.prototype.LoadFontsFromServer = function(_fonts) asc_docs_api.prototype.LoadFontsFromServer = function(_fonts)
...@@ -663,6 +738,10 @@ asc_docs_api.prototype.SetUnchangedDocument = function() ...@@ -663,6 +738,10 @@ asc_docs_api.prototype.SetUnchangedDocument = function()
asc_docs_api.prototype.isDocumentModified = function() asc_docs_api.prototype.isDocumentModified = function()
{ {
if (!this.canSave) {
// Пока идет сохранение, мы не закрываем документ
return true;
}
return this.isDocumentModify; return this.isDocumentModify;
} }
...@@ -673,6 +752,28 @@ asc_docs_api.prototype.sync_BeginCatchSelectedElements = function() ...@@ -673,6 +752,28 @@ asc_docs_api.prototype.sync_BeginCatchSelectedElements = function()
} }
asc_docs_api.prototype.sync_EndCatchSelectedElements = function() asc_docs_api.prototype.sync_EndCatchSelectedElements = function()
{ {
if ( !this.chartStyleManager.isReady() || !this.chartPreviewManager.isReady() )
{
for ( var i = 0; i < this.SelectedObjectsStack.length; i++ )
{
if ( this.SelectedObjectsStack[i].Value.ChartProperties )
{
var is_on = History.Is_On();
if(is_on)
{
History.TurnOff();
}
this.chartStyleManager.init();
this.chartPreviewManager.init();
this.asc_fireCallback("asc_onUpdateChartStyles");
if(is_on)
{
History.TurnOn();
}
break;
}
}
}
this.asc_fireCallback("asc_onFocusObject", this.SelectedObjectsStack); this.asc_fireCallback("asc_onFocusObject", this.SelectedObjectsStack);
} }
asc_docs_api.prototype.getSelectedElements = function(bUpdate) asc_docs_api.prototype.getSelectedElements = function(bUpdate)
...@@ -720,11 +821,6 @@ asc_docs_api.prototype.sync_ChangeLastSelectedElement = function(type, obj) ...@@ -720,11 +821,6 @@ asc_docs_api.prototype.sync_ChangeLastSelectedElement = function(type, obj)
asc_docs_api.prototype.Init = function() asc_docs_api.prototype.Init = function()
{ {
if (window.editor == undefined)
{
window.editor = this;
window['editor'] = window.editor;
}
this.WordControl.Init(); this.WordControl.Init();
} }
asc_docs_api.prototype.asc_getEditorPermissions = function() asc_docs_api.prototype.asc_getEditorPermissions = function()
...@@ -733,11 +829,12 @@ asc_docs_api.prototype.asc_getEditorPermissions = function() ...@@ -733,11 +829,12 @@ asc_docs_api.prototype.asc_getEditorPermissions = function()
{ {
var rData = {}; var rData = {};
rData["c"] = "getsettings"; rData["c"] = "getsettings";
rData["id"] = this.DocInfo.get_Id();
rData["format"] = this.DocInfo.get_Format(); rData["format"] = this.DocInfo.get_Format();
rData["vkey"] = this.DocInfo.get_VKey(); rData["vkey"] = this.DocInfo.get_VKey();
rData["editorid"] = c_oEditorId.Word; rData["editorid"] = c_oEditorId.Word;
sendCommand( this, this.asc_getEditorPermissionsCallback, JSON.stringify(rData) ); sendCommand( this, this.asc_getEditorPermissionsCallback, rData );
} }
else else
{ {
...@@ -748,8 +845,8 @@ asc_docs_api.prototype.asc_getEditorPermissions = function() ...@@ -748,8 +845,8 @@ asc_docs_api.prototype.asc_getEditorPermissions = function()
asc_docs_api.prototype.asc_getEditorPermissionsCallback = function(incomeObject) asc_docs_api.prototype.asc_getEditorPermissionsCallback = function(incomeObject)
{ {
if(null != incomeObject && "getsettings" == incomeObject.type){ if(null != incomeObject && "getsettings" == incomeObject["type"]){
var oSettings = JSON.parse(incomeObject.data); var oSettings = JSON.parse(incomeObject["data"]);
//Set up coauthoring and spellcheker service //Set up coauthoring and spellcheker service
window.g_cAscCoAuthoringUrl = oSettings['g_cAscCoAuthoringUrl']; window.g_cAscCoAuthoringUrl = oSettings['g_cAscCoAuthoringUrl'];
...@@ -758,6 +855,28 @@ asc_docs_api.prototype.asc_getEditorPermissionsCallback = function(incomeObject) ...@@ -758,6 +855,28 @@ asc_docs_api.prototype.asc_getEditorPermissionsCallback = function(incomeObject)
var asc_CAscEditorPermissions = window["Asc"].asc_CAscEditorPermissions; var asc_CAscEditorPermissions = window["Asc"].asc_CAscEditorPermissions;
var oEditorPermissions = new asc_CAscEditorPermissions(oSettings); var oEditorPermissions = new asc_CAscEditorPermissions(oSettings);
editor.asc_fireCallback("asc_onGetEditorPermissions", oEditorPermissions); editor.asc_fireCallback("asc_onGetEditorPermissions", oEditorPermissions);
if(undefined != oSettings['trackingInfo'] &&
null != oSettings['trackingInfo'])
{
var asc_CTrackFile = window["Asc"].CTrackFile;
editor.TrackFile = new asc_CTrackFile(oSettings['trackingInfo']);
editor.TrackFile.setDocId(editor.DocInfo.get_Id());
editor.TrackFile.setUserId(editor.DocInfo.get_UserId());
editor.TrackFile.setTrackFunc(sendTrack);
var _isDocumentModified = function(){
return editor.isDocumentModified();
};
editor.TrackFile.setIsDocumentModifiedFunc(_isDocumentModified);
if(undefined != oSettings['TrackingInterval'] &&
null != oSettings['TrackingInterval'])
editor.TrackFile.setInterval(oSettings['TrackingInterval']);
editor.TrackFile.Start();
}
} }
} }
asc_docs_api.prototype.asc_setDocInfo = function(c_DocInfo) asc_docs_api.prototype.asc_setDocInfo = function(c_DocInfo)
...@@ -769,7 +888,6 @@ asc_docs_api.prototype.LoadDocument = function(c_DocInfo) ...@@ -769,7 +888,6 @@ asc_docs_api.prototype.LoadDocument = function(c_DocInfo)
{ {
this.asc_setDocInfo(c_DocInfo); this.asc_setDocInfo(c_DocInfo);
this.WordControl.m_oDrawingDocument.m_bIsOpeningDocument = true; this.WordControl.m_oDrawingDocument.m_bIsOpeningDocument = true;
if(this.DocInfo){ if(this.DocInfo){
...@@ -808,14 +926,24 @@ asc_docs_api.prototype.LoadDocument = function(c_DocInfo) ...@@ -808,14 +926,24 @@ asc_docs_api.prototype.LoadDocument = function(c_DocInfo)
if (this.DocInfo.get_OfflineApp() === true) if (this.DocInfo.get_OfflineApp() === true)
{ {
this.OfflineAppDocumentStartLoad(); this.OfflineAppDocumentStartLoad();
this.asyncServerIdStartLoaded();
return; return;
} }
if(documentId){ if(documentId){
var oOpenOptions = this.DocInfo.get_Options();
if(oOpenOptions && oOpenOptions["isEmpty"])
{
var rData = {"id":documentId, "format": documentFormat, "vkey": documentVKey, "editorid": c_oEditorId.Word, "c":"create", "url": documentUrl, "title": documentTitle, "embeddedfonts": this.isUseEmbeddedCutFonts, "data": g_sEmpty_bin};
sendCommand( oThis, function(){}, rData );
editor.OpenDocument2(g_sResourceServiceLocalUrl + documentId + "/", g_sEmpty_bin);
}
else
{
this.sync_StartAction(c_oAscAsyncActionType.BlockInteraction, c_oAscAsyncAction.Open); this.sync_StartAction(c_oAscAsyncActionType.BlockInteraction, c_oAscAsyncAction.Open);
var rData = {"id":documentId, "format": documentFormat, "vkey": documentVKey, "editorid": c_oEditorId.Word, "c":"open", "url": documentUrl, "title": documentTitle, "embeddedfonts": this.isUseEmbeddedCutFonts}; var rData = {"id":documentId, "format": documentFormat, "vkey": documentVKey, "editorid": c_oEditorId.Word, "c":"open", "url": documentUrl, "title": documentTitle, "embeddedfonts": this.isUseEmbeddedCutFonts};
sendCommand( oThis, function(){}, JSON.stringify(rData) ); sendCommand( oThis, function(){}, rData );
}
this.sync_zoomChangeCallback(this.WordControl.m_nZoomValue, 0); this.sync_zoomChangeCallback(this.WordControl.m_nZoomValue, 0);
} }
else else
...@@ -825,11 +953,12 @@ asc_docs_api.prototype.LoadDocument = function(c_DocInfo) ...@@ -825,11 +953,12 @@ asc_docs_api.prototype.LoadDocument = function(c_DocInfo)
this.DocInfo.put_OfflineApp(true); this.DocInfo.put_OfflineApp(true);
// For test create unique id // For test create unique id
documentId = "0123456789"; documentId = "0123456789qwertty";
this.OfflineAppDocumentStartLoad(); this.OfflineAppDocumentStartLoad();
this.sync_zoomChangeCallback(this.WordControl.m_nZoomValue, 0); this.sync_zoomChangeCallback(this.WordControl.m_nZoomValue, 0);
} }
this.asyncServerIdStartLoaded();
} }
asc_docs_api.prototype.SetFontsPath = function(path) asc_docs_api.prototype.SetFontsPath = function(path)
...@@ -850,6 +979,11 @@ asc_docs_api.prototype.ChangeReaderMode = function() ...@@ -850,6 +979,11 @@ asc_docs_api.prototype.ChangeReaderMode = function()
{ {
return this.WordControl.ChangeReaderMode(); return this.WordControl.ChangeReaderMode();
} }
asc_docs_api.prototype.SetReaderModeOnly = function()
{
this.isOnlyReaderMode = true;
this.ImageLoader.bIsAsyncLoadDocumentImages = false;
}
asc_docs_api.prototype.IncreaseReaderFontSize = function() asc_docs_api.prototype.IncreaseReaderFontSize = function()
{ {
...@@ -951,7 +1085,10 @@ asc_docs_api.prototype.GetCopyPasteDivId = function() ...@@ -951,7 +1085,10 @@ asc_docs_api.prototype.GetCopyPasteDivId = function()
asc_docs_api.prototype.ContentToHTML = function(bIsRet) asc_docs_api.prototype.ContentToHTML = function(bIsRet)
{ {
this.DocumentReaderMode = new CDocumentReaderMode(); this.DocumentReaderMode = new CDocumentReaderMode();
var _old = copyPasteUseBinery;
copyPasteUseBinery = false;
Editor_Copy(this); Editor_Copy(this);
copyPasteUseBinery = _old;
this.DocumentReaderMode = null; this.DocumentReaderMode = null;
return document.getElementById("SelectId").innerHTML; return document.getElementById("SelectId").innerHTML;
} }
...@@ -1001,30 +1138,6 @@ asc_docs_api.prototype.LoadDocumentFromDisk = function() ...@@ -1001,30 +1138,6 @@ asc_docs_api.prototype.LoadDocumentFromDisk = function()
} }
} }
asc_docs_api.prototype.OpenEmptyDocument = function()
{
editor.InitEditor();
this.LoadedObject = null;
this.DocumentType = 0;
this.WordControl.m_oLogicDocument.Fonts = [];
this.asyncServerIdStartLoaded();
this.FontLoader.LoadDocumentFonts(new Array(), true);
}
asc_docs_api.prototype.OpenTestDocument = function()
{
// For test create unique id
documentId = "0123456789";
editor.InitEditor();
this.LoadedObject = null;
this.DocumentType = 1;
this.WordControl.m_oLogicDocument.Fonts = [];
this.WordControl.m_oLogicDocument.ImageMap = {};
this.asyncServerIdStartLoaded();
this.FontLoader.LoadDocumentFonts(new Array(), true);
}
asc_docs_api.prototype.OpenTestDocumentViewer = function() asc_docs_api.prototype.OpenTestDocumentViewer = function()
{ {
this.LoadedObject = null; this.LoadedObject = null;
...@@ -1038,6 +1151,7 @@ asc_docs_api.prototype.OpenTestDocumentViewer = function() ...@@ -1038,6 +1151,7 @@ asc_docs_api.prototype.OpenTestDocumentViewer = function()
asc_docs_api.prototype.OpenDocument = function(url, gObject) asc_docs_api.prototype.OpenDocument = function(url, gObject)
{ {
this.isOnlyReaderMode = false;
this.InitViewer(); this.InitViewer();
this.LoadedObject = null; this.LoadedObject = null;
this.DocumentType = 1; this.DocumentType = 1;
...@@ -1077,6 +1191,28 @@ asc_docs_api.prototype.OpenDocument2 = function(url, gObject) ...@@ -1077,6 +1191,28 @@ asc_docs_api.prototype.OpenDocument2 = function(url, gObject)
else else
editor.asc_fireCallback("asc_onError",c_oAscError.ID.MobileUnexpectedCharCount,c_oAscError.Level.Critical); editor.asc_fireCallback("asc_onError",c_oAscError.ID.MobileUnexpectedCharCount,c_oAscError.Level.Critical);
//callback
editor.DocumentOrientation = (null == editor.WordControl.m_oLogicDocument) ? true : !editor.WordControl.m_oLogicDocument.Orientation;
var sizeMM;
if(editor.DocumentOrientation)
sizeMM = DocumentPageSize.getSize(Page_Width, Page_Height);
else
sizeMM = DocumentPageSize.getSize(Page_Height, Page_Width);
editor.sync_DocSizeCallback(sizeMM.w_mm, sizeMM.h_mm);
editor.sync_PageOrientCallback(editor.get_DocumentOrientation());
this.ParcedDocument = true;
if (this.isStartCoAuthoringOnEndLoad) {
this.CoAuthoringApi.onStartCoAuthoring(true);
this.isStartCoAuthoringOnEndLoad = false;
}
if (this.isMobileVersion)
{
window.USER_AGENT_SAFARI_MACOS = false;
PASTE_ELEMENT_ID = "wrd_pastebin";
ELEMENT_DISPAY_STYLE = "none";
}
if (window.USER_AGENT_SAFARI_MACOS) if (window.USER_AGENT_SAFARI_MACOS)
setInterval(SafariIntervalFocus, 10); setInterval(SafariIntervalFocus, 10);
...@@ -1114,47 +1250,6 @@ asc_docs_api.prototype.asc_registerCallback = function(name, callback) { ...@@ -1114,47 +1250,6 @@ asc_docs_api.prototype.asc_registerCallback = function(name, callback) {
if (!_callbacks.hasOwnProperty(name)) if (!_callbacks.hasOwnProperty(name))
_callbacks[name] = []; _callbacks[name] = [];
_callbacks[name].push(callback); _callbacks[name].push(callback);
if ("asc_onInitEditorFonts" == name)
{
if (this._gui_fonts != null)
{
this.asc_fireCallback("asc_onInitEditorFonts", this._gui_fonts);
this._gui_fonts = null;
}
}
else if ("asc_onInitEditorStyles" == name)
{
if (this._gui_styles != null)
{
this.asc_fireCallback("asc_onInitEditorStyles", this._gui_styles);
this._gui_styles = null;
}
}
else if ("asc_onInitEditorShapes" == name)
{
this.asc_fireCallback("asc_onInitEditorShapes", g_oAutoShapesGroups, g_oAutoShapesTypes);
}
else if ("asc_onInitStandartTextures" == name)
{
this.sync_InitStandartTextures();
}
else if ("asc_onSendThemeColors" == name)
{
if (this._gui_control_colors != null)
{
this.asc_fireCallback("asc_onSendThemeColors",this._gui_control_colors.Colors, this._gui_control_colors.StandartColors);
this._gui_control_colors = null;
}
}
else if ("asc_onSendThemeColorSchemes" == name)
{
if (this._gui_color_schemes != null)
{
this.asc_fireCallback("asc_onSendThemeColorSchemes", this._gui_color_schemes);
this._gui_color_schemes = null;
}
}
} }
asc_docs_api.prototype.asc_unregisterCallback = function(name, callback) { asc_docs_api.prototype.asc_unregisterCallback = function(name, callback) {
...@@ -1188,6 +1283,43 @@ asc_docs_api.prototype.asc_checkNeedCallback = function(name) { ...@@ -1188,6 +1283,43 @@ asc_docs_api.prototype.asc_checkNeedCallback = function(name) {
return false; return false;
} }
// тут методы, замены евентов
asc_docs_api.prototype.get_PropertyEditorShapes = function()
{
var ret = [g_oAutoShapesGroups, g_oAutoShapesTypes];
return ret;
}
asc_docs_api.prototype.get_PropertyEditorFonts = function()
{
return this._gui_fonts;
}
asc_docs_api.prototype.get_PropertyStandartTextures = function()
{
var _count = g_oUserTexturePresets.length;
var arr = new Array(_count);
for (var i = 0; i < _count; ++i)
{
arr[i] = new CAscTexture();
arr[i].Id = i;
arr[i].Image = g_oUserTexturePresets[i];
}
return arr;
}
asc_docs_api.prototype.get_PropertyEditorStyles = function()
{
return this._gui_styles;
}
asc_docs_api.prototype.get_PropertyThemeColors = function()
{
var _ret = [this._gui_control_colors.Colors, this._gui_control_colors.StandartColors];
return _ret;
}
asc_docs_api.prototype.get_PropertyThemeColorSchemes = function()
{
return this._gui_color_schemes;
}
// -------
///////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////
///////////////////CoAuthoring and Chat api////////////////////////////// ///////////////////CoAuthoring and Chat api//////////////////////////////
///////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////
...@@ -1214,35 +1346,41 @@ asc_docs_api.prototype._coAuthoringInit = function() ...@@ -1214,35 +1346,41 @@ asc_docs_api.prototype._coAuthoringInit = function()
return; // Error return; // Error
} }
if(undefined !== window['g_cAscCoAuthoringUrl']) if (undefined !== window['g_cAscCoAuthoringUrl'])
window.g_cAscCoAuthoringUrl = window['g_cAscCoAuthoringUrl']; window.g_cAscCoAuthoringUrl = window['g_cAscCoAuthoringUrl'];
if (undefined !== window.g_cAscCoAuthoringUrl) {
if(undefined !== window.g_cAscCoAuthoringUrl)
{
//Turn off CoAuthoring feature if it disabled //Turn off CoAuthoring feature if it disabled
if(!this.isCoAuthoringEnable) if (!this.isCoAuthoringEnable)
window.g_cAscCoAuthoringUrl = ""; window.g_cAscCoAuthoringUrl = "";
this.CoAuthoringApi.set_url(window.g_cAscCoAuthoringUrl); this.CoAuthoringApi.set_url(window.g_cAscCoAuthoringUrl);
} }
//���� ������ ����������� ������������, ����� ������� ��� ����������� ������������� ���. //Если User не задан, отключаем коавторинг.
if(undefined === editor.User || null === editor.User || if (null == this.User || null == this.User.asc_getId()) {
undefined === editor.User.asc_getId() || null === editor.User.asc_getId())
{
var asc_user = window["Asc"].asc_CUser; var asc_user = window["Asc"].asc_CUser;
editor.User = new asc_user(); this.User = new asc_user();
editor.User.asc_setId("Unknown"); this.User.asc_setId("Unknown");
editor.User.asc_setUserName("Unknown"); this.User.asc_setUserName("Unknown");
this.CoAuthoringApi.set_url(""); this.CoAuthoringApi.set_url("");
} }
var t = this; var t = this;
this.CoAuthoringApi.onParticipantsChanged = function (e) { t.asc_fireCallback( "asc_onParticipantsChanged", e ); }; this.CoAuthoringApi.onParticipantsChanged = function (e, CountEditUsers)
this.CoAuthoringApi.onAuthParticipantsChanged = function (e) { t.asc_fireCallback( "asc_onAuthParticipantsChanged", e ); }; {
t.asc_fireCallback( "asc_onParticipantsChanged", e );
if ( 1 >= CountEditUsers )
editor.asc_setDrawCollaborationMarks(false);
else
editor.asc_setDrawCollaborationMarks(true);
};
this.CoAuthoringApi.onAuthParticipantsChanged = function (e)
{
t.asc_fireCallback( "asc_onAuthParticipantsChanged", e );
};
this.CoAuthoringApi.onMessage = function (e) { t.asc_fireCallback( "asc_onCoAuthoringChatReceiveMessage", e ); }; this.CoAuthoringApi.onMessage = function (e) { t.asc_fireCallback( "asc_onCoAuthoringChatReceiveMessage", e ); };
this.CoAuthoringApi.onConnectionStateChanged = function (e) { t.asc_fireCallback( "asc_onConnectionStateChanged", e ); }; this.CoAuthoringApi.onConnectionStateChanged = function (e) { t.asc_fireCallback( "asc_onConnectionStateChanged", e ); };
this.CoAuthoringApi.onUserStateChanged = function (e) { t.asc_fireCallback( "asc_onUserStateChanged", e ); };
this.CoAuthoringApi.onLocksAcquired = function (e) this.CoAuthoringApi.onLocksAcquired = function (e)
{ {
if ( 2 != e["state"] ) if ( 2 != e["state"] )
...@@ -1331,32 +1469,32 @@ asc_docs_api.prototype._coAuthoringInit = function() ...@@ -1331,32 +1469,32 @@ asc_docs_api.prototype._coAuthoringInit = function()
CollaborativeEditing.Add_Changes( Changes ); CollaborativeEditing.Add_Changes( Changes );
} }
// т.е. если bSendEvent не задан, то посылаем сообщение // т.е. если bSendEvent не задан, то посылаем сообщение + когда загрузился документ
if ( Count > 0 && false != bSendEvent ) if ( Count > 0 && false != bSendEvent && t.bInit_word_control )
editor.sync_CollaborativeChanges(); t.sync_CollaborativeChanges();
}; };
this.CoAuthoringApi.onFirstLoadChanges = function (e) this.CoAuthoringApi.onFirstLoadChanges = function (e)
{ {
t.CoAuthoringApi.onSaveChanges(e,false); t.CoAuthoringApi.onSaveChanges(e,false);
//** t.asyncServerIdEndLoaded ();
//CollaborativeEditing.Apply_Changes(); //CollaborativeEditing.Apply_Changes();
//**
}; };
this.CoAuthoringApi.onSetIndexUser = function (e) this.CoAuthoringApi.onSetIndexUser = function (e)
{ {
g_oIdCounter.Set_UserId("" + e); g_oIdCounter.Set_UserId("" + e);
t.asyncServerIdEndLoaded ();
}; };
this.CoAuthoringApi.onStartCoAuthoring = function (e) this.CoAuthoringApi.onStartCoAuthoring = function (isStartEvent) {
{ if (t.ParcedDocument) {
CollaborativeEditing.Start_CollaborationEditing(); CollaborativeEditing.Start_CollaborationEditing();
editor.asc_setDrawCollaborationMarks(true);
editor.WordControl.m_oLogicDocument.DrawingDocument.Start_CollaborationEditing(); editor.WordControl.m_oLogicDocument.DrawingDocument.Start_CollaborationEditing();
if ( true != History.Is_Clear() ) if (true != History.Is_Clear()) {
{
CollaborativeEditing.Apply_Changes(); CollaborativeEditing.Apply_Changes();
CollaborativeEditing.Send_Changes(); CollaborativeEditing.Send_Changes();
} }
} else
t.isStartCoAuthoringOnEndLoad = true;
}; };
/** /**
* Event об отсоединении от сервера * Event об отсоединении от сервера
...@@ -1370,15 +1508,15 @@ asc_docs_api.prototype._coAuthoringInit = function() ...@@ -1370,15 +1508,15 @@ asc_docs_api.prototype._coAuthoringInit = function()
if (isDisconnectAtAll) { if (isDisconnectAtAll) {
// Посылаем наверх эвент об отключении от сервера // Посылаем наверх эвент об отключении от сервера
t.asc_fireCallback("asc_onСoAuthoringDisconnect"); t.asc_fireCallback("asc_onСoAuthoringDisconnect");
t.SetViewMode(true, true); t.SetViewMode(true);
if (!isCloseCoAuthoring){ if (!isCloseCoAuthoring){
t.sync_ErrorCallback(c_oAscError.ID.CoAuthoringDisconnect, c_oAscError.Level.NoCritical); t.sync_ErrorCallback(c_oAscError.ID.CoAuthoringDisconnect, c_oAscError.Level.NoCritical);
} }
} }
}; };
this.CoAuthoringApi.init (editor.User, documentId, this.isViewMode, 'fghhfgsjdgfjs', window.location.host, g_sMainServiceLocalUrl, function(){ this.CoAuthoringApi.init (editor.User, documentId, 'fghhfgsjdgfjs', window.location.host, g_sMainServiceLocalUrl, function(){
}); }, c_oEditorId.Word);
// ToDo init other callbacks // ToDo init other callbacks
} }
...@@ -1454,7 +1592,19 @@ asc_docs_api.prototype.autoSaveInit = function (autoSaveGap) { ...@@ -1454,7 +1592,19 @@ asc_docs_api.prototype.autoSaveInit = function (autoSaveGap) {
var t = this; var t = this;
this.autoSaveTimeOutId = setTimeout(function () { this.autoSaveTimeOutId = setTimeout(function () {
t.autoSaveTimeOutId = null; t.autoSaveTimeOutId = null;
if (t.isDocumentModified()) if (t.isViewMode) {
/*
1) При загрузке файла на просмотре при совместном редактировании загрузится
файл уже с последними изменениями.
2) Далее при срабатывании автосохранения должны накатываться новые изменения
(это надо делать) при этом файл отсылаться не должен, т.к. изменений во вьювере нет.
3) Если пользователь отключил автосохранение, то изменения к нему приходить не
будут, поскольку это его решение.
*/
// Принимаем чужие изменения
CollaborativeEditing.Apply_Changes();
t.autoSaveInit();
} else if (t.isDocumentModified())
t.asc_Save(/*isAutoSave*/true); t.asc_Save(/*isAutoSave*/true);
else else
t.autoSaveInit(); t.autoSaveInit();
...@@ -1641,6 +1791,8 @@ function CParagraphFrame(obj) ...@@ -1641,6 +1791,8 @@ function CParagraphFrame(obj)
{ {
if ( obj ) if ( obj )
{ {
this.FromDropCapMenu = false;
this.DropCap = ( dropcap_None === obj.DropCap ? c_oAscDropCap.None : ( dropcap_Drop === obj.DropCap ? c_oAscDropCap.Drop : ( dropcap_Margin === obj.DropCap ? c_oAscDropCap.Margin : undefined ) ) ); this.DropCap = ( dropcap_None === obj.DropCap ? c_oAscDropCap.None : ( dropcap_Drop === obj.DropCap ? c_oAscDropCap.Drop : ( dropcap_Margin === obj.DropCap ? c_oAscDropCap.Margin : undefined ) ) );
this.H = obj.H; this.H = obj.H;
this.HAnchor = obj.HAnchor; this.HAnchor = obj.HAnchor;
...@@ -1655,9 +1807,14 @@ function CParagraphFrame(obj) ...@@ -1655,9 +1807,14 @@ function CParagraphFrame(obj)
this.XAlign = obj.XAlign; this.XAlign = obj.XAlign;
this.Y = obj.Y; this.Y = obj.Y;
this.YAlign = obj.YAlign; this.YAlign = obj.YAlign;
this.Brd = (undefined != obj.Brd && null != obj.Brd) ? new CParagraphBorders (obj.Brd) : null;
this.Shd = (undefined != obj.Shd && null != obj.Shd) ? new CParagraphShd (obj.Shd) : null;
this.FontFamily = (undefined != obj.FontFamily && null != obj.FontFamily) ? new CTextFontFamily (obj.FontFamily) : null;
} }
else else
{ {
this.FromDropCapMenu = false;
this.DropCap = undefined; this.DropCap = undefined;
this.H = undefined; this.H = undefined;
this.HAnchor = undefined; this.HAnchor = undefined;
...@@ -1672,6 +1829,9 @@ function CParagraphFrame(obj) ...@@ -1672,6 +1829,9 @@ function CParagraphFrame(obj)
this.XAlign = undefined; this.XAlign = undefined;
this.Y = undefined; this.Y = undefined;
this.YAlign = undefined; this.YAlign = undefined;
this.Shd = null;
this.Brd = null;
this.FontFamily = null;
} }
} }
...@@ -1703,14 +1863,64 @@ CParagraphFrame.prototype.get_Y = function () { return this.Y; } ...@@ -1703,14 +1863,64 @@ CParagraphFrame.prototype.get_Y = function () { return this.Y; }
CParagraphFrame.prototype.put_Y = function (v) { this.Y = v; } CParagraphFrame.prototype.put_Y = function (v) { this.Y = v; }
CParagraphFrame.prototype.get_YAlign = function () { return this.YAlign; } CParagraphFrame.prototype.get_YAlign = function () { return this.YAlign; }
CParagraphFrame.prototype.put_YAlign = function (v) { this.YAlign = v; } CParagraphFrame.prototype.put_YAlign = function (v) { this.YAlign = v; }
CParagraphFrame.prototype.get_Borders = function () { return this.Brd; }
CParagraphFrame.prototype.put_Borders = function (v) { this.Brd = v; }
CParagraphFrame.prototype.get_Shade = function () { return this.Shd; }
CParagraphFrame.prototype.put_Shade = function (v) { this.Shd = v; }
CParagraphFrame.prototype.get_FontFamily = function () { return this.FontFamily; }
CParagraphFrame.prototype.put_FontFamily = function (v) { this.FontFamily = v; }
CParagraphFrame.prototype.put_FromDropCapMenu = function (v) { this.FromDropCapMenu = v; }
asc_docs_api.prototype.put_FramePr = function(Obj) asc_docs_api.prototype.put_FramePr = function(Obj)
{ {
if ( undefined != Obj.FontFamily )
{
var name = Obj.FontFamily;
Obj.FontFamily = new CTextFontFamily( { Name : Obj.FontFamily, Index : -1 } );
var loader = window.g_font_loader;
var nIndex = loader.map_font_index[name];
var fontinfo = loader.fontInfos[nIndex];
var isasync = loader.LoadFont(fontinfo, editor.asyncFontEndLoaded_DropCap, Obj);
if (false === isasync)
{
if ( false === this.WordControl.m_oLogicDocument.Document_Is_SelectionLocked(changestype_Paragraph_Properties) )
{
this.WordControl.m_oLogicDocument.Create_NewHistoryPoint();
this.WordControl.m_oLogicDocument.Set_ParagraphFramePr( Obj );
}
}
}
else
{
if ( false === this.WordControl.m_oLogicDocument.Document_Is_SelectionLocked(changestype_Paragraph_Properties) )
{
this.WordControl.m_oLogicDocument.Create_NewHistoryPoint();
this.WordControl.m_oLogicDocument.Set_ParagraphFramePr( Obj );
}
}
}
asc_docs_api.prototype.asyncFontEndLoaded_DropCap = function(Obj)
{
this.sync_EndAction(c_oAscAsyncActionType.Information, c_oAscAsyncAction.LoadFont);
if ( false === this.WordControl.m_oLogicDocument.Document_Is_SelectionLocked(changestype_Paragraph_Properties) ) if ( false === this.WordControl.m_oLogicDocument.Document_Is_SelectionLocked(changestype_Paragraph_Properties) )
{ {
this.WordControl.m_oLogicDocument.Create_NewHistoryPoint(); this.WordControl.m_oLogicDocument.Create_NewHistoryPoint();
this.WordControl.m_oLogicDocument.Set_ParagraphFramePr( Obj ); this.WordControl.m_oLogicDocument.Set_ParagraphFramePr( Obj );
} }
// отжать заморозку меню
}
asc_docs_api.prototype.asc_addDropCap = function(bInText)
{
this.WordControl.m_oLogicDocument.Add_DropCap( bInText );
}
asc_docs_api.prototype.removeDropcap = function(bDropCap)
{
this.WordControl.m_oLogicDocument.Remove_DropCap( bDropCap );
} }
function CParagraphProp (obj) function CParagraphProp (obj)
...@@ -1731,6 +1941,7 @@ function CParagraphProp (obj) ...@@ -1731,6 +1941,7 @@ function CParagraphProp (obj)
this.Locked = (undefined != obj.Locked && null != obj.Locked ) ? obj.Locked : false; this.Locked = (undefined != obj.Locked && null != obj.Locked ) ? obj.Locked : false;
this.CanAddTable = (undefined != obj.CanAddTable ) ? obj.CanAddTable : true; this.CanAddTable = (undefined != obj.CanAddTable ) ? obj.CanAddTable : true;
this.FramePr = (undefined != obj.FramePr ) ? new CParagraphFrame( obj.FramePr ) : undefined; this.FramePr = (undefined != obj.FramePr ) ? new CParagraphFrame( obj.FramePr ) : undefined;
this.CanAddDropCap = (undefined != obj.CanAddDropCap ) ? obj.CanAddDropCap : false;
this.Subscript = (undefined != obj.Subscript) ? obj.Subscript : undefined; this.Subscript = (undefined != obj.Subscript) ? obj.Subscript : undefined;
this.Superscript = (undefined != obj.Superscript) ? obj.Superscript : undefined; this.Superscript = (undefined != obj.Superscript) ? obj.Superscript : undefined;
...@@ -1772,6 +1983,7 @@ function CParagraphProp (obj) ...@@ -1772,6 +1983,7 @@ function CParagraphProp (obj)
this.Locked = false; this.Locked = false;
this.CanAddTable = true; this.CanAddTable = true;
this.Tabs = undefined; this.Tabs = undefined;
this.CanAddDropCap = false;
this.Subscript = undefined; this.Subscript = undefined;
this.Superscript = undefined; this.Superscript = undefined;
...@@ -1826,6 +2038,7 @@ CParagraphProp.prototype.get_DefaultTab = function () { return this.DefaultTab; ...@@ -1826,6 +2038,7 @@ CParagraphProp.prototype.get_DefaultTab = function () { return this.DefaultTab;
CParagraphProp.prototype.put_DefaultTab = function (v) { this.DefaultTab = v; } CParagraphProp.prototype.put_DefaultTab = function (v) { this.DefaultTab = v; }
CParagraphProp.prototype.get_FramePr = function () { return this.FramePr; } CParagraphProp.prototype.get_FramePr = function () { return this.FramePr; }
CParagraphProp.prototype.put_FramePr = function (v) { this.FramePr = v; } CParagraphProp.prototype.put_FramePr = function (v) { this.FramePr = v; }
CParagraphProp.prototype.get_CanAddDropCap = function() { return this.CanAddDropCap; }
// Paragraph properties // Paragraph properties
function CParagraphPropEx (obj) function CParagraphPropEx (obj)
...@@ -2227,7 +2440,7 @@ asc_docs_api.prototype.UpdateParagraphProp = function(ParaPr) ...@@ -2227,7 +2440,7 @@ asc_docs_api.prototype.UpdateParagraphProp = function(ParaPr)
else else
ParaPr.StyleName = this.WordControl.m_oLogicDocument.Styles.Style[ParaPr.PStyle].Name; ParaPr.StyleName = this.WordControl.m_oLogicDocument.Styles.Style[ParaPr.PStyle].Name;
if ( null == ParaPr.NumPr || 0 === ParaPr.NumPr.NumId ) if ( null == ParaPr.NumPr || 0 === ParaPr.NumPr.NumId || "0" === ParaPr.NumPr.NumId )
ParaPr.ListType = {Type: -1, SubType : -1}; ParaPr.ListType = {Type: -1, SubType : -1};
else else
{ {
...@@ -2255,19 +2468,6 @@ asc_docs_api.prototype.UpdateParagraphProp = function(ParaPr) ...@@ -2255,19 +2468,6 @@ asc_docs_api.prototype.UpdateParagraphProp = function(ParaPr)
this.sync_PrPropCallback(ParaPr); this.sync_PrPropCallback(ParaPr);
} }
asc_docs_api.prototype.sync_InitStandartTextures = function()
{
var _count = g_oUserTexturePresets.length;
var arr = new Array(_count);
for (var i = 0; i < _count; ++i)
{
arr[i] = new CAscTexture();
arr[i].Id = i;
arr[i].Image = g_oUserTexturePresets[i];
}
this.asc_fireCallback("asc_onInitStandartTextures", arr);
}
/*----------------------------------------------------------------*/ /*----------------------------------------------------------------*/
/*functions for working with clipboard, document*/ /*functions for working with clipboard, document*/
/*TODO: Print,Undo,Redo,Copy,Cut,Paste,Share,Save,DownloadAs,ReturnToDocuments(вернуться на предыдущую страницу) & callbacks for these functions*/ /*TODO: Print,Undo,Redo,Copy,Cut,Paste,Share,Save,DownloadAs,ReturnToDocuments(вернуться на предыдущую страницу) & callbacks for these functions*/
...@@ -2283,13 +2483,13 @@ asc_docs_api.prototype.asc_Print = function() ...@@ -2283,13 +2483,13 @@ asc_docs_api.prototype.asc_Print = function()
var editor = this; var editor = this;
if(null == this.WordControl.m_oLogicDocument) if(null == this.WordControl.m_oLogicDocument)
{ {
var rData = {"id":documentId, "format": documentFormat, "c":"savefromorigin"}; var rData = {"id":documentId, "vkey": documentVKey, "format": documentFormat, "c":"savefromorigin"};
sendCommand(editor, function(){editor.sync_EndAction(c_oAscAsyncActionType.BlockInteraction, c_oAscAsyncAction.Print);}, JSON.stringify(rData)); sendCommand(editor, function(){editor.sync_EndAction(c_oAscAsyncActionType.BlockInteraction, c_oAscAsyncAction.Print);}, rData);
} }
else else
_downloadAs(this, c_oAscFileType.PDF, function(incomeObject){ _downloadAs(this, c_oAscFileType.PDF, function(incomeObject){
if(null != incomeObject && "save" == incomeObject.type) if(null != incomeObject && "save" == incomeObject["type"])
editor.processSavedFile(incomeObject.data, false); editor.processSavedFile(incomeObject["data"], false);
editor.sync_EndAction(c_oAscAsyncActionType.BlockInteraction, c_oAscAsyncAction.Print);}, true); editor.sync_EndAction(c_oAscAsyncActionType.BlockInteraction, c_oAscAsyncAction.Print);}, true);
} }
} }
...@@ -2314,7 +2514,23 @@ asc_docs_api.prototype.Cut = function() ...@@ -2314,7 +2514,23 @@ asc_docs_api.prototype.Cut = function()
} }
asc_docs_api.prototype.Paste = function() asc_docs_api.prototype.Paste = function()
{ {
if (!window.GlobalPasteFlag)
{
if (!window.USER_AGENT_SAFARI_MACOS)
{
window.GlobalPasteFlag = true;
return Editor_Paste_Button(this);
}
else
{
if (0 === window.GlobalPasteFlagCounter)
{
SafariIntervalFocus();
window.GlobalPasteFlag = true;
return Editor_Paste_Button(this); return Editor_Paste_Button(this);
}
}
}
} }
asc_docs_api.prototype.Share = function(){ asc_docs_api.prototype.Share = function(){
...@@ -2379,12 +2595,11 @@ function OnSave_Callback(e) ...@@ -2379,12 +2595,11 @@ function OnSave_Callback(e)
////uncoment to save changes only instead send file complete ////uncoment to save changes only instead send file complete
//var data = JSON.stringify( CollaborativeEditing.Get_SelfChanges() ); //var data = JSON.stringify( CollaborativeEditing.Get_SelfChanges() );
//oAdditionalData["savetype"] = "changes"; //oAdditionalData["savetype"] = "changes";
oAdditionalData["data"] = data;
var sData = "mnuSaveAs" + cCharDelimiter + JSON.stringify(oAdditionalData) + cCharDelimiter + data;
sendCommand(editor, function(incomeObject){ sendCommand(editor, function(incomeObject){
if(null != incomeObject && "save" == incomeObject.type) if(null != incomeObject && "save" == incomeObject["type"])
editor.processSavedFile(incomeObject.data, true); editor.processSavedFile(incomeObject["data"], true);
}, sData); }, oAdditionalData);
} }
// Пересылаем свои изменения // Пересылаем свои изменения
...@@ -2423,8 +2638,8 @@ asc_docs_api.prototype.asc_DownloadAs = function(typeFile){//передаем ч ...@@ -2423,8 +2638,8 @@ asc_docs_api.prototype.asc_DownloadAs = function(typeFile){//передаем ч
this.sync_StartAction(c_oAscAsyncActionType.BlockInteraction, c_oAscAsyncAction.DownloadAs); this.sync_StartAction(c_oAscAsyncActionType.BlockInteraction, c_oAscAsyncAction.DownloadAs);
var editor = this; var editor = this;
_downloadAs(this, typeFile, function(incomeObject){ _downloadAs(this, typeFile, function(incomeObject){
if(null != incomeObject && "save" == incomeObject.type) if(null != incomeObject && "save" == incomeObject["type"])
editor.processSavedFile(incomeObject.data, false); editor.processSavedFile(incomeObject["data"], false);
editor.sync_EndAction(c_oAscAsyncActionType.BlockInteraction, c_oAscAsyncAction.DownloadAs);}, true); editor.sync_EndAction(c_oAscAsyncActionType.BlockInteraction, c_oAscAsyncAction.DownloadAs);}, true);
} }
asc_docs_api.prototype.Resize = function(){ asc_docs_api.prototype.Resize = function(){
...@@ -2439,8 +2654,8 @@ asc_docs_api.prototype.Help = function(){ ...@@ -2439,8 +2654,8 @@ asc_docs_api.prototype.Help = function(){
} }
asc_docs_api.prototype.ClearCache = function(){ asc_docs_api.prototype.ClearCache = function(){
var rData = {"id":documentId, "format": documentFormat, "c":"cc"}; var rData = {"id":documentId, "vkey": documentVKey, "format": documentFormat, "c":"cc"};
sendCommand(editor, function(){}, JSON.stringify(rData)); sendCommand(editor, function(){}, rData);
} }
asc_docs_api.prototype.SetFontRenderingMode = function(mode) asc_docs_api.prototype.SetFontRenderingMode = function(mode)
...@@ -2461,6 +2676,9 @@ asc_docs_api.prototype.SetFontRenderingMode = function(mode) ...@@ -2461,6 +2676,9 @@ asc_docs_api.prototype.SetFontRenderingMode = function(mode)
this.WordControl.m_oDrawingDocument.ClearCachePages(); this.WordControl.m_oDrawingDocument.ClearCachePages();
g_fontManager.ClearFontsRasterCache(); g_fontManager.ClearFontsRasterCache();
if (window.g_fontManager2 !== undefined && window.g_fontManager2 !== null)
window.g_fontManager2.ClearFontsRasterCache();
if (this.bInit_word_control) if (this.bInit_word_control)
this.WordControl.OnScroll(); this.WordControl.OnScroll();
} }
...@@ -2473,7 +2691,7 @@ asc_docs_api.prototype.processSavedFile = function(url, bInner) ...@@ -2473,7 +2691,7 @@ asc_docs_api.prototype.processSavedFile = function(url, bInner)
else else
{ {
if( this.isMobileVersion ) if( this.isMobileVersion )
window.open("/Common/MobileDownloader/download.html?file="+encodeURIComponent(url),"_parent","",false); window.open("../../../sdk/Common/MobileDownloader/download.html?file="+encodeURIComponent(url),"_parent","",false);
else else
getFile(url); getFile(url);
} }
...@@ -2540,6 +2758,8 @@ asc_docs_api.prototype.sync_CanRedoCallback = function(bCanRedo) ...@@ -2540,6 +2758,8 @@ asc_docs_api.prototype.sync_CanRedoCallback = function(bCanRedo)
this.asc_fireCallback("asc_onCanRedo", bCanRedo); this.asc_fireCallback("asc_onCanRedo", bCanRedo);
} }
asc_docs_api.prototype.setStartPointHistory = function(){this.noCreatePoint = true; History.Create_NewPoint();};
asc_docs_api.prototype.setEndPointHistory = function(){this.noCreatePoint = false; };
function CDocInfoProp(obj) function CDocInfoProp(obj)
{ {
...@@ -2746,8 +2966,23 @@ asc_docs_api.prototype.sync_ReturnHeadersCallback = function (headers){ ...@@ -2746,8 +2966,23 @@ asc_docs_api.prototype.sync_ReturnHeadersCallback = function (headers){
} }
*/ */
asc_docs_api.prototype.asc_searchEnabled = function(bIsEnabled)
{
if (null != this.WordControl.m_oDrawingDocument.m_oDocumentRenderer)
{
this.WordControl.m_oDrawingDocument.m_oDocumentRenderer.SearchResults.IsSearch = false;
this.WordControl.OnUpdateOverlay();
}
}
asc_docs_api.prototype.asc_findText = function(text, isNext, isMatchCase) asc_docs_api.prototype.asc_findText = function(text, isNext, isMatchCase)
{ {
if (null != this.WordControl.m_oDrawingDocument.m_oDocumentRenderer)
{
this.WordControl.m_oDrawingDocument.m_oDocumentRenderer.findText(text, isMatchCase, isNext);
return this.WordControl.m_oDrawingDocument.m_oDocumentRenderer.SearchResults.Count;
}
var SearchEngine = editor.WordControl.m_oLogicDocument.Search( text, { MatchCase : isMatchCase } ); var SearchEngine = editor.WordControl.m_oLogicDocument.Search( text, { MatchCase : isMatchCase } );
var Id = this.WordControl.m_oLogicDocument.Search_GetId( isNext ); var Id = this.WordControl.m_oLogicDocument.Search_GetId( isNext );
...@@ -2760,7 +2995,10 @@ asc_docs_api.prototype.asc_findText = function(text, isNext, isMatchCase) ...@@ -2760,7 +2995,10 @@ asc_docs_api.prototype.asc_findText = function(text, isNext, isMatchCase)
asc_docs_api.prototype.asc_replaceText = function(text, replaceWith, isReplaceAll, isMatchCase) asc_docs_api.prototype.asc_replaceText = function(text, replaceWith, isReplaceAll, isMatchCase)
{ {
editor.WordControl.m_oLogicDocument.Search( text, { MatchCase : isMatchCase } ); if (null == this.WordControl.m_oLogicDocument)
return;
this.WordControl.m_oLogicDocument.Search( text, { MatchCase : isMatchCase } );
if ( true === isReplaceAll ) if ( true === isReplaceAll )
this.WordControl.m_oLogicDocument.Search_Replace(replaceWith, true, -1); this.WordControl.m_oLogicDocument.Search_Replace(replaceWith, true, -1);
...@@ -2785,17 +3023,27 @@ asc_docs_api.prototype.asc_replaceText = function(text, replaceWith, isReplaceAl ...@@ -2785,17 +3023,27 @@ asc_docs_api.prototype.asc_replaceText = function(text, replaceWith, isReplaceAl
asc_docs_api.prototype.asc_selectSearchingResults = function(bShow) asc_docs_api.prototype.asc_selectSearchingResults = function(bShow)
{ {
if (null != this.WordControl.m_oDrawingDocument.m_oDocumentRenderer)
{
this.WordControl.m_oDrawingDocument.m_oDocumentRenderer.SearchResults.Show = bShow;
this.WordControl.OnUpdateOverlay();
return;
}
this.WordControl.m_oLogicDocument.Search_Set_Selection(bShow); this.WordControl.m_oLogicDocument.Search_Set_Selection(bShow);
} }
asc_docs_api.prototype.asc_isSelectSearchingResults = function() asc_docs_api.prototype.asc_isSelectSearchingResults = function()
{ {
if (null != this.WordControl.m_oDrawingDocument.m_oDocumentRenderer)
{
return this.WordControl.m_oDrawingDocument.m_oDocumentRenderer.SearchResults.Show;
}
return this.WordControl.m_oLogicDocument.Search_Get_Selection(); return this.WordControl.m_oLogicDocument.Search_Get_Selection();
} }
asc_docs_api.prototype.sync_ReplaceAllCallback = function(Count) asc_docs_api.prototype.sync_ReplaceAllCallback = function(ReplaceCount, OverallCount)
{ {
this.asc_fireCallback("asc_onReplaceAll", Count); this.asc_fireCallback("asc_onReplaceAll", ReplaceCount, OverallCount);
} }
asc_docs_api.prototype.sync_SearchEndCallback = function() asc_docs_api.prototype.sync_SearchEndCallback = function()
...@@ -2826,9 +3074,9 @@ asc_docs_api.prototype.put_TextPrFontSize = function(size) ...@@ -2826,9 +3074,9 @@ asc_docs_api.prototype.put_TextPrFontSize = function(size)
{ {
this.WordControl.m_oLogicDocument.Create_NewHistoryPoint(); this.WordControl.m_oLogicDocument.Create_NewHistoryPoint();
//this.WordControl.m_oLogicDocument.Paragraph_Add( new ParaTextPr( { FontSize : Math.min(size, 100) } ) ); //this.WordControl.m_oLogicDocument.Paragraph_Add( new ParaTextPr( { FontSize : Math.min(size, 100) } ) );
//** //**
//MathControl.SetTxtPrp( { FontSize : Math.min(size, 100) } ); MathComposition.addRPrpForSelect( { FontSize : Math.min(size, 100) } );
MathComposition.SetTxtPrp( { FontSize : Math.min(size, 100) } );
//** //**
} }
} }
...@@ -2838,9 +3086,9 @@ asc_docs_api.prototype.put_TextPrBold = function(value) ...@@ -2838,9 +3086,9 @@ asc_docs_api.prototype.put_TextPrBold = function(value)
{ {
this.WordControl.m_oLogicDocument.Create_NewHistoryPoint(); this.WordControl.m_oLogicDocument.Create_NewHistoryPoint();
//this.WordControl.m_oLogicDocument.Paragraph_Add( new ParaTextPr( { Bold : value } ) ); //this.WordControl.m_oLogicDocument.Paragraph_Add( new ParaTextPr( { Bold : value } ) );
//** //**
//MathControl.SetTxtPrp( { Bold : value } ); MathComposition.addRPrpForSelect( { Bold : value } );
MathComposition.SetTxtPrp( { Bold : value } );
//** //**
} }
} }
...@@ -2850,9 +3098,9 @@ asc_docs_api.prototype.put_TextPrItalic = function(value) ...@@ -2850,9 +3098,9 @@ asc_docs_api.prototype.put_TextPrItalic = function(value)
{ {
this.WordControl.m_oLogicDocument.Create_NewHistoryPoint(); this.WordControl.m_oLogicDocument.Create_NewHistoryPoint();
//this.WordControl.m_oLogicDocument.Paragraph_Add( new ParaTextPr( { Italic : value } ) ); //this.WordControl.m_oLogicDocument.Paragraph_Add( new ParaTextPr( { Italic : value } ) );
//** //**
//MathControl.SetTxtPrp( { Italic : value } ); MathComposition.addRPrpForSelect( { Italic : value } );
MathComposition.SetTxtPrp( { Italic : value } );
//** //**
} }
} }
...@@ -2945,6 +3193,8 @@ asc_docs_api.prototype.put_TextPrLang = function(value) ...@@ -2945,6 +3193,8 @@ asc_docs_api.prototype.put_TextPrLang = function(value)
this.WordControl.m_oLogicDocument.Create_NewHistoryPoint(); this.WordControl.m_oLogicDocument.Create_NewHistoryPoint();
this.WordControl.m_oLogicDocument.Paragraph_Add( new ParaTextPr( { Lang : { Val : value } } ) ); this.WordControl.m_oLogicDocument.Paragraph_Add( new ParaTextPr( { Lang : { Val : value } } ) );
this.WordControl.m_oLogicDocument.Spelling.Check_CurParas();
if ( true === this.isMarkerFormat ) if ( true === this.isMarkerFormat )
this.sync_MarkerFormatCallback( false ); this.sync_MarkerFormatCallback( false );
} }
...@@ -3101,18 +3351,12 @@ asc_docs_api.prototype.sync_PrLineSpacingCallBack = function(LineSpacing){ ...@@ -3101,18 +3351,12 @@ asc_docs_api.prototype.sync_PrLineSpacingCallBack = function(LineSpacing){
} }
asc_docs_api.prototype.sync_InitEditorFonts = function(gui_fonts){ asc_docs_api.prototype.sync_InitEditorFonts = function(gui_fonts){
this._gui_fonts = gui_fonts; this._gui_fonts = gui_fonts;
var ret = this.asc_fireCallback("asc_onInitEditorFonts",gui_fonts);
if (ret)
this._gui_fonts = null;
} }
asc_docs_api.prototype.sync_InitEditorStyles = function(styles_painter){ asc_docs_api.prototype.sync_InitEditorStyles = function(styles_painter){
this._gui_styles = styles_painter; this._gui_styles = styles_painter;
var ret = this.asc_fireCallback("asc_onInitEditorStyles",styles_painter);
if (ret)
this._gui_styles = null;
} }
asc_docs_api.prototype.sync_InitEditorTableStyles = function(styles){ asc_docs_api.prototype.sync_InitEditorTableStyles = function(styles, is_retina_enabled){
this.asc_fireCallback("asc_onInitTableTemplates",styles); this.asc_fireCallback("asc_onInitTableTemplates",styles, is_retina_enabled);
} }
...@@ -3142,7 +3386,11 @@ asc_docs_api.prototype.sync_InitEditorTableStyles = function(styles){ ...@@ -3142,7 +3386,11 @@ asc_docs_api.prototype.sync_InitEditorTableStyles = function(styles){
asc_docs_api.prototype.paraApply = function(Props) asc_docs_api.prototype.paraApply = function(Props)
{ {
if ( false === this.WordControl.m_oLogicDocument.Document_Is_SelectionLocked(changestype_Paragraph_Properties) ) var Additional = undefined;
if ( undefined != Props.DefaultTab )
Additional = { Type : changestype_2_Element_and_Type, Element : this.WordControl.m_oLogicDocument, CheckType : changestype_Document_SectPr };
if ( false === this.WordControl.m_oLogicDocument.Document_Is_SelectionLocked(changestype_Paragraph_Properties, Additional) )
{ {
this.WordControl.m_oLogicDocument.Create_NewHistoryPoint(); this.WordControl.m_oLogicDocument.Create_NewHistoryPoint();
...@@ -3186,7 +3434,7 @@ asc_docs_api.prototype.paraApply = function(Props) ...@@ -3186,7 +3434,7 @@ asc_docs_api.prototype.paraApply = function(Props)
if ( undefined != Props.DefaultTab ) if ( undefined != Props.DefaultTab )
{ {
// TODO: реализовать изменения таба по умолчанию this.WordControl.m_oLogicDocument.Set_DocumentDefaultTab( Props.DefaultTab );
} }
...@@ -3637,6 +3885,33 @@ asc_docs_api.prototype.sync_EndAddShape = function() ...@@ -3637,6 +3885,33 @@ asc_docs_api.prototype.sync_EndAddShape = function()
} }
} }
asc_docs_api.prototype.SetDrawingFreeze = function(bIsFreeze)
{
this.WordControl.DrawingFreeze = bIsFreeze;
var _elem1 = document.getElementById("id_main");
if (_elem1)
{
var _elem2 = document.getElementById("id_horscrollpanel");
var _elem3 = document.getElementById("id_panel_right");
if (bIsFreeze)
{
_elem1.style.display = "none";
_elem2.style.display = "none";
_elem3.style.display = "none";
}
else
{
_elem1.style.display = "block";
_elem2.style.display = "block";
_elem3.style.display = "block";
}
}
if (!bIsFreeze)
this.WordControl.OnScroll();
}
/*----------------------------------------------------------------*/ /*----------------------------------------------------------------*/
/*functions for working with page*/ /*functions for working with page*/
asc_docs_api.prototype.change_PageOrient = function(isPortrait) asc_docs_api.prototype.change_PageOrient = function(isPortrait)
...@@ -3674,6 +3949,17 @@ asc_docs_api.prototype.change_DocSize = function(width,height) ...@@ -3674,6 +3949,17 @@ asc_docs_api.prototype.change_DocSize = function(width,height)
this.WordControl.m_oLogicDocument.Set_DocumentPageSize(height, width); this.WordControl.m_oLogicDocument.Set_DocumentPageSize(height, width);
} }
} }
asc_docs_api.prototype.get_DocumentWidth = function()
{
return Page_Width;
}
asc_docs_api.prototype.get_DocumentHeight = function()
{
return Page_Height;
}
asc_docs_api.prototype.put_AddPageBreak = function() asc_docs_api.prototype.put_AddPageBreak = function()
{ {
if ( false === this.WordControl.m_oLogicDocument.Document_Is_SelectionLocked(changestype_Paragraph_Content) ) if ( false === this.WordControl.m_oLogicDocument.Document_Is_SelectionLocked(changestype_Paragraph_Content) )
...@@ -4556,17 +4842,8 @@ asc_docs_api.prototype.AddImage = function(){ ...@@ -4556,17 +4842,8 @@ asc_docs_api.prototype.AddImage = function(){
} }
else else
{ {
var oImageUploader = document.getElementById("apiImageUpload"); var frameWindow = GetUploadIFrame();
if(!oImageUploader) var content = '<html><head></head><body><form action="'+g_sUploadServiceLocalUrl+'?key='+documentId+'" method="POST" enctype="multipart/form-data"><input id="apiiuFile" name="apiiuFile" type="file" accept="image/*" size="1"><input id="apiiuSubmit" name="apiiuSubmit" type="submit" style="display:none;"></form></body></html>';
{
var frame = document.createElement("iframe");
frame.name = "apiImageUpload";
frame.id = "apiImageUpload";
frame.setAttribute("style", "position:absolute;left:-2px;top:-2px;width:1px;height:1px;z-index:-1000;");
document.body.appendChild(frame);
}
var frameWindow = window.frames["apiImageUpload"];
var content = '<html><head></head><body><form action="'+g_sUploadServiceLocalUrl+'?key='+documentId+'" method="POST" enctype="multipart/form-data"><input id="apiiuFile" name="apiiuFile" type="file" size="1"><input id="apiiuSubmit" name="apiiuSubmit" type="submit" style="display:none;"></form></body></html>';
frameWindow.document.open(); frameWindow.document.open();
frameWindow.document.write(content); frameWindow.document.write(content);
frameWindow.document.close(); frameWindow.document.close();
...@@ -4576,46 +4853,21 @@ asc_docs_api.prototype.AddImage = function(){ ...@@ -4576,46 +4853,21 @@ asc_docs_api.prototype.AddImage = function(){
var oThis = this; var oThis = this;
fileName.onchange = function(e) fileName.onchange = function(e)
{ {
var bNeedSubmit = true;
if(e && e.target && e.target.files) if(e && e.target && e.target.files)
{ {
var files = e.target.files; var nError = ValidateUploadImage(e.target.files);
if(files.length > 0) if(c_oAscServerError.NoError != nError)
{
var file = files[0];
//проверяем расширение файла
var sName = file.fileName || file.name;
if(sName)
{
var bSupported = false;
var nIndex = sName.lastIndexOf(".");
if(-1 != nIndex)
{
var ext = sName.substring(nIndex + 1).toLowerCase();
for(var i = 0, length = c_oAscImageUploadProp.SupportedFormats.length; i < length; i++)
{
if(c_oAscImageUploadProp.SupportedFormats[i] == ext)
{ {
bSupported = true; bNeedSubmit = false;
break; oThis.asc_fireCallback("asc_onError",_mapAscServerErrorToAscError(nError),c_oAscError.Level.NoCritical);
}
} }
} }
if(false == bSupported) if(bNeedSubmit)
{ {
oThis.asc_fireCallback("asc_onError",c_oAscError.ID.UplImageExt,c_oAscError.Level.NoCritical);
return;
}
}
var nSize = file.fileSize || file.size;
if(nSize && c_oAscImageUploadProp.MaxFileSize < nSize)
{
oThis.asc_fireCallback("asc_onError",c_oAscError.ID.UplImageSize,c_oAscError.Level.NoCritical);
return;
}
}
}
oThis.sync_StartAction(c_oAscAsyncActionType.BlockInteraction, c_oAscAsyncAction.UploadImage); oThis.sync_StartAction(c_oAscAsyncActionType.BlockInteraction, c_oAscAsyncAction.UploadImage);
fileSubmit.click(); fileSubmit.click();
}
}; };
//todo пересмотреть opera //todo пересмотреть opera
if (window.opera != undefined) if (window.opera != undefined)
...@@ -4638,18 +4890,16 @@ asc_docs_api.prototype.AddImageUrl = function(url, imgProp) ...@@ -4638,18 +4890,16 @@ asc_docs_api.prototype.AddImageUrl = function(url, imgProp)
{ {
this.AddImageUrlAction(url, imgProp); this.AddImageUrlAction(url, imgProp);
} }
else if(0 == url.indexOf("data:"))
{
this.AddImageUrlAction(url, imgProp);
}
else else
{ {
var rData = {"id":documentId, "c":"imgurl", "data": url}; var rData = {"id":documentId, "vkey": documentVKey, "c":"imgurl", "data": url};
var oThis = this; var oThis = this;
this.sync_StartAction(c_oAscAsyncActionType.BlockInteraction, c_oAscAsyncAction.UploadImage);
sendCommand( oThis, function(incomeObject){ sendCommand( oThis, function(incomeObject){
if(null != incomeObject && "imgurl" ==incomeObject.type) if(null != incomeObject && "imgurl" ==incomeObject["type"])
oThis.AddImageUrlAction(incomeObject.data, imgProp); oThis.AddImageUrlAction(incomeObject["data"], imgProp);
}, JSON.stringify(rData) ); oThis.sync_EndAction(c_oAscAsyncActionType.BlockInteraction, c_oAscAsyncAction.UploadImage);
}, rData );
} }
} }
} }
...@@ -4701,7 +4951,7 @@ asc_docs_api.prototype.AddImageUrlAction = function(url, imgProp) ...@@ -4701,7 +4951,7 @@ asc_docs_api.prototype.AddImageUrlAction = function(url, imgProp)
} }
else else
{ {
this.sync_StartAction(c_oAscAsyncActionType.Information, c_oAscAsyncAction.LoadImage); this.sync_StartAction(c_oAscAsyncActionType.BlockInteraction, c_oAscAsyncAction.LoadImage);
this.asyncImageEndLoaded2 = function(_image) this.asyncImageEndLoaded2 = function(_image)
{ {
var _w = Math.max(1, Page_Width - (X_Left_Margin + X_Right_Margin)); var _w = Math.max(1, Page_Width - (X_Left_Margin + X_Right_Margin));
...@@ -4746,7 +4996,7 @@ asc_docs_api.prototype.AddImageUrlAction = function(url, imgProp) ...@@ -4746,7 +4996,7 @@ asc_docs_api.prototype.AddImageUrlAction = function(url, imgProp)
this.WordControl.m_oLogicDocument.Add_InlineImage(_w, _h, src, null, true); this.WordControl.m_oLogicDocument.Add_InlineImage(_w, _h, src, null, true);
} }
this.sync_EndAction(c_oAscAsyncActionType.Information, c_oAscAsyncAction.LoadImage); this.sync_EndAction(c_oAscAsyncActionType.BlockInteraction, c_oAscAsyncAction.LoadImage);
this.asyncImageEndLoaded2 = null; this.asyncImageEndLoaded2 = null;
} }
...@@ -4788,7 +5038,12 @@ asc_docs_api.prototype.ImgApply = function(obj) ...@@ -4788,7 +5038,12 @@ asc_docs_api.prototype.ImgApply = function(obj)
if ( false === this.WordControl.m_oLogicDocument.Document_Is_SelectionLocked(changestype_Image_Properties, AdditionalData) ) if ( false === this.WordControl.m_oLogicDocument.Document_Is_SelectionLocked(changestype_Image_Properties, AdditionalData) )
{ {
if(!this.noCreatePoint)
this.WordControl.m_oLogicDocument.Create_NewHistoryPoint(); this.WordControl.m_oLogicDocument.Create_NewHistoryPoint();
if (ImagePr.ShapeProperties)
ImagePr.ImageUrl = "";
if(ImagePr.ImageUrl != undefined && ImagePr.ImageUrl != null && ImagePr.ImageUrl != "") if(ImagePr.ImageUrl != undefined && ImagePr.ImageUrl != null && ImagePr.ImageUrl != "")
{ {
var _img = this.ImageLoader.LoadImage(ImagePr.ImageUrl, 1) var _img = this.ImageLoader.LoadImage(ImagePr.ImageUrl, 1)
...@@ -4899,7 +5154,7 @@ asc_docs_api.prototype.ShapeApply = function(shapeProps) ...@@ -4899,7 +5154,7 @@ asc_docs_api.prototype.ShapeApply = function(shapeProps)
} }
else else
{ {
this.sync_StartAction(c_oAscAsyncActionType.Information, c_oAscAsyncAction.LoadImage); this.sync_StartAction(c_oAscAsyncActionType.BlockInteraction, c_oAscAsyncAction.LoadImage);
var oProp = shapeProps; var oProp = shapeProps;
this.asyncImageEndLoaded2 = function(_image) this.asyncImageEndLoaded2 = function(_image)
...@@ -4907,7 +5162,7 @@ asc_docs_api.prototype.ShapeApply = function(shapeProps) ...@@ -4907,7 +5162,7 @@ asc_docs_api.prototype.ShapeApply = function(shapeProps)
this.WordControl.m_oLogicDocument.ShapeApply(oProp); this.WordControl.m_oLogicDocument.ShapeApply(oProp);
this.WordControl.m_oDrawingDocument.DrawImageTextureFillShape(image_url); this.WordControl.m_oDrawingDocument.DrawImageTextureFillShape(image_url);
this.sync_EndAction(c_oAscAsyncActionType.Information, c_oAscAsyncAction.LoadImage); this.sync_EndAction(c_oAscAsyncActionType.BlockInteraction, c_oAscAsyncAction.LoadImage);
this.asyncImageEndLoaded2 = null; this.asyncImageEndLoaded2 = null;
} }
} }
...@@ -5083,13 +5338,13 @@ function CHyperlinkProperty( obj ) ...@@ -5083,13 +5338,13 @@ function CHyperlinkProperty( obj )
{ {
this.Text = (undefined != obj.Text ) ? obj.Text : null; this.Text = (undefined != obj.Text ) ? obj.Text : null;
this.Value = (undefined != obj.Value ) ? obj.Value : ""; this.Value = (undefined != obj.Value ) ? obj.Value : "";
this.ToolTip = (undefined != obj.ToolTip) ? obj.ToolTip : null; this.ToolTip = (undefined != obj.ToolTip) ? obj.ToolTip : "";
} }
else else
{ {
this.Text = null; this.Text = null;
this.Value = ""; this.Value = "";
this.ToolTip = null; this.ToolTip = "";
} }
} }
...@@ -5166,6 +5421,7 @@ asc_docs_api.prototype.asc_replaceMisspelledWord = function(Word, SpellCheckProp ...@@ -5166,6 +5421,7 @@ asc_docs_api.prototype.asc_replaceMisspelledWord = function(Word, SpellCheckProp
this.WordControl.m_oLogicDocument.Create_NewHistoryPoint(); this.WordControl.m_oLogicDocument.Create_NewHistoryPoint();
Paragraph.Replace_MisspelledWord( Word, ElemId ); Paragraph.Replace_MisspelledWord( Word, ElemId );
this.WordControl.m_oLogicDocument.Recalculate(); this.WordControl.m_oLogicDocument.Recalculate();
Paragraph.Document_SetThisElementCurrent();
} }
} }
...@@ -5193,12 +5449,15 @@ asc_docs_api.prototype.asc_ignoreMisspelledWord = function(SpellCheckProperty, b ...@@ -5193,12 +5449,15 @@ asc_docs_api.prototype.asc_ignoreMisspelledWord = function(SpellCheckProperty, b
asc_docs_api.prototype.asc_setDefaultLanguage = function(Lang) asc_docs_api.prototype.asc_setDefaultLanguage = function(Lang)
{ {
if (editor.WordControl.m_oLogicDocument)
editor.WordControl.m_oLogicDocument.Set_DefaultLanguage(Lang); editor.WordControl.m_oLogicDocument.Set_DefaultLanguage(Lang);
} }
asc_docs_api.prototype.asc_getDefaultLanguage = function() asc_docs_api.prototype.asc_getDefaultLanguage = function()
{ {
if (editor.WordControl.m_oLogicDocument)
return editor.WordControl.m_oLogicDocument.Get_DefaultLanguage(); return editor.WordControl.m_oLogicDocument.Get_DefaultLanguage();
return null;
} }
//----------------------------------------------------------------- //-----------------------------------------------------------------
// Функции для работы с комментариями // Функции для работы с комментариями
...@@ -5381,6 +5640,23 @@ asc_docs_api.prototype.sync_UnLockComment = function(Id) ...@@ -5381,6 +5640,23 @@ asc_docs_api.prototype.sync_UnLockComment = function(Id)
{ {
this.asc_fireCallback("asc_onUnLockComment", Id); this.asc_fireCallback("asc_onUnLockComment", Id);
} }
asc_docs_api.prototype.asc_getComments = function()
{
var ResComments = new Array();
var LogicDocument = this.WordControl.m_oLogicDocument;
if ( undefined != LogicDocument )
{
var DocComments = LogicDocument.Comments;
for ( var Id in DocComments.m_aComments )
{
var AscCommentData = new asc_CCommentData(DocComments.m_aComments[Id].Data);
ResComments.push( { "Id" : Id, "Comment" : AscCommentData } );
}
}
return ResComments;
}
//----------------------------------------------------------------- //-----------------------------------------------------------------
asc_docs_api.prototype.sync_LockHeaderFooters = function() asc_docs_api.prototype.sync_LockHeaderFooters = function()
{ {
...@@ -5526,7 +5802,7 @@ asc_docs_api.prototype.asyncFontsDocumentStartLoaded = function() ...@@ -5526,7 +5802,7 @@ asc_docs_api.prototype.asyncFontsDocumentStartLoaded = function()
// здесь прокинуть евент о заморозке меню // здесь прокинуть евент о заморозке меню
// и нужно вывести информацию в статус бар // и нужно вывести информацию в статус бар
if (this.isPasteFonts_Images) if (this.isPasteFonts_Images)
this.sync_StartAction(c_oAscAsyncActionType.Information, c_oAscAsyncAction.LoadFont); this.sync_StartAction(c_oAscAsyncActionType.BlockInteraction, c_oAscAsyncAction.LoadFont);
else if (this.isSaveFonts_Images) else if (this.isSaveFonts_Images)
this.sync_StartAction(c_oAscAsyncActionType.Information, c_oAscAsyncAction.LoadFont); this.sync_StartAction(c_oAscAsyncActionType.Information, c_oAscAsyncAction.LoadFont);
else else
...@@ -5567,7 +5843,7 @@ asc_docs_api.prototype.asyncFontsDocumentEndLoaded = function() ...@@ -5567,7 +5843,7 @@ asc_docs_api.prototype.asyncFontsDocumentEndLoaded = function()
{ {
// все, шрифты загружены. Теперь нужно подгрузить картинки // все, шрифты загружены. Теперь нужно подгрузить картинки
if (this.isPasteFonts_Images) if (this.isPasteFonts_Images)
this.sync_EndAction(c_oAscAsyncActionType.Information, c_oAscAsyncAction.LoadFont); this.sync_EndAction(c_oAscAsyncActionType.BlockInteraction, c_oAscAsyncAction.LoadFont);
else if (this.isSaveFonts_Images) else if (this.isSaveFonts_Images)
this.sync_EndAction(c_oAscAsyncActionType.Information, c_oAscAsyncAction.LoadFont); this.sync_EndAction(c_oAscAsyncActionType.Information, c_oAscAsyncAction.LoadFont);
else else
...@@ -5583,7 +5859,7 @@ asc_docs_api.prototype.asyncFontsDocumentEndLoaded = function() ...@@ -5583,7 +5859,7 @@ asc_docs_api.prototype.asyncFontsDocumentEndLoaded = function()
if (_count > 0) if (_count > 0)
{ {
this.EndActionLoadImages = 2; this.EndActionLoadImages = 2;
this.sync_StartAction(c_oAscAsyncActionType.Information, c_oAscAsyncAction.LoadImage); this.sync_StartAction(c_oAscAsyncActionType.BlockInteraction, c_oAscAsyncAction.LoadImage);
} }
var _oldAsyncLoadImages = this.ImageLoader.bIsAsyncLoadDocumentImages; var _oldAsyncLoadImages = this.ImageLoader.bIsAsyncLoadDocumentImages;
...@@ -5635,11 +5911,19 @@ asc_docs_api.prototype.asyncFontsDocumentEndLoaded = function() ...@@ -5635,11 +5911,19 @@ asc_docs_api.prototype.asyncFontsDocumentEndLoaded = function()
for (var i in _loader_object.ImageMap) for (var i in _loader_object.ImageMap)
++_count; ++_count;
if (!this.isOnlyReaderMode)
{
// add const textures // add const textures
var _st_count = g_oUserTexturePresets.length; var _st_count = g_oUserTexturePresets.length;
for (var i = 0; i < _st_count; i++) for (var i = 0; i < _st_count; i++)
_loader_object.ImageMap[_count + i] = g_oUserTexturePresets[i]; _loader_object.ImageMap[_count + i] = g_oUserTexturePresets[i];
if (this.OpenDocumentProgress && !this.ImageLoader.bIsAsyncLoadDocumentImages)
{
this.OpenDocumentProgress.ImagesCount += _st_count;
}
}
if (_count > 0) if (_count > 0)
{ {
this.EndActionLoadImages = 1; this.EndActionLoadImages = 1;
...@@ -5663,16 +5947,11 @@ asc_docs_api.prototype.CreateFontsCharMap = function() ...@@ -5663,16 +5947,11 @@ asc_docs_api.prototype.CreateFontsCharMap = function()
asc_docs_api.prototype.sync_SendThemeColors = function(colors,standart_colors) asc_docs_api.prototype.sync_SendThemeColors = function(colors,standart_colors)
{ {
this._gui_control_colors = { Colors : colors, StandartColors : standart_colors }; this._gui_control_colors = { Colors : colors, StandartColors : standart_colors };
var ret = this.asc_fireCallback("asc_onSendThemeColors",colors,standart_colors); this.asc_fireCallback("asc_onSendThemeColors",colors,standart_colors);
if (ret)
this._gui_control_colors = null;
} }
asc_docs_api.prototype.sync_SendThemeColorSchemes = function(param) asc_docs_api.prototype.sync_SendThemeColorSchemes = function(param)
{ {
this._gui_color_schemes = param; this._gui_color_schemes = param;
var ret = this.asc_fireCallback("asc_onSendThemeColorSchemes",param);
if (ret)
this._gui_color_schemes = null;
} }
asc_docs_api.prototype.ChangeColorScheme = function(index_scheme) asc_docs_api.prototype.ChangeColorScheme = function(index_scheme)
...@@ -5698,6 +5977,7 @@ asc_docs_api.prototype.ChangeColorScheme = function(index_scheme) ...@@ -5698,6 +5977,7 @@ asc_docs_api.prototype.ChangeColorScheme = function(index_scheme)
{ {
var _obj = g_oUserColorScheme[index_scheme]; var _obj = g_oUserColorScheme[index_scheme];
var scheme = new ClrScheme(); var scheme = new ClrScheme();
scheme.name = _obj["name"];
var _c = null; var _c = null;
_c = _obj["dk1"]; _c = _obj["dk1"];
...@@ -5761,15 +6041,25 @@ asc_docs_api.prototype.ChangeColorScheme = function(index_scheme) ...@@ -5761,15 +6041,25 @@ asc_docs_api.prototype.ChangeColorScheme = function(index_scheme)
data.newScheme = theme.themeElements.clrScheme; data.newScheme = theme.themeElements.clrScheme;
History.Add(this.WordControl.m_oLogicDocument.DrawingObjects, data); History.Add(this.WordControl.m_oLogicDocument.DrawingObjects, data);
this.WordControl.m_oDrawingDocument.CheckGuiControlColors(); this.WordControl.m_oDrawingDocument.CheckGuiControlColors();
var is_on = History.Is_On();
if(is_on)
{
History.TurnOff();
}
this.chartStyleManager.init(); this.chartStyleManager.init();
this.chartPreviewManager.init(); this.chartPreviewManager.init();
if(is_on)
{
History.TurnOn();
}
this.asc_fireCallback("asc_onUpdateChartStyles"); this.asc_fireCallback("asc_onUpdateChartStyles");
_changer.calculateAfterChangeTheme(); _changer.calculateAfterChangeTheme();
// TODO: // TODO:
this.WordControl.m_oDrawingDocument.ClearCachePages(); this.WordControl.m_oDrawingDocument.ClearCachePages();
this.WordControl.OnScroll(); this.WordControl.OnScroll();
this.WordControl.m_oDrawingDocument.CheckGuiControlColors();
} }
} }
...@@ -5787,6 +6077,9 @@ asc_docs_api.prototype.asyncImagesDocumentEndLoaded = function() ...@@ -5787,6 +6077,9 @@ asc_docs_api.prototype.asyncImagesDocumentEndLoaded = function()
} }
else if (this.EndActionLoadImages == 2) else if (this.EndActionLoadImages == 2)
{ {
if (this.isPasteFonts_Images)
this.sync_EndAction(c_oAscAsyncActionType.BlockInteraction, c_oAscAsyncAction.LoadImage);
else
this.sync_EndAction(c_oAscAsyncActionType.Information, c_oAscAsyncAction.LoadImage); this.sync_EndAction(c_oAscAsyncActionType.Information, c_oAscAsyncAction.LoadImage);
} }
...@@ -5807,9 +6100,9 @@ asc_docs_api.prototype.asyncImagesDocumentEndLoaded = function() ...@@ -5807,9 +6100,9 @@ asc_docs_api.prototype.asyncImagesDocumentEndLoaded = function()
this.WordControl.InitControl(); this.WordControl.InitControl();
if (this.isViewMode) if (this.isViewMode)
this.SetViewMode(true, /*isNotSendOnCoAuthoringServer*/ true); this.SetViewMode(true);
this.asyncServerIdStartLoaded(); //this.asyncServerIdStartLoaded();
return; return;
} }
...@@ -5820,7 +6113,7 @@ asc_docs_api.prototype.asyncImagesDocumentEndLoaded = function() ...@@ -5820,7 +6113,7 @@ asc_docs_api.prototype.asyncImagesDocumentEndLoaded = function()
if (true == this.ServerIdWaitComplete) if (true == this.ServerIdWaitComplete)
this.OpenDocumentEndCallback(); this.OpenDocumentEndCallback();
this.asyncServerIdStartLoaded(); //this.asyncServerIdStartLoaded();
} }
else else
{ {
...@@ -5829,6 +6122,8 @@ asc_docs_api.prototype.asyncImagesDocumentEndLoaded = function() ...@@ -5829,6 +6122,8 @@ asc_docs_api.prototype.asyncImagesDocumentEndLoaded = function()
this.isPasteFonts_Images = false; this.isPasteFonts_Images = false;
this.pasteImageMap = null; this.pasteImageMap = null;
this.pasteCallback(); this.pasteCallback();
window.GlobalPasteFlag = false;
window.GlobalPasteFlagCounter = 0;
this.pasteCallback = null; this.pasteCallback = null;
} }
else if (this.isSaveFonts_Images) else if (this.isSaveFonts_Images)
...@@ -5841,6 +6136,8 @@ asc_docs_api.prototype.asyncImagesDocumentEndLoaded = function() ...@@ -5841,6 +6136,8 @@ asc_docs_api.prototype.asyncImagesDocumentEndLoaded = function()
{ {
this.isLoadImagesCustom = false; this.isLoadImagesCustom = false;
this.loadCustomImageMap = null; this.loadCustomImageMap = null;
if (!this.ImageLoader.bIsAsyncLoadDocumentImages)
this.SyncLoadImages_callback(); this.SyncLoadImages_callback();
} }
} }
...@@ -5871,6 +6168,9 @@ asc_docs_api.prototype.OpenDocumentEndCallback = function() ...@@ -5871,6 +6168,9 @@ asc_docs_api.prototype.OpenDocumentEndCallback = function()
{ {
var Document = this.WordControl.m_oLogicDocument; var Document = this.WordControl.m_oLogicDocument;
CollaborativeEditing.Apply_Changes();
CollaborativeEditing.Release_Locks();
//Recalculate HdrFtr //Recalculate HdrFtr
if(Document.HdrFtr && Document.HdrFtr.Content && Document.HdrFtr.Content.length > 0 && Document.HdrFtr.Content[0].Header) if(Document.HdrFtr && Document.HdrFtr.Content && Document.HdrFtr.Content.length > 0 && Document.HdrFtr.Content[0].Header)
{ {
...@@ -5922,11 +6222,20 @@ asc_docs_api.prototype.OpenDocumentEndCallback = function() ...@@ -5922,11 +6222,20 @@ asc_docs_api.prototype.OpenDocumentEndCallback = function()
} }
Document.DrawingObjects.calculateAfterOpen();
Document.DrawingObjects.calculateAfterChangeTheme(); Document.DrawingObjects.calculateAfterChangeTheme();
if (!this.isOnlyReaderMode)
{
Document.Recalculate(); Document.Recalculate();
this.WordControl.m_oDrawingDocument.TargetStart(); this.WordControl.m_oDrawingDocument.TargetStart();
} }
else
{
Document.Recalculate_AllTables();
this.ChangeReaderMode();
}
}
} }
} }
...@@ -5941,7 +6250,7 @@ asc_docs_api.prototype.OpenDocumentEndCallback = function() ...@@ -5941,7 +6250,7 @@ asc_docs_api.prototype.OpenDocumentEndCallback = function()
this.WordControl.InitControl(); this.WordControl.InitControl();
if (this.isViewMode) if (this.isViewMode)
this.SetViewMode(true, /*isNotSendOnCoAuthoringServer*/ true); this.SetViewMode(true);
if (undefined != window['qtDocBridge']) if (undefined != window['qtDocBridge'])
{ {
...@@ -6041,9 +6350,24 @@ asc_docs_api.prototype.sync_SendProgress = function(Percents) ...@@ -6041,9 +6350,24 @@ asc_docs_api.prototype.sync_SendProgress = function(Percents)
asc_docs_api.prototype.pre_Paste = function(_fonts, _images, callback) asc_docs_api.prototype.pre_Paste = function(_fonts, _images, callback)
{ {
this.isPasteFonts_Images = true;
this.pasteCallback = callback; this.pasteCallback = callback;
this.pasteImageMap = _images; this.pasteImageMap = _images;
var _count = 0;
for (var i in this.pasteImageMap)
++_count;
if (0 == _count && false === this.FontLoader.CheckFontsNeedLoading(_fonts))
{
// никаких евентов. ничего грузить не нужно. сделано для сафари под макОс.
// там при LongActions теряется фокус и вставляются пробелы
this.pasteCallback();
window.GlobalPasteFlag = false;
window.GlobalPasteFlagCounter = 0;
this.pasteCallback = null;
return;
}
this.isPasteFonts_Images = true;
this.FontLoader.LoadDocumentFonts2(_fonts); this.FontLoader.LoadDocumentFonts2(_fonts);
} }
...@@ -6061,8 +6385,20 @@ asc_docs_api.prototype.SyncLoadImages = function(_images) ...@@ -6061,8 +6385,20 @@ asc_docs_api.prototype.SyncLoadImages = function(_images)
this.loadCustomImageMap = _images; this.loadCustomImageMap = _images;
var _count = 0; var _count = 0;
for (var i in this.loadCustomImageMap) var _loaded = this.ImageLoader.map_image_index;
var _new_len = this.loadCustomImageMap.length;
for (var i = 0; i < _new_len; i++)
{
if (undefined !== _loaded[this.loadCustomImageMap[i]])
{
this.loadCustomImageMap.splice(i, 1);
i--;
_new_len--;
continue;
}
++_count; ++_count;
}
if (_count > 0) if (_count > 0)
{ {
...@@ -6302,16 +6638,13 @@ asc_docs_api.prototype.GetSectionInfo = function() ...@@ -6302,16 +6638,13 @@ asc_docs_api.prototype.GetSectionInfo = function()
return obj; return obj;
} }
asc_docs_api.prototype.SetViewMode = function( isViewMode, isNotSendOnCoAuthoringServer ) asc_docs_api.prototype.SetViewMode = function( isViewMode )
{ {
if (!isNotSendOnCoAuthoringServer && this.ServerIdWaitComplete && this.ServerImagesWaitComplete)
this.CoAuthoringApi.set_isViewerMode (isViewMode);
if (isViewMode) if (isViewMode)
{ {
this.isViewMode = true; this.isViewMode = true;
this.ShowParaMarks = false; this.ShowParaMarks = false;
this.isShowTableEmptyLine = false; //this.isShowTableEmptyLine = false;
//this.WordControl.m_bIsRuler = true; //this.WordControl.m_bIsRuler = true;
this.WordControl.m_oDrawingDocument.ClearCachePages(); this.WordControl.m_oDrawingDocument.ClearCachePages();
this.WordControl.HideRulers(); this.WordControl.HideRulers();
...@@ -6325,6 +6658,13 @@ asc_docs_api.prototype.SetViewMode = function( isViewMode, isNotSendOnCoAuthorin ...@@ -6325,6 +6658,13 @@ asc_docs_api.prototype.SetViewMode = function( isViewMode, isNotSendOnCoAuthorin
this.FontLoader.LoadDocumentFonts(this.WordControl.m_oLogicDocument.Fonts, true); this.FontLoader.LoadDocumentFonts(this.WordControl.m_oLogicDocument.Fonts, true);
return; return;
} }
if ( this.bInit_word_control === true )
{
CollaborativeEditing.Apply_Changes();
CollaborativeEditing.Release_Locks();
}
this.isUseEmbeddedCutFonts = false; this.isUseEmbeddedCutFonts = false;
this.isViewMode = false; this.isViewMode = false;
...@@ -6425,15 +6765,6 @@ asc_docs_api.prototype.OfflineAppDocumentEndLoad = function() ...@@ -6425,15 +6765,6 @@ asc_docs_api.prototype.OfflineAppDocumentEndLoad = function()
editor.OpenDocument(documentUrl, window["editor_bin"]); editor.OpenDocument(documentUrl, window["editor_bin"]);
else else
editor.OpenDocument2(documentUrl, window["editor_bin"]); editor.OpenDocument2(documentUrl, window["editor_bin"]);
//callback
editor.DocumentOrientation = (null == editor.WordControl.m_oLogicDocument) ? true : !editor.WordControl.m_oLogicDocument.Orientation;
var sizeMM;
if(editor.DocumentOrientation)
sizeMM = DocumentPageSize.getSize(Page_Width, Page_Height);
else
sizeMM = DocumentPageSize.getSize(Page_Height, Page_Width);
editor.sync_DocSizeCallback(sizeMM.w_mm, sizeMM.h_mm);
editor.sync_PageOrientCallback(editor.get_DocumentOrientation());
} }
asc_docs_api.prototype.SetDrawImagePlaceParagraph = function(element_id, props) asc_docs_api.prototype.SetDrawImagePlaceParagraph = function(element_id, props)
...@@ -6514,10 +6845,20 @@ function _onSpellCheck_Callback2 (response) ...@@ -6514,10 +6845,20 @@ function _onSpellCheck_Callback2 (response)
}) })
};*/ };*/
function sendCommand(editor, fCallback, rdata){ function sendCommand(editor, fCallback, rdata){
var sData;
//json не должен превышать размера g_nMaxJsonLength, иначе при его чтении будет exception
if(null != rdata["data"] && "string" === typeof(rdata["data"]) && rdata["data"].length > g_nMaxJsonLengthChecked)
{
var sTemp = rdata["data"];
rdata["data"] = null;
sData = "mnuSaveAs" + cCharDelimiter + JSON.stringify(rdata) + cCharDelimiter + sTemp;
}
else
sData = JSON.stringify(rdata);
asc_ajax({ asc_ajax({
type: 'POST', type: 'POST',
url: g_sMainServiceLocalUrl, url: g_sMainServiceLocalUrl,
data: rdata, data: sData,
error: function(jqXHR, textStatus, errorThrown){ error: function(jqXHR, textStatus, errorThrown){
editor.asc_fireCallback("asc_onError",c_oAscError.ID.Unknown,c_oAscError.Level.Critical); editor.asc_fireCallback("asc_onError",c_oAscError.ID.Unknown,c_oAscError.Level.Critical);
if(fCallback) if(fCallback)
...@@ -6525,9 +6866,9 @@ function sendCommand(editor, fCallback, rdata){ ...@@ -6525,9 +6866,9 @@ function sendCommand(editor, fCallback, rdata){
}, },
success: function(msg){ success: function(msg){
var incomeObject = JSON.parse(msg); var incomeObject = JSON.parse(msg);
switch(incomeObject.type){ switch(incomeObject["type"]){
case "open": case "open":
var sJsonUrl = g_sResourceServiceLocalUrl + incomeObject.data; var sJsonUrl = g_sResourceServiceLocalUrl + incomeObject["data"];
asc_ajax({ asc_ajax({
url: sJsonUrl, url: sJsonUrl,
dataType: "text", dataType: "text",
...@@ -6549,15 +6890,6 @@ function sendCommand(editor, fCallback, rdata){ ...@@ -6549,15 +6890,6 @@ function sendCommand(editor, fCallback, rdata){
editor.OpenDocument(url, result); editor.OpenDocument(url, result);
else else
editor.OpenDocument2(url, result); editor.OpenDocument2(url, result);
//callback
editor.DocumentOrientation = (null == editor.WordControl.m_oLogicDocument) ? true : !editor.WordControl.m_oLogicDocument.Orientation;
var sizeMM;
if(editor.DocumentOrientation)
sizeMM = DocumentPageSize.getSize(Page_Width, Page_Height);
else
sizeMM = DocumentPageSize.getSize(Page_Height, Page_Width);
editor.sync_DocSizeCallback(sizeMM.w_mm, sizeMM.h_mm);
editor.sync_PageOrientCallback(editor.get_DocumentOrientation());
if(fCallback) if(fCallback)
fCallback(incomeObject); fCallback(incomeObject);
}, },
...@@ -6570,20 +6902,20 @@ function sendCommand(editor, fCallback, rdata){ ...@@ -6570,20 +6902,20 @@ function sendCommand(editor, fCallback, rdata){
break; break;
case "needparams": case "needparams":
var rData = {"id":documentId, "format": documentFormat, "vkey": documentVKey, "editorid": c_oEditorId.Word, "c":"reopen", "url": documentUrl, "title": documentTitle, "codepage": 0, "embeddedfonts": editor.isUseEmbeddedCutFonts}; var rData = {"id":documentId, "format": documentFormat, "vkey": documentVKey, "editorid": c_oEditorId.Word, "c":"reopen", "url": documentUrl, "title": documentTitle, "codepage": 0, "embeddedfonts": editor.isUseEmbeddedCutFonts};
sendCommand(editor, fCallback, JSON.stringify(rData)) sendCommand(editor, fCallback, rData)
break; break;
case "waitopen": case "waitopen":
if (incomeObject.data) if (incomeObject["data"])
{ {
editor._lastConvertProgress = incomeObject.data / 2; editor._lastConvertProgress = incomeObject["data"] / 2;
editor.sync_SendProgress(editor._lastConvertProgress); editor.sync_SendProgress(editor._lastConvertProgress);
} }
var rData = {"id":documentId, "format": documentFormat, "vkey": documentVKey, "editorid": c_oEditorId.Word, "c":"chopen"}; var rData = {"id":documentId, "format": documentFormat, "vkey": documentVKey, "editorid": c_oEditorId.Word, "c":"chopen"};
setTimeout( function(){sendCommand(editor, fCallback, JSON.stringify(rData))}, 3000); setTimeout( function(){sendCommand(editor, fCallback, rData)}, 3000);
break; break;
case "changes": case "changes":
//var rData = {"id":documentId, "c":"sfc", "outputformat": c_oAscFileType.DOCX}; //var rData = {"id":documentId, "c":"sfc", "outputformat": c_oAscFileType.DOCX};
//sendCommand(editor, fCallback, JSON.stringify(rData)); //sendCommand(editor, fCallback, rData);
if(fCallback) if(fCallback)
fCallback(incomeObject); fCallback(incomeObject);
...@@ -6596,24 +6928,28 @@ function sendCommand(editor, fCallback, rdata){ ...@@ -6596,24 +6928,28 @@ function sendCommand(editor, fCallback, rdata){
break; break;
case "waitsave": case "waitsave":
{ {
var rData = {"id":documentId, "title": documentTitleWithoutExtention, "c":"chsave", "data": incomeObject.data}; var rData = {"id":documentId, "vkey": documentVKey, "title": documentTitleWithoutExtention, "c":"chsave", "data": incomeObject["data"]};
setTimeout( function(){sendCommand(editor, fCallback, JSON.stringify(rData))}, 3000); setTimeout( function(){sendCommand(editor, fCallback, rData)}, 3000);
} }
break; break;
case "savepart": case "savepart":
var outputData = JSON.parse(incomeObject.data); var outputData = JSON.parse(incomeObject["data"]);
_downloadAs(editor, outputData.format, fCallback, false, outputData.savekey); _downloadAs(editor, outputData["format"], fCallback, false, outputData["savekey"]);
break; break;
case "imgurl": case "getsettings":
if(fCallback) if(fCallback)
fCallback(incomeObject); fCallback(incomeObject);
break; break;
case "getsettings": case "err":
var nErrorLevel = c_oAscError.Level.NoCritical;
//todo передалеть работу с callback
if("getsettings" == rdata["c"] || "open" == rdata["c"] || "chopen" == rdata["c"] || "create" == rdata["c"])
nErrorLevel = c_oAscError.Level.Critical;
editor.asc_fireCallback("asc_onError", _mapAscServerErrorToAscError(parseInt(incomeObject["data"])), nErrorLevel);
if(fCallback) if(fCallback)
fCallback(incomeObject); fCallback(incomeObject);
break; break;
case "err": default:
editor.asc_fireCallback("asc_onError", _mapAscServerErrorToAscError(parseInt(incomeObject.data)), c_oAscError.Level.Critical);
if(fCallback) if(fCallback)
fCallback(incomeObject); fCallback(incomeObject);
break; break;
...@@ -6622,6 +6958,22 @@ function sendCommand(editor, fCallback, rdata){ ...@@ -6622,6 +6958,22 @@ function sendCommand(editor, fCallback, rdata){
}) })
}; };
function sendTrack(fCallback, url, rdata){
asc_ajax({
type: 'POST',
url: url,
data: rdata,
error: function(jqXHR, textStatus, errorThrown){
if(fCallback)
fCallback();
},
success: function(msg){
var incomeObject = JSON.parse(msg);
if(fCallback)
fCallback(incomeObject);
}
})
};
function _downloadAs(editor, filetype, fCallback, bStart, sSaveKey) function _downloadAs(editor, filetype, fCallback, bStart, sSaveKey)
{ {
var sData; var sData;
...@@ -6638,37 +6990,26 @@ function _downloadAs(editor, filetype, fCallback, bStart, sSaveKey) ...@@ -6638,37 +6990,26 @@ function _downloadAs(editor, filetype, fCallback, bStart, sSaveKey)
if(dd.isComleteRenderer2()) if(dd.isComleteRenderer2())
{ {
if(false == bStart) if(false == bStart)
{
oAdditionalData["savetype"] = "complete"; oAdditionalData["savetype"] = "complete";
sData = "mnuSaveAs" + cCharDelimiter + JSON.stringify(oAdditionalData) + cCharDelimiter + dd.ToRendererPart();
}
else else
{
oAdditionalData["savetype"] = "completeall"; oAdditionalData["savetype"] = "completeall";
sData = "mnuSaveAs" + cCharDelimiter + JSON.stringify(oAdditionalData) + cCharDelimiter + dd.ToRendererPart();
}
} }
else else
{ {
if(false == bStart) if(false == bStart)
{
oAdditionalData["savetype"] = "part"; oAdditionalData["savetype"] = "part";
sData = "mnuSaveAs" + cCharDelimiter + JSON.stringify(oAdditionalData) + cCharDelimiter + dd.ToRendererPart();
}
else else
{
oAdditionalData["savetype"] = "partstart"; oAdditionalData["savetype"] = "partstart";
sData = "mnuSaveAs" + cCharDelimiter + JSON.stringify(oAdditionalData) + cCharDelimiter + dd.ToRendererPart();
}
} }
sendCommand(editor, fCallback, sData); oAdditionalData["data"] = dd.ToRendererPart();
sendCommand(editor, fCallback, oAdditionalData);
} }
else else
{ {
var oBinaryFileWriter = new BinaryFileWriter(editor.WordControl.m_oLogicDocument); var oBinaryFileWriter = new BinaryFileWriter(editor.WordControl.m_oLogicDocument);
oAdditionalData["savetype"] = "completeall"; oAdditionalData["savetype"] = "completeall";
sData = "mnuSaveAs" + cCharDelimiter + JSON.stringify(oAdditionalData) + cCharDelimiter + oBinaryFileWriter.Write(); oAdditionalData["data"] = oBinaryFileWriter.Write();
sendCommand(editor, fCallback, sData); sendCommand(editor, fCallback, oAdditionalData);
} }
}; };
...@@ -6715,6 +7056,7 @@ function _mapAscServerErrorToAscError(nServerError) ...@@ -6715,6 +7056,7 @@ function _mapAscServerErrorToAscError(nServerError)
case c_oAscServerError.TaskResult : nRes = c_oAscError.ID.Database;break; case c_oAscServerError.TaskResult : nRes = c_oAscError.ID.Database;break;
case c_oAscServerError.ConvertDownload : nRes = c_oAscError.ID.DownloadError;break; case c_oAscServerError.ConvertDownload : nRes = c_oAscError.ID.DownloadError;break;
case c_oAscServerError.ConvertTimeout : nRes = c_oAscError.ID.ConvertationTimeout;break; case c_oAscServerError.ConvertTimeout : nRes = c_oAscError.ID.ConvertationTimeout;break;
case c_oAscServerError.ConvertMS_OFFCRYPTO : nRes = c_oAscError.ID.ConvertationPassword;break;
case c_oAscServerError.ConvertUnknownFormat : case c_oAscServerError.ConvertUnknownFormat :
case c_oAscServerError.ConvertReadFile : case c_oAscServerError.ConvertReadFile :
case c_oAscServerError.Convert : nRes = c_oAscError.ID.ConvertationError;break; case c_oAscServerError.Convert : nRes = c_oAscError.ID.ConvertationError;break;
...@@ -6841,71 +7183,43 @@ CErrorData.prototype.get_Value = function() { return this.Value; }; ...@@ -6841,71 +7183,43 @@ CErrorData.prototype.get_Value = function() { return this.Value; };
// Вставка диаграмм // Вставка диаграмм
asc_docs_api.prototype.asc_getChartObject = function() asc_docs_api.prototype.asc_getChartObject = function()
{ {
this.isChartEditor = true; this.isChartEditor = true; // Для совместного редактирования
var chart = this.WordControl.m_oLogicDocument.Get_ChartObject();
if ( chart.type != "" )
this.WordControl.m_oLogicDocument.Document_Is_SelectionLocked(changestype_Drawing_Props);
else
this.WordControl.m_oLogicDocument.Document_Is_SelectionLocked(changestype_Paragraph_Content);
chart["themeColors"] = []; var graphicObject = this.WordControl.m_oLogicDocument.Get_ChartObject();
for (var i = 0; i < this.WordControl.m_oDrawingDocument.GuiControlColorsMap.length; i++) { for (var i = 0; i < this.WordControl.m_oDrawingDocument.GuiControlColorsMap.length; i++) {
chart["themeColors"].push( this.WordControl.m_oDrawingDocument.GuiControlColorsMap[i].get_hex() ); graphicObject.chart.themeColors.push( this.WordControl.m_oDrawingDocument.GuiControlColorsMap[i].get_hex() );
} }
return graphicObject;
return chart;
} }
asc_docs_api.prototype.asc_addChartDrawingObject = function(chart) asc_docs_api.prototype.asc_addChartDrawingObject = function(chartBinary)
{ {
if ( false === this.WordControl.m_oLogicDocument.Document_Is_SelectionLocked(changestype_Paragraph_Content) ) /**/
{
History.Create_NewPoint();
var diagramm = new CChartData(true);
diagramm.deserializeChart(chart);
diagramm.putToHistory();
var _image = this.ImageLoader.LoadImage(_getFullImageSrc(diagramm.img), 1); // Приводим бинарик к объекту типа CChartAsGroup и добавляем объект
if (null != _image) if ( isObject(chartBinary) )
{
this.WordControl.m_oLogicDocument.Add_InlineImage( this.WordControl.m_oLogicDocument.DrawingDocument.GetMMPerDot(diagramm.width),
this.WordControl.m_oLogicDocument.DrawingDocument.GetMMPerDot(diagramm.height), null, diagramm );
}
else
{ {
this.sync_StartAction(c_oAscAsyncActionType.Information, c_oAscAsyncAction.LoadImage); var binary = chartBinary["binary"];
this.asyncImageEndLoaded2 = function(_image) if ( false === this.WordControl.m_oLogicDocument.Document_Is_SelectionLocked(changestype_Paragraph_Content) )
{ {
this.WordControl.m_oLogicDocument.Add_InlineImage( this.WordControl.m_oLogicDocument.DrawingDocument.GetMMPerDot(diagramm.width), History.Create_NewPoint();
this.WordControl.m_oLogicDocument.DrawingDocument.GetMMPerDot(diagramm.height), null, diagramm); this.WordControl.m_oLogicDocument.Add_InlineImage( null, null, null, binary );
this.sync_EndAction(c_oAscAsyncActionType.Information, c_oAscAsyncAction.LoadImage);
}
} }
} }
} }
asc_docs_api.prototype.asc_editChartDrawingObject = function(chart) asc_docs_api.prototype.asc_editChartDrawingObject = function(chartBinary)
{ {
if ( false === this.WordControl.m_oLogicDocument.Document_Is_SelectionLocked(changestype_Paragraph_Content) ) /**/
{
History.Create_NewPoint();
var diagramm = new CChartData(true);
diagramm.deserializeChart(chart);
diagramm.putToHistory();
var _image = this.ImageLoader.LoadImage(_getFullImageSrc(diagramm.img), 1); // Находим выделенную диаграмму и накатываем бинарник
if (null != _image) if ( isObject(chartBinary) )
{ {
this.WordControl.m_oLogicDocument.Edit_Chart( diagramm ); var binary = chartBinary["binary"];
} if ( false === this.WordControl.m_oLogicDocument.Document_Is_SelectionLocked(changestype_Paragraph_Content) )
else
{
this.sync_StartAction(c_oAscAsyncActionType.Information, c_oAscAsyncAction.LoadImage);
this.asyncImageEndLoaded2 = function(_image)
{ {
this.WordControl.m_oLogicDocument.Edit_Chart( diagramm ); History.Create_NewPoint();
this.sync_EndAction(c_oAscAsyncActionType.Information, c_oAscAsyncAction.LoadImage); this.WordControl.m_oLogicDocument.Edit_Chart(binary);
}
} }
} }
} }
...@@ -6921,3 +7235,13 @@ asc_docs_api.prototype.sync_closeChartEditor = function() ...@@ -6921,3 +7235,13 @@ asc_docs_api.prototype.sync_closeChartEditor = function()
{ {
this.asc_fireCallback("asc_onCloseChartEditor"); this.asc_fireCallback("asc_onCloseChartEditor");
} }
asc_docs_api.prototype.asc_setDrawCollaborationMarks = function (bDraw)
{
if ( bDraw !== this.isCoMarksDraw )
{
this.isCoMarksDraw = bDraw;
this.WordControl.m_oDrawingDocument.ClearCachePages();
this.WordControl.m_oDrawingDocument.FirePaint();
}
}
...@@ -48,8 +48,7 @@ CFraction.prototype.getCenter = function() ...@@ -48,8 +48,7 @@ CFraction.prototype.getCenter = function()
if(this.type == BAR_FRACTION || this.type == NO_BAR_FRACTION) if(this.type == BAR_FRACTION || this.type == NO_BAR_FRACTION)
{ {
//var penW = this.getTxtPrp().FontSize* 25.4/96 * 0.08 /2; var penW = this.getCtrPrp().FontSize* 25.4/96 * 0.08 /2;
var penW = this.getPrpToControlLetter().FontSize* 25.4/96 * 0.08 /2;
center = this.elements[0][0].size.height + penW; center = this.elements[0][0].size.height + penW;
} }
else if(this.type == SKEWED_FRACTION) else if(this.type == SKEWED_FRACTION)
...@@ -74,7 +73,7 @@ CFraction.prototype.draw = function(pGraphics) ...@@ -74,7 +73,7 @@ CFraction.prototype.draw = function(pGraphics)
} }
CFraction.prototype.drawBarFraction = function(pGraphics) CFraction.prototype.drawBarFraction = function(pGraphics)
{ {
var ctrPrp = this.getPrpToControlLetter(); var ctrPrp = this.getCtrPrp();
var penW = ctrPrp.FontSize* this.reduct* 25.4/96 * 0.08; var penW = ctrPrp.FontSize* this.reduct* 25.4/96 * 0.08;
var x1 = this.pos.x, var x1 = this.pos.x,
...@@ -94,8 +93,8 @@ CFraction.prototype.drawBarFraction = function(pGraphics) ...@@ -94,8 +93,8 @@ CFraction.prototype.drawBarFraction = function(pGraphics)
} }
CFraction.prototype.drawSkewedFraction = function(pGraphics) CFraction.prototype.drawSkewedFraction = function(pGraphics)
{ {
var ctrPrp = this.getPrpToControlLetter(); var ctrPrp = this.getCtrPrp();
//var fontSize = this.getTxtPrp().FontSize;
var penW = ctrPrp.FontSize/12.5*g_dKoef_pix_to_mm; var penW = ctrPrp.FontSize/12.5*g_dKoef_pix_to_mm;
var gap = this.gapSlash/2 - penW/7.5; var gap = this.gapSlash/2 - penW/7.5;
...@@ -199,7 +198,7 @@ CFraction.prototype.drawLinearFraction = function(pGraphics) ...@@ -199,7 +198,7 @@ CFraction.prototype.drawLinearFraction = function(pGraphics)
x2 = this.pos.x + this.elements[0][0].size.width + shift, x2 = this.pos.x + this.elements[0][0].size.width + shift,
y2 = this.pos.y + this.size.center + desc; y2 = this.pos.y + this.size.center + desc;
var ctrPrp = this.getPrpToControlLetter(); var ctrPrp = this.getCtrPrp();
var penW = ctrPrp.FontSize/12.5*g_dKoef_pix_to_mm; var penW = ctrPrp.FontSize/12.5*g_dKoef_pix_to_mm;
pGraphics.SetFont(ctrPrp); pGraphics.SetFont(ctrPrp);
...@@ -248,7 +247,7 @@ CFraction.prototype.recalculateSize = function() ...@@ -248,7 +247,7 @@ CFraction.prototype.recalculateSize = function()
} }
CFraction.prototype.recalculateSkewed = function() CFraction.prototype.recalculateSkewed = function()
{ {
var ctrPrp = this.getPrpToControlLetter(); var ctrPrp = this.getCtrPrp();
this.gapSlash = 5.011235894097222 * ctrPrp.FontSize/36; this.gapSlash = 5.011235894097222 * ctrPrp.FontSize/36;
var _width = this.elements[0][0].size.width + this.gapSlash + this.elements[0][1].size.width; var _width = this.elements[0][0].size.width + this.gapSlash + this.elements[0][1].size.width;
var _height = this.elements[0][0].size.height + this.elements[0][1].size.height; var _height = this.elements[0][0].size.height + this.elements[0][1].size.height;
...@@ -260,7 +259,7 @@ CFraction.prototype.recalculateLinear = function() ...@@ -260,7 +259,7 @@ CFraction.prototype.recalculateLinear = function()
{ {
var H = this.elements[0][0].size.center + this.elements[0][1].size.height - this.elements[0][1].size.center; var H = this.elements[0][0].size.center + this.elements[0][1].size.height - this.elements[0][1].size.center;
//var txtPrp = this.getTxtPrp(); //var txtPrp = this.getTxtPrp();
var ctrPrp = this.getPrpToControlLetter(); var ctrPrp = this.getCtrPrp();
var gap = 5.011235894097222*ctrPrp.FontSize/36; var gap = 5.011235894097222*ctrPrp.FontSize/36;
...@@ -393,6 +392,7 @@ CNumerator.prototype.recalculateSize = function() ...@@ -393,6 +392,7 @@ CNumerator.prototype.recalculateSize = function()
var arg = this.elements[0][0].size; var arg = this.elements[0][0].size;
//var txtPrp = this.getTxtPrp(); //var txtPrp = this.getTxtPrp();
//txtPrp.FontSize *= this.Parent.reduct; //txtPrp.FontSize *= this.Parent.reduct;
var ctrPrp = this.getCtrPrp(); var ctrPrp = this.getCtrPrp();
var Descent = arg.height - arg.ascent; // baseLine var Descent = arg.height - arg.ascent; // baseLine
...@@ -454,6 +454,7 @@ CDenominator.prototype.recalculateSize = function() ...@@ -454,6 +454,7 @@ CDenominator.prototype.recalculateSize = function()
var arg = this.elements[0][0].size; var arg = this.elements[0][0].size;
/*var txtPrp = this.getTxtPrp(); /*var txtPrp = this.getTxtPrp();
txtPrp.FontSize *= this.Parent.reduct;*/ txtPrp.FontSize *= this.Parent.reduct;*/
var ctrPrp = this.getCtrPrp(); var ctrPrp = this.getCtrPrp();
var gap = 7.832769097222222 * ctrPrp.FontSize/36, var gap = 7.832769097222222 * ctrPrp.FontSize/36,
......
...@@ -99,8 +99,7 @@ CLimit.prototype.getIterator = function() ...@@ -99,8 +99,7 @@ CLimit.prototype.getIterator = function()
} }
CLimit.prototype.setDistance = function() CLimit.prototype.setDistance = function()
{ {
//this.dH = 0.03674768518518519*this.getTxtPrp().FontSize; this.dH = 0.03674768518518519*this.getCtrPrp().FontSize;
this.dH = 0.03674768518518519*this.getPrpToControlLetter().FontSize;
} }
...@@ -157,8 +156,7 @@ CMathFunc.prototype.init = function() ...@@ -157,8 +156,7 @@ CMathFunc.prototype.init = function()
} }
CMathFunc.prototype.setDistance = function() CMathFunc.prototype.setDistance = function()
{ {
//this.dW = this.getTxtPrp().FontSize/6*g_dKoef_pt_to_mm; this.dW = this.getCtrPrp().FontSize/6*g_dKoef_pt_to_mm;
this.dW = this.getPrpToControlLetter().FontSize/6*g_dKoef_pt_to_mm;
} }
CMathFunc.prototype.getFName = function() CMathFunc.prototype.getFName = function()
{ {
......
...@@ -501,6 +501,9 @@ CMathContent.prototype = ...@@ -501,6 +501,9 @@ CMathContent.prototype =
{ {
var elem = new mathElem(obj); var elem = new mathElem(obj);
if(obj.typeObj === MATH_COMP)
obj.setComposition(this.Composition);
var bDef = typeof(shift) !== "undefined" && shift !== null; var bDef = typeof(shift) !== "undefined" && shift !== null;
var bNum = shift === shift - 0; var bNum = shift === shift - 0;
var bCont = bNum ? ( this.CurPos + shift >= 0 && this.CurPos + shift < this.content.length) : false; var bCont = bNum ? ( this.CurPos + shift >= 0 && this.CurPos + shift < this.content.length) : false;
...@@ -527,6 +530,15 @@ CMathContent.prototype = ...@@ -527,6 +530,15 @@ CMathContent.prototype =
{ {
this.Composition = Composition; this.Composition = Composition;
}, },
setReferenceComp: function(Comp) // отличие от setComposition: ссылка на общую формулу передается всем элементам контента
{
this.Composition = Comp;
for(var i = 0; i < this.content.length; i++)
{
if(this.content[i].value.type == MATH_COMP)
this.contetn[i].value.setReferenceComp(Comp);
}
},
createEquation: function(ind) createEquation: function(ind)
{ {
var Pos = this.CurPos + 1; var Pos = this.CurPos + 1;
...@@ -4374,9 +4386,11 @@ CMathContent.prototype = ...@@ -4374,9 +4386,11 @@ CMathContent.prototype =
} }
else if(order == -2) else if(order == -2)
{ {
this.setStart_Selection(this.CurPos + 1); /*this.setStart_Selection(this.CurPos + 1);
this.setEnd_Selection(this.CurPos - 1); this.setEnd_Selection(this.CurPos - 1);
this.selection.active = false; this.selection.active = false;*/
this.removeFormula(this.CurPos);
SelectContent = this; SelectContent = this;
CurrContent = null; // т.к. пришли из другого контента CurrContent = null; // т.к. пришли из другого контента
...@@ -4387,6 +4401,214 @@ CMathContent.prototype = ...@@ -4387,6 +4401,214 @@ CMathContent.prototype =
return {CurrContent : CurrContent, SelectContent: SelectContent, state: state, items: items}; return {CurrContent : CurrContent, SelectContent: SelectContent, state: state, items: items};
}, },
remove_internal: function(order) remove_internal: function(order)
{
var bDelete = false;
var bSelect = this.selection.startPos !== this.selection.endPos;
var currType = this.content[this.CurPos].value.typeObj,
prevType = this.CurPos > 1 ? this.content[this.CurPos - 1].value.typeObj : null,
prev2_Type = this.CurPos > 2 ? this.content[this.CurPos - 2].value.typeObj : null,
nextType = this.CurPos + 1 < this.content.length ? this.content[this.CurPos + 1].value.typeObj : null,
next2_Type = this.CurPos + 2 < this.content.length ? this.content[this.CurPos + 2].value.typeObj : null,
next3_Type = this.CurPos + 3 < this.content.length ? this.content[this.CurPos + 3].value.typeObj : null;
var bDirectlyBegin = this.CurPos == 0 || (currType == MATH_EMPTY && this.CurPos == 1) && bMEDirect,
bReverseEnd = this.CurPos == this.content.length - 1 && bMEReverse;
var bNotRemove = bDirectlyBegin || bReverseEnd;
var bMEDirect = order == 1,
bMEReverse = order == -1;
// directly
var bDirectly_CurrComp = bMEDirect && currType == MATH_EMPTY && prevType == MATH_COMP ,
bDirectly_RPrpComp = bMEDirect && currType == MATH_RUN_PRP && prevType == MATH_EMPTY && prev2_Type == MATH_COMP;
// reverse
var bReverseComp = bMEReverse && nextType == MATH_COMP && next2_Type == MATH_EMPTY;
//
var bRemoveFormula = (bDirectly_CurrComp|| bDirectly_RPrpComp || bReverseComp) && !bSelect;
// NB !
// учесть случаи :
// 1. если нажата delete и справа стоят RunPrp
// 2. если все текстовые элементы удалили из Run, нужно удалить RunPrp (delete и backspace)
if(bRemoveFormula)
{
var pos;
if(bMEReverse)
pos = this.CurPos + 1;
else if(bDirectly_CurrComp)
pos = this.CurPos - 1;
else if(bDirectly_RPrpComp)
pos = this.CurPos - 2;
this.removeFormula(pos);
/* var start, end;
if(bDirectly_CurrComp) // directly, only composition
{
start = this.CurPos;
end = this.CurPos - 2;
}
else if(bReverseComp && !bAfterRPrp) // reverse, only composition
{
start = this.CurPos;
end = this.CurPos + 2;
}
else // composition + RunPrp(after)
{
var bSelectRunPrp = false;
var bDirectlySearch = prev3_Type === MATH_TEXT && bDirectly_RPrpComp, // перед мат. объектом текст, а после RunPrp
bReverseSeach = currType === MATH_TEXT && bMEReverse && bAfterRPrp;
if(bDirectlySearch || bReverseSeach)
{
var shift;
if(bMEDirect)
shift = 3;
else
shift = 0;
for(var i = this.CurPos - shift; i > 0; i--)
{
if(this.content[i].value.typeObj === MATH_RUN_PRP)
{
currRPrp = this.content[this.CurPos + shift].value;
prevRPrp = this.content[i].value;
bSelectRunPrp = currRPrp.isEqual(currRPrp, prevRPrp);
break;
}
}
}
if(bMEDirect)
{
if(bSelectRunPrp)
{
start = this.CurPos;
end = this.CurPos - 3;
}
else
{
start = this.CurPos - 1;
end = this.CurPos - 3;
}
}
else
{
if(bSelectRunPrp)
{
start = this.CurPos - 1;
end = this.CurPos + 2;
}
else
{
start = this.CurPos - 1;
end = this.CurPos + 1;
}
}
}
this.setStart_Selection(start);
this.setEnd_Selection(end);
this.selection.active = false;*/
}
// TO DO
// переделать !
// можно проще, как для случая с формулой
else if(!bNotRemove)
{
var start, end;
var bDirRPrp = currType === MATH_RUN_PRP && bMEDirect,
bRevRPrp = nextType === MATH_RUN_PRP && bMEReverse;
if(bDirRPrp) // проверку на начало прошли
{
start = this.CurPos - 1;
end = this.CurPos;
}
else if(bRevRPrp) // на всякий случай, может получится, что после удаления элемента, стоим после RunPrp
{
start = this.CurPos + 2;
end = this.CurPos + 3;
}
else if(bSelect)
{
start = this.selection.startPos;
end = this.selection.endPos;
var tmp;
if(start > end)
{
tmp = start;
start = end;
end = tmp;
}
}
else if(bMEReverse)
{
if(nextType == MATH_RUN_PRP && next3_Type !== MATH_TEXT) //единственная буква в Run
{
start = this.CurPos;
end = this.CurPos + 2;
}
else
{
start = this.CurPos + 1;
end = this.CurPos + 2;
}
}
else
{
if(prevType == MATH_RUN_PRP && nextType !== MATH_TEXT) //единственная буква в Run
{
start = this.CurPos - 1;
end = this.CurPos + 1;
}
else
{
start = this.CurPos;
end = this.CurPos + 1;
}
}
items = this.content.splice(start, end - start);
if(!TEST)
{
History.Create_NewPoint();
//items = this.content.splice(start, end - start);
History.Add(this, {Type: historyitem_Math_RemoveItem, Items: items, Pos: start});
}
if(bSelect)
this.CurPos = this.selection.startPos - 1;
else if(bMEDirect)
this.CurPos -= end - start;
this.setStart_Selection(this.CurPos);
this.selection.active = false;
bDelete = true;
}
return {bDelete: bDelete, items: items};
},
old_remove_internal: function(order)
{ {
var bDelete = false; var bDelete = false;
var bSelect = this.selection.startPos !== this.selection.endPos; var bSelect = this.selection.startPos !== this.selection.endPos;
...@@ -4398,9 +4620,10 @@ CMathContent.prototype = ...@@ -4398,9 +4620,10 @@ CMathContent.prototype =
next2_Type = this.CurPos + 2 < this.content.length ? this.content[this.CurPos + 2].value.typeObj : null, next2_Type = this.CurPos + 2 < this.content.length ? this.content[this.CurPos + 2].value.typeObj : null,
next3_Type = this.CurPos + 3 < this.content.length ? this.content[this.CurPos + 3].value.typeObj : null; next3_Type = this.CurPos + 3 < this.content.length ? this.content[this.CurPos + 3].value.typeObj : null;
var bDirBeginning = this.CurPos == 0 || (currType == MATH_EMPTY && this.CurPos == 1) && bMEDirect, var bDirectlyBegin = this.CurPos == 0 || (currType == MATH_EMPTY && this.CurPos == 1) && bMEDirect,
bReverseEnd = this.CurPos == this.content.length - 1 && bMEReverse; bReverseEnd = this.CurPos == this.content.length - 1 && bMEReverse;
var bNotRemove = bDirectlyBegin || bReverseEnd;
// directly // directly
...@@ -4504,7 +4727,7 @@ CMathContent.prototype = ...@@ -4504,7 +4727,7 @@ CMathContent.prototype =
this.selection.active = false; this.selection.active = false;
} }
else if( !bDirBeginning && !bReverseEnd ) else if(!bNotRemove)
{ {
var start, end; var start, end;
...@@ -4581,7 +4804,62 @@ CMathContent.prototype = ...@@ -4581,7 +4804,62 @@ CMathContent.prototype =
return {bDelete: bDelete, items: items}; return {bDelete: bDelete, items: items};
}, },
old_remove_internal: function(order) removeFormula: function(pos)
{
var result = false;
var currType = this.content[pos].value.typeObj,
prevType = pos > 1 ? this.content[pos - 1].value.typeObj : null,
nextType = pos + 1 < this.content.length ? this.content[pos + 1].value.typeObj : null,
next2_Type = pos + 2 < this.content.length ? this.content[pos + 2].value.typeObj : null;
var bMFormula = currType == MATH_COMP && nextType == MATH_EMPTY;
var bAfterRPrp = next2_Type == MATH_RUN_PRP,
bPrevTxt = prevType == MATH_TEXT;
var bRemoveRPrp = bAfterRPrp && bPrevTxt;
if(bMFormula)
{
var start, end;
var bSelectRunPrp = false;
if(bRemoveRPrp)
{
for(var i = pos - 1; i > 0; i--)
{
if(this.content[i].value.typeObj === MATH_RUN_PRP)
{
currRPrp = this.content[pos+2].value;
prevRPrp = this.content[i].value;
bSelectRunPrp = currRPrp.isEqual(currRPrp, prevRPrp);
break;
}
}
}
if(bSelectRunPrp)
{
start = pos - 1;
end = pos + 2;
}
else
{
start = pos - 1;
end = pos + 1;
}
this.setStart_Selection(start);
this.setEnd_Selection(end);
this.selection.active = false;
result = true;
}
return result;
},
old_old_remove_internal: function(order)
{ {
//var bMEDirect = order == 1 && this.content[this.CurPos].value.empty, //var bMEDirect = order == 1 && this.content[this.CurPos].value.empty,
var bMEDirect = order == 1 && currType === MATH_EMPTY, // работает, если только в конце формулы стоим или после идет еще одна формула var bMEDirect = order == 1 && currType === MATH_EMPTY, // работает, если только в конце формулы стоим или после идет еще одна формула
...@@ -5024,14 +5302,15 @@ CMathContent.prototype = ...@@ -5024,14 +5302,15 @@ CMathContent.prototype =
} }
else if(this.content[1].value.typeObj === MATH_COMP) else if(this.content[1].value.typeObj === MATH_COMP)
{ {
var ctrPrp = this.content[1].value.getCtrPrp(); //var ctrPrp = this.content[1].value.getCtrPrp();
var ctrPrp = this.content[1].value.getCtrPrp_2();// иначе зациклимся на getCtrPrp
txtPrp.Merge(ctrPrp); txtPrp.Merge(ctrPrp);
} }
} }
return txtPrp; return txtPrp;
}, },
old_checkRunPrp: function() old_old_checkRunPrp: function()
{ {
var bEmpty = this.IsEmpty(), var bEmpty = this.IsEmpty(),
OnlyRunPrp = this.content.length == 2 && this.content[1].value.typeObj == MATH_RUN_PRP; OnlyRunPrp = this.content.length == 2 && this.content[1].value.typeObj == MATH_RUN_PRP;
...@@ -5060,7 +5339,7 @@ CMathContent.prototype = ...@@ -5060,7 +5339,7 @@ CMathContent.prototype =
} }
}, },
checkRunPrp: function() old_checkRunPrp: function()
{ {
var bEmpty = this.IsEmpty(), var bEmpty = this.IsEmpty(),
OnlyRunPrp = this.content.length == 2 && this.content[1].value.typeObj == MATH_RUN_PRP, OnlyRunPrp = this.content.length == 2 && this.content[1].value.typeObj == MATH_RUN_PRP,
...@@ -5188,7 +5467,7 @@ CMathContent.prototype = ...@@ -5188,7 +5467,7 @@ CMathContent.prototype =
var rPrp = new CTextPr(); var rPrp = new CTextPr();
rPrp.Italic = flag; rPrp.Italic = flag;
if(bEmpty) if(this.IsEmpty())
{ {
this.addRunPrp(rPrp); this.addRunPrp(rPrp);
} }
...@@ -5201,6 +5480,46 @@ CMathContent.prototype = ...@@ -5201,6 +5480,46 @@ CMathContent.prototype =
} }
} }
}, },
addRPrpForSelect: function(rPrp)
{
var start = this.selection.startPos,
end = this.selection.endPos;
if(start > end)
{
var temp = start;
start = end;
end = temp;
}
for(var i = start; i < end; i++)
{
var obj = this.content[i].value;
if(obj.typeObj == MATH_RUN_PRP)
{
obj.Merge(rPrp);
}
else if(obj.typeObj == MATH_COMP)
{
obj.addRPrp(rPrp);
}
}
},
addRPrp: function(rPrp)
{
for(var i = 0; i < this.content.length; i++)
{
var obj = this.content[i].value;
if(obj.typeObj == MATH_RUN_PRP)
{
obj.Merge(rPrp);
}
else if(obj.typeObj == MATH_COMP)
{
obj.addRPrp(rPrp);
}
}
},
//////////////////////// ////////////////////////
//////// ///////// //////// /////////
...@@ -5453,19 +5772,9 @@ CMathContent.prototype = ...@@ -5453,19 +5772,9 @@ CMathContent.prototype =
return content; return content;
}, },
IsEmpty: function() IsEmpty: function()
{ {
return this.content.length == 1; return this.content.length == 1;
},
setReferenceComp: function(Comp)
{
this.Composition = Comp;
for(var i = 0; i < this.content.length; i++)
{
if(this.content[i].value.type == MATH_COMP)
this.contetn[i].value.setReferenceComp(Comp);
}
} }
} }
//todo //todo
...@@ -5858,7 +6167,7 @@ CMathComposition.prototype = ...@@ -5858,7 +6167,7 @@ CMathComposition.prototype =
editor.WordControl.m_oLogicDocument.DrawingDocument.SelectEnabled(false); editor.WordControl.m_oLogicDocument.DrawingDocument.SelectEnabled(false);
} }
}, },
SetTxtPrp: function(txtPrp) old_SetTxtPrp: function(txtPrp)
{ {
this.SelectContent.changeTxtPrp(txtPrp, false); this.SelectContent.changeTxtPrp(txtPrp, false);
//this.SelectContent.setTxtPrp(txtPrp, false); //this.SelectContent.setTxtPrp(txtPrp, false);
...@@ -6108,7 +6417,7 @@ CMathComposition.prototype = ...@@ -6108,7 +6417,7 @@ CMathComposition.prototype =
this.CreateEquation2(indef); this.CreateEquation2(indef);
// временно // временно
//this.RecalculateReverse(); //this.RecalculateReverse();
this.Root.Resize(); //this.Root.Resize();
this.UpdatePosition(); this.UpdatePosition();
}, },
RecalculateComposition: function() RecalculateComposition: function()
......
...@@ -4,8 +4,7 @@ function CMathMatrix() ...@@ -4,8 +4,7 @@ function CMathMatrix()
this.lineGapRow = 1; this.lineGapRow = 1;
this.gaps = null; this.gaps = null;
this.plcHide = false; this.plcHide = false;
this.row = 0;
this.column = 0;
this.spaceRow = this.spaceRow =
{ {
...@@ -29,6 +28,11 @@ function CMathMatrix() ...@@ -29,6 +28,11 @@ function CMathMatrix()
column: new Array() column: new Array()
}; };
//// special for "read" ////
this.row = 0;
this.column = 0;
////
CMathBase.call(this); CMathBase.call(this);
} }
extend(CMathMatrix, CMathBase); extend(CMathMatrix, CMathBase);
...@@ -161,8 +165,7 @@ CMathMatrix.prototype.setRuleGap = function(space, rule, gap, minGap) ...@@ -161,8 +165,7 @@ CMathMatrix.prototype.setRuleGap = function(space, rule, gap, minGap)
} }
CMathMatrix.prototype.recalculateSize = function() CMathMatrix.prototype.recalculateSize = function()
{ {
//var txtPrp = this.getTxtPrp(); var txtPrp = this.getCtrPrp();
var txtPrp = this.getPrpToControlLetter();
var interval = this.getLineGap(txtPrp); var interval = this.getLineGap(txtPrp);
this.gaps.column[0] = 0; this.gaps.column[0] = 0;
...@@ -466,7 +469,6 @@ CMathMatrix.prototype.baseJustification = function(type) ...@@ -466,7 +469,6 @@ CMathMatrix.prototype.baseJustification = function(type)
//// ////
function CEqArray() function CEqArray()
{ {
this.row = 0;
CMathMatrix.call(this); CMathMatrix.call(this);
} }
extend(CEqArray, CMathMatrix); extend(CEqArray, CMathMatrix);
......
...@@ -129,8 +129,7 @@ CNary.prototype.init = function(props) ...@@ -129,8 +129,7 @@ CNary.prototype.init = function(props)
} }
CNary.prototype.setDistance = function() CNary.prototype.setDistance = function()
{ {
//this.dW = this.getTxtPrp().FontSize/36*2.45; this.dW = this.getCtrPrp().FontSize/36*2.45;
this.dW = this.getPrpToControlLetter().FontSize/36*2.45;
} }
CNary.prototype.getBase = function() CNary.prototype.getBase = function()
{ {
...@@ -325,7 +324,7 @@ CNaryUndOvr.prototype.init = function(sign) ...@@ -325,7 +324,7 @@ CNaryUndOvr.prototype.init = function(sign)
CNaryUndOvr.prototype.recalculateSize = function() CNaryUndOvr.prototype.recalculateSize = function()
{ {
//var zetta = this.getTxtPrp().FontSize* 25.4/96; //var zetta = this.getTxtPrp().FontSize* 25.4/96;
var zetta = this.getPrpToControlLetter().FontSize* 25.4/96; var zetta = this.getCtrPrp().FontSize* 25.4/96;
this.gapTop = zetta*0.25; this.gapTop = zetta*0.25;
this.gapBottom = zetta*0.1; this.gapBottom = zetta*0.1;
...@@ -419,7 +418,6 @@ CNaryUndOvr.prototype.getUpperIterator = function() ...@@ -419,7 +418,6 @@ CNaryUndOvr.prototype.getUpperIterator = function()
function CNaryOperator(flip) function CNaryOperator(flip)
{ {
this.Composition = null; this.Composition = null;
this.TxtPrp = new CMathTextPrp();
this.bFlip = (flip == -1); this.bFlip = (flip == -1);
this.sizeGlyph = null; this.sizeGlyph = null;
} }
...@@ -434,7 +432,7 @@ CNaryOperator.prototype.draw = function(pGraphics) ...@@ -434,7 +432,7 @@ CNaryOperator.prototype.draw = function(pGraphics)
YY = new Array(); YY = new Array();
//var textScale = this.getTxtPrp().FontSize/850; // 1000 pt //var textScale = this.getTxtPrp().FontSize/850; // 1000 pt
var textScale = this.getPrpToControlLetter().FontSize/850; // 1000 pt var textScale = this.getCtrPrp().FontSize/850; // 1000 pt
var alpha = textScale*25.4/96 /64; // коэффициент; используется для того чтобы перевести координаты в миллиметры var alpha = textScale*25.4/96 /64; // коэффициент; используется для того чтобы перевести координаты в миллиметры
// g_dKoef_px_to_mm = 25.4/96 // g_dKoef_px_to_mm = 25.4/96
...@@ -497,22 +495,14 @@ CNaryOperator.prototype.Resize = function() ...@@ -497,22 +495,14 @@ CNaryOperator.prototype.Resize = function()
{ {
this.recalculateSize(); this.recalculateSize();
} }
CNaryOperator.prototype.setTxtPrp = function(txtPrp)
{
this.TxtPrp.Merge(txtPrp);
}
CNaryOperator.prototype.setComposition = function(Compos) CNaryOperator.prototype.setComposition = function(Compos)
{ {
this.Composition = Compos; this.Composition = Compos;
} }
CNaryOperator.prototype.getPrpToControlLetter = function() CNaryOperator.prototype.getCtrPrp = function()
{ {
return this.Parent.getPrpToControlLetter(); return this.Parent.getCtrPrp();
} }
/*CNaryOperator.prototype.getTxtPrp = function()
{
return this.TxtPrp;
}*/
function CSigma() function CSigma()
{ {
...@@ -630,7 +620,7 @@ CSigma.prototype.getCoord = function() ...@@ -630,7 +620,7 @@ CSigma.prototype.getCoord = function()
//var textScale = this.getTxtPrp().FontSize/850; // 1000 pt //var textScale = this.getTxtPrp().FontSize/850; // 1000 pt
var textScale = this.getPrpToControlLetter().FontSize/850; // 1000 pt var textScale = this.getCtrPrp().FontSize/850; // 1000 pt
var alpha = textScale*25.4/96 /64; var alpha = textScale*25.4/96 /64;
var h1 = Y[0] - Y[21], var h1 = Y[0] - Y[21],
...@@ -702,7 +692,7 @@ CSigma.prototype.calculateSizeGlyph = function() ...@@ -702,7 +692,7 @@ CSigma.prototype.calculateSizeGlyph = function()
// пока размер не меняем в зависимости от высоты аргумента // пока размер не меняем в зависимости от высоты аргумента
//var betta = this.getTxtPrp().FontSize/36; //var betta = this.getTxtPrp().FontSize/36;
var betta = this.getPrpToControlLetter().FontSize/36; var betta = this.getCtrPrp().FontSize/36;
var _width = 8.997900390624999*betta, var _width = 8.997900390624999*betta,
_height = 11.994444444444444*betta; _height = 11.994444444444444*betta;
...@@ -834,7 +824,7 @@ CProduct.prototype.getCoord = function() ...@@ -834,7 +824,7 @@ CProduct.prototype.getCoord = function()
//var textScale = this.getTxtPrp().FontSize/850, // 1000 pt //var textScale = this.getTxtPrp().FontSize/850, // 1000 pt
var textScale = this.getPrpToControlLetter().FontSize/850, // 1000 pt var textScale = this.getCtrPrp().FontSize/850, // 1000 pt
alpha = textScale*25.4/96 /64; alpha = textScale*25.4/96 /64;
var h1 = Y[9], var h1 = Y[9],
...@@ -865,7 +855,7 @@ CProduct.prototype.getCoord = function() ...@@ -865,7 +855,7 @@ CProduct.prototype.getCoord = function()
CProduct.prototype.calculateSizeGlyph = function() CProduct.prototype.calculateSizeGlyph = function()
{ {
//var betta = this.getTxtPrp().FontSize/36; //var betta = this.getTxtPrp().FontSize/36;
var betta = this.getPrpToControlLetter().FontSize/36; var betta = this.getCtrPrp().FontSize/36;
var _width = 10.312548828125*betta, var _width = 10.312548828125*betta,
_height = 11.994444444444444*betta; _height = 11.994444444444444*betta;
...@@ -937,7 +927,7 @@ CUnion.prototype.getCoord = function() ...@@ -937,7 +927,7 @@ CUnion.prototype.getCoord = function()
CUnion.prototype.calculateSizeGlyph = function() CUnion.prototype.calculateSizeGlyph = function()
{ {
//var betta = this.getTxtPrp().FontSize/36; //var betta = this.getTxtPrp().FontSize/36;
var betta = this.getPrpToControlLetter().FontSize/36; var betta = this.getCtrPrp().FontSize/36;
this.gap = 0.93*betta; this.gap = 0.93*betta;
var _width = 9.38*betta, var _width = 9.38*betta,
...@@ -1056,7 +1046,7 @@ CLogicalOr.prototype.getCoord = function() ...@@ -1056,7 +1046,7 @@ CLogicalOr.prototype.getCoord = function()
X[7] = 0; Y[7] = 0; X[7] = 0; Y[7] = 0;
//var textScale = this.getTxtPrp().FontSize/850, // 1000 pt //var textScale = this.getTxtPrp().FontSize/850, // 1000 pt
var textScale = this.getPrpToControlLetter().FontSize/850, // 1000 pt var textScale = this.getCtrPrp().FontSize/850, // 1000 pt
alpha = textScale*25.4/96 /64; alpha = textScale*25.4/96 /64;
var w1 = X[1], var w1 = X[1],
...@@ -1088,7 +1078,7 @@ CLogicalOr.prototype.getCoord = function() ...@@ -1088,7 +1078,7 @@ CLogicalOr.prototype.getCoord = function()
CLogicalOr.prototype.calculateSizeGlyph = function() CLogicalOr.prototype.calculateSizeGlyph = function()
{ {
//var betta = this.getTxtPrp().FontSize/36; //var betta = this.getTxtPrp().FontSize/36;
var betta = this.getPrpToControlLetter().FontSize/36; var betta = this.getCtrPrp().FontSize/36;
var _width = 9.6159*betta, var _width = 9.6159*betta,
_height = 11.994444444444444*betta; _height = 11.994444444444444*betta;
...@@ -1318,7 +1308,7 @@ CIntegral.prototype.old_drawPath = function(XX, YY) ...@@ -1318,7 +1308,7 @@ CIntegral.prototype.old_drawPath = function(XX, YY)
CIntegral.prototype.calculateSizeGlyph = function() CIntegral.prototype.calculateSizeGlyph = function()
{ {
//var betta = this.getTxtPrp().FontSize/36; //var betta = this.getTxtPrp().FontSize/36;
var betta = this.getPrpToControlLetter().FontSize/36; var betta = this.getCtrPrp().FontSize/36;
var _width = 8.624*betta, var _width = 8.624*betta,
_height = 13.7*betta; _height = 13.7*betta;
...@@ -1359,7 +1349,7 @@ CDoubleIntegral.prototype.drawPath = function(pGraphics, XX, YY) ...@@ -1359,7 +1349,7 @@ CDoubleIntegral.prototype.drawPath = function(pGraphics, XX, YY)
CDoubleIntegral.prototype.calculateSizeGlyph = function() CDoubleIntegral.prototype.calculateSizeGlyph = function()
{ {
//var betta = this.getTxtPrp().FontSize/36; //var betta = this.getTxtPrp().FontSize/36;
var betta = this.getPrpToControlLetter().FontSize/36; var betta = this.getCtrPrp().FontSize/36;
var _width = 14.2296*betta, var _width = 14.2296*betta,
_height = 13.7*betta; _height = 13.7*betta;
...@@ -1410,7 +1400,7 @@ CTripleIntegral.prototype.drawPath = function(pGraphics, XX, YY) ...@@ -1410,7 +1400,7 @@ CTripleIntegral.prototype.drawPath = function(pGraphics, XX, YY)
CTripleIntegral.prototype.calculateSizeGlyph = function() CTripleIntegral.prototype.calculateSizeGlyph = function()
{ {
//var betta = this.getTxtPrp().FontSize/36; //var betta = this.getTxtPrp().FontSize/36;
var betta = this.getPrpToControlLetter().FontSize/36; var betta = this.getCtrPrp().FontSize/36;
var _width = 18.925368*betta, var _width = 18.925368*betta,
_height = 13.7*betta; _height = 13.7*betta;
...@@ -2852,7 +2842,7 @@ CContourIntegral.prototype.draw = function(pGraphics) ...@@ -2852,7 +2842,7 @@ CContourIntegral.prototype.draw = function(pGraphics)
HH = coord2.H; HH = coord2.H;
//var textScale = this.getTxtPrp().FontSize/850;// 1000 pt //var textScale = this.getTxtPrp().FontSize/850;// 1000 pt
var textScale = this.getPrpToControlLetter().FontSize/850;// 1000 pt var textScale = this.getCtrPrp().FontSize/850;// 1000 pt
var alpha = textScale*25.4/96 /64; // коэффициент; используется для того чтобы перевести координаты в миллиметры var alpha = textScale*25.4/96 /64; // коэффициент; используется для того чтобы перевести координаты в миллиметры
var shX = (WW - W)*alpha/2, var shX = (WW - W)*alpha/2,
...@@ -2897,7 +2887,7 @@ CContourIntegral.prototype.draw = function(pGraphics) ...@@ -2897,7 +2887,7 @@ CContourIntegral.prototype.draw = function(pGraphics)
CContourIntegral.prototype.calculateSizeGlyph = function() CContourIntegral.prototype.calculateSizeGlyph = function()
{ {
//var betta = this.getTxtPrp().FontSize/36; //var betta = this.getTxtPrp().FontSize/36;
var betta = this.getPrpToControlLetter().FontSize/36; var betta = this.getCtrPrp().FontSize/36;
var _width = 8.624*betta, var _width = 8.624*betta,
_height = 13.7*betta; _height = 13.7*betta;
...@@ -3357,7 +3347,7 @@ CSurfaceIntegral.prototype.draw = function(pGraphics) ...@@ -3357,7 +3347,7 @@ CSurfaceIntegral.prototype.draw = function(pGraphics)
//var textScale = this.getTxtPrp().FontSize/850; // 1000 pt //var textScale = this.getTxtPrp().FontSize/850; // 1000 pt
var textScale = this.getPrpToControlLetter().FontSize/850; // 1000 pt var textScale = this.getCtrPrp().FontSize/850; // 1000 pt
var alpha = textScale*25.4/96 /64; // коэффициент; используется для того чтобы перевести координаты в миллиметры var alpha = textScale*25.4/96 /64; // коэффициент; используется для того чтобы перевести координаты в миллиметры
...@@ -3404,7 +3394,7 @@ CSurfaceIntegral.prototype.draw = function(pGraphics) ...@@ -3404,7 +3394,7 @@ CSurfaceIntegral.prototype.draw = function(pGraphics)
CSurfaceIntegral.prototype.calculateSizeGlyph = function() CSurfaceIntegral.prototype.calculateSizeGlyph = function()
{ {
//var betta = this.getTxtPrp().FontSize/36; //var betta = this.getTxtPrp().FontSize/36;
var betta = this.getPrpToControlLetter().FontSize/36; var betta = this.getCtrPrp().FontSize/36;
var _width = 14.2296*betta, var _width = 14.2296*betta,
_height = 13.7*betta; _height = 13.7*betta;
...@@ -3933,7 +3923,7 @@ CVolumeIntegral.prototype.draw = function(pGraphics) ...@@ -3933,7 +3923,7 @@ CVolumeIntegral.prototype.draw = function(pGraphics)
HH = coord2.H; HH = coord2.H;
var textScale = this.getPrpToControlLetter().FontSize/850; // 1000 pt var textScale = this.getCtrPrp().FontSize/850; // 1000 pt
var alpha = textScale*25.4/96 /64; // коэффициент; используется для того чтобы перевести координаты в миллиметры var alpha = textScale*25.4/96 /64; // коэффициент; используется для того чтобы перевести координаты в миллиметры
...@@ -3980,7 +3970,7 @@ CVolumeIntegral.prototype.draw = function(pGraphics) ...@@ -3980,7 +3970,7 @@ CVolumeIntegral.prototype.draw = function(pGraphics)
CVolumeIntegral.prototype.calculateSizeGlyph = function() CVolumeIntegral.prototype.calculateSizeGlyph = function()
{ {
//var betta = this.getTxtPrp().FontSize/36; //var betta = this.getTxtPrp().FontSize/36;
var betta = this.getPrpToControlLetter().FontSize/36; var betta = this.getCtrPrp().FontSize/36;
var _width = 18.925368*betta, var _width = 18.925368*betta,
_height = 13.7*betta; _height = 13.7*betta;
......
...@@ -16,11 +16,6 @@ function CGlyphOperator() ...@@ -16,11 +16,6 @@ function CGlyphOperator()
this.measure = 0; this.measure = 0;
this.penW = 1; // px this.penW = 1; // px
this.TxtPrp = new CTextPr();
//this.TxtPrp = new CMathTextPrp();
//this.bGlyph = true;
} }
CGlyphOperator.prototype.init = function(props) CGlyphOperator.prototype.init = function(props)
{ {
...@@ -317,17 +312,13 @@ CGlyphOperator.prototype.draw = function(pGraphics, XX, YY) ...@@ -317,17 +312,13 @@ CGlyphOperator.prototype.draw = function(pGraphics, XX, YY)
pGraphics.df(); pGraphics.df();
pGraphics.SetIntegerGrid(intGrid); pGraphics.SetIntegerGrid(intGrid);
} }
/*CGlyphOperator.prototype.getTxtPrp = function() CGlyphOperator.prototype.getCtrPrp = function()
{
return this.TxtPrp;
}*/
CGlyphOperator.prototype.setTxtPrp = function(txtPrp)
{ {
this.TxtPrp.Merge(txtPrp); return this.Parent.getCtrPrp();
} }
CGlyphOperator.prototype.getPrpToControlLetter = function() CGlyphOperator.prototype.relate = function(parent)
{ {
return this.TxtPrp; this.Parent = parent;
} }
function old_CGlyphOperator() function old_CGlyphOperator()
...@@ -1383,8 +1374,7 @@ function COperatorBracket() ...@@ -1383,8 +1374,7 @@ function COperatorBracket()
extend(COperatorBracket, CGlyphOperator); extend(COperatorBracket, CGlyphOperator);
COperatorBracket.prototype.calcSize = function( measure ) COperatorBracket.prototype.calcSize = function( measure )
{ {
//var betta = this.getTxtPrp().FontSize/36; var betta = this.getCtrPrp().FontSize/36;
var betta = this.getPrpToControlLetter().FontSize/36;
// перевернутая скобка // перевернутая скобка
var minBoxH = 4.917529296874999 *betta, //width of 0x28 var minBoxH = 4.917529296874999 *betta, //width of 0x28
...@@ -1471,8 +1461,7 @@ COperatorBracket.prototype.calcCoord = function(measure) ...@@ -1471,8 +1461,7 @@ COperatorBracket.prototype.calcCoord = function(measure)
//TODO //TODO
// X[1] > X[52] // X[1] > X[52]
//var textScale = this.getTxtPrp().FontSize/1000; // 1000 pt var textScale = this.getCtrPrp().FontSize/1000; // 1000 pt
var textScale = this.getPrpToControlLetter().FontSize/1000; // 1000 pt
var alpha = textScale*25.4/96 /64; // коэффициент используется для того, чтобы перевести координаты в миллиметры var alpha = textScale*25.4/96 /64; // коэффициент используется для того, чтобы перевести координаты в миллиметры
var augm = measure/((X[52] + (X[0] - X[1])/2 + X[1] - X[52])*alpha*2); var augm = measure/((X[52] + (X[0] - X[1])/2 + X[1] - X[52])*alpha*2);
...@@ -1902,8 +1891,7 @@ function COperatorParenthesis() ...@@ -1902,8 +1891,7 @@ function COperatorParenthesis()
extend(COperatorParenthesis, CGlyphOperator); extend(COperatorParenthesis, CGlyphOperator);
COperatorParenthesis.prototype.calcSize = function(measure) COperatorParenthesis.prototype.calcSize = function(measure)
{ {
//var betta = this.getTxtPrp().FontSize/36; var betta = this.getCtrPrp().FontSize/36;
var betta = this.getPrpToControlLetter().FontSize/36;
var maxBoxH = 9.63041992187 *betta, //9.63 width of 0x239D var maxBoxH = 9.63041992187 *betta, //9.63 width of 0x239D
minBoxH = 5.27099609375 *betta, //width of 0x28 minBoxH = 5.27099609375 *betta, //width of 0x28
...@@ -1935,8 +1923,7 @@ COperatorParenthesis.prototype.calcCoord = function(measure) ...@@ -1935,8 +1923,7 @@ COperatorParenthesis.prototype.calcCoord = function(measure)
X[8] = 24398; Y[8] = 26227; X[8] = 24398; Y[8] = 26227;
X[9] = 39470; Y[9] = 26227; X[9] = 39470; Y[9] = 26227;
//var textScale = this.getTxtPrp().FontSize/1000; // 1000 pt var textScale = this.getCtrPrp().FontSize/1000; // 1000 pt
var textScale = this.getPrpToControlLetter().FontSize/1000; // 1000 pt
var alpha = textScale*25.4/96 /64; // коэффициент используется для того, чтобы перевести координаты в миллиметры var alpha = textScale*25.4/96 /64; // коэффициент используется для того, чтобы перевести координаты в миллиметры
var aug = measure/(X[9]*alpha)/2; //Y[9]*alpha - высота скобки var aug = measure/(X[9]*alpha)/2; //Y[9]*alpha - высота скобки
...@@ -2315,8 +2302,7 @@ COperatorAngleBracket.prototype.calcSize = function(measure) ...@@ -2315,8 +2302,7 @@ COperatorAngleBracket.prototype.calcSize = function(measure)
{ {
//скобка перевернутая //скобка перевернутая
//var betta = this.getTxtPrp().FontSize/36; var betta = this.getCtrPrp().FontSize/36;
var betta = this.getPrpToControlLetter().FontSize/36;
var widthBr = 11.994444444444444*betta; var widthBr = 11.994444444444444*betta;
if( measure/widthBr > 3.768 ) if( measure/widthBr > 3.768 )
...@@ -2340,8 +2326,7 @@ COperatorAngleBracket.prototype.calcCoord = function(measure) ...@@ -2340,8 +2326,7 @@ COperatorAngleBracket.prototype.calcCoord = function(measure)
X[6] = 76439; Y[6] = 21036; X[6] = 76439; Y[6] = 21036;
X[7] = 38990; Y[7] = 7665; X[7] = 38990; Y[7] = 7665;
//var textScale = this.getTxtPrp().FontSize/1000; // 1000 pt var textScale = this.getCtrPrp().FontSize/1000; // 1000 pt
var textScale = this.getPrpToControlLetter().FontSize/1000; // 1000 pt
var alpha = textScale*25.4/96 /64; // коэффициент используется для того, чтобы перевести координаты в миллиметры var alpha = textScale*25.4/96 /64; // коэффициент используется для того, чтобы перевести координаты в миллиметры
var augm = measure/(X[5]*alpha); var augm = measure/(X[5]*alpha);
...@@ -2438,8 +2423,7 @@ CSquareBracket.prototype.calcCoord = function(measure) ...@@ -2438,8 +2423,7 @@ CSquareBracket.prototype.calcCoord = function(measure)
X[7] = 76224; Y[7] = 6912; X[7] = 76224; Y[7] = 6912;
X[8] = 3200; Y[8] = 6912; X[8] = 3200; Y[8] = 6912;
//var textScale = this.getTxtPrp().FontSize/1000; // 1000 pt var textScale = this.getCtrPrp().FontSize/1000; // 1000 pt
var textScale = this.getPrpToControlLetter().FontSize/1000; // 1000 pt
var alpha = textScale*25.4/96 /64; // коэффициент используется для того, чтобы перевести координаты в миллиметры var alpha = textScale*25.4/96 /64; // коэффициент используется для того, чтобы перевести координаты в миллиметры
var lng = measure/alpha - X[4] - 2*X[0]; var lng = measure/alpha - X[4] - 2*X[0];
...@@ -2481,8 +2465,7 @@ CSquareBracket.prototype.drawPath = function(pGraphics, XX, YY) ...@@ -2481,8 +2465,7 @@ CSquareBracket.prototype.drawPath = function(pGraphics, XX, YY)
} }
CSquareBracket.prototype.calcSize = function() CSquareBracket.prototype.calcSize = function()
{ {
//var betta = this.getTxtPrp().FontSize/36; var betta = this.getCtrPrp().FontSize/36;
var betta = this.getPrpToControlLetter().FontSize/36;
var height = 4.446240234375*betta; var height = 4.446240234375*betta;
//var width = 12.0*this.betta; //var width = 12.0*this.betta;
...@@ -2509,8 +2492,7 @@ CHalfSquareBracket.prototype.calcCoord = function(measure) ...@@ -2509,8 +2492,7 @@ CHalfSquareBracket.prototype.calcCoord = function(measure)
X[5] = 77522; Y[5] = 0; X[5] = 77522; Y[5] = 0;
X[6] = 0; Y[6] = 0; X[6] = 0; Y[6] = 0;
//var textScale = this.getTxtPrp().FontSize/1000; // 1000 pt var textScale = this.getCtrPrp().FontSize/1000; // 1000 pt
var textScale = this.getPrpToControlLetter().FontSize/1000; // 1000 pt
var alpha = textScale*25.4/96 /64; // коэффициент используется для того, чтобы перевести координаты в миллиметры var alpha = textScale*25.4/96 /64; // коэффициент используется для того, чтобы перевести координаты в миллиметры
var w1 = X[4], var w1 = X[4],
...@@ -2541,8 +2523,7 @@ CHalfSquareBracket.prototype.calcCoord = function(measure) ...@@ -2541,8 +2523,7 @@ CHalfSquareBracket.prototype.calcCoord = function(measure)
} }
CHalfSquareBracket.prototype.calcSize = function() CHalfSquareBracket.prototype.calcSize = function()
{ {
//var betta = this.getTxtPrp().FontSize/36; var betta = this.getCtrPrp().FontSize/36;
var betta = this.getPrpToControlLetter().FontSize/36;
var height = 4.446240234375*betta; var height = 4.446240234375*betta;
var width = 11.99444444444*betta; var width = 11.99444444444*betta;
...@@ -2634,8 +2615,7 @@ COperatorLine.prototype.setContent = function() ...@@ -2634,8 +2615,7 @@ COperatorLine.prototype.setContent = function()
} }
COperatorLine.prototype.calcSize = function() COperatorLine.prototype.calcSize = function()
{ {
//var betta = this.getTxtPrp().FontSize/36; var betta = this.getCtrPrp().FontSize/36;
var betta = this.getPrpToControlLetter().FontSize/36;
var height = 4.018359374999999*betta; var height = 4.018359374999999*betta;
var width = 11.99444444444*betta; var width = 11.99444444444*betta;
...@@ -2653,8 +2633,7 @@ COperatorLine.prototype.calcCoord = function(measure) ...@@ -2653,8 +2633,7 @@ COperatorLine.prototype.calcCoord = function(measure)
X[3] = 77504; Y[3] = 0; X[3] = 77504; Y[3] = 0;
X[4] = 0; Y[4] = 0; X[4] = 0; Y[4] = 0;
//var textScale = this.getTxtPrp().FontSize/1000; // 1000 pt var textScale = this.getCtrPrp().FontSize/1000; // 1000 pt
var textScale = this.getPrpToControlLetter().FontSize/1000; // 1000 pt
var alpha = textScale*25.4/96 /64; // коэффициент используется для того, чтобы перевести координаты в миллиметры var alpha = textScale*25.4/96 /64; // коэффициент используется для того, чтобы перевести координаты в миллиметры
var XX = new Array(), var XX = new Array(),
...@@ -2699,8 +2678,7 @@ function CWhiteSquareBracket() ...@@ -2699,8 +2678,7 @@ function CWhiteSquareBracket()
extend(CWhiteSquareBracket, CGlyphOperator); extend(CWhiteSquareBracket, CGlyphOperator);
CWhiteSquareBracket.prototype.calcSize = function() CWhiteSquareBracket.prototype.calcSize = function()
{ {
//var betta = this.getTxtPrp().FontSize/36; var betta = this.getCtrPrp().FontSize/36;
var betta = this.getPrpToControlLetter().FontSize/36;
var height = 5.5872558593749995*betta; var height = 5.5872558593749995*betta;
var width = 11.99444444444*betta; var width = 11.99444444444*betta;
...@@ -2743,8 +2721,7 @@ CWhiteSquareBracket.prototype.calcCoord = function(measure) ...@@ -2743,8 +2721,7 @@ CWhiteSquareBracket.prototype.calcCoord = function(measure)
X[12] = 74304; Y[12] = 4600; X[12] = 74304; Y[12] = 4600;
X[13] = 74304; Y[13] = 12700; X[13] = 74304; Y[13] = 12700;
//var textScale = this.getTxtPrp().FontSize/1000; // 1000 pt var textScale = this.getCtrPrp().FontSize/1000; // 1000 pt
var textScale = this.getPrpToControlLetter().FontSize/1000; // 1000 pt
var alpha = textScale*25.4/96 /64; // коэффициент используется для того, чтобы перевести координаты в миллиметры var alpha = textScale*25.4/96 /64; // коэффициент используется для того, чтобы перевести координаты в миллиметры
var XX = new Array(), var XX = new Array(),
...@@ -2800,8 +2777,7 @@ function COperatorDoubleLine() ...@@ -2800,8 +2777,7 @@ function COperatorDoubleLine()
extend(COperatorDoubleLine, CGlyphOperator); extend(COperatorDoubleLine, CGlyphOperator);
COperatorDoubleLine.prototype.calcSize = function() COperatorDoubleLine.prototype.calcSize = function()
{ {
//var betta = this.getTxtPrp().FontSize/36; var betta = this.getCtrPrp().FontSize/36;
var betta = this.getPrpToControlLetter().FontSize/36;
var height = 6.715869140624999*betta, var height = 6.715869140624999*betta,
width = 11.99444444444*betta; width = 11.99444444444*betta;
...@@ -2827,8 +2803,7 @@ COperatorDoubleLine.prototype.calcCoord = function(measure) ...@@ -2827,8 +2803,7 @@ COperatorDoubleLine.prototype.calcCoord = function(measure)
X[8] = 77504; Y[8] = 18112; X[8] = 77504; Y[8] = 18112;
X[9] = 0; Y[9] = 18112; X[9] = 0; Y[9] = 18112;
//var textScale = this.getTxtPrp().FontSize/1000; // 1000 pt var textScale = this.getCtrPrp().FontSize/1000; // 1000 pt
var textScale = this.getPrpToControlLetter().FontSize/1000; // 1000 pt
var alpha = textScale*25.4/96 /64; // коэффициент используется для того, чтобы перевести координаты в миллиметры var alpha = textScale*25.4/96 /64; // коэффициент используется для того, чтобы перевести координаты в миллиметры
var XX = new Array(), var XX = new Array(),
...@@ -2960,8 +2935,7 @@ function CSingleArrow() ...@@ -2960,8 +2935,7 @@ function CSingleArrow()
extend(CSingleArrow, CGlyphOperator); extend(CSingleArrow, CGlyphOperator);
CSingleArrow.prototype.calcSize = function() CSingleArrow.prototype.calcSize = function()
{ {
//var betta = this.getTxtPrp().FontSize/36; var betta = this.getCtrPrp().FontSize/36;
var betta = this.getPrpToControlLetter().FontSize/36;
var height = 5.946923828125*betta; var height = 5.946923828125*betta;
var width = 10.641210937499999*betta; var width = 10.641210937499999*betta;
...@@ -2984,8 +2958,7 @@ CSingleArrow.prototype.calcCoord = function(measure) ...@@ -2984,8 +2958,7 @@ CSingleArrow.prototype.calcCoord = function(measure)
X[9] = 56138; Y[9] = 17625; X[9] = 56138; Y[9] = 17625;
X[10] = 56138; Y[10] = 12300; X[10] = 56138; Y[10] = 12300;
//var textScale = this.getTxtPrp().FontSize/1000; // 1000 pt var textScale = this.getCtrPrp().FontSize/1000; // 1000 pt
var textScale = this.getPrpToControlLetter().FontSize/1000; // 1000 pt
var alpha = textScale*25.4/96 /64; // коэффициент используется для того, чтобы перевести координаты в миллиметры var alpha = textScale*25.4/96 /64; // коэффициент используется для того, чтобы перевести координаты в миллиметры
var XX = new Array(), var XX = new Array(),
...@@ -3026,17 +2999,6 @@ CSingleArrow.prototype.drawPath = function(pGraphics, XX, YY) ...@@ -3026,17 +2999,6 @@ CSingleArrow.prototype.drawPath = function(pGraphics, XX, YY)
pGraphics._l(XX[9], YY[9]); pGraphics._l(XX[9], YY[9]);
pGraphics._l(XX[10], YY[10]); pGraphics._l(XX[10], YY[10]);
} }
/*CSingleArrow.prototype.getSizeGlyph = function()
{
var textScale = this.getTxtPrp().FontSize/1000; // 1000 pt
var alpha = textScale*25.4/96 /64;
var width = 62360*alpha; // X[9]
var height = 33242*alpha; // Y[6]
var center = 14944*alpha; // (Y[5] + Y[4])/2
return {width : width, height : height, center : center};
}*/
function CLeftRightArrow() function CLeftRightArrow()
{ {
...@@ -3046,8 +3008,7 @@ function CLeftRightArrow() ...@@ -3046,8 +3008,7 @@ function CLeftRightArrow()
extend(CLeftRightArrow, CGlyphOperator); extend(CLeftRightArrow, CGlyphOperator);
CLeftRightArrow.prototype.calcSize = function() CLeftRightArrow.prototype.calcSize = function()
{ {
//var betta = this.getTxtPrp().FontSize/36; var betta = this.getCtrPrp().FontSize/36;
var betta = this.getPrpToControlLetter().FontSize/36;
var height = 5.946923828125*betta; var height = 5.946923828125*betta;
var width = 11.695410156249999*betta; var width = 11.695410156249999*betta;
...@@ -3077,8 +3038,7 @@ CLeftRightArrow.prototype.calcCoord = function(measure) ...@@ -3077,8 +3038,7 @@ CLeftRightArrow.prototype.calcCoord = function(measure)
X[15] = 8363; Y[15] = 17962; X[15] = 8363; Y[15] = 17962;
X[16] = 16950; Y[16] = 28912; X[16] = 16950; Y[16] = 28912;
//var textScale = this.getTxtPrp().FontSize/1000; // 1000 pt var textScale = this.getCtrPrp().FontSize/1000; // 1000 pt
var textScale = this.getPrpToControlLetter().FontSize/1000; // 1000 pt
var alpha = textScale*25.4/96 /64; // коэффициент используется для того, чтобы перевести координаты в миллиметры var alpha = textScale*25.4/96 /64; // коэффициент используется для того, чтобы перевести координаты в миллиметры
var XX = new Array(), var XX = new Array(),
...@@ -3125,17 +3085,6 @@ CLeftRightArrow.prototype.drawPath = function(pGraphics, XX, YY) ...@@ -3125,17 +3085,6 @@ CLeftRightArrow.prototype.drawPath = function(pGraphics, XX, YY)
pGraphics._l(XX[16], YY[16]); pGraphics._l(XX[16], YY[16]);
} }
/*CLeftRightArrow.prototype.getSizeGlyph = function()
{
var textScale = this.getTxtPrp().FontSize/1000; // 1000 pt
var alpha = textScale*25.4/96 /64;
var width = 62100*alpha; // X[9]
var height = 30975*alpha; // Y[6]
var center = 15487*alpha; // (Y[11] + Y[10])/2
return {width : width, height : height, center : center};
}*/
function CDoubleArrow() function CDoubleArrow()
{ {
...@@ -3145,8 +3094,7 @@ function CDoubleArrow() ...@@ -3145,8 +3094,7 @@ function CDoubleArrow()
extend(CDoubleArrow, CGlyphOperator); extend(CDoubleArrow, CGlyphOperator);
CDoubleArrow.prototype.calcSize = function() CDoubleArrow.prototype.calcSize = function()
{ {
//var betta = this.getTxtPrp().FontSize/36; var betta = this.getCtrPrp().FontSize/36;
var betta = this.getPrpToControlLetter().FontSize/36;
var height = 6.7027777777777775*betta; var height = 6.7027777777777775*betta;
var width = 10.994677734375*betta; var width = 10.994677734375*betta;
...@@ -3178,8 +3126,7 @@ CDoubleArrow.prototype.calcCoord = function(measure) ...@@ -3178,8 +3126,7 @@ CDoubleArrow.prototype.calcCoord = function(measure)
X[16] = 58950; Y[16] = 19495; X[16] = 58950; Y[16] = 19495;
X[17] = 58950; Y[17] = 19495; X[17] = 58950; Y[17] = 19495;
//var textScale = this.getTxtPrp().FontSize/1000; // 1000 pt var textScale = this.getCtrPrp().FontSize/1000; // 1000 pt
var textScale = this.getPrpToControlLetter().FontSize/1000; // 1000 pt
var alpha = textScale*25.4/96 /64; // коэффициент используется для того, чтобы перевести координаты в миллиметры var alpha = textScale*25.4/96 /64; // коэффициент используется для того, чтобы перевести координаты в миллиметры
var XX = new Array(), var XX = new Array(),
...@@ -3234,17 +3181,6 @@ CDoubleArrow.prototype.drawPath = function(pGraphics, XX, YY) ...@@ -3234,17 +3181,6 @@ CDoubleArrow.prototype.drawPath = function(pGraphics, XX, YY)
pGraphics._m(XX[16], YY[16]); pGraphics._m(XX[16], YY[16]);
pGraphics._l(XX[17], YY[17]); pGraphics._l(XX[17], YY[17]);
} }
/*CDoubleArrow.prototype.getSizeGlyph = function()
{
var textScale = this.getTxtPrp().FontSize/1000; // 1000 pt
var alpha = textScale*25.4/96 /64;
var width = 58950*alpha;
var height = 39064*alpha;
var center = 19532.5*alpha;
return {width : width, height : height, center : center}
}*/
function CLR_DoubleArrow() function CLR_DoubleArrow()
{ {
...@@ -3254,8 +3190,7 @@ function CLR_DoubleArrow() ...@@ -3254,8 +3190,7 @@ function CLR_DoubleArrow()
extend(CLR_DoubleArrow, CGlyphOperator); extend(CLR_DoubleArrow, CGlyphOperator);
CLR_DoubleArrow.prototype.calcSize = function() CLR_DoubleArrow.prototype.calcSize = function()
{ {
//var betta = this.getTxtPrp().FontSize/36; var betta = this.getCtrPrp().FontSize/36;
var betta = this.getPrpToControlLetter().FontSize/36;
var height = 6.7027777777777775*betta; var height = 6.7027777777777775*betta;
var width = 13.146484375*betta; var width = 13.146484375*betta;
...@@ -3293,8 +3228,7 @@ CLR_DoubleArrow.prototype.calcCoord = function(measure) ...@@ -3293,8 +3228,7 @@ CLR_DoubleArrow.prototype.calcCoord = function(measure)
X[22] = 59925; Y[22] = 14213; X[22] = 59925; Y[22] = 14213;
X[23] = 59925; Y[23] = 14213; X[23] = 59925; Y[23] = 14213;
//var textScale = this.getTxtPrp().FontSize/1000; // 1000 pt var textScale = this.getCtrPrp().FontSize/1000; // 1000 pt
var textScale = this.getPrpToControlLetter().FontSize/1000; // 1000 pt
var alpha = textScale*25.4/96 /64; var alpha = textScale*25.4/96 /64;
var XX = new Array(), var XX = new Array(),
...@@ -3435,8 +3369,7 @@ function CCombiningArrow() ...@@ -3435,8 +3369,7 @@ function CCombiningArrow()
extend(CCombiningArrow, CGlyphOperator); extend(CCombiningArrow, CGlyphOperator);
CCombiningArrow.prototype.calcSize = function() CCombiningArrow.prototype.calcSize = function()
{ {
//var betta = this.getTxtPrp().FontSize/36; var betta = this.getCtrPrp().FontSize/36;
var betta = this.getPrpToControlLetter().FontSize/36;
var height = 3.88*betta; var height = 3.88*betta;
var width = 4.938*betta; var width = 4.938*betta;
...@@ -3465,8 +3398,7 @@ CCombiningArrow.prototype.calcCoord = function(measure) ...@@ -3465,8 +3398,7 @@ CCombiningArrow.prototype.calcCoord = function(measure)
X[9] = 0; Y[9] = 10312; X[9] = 0; Y[9] = 10312;
X[10] = 0; Y[10] = 8137; X[10] = 0; Y[10] = 8137;
//var textScale = this.getTxtPrp().FontSize/1000; // 1000 pt var textScale = this.getCtrPrp().FontSize/1000; // 1000 pt
var textScale = this.getPrpToControlLetter().FontSize/1000; // 1000 pt
var alpha = textScale*25.4/96 /64; // коэффициент используется для того, чтобы перевести координаты в миллиметры var alpha = textScale*25.4/96 /64; // коэффициент используется для того, чтобы перевести координаты в миллиметры
var XX = new Array(), var XX = new Array(),
...@@ -3507,7 +3439,7 @@ function CCombiningHalfArrow() ...@@ -3507,7 +3439,7 @@ function CCombiningHalfArrow()
extend(CCombiningHalfArrow, CGlyphOperator); extend(CCombiningHalfArrow, CGlyphOperator);
CCombiningHalfArrow.prototype.calcSize = function() CCombiningHalfArrow.prototype.calcSize = function()
{ {
var betta = this.getPrpToControlLetter().FontSize/36; var betta = this.getCtrPrp().FontSize/36;
// 0x21BC half, down // 0x21BC half, down
...@@ -3546,7 +3478,7 @@ CCombiningHalfArrow.prototype.calcCoord = function(measure) ...@@ -3546,7 +3478,7 @@ CCombiningHalfArrow.prototype.calcCoord = function(measure)
X[6] = 0; Y[6] = 10987; X[6] = 0; Y[6] = 10987;
X[7] = 0; Y[7] = 8137; X[7] = 0; Y[7] = 8137;
var textScale = this.getPrpToControlLetter().FontSize/1000; // 1000 pt var textScale = this.getCtrPrp().FontSize/1000; // 1000 pt
var alpha = textScale*25.4/96 /64; // коэффициент используется для того, чтобы перевести координаты в миллиметры var alpha = textScale*25.4/96 /64; // коэффициент используется для того, чтобы перевести координаты в миллиметры
var XX = new Array(), var XX = new Array(),
...@@ -3573,7 +3505,7 @@ function CCombining_LR_Arrow() ...@@ -3573,7 +3505,7 @@ function CCombining_LR_Arrow()
extend(CCombining_LR_Arrow, CGlyphOperator); extend(CCombining_LR_Arrow, CGlyphOperator);
CCombining_LR_Arrow.prototype.calcSize = function() CCombining_LR_Arrow.prototype.calcSize = function()
{ {
var betta = this.getPrpToControlLetter().FontSize/36; var betta = this.getCtrPrp().FontSize/36;
var height = 3.88*betta; var height = 3.88*betta;
var width = 4.938*betta; var width = 4.938*betta;
...@@ -3624,7 +3556,7 @@ CCombining_LR_Arrow.prototype.calcCoord = function(measure) ...@@ -3624,7 +3556,7 @@ CCombining_LR_Arrow.prototype.calcCoord = function(measure)
X[15] = 0; Y[15] = 10312; X[15] = 0; Y[15] = 10312;
X[16] = 0; Y[16] = 8137; X[16] = 0; Y[16] = 8137;
var textScale = this.getPrpToControlLetter().FontSize/1000; // 1000 pt var textScale = this.getCtrPrp().FontSize/1000; // 1000 pt
var alpha = textScale*25.4/96 /64; // коэффициент используется для того, чтобы перевести координаты в миллиметры var alpha = textScale*25.4/96 /64; // коэффициент используется для того, чтобы перевести координаты в миллиметры
var XX = new Array(), var XX = new Array(),
...@@ -3802,7 +3734,7 @@ COperator.prototype.fixSize = function(measure) ...@@ -3802,7 +3734,7 @@ COperator.prototype.fixSize = function(measure)
//height = dims.Height > measure ? measure : dims.Height; //height = dims.Height > measure ? measure : dims.Height;
} }
var betta = this.TxtPrp.FontSize/36; var betta = this.getCtrPrp().FontSize;
var center = height/2 + 0.2*betta; var center = height/2 + 0.2*betta;
this.size = { width: width, height: height, center: center}; this.size = { width: width, height: height, center: center};
...@@ -3831,12 +3763,12 @@ COperator.prototype.Resize = function() ...@@ -3831,12 +3763,12 @@ COperator.prototype.Resize = function()
COperator.prototype.relate = function(parent) COperator.prototype.relate = function(parent)
{ {
this.Parent = parent; this.Parent = parent;
if(this.glyph !== -1)
this.glyph.relate(this);
} }
COperator.prototype.setTxtPrp = function(txtPrp) COperator.prototype.getCtrPrp = function()
{ {
this.TxtPrp = txtPrp; return this.Parent.getCtrPrp();
if(this.glyph !== -1)
this.glyph.setTxtPrp(txtPrp);
} }
function CSeparator(glyph) function CSeparator(glyph)
...@@ -3876,7 +3808,10 @@ function CDelimiter() ...@@ -3876,7 +3808,10 @@ function CDelimiter()
this.sepOper = new COperator (-1); this.sepOper = new COperator (-1);
this.shape = DELIMITER_SHAPE_CENTERED; this.shape = DELIMITER_SHAPE_CENTERED;
this.grow = true; this.grow = true;
//// special for "read" ////
this.column = 0; this.column = 0;
////
CSubMathBase.call(this); CSubMathBase.call(this);
} }
...@@ -3890,18 +3825,15 @@ CDelimiter.prototype.init = function(props) ...@@ -3890,18 +3825,15 @@ CDelimiter.prototype.init = function(props)
var begGlyph = this.getGlyph(props.begChr, props.begChrType, LOCATION_LEFT); var begGlyph = this.getGlyph(props.begChr, props.begChrType, LOCATION_LEFT);
this.begOper = new COperator (begGlyph); this.begOper = new COperator (begGlyph);
this.begOper.relate(this);
var endGlyph = this.getGlyph(props.endChr, props.endChrType, LOCATION_RIGHT); var endGlyph = this.getGlyph(props.endChr, props.endChrType, LOCATION_RIGHT);
this.endOper = new COperator (endGlyph); this.endOper = new COperator (endGlyph);
this.endOper.relate(this);
var sepGlyph = this.getGlyph(props.sepChr, props.sepChrType, LOCATION_SEP); var sepGlyph = this.getGlyph(props.sepChr, props.sepChrType, LOCATION_SEP);
this.sepOper = new CSeparator (sepGlyph); this.sepOper = new CSeparator (sepGlyph);
this.sepOper.relate(this);
//var tPrp = this.getTxtPrp();
var tPrp = this.getPrpToControlLetter();
this.begOper.setTxtPrp(tPrp);
this.sepOper.setTxtPrp(tPrp);
this.endOper.setTxtPrp(tPrp);
if(props.shape == DELIMITER_SHAPE_MATH || props.shp == DELIMITER_SHAPE_MATH) if(props.shape == DELIMITER_SHAPE_MATH || props.shp == DELIMITER_SHAPE_MATH)
this.shape = DELIMITER_SHAPE_MATH; this.shape = DELIMITER_SHAPE_MATH;
...@@ -3920,6 +3852,17 @@ CDelimiter.prototype.recalculateSize = function() ...@@ -3920,6 +3852,17 @@ CDelimiter.prototype.recalculateSize = function()
var ascent = 0, var ascent = 0,
descent = 0; descent = 0;
// временно
var FontSize = this.getCtrPrp().FontSize;
var Height = 0.4*FontSize; // g_oTextMeasurer.GetHeight()
var plH = 0.275*FontSize, // плейсхолдер
H2 = 0.08*FontSize; // временно baseLine
// временно
var div = 0;
if(this.shape == DELIMITER_SHAPE_CENTERED) if(this.shape == DELIMITER_SHAPE_CENTERED)
{ {
for(var j = 0; j < this.nCol; j++) for(var j = 0; j < this.nCol; j++)
...@@ -3930,9 +3873,29 @@ CDelimiter.prototype.recalculateSize = function() ...@@ -3930,9 +3873,29 @@ CDelimiter.prototype.recalculateSize = function()
descent = content.height - content.center > descent ? content.height - content.center: descent; descent = content.height - content.center > descent ? content.height - content.center: descent;
} }
height = ascent > descent ? 2*ascent : 2*descent; maxH = ascent > descent ? ascent : descent;
center = height/2;
// для случая, когда в контенте степень и пр. элементы где нужно учитовать baseLine
if(descent < plH || ascent < plH)
{
if(maxH < plH)
{
height = ascent + descent;
center = ascent;
}
else
{
div = ascent - plH;
height = ascent + descent + div;
center = ascent;
}
}
else
{
height = 2*maxH;
center = height/2;
}
} }
else else
{ {
...@@ -3953,24 +3916,29 @@ CDelimiter.prototype.recalculateSize = function() ...@@ -3953,24 +3916,29 @@ CDelimiter.prototype.recalculateSize = function()
if(height < this.begOper.size.height) if(height < this.begOper.size.height)
{ {
center = this.begOper.size.height - H2;
height = this.begOper.size.height; height = this.begOper.size.height;
center = this.begOper.size.center; //center = this.begOper.size.center;
} }
this.endOper.fixSize(height); this.endOper.fixSize(height);
width += this.endOper.size.width; width += this.endOper.size.width;
if(height < this.endOper.size.height) if(height < this.endOper.size.height)
{ {
//center += (height - this.endOper.size.height)/2;
center = this.endOper.size.height - H2;
height = this.endOper.size.height; height = this.endOper.size.height;
center = this.endOper.size.center; //center = this.endOper.size.center;
} }
this.sepOper.fixSize(height); this.sepOper.fixSize(height);
width += (this.nCol - 1)*this.sepOper.size.width; width += (this.nCol - 1)*this.sepOper.size.width;
if(height < this.endOper.size.height) if(height < this.endOper.size.height)
{ {
//center += (height - this.sepOper.size.height)/2;
height = this.sepOper.size.height; height = this.sepOper.size.height;
center = this.sepOper.size.center; //center = this.sepOper.size.center;
} }
...@@ -4369,109 +4337,8 @@ CDelimiter.prototype.getGlyph = function(chr, type, location) ...@@ -4369,109 +4337,8 @@ CDelimiter.prototype.getGlyph = function(chr, type, location)
return operator; return operator;
} }
CDelimiter.prototype.setTxtPrp = function(txtPrp)
{
this.begOper.setTxtPrp(txtPrp);
this.sepOper.setTxtPrp(txtPrp);
this.endOper.setTxtPrp(txtPrp);
CDelimiter.superclass.setTxtPrp.call(this, txtPrp);
}
/*function GetGlyph_GrChr(chr, location)
{
var operator;
if(typeof(chr) === "undefined" ||chr === null)
{
{
operator = new COperatorBracket();
var props =
{
location: LOCATION_BOT,
turn: TURN_MIRROR_0
};
operator.init(props);
}
}
else if(chr.value === "⏞" || chr.type == BRACKET_CURLY_TOP)
{
operator = new COperatorBracket();
var props =
{
location: location,
turn: TURN_0
};
operator.init(props);
}
else if(chr.value === "⏟" || chr.type === BRACKET_CURLY_BOTTOM )
{
operator = new COperatorBracket();
var props =
{
location: location,
turn: TURN_MIRROR_0
};
operator.init(props);
}
else if(chr.value === "⃖" || chr.type === ARROW_LEFT)
{
operator = new CSingleArrow();
var props =
{
location: location,
turn: TURN_0
};
operator.init(props);
}
else if(chr.value === "⃗" || chr.type === ARROW_RIGHT)
{
operator = new CSingleArrow();
var props =
{
location: location,
turn: TURN_180
};
operator.init(props);
}
else if(chr.value === "⃡" || chr.type === ARROW_LR)
{
operator = new CLeftRightArrow();
var props =
{
location: location,
turn: TURN_0
};
operator.init(props);
}
else if(chr.value === "⃐" || chr.type === HALF_ARROW_LEFT)
{
operator = new CCombiningHalfArrow();
var props =
{
location: location,
turn: TURN_0
};
operator.init(props);
}
else if(chr.value === "⃑" || chr.type === HALF_ARROW_RIGHT)
{
operator = new CCombiningHalfArrow();
var props =
{
location: location,
turn: TURN_180
};
operator.init(props);
}
else
{
operator = new CMathText();
operator.add(chr.value.charCodeAt(0));
}
return operator;
}*/
function old_CGroupCharacter() function old_CGroupCharacter()
{ {
this.operator = null; this.operator = null;
...@@ -4615,9 +4482,7 @@ extend(CCharacter, CSubMathBase); ...@@ -4615,9 +4482,7 @@ extend(CCharacter, CSubMathBase);
CCharacter.prototype.setOperator = function(operator) CCharacter.prototype.setOperator = function(operator)
{ {
this.operator = operator; this.operator = operator;
//var tPrp = this.getTxtPrp(); this.operator.relate(this);
//var tPrp = this.getPrpToControlLetter();
//this.operator.setTxtPrp(tPrp);
this.setDimension(1, 1); this.setDimension(1, 1);
this.setContent(); this.setContent();
...@@ -4626,7 +4491,7 @@ CCharacter.prototype.recalculateSize = function() ...@@ -4626,7 +4491,7 @@ CCharacter.prototype.recalculateSize = function()
{ {
var content = this.elements[0][0]; var content = this.elements[0][0];
var rPrp = this.getPrpToControlLetter(); var rPrp = this.getCtrPrp();
rPrp.Italic = false; rPrp.Italic = false;
g_oTextMeasurer.SetFont(rPrp); g_oTextMeasurer.SetFont(rPrp);
...@@ -4671,7 +4536,7 @@ CCharacter.prototype.draw = function(pGraphics) ...@@ -4671,7 +4536,7 @@ CCharacter.prototype.draw = function(pGraphics)
{ {
this.elements[0][0].draw(pGraphics); this.elements[0][0].draw(pGraphics);
var rPrp = this.getPrpToControlLetter(); var rPrp = this.getCtrPrp();
rPrp.Italic = false; rPrp.Italic = false;
pGraphics.SetFont(rPrp); pGraphics.SetFont(rPrp);
...@@ -4731,13 +4596,6 @@ CCharacter.prototype.getBase = function() ...@@ -4731,13 +4596,6 @@ CCharacter.prototype.getBase = function()
{ {
return this.elements[0][0]; return this.elements[0][0];
} }
CCharacter.prototype.setTxtPrp = function(txtPrp)
{
if(this.operator !== null && typeof(this.operator) !== "undefined")
this.operator.setTxtPrp(txtPrp);
CCharacter.superclass.setTxtPrp.call(this, txtPrp);
}
function CGroupCharacter() function CGroupCharacter()
...@@ -4768,7 +4626,7 @@ CGroupCharacter.prototype.init = function(props) ...@@ -4768,7 +4626,7 @@ CGroupCharacter.prototype.init = function(props)
if(glyph.bArrow) if(glyph.bArrow)
this.setReduct(DEGR_REDUCT); this.setReduct(DEGR_REDUCT);
this.setOperator( new COperator(glyph) ); this.setOperator(new COperator(glyph));
} }
CGroupCharacter.prototype.getCenter = function() CGroupCharacter.prototype.getCenter = function()
{ {
......
...@@ -9,7 +9,7 @@ function CSignRadical() ...@@ -9,7 +9,7 @@ function CSignRadical()
} }
CSignRadical.prototype.draw = function(pGraphics) CSignRadical.prototype.draw = function(pGraphics)
{ {
var txtPrp = this.Parent.getPrpToControlLetter(); var txtPrp = this.Parent.getCtrPrp();
//var txtPrp = this.Parent.getTxtPrp(); //var txtPrp = this.Parent.getTxtPrp();
var penW = txtPrp.FontSize*g_dKoef_pt_to_mm*0.042; var penW = txtPrp.FontSize*g_dKoef_pt_to_mm*0.042;
...@@ -80,7 +80,7 @@ CSignRadical.prototype.draw = function(pGraphics) ...@@ -80,7 +80,7 @@ CSignRadical.prototype.draw = function(pGraphics)
CSignRadical.prototype.recalculateSize = function() CSignRadical.prototype.recalculateSize = function()
{ {
//var txtPrp = this.Parent.getTxtPrp(); //var txtPrp = this.Parent.getTxtPrp();
var txtPrp = this.Parent.getPrpToControlLetter(); var txtPrp = this.Parent.getCtrPrp();
var sizeArg = this.Parent.getBase().size; var sizeArg = this.Parent.getBase().size;
var height, width; var height, width;
...@@ -223,7 +223,7 @@ CRadical.prototype.recalculateSize = function() ...@@ -223,7 +223,7 @@ CRadical.prototype.recalculateSize = function()
var width = degr.width - wTick + sign.width; var width = degr.width - wTick + sign.width;
var txtPrp = this.getPrpToControlLetter(); var txtPrp = this.getCtrPrp();
var plH = 9.877777777777776 * txtPrp.FontSize /36; var plH = 9.877777777777776 * txtPrp.FontSize /36;
if( sign.height < plH ) if( sign.height < plH )
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment