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