diff --git a/source/java/writer2latex/api/ConverterFactory.java b/source/java/writer2latex/api/ConverterFactory.java index 55cf2be..e65aedb 100644 --- a/source/java/writer2latex/api/ConverterFactory.java +++ b/source/java/writer2latex/api/ConverterFactory.java @@ -20,7 +20,7 @@ * * All Rights Reserved. * - * Version 1.2 (2009-06-11) + * Version 1.2 (2009-08-23) * */ @@ -33,7 +33,7 @@ public class ConverterFactory { // Version information private static final String VERSION = "1.1.1"; - private static final String DATE = "2008-06-11"; + private static final String DATE = "2008-08-31"; /** Return version information * @return the Writer2LaTeX version in the form diff --git a/source/java/writer2latex/latex/TableConverter.java b/source/java/writer2latex/latex/TableConverter.java index a6c1c14..da0b186 100644 --- a/source/java/writer2latex/latex/TableConverter.java +++ b/source/java/writer2latex/latex/TableConverter.java @@ -20,7 +20,7 @@ * * All Rights Reserved. * - * Version 1.2 (2009-06-11) + * Version 1.2 (2009-08-23) * */ @@ -248,25 +248,35 @@ public class TableConverter extends ConverterHelper { // Table head ldp.append("\\tablefirsthead{"); - handleRows(ldp,oc,RowType.FIRST_HEAD); + if (hasRowType(RowType.FIRST_HEAD)) { + handleRows(ldp,oc,RowType.FIRST_HEAD,true,false); + } + else { + handleRows(ldp,oc,RowType.HEAD,true,false); + } ldp.append("}\n"); ldp.append("\\tablehead{"); - handleRows(ldp,oc,RowType.HEAD); + handleRows(ldp,oc,RowType.HEAD,true,false); ldp.append("}\n"); // Table foot ldp.append("\\tabletail{"); - handleRows(ldp,oc,RowType.FOOT); + handleRows(ldp,oc,RowType.FOOT,true,true); ldp.append("}\n"); ldp.append("\\tablelasttail{"); - handleRows(ldp,oc,RowType.LAST_FOOT); + if (hasRowType(RowType.LAST_FOOT)) { + handleRows(ldp,oc,RowType.LAST_FOOT,true,true); + } + else { + handleRows(ldp,oc,RowType.FOOT,true,true); + } ldp.append("}\n"); // The table body handleHyperTarget(ldp); ldp.append(baTable.getBefore()).nl(); - handleRows(ldp,oc,RowType.BODY); - ldp.append(baTable.getAfter()).nl(); + handleRows(ldp,oc,RowType.BODY,true,!hasRowType(RowType.FOOT) && !hasRowType(RowType.LAST_FOOT)); + ldp.nl().append(baTable.getAfter()).nl(); ldp.append(baTableAlign.getAfter()); } @@ -282,25 +292,25 @@ public class TableConverter extends ConverterHelper { handleCaption("\\caption",ldp,oc); ldp.append("\\\\").nl(); if (hasRowType(RowType.FIRST_HEAD)) { - handleRows(ldp,oc,RowType.FIRST_HEAD); + handleRows(ldp,oc,RowType.FIRST_HEAD,true,true); } else { - handleRows(ldp,oc,RowType.HEAD); + handleRows(ldp,oc,RowType.HEAD,true,true); } ldp.nl().append("\\endfirsthead").nl(); } else if (hasRowType(RowType.FIRST_HEAD)) { // Otherwise we only need it if the table contains a first head - handleRows(ldp,oc,RowType.FIRST_HEAD); + handleRows(ldp,oc,RowType.FIRST_HEAD,true,true); ldp.nl().append("\\endfirsthead").nl(); } // Head - handleRows(ldp,oc,RowType.HEAD); + handleRows(ldp,oc,RowType.HEAD,true,true); ldp.nl().append("\\endhead").nl(); // Foot - handleRows(ldp,oc,RowType.FOOT); + handleRows(ldp,oc,RowType.FOOT,false,true); ldp.nl().append("\\endfoot").nl(); // Last foot @@ -308,26 +318,26 @@ public class TableConverter extends ConverterHelper { // If there's a caption below, we must use \endlastfoot // and have to repeat the foot if there's no last foot if (hasRowType(RowType.LAST_FOOT)) { - handleRows(ldp,oc,RowType.LAST_FOOT); + handleRows(ldp,oc,RowType.LAST_FOOT,false,true); ldp.nl(); } else if (hasRowType(RowType.FOOT)){ - handleRows(ldp,oc,RowType.FOOT); + handleRows(ldp,oc,RowType.FOOT,false,true); ldp.nl(); } handleCaption("\\caption",ldp,oc); - ldp.nl().append("\\endlastfoot").nl(); + ldp.append("\\endlastfoot").nl(); } else if (hasRowType(RowType.LAST_FOOT)) { // Otherwise we only need it if the table contains a last foot - handleRows(ldp,oc,RowType.LAST_FOOT); + handleRows(ldp,oc,RowType.LAST_FOOT,false,true); ldp.nl().append("\\endlastfoot").nl(); } // Body - handleRows(ldp,oc,RowType.BODY); + handleRows(ldp,oc,RowType.BODY,!hasRowType(RowType.HEAD) && !hasRowType(RowType.FIRST_HEAD),true); - ldp.append(baTable.getAfter()).nl(); + ldp.nl().append(baTable.getAfter()).nl(); } private void handleTableFloat(LaTeXDocumentPortion ldp, Context oc) { @@ -347,9 +357,9 @@ public class TableConverter extends ConverterHelper { // The table handleHyperTarget(ldp); ldp.append(baTable.getBefore()).nl(); - handleRows(ldp,oc,RowType.HEAD); + handleRows(ldp,oc,RowType.HEAD,true,true); ldp.nl(); - handleRows(ldp,oc,RowType.BODY); + handleRows(ldp,oc,RowType.BODY,!hasRowType(RowType.HEAD),true); ldp.append(baTable.getAfter()).nl(); // Caption below @@ -357,7 +367,7 @@ public class TableConverter extends ConverterHelper { handleCaption("\\caption",ldp,oc); } - ldp.append(baTableAlign.getAfter()); + ldp.nl().append(baTableAlign.getAfter()); ldp.append("\\end{table}").nl(); } @@ -373,12 +383,10 @@ public class TableConverter extends ConverterHelper { // The table handleHyperTarget(ldp); ldp.append(baTable.getBefore()).nl(); - if (table.getFirstBodyRow()>0) { - handleRows(ldp,oc,RowType.HEAD); - ldp.nl(); - } - handleRows(ldp,oc,RowType.BODY); - ldp.append(baTable.getAfter()).nl(); + handleRows(ldp,oc,RowType.HEAD,true,true); + ldp.nl(); + handleRows(ldp,oc,RowType.BODY,!hasRowType(RowType.HEAD),true); + ldp.nl().append(baTable.getAfter()).nl(); // Caption below if (caption!=null && !bCaptionAbove) { @@ -400,22 +408,25 @@ public class TableConverter extends ConverterHelper { } } - private void handleRows(LaTeXDocumentPortion ldp, Context oc, RowType rowType) { + private void handleRows(LaTeXDocumentPortion ldp, Context oc, RowType rowType, boolean bLineBefore, boolean bLineAfter) { int nRowCount = table.getRowCount(); int nColCount = table.getColCount(); boolean bFirst = true; + int nPreviousRow = -1; for (int nRow=0; nRow-1) { + ldp.append(formatter.getInterrowMaterial(nPreviousRow+1)).nl(); + } + nPreviousRow = nRow; + // If it's the first row, add top interrow material - if (bFirst) { + if (bFirst && bLineBefore) { String sInter = formatter.getInterrowMaterial(nRow); if (sInter.length()>0) { ldp.append(sInter).nl(); } bFirst=false; } - else { - // If it's not the first row in this row portion, separate with a newline - ldp.nl(); - } // Export columns in this row Context icRow = (Context) oc.clone(); BeforeAfter baRow = new BeforeAfter(); @@ -446,9 +457,14 @@ public class TableConverter extends ConverterHelper { } nCol+=nColSpan; } - ldp.append("\\\\").append(formatter.getInterrowMaterial(nRow+1)); + ldp.append("\\\\"); } } + // Add interrow material from last row, if required + if (nPreviousRow>-1 && bLineAfter) { + ldp.append(formatter.getInterrowMaterial(nPreviousRow+1)); + } + } } diff --git a/source/oxt/writer2latex/META-INF/manifest.xml b/source/oxt/writer2latex/META-INF/manifest.xml index a0e086c..fac029b 100644 --- a/source/oxt/writer2latex/META-INF/manifest.xml +++ b/source/oxt/writer2latex/META-INF/manifest.xml @@ -12,6 +12,10 @@ + + + + diff --git a/source/oxt/writer2latex/OptionPages.xcu b/source/oxt/writer2latex/OptionPages.xcu new file mode 100644 index 0000000..755a7d5 --- /dev/null +++ b/source/oxt/writer2latex/OptionPages.xcu @@ -0,0 +1,69 @@ + + + + + + + + + + + + + + + + + + org.openoffice.da.writer2latex.configuration + + + Writer2LaTeX + + + %origin%/W2LDialogs2/Configuration1.xdl + + + org.openoffice.da.writer2latex.ConfigurationDialog + + + + + org.openoffice.da.writer2latex.configuration.subpage1 + + + Subpage + + + %origin%/W2LDialogs2/Configuration2.xdl + + + org.openoffice.da.writer2latex.ConfigurationDialog + + + + + org.openoffice.da.writer2latex.configuration.subpage2 + + + Subpage + + + %origin%/W2LDialogs2/Configuration1.xdl + + + org.openoffice.da.writer2latex.ConfigurationDialog + + + + + + + \ No newline at end of file diff --git a/source/oxt/writer2latex/W2LDialogs2/Configuration1.xdl b/source/oxt/writer2latex/W2LDialogs2/Configuration1.xdl new file mode 100644 index 0000000..6a0367b --- /dev/null +++ b/source/oxt/writer2latex/W2LDialogs2/Configuration1.xdl @@ -0,0 +1,14 @@ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/source/oxt/writer2latex/W2LDialogs2/Configuration2.xdl b/source/oxt/writer2latex/W2LDialogs2/Configuration2.xdl new file mode 100644 index 0000000..0fac530 --- /dev/null +++ b/source/oxt/writer2latex/W2LDialogs2/Configuration2.xdl @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/source/oxt/writer2latex/W2LDialogs2/Module1.xba b/source/oxt/writer2latex/W2LDialogs2/Module1.xba new file mode 100644 index 0000000..9c46f60 --- /dev/null +++ b/source/oxt/writer2latex/W2LDialogs2/Module1.xba @@ -0,0 +1,10 @@ + + +REM ***** BASIC ***** + +Sub Main + +End Sub + + + \ No newline at end of file diff --git a/source/oxt/writer2latex/W2LDialogs2/dialog.xlb b/source/oxt/writer2latex/W2LDialogs2/dialog.xlb new file mode 100644 index 0000000..cbcedd2 --- /dev/null +++ b/source/oxt/writer2latex/W2LDialogs2/dialog.xlb @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/source/oxt/writer2latex/W2LDialogs2/script.xlb b/source/oxt/writer2latex/W2LDialogs2/script.xlb new file mode 100644 index 0000000..27f0c96 --- /dev/null +++ b/source/oxt/writer2latex/W2LDialogs2/script.xlb @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file