001package com.hfg.xml.msofficexml.docx.wordprocessingml.style;
002
003
004import com.hfg.xml.msofficexml.docx.Docx;
005import com.hfg.xml.msofficexml.docx.wordprocessingml.WmlParagraphProperties;
006import com.hfg.xml.msofficexml.docx.wordprocessingml.WmlTableCellProperties;
007import com.hfg.xml.msofficexml.docx.wordprocessingml.WmlTextRunProperties;
008import com.hfg.xml.msofficexml.docx.wordprocessingml.WmlXML;
009import com.hfg.xml.msofficexml.docx.wordprocessingml.WmlXMLTag;
010
011public class WmlTableStyleProperties extends WmlXMLTag
012{
013   private WmlParagraphProperties mParagraphProperties;
014   private WmlTextRunProperties mRunProperties;
015   private WmlTableCellProperties mTableCellProperties;
016
017
018   public enum Type  /* ST_TblStyleOverrideType */
019   {
020      wholeTable,
021      firstRow,
022      lastRow,
023      firstCol,
024      lastCol,
025      band1Vert,
026      band2Vert,
027      band1Horz,
028      band2Horz,
029      neCell,
030      nwCell,
031      seCell,
032      swCell
033   }
034
035
036   //---------------------------------------------------------------------------
037   public WmlTableStyleProperties(Type inType, Docx inDocx)
038   {
039      super(WmlXML.TABLE_STYLE_PROPS, inDocx);
040      setAttribute(WmlXML.TYPE_ATT, inType);
041   }
042
043
044   //---------------------------------------------------------------------------
045   public WmlTextRunProperties getTextRunProperties()
046   {
047      if (null == mRunProperties)
048      {
049         // Check it it has been added via addSubtag()...
050         mRunProperties = getOptionalSubtagByName(WmlXML.RUN_PROPS);
051         if (null == mRunProperties)
052         {
053            mRunProperties = new WmlTextRunProperties(getParentDoc());
054            addSubtag(mRunProperties);
055         }
056      }
057
058      return mRunProperties;
059   }
060
061
062   //---------------------------------------------------------------------------
063   public WmlParagraphProperties getParagraphProperties()
064   {
065      if (null == mParagraphProperties)
066      {
067         // Check it it has been added via addSubtag()...
068         mParagraphProperties = getOptionalSubtagByName(WmlXML.PARAGRAPH_PROPS);
069         if (null == mParagraphProperties)
070         {
071            mParagraphProperties = new WmlParagraphProperties(getParentDoc());
072            addSubtag(mParagraphProperties);
073         }
074      }
075
076      return mParagraphProperties;
077   }
078
079   //---------------------------------------------------------------------------
080   public WmlTableCellProperties getTableCellProperties()
081   {
082      if (null == mTableCellProperties)
083      {
084         // Check it it has been added via addSubtag()...
085         mTableCellProperties = (WmlTableCellProperties) getOptionalSubtagByName(WmlXML.TABLE_CELL_PROPS);
086         if (null == mTableCellProperties)
087         {
088            mTableCellProperties = new WmlTableCellProperties(getParentDoc());
089            addSubtag(mTableCellProperties);
090         }
091      }
092
093      return mTableCellProperties;
094   }
095}
096