From 7df46da38cd7293b2aa97b8eba7dc52abd79b631 Mon Sep 17 00:00:00 2001
From: henrikjust <henrikjust@f0f2a975-2e09-46c8-9428-3b39399b9f3c>
Date: Wed, 9 Mar 2011 21:22:29 +0000
Subject: [PATCH] Three minor W2X bugfixes

git-svn-id: svn://svn.code.sf.net/p/writer2latex/code/trunk@97 f0f2a975-2e09-46c8-9428-3b39399b9f3c
---
 source/distro/changelog.txt                        |  6 ++++++
 source/java/writer2latex/office/ListCounter.java   |  6 +++---
 source/java/writer2latex/xhtml/Converter.java      |  4 ++--
 source/java/writer2latex/xhtml/TableConverter.java | 10 +++++-----
 source/java/writer2latex/xhtml/TextConverter.java  |  5 ++---
 5 files changed, 18 insertions(+), 13 deletions(-)

diff --git a/source/distro/changelog.txt b/source/distro/changelog.txt
index f401ed1..ccb017c 100644
--- a/source/distro/changelog.txt
+++ b/source/distro/changelog.txt
@@ -3,6 +3,12 @@ Changelog for Writer2LaTeX version 1.0 -> 1.2
 
 ---------- version 1.1.7 ----------
 
+[w2x] Bugfix: Do not add space to empty labels (e.g. heading numbering)
+
+[w2x] Export line breaks as spaces in annotations and EPUB table of content
+
+[w2x] Bugfix: Do not export cell widths for tables with relative width
+
 [w2x] Export suffix and prefix on footnotes and endnotes
 
 [w2x] Export footnotes as endnotes (if text:footnotes-position="document"). A new option footnotes_heading is added:
diff --git a/source/java/writer2latex/office/ListCounter.java b/source/java/writer2latex/office/ListCounter.java
index 6c18452..05905b8 100644
--- a/source/java/writer2latex/office/ListCounter.java
+++ b/source/java/writer2latex/office/ListCounter.java
@@ -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-05-13)
+ *  Version 1.2 (2011-03-09)
  *
  */
 
@@ -124,7 +124,7 @@ public class ListCounter {
     		// TODO: Lettersync
     		sLabel+=formatNumber(nCounter[nLevel],sNumFormat[nLevel],true);
     		if (sSuffix!=null) { sLabel+=sSuffix; }
-    		if (sSpace!=null) { sLabel+=sSpace; }
+    		if (sLabel.length()>0 && sSpace!=null) { sLabel+=sSpace; }
     		return sLabel;
     	}
     	else if (style.isBullet(nLevel)) {
diff --git a/source/java/writer2latex/xhtml/Converter.java b/source/java/writer2latex/xhtml/Converter.java
index f38381a..11829a6 100644
--- a/source/java/writer2latex/xhtml/Converter.java
+++ b/source/java/writer2latex/xhtml/Converter.java
@@ -20,7 +20,7 @@
  *
  *  All Rights Reserved.
  * 
- *  Version 1.2 (2011-03-08)
+ *  Version 1.2 (2011-03-09)
  *
  */
 
@@ -472,7 +472,7 @@ public class Converter extends ConverterBase {
                     if (sName.equals(XMLString.TEXT_S)) {
                            buf.append(" ");
                     }
-                    else if (sName.equals(XMLString.TEXT_TAB_STOP) || sName.equals(XMLString.TEXT_TAB)) { // text:tab in oasis
+                    else if (sName.equals(XMLString.TEXT_LINE_BREAK) || sName.equals(XMLString.TEXT_TAB_STOP) || sName.equals(XMLString.TEXT_TAB)) { // text:tab in oasis
                         buf.append(" ");
                     }
                     else if (OfficeReader.isNoteElement(child)) {
diff --git a/source/java/writer2latex/xhtml/TableConverter.java b/source/java/writer2latex/xhtml/TableConverter.java
index 55b8f41..47015b6 100644
--- a/source/java/writer2latex/xhtml/TableConverter.java
+++ b/source/java/writer2latex/xhtml/TableConverter.java
@@ -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-15)
+ *  Version 1.2 (2011-03-09)
  *
  */
 
@@ -285,7 +285,7 @@ public class TableConverter extends ConverterHelper {
                     String sValueType = ofr.isOpenDocument() ?
                         Misc.getAttribute(cell,XMLString.OFFICE_VALUE_TYPE) :
                         Misc.getAttribute(cell,XMLString.TABLE_VALUE_TYPE);
-                    applyCellStyle(view.getCellStyleName(nRow,nCol), sTotalWidth, sValueType, td, subTable!=null);
+                    applyCellStyle(view.getCellStyleName(nRow,nCol), view.getRelTableWidth()!=null, sTotalWidth, sValueType, td, subTable!=null);
                 }
                 else if (XMLString.TABLE_COVERED_TABLE_CELL.equals(cell.getNodeName())) {
                     // covered table cells are not part of xhtml table model
@@ -367,13 +367,13 @@ public class TableConverter extends ConverterHelper {
         applyStyle(info,row);
     }
 	
-    private void applyCellStyle(String sStyleName, String sTotalWidth, String sValueType, Element cell, boolean bIsSubTable) {
+    private void applyCellStyle(String sStyleName, boolean bIsRelative, String sTotalWidth, String sValueType, Element cell, boolean bIsSubTable) {
         StyleInfo info = new StyleInfo();
         getCellSc().applyStyle(sStyleName,info);
 
         StyleWithProperties style = ofr.getCellStyle(sStyleName);
         if (style!=null) {
-            if (!config.xhtmlIgnoreTableDimensions()) {
+            if (!config.xhtmlIgnoreTableDimensions() && !bIsRelative) {
                 String sEdge = "0";
     
                 // Set the cell width. This is calculated as
diff --git a/source/java/writer2latex/xhtml/TextConverter.java b/source/java/writer2latex/xhtml/TextConverter.java
index 7badf9c..0c0f1b3 100644
--- a/source/java/writer2latex/xhtml/TextConverter.java
+++ b/source/java/writer2latex/xhtml/TextConverter.java
@@ -1,6 +1,5 @@
 /************************************************************************
  *
- *  TextConverter.java
  *
  *  This library is free software; you can redistribute it and/or
  *  modify it under the terms of the GNU Lesser General Public
@@ -20,7 +19,7 @@
  *
  *  All Rights Reserved.
  * 
- *  Version 1.2 (2011-03-08)
+ *  Version 1.2 (2011-03-09)
  *
  */
 
@@ -691,7 +690,7 @@ public class TextConverter extends ConverterHelper {
                 // Add in external content. For single file output we include all level 1 headings + their target
                 // Targets are added only when the toc level is deeper than the split level 
                 if (nLevel<=nExternalTocDepth) {
-                	converter.addContentEntry(sLabel+(sLabel.length()>0 ? " " : "")+converter.getPlainInlineText(onode), nLevel,
+                	converter.addContentEntry(sLabel+converter.getPlainInlineText(onode), nLevel,
                 			nLevel>nSplit ? sTarget : null);
                 }