Logo Search packages:      
Sourcecode: jexcelapi version File versions  Download package

SheetSettings.java

/*********************************************************************
*
*      Copyright (C) 2002 Andrew Khan
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
***************************************************************************/

package jxl;

import jxl.common.Assert;

import jxl.format.PageOrientation;
import jxl.format.PaperSize;
import jxl.biff.SheetRangeImpl;
import jxl.Range;
import jxl.format.PageOrder;

/**
 * This is a bean which client applications may use to get/set various
 * properties which are associated with a particular worksheet, such
 * as headers and footers, page orientation etc.
 */
00035 public final class SheetSettings
{
  /**
   * The page orientation
   */
00040   private PageOrientation orientation;
  
  /**
   * The page order
   */
00045   private PageOrder pageOrder;

  /**
   * The paper size for printing
   */
00050   private PaperSize paperSize;

  /**
   * Indicates whether or not this sheet is protected
   */
00055   private boolean sheetProtected;

  /**
   * Indicates whether or not this sheet is hidden
   */
00060   private boolean hidden;

  /**
   * Indicates whether or not this sheet is selected
   */
00065   private boolean selected;

  /**
   * The header
   */
00070   private HeaderFooter header;

  /**
   * The margin allocated for any page headers, in inches
   */
00075   private double headerMargin;

  /**
   * The footer
   */
00080   private HeaderFooter footer;

  /**
   * The margin allocated for any page footers, in inches
   */
00085   private double footerMargin;

  /**
   * The scale factor used when printing
   */
00090   private int scaleFactor;

  /**
   * The zoom factor used when viewing.  Note the difference between
   * this and the scaleFactor which is used when printing
   */
00096   private int zoomFactor;

  /**
   * The page number at which to commence printing
   */
00101   private int pageStart;

  /**
   * The number of pages into which this excel sheet is squeezed widthwise
   */
00106   private int fitWidth;

  /**
   * The number of pages into which this excel sheet is squeezed heightwise
   */
00111   private int fitHeight;

  /**
   * The horizontal print resolution
   */
00116   private int horizontalPrintResolution;

  /**
   * The vertical print resolution
   */
00121   private int verticalPrintResolution;

  /**
   * The margin from the left hand side of the paper in inches
   */
00126   private double leftMargin;

  /**
   * The margin from the right hand side of the paper in inches
   */
00131   private double rightMargin;

  /**
   * The margin from the top of the paper in inches
   */
00136   private double topMargin;

  /**
   * The margin from the bottom of the paper in inches
   */
00141   private double bottomMargin;

  /**
   * Indicates whether to fit the print to the pages or scale the output
   * This field is manipulated indirectly by virtue of the setFitWidth/Height
   * methods
   */
00148   private boolean fitToPages;

  /**
   * Indicates whether grid lines should be displayed
   */
00153   private boolean showGridLines;

  /**
   * Indicates whether grid lines should be printed
   */
00158   private boolean printGridLines;

  /**
   * Indicates whether sheet headings should be printed
   */
00163   private boolean printHeaders;

  /**
   * Indicates the view mode
   */
00168   private boolean pageBreakPreviewMode;

  /**
   * Indicates whether the sheet should display zero values
   */
00173   private boolean displayZeroValues;

  /**
   * The password for protected sheets
   */
00178   private String password;

  /**
   * The password hashcode - used when copying sheets
   */
00183   private int passwordHash;

  /**
   * The default column width, in characters
   */
00188   private int defaultColumnWidth;

  /**
   * The default row height, in 1/20th of a point
   */
00193   private int defaultRowHeight;

  /**
   * The horizontal freeze pane
   */
00198   private int horizontalFreeze;

  /**
   * The vertical freeze position
   */
00203   private int verticalFreeze;

  /**
   * Vertical centre flag
   */
00208   private boolean verticalCentre;

  /**
   * Horizontal centre flag
   */
00213   private boolean horizontalCentre;

  /**
   * The number of copies to print
   */
00218   private int copies;

  /**
   * Automatic formula calculation
   */
00223   private boolean automaticFormulaCalculation;

  /**
   * Recalculate the formulas before save
   */
00228   private boolean recalculateFormulasBeforeSave;

  /**
   * The magnification factor for use during page break preview mode (in 
   * percent)
   */
00234   private int pageBreakPreviewMagnification;

  /**
   * The magnification factor for use during normal mode (in percent)
   */
00239   private int normalMagnification;

  /**
   * The print area
   */
00244   private Range printArea;

  /**
   * The print row titles
   */
00249   private Range printTitlesRow;

  /**
   * The print column titles
   */
00254   private Range printTitlesCol;
    
  /**
   * A handle to the sheet - used internally for ranges
   */
00259   private Sheet sheet;

  // ***
  // The defaults
  // **
  private static final PageOrientation DEFAULT_ORIENTATION =
    PageOrientation.PORTRAIT;
  private static final PageOrder DEFAULT_ORDER =
    PageOrder.RIGHT_THEN_DOWN;
  private static final PaperSize DEFAULT_PAPER_SIZE = PaperSize.A4;
  private static final double DEFAULT_HEADER_MARGIN = 0.5;
  private static final double DEFAULT_FOOTER_MARGIN = 0.5;
  private static final int    DEFAULT_PRINT_RESOLUTION = 0x12c;
  private static final double DEFAULT_WIDTH_MARGIN     = 0.75;
  private static final double DEFAULT_HEIGHT_MARGIN    = 1;

  private static final int DEFAULT_DEFAULT_COLUMN_WIDTH = 8;
  private static final int DEFAULT_ZOOM_FACTOR = 100;
  private static final int DEFAULT_NORMAL_MAGNIFICATION = 100;
  private static final int DEFAULT_PAGE_BREAK_PREVIEW_MAGNIFICATION = 60;

  // The publicly accessible values
  /**
   * The default value for the default row height
   */
00284   public static final int DEFAULT_DEFAULT_ROW_HEIGHT = 0xff;

  /**
   * Default constructor
   */
00289   public SheetSettings(Sheet s)
  {
    sheet = s; // for internal use, when accessing ranges
    orientation        = DEFAULT_ORIENTATION;
    pageOrder          = DEFAULT_ORDER;
    paperSize          = DEFAULT_PAPER_SIZE;
    sheetProtected     = false;
    hidden             = false;
    selected           = false;
    headerMargin       = DEFAULT_HEADER_MARGIN;
    footerMargin       = DEFAULT_FOOTER_MARGIN;
    horizontalPrintResolution = DEFAULT_PRINT_RESOLUTION;
    verticalPrintResolution   = DEFAULT_PRINT_RESOLUTION;
    leftMargin         = DEFAULT_WIDTH_MARGIN;
    rightMargin        = DEFAULT_WIDTH_MARGIN;
    topMargin          = DEFAULT_HEIGHT_MARGIN;
    bottomMargin       = DEFAULT_HEIGHT_MARGIN;
    fitToPages         = false;
    showGridLines      = true;
    printGridLines     = false;
    printHeaders       = false;
    pageBreakPreviewMode = false;
    displayZeroValues  = true;
    defaultColumnWidth = DEFAULT_DEFAULT_COLUMN_WIDTH;
    defaultRowHeight   = DEFAULT_DEFAULT_ROW_HEIGHT;
    zoomFactor         = DEFAULT_ZOOM_FACTOR;
    pageBreakPreviewMagnification = DEFAULT_PAGE_BREAK_PREVIEW_MAGNIFICATION;
    normalMagnification = DEFAULT_NORMAL_MAGNIFICATION;
    horizontalFreeze   = 0;
    verticalFreeze     = 0;
    copies             = 1;
    header             = new HeaderFooter();
    footer             = new HeaderFooter();
    automaticFormulaCalculation = true;
    recalculateFormulasBeforeSave = true;
  }

  /**
   * Copy constructor.  Called when copying sheets
   * @param copy the settings to copy
   */
00330   public SheetSettings(SheetSettings copy, Sheet s)
  {
    Assert.verify(copy != null);

    sheet = s;  // for internal use when accessing ranges
    orientation    = copy.orientation;
    pageOrder      = copy.pageOrder;
    paperSize      = copy.paperSize;
    sheetProtected = copy.sheetProtected;
    hidden         = copy.hidden;
    selected       = false; // don't copy the selected flag
    headerMargin   = copy.headerMargin;
    footerMargin   = copy.footerMargin;
    scaleFactor    = copy.scaleFactor;
    pageStart      = copy.pageStart;
    fitWidth       = copy.fitWidth;
    fitHeight      = copy.fitHeight;
    horizontalPrintResolution = copy.horizontalPrintResolution;
    verticalPrintResolution   = copy.verticalPrintResolution;
    leftMargin         = copy.leftMargin;
    rightMargin        = copy.rightMargin;
    topMargin          = copy.topMargin;
    bottomMargin       = copy.bottomMargin;
    fitToPages         = copy.fitToPages;
    password           = copy.password;
    passwordHash       = copy.passwordHash;
    defaultColumnWidth = copy.defaultColumnWidth;
    defaultRowHeight   = copy.defaultRowHeight;
    zoomFactor         = copy.zoomFactor;
    pageBreakPreviewMagnification = copy.pageBreakPreviewMagnification;
    normalMagnification = copy.normalMagnification;
    showGridLines      = copy.showGridLines;
    displayZeroValues  = copy.displayZeroValues;
    pageBreakPreviewMode = copy.pageBreakPreviewMode;
    horizontalFreeze   = copy.horizontalFreeze;
    verticalFreeze     = copy.verticalFreeze;
    horizontalCentre   = copy.horizontalCentre;
    verticalCentre     = copy.verticalCentre;
    copies             = copy.copies;
    header             = new HeaderFooter(copy.header);
    footer             = new HeaderFooter(copy.footer);
    automaticFormulaCalculation = copy.automaticFormulaCalculation;
    recalculateFormulasBeforeSave = copy.recalculateFormulasBeforeSave;

    if (copy.printArea != null)
    {
      printArea = new SheetRangeImpl
        (sheet,
         copy.getPrintArea().getTopLeft().getColumn(),
         copy.getPrintArea().getTopLeft().getRow(),
         copy.getPrintArea().getBottomRight().getColumn(),
         copy.getPrintArea().getBottomRight().getRow());
    }
    
    if (copy.printTitlesRow != null)
    {
      printTitlesRow = new SheetRangeImpl
        (sheet,
         copy.getPrintTitlesRow().getTopLeft().getColumn(),
         copy.getPrintTitlesRow().getTopLeft().getRow(),
         copy.getPrintTitlesRow().getBottomRight().getColumn(),
         copy.getPrintTitlesRow().getBottomRight().getRow());
    }    

    if (copy.printTitlesCol != null)
    {
      printTitlesCol = new SheetRangeImpl
        (sheet,
         copy.getPrintTitlesCol().getTopLeft().getColumn(),
         copy.getPrintTitlesCol().getTopLeft().getRow(),
         copy.getPrintTitlesCol().getBottomRight().getColumn(),
         copy.getPrintTitlesCol().getBottomRight().getRow());
    }    
  }

  /**
   * Sets the paper orientation for printing this sheet
   *
   * @param po the orientation
   */
00410   public void setOrientation(PageOrientation po)
  {
    orientation = po;
  }

  /**
   * Accessor for the orientation
   *
   * @return the orientation
   */
00420   public PageOrientation getOrientation()
  {
    return orientation;
  }

  /**
   * Accessor for the order
   * 
   * @return
   */
00430   public PageOrder getPageOrder() 
  {
    return pageOrder;
  }

  /**
   * Sets the page order for printing this sheet
   * 
   * @param order
   */
00440   public void setPageOrder(PageOrder order) 
  {
    this.pageOrder = order;
  }

  /**
   * Sets the paper size to be used when printing this sheet
   *
   * @param ps the paper size
   */
00450   public void setPaperSize(PaperSize ps)
  {
    paperSize = ps;
  }

  /**
   * Accessor for the paper size
   *
   * @return the paper size
   */
00460   public PaperSize getPaperSize()
  {
    return paperSize;
  }

  /**
   * Queries whether this sheet is protected (ie. read only)
   *
   * @return TRUE if this sheet is read only, FALSE otherwise
   */
00470   public boolean isProtected()
  {
    return sheetProtected;
  }

  /**
   * Sets the protected (ie. read only) status of this sheet
   *
   * @param p the protected status
   */
00480   public void setProtected(boolean p)
  {
    sheetProtected = p;
  }

  /**
   * Sets the margin for any page headers
   *
   * @param d the margin in inches
   */
00490   public void setHeaderMargin(double d)
  {
    headerMargin = d;
  }

  /**
   * Accessor for the header margin
   *
   * @return the header margin
   */
00500   public double getHeaderMargin()
  {
    return headerMargin;
  }

  /**
   * Sets the margin for any page footer
   *
   * @param d the footer margin in inches
   */
00510   public void setFooterMargin(double d)
  {
    footerMargin = d;
  }

  /**
   * Accessor for the footer margin
   *
   * @return the footer margin
   */
00520   public double getFooterMargin()
  {
    return footerMargin;
  }

  /**
   * Sets the hidden status of this worksheet
   *
   * @param h the hidden flag
   */
00530   public void setHidden(boolean h)
  {
    hidden = h;
  }

  /**
   * Accessor for the hidden nature of this sheet
   *
   * @return TRUE if this sheet is hidden, FALSE otherwise
   */
00540   public boolean isHidden()
  {
    return hidden;
  }

  /**
   * Sets this sheet to be when it is opened in excel
   *
   * @deprecated use overloaded version which takes a boolean
   */
00550   public void setSelected()
  {
    setSelected(true);
  }

  /**
   * Sets this sheet to be when it is opened in excel
   *
   * @param s sets whether this sheet is selected or not
   */
00560   public void setSelected(boolean s)
  {
    selected = s;
  }

  /**
   * Accessor for the selected nature of the sheet
   *
   * @return TRUE if this sheet is selected, FALSE otherwise
   */
00570   public boolean isSelected()
  {
    return selected;
  }

  /**
   * Sets the scale factor for this sheet to be used when printing.  The
   * parameter is a percentage, therefore setting a scale factor of 100 will
   * print at normal size, 50 half size, 200 double size etc
   *
   * @param sf the scale factor as a percentage
   */
00582   public void setScaleFactor(int sf)
  {
    scaleFactor = sf;
    fitToPages = false;
  }

  /**
   * Accessor for the scale factor
   *
   * @return the scale factor
   */
00593   public int getScaleFactor()
  {
    return scaleFactor;
  }

  /**
   * Sets the page number at which to commence printing
   *
   * @param ps the page start number
   */
00603   public void setPageStart(int ps)
  {
    pageStart = ps;
  }

  /**
   * Accessor for the page start
   *
   * @return the page start
   */
00613   public int getPageStart()
  {
    return pageStart;
  }

  /**
   * Sets the number of pages widthwise which this sheet should be
   * printed into
   *
   * @param fw the number of pages
   */
00624   public void setFitWidth(int fw)
  {
    fitWidth = fw;
    fitToPages = true;
  }

  /**
   * Accessor for the fit width
   *
   * @return the number of pages this sheet will be printed into widthwise
   */
00635   public int getFitWidth()
  {
    return fitWidth;
  }

  /**
   * Sets the number of pages vertically that this sheet will be printed into
   *
   * @param fh the number of pages this sheet will be printed into heightwise
   */
00645   public void setFitHeight(int fh)
  {
    fitHeight = fh;
    fitToPages = true;
  }

  /**
   * Accessor for the fit height
   *
   * @return the number of pages this sheet will be printed into heightwise
   */
00656   public int getFitHeight()
  {
    return fitHeight;
  }

  /**
   * Sets the horizontal print resolution
   *
   * @param hpw the print resolution
   */
00666   public void setHorizontalPrintResolution(int hpw)
  {
    horizontalPrintResolution = hpw;
  }

  /**
   * Accessor for the horizontal print resolution
   *
   * @return the horizontal print resolution
   */
00676   public int getHorizontalPrintResolution()
  {
    return horizontalPrintResolution;
  }

  /**
   * Sets the vertical print reslution
   *
   * @param vpw the vertical print resolution
   */
00686   public void setVerticalPrintResolution(int vpw)
  {
    verticalPrintResolution = vpw;
  }

  /**
   * Accessor for the vertical print resolution
   *
   * @return the vertical print resolution
   */
00696   public int getVerticalPrintResolution()
  {
    return verticalPrintResolution;
  }

  /**
   * Sets the right margin
   *
   * @param m the right margin in inches
   */
00706   public void setRightMargin(double m)
  {
    rightMargin = m;
  }

  /**
   * Accessor for the right margin
   *
   * @return the right margin in inches
   */
00716   public double getRightMargin()
  {
    return rightMargin;
  }

  /**
   * Sets the left margin
   *
   * @param m the left margin in inches
   */
00726   public void setLeftMargin(double m)
  {
    leftMargin = m;
  }

  /**
   * Accessor for the left margin
   *
   * @return the left margin in inches
   */
00736   public double getLeftMargin()
  {
    return leftMargin;
  }

  /**
   * Sets the top margin
   *
   * @param m the top margin in inches
   */
00746   public void setTopMargin(double m)
  {
    topMargin = m;
  }

  /**
   * Accessor for the top margin
   *
   * @return the top margin in inches
   */
00756   public double getTopMargin()
  {
    return topMargin;
  }

  /**
   * Sets the bottom margin
   *
   * @param m the bottom margin in inches
   */
00766   public void setBottomMargin(double m)
  {
    bottomMargin = m;
  }

  /**
   * Accessor for the bottom margin
   *
   * @return the bottom margin in inches
   */
00776   public double getBottomMargin()
  {
    return bottomMargin;
  }

  /**
   * Gets the default margin width
   *
   * @return the default margin width
   */
00786   public double getDefaultWidthMargin()
  {
    return DEFAULT_WIDTH_MARGIN;
  }

  /**
   * Gets the default margin height
   *
   * @return the default margin height
   */
00796   public double getDefaultHeightMargin()
  {
    return DEFAULT_HEIGHT_MARGIN;
  }

  /**
   * Accessor for the fit width print flag
   * @return TRUE if the print is to fit to pages, false otherwise
   */
00805   public boolean getFitToPages()
  {
    return fitToPages;
  }

  /**
   * Accessor for the fit to pages flag
   * @param b TRUE to fit to pages, FALSE to use a scale factor
   */
00814   public void setFitToPages(boolean b)
  {
    fitToPages = b;
  }

  /**
   * Accessor for the password
   *
   * @return the password to unlock this sheet, or NULL if not protected
   */
00824   public String getPassword()
  {
    return password;
  }

  /**
   * Sets the password for this sheet
   *
   * @param s the password
   */
00834   public void setPassword(String s)
  {
    password = s;
  }

  /**
   * Accessor for the password hash - used only when copying sheets
   *
   * @return passwordHash
   */
00844   public int getPasswordHash()
  {
    return passwordHash;
  }

  /**
   * Accessor for the password hash - used only when copying sheets
   *
   * @param ph the password hash
   */
00854   public void setPasswordHash(int ph)
  {
    passwordHash = ph;
  }

  /**
   * Accessor for the default column width
   *
   * @return the default column width, in characters
   */
00864   public int getDefaultColumnWidth()
  {
    return defaultColumnWidth;
  }

  /**
   * Sets the default column width
   *
   * @param w the new default column width
   */
00874   public void setDefaultColumnWidth(int w)
  {
    defaultColumnWidth = w;
  }

  /**
   * Accessor for the default row height
   *
   * @return the default row height, in 1/20ths of a point
   */
00884   public int getDefaultRowHeight()
  {
    return defaultRowHeight;
  }

  /**
   * Sets the default row height
   *
   * @param h the default row height, in 1/20ths of a point
   */
00894   public void setDefaultRowHeight(int h)
  {
    defaultRowHeight = h;
  }

  /**
   * Accessor for the zoom factor.  Do not confuse zoom factor (which relates
   * to the on screen view) with scale factor (which refers to the scale factor
   * when printing)
   *
   * @return the zoom factor as a percentage
   */
00906   public int getZoomFactor()
  {
    return zoomFactor;
  }

  /**
   * Sets the zoom factor.  Do not confuse zoom factor (which relates
   * to the on screen view) with scale factor (which refers to the scale factor
   * when printing)
   *
   * @param zf the zoom factor as a percentage
   */
00918   public void setZoomFactor(int zf)
  {
    zoomFactor = zf;
  }

  /**
   * Accessor for the page break preview mangificaton factor.
   * Do not confuse zoom factor or scale factor
   *
   * @return the page break preview magnification  a percentage
   */
00929   public int getPageBreakPreviewMagnification()
  {
    return pageBreakPreviewMagnification;
  }

  /**
   * Accessor for the page break preview magnificaton factor.
   * Do not confuse zoom factor or scale factor
   *
   * @param f the page break preview magnification as a percentage
   */
00940   public void setPageBreakPreviewMagnification(int f)
  {
    pageBreakPreviewMagnification =f ;
  }

  /**
   * Accessor for the nomral view  magnificaton factor.
   * Do not confuse zoom factor or scale factor
   *
   * @return the page break preview magnification  a percentage
   */
00951   public int getNormalMagnification()
  {
    return normalMagnification;
  }

  /**
   * Accessor for the normal magnificaton factor.
   * Do not confuse zoom factor or scale factor
   *
   * @param f the page break preview magnification as a percentage
   */
00962   public void setNormalMagnification(int f)
  {
    normalMagnification = f ;
  }


  /**
   * Accessor for the displayZeroValues property
   *
   * @return TRUE to display zero values, FALSE not to bother
   */
00973   public boolean getDisplayZeroValues()
  {
    return displayZeroValues;
  }

  /**
   * Sets the displayZeroValues property
   *
   * @param b TRUE to show zero values, FALSE not to bother
   */
00983   public void setDisplayZeroValues(boolean b)
  {
    displayZeroValues = b;
  }

  /**
   * Accessor for the showGridLines property
   *
   * @return TRUE if grid lines will be shown, FALSE otherwise
   */
00993   public boolean getShowGridLines()
  {
    return showGridLines;
  }

  /**
   * Sets the showGridLines property
   *
   * @param b TRUE to show grid lines on this sheet, FALSE otherwise
   */
01003   public void setShowGridLines(boolean b)
  {
    showGridLines = b;
  }

  /**
   * Accessor for the pageBreakPreview mode
   *
   * @return TRUE if page break preview is enabled, FALSE otherwise
   */
01013   public boolean getPageBreakPreviewMode()
  {
    return pageBreakPreviewMode;
  }

  /**
   * Sets the pageBreakPreviewMode  property
   *
   * @param b TRUE to launch in page break preview mode, FALSE otherwise
   */
01023   public void setPageBreakPreviewMode(boolean b)
  {
    pageBreakPreviewMode = b;
  }

  /**
   * Accessor for the printGridLines property
   *
   * @return TRUE if grid lines will be printed, FALSE otherwise
   */
01033   public boolean getPrintGridLines()
  {
    return printGridLines;
  }

   /**
   * Sets the printGridLines property
   *
   * @param b TRUE to print grid lines on this sheet, FALSE otherwise
   */
01043   public void setPrintGridLines(boolean b)
  {
    printGridLines = b;
  }

  /**
   * Accessor for the printHeaders property
   *
   * @return TRUE if headers will be printed, FALSE otherwise
   */
01053   public boolean getPrintHeaders()
  {
    return printHeaders;
  }

   /**
   * Sets the printHeaders property
   *
   * @param b TRUE to print headers on this sheet, FALSE otherwise
   */
01063   public void setPrintHeaders(boolean b)
  {
    printHeaders = b;
  }

  /**
   * Gets the row at which the pane is frozen horizontally
   *
   * @return the row at which the pane is horizontally frozen, or 0 if there
   * is no freeze
   */
01074   public int getHorizontalFreeze()
  {
    return horizontalFreeze;
  }

  /**
   * Sets the row at which the pane is frozen horizontally
   *
   * @param row the row number to freeze at
   */
01084   public void setHorizontalFreeze(int row)
  {
    horizontalFreeze = Math.max(row, 0);
  }

  /**
   * Gets the column at which the pane is frozen vertically
   *
   * @return the column at which the pane is vertically frozen, or 0 if there
   * is no freeze
   */
01095   public int getVerticalFreeze()
  {
    return verticalFreeze;
  }

  /**
   * Sets the row at which the pane is frozen vertically
   *
   * @param col the column number to freeze at
   */
01105   public void setVerticalFreeze(int col)
  {
    verticalFreeze = Math.max(col, 0);
  }

  /**
   * Sets the number of copies
   *
   * @param c the number of copies
   */
01115   public void setCopies(int c)
  {
    copies = c;
  }

  /**
   * Accessor for the number of copies to print
   *
   * @return the number of copies
   */
01125   public int getCopies()
  {
    return copies;
  }

  /**
   * Accessor for the header
   *
   * @return the header
   */
01135   public HeaderFooter getHeader()
  {
    return header;
  }

  /**
   * Sets the header
   *
   * @param h the header
   */
01145   public void setHeader(HeaderFooter h)
  {
    header = h;
  }

  /**
   * Sets the footer
   *
   * @param f the footer
   */
01155   public void setFooter(HeaderFooter f)
  {
    footer = f;
  }

  /**
   * Accessor for the footer
   *
   * @return the footer
   */
01165   public HeaderFooter getFooter()
  {
    return footer;
  }

  /**
   * Accessor for the horizontal centre
   *
   * @return Returns the horizontalCentre.
   */
01175   public boolean isHorizontalCentre()
  {
    return horizontalCentre;
  }

  /**
   * Sets the horizontal centre
   *
   * @param horizCentre The horizontalCentre to set.
   */
01185   public void setHorizontalCentre(boolean horizCentre)
  {
    this.horizontalCentre = horizCentre;
  }

  /**
   * Accessor for the vertical centre
   *
   * @return Returns the verticalCentre.
   */
01195   public boolean isVerticalCentre()
  {
    return verticalCentre;
  }

  /**
   * Sets the vertical centre
   *
   * @param vertCentre The verticalCentre to set.
   */
01205   public void setVerticalCentre(boolean vertCentre)
  {
    this.verticalCentre = vertCentre;
  }

  /**
   * Sets the automatic formula calculation flag
   *
   * @param auto - TRUE to automatically calculate the formulas,
   * FALSE otherwise
   */
01216   public void setAutomaticFormulaCalculation(boolean auto)
  {
    automaticFormulaCalculation = auto;
  }

  /**
   * Retrieves the automatic formula calculation flag
   *
   * @return TRUE if formulas are calculated automatically, FALSE if they
   * are calculated manually
   */
01227   public boolean getAutomaticFormulaCalculation()
  {
    return automaticFormulaCalculation;
  }

  /**
   * Sets the recalculate formulas when the sheet is saved flag
   *
   * @param recalc - TRUE to automatically calculate the formulas when the,
   * spreadsheet is saved, FALSE otherwise
   */
01238   public void setRecalculateFormulasBeforeSave(boolean recalc)
  {
    recalculateFormulasBeforeSave = recalc;
  }

  /**
   * Retrieves the recalculate formulas before save  flag
   *
   * @return TRUE if formulas are calculated before the sheet is saved,
   * FALSE otherwise
   */
01249   public boolean getRecalculateFormulasBeforeSave()
  {
    return recalculateFormulasBeforeSave;
  }

  /**
   * Sets the print area for this sheet
   *
   * @param firstCol the first column of the print area
   * @param firstRow the first row of the print area
   * @param lastCol the last column of the print area
   * @param lastRow the last row of the print area
   */
01262   public void setPrintArea(int firstCol, 
                           int firstRow,  
                           int lastCol,
                           int lastRow)
  {
    printArea = new SheetRangeImpl(sheet, firstCol, firstRow, 
                                   lastCol, lastRow);
  }

  /**
   * Accessor for the print area
   *
   * @return the print area, or NULL if one is not defined for this sheet
   */
01276   public Range getPrintArea()
  {
    return printArea;
  }

  /**
   * Sets both of the print titles for this sheet
   *
   * @param firstRow the first row of the print row titles
   * @param lastRow the last row of the print row titles
   * @param firstCol the first column of the print column titles
   * @param lastCol the last column of the print column titles
   */
01289   public void setPrintTitles(int firstRow, 
                             int lastRow,  
                             int firstCol,
                             int lastCol)
  {
    setPrintTitlesRow(firstRow, lastRow);
    setPrintTitlesCol(firstCol, lastCol);
  }

  /**
   * Sets the print row titles for this sheet
   *
   * @param firstRow the first row of the print titles
   * @param lastRow the last row of the print titles
   */
01304   public void setPrintTitlesRow(int firstRow, 
                                    int lastRow)
  {
    printTitlesRow = new SheetRangeImpl(sheet, 0, firstRow, 
                                                           255, lastRow);
  }
  
  /**
   * Sets the print column titles for this sheet
   *
   * @param firstRow the first row of the print titles
   * @param lastRow the last row of the print titles
   */
01317   public void setPrintTitlesCol(int firstCol, 
                                    int lastCol)
  {
    printTitlesCol = new SheetRangeImpl(sheet, firstCol, 0, 
                                                    lastCol, 65535);
  }
  
  /**
   * Accessor for the print row titles
   *
   * @return the print row titles, or NULL if one is not defined for this sheet
   */
01329   public Range getPrintTitlesRow()
  {
    return printTitlesRow;
  }
  
  /**
   * Accessor for the print column titles
   *
   * @return the print column titles, or NULL if one is not defined for this 
   * sheet
   */
01340   public Range getPrintTitlesCol()
  {
    return printTitlesCol;
  }
}

Generated by  Doxygen 1.6.0   Back to index