Commit 27af9326 authored by Ilya Kirillov's avatar Ilya Kirillov

Fix bug #32589 Исправлен баг с чтением документов, у которых стоит флаг...

Fix bug #32589 Исправлен баг с чтением документов, у которых стоит флаг "колонки разной ширины", но при этом ни одной колонки не задано.
parent c5072d9a
...@@ -1879,124 +1879,137 @@ CSectionPageNumInfo.prototype = ...@@ -1879,124 +1879,137 @@ CSectionPageNumInfo.prototype =
function CSectionColumn() function CSectionColumn()
{ {
this.W = 0; this.W = 0;
this.Space = 0; this.Space = 0;
} }
CSectionColumn.prototype.Write_ToBinary = function(Writer) CSectionColumn.prototype.Write_ToBinary = function(Writer)
{ {
// Double : W // Double : W
// Double : Space // Double : Space
Writer.WriteDouble( this.W ); Writer.WriteDouble(this.W);
Writer.WriteDouble( this.Space ); Writer.WriteDouble(this.Space);
}; };
CSectionColumn.prototype.Read_FromBinary = function(Reader) CSectionColumn.prototype.Read_FromBinary = function(Reader)
{ {
// Double : W // Double : W
// Double : Space // Double : Space
this.W = Reader.GetDouble(); this.W = Reader.GetDouble();
this.Space = Reader.GetDouble(); this.Space = Reader.GetDouble();
}; };
function CSectionColumns(SectPr) function CSectionColumns(SectPr)
{ {
this.SectPr = SectPr; this.SectPr = SectPr;
this.EqualWidth = true; this.EqualWidth = true;
this.Num = 1; this.Num = 1;
this.Sep = false; this.Sep = false;
this.Space = 30; this.Space = 30;
this.Cols = []; this.Cols = [];
} }
CSectionColumns.prototype.Write_ToBinary = function(Writer) CSectionColumns.prototype.Write_ToBinary = function(Writer)
{ {
// Bool : Equal // Bool : Equal
// Long : Num // Long : Num
// Bool : Sep // Bool : Sep
// Double : Space // Double : Space
// Long : Количество колонок // Long : Количество колонок
// Variable : Сами колонки // Variable : Сами колонки
Writer.WriteBool( this.EqualWidth ); Writer.WriteBool(this.EqualWidth);
Writer.WriteLong( this.Num ); Writer.WriteLong(this.Num);
Writer.WriteBool( this.Sep ); Writer.WriteBool(this.Sep);
Writer.WriteDouble( this.Space ); Writer.WriteDouble(this.Space);
var Count = this.Cols.length; var Count = this.Cols.length;
Writer.WriteLong( Count ); Writer.WriteLong(Count);
for ( var Pos = 0; Pos < Count; Pos++ ) for (var Pos = 0; Pos < Count; Pos++)
{ {
this.Cols[Pos].Write_ToBinary(Writer); this.Cols[Pos].Write_ToBinary(Writer);
} }
}; };
CSectionColumns.prototype.Read_FromBinary = function(Reader) CSectionColumns.prototype.Read_FromBinary = function(Reader)
{ {
// Bool : Equal // Bool : Equal
// Long : Num // Long : Num
// Bool : Sep // Bool : Sep
// Double : Space // Double : Space
// Long : Количество колонок // Long : Количество колонок
// Variable : Сами колонки // Variable : Сами колонки
this.EqualWidth = Reader.GetBool(); this.EqualWidth = Reader.GetBool();
this.Num = Reader.GetLong(); this.Num = Reader.GetLong();
this.Sep = Reader.GetBool(); this.Sep = Reader.GetBool();
this.Space = Reader.GetDouble(); this.Space = Reader.GetDouble();
var Count = Reader.GetLong(); var Count = Reader.GetLong();
this.Cols = []; this.Cols = [];
for ( var Pos = 0; Pos < Count; Pos++ ) for (var Pos = 0; Pos < Count; Pos++)
{ {
this.Cols[Pos] = new CSectionColumn(); this.Cols[Pos] = new CSectionColumn();
this.Cols[Pos].Read_FromBinary( Reader ); this.Cols[Pos].Read_FromBinary(Reader);
} }
}; };
CSectionColumns.prototype.Get_Count = function() CSectionColumns.prototype.Get_Count = function()
{ {
if (true === this.EqualWidth) if (true === this.EqualWidth)
return this.Num; {
else return this.Num;
return this.Cols.length; }
else
{
if (this.Cols.length <= 0)
return 1;
return this.Cols.length;
}
}; };
CSectionColumns.prototype.Get_ColumnWidth = function(ColIndex) CSectionColumns.prototype.Get_ColumnWidth = function(ColIndex)
{ {
if (true === this.EqualWidth) if (true === this.EqualWidth)
{ {
var PageW = this.SectPr.Get_PageWidth(); var PageW = this.SectPr.Get_PageWidth();
var MarginL = this.SectPr.Get_PageMargin_Left(); var MarginL = this.SectPr.Get_PageMargin_Left();
var MarginR = this.SectPr.Get_PageMargin_Right(); var MarginR = this.SectPr.Get_PageMargin_Right();
return this.Num > 0 ? (PageW - MarginL - MarginR - this.Space * (this.Num - 1)) / this.Num : (PageW - MarginL - MarginR); return this.Num > 0 ? (PageW - MarginL - MarginR - this.Space * (this.Num - 1)) / this.Num : (PageW - MarginL - MarginR);
} }
else else
{ {
ColIndex = Math.max(0, Math.min(this.Cols.length - 1, ColIndex)); if (this.Cols.length <= 0)
if (ColIndex < 0) return 0;
return 0;
ColIndex = Math.max(0, Math.min(this.Cols.length - 1, ColIndex));
return this.Cols[ColIndex].W; if (ColIndex < 0)
} return 0;
return this.Cols[ColIndex].W;
}
}; };
CSectionColumns.prototype.Get_ColumnSpace = function(ColIndex) CSectionColumns.prototype.Get_ColumnSpace = function(ColIndex)
{ {
if (true === this.EqualWidth) if (true === this.EqualWidth)
{ {
return this.Space; return this.Space;
} }
else else
{ {
ColIndex = Math.max(0, Math.min(this.Cols.length - 1, ColIndex)); if (this.Cols.length <= 0)
if (ColIndex < 0) return this.Space;
return this.Space;
ColIndex = Math.max(0, Math.min(this.Cols.length - 1, ColIndex));
return this.Cols[ColIndex].Space; if (ColIndex < 0)
} return this.Space;
return this.Cols[ColIndex].Space;
}
}; };
function CSectionLayoutColumnInfo(X, XLimit) function CSectionLayoutColumnInfo(X, XLimit)
......
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