EPUB export + a bugfix

git-svn-id: svn://svn.code.sf.net/p/writer2latex/code/trunk@56 f0f2a975-2e09-46c8-9428-3b39399b9f3c
This commit is contained in:
henrikjust 2010-03-31 07:25:24 +00:00
parent ce61f7bc3b
commit 7644cf2eba
14 changed files with 122 additions and 81 deletions

View file

@ -20,7 +20,7 @@
*
* All Rights Reserved.
*
* Version 1.2 (2010-03-25)
* Version 1.2 (2010-03-31)
*
*/
@ -44,7 +44,6 @@ import org.w3c.dom.NodeList;
import org.w3c.dom.Text;
import writer2latex.api.Config;
import writer2latex.api.ContentEntry;
import writer2latex.api.ConverterFactory;
//import writer2latex.api.ConverterResult;
import writer2latex.base.ContentEntryImpl;
@ -83,6 +82,7 @@ public class Converter extends ConverterBase {
// The xhtml output file(s)
protected int nType = XhtmlDocument.XHTML10; // the doctype
private boolean bOPS = false; // Do we need to be OPS conforming?
Vector<XhtmlDocument> outFiles;
private int nOutFileIndex;
private XhtmlDocument htmlDoc; // current outfile
@ -157,15 +157,18 @@ public class Converter extends ConverterBase {
protected Node importNode(Node node, boolean bDeep) { return htmlDOM.importNode(node,bDeep); }
protected L10n getL10n() { return l10n; }
public void setOPS(boolean b) { bOPS = true; }
public boolean isOPS() { return bOPS; }
// override
public void convertInner() throws IOException {
@Override public void convertInner() throws IOException {
sTargetFileName = Misc.trimDocumentName(sTargetFileName,XhtmlDocument.getExtension(nType));
outFiles = new Vector<XhtmlDocument>();
nOutFileIndex = -1;
bNeedHeaderFooter = ofr.isSpreadsheet() || ofr.isPresentation() || config.getXhtmlSplitLevel()>0 || config.getXhtmlUplink().length()>0;
bNeedHeaderFooter = !bOPS && (ofr.isSpreadsheet() || ofr.isPresentation() || config.getXhtmlSplitLevel()>0 || config.getXhtmlUplink().length()>0);
l10n = new L10n();
@ -612,6 +615,8 @@ public class Converter extends ConverterBase {
}
else { // external link
anchor = htmlDOM.createElement("a");
sHref = ofr.fixRelativeLink(sHref);
// Workaround for an OOo problem:
if (sHref.indexOf("?")==-1) { // No question mark

View file

@ -20,7 +20,7 @@
*
* All Rights Reserved.
*
* Version 1.2 (2010-03-26)
* Version 1.2 (2010-03-29)
*
*/
@ -571,11 +571,14 @@ public class TextConverter extends ConverterHelper {
// Add to toc
if (!bInToc) {
converter.addTarget(heading,"toc"+(++nTocIndex));
String sTarget = "toc"+(++nTocIndex);
converter.addTarget(heading,sTarget);
// Add in external content
if (nLevel<=nSplit) {
converter.addContentEntry(sLabel+(sLabel.length()>0 ? " " : "")+Misc.getPCDATA(onode), nLevel, null);
// Add in external content. For single file output we include all level 1 headings + their target
// For multi-file output, the included heading levels depends on the split leve, and we don't include targets
if (nLevel<=Math.max(nSplit,1)) {
converter.addContentEntry(sLabel+(sLabel.length()>0 ? " " : "")+Misc.getPCDATA(onode), nLevel,
nSplit==0 ? sTarget : null);
}
// Add to real toc