123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117 |
- import luckysheetConfigsetting from './luckysheetConfigsetting';
- import {zoomChange} from './zoom';
- import sheetmanage from './sheetmanage';
- import server from './server';
- import {rowLocationByIndex, colLocationByIndex,mouseposition,rowLocation,colLocation} from '../global/location';
- import Store from '../store';
- let ExcelPlaceholder = {
- "[tabName]":"&A",
- "[CurrentDate]":"&D",
- "[fileName]":"&F",
- "[background]":"&G",
- "[Shadow]":"&H",
- "[TotalPages]":"&N",
- "[pageNumber]":"&P",
- "[CurrentTime]":"&T",
- "[filePath]":"&Z",
- }
- // Get the pixel value per millimeter
- function getOneMmsPx (){
- let div = document.createElement("div");
- div.style.width = "1mm";
- document.querySelector("body").appendChild(div);
- let mm1 = div.getBoundingClientRect();
- let w = mm1.width;
- $(div).remove();
- return mm1.width;
- }
- export function viewChange(curType, preType){
- let currentSheet = sheetmanage.getSheetByIndex();
- if(currentSheet.config==null){
- currentSheet.config = {};
- }
- if(currentSheet.config.sheetViewZoom==null){
- currentSheet.config.sheetViewZoom = {};
- }
- let defaultZoom = 1, type="zoomScaleNormal";
- printLineAndNumberDelete(currentSheet);
- if(curType=="viewNormal"){
- type = "viewNormalZoomScale";
- }
- else if(curType=="viewLayout"){
- type = "viewLayoutZoomScale";
- }
- else if(curType=="viewPage"){
- type = "viewPageZoomScale";
- defaultZoom = 0.6;
- printLineAndNumberCreate(currentSheet);
- }
-
- let curZoom = currentSheet.config.sheetViewZoom[type];
- if(curZoom==null){
- curZoom = defaultZoom;
- }
- currentSheet.config.curentsheetView = curType;
- if (Store.clearjfundo) {
- Store.jfredo.push({
- "type": "viewChange",
- "curType": curType,
- "preType": preType,
- "sheetIndex": Store.currentSheetIndex,
- });
- }
- // Store.zoomRatio = curZoom;
- // server.saveParam("all", Store.currentSheetIndex, curZoom, { "k": "zoomRatio" });
- server.saveParam("cg", Store.currentSheetIndex, curType, { "k": "curentsheetView" });
- Store.currentSheetView = curType;
- zoomChange(curZoom);
- }
- function printLineAndNumberDelete(sheet){
- }
- function printLineAndNumberCreate(sheet){
-
- }
- function switchViewBtn($t){
- let $viewList = $t.parent(), preType=$viewList.find("luckysheet-print-viewBtn-active").attr("type");
- if($t.attr("type") == preType){
- return;
- }
- let curType = $t.attr("type");
- if(curType!=null){
- viewChange(curType, preType);
- }
- else{
- return;
- }
- $t.parent().find(".luckysheet-print-viewBtn").removeClass("luckysheet-print-viewBtn-active");
- $t.addClass("luckysheet-print-viewBtn-active");
- }
- export function printInitial(){
- let container = luckysheetConfigsetting.container;
- let _this = this;
- $("#"+container).find(".luckysheet-print-viewBtn").click(function(){
- switchViewBtn($(this));
- });
- }
|