Apply footer/header margins from page layout
This commit is contained in:
parent
df172d504d
commit
2b7d1142c0
1 changed files with 12 additions and 0 deletions
|
@ -1776,6 +1776,9 @@ public class TextParser extends Parser {
|
||||||
inHeader = true;
|
inHeader = true;
|
||||||
MasterPage masterPage = ofr.getFullMasterPage(currentMasterPage);
|
MasterPage masterPage = ofr.getFullMasterPage(currentMasterPage);
|
||||||
if (currentMasterPage != null) {
|
if (currentMasterPage != null) {
|
||||||
|
String pageLayoutName = masterPage.getPageLayoutName();
|
||||||
|
PageLayout pageLayout = ofr.getPageLayout(pageLayoutName);
|
||||||
|
String marginBottom = pageLayout.getFooterProperty(FO_MARGIN_BOTTOM);
|
||||||
if (pageNum % 2 == 0) {
|
if (pageNum % 2 == 0) {
|
||||||
headerNode = masterPage.getHeaderLeft();
|
headerNode = masterPage.getHeaderLeft();
|
||||||
}
|
}
|
||||||
|
@ -1785,6 +1788,9 @@ public class TextParser extends Parser {
|
||||||
if (headerNode != null) {
|
if (headerNode != null) {
|
||||||
//Create header element
|
//Create header element
|
||||||
Element headerElement = converter.createElement("header");
|
Element headerElement = converter.createElement("header");
|
||||||
|
if (marginBottom != null) {
|
||||||
|
headerElement.setAttribute("style", "margin-bottom:"+getPageSc().scale(marginBottom)+";");
|
||||||
|
}
|
||||||
Node pageNode = node.getParentNode();
|
Node pageNode = node.getParentNode();
|
||||||
pageNode.insertBefore(headerElement, node);
|
pageNode.insertBefore(headerElement, node);
|
||||||
traverseBlockText(headerNode, headerElement);
|
traverseBlockText(headerNode, headerElement);
|
||||||
|
@ -1801,6 +1807,9 @@ public class TextParser extends Parser {
|
||||||
inFooter = true;
|
inFooter = true;
|
||||||
MasterPage masterPage = ofr.getFullMasterPage(currentMasterPage);
|
MasterPage masterPage = ofr.getFullMasterPage(currentMasterPage);
|
||||||
if (currentMasterPage != null) {
|
if (currentMasterPage != null) {
|
||||||
|
String pageLayoutName = masterPage.getPageLayoutName();
|
||||||
|
PageLayout pageLayout = ofr.getPageLayout(pageLayoutName);
|
||||||
|
String marginTop = pageLayout.getFooterProperty(FO_MARGIN_TOP);
|
||||||
if (pageNum % 2 == 0) {
|
if (pageNum % 2 == 0) {
|
||||||
footerNode = masterPage.getFooterLeft();
|
footerNode = masterPage.getFooterLeft();
|
||||||
}
|
}
|
||||||
|
@ -1810,6 +1819,9 @@ public class TextParser extends Parser {
|
||||||
if (footerNode != null) {
|
if (footerNode != null) {
|
||||||
//Create footer element
|
//Create footer element
|
||||||
Element footerElement = converter.createElement("footer");
|
Element footerElement = converter.createElement("footer");
|
||||||
|
if (marginTop != null) {
|
||||||
|
footerElement.setAttribute("style", "margin-top:"+getPageSc().scale(marginTop)+";");
|
||||||
|
}
|
||||||
Node pageNode = node.getParentNode();
|
Node pageNode = node.getParentNode();
|
||||||
pageNode.appendChild(footerElement);
|
pageNode.appendChild(footerElement);
|
||||||
traverseBlockText(footerNode, footerElement);
|
traverseBlockText(footerNode, footerElement);
|
||||||
|
|
Loading…
Add table
Reference in a new issue