Commit 5408eee1 authored by Sergey.Konovalov's avatar Sergey.Konovalov Committed by Alexander.Trofimov

(2.0.0.134): AVSOfficeDocxFile2

(1.0.0.58): XlsxSerializerCom
Добавлены свойства Autofilter(ShowButton, Blank), добавлено свойство index для numCache chart(теперь в Word отображаются серии с пропусками)

git-svn-id: svn://192.168.3.15/activex/AVS/Sources/TeamlabOffice/trunk/OfficeWeb@47771 954022d7-b5bf-4e40-9824-e11837661b57
parent 50d0329a
......@@ -831,7 +831,10 @@ var c_oSer_ChartSeriesNumCacheType =
{
Formula: 0,
NumCache: 1,
NumCacheVal: 2
NumCacheVal: 2,
NumCacheIndex: 3,
NumCache2: 4,
NumCacheItem: 5
};
/** @enum */
var EChartAxPos =
......@@ -1183,7 +1186,7 @@ function BinaryChartWriter(memory)
this.memory.WriteString2(sRef);
if(null != data)
this.bs.WriteItem(c_oSer_ChartSeriesNumCacheType.NumCache, function(){oThis.WriteSeriesNumCacheValues(bRow, v1, v2, v3, data);});
this.bs.WriteItem(c_oSer_ChartSeriesNumCacheType.NumCache2, function(){oThis.WriteSeriesNumCacheValues(bRow, v1, v2, v3, data);});
};
this.WriteSeriesNumCacheValues = function(bRow, v1, v2, v3, data)
{
......@@ -1197,10 +1200,7 @@ function BinaryChartWriter(memory)
{
var val = subData[i].value;
if(null != val)
{
this.memory.WriteByte(c_oSer_ChartSeriesNumCacheType.NumCacheVal);
this.memory.WriteString2(val);
}
this.bs.WriteItem(c_oSer_ChartSeriesNumCacheType.NumCacheItem, function(){oThis.WriteSeriesNumCacheValue(val, i);});
}
}
}
......@@ -1213,14 +1213,19 @@ function BinaryChartWriter(memory)
{
var val = subData[v1].value;
if(null != val)
{
this.memory.WriteByte(c_oSer_ChartSeriesNumCacheType.NumCacheVal);
this.memory.WriteString2(val);
}
this.bs.WriteItem(c_oSer_ChartSeriesNumCacheType.NumCacheItem, function(){oThis.WriteSeriesNumCacheValue(val, i);});
}
}
}
}
this.WriteSeriesNumCacheValue = function(val, index)
{
//val
this.memory.WriteByte(c_oSer_ChartSeriesNumCacheType.NumCacheVal);
this.memory.WriteString2(val);
//index
this.bs.WriteItem(c_oSer_ChartSeriesNumCacheType.NumCacheIndex, function(){oThis.memory.WriteLong(index);});
}
this.WriteSeriesMarkers = function(marker)
{
var oThis = this;
......@@ -1732,6 +1737,12 @@ function Binary_ChartReader(stream, chart)
return oThis.ReadSeriesNumCacheValues(t,l, Val.NumCache);
});
}
else if ( c_oSer_ChartSeriesNumCacheType.NumCache2 === type )
{
res = this.bcr.Read1(length, function(t,l){
return oThis.ReadSeriesNumCacheValues2(t,l, Val.NumCache);
});
}
else
res = c_oSerConstants.ReadUnknown;
return res;
......@@ -1741,7 +1752,39 @@ function Binary_ChartReader(stream, chart)
var res = c_oSerConstants.ReadOk;
var oThis = this;
if ( c_oSer_ChartSeriesNumCacheType.NumCacheVal === type )
aValues.push(this.stream.GetString2LE(length));
{
var oNewVal = {val: this.stream.GetString2LE(length), index: aValues.length};
aValues.push(oNewVal);
}
else
res = c_oSerConstants.ReadUnknown;
return res;
};
this.ReadSeriesNumCacheValues2 = function(type, length, aValues)
{
var res = c_oSerConstants.ReadOk;
var oThis = this;
if ( c_oSer_ChartSeriesNumCacheType.NumCacheItem === type )
{
var oNewVal = {val: null, index: null};
res = this.bcr.Read1(length, function(t,l){
return oThis.ReadSeriesNumCacheValuesItem(t,l, oNewVal);
});
if(null != oNewVal.index)
aValues[oNewVal.index] = oNewVal;
}
else
res = c_oSerConstants.ReadUnknown;
return res;
};
this.ReadSeriesNumCacheValuesItem = function(type, length, value)
{
var res = c_oSerConstants.ReadOk;
var oThis = this;
if ( c_oSer_ChartSeriesNumCacheType.NumCacheVal === type )
value.val = this.stream.GetString2LE(length);
else if ( c_oSer_ChartSeriesNumCacheType.NumCacheIndex === type )
value.index = this.stream.GetULongLE();
else
res = c_oSerConstants.ReadUnknown;
return res;
......
......@@ -392,7 +392,10 @@ var c_oSer_FilterColumn =
CustomFilters:4,
ColorFilter:5,
Top10:6,
DynamicFilter: 7
DynamicFilter: 7,
HiddenButton: 8,
ShowButton: 9,
FiltersBlank: 10
};
/** @enum */
var c_oSer_Filter =
......@@ -1006,6 +1009,9 @@ function BinaryTableWriter(memory, aDxfs)
//Top10
if(null != filterColumn.Top10)
this.bs.WriteItem(c_oSer_FilterColumn.Top10, function(){oThis.WriteTop10(filterColumn.Top10);});
//ShowButton
if(null != filterColumn.ShowButton)
this.bs.WriteItem(c_oSer_FilterColumn.ShowButton, function(){oThis.memory.WriteBool(filterColumn.ShowButton);});
}
this.WriteFilters = function(filters)
{
......@@ -1020,6 +1026,8 @@ function BinaryTableWriter(memory, aDxfs)
for(var i = 0, length = filters.Dates.length; i < length; ++i)
this.bs.WriteItem(c_oSer_FilterColumn.DateGroupItem, function(){oThis.WriteDateGroupItem(filters.Dates[i]);});
}
if(null != filters.Blank)
this.bs.WriteItem(c_oSer_FilterColumn.FiltersBlank, function(){oThis.memory.WriteBool(filters.Blank);});
}
this.WriteFilter = function(val)
{
......@@ -3432,7 +3440,7 @@ function Binary_TableReader(stream, ws, Dxfs)
var oThis = this;
if ( c_oSer_AutoFilter.FilterColumn == type )
{
var oFilterColumn = new Object();
var oFilterColumn = {ColId: null, Filters: null, CustomFiltersObj: null, DynamicFilter: null, ColorFilter: null, Top10: null, ShowButton: true};
res = this.bcr.Read1(length, function(t,l){
return oThis.ReadFilterColumn(t,l, oFilterColumn);
});
......@@ -3450,7 +3458,7 @@ function Binary_TableReader(stream, ws, Dxfs)
oFilterColumn.ColId = this.stream.GetULongLE();
else if ( c_oSer_FilterColumn.Filters == type )
{
oFilterColumn.Filters = {Values: new Array(), Dates: new Array()};
oFilterColumn.Filters = {Values: new Array(), Dates: new Array(), Blank: null};
res = this.bcr.Read1(length, function(t,l){
return oThis.ReadFilters(t,l, oFilterColumn.Filters);
});
......@@ -3482,6 +3490,10 @@ function Binary_TableReader(stream, ws, Dxfs)
return oThis.ReadTop10(t,l, oFilterColumn.Top10);
});
}
else if ( c_oSer_FilterColumn.HiddenButton == type )
oFilterColumn.ShowButton = !this.stream.GetBool();
else if ( c_oSer_FilterColumn.ShowButton == type )
oFilterColumn.ShowButton = this.stream.GetBool();
else
res = c_oSerConstants.ReadUnknown;
return res;
......@@ -3507,6 +3519,8 @@ function Binary_TableReader(stream, ws, Dxfs)
});
oFilters.Dates.push(oDateGroupItem);
}
else if ( c_oSer_FilterColumn.FiltersBlank == type )
oFilters.Blank = this.stream.GetBool();
else
res = c_oSerConstants.ReadUnknown;
return res;
......
......@@ -5245,30 +5245,59 @@ function Binary_DocumentTableReader(doc, openParams, ImageMap, stream, bAllowFlo
res = c_oSerConstants.ReadUnknown;
return res;
};
this.PrepareSeria = function(val, chart)
this.ParseFormula = function(formula)
{
var rowByRow = null;
for(var i = 0, length = val.length; i < length; ++i)
var bbox = null;
//todo надо бы подключить parserHelp.parse3DRef. сейчас здесь упрошенный парсер.
var index = formula.indexOf("!");
if(-1 != index)
formula = formula.substring(index + 1);
formula = formula.replace(/\$/g,"");
var parts = formula.split(":");
if(2 == parts.length)
{
var item = {numFormatStr: "General", isDateTimeFormat: false, value: val[i]};
if(chart.range.rows)
var first = new CellAddress(parts[0]);
var last = new CellAddress(parts[1]);
bbox = {r1: first.getRow0(), c1: first.getCol0(), r2: last.getRow0(), c2: last.getCol0()};
}
return bbox;
},
this.PrepareSeria = function(val, chart, formula)
{
var bbox = this.ParseFormula(formula);
if(null != bbox)
{
var length = 0;
if(bbox.c2 - bbox.c1 > bbox.r2 - bbox.r1)
length = bbox.c2 - bbox.c1 + 1;
else
length = bbox.r2 - bbox.r1 + 1;
for(var i = 0; i < length; ++i)
{
if(null == rowByRow)
var elem = val[i];
var sVal = "0";
if(null != elem && null != elem.val)
sVal = elem.val;
var item = {numFormatStr: "General", isDateTimeFormat: false, value: sVal};
if(chart.range.rows)
{
rowByRow = new Array();
chart.data.push(rowByRow);
if(null == rowByRow)
{
rowByRow = new Array();
chart.data.push(rowByRow);
}
rowByRow.push(item);
}
rowByRow.push(item);
}
else
{
var row = chart.data[i];
if(null == row)
else
{
row = new Array();
chart.data[i] = row;
var row = chart.data[i];
if(null == row)
{
row = new Array();
chart.data[i] = row;
}
row.push(item);
}
row.push(item);
}
}
}
......@@ -5308,31 +5337,22 @@ function Binary_DocumentTableReader(doc, openParams, ImageMap, stream, bAllowFlo
{
if(null != seria.Val && null != seria.Val.Formula)
{
//todo надо бы подключить parserHelp.parse3DRef. сейчас здесь упрошенный парсер.
var formula = seria.Val.Formula;
var index = formula.indexOf("!");
if(-1 != index)
formula = formula.substring(index + 1);
formula = formula.replace(/\$/g,"");
var parts = formula.split(":");
if(2 == parts.length)
var bbox = this.ParseFormula(seria.Val.Formula);
if(null != bbox)
{
var first = new CellAddress(parts[0]);
var last = new CellAddress(parts[1]);
chart.range.rows = false;
chart.range.columns = false;
//основываемся на том что parseInt отбрасываем числа в конце
if(last.getCol0() - first.getCol0() > last.getRow0() - first.getRow0())
if(bbox.c2 - bbox.c1 > bbox.r2 - bbox.r1)
chart.range.rows = true;
else
chart.range.columns = true;
}
}
if(null != seria.xVal && null != seria.xVal.NumCache)
this.PrepareSeria(seria.xVal.NumCache, chart);
if(null != seria.xVal && null != seria.xVal.NumCache && null != seria.xVal.Formula)
this.PrepareSeria(seria.xVal.NumCache, chart, seria.xVal.Formula);
}
if(null != seria.Val && null != seria.Val.NumCache)
this.PrepareSeria(seria.Val.NumCache, chart);
if(null != seria.Val && null != seria.Val.NumCache && null != seria.Val.Formula)
this.PrepareSeria(seria.Val.NumCache, chart, seria.Val.Formula);
}
}
var nRowCount = chart.data.length;
......
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