log.error("Passed null sectPr?!");
return;
}
List<CTRel> hdrFtrRefs = null;
BooleanDefaultTrue titlePage = null;
if (sectPr.getType()!=null
&& "continuous".equals(sectPr.getType().getVal())) {
// If this is a continuous section, use the headers/footers from the previous section!
log.debug("this is a continuous section");
if (previousHF!=null) {
// for a continuous sectPr, ignore the stuff in this sectPr,
// by taking our settings from previousHF
firstHeaderActive=previousHF.firstHeaderActive;
firstHeader=previousHF.firstHeader;
firstFooterActive=previousHF.firstFooterActive;
firstFooter=previousHF.firstFooter;
evenHeader=previousHF.evenHeader;
evenFooter=previousHF.evenFooter;
defaultHeader=previousHF.defaultHeader;
defaultFooter=previousHF.defaultFooter;
return;
}
}
// The usual non-continuous case
// (or first sectPr in docx is continuous - maybe the docx starts with columns?)
if (previousHF==null) {
log.debug("previousHF==null");
previousHF= new HeaderFooterPolicy();
}
hdrFtrRefs = sectPr.getEGHdrFtrReferences();
titlePage = sectPr.getTitlePg();
// Headers.
// Init from previousHF
firstHeader = previousHF.firstHeader;
if (titlePage!=null && titlePage.isVal() ) {
firstHeaderActive = previousHF.firstHeader;
}
defaultHeader = previousHF.defaultHeader;
evenHeader = previousHF.evenHeader;
// and overwrite with whatever we have
// specific to this sectPr
setHeaderReferences(hdrFtrRefs, rels, titlePage );
// Now, same for Footers.
// Init from previousHF
firstFooter = previousHF.firstFooter;
if (titlePage!=null && titlePage.isVal() ) {
firstFooterActive = previousHF.firstFooter;
}
defaultFooter = previousHF.defaultFooter;
evenFooter = previousHF.evenFooter;
// and overwrite with whatever we have
// specific to this sectPr
setFooterReferences(hdrFtrRefs, rels, titlePage );
if ((titlePage != null) && (titlePage.isVal())) {
if (firstHeaderActive == null) {
firstHeaderActive = getDummyHeader();
}
if (firstFooterActive == null) {
firstFooterActive = getDummyFooter();