001package com.hfg.xml.msofficexml.part; 002 003import com.hfg.xml.XMLTag; 004import com.hfg.xml.msofficexml.docx.drawingml.theme.DmlTheme; 005import com.hfg.xml.msofficexml.xlsx.Xlsx; 006 007//------------------------------------------------------------------------------ 008/** 009 Base class for Office Open XML theme parts. 010 011 @author J. Alex Taylor, hairyfatguy.com 012 */ 013//------------------------------------------------------------------------------ 014// com.hfg XML/HTML Coding Library 015// 016// This library is free software; you can redistribute it and/or 017// modify it under the terms of the GNU Lesser General Public 018// License as published by the Free Software Foundation; either 019// version 2.1 of the License, or (at your option) any later version. 020// 021// This library is distributed in the hope that it will be useful, 022// but WITHOUT ANY WARRANTY; without even the implied warranty of 023// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 024// Lesser General Public License for more details. 025// 026// You should have received a copy of the GNU Lesser General Public 027// License along with this library; if not, write to the Free Software 028// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 029// 030// J. Alex Taylor, President, Founder, CEO, COO, CFO, OOPS hairyfatguy.com 031// jataylor@hairyfatguy.com 032//------------------------------------------------------------------------------ 033 034public abstract class ThemePart extends OfficeXMLPart 035{ 036 //########################################################################### 037 // PRIVATE FIELDS 038 //########################################################################### 039 040 private int mThemeIndex; 041 042 //########################################################################### 043 // CONSTRUCTORS 044 //########################################################################### 045 046 //--------------------------------------------------------------------------- 047 public ThemePart(Xlsx inParentDoc) 048 { 049 super(inParentDoc); 050 051 XMLTag rootNode = new DmlTheme(this); 052 053 setRootNode(rootNode); 054 } 055 056 //########################################################################### 057 // PUBLIC METHODS 058 //########################################################################### 059 060 //--------------------------------------------------------------------------- 061 public ThemePart setThemeIndex(int inValue) 062 { 063 mThemeIndex = inValue; 064 return this; 065 } 066 067 //--------------------------------------------------------------------------- 068 public int getThemeIndex() 069 { 070 return mThemeIndex; 071 } 072 073 //--------------------------------------------------------------------------- 074 @Override 075 public DmlTheme getRootNode() 076 { 077 DmlTheme rootNode = (DmlTheme) super.getRootNode(); 078 if (null == rootNode) 079 { 080 rootNode = new DmlTheme(this); 081 setRootNode(rootNode); 082 } 083 084 return rootNode; 085 } 086 087}