001package com.hfg.xml.msofficexml.docx.drawingml.font; 002 003 004 005import com.hfg.xml.msofficexml.OfficeOpenXMLTag; 006import com.hfg.xml.msofficexml.OfficeOpenXmlDocument; 007import com.hfg.xml.msofficexml.docx.drawingml.DmlXML; 008 009//------------------------------------------------------------------------------ 010/** 011 Represents an Office Open XML drawingml font scheme (<a:fontScheme>) tag. 012 <div> 013 @author J. Alex Taylor, hairyfatguy.com 014 </div> 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 037public class DmlFontScheme extends OfficeOpenXMLTag 038{ 039 private DmlMajorFont mMajorFont; 040 private DmlMinorFont mMinorFont; 041 042 //########################################################################### 043 // CONSTRUCTORS 044 //########################################################################### 045 046 //--------------------------------------------------------------------------- 047 public DmlFontScheme(OfficeOpenXmlDocument inParentDoc) 048 { 049 super(DmlXML.FONT_SCHEME, inParentDoc); 050 init(); 051 } 052 053 //--------------------------------------------------------------------------- 054 private void init() 055 { 056 getMajorFont(); 057 getMinorFont(); 058 } 059 060 //########################################################################### 061 // PUBLIC METHODS 062 //########################################################################### 063 064 //--------------------------------------------------------------------------- 065 public DmlFontScheme setName(String inValue) 066 { 067 setAttribute(DmlXML.NAME_ATT, inValue); 068 return this; 069 } 070 071 //--------------------------------------------------------------------------- 072 /** 073 * Returns the major font tag. 074 * @return the major font tag 075 */ 076 public DmlMajorFont getMajorFont() 077 { 078 if (null == mMajorFont) 079 { 080 // Check if it has been added via addSubtag()... 081 mMajorFont = getOptionalSubtagByName(DmlXML.MAJOR_FONT); 082 if (null == mMajorFont) 083 { 084 mMajorFont = new DmlMajorFont(getParentDoc()); 085 addSubtag(mMajorFont); 086 } 087 } 088 089 return mMajorFont; 090 } 091 092 //--------------------------------------------------------------------------- 093 /** 094 * Returns the minor font tag. 095 * @return the minor font tag 096 */ 097 public DmlMinorFont getMinorFont() 098 { 099 if (null == mMinorFont) 100 { 101 // Check if it has been added via addSubtag()... 102 mMinorFont = getOptionalSubtagByName(DmlXML.MINOR_FONT); 103 if (null == mMinorFont) 104 { 105 mMinorFont = new DmlMinorFont(getParentDoc()); 106 addSubtag(mMinorFont); 107 } 108 } 109 110 return mMinorFont; 111 } 112 113}