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

@ -2,6 +2,14 @@ Changelog for Writer2LaTeX version 1.0 -> 1.2
---------- version 1.1.7 ---------- ---------- version 1.1.7 ----------
[all] Filter bugfix: Do not exclude surrogate pairs
[w2l] Bugfix: Fixed indentation problem with lists after tables if formatting>=convert_most
[w2l] Bugfix: Lists in tables are now exported as standard lists even if formatting>=convert_most
[w2l] Bugfix: Corrected export of centered and right justified paragraphs in tables
[w2x] Renamed the option original_image_size to image_size with extended values: absolute (default, former false), [w2x] Renamed the option original_image_size to image_size with extended values: absolute (default, former false),
relative (new value: Export images and text boxes using relative width, i.e. as a percentage of the current text width) relative (new value: Export images and text boxes using relative width, i.e. as a percentage of the current text width)
and none/original_image_size (former true). The old option name is still recognized. and none/original_image_size (former true). The old option name is still recognized.
@ -33,8 +41,6 @@ Changelog for Writer2LaTeX version 1.0 -> 1.2
[w2x] Export footnotes as endnotes (if text:footnotes-position="document"). A new option footnotes_heading is added: [w2x] Export footnotes as endnotes (if text:footnotes-position="document"). A new option footnotes_heading is added:
The value of this (if non-empty) is used as heading for the footnotes in this case The value of this (if non-empty) is used as heading for the footnotes in this case
[w2x] EPUB: Set body margin to zero
[w2x] Export footnote rule (using first master page) [w2x] Export footnote rule (using first master page)
[w2x] Export page background color (using first master page) [w2x] Export page background color (using first master page)

View file

@ -149,14 +149,16 @@ public abstract class ExportFilterBase implements
else if (c=='>'){ else if (c=='>'){
buf.append(">"); buf.append(">");
} }
else if (c=='\u0009' || c=='\n' || c=='\r' || (c>='\u0020' && c<='\uD7FF') || (c>='\uE000' && c<'\uFFFD')) { //else if (c=='\u0009' || c=='\n' || c=='\r' || (c>='\u0020' && c<='\uD7FF') || (c>='\uE000' && c<'\uFFFD')) {
else if (c=='\u0009' || c=='\n' || c=='\r' || (c>='\u0020' && c<'\uFFFD')) {
// Valid characters found at xml.com // Valid characters found at xml.com
// Char ::= #x9 | #xA | #xD | [#x20-#xD7FF] | [#xE000-#xFFFD] | [#x10000-#x10FFFF] // Char ::= #x9 | #xA | #xD | [#x20-#xD7FF] | [#xE000-#xFFFD] | [#x10000-#x10FFFF]
// (the latter are represented as surrogate pairs (#xD800-#xDFFF)
buf.append(c); buf.append(c);
} }
else { else {
// Found illegal character // Found illegal character
System.out.println("Illegal character : "+Integer.toHexString(c)); //System.out.println("Illegal character : "+Integer.toHexString(c));
} }
} }
return buf.toString(); return buf.toString();

View file

@ -20,7 +20,7 @@
* *
* All Rights Reserved. * All Rights Reserved.
* *
* Version 1.2 (2011-03-10) * Version 1.2 (2011-03-23)
* *
*/ */
@ -551,7 +551,7 @@ public final class Writer4LaTeX extends WeakBase
if (sDocumentUrl.length()!=0) { if (sDocumentUrl.length()!=0) {
if (sDocumentUrl.startsWith("file:")) { if (sDocumentUrl.startsWith("file:")) {
if (System.getProperty("os.name").startsWith("Windows")) { if (System.getProperty("os.name").startsWith("Windows")) {
Pattern windowsPattern = Pattern.compile("^file:///[A-Za-z][|:]"); Pattern windowsPattern = Pattern.compile("^file:///[A-Za-z][|:].*");
if (!windowsPattern.matcher(sDocumentUrl).matches()) { if (!windowsPattern.matcher(sDocumentUrl).matches()) {
MessageBox msgBox = new MessageBox(m_xContext, m_xFrame); MessageBox msgBox = new MessageBox(m_xContext, m_xFrame);
msgBox.showMessage("Please save the document on a location with a drive name!", msgBox.showMessage("Please save the document on a location with a drive name!",

View file

@ -20,7 +20,7 @@
* *
* All Rights Reserved. * All Rights Reserved.
* *
* Version 1.2 (2011-03-21) * Version 1.2 (2011-03-23)
* *
*/ */
@ -33,7 +33,7 @@ public class ConverterFactory {
// Version information // Version information
private static final String VERSION = "1.1.7"; 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 /** Return the Writer2LaTeX version in the form
* (major version).(minor version).(patch level)<br/> * (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, Misc.getPosInteger(node.getAttribute(XMLString.TEXT_START_VALUE),1)-1,
ba); ba);
// export the list item // export the list item (note the special treatment of lists in tables)
if (ba.getBefore().length()>0) { if (ba.getBefore().length()>0) {
ldp.append(ba.getBefore()); 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); 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, * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
* MA 02111-1307 USA * MA 02111-1307 USA
* *
* Copyright: 2002-2010 by Henrik Just * Copyright: 2002-2011 by Henrik Just
* *
* All Rights Reserved. * 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; return;
} }
// Step 3: Export as default lists, but redefine labels // 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 (oc.getListLevel()==1) {
if (!styleNames.containsName(getDisplayName(oc.getListStyleName()))) { if (!styleNames.containsName(getDisplayName(oc.getListStyleName()))) {
createListStyleLabels(oc.getListStyleName()); createListStyleLabels(oc.getListStyleName());
@ -124,7 +126,8 @@ public class ListStyleConverter extends StyleConverter {
+"level"+Misc.int2roman(oc.getListLevel()); +"level"+Misc.int2roman(oc.getListLevel());
if (!oc.isInContinuedList() && style.isNumber(oc.getListLevel())) { if (!oc.isInContinuedList() && style.isNumber(oc.getListLevel())) {
int nStartValue = Misc.getPosInteger(style.getLevelProperty(oc.getListLevel(),XMLString.TEXT_START_VALUE),1)-1; 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+"}"); ba.add("\\begin{"+sTeXName+"}","\\end{"+sTeXName+"}");
} }

View file

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

View file

@ -16,11 +16,11 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
* MA 02111-1307 USA * MA 02111-1307 USA
* *
* Copyright: 2002-2008 by Henrik Just * Copyright: 2002-2011 by Henrik Just
* *
* All Rights Reserved. * 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) { public void add(String sBefore1, String sAfter1) {
sBefore+=sBefore1; sAfter=sAfter1+sAfter; 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 /** Get LaTeX code to put before
* @return then LaTeX code * @return then LaTeX code

View file

@ -20,7 +20,7 @@
* *
* All Rights Reserved. * 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 // Background color
StyleInfo pageInfo = new StyleInfo(); StyleInfo pageInfo = new StyleInfo();
getFrameSc().cssBackground(pageLayout,pageInfo.props,true); 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"); pageInfo.props.addValue("margin", "0");
} }*/
if (pageInfo.hasAttributes()) { if (pageInfo.hasAttributes()) {
buf.append(sIndent).append("body {").append(pageInfo.props.toString()).append("}") buf.append(sIndent).append("body {").append(pageInfo.props.toString()).append("}")
.append(config.prettyPrint() ? "\n" : " "); .append(config.prettyPrint() ? "\n" : " ");

View file

@ -61,7 +61,7 @@
<prop oor:name="UseDefaultFont" oor:type="xs:boolean" /> <prop oor:name="UseDefaultFont" oor:type="xs:boolean" />
<prop oor:name="DefaultFontName" oor:type="xs:string" /> <prop oor:name="DefaultFontName" oor:type="xs:string" />
<prop oor:name="ConvertToPx" oor:type="xs:boolean" /> <prop oor:name="ConvertToPx" oor:type="xs:boolean" />
<prop oor:name="ImageSize" oor:type="xs:int"/> <prop oor:name="ImageSize" oor:type="xs:short"/>
<!-- AutoCorrect --> <!-- AutoCorrect -->
<prop oor:name="IgnoreEmptyParagraphs" oor:type="xs:boolean" /> <prop oor:name="IgnoreEmptyParagraphs" oor:type="xs:boolean" />
<prop oor:name="IgnoreHardLineBreaks" oor:type="xs:boolean" /> <prop oor:name="IgnoreHardLineBreaks" oor:type="xs:boolean" />

View file

@ -70,7 +70,7 @@
<prop oor:name="ColumnScaling" oor:type="xs:int"> <prop oor:name="ColumnScaling" oor:type="xs:int">
<value>100</value> <value>100</value>
</prop> </prop>
<prop oor:name="ImageSize" oor:type="xs:int"> <prop oor:name="ImageSize" oor:type="xs:short">
<value>1</value><!-- relative --> <value>1</value><!-- relative -->
</prop> </prop>
<prop oor:name="RelativeFontSize" oor:type="xs:boolean"> <prop oor:name="RelativeFontSize" oor:type="xs:boolean">

View file

@ -96,7 +96,7 @@
<dlg:menupopup> <dlg:menupopup>
<dlg:menuitem dlg:value="Use absolute size"/> <dlg:menuitem dlg:value="Use absolute size"/>
<dlg:menuitem dlg:value="Use relative size (%)"/> <dlg:menuitem dlg:value="Use relative size (%)"/>
<dlg:menuitem dlg:value="Use orignal image size"/> <dlg:menuitem dlg:value="Use original image size"/>
</dlg:menupopup> </dlg:menupopup>
</dlg:menulist> </dlg:menulist>
</dlg:bulletinboard> </dlg:bulletinboard>

View file

@ -82,6 +82,7 @@
<embed href="org.openoffice.da.writer2xhtml.oxt/export.xhp#converttopx4"/> <embed href="org.openoffice.da.writer2xhtml.oxt/export.xhp#converttopx4"/>
<bookmark xml-lang="en-US" branch="hid/org.openoffice.da.writer2xhtml.oxt:EpubOptionsImageSize" id="bm_options_imagesize"/> <bookmark xml-lang="en-US" branch="hid/org.openoffice.da.writer2xhtml.oxt:EpubOptionsImageSize" id="bm_options_imagesize"/>
<paragraph role="heading" level="3" xml-lang="en-US">Image size</paragraph>
<paragraph role="paragraph" xml-lang="en-US"><ahelp hid="org.openoffice.da.writer2xhtml.oxt:EpubOptionsImageSize" visibility="hidden">Select how to set the image size in the EPUB document</ahelp></paragraph> <paragraph role="paragraph" xml-lang="en-US"><ahelp hid="org.openoffice.da.writer2xhtml.oxt:EpubOptionsImageSize" visibility="hidden">Select how to set the image size in the EPUB document</ahelp></paragraph>
<paragraph role="paragraph" xml-lang="en-US">Select how to set the image size in the EPUB document</paragraph> <paragraph role="paragraph" xml-lang="en-US">Select how to set the image size in the EPUB document</paragraph>
<list type="unordered"> <list type="unordered">