com.hfg.xml.msofficexml.docx.drawingml.DmlBlipFill 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.drawingml;
import com.hfg.xml.msofficexml.docx.Docx;
import com.hfg.xml.msofficexml.docx.wordprocessingml.WmlXMLTag;
/**
From the ECMA-TC45 Primer: "BLIPs refer to Binary Large Image or Pictures. Blip Fills are made up of several components:
a Blip Reference, a Source Rectangle, and a Fill Mode."
*/
public class DmlBlipFill extends WmlXMLTag
{
private DmlStretch mStretch;
private DmlBlip mBlip;
private DmlSrcRect mSrcRect;
//---------------------------------------------------------------------------
public DmlBlipFill(Docx inDocx)
{
super(DmlXML.BLIP_FILL, inDocx);
init();
}
//---------------------------------------------------------------------------
private void init()
{
getSrcRect();
}
//---------------------------------------------------------------------------
/**
* Returns the stretch tag if one exists or else instantiates a new one.
* @return the stretch tag for this blipFill tag
*/
public DmlStretch getStretch()
{
if (null == mStretch)
{
// Check if it has been added via addSubtag()...
mStretch = (DmlStretch) getOptionalSubtagByName(DmlXML.STRETCH);
if (null == mStretch)
{
mStretch = new DmlStretch(getParentDoc());
addSubtag(mStretch);
}
}
return mStretch;
}
//---------------------------------------------------------------------------
/**
* Returns the source rectangle tag if one exists or else instantiates a new one.
* @return the source rectangle tag for this blipFill tag
*/
public DmlSrcRect getSrcRect()
{
if (null == mSrcRect)
{
// Check if it has been added via addSubtag()...
mSrcRect = (DmlSrcRect) getOptionalSubtagByName(DmlXML.SRC_RECT);
if (null == mSrcRect)
{
mSrcRect = new DmlSrcRect();
addSubtag(mSrcRect);
}
}
return mSrcRect;
}
//---------------------------------------------------------------------------
/**
* Returns the blip tag if one exists or else instantiates a new one.
* @return the blip tag for this blipFill tag
*/
public DmlBlip getBlip()
{
if (null == mBlip)
{
// Check if it has been added via addSubtag()...
mBlip = (DmlBlip) getOptionalSubtagByName(DmlXML.BLIP);
if (null == mBlip)
{
mBlip = new DmlBlip(getParentDoc());
addSubtag(0, mBlip);
}
}
return mBlip;
}
}