com.hfg.xml.msofficexml.docx.wordprocessingml.WmlNumberingLevelDef 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.docx.wordprocessingml;
import com.hfg.xml.XMLName;
import com.hfg.xml.XMLTag;
import com.hfg.xml.msofficexml.docx.Docx;
import com.hfg.xml.msofficexml.docx.wordprocessingml.style.WmlJustification;
//------------------------------------------------------------------------------
/**
Represents an Office Open XML document numbering level (<w:lvl>) 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 WmlNumberingLevelDef extends WmlXMLTag
{
private WmlParagraphProperties mParagraphProperties;
private WmlTextRunProperties mRunProperties;
//###########################################################################
// CONSTRUCTORS
//###########################################################################
//---------------------------------------------------------------------------
public WmlNumberingLevelDef(Docx inDocx)
{
super(WmlXML.LEVEL, inDocx);
}
//###########################################################################
// PUBLIC METHODS
//###########################################################################
//---------------------------------------------------------------------------
public WmlNumberingLevelDef setLevel(int inValue)
{
setAttribute(WmlXML.NUMBERING_LEVEL_ATT, inValue);
return this;
}
//---------------------------------------------------------------------------
public WmlNumberingLevelDef setTentative(boolean inValue)
{
setAttribute(WmlXML.TENTATIVE_ATT, inValue ? 1 : 0);
return this;
}
//---------------------------------------------------------------------------
public WmlNumberingLevelDef setStartingValue(int inValue)
{
XMLTag tag = getOptionalSubtagByName(WmlXML.START);
if (null == tag)
{
tag = new WmlXMLTag(WmlXML.START, getParentDoc());
addSubtag(tag);
}
tag.setAttribute(WmlXML.VALUE_ATT, inValue);
return this;
}
//---------------------------------------------------------------------------
public WmlNumberingLevelDef setNumberingFormat(WmlNumberingFormat inValue)
{
XMLName tagName = WmlXML.NUMBERING_FORMAT;
XMLTag tag = getOptionalSubtagByName(tagName);
if (null == tag)
{
tag = new WmlXMLTag(tagName, getParentDoc());
addSubtag(tag);
}
tag.setAttribute(WmlXML.VALUE_ATT, inValue);
return this;
}
//---------------------------------------------------------------------------
public WmlNumberingFormat getNumberingFormat()
{
WmlNumberingFormat value = null;
XMLTag tag = getOptionalSubtagByName(WmlXML.NUMBERING_FORMAT);
if (tag != null)
{
value = WmlNumberingFormat.valueOf(tag.getAttributeValue(WmlXML.VALUE_ATT));
}
return value;
}
//---------------------------------------------------------------------------
public WmlNumberingLevelDef setLevelText(String inValue)
{
XMLName tagName = WmlXML.LEVEL_TEXT;
XMLTag tag = getOptionalSubtagByName(tagName);
if (null == tag)
{
tag = new WmlXMLTag(tagName, getParentDoc());
addSubtag(tag);
}
tag.setAttribute(WmlXML.VALUE_ATT, inValue);
return this;
}
//---------------------------------------------------------------------------
public WmlNumberingLevelDef setJustification(WmlJustification inValue)
{
XMLName tagName = WmlXML.LEVEL_JUSTIFICATION;
XMLTag tag = getOptionalSubtagByName(tagName);
if (null == tag)
{
tag = new WmlXMLTag(tagName, getParentDoc());
addSubtag(tag);
}
tag.setAttribute(WmlXML.VALUE_ATT, inValue);
return this;
}
//---------------------------------------------------------------------------
public WmlTextRunProperties getTextRunProperties()
{
if (null == mRunProperties)
{
// Check it it has been added via addSubtag()...
mRunProperties = getOptionalSubtagByName(WmlXML.RUN_PROPS);
if (null == mRunProperties)
{
mRunProperties = new WmlTextRunProperties(getParentDoc());
addSubtag(mRunProperties);
}
}
return mRunProperties;
}
//---------------------------------------------------------------------------
public WmlParagraphProperties getParagraphProperties()
{
if (null == mParagraphProperties)
{
// Check it it has been added via addSubtag()...
mParagraphProperties = getOptionalSubtagByName(WmlXML.PARAGRAPH_PROPS);
if (null == mParagraphProperties)
{
mParagraphProperties = new WmlParagraphProperties(getParentDoc());
addSubtag(mParagraphProperties);
}
}
return mParagraphProperties;
}
}