001package com.hfg.xml.msofficexml.docx.drawingml.fill;
002
003
004import java.awt.Color;
005
006import com.hfg.xml.msofficexml.docx.drawingml.DmlXML;
007import com.hfg.xml.msofficexml.docx.drawingml.color.DmlColor;
008import com.hfg.xml.msofficexml.docx.drawingml.color.DmlSRGBColor;
009
010//------------------------------------------------------------------------------
011/**
012 Represents a solid fill (<a:solidFill>) tag in drawing markup language (DML) from Office Open XML.
013
014 @author J. Alex Taylor, hairyfatguy.com
015 */
016//------------------------------------------------------------------------------
017// com.hfg XML/HTML Coding Library
018//
019// This library is free software; you can redistribute it and/or
020// modify it under the terms of the GNU Lesser General Public
021// License as published by the Free Software Foundation; either
022// version 2.1 of the License, or (at your option) any later version.
023//
024// This library is distributed in the hope that it will be useful,
025// but WITHOUT ANY WARRANTY; without even the implied warranty of
026// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
027// Lesser General Public License for more details.
028//
029// You should have received a copy of the GNU Lesser General Public
030// License along with this library; if not, write to the Free Software
031// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
032//
033// J. Alex Taylor, President, Founder, CEO, COO, CFO, OOPS hairyfatguy.com
034// jataylor@hairyfatguy.com
035//------------------------------------------------------------------------------
036
037/*
038  Ex:  <a:solidFill><a:srgbClr val="729fcf"/></a:solidFill>
039 */
040
041public class DmlSolidFill extends DmlFill
042{
043   private DmlColor mColorModel;
044
045   //###########################################################################
046   // CONSTRUCTORS
047   //###########################################################################
048
049   //---------------------------------------------------------------------------
050   public DmlSolidFill()
051   {
052      super(DmlXML.SOLID_FILL);
053   }
054
055   //---------------------------------------------------------------------------
056   public DmlSolidFill(Color inColor)
057   {
058      this();
059      if (inColor != null)
060      {
061         setColorModel(new DmlSRGBColor(inColor));
062      }
063   }
064
065   //---------------------------------------------------------------------------
066   public DmlSolidFill(DmlColor inColorModel)
067   {
068      this();
069      if (inColorModel != null)
070      {
071         setColorModel(inColorModel);
072      }
073   }
074
075   //###########################################################################
076   // PUBLIC METHODS
077   //###########################################################################
078
079   //---------------------------------------------------------------------------
080   public DmlSolidFill setColorModel(DmlColor inColorModel)
081   {
082      if (mColorModel != null)
083      {
084         removeSubtag(mColorModel);
085      }
086
087      mColorModel = inColorModel;
088      addSubtag(mColorModel);
089
090      return this;
091   }
092}