protected List<Area> layoutISDInstance(Element e, LayoutState ls) { List<Area> areas = new java.util.ArrayList<Area>(); try { double begin = Double.parseDouble(e.getAttribute("begin")); double end = Double.parseDouble(e.getAttribute("end")); Extent cellResolution = parseCellResolution(Documents.getAttribute(e, ttpCellResolutionAttrName, null)); if (cellResolution == null) cellResolution = defaults.getCellResolution(); ls.pushCanvas(e, begin, end, cellResolution); Extent extent = ls.getExternalExtent(); double w = extent.getWidth(); double h = extent.getHeight(); boolean clip = ls.getExternalOverflow().clips(); ls.pushViewport(e, w, h, clip); WritingMode wm = ls.getExternalWritingMode(); TransformMatrix ctm = ls.getExternalTransform(); ls.pushReference(e, 0, 0, w, h, wm, ctm); for (Element c : getChildElements(e)) { if (isElement(c, isdRegionElementName)) layoutRegion(c, ls); else if (isElement(c, isdComputedStyleSetElementName)) ls.saveStyles(c); } ls.pop(); ls.pop(); areas.add(ls.pop()); } catch (NumberFormatException x) { } return areas; }
protected void layoutRegion(Element e, LayoutState ls) { Extent extent = ls.getExtent(e); double w = extent.getWidth(); double h = extent.getHeight(); Point origin = ls.getPosition(e, extent); double x = origin.getX(); double y = origin.getY(); boolean clip = ls.getOverflow(e).clips(); ls.pushViewport(e, w, h, clip); WritingMode wm = ls.getWritingMode(e); TransformMatrix ctm = ls.getTransform(e); ls.pushReference(e, x, y, w, h, wm, ctm); for (Element c : getChildElements(e)) { if (isElement(c, ttBodyElementName)) layoutBody(c, ls); } AreaNode r = ls.peek(); if (r instanceof ReferenceArea) alignBlockAreas((ReferenceArea) r, ls.getReferenceAlignment()); ls.pop(); ls.pop(); }