/************************************************************************ * * LoftReader.java * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License version 2.1, as published by the Free Software Foundation. * * This library 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, * MA 02111-1307 USA * * Copyright: 2002-2008 by Henrik Just * * All Rights Reserved. * * Version 1.0 (2008-11-22) * */ package writer2latex.office; //import java.util.Hashtable; //import java.util.Set; import org.w3c.dom.Element; //import org.w3c.dom.Node; import writer2latex.util.Misc; /** *
The class reads a text:illustration-index
or
* text:table-index
element.
Initialize the LoftReader with a illustration/table index node
* @param onode a text:*-index
*/
public LoftReader(Element onode) {
bIsTableIndex = onode.getTagName().equals(XMLString.TEXT_TABLE_INDEX);
sName = Misc.getAttribute(onode,XMLString.TEXT_NAME);
sStyleName = Misc.getAttribute(onode,XMLString.TEXT_STYLE_NAME);
loftSource = bIsTableIndex ?
Misc.getChildByTagName(onode,XMLString.TEXT_TABLE_INDEX_SOURCE) :
Misc.getChildByTagName(onode,XMLString.TEXT_ILLUSTRATION_INDEX_SOURCE);
indexBody = Misc.getChildByTagName(onode,XMLString.TEXT_INDEX_BODY);
if (loftSource!=null) {
bUseCaption = !"false".equals(loftSource.getAttribute(XMLString.TEXT_USE_CAPTION));
sCaptionSequenceName = loftSource.getAttribute(XMLString.TEXT_CAPTION_SEQUENCE_NAME);
bIsByChapter = "chapter".equals(loftSource.getAttribute(XMLString.TEXT_INDEX_SCOPE));
indexTitleTemplate = Misc.getChildByTagName(loftSource,XMLString.TEXT_INDEX_TITLE_TEMPLATE);
loftEntryTemplate = bIsTableIndex ?
Misc.getChildByTagName(loftSource,XMLString.TEXT_TABLE_INDEX_ENTRY_TEMPLATE) :
Misc.getChildByTagName(loftSource,XMLString.TEXT_ILLUSTRATION_INDEX_ENTRY_TEMPLATE);
}
}
/**
Get the (section) name for this loft
* @return the name of the loft */ public String getName() { return sName; } /**Get the (section) style name for this loft
* @return name of the section style to use for this loft */ public String getStyleName() { return sStyleName; } /**Is this a table index or a figure index?
* @return true if it's a table index */ public boolean isTableIndex() { return bIsTableIndex; } /**Is this loft by chapter?
* @return true if the scope is a chapter only */ public boolean isByChapter() { return bIsByChapter; } /**Is this loft generated by captions? (otherwise: by object names)
* @return true if we use captions */ public boolean useCaption() { return bUseCaption; } /**Get the sequence name to use for the caption
* @return the name of the caption */ public String getCaptionSequenceName() { return sCaptionSequenceName; } /**Get the index title template for this loft
* @return thetext:index-title-template
element, or null
*/
public Element getIndexTitleTemplate() { return indexTitleTemplate; }
/** Get the entry template for this loft at a specific level
* @param nLevel the outline level * @return thetext:table-of-content-entry-template
element, or null
*/
public Element getLoftEntryTemplate(int nLevel) {
return loftEntryTemplate;
}
/** Return the generated content of this loft, if available
* @return thetext:index-body
element
*/
public Element getIndexBody() { return indexBody; }
}