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