com.hfg.xml.msofficexml.xlsx.spreadsheetml.SsmlWorkbookProperties Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of com_hfg Show documentation
Show all versions of com_hfg Show documentation
com.hfg xml, html, svg, and bioinformatics utility library
package com.hfg.xml.msofficexml.xlsx.spreadsheetml;
import com.hfg.util.BooleanUtil;
import com.hfg.xml.XMLTag;
import com.hfg.xml.msofficexml.xlsx.Xlsx;
//------------------------------------------------------------------------------
/**
Represents an Office Open XML workbook properties (<ssml:workbookPr>) tag.
@author J. Alex Taylor, hairyfatguy.com
*/
//------------------------------------------------------------------------------
// com.hfg XML/HTML Coding Library
//
// 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
//
// J. Alex Taylor, President, Founder, CEO, COO, CFO, OOPS hairyfatguy.com
// [email protected]
//------------------------------------------------------------------------------
public class SsmlWorkbookProperties extends SsmlXMLTag
{
//##########################################################################
// CONSTRUCTORS
//##########################################################################
//---------------------------------------------------------------------------
public SsmlWorkbookProperties(Xlsx inXlsx)
{
super(SsmlXML.WORKBOOK_PROPS, inXlsx);
setDefaults();
}
//---------------------------------------------------------------------------
public SsmlWorkbookProperties(Xlsx inXlsx, XMLTag inPropertiesTag)
{
this(inXlsx);
if (inPropertiesTag.hasAttribute(SsmlXML.DATE1904_ATT))
{
set1904BasedDates(BooleanUtil.valueOf(inPropertiesTag.getAttributeValue(SsmlXML.DATE1904_ATT)));
}
if (inPropertiesTag.hasAttribute(SsmlXML.SHOW_INK_ANNOTATION_ATT))
{
setShowInkAnnotation(BooleanUtil.valueOf(inPropertiesTag.getAttributeValue(SsmlXML.SHOW_INK_ANNOTATION_ATT)));
}
if (inPropertiesTag.hasAttribute(SsmlXML.AUTO_COMPRESS_PICS_ATT))
{
setAutoCompressPictures(BooleanUtil.valueOf(inPropertiesTag.getAttributeValue(SsmlXML.AUTO_COMPRESS_PICS_ATT)));
}
}
//---------------------------------------------------------------------------
private void setDefaults()
{
set1904BasedDates(false);
setShowInkAnnotation(false);
setAutoCompressPictures(false);
}
//##########################################################################
// PUBLIC METHODS
//##########################################################################
//---------------------------------------------------------------------------
/**
Indicate that our dates are based on 01 Jan 1904 and not 01 Jan 1900.
* @param inValue whether or not dates are based on 01 Jan 1904
* @return this workbook properties object to enable method chaining
*/
public SsmlWorkbookProperties set1904BasedDates(boolean inValue)
{
setAttribute(SsmlXML.DATE1904_ATT, inValue ? "1" : "0");
return this;
}
//---------------------------------------------------------------------------
public boolean get1904BasedDates()
{
return BooleanUtil.valueOf(getAttributeValue(SsmlXML.DATE1904_ATT));
}
//---------------------------------------------------------------------------
public SsmlWorkbookProperties setShowInkAnnotation(boolean inValue)
{
setAttribute(SsmlXML.SHOW_INK_ANNOTATION_ATT, inValue ? "1" : "0");
return this;
}
//---------------------------------------------------------------------------
public boolean getShowInkAnnotation()
{
return BooleanUtil.valueOf(getAttributeValue(SsmlXML.SHOW_INK_ANNOTATION_ATT));
}
//---------------------------------------------------------------------------
public SsmlWorkbookProperties setAutoCompressPictures(boolean inValue)
{
setAttribute(SsmlXML.AUTO_COMPRESS_PICS_ATT, inValue ? "1" : "0");
return this;
}
//---------------------------------------------------------------------------
public boolean getAutoCompressPictures()
{
return BooleanUtil.valueOf(getAttributeValue(SsmlXML.AUTO_COMPRESS_PICS_ATT));
}
}