W2L help content, hiding postponed features, some bugfixes
git-svn-id: svn://svn.code.sf.net/p/writer2latex/code/trunk@64 f0f2a975-2e09-46c8-9428-3b39399b9f3c
This commit is contained in:
parent
83f0c7d224
commit
86e0b8d693
40 changed files with 885 additions and 142 deletions
|
@ -20,7 +20,7 @@
|
|||
*
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* Version 1.2 (2010-05-09)
|
||||
* Version 1.2 (2010-05-17)
|
||||
*
|
||||
*/
|
||||
|
||||
|
@ -227,10 +227,12 @@ public class Converter extends ConverterBase {
|
|||
converterResult.addContentEntry(new ContentEntryImpl("Text", 1, outFiles.get(0), null));
|
||||
}
|
||||
else {
|
||||
// The title page is the first page
|
||||
converterResult.setTitlePageFile(new ContentEntryImpl("Title page", 1, outFiles.get(0), null));
|
||||
// The text page is the one containing the first heading
|
||||
ContentEntry firstHeading = converterResult.getContent().get(0);
|
||||
// The title page is the first page, unless the first page starts with a heading
|
||||
if (outFiles.get(0)!=firstHeading.getFile() || firstHeading.getTarget()!=null) {
|
||||
converterResult.setTitlePageFile(new ContentEntryImpl("Title page", 1, outFiles.get(0), null));
|
||||
}
|
||||
// The text page is the one containing the first heading
|
||||
converterResult.setTextFile(new ContentEntryImpl("Text", 1, firstHeading.getFile(), firstHeading.getTarget()));
|
||||
}
|
||||
|
||||
|
@ -397,7 +399,6 @@ public class Converter extends ConverterBase {
|
|||
if (nIndex>=0 && nIndex<=nOutFileIndex) {
|
||||
Element a = dom.createElement("a");
|
||||
a.setAttribute("href",Misc.makeHref(getOutFileName(nIndex,true)));
|
||||
a.setAttribute("href",getOutFileName(nIndex,true));
|
||||
a.appendChild(dom.createTextNode(s));
|
||||
//node.appendChild(dom.createTextNode("["));
|
||||
node.appendChild(a);
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
*
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* Version 1.2 (2010-03-03)
|
||||
* Version 1.2 (2010-05-13)
|
||||
*
|
||||
*/
|
||||
|
||||
|
@ -376,12 +376,14 @@ public class DrawConverter extends ConverterHelper {
|
|||
if (sHref!=null && sHref.length()>0 && !ofr.isInPackage(sHref)) {
|
||||
// Linked image is not yet handled by ImageLoader. This is a temp.
|
||||
// solution (will go away when ImageLoader is finished)
|
||||
sFileName = sHref;
|
||||
// In OpenDocument *package* format ../ means "leave the package"
|
||||
if (ofr.isOpenDocument() && ofr.isPackageFormat() && sFileName.startsWith("../")) {
|
||||
sFileName=sFileName.substring(3);
|
||||
}
|
||||
//String sExt = sHref.substring(sHref.lastIndexOf(".")).toLowerCase();
|
||||
if (!converter.isOPS()) { // Cannot have linked images in EPUB, ignore the image
|
||||
sFileName = sHref;
|
||||
// In OpenDocument *package* format ../ means "leave the package"
|
||||
if (ofr.isOpenDocument() && ofr.isPackageFormat() && sFileName.startsWith("../")) {
|
||||
sFileName=sFileName.substring(3);
|
||||
}
|
||||
//String sExt = sHref.substring(sHref.lastIndexOf(".")).toLowerCase();
|
||||
}
|
||||
}
|
||||
else { // embedded or base64 encoded image
|
||||
BinaryGraphicsDocument bgd = converter.getImageLoader().getImage(onode);
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
*
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* Version 1.2 (2010-05-09)
|
||||
* Version 1.2 (2010-05-13)
|
||||
*
|
||||
*/
|
||||
|
||||
|
@ -80,6 +80,7 @@ public class ParStyleConverter extends StyleWithPropertiesConverterHelper {
|
|||
* @param bInherit true if properties should be inherited from parent style(s)
|
||||
*/
|
||||
public void applyProperties(StyleWithProperties style, CSVList props, boolean bInherit) {
|
||||
cssPageBreak(style,props,bInherit);
|
||||
getFrameSc().cssMargins(style,props,bInherit);
|
||||
getFrameSc().cssBorder(style,props,bInherit);
|
||||
getFrameSc().cssPadding(style,props,bInherit);
|
||||
|
@ -104,6 +105,15 @@ public class ParStyleConverter extends StyleWithPropertiesConverterHelper {
|
|||
if (style==null || !style.isAutomatic()) { return sStyleName; }
|
||||
return style.getParentName();
|
||||
}
|
||||
|
||||
public void cssPageBreak(StyleWithProperties style, CSVList props, boolean bInherit) {
|
||||
if ("page".equals(style.getProperty(XMLString.FO_BREAK_BEFORE, bInherit))) {
|
||||
props.addValue("page-break-before", "always");
|
||||
}
|
||||
else if ("page".equals(style.getProperty(XMLString.FO_BREAK_AFTER, bInherit))) {
|
||||
props.addValue("page-break-after", "always");
|
||||
}
|
||||
}
|
||||
|
||||
public void cssPar(StyleWithProperties style, CSVList props, boolean bInherit){
|
||||
String s;
|
||||
|
|
|
@ -16,11 +16,11 @@
|
|||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
|
||||
* MA 02111-1307 USA
|
||||
*
|
||||
* Copyright: 2002-2008 by Henrik Just
|
||||
* Copyright: 2002-2010 by Henrik Just
|
||||
*
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* Version 1.0 (2008-09-08)
|
||||
* Version 1.2 (2010-05-13)
|
||||
*
|
||||
*/
|
||||
|
||||
|
@ -74,6 +74,8 @@ public class TableStyleConverter extends StyleWithPropertiesConverterHelper {
|
|||
* @param bInherit true if properties should be inherited from parent style(s)
|
||||
*/
|
||||
public void applyProperties(StyleWithProperties style, CSVList props, boolean bInherit) {
|
||||
// Page break
|
||||
getParSc().cssPageBreak(style, props, bInherit);
|
||||
// Apply background
|
||||
getFrameSc().cssBackground(style,props,bInherit);
|
||||
// Table-specific properties
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
*
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* Version 1.2 (2010-05-09)
|
||||
* Version 1.2 (2010-05-13)
|
||||
*
|
||||
*/
|
||||
|
||||
|
@ -470,9 +470,10 @@ public class TextConverter extends ConverterHelper {
|
|||
if (nDontSplitLevel>1) { // we cannot split due to a nested structure
|
||||
return node;
|
||||
}
|
||||
if (bAfterHeading && nLevel-nLastSplitLevel<=nRepeatLevels) {
|
||||
if (!converter.isOPS() && bAfterHeading && nLevel-nLastSplitLevel<=nRepeatLevels) {
|
||||
// we cannot split because we are right after a heading and the
|
||||
// maximum number of parent headings on the page is not reached
|
||||
// maximum number of parent headings on the page is not reached
|
||||
// TODO: Something wrong here....nLastSplitLevel is never set???
|
||||
return node;
|
||||
}
|
||||
if (nSplit>=nLevel && converter.outFileHasContent()) {
|
||||
|
@ -562,7 +563,14 @@ public class TextConverter extends ConverterHelper {
|
|||
ListCounter counter = getListCounter(listStyle);
|
||||
if (bRestart) { counter.restart(nListLevel,nStartValue); }
|
||||
String sLabel = counter.step(nListLevel).getLabel();
|
||||
insertListLabel(listStyle,nListLevel,"SectionNumber",sLabel,heading);
|
||||
if (config.zenHack() && nLevel==2) {
|
||||
// Hack for ePub Zen Garden: Special style for the prefix at level 2
|
||||
// TODO: Replace by some proper style map construct...
|
||||
insertListLabel(listStyle,nListLevel,"SectionNumber",counter.getPrefix(),counter.getLabelAndSuffix(),heading);
|
||||
}
|
||||
else {
|
||||
insertListLabel(listStyle,nListLevel,"SectionNumber",null,sLabel,heading);
|
||||
}
|
||||
|
||||
// Add to toc
|
||||
if (!bInToc) {
|
||||
|
@ -642,7 +650,7 @@ public class TextConverter extends ConverterHelper {
|
|||
if (!bIsEmpty) {
|
||||
par = createTextBackground(par, sStyleName);
|
||||
if (config.listFormatting()==XhtmlConfig.HARD_LABELS) {
|
||||
insertListLabel(currentListStyle, nCurrentListLevel, "ItemNumber", sCurrentListLabel, par);
|
||||
insertListLabel(currentListStyle, nCurrentListLevel, "ItemNumber", null, sCurrentListLabel, par);
|
||||
}
|
||||
sCurrentListLabel = null;
|
||||
traverseInlineText(onode,par);
|
||||
|
@ -694,8 +702,14 @@ public class TextConverter extends ConverterHelper {
|
|||
}
|
||||
|
||||
// Helper: Insert a list label formatted with a list style
|
||||
private void insertListLabel(ListStyle style, int nLevel, String sDefaultStyle, String sLabel, Element hnode) {
|
||||
private void insertListLabel(ListStyle style, int nLevel, String sDefaultStyle, String sPrefix, String sLabel, Element hnode) {
|
||||
if (sLabel!=null && sLabel.length()>0) {
|
||||
if (sPrefix!=null) {
|
||||
Element prefix = converter.createElement("span");
|
||||
prefix.setAttribute("class", "chapter-name");
|
||||
hnode.appendChild(prefix);
|
||||
prefix.appendChild( converter.createTextNode(sPrefix));
|
||||
}
|
||||
StyleInfo info = new StyleInfo();
|
||||
if (style!=null) {
|
||||
String sTextStyleName = style.getLevelProperty(nLevel,XMLString.TEXT_STYLE_NAME);
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
*
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* Version 1.2 (2010-05-09)
|
||||
* Version 1.2 (2010-05-13)
|
||||
*
|
||||
*/
|
||||
|
||||
|
@ -41,7 +41,7 @@ import writer2latex.util.Misc;
|
|||
|
||||
public class XhtmlConfig extends writer2latex.base.ConfigBase {
|
||||
// Implement configuration methods
|
||||
protected int getOptionCount() { return 42; }
|
||||
protected int getOptionCount() { return 43; }
|
||||
protected String getDefaultConfigPath() { return "/writer2latex/xhtml/config/"; }
|
||||
|
||||
// Override setOption: To be backwards compatible, we must accept options
|
||||
|
@ -119,6 +119,7 @@ public class XhtmlConfig extends writer2latex.base.ConfigBase {
|
|||
private static final int UPLINK = 39;
|
||||
private static final int DIRECTORY_ICON = 40;
|
||||
private static final int DOCUMENT_ICON = 41;
|
||||
private static final int ZEN_HACK = 42; // temporary hack for ePub Zen Garden styles
|
||||
|
||||
protected ComplexOption xheading = addComplexOption("heading-map");
|
||||
protected ComplexOption xpar = addComplexOption("paragraph-map");
|
||||
|
@ -197,6 +198,7 @@ public class XhtmlConfig extends writer2latex.base.ConfigBase {
|
|||
options[UPLINK] = new Option("uplink","");
|
||||
options[DIRECTORY_ICON] = new Option("directory_icon","");
|
||||
options[DOCUMENT_ICON] = new Option("document_icon","");
|
||||
options[ZEN_HACK] = new BooleanOption("zen_hack", "false");
|
||||
}
|
||||
|
||||
protected void readInner(Element elm) {
|
||||
|
@ -309,6 +311,7 @@ public class XhtmlConfig extends writer2latex.base.ConfigBase {
|
|||
public String getXhtmlUplink() { return options[UPLINK].getString(); }
|
||||
public String getXhtmlDirectoryIcon() { return options[DIRECTORY_ICON].getString(); }
|
||||
public String getXhtmlDocumentIcon() { return options[DOCUMENT_ICON].getString(); }
|
||||
public boolean zenHack() { return ((BooleanOption) options[ZEN_HACK]).getValue(); }
|
||||
|
||||
public XhtmlStyleMap getXParStyleMap() { return getStyleMap(xpar); }
|
||||
public XhtmlStyleMap getXHeadingStyleMap() { return getStyleMap(xheading); }
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue