001package com.hfg.xml.msofficexml.docx.drawingml.font;
002
003
004
005import com.hfg.xml.XMLTag;
006import com.hfg.xml.msofficexml.OfficeOpenXMLTag;
007import com.hfg.xml.msofficexml.OfficeOpenXmlDocument;
008import com.hfg.xml.msofficexml.docx.drawingml.DmlXML;
009
010//------------------------------------------------------------------------------
011/**
012 Represents an Office Open XML drawingml minor font (<a:minorFont>) tag.
013 <div>
014 @author J. Alex Taylor, hairyfatguy.com
015 </div>
016 */
017//------------------------------------------------------------------------------
018// com.hfg XML/HTML Coding Library
019//
020// This library is free software; you can redistribute it and/or
021// modify it under the terms of the GNU Lesser General Public
022// License as published by the Free Software Foundation; either
023// version 2.1 of the License, or (at your option) any later version.
024//
025// This library is distributed in the hope that it will be useful,
026// but WITHOUT ANY WARRANTY; without even the implied warranty of
027// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
028// Lesser General Public License for more details.
029//
030// You should have received a copy of the GNU Lesser General Public
031// License along with this library; if not, write to the Free Software
032// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
033//
034// J. Alex Taylor, President, Founder, CEO, COO, CFO, OOPS hairyfatguy.com
035// jataylor@hairyfatguy.com
036//------------------------------------------------------------------------------
037
038public class DmlMinorFont extends OfficeOpenXMLTag
039{
040   private XMLTag mLatinFont;
041   private XMLTag mEastAsianFont;
042   private XMLTag mComplexScriptFont;
043
044   // Default font values
045   private static String sDefaultLatinFont         = "Calibri";
046   private static String sDefaultEastAsianFont     = "";
047   private static String sDefaultComplexScriptFont = "";
048
049   //###########################################################################
050   // CONSTRUCTORS
051   //###########################################################################
052
053   //---------------------------------------------------------------------------
054   public DmlMinorFont(OfficeOpenXmlDocument inParentDoc)
055   {
056      super(DmlXML.MINOR_FONT, inParentDoc);
057      init();
058   }
059
060   //---------------------------------------------------------------------------
061   private void init()
062   {
063      setLatinFont(sDefaultLatinFont);
064      setEastAsianFont(sDefaultEastAsianFont);
065      setComplexScriptFont(sDefaultComplexScriptFont);
066   }
067
068   //###########################################################################
069   // PUBLIC METHODS
070   //###########################################################################
071
072   //---------------------------------------------------------------------------
073   public DmlMinorFont setLatinFont(String inTypeface)
074   {
075      if (null == mLatinFont)
076      {
077         mLatinFont = new XMLTag(DmlXML.LATIN_FONT);
078         addSubtag(mLatinFont);
079      }
080
081      mLatinFont.setAttribute(DmlXML.TYPEFACE_ATT, inTypeface);
082
083      return this;
084   }
085
086   //---------------------------------------------------------------------------
087   public DmlMinorFont setEastAsianFont(String inTypeface)
088   {
089      if (null == mEastAsianFont)
090      {
091         mEastAsianFont = new XMLTag(DmlXML.EAST_ASIAN_FONT);
092         addSubtag(mEastAsianFont);
093      }
094
095      mEastAsianFont.setAttribute(DmlXML.TYPEFACE_ATT, inTypeface);
096
097      return this;
098   }
099
100   //---------------------------------------------------------------------------
101   public DmlMinorFont setComplexScriptFont(String inTypeface)
102   {
103      if (null == mComplexScriptFont)
104      {
105         mComplexScriptFont = new XMLTag(DmlXML.COMPLEX_SCRIPT_FONT);
106         addSubtag(mComplexScriptFont);
107      }
108
109      mComplexScriptFont.setAttribute(DmlXML.TYPEFACE_ATT, inTypeface);
110
111      return this;
112   }
113}