All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.hfg.xml.msofficexml.docx.drawingml.DmlShapeProperties Maven / Gradle / Ivy

There is a newer version: 20240423
Show newest version
package com.hfg.xml.msofficexml.docx.drawingml;


import com.hfg.xml.XMLTag;
import com.hfg.xml.msofficexml.OfficeOpenXMLTag;
import com.hfg.xml.msofficexml.OfficeOpenXmlDocument;
import com.hfg.xml.msofficexml.docx.drawingml.fill.DmlFill;
import com.hfg.xml.msofficexml.docx.drawingml.line.DmlLine;

//------------------------------------------------------------------------------
/**
 Represents an Office Open XML drawingml shape properties (<a:shPr>) 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 DmlShapeProperties extends OfficeOpenXMLTag { private DmlTransform mTransform; private DmlPresetGeometry mPresetGeometry; private XMLTag mFillTag; private DmlLine mLine; //--------------------------------------------------------------------------- public DmlShapeProperties(OfficeOpenXmlDocument inParentDoc) { super(DmlXML.SHAPE_PROPS, inParentDoc); init(); } //--------------------------------------------------------------------------- private void init() { setBWMode(DmlBlackWhiteMode.auto); getTransform(); } //--------------------------------------------------------------------------- public DmlShapeProperties setBWMode(DmlBlackWhiteMode inValue) { setAttribute(DmlXML.BLACK_WHITE_MODE_ATT, inValue.name()); return this; } //--------------------------------------------------------------------------- /** * Returns the transform tag if one exists or else instantiates a new one. * @return the transform tag for this shape properties tag */ public DmlTransform getTransform() { if (null == mTransform) { // Check if it has been added via addSubtag()... mTransform = getOptionalSubtagByName(DmlXML.TRANSFORM_2D); if (null == mTransform) { mTransform = new DmlTransform(); addSubtag(mTransform); } } return mTransform; } //--------------------------------------------------------------------------- /** * Returns the preset geometry tag if one exists or else instantiates a new one. * @return the preset geometry tag for this shape properties tag */ public DmlPresetGeometry getPresetGeometry() { if (null == mPresetGeometry) { // Check if it has been added via addSubtag()... mPresetGeometry = getOptionalSubtagByName(DmlXML.PRESET_GEOMETRY); if (null == mPresetGeometry) { mPresetGeometry = new DmlPresetGeometry(); addSubtag(mPresetGeometry); } } return mPresetGeometry; } //--------------------------------------------------------------------------- /** * Specifies the fill type that should be used for the shape. */ public DmlShapeProperties setFill(DmlFill inValue) { if (mFillTag != null) { removeSubtag(mFillTag); } mFillTag = inValue; addSubtag(mFillTag); return this; } //--------------------------------------------------------------------------- /** * Returns the line tag if one exists or else instantiates a new one. * @return the line tag for this shape properties tag */ public DmlLine getLine() { if (null == mLine) { // Check if it has been added via addSubtag()... mLine = getOptionalSubtagByName(DmlXML.LINE); if (null == mLine) { mLine = new DmlLine(getParentDoc()); addSubtag(mLine); } } return mLine; } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy