Assorted bugfixes

git-svn-id: svn://svn.code.sf.net/p/writer2latex/code/trunk@101 f0f2a975-2e09-46c8-9428-3b39399b9f3c
This commit is contained in:
henrikjust 2011-03-24 07:26:28 +00:00
parent 4a63a1ce8c
commit 26de5a45df
13 changed files with 59 additions and 39 deletions

View file

@ -20,7 +20,7 @@
*
* All Rights Reserved.
*
* Version 1.2 (2011-03-21)
* Version 1.2 (2011-03-23)
*
*/
@ -33,7 +33,7 @@ public class ConverterFactory {
// Version information
private static final String VERSION = "1.1.7";
private static final String DATE = "2011-03-21";
private static final String DATE = "2011-03-23";
/** Return the Writer2LaTeX version in the form
* (major version).(minor version).(patch level)<br/>

View file

@ -313,13 +313,13 @@ public class BlockConverter extends ConverterHelper {
Misc.getPosInteger(node.getAttribute(XMLString.TEXT_START_VALUE),1)-1,
ba);
// export the list item
// export the list item (note the special treatment of lists in tables)
if (ba.getBefore().length()>0) {
ldp.append(ba.getBefore());
if (config.formatting()>=LaTeXConfig.CONVERT_MOST) { ldp.nl(); }
if (config.formatting()>=LaTeXConfig.CONVERT_MOST && !oc.isInTable()) { ldp.nl(); }
}
traverseBlockText(node,ldp,oc);
if (ba.getAfter().length()>0) { ldp.append(ba.getAfter()).nl(); }
if (ba.getAfter().length()>0 || oc.isInTable()) { ldp.append(ba.getAfter()).nl(); }
}
/*

View file

@ -16,11 +16,11 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
* MA 02111-1307 USA
*
* Copyright: 2002-2010 by Henrik Just
* Copyright: 2002-2011 by Henrik Just
*
* All Rights Reserved.
*
* Version 1.2 (2010-03-03)
* Version 1.2 (2011-03-22)
*
*/
@ -90,7 +90,9 @@ public class ListStyleConverter extends StyleConverter {
return;
}
// Step 3: Export as default lists, but redefine labels
if (config.formatting()==LaTeXConfig.CONVERT_BASIC) {
// (for list in tables this is the maximum formatting we export)
if (config.formatting()==LaTeXConfig.CONVERT_BASIC ||
(config.formatting()>=LaTeXConfig.CONVERT_MOST && oc.isInTable())) {
if (oc.getListLevel()==1) {
if (!styleNames.containsName(getDisplayName(oc.getListStyleName()))) {
createListStyleLabels(oc.getListStyleName());
@ -124,7 +126,8 @@ public class ListStyleConverter extends StyleConverter {
+"level"+Misc.int2roman(oc.getListLevel());
if (!oc.isInContinuedList() && style.isNumber(oc.getListLevel())) {
int nStartValue = Misc.getPosInteger(style.getLevelProperty(oc.getListLevel(),XMLString.TEXT_START_VALUE),1)-1;
ba.add("\\setcounter{"+sTeXName+"}{"+Integer.toString(nStartValue)+"}\n","");
// Note that we need a blank line after certain constructions to get proper indentation
ba.add("\n\\setcounter{"+sTeXName+"}{"+Integer.toString(nStartValue)+"}\n","");
}
ba.add("\\begin{"+sTeXName+"}","\\end{"+sTeXName+"}");
}

View file

@ -16,11 +16,11 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
* MA 02111-1307 USA
*
* Copyright: 2002-2010 by Henrik Just
* Copyright: 2002-2011 by Henrik Just
*
* All Rights Reserved.
*
* Version 1.2 (2010-03-12)
* Version 1.2 (2011-03-22)
*
*/
@ -232,7 +232,7 @@ public class ParConverter extends StyleConverter {
}
else {
// Export character formatting + alignment only
BeforeAfter baText = new BeforeAfter();
BeforeAfter baFormat = new BeforeAfter();
// Apply hard formatting attributes
// Note: Left justified text is exported as full justified text!
@ -240,27 +240,26 @@ public class ParConverter extends StyleConverter {
if (style!=null) {
String sTextAlign = style.getProperty(XMLString.FO_TEXT_ALIGN,true);
if (bLastInBlock && context.isInLastTableColumn()) { // no grouping needed, but need to fix problem with \\
if ("center".equals(sTextAlign)) { ba.add("\\centering\\arraybslash ",""); }
else if ("end".equals(sTextAlign)) { ba.add("\\raggedleft\\arraybslash ",""); }
if ("center".equals(sTextAlign)) { baFormat.add("\\centering\\arraybslash",""); }
else if ("end".equals(sTextAlign)) { baFormat.add("\\raggedleft\\arraybslash",""); }
bNeedArrayBslash = true;
}
else if (bLastInBlock) { // no \par needed
if ("center".equals(sTextAlign)) { ba.add("\\centering ",""); }
else if ("end".equals(sTextAlign)) { ba.add("\\raggedleft ",""); }
if ("center".equals(sTextAlign)) { baFormat.add("\\centering",""); }
else if ("end".equals(sTextAlign)) { baFormat.add("\\raggedleft",""); }
}
else {
if ("center".equals(sTextAlign)) { ba.add("\\centering ","\\par"); }
else if ("end".equals(sTextAlign)) { ba.add("\\raggedleft ","\\par"); }
if ("center".equals(sTextAlign)) { baFormat.add("\\centering","\\par"); }
else if ("end".equals(sTextAlign)) { baFormat.add("\\raggedleft","\\par"); }
}
palette.getI18n().applyLanguage(style,true,true,baText);
palette.getCharSc().applyFont(style,true,true,baText,context);
palette.getI18n().applyLanguage(style,true,true,baFormat);
palette.getCharSc().applyFont(style,true,true,baFormat,context);
}
// Assemble the bits. If there is any hard character formatting
// or alignment we must group the contents.
if (!baText.isEmpty() && !bLastInBlock) { ba.add("{","}"); }
ba.add(baText.getBefore(),baText.getAfter());
if (baText.getBefore().length()>0) { ba.add(" ",""); }
// If there is any hard character formatting or alignment we must group the contents.
if (!baFormat.isEmpty() && !bLastInBlock) { ba.add("{","}"); }
ba.add(baFormat);
if (ba.getBefore().length()>0) { ba.add(" ",""); }
}
// Update context

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-2011 by Henrik Just
*
* All Rights Reserved.
*
* Version 1.0 (2008-12-02)
* Version 1.2 (2011-03-22)
*
*/
@ -56,6 +56,15 @@ public class BeforeAfter {
public void add(String sBefore1, String sAfter1) {
sBefore+=sBefore1; sAfter=sAfter1+sAfter;
}
/** <p>Add the content of another <code>BeforeAfter</code> to this <code>BeforeAfter</code></p>
* <p>The new data will be be added "inside"</p>
*
* @param ba the code to add
*/
public void add(BeforeAfter ba) {
add(ba.getBefore(), ba.getAfter());
}
/** Get LaTeX code to put before
* @return then LaTeX code

View file

@ -20,7 +20,7 @@
*
* All Rights Reserved.
*
* Version 1.2 (2011-03-16)
* Version 1.2 (2011-03-21)
*
*/
@ -168,9 +168,9 @@ public class PageStyleConverter extends StyleConverterHelper {
// Background color
StyleInfo pageInfo = new StyleInfo();
getFrameSc().cssBackground(pageLayout,pageInfo.props,true);
if (converter.isOPS()) { // Use zero margin for EPUB and default margins for XHTML
/*if (converter.isOPS()) { // Use zero margin for EPUB and default margins for XHTML
pageInfo.props.addValue("margin", "0");
}
}*/
if (pageInfo.hasAttributes()) {
buf.append(sIndent).append("body {").append(pageInfo.props.toString()).append("}")
.append(config.prettyPrint() ? "\n" : " ");