Changeset 1601 for trunk/docx4j/src/main
- Timestamp:
- 07/09/11 04:22:08 (11 months ago)
- Location:
- trunk/docx4j/src/main/java/org/docx4j/model/structure
- Files:
-
- 3 edited
-
HeaderFooterPolicy.java (modified) (1 diff)
-
PageDimensions.java (modified) (7 diffs)
-
SectionWrapper.java (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/docx4j/src/main/java/org/docx4j/model/structure/HeaderFooterPolicy.java
r1353 r1601 99 99 // Grab what headers and footers have been defined 100 100 if (sectPr == null) { 101 log.debug("No headers/footers in this sectPr"); 101 102 return; 102 103 } -
trunk/docx4j/src/main/java/org/docx4j/model/structure/PageDimensions.java
r1580 r1601 23 23 import java.math.BigInteger; 24 24 25 import org.apache.log4j.Logger; 25 26 import org.docx4j.jaxb.Context; 26 27 import org.docx4j.wml.STPageOrientation; … … 44 45 public class PageDimensions { 45 46 47 protected static Logger log = Logger.getLogger(PageDimensions.class); 48 46 49 // TODO - defaults page size and margins in a .properties file? 47 50 … … 75 78 76 79 if (pgSz == null) { 80 log.warn("No pgSz in this section; defaulting."); 77 81 pgSz = Context.getWmlObjectFactory().createSectPrPgSz(); 82 setPgSize(PageSizePaper.A4, false ); 78 83 } else { 79 84 this.pgSz = pgSz; … … 81 86 82 87 if (pgMar ==null) { 88 log.warn("No pgMar in this section; defaulting."); 83 89 pgMar = Context.getWmlObjectFactory().createSectPrPgMar(); 90 setMargins(MarginsWellKnown.NORMAL); 84 91 } else { 85 92 this.pgMar = pgMar; … … 261 268 * space occupied), it may be possible to do this automatically. 262 269 * 263 */ 264 265 public int getHeaderExtent() { 270 * ------------------ 271 * 272 * pgMar.header is the distance from the top edge of the paper to the top edge of the header 273 * 274 * in XSL FO, extent is the inline-progression-dimension of the region-start or region-end 275 * or the block-progression-dimension of the region-before or region-after. 276 */ 277 278 /** 279 * Get the distance from the top edge of the paper to the top edge of the header 280 */ 281 public int getHeaderMargin() { 266 282 if (pgMar.getHeader()==null 267 283 || pgMar.getHeader().intValue() ==0 ) { … … 272 288 } 273 289 274 public int getFooterExtent() { 290 /** 291 * Get the distance from the bottom edge of the paper to the bottom edge of the footer 292 */ 293 public int getFooterMargin() { 275 294 if (pgMar.getFooter()==null 276 295 || pgMar.getFooter().intValue() ==0 ) { … … 281 300 } 282 301 302 int headerExtent = 708; 303 /** 304 * Get the height of the header. In Word, the size of header and footer areas can change dynamically; 305 * for PDF output, you need to set this appropriately. It defaults to 708 TWIPs 306 */ 307 public int getHeaderExtent() { 308 return headerExtent; 309 } 310 public void setHeaderExtent(int headerExtent) { 311 this.headerExtent = headerExtent; 312 } 313 314 int footerExtent = 708; 315 /** 316 * Get the height of the footer. In Word, the size of header and footer areas can change dynamically; 317 * for PDF output, you need to set this appropriately. It defaults to 708 TWIPs 318 */ 319 public int getFooterExtent() { 320 return footerExtent; 321 } 322 public void setFooterExtent(int footerExtent) { 323 this.footerExtent = footerExtent; 324 } 325 283 326 } -
trunk/docx4j/src/main/java/org/docx4j/model/structure/SectionWrapper.java
r1567 r1601 21 21 22 22 23 import org.apache.log4j.Logger; 23 24 import org.docx4j.openpackaging.parts.relationships.RelationshipsPart; 24 25 import org.docx4j.wml.SectPr; … … 26 27 public class SectionWrapper { 27 28 29 protected static Logger log = Logger.getLogger(SectionWrapper.class); 30 28 31 protected SectionWrapper(SectPr sectPr, HeaderFooterPolicy previousHF, RelationshipsPart rels) { 29 32 // This should work even if sectPr is null 30 33 this.sectPr = sectPr; 34 if (sectPr==null) { 35 log.warn("No (document level?) sectPr!"); 36 } 31 37 this.headerFooterPolicy = new HeaderFooterPolicy(sectPr, previousHF, rels); 32 38
Note: See TracChangeset
for help on using the changeset viewer.
