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