1 17 18 19 20 package org.apache.fop.layoutmgr.inline; 21 22 import org.apache.fop.fo.flow.PageNumberCitationLast; 23 import org.apache.fop.area.PageViewport; 24 import org.apache.fop.area.Resolvable; 25 import org.apache.fop.area.inline.InlineArea; 26 import org.apache.fop.area.inline.UnresolvedPageNumber; 27 import org.apache.fop.area.inline.TextArea; 28 import org.apache.fop.layoutmgr.LayoutContext; 29 import org.apache.fop.layoutmgr.LayoutManager; 30 31 34 public class PageNumberCitationLastLayoutManager extends PageNumberCitationLayoutManager { 35 36 private PageNumberCitationLast fobj; 37 38 44 public PageNumberCitationLastLayoutManager(PageNumberCitationLast node) { 45 super(node); 46 fobj = node; 47 } 48 49 50 public InlineArea get(LayoutContext context) { 51 curArea = getPageNumberCitationLastInlineArea(parentLM); 52 return curArea; 53 } 54 55 59 private InlineArea getPageNumberCitationLastInlineArea(LayoutManager parentLM) { 60 TextArea text = null; 61 resolved = false; 62 if (!getPSLM().associateLayoutManagerID(fobj.getRefId())) { 63 text = new UnresolvedPageNumber(fobj.getRefId(), font, UnresolvedPageNumber.LAST); 64 getPSLM().addUnresolvedArea(fobj.getRefId(), (Resolvable)text); 65 String str = "MMM"; int width = getStringWidth(str); 67 text.setIPD(width); 68 } else { 69 PageViewport page = getPSLM().getLastPVWithID(fobj.getRefId()); 70 String str = page.getPageNumberString(); 71 text = new TextArea(); 73 int width = getStringWidth(str); 74 text.addWord(str, 0); 75 text.setIPD(width); 76 77 resolved = true; 78 } 79 80 updateTextAreaTraits(text); 81 82 return text; 83 } 84 } 85 | Popular Tags |