/************************************************************************
*
* MetaData.java
*
* Copyright: 2002-2014 by Henrik Just
*
* This file is part of Writer2LaTeX.
*
* Writer2LaTeX is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Writer2LaTeX is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Writer2LaTeX. If not, see
This class represents the metadata of an OOo Writer document.
*/ public class MetaData implements writer2latex.api.MetaData { // Dublin Core private String sTitle = ""; private String sCreator = ""; private String sInitialCreator = ""; private String sDate = ""; private String sDescription = ""; private String sLanguage = ""; private String sSubject = ""; // Keywords private String sKeywords = ""; // User-defined private MapConstruct a new instance from an OOo Writer document.
* @param oooDoc is the OOo document */ public MetaData(OfficeDocument oooDoc) { // get the DOM (either package or flat) Document dom = oooDoc.getMetaDOM(); if (dom==null) { dom = oooDoc.getContentDOM(); } // get the office:meta element NodeList list = dom.getElementsByTagName(XMLString.OFFICE_META); if (list.getLength() == 0) { return; } // oops, no metadata - fails silently Node meta = list.item(0); if (!meta.hasChildNodes()) { return; } // traverse the metadata CSVList keywords = new CSVList(", "); list = meta.getChildNodes(); int nLen = list.getLength(); for (int i=0; iGet the creator of this document (may be empty)
* @return the creator of the document (or the initial creator if none is specified) */ public String getCreator() { return sCreator==null ? sInitialCreator : sCreator; } /**Get the initial creator of this document (may be empty)
* @return the initial creator of the document */ public String getInitialCreator() { return sInitialCreator; } /**Get the date of this document (may be empty)
* @return the date of the document */ public String getDate() { return sDate; } /**Get the description of this document (may be empty)
* @return the description of the document */ public String getDescription() { return sDescription; } /**Get the language of this document (may be empty)
* @return the language of the document */ public String getLanguage() { return sLanguage; } public void setLanguage(String sLanguage) { this.sLanguage = sLanguage; } /**Get the subject of this document (may be empty)
* @return the subject of the document */ public String getSubject() { return sSubject; } /**Get the keywords of this document as a comma separated list (may be epmty)
* @return the keywords of the document */ public String getKeywords() { return sKeywords; } /** Get the user-defined meta data * * @return the user-defined meta data as a name-value map */ public Map