More exquisite bugfixes

git-svn-id: svn://svn.code.sf.net/p/writer2latex/code/trunk@102 f0f2a975-2e09-46c8-9428-3b39399b9f3c
This commit is contained in:
henrikjust 2011-03-29 10:01:49 +00:00
parent 26de5a45df
commit f19433e716
10 changed files with 95 additions and 43 deletions

View file

@ -311,7 +311,7 @@ public class BlockConverter extends ConverterHelper {
node.getNodeName().equals(XMLString.TEXT_LIST_HEADER),
"true".equals(node.getAttribute(XMLString.TEXT_RESTART_NUMBERING)),
Misc.getPosInteger(node.getAttribute(XMLString.TEXT_START_VALUE),1)-1,
ba);
ba,oc);
// export the list item (note the special treatment of lists in tables)
if (ba.getBefore().length()>0) {

View file

@ -20,7 +20,7 @@
*
* All Rights Reserved.
*
* Version 1.2 (2011-03-10)
* Version 1.2 (2011-03-29)
*
*/
@ -239,7 +239,9 @@ public class HeadingConverter extends ConverterHelper {
// Suppress indentation after heading? currently not..
// ldp.append("-");
ldp.append(sMarginTop)
.append("}{").append(sMarginBottom).append("}{");
.append("}{")
.append(Misc.isZero(sMarginBottom) ? "0.1mm" : sMarginBottom)
.append("}{");
// Note: decl.getAfter() may include a page break after, which we ignore
ldp.append(decl.getBefore());
if (!comm.isEmpty()) {

View file

@ -135,7 +135,7 @@ public class ListStyleConverter extends StyleConverter {
/** <p>Apply a list style to a list item.</p> */
public void applyListItemStyle(String sStyleName, int nLevel, boolean bHeader,
boolean bRestart, int nStartValue, BeforeAfter ba) {
boolean bRestart, int nStartValue, BeforeAfter ba, Context oc) {
// Step 1. We may have a style map, this always takes precedence
String sDisplayName = ofr.getListStyles().getDisplayName(sStyleName);
if (config.getListItemStyleMap().contains(sDisplayName)) {
@ -154,7 +154,9 @@ public class ListStyleConverter extends StyleConverter {
return;
}
// Step 3: Export as default lists (with redefined 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 (nLevel<=4) {
if (bHeader) {
ba.add("\\item[] ","");

View file

@ -20,7 +20,7 @@
*
* All Rights Reserved.
*
* Version 1.2 (2011-03-22)
* Version 1.2 (2011-03-29)
*
*/
@ -232,7 +232,8 @@ public class ParConverter extends StyleConverter {
}
else {
// Export character formatting + alignment only
BeforeAfter baFormat = new BeforeAfter();
BeforeAfter baPar = new BeforeAfter();
BeforeAfter baText = new BeforeAfter();
// Apply hard formatting attributes
// Note: Left justified text is exported as full justified text!
@ -240,25 +241,34 @@ 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)) { baFormat.add("\\centering\\arraybslash",""); }
else if ("end".equals(sTextAlign)) { baFormat.add("\\raggedleft\\arraybslash",""); }
if ("center".equals(sTextAlign)) { baPar.add("\\centering\\arraybslash",""); }
else if ("end".equals(sTextAlign)) { baPar.add("\\raggedleft\\arraybslash",""); }
bNeedArrayBslash = true;
}
else if (bLastInBlock) { // no \par needed
if ("center".equals(sTextAlign)) { baFormat.add("\\centering",""); }
else if ("end".equals(sTextAlign)) { baFormat.add("\\raggedleft",""); }
if ("center".equals(sTextAlign)) { baPar.add("\\centering",""); }
else if ("end".equals(sTextAlign)) { baPar.add("\\raggedleft",""); }
}
else {
if ("center".equals(sTextAlign)) { baFormat.add("\\centering","\\par"); }
else if ("end".equals(sTextAlign)) { baFormat.add("\\raggedleft","\\par"); }
if ("center".equals(sTextAlign)) { baPar.add("\\centering","\\par"); }
else if ("end".equals(sTextAlign)) { baPar.add("\\raggedleft","\\par"); }
}
palette.getI18n().applyLanguage(style,true,true,baFormat);
palette.getCharSc().applyFont(style,true,true,baFormat,context);
palette.getI18n().applyLanguage(style,true,true,baText);
palette.getCharSc().applyFont(style,true,true,baText,context);
}
// If there is any hard character formatting or alignment we must group the contents.
if (!baFormat.isEmpty() && !bLastInBlock) { ba.add("{","}"); }
ba.add(baFormat);
// Group the contents if this is not the last paragraph in the cell
boolean bIsGrouped = false;
if ((!baPar.isEmpty() || !baText.isEmpty()) && !bLastInBlock) {
ba.add("{","}");
bIsGrouped = true;
}
ba.add(baPar);
// Group the text formatting in any case (supertabular needs this)
if (!baText.isEmpty() && !bIsGrouped) {
ba.add("{", "}");
}
ba.add(baText);
if (ba.getBefore().length()>0) { ba.add(" ",""); }
}

View file

@ -20,7 +20,7 @@
*
* All Rights Reserved.
*
* Version 1.2 (2011-03-22)
* Version 1.2 (2011-03-29)
*
*/
@ -57,6 +57,19 @@ public class BeforeAfter {
sBefore+=sBefore1; sAfter=sAfter1+sAfter;
}
/** <p>Add data to the <code>BeforeAfter</code></p>
* <p>The new data will be be added "outside", thus for example</p>
* <ul><li><code>enclose("\textsf{","}");</code>
* <li><code>enclose("\textit{","}");</code></ul>
* <p>will create the pair <code>\textit{\textsf{</code>, <code>}}</code></p>
*
* @param sBefore1 LaTeX code to put before
* @param sAfter1 LaTeX code to put after
*/
public void enclose(String sBefore1, String sAfter1) {
sBefore=sBefore1+sBefore; sAfter+=sAfter1;
}
/** <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>
*