1 17 18 19 20 package org.apache.fop.fo; 21 22 import org.apache.fop.fo.properties.CommonBorderPaddingBackground; 23 import org.apache.fop.util.CharUtilities; 24 import java.util.NoSuchElementException ; 25 26 30 public class InlineCharIterator extends RecursiveCharIterator { 31 private boolean startBoundary = false; 32 private boolean endBoundary = false; 33 34 39 public InlineCharIterator(FObj fobj, CommonBorderPaddingBackground bpb) { 40 super(fobj); 41 checkBoundaries(bpb); 42 } 43 44 45 private void checkBoundaries(CommonBorderPaddingBackground bpb) { 46 53 startBoundary = true; 54 endBoundary = true; 55 } 56 57 60 public boolean hasNext() { 61 if (startBoundary) { 62 return true; 63 } 64 return (super.hasNext() || endBoundary); 65 69 } 70 71 75 public char nextChar() throws NoSuchElementException { 76 if (startBoundary) { 77 startBoundary = false; 78 return CharUtilities.CODE_EOT; 79 } 80 try { 81 return super.nextChar(); 82 } catch (NoSuchElementException e) { 83 if (endBoundary) { 86 endBoundary = false; 87 return CharUtilities.CODE_EOT; 88 } else { 89 throw e; 90 } 91 } 92 } 93 } 94 95 | Popular Tags |