2010-03-29 11:07:24 +00:00
|
|
|
/************************************************************************
|
|
|
|
*
|
|
|
|
* EPUBConverter.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
|
|
|
|
*
|
2014-09-06 19:19:17 +00:00
|
|
|
* Copyright: 2001-2014 by Henrik Just
|
2010-03-29 11:07:24 +00:00
|
|
|
*
|
|
|
|
* All Rights Reserved.
|
|
|
|
*
|
2014-09-25 15:17:30 +00:00
|
|
|
* version 1.4 (2014-09-24)
|
2010-03-29 11:07:24 +00:00
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
package writer2latex.epub;
|
|
|
|
|
|
|
|
import java.io.IOException;
|
|
|
|
import java.io.InputStream;
|
|
|
|
|
|
|
|
import writer2latex.api.ConverterResult;
|
|
|
|
import writer2latex.base.ConverterResultImpl;
|
|
|
|
import writer2latex.xhtml.Xhtml11Converter;
|
|
|
|
|
|
|
|
|
|
|
|
/** This class converts an OpenDocument file to an EPUB document.
|
|
|
|
*/
|
|
|
|
public final class EPUBConverter extends Xhtml11Converter {
|
|
|
|
|
|
|
|
// Constructor
|
|
|
|
public EPUBConverter() {
|
|
|
|
super();
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override public ConverterResult convert(InputStream is, String sTargetFileName) throws IOException {
|
2010-03-31 07:25:24 +00:00
|
|
|
setOPS(true);
|
2011-02-20 16:06:55 +00:00
|
|
|
ConverterResult xhtmlResult = super.convert(is, "chapter");
|
2014-09-06 19:19:17 +00:00
|
|
|
return createPackage(xhtmlResult,sTargetFileName);
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override public ConverterResult convert(org.w3c.dom.Document dom, String sTargetFileName, boolean bDestructive) throws IOException {
|
|
|
|
setOPS(true);
|
|
|
|
ConverterResult xhtmlResult = super.convert(dom, "chapter", bDestructive);
|
|
|
|
return createPackage(xhtmlResult,sTargetFileName);
|
|
|
|
}
|
|
|
|
|
|
|
|
private ConverterResult createPackage(ConverterResult xhtmlResult, String sTargetFileName) {
|
2010-03-29 11:07:24 +00:00
|
|
|
ConverterResultImpl epubResult = new ConverterResultImpl();
|
2010-12-16 09:22:24 +00:00
|
|
|
epubResult.addDocument(new EPUBWriter(xhtmlResult,sTargetFileName,getXhtmlConfig()));
|
2010-03-29 11:07:24 +00:00
|
|
|
epubResult.setMetaData(xhtmlResult.getMetaData());
|
|
|
|
return epubResult;
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|