Merge changes from 1.0beta3 + Export XHTML without MathML

git-svn-id: svn://svn.code.sf.net/p/writer2latex/code/trunk@24 f0f2a975-2e09-46c8-9428-3b39399b9f3c
This commit is contained in:
henrikjust 2009-05-29 10:44:38 +00:00
parent 1bbf6241a4
commit 839483be11
29 changed files with 927 additions and 27 deletions

View file

@ -20,7 +20,7 @@
*
* All Rights Reserved.
*
* Version 1.2 (2009-03-26)
* Version 1.2 (2009-05-29)
*
*/
@ -228,7 +228,14 @@ public class DrawConverter extends ConverterHelper {
}
if (!oc.isInFrame() && config.alignFrames()) {
// Avoid nesting center environment
ba.add("\\begin{center}\n","\n\\end{center}\n");
if (config.floatFigures()) {
// Inside floats we don't want the extra glue added by the center environment
ba.add("\\centering\n","\n");
}
else {
// Outside a float we certainly want it
ba.add("\\begin{center}\n","\n\\end{center}\n");
}
}
}

View file

@ -18,7 +18,7 @@
*
* Copyright: 2002-2009 by Henrik Just
*
* Version 1.0 (2009-02-17)
* Version 1.0 (2009-04-08)
*
* All Rights Reserved.
*/
@ -1007,12 +1007,12 @@ public final class StarMathConverter implements writer2latex.api.StarMathConvert
private String table(float fSize, Token eAlign){
StringBuffer bufTable=new StringBuffer();
String sLine=line(fSize,eAlign);
String sLine=line(fSize,eAlign,true);
if (curToken.eType==Token.NEWLINE){ // more than one line
bufTable.append("\\begin{gathered}").append(sLine);
while (curToken.eType==Token.NEWLINE){
nextToken();
bufTable.append("\\\\").append(line(fSize,eAlign));
bufTable.append("\\\\").append(line(fSize,eAlign,false));
}
return bufTable.append("\\end{gathered}").toString();
}
@ -1052,12 +1052,19 @@ public final class StarMathConverter implements writer2latex.api.StarMathConvert
}
}
private String line(float fSize, Token eAlign){
private String line(float fSize, Token eAlign, boolean bFirstLine){
if (curToken.eType!=Token.NEWLINE && curToken.eType!=Token.END){
// Add implicit left alignment for expressions starting with text
// (Note: Don't pass on this alignment to subexpressions!)
// This alignment is only added if there's more than one line!
if (curToken.eType==Token.TEXT) {
return expression(fSize,eAlign)+"\\hfill ";
String sExpression = expression(fSize,eAlign);
if (!bFirstLine || curToken.eType==Token.NEWLINE) {
return sExpression+"\\hfill ";
}
else {
return sExpression;
}
}
else {
return align(fSize,eAlign,true,false);

View file

@ -16,11 +16,11 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
* MA 02111-1307 USA
*
* Copyright: 2002-2008 by Henrik Just
* Copyright: 2002-2009 by Henrik Just
*
* All Rights Reserved.
*
* Version 1.0 (2008-11-23)
* Version 1.0 (2009-05-22)
*
*/
@ -149,7 +149,7 @@ public class TableConverter extends ConverterHelper {
// Get table declarations
baTable = new BeforeAfter();
baTableAlign = new BeforeAfter();
formatter.applyTableStyle(baTable,baTableAlign);
formatter.applyTableStyle(baTable,baTableAlign,config.floatTables() && !ic.isInFrame() && !table.isSubTable());
// Convert table
if (formatter.isSupertabular()) {
@ -181,7 +181,7 @@ public class TableConverter extends ConverterHelper {
// Table head
ldp.append("\\tablehead{");
handleHeaderRows(ldp,oc);
ldp.append("}");
ldp.append("}\n");
// The table
handleHyperTarget(ldp);

View file

@ -20,7 +20,7 @@
*
* All Rights Reserved.
*
* Version 1.0 (2009-02-19)
* Version 1.0 (2009-05-22)
*
*/
@ -307,8 +307,11 @@ public class TableFormatter extends ConverterHelper {
/**
* <p>Create table environment based on table style.</p>
* <p>Returns eg. "\begin{longtable}{m{2cm}|m{4cm}}", "\end{longtable}".</p>
* @param ba the <code>BeforeAfter</code> to contain the table code
* @param baAlign the <code>BeforeAfter</code> to contain the alignment code, if it's separate
* @param bInFloat true if the table should be floating
*/
public void applyTableStyle(BeforeAfter ba, BeforeAfter baAlign) {
public void applyTableStyle(BeforeAfter ba, BeforeAfter baAlign, boolean bInFloat) {
// Read formatting info from table style
// Only supported properties are alignment and may-break-between-rows.
String sStyleName = table.getTableStyleName();
@ -328,7 +331,18 @@ public class TableFormatter extends ConverterHelper {
// Create table alignment (for supertabular, tabular and tabulary)
if (!bIsLongtable && !table.isSubTable()) {
baAlign.add("\\begin{"+sAlign+"}\n","\\end{"+sAlign+"}\n");
if (bInFloat & !bIsSupertabular) {
// Inside a float we don't want the extra glue added by the flushleft/center/flushright environment
switch (cAlign) {
case 'c' : baAlign.add("\\centering\n", ""); break;
case 'r' : baAlign.add("\\raggedleft\n", ""); break;
case 'l' : baAlign.add("\\raggedright\n", "");
}
}
else {
// But outside floats we do want it
baAlign.add("\\begin{"+sAlign+"}\n","\\end{"+sAlign+"}\n");
}
}
// Create table declaration