org.apache.maven.doxia.module.rtf
Class RtfSink

java.lang.Object
  extended byorg.apache.maven.doxia.sink.AbstractSink
      extended byorg.apache.maven.doxia.sink.SinkAdapter
          extended byorg.apache.maven.doxia.module.rtf.RtfSink
All Implemented Interfaces:
LogEnabled, Markup, Sink

public class RtfSink
extends SinkAdapter

RTF Sink implementation.

Since:
1.0
Version:
$Id: RtfSink.java 785531 2009-06-17 09:47:59Z ltheussl $

Field Summary
static double DEFAULT_BOTTOM_MARGIN
          Paper bottom margin, 2 cm
static int DEFAULT_CHAR_SET
          Constant DEFAULT_CHAR_SET=0
static int DEFAULT_CODE_PAGE
          Codepage, 1252
static String DEFAULT_DATA_FORMAT
          Data format, ascii
static int DEFAULT_FONT_SIZE
          Font size, 10 pts
static String DEFAULT_IMAGE_FORMAT
          Image format, bmp
static String DEFAULT_IMAGE_TYPE
          Image type, palette
static double DEFAULT_LEFT_MARGIN
          Paper left margin, 2 cm
static double DEFAULT_PAPER_HEIGHT
          Paper height, 29.7 cm
static double DEFAULT_PAPER_WIDTH
          Paper width, 21 cm
static int DEFAULT_RESOLUTION
          Resolution, 72 dpi
static double DEFAULT_RIGHT_MARGIN
          Paper right margin, 2 cm
static int DEFAULT_SPACING
          Spacing, 10 pts
static double DEFAULT_TOP_MARGIN
          Paper top margin, 2 cm
protected  int fontSize
           
static String IMG_DATA_ASCII
          Constant IMG_DATA_ASCII="ascii"
static String IMG_DATA_RAW
          Constant IMG_DATA_RAW="raw"
static String IMG_FORMAT_BMP
          Constant IMG_FORMAT_BMP="bmp"
static String IMG_FORMAT_WMF
          Constant IMG_FORMAT_WMF="wmf"
static String IMG_TYPE_PALETTE
          Constant IMG_TYPE_PALETTE="palette"
static String IMG_TYPE_RGB
          Constant IMG_TYPE_RGB="rgb"
protected  RtfSink.Indentation indentation
           
protected  RtfSink.Space space
           
protected  OutputStream stream
           
static int STYLE_BOLD
          Constant STYLE_BOLD=2
static int STYLE_ITALIC
          Constant STYLE_ITALIC=1
static int STYLE_ROMAN
          Constant STYLE_ROMAN=0
static int STYLE_TYPEWRITER
          Constant STYLE_TYPEWRITER=3
protected  PrintWriter writer
           
 
Fields inherited from interface org.apache.maven.doxia.sink.Sink
JUSTIFY_CENTER, JUSTIFY_LEFT, JUSTIFY_RIGHT, NUMBERING_DECIMAL, NUMBERING_LOWER_ALPHA, NUMBERING_LOWER_ROMAN, NUMBERING_UPPER_ALPHA, NUMBERING_UPPER_ROMAN, ROLE, SECTION_LEVEL_1, SECTION_LEVEL_2, SECTION_LEVEL_3, SECTION_LEVEL_4, SECTION_LEVEL_5
 
Fields inherited from interface org.apache.maven.doxia.markup.Markup
COLON, EOL, EQUAL, GREATER_THAN, LEFT_CURLY_BRACKET, LEFT_SQUARE_BRACKET, LESS_THAN, MINUS, PLUS, QUOTE, RIGHT_CURLY_BRACKET, RIGHT_SQUARE_BRACKET, SEMICOLON, SLASH, SPACE, STAR
 
Constructor Summary
protected RtfSink()
          Constructor for RtfSink.
protected RtfSink(OutputStream output)
          Constructor for RtfSink.
protected RtfSink(OutputStream output, String encoding)
          Constructor for RtfSink.
 
Method Summary
 void anchor_()
          
 void anchor(String name)
          
 void author_()
          
 void author()
          
 void body_()
          
 void body()
          
 void bold_()
          
 void bold()
          
 void close()
          
 void date_()
          
 void date()
          
 void definedTerm_()
          
 void definedTerm()
          
 void definition_()
          
 void definition()
          
 void definitionList_()
          
 void definitionList()
          
 void definitionListItem_()
          
 void definitionListItem()
          
 void figure_()
          
 void figure()
          
 void figureCaption_()
          
 void figureCaption()
          
 void figureGraphics(String name)
          
 void flush()
          
protected  Font getFont(int style, int size)
          getFont.
 void head_()
          
 void head()
          
 void horizontalRule()
          
 void italic_()
          
 void italic()
          
 void lineBreak()
          
 void link_()
          
 void link(String name)
          
 void list_()
          
 void list()
          
 void listItem_()
          
 void listItem()
          
 void monospaced_()
          
 void monospaced()
          
 void nonBreakingSpace()
          
 void numberedList_()
          
 void numberedList(int numbering)
          
 void numberedListItem_()
          
 void numberedListItem()
          
 void pageBreak()
          
 void paragraph_()
          
 void paragraph()
          
 void section1_()
          
 void section1()
          
 void section2_()
          
 void section2()
          
 void section3_()
          
 void section3()
          
 void section4_()
          
 void section4()
          
 void section5_()
          
 void section5()
          
 void sectionTitle_()
          
 void sectionTitle()
          
 void setBottomMargin(double margin)
          Setter for the field bottomMargin.
 void setCharSet(int cs)
          Setter for the field charSet.
 void setCodePage(int cp)
          Setter for the field codePage.
 void setFontSize(int size)
          Setter for the field fontSize.
 void setImageCompression(boolean compression)
          Setter for the field imageCompression.
 void setImageDataFormat(String format)
          Setter for the field imageDataFormat.
 void setImageFormat(String format)
          Setter for the field imageFormat.
 void setImageType(String type)
          Setter for the field imageType.
 void setLeftMargin(double margin)
          Setter for the field leftMargin.
 void setPaperSize(double width, double height)
          setPaperSize.
 void setResolution(int resolution)
          Setter for the field resolution.
 void setRightMargin(double margin)
          Setter for the field rightMargin.
 void setSpacing(int spacing)
          setSpacing.
 void setTopMargin(double margin)
          Setter for the field topMargin.
 void table_()
          
 void table()
          
 void tableCaption_()
          
 void tableCaption()
          
 void tableCell_()
          
 void tableCell()
          
 void tableHeaderCell_()
          
 void tableHeaderCell()
          
 void tableRow_()
          
 void tableRow()
          
 void tableRows_()
          
 void tableRows(int[] justification, boolean grid)
          
 void text(String text)
          
 void title_()
          
 void title()
          
protected  int toTwips(double length, int unit)
          toTwips.
 void unknown(String name, Object[] requiredParams, SinkEventAttributes attributes)
           Unkown events just log a warning message but are ignored otherwise.
 void verbatim_()
          
 void verbatim(boolean boxed)
          
 
Methods inherited from class org.apache.maven.doxia.sink.SinkAdapter
anchor, author, body, comment, date, definedTerm, definition, definitionList, definitionListItem, figure, figureCaption, figureGraphics, head, horizontalRule, lineBreak, link, list, listItem, numberedList, numberedListItem, paragraph, rawText, section_, section, sectionTitle_, sectionTitle, sectionTitle1_, sectionTitle1, sectionTitle2_, sectionTitle2, sectionTitle3_, sectionTitle3, sectionTitle4_, sectionTitle4, sectionTitle5_, sectionTitle5, table, tableCaption, tableCell, tableCell, tableHeaderCell, tableHeaderCell, tableRow, text, title, verbatim
 
Methods inherited from class org.apache.maven.doxia.sink.AbstractSink
enableLogging, getLog, unifyEOLs
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_PAPER_WIDTH

public static final double DEFAULT_PAPER_WIDTH
Paper width, 21 cm

See Also:
Constant Field Values

DEFAULT_PAPER_HEIGHT

public static final double DEFAULT_PAPER_HEIGHT
Paper height, 29.7 cm

See Also:
Constant Field Values

DEFAULT_TOP_MARGIN

public static final double DEFAULT_TOP_MARGIN
Paper top margin, 2 cm

See Also:
Constant Field Values

DEFAULT_BOTTOM_MARGIN

public static final double DEFAULT_BOTTOM_MARGIN
Paper bottom margin, 2 cm

See Also:
Constant Field Values

DEFAULT_LEFT_MARGIN

public static final double DEFAULT_LEFT_MARGIN
Paper left margin, 2 cm

See Also:
Constant Field Values

DEFAULT_RIGHT_MARGIN

public static final double DEFAULT_RIGHT_MARGIN
Paper right margin, 2 cm

See Also:
Constant Field Values

DEFAULT_FONT_SIZE

public static final int DEFAULT_FONT_SIZE
Font size, 10 pts

See Also:
Constant Field Values

DEFAULT_SPACING

public static final int DEFAULT_SPACING
Spacing, 10 pts

See Also:
Constant Field Values

DEFAULT_RESOLUTION

public static final int DEFAULT_RESOLUTION
Resolution, 72 dpi

See Also:
Constant Field Values

DEFAULT_IMAGE_FORMAT

public static final String DEFAULT_IMAGE_FORMAT
Image format, bmp

See Also:
Constant Field Values

DEFAULT_IMAGE_TYPE

public static final String DEFAULT_IMAGE_TYPE
Image type, palette

See Also:
Constant Field Values

DEFAULT_DATA_FORMAT

public static final String DEFAULT_DATA_FORMAT
Data format, ascii

See Also:
Constant Field Values

DEFAULT_CODE_PAGE

public static final int DEFAULT_CODE_PAGE
Codepage, 1252

See Also:
Constant Field Values

DEFAULT_CHAR_SET

public static final int DEFAULT_CHAR_SET
Constant DEFAULT_CHAR_SET=0

See Also:
Constant Field Values

IMG_FORMAT_BMP

public static final String IMG_FORMAT_BMP
Constant IMG_FORMAT_BMP="bmp"

See Also:
Constant Field Values

IMG_FORMAT_WMF

public static final String IMG_FORMAT_WMF
Constant IMG_FORMAT_WMF="wmf"

See Also:
Constant Field Values

IMG_TYPE_PALETTE

public static final String IMG_TYPE_PALETTE
Constant IMG_TYPE_PALETTE="palette"

See Also:
Constant Field Values

IMG_TYPE_RGB

public static final String IMG_TYPE_RGB
Constant IMG_TYPE_RGB="rgb"

See Also:
Constant Field Values

IMG_DATA_ASCII

public static final String IMG_DATA_ASCII
Constant IMG_DATA_ASCII="ascii"

See Also:
Constant Field Values

IMG_DATA_RAW

public static final String IMG_DATA_RAW
Constant IMG_DATA_RAW="raw"

See Also:
Constant Field Values

STYLE_ROMAN

public static final int STYLE_ROMAN
Constant STYLE_ROMAN=0

See Also:
Constant Field Values

STYLE_ITALIC

public static final int STYLE_ITALIC
Constant STYLE_ITALIC=1

See Also:
Constant Field Values

STYLE_BOLD

public static final int STYLE_BOLD
Constant STYLE_BOLD=2

See Also:
Constant Field Values

STYLE_TYPEWRITER

public static final int STYLE_TYPEWRITER
Constant STYLE_TYPEWRITER=3

See Also:
Constant Field Values

fontSize

protected int fontSize

indentation

protected RtfSink.Indentation indentation

space

protected RtfSink.Space space

writer

protected PrintWriter writer

stream

protected OutputStream stream
Constructor Detail

RtfSink

protected RtfSink()
           throws IOException

Constructor for RtfSink.

Throws:
IOException - if any

RtfSink

protected RtfSink(OutputStream output)
           throws IOException

Constructor for RtfSink.

Parameters:
output - not null
Throws:
IOException - if any

RtfSink

protected RtfSink(OutputStream output,
                  String encoding)
           throws IOException

Constructor for RtfSink.

Parameters:
output - not null
encoding - a valid charset
Throws:
IOException - if any
Method Detail

setPaperSize

public void setPaperSize(double width,
                         double height)
setPaperSize.

Parameters:
width - in cm.
height - in cm.

setTopMargin

public void setTopMargin(double margin)

Setter for the field topMargin.

Parameters:
margin - margin.

setBottomMargin

public void setBottomMargin(double margin)

Setter for the field bottomMargin.

Parameters:
margin - margin.

setLeftMargin

public void setLeftMargin(double margin)

Setter for the field leftMargin.

Parameters:
margin - margin

setRightMargin

public void setRightMargin(double margin)

Setter for the field rightMargin.

Parameters:
margin - margin

setFontSize

public void setFontSize(int size)

Setter for the field fontSize.

Parameters:
size - in pts

setSpacing

public void setSpacing(int spacing)

setSpacing.

Parameters:
spacing - in pts.

setResolution

public void setResolution(int resolution)

Setter for the field resolution.

Parameters:
resolution - in dpi

setImageFormat

public void setImageFormat(String format)

Setter for the field imageFormat.

Parameters:
format -

setImageType

public void setImageType(String type)

Setter for the field imageType.

Parameters:
type -

setImageDataFormat

public void setImageDataFormat(String format)

Setter for the field imageDataFormat.

Parameters:
format -

setImageCompression

public void setImageCompression(boolean compression)

Setter for the field imageCompression.

Parameters:
compression -

setCodePage

public void setCodePage(int cp)

Setter for the field codePage.

Parameters:
cp -

setCharSet

public void setCharSet(int cs)

Setter for the field charSet.

Parameters:
cs -

head

public void head()


head_

public void head_()


toTwips

protected int toTwips(double length,
                      int unit)

toTwips.

Parameters:
length - a double.
unit - a int.
Returns:
a int.

title

public void title()


title_

public void title_()


author

public void author()


author_

public void author_()


date

public void date()


date_

public void date_()


body

public void body()


body_

public void body_()


section1

public void section1()


section1_

public void section1_()


section2

public void section2()


section2_

public void section2_()


section3

public void section3()


section3_

public void section3_()


section4

public void section4()


section4_

public void section4_()


section5

public void section5()


section5_

public void section5_()


sectionTitle

public void sectionTitle()


sectionTitle_

public void sectionTitle_()


list

public void list()


list_

public void list_()


listItem

public void listItem()


listItem_

public void listItem_()


numberedList

public void numberedList(int numbering)


numberedList_

public void numberedList_()


numberedListItem

public void numberedListItem()


numberedListItem_

public void numberedListItem_()


definitionList

public void definitionList()


definitionList_

public void definitionList_()


definitionListItem

public void definitionListItem()


definitionListItem_

public void definitionListItem_()


definedTerm

public void definedTerm()


definedTerm_

public void definedTerm_()


definition

public void definition()


definition_

public void definition_()


table

public void table()


table_

public void table_()


tableRows

public void tableRows(int[] justification,
                      boolean grid)


tableRows_

public void tableRows_()


tableRow

public void tableRow()


tableRow_

public void tableRow_()


tableHeaderCell

public void tableHeaderCell()


tableHeaderCell_

public void tableHeaderCell_()


tableCell

public void tableCell()


tableCell_

public void tableCell_()


tableCaption

public void tableCaption()


tableCaption_

public void tableCaption_()


paragraph

public void paragraph()


paragraph_

public void paragraph_()


verbatim

public void verbatim(boolean boxed)


verbatim_

public void verbatim_()


figure

public void figure()


figure_

public void figure_()


figureGraphics

public void figureGraphics(String name)


figureCaption

public void figureCaption()


figureCaption_

public void figureCaption_()


horizontalRule

public void horizontalRule()


pageBreak

public void pageBreak()


anchor

public void anchor(String name)


anchor_

public void anchor_()


link

public void link(String name)


link_

public void link_()


italic

public void italic()


italic_

public void italic_()


bold

public void bold()


bold_

public void bold_()


monospaced

public void monospaced()


monospaced_

public void monospaced_()


lineBreak

public void lineBreak()


nonBreakingSpace

public void nonBreakingSpace()


text

public void text(String text)


unknown

public void unknown(String name,
                    Object[] requiredParams,
                    SinkEventAttributes attributes)
Unkown events just log a warning message but are ignored otherwise.

See Also:
Sink.unknown(String,Object[],SinkEventAttributes)

getFont

protected Font getFont(int style,
                       int size)

getFont.

Parameters:
style - a int.
size - a int.
Returns:
a Font object.

flush

public void flush()


close

public void close()



Copyright © 2005-2009 The Apache Software Foundation. All Rights Reserved.