com.hfg.xml.msofficexml.xlsx.spreadsheetDrawing.SsDrawShapeStyle 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.spreadsheetDrawing;
import com.hfg.xml.msofficexml.docx.drawingml.DmlXML;
import com.hfg.xml.msofficexml.docx.drawingml.color.DmlSchemeColor;
import com.hfg.xml.msofficexml.docx.drawingml.color.DmlSchemeColorValue;
import com.hfg.xml.msofficexml.docx.drawingml.effect.DmlEffectRef;
import com.hfg.xml.msofficexml.docx.drawingml.fill.DmlFillRef;
import com.hfg.xml.msofficexml.docx.drawingml.font.DmlFontCollectionIndex;
import com.hfg.xml.msofficexml.docx.drawingml.font.DmlFontRef;
import com.hfg.xml.msofficexml.docx.drawingml.line.DmlLineRef;
import com.hfg.xml.msofficexml.xlsx.Xlsx;
import com.hfg.xml.msofficexml.xlsx.spreadsheetml.SsmlXMLTag;
//------------------------------------------------------------------------------
/**
Represents an Office Open XML worksheet drawing shape style (<xdr:style>) 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 SsDrawShapeStyle extends SsmlXMLTag
{
private DmlLineRef mLineRef;
private DmlFillRef mFillRef;
private DmlEffectRef mEffectRef;
private DmlFontRef mFontRef;
//---------------------------------------------------------------------------
public SsDrawShapeStyle(Xlsx inXlsx)
{
super(SsDrawXML.STYLE, inXlsx);
init();
}
//---------------------------------------------------------------------------
private void init()
{
// Be sure that the styles part is initialized
getParentDoc().getStylesPart();
// Initialize reference tags
getLineRef().setIndex(0).setColorModel(new DmlSchemeColor(DmlSchemeColorValue.accentColor1));
getFillRef().setIndex(0).setColorModel(new DmlSchemeColor(DmlSchemeColorValue.accentColor1));
getEffectRef().setIndex(0).setColorModel(new DmlSchemeColor(DmlSchemeColorValue.accentColor1));
getFontRef().setIndex(DmlFontCollectionIndex.minor).setColorModel(new DmlSchemeColor(DmlSchemeColorValue.lightColor1));
}
//---------------------------------------------------------------------------
/**
* Returns the line reference (<a:lnRef>) tag.
* @return the line reference (<a:lnRef>) for this shape tag
*/
public DmlLineRef getLineRef()
{
if (null == mLineRef)
{
// Check if it has been added via addSubtag()...
mLineRef = getOptionalSubtagByName(DmlXML.LINE_REF);
if (null == mLineRef)
{
mLineRef = new DmlLineRef();
addSubtag(mLineRef);
}
}
return mLineRef;
}
//---------------------------------------------------------------------------
/**
* Returns the fill reference (<a:fillRef>) tag.
* @return the fill reference (<a:fillRef>) for this shape tag
*/
public DmlFillRef getFillRef()
{
if (null == mFillRef)
{
// Check if it has been added via addSubtag()...
mFillRef = getOptionalSubtagByName(DmlXML.FILL_REF);
if (null == mFillRef)
{
mFillRef = new DmlFillRef();
addSubtag(mFillRef);
}
}
return mFillRef;
}
//---------------------------------------------------------------------------
/**
* Returns the effect reference (<a:effectRef>) tag.
* @return the effect reference (<a:effectRef>) for this shape tag
*/
public DmlEffectRef getEffectRef()
{
if (null == mEffectRef)
{
// Check if it has been added via addSubtag()...
mEffectRef = getOptionalSubtagByName(DmlXML.EFFECT_REF);
if (null == mEffectRef)
{
mEffectRef = new DmlEffectRef();
addSubtag(mEffectRef);
}
}
return mEffectRef;
}
//---------------------------------------------------------------------------
/**
* Returns the font reference (<a:fontRef>) tag.
* @return the font reference (<a:fontRef>) for this shape tag
*/
public DmlFontRef getFontRef()
{
if (null == mFontRef)
{
// Check if it has been added via addSubtag()...
mFontRef = getOptionalSubtagByName(DmlXML.FONT_REF);
if (null == mFontRef)
{
mFontRef = new DmlFontRef();
addSubtag(mFontRef);
}
}
return mFontRef;
}
}