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

Bug 14334 - Срабатывает автоподбор ширины пустого столбца.

git-svn-id: svn://192.168.3.15/activex/AVS/Sources/TeamlabOffice/trunk/OfficeWeb@48428 954022d7-b5bf-4e40-9824-e11837661b57
parent 0abf563b
......@@ -750,15 +750,9 @@ function UndoRedoData_ColProp(col){
UndoRedoData_ColProp.prototype = {
isEqual : function(val)
{
var bRes = this.width == val.width && this.hd == val.hd && this.CustomWidth == val.CustomWidth;
if(bRes)
{
if((null == this.BestFit || true == this.BestFit) && (null == val.BestFit || true == val.BestFit))
bRes = true;
else
bRes = false;
}
return bRes;
return this.hd == val.hd && this.CustomWidth == val.CustomWidth && ((this.BestFit == val.BestFit && this.width == val.width) ||
((null == this.width || gc_dDefaultColWidthCharsAttribute == this.width) && (null == this.BestFit || true == this.BestFit) &&
(null == val.width || gc_dDefaultColWidthCharsAttribute == val.width) && (null == val.BestFit || true == val.BestFit)));
},
getType : function()
{
......@@ -810,6 +804,12 @@ function UndoRedoData_RowProp(row){
}
}
UndoRedoData_RowProp.prototype = {
isEqual : function(val)
{
return this.hd == val.hd && ((this.CustomHeight == val.CustomHeight && this.h == val.h) ||
((null == this.h || gc_dDefaultRowHeightAttribute == this.h) && (null == this.CustomHeight || false == this.CustomHeight) &&
(null == val.h || gc_dDefaultRowHeightAttribute == val.h) && (null == val.CustomHeight || false == val.CustomHeight)));
},
getType : function()
{
return UndoRedoDataTypes.RowProp;
......
......@@ -2,6 +2,7 @@ var d1,d2,d3;
var g_nHSLMaxValue = 240;
var g_nVerticalTextAngle = 255;
var gc_dDefaultColWidthCharsAttribute;//определяется в WorksheetView.js
var gc_dDefaultRowHeightAttribute;//определяется в WorksheetView.js
var g_nNextWorksheetId = 1;
var g_sNewSheetNamePattern = "Sheet";
var g_nSheetNameMaxLength = 31;
......@@ -2102,6 +2103,8 @@ function Woorksheet(wb, _index, bAddUserId, sId){
this.aGCells = new Object();// 0 based
this.aCols = new Array();// 0 based
this.Drawings = new Array();
this.TableParts = new Array();
this.AutoFilter = null;
this.oAllCol = null;
this.objForRebuldFormula = {};
this.aComments = new Array();
......@@ -2903,18 +2906,28 @@ Woorksheet.prototype.setColHidden=function(bHidden, start, stop){
};
if(0 != start && gc_nMaxCol0 == stop)
{
var col = this.getAllCol();
var col = null;
if(false == bHidden)
col = this.oAllCol;
else
col = this.getAllCol();
if(null != col)
fProcessCol(col);
}
else
{
for(var i = start; i <= stop; i++){
var col = this._getCol(i);
var col = null;
if(false == bHidden)
col = this._getColNoEmpty(i);
else
col = this._getCol(i);
if(null != col)
fProcessCol(col);
}
}
};
Woorksheet.prototype.setColBestFit=function(bBestFit, start, stop){
Woorksheet.prototype.setColBestFit=function(bBestFit, width, start, stop){
//start, stop 0 based
if(null == start)
return;
......@@ -2924,8 +2937,6 @@ Woorksheet.prototype.setColBestFit=function(bBestFit, start, stop){
History.SetSelection(null, true);
var oThis = this;
var fProcessCol = function(col){
if(col.BestFit != bBestFit)
{
var oOldProps = col.getWidthProp();
if(bBestFit)
{
......@@ -2934,23 +2945,33 @@ Woorksheet.prototype.setColBestFit=function(bBestFit, start, stop){
}
else
col.BestFit = null;
col.width = width;
var oNewProps = col.getWidthProp();
if(false == oOldProps.isEqual(oNewProps))
{
History.Add(g_oUndoRedoWorksheet, historyitem_Worksheet_ColProp, oThis.getId(), new Asc.Range(0, 0, gc_nMaxCol0, gc_nMaxRow0), new UndoRedoData_IndexSimpleProp(col.index, false, oOldProps, oNewProps));
History.AddTrigger(["changeWorksheetUpdate", oThis.getId()]);
}
}
};
if(0 != start && gc_nMaxCol0 == stop)
{
var col = this.getAllCol();
var col = null;
if(bBestFit && gc_dDefaultColWidthCharsAttribute == width)
col = this.oAllCol;
else
col = this.getAllCol();
if(null != col)
fProcessCol(col);
}
else
{
for(var i = start; i <= stop; i++){
var col = this._getCol(i);
var col = null;
if(bBestFit && gc_dDefaultColWidthCharsAttribute == width)
col = this._getColNoEmpty(i);
else
col = this._getCol(i);
if(null != col)
fProcessCol(col);
}
}
......@@ -3002,8 +3023,12 @@ Woorksheet.prototype.setRowHidden=function(bHidden, start, stop){
History.Create_NewPoint();
History.SetSelection(null, true);
for(var i = start;i <= stop; i++){
var oCurRow = this._getRow(i);
if(oCurRow.hd != bHidden)
var oCurRow = null;
if(false == bHidden)
oCurRow = this._getRowNoEmpty(i);
else
oCurRow = this._getRow(i);
if(null != oCurRow && oCurRow.hd != bHidden)
{
var oOldProps = oCurRow.getHeightProp();
if(bHidden)
......@@ -3024,7 +3049,7 @@ Woorksheet.prototype.setRowHidden=function(bHidden, start, stop){
}
}
};
Woorksheet.prototype.setRowBestFit=function(bBestFit, start, stop){
Woorksheet.prototype.setRowBestFit=function(bBestFit, height, start, stop){
//start, stop 0 based
if(null == start)
return;
......@@ -3033,14 +3058,21 @@ Woorksheet.prototype.setRowBestFit=function(bBestFit, start, stop){
History.Create_NewPoint();
History.SetSelection(null, true);
for(var i = start;i <= stop; i++){
var oCurRow = this._getRow(i);
if(bBestFit && oCurRow.CustomHeight)
var oCurRow = null;
if(true == bBestFit && gc_dDefaultRowHeightAttribute == height)
oCurRow = this._getRowNoEmpty(i);
else
oCurRow = this._getRow(i);
if(null != oCurRow)
{
var oOldProps = oCurRow.getHeightProp();
if(true == bBestFit)
oCurRow.CustomHeight = null;
else
oCurRow.CustomHeight = true;
oCurRow.height = height;
var oNewProps = oCurRow.getHeightProp();
if(false == Asc.isEqual(oOldProps, oNewProps))
if(false == oOldProps.isEqual(oNewProps))
{
History.Add(g_oUndoRedoWorksheet, historyitem_Worksheet_RowProp, this.getId(), new Asc.Range(0, i, gc_nMaxCol0, i), new UndoRedoData_IndexSimpleProp(i, true, oOldProps, oNewProps));
History.AddTrigger(["changeWorksheetUpdate", this.getId()]);
......
......@@ -1135,6 +1135,7 @@
this.maxRowHeight = asc_calcnpt( 409, this._getPPIY() );
this.defaultRowDescender = this._calcRowDescender(this.settings.cells.fontSize);
this.defaultRowHeight = asc_calcnpt( this.settings.cells.fontSize * this.vspRatio, this._getPPIY() ) + this.height_1px;
gc_dDefaultRowHeightAttribute = this.model.getDefaultHeight() || this.defaultRowHeight;
},
_initCellsArea: function (fullRecalc) {
this.width_1px = asc_calcnpt(0, this._getPPIX(), 1/*px*/);
......@@ -3636,10 +3637,8 @@
History.Create_NewPoint();
History.SetSelection(null, true);
History.StartTransaction();
// Выставляем ширину в модели
self.model.setColWidth(modelw, col, col);
// Выставляем, что это bestFit
self.model.setColBestFit (true, col, col);
self.model.setColBestFit (true, modelw, col, col);
History.EndTransaction();
self._updateColumnPositions();
......@@ -8401,9 +8400,8 @@
History.Create_NewPoint();
History.SetSelection(null, true);
History.StartTransaction();
t.model.setColWidth(cw, col, col);
// Выставляем, что это bestFit
t.model.setColBestFit(true, col, col);
t.model.setColBestFit(true, cw, col, col);
History.EndTransaction();
t.nColsCount = 0;
......@@ -8444,9 +8442,8 @@
History.Create_NewPoint();
History.SetSelection(null, true);
History.StartTransaction();
t.model.setRowHeight(Math.min(height + t.height_1px, t.maxRowHeight), row, row);
// Выставляем, что это bestFit
t.model.setRowBestFit (true, row, row);
t.model.setRowBestFit (true, Math.min(height + t.height_1px, t.maxRowHeight), row, row);
History.EndTransaction();
t.nRowsCount = 0;
......
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