001package com.hfg.xml.msofficexml.docx.drawingml.text; 002 003 004import com.hfg.xml.XMLTag; 005import com.hfg.xml.msofficexml.OfficeXML; 006import com.hfg.xml.msofficexml.docx.drawingml.DmlXML; 007 008//------------------------------------------------------------------------------ 009/** 010 Represents an Office Open XML DrawingMl text (<a:t>) tag. 011 012 @author J. Alex Taylor, hairyfatguy.com 013 */ 014//------------------------------------------------------------------------------ 015// com.hfg XML/HTML Coding Library 016// 017// This library is free software; you can redistribute it and/or 018// modify it under the terms of the GNU Lesser General Public 019// License as published by the Free Software Foundation; either 020// version 2.1 of the License, or (at your option) any later version. 021// 022// This library is distributed in the hope that it will be useful, 023// but WITHOUT ANY WARRANTY; without even the implied warranty of 024// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 025// Lesser General Public License for more details. 026// 027// You should have received a copy of the GNU Lesser General Public 028// License along with this library; if not, write to the Free Software 029// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 030// 031// J. Alex Taylor, President, Founder, CEO, COO, CFO, OOPS hairyfatguy.com 032// jataylor@hairyfatguy.com 033//------------------------------------------------------------------------------ 034 035public class DmlText extends XMLTag 036{ 037 //--------------------------------------------------------------------------- 038 public DmlText() 039 { 040 super(DmlXML.TEXT); 041 } 042 043 //--------------------------------------------------------------------------- 044 @Override 045 public DmlText setContent(CharSequence inText) 046 { 047 clearContent(); 048 049 addContent(inText); 050 051 return this; 052 } 053 054 //--------------------------------------------------------------------------- 055 @Override 056 public DmlText addContent(CharSequence inText) 057 { 058 if (inText != null 059 && (inText.toString().startsWith(" ") 060 || inText.toString().endsWith(" "))) 061 { 062 setAttribute(OfficeXML.SPACE, "preserve"); 063 } 064 065 return (DmlText) super.addContent(inText); 066 } 067}