@Override public boolean parse( final RTFParser parser, final Node node, final int value ) throws IOException, TemplateException { // return until we are past the parent Underline return !(node.getLastChild() instanceof Formatting.Underline); } },
@Override public boolean parse( final RTFParser parser, final Node node, final int value ) throws IOException, TemplateException { if( value == 0 ) { // return until we are past the parent Underline return !(node.getLastChild() instanceof Formatting.Underline); //isLastNode( node, Formatting.Underline.class ); } else if( node instanceof TextNode ) { // Skip until the node is not a TextNode return true; } else { parser.parse( node, new Formatting.Underline() ); } return false; } },
@Override public boolean parse( final RTFParser parser, final Node node, final int value ) throws IOException, TemplateException { if( value == 0 ) { // return until we are past the parent Underline //return isLastNode( node, Formatting.Bold.class ); return !(node.getLastChild() instanceof Formatting.Bold); } else if( node instanceof TextNode ) { // Skip until the node is not a TextNode return true; } parser.parse( node, new Formatting.Bold() ); return false; } },
@Override public boolean parse( final RTFParser parser, final Node node, final int value ) throws IOException, TemplateException { if( value == 0 ) { // return until we are past the parent Underline //return isLastNode( node, Formatting.Italic.class ); return !(node.getLastChild() instanceof Formatting.Italic); } else if( node instanceof TextNode ) { // Skip until the node is not a TextNode return true; } parser.parse( node, new Formatting.Italic() ); return false; } },
@Override public boolean parse( final RTFParser parser, final Node node, final int value ) throws IOException, TemplateException { if( value == 0 ) { // return until we are past the parent Underline //return isLastNode( node, Formatting.Strike.class ); return !(node.getLastChild() instanceof Formatting.Strike); } else if( node instanceof TextNode ) { // Skip until the node is not a TextNode return true; } parser.parse( node, new Formatting.Strike() ); return false; } },
@Override public boolean parse( final RTFParser parser, final Node node, final int value ) throws IOException, TemplateException { if( node instanceof TextNode ) { // Skip until the node is not a TextNode return true; } if( value == 1 ) { parser.parse( node, new Formatting.Strike() ); } else { return !(node.getLastChild() instanceof Formatting.Strike); } return false; } },
private boolean lineBreak( final Node<ModelVisitor> node, final int forward ) throws IOException, TemplateException { if( !(node instanceof Section || node instanceof SubSection.Paragraph) ) { // Skip until the node is the Document node as this is a top level node return true; } buffer.moveForward( forward ); // Don't include a line break if the last node was a SubSection or a List final Node<ModelVisitor> prev = node.getLastChild(); if( !(prev instanceof SubSection || prev instanceof Lists) ) { add( node, new SubSection.LineBreak() ); } return false; }