Added option for aligning splits to pages

This commit is contained in:
Georgy Litvinov 2020-02-10 15:46:49 +01:00
parent 17742eacc3
commit b591f6c3c5
2 changed files with 7 additions and 3 deletions

View file

@ -40,7 +40,7 @@ import writer2latex.util.Misc;
public class XhtmlConfig extends writer2latex.base.ConfigBase {
// Implement configuration methods
protected int getOptionCount() { return 63; }
protected int getOptionCount() { return 64; }
protected String getDefaultConfigPath() { return "/writer2latex/xhtml/config/"; }
// Override setOption: To be backwards compatible, we must accept options
@ -162,6 +162,7 @@ public class XhtmlConfig extends writer2latex.base.ConfigBase {
private static final int PAGE_TAGS = 60;
private static final int MIN_LETTER_SPACING = 61;
private static final int PAGE_BREAK_STYLE = 62;
private static final int ALIGN_SPLITS_TO_PAGES = 63;
protected ComplexOption xheading = addComplexOption("heading-map");
protected ComplexOption xpar = addComplexOption("paragraph-map");
@ -291,6 +292,7 @@ public class XhtmlConfig extends writer2latex.base.ConfigBase {
options[MIN_LETTER_SPACING] = new Option("min_letter_spacing","0.15");
options[PAGE_BREAK_STYLE] = new Option("page_break_style","");
options[CSS_INLINE] = new BooleanOption("css_inline","true");
options[ALIGN_SPLITS_TO_PAGES] = new BooleanOption("align_splits_to_pages","false");
}
@ -439,6 +441,8 @@ public class XhtmlConfig extends writer2latex.base.ConfigBase {
return "none";
}
return options[HEADING_TAGS].getString(); }
public boolean getAlignSplitsToPages() { return ((BooleanOption) options[ALIGN_SPLITS_TO_PAGES]).getValue(); }
public String getPageTags() { return options[PAGE_TAGS].getString(); }
public String getMinLetterSpacing() { return ( options[MIN_LETTER_SPACING]).getString(); }
public String getPageBreakStyle() { return ( options[PAGE_BREAK_STYLE]).getString(); }

View file

@ -22,7 +22,7 @@ public class Separator {
private static final String SECTIONS = "sections";
private static final String DIV = "div";
private int splitLevel = 0;
private boolean alignSplitToPages = false;
private boolean alignSplitToPages;
private int lastSplitPageNum = 1;
private Integer pageNumber = null;
private String breakStyle = null;
@ -44,7 +44,7 @@ public class Separator {
headingSeparation = config.getHeadingTags();
pageSeparation = config.getPageTags();
splitLevel = config.getXhtmlSplitLevel();
alignSplitToPages = pageSeparation.equals(DIV) ? true : false;
alignSplitToPages = config.getAlignSplitsToPages();
breakStyle = config.getPageBreakStyle();
pageContainer = converter.pageContainer;
}