Commit 4b30ed5a authored by Anna.Pavlova's avatar Anna.Pavlova

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