diff --git a/build.gradle b/build.gradle
index 0e4cf7c..a5e4335 100644
--- a/build.gradle
+++ b/build.gradle
@@ -2,7 +2,7 @@ apply plugin: 'java'
repositories{
mavenCentral()
}
-def releaseVersion = "0.5.14"
+def releaseVersion = "0.6.2"
def propertyFile = file "src/main/java/w2phtml/project.properties"
Properties properties = new Properties()
propertyFile.withReader { properties.load(it) }
@@ -53,7 +53,6 @@ task xhtml(type: Jar) {
manifest {
attributes("Implementation-Title": rootProject.name,
"Implementation-Version": releaseVersion,
- "Built-By": "litvinovg",
"RegistrationClassName" : "org.openoffice.da.comp.writer2xhtml.W2XRegistration",
"Class-Path" : "jasp.jar parser.jar")
}
diff --git a/src/main/java/org/openoffice/da/comp/writer2xhtml/BatchConverter.java b/src/main/java/org/openoffice/da/comp/writer2xhtml/BatchConverter.java
deleted file mode 100644
index 98d719e..0000000
--- a/src/main/java/org/openoffice/da/comp/writer2xhtml/BatchConverter.java
+++ /dev/null
@@ -1,517 +0,0 @@
-/************************************************************************
- *
- * BatchConverter.java
- *
- * Copyright: 2002-2009 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 .
- *
- * Version 1.3.1 (2014-08-04)
- *
- */
-
-package org.openoffice.da.comp.writer2xhtml;
-
-import java.io.IOException;
-import java.io.OutputStream;
-import java.net.URI;
-import java.net.URISyntaxException;
-
-import com.sun.star.lib.uno.adapter.XInputStreamToInputStreamAdapter;
-import com.sun.star.lib.uno.adapter.XOutputStreamToOutputStreamAdapter;
-import com.sun.star.beans.PropertyValue;
-import com.sun.star.document.XDocumentProperties;
-import com.sun.star.document.XDocumentPropertiesSupplier;
-import com.sun.star.frame.XComponentLoader;
-import com.sun.star.frame.XStorable;
-import com.sun.star.io.NotConnectedException;
-import com.sun.star.io.XInputStream;
-import com.sun.star.io.XOutputStream;
-import com.sun.star.lang.XComponent;
-import com.sun.star.lang.XServiceInfo;
-import com.sun.star.lang.XServiceName;
-import com.sun.star.lang.XTypeProvider;
-import com.sun.star.sheet.XSpreadsheetDocument;
-import com.sun.star.text.XTextDocument;
-import com.sun.star.ucb.CommandAbortedException;
-import com.sun.star.ucb.XSimpleFileAccess2;
-import com.sun.star.uno.AnyConverter;
-import com.sun.star.uno.Type;
-import com.sun.star.uno.UnoRuntime;
-import com.sun.star.uno.XComponentContext;
-
-import w2phtml.api.ConverterFactory;
-import w2phtml.api.IndexPageEntry;
-import w2phtml.api.MIMETypes;
-import w2phtml.api.OutputFile;
-
-// Import interfaces as defined in uno idl
-import org.openoffice.da.writer2xhtml.XBatchConverter;
-import org.openoffice.da.writer2xhtml.XBatchHandler;
-import org.openoffice.da.comp.w2lcommon.helper.PropertyHelper;
-
-/** This class provides a uno component which implements the interface
- * org.openoffice.da.writer2xhtml.XBatchConverter
- */
-public class BatchConverter implements
- XBatchConverter,
- XServiceName,
- XServiceInfo,
- XTypeProvider {
-
- /** The component will be registered under this name.
- */
- public static final String __serviceName = "org.openoffice.da.writer2xhtml.BatchConverter";
-
- public static final String __implementationName = "org.openoffice.da.comp.writer2xhtml.BatchConverter";
-
- private XComponentContext xComponentContext = null;
-
- private XSimpleFileAccess2 sfa2 = null;
- private w2phtml.api.BatchConverter batchConverter = null;
-
- private XBatchHandler handler;
-
- // Based on convert arguments
- private boolean bRecurse = true;
- private String sWriterFilterName = "org.openoffice.da.writer2xhtml";
- private Object writerFilterData = null;
- private String sCalcFilterName = "org.openoffice.da.calc2xhtml";
- private Object calcFilterData = null;
- private boolean bIncludePdf = true;
- private boolean bIncludeOriginal = false;
- private boolean bUseTitle = true;
- private boolean bUseDescription = true;
- private String sUplink = "";
- private String sDirectoryIcon = "";
- private String sDocumentIcon = "";
- private String sTemplateURL = null;
-
- public BatchConverter(XComponentContext xComponentContext) {
- this.xComponentContext = xComponentContext;
- // Get the SimpleFileAccess service
- try {
- Object sfaObject = xComponentContext.getServiceManager().createInstanceWithContext(
- "com.sun.star.ucb.SimpleFileAccess", xComponentContext);
- sfa2 = (XSimpleFileAccess2) UnoRuntime.queryInterface(XSimpleFileAccess2.class, sfaObject);
- }
- catch (com.sun.star.uno.Exception e) {
- // failed to get SimpleFileAccess service (should not happen)
- }
- }
-
- // Helper: Get a string from an any
- private String getValue(Object any) {
- if (AnyConverter.isString(any)) {
- try {
- return AnyConverter.toString(any);
- }
- catch (com.sun.star.lang.IllegalArgumentException e) {
- return "";
- }
- }
- else {
- return "";
- }
- }
-
- // Implementation of XBatchConverter:
- public void convert(String sSourceURL, String sTargetURL, PropertyValue[] lArguments, XBatchHandler handler) {
- // Create batch converter (currently we don't need to set a converter)
- batchConverter = ConverterFactory.createBatchConverter(MIMETypes.XHTML);
-
- this.handler = handler;
-
- // Read the arguments
- int nSize = lArguments.length;
- for (int i=0; i0) {
- entry.setDisplayName(loadedTitle);
- }
- String loadedDescription = docProps.getDescription();
- if (bUseDescription && loadedDescription.length()>0) {
- entry.setDescription(loadedDescription);
- }
-
- // Determine the type of the component
- boolean bText = false;
- boolean bSpreadsheet = false;
- if (UnoRuntime.queryInterface(XTextDocument.class, xDocument)!=null) { bText=true; }
- else if (UnoRuntime.queryInterface(XSpreadsheetDocument.class, xDocument)!=null) { bSpreadsheet=true; }
- if (!bText && !bSpreadsheet) {
- handler.endFile(sSourceFileURL,false);
- xDocument.dispose();
- return null;
- }
-
- // Convert using requested filter
- boolean bHtmlSuccess = true;
-
- PropertyHelper exportProps = new PropertyHelper();
- exportProps.put("FilterName", bText ? sWriterFilterName : sCalcFilterName);
- exportProps.put("Overwrite", new Boolean(true));
- if (bText && writerFilterData!=null) { exportProps.put("FilterData", writerFilterData); }
- if (bSpreadsheet && calcFilterData!=null) { exportProps.put("FilterData", calcFilterData); }
-
- try {
- XStorable xStore = (XStorable) UnoRuntime.queryInterface (XStorable.class, xDocument);
- xStore.storeToURL (sTargetFileURL, exportProps.toArray());
- }
- catch (com.sun.star.io.IOException e) {
- // Failed to convert; continue anyway, but don't link to the file name
- entry.setFile(null);
- bHtmlSuccess = false;
- }
-
- // Convet to pdf if requested
- boolean bPdfSuccess = true;
-
- if (bIncludePdf) {
- PropertyValue[] pdfProps = new PropertyValue[2];
- pdfProps[0] = new PropertyValue();
- pdfProps[0].Name = "FilterName";
- pdfProps[0].Value = bText ? "writer_pdf_Export" : "calc_pdf_Export";
- pdfProps[1] = new PropertyValue();
- pdfProps[1].Name = "Overwrite";
- pdfProps[1].Value = new Boolean(true);
-
- String sPdfFileURL = ensureSlash(sTargetURL) + getBaseName(sSourceFileURL) + ".pdf";
-
- try {
- XStorable xStore = (XStorable) UnoRuntime.queryInterface (XStorable.class, xDocument);
- xStore.storeToURL (sPdfFileURL, pdfProps);
- entry.setPdfFile(sPdfFileURL);
- }
- catch (com.sun.star.io.IOException e) {
- // Not critical, continue without pdf
- bPdfSuccess = false;
- }
- }
-
- xDocument.dispose();
-
- // Include original document if required
- if (bIncludeOriginal) {
- // TODO
- }
-
- // Report a failure to the user if either of the exports failed
- handler.endFile(sSourceFileURL,bHtmlSuccess && bPdfSuccess);
- // But return the index entry even if only one succeded
- if (bHtmlSuccess || bPdfSuccess) { return entry; }
- else { return null; }
- }
-
- private String getName(String sURL) {
- int n = sURL.lastIndexOf("/");
- return n>-1 ? sURL.substring(n+1) : sURL;
- }
-
- private String getBaseName(String sURL) {
- String sName = getName(sURL);
- int n = sName.lastIndexOf(".");
- return n>-1 ? sName.substring(0,n) : sName;
- }
-
- private String ensureSlash(String sURL) {
- return sURL.endsWith("/") ? sURL : sURL+"/";
- }
-
- private String decodeURL(String sURL) {
- try {
- return new URI(sURL).getPath();
- }
- catch (URISyntaxException e) {
- return sURL;
- }
- }
-
- // Implement methods from interface XTypeProvider
-
- public com.sun.star.uno.Type[] getTypes() {
- Type[] typeReturn = {};
- try {
- typeReturn = new Type[] {
- new Type( XBatchConverter.class ),
- new Type( XTypeProvider.class ),
- new Type( XServiceName.class ),
- new Type( XServiceInfo.class ) };
- }
- catch( Exception exception ) {
-
- }
-
- return( typeReturn );
- }
-
-
- public byte[] getImplementationId() {
- byte[] byteReturn = {};
-
- byteReturn = new String( "" + this.hashCode() ).getBytes();
-
- return( byteReturn );
- }
-
- // Implement method from interface XServiceName
- public String getServiceName() {
- return( __serviceName );
- }
-
- // Implement methods from interface XServiceInfo
- public boolean supportsService(String stringServiceName) {
- return( stringServiceName.equals( __serviceName ) );
- }
-
- public String getImplementationName() {
- return( __implementationName );
- }
-
- public String[] getSupportedServiceNames() {
- String[] stringSupportedServiceNames = { __serviceName };
- return( stringSupportedServiceNames );
- }
-
-
-}
-
-
-
diff --git a/src/main/java/org/openoffice/da/comp/writer2xhtml/BatchHandlerAdapter.java b/src/main/java/org/openoffice/da/comp/writer2xhtml/BatchHandlerAdapter.java
deleted file mode 100644
index b95f7ec..0000000
--- a/src/main/java/org/openoffice/da/comp/writer2xhtml/BatchHandlerAdapter.java
+++ /dev/null
@@ -1,72 +0,0 @@
-/************************************************************************
- *
- * BatchHandlerAdapter.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 .
- *
- * Version 1.0 (2008-10-05)
- *
- */
-
-package org.openoffice.da.comp.writer2xhtml;
-
-import org.openoffice.da.writer2xhtml.XBatchHandler;
-
-import w2phtml.api.BatchHandler;
-
-/** The uno interface provides an XBatchHandler implementation, the java
- * interface requires a BatchHandler implementation. This simple class
- * implements the latter using an instance of the former.
- */
-public class BatchHandlerAdapter implements BatchHandler {
-
- private XBatchHandler unoHandler;
-
- public BatchHandlerAdapter(XBatchHandler unoHandler) {
- this.unoHandler = unoHandler;
- }
-
- public void startConversion() {
- unoHandler.startConversion();
- }
-
- public void endConversion() {
- unoHandler.endConversion();
- }
-
- public void startDirectory(String sName) {
- unoHandler.startDirectory(sName);
- }
-
- public void endDirectory(String sName, boolean bSuccess) {
- unoHandler.endDirectory(sName, bSuccess);
- }
-
- public void startFile(String sName) {
- unoHandler.startFile(sName);
- }
-
- public void endFile(String sName, boolean bSuccess) {
- unoHandler.endFile(sName, bSuccess);
- }
-
- public boolean cancel() {
- return unoHandler.cancel();
- }
-
-}
diff --git a/src/main/java/org/openoffice/da/comp/writer2xhtml/W2XRegistration.java b/src/main/java/org/openoffice/da/comp/writer2xhtml/W2XRegistration.java
index 4d7ad10..48d9cea 100644
--- a/src/main/java/org/openoffice/da/comp/writer2xhtml/W2XRegistration.java
+++ b/src/main/java/org/openoffice/da/comp/writer2xhtml/W2XRegistration.java
@@ -71,12 +71,6 @@ public class W2XRegistration {
multiFactory,
regKey);
}
- else if (implName.equals(BatchConverter.__implementationName) ) {
- xSingleServiceFactory = FactoryHelper.getServiceFactory(BatchConverter.class,
- BatchConverter.__serviceName,
- multiFactory,
- regKey);
- }
else if (implName.equals(XhtmlOptionsDialog.__implementationName)) {
xSingleServiceFactory = FactoryHelper.getServiceFactory(XhtmlOptionsDialog.class,
XhtmlOptionsDialog.__serviceName,
@@ -133,8 +127,6 @@ public class W2XRegistration {
*/
public static boolean __writeRegistryServiceInfo(XRegistryKey regKey) {
return
- FactoryHelper.writeRegistryServiceInfo(BatchConverter.__implementationName,
- BatchConverter.__serviceName, regKey) &
FactoryHelper.writeRegistryServiceInfo(Writer2xhtml.__implementationName,
Writer2xhtml.__serviceName, regKey) &
FactoryHelper.writeRegistryServiceInfo(W2XExportFilter.__implementationName,
diff --git a/src/main/java/w2phtml/project.properties b/src/main/java/w2phtml/project.properties
index dc34c6e..069046a 100644
--- a/src/main/java/w2phtml/project.properties
+++ b/src/main/java/w2phtml/project.properties
@@ -1,3 +1,3 @@
-#Thu Jun 25 12:58:30 CEST 2020
-releaseVersion=0.5.14
-releaseDate=12\:58\:30 25-06-2020
+#Wed Jul 22 13:02:52 CEST 2020
+releaseVersion=0.6.2
+releaseDate=13\:02\:52 22-07-2020
diff --git a/src/main/java/w2phtml/rdf/resources/text_structures.rdf b/src/main/java/w2phtml/rdf/resources/text_structures.rdf
new file mode 100644
index 0000000..7a02817
--- /dev/null
+++ b/src/main/java/w2phtml/rdf/resources/text_structures.rdf
@@ -0,0 +1,272 @@
+
+
+ ts_
+ Text structures
+
+
+ -1
+
+
+
+ -1
+
+
+
+ Electronic philosophical encyclopedia article
+
+
+
+
+
+
+
+
+ TOC Element
+ -1
+
+ -1
+ Table of contents element
+
+
+
+
+
+
+
+
+
+ Text excerpt
+
+
+
+
+
+ -1
+ Elenph Excerpt
+ -1
+
+
+
+
+
+
+
+ has TOC item
+
+
+
+
+
+
+
+ true
+
+
+
+ First publication
+
+
+
+
+
+
+
+
+
+
+
+ Year and month
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Works
+
+
+
+
+
+
+
+
+
+
+ bibliography
+
+
+
+
+
+
+
+ HTML
+
+
+ html Excerpt
+
+
+
+
+
+
+
+
+
+
+ Issue
+
+
+
+
+
+ htmlExcerpt
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Affiliation
+
+
+
+
+
+
+
+
+
+
+
+
+
+ author
+
+
+
+
+
+
+
+
+ Keywords
+
+
+
+
+
+
+
+
+
+
+
+ DOI
+
+
+
+
+
+ points to
+
+
+
+
+
+ true
+
+
+
+
+
+
+
+
+
+
+
+
+ true
+
+ has text
+
+
+
+
+
+
+ Item Number
+
+
+
+
+
+
+
+
+
+
+
+ Year
+
+
+
+
+
+
+
+
+
diff --git a/src/main/java/w2phtml/xhtml/ODFPageSplitter.java b/src/main/java/w2phtml/xhtml/ODFPageSplitter.java
index 81b9d3e..cf06cae 100644
--- a/src/main/java/w2phtml/xhtml/ODFPageSplitter.java
+++ b/src/main/java/w2phtml/xhtml/ODFPageSplitter.java
@@ -57,13 +57,18 @@ public class ODFPageSplitter {
if (indexFirstPart != null) {
onode.insertBefore(indexFirstPart, child);
}
- } else if (nodeName.equals(TEXT_SECTION)) {
+ } else if (nodeName.equals(TEXT_ILLUSTRATION_INDEX)) {
+ Node indexFirstPart = splitTextIllustrationIndex(child);
+ if (indexFirstPart != null) {
+ onode.insertBefore(indexFirstPart, child);
+ }
+ }else if (nodeName.equals(TEXT_SECTION)) {
Node sectionFirstPart = handleSection(child);
if (sectionFirstPart != null) {
onode.insertBefore(sectionFirstPart, child);
style = ofr.getSectionStyle(Misc.getAttribute(child, TEXT_SECTION));
}
- } else if (nodeName.equals(TEXT_TABLE_OF_CONTENT)){
+ } else if (nodeName.equals(TEXT_TABLE_OF_CONTENT)){
//HACK
containsSPB(childFirstPart);
i++;
@@ -73,6 +78,7 @@ public class ODFPageSplitter {
i++;
continue;
} else {
+ System.out.println("In ODFPageSplitter unknown node found. Error, exiting.");
Debug.printNode(child);
System.exit(1);
@@ -101,6 +107,24 @@ public class ODFPageSplitter {
//Debug.printNode(onode);
return onode;
}
+ private static Node splitTextIllustrationIndex(Node illustrationIndex) {
+ Node illustrationIndexFirstPart = illustrationIndex.cloneNode(false);
+ NodeList childs = illustrationIndex.getChildNodes();
+ int i = 0;
+ while (childs.getLength() > i) {
+ Node child = childs.item(i);
+ String childName = child.getNodeName();
+ if (childName.equals(TEXT_ILLUSTRATION_INDEX_SOURCE)) {
+ illustrationIndexFirstPart.appendChild(child.cloneNode(true));
+ } else
+ if (childName.equals(TEXT_INDEX_BODY)) {
+ Node indexBodyFirstPart = splitTextIndexBody(child);
+ illustrationIndexFirstPart.appendChild(indexBodyFirstPart);
+ }
+ i++;
+ }
+ return illustrationIndexFirstPart;
+ }
private static Node splitABIndex(Node abIndex) {
Node abIndexFirstPart = abIndex.cloneNode(false);
NodeList childs = abIndex.getChildNodes();
diff --git a/src/main/oxt/description.xml b/src/main/oxt/description.xml
index 7bd8c86..2f6b9bb 100644
--- a/src/main/oxt/description.xml
+++ b/src/main/oxt/description.xml
@@ -3,7 +3,7 @@
-
+