Table improvements + starting configuration ui
git-svn-id: svn://svn.code.sf.net/p/writer2latex/code/trunk@27 f0f2a975-2e09-46c8-9428-3b39399b9f3c
This commit is contained in:
parent
9e78c8fc3d
commit
f6c8e1709e
9 changed files with 172 additions and 36 deletions
source
java/writer2latex
oxt/writer2latex
|
@ -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
|
||||
|
|
|
@ -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<nRowCount; nRow++) {
|
||||
if (rowTypes[nRow]==rowType) {
|
||||
// Add interrow material from previous row, if any
|
||||
if (nPreviousRow>-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));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -12,6 +12,10 @@
|
|||
<manifest:file-entry
|
||||
manifest:full-path="w2l_filters.xcu"
|
||||
manifest:media-type="application/vnd.sun.star.configuration-data"/>
|
||||
|
||||
<manifest:file-entry
|
||||
manifest:full-path="OptionPages.xcu"
|
||||
manifest:media-type="application/vnd.sun.star.configuration-data"/>
|
||||
|
||||
<manifest:file-entry
|
||||
manifest:full-path="Options.xcs"
|
||||
|
@ -25,6 +29,10 @@
|
|||
manifest:full-path="W2LDialogs/"
|
||||
manifest:media-type="application/vnd.sun.star.basic-library"/>
|
||||
|
||||
<manifest:file-entry
|
||||
manifest:full-path="W2LDialogs2/"
|
||||
manifest:media-type="application/vnd.sun.star.basic-library"/>
|
||||
|
||||
<manifest:file-entry
|
||||
manifest:full-path="writer2latex.rdb"
|
||||
manifest:media-type="application/vnd.sun.star.uno-typelibrary;type=RDB"/>
|
||||
|
|
69
source/oxt/writer2latex/OptionPages.xcu
Normal file
69
source/oxt/writer2latex/OptionPages.xcu
Normal file
|
@ -0,0 +1,69 @@
|
|||
<?xml version='1.0' encoding='UTF-8'?>
|
||||
|
||||
<oor:component-data oor:name="OptionsDialog" oor:package="org.openoffice.Office"
|
||||
xmlns:oor="http://openoffice.org/2001/registry"
|
||||
xmlns:xs="http://www.w3.org/2001/XMLSchema"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
|
||||
|
||||
<node oor:name="Modules">
|
||||
<!-- This node should appear in the Writer module -->
|
||||
<node oor:name="com.sun.star.text.TextDocument" oor:op="fuse">
|
||||
<node oor:name="Nodes">
|
||||
<node oor:name="org.openoffice.da.writer2latex.configuration"
|
||||
oor:op="fuse">
|
||||
</node>
|
||||
</node>
|
||||
</node>
|
||||
</node>
|
||||
|
||||
<node oor:name="Nodes">
|
||||
<node oor:name="org.openoffice.da.writer2latex.configuration"
|
||||
oor:op="fuse">
|
||||
<prop oor:name="Id">
|
||||
<value>org.openoffice.da.writer2latex.configuration</value>
|
||||
</prop>
|
||||
<prop oor:name="Label">
|
||||
<value xml:lang="en-US">Writer2LaTeX</value>
|
||||
</prop>
|
||||
<prop oor:name="OptionsPage">
|
||||
<value>%origin%/W2LDialogs2/Configuration1.xdl</value>
|
||||
</prop>
|
||||
<prop oor:name="EventHandlerService">
|
||||
<value>org.openoffice.da.writer2latex.ConfigurationDialog</value>
|
||||
</prop>
|
||||
<node oor:name="Leaves">
|
||||
<node oor:name="org.openoffice.da.writer2latex.configuration.subpage1"
|
||||
oor:op="fuse">
|
||||
<prop oor:name="Id">
|
||||
<value>org.openoffice.da.writer2latex.configuration.subpage1</value>
|
||||
</prop>
|
||||
<prop oor:name="Label">
|
||||
<value xml:lang="en-US">Subpage</value>
|
||||
</prop>
|
||||
<prop oor:name="OptionsPage">
|
||||
<value>%origin%/W2LDialogs2/Configuration2.xdl</value>
|
||||
</prop>
|
||||
<prop oor:name="EventHandlerService">
|
||||
<value>org.openoffice.da.writer2latex.ConfigurationDialog</value>
|
||||
</prop>
|
||||
</node>
|
||||
<node oor:name="org.openoffice.da.writer2latex.configuration.subpage2"
|
||||
oor:op="fuse">
|
||||
<prop oor:name="Id">
|
||||
<value>org.openoffice.da.writer2latex.configuration.subpage2</value>
|
||||
</prop>
|
||||
<prop oor:name="Label">
|
||||
<value xml:lang="en-US">Subpage</value>
|
||||
</prop>
|
||||
<prop oor:name="OptionsPage">
|
||||
<value>%origin%/W2LDialogs2/Configuration1.xdl</value>
|
||||
</prop>
|
||||
<prop oor:name="EventHandlerService">
|
||||
<value>org.openoffice.da.writer2latex.ConfigurationDialog</value>
|
||||
</prop>
|
||||
</node>
|
||||
</node>
|
||||
</node>
|
||||
</node>
|
||||
|
||||
</oor:component-data>
|
14
source/oxt/writer2latex/W2LDialogs2/Configuration1.xdl
Normal file
14
source/oxt/writer2latex/W2LDialogs2/Configuration1.xdl
Normal file
|
@ -0,0 +1,14 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE dlg:window PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "dialog.dtd">
|
||||
<dlg:window xmlns:dlg="http://openoffice.org/2000/dialog" xmlns:script="http://openoffice.org/2000/script" dlg:id="Configuration1" dlg:left="139" dlg:top="84" dlg:width="260" dlg:height="185" dlg:closeable="true" dlg:moveable="true" dlg:title="Writer2LaTeX Custom Configuration" dlg:withtitlebar="false">
|
||||
<dlg:styles>
|
||||
<dlg:style dlg:style-id="0" dlg:border="none"/>
|
||||
<dlg:style dlg:style-id="1" dlg:font-height="14"/>
|
||||
</dlg:styles>
|
||||
<dlg:bulletinboard>
|
||||
<dlg:fixedline dlg:id="FixedLine1" dlg:tab-index="0" dlg:left="6" dlg:top="32" dlg:width="248" dlg:height="2"/>
|
||||
<dlg:img dlg:style-id="0" dlg:id="ImageControl1" dlg:tab-index="1" dlg:left="8" dlg:top="6" dlg:width="21" dlg:height="21" dlg:scale-image="false" dlg:src="../images/w2licon.png"/>
|
||||
<dlg:text dlg:style-id="1" dlg:id="Label1" dlg:tab-index="2" dlg:left="36" dlg:top="10" dlg:width="193" dlg:height="16" dlg:value="Writer2LaTeX Custom Configuration"/>
|
||||
<dlg:text dlg:id="Label2" dlg:tab-index="3" dlg:left="37" dlg:top="43" dlg:width="194" dlg:height="113" dlg:value="This is where you create a custom configuration for the Writer2LaTeX export filter. You can define how to convert text, tables, figures etc. to LaTeX code" dlg:multiline="true"/>
|
||||
</dlg:bulletinboard>
|
||||
</dlg:window>
|
8
source/oxt/writer2latex/W2LDialogs2/Configuration2.xdl
Normal file
8
source/oxt/writer2latex/W2LDialogs2/Configuration2.xdl
Normal file
|
@ -0,0 +1,8 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE dlg:window PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "dialog.dtd">
|
||||
<dlg:window xmlns:dlg="http://openoffice.org/2000/dialog" xmlns:script="http://openoffice.org/2000/script" dlg:id="Configuration2" dlg:left="139" dlg:top="84" dlg:width="260" dlg:height="101" dlg:closeable="true" dlg:moveable="true" dlg:title="Writer2LaTeX Custom Configuration" dlg:withtitlebar="false">
|
||||
<dlg:bulletinboard>
|
||||
<dlg:text dlg:id="Page2" dlg:tab-index="0" dlg:left="6" dlg:top="4" dlg:width="210" dlg:height="12" dlg:value="Custom Config - page 2"/>
|
||||
|
||||
</dlg:bulletinboard>
|
||||
</dlg:window>
|
10
source/oxt/writer2latex/W2LDialogs2/Module1.xba
Normal file
10
source/oxt/writer2latex/W2LDialogs2/Module1.xba
Normal file
|
@ -0,0 +1,10 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE script:module PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "module.dtd">
|
||||
<script:module xmlns:script="http://openoffice.org/2000/script" script:name="Module1" script:language="StarBasic">REM ***** BASIC *****
|
||||
|
||||
Sub Main
|
||||
|
||||
End Sub
|
||||
|
||||
|
||||
</script:module>
|
6
source/oxt/writer2latex/W2LDialogs2/dialog.xlb
Normal file
6
source/oxt/writer2latex/W2LDialogs2/dialog.xlb
Normal file
|
@ -0,0 +1,6 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE library:library PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "library.dtd">
|
||||
<library:library xmlns:library="http://openoffice.org/2000/library" library:name="W2LDialogs2" library:readonly="false" library:passwordprotected="false">
|
||||
<library:element library:name="Configuration1"/>
|
||||
<library:element library:name="Configuration2"/>
|
||||
</library:library>
|
5
source/oxt/writer2latex/W2LDialogs2/script.xlb
Normal file
5
source/oxt/writer2latex/W2LDialogs2/script.xlb
Normal file
|
@ -0,0 +1,5 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE library:library PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "library.dtd">
|
||||
<library:library xmlns:library="http://openoffice.org/2000/library" library:name="W2LDialogs2" library:readonly="false" library:passwordprotected="false">
|
||||
<library:element library:name="Module1"/>
|
||||
</library:library>
|
Loading…
Add table
Reference in a new issue