001package com.hfg.xml.msofficexml.docx.drawingml; 002 003 004import com.hfg.xml.msofficexml.docx.Docx; 005import com.hfg.xml.msofficexml.docx.drawingml.text.DmlTextBody; 006import com.hfg.xml.msofficexml.docx.wordprocessingml.WmlXMLTag; 007 008public class DmlShape extends WmlXMLTag 009{ 010 private DmlNonVisualShapeDrawingProperties mDmlNonVisualShapeDrawingProperties; 011 private DmlTextBody mTextBox; 012 013 //--------------------------------------------------------------------------- 014 public DmlShape(Docx inDocx) 015 { 016 super(DmlXML.SHAPE, inDocx); 017 } 018 019 //--------------------------------------------------------------------------- 020 /** 021 * Returns the non-visual shape drawing properties (<p:nvSpPr>) tag if one exists or else instantiates a new one. 022 * @return the non-visual shape drawing properties (<p:nvSpPr>) for this shape tag 023 */ 024 public DmlNonVisualShapeDrawingProperties getNonVisualShapeDrawingProperties() 025 { 026 if (null == mDmlNonVisualShapeDrawingProperties) 027 { 028 // Check if it has been added via addSubtag()... 029 mDmlNonVisualShapeDrawingProperties = getOptionalSubtagByName(DmlXML.NON_VISUAL_SHAPE_DRAWING_PROPS); 030 if (null == mDmlNonVisualShapeDrawingProperties) 031 { 032 mDmlNonVisualShapeDrawingProperties = new DmlNonVisualShapeDrawingProperties(getParentDoc()); 033 addSubtag(mDmlNonVisualShapeDrawingProperties); 034 } 035 } 036 037 return mDmlNonVisualShapeDrawingProperties; 038 } 039 040 //--------------------------------------------------------------------------- 041 public DmlTextBody getTextBox() 042 { 043 if (null == mTextBox) 044 { 045 // Check if it has been added via addSubtag()... 046 mTextBox = getOptionalSubtagByName(DmlXML.TEXT_BODY); 047 if (null == mTextBox) 048 { 049 mTextBox = new DmlTextBody(getParentDoc()); 050 addSubtag(mTextBox); 051 } 052 } 053 054 return mTextBox; 055 } 056 057}