Commit 27fc20a9 authored by Alexander.Trofimov's avatar Alexander.Trofimov Committed by Alexander.Trofimov

Заделал копирование свойств листа при копировании (условное форматирование,...

Заделал копирование свойств листа при копировании (условное форматирование, настройки просмотра: показывать сетку и заголовки, цвет листа)
У цветов заделал clone

git-svn-id: svn://192.168.3.15/activex/AVS/Sources/TeamlabOffice/trunk/OfficeWeb@53258 954022d7-b5bf-4e40-9824-e11837661b57
parent db47befa
......@@ -35,6 +35,19 @@
return this;
}
CConditionalFormatting.prototype.clone = function(ws) {
var i, res = new CConditionalFormatting();
res.Pivot = this.Pivot;
res.SqRef = this.SqRef;
for (i = 0; i < this.aRules.length; ++i)
res.aRules.push(this.aRules[i].clone());
res.recalc(ws);
return res;
};
CConditionalFormatting.prototype.recalc = function(ws) {
this.SqRefRange = ws.getRange2(this.SqRef);
};
function CConditionalFormattingRule () {
if ( !(this instanceof CConditionalFormattingRule) ) {
......@@ -59,6 +72,27 @@
return this;
}
CConditionalFormattingRule.prototype.clone = function() {
var i, res = new CConditionalFormattingRule();
res.AboveAverage = this.AboveAverage;
res.Bottom = this.Bottom;
if (this.dxf)
res.dxf = this.dxf.clone();
res.EqualAverage = this.EqualAverage;
res.Operator = this.Operator;
res.Percent = this.Percent;
res.Priority = this.Priority;
res.Rank = this.Rank;
res.StdDev = this.StdDev;
res.StopIfTrue = this.StopIfTrue;
res.Text = this.Text;
res.TimePeriod = this.TimePeriod;
res.Type = this.Type;
for (i = 0; i < this.aRuleElements.length; ++i)
res.aRuleElements.push(this.aRuleElements[i].clone());
return res;
};
function CColorScale () {
if ( !(this instanceof CColorScale) ) {
......@@ -70,6 +104,14 @@
return this;
}
CColorScale.prototype.clone = function() {
var i, res = new CColorScale();
for (i = 0; i < this.aCFVOs.length; ++i)
res.aCFVOs.push(this.aCFVOs[i].clone());
for (i = 0; i < this.aColors.length; ++i)
res.aColors.push(this.aColors[i].clone());
return res;
};
function CDataBar () {
if ( !(this instanceof CDataBar) ) {
......@@ -85,6 +127,17 @@
return this;
}
CDataBar.prototype.clone = function() {
var i, res = new CDataBar();
res.MaxLength = this.MaxLength;
res.MinLength = this.MinLength;
res.ShowValue = this.ShowValue;
for (i = 0; i < this.aCFVOs.length; ++i)
res.aCFVOs.push(this.aCFVOs[i].clone());
if (this.Color)
res.Color = this.Color.clone();
return res;
};
function CFormulaCF () {
if ( !(this instanceof CFormulaCF) ) {
......@@ -95,6 +148,11 @@
return this;
}
CFormulaCF.prototype.clone = function() {
var res = new CFormulaCF();
res.Text = this.Text;
return res;
};
function CIconSet () {
if ( !(this instanceof CIconSet) ) {
......@@ -110,6 +168,16 @@
return this;
}
CIconSet.prototype.clone = function() {
var i, res = new CIconSet();
res.IconSet = this.IconSet;
res.Percent = this.Percent;
res.Reverse = this.Reverse;
res.ShowValue = this.ShowValue;
for (i = 0; i < this.aCFVOs.length; ++i)
res.aCFVOs.push(this.aCFVOs[i].clone());
return res;
};
function CConditionalFormatValueObject () {
if ( !(this instanceof CConditionalFormatValueObject) ) {
......@@ -122,6 +190,13 @@
return this;
}
CConditionalFormatValueObject.prototype.clone = function() {
var res = new CConditionalFormatValueObject();
res.Gte = this.Gte;
res.Type = this.Type;
res.Val = this.Val;
return res;
};
function CGradient (c1, c2) {
if ( !(this instanceof CGradient) ) {
......
......@@ -5226,9 +5226,9 @@ function Binary_WorksheetTableReader(stream, wb, aSharedStrings, aCellXfs, Dxfs,
} else if (c_oSerWorksheetsTypes.ConditionalFormatting === type) {
oConditionalFormatting = new Asc.CConditionalFormatting();
res = this.bcr.Read1(length, function (t, l) {
return oThis.ReadConditionalFormatting(t, l, oConditionalFormatting,
function (sRange) {return oWorksheet.getRange2(sRange);});
return oThis.ReadConditionalFormatting(t, l, oConditionalFormatting);
});
oConditionalFormatting.recalc(oWorksheet);
oWorksheet.aConditionalFormatting.push(oConditionalFormatting);
} else if (c_oSerWorksheetsTypes.SheetViews === type) {
res = this.bcr.Read1(length, function (t, l) {
......@@ -5881,7 +5881,7 @@ function Binary_WorksheetTableReader(stream, wb, aSharedStrings, aCellXfs, Dxfs,
res = c_oSerConstants.ReadUnknown;
return res;
};
this.ReadConditionalFormatting = function (type, length, oConditionalFormatting, functionGetRange2) {
this.ReadConditionalFormatting = function (type, length, oConditionalFormatting) {
var res = c_oSerConstants.ReadOk;
var oThis = this;
var oConditionalFormattingRule = null;
......@@ -5889,7 +5889,6 @@ function Binary_WorksheetTableReader(stream, wb, aSharedStrings, aCellXfs, Dxfs,
oConditionalFormatting.Pivot = this.stream.GetBool();
else if (c_oSer_ConditionalFormatting.SqRef === type) {
oConditionalFormatting.SqRef = this.stream.GetString2LE(length);
oConditionalFormatting.SqRefRange = functionGetRange2(oConditionalFormatting.SqRef);
}
else if (c_oSer_ConditionalFormatting.ConditionalFormattingRule === type) {
oConditionalFormattingRule = new Asc.CConditionalFormattingRule();
......@@ -5914,8 +5913,7 @@ function Binary_WorksheetTableReader(stream, wb, aSharedStrings, aCellXfs, Dxfs,
else if (c_oSer_ConditionalFormattingRule.DxfId === type)
{
var DxfId = this.stream.GetULongLE();
var dxf = this.Dxfs[DxfId];
oConditionalFormattingRule.dxf = dxf;
oConditionalFormattingRule.dxf = this.Dxfs[DxfId];
}
else if (c_oSer_ConditionalFormattingRule.EqualAverage === type)
oConditionalFormattingRule.EqualAverage = this.stream.GetBool();
......
......@@ -2290,12 +2290,12 @@ function Woorksheet(wb, _index, bAddUserId, sId){
this.nMaxRowId = 1;
this.nMaxColId = 1;
};
}
Woorksheet.prototype.rebuildColors=function(){
this._forEachCell(function(cell){
cell.cleanCache();
});
}
};
Woorksheet.prototype.generateFontMap=function(oFontMap){
//пробегаемся по Drawing
for(var i = 0, length = this.Drawings.length; i < length; ++i)
......@@ -2386,7 +2386,15 @@ Woorksheet.prototype.clone=function(sNewId, bFromRedo){
comment.setId();
oNewWs.aComments.push(comment);
}
}
}
for (i = 0; i < this.sheetViews.length; ++i) {
oNewWs.sheetViews.push(this.sheetViews[i].clone());
}
for (i = 0; i < this.aConditionalFormatting.length; ++i) {
oNewWs.aConditionalFormatting.push(this.aConditionalFormatting[i].clone(oNewWs));
}
if (this.sheetPr)
oNewWs.sheetPr = this.sheetPr.clone();
return oNewWs;
};
Woorksheet.prototype.copyDrawingObjects=function(oNewWs)
......@@ -4826,7 +4834,7 @@ function Range(worksheet, r1, c1, r2, c2){
//first last устарели, не убраны только для совместимости
this.first = new CellAddress(this.bbox.r1, this.bbox.c1, 0);
this.last = new CellAddress(this.bbox.r2, this.bbox.c2, 0);
};
}
Range.prototype.clone=function(){
return new Range(this.worksheet, this.bbox.r1, this.bbox.c1, this.bbox.r2, this.bbox.c2);
}
......
......@@ -51,6 +51,10 @@ function RgbColor(rgb)
}
RgbColor.prototype =
{
clone : function()
{
return new RgbColor(this.rgb);
},
getType : function()
{
return UndoRedoDataTypes.RgbColor;
......@@ -114,6 +118,14 @@ function ThemeColor()
}
ThemeColor.prototype =
{
clone : function()
{
var res = new ThemeColor();
res.rgb = this.rgb;
res.theme = this.theme;
res.tint = this.tint;
return res;
},
getType : function()
{
return UndoRedoDataTypes.ThemeColor;
......@@ -312,7 +324,7 @@ ColorManager.prototype =
}
}
}
}
};
g_oColorManager = new ColorManager();
/** @constructor */
......
......@@ -836,6 +836,8 @@
var result = new asc_CSheetViewSettings();
result.showGridLines = this.showGridLines;
result.showRowColHeaders = this.showRowColHeaders;
if (this.pane)
result.pane = this.pane.clone();
return result;
},
isEqual: function (settings) {
......@@ -881,6 +883,12 @@
return this;
}
asc_CPane.prototype.clone = function() {
var res = new asc_CPane();
res.state = this.state;
res.topLeftCell = this.topLeftCell;
return res;
};
function RedoObjectParam () {
if (!(this instanceof RedoObjectParam)) {
......@@ -1052,6 +1060,23 @@
return this;
}
asc_CSheetPr.prototype.clone = function() {
var res = new asc_CSheetPr();
res.CodeName = this.CodeName;
res.EnableFormatConditionsCalculation = this.EnableFormatConditionsCalculation;
res.FilterMode = this.FilterMode;
res.Published = this.Published;
res.SyncHorizontal = this.SyncHorizontal;
res.SyncRef = this.SyncRef;
res.SyncVertical = this.SyncVertical;
res.TransitionEntry = this.TransitionEntry;
res.TransitionEvaluation = this.TransitionEvaluation;
if (this.TabColor)
res.TabColor = this.TabColor.clone();
return res;
};
// Математическая информация о выделении
/** @constructor */
......
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