001: /* ====================================================================
002: Licensed to the Apache Software Foundation (ASF) under one or more
003: contributor license agreements. See the NOTICE file distributed with
004: this work for additional information regarding copyright ownership.
005: The ASF licenses this file to You under the Apache License, Version 2.0
006: (the "License"); you may not use this file except in compliance with
007: the License. You may obtain a copy of the License at
008:
009: http://www.apache.org/licenses/LICENSE-2.0
010:
011: Unless required by applicable law or agreed to in writing, software
012: distributed under the License is distributed on an "AS IS" BASIS,
013: WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014: See the License for the specific language governing permissions and
015: limitations under the License.
016: ==================================================================== */
017:
018: package org.apache.poi.hssf.util;
019:
020: /**
021: * Holds information regarding a split plane or freeze plane for a sheet.
022: *
023: */
024: public class PaneInformation {
025: /** Constant for active pane being the lower right*/
026: public static final byte PANE_LOWER_RIGHT = (byte) 0;
027: /** Constant for active pane being the upper right*/
028: public static final byte PANE_UPPER_RIGHT = (byte) 1;
029: /** Constant for active pane being the lower left*/
030: public static final byte PANE_LOWER_LEFT = (byte) 2;
031: /** Constant for active pane being the upper left*/
032: public static final byte PANE_UPPER_LEFT = (byte) 3;
033:
034: private short x;
035: private short y;
036: private short topRow;
037: private short leftColumn;
038: private byte activePane;
039: private boolean frozen = false;
040:
041: public PaneInformation(short x, short y, short top, short left,
042: byte active, boolean frozen) {
043: this .x = x;
044: this .y = y;
045: this .topRow = top;
046: this .leftColumn = left;
047: this .activePane = active;
048: this .frozen = frozen;
049: }
050:
051: /**
052: * Returns the vertical position of the split.
053: * @return 0 if there is no vertical spilt,
054: * or for a freeze pane the number of columns in the TOP pane,
055: * or for a split plane the position of the split in 1/20th of a point.
056: */
057: public short getVerticalSplitPosition() {
058: return x;
059: }
060:
061: /**
062: * Returns the horizontal position of the split.
063: * @return 0 if there is no horizontal spilt,
064: * or for a freeze pane the number of rows in the LEFT pane,
065: * or for a split plane the position of the split in 1/20th of a point.
066: */
067: public short getHorizontalSplitPosition() {
068: return y;
069: }
070:
071: /**
072: * For a horizontal split returns the top row in the BOTTOM pane.
073: * @return 0 if there is no horizontal split, or the top row of the bottom pane.
074: */
075: public short getHorizontalSplitTopRow() {
076: return topRow;
077: }
078:
079: /**
080: * For a vertical split returns the left column in the RIGHT pane.
081: * @return 0 if there is no vertical split, or the left column in the RIGHT pane.
082: */
083: public short getVerticalSplitLeftColumn() {
084: return leftColumn;
085: }
086:
087: /**
088: * Returns the active pane
089: * @see #PANE_LOWER_RIGHT
090: * @see #PANE_UPPER_RIGHT
091: * @see #PANE_LOWER_LEFT
092: * @see #PANE_UPPER_LEFT
093: * @return the active pane.
094: */
095: public byte getActivePane() {
096: return activePane;
097: }
098:
099: /** Returns true if this is a Freeze pane, false if it is a split pane.
100: */
101: public boolean isFreezePane() {
102: return frozen;
103: }
104: }
|