org.pz.platypus.plugin.pdf.commands
Class PdfCodeWithOptions

java.lang.Object
  extended by org.pz.platypus.commands.CodeWithOptions
      extended by org.pz.platypus.plugin.pdf.commands.PdfCodeWithOptions
All Implemented Interfaces:
IOutputCommand

public class PdfCodeWithOptions
extends CodeWithOptions
implements IOutputCommand

Begin a code section or code listing, with options controlling the line count To be added: - the language for use in syntax highlighting - file location to extract from a source file Status of implementation: TO DO: Currently, line number is hard-coded to a max of three digits. Need error routines (and defaults) in case parameters are in error.

Author:
alb

Field Summary
 
Fields inherited from class org.pz.platypus.commands.CodeWithOptions
params, root, tokenParam
 
Constructor Summary
PdfCodeWithOptions()
           
 
Method Summary
private  void emitCode(float fontSize, PdfData pdd, Token tok)
          Emits code
private  void emitLineMarker(PdfOutfile outfile)
          Emit the marker for a line with no number
private  void emitLineNumber(PdfData pdd)
          Emit the line number for a listing line
private  void emitNewLine(PdfOutfile outfile)
          Emits a CR or CR/LF to the PDF outfile.
private  boolean endOfCode(Token tok)
          At the [-code] token? (So, at end of code?)
private  boolean isBlankLine(Token t)
          Is the token a blank line (so, [CR]) ?
private  boolean isText(Token t)
          Is the token text?
 int process(IOutputContext context, Token tok, int tokNum)
          method for processing this command in the output plugin.
protected  void switchToCodeMode(PdfData pdd, Token tok, int tokNum)
          Code mode means saving the current format and switching to a code font.
 
Methods inherited from class org.pz.platypus.commands.CodeWithOptions
getRoot, parseSkipLineNumber, parseStartingLineNumber, preProcess
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.pz.platypus.interfaces.IOutputCommand
getRoot
 

Constructor Detail

PdfCodeWithOptions

public PdfCodeWithOptions()
Method Detail

process

public int process(IOutputContext context,
                   Token tok,
                   int tokNum)
Description copied from interface: IOutputCommand
method for processing this command in the output plugin.

Specified by:
process in interface IOutputCommand
Parameters:
context - the context/state of the output document
tok - the command token as found in the token stream
tokNum - the number of the token in the token list

emitCode

private void emitCode(float fontSize,
                      PdfData pdd,
                      Token tok)
Emits code


emitNewLine

private void emitNewLine(PdfOutfile outfile)
Emits a CR or CR/LF to the PDF outfile.

Parameters:
outfile - to which newLine is written

isText

private boolean isText(Token t)
Is the token text?

Parameters:
t - the token
Returns:
true if text, false otherwise

isBlankLine

private boolean isBlankLine(Token t)
Is the token a blank line (so, [CR]) ?

Parameters:
t - Token
Returns:
true if blank line, false otherwise

emitLineNumber

private void emitLineNumber(PdfData pdd)
Emit the line number for a listing line

Parameters:
pdd - PDF data block

emitLineMarker

private void emitLineMarker(PdfOutfile outfile)
Emit the marker for a line with no number

Parameters:
outfile - the name of the PDF outfile

endOfCode

private boolean endOfCode(Token tok)
At the [-code] token? (So, at end of code?)

Parameters:
tok - current token
Returns:
true if at [-code], false otherwise

switchToCodeMode

protected void switchToCodeMode(PdfData pdd,
                                Token tok,
                                int tokNum)
Code mode means saving the current format and switching to a code font.

Parameters:
pdd - PDF data
tok - token
tokNum - token number of token in the token list.


Copyright © 2008-10 Pacific Data Works LLC