Process page style columns
This commit is contained in:
parent
525ec1ee6b
commit
160fda5007
3 changed files with 28 additions and 16 deletions
|
@ -54,7 +54,7 @@ public class StyleWithProperties extends OfficeStyle {
|
|||
|
||||
private PropertySet backgroundImageProperties = new PropertySet();
|
||||
|
||||
private int nColCount = 0;
|
||||
private int nColCount = 1;
|
||||
|
||||
private boolean bHasFootnoteSep = false;
|
||||
private PropertySet footnoteSep = new PropertySet();
|
||||
|
|
|
@ -116,12 +116,14 @@ public class DocumentSeparator {
|
|||
|
||||
return hnode;
|
||||
}
|
||||
public boolean isPageOpened() {
|
||||
return pageOpened;
|
||||
}
|
||||
|
||||
/**
|
||||
* Opens main document section heading tag
|
||||
*/
|
||||
protected Node startDocument(Node hnode, String title, int pageNum){
|
||||
|
||||
if (noHeadingSeparation() && noPageSeparation()){
|
||||
return hnode;
|
||||
}
|
||||
|
|
|
@ -532,17 +532,18 @@ public class TextConverter extends ConverterHelper {
|
|||
// Unlike headings, paragraphs and spans, text:display is not attached to the style:
|
||||
String lastEndnotesContext = endnotesContext;
|
||||
String lastFootnotesContext = footnotesContext;
|
||||
|
||||
boolean pageWasOpened = docSep.isPageOpened();
|
||||
String sectionName = Misc.getAttribute(onode,TEXT_NAME);
|
||||
String last = Misc.getAttribute(onode,"last");
|
||||
boolean isLast = false;
|
||||
if (last != null && last.equals("true")) { isLast = true;}
|
||||
|
||||
if (!bDisplayHiddenText && "none".equals(Misc.getAttribute(onode,TEXT_DISPLAY))) { return hnode; }
|
||||
hnode = docSep.closePage(hnode);
|
||||
|
||||
if (pageWasOpened) {hnode = docSep.closePage(hnode);}
|
||||
boolean removeStyleAtExit = setSectionStyle(onode);
|
||||
|
||||
hnode = docSep.openPage(hnode, pageNum);
|
||||
if (pageWasOpened) {hnode = docSep.openPage(hnode, pageNum);}
|
||||
hnode = traverseBlockText(onode, hnode);
|
||||
if (isLast) {
|
||||
insertEndnotes((Element) hnode, sectionName);
|
||||
|
@ -1718,7 +1719,8 @@ public class TextConverter extends ConverterHelper {
|
|||
//hnode = exitPageContainer((Element) hnode);
|
||||
addFooter(hnode);
|
||||
// Update MP
|
||||
updateMasterPage(style);
|
||||
updateMasterPageWith(style);
|
||||
setPageContainerStyle();
|
||||
// Set new page number if defined or increment if not
|
||||
if (newPageNumber != null) {
|
||||
pageNum = newPageNumber;
|
||||
|
@ -1782,17 +1784,12 @@ public class TextConverter extends ConverterHelper {
|
|||
|
||||
private Node startDocument(Node hnode, StyleWithProperties style, Integer newPageNumber) {
|
||||
|
||||
if (hasMasterPage(style)) {
|
||||
updateMasterPage(style);
|
||||
} else {
|
||||
currentMasterPage = "Standard";
|
||||
}
|
||||
setFirstMasterPage(style);
|
||||
|
||||
if (newPageNumber != null) {
|
||||
pageNum = newPageNumber;
|
||||
} else {
|
||||
fitPageNumberToMasterPageStyle();
|
||||
}
|
||||
|
||||
//Start tagging
|
||||
String sTitle = converter.getTitle();
|
||||
hnode = docSep.startDocument(hnode, sTitle,pageNum);
|
||||
|
@ -1803,6 +1800,21 @@ public class TextConverter extends ConverterHelper {
|
|||
return hnode;
|
||||
}
|
||||
|
||||
private void setFirstMasterPage(StyleWithProperties style) {
|
||||
updateMasterPageWith(style);
|
||||
if (currentMasterPage == null) {
|
||||
currentMasterPage = "Standard";
|
||||
}
|
||||
setPageContainerStyle();
|
||||
}
|
||||
|
||||
private void setPageContainerStyle() {
|
||||
MasterPage mp = ofr.getFullMasterPage(currentMasterPage);
|
||||
PageLayout layout = ofr.getPageLayout(mp.getPageLayoutName());
|
||||
String containerStyle = "column-count: " + layout.getColCount() + ";";
|
||||
docSep.setPageContainerStyle(containerStyle);
|
||||
}
|
||||
|
||||
private void fitPageNumberToMasterPageStyle() {
|
||||
// TODO: READ master-page style
|
||||
|
||||
|
@ -1845,7 +1857,7 @@ public class TextConverter extends ConverterHelper {
|
|||
return false;
|
||||
}
|
||||
|
||||
private void updateMasterPage(StyleWithProperties style) {
|
||||
private void updateMasterPageWith(StyleWithProperties style) {
|
||||
|
||||
if (!hasMasterPage(style) && nextMasterPage == null) {
|
||||
return;
|
||||
|
@ -1858,8 +1870,6 @@ public class TextConverter extends ConverterHelper {
|
|||
}
|
||||
MasterPage masterPage = ofr.getFullMasterPage(currentMasterPage);
|
||||
nextMasterPage = masterPage.getProperty(STYLE_NEXT_STYLE_NAME);
|
||||
//TODO:PROCESS MASTERPAGE COLUMNS
|
||||
//docSep.setPageContainerStyle("column-count: 2;");
|
||||
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue