All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.ttzero.excel.entity.e3.Window1Parser Maven / Gradle / Ivy

/*
 * Copyright (c) 2019-2020, [email protected] All Rights Reserved.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package org.ttzero.excel.entity.e3;

/**
 * 5.109 WINDOW1
 * 

* This record contains general settings for the document window * and global workbook settings (BIFF5-BIFF8). * * @author guanquan.wang on 2019-02-06 */ public class Window1Parser { public static Window1 get(Block block) { block.ready(); Window1 window = new Window1(); // Horizontal position of the document window (in twips = 1/20 of a point) window.horizontal = block.nextShort(); // Vertical position of the document window (in twips = 1/20 of a point) window.vertical = block.nextShort(); // Width of the document window (in twips = 1/20 of a point) window.width = block.nextShort(); // Height of the document window (in twips = 1/20 of a point) window.height = block.nextShort(); // Option // Bits Mask //0 0001H //1 0002H //3 0008H //4 0010H //5 0020H //Contents //0 = Window is visible //0 = Window is open //0 = Horizontal scroll bar hidden 0 = Vertical scroll bar hidden //0 = Worksheet tab bar hidden //1 = Window is hidden //1 = Window is minimised //1 = Horizontal scroll bar visible 1 = Vertical scroll bar visible //1 = Worksheet tab bar visible window.option = Option.of(block.nextShort()); // Index to active (displayed) worksheet window.activeSheet = block.nextShort(); // Index of first visible tab in the worksheet tab bar window.firstVisibleTab = block.nextShort(); // Number of selected worksheets (highlighted in the worksheet tab bar) window.numberOfSelectedSheets = block.nextShort(); // Width of worksheet tab bar (in 1/1000 of window width). // The remaining space is used by the horizontal scrollbar. window.tabBarWidth = block.nextShort(); block.commit(); return window; } public static short getId() { return ParserIdentifier.WINDOW1; } public static class Window1 { short horizontal; short vertical; short width; short height; Option option; short activeSheet; short firstVisibleTab; short numberOfSelectedSheets; short tabBarWidth; public short getHorizontal() { return horizontal; } public short getVertical() { return vertical; } public short getWidth() { return width; } public short getHeight() { return height; } /** * Window is hidden * * @return 0 = Window is visible * 1 = Window is hidden */ public boolean isHidden() { return option.isOn(0); } /** * Window is minimised * * @return 0 = Window is open * 1 = Window is minimised */ public boolean isMinimised() { return option.isOn(1); } /** * Horizontal scroll bar visible * * @return 0 = Horizontal scroll bar hidden * 1 = Horizontal scroll bar visible */ public boolean hScrollBarVisible() { return option.isOn(3); } /** * Vertical scroll bar visible * * @return 0 = Vertical scroll bar hidden * 1 = Vertical scroll bar visible */ public boolean vScrollBarVisible() { return option.isOn(4); } /** * Worksheet tab bar visible * * @return 0 = Worksheet tab bar hidden * 1 = Worksheet tab bar visible */ public boolean tabBarVisible() { return option.isOn(5); } public short getActiveSheet() { return activeSheet; } public short getFirstVisibleTab() { return firstVisibleTab; } public short getNumberOfSelectedSheets() { return numberOfSelectedSheets; } public short getTabBarWidth() { return tabBarWidth; } // TODO @Override public String toString() { return "horizontal: " + horizontal + " vertical: " + vertical + " width: " + width + " height: " + height + " activeSheet: " + activeSheet + " firstVisibleTab: " + firstVisibleTab + " numberOfSelectedSheets: " + numberOfSelectedSheets + " tabBarWidth: " + tabBarWidth + (isHidden() ? " [Window is hidden]" : " [Window is visible]") + (isMinimised() ? " [Window is open]" : " [Window is minimised]") + (hScrollBarVisible() ? " [Horizontal scroll bar hidden]" : " [Horizontal scroll bar visible]") + (vScrollBarVisible() ? " [Vertical scroll bar hidden]" : " [Vertical scroll bar visible]") + (tabBarVisible() ? " [Worksheet tab bar hidden]" : " [Worksheet tab bar visible]") ; } } }





© 2015 - 2024 Weber Informatics LLC | Privacy Policy