Commit 8b8d43cc authored by Anna.Pavlova's avatar Anna.Pavlova Committed by Alexander.Trofimov

1. Реализовала функцию Copy

2. Исправила getPropsForWrite : теперь свойства отдаются по формату (т.е. такие же, какие приходят на чтение)

git-svn-id: svn://192.168.3.15/activex/AVS/Sources/TeamlabOffice/trunk/OfficeWeb@56014 954022d7-b5bf-4e40-9824-e11837661b57
parent de43e4b2
......@@ -70,16 +70,16 @@ ParaMath.prototype =
var NewMath = new ParaMath();
/*if(Selected)
if(Selected)
{
var Content = this.GetSelectContent();
NewMath.Root = Content.Copy(Selected, NewMath);
var result = this.GetSelectContent();
NewMath.Root = result.Content.Copy(Selected, NewMath);
}
else
{
NewMath.Root = this.Root.Copy(Selected, NewMath);
}*/
}
/// argSize, bDot и bRoot выставить на объединении контентов
......
......@@ -1683,13 +1683,3 @@ CAccent.prototype.findDisposition = function(pos)
return {pos: posCurs, mCoord: mouseCoord, inside_flag: inside_flag};
}
CAccent.prototype.Copy = function(Selected, Composition)
{
var props = this.getPropsForWrite();
var NewAccent = new CAccent();
NewAccent.init(props);
this.Copy_2(Selected, Composition, NewAccent);
return NewAccent;
}
\ No newline at end of file
......@@ -1093,7 +1093,6 @@ CMathBase.prototype =
return content;
},
//// For Edit /////
selection_Start: function(x, y)
{
var elem = this.findDisposition({x: x, y: y});
......@@ -1552,8 +1551,14 @@ CMathBase.prototype =
{
return this.getCtrPrp();
},
Copy_2: function(Selected, Composition, NewObj)
Copy: function(Selected, Composition)
{
var props = this.getPropsForWrite();
var NewObj = new this.constructor();
NewObj.init(props);
NewObj.argSize = this.argSize;
NewObj.Composition = Composition;
var CtrPrp = this.CtrPrp.Copy();
......@@ -1563,13 +1568,12 @@ CMathBase.prototype =
for(var j = 0; j < this.nCol; j++)
{
NewObj.elements[i][j] = this.elements[i][j].Copy(Selected, Composition);
var argSize = this.elements[i][j].argSize;
NewObj.elements[i][j].setArgSize(argSize);
NewObj.elements[i][j].argSize = this.elements[i][j].argSize;
NewObj.elements[i][j].relate(NewObj);
}
return NewObj;
}
//////////////////////////
......
......@@ -456,6 +456,7 @@ CDegree.prototype.getBase = function()
CDegree.prototype.getPropsForWrite = function()
{
var props = {};
props.type = this.type;
props.alnScr = this.alnScr;
......
......@@ -410,30 +410,11 @@ CFraction.prototype.findDisposition = function( mCoord )
}
CFraction.prototype.getPropsForWrite = function()
{
var type = null;
if (this.type == BAR_FRACTION)
type = 0;
else if (this.type == LINEAR_FRACTION)
type = 1;
else if (this.type == NO_BAR_FRACTION)
type = 2;
else if (this.type == SKEWED_FRACTION)
type = 3;
var props = {
type: type
type: this.type
};
return props;
}
CFraction.prototype.Copy = function(Selected, Composition)
{
var props = this.getPropsForWrite();
var NewFraction = new CFraction();
NewFraction.init(props);
this.Copy_2(Selected, Composition, NewFraction);
return NewFraction;
return props;
}
......@@ -501,6 +482,12 @@ CNumerator.prototype.getRunPrp = function()
{
return this.Parent.getRunPrp();
}
CNumerator.prototype.getPropsForWrite = function()
{
var props = {};
return props;
}
function CDenominator()
{
......@@ -571,5 +558,10 @@ CDenominator.prototype.getRunPrp = function()
{
return this.Parent.getRunPrp();
}
CDenominator.prototype.getPropsForWrite = function()
{
var props = {};
return props;
}
//////////
......@@ -6372,8 +6372,17 @@ CMathContent.prototype =
if(Selected)
{
start = this.SelectStartPos;
end = this.SelectEndPos;
if(this.SelectStartPos < this.SelectEndPos)
{
start = this.SelectStartPos;
end = this.SelectEndPos;
}
else
{
start = this.SelectEndPos;
end = this.SelectStartPos;
}
}
else
{
......@@ -6383,9 +6392,9 @@ CMathContent.prototype =
var NewContent = new CMathContent();
NewContent.setComposition(Composition);
NewContent.plHide = this.plHide;
NewContent.plhHide = this.plhHide;
for(var i = start; i < end; i++)
for(var i = start; i <= end; i++)
{
var element;
if(this.content[i].typeObj == MATH_PARA_RUN)
......@@ -6398,7 +6407,7 @@ CMathContent.prototype =
element.relate(this);
}
NewContent.push(element);
NewContent.content.push(element);
}
return NewContent;
......
......@@ -408,8 +408,9 @@ CMathText.prototype =
Copy: function()
{
var NewLetter = new CMathText(this.bJDraw);
NewLetter.add(this.value);
return NewLetter;
},
// заглушка для текста (для n-арных операторов, когда выставляется текст вместо оператора)
......
......@@ -165,6 +165,15 @@ var MATH_EMPTY = 3;
var MATH_PLACEHOLDER = 4;
var MATH_PARA_RUN = 5;
var LOCATION_TOP = 0;
var LOCATION_BOT = 1;
var LOCATION_LEFT = 2;
var LOCATION_RIGHT = 3;
var LOCATION_SEP = 4;
var VJUST_TOP = 0;
var VJUST_BOT = 1;
////////////////////////////////////////
var BREAK_BEFORE = 0;
......@@ -180,6 +189,8 @@ var STY_BI = 1;
var STY_ITALIC = 2;
var STY_PLAIN = 3;
/////////////////////////////////////////
var extend = function(Child, Parent)
{
......
......@@ -241,15 +241,10 @@ CNary.prototype.getLowerIterator = function()
}
CNary.prototype.getPropsForWrite = function()
{
var limLoc = null;
if (this.limLoc == NARY_SubSup)
limLoc = 0;
else if (this.limLoc == NARY_UndOvr)
limLoc = 1;
var props = {
chr: String.fromCharCode(this.code),
grow: this.grow,
limLoc: limLoc,
limLoc: this.limLoc,
subHide: this.subHide,
supHide: this.supHide
};
......
var LOCATION_TOP = 0;
var LOCATION_BOT = 1;
var LOCATION_LEFT = 2;
var LOCATION_RIGHT = 3;
var LOCATION_SEP = 4;
var VJUST_TOP = 0;
var VJUST_BOT = 1;
function CGlyphOperator()
{
this.loc = null;
......@@ -3959,13 +3950,8 @@ CDelimiter.prototype.getPropsForWrite = function()
props.grow = this.grow == true ? 1 : 0;
props.column = this.nCol;
var shp = null
if ( this.shape == DELIMITER_SHAPE_MATH)
shp = 0;
else if ( this.shape == DELIMITER_SHAPE_CENTERED )
shp = 1;
props.shp = shp;
props.shp = this.shape;
props.begChr = this.begOper.getChr(); // default: PARENTHESIS_LEFT
props.endChr = this.endOper.getChr(); // default: PARENTHESIS_RIGHT
......@@ -4346,22 +4332,10 @@ CGroupCharacter.prototype.old_getGlyph = function(code, type)
}
CGroupCharacter.prototype.getPropsForWrite = function()
{
var vertJc = null;
if (this.vertJc == VJUST_TOP)
vertJc = 1;
else
vertJc = 0;
var pos = null;
if (this.loc == LOCATION_BOT)
pos = 0;
else if ( this.loc == LOCATION_TOP)
pos = 1;
var props = {
chr: this.operator.getChr(),
pos: pos,
vertJc: vertJc
pos: this.loc,
vertJc: this.vertJc
};
return props;
......
......@@ -1219,7 +1219,7 @@ CRadical.prototype.getPropsForWrite = function()
{
var props = {};
props.degHide = this.type == SQUARE_RADICAL ? 1 : 0;
props.degHide = this.type;
return props;
}
......
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