001package com.hfg.xml.msofficexml.part; 002 003 004import com.hfg.xml.XMLTag; 005import com.hfg.xml.msofficexml.OfficeXML; 006import com.hfg.xml.msofficexml.docx.Docx; 007import com.hfg.xml.msofficexml.docx.wordprocessingml.WmlComments; 008import com.hfg.xml.msofficexml.docx.wordprocessingml.WmlParagraph; 009import com.hfg.xml.msofficexml.docx.wordprocessingml.WmlXML; 010 011//------------------------------------------------------------------------------ 012/** 013 Represents an Office Open XML comments part. 014 015 @author J. Alex Taylor, hairyfatguy.com 016 */ 017//------------------------------------------------------------------------------ 018// com.hfg XML/HTML Coding Library 019// 020// This library is free software; you can redistribute it and/or 021// modify it under the terms of the GNU Lesser General Public 022// License as published by the Free Software Foundation; either 023// version 2.1 of the License, or (at your option) any later version. 024// 025// This library is distributed in the hope that it will be useful, 026// but WITHOUT ANY WARRANTY; without even the implied warranty of 027// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 028// Lesser General Public License for more details. 029// 030// You should have received a copy of the GNU Lesser General Public 031// License along with this library; if not, write to the Free Software 032// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 033// 034// J. Alex Taylor, President, Founder, CEO, COO, CFO, OOPS hairyfatguy.com 035// [email protected] 036//------------------------------------------------------------------------------ 037 038public class CommentsPart extends OfficeXMLPart 039{ 040 041 //--------------------------------------------------------------------------- 042 public CommentsPart(Docx inDocx) 043 { 044 super(inDocx); 045 setFile(WmlXML.COMMENTS_FILE); 046 047 XMLTag rootNode = new WmlComments(); 048 rootNode.addXMLNamespaceDeclaration(WmlXML.WORDPROCESSINGML_NAMESPACE); 049 rootNode.addXMLNamespaceDeclaration(OfficeXML.OFFICE_NAMESPACE); 050 setRootNode(rootNode); 051 } 052 053 //--------------------------------------------------------------------------- 054 /** 055 Convenience short cut method. 056 */ 057 public int addComment(WmlParagraph inValue) 058 { 059 return ((WmlComments)getRootNode()).addComment(inValue); 060 } 061}