Commit 700d62f8 authored by Alexander.Trofimov's avatar Alexander.Trofimov

Пернес fitToWidth и fitToHeight в PagePrintOptions

parent 1906aba4
......@@ -3184,11 +3184,14 @@ var editor;
var _adjustPrint = window.AscDesktopEditor_PrintData ? window.AscDesktopEditor_PrintData : new asc_CAdjustPrint();
window.AscDesktopEditor_PrintData = undefined;
if (1 == _param)
{
_adjustPrint.asc_setPrintType(c_oAscPrintType.EntireWorkbook);
_adjustPrint.asc_setFitToWidth(true);
_adjustPrint.asc_setFitToHeight(true);
if (1 == _param) {
var countWorksheets = _adjustPrint.asc_setPrintType(c_oAscPrintType.EntireWorkbook), printOptions;
this.wbModel.getWorksheetCount();
for (var j = 0; j < countWorksheets; ++j) {
printOptions = this.wbModel.getWorksheet(j).PagePrintOptions;
printOptions.asc_setFitToWidth(true);
printOptions.asc_setFitToHeight(true);
}
}
var _printPagesData = this.wb.calcPagesPrint(_adjustPrint);
......
......@@ -251,11 +251,6 @@ var c_oAscPrintType = {
EntireWorkbook: 1, // Всю книгу
Selection: 2 // Выделенный фрагмент
};
// Тип печати
var c_oAscLayoutPageType = {
FitToWidth: 0, // На всю ширину
ActualSize: 1 // По реальным размерам
};
/** @enum */
var c_oAscCustomAutoFilter = {
......
......@@ -2352,7 +2352,8 @@ function asc_ReadAdjustPrint(s, p) {
}
case 1:
{
adjustPrint.asc_setLayoutPageType(s[p.pos++]);
// ToDo что-то тут нужно поправить...Теперь нет asc_setLayoutPageType
//adjustPrint.asc_setLayoutPageType(s[p.pos++]);
break;
}
case 255:
......
......@@ -1079,33 +1079,26 @@
asc_CPageMargins.prototype.asc_setTop = function (val) { this.top = val; };
asc_CPageMargins.prototype.asc_setBottom = function (val) { this.bottom = val; };
/** @constructor */
function asc_CPageSetup (obj) {
if ( !(this instanceof asc_CPageSetup) ) {
return new asc_CPageSetup(obj);
}
function asc_CPageSetup () {
this.orientation = c_oAscPrintDefaultSettings.PageOrientation;
this.width = c_oAscPrintDefaultSettings.PageWidth;
this.height = c_oAscPrintDefaultSettings.PageHeight;
if (obj) {
this.orientation = obj.orientation;
this.width = obj.width;
this.height = obj.height;
}
this.fitToWidth = false; //ToDo can be a number
this.fitToHeight = false; //ToDo can be a number
return this;
}
asc_CPageSetup.prototype.init = function () {
if (null == this.orientation)
this.orientation = c_oAscPrintDefaultSettings.PageOrientation;
if (null == this.width)
this.width = c_oAscPrintDefaultSettings.PageWidth;
if (null == this.height)
this.height = c_oAscPrintDefaultSettings.PageHeight;
};
asc_CPageSetup.prototype.asc_getOrientation = function () { return this.orientation; };
asc_CPageSetup.prototype.asc_getWidth = function () { return this.width; };
asc_CPageSetup.prototype.asc_getHeight = function () { return this.height; };
asc_CPageSetup.prototype.asc_setOrientation = function (val) { this.orientation = val; };
asc_CPageSetup.prototype.asc_setWidth = function (val) { this.width = val; };
asc_CPageSetup.prototype.asc_setHeight = function (val) { this.height = val; };
asc_CPageSetup.prototype.getFitToWidth = function () { return this.fitToWidth; };
asc_CPageSetup.prototype.getFitToHeight = function () { return this.fitToHeight; };
asc_CPageSetup.prototype.asc_setFitToWidth = function (val) { this.fitToWidth = val; };
asc_CPageSetup.prototype.asc_setFitToHeight = function (val) { this.fitToHeight = val; };
/** @constructor */
function asc_CPageOptions (obj) {
......@@ -1186,30 +1179,14 @@
}
/** @constructor */
function asc_CAdjustPrint () {
if ( !(this instanceof asc_CAdjustPrint) ) {
return new asc_CAdjustPrint();
}
// Вид печати
this.printType = c_oAscPrintType.ActiveSheets;
// Вид печати
this.layoutPageType = c_oAscLayoutPageType.ActualSize;
// По ширине
this.fitToWidth = false;
// По высоте
this.fitToHeight = false;
// ToDo сюда же start и end page index
return this;
}
asc_CAdjustPrint.prototype.asc_getPrintType = function () { return this.printType; };
asc_CAdjustPrint.prototype.asc_getLayoutPageType = function () { return this.layoutPageType; };
asc_CAdjustPrint.prototype.asc_setPrintType = function (val) { this.printType = val; };
asc_CAdjustPrint.prototype.asc_setLayoutPageType = function (val) { this.layoutPageType = val; };
asc_CAdjustPrint.prototype.getFitToWidth = function () { return this.fitToWidth; };
asc_CAdjustPrint.prototype.getFitToHeight = function () { return this.fitToHeight; };
asc_CAdjustPrint.prototype.asc_setFitToWidth = function (val) { this.fitToWidth = val; };
asc_CAdjustPrint.prototype.asc_setFitToHeight = function (val) { this.fitToHeight = val; };
/** @constructor */
function asc_CLockInfo () {
......@@ -1688,6 +1665,8 @@
prot["asc_setOrientation"] = prot.asc_setOrientation;
prot["asc_setWidth"] = prot.asc_setWidth;
prot["asc_setHeight"] = prot.asc_setHeight;
prot["asc_setFitToWidth"] = prot.asc_setFitToWidth;
prot["asc_setFitToHeight"] = prot.asc_setFitToHeight;
window["Asc"]["asc_CPageOptions"] = window["Asc"].asc_CPageOptions = asc_CPageOptions;
prot = asc_CPageOptions.prototype;
......@@ -1706,11 +1685,7 @@
window["Asc"]["asc_CAdjustPrint"] = window["Asc"].asc_CAdjustPrint = asc_CAdjustPrint;
prot = asc_CAdjustPrint.prototype;
prot["asc_getPrintType"] = prot.asc_getPrintType;
prot["asc_getLayoutPageType"] = prot.asc_getLayoutPageType;
prot["asc_setPrintType"] = prot.asc_setPrintType;
prot["asc_setLayoutPageType"] = prot.asc_setLayoutPageType;
prot["asc_setFitToWidth"] = prot.asc_setFitToWidth;
prot["asc_setFitToHeight"] = prot.asc_setFitToHeight;
window["Asc"].asc_CLockInfo = asc_CLockInfo;
......
......@@ -2387,19 +2387,19 @@
var activeWs;
var printPagesData = new asc_CPrintPagesData();
var printType = adjustPrint.asc_getPrintType();
// 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();
ws = this.getWorksheet();
printPagesData.arrPages = ws.calcPagesPrint(wb.getWorksheet(activeWs).PagePrintOptions, /*printOnlySelection*/false, /*indexWorksheet*/activeWs, bFitToWidth, bFitToHeight);
} else if (printType == c_oAscPrintType.EntireWorkbook) {
printPagesData.arrPages =
ws.calcPagesPrint(wb.getWorksheet(activeWs).PagePrintOptions, /*printOnlySelection*/false, /*indexWorksheet*/
activeWs);
} else if (printType === c_oAscPrintType.EntireWorkbook) {
// Колличество листов
var countWorksheets = this.model.getWorksheetCount();
for (var i = 0; i < countWorksheets; ++i) {
ws = this.getWorksheet(i);
var arrPages = ws.calcPagesPrint(wb.getWorksheet(i).PagePrintOptions, /*printOnlySelection*/false, /*indexWorksheet*/i, bFitToWidth, bFitToHeight);
var arrPages = ws.calcPagesPrint(wb.getWorksheet(i).PagePrintOptions, /*printOnlySelection*/false,
/*indexWorksheet*/i);
if (null !== arrPages) {
if (null === printPagesData.arrPages) {
printPagesData.arrPages = [];
......@@ -2407,10 +2407,12 @@
printPagesData.arrPages = printPagesData.arrPages.concat(arrPages);
}
}
} else if (printType == c_oAscPrintType.Selection) {
} else if (printType === c_oAscPrintType.Selection) {
activeWs = wb.getActive();
ws = this.getWorksheet();
printPagesData.arrPages = ws.calcPagesPrint(wb.getWorksheet(activeWs).PagePrintOptions, /*printOnlySelection*/true, /*indexWorksheet*/activeWs, bFitToWidth, bFitToHeight);
printPagesData.arrPages =
ws.calcPagesPrint(wb.getWorksheet(activeWs).PagePrintOptions, /*printOnlySelection*/true, /*indexWorksheet*/
activeWs);
}
return printPagesData;
......
This diff is collapsed.
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