/************************************************************************
*
* LoftReader.java
*
* Copyright: 2002-2008 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
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; }
}