Commit 9e7980ad authored by Alexander.Trofimov's avatar Alexander.Trofimov Committed by Alexander.Trofimov

Добавил fitToWidth и fitToHeight. Методы и реализацию.

git-svn-id: svn://192.168.3.15/activex/AVS/Sources/TeamlabOffice/trunk/OfficeWeb@67845 954022d7-b5bf-4e40-9824-e11837661b57
parent d004ae41
...@@ -1170,6 +1170,11 @@ ...@@ -1170,6 +1170,11 @@
// Вид печати // Вид печати
this.layoutPageType = c_oAscLayoutPageType.ActualSize; this.layoutPageType = c_oAscLayoutPageType.ActualSize;
// По ширине
this.fitToWidth = false;
// По высоте
this.fitToHeight = false;
return this; return this;
} }
asc_CAdjustPrint.prototype.asc_getPrintType = function () { return this.printType; }; asc_CAdjustPrint.prototype.asc_getPrintType = function () { return this.printType; };
...@@ -1177,6 +1182,11 @@ ...@@ -1177,6 +1182,11 @@
asc_CAdjustPrint.prototype.asc_setPrintType = function (val) { this.printType = val; }; asc_CAdjustPrint.prototype.asc_setPrintType = function (val) { this.printType = val; };
asc_CAdjustPrint.prototype.asc_setLayoutPageType = function (val) { this.layoutPageType = val; }; asc_CAdjustPrint.prototype.asc_setLayoutPageType = function (val) { this.layoutPageType = val; };
asc_CAdjustPrint.prototype.getFitToWidth = function () { return this.fitToWidth; };
asc_CAdjustPrint.prototype.getFitToHeight = function () { this.fitToHeight; };
asc_CAdjustPrint.prototype.asc_setFitToWidth = function (val) { this.fitToWidth = val; };
asc_CAdjustPrint.prototype.asc_setFitToHeight = function (val) { this.fitToHeight = val; };
/** @constructor */ /** @constructor */
function asc_CLockInfo () { function asc_CLockInfo () {
this["sheetId"] = null; this["sheetId"] = null;
...@@ -1667,6 +1677,8 @@ ...@@ -1667,6 +1677,8 @@
prot["asc_getLayoutPageType"] = prot.asc_getLayoutPageType; prot["asc_getLayoutPageType"] = prot.asc_getLayoutPageType;
prot["asc_setPrintType"] = prot.asc_setPrintType; prot["asc_setPrintType"] = prot.asc_setPrintType;
prot["asc_setLayoutPageType"] = prot.asc_setLayoutPageType; prot["asc_setLayoutPageType"] = prot.asc_setLayoutPageType;
prot["asc_setFitToWidth"] = prot.asc_setFitToWidth;
prot["asc_setFitToHeight"] = prot.asc_setFitToHeight;
window["Asc"].asc_CLockInfo = asc_CLockInfo; window["Asc"].asc_CLockInfo = asc_CLockInfo;
......
...@@ -2153,17 +2153,19 @@ ...@@ -2153,17 +2153,19 @@
var activeWs; var activeWs;
var printPagesData = new asc_CPrintPagesData(); var printPagesData = new asc_CPrintPagesData();
var printType = adjustPrint.asc_getPrintType(); var printType = adjustPrint.asc_getPrintType();
var layoutPageType = adjustPrint.asc_getLayoutPageType(); // var layoutPageType = adjustPrint.asc_getLayoutPageType();
var bFitToWidth = adjustPrint.getFitToWidth();
var bFitToHeight = adjustPrint.getFitToHeight();
if (printType == c_oAscPrintType.ActiveSheets) { if (printType == c_oAscPrintType.ActiveSheets) {
activeWs = wb.getActive(); activeWs = wb.getActive();
ws = this.getWorksheet(); ws = this.getWorksheet();
printPagesData.arrPages = ws.calcPagesPrint (wb.getWorksheet(activeWs).PagePrintOptions, /*printOnlySelection*/false, /*indexWorksheet*/activeWs, layoutPageType); printPagesData.arrPages = ws.calcPagesPrint(wb.getWorksheet(activeWs).PagePrintOptions, /*printOnlySelection*/false, /*indexWorksheet*/activeWs, bFitToWidth, bFitToHeight);
} else if (printType == c_oAscPrintType.EntireWorkbook) { } else if (printType == c_oAscPrintType.EntireWorkbook) {
// Колличество листов // Колличество листов
var countWorksheets = this.model.getWorksheetCount(); var countWorksheets = this.model.getWorksheetCount();
for (var i = 0; i < countWorksheets; ++i) { for (var i = 0; i < countWorksheets; ++i) {
ws = this.getWorksheet(i); ws = this.getWorksheet(i);
var arrPages = ws.calcPagesPrint (wb.getWorksheet(i).PagePrintOptions, /*printOnlySelection*/false, /*indexWorksheet*/i, layoutPageType); var arrPages = ws.calcPagesPrint(wb.getWorksheet(i).PagePrintOptions, /*printOnlySelection*/false, /*indexWorksheet*/i, bFitToWidth, bFitToHeight);
if (null !== arrPages) { if (null !== arrPages) {
if (null === printPagesData.arrPages) if (null === printPagesData.arrPages)
printPagesData.arrPages = []; printPagesData.arrPages = [];
...@@ -2173,7 +2175,7 @@ ...@@ -2173,7 +2175,7 @@
} else if (printType == c_oAscPrintType.Selection) { } else if (printType == c_oAscPrintType.Selection) {
activeWs = wb.getActive(); activeWs = wb.getActive();
ws = this.getWorksheet(); ws = this.getWorksheet();
printPagesData.arrPages = ws.calcPagesPrint (wb.getWorksheet(activeWs).PagePrintOptions, /*printOnlySelection*/true, /*indexWorksheet*/activeWs, layoutPageType); printPagesData.arrPages = ws.calcPagesPrint(wb.getWorksheet(activeWs).PagePrintOptions, /*printOnlySelection*/true, /*indexWorksheet*/activeWs, bFitToWidth, bFitToHeight);
} }
return printPagesData; return printPagesData;
......
...@@ -1640,7 +1640,7 @@ ...@@ -1640,7 +1640,7 @@
}; };
// ----- Drawing for print ----- // ----- Drawing for print -----
WorksheetView.prototype.calcPagesPrint = function(pageOptions, printOnlySelection, indexWorksheet, layoutPageType) { WorksheetView.prototype.calcPagesPrint = function(pageOptions, printOnlySelection, indexWorksheet, bFitToWidth, bFitToHeight) {
var range; var range;
var maxCols = this.model.getColsCount(); var maxCols = this.model.getColsCount();
var maxRows = this.model.getRowsCount(); var maxRows = this.model.getRowsCount();
...@@ -1796,7 +1796,7 @@ ...@@ -1796,7 +1796,7 @@
for (rowIndex = currentRowIndex; rowIndex < maxRows; ++rowIndex) { for (rowIndex = currentRowIndex; rowIndex < maxRows; ++rowIndex) {
var currentRowHeight = this.rows[rowIndex].height; var currentRowHeight = this.rows[rowIndex].height;
if (currentHeight + currentRowHeight > pageHeightWithFieldsHeadings) { if (!bFitToHeight && currentHeight + currentRowHeight > pageHeightWithFieldsHeadings) {
// Закончили рисовать страницу // Закончили рисовать страницу
break; break;
} }
...@@ -1809,13 +1809,13 @@ ...@@ -1809,13 +1809,13 @@
currentColWidth -= newPagePrint.startOffsetPt; currentColWidth -= newPagePrint.startOffsetPt;
} }
if (c_oAscLayoutPageType.FitToWidth !== layoutPageType && currentWidth + currentColWidth > pageWidthWithFieldsHeadings && colIndex !== currentColIndex) { if (!bFitToWidth && currentWidth + currentColWidth > pageWidthWithFieldsHeadings && colIndex !== currentColIndex) {
break; break;
} }
currentWidth += currentColWidth; currentWidth += currentColWidth;
if (c_oAscLayoutPageType.FitToWidth !== layoutPageType && currentWidth > pageWidthWithFieldsHeadings && colIndex === currentColIndex) { if (!bFitToWidth && currentWidth > pageWidthWithFieldsHeadings && colIndex === currentColIndex) {
// Смещаем в селедующий раз ячейку // Смещаем в селедующий раз ячейку
bIsAddOffset = true; bIsAddOffset = true;
++colIndex; ++colIndex;
...@@ -1829,7 +1829,7 @@ ...@@ -1829,7 +1829,7 @@
currentWidth += this.cellsLeft; currentWidth += this.cellsLeft;
} }
if (c_oAscLayoutPageType.FitToWidth === layoutPageType) { if (bFitToWidth) {
newPagePrint.pageClipRectWidth = Math.max(currentWidth, newPagePrint.pageClipRectWidth); newPagePrint.pageClipRectWidth = Math.max(currentWidth, newPagePrint.pageClipRectWidth);
newPagePrint.pageWidth = newPagePrint.pageClipRectWidth * vector_koef + (pageLeftField + pageRightField); newPagePrint.pageWidth = newPagePrint.pageClipRectWidth * vector_koef + (pageLeftField + pageRightField);
} else { } else {
...@@ -1841,6 +1841,11 @@ ...@@ -1841,6 +1841,11 @@
currentWidth = 0; currentWidth = 0;
} }
if (bFitToHeight) {
newPagePrint.pageClipRectHeight = Math.max(currentHeight, newPagePrint.pageClipRectHeight);
newPagePrint.pageHeight = newPagePrint.pageClipRectHeight * vector_koef + (pageTopField + pageBottomField);
}
// Нужно будет пересчитывать колонки // Нужно будет пересчитывать колонки
isCalcColumnsWidth = true; isCalcColumnsWidth = true;
......
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